Archive for the 'programming' Category

Snow Leopard iPhone SDK fixed

I was completely stumped by an error in the build of our iPhone app. It just said ’something something exited with status -1.’ Said something wasn’t any kind of actual program or file you could find on the disk, so I had no way of getting further into it.

I actually had a support call into Apple Technical Support, who were trying to help figure it out.

But then the final Snow Leopard iPhone SDK 3.1 came out, and that revealed much more detailed errors. In particular, it showed that Xcode was trying run an old Leopard component of the iPhone SDK, which no longer exists. So I wiped the entire /Developer hierarchy off my machine, and reinstalled Xcode 3.2 and the single Snow Leopard 3.1 iPhone SDK. Kapow, everything works now.

How to run visualvm on Mac OS X

visualvm --jdkhome /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/

via http://denverdev.blogspot.com/2008/09/setting-up-sun-visualvm-on-mac-osx.html

PostgreSQL on Leopard

These instructions worked well. The one problem I had was my openssl is out of sync with the latest 8.3 version, so I just configured without ssl.

./configure --prefix=/usr/local/pgsql \
--enable-thread-safety \
--without-docdir \
--with-perl \
--with-gssapi \
--with-pam \
--with-bonjour \
--without-openssl

How the heck do I set up a BitTorrent tracker?

Why is this so friggin hard?

At work we have a couple hundred servers, and we like to install software on them a lot. Like every day. The software images are kind of big, maybe 100-200mb each, and there are maybe 20 different “types” of them. We more or less want to copy all the images out to all 200 machines really fast. Instantly would be great, but we’d settle for a minute or two. We have way expensive switches with 32 gigabit aggregate bandwidth, so 32 file copies could be happening simultaneously at fill 1000 megabit wire speed before we’d run into a wall.

We’ve had the idea for a long time to run our own little bittorrent universe on our LAN, with a client on every machine and a tracker that would get the master copy of everything.

I’ve just about pulled all the hair out of my head trying to make this work. BitTorrent.com has sold out to the Music/TV/Movie industry, and their web site is all useless drivel about how to download movies on the Windows BitTorrent client. There are 17 zillion people who have written their own bittorrent trackers, but those sites are loaded with ads about free pr0n, and it doesn’t give me a happy feeling about installing into my production data center. Or my own workstation for that matter.

I’ve tried downloading the BT source code from sourceforge; that’s apparently gone. Darwin/Macports installs of bittorrent bit the giant FAIL with all kinds of fucked up Python dependencies.

It’s looking like one of the most popular and probably easiest trackers is a PHP-based one called BT Tracker. But there are 500 flavors of that, and I really don’t want to have to set up a web server to set up PHP to set up a tracker for an internal system. Doesn’t anybody just make simple, self-contained daemons anymore?

Got any hints?

Amen, brother.

Update: promising. Um, maybe not.

Improving Productivity

increases programmer output by 22.6% At work we just got this new coffee machine. Google always brags about the free soda, snacks, meals, massages, pedicures, dry cleaning etc. But that stuff is expensive.

This coffee maker wasn’t cheap either, but if you allocate the cost across the 15+ engineers that use it, it’s a hell of a lot cheaper than buying RAM upgrades. And the coffee it makes is so delicious, so much better than normal drip-brewed coffee, it will make your programmers happy. Imagine if your programmers and product designers were not only happier, but cranked up on good old caffeine.

Can you love a machine? Spend a week with this beauty and you’ll find out. So shiny.

Add your own boot command script to Mac OS X

If you have some things you want to start when your mac boots, here is how to do it. I use mine to start up an SSH keychain, start a mysql server and a memcached.

First, you’ll need to be root:

sudo tcsh

Now, make a directory for your stuff. Suppose your name is “Buffy.”

mkdir /Library/StartupItems/buffy
chown root /Library/StartupItems/buffy
chmod 755 /Library/StartupItems/buffy

You need to put two files in this directory. The first one is called StartupParameters.plist and should look like this:

{
Description = "buffy";
Provides = ("buffy");
Requires = ("Network");
OrderPreference = "Late";
Messages = {
start = "Starting buffy";
stop = "Stopping buffy";
};
}

If you were some kind of Darwin super guru, you could set all kinds of other options in here, but let’s pretend for now that you just want to save yourself remembering to type extra stuff after you reboot your mac. Crap that sentence was ugly. Sorry.

OK, now you need to write the actual script to start things. name that file buffy

Here is an example:

#!/bin/sh

##
# buffy local stuff
##

. /etc/rc.common

StartService ()
{
    ConsoleMessage "buffy startup"
    # start postfix mail server
    postfix start
    # this is some weird stuff that only i'm interested in
    # but I'm sure  you have similar weird stuff
    /r9/mysql1/bin/r9mysqld start
    export EVENT_NOKQUEUE=1
    # note the 'su' things so these process run as the 'buffy' user
    su buffy -c '/usr/local/bin/memcached -d -m 128 -p 11211'
    su buffy -c 'sh /Users/billo/bin/keychain'
}

StopService ()
{
    ConsoleMessage "buffy shutdown"
    /r9/mysql1/bin/r9mysqld stop
}

RestartService ()
{
    StopService
    StartService
}

RunService "$1"

Make sure the files you create are owned by ‘root’ otherwise OS X will ignore them.

FireFox 3 Upgrade Notes

Plugin update check doesn’t work for a number of plugins (in particular: FireBug and Web Developer.)

You can get FireBug to work by visiting getfirebug.com and downloading the 1.1 beta.

Get Web Developer to work by visiting the web developer plugin page. While, you’re doing that, visit Chris Pederick’s home page and click on an ad. It’s the least you can do.

My first impression of the latest beta (b4) is that it seems very fast page rendering. Maybe as fast as Safari.

Steve Yegge is my Hero of the Month

He has some great stuff in his most recent essay:

So you can write Java code that’s object-oriented but C-like using arrays, vectors, linked lists, hashtables, and a minimal sprinkling of classes. Or you can spend years creating mountains of class hierarchies and volumes of UML in a heroic effort to tell people stories about all the great code you’re going to write someday.

Perl, Python and Ruby fail to attract many Java and C++ programmers because, well, they force you to get stuff done. It’s not very easy to drag your heels and dicker with class modeling in dynamic languages, although I suppose some people still manage. By and large these languages (like C) force you to face the computation head-on. That makes them really unpopular with metadata-addicted n00bs. It’s funny, but I used to get really pissed off at Larry Wall for calling Java programmers “babies”. It turns out the situation is a little more complicated than that… but only a little.

And Haskell, OCaml and their ilk are part of a 45-year-old static-typing movement within academia to try to force people to model everything. Programmers hate that. These languages will never, ever enjoy any substantial commercial success, for the exact same reason the Semantic Web is a failure. You can’t force people to provide metadata for everything they do. They’ll hate you.

NTS: a nice essay from Larry Wall

This is a pleasure to read: http://www.perl.com/lpt/a/997

How to scroll compiler output in Emacs

I’ve used M-x compile in emacs for years. Like for 17 years. My fingers automatically do ^x^m that I have had as the key binding for that command, as soon as I save a source file.

However, at some point in Emacs 21 (and now on 22) the *compilation* buffer stopped scrolling; it would show the top of the output, but then scroll out of sight. Then I would have to move the point to the end of that buffer to see the compilation activity. It was very annoying, but not annoying enough that I spent any time trying to find the settings.

But I did finally stumble across it, and here it is:


(setq compilation-scroll-output t)

One more line in my 5000 lines of emacs personalization lisp.