Один из самых удобных способов записать данные это использование готовых форматов, такие как JSON или YAML.
Из плюсов такого подхода стоит отметить вот что:
🔸 готовый, повсеместно используемый и поддерживаемый формат
🔸 простой и понятный файл, удобочитаемый для человека
🔸 можно легко редактировать в любом текстовом редакторе без специальных программ и библиотек
Но есть и минусы
🔹 затраты времени при записи файла (кодирование данных в нужный формат строки)
🔹 затраты времени при чтении файла (декодирование данных в Python объекты)
🔹 размер файла увеличивается из-за разметки данных (скобки, запятые, переносы, отступы...)
🔹 перед записью все данные должны быть помещены в память в полном объёме (не всегда)
🔹 при чтении необходимо считать весь файл в память и только потом декодировать данные
Если нужно писать немного данных в несколько файлов, то затраты по времени не ощутимы. Обычно это файлы конфига или какие-либо метаданные. Это отличный вариант под такие задачи.
Есть и другой поход к записи файлов - это бинарные файлы. Используется, когда данных достаточно много и никто их не собирается читать глазками😳.
🔸 очень быстрая запись
🔸 чтение значительно быстрей чем JSON, YAML итд
🔸 размер файла значительно меньше, так как нет разметки
🔸 можно записывать данные по мере поступления не загружая всё в память
🔸 можно извлечь любую часть данных независимо
Из минусов
🔹 нужно определить свой формат записи данных (если не используете готовую спецификацию определённого формата)
🔹 не получится открыть файл и визуально понять что там записано, а для чтения файла потребуется знать его спецификацию.
🔹 не так-то просто создать такой файл без специальной библиотеки
В таком виде удобно записывать большой массив любых однородных данных. Например, мониторинг валютной биржи или кэшированная анимация 3D геометрии.
(Это не означает что нельзя записать данные разного типа, просто это будет не так удобно)
Представьте себе JPG-картинку. По сути это немного мета-информации и большой массив пикселей. Тоже самое со звуком или видео файлом. Поэтому, если вы попробуете открыть картинку в текстовом редакторе вы увидите что-то вроде такого
f15d cd29 a564 4578 ...
09e2 9bc4 a696 1253 ...
84e9 4de1 3b23 c24a ...
2534 5161 28e0 709d ...
...
Это и есть записанные байтики. И для их чтения требуется определённый софт который знает что с ними делать. Под каждый тип файла.
К чему это я? Читайте в следующем посте...
#tricks#basic
#UNRWA
L’Agenzia delle Nazioni Unite per il soccorso e l'occupazione dei rifugiati palestinesi nel Vicino Oriente ha avviato un’investigazione su 10 dei suoi dipendenti accusati di antisemitismo, terrorismo ed apologia di nazismo. L’accusa giunge dall’UN Watch, un’organizzazione che monitora il comportamento dell’ONU e delle sue agenzie satellite, che in un report pubblicato negli scorsi giorni ha sottolineato la violazione dei regolamenti dell’ONU e dell’UNRWA (fondati sui principi di imparzialità ed indipendenza) da parte di 22 professori facenti parte dell’agenzia dell’ONU (che si aggiungono ai 100 già individuati dall’UN Watch).
La risposta dell’UNRWA è giunta nei giorni successivi: “L’organizzazione affronta ogni accusa con serietà. Per questo motivo, abbiamo immediatamente avviato un’investigazione volta ad accertare la veridicità dei fatti. L’indagine riguarderà 10 di quei 22 professori (perché gli altri non facevano parte dell’agenzia al momento della commissione del fatto addebitato, ndr.) e sarà incentrata sull’accertamento della violazione delle policies in tema di social media dell’agenzia, che proibiscono al suo personale di incorrere in condotte online viziate da un difetto di neutralità.
👉@giurisprudentia
#Palestina#ONU
L’#UNRWA ha licenziato 9 dei suoi operatori umanitari per aver preso parte al pogrom di #Hamas del 7 ottobre in #Israele. Le evidenze di una tale condotta sono state accertate in seguito a un’indagine interna alle Nazioni Unite.
@OsservatorioEsteri
📰 Israel Seizes UNRWA’s Jerusalem Headquarters, Escalates Crackdown
Israeli officials seized the Jerusalem headquarters of the United Nations Relief and Works Agency (UNRWA), overseeing the demolition of several structures in its compound. The move marks a new escalation in Israel’s campaign against the agency, which has long been a major aid provider in the West Bank and Gaza Strip but has faced sweeping legal restrictions from Israel over the past two years.
Defiance and Denunciation
Israel’s foreign ministry defended the action, saying UNRWA “has long ceased to be a humanitarian aid organization, serving instead as a greenhouse for terrorism.” UNRWA’s chief, Philippe Lazzarini, called the move “a new level of open & deliberate defiance of international law”.
Legal and Diplomatic Clash
UNRWA was established in 1949 to aid Palestinian refugees and their descendants. Israel has passed laws banning the agency and stripping it of diplomatic immunity, even allowing the seizure of its properties. While the compound has been largely vacant since international staff left, Israeli officials entered in December and raised an Israeli flag, asserting control.
Who’s Playing by the Rules?
Israel claims the seizure is legal under both national and international law, but UNRWA insists the compound remains under U.N. protection. As the agency continues some operations in East Jerusalem, the standoff raises questions about the future of humanitarian aid and the limits of international law in the region.
#Israel#UNRWA#Jerusalem#HumanitarianAid#InternationalLaw#MiddleEast
📱American Оbserver - Stay up to date on all important events
🇺🇸
💔🇵🇸#The#Rafah#Holocaust
Horrific scenes is unfolding of the massacre committed by the criminal #Israeli occupation army with 8 missiles targeting displaced people in the vicinity of the #UNRWA agency's headquarters, northwest of Rafah, southern #Gaza
First footage depicts the moment when #Israeli occupation aircraft dropped missiles at displaced Palestinians' barracks belonging to the #UNRWA site in the Tal Al-Sultan area of Rafah City, killing more than 50 displaced civilians, including innocent children.
A child's head and legs were decapitated due to #Israeli missiles dropped on a displacement center in Rafah, where entire families were completely wiped out in this massacre, with women, children, and the elderly burned to death.
Civil Defense to Al Jazeera:
"We believe that the occupation army used internationally prohibited weapons to target the displaced in Rafah, judging by the size of the fires that erupted at the targeted site."
@The Children of Gaza
🇮🇱⚔️🇵🇸🇺🇳ALLARME A GERUSALEMME.
Ore 5 del mattino. Israele entra con i bulldozer nel compound dell’UNRWA, l’agenzia ONU per i rifugiati palestinesi. Magazzini demoliti. Aiuti umanitari sepolti. Medicine e cibo per Gaza e Cisgiordania, distrutti.
Il commissario ONU Lazzarini: "Un attacco senza precedenti. Un nuovo livello di violazione del diritto internazionale."
Israele dice: "È legale."
Guardiamo i fatti:
Ottobre 2024: Israele vieta all’UNRWA di operare.
Dicembre 2024: Revoca l’immunità diplomatica all’ONU.
Gennaio 2025: Chiude l’ospedale UNRWA nel Quartiere Musulmano.
Oggi demolisce.
È un piano chiaro. Sradicare ogni presenza internazionale. Ogni baluardo di umanità.
Per riscrivere la storia. Per cancellare il diritto al ritorno.
Il messaggio è: "Qui non avete più nessuno. Nemmeno l’ONU vi protegge."
Fermare l’apartheid è dovere di ogni coscienza.
#GerusalemmeEst#UNRWA#ApartheidIsraeliano#StopGenocidio#PalestinaLibera ResistenzaDigitale FreePalestine