Friday, September 18, 2009

Native Mac PyGTK for Snow Leopard

I have just made a fresh build of native PyGTK for Mac on my new Snow Leopard install. It seems to be working - I have only tested my simple hello_pygtk.py script, and that works at least ;-)

You can grab the new build here: MacPyGTK_SnowLeopard_091809.dmg

Remember to follow the three simple instructions in README.txt in order to make it work. B.t.w., one has to be running Python in 32-bit mode for it to work. This can be done in two ways:
  1. By setting this environment variable VERSIONER_PYTHON_PREFER_32_BIT=yes
  2. By issuing this command (once): defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
I would prefer setting the environment variable in a script starting my PyGTK application. That way I am changing as little as possible in the standard setup of the machine...

Thursday, September 17, 2009

Piping output of shell commands into the clipboard

I love my terminal! The availability of a proper shell and set of *nix tools is one of the main reasons that I dared switch to Mac OS X two years ago. I have been used to having the full GNU tool chain on the Linux systems I have been using the last 10 years, and there is no way I will ever give that up :-)

Today I learned something new about my terminal on OS X; I learned about the pbcopy and pbpaste commands. These two shell commands copy shell output into the clipboard, and pastes the clipboard content into the shell, respectively. I.e., today I needed to grep+cut through some large log files, and the results of these commands I wanted to paste to a spreadsheet. Instead of having to 1) perform the command, and then 2) use the mouse to scroll up and select all of the results to copy-paste them into the spreadsheet, I found that I could use pbcopy to pipe stdout directly to the clipboard:
grep foo logfile.txt | cut -d " " -f1,2,4 | pbcopy
After running this I could just go to my spreadsheet application and insert the three selected rows.

This little command is a real time saver I can tell you! I must have saved at least an hours work today alone ;-)

Sunday, September 13, 2009

Fresh PyGTK build for Leopard/Intel

I have just built a fresh version of native Mac OS X PyGTK and all of its dependencies. This time I have only made an Intel build for Leopard, so no PPC version this time around.

You can grab the new dmg file here: MacPyGTK_Leopard_Intel_091309.dmg

The install procedure is the usual:
  1. Download and mount the dmg
  2. Drag the MacPyGTK folder to /Developer
  3. Copy the contents of site-packages into the site packages of your Python installation (on 10.5 this should be /Library/Python/2.5/site-packages)
  4. Test that it works by running the hello_pygtk.py file with your Python interpreter.
That's it - now you should have a fully functional PyGTK installation to play around with.

Tuesday, July 21, 2009

New Logo for Locusts?

I have for some time now been searching for a nice picture of a grasshopper to use as a logo for the Locusts project that I am working on. I never found one that I was satisfied with though, but yesterday I got lucky. While I was out walking in Lappeenranta this little fellow was sitting on the side of the road - and he really liked being photographed.

B.t.w., I edited this image using Pixelmator to remove the background. This little app is really turning out to be an excellent image editor - who needs Photoshop anyway? :-)

Friday, July 17, 2009

Excited about Scavenger...

Just wanted to let you know that I have posted something about Scavenger on my "work" blog. I have conducted some benchmarks of Scavengers parallel processing abilities and it is looking very promising I must say.

Wednesday, July 15, 2009

Making your OS X hostname stick

If you are both a Mac user and a terminal junkie, as I am, you will probably have noticed that your computers hostname changes whenever you enter a new network environment[1]. More precisely, when you join a network through a DHCP server in some cases it also assigns you a new hostname. This has been a major annoyance to me for some time now, so I finally decided to find out how to make my hostname stick. And, as it turns out, that is of course quite simple to do:

1) Issue the command "sudo vi /etc/hostconfig"
2) Add the line HOSTNAME=my-hostname to this file (pressing i to enter edit mode).
3) Save and close (that's Esc to quit editing mode, and then :wq + Enter for you vi rookies)

The HOSTNAME line may already exist on your system in which case its value will be "-AUTOMATIC-". In that case you just replace that with your hostname. It was not there on my Leopard (client) machine.

Oh yeah, thanks to Robert Brewer for teaching me how to do this. Take a look at his article if you are interested in getting some more detailed information about the whole hostname determination business on OS X.

[1]: For those of you not used to using a terminal a new command-line in a terminal typically starts with "username@hostname:top-level-path$". E.g., my prompt right now shows "madsk@leela:Development$".

Monday, July 13, 2009

Scavenger tutorial available

I have finally gotten around to writing some documentation of Scavenger, so that others may in fact start writing Scavenger-enabled applications. I have spent the entire day updating the wiki pages of Scavengers GoogleCode homepage so now you will find a tutorial there along with some other related information about scavenger. Enjoy!