Planet::Articles
Well, somehow we've made it to the end of the first semester of this year, and I quite inconveniently forgot to write about anything since the start of April. This is quite problematic. I guess that means it's time for me to do my semi-regular dump of notable things. Bleh.
So, where to begin?
ACM-ICPC Trip
So yes, we did arrive safely in Germany, spending a week with my relatives who live just outside of Frankfurt-am-Main in centre of the country. That was a fun week, we spent many days taking in the area, sampling the culture, and preparing for the programming contest the next week. We spent a week in Stockholm, where the contest was held, which was great fun in general (despite being somewhat colder than Germany and indeed Australia), we met many like-minded people, and thoroughly enjoyed the week. In the end, we solved three problems in the contest, which was (just) sufficient to see us getting a ranked position of equal 49th (yay!).

I'll write up the two weeks spent overseas in greater detail soon (hopefully).
Twitter & Co.
So I succumbed to peer pressure roughly two weeks ago, signing up for Twitter and Identi.ca. As a fun experiment into the field, I investigated how long it would take, and what measures would be necessary, for someone to notice that I was on Twitter, and then follow me. I did this by following one or two people per day, and getting them to drop relatively silent hints about my existence. In the end, it took about a week for someone to notice me, with a fairly blatant reference to me needed to make it obvious. Despite the great scientific breakthrough observed, I don't think the result is sufficient to write a paper about... :P
My main observation is that Twitter is miles behind Identi.ca in terms of useful features (I like group notices, denoted by '!' tags in Identi.ca, and Jabber-based updating in particular), stability (updating my Avatar in Identi.ca does indeed work first time, every time, whereas it took me 10 tries to get it to work in Twitter), and ability to store my own name (This would make Twitter the first site that I have ever needed to call myself "Chris" as opposed to "Christopher"), that said, Twitter is ahead greatly in terms of the number of people on it, which makes sticking around there a necessary evil (boo for centralisation!).
End of Semester/Undergrad
And yes, it would be amiss to not note that last week was my last week of lectures as an undergrad student (presuming, of course, that all of my exams go sufficiently well), it was mostly uneventful, with the exception of having to hand in two major assignments, prepare and present a lightning talk, and run the session in which it was presented. All-in-all rather busy!
Friday saw the second edition of the UTAS Computing Society Lightning Talks, if you haven't seen them already, I highly recommend that you check them out -- this semester's were at a very high standard indeed, and I wish I'd printed out more certificates for good talks :). My talk was a demonstration of using metaprogramming in Python, though that's not what it seemed to be about.
An introduction
I went to the Apple University Consortium's Cocoa Workshop at the University of New South Wales in February of this year, it was a heap of fun, and we learnt heaps whilst there. One of the key distinguising features of Cocoa is its use of verbose English method and attribute names, the idea being that each line of code should make a reasonable amount of sense when read aloud, hence:
NSString *str = [[NSString alloc] initWithString @"Hello World!"]
does indeed allocate memory to hold a string object, and initialises the newly-allocated memory with a string containing "Hello World!" (this code is highly redundant!). Supposedly such a naming scheme allows coders to write code that is easily maintainable by the original coder, and easily learnable by people who pick up the code for the first time.
On the other hand, my friends, collectively known as Maclab (named after the room at UTAS we inhabit) have developed a rather unique vocabularly, which in particular involves replacing as many words as possible with either 'thrust' or 'fork', so "Thrustingly thrust the forking forker" is not an uncommon utterance amongst my friends. If this is indeed their usual mode of conversation, then Cocoa's way of identifying methods and attributes is not necessarily going to be a particularly intiuitive one. So, clearly, we need a version of cocoa that meets their needs.
The setup
So, conveniently, Apple provide a comprehensive version of the Cocoa API, thanks to the PyObjC project. We can therefore use the Python bindings for Cocoa facilitate our new version of Cocoa. Since Cocoa has a very consistent naming scheme, we can simply perform string replacement to translate from our maclab language to the standard cocoa language, using a routine somewhat like this:
def translate(inp):
''' Translates an input string from key language to value language '''
for i in LANGUAGE:
if i[0].islower():
# Try both capital case and lowercase
inp = inp.replace(i, LANGUAGE[i])
inp = inp.replace(rtitle(i), rtitle(LANGUAGE[i]))
else:
inp = inp.replace(i, LANGUAGE[i])
return inp
def rtitle(i):
return i[0].upper() + i[1:]
Here, LANGUAGE is a dictionary, with keys in the language code will be written in and values being the target language (in this case, Cocoa). There's not all that much of a sophisticated nature going on in here. Now that we have a method by which we can translate our attribute accesses, we can get to the meat of the the code.
The implementation
To achieve the new API, we need to use a technique that I will call proxying. This involves the use of objects whose sole purpose is to intercept attribute accesses and calls to an underlying object. In this case, the point of intercepting the calls and accesses is to perform translation from our new objects to standard Cocoa objects. In Python we can do this by overriding the standard attribute access and call methods.
First up is __getattr__, the attribute accessor method -- for this, we are passed a string; the name of the attribute that we're looking for, which we translate, and then attempt to access upon the method on the underlying object (in this case, self.__u__). There is one slight hitch: in certain cases, we may not want to translate the attribute name. This is true, in particular, of the attribute that represents the underlying object. Hence we provide a REAL_ATTRS list, for which we use the default __getattr__ method for. This results in code that looks something like this:
def __getattribute__(self,name):
#''' Perform method/attribute proxying on ''' + repr(self.__u__)
if name in REAL_ATTRS:
return object.__getattribute__(self,name)
else:
new_objectname = "self.__u__.%s" % translate(name)
new_object = eval(new_objectname)
return CocomoProxy(new_object)
Notice that we use eval to perform the lookup? It turns out that __getattr__ doesn't work universally, whereas . notation does -- so we use that for less failover.
Being able to call methods on the objects is important, but slightly more difficult -- we want behaviour to be maintained, so we need to make sure that proper Cocoa objects are passed as arguments, rather than the Proxy objects that you may have originally dealt with. We can do this with Python's argument unpacking -- we build up a list of arguments, and unproxy them as necessary:
def __call__(self,*a, **k):
new_a = [i.__u__ if type(i) == CocomoProxy else i for i in a]
new_k = dict( (translate(i), k[i].__u__ if type(k[i]) == CocomoProxy else k[i]) for i in k)
return CocomoProxy(self.__u__(*new_a,**new_k))
We may also need to deal with iterators. This can be done using a standard generator function, thusly:
def __iter__(self):
for i in self.__u__:
yield CocomoProxy(i)
Finally, there may be legitimate reasons for extracting Cocoa objects, these include printing strings, so we provide an accessor method called no_really:
def no_really(self):
return self.__u__
And that's the entire implementation! The final thing we need to do is provide a pre-proxied version of the base module for Cocoa. Let's call it GypsyMagic.
The payoff
So now that we have a working bridge from Maclab English to Cocoa English, we can take this sample code that puts some stuff into an array, and then prints it:
import AppKit
hworld = AppKit.NSString.alloc().initWithString_("Hello, World!")
arr = AppKit.NSMutableArray.alloc().init()
arr.addObject_(hworld)
arr.addObject_("Boop!")
for i in arr:
print i
And write it in the far more palatable:
from cocomo import GypsyMagic
hworld = GypsyMagic.OGMouthWords.subsume().makeGogoWithMouthWords_("Hello, World!")
arr = GypsyMagic.OGForkableTrinketHolder.subsume().makeGogo()
arr.thrustinglyThrustForker_(hworld)
arr.thrustinglyThrustForker_("Boop!")
for i in arr:
print i.no_really()
If you're interested in seeing how it all fits together, see Cocomo's website.
To bring you a drink that shares its name with an operating system. Ubuntu Cola is a fair trade cola (so the Sugar and Cola farmers in Africa get paid fairly for their wares) that we found in Stockholm. It's rather tasty too. If you're in Europe, it's worth going out and finding some -- it stocks in the UK, Ireland, Sweden, Norway and Belgium.
(Actually useful writings to come later)
As previously mentioned I'm on one of the Australian teams competing in the ACM ICPC World Finals being held in Stockholm on April 21 -- that means that I somehow need to get to Europe, and that somehow is series of flights, today -- with a week's stopover in Frankfurt, to visit relatives who live there.
Flights today are Hobart-Melbourne (not too bad) and Melbourne-Frankfurt via Bangkok (oriental setting), an ugly 28 hours total in transit (that I'm not really looking forward to), arriving at the somewhat inconvenient time of 6AM (just to ensure that any excess jetlag will be comfortably prolonged).
I'll be trying pretty hard to document my trip here, and this will probably mean that there'll be a bit of extra noise coming from me on PLOA -- for those of you with little interest in what I'm doing: sorry about that!
Earth Hour was celebrated yesterday: buildings and households all around Hobart switched their lights off as a statement in favour of action on Global Warming.
This is Wrest Point Casino (Hobart's tallest building) with its external lights switched off -- though it would seem that some of the patrons of the hotel didn't get the message.
Wow. It's been a thoroughly busy month, lots of things to recap, so I won't bother going into too much detail... Here's a selection:
AUC Workshops
In February, the Apple University Consortium sent me to Sydney for their annual Cocoa Developement workshop, and to Melbourne for their inaugural Ruby on OS X Workshop. Both workshops were great, and if you attend an AUC Member University, you really should sign up for their future workshops; that said, I can't see me seriously using Rails for anything in the future, and Obj-C peeves me... Cocoa, on the other hand is seriously exciting, and even from a few days' exposure, I can see why Cocoa developers love their framework so much, and the lack of a similar facility for making good UIs quickly in Linux is really obvious to me now . Hopefully this is something that gets addressed in future releases of the major desktop environments.
Semester 1 Gogog!
Uni went back this week, and it's been all-in-all rather eventful. It's the start of my final semester of undergrad study, which is going to encompass holding the presidency of TUCS, our Campus Computing Society, going to Stockholm to compete in the ACM Programming Contest, all the while juggling effectively 5 units of study. How I'm going to cope with it I have no idea, presumably I will though...
This semester, I'm studying three maths units (two pure, one applied): Computational Methods (or, how to avoid doing hard maths... clever how they keep that one for third year), Algebra 3 (mostly group theory this year) and (Functional) Analysis 3; Computing-wise, I'm studying Data Mining & Text Retrieval (the 3rd-year Machine Learning unit), and Advanced Web Development (purely as a Gimme unit). Hopefully this one constitutes a reasonably good mix between fun and interestingness -- and hopefully not too time-consuming. On another note, Kumudini (the lecturer for Analysis) deserves special thanks, as she's gone out of her way to ensure that Analysis is being offered before Semester 2 for me, which I'm quite grateful for (as it means that I can graduate with the Pure Maths Major).
TUU Societies Day 2009
Mentioning the start of semester without mentioning Societies day would be quite amiss -- for those who are unfamiliar, socieities day is a 3-hour event held on the first Wednesday of the Uni year, where students signup for their chosen sports clubs and societies, generally in return for Alcohol. This year, however, the Union made the curious decision to spilt the allocated space in two, and provide a dry area, which proved to be very useful for us at TUCS (as we'd decided quite some time eadlier that we'd not be providing alcohol). The Union kindly provided us with space directly outside the wet area, which gave us a massive wall for advertising, and the dry area made all our volunteers highly visible (due to there actually being space to move about).
TUCS put on a Barbecue, and provided "Enticing Gift Bags" (full of things including leftover LCA09 schwag) to new members. The Nett effect of this was that TUCS signed up 115 members, which is almost three times as many as we managed on societies day last year. Obviously, we're pretty happy.
That's all for now, more as it comes!
Friday's keynote was fantastic -- Simon Phipps (who retained his job at Sun Microsystems) spoke of the Third Wave of Free Software, which was an observation that Free Software (specifically not Open Source) is becoming a sensible business proposition. It's about time that it did. It was refreshing to see a large corporate's view of the world of Free Software largely agreeing with my own. Talks after morning tea were Tridge's talk on his automatic cluster testing framework (pretty cool), followed by Conrad Parker's talk on Ogg Chopping, which despite the name, was actually a 50-minute rant about why Haskell is cool -- I'm sold (I think), but somewhat confused about the talk -- really, I have no idea what happened. I strongly urge you to watch the video (when it becomes available) in order to figure out what happened for yourself.
Lunchtime was the Great Unbeardening -- Linus Torvalds (who was roped into the act at the auction on Wednesday) shaved Bdale Garbee's beard -- the result? Disturbing. Really disturbing, but all in the name of charity. The #lca tag on twitter was displayed on the projector screen, so live audience responses were shown as the shaving continued, including one Maclabbian pointing out the relative weirdness of the event; photos were up on Flickr well before the end of the event, and Southern Cross News came to film the event (focusing on the shavee, and not the mysterious Finn doing the shaving...).
Matthew Garrett's talk on Power Management that works was great: nothing too technical, but an excellent discussion of the user interface issues surrounding power management. Matthew's talk was unique in that his talk covered everything in his abstract -- this includes answering the question "will we ever get to beer island?" -- the answer? Yes, provided you're in Texas. Following was Geek My Ride, presented by Jonathan Oxer and Flame -- this was a pretty cool demo talk, showing how the two of them have modded their cars to include some pretty cool stuff, including in-dash diagnostics, MP3 playback, and remote ignition (wow cool!).
The final talk of the conference was Bdale talking about rockets, which as usual were pretty cool. Lightning talks concluded the conference as they did in 2008 -- nice to see them becoming an LCA tradition, I will definitely aim to present at least one next year.
Conclusion
So that's it. LCA is over for another year, and will reconvene in Wellington, New Zealand for 2010 -- I've never been to New Zealand, and am really looking forward to going there next year. The 2009 Conference was excellent, the talks were well-presented, and the organisation of the conference was such that it appeared from the outside that the everything ran well (I've been told that that was certainly not the case). The conference allowed us to show off Hobart to the technical world, which is an opportunity that does not present itself regularly -- I'm glad that we got that opportunity, and I think most delegates this year will agree that it was an opportunity that was well-received, and resulted in an excellent conference for all involved.
Also thanks to Adam Harvey and Monica Wood for helping out at UpDNS -- you certainly made my job in organising it a lot easier; Linux Australia for having faith in the organisers ability to put on the conference -- I hope your investment in the Tasmanian Free Software Community pays off.
The opening Keynote on Thursday was a discussion of the Wikimedia/Wikia project, which was overall not too bad. The highlight of the talk was the relaying the Parable of the Vegan, which was quite hilarious. Sadly, I don't think the talk was quite as good as it could have been -- too much time was spent teaching the purpose of Wikipedia and the structure of the wiki community, which I think was generally common knowledge amongst the audience. Once questions were asked, it became generally more interesting.
After morning tea were the absolutely fantastic Perl talks of Paul Fenwick, the first was "The Art of Klingon Programming", which made a hugely insightful analogy between the Perl programming language and Klingon culture, and used this to inspire his talk about libautodie, a library that makes Perl behave sanely in the face of supposedly fatal errors. It's pretty damn cool, and cleans up one of my least favourite things about Perl (though quite a few still remain), Paul's second talk of the day was on new features in Perl 5.10, which were interesting. Perl 5.10 has added a swtich-alike block, which I think is a model that other languages should adopt -- instead of the C-style 'break-or-fallthrough' method (which introduces many stupid bugs for newbies), Perl adopts the 'continue' keyword to allow a fallthrough, or no statement to break -- this is pretty damn clever, if I do say so myself.
This was followed by a talk entitled 7 Things Lawyers Don't Understand About Software -- delivered by a UTAS Law PhD student, who presented some very interesting arguments about the likeness of software and mathematics, and related this to the unpatentability of mathematics. His research appears interesting and I urge you to check it out.
After Lunch was Donna's The Joy of Inkscape tutorial, the point of which was to have people tinker with inscape for two hours, with occasional supervision from experts. Sadly, the room (which holds 40 with tables) overflowed, and hence the tutorial didn't appear to function entirely as planned. I don't think this affected the ability of people with seats to enjoy the tutorial though, which is nice.
Following Afternoon tea, I relaxed for a while (indeed skipping a talk), and finished up at Hugh Blemings' talk on learning Free Software Hacking from Clever People -- this talk was a disappointment -- from casual observation, people in the audience provided more useful input than the speaker, and the speaker was mostly inaudible (partially due to his tone of voice not agreeing with the room acoustics).
Thursday Evening involved me and various TUCS people running the Unprofessional Delegates Networking Session at the Uni Bar -- this was a massive success for us (we turned a profit!!!) and we were happy to provide an opportunity for the non-professional delegates to socialise whilst the professionals enjoyed their pissup at a brewery. Never underestimate the power of meat and quanitity burger to attract and feed people. I should direct many thanks to the business staff at the TUU and the Uni Bar, who opened their facilities at 3 days notice, for what was effectively a break-even prospect. Hopefully TUCS can do more work with them in the future.
Tuesday I spent mostly at the Free as in Freedom miniconf, where I saw Arthur Sale's talk on Open Access journals (where he outlined the changes that need to occur in the research publishing industry in order to support research in the online age), Jeff Waugh's talk "We are the Translators", which drew some enlightening parallels between Gutenberg, early Protestants (who translated the bible into modern languages, much to the disgust of the Catholic church) and the modern Free Software movement.
The final talk of the day was presented by Rusty, which essentially consisted of a fantastic 25-minute rant against modern IP law. The talk was passionate, interesting, and featured an interpretive dance about the dangers of software patents. I think that just about sums the talk up. Here I also met Paul Fenwick (developer of Autodie, the library that makes perl behave sanely in the face of errors); to my horror, many of my friends, who were sitting in the same general area as me hadn't seen Paul's lightning talk from 2008, so I took the opportunity to show them -- it's still as fresh and witty as it was last year and if you haven't seen it I urge you to again. At the conclusion of FIAF, we played Freedom Bingo, which although running for the first time ever, went pretty well -- I (as the last person to win a prize) secured a copy of Girl Talk's album, which I'll listen to sometime in the nearish future.
Outside the conference proper, I went with some fellow student (and one professional) delegates to Da Angelo's in Battery Point. Needless to say, it went down a treat (I was thanking my luck that we managed to get a table there at such short notice) -- everyone was really happy with their meal, and other than that, the company was excellent, and was all-in-all a pretty good night.
Tom Limoncelli opened the conference proper with his keynote on "The Scarcity Mindset vs. The Abundance Mindset", which was an interesting and insightful talk on how the modern abundance of computer hardware, coupled with open source software can help sysadmins make better use of their resources. I must congratulate the organisers of the conference for selecting a sysadmin talk as the opening keynote: LCA has suffered from a lack of sysadmin talks (which the miniconf has fixed to a certain extent), and having such a keynote open the conference is an excellent investment in furthering sysadmin content at future LCAs. That said, the talk was very sysadmin-specific, and was therefore not directed well at the majority of delegates (discussing things like implementing better tech support policies in the workplace). For those more willing to look at the bigger picture (i.e. by factoring out the direct application to sysadmining, the abundance mindset is certainly something that can be used to better support open source development.
This, for me, was followed by Keith Packard and Carl Worth doing a double-feature talk on recent developments in X, followed by a demonstration of the Linux graphics pipeline, including some discussion of how graphics drivers can be improved to allow better rendering from (say) Cairo and OpenGL. I went to the Django tutorial after lunch, which was reasonably interesting, though I stopped actively participating about halfway through. It was interesting to see how Django works, and how some of its choices were made as far as design was concerned -- in particular how there are many features designed for journalists, since Django was developed in-house by Journalists in Kansas.
Post-afternoon-tea, I went to Jonathan Corbet's talk on joining the Kernel development process, which was a departure from his usual "Kernel Report" talk -- he explained the significance of the various trees of kernel development, and explained how to work with subsystem maintainers in order to ensure that your driver became well-maintained into the future. This talk was significantly enhanced by Linus Torvalds being in the room, helping answer questions and providing further input into the presentation as it presented: this was probably the closest he got to presenting for the entire week. Following this was Martin Krafft's talk on the vcs-pkg.org project, or how distribution package maintainers can collaborate with their counterparts at other distros using distributed VCSes such as Git. He presented a good discussion of his own workflows, as well as discussion of the suitability of various tools for the purpose of cross-distro collaboration.
The real highlight was Wednesday night's penguin dinner, which featured the most bizarre auction that I've ever seen, which ended up with a consortium of Kernel Hackers and Collabora paying AUD$10,500 for a print of a photo, and a beard. This has already been discussed adequately elsewhere, so I shalln't bother.
















