Author Archives: dbrady

The Surprising Truth About Cellular Automata and You

Cellular automata is a way of modeling complex systems by focusing on simple, independent entities called automatons. These automatons are not simple by design but rather by definition; because they are each a tiny, tiny part of a massive system, and because the number of possible interactions between these automatons rises exponentially with each automaton added to the system, there is no possible way that a single automaton can possibly understand the complexity of its own system.

Here’s are some of the things a cellular automaton DOES know:

  • It knows what it wants. An automaton is independent and has goals of its own that it wishes to satisfy.
  • It interacts with the world. This varies depending on the model of the system and the goals of the automaton, but often an automaton will consume resources, attempt to obtain more, and may expel waste.
  • It interacts with other automata. I originally wrote “its neighbors” but “neighbor” is too restricted a term. An automaton may communicate with automata at great distances, or may receive summaries of the behavior of groups of automata, in much the same way that you or I can send an email or watch the news.
  • It has a staggering amount of hubris. The automaton cannot possibly understand the system in which it lies, but in spite of this limitation, it will attempt to interact with the world and other automata and attempt to achieve its goals.

The complexities of the system are beautiful and staggering. Readers of “The Land of Lisp” will recognize this example: consider a world in which resources are scarce everywhere except in a tight jungle area, where resources are very rich. Now consider an automaton which has only one choice in life: to move straight ahead or turn. The automaton consumes a resource if it finds one, and it will die if it goes for too many turns without finding a resource. Each automaton will have a random tendency towards turning or going straight. Now let’s say that every so often, the surviving automata create offspring with tendencies similar to its own.

In even this simple an example, the automata will VERY quickly–in just a few dozen generations–specialize into two different species. One species adapts to living in the jungle. It almost always turns, trying to keep itself from wandering away from the jungle. The other species almost always goes straight, trying to cover as much distance as possible to find resources in the desert.

With regard to the title of this post, that’s “The Suprising Truth About Cellular Automata”. What about the “And You” part?

Take a deep breath, and reread the rules of cellular automata. Now turn your head and look out the window. Stare off into the distance and think for a long time. Now say these words aloud:

“This is why I don’t understand politics or economics.”

Of course, the hubris rule still applies. Just because we don’t understand it, doesn’t mean we aren’t going to try and it definitely doesn’t mean we’re not going to manipulate it. But for me, this is a perfectly adequate explanation for why economic theory makes so much sense on paper and yet the world economy can be in the tank. It explains why I get offended when someone reminds me to unit test my code, even while my unit tests reveal so many defects in my code.

The scale of complexity explains why terrorist bombings and economic collapse don’t necessarily have to be the work of conspiracies, and hubris explains why I would much rather believe that they are. Conversely, hubris explains why campaigning politicians look good denouncing the ails of the system, and complexity explains why incumbent politicians look incompetent trying to fix them.

Palindromic Powers of Two

Huh, that’s odd.

Just farting around, reducing the set of Integers to their prime factors—typically Friday-night stuff, amirite?—and I noticed an interesting pattern.

  1. Start with a keyspace of 0 and all of the integers in order as your available keys.
  2. Write a 0.
  3. You’ve exhausted the keyspace, so get another key, 1.
  4. Write the entire series so far, add the new key, and write the series (minus the new key) again. You should have 010.
  5. You’ve exhausted the keyspace again, so get another key, 2.
  6. Repeat: 010, 2, 010 -> 0102010.
  7. Repeat with 3: 010201030102010.
  8. Repeat with 4: 0102010301020104010201030102010.

And so on.

The “Huh!” moment is this: you’re writing the exponent of two in the prime factorization of the list of integers:

1 20
2 21
3 20 * 3
4 22
5 20 * 5
6 21 * 3
7 20
8 23
9 20 * 32
10 21 * 5
11 20
12 22 * 3
13 20
14 21 * 7
15 20 * 3 * 5
16 24

App-a-Day Challenge, Day Screw It

Yeah, so, you know that app-a-day challenge thing? So, about that….

It’s like this, folks: I thought I was putting my mad skillz on the line; it turned out I was putting my madness on display.

I got my butt handed to me by this challenge in two equal portions. First, real life interrupted in a big way. One of my clients called me to tell me his airport software was being audited by the FAA in 24 hours–and there was a bug in my product that needed fixing. It sounded like a reasonably small tweak, so I agreed to handle it, thinking I’d even have time to ship my app afterwards. Turns out it was a redesign of the entire access control system which took me about 20 hours. I delivered it around 9am the next day and then went to bed and slept through a SECOND day of not shipping an app.

Fair humility where it is due, however, the other equal part of me getting served was that there really are just so many moving parts to an Android application that it’s insane. I’ll blame the tools and documentation here, hopefully convincingly, but the argument will stand that lack of experience is why I could not quickly overcome tool and documentation issues. But here’s the argument anyway: The Android development environment is epic shit. Not epic THE shit, just epic SHIT. Like somebody’s been feeding their mastodon too much fiber.

High-ceremony languages require high-tooling support. Low-ceremony languages require high-documentation support. For example, C# is the highest-ceremony language I’ve ever worked with–followed closely by Java. C#, however, is supported by Developer Studio, which is the best freaking IDE ever made. Seriously, I don’t like Microsoft on principle, and I don’t care for any of their languages professionally anymore. But I used their tools for over a decade and I’ve never seen their match. Don’t even bother posting a knee-jerk comment in response about this unless you know what you’re talking about, because you don’t, so just shut up. Oh, and if your knee-jerk comment was to say that Eclipse is pretty good, you also need to fuck off. And then get help. It’s called Stockholm Syndrome. Look it up (after you fuck off).

Ahem. Moving on.

Low-ceremony languages need high-documentation support. All you really need there is a good text editor (which means emacs, since I’m still in a mood to start shit) and off you go. You have the freedom to write expressive code that is readable enough that you don’t NEED all the tooling support. (Detractors of languages like Lisp and Ruby will say that you also have the freedom to write awful code. When you’re older, and learn big words like economics and sustainability, you’ll understand. For now, just understand that there are a lot of freedoms which one learns quickly to not exercise if one wants to keep one’s job.)

So anyway, yeah. Didn’t mean for this to turn into a rant, but Java is very high-ceremony, Android’s documentation is still rather in its infancy, and the tool support is Eclipse, of which my opinion has not changed in 4 years.

Will I still code in Android? Yes. The documentation will get better, and my experience with knowing how to fix Eclipse’s brain damage (syntax errors that are fixed but won’t go away until you clean the project or restart eclipse, etc) will get better. I’ll probably even stop complaining about it at some point.

But yeah. For now… let’s just say that the experiment ended with “findings” rather than “results”.

App-a-Day Challenge

Well, it’s been an interesting month since Public Engines maximized my occupational opportunities. I’ve been head-down learning the Android platform, with the goal of being able to write and sell apps in the Android Market to create a little passive income. I released Big Digital Clock, a free clock application, about a week ago, and on Saturday the Schlock Mercenary comic reader app (a straight-up port of the iPhone app) went into private beta.

I have about a week left of paid-for time until I have to go create some active revenue (by the way, I am available for contract or consulting work, please contact me if you have Ruby or Android development needs). What to do with that time?

In 2009 my New Year’s Resolution was to ship code every single day. I learned some dangerous and useful skills, and I’ve decided to put them on the line. So here begins the

App-a-Day Challenge

I am going to write and ship a paid app into the Android Market every single day for a week. They’ll be small in scope (kids’ games, map and timer utilities, etc), and they’ll probably all be $0.99 apps when I’m done.

Today is already half gone, and I have to go do an Android tutoring session in an hour, but I think there’s still time to ship today. Watch this space for an announcement: Balloon Pop! is coming soon!

Intelligence and Prediction

Cleaning my office today, I found a sheet of paper covered in my own handwriting. I had been somewhere without my journal when an epiphany had struck. I’m cleaning office now, and didn’t want to throw it away. Here it is for posterity, such as that may be.

One measure of intelligence is the ability to take a set of observations at varying degrees of confidence and accurately predict outcomes. The greater the intelligence, experience, and capacity for reason, the more detailed the predictions become, the more distant they can be and the fewer and less confident the observations upon which they are based.

When I was the Director of Technology at RESMARK, the president was my good friend and we would spent long hours planning and discussing strategy. One afternoon we were his office, discussing his weekly meeting with our investor. He told me of the struggles and debates in the meeting over our ship date and our budget; over perceived velocity; over staffing and technology requirements. Partway through our discussion, he said that the investor had asked him to produce a line-item budget breakdown.

I jerked upright, startled. Suddenly something was wrong. This request was not in keeping with everything I knew about the relationship between the investor and the president up this point. I reevaluated my assumptions, and nothing fit. Then one assumption change DID fit. I considered it, thought through the range of consequences and they all ended up at the same place. I looked at the president and announced, “You’re going to get fired in the next three months.”

I was right. About 10 weeks later, the president called me in and told me he had been let go.

Two Beautiful Things

Here are a couple of pages from my journal for today. These are two things I find beautiful, have studied, and can draw… but have only begun to understand.


Click for larger image

The formula on the left is the Y Combinator, derived in Ruby, by Tom Moertel. His writeup and explanation are on raganwald.com. The owl is Aurora, a barn owl who lives and performs daily at Tracy Aviary.

Having time to just noodle around in a journal is something I’ve missed immensely. So great to have time for a life again.

TourBus 2: The Tourbusening

I’m speaking at Utah Open Source Conference! I will use up 55 minutes of your remaining lifetime talking about web load testing.

I am, of course, going to dust off TourBus. It was such a simple app that there wasn’t really anything to show off at MWRC 2009 and I am pleased to say that there still isn’t!

But you could help change that. Check out TourBus on GitHub, or better yet fork it and dig in.

Some features I hope to add in the next month:

  1. AMF support (testing Flex apps, anyone?)
  2. Proxy logging (tour the website yourself in a browser, then playback your browser session)
  3. Better (read: ANY) specs!
  4. Rails plugin, complete with generators and rake tasks
  5. Reporting and statistical analysis

Seriously, what’s not to like? Get in there and get forking!

P.S. For those of you watching the MWRC 2009 video and wondering, “Will I ever get the chance to see those ridiculous sideburns in person?” the answer is oh my goodness yes.