ELOS

No Comments »

The Elements of Style by William Strunk, Jr. is a succinct do-and-don’ts text on writing. There is an updated version by Strunk and White. Over a decade ago I made a LaTeX version of the 1918 out-of-copyright version. More recent I made a Kindle version. I put them up for DOWNLOAD. Looking at the decade old Makefile (that still worked) I realized how much my Makefiles have changed over time. There are several particularities with LaTeX that make it hard for make to handle. It needs a number of passes, if it fails it needs a clean up, and the output is way to verbose most of the time. Therefor I coded a Makefile to run LaTeX as often as required, cleanup after a failed compilation attempt, display a progress bar, and redirect LaTeX’s output to a file named ‘out’. If you like you can look at it and take whatever you like from it for your own Makefiles.


Welsh Incident

No Comments »

When I showed my first version of the Glass plugin to the coder that thought it impossible, I got some words of praise but she claimed a user-selectable colored rim (like some Flash version had) was still impossible. Robert Graves did not write:

"User selectable colours?"                         
                        "Mostly nameless colours,
Colours you'd like to see; but one was puce       
Or perhaps more like crimson, but not purplish."  

A stack of semi-translucent images can produce even the color #4E1609 (puce) but let’s look at the simpler example below, the color #FFAA33.

Read the rest of this entry


Squaring The Circle

No Comments »

The late Steve Jobs did not allow Flash on the iPhone-pod-pad because it reduces reliability and leads to sub-standard apps. A coder from Apple told me that coding a magnifying glass applet was impossible without either Flash or the CSS3 radius property. Or you were stuck with a rectangular zoom frame. Naturallemente, I had to prove her wrong. At first it felt like squaring the circle, than I did. Think about that for a while. I’ll wait… Read the rest of this entry


Dog Code

No Comments »

On Saturday, coder Adam found a dog wandering the highway. He took it upon himself to find the owner. So he did what he did best, write code:
Code to find a dog's owner.
I texted the first number, explaining I had found this dog on the highway and sure enough, it was the owner! He promptly drove to my house to pick up “Izzy”. When he arrived he was very glad to have his dog back but also confused as to how I found his phone number. I told him I “scraped” the dog registration site and left it at that (yeah it’s a bit unnerving how easy it is to find information on people). (Adam Gotch) [In a message to Perlbuzz]


R.I.P John McCarthy

No Comments »
R.I.P. John McCarthy
John McCarthy, 1927-2011
(Creator of Lisp and more)

This giant, John McCarthy stood at the cradle of AI, Lisp, and theoretical computer science. Like us, he loved elegant mathematics.


R.I.P. dmr

No Comments »

Dennis Ritchie, 1941-2011
(Unix co-creator, creator of C, and more)

Read the rest of this entry


When Coding Fails

No Comments »

I needed to rescue all the photo’s on a 2.5″ drive. It had a S-ATA interface. I had all the software but not the hardware. So I went out and bought a S-ATA to USB3 gadget. Though the computer reading the disk had only USB2, I bought the USB3 device because (I thought) I knew USB3 is 100% compatible with USB2. Needles to say, it failed work. After some reading specs I find that a USB3 socket delivers 900mA where USB2 can drive a maxium of 500mA. Remembering an USB2 device that had a Y-shaped cable and two connectors it hit me. All I needed to do was add a USB2 connector to the power circuitry. Took 20 minutes. And so, my fellow coders: code not what your code can’t do for you – ask what you can do for your code.

π


Consider a Domain Specific Language

No Comments »

There I was, in this meeting. A domain specialist had build a prototype in Excel/VBA. The commercial recode was an pseudo Excel engine, coded in PHP, with the prototype expressions shoehorned into it. I’ll pause while you recover. They had replaced the domain specialist with a programmer where they should have replaced Excel with a DSL. And here is why.

 A DSL drastically lowers the implicit domain knowledge in your code. 

Let me examplify; implement “If you have been married for more than half the fiscal year…” given the implicit knowledge: Dutch law mandates that you can D.I.V.O.R.C.E only after being marriage for at least a year.

In a generic language (given some suitable library) one could write: if (is_married_on($year, 6, 30)) reasoning that who has been married the middle day of the year, must have been been married for at least the first or the last half.

Apart from the hard to spot bugs in this code, it is hard to understand what constitutes being married more than half a year. Is it 183 days and 184 in a leap year? Being married the first three and last three months of the year?

Look at three examples in an imaginary predicate logic like DSL:

{all "married" | day $Y 30 6} ->
{sum #day "married" | year $Y} >= 183 ->
{max #day "married" | year $Y} > {sum #day | year $Y}/2 ->

How easy it is for the domain expert to express things much more explicit. A generic language would need a huge number of domain specific library call’s with extreme explicit naming and still would not get close to offering a flexible and explicit alternative. Besides, it is nice to use some explicit language now and than.


The Woz on Coding

No Comments »


Thanks to a good friend I had the honor to join a select group spending some time with The Woz. Topics ranged from how mutually intelligible Beijing and Hebei dialects of Mandarin are to whether history should be taught in schools. Being a nerd of the right age I had to ask Steve some questions that had been haunting me since 1978. I learned how to program by looking at SWEET16 code, the (build in) assembler/system monitor, Integer BASIC and DOS. His recollection powers are incredible. Not only could he answer all but one question without pause, he also could describe how long it took, who else participated, what the other Steve did and most interesting to me he often gave an introspective view of how he felt while doing it, why it turned out the way it did and what he did not know but might have wished he had. If he ever needs a headshrinker he will be done in half a session. For example, he would describe this “flow” effect that we coders all know when working one something complex. Incasu, Steve was working on a different timing of the disk head read/write signal. Specificly he moved from a 4/8ms to a 4/8/12ms signal in order to cram in some 25% extra bits. He described, much better than I can reproduce, how he worked till he was too tired, getting it almost done. Than next day it would take very long to get back into the flow and he would work till he was too tired again, getting it almost done. Than one night he did what he had to do and worked till early mornings to finish it. He declared it the hardest code he ever did. He also compared performing a complex dance as a non dancer to writing Integer BASIC without relevant experience or training. In fact he disclosed he did not know, back than, that BASIC was a collection of incompatible dialects (like Mandarin). This entry is getting too long so I leave you with just one more gem. Steve wanted BASIC for the Apple because of the book “101 BASIC Computer Games“. He still seems oblivious of the enormous impact of this decision. He chose my first computer language for me and for most all my peer coders.


The Right Tool

No Comments »

My professor runs a website on the USA elections. I help him some with the graphics.

presidential
midterm

Since the site features a lot of dynamic graphs, I build a numbers-to-graphs system by combining Bourne Shell and Ghostscript. This gave me a very powerful code and data pre-processor on a very powerful graphic language.

It took many hours to write the program. Luckily, the result was surprisingly dynamic; Because every thing parameterized, things often stayed visually pleasing even with input parameters we had not anticipated. For example midterm elections (right top image) have only house and senate races, but no electoral votes prediction like the presidential elections (left top image). Originally the program could handle only presidential elections, but with two numbers changed an one line removed, it generated the midterm graphics adequately. Take a look at some of the other graphs at electoral-vote.com. Just click on the map.