开发者
编程技术、框架工具、最佳实践
共 7333 篇 · 第 254/367 页
CraftsmanSHIP. Not CraftsmanSHIT.
submitted by /u/fagnerbrack [link] [留言]
New way of making espresso with ultrasound
Mirlo
Social media for real connections. No likes, no algorithm. Discussion | Link
How to Test a Food Delivery App: 30 Test Cases from Order to Doorstep
Every food delivery app has the same promise: you tap a button, food shows up at your door. Testing...
I Built a Mini Message Broker in Pure Python and Finally Understood How Kafka Moves Millions of Events
Last year I was on a team that pushed 40 million events per day through Kafka. We had consumer lag alerts, rebalancing incidents, and a whole runbook for when the broker got behind. I understood how to operate Kafka. But I did not understand how Kafka works. So I built a tiny one. No dependencies. No Zookeeper. No JVM. Just Python and the core ideas. Here is what I learned. The Three Things Kafka Actually Does People say "Kafka is a message queue." That is not quite right. Kafka is a distributed commit log . It has three jobs: Accept writes from producers and append them to a log Let consumers read from any offset in that log Remember where each consumer group is up to That third one is the thing that makes Kafka different from a traditional queue. A queue forgets a message once it is consumed. Kafka remembers. You can replay. You can have 10 different consumer groups reading the same topic at different speeds. The code to implement this is smaller than you think. brokelite: A Message Broker in 120 Lines import threading import time from collections import defaultdict from typing import Dict , List , Tuple class Partition : """ Append-only log for one partition of a topic. """ def __init__ ( self ): self . _log : List [ Tuple [ int , bytes ]] = [] # (offset, message) self . _lock = threading . Lock () self . _next_offset = 0 def append ( self , message : bytes ) -> int : with self . _lock : offset = self . _next_offset self . _log . append (( offset , message )) self . _next_offset += 1 return offset def read_from ( self , offset : int , max_count : int = 100 ) -> List [ Tuple [ int , bytes ]]: with self . _lock : return [ ( off , msg ) for off , msg in self . _log if off >= offset ][: max_count ] def __len__ ( self ): return self . _next_offset class Topic : """ A topic is just N partitions. """ def __init__ ( self , name : str , num_partitions : int = 3 ): self . name = name self . partitions = [ Partition () for _ in range ( num_partitions )] def route ( self , k
Top 7 Featured DEV Posts of the Week
Welcome to this week's Top 7, where the DEV editorial team handpicks their favorite posts from the...
My Top 7 Most Profitable Weather Market Traders on Polymarket
description: Weather markets on Polymarket have become one of the hottest and most consistent...
The Return of Rigorous Full-System Timing Simulation
Speed Matters for Google Web Search [2009]
submitted by /u/Successful_Bowl2564 [link] [留言]
I Could've Rickrolled the FIFA World Cup. All I Needed Was My ID
Govee Discount Codes and Deals: 30% Off
New to Govee? Get a $5 coupon on your first purchase just for signing up.
John Carmack on Fabrice Bellard
https://xcancel.com/ID_AA_Carmack/status/2064095424420487226
The time the x86 emulator team found code so bad they fixed it during emulation
Show HN: Garden of Flowers – an archive of pictorial typography before ASCII art
Hey all, I made this. The archive started with my 2015 BA thesis on Amiga ASCII art when I was curious about the history of ASCII art but found very little on text art that came before it. The historical precursors are often attributed to typewriter art and shaped/visual poetry, but I think letterpress is overlooked. So, I got slightly obsessed and started a personal database of pictures built entirely from metal type, ornaments, and rule, some going back to the 1600s. After eight years, I've ma
The rise of machine writing is a great opportunity for literature
[Boost]
Clean Architecture on Frontend Alex Bespoyasov Alex Bespoyasov Alex Bespoyasov Follow Sep 1 '21 Clean Architecture on Frontend # typescript # react # architecture 2542 reactions 138 comments 35 min read
OpenAPI Specs automatisch in saubere Markdown-Doku konvertieren
Ihre OpenAPI-Datei ist die Quelle der Wahrheit für Ihre API: Pfade, Parameter, Request-Bodies, Responses und Schemas. Für Entwickler im Alltag ist rohes YAML oder JSON aber selten das beste Lesematerial. Backend-Teams brauchen eine schnelle Endpunkt-Referenz im Repository, Frontend-Teams wollen Request- und Response-Felder im Pull Request prüfen, und technische Redakteure möchten Inhalte in Wiki- oder Docs-Systeme übernehmen, ohne Schemas abzutippen. Testen Sie Apidog noch heute Markdown ist dafür das praktischste Zielformat. Es funktioniert in GitHub, Confluence, Notion, Docusaurus, MkDocs, Hugo und jedem Texteditor. Die Aufgabe lautet also: Aus einer vorhandenen openapi.yaml automatisch sauberes Markdown erzeugen. Manuell ist das zu langsam und driftet beim nächsten API-Change auseinander. Automatisch generiertes Markdown bleibt dagegen Teil Ihres Release-Prozesses. Warum Markdown aus OpenAPI generieren? Ein OpenAPI-Dokument ist primär für Maschinen gedacht. Tools parsen es, um Clients zu generieren, Contract-Tests auszuführen, Requests zu validieren oder interaktive Dokumentation zu rendern. Diese Maschinenlesbarkeit sollten Sie beibehalten. Wenn Sie zuerst die Qualität Ihrer Spezifikation prüfen möchten, hilft der Leitfaden zu OpenAPI-Validierungstools . Markdown löst ein anderes Problem: Es macht die API dort lesbar, wo kein OpenAPI-Renderer läuft. Typische Einsatzfälle: README.md oder /docs im Repository Pull-Request-Beschreibungen für neue oder geänderte Endpunkte Confluence- oder Notion-Seiten für Team-Reviews Statische Dokumentationsseiten mit Docusaurus, MkDocs oder Hugo Offline- oder interne Referenzdateien für Support und QA Wichtig ist: Markdown sollte ein abgeleitetes Artefakt sein. Die OpenAPI-Spezifikation bleibt kanonisch, Markdown wird bei Änderungen neu erzeugt. Methoden im Überblick Es gibt keinen offiziellen OpenAPI-Befehl für Markdown-Export. In der Praxis nutzen Teams entweder Konverter, ein eigenes Skript oder eine API-Plattform. Methode Am b