Programming · Latest articles

30 new today · 2,696 articles · from 79 blogs

Lea Verou··Lea Verou

Different remote and local resource URLs, with Service Workers!

AI summaryThe article explores the common web development challenge of using different resource URLs (such as for JavaScript libraries) in local development versus production, reviewing workarounds like manual URL swapping, JS-based fallback loading, and build tools like gulp. The author presents their preferred solution: a Service Worker that intercepts requests on localhost and redirects them to local files, allowing normal remote URLs in the HTML. While effective, this approach has caveats such as the same-origin restriction requiring the script to be copied to each repo and the first pageload still using the remote URL.

Without Boats·

Alternative Registries

AI summaryCargo, Rust's package manager, introduced a new feature this week that allows users to download dependencies from alternative registries in addition to crates.io. This enables organizations to distribute internal libraries through cargo without needing to upload them to a public registry. The feature is currently available only on nightly and is gated behind the alternative-registries feature gate.

Without Boats·

Blogging With GitLab and Hugo

AI summaryThe author describes their unsuccessful attempt at maintaining a blog with GitHub Pages, where they struggled to actually produce posts. Moving to GitLab and Hugo, they prioritize a low-maintenance workflow over site appearance, wanting an experience like writing Rust RFCs: write some markdown, commit, push, and let others read it.

Fabien Sanglard·

Game Engine Black Book Postmortem

AI summaryThe author announces that the Game Engine Black Book about Wolfenstein 3D has shipped—a 316-page, full-color book covering 1991 hardware, id Software tools, and the game engine's internals, available on Amazon and Google Play Books. The project took three years to complete and involved many challenges. The author shares a postmortem of lessons learned to help aspiring writers.

Fabien Sanglard·

FizzleFade

AI summaryThe author, an avid reader of source code, shares their delight in discovering elegant solutions like Fizzlefade while working on the Game Engine Black Book: Wolfenstein 3D, comparing it to the famous Quake 3 inverse square root trick. Fizzlefade is the function that transitions between scenes in Wolfenstein 3D by turning screen pixels to a solid color one at a time in a seemingly random pattern.

Fabien Sanglard·

Game Engine Black Book ReleaseDate

AI summaryGame Engine Black Book is an engineering book that explains how Wolfenstein 3D was made and how id Software turned the IBM PC into a leading gaming platform capable of high frame rates. Rather than containing much prose, the book uses text and detailed drawings to describe the Wolfenstein 3D game engine and its hardware, namely the IBM PC with an Intel 386 CPU and a VGA graphics card.

Elixir Blog··José Valim

Elixir v1.5 released

Elixir v1.5 integrates with Erlang/OTP 20 and bring changes that improves the language reach and the developer experience.

Preshing on Programming··Jeff Preshing

Can Reordering of Release/Acquire Operations Introduce Deadlock?

AI summaryThe author examines whether a compiler can reorder a write-release followed by a read-acquire on spinlocks, which would cause a thread to hold two locks at once and potentially introduce deadlock. Although acquire/release semantics alone don't forbid this reordering, he argues that C++ standard §4.7.2:18—which says atomic stores must eventually become visible to all other threads—should prevent moving the release store past a potentially infinite loop, so deadlock shouldn't be possible. He notes that the standard's wording is only a recommendation ('should' rather than 'must'), but concludes that acquire/release operations aren't inherently deadlock-prone, a view supported by compiler tests and commenter Anthony Williams.

Preshing on Programming··Jeff Preshing

Here's a Standalone Cairo DLL for Windows

AI summaryThe author, unable to find an up-to-date, dependency-free precompiled Cairo DLL for Windows, wrote a build script (shared on GitHub) and released binary packages containing headers, import libraries, and DLLs for x86 and x64. The DLLs are statically linked with their own C runtime, have no external dependencies, and should work with any MSVC-built application. They are configured to render text using FreeType for better quality, broader font format support, and consistent cross-platform appearance, and the author provides a sample CMake-based application to test them.

Preshing on Programming··Jeff Preshing

Learn CMake's Scripting Language in 15 Minutes

AI summaryThis article is a quick-start tutorial on CMake's scripting language, the language used in every CMakeLists.txt file to define build targets and perform other tasks. It covers the core syntax and programming model, explaining that all variables are strings, every statement is a command, lists are semicolon-delimited strings, and covering flow control, functions versus macros, script inclusion, and target properties. The goal is to help readers quickly grasp enough of the language to understand and edit CMake scripts without wading through scattered documentation.

Lea Verou··Lea Verou

Introducing Mavo: Create web apps entirely by writing HTML!

AI summaryThe author announced the release of Mavo, an open-source, HTML-based language developed over two years at MIT CSAIL that lets users create web applications without programming or a server backend. Named after the author's late mother, the project's release had been delayed for months due to anxiety about it not being ready. Readers are invited to try Mavo at mavo.io and share whatever they create with it.

Preshing on Programming··Jeff Preshing

How to Build a CMake-Based Project

AI summaryThis article is a practical guide to configuring and building CMake-based C/C++ projects, explaining core concepts such as the source and binary folders, the cache, and the configure and generate steps. It demonstrates several ways to run CMake—including the command line, cmake-gui, and ccmake—and how to generate build pipelines using Unix Makefiles, Visual Studio, and Xcode. The concepts are illustrated with a sample project called CMakeDemo, which uses SDL2 and OpenGL to render a spinning 3D logo.

Andrew Kelley·

A Better Way to Implement Bit Fields

AI summaryThe author, while developing a 4-player arcade game for the Raspberry Pi 3 to test Zig's suitability for OS and embedded development, implemented bit-fields in the Zig language to support USB controller drivers, avoiding the pitfalls of C's implementation-defined and poorly regarded bit-field syntax. Zig achieves this with no syntax additions by combining packed structs (where fields occupy exact memory layout with no padding) with arbitrary bit-width integer types created via the @intType builtin. Unlike C, Zig allows taking addresses of bit-fields, with the bit offset and length encoded in the pointer type so the compiler can catch misuse.

Lea Verou··Lea Verou

HTML APIs: What they are and how to design a good one

AI summaryThe author, who believes in lowering barriers to creating rich interactive experiences and improving programming usability, has written an article for Smashing Magazine. The article targets JavaScript library developers who want their libraries to be usable directly through HTML without requiring users to write JavaScript. Interested readers are directed to the article for more information.

Andrew Kelley·

Zig: Already More Knowable Than C

AI summaryThe article translates tricky code examples from a 2015 post titled 'I Do Not Know C' into Zig, showing that Zig catches many of C's pitfalls—such as variable redefinition, misuse of nullable pointers, integer overflow, and ambiguous division—either at compile time or through runtime safety checks that crash with a traceback in debug mode. It highlights that Zig's operators make behavior explicit, with '+' asserting no overflow, '+%' providing wraparound, and division requiring an explicit choice between truncating, flooring, or exact semantics. The author concludes that Zig is on track to replace C as the simple, straightforward language for writing systems code.