August 19, 2008
Epic Fail

My Mac died again a month or so ago - another HDD failure. Not a problem, I thought - new disk, restore from Time Machine, sorted.

Only my Time Machine backup disk had been plugged in to my Mac when it died, which is at least as bad as pulling the plug without unmounting. The backup disk wouldn't mount. Dash it, I thought.

All in all, though, I'm surprised how little I lost:

  • My music, all recovered from My iPod. Thank you Senuti. It even recovered most of my metadata - play counts, star ratings, the sort of thing that only the painfully anal people like me care about. I'm very glad about this - re-ripping all my CDs would have taken months.
  • My contacts were in a vCard file on my iPod too.
  • My email is all on Gmail.
  • My calendar, ditto, synched with iCal via BusySync.
  • My bookmarks are all in delicious, accessed via Delicious Bookmarks.
  • Most of my documents I managed to dredge out of email too.
  • Code. All in one Subversion repository or another, naturally.

What did I lose?

  • Some of my photos. It wasn't too bad - I have a backup from about six months ago, so most of them were there. I'd sent CDs to family with more recent stuff, so I could recvover those. But I know I lost some.
  • A few documents. Having said that I recovered most of my documents, I was missing a few things. Most notably, I have a couple of VoodooPad documents that I keep loads of notes in, and I lost several month's worth of these. Bah.
  • An episode of Doctor Who or two, grabbed with iplayer-dl. Ah well, they'll repeat them sooner or later.

Lesson learned - Time Machine is great for convenience, but don't trust it as your only backup mechanism. If it wasn't for those DVD-R backups I'd taken a few months back, i'd have lost far more than I have.

Posted by Simon Brunning at 09:59 PM | Permalink | Comments (51)
May 01, 2008
Emailing yourself the result of a query
echo "select 1 from dual;" | sqlplus user/password@database | mail -s "Result of your query" simon@brunningonline.net

I love Unix, me.

Posted by Simon Brunning at 02:06 PM | Permalink | Comments (2)
April 22, 2008
Mac Shortcut of the Day

