Dead Simple HTTP Server On macOS Using launchd
home // page // Technical
Misc Technical Tips

Dead Simple HTTP Server On macOS Using launchd

Recently I’ve been reading a lot of the Fossil and SQLite code bases. I’ve been very impressed by their cleanliness and the interesting ways in which they break from conventional wisdom in their construction. One thing I stumbled across while perusing a post on the Fossil mailing list was that inetd could be used to create a simple and efficient HTTP server with nothing but some basic C code. My interest was piqued and I began researching inetd on macOS. What I…

Misc Technical Tips

5 Readings From A Hidden History Of Software Engineering

(Image: Johann Georg Meyer “Das Lesende Mädchen”, 1871) Introduction There is a hidden history to software engineering that some have come to know, but of which most are sadly unaware. Instead, as happens so often in history, a vein of easily graspable but unworkable techniques and ideas has come to dominate the industry. These techniques are bundled with their own superficially plausible justifications and are parroted, easily enough, by amateurs to ensnare other amateurs. And so, we have a generation of…

Technical Tips

Getting Circular With SDL Audio

(Image Wikipedia Commons) Recently I’ve been having a lot of fun following along with Casey Muratori’s Handmade Hero project. As far as I know this is the first time a seasoned game industry vet like Casey has graciously decided to share the step-by-step creation of a professional-quality game. Amazingly, he’s also been including videos detailing every line of code and every major architectural decision. However, following along with the code examples can be tough if you’re not on a Windows…

Technical Tips

C++: Storing A shared_ptr As Lua Userdata

Recently I’ve been working on a game engine in C++. I’ve always wanted to participate in a Ludum Dare compo, and this work is in preparation for the December 1st compo. A big piece of the design of my engine is using Lua for scripting and providing novel Lua objects from C++ for this purpose. Yesterday I was attempting to embed provide a C++ object to Lua scripts. This object’s lifetime and ownership were managed using a reference counted shared_ptr,…

Misc Technical

Applying Thompson Sampling To The Interview Process

(Image by Macoto Murayama) NOTE: This post is not necessarily advocating for this approach. I think it’s an interesting idea so I’m putting it out there. This approach, as is, does not account for subjective biases, but it could provide the data to measure and compensate for them. One of the problems I’ve observed with interviews candidates across several companies is their informality. It often feels more like reading tea leaves than finding the best person. While many companies attempt to make this more rigorous, they…

Technical

Let’s Write An Ethereum Virtual Machine Disassembler

In this article we’ll discuss writing a disassembler for the Ethereum Virtual Machine (EVM). While writing disassemblers doesn’t necessarily require much knowledge of the machine the instructions are for, it’s actually quite a fun way to get your feet wet. During this tutorial we’ll be using the D programming language. Why D? Honestly there’s no great reason. It’s mostly because I think it’s clearer and simpler than the alternatives for this kind of low-level code. Let’s get started. Introduction When writing…

Ben Laposky, Oscilon
Technical Tips

Simple Software Verification, Part 3: Karnaugh Maps

(Image by Ben Laposky) [hamzh_toggle title=”Series Parts” state=”closed”] Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps [/hamzh_toggle] Welcome to the third and final article in this mini-series on software validation. In this article we’re going to discuss state machines, what desirable properties they should possess, and then I’ll demonstrate a simple tool for verifying them called Karnaugh Maps. Identifying State Machines As a general rule of thumb, you can identify a program that…

Technical Tips

Simple Software Verification, Part 2: Trace Tables

(Image by Leonardo Solaas) [hamzh_toggle title=”Series Parts” state=”closed”] Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps [/hamzh_toggle] Welcome back! In the previous article I explained why you might be interested in software verification techniques and then showed you how to use Execution Tables to verify your software for specific cases. In this article, we’ll generalize Execution Tables into a format that will allows us to create simple inductive proofs about our loops. Trace Tables…

Technical Tips

Simple Software Verification, Part 1: Execution Tables

[hamzh_toggle title=”Series Parts” state=”closed”] Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps [/hamzh_toggle] (Image by Manfred Mohr) Introduction If you’re a software developer, and you work somewhere even remotely sane, then chances are good you employ some form of automated testing in your day-to-day practice. Automated testing is a wonderful and extremely valuable tool, but there is nevertheless something slightly fanatical and suspicious about the claims of those who prescribe it as the strategy for managing software quality. Namely,…

Technical

Fixing Python’s title Function

Python’s title function has some weird side-effects when you’re titlizing a string like, for example, a street name: >>> "62nd".title() "62Nd" >>> "West 62nd st.".title() "West 62Nd St." Here’s how you can fix this: import re def fixed_title(input_string): parts = re.split(r'\s', input_string) for idx, value in enumerate(parts): if re.match(r'[A-Za-z]', value[0]): parts[idx] = value[0].upper() + value[1:] return ' '.join(parts) A simple fix that produces the right result: >>> fixed_title("West 62nd st.") "West 62nd St."