Posts with the name or tag of Programming;

by Gaz

Software Development Meme

10:18 am in Programming by Gaz

BinaryIt’s been months since I received a Meme Tag, so I decided to invite myself to take part in a Meme from Aaron Feng.

How old were you when you first started programming?

Now, that really would be telling and would give away my age. Let’s just say that I was lucky enough to get a Sinclair ZX81 for Christmas 1981, and never really looked back.

How did you get started in programming?

All my friends were getting Atari games console’s, but I got a stinking ZX81 with 1K of memory… actually a bit less than that, since a few hundred bytes were reserved for system variables, and had to write my own games.

What was your first language?

Afrikaans. Followed by English, and then Sinclair BASIC.

What was the first real program you wrote?

Mars Mining Corporation. After 6 months of typing in other peoples BASIC code from printouts in magazines, I acquired a 4K RAM Pack for my ZX81, and wrote a fun text only simulation for making money out of running a mining company on Mars.

What languages have you used since you started programming?

Chronologically, as best as I can remember:

Sinclair Basic, Z80 assembler, BBC Basic, 6502 Assembler, Amstrad BASIC, Pascal, LPC, MUF Modula-2, APL, Forth, C, YACC, Oberon, Occam-2, Modula-3, C-shell, C++, Prolog, Bourne Shell, sed, Emacs Lisp, AWK, M4, Scheme, Tcl/Tk, Cobol, PCL5, D, Brainfuck, C#, Java, Javascript, Python, SQL, PHP4, Lua, AppleScript…

And then there are a whole slew of XML based and inspired languages I’ve had the pleasure of becoming acquainted with over the years:

SGML, CSS2, CSS3, XHTML, XSL, Glade XML, YAML, RDF, DAML+Oil, JSON, DTD, RSS, Atom, SAX…

Plus some proprietary languages I can’t remember the names of, and quite probably several more languages that I’ve forgotten about.

What was your first professional programming gig?

My first job after graduating was fixing bugs in support software for Independent Financial Advisors, back in 1994.

If you knew then what you know now, would you have started programming?

I would have started sooner if I’d been able to talk my Dad into buying a PDP-11…

If there is one thing you learned along the way that you would tell new developers, what would it be?

Study other people’s code. Free Software is an education!

What’s the most fun you’ve ever had… programming?

Libtool, obviously. How could I not enjoy writing M4 code that generates portable Bourne Shell code on the developers machine, which in turn runs on the users machine to generate C code to interact with code libraries? I was meta-programming before I even knew what it meant :-)

Who’s next?

James Urquhart

by Gaz

Texinfo Bundle

9:00 pm in Programming, Technology, Writing by Gaz

TextMateOver the last few days I’ve been reading the wonderful TextMate documentation in parallel with James Edward Gray II‘s excellent TextMate: Power Editing for the Mac. One of the (very few) shortcomings of TextMate is a distinct lack of many of the Emacs modes I’ve grown to rely on when working on GNU Software.

Unquestionably, TextMate is Emacs reimagined for the Mac, and it’s about time I stopped chickening out and running for Emacs when I can’t quite bend TextMate to my will. So, I plan to write the missing modes and distribute and maintain them from here. I picked on what looked to be an easy start with a Texinfo mode, although it turns out to have such a huge number of directives (each with slightly different syntax from the others) that it became a much larger project than I had anticipated.

I see that the TextMate wiki have an outstanding request for implementation of a texinfo mode, and I hope this goes some way towards filling that need. Please bear in mind, gentle reader, that this is my first TextMate mode, and as such is certainly rough around the edges. I would, however, be delighted to receive contributions to improve it in the form of patches and/or constructive criticism. At the moment it provides (very comprehensive) syntax highlighting, a template document and support for the symbol list to jump directly to any node in the current file. There are not yet any commands or macros.

Download the Texinfo bundle here

Unless I am very much mistaken, you simply unpack the archive and then double click on the icon install it into your personal TextMate bundle library.

by Gaz

GPG Encryption & Signatures for GMail and Apple Mail

8:37 am in Programming, Technology by Gaz

firegpg.jpgI recently bemoaned the lack of PKI support in Google Mail, only to be proven wrong when I happened upon the FireGPG project this morning: A firefox extension that uses an external GPG binary to handle ASCII armoured email signatures and encryption. The embedded ASCII armoured signature flavour involves adding a block of text at the end of an email, and sometimes requires adding escape characters into the email itself which is kinda clunky and ugly. The developers are working on adding PGP/Mime signature attachments though — where all the GPG gunk is ferretted away into an attachment so that the body of the email is left untouched — providing the other missing part of my requirements for taking Google Mail seriously.

The FireGPG project seems to be very active and is releasing often, so I’m hoping that the PGP/MIME support will be available by the time Google has set a Gears enabled offline capable GMail loose.

Although I use Safari as my primary browser, I also keep a copy of Firefox around for occasional sites that don’t work in Safari (cough my bank! cough), and for web development, so I don’t lose anything by launching Firefox to read my email instead of Mail.app, where I currently have to install and configure the GPGMail bundle to get encryption and digital signature support. But more about that in another post…

Related Articles

  1. Google Gears

by Gaz

Google Gears

4:40 pm in Programming, Technology by Gaz

In case you’ve been living under a rock for the last few days, Google Gears is creating a wave of excitement across the intertubes. It’s a new open source beta browser plugin for Firefox and IE (Safari and Opera to follow) that provides javascript APIs to allow disconnected use of web applications. Once a webapp has integrated with Gears, it will be able to store state on the browser host for offline working, and then quietly resynchronise in the background once the network connection comes back up later.

The first webapp to use it is Google Reader. Once you have Gears installed, Reader will gain a button that downloads a copy of the last couple of thousand articles to your disk, which will allow you to read, tag and share those articles without a net connection, and then resynchronise itself later, when the network is back, with another click. More details at Google’s Gears site.

So, first of all, I want to join in with the masses and proclaim that all of this is a Good Thing, and a welcome step towards reducing our dependency on an always-on internet connection. Traveling from hotel to hotel, and relying on a patchy connection can be frustrating, and if the webapps I rely on start to use Gears, it will certainly make life a little easier for me :-)

But, it’s not a complete solution. Google avoid talking about what happens if I’m using multiple computers. Synchronisation is a hard problem, and I’d be (pleasantly) surprised if things continue to work properly if I disconnect my laptop’s network and work offline with Reader for a while, then while I’m on the train to a meeting I use my mobile phone to read some other feeds… what happens when I reconnect my laptop? What happens if I have a work laptop and a home laptop, and use them both offline sometimes?

For me, having offline access to Google Calendar might be enough to make me switch from Apple’s iCal. iCal is not without its problems: unless I have my laptop with me to change or add appointments, events in my iPod are read-only, and changing or adding events with my phone is painful; .Mac iCal synchronisation always seems to come up with spurious conflicts; and the .Mac web view of my public calendars is read only. If there were a user friendly means of keeping my online, offline and phone calendars nicely synchronised, I’d buy it in a snap!

No doubt everyone is waiting for a Gears version of GMail, and although it will almost certainly arrive if Gears gains the traction it deserves, I still won’t be switching to GMail as my main mail hub. Before I will be comfortable with that, I want to be able to use PGP with my email: I routinely sign every email I send, and I’d like the option to encrypt sensitive business communications when everything is stored (apparently forever!) on Google’s server. There is still no direct IMAP access to GMail, but in order to use PGP with my Google mail, I need to use an external mail client. And Google only let me do that through the venerable POP protocol, so I effectively need to mirror all the email stored at Google to a central IMAP server and jump through some other hoops to sychronise sent mail — and that means that the GMail webapp won’t reflect what’s going on at my IMAP mirrored google mail archive.

However (and this is the good part), the implementation of Gears shows how a javascript API can be produced to interact with client side software; I’ll bet that it isn’t too long before someone else comes up with a PGP GMail plugin to handle email signatures and encryption. In combination with a Gears based GMail and GCal, and some means to make a backup of everything stored there, Google will certainly replace Apple Mail and iCal in my workflow.

We live in interesting times!

Related Articles

  1. GPG Encryption & Signatures for GMail and Apple Mail

by Gaz

Multicolumn Sort in iTunes 7.1

7:24 pm in Music, Programming by Gaz

Now that I have around 1000 albums stored in iTunes, I’ve been trying to figure out how to sort on multiple columns.

When I organised my CD and LP collections, I would keep them alphabetised by artist, and then by date within artist. So if I wanted to play the latest Megadeth album, I could thumb through the racks to M and then see all of their albums in the order they were released, followed by all of Metal Church’s albums, and then Metallica and so on. The system doesn’t take into account compilations and soundtracks, so I would put them in among the artists, ordered by title, so my Matrix soundtrack albums sit between Marilyn Manson and Meat Loaf; and my Metal Hammer Magazine cover discs would live between Megadeth and Metallica, starting with the oldest and so on, and so on.

(If you’re happily downloading all the awesome metal by bands with names that start with M from the links above, you should probably pick up the fantabulous new return-to-oldschool Machine Head album while you’re at it.)

As far as I can tell, there’s no way to do this with iTunes :-( I had hoped to be able to sort the year column, and then rely on the sort algorithm being stable so that a second sort on artist wouldn’t jumble up the years. No luck there. Worse, sorting by artist splits up all my soundtrack and compilation albums and puts the tracks in amongst the albums from the track artists. However, the latest release of iTunes does have a new Sorting tab in the File -> Get Info menu when a single track is highlighted, and that allows me to type whatever I like into the Sort Artist field, and have that override artist as far as sort order is concerned. Here is how I could make iTunes sort as I’ve described above:

  1. If the album this track comes from is a soundtrack or compilation, put the album name followed by the album release year into the Sort Artist field.
  2. Otherwise, put the artist name followed by the album release year into the Sort Artist field.

Unfortunately, there Sorting tab isn’t visible when selecting a whole album’s worth of tracks, so I’d have to go through all 9000 tracks in my library one at a time and paste this information in manually. Sounds like an ideal job for Applescript to me, and since I’m trying to learn the language and add it to my repertoire I’m inclined to jump in head first and code it up…

But first, hasn’t anyone done something like this already? Surely I’m not the first person to be frustrated by the crappiness of iTunes’ sorting? Or have I just missed some clever whizbang option right there in iTunes already that would save me a day of coding? Please enlighten me in the comments!