Ruby net/http 내부 구조 분석: 표준 라이브러리의 네트워킹 엔진
net/http는 소켓 추상화, 요청 직렬화, 응답 파싱을 직접 처리하는 Ruby 표준 라이브러리의 정교한 네트워킹 엔진이다.
Ruby net/http 내부 구조 분석: 표준 라이브러리의 네트워킹 엔진
net/http는 소켓 추상화, 요청 직렬화, 응답 파싱을 직접 처리하는 Ruby 표준 라이브러리의 정교한 네트워킹 엔진이다.
Now this is an interesting #Python problem. I don't know if it's a #bug, but it's a change in behaviour that I don't see documented.
I upgraded from #Debian 12/Bookworm to 13/Trixie, so the default Python3 changed from 3.11 to 3.13. A script of mine broke, because `pathlib.Path.is_mount()` changed behaviour when the path is a symlink (at least to a directory).
i.e. I'm testing a path that is a symlink. The symlink points to a directory. That directory *is* a mountpoint. The `.is_mount()` test in 3.11 returned True, while in 3.13 it returns False.
This seems wrong to me. Most path-manipulation functions transparently treat symlinks as if they were the pointed-to object unless you pass an option/flag specifically to say you want the symlink itself.
Gonna have to dig to see what else I can find.
#pathlib #path #is_mount #stdlib #behaviour #symlink #filesystem #mountpoint #mount
Stdlib: A library of frameworks, templates, and guides for technical leadership
https://debuggingleadership.com/stdlib
#HackerNews #Stdlib #TechnicalLeadership #Frameworks #Templates #Guides
Brand new PEP by @emmatyping to add Zstandard to the standard library:
https://peps.python.org/pep-0784/
Will it make it in to 3.14 before the feature freeze on 2025-05-06? It'll be close but it's possible!
The PEP also suggests namespacing the other compression libraries lzma, bz2 and zlib, with a 10-year deprecation for the old names.
Join the discussion to give your support, suggestions or feedback:
https://discuss.python.org/t/pep-784-adding-zstandard-to-the-standard-library/87377
Zstandard is a widely adopted, mature, and highly efficient compression standard. This PEP proposes adding a new module to the Python standard library containing a Python wrapper around Meta’s zstd library, the default implementation. Additionally, to a...
It depends on what, exactly, you want. time.localtime() will give you a value in the system's configured #timezone. time.gmtime() will give you #UTC. The difference between those will tell you the current local time's offset from UTC.
If you want the name of the configured timezone, on many Unix-type systems, you can read /etc/timezone to get it.
If you want more specific info about a timezone, you can add an external dependency which includes (or provides access to a system-provided) database of timezone info. This stuff changes often, and is decided politically rather than technically, so it's a moving target and the #Python #stdlib doesn't try to include it. `pytz` is one such package with a fairly complete database.
And you can easily override any of these in a test framework. Using unittest.mock.MagicMock(), for example, lets you override any of the above with whatever value you want those functions to return.
Una apparente #maledizione si è appena abbattuta su di me oggi: non riesco a far funzionare un #programma C!!! 😭️
Il problema è il seguente: il programmino di ieri per pubblicare su WordPress dal #3DS funziona benissimo, ma mi sono ricordata che dal browser del 3DS non si può caricare come #foto la schermata del gioco in pausa, ma solo cose dall’album… e non tutti i giochi permettono di salvare lì. Per salvare #screenshot da qualunque gioco c’è il menù #Rosalina, ma salva foto non-JPEG e in una cartella diversa. 😪️
Ho pensato per un attimo di forkare #LumaCFW (ho controllato e nessuno lo ha fatto, almeno non per versioni recenti), e modificare la funzione di screenshot per salvare in #JPEG, ma dopo qualche prova mi sa che evito, perché è un casino: l’ambiente di esecuzione è talmente ristretto che non vanno nemmeno tutte le funzioni della #stdlib #C, quindi non è immediato far funzionare tutto. 😮💨️
La seconda opzione, più sfavorevole ma comunque decente, sarebbe un #homebrew che converte le foto da #BMP a #JPG e le mette nella cartella giusta… e ovviamente non esiste, esistono cose simili ma non questo, quindi devo farlo io. Ho trovato questa repo da cui posso semplicemente rubare il #codice di #conversione, che sul 3DS compila e quindi dovrebbe tranquillamente fungere. E però mi sto incartando su tutto il resto, cioè la navigazione tra le cartelle e la gestione dei #file (automatica, non pianifico di mettere menù o cose, deve semplicemente aprirsi, convertire, e chiudersi). #Mannaggia! 🤢️
Purtroppo C per fare cose di #utilità pratica (ossia non videogiochini, o roba tipo demo audiovisive, e così via) è #tedioso… soprattutto perché la #API della stdlib fa proprio schifo, con tutti i nomi di funzioni e tipi scritti tutti in minuscolo e spesso senza vocali perché a qualcuno pesava il culo di scrivere parole intere. E quindi finisci per creare millemila macro e funzioni intermedie di astrazioni per evitare di ripetere di continuo le stesse criptiche righe ma così vai a creare astrazioni ancora più astruse per passare i dati in giro e così via. Mi chiedo come sia possibile usarlo per fare addirittura interi sistemi operativi, #pezzi. Vabbè, oggi si soffre. 💀️
https://octospacc.altervista.org/2024/02/10/cazo/
#3DS #API #BMP #C #codice #conversione #file #foto #homebrew #JPEG #JPG #LumaCFW #maledizione #Mannaggia #pezzi #programma #Rosalina #screenshot #stdlib #tedioso
Well done, but ...
>>> import fractions
>>> fractions.Fraction(0.125)
Fraction(1, 8)
>>> fractions.Fraction(0.3333)
Fraction(6004199023210345, 18014398509481984)
>>> fractions.Fraction(0.3333).limit_denominator(1000)
Fraction(1, 3)
A lesser-known part of the #stdlib
😂