software engineering

Golang garbage collection of open file descriptors

Bruce Ediger

When you write Go code, you use os.Stdout and os.Stderr instead of our old C friends, stdout and stderr from stdio.h. os.Stdin, os.Stdout and os.Stderr have type *os.File. This Go type encapsulates encapsulates Linux file descriptors (small integer values representing open files).

Unknown Language Coding Problem

Unknown Language Coding Problem

Bruce Ediger

This is from the Daily Coding Problem email list. The owners of that list haven’t sent out a problem that caught my imagination in quite a while.

Daily Coding Problem: Problem #1553 [Hard]

This problem was asked by Airbnb.

You come across a dictionary of sorted words in a language you’ve never seen before. Write a program that returns the correct order of letters in this language.

For example, given ['xww', 'wxyz', 'wxyw', 'ywx', 'ywz'], you should return ['x', 'z', 'w', 'y'].


Github repo for my solution. Feel free to look it over, try it and email me (bediger8@gmail.com) if you notice anything.

Gall's Law

Bruce Ediger

I ran across an engineering aphorism or principle called “Gall’s Law”:

A complex system that works is invariably found to have evolved from a simple system that worked. The inverse proposition also appears to be true: A complex system designed from scratch never works and cannot be made to work. You have to start over, beginning with a working simple system.

GPP Quine

GPP Quine

Bruce Ediger

GPP is the General Purpose Preprocessor, a macro preprocessor for various forms of structured and unstructured text.

A quine is a computer program which takes no input and produces a copy of its own source code as its only output. There’s usually a few conditions on what the program can do, like not reading it’s source code during execution.

I wrote what I believe to be the first non-vacuous quine ever in the GPP language.

Daily Coding Problem

Daily Coding Problem

Bruce Ediger

There’s at least two things that one might conflate under the “Daily Coding Problem” rubric:

They’re related, as the book is a byproduct of the success of the email list. Both are deficient, but for different reasons

Self Relocating Program

Bruce Ediger

Once upon a time, I wrote a reasonably-strict-C89 C language program that “relocates” a function in memory and then runs it. That relocated function can relocate itself again, and run that copy, and so on and so forth.

Github repo for this program