Category Archives: Uncategorized

Git: How to Merge a New Pull Request

I originally wrote this as Git: How to Merge a Remote Fork on LiveJournal, but Google refuses to index my LJ, so I couldn’t find it when I needed it. I’m reposting this here for my own future benefit.

James Britt just updated the documentation to TourBus for me, and he pushed the changes to his own fork. Here’s how I pulled it into my own repository without forcibly overwriting my own work until I was ready to merge it. James’ fork is at http://github.com/jamesbritt/tourbus.

Comments are welcome, especially if you know a better way to do it.

In English: Add a remote to my local repository, for James’ remote. Fetch his changes. Diff his changes against master. Assuming approval of his changes, check out master, merge james’ master, and push it.

In Bash:

$ cd tourbus
$ git checkout master
$ git remote add jamesbritt git://github.com/jamesbritt/tourbus
$ git fetch jamesbritt
$ git diff jamesbritt/master
$ git merge jamesbritt-master
$ git push origin master

[Edit: Thanks to Markus Prinz for pointing out the needless tracking branch. I have removed it.]

[Edit: Markus also points out that you can skip the git fetch jamesbritt step if you use -f in the preceding step: git remote add -f jamesbritt git://github.com/jamesbritt/tourbus]

If you need to make changes to get their stuff before merging and you don’t want to do it on master, you should make your own story branch for it:

$ cd tourbus
$ git checkout master
$ git remote add jamesbritt git://github.com/jamesbritt/tourbus
$ git fetch jamesbritt
$ git diff jamesbritt/master # eep, weird changes seen
$ git checkout -b fixmerge # I'm on master, so this will branch from there
$ git merge jamesbritt/master # now we have a master + jamesbritt/master merge. Make changes as needed, then
$ git checkout master
$ git merge fixmerge
$ git push origin master

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.

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”.

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.

How to Install RSpec and RSpec-rails

I’ve done this so many times this week that I’m writing it down here where I can Google it later. What I’m looking for is the specific three commands you type to install rspec and rspec-rails as plugins into my rails project.

To find this data normally, I do this:

  1. Go to http://rspec.info because that’s the URL I can remember.
  2. Click on Spec::Rails in the menu bar.
  3. Click on Install in THAT menu bar.
  4. This takes you to a page that tells you that the Install instructions are no longer here, they’ve moved to http://wiki.github.com/dchelimsky/rspec/rails
  5. Hooray! THIS is the page you want to be at. Sure enough, scroll down to see

Okay, now… ready for the kicker? This documentation is ALSO out of date. (There’s a crash bug in tag 1.2.9 when you call model.should be_valid.) As of this writing, if you clone the rspec-rails repo and examine the tags, you will see that 1.3.2 is available. So here’s the updated command. For now.

ruby script/plugin install git://github.com/dchelimsky/rspec.git -r 'refs/tags/1.3.2'
ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git -r 'refs/tags/1.3.2'
ruby script/generate rspec

…But lately I just get the latest and it seems to work:

ruby script/plugin install git://github.com/dchelimsky/rspec.git
ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git
ruby script/generate rspec