Можно ли в 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
#dotnet
Najot Ta'lim jamoasi .NET ustozlari uchun vakansiya e'lon qiladi!
«Najot Ta'lim» zamonaviy AyTi markazining Toshkent filiali uchun malakali .NET mentorlar (ustozlar) qidirilmoqda. Bu aynan siz bo'lishingiz mumkin. Quyida batafsil tanishib chiqing.
Oylik maosh: soatiga 10$ dan 17$ gacha
Talablar:
• 1.5 yildan kam bo'lmagan ish tajribasi;
• O'zbek tilida erkin so'zlasha olish;
• Haftada 5 kun, kuniga 3 soat dars berish;
• Mashqlar va imtihonlar sxemalarini to'g'ri tanlay olish;
• O'quv bo'limi o'quv rejasini ishlab chiqishda yordam berish.
Takliflarimiz:
• Rasmiy mehnat faoliyati;
• Malakali mutaxasisslardan tashkil topgan katta va ahil jamoa;
• Katta tajriba orttirish imkoniyati;
• Zamonaviy hi-tech ofisdagi ish;
• Bepul treninglar, meetup'lar, workshop'lar;
• Qo'shimcha imkoniyatlar;
• Eng asosiysi, ilmga chanqoq yoshlarga dars berish.
Yuqoridagi talab va takliflar sizga ma'qul kelgan bo'lsa yoki shunday mutaxassisni tanisangiz bizga murojaat qiling. Chunki tavsiya qilgan nomzodingiz jamoamizda ish boshlasa, ma'lum bir shartlar asosida sizga ham 300$ suyunchi bor.
Sizni jamoamizda ko'rishdan mamnun bo'lamiz!
Murojaat uchun: @najottalim_recruiting
+998996150011
@mdcuzbekistan
#dotnet
Applied Labs is looking for a .Net Developer (Mid to Senior)
City: Tashkent (100% remote. Work from wherever you want or from our office at C-Space coworking in Tashkent or combine both).
Salary: $2000 - $4000
About us: Applied Labs LLC (appliedlabs.io) is a successful product development and outstaffing (staff augmentation) company focused on providing a wide range of tech solutions to the US market. The company has offices in New York, London, Moscow, and Tashkent.
Key Responsibilities:
• Proficiency in C #, .NET Framework and .NET -Core;
• Understanding how web protocols (HTTP, HTTPS) and REST / SOAP API work;
• Knowledge of MS SQL Server, Oracle, PostgreSQL: the ability to design a database structure, write and optimize SQL queries and stored procedures;
• Work experience 3+ years;
• Fluency in English (verbal and written communication);
• Bachelor's Degree in Computer Science, Engineering or related field or strong track record proving the equivalent level of experience;
• Capability to multi-task with strong attention to detail;
• Ability to work in a fast-paced, agile environment and resolving unplanned incidents quickly;
• Outstanding communication skills, including the ability to effectively present information in both technical and non-technical terms and train users using non-technical terms;
• Strong customer service focus;
• Excellent team player skills with the ability to influence others.
Skills Knowledge and Expertise
• A sound knowledge of software engineering;
• Excellent analytical skills;
• Sourcing requirements from customers and suggesting appropriate solutions;
• Quick generating of POC (proof of concepts) and demos;
• Self-motivated, proactive, independent & responsive candidate, the specialist, who requires little supervisory attention.
Benefits
• Flexible office policy - You can work from wherever you want or from our cozy office in Tashkent. You can even combine both - few days in the office and a few days remote;
• 5/2 work week, 8 hours a day;
• Official employment in accordance with Uzbekistan's Labor Laws;
• You are expected to be available for communication between 18:00 to 23:00 Tashkent time (because you'll be working with the US team located in New York);
• Frequent team-building activities and internal hackathons;
• Health insurance;
• Group exercises;
• Reimbursement for sport.
Apply here: https://appliedlabs.pinpointhq.com/en/jobs/73978
TechCells is Looking for a .NET developer to join us at our new startup.
Unnegotiable requirements:
• 5+ years of experience with .NET / C# / ASP.NET Web API
• 2+ years of experience with MongoDB
• Fluent English
Your candidacy will be prioritized if...
• You have Vue.js experience
• AI/ML experience
You will work in a small team of developers and create an online platform.
This is a fully remote work.
Salary range $2000 +
Please reach out via Telegram at @TechCellsHR
#job#dotnet
@mdcuzbekistan
✅ Завтра
MskDotNet Meetup #18
📅 28 февраля / 18:30 (время МСК) / Москва, Льва Толстого, д. 16
офис компании Яндекс
💵 Бесплатно
📝 Регистрация тут: https://goo.gl/F4RyTm
Приглашаем разработчиков на встречу сообщества MskDotNet, которая пройдёт в Московском офисе Яндекса.
В программе два доклада — про особенности настройки и маршрутизации в NGINX и использование .NET Core.
🔗 Программа: https://goo.gl/U2h5fc
#DotNet#nginx#Москва
✅ Через неделю
MskDotNet Meetup #18
📅 28 февраля / 18:30 (время МСК) / Москва, Льва Толстого, д. 16
офис компании Яндекс
💵 Бесплатно
📝 Регистрация тут: https://goo.gl/QtTBjr
Приглашаем разработчиков на встречу сообщества MskDotNet, которая пройдёт в Московском офисе Яндекса.
В программе два доклада — про особенности настройки и маршрутизации в NGINX и использование .NET Core.
🔗 Программа: https://goo.gl/hKpUze
#DotNet#nginx#Москва
.Net dasturchi
🏢 Toshkent, Ofis
💵 Maosh: $1200 dan
Batafsil ma'lumot
➖➖➖➖➖➖➖➖➖➖
.Net разработчик
🏢 Ташкент, Офис
💵 Зарплата: от $1200
Полное описание
#dotnet#toshkent
#vakansiya#dotnet#csharp
Davr Bank Middle/Senior .NET dasturchi izlamoqda
Talablar:
• C# / .NET Framework
• ASP.NET, REST API
• WCF, Windows services
• Oracle
• JSON/XML
Qo'shimcha ma'lumotlar:
• Maosh - 500$ dan 2000$ gacha
• Ish vaqti - 9:00 dan 18:00 gacha
• Hudud - Toshkent shaxri
Resume yuboring:Nodir
.NET Uzbekistan Community
______
Telegram | Instagram | Youtube
#csharp#dotnet#monorepo
The .NET Virtual Monolithic Repository (VMR) is a special place where all the code needed to build the .NET SDK is kept together. This makes it easier for developers to build and test .NET because everything is in one place. The VMR is like a mirror of other .NET repositories, so changes in those repositories are copied here. This helps simplify the process of building .NET and makes it easier for others to contribute and use the code. It also helps make the build process more transparent and reproducible for the community.
https://github.com/dotnet/dotnet
Creating a Message Broker in C#
Hello everyone! Our workshop series is making a comeback after a hiatus, and we're thrilled to announce the next session happening this upcoming Sunday. The topic on the agenda is "Creating a Message Broker in C#". Our close friend Asadbek will guide us through the process of constructing the fundamental structure of a message broker, providing valuable insights into the inner workings of message brokers like RabbitMQ, Kafka.
Stay tuned for future sessions where we'll delve into more intermediate topics related to .NET. Your active participation is encouraged, so mark your calendars, and we look forward to seeing you this Sunday!
Date: 4-February, 20:00
Link: Zoom
Speaker:Asadbek Sindarov
#messagebroker#csharp#dotnet
Telegram | Instagram | Youtube | Linkedin