@thedevs · Post #2073 · 22.08.2023 г., 10:22
Thoughts on Elixir, Phoenix and LiveView after 18 months of commercial use. #article#elixir @thedevs https://thedevs.link/u1toL1
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #241 · 5 мај
Можно ли в Python создавать бинарные файлы? Конечно можно. Для этого в Python есть следующие инструменты: ▫️ тип данных bytes и bytearray ▫️ открытие файла в режиме wb (write binary) или rb (read binary) ▫️ модуль struct Про модуль struct поговорим в первую очередь. Файл в формате JSON или Yaml внутри себя содержит разметку данных. Всегда можно определить где список начался а где закончился. Где записана строка а где словарь. То есть формат записи данных содержит в себе элементы разметки данных. В binary-файле данные не имеют визуальной разметки. Это просто байты, записанные один за другим. Правила записи и чтения находятся вне файла. Модуль struct как раз и помогает с организацией данных в таком файле с помощью определения форматов записи для разных частей файла. Модуль struct преобразует Python-объекты в массив байт, готовый к записи в файл и имеющий определённый вид. Для этого всегда следует указывать формат преобразования (или, как оно здесь называется - запаковки). Формат нужен для того, чтобы выделить достаточное количество байт для записи конкретного типа объекта. В последствии с помощью того же формата будет производиться чтение. При этом следует помнить что мы говорим о типах языка С а не Python. Именно формат определяет, что записано в конкретном месте файла, число, строка или что-то еще. Вот какие токены формата у нас есть. Помимо этого, первым символом можно указать порядок байтов. На разных системах одни и те же типы данных могут записываться по-разному, поэтому желательно указать конкретный способ из доступных. Если этого не сделать, то используется символ '@', то есть нативный для текущей системы. В строке формата мы пишем в каком порядке и какие типы собираемся преобразовать в байты. Запакуем в байты простое число, токен "i". >>> import struct >>> struct.pack('=i', 10) b'\n\x00\x00\x00' Теперь несколько float, при этом нужно передавать элементы не массивом а последовательностью аргументов. >>> struct.pack('=fff', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Вместо нескольких токенов можно просто указать нужное количество элементов перед одним токеном, результат будет тот же. >>> struct.pack('=3f', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Теперь запакуем разные типы >>> data = struct.pack('=fiQ', 1.0, 4, 100500) я запаковал типы float, int и unsigned long long (очень большой int, на 8 байт) b'\x00\x00\x80?\x04\x00\x00...' Распаковка происходит аналогично, но нужно указать тот же формат, который использовался при запаковке. Результат возвращается всегда в виде кортежа. >>> struct.unpack('=fiQ', data) (1.0, 4, 100500) Как видите, ничего страшного! #lib#basic
Пребарај: #elixir
@thedevs · Post #2073 · 22.08.2023 г., 10:22
Thoughts on Elixir, Phoenix and LiveView after 18 months of commercial use. #article#elixir @thedevs https://thedevs.link/u1toL1
@thedevs · Post #1392 · 11.02.2019 г., 18:35
Benchmarking Go vs Node vs Elixir. #article#go#nodejs#elixir @thedevs https://kutt.it/WVQyLq
@githubtrending · Post #15106 · 30.08.2025 г., 13:00
#elixir#elixir#language_server_protocol#lsp Expert is the official language server for Elixir, helping your code editor understand and work with Elixir code better. You can easily install it by downloading the right version for your system or build it from source if you prefer. Expert supports the latest features through nightly builds and integrates smoothly with your editor, improving coding with features like error checking and code completion. Using Expert makes writing Elixir code faster and less error-prone, boosting your productivity and coding experience. It is open source under Apache License 2.0 and supported by sponsors, ensuring ongoing development and support. https://github.com/elixir-lang/expert
@githubtrending · Post #15032 · 06.08.2025 г., 11:30
#elixir#debug_adapter_protocol#elixir#language_server#language_server_protocol#lsp ElixirLS is a tool that helps you write and debug Elixir code more easily by providing features like code completion, go-to-definition, inline error reporting, and a powerful debugger that supports breakpoints and step-through debugging. It works with many editors and IDEs through standard protocols, making it flexible to use. It also integrates Dialyzer for static code analysis to catch bugs early and offers a server that helps AI tools understand your code better. Using ElixirLS speeds up development, improves code quality, and makes debugging simpler and more efficient. It supports recent Elixir and OTP versions and can be customized for your project needs. https://github.com/elixir-lsp/elixir-ls
@githubtrending · Post #15545 · 07.03.2026 г., 12:30
#elixir#agent#ai#artificial_intelligence#elixir#event_driven_architecture#functional_programming#orchestration#workflow Jido is a pure functional framework for Elixir to build autonomous multi-agent workflows. Agents are immutable data with a simple `cmd/2` function that transforms state purely and outputs directives for effects like signals or spawning, handled by OTP runtime. It formalizes patterns like standard signals, reusable actions, and hierarchies over raw GenServer, adding AI tools, strategies (ReAct, FSM), and supervision. You benefit by creating scalable, testable, fault-tolerant agent systems easily for production AI apps, saving reinvented code. https://github.com/agentjido/jido