Пашок🗽
системная константа конца строки наверно есть или метод на проверку с концом стрки
Там это системная штука считки ввода, которая возвращает интовое представление символа, проблему может вызывать почти всё что угодно)) я когда парсинг файлов писал, то на маке при переносе строк вылазили всё что угодно, \n, \r и даже [abrakadabra] в разных сочетаниях
Пашок🗽
Если с таким долго долбаться можно к ООП и не дойти 🤡
Avazart
Ну так это нормально
Avazart
Файлы то разные
Andrii
Если с таким долго долбаться можно к ООП и не дойти 🤡
Как раз опыт разруливания таких задач важнее ООП.
Avazart
линуксовые переносы это чисто \n
Avazart
а в винде сочетания \r\n
Avazart
Стоит учитывать кодировку.
Пашок🗽
да какой это опыт лол)
Andrii
линуксовые переносы это чисто \n
Везде так на нормальных OS, ну а под Windows там заже специальный флаг отктытия файла есть, чтобы он не преобразовывал в возвращал \r\n Очередные грабли
Avazart
Хз про флаг не знаю.
Andrii
Хз про флаг не знаю.
https://docs.microsoft.com/ru-ru/cpp/c-runtime-library/reference/open-wopen?view=msvc-170 O_TEXT и O_BINARY
Avazart
Так это режим чтения файла
Avazart
он везде есть
Andrii
Ну... в Linux нету таких констант
Andrii
Там в принципе всё равно как ты открываешь
Andrii
А единственное назначение O_TEXT как раз преобразовывать \n\r в \n чтобы большая часть нормального s/w работала
Andrii
И O_TEXT равно 0, так что это поведение по умолчанию
Andrii
А в Linux как раз пофик как файл читать, бинарно или текстово. В чём разница?
Шаман Каган
И что будет не под Windows?
это уже другой вопрос )
Шаман Каган
вообще этот код по анализу ввода не имеет практической ценности
Шаман Каган
но человек решил упороться.....
Andrii
вообще этот код по анализу ввода не имеет практической ценности
Почему? В принципе я в 9-м классе решал много разных обработок строк на Си там был цикл char ch; while ((ch = getchar()) != EOF) { /* Тут всякая логика подсчёта слов, парсинга float, ... */ }
Avazart
у него
Avazart
Тем более у него строки вроде а не байты
Avazart
И вообще не файл.
m700
я считаю в целом неплохо обсудили 4 строчки кода. Добро пожаловать в программирование, так сказать)
Avazart
Ну тут нужно знать что автор хотел сделать
Avazart
System.in.read(); я хз как работает но по логике должен быть какой то System.in.readLine()
Avazart
Который сводит еще к меньшему кол-ву строк
m700
System.in.read(); я хз как работает но по логике должен быть какой то System.in.readLine()
я как понял там именно по символьно считать надо а не сразу строку
Avazart
Почему нет?
Avazart
Какая разница?
10658
🏆 Frontend Contest: Frontend of DEX with liquidity pools, Stage 1. Prize fund: $30 000 in Toncoins. Deadline: 18:00 on Jan, 31 (UTC). Task: Create a frontend of DEX with liquidity pools for TON Blockchain. In this stage, you need to create a working UI. Asynchronous calls to smart contracts must be mocked-up. We require a UI for exchanging one token for another token, a UI for creating a pool with two tokens, a UI for adding and removing liquidity from a pool, a UI with a list of pools and pool statistics. You can explore services like Uniswap and Pancake. You must use the Typescript+React+Redux stack. Extra dependencies and extra code are not welcome. You can't use the idea of just copying the entire open-source Uniswap code - there is a lot of unnecessary code there. When considering the design options, you can focus on the ton.org site, UI of standard wallets and bridge. You may find the brand assets page helpful. We deliberately did not give ready-made references so that you have the opportunity to rethink some things in using such services. Evaluation priorities: understandability of the code and the possibility of its further support, general correctness and speed of the application and attention to detail. Who can take part: Anyone. How do I submit: Please comment on this issue on GitHub by attaching an archive or link to the open-source code with a solution, a description of the functionality, a description of the build process, your TON address to receive an award. Submission must be under the MIT license. To avoid plagiarism, you can attach a link to a private repo to the submission, which you will make public after the deadline.
10658
🏆 Frontend Contest: Frontend of DEX with liquidity pools, Stage 1. Prize fund: $30 000 in Toncoins. Deadline: 18:00 on Jan, 31 (UTC). Task: Create a frontend of DEX with liquidity pools for TON Blockchain. In this stage, you need to create a working UI. Asynchronous calls to smart contracts must be mocked-up. We require a UI for exchanging one token for another token, a UI for creating a pool with two tokens, a UI for adding and removing liquidity from a pool, a UI with a list of pools and pool statistics. You can explore services like Uniswap and Pancake. You must use the Typescript+React+Redux stack. Extra dependencies and extra code are not welcome. You can't use the idea of just copying the entire open-source Uniswap code - there is a lot of unnecessary code there. When considering the design options, you can focus on the ton.org site, UI of standard wallets and bridge. You may find the brand assets page helpful. We deliberately did not give ready-made references so that you have the opportunity to rethink some things in using such services. Evaluation priorities: understandability of the code and the possibility of its further support, general correctness and speed of the application and attention to detail. Who can take part: Anyone. How do I submit: Please comment on this issue on GitHub by attaching an archive or link to the open-source code with a solution, a description of the functionality, a description of the build process, your TON address to receive an award. Submission must be under the MIT license. To avoid plagiarism, you can attach a link to a private repo to the submission, which you will make public after the deadline.
может кого-то заинтересует, что очень вряд-ли, конечно )
Kenin
🏆 Frontend Contest: Frontend of DEX with liquidity pools, Stage 1. Prize fund: $30 000 in Toncoins. Deadline: 18:00 on Jan, 31 (UTC). Task: Create a frontend of DEX with liquidity pools for TON Blockchain. In this stage, you need to create a working UI. Asynchronous calls to smart contracts must be mocked-up. We require a UI for exchanging one token for another token, a UI for creating a pool with two tokens, a UI for adding and removing liquidity from a pool, a UI with a list of pools and pool statistics. You can explore services like Uniswap and Pancake. You must use the Typescript+React+Redux stack. Extra dependencies and extra code are not welcome. You can't use the idea of just copying the entire open-source Uniswap code - there is a lot of unnecessary code there. When considering the design options, you can focus on the ton.org site, UI of standard wallets and bridge. You may find the brand assets page helpful. We deliberately did not give ready-made references so that you have the opportunity to rethink some things in using such services. Evaluation priorities: understandability of the code and the possibility of its further support, general correctness and speed of the application and attention to detail. Who can take part: Anyone. How do I submit: Please comment on this issue on GitHub by attaching an archive or link to the open-source code with a solution, a description of the functionality, a description of the build process, your TON address to receive an award. Submission must be under the MIT license. To avoid plagiarism, you can attach a link to a private repo to the submission, which you will make public after the deadline.
жесть
Arutemu
Кто такой IT-инженер?
Arutemu
Проблема в расплывчатом понятии, или я не правильно искал
m700
в трудовой что угодно могу понаписать или внутри компании должность придумать
Arutemu
Хорошо, пока оставлю этот вопрос
Mikoratanakaki
Optrium
Здравствуйте, есть какой-то чат по компьютерным сетям?
Калыван
https://m.rabota.ua/vacancy/view/9048418?ref=recom_similar&cre=sauron&pos=spa_vacancy_similar_profile Стоит ли вакансия потраченого времени? Просто 6,5 месяцев стажеровки довольно долго но с другой стороны перспективы
Andrey
Java
String s = "1+2+3"; String[] tokens = s.split("+"); Int res = 0; for (String t : tokens) Res += Integer.parseInt(t);
Andrey
Это цикло по типу fot str(t) in tokens:?
Это цикл по массиву стрингов, после их разделения через сплит.
m700
я бы советовал бы попробовать
Калыван
полгода нормальное время для поднятие скилла
Просто еще есть вариант пойти работать но не в этой сфере IT, а более занудной как по мне
Mikoratanakaki
String s = "1+2+3"; String[] tokens = s.split("+"); Int res = 0; for (String t : tokens) Res += Integer.parseInt(t);
А если "1 + 2 + 3", сплиту нельзя давать 2 символа на вырезку?
Mikoratanakaki
Пробелы?
Да, пробелы + знаки "+-/*", на будущее спрашиваю
Andrey
Да, пробелы + знаки "+-/*", на будущее спрашиваю
Строку можно подготовить, это тоже мини задача: google удаление пробелов из строки.
Mikoratanakaki
И еще чат, кто-то в курсе про Java марафон от Алишева, тот проект который нужно сделать в конце марафона, он показывает уровень навыка, хотя бы минимальный? Имеется ввиду, если я его осилю, я получается знаю что-то в Java? @all Кто не в курсе, могу задачу финального проекта в личку скинуть, если это можно, конечно.
Andrey
А следующая задача - обойтись без сплита. Т.е например пройтись по подготовленной строке встречаем символ + - в этом месте сами режем строку.
Mikoratanakaki
Andrey
А потом уже подумать как другие команды добавить.
Mikoratanakaki
А потом уже подумать как другие команды добавить.
Задача не из лёгких) но я попытаюсь
Пашок🗽
Лучший метод сделать калькулятор на джаве: ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("JavaScript"); String foo = "40+2"; System.out.println(engine.eval(foo));
Mikoratanakaki
Не проходил)
Влад
Здравствуйте, помогите пожалуйста Задача: Напишите запрос, который посчитает количество уникальных продуктов для каждого магазина (name_store). Назовите переменную name_uniq_cnt. Найдите три магазина, в которых число уникальных товаров наименьшее, но более тридцати. Выведите название каждого магазина и количество уникальных товаров в нём. Мой код: SELECT name_store, COUNT(DISTINCT name) AS name_uniq_cnt FROM products_data_all GROUP BY name_store, name_uniq_cnt HAVING COUNT(DISTINCT name) > 30 ORDER BY name_store, name_uniq_cnt ASC LIMIT 3;
Влад
Тут проблема в 3 строчке
Mikhail
Тут проблема в 3 строчке
В 4ой? В слове FROM?
Влад
Нет, извини , в 3
Влад
Что то не так с COUNT
Mikhail
А products_data_all.name вообще есть?
Mikhail
Что то не так с COUNT
Добавь скобки DISTINCT() Я еще вижу проблему с GROUP BY name_store, name_uniq_cnt и c ORDER BY name_store, name_uniq_cnt ASC.