Source Code is Formal Communication

When developing a new program—especially when trying out many different things—it’s common to pepper your code with various messages that are displayed when the program reaches a particular point or when it encounters a condition that you thought was impossible.  I suspect every programmer has run into a message or assertion that says, “this can’t happen.”  The joke is that it did happen.

It’s also common to be pretty liberal with terse comments that are little more than notes to oneself about the current technique being tried.

Both are understandable.  Every programmer I’ve known has done similar things.  However, it’s also quite common to leave those comments and messages in the code after the problem is solved and you’ve moved on to other things.  Particularly in a fast-paced environment, you often have little time to go through and “clean up” your code once you have it working.  And therein lies the problem.

All too often those comments and debug error messages are…well, let’s just say “colorful.”   In addition, programmers are known to editorialize in their comments—often to the point of ranting.

You may think that when you’re working by yourself or in a small team, such things shouldn’t matter.  After all, you know that your fellow team members won’t be offended by your use of colorful language.  Thinking that way is a mistake because eventually somebody else is going to see your code.  Perhaps you’ll bring on a new team member who is offended.  Or maybe you’ll want to present the code as a sample in an interview for your next job.

Either of those two would be embarrassing.  But suppose one of your colorful messages pops up on the screen when your boss is demonstrating the program to a potential client.  That could be disastrous.  I’ve seen it happen.  Fortunately it wasn’t one of my colorful error messages.

You’re mistaken if you think that source code comments pose less of a problem.  I was involved with a company that was acquired by another, and part of the “due diligence” involved having the acquiring company’s lead programmers look over the source code.  They were mostly looking for stuff that shouldn’t be there (stolen code, for example), and verifying that everyting that should be there, was.  Early on, one reviewer stumbled upon a long and profane ranting comment in the source code and as a result was highly critical of all the code he reviewed.  Fair or not, that one comment colored his perception of the entire project.

Even if you’re working by yourself, the likelihood of your code being seen by others is very high.  The likelihood of somebody else seeing the output from your programs is even higher.  People will judge you by the contents of your comments and error messages, just as they will judge you by the quality of your code and how well your programs work.

Unless you’re absolutely certain that your program will not be seen by anybody else, you should treat it like any other type of formal communication.  You wouldn’t include profanity or ranting editorializing in a design document you’re presenting to a client, so such things shouldn’t be in your programs.


Our amateur radio club is in the process of starting another class for people interested in getting their ham radio license.  One of the more difficult tasks is finding a place to hold the classes.  We need a room that’ll hold 25 or 30 people, available after hours or on weekends, and free.  We don’t charge for the classes, so we can’t afford to pay for a room.

In Round Rock, a local hospital has generously donated use of a conference room on Saturday mornings.  That’s great for people in north Austin, Round Rock, and Georgetown, but people who live in central or south Austin are understandably reluctant to drive all that way.  We finally found a place in central Austin, but telling people where it is has become something of a comedy.

The Combined Transportation, Emergency, and Communications Center (CTECC) in Austin brings several state, county, and municipal government agencies together under one roof so they can share command-and-control resources in the area.  It houses traffic management and emergency communications for public safety.  The agencies involved include:

  • City of Austin (911 dispatch, police, fire, EMS)
  • Travis County (911 dispatch, sheriff, constable)
  • Capital Metropolitan Transportation Authority (the local bus system)
  • Texas Department of Transportation (TxDOT) for the freeway

That’s all well and good, but where is it?  Searching the Web for “CTECC Austin” leads to any number of articles about what it is and what it does, but the only location I could find amounts to “on Old Manor Road at the old Mueller Airport.”

So I thought I’d ask for the address on my club’s mailing list.  All I got was a bunch of confusing directions with questionable landmarks and that ended in “look for the building with all the antennas on top.”  No published street address because, as one person said, “they have a real Homeland Security concern in advertising their presence.”

That’s just silly.  I can’t imagine that hiding their street address will inconvenience anybody who has evil intentions.  “I was going to attack the Austin emergency communications facility, but I couldn’t find their street address.”

If “Homeland Security” is the real reason that I can’t find an address for this facility, then they probably shouldn’t advertise its existence at all and they certainly shouldn’t allow a bunch of amateur radio operators and students to use their facility.  Or will they make us submit to a detailed Homeland Security background check before they allow us on premises?

Sorry, but I don’t buy the “Homeland Security” excuse for not posting an address.  Anybody have a real reason?

By the way, a little fiddling with Google Maps reveals an approximate address of 5020 Old Manor Road.  Am I going to get a visit from Homeland Security for posting that?

Shakespeare vs. Markov

I’m developing some code to work with Markov models, and as an early test I created a model of Shakespeare’s sonnets.  Then I had the program generate some verse from the model.  For example:

If they in thou, thy love, that old,
Thought, that which yet do the heat did excess
My love concord never saw my woeful taste
At ransoms you for that so unprovident:
For thereby beauty show’st I am fled,
Althoughts to the dead, that care
With should thus shall by their fair,
Where too much my jade,
Her loves, my heart.

The Markov model generates text one character at a time.  The next character is selected based on the distribution of characters in the original source text, and also on the “order” of the model.  In an order 0 model, character selection is based entirely on the frequency of characters in the source text.  If the letter ‘e’ appears 12% of the time in the source text, then it will appear approximately 12% of the time in the output.  Output from an order 0 model is just a weighted random sampling of the source text.  For example:

  oaa,stpr iyt eimhr  rttntnettohe  Tt
chShag  flsoTa
ebshenuAievien lffetNthfean
nnnfIhwste  aek oppe

An order 1 model bases character selection on the frequency of characters that follow the current character.  That is, given the current character, the next character selected is guaranteed to be one that followed that character in the source text.  The model cannot generate a bigram (sequence of two characters) that did not exist in the source.  So, for example, the sequence ‘qz’ can’t appear in the generated text unless it was also in the source.   Verse generated from an order 1 model is slightly better than what you’ll get from an order 0 model:

Myouivey inn f th peroeethe,
Anete pe!
Touss s o by thy!
Ar temye corste d w.
Be wh s t, n rverose d th ms t,
I s s Ifiththin ay past lll s farenoulofan r, t thonard areall ngain,
Foutea cthakedinore,
Yot te,
Lorowor d thoodoref pathe,

Things begin to improve quickly as you move up in order of the model.  Order 2 bases character selection on the two preceeding characters, and you start to see recognizable English words although overall it looks more like some freaky foreign language:

Thich Must I winter,
The I do loodye ming to lin
So me lie stat so hou faut forse trom fore.
Whe be.
That, all shart and’s mor thee my swed thy head.
And thawarit, a strand sabudge,
To ale whal wart,

Order 3 verse contains primarily recognizable English words.  At order 5 (the first sample above), almost all words are valid and you begin to see word pairs that existed in the original source text.  The resulting verse is reminiscent of a drunk and confused dramatics major trying to impress a group of girls with his knowledge of Shakespeare.

Order 10 verse is like Shakespeare in a blender:

Thou blind fool Love, what dost thou abuse,
The bounteous largess given thee to give?
Profitless usurer why dost thou that I do fawn upon,
Nay if thou live remembered
My deepest sense, how hard true sorrow hits,
And sealed false bonds of love doth well denote,
Love’s fire heats water, water cools not love
Which alters when it alteration finds,
Or bends with thee, wherever I abide,
The guilty goddess of my passion,
A woman’s face with nature’s truth,
And delves the parallels in beauty dyed?
Both truth and beauty should look so.

Here you sometimes see complete sonnet lines.  Other times you’ll see the first half of one line morph into the second half of another, or just pure randomness. 

Things get less interesting beyond order 10, and by order 15 the thing starts spitting out complete sonnets exactly as they were fed in.

I probably spent entirely too much time “testing” my program:  generating verse and laughing at the results.  But it was a welcome bit of humor in an otherwise somewhat dull day.

Creating a slide show shouldn’t be this hard

What I want to do seems simple enough.  Given a collection of image files, create a slide show video suitable for sending via email or posting on YouTube.   There are countless GUI programs that will do this.  But I want to do it from the command line under program control.

Finding a suitable Windows program to do this is turning out to be very difficult.  I first tried a Windows build of ffmpeg, which is apparently the program under Linux.  The three Windows builds I tried are badly broken, either crashing or rejecting valid command lines.  I thought I’d try mencoder (part of the MPlayer project), but the Windows MPlayer build that I downloaded doesn’t appear to include mencoder.

Somebody else suggested x264, but my experience with that has been fruitless as well.  Unless you consider frustration fruitful.

I’m stumped.  All I want is a program that I can point to a directory and say, “Make a slide show from all those images.”  This isn’t rocket science, and yet every program I’ve tried has failed.

If you have any suggestions for a command line program that will create a slide show from multiple .jpg files and save it to a common video format (.avi, .mp4, .flv, .swf, etc.), I’d be real happy to hear about it.  But, please, don’t recommend Linux, BSD, or some other operating system.  This must be a Windows solution.

One more time on the treadmill

Just wanted to share this video from yesterday’s treadmill session.  They’ve reduced the water level and increased the speed.  Charlie is improving by leaps and bounds every day.  Perhaps soon he’ll be leaping and bounding.

Charlie Walks Again!

The title pretty much says it all.  The physical therapist at A&M sent us these videos of Charlie walking yesterday.  This is just two weeks post-surgery, after not walking for almost two months.  He still has a long way to go, but he’s getting there pretty darned quick.

They tell me that they’re feeding him four full cans of food a day. That’s more than double what we normally feed him, but I guess he’s got a lot of weight to put back on.

We’ll be heading over there tomorrow to pick him up.  We’ll decide over the weekend whether we’ll be taking him back or continuing the therapy here.

Frame Switch

Frame SwitchJust west of Taylor on U.S. 79, I noticed a sign that said, “Frame Switch.”  I caught that sign coming back, too, and was curious because it looks just like the signs that announce the little towns along the route.  Except this sign doesn’t show the population.

Google is a wonderful thing.  I learned that Frame Switch was a small stock raising community formed in the late 1800s.  It was named for the father of some rancher’s wife.  From 1933 up to 2000, the census reported a population of 20 people.  Based on the short distance between the highway signs, I’d say that the town isn’t very big.  If there are still 20 people living there, I can’t see where they’d live.

The great thing about searching for Frame Switch, TX is all the spam links that came up.  There are links for real estate listings, apartment locators, movers, private investigators, used cars, jobs, pest control, and that’s just on the first page of results.  I realize that many of those sites provide links to services in surrounding communities, but if you click on some of them all you get is a page of ads, devoid of relevant content.

I suppose I’m too easily amused.



A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.