⌘-` cycles between windows of the active application, ⌘-~ cycles backwards. Learning this somewhat lessens the pain of not having a working Witch.

Posted by Simon Brunning at 02:51 PM | Permalink | Comments (2)
Burn the Witch

Since moving to Leopard, I've had to do without two of my favorite little apps; Witch, a window switcher, and growlnotify, a command line growl notifier.

growlnotify is still dead - this workaround doesn't work for me, nor does the beta, and I can't even work out where to download the Python bindings.

Witch 2.0 is out today. Sadly, that's still not working either. Sigh. Windows in spaces other than the active one still don't show up. Apart, strangely, for iTunes and Notes.

Now Textpander has stopped working too. Bugger.

Posted by Simon Brunning at 02:07 PM | Permalink | Comments (1)
February 18, 2008
Top-and-tailing log files

Some of our log files are huge - I have a 10 GB file on my HDD right now. These files are unwieldy to say the least, and you usually have a good idea as to the time in which a particular problem occurred, so it's often handy to be able to chop out a specified time range. I keep forgetting how to do this, and re-inventing the process. So, here for my own benefit at a couple of methods.

The hard way

From the bash shell:

wc -l your.log

This will count the lines in your file.

grep -n 12:00: your.log | head -n 1

This will give you the line number of the 1st line containing "12:00:" - in this example, I want log entries starting at midday, so this is the first line that I want.

grep -n 12:10: your.log | tail -n 1

This will give you the line number of the 1st line containing "12:10:" - in this example, I want log entries up to ten past twelve, so this is the last line that I want.

tail -n $[total-first] your.log | head -n $[total-last] > your_focused.log

Replace first, last and total with the values you got above, and you'll end up with a file containing only the time range that you wanted. (If you only want to look at the file once, you can just pipe into less or whatever rather than piping into an output file.)

The easy way

python -c "import itertools, sys; sys.stdout.writelines(itertools.takewhile(lambda item: not '12:10:' in item, itertools.dropwhile(lambda item: not '12:00:' in item, open('your.log'))))" > your_focused.log

Same thing, only this will read through the file just once.

Now, I'm fully expecting someone to come and tell me the real easy way. ;-)

Posted by Simon Brunning at 12:25 PM | Permalink | Comments (16)
January 24, 2008
The Mac is Back!

Got a phone call last night just as I was getting to Angel tube station. Dawkins was all better! So I diverted to Regent's Street to pick it up.

Not only did I have a new HDD, but they'd also replaced the fascia, trackpad and keyboard for some reason. Not that I'm complaining - they were all looking their age. No new logic board, though - the old one is still fine.

Got home, restored from my Time Machine backup, and Bob's your uncle, good as new.

Funny thing is, pre-Time Machine, my backups were sporadic at best. Had this happened just a month earlier, I would have lost loads.

Posted by Simon Brunning at 10:06 AM | Permalink | Comments (2)
January 22, 2008
Macless...

Dawkins is poorly. :-(

Took it to the Apple store last night, and it seems that somehow or other both the logic board and the HDD are dead! I'm glad it's in warranty! Should be back in a week or so.

So in the meantime, no blogging, no IM and hardly any email.

Posted by Simon Brunning at 09:23 AM | Permalink | Comments (0)
January 01, 2008
Now That's What I Call Service!

I bought Mum a copy of MarsEdit for Christmas. She loved it - ever wondered where I got my nerd genes from? ;-)

Anyway, she was having trouble getting a couple of her inexplicably large number of blogs up and running with it - and somehow Daniel Jalkut, MarsEdit's author, spotted her blog post and came and helped her out. Wow - you don't get Bill helping the frustrated Vista victims out, do you? And that cost far more than MarsEdit.

He was pretty positive about a change I suggested recently, too.

So, MarsEdit is now even more highly recommended than it used to be.

Posted by Simon Brunning at 08:51 PM | Permalink | Comments (2)
Leopard

Mum got me a lovely 500GB external hard disk, which is what I was waiting for before installing Leopard. I backed everything up with Carbon Copy Cloner, then did a scratch install.

Good God it's taking a long time to get everything re-installed. I shouldn't be surprised, I suppose; I'd filled four pages of my trusty Moleskine with a list of things to reinstall. Including MarsEdit - hence the sudden slew of posts. ;-) Still, just about done now.

No need to Virtue; Spaces seems like a very nice replacement so far.

Time Machine is great. Zero effort backups - this is huge. Be honest - how many of us have really good backups of our personal machines? Well, now there's no excuse. Interface is a bit wacky, though.

Lots of other great stuff for Python devs, too, and a built-in ssh agent. And I love the new Terminal.

Fracture isn't working at all, though. :-(

More later, perhaps.

Posted by Simon Brunning at 04:07 PM | Permalink | Comments (1)
December 13, 2007
The Magic Goes Away

Oh no! What's going to happen to Quicksilver? I'm not sure I can do without it now, so I hope someone picks it up and supports it.

Still, thanks to Nicholas Jitkoff for all his work thus far. Quicksilver is a thing of beauty.

Posted by Simon Brunning at 01:58 PM | Permalink | Comments (1)
November 30, 2007
Orrible Strikes Again

I wasted a good couple of hours today trying to get cx_Oracle running on my Mac. I didn't have any luck - Oracle's Mac client is PPC only. You can still run it in an Intel Mac due to the magic of Rosetta, but you don't seem to be able to compile against it, so these instructions don't work for me.

Anyone got a binary I can snarf?

Posted by Simon Brunning at 04:24 PM | Permalink | Comments (3)
Fear of Flying

Hey - did you know you can run less directly over a gzipped file? Cool.

less /resin-apps/r2apps/log/r2frontend.log.2007-11-29.gz

Posted by Simon Brunning at 04:00 PM | Permalink | Comments (5)
November 21, 2007
Subversion Log Filtering

So, Annabel was complaining that she couldn't see a log of just her Subversion revisions along with details of the files that have changed from the command line. Shock horror - something you can do from Tortoise that you can't easily do from the shell!

(If you don't care about seeing a list of the files that have been changed, you can just do svn log | grep -A2 sbrunning | less, but adding the -v option turns the output to gibberish.)

Clearly I wasn't going to to let that stand, so I knocked up a very quick script. Then proceeded to over-engineer the snot out of it. (In my own time I must add.)

You can filter by author or by checkin message, with regexps. You can also reverse the output and see the latest checkin last, which is handy if you are only want to see the most recent checkins and don't want to pipe the output to less.

Get it here: svnlog (syntax highlighed - loving that Django TextMate theme) or svnlog (text). Requires Python 2.5. Works on Mac & Linux, probably on Windows too if you give it a .py suffix.

Posted by Simon Brunning at 06:05 PM | Permalink | Comments (4)
November 01, 2007
Mac screen savers

I spotted Jim running the Fracture screen saver on his MacBook the other day. Beautiful - worth £5 of anyone's money.

"As you can rely on with Stick Software products, it has a suitably overengineered configuration panel that lets you control many details of its operation." Outstanding.

It joins my ever growing collection. I love Skyrocket and Hyperspace, (I've mentioned Skyrocket before) and Euphoria, Solar Winds, Flux & Fireflies. (These also offer config screens with all the frobbing and tweaking opportunities that you could ever want.)

For traditions' sake I also have Red Pill and PongSaver. Oh yes, and a couple of Life savers that I can't seem to find links for any more.

That's a lot of screen savers. I don't want to be fiddling with them all too much. Fun screen savers are enough of a productivity sink as it is - I don't want to be changing my mind as to what to run all the time. And I don't want to use the Macs built-in screen saver randomiser, 'cos it's an all or nothing thing. Though I do like the iTunes Artwork & RSS Visualiser savers, there are a lot of the built in savers that I don't want to see.

Luckily, there's RandomExtra. Like the built in randomiser, it picks a screen saver at random, but it also allows you to select which of your installed savers you want it to pick from. What's more, you can weight the savers - so I can choose to see Fracture twice as often as PongSaver, for example.

Naturally, I just spend ages fiddling with RandomExtra, instead. Sigh.

Posted by Simon Brunning at 06:38 PM | Permalink | Comments (2)
October 31, 2007
The Leopard and The Snake

Java may not be getting much Apple love, at least not for the moment, but the better language sure is. ;-)

Also Leopard has built-in Subversion, including Python bindings, and ssh key management too. Sweet.

Just as soon as they get Java up to spec, looks like I'll be jumping.

Update: And perhaps Java on Leopard isn't looking so bad after all.

Posted by Simon Brunning at 06:19 PM | Permalink | Comments (3)
October 30, 2007
Leopard

Leopard looks like it's got some good stuff in it - Time Machine and Spaces especially look good, and the new Terminal looks like it might replace iTerm.

But it looks like they've done the Dock no favours. The Finder changes don't sound to great either. I use Quicksilver and Path Finder, though, so I'm not too bothered about them, and I have a feeling that going forward, I'm going to have to upgrade to get any of the latest toys working.

But anyway, until they fix Java, I can't upgrade, so that's that. Early adopters around the office have found that Eclipse is totally broken on Leopard at the moment, and that's a show-stopper.

Update: Lifehacker on the new Terminal. Also, Richard and Jeff on why it doesn't matter that Java's broken on Leopard. It does matter, though - if Java won't run on Leopard, I won't upgrade to it, and I won't buy a new Mac, either. My loss, but Apple's loss too. I'm a consultant - I don't always get to choose the platform I work with, and many of my clients choose Java.

Posted by Simon Brunning at 09:51 AM | Permalink | Comments (5)
October 16, 2007
Phone Home?

Some unmitigated bastard has stolen Jez's Mac. Anyone got any suggestions for him that don't involve already having installed MacPhoneHome?

In the meantime, if any of you see a Mac with a Cyberman's head in the lid, get in touch with Jez or me.

Posted by Simon Brunning at 02:01 PM | Permalink | Comments (4)
October 15, 2007
A Whip Without a Growl is No Fun

Bugger. Growl doesn't have an option to wake your Mac from a screen saver, even on a per-app or per-event basis - and it isn't going to get one. I have to say, I don't agree that it would be that evil an option, provided that it wasn't the default. People wouldn't have to turn it on if they didn't want to, after all.

I'm quite prepared to believe that it would be a bugger to implement, though.

Why do I want it? Well, I'm currently Build Whip here at GU, and ccmenu is an essential tool in my armory. It would be really nice if I could arrange to be told about a broken build even if my screen saver has kicked it. I can make it play a sound, I suppose, but it's not really the same.

What's a Build Whip? Well, we have a big old team here, twenty-odd pairs, and we are not allowed to check in on red. Someone needs to make sure that the build gets fixed ASAP, and it's my job to make sure that happens.

Still none the wiser? OK, well, we practice something called Continuous Integration. When we are happy with a bit of code we've written, we put it into a single shared place, the code repository. Whenever the code in the repository changes, one or our server machines automatically bursts into life, and compiles all the code (to make sure that it's valid) then runs all our automated tests (hopefully demonstrating that it's bug free).

If this all works, the build is green. If not, it's red, and there's always some what that the entire team is informed of this. At my last site, we had a lava lamp. At GU, we have a big-ass plasma TV showing all sorts of stuff, and ccmenu or ccTray.

If the build is red, it need to be fixed ASAP. Fixing the build can be enormously complicated by other people putting further changes into the repository while you are working on it, so that's not allowed. Since that means that no one can check in (i.e. put code changes into the repository) while the build is red, that means it's even more important that the build is fixed ASAP. ASAPer? ASAPest? Whatever. So you have a build whip, whose job it is to either fix the build, or more often to track down the pair whose change was responsible for breaking the build, and make them fix it.

More on this later. Time to go shopping.

Posted by Simon Brunning at 06:30 PM | Permalink | Comments (1)
March 08, 2007
It's here!

My new baby, now christened "dawkins", has arrived. It's lovely.

Posted by Simon Brunning at 04:38 PM | Permalink | Comments (11)
February 28, 2007
Virtualisation...

Get an email today - my new MacBook is in the post!

So, Mac people, Parallels or VMWare?

Posted by Simon Brunning at 12:36 PM | Permalink | Comments (12)
February 07, 2007
Thoughts on Music

Interesting discussion of Steve Jobsís "Thoughts on Music" essay by John Gruber at Daring Fireball, the upshot of which is that DRM is really driven by the record industry and that Apple would gladly drop it if they could.

Me - I'm a CD in the hand sort of a bloke, and I'll probably remain so. I'll certainly never buy DRM encumbered stuff - I want to buy it, not rent it.

Update: The Economist: "Indeed, scrapping DRM would probably increase online-music sales by reducing confusion and incompatibility. With the leading online store, Apple would benefit most. Mr Jobsís argument, in short, is transparently self-serving. It also happens to be right."

Posted by Simon Brunning at 02:20 PM | Permalink | Comments (2)
January 30, 2007
I'm a PC, I'm a Mac

I'm not sure which are funnier: the Apple UK ads, or the piss-takes. Either way, I think I'm going for a maxed-out MacBook soon.

Posted by Simon Brunning at 10:55 AM | Permalink | Comments (1)
October 17, 2006
DVD Audio format-shifting on the Mac

OK, Mac gurus - how do I rip the audio from a DVD to MP3, so I can listen to it on my iPod, preferably using open source software?

I own the DVD in question, FWIW. ;-)

Update: Mac the Ripper and ffmpegX did the job between them. Thanks.

Posted by Simon Brunning at 12:37 PM | Permalink | Comments (8)
October 13, 2006
Merge tools

If you are going to be doing a lot of merging working with Subversion (or, I'd imagine, CVS), you are going to need good a good merge tool. And believe me, you are going to be doing a lot of merging.

Subversion itself doesn't provide a merge tool - and nor should it. It's a cross-platform command line driven tool, and besides, I suspect that most developers have their own favourite - or need to find one quickly.

If you are working on Windows, you'll probably have Tortoise installed, 'cos it's really good for simple stuff. Tortoise does come with a merge tool, but it's horrid, really nasty. Aside from just how damn ugly the thing is, it's also almost totally incomprehensible. All those colours - what do they mean?

But that's OK. There are alternatives, and they are easy enough to integrate into Tortoise. The first thing I came across was WinMerge. WinMerge is very good for showing diffs, but it doesn't (as yet) do three way merging - so that's out. Another, more powerful alternative is KDiff3. By the time I came across this, I'd already made my happy move to the Mac, so I've not used it myself, but my Windows-victim colleagues report that it works fine.

So the trick is to use the tool with diff in the name for merging, and the tool with merge in the name for diffing. ;-)

Tortoise also provides tools for making and applying patches, but they seem to use fully-qualified path names, so you can't apply patches from one machine to another unless it happens to keep everything in the same place. So, it's best to use Subversion to make your patches with svn patch > whatever.patch to make your patches (or svn st | awk '/^\s?[MAD]/ { print $NF } ' | xargs svn diff > whatever.patch if you've made the same externals mistake that I did), and to use unxutils' patch to apply them.

In the Mac, there's a natural solution - FileMerge, part of the XCode suite. It's very nice to use, if not perfect. (A few more keyboard shortcuts would be nice, for example, Apple, Just 'cos it's GUIfied and beautiful doesn't mean I should be reaching for the mouse all the time.) Integrating it with command line Subversion would be non-trivial but for Bruno De Fraine's lovely Using FileMerge as a diff command for Subversion - he's done all the hard work for you. Thanks for that, Bruno.

Oh, SubClipse also provides a merging tool, but I've never really used it. It's nice to have SubClipse around - the fact that it decorates all your files showing you their status against the repository is nice, and I often use it to add files - quicker than an svd add if you are in the IDE already. But IDE/version control integration is far less crucial than it used to be in the bad old VSS days when you couldn't edit a file without checking it out, so I do most of my Subversion tasks from the command line.

I'd be interested to know what all you *nix types use - especially anything console based.

Have I missed anything cool?

Posted by Simon Brunning at 08:27 PM | Permalink | Comments (16)
WriteRoom

Just a quick post to plug the lovely WriteRoom. If you sometimes need to write prose, and you are easily distracted, give it a try.

(There seems to be a Windows analogue, DarkRoom, but I have no experience of it. Let me know if it works!)

Prose like, for example, blog posting s. ;-)

Posted by Simon Brunning at 03:11 PM | Permalink | Comments (2)
October 04, 2006
Emacs and me

There's a discussion going on at the moment concerning refactoring dynamic languages. For whatever reason, its protagonists don't seem to be aware of Phil Dawes' excellent Bicycle Repair Man.

I'd love to give Bicycle Repair Man a go; it looks fab when Phil demos it. but there's one hurdle to get over first - Emacs. And it's a big one.

I've given Emacs a go a couple of times (most recently Aquamacs), and it seems to make sense to me. It's not totally horrid like that nasty vi thing that just beeps at me all the bloody time. No, it's just that the learning curve is steep, and I have real work to do, work that I can accomplish far more easily at the moment using jEdit.

There are loads of tasks that I can achieve really easily using jEdit that I wouldn't even know where to start looking for in Emacs - line sorting, search and replace across a filtered set of files throughout a directory sub-tree, opening files in archives or FTP repositories, HTMlifying, XML re-indenting. I know Emacs can do all this stuff, but I really don't know where to look for it all, and I need to get stuff done.

There are a couple of other jEdit features that I really like and would miss, too. The File System Browser (which I keep docked and open at all times) is a fabulous tool. I like a mouse driven interface for navigating around the file system, and jEdit's is a very powerful one. Also, the combination of the search bar and the hypersearch panel (which I leave on by default and dock at the bottom respectively) is really powerful too. Are there Emacs analogs of these tools?

Oh yes, and I like buffer tabs too.

And before Andy comes in and starts accusing me of being a weak-minded GUI lover, I'm not. I'm getting on fine with bash on the Mac. I'm starting to use awk and sed to do stuff on the command line that are totally impossible via a GUI. (Oh, and thanks for the help on that, Andy.)

So, should I stick with what I know? After all, it's not like I'm using Notepad here - jEdit's very good. Or should I take the pain and try to switch to Emacs? I'd be able to use Bicycle Repair Man!

Posted by Simon Brunning at 12:34 PM | Permalink | Comments (15)
November 29, 2005
Black Box Testing

OK, all you Mac-heads, a bit of help please. I've managed to turn something on, and I don't know how to turn it off again. Right now, whichever control has focus is "highlighted" by a black box. Trivial, I know - especially in light of all the important stuff that I can't get working at the moment, but it's driving me mad.

I almost certainly turned it on with some clumsy miss-keystroke, but I've no idea what it might have been. I've hunted all through the System Preferences, concentrating on the Keyboard and Universal Access panels but I can't find whatever it is I've turned on. Any hints?

Posted by Simon Brunning at 07:09 PM | Permalink | Comments (3)
November 22, 2005
London Web Framework Night

Speaking of the London Web Framework Night - I never did write that up, did I?

OK, so, first up, Catalyst. What can I say? Catalyst may or may not be a great web framework, but since I didn't understand a word of the presentation, I'm not in any position to judge. It seemed mainly to consist of a list of CPAN modules that are either part of Catalyst, or can be plugged into it. No code, no working system, no screenshots, no inkling of what's in it for me. Nothing. Awkward, opaque, and unfriendly to all but insiders - much like I imagine Perl to be. (It must be said, the Perl mongers are aware of the problem - see this post, and this one. Message for Simon Wistow re your "Show Leon's Catalyst based web debugger. I'm willing to bet that it would be largely impossible in either of the other two" comment - I give you Ajaxy Exception Catching.)

Next up came Simon's Django presentation. I may have put The Fear into Simon about presenting to so many people, but perhaps I did him a favour - despite his admitted inexperience as a presenter, it was a cracking show. Compelling, funny, enthusiastic, and giving a very good idea as to what Django does, and how it does it. Using it will be pretty much a no-brainer when it comes to putting together a CMS style site. Whether it's the right platform for database driven sites like the kind of thing that I do for my day job is another matter. There's a clear front end/back end division with Django, with editors using its spectacular "magic" admin interface, and users mainly viewing content - though you do get community features like commenting pretty much for free. Perfect for a lot of sites, but would it suit enterprise database apps like banks and insurance houses need - and I write?

Simon demonstrated both the front and back ends of Django using lawrence.com - one of the sites for which Django was developed in the first place. Though the God of Demos made an apprearance at one point giving Simon an SQL exception, he also had a number of "oooh"s, and outright applause at least twice.

Last up was Matt Biddulph giving us a flavour of Rails. Struggling manfully through a stinking cold, Matt gave us the phiosophy of Rails in a very punchy manner. It looks very much a case of "do it our way", but that's often the right approach. Not enough code on show to tempt me away from a Python platform, though. ;-)

Without a doubt, the highlight here was Matt's demo of BBC Programme Catalogue. I have no words for how cool this project is. None.

I missed out on the booze up afterwards - I was feeling a bit fragile after several heavy sessions on the trot - so I'm sorry if I missed any of you. It was a good night nevertheless - a big thank you to Dean Wilson for organising it all.

Me? I'm looking at TurboGears. ;-) I like the concept of tying together best-of-breed components. Getting it running on my Mac was trivial, and the 20 minute Wiki is a superb demo. As soon as I locate some of that copious free time of mine, I'll try throwing together a simple site or two to see how it hangs together.

Posted by Simon Brunning at 06:46 PM | Permalink | Comments (8)
September 29, 2005
Mum's new baby

Mum's new baby is here. How's it going, Mum?

Err, yes, now that you ask, I may have had some infuence over her choice.

Posted by Simon Brunning at 03:07 PM | Permalink | Comments (2)
September 07, 2005
Baby Steps

I could get to like this bash thing. I have a fairly deeply nested directory tree. I wanted to delete all directories within that tree with a given name. (.svn, as it happens.) I was trying to use ls to generate a list of directories, but ls -R .svn wasn't giving me anything.

So, I joined the #bash channel on freenode, and was steered in the right direction in seconds - use the find command. Here's the end result, for my own reference as much as anything:

yes | find . -name '.svn' -exec rm -r {} \;

Beautiful, no? Well, OK, no, but it works.

Posted by Simon Brunning at 01:04 PM | Permalink | Comments (6)
August 31, 2005
Roadkill

I've been getting on fairly well with Roadkill, my nice new Powerbook, but it's been a bit of a learning curve. The pretty Mac front end stuff is a piece of cake on the whole, with one major exception - undo, cut, copy and paste are Apple-z, x, c, and v respectivly, instead of Ctrl-z, x, c, and v as they are on Windows. I've been using those shortcuts for so long now that they are embedded in muscle memory. I've hit the wrong shortcut before my brain (such as it is) has had a chance to overrule them. Getting over that is going to take a while.

Getting some of the command line driven stuff - Ant, Subversion and Tomcat - working was a bit more of a challenge. Easy once you know how, but you keep being tripped up by things that I didn't know about.

I had installed Java 1.5, but the installer didn't tell me where it had been put, so I had to go and look for it. I found it in /System/Library/Frameworks/JavaVM.framework/Versions/1.5/ in the end.

There was already a version of Ant installed in /Developer/Java/Ant, probably as part of the XCode tools install, but it was the wrong version, and in any case I wasn't able to add 3rd party tasks to it, so I needed to use my own version.

Both of these problems involved setting environment variables, and I gather that it's recommended that you don't muck about with global environment variables, so I set up some shell scripts to start and stop tomcat and to run ant scripts with the environment variables set correctly. I was even smart enough to put the shebang line at the top (though finding the bloody '#' key took a while) and to mark them as executable wwith chmod. But I still couldn't run the bloody scripts. The shell was claiming that tey wen't there, though I could see them with ls.

It turns out that your current working directory isn't on your path by default. Arrrgh! That one took me hours, literally. Prefixing the script names with ./ does the trick there.

I still can't resolve any of the other boxes on my network by name, only by IP address. Irritating, but no show stopper. I can always add them to /etc/hosts, but for the moment I'm just using the IP addresses.

Still, I managed to get past all that, and my current web application is building and running on Roadkill happily enough now, after fixing a couple of minor Windows-isms in our build file. ;-)

Next on my list; installing PostgreSQL, and getting my app to work with it, and working out this whole multiple Python versions on one machine thing, and working out where the insert and delete keys are...

One other thing - what do you, uh, we Mac users use to read Usenet? Entourage seems to have trouble getting at Gmane - this fix, uh, doesn't.

Posted by Simon Brunning at 01:52 PM | Permalink | Comments (17)
August 26, 2005
It's here!

And a thing of beauty it is too. Don't expect too much from me for a day or two.

Posted by Simon Brunning at 10:35 AM | Permalink | Comments (5)
August 17, 2005
All Quiet

I seem to have left my iPod playing when I got home last night, 'cos it was dead this morning. I hate commuting without music. (It's happy enough now though - it was just the battery.)

Besides which, being the nerd I am, I had to knock this up to make sure that my metadata is still correct:

import win32com.client
 
def main():
    iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
    
    quiet_tracks_playlist = iTunes.LibrarySource.Playlists.ItemByName('Reduce Played Count')
    for track in quiet_tracks_playlist.Tracks:
        print 'reducing played count for', track.Artist, '-', track.Album, '-', track.Name, 'from', track.PlayedCount,
        track.PlayedCount -= 1       
        print 'to', track.PlayedCount
 
if __name__ == '__main__':
    main()

How sad is that?

(I suppose that I'll be learning how to script iTunes all over again once I've got my new Mac.)

Why do I care about re-setting the played count? 'Cos I want this to be right:

import datetime
import time
import win32com.client
 
def main():
    iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
 
    total_time = datetime.timedelta(0)
 
    for track in iTunes.LibraryPlaylist.Tracks:
        try:
            track_time = time.strptime(track.Time, '%M:%S')
        except ValueError:
            track_time = time.strptime(track.Time, '%H:%M:%S')
        track_length = datetime.timedelta(hours=track_time.tm_hour,
                                          minutes=track_time.tm_min,
                                          seconds=track_time.tm_sec)
        track_time = track_length * track.PlayedCount
        total_time += track_time
                                                 
    print 'Total iPod time:', total_time
 
if __name__ == '__main__':
    main()
    raw_input('Hit enter to continue...')

And how sad is that?

Posted by Simon Brunning at 05:08 PM | Permalink | Comments (2)
How did *that* happen?

Dan's PC died yesterday; hard disk died. It's been replaced, but while Dan was working on it, we were having a chat with Jeff, our finance director, and Dan suggested that we should keep a spare PC about the place so that in the event of one dieing, there's always another one to be getting on with. Jeff thought that this was a jolly good idea.

I pointed out that I thought that we ought to get notebook PCs rather than desktops in future. The aren't that much more expensive, and they give you a whole lot more flexibility. I'm forever being sent off to client sites, and a notebook of my own would be dead handy. (There is Roadwarrior, but you know how it is using a PC other than your own..) Besides, we'd be able to work from home if we needed to occasionally due to trains not running or other problems, or to implement that bright idea that you have on Saturday evening straight away.

Jeff thought that this was a good idea too. "Just spec yourself up a decent notebook," he said, "and order it".

"Result!", I thought.

"Oh, don't go ordering yourself a Powerbook, though!"

"Fair enough. I wasn't planning to try and get that one over on you, much as I'd love to. You do realise, though, that all the stiff we work on these days is cross platform, and would work just fine on a Mac?" I couldn't help but point it out.

Half an hour later, Jeff and Alex (our technical director) came over and told me to order a Powerbook! They asked me to check that it wasn't going to cause a problem in terms of development or office tools or network infrastructure, but that if it all looks workable, they'd like to make sure that we really are building cross platform software.

So, I've checked. Development tools are no problem - just about everything is Java based (Eclipse, Ant, Tomcat, Spring, Hibernate, Axis, etc, etc, etc.), though I have a bunch of Python stuff too. We want to be cross database, too, so we are developing against MySQL, and deploying against SQL Server and DB2/400 (which don't run on the development boxes.). We use Subversion for change control. All of this should be fine on a Mac. MS Office for Mac is compatible with Windows Office, and our network should just require a little tweaking. All systems go.

I did suggest that we should wait for El Presidente to get back to see if he was OK with it all, but there's no stopping Jeff and Alex with the wind in their sails, so the order went in today:

I have no words for how cool this is. See - who needs a girlfriend? ;-)

Tulna, (who doesn't have a blog, oh no,) is dead jealous. And she says she's not a nerd. Now - lots of Mac software to download...

Posted by Simon Brunning at 04:04 PM | Permalink | Comments (12)