Yearly Archives: 2009

Announcing the LCA2010 Open Programming Languages Miniconf

You may have caught the announcement yesterday about the miniconfs accepted for Linux.conf.au 2010 (to be held in January in Wellington) and noticed my name there…

I’m running one of the miniconfs this year, along with Jacinta Richardson. It’s called the Open Programming Languages Miniconf, and is all about doing application development with open source tools (languages, libraries, frameworks, etc). Our proposal put it like this:

The Linux.conf.au Open Programming Languages Miniconf is a single-day mini-conference about application development with Open Source programming languages. Featuring talks on a wide range of topics and programming languages, this miniconf aims to bring together open source developers with presentations that share techniques, best practices and values amongst programmers of all open programming languages.

Our CFP isn’t quite ready yet, but our website is, and you can go there to read more of our proposal, and subscribe to our announcements RSS.

So if you have something to say about developing with Python, Perl, PHP, C, or any other open source programming language, start planning your talks and presentations; I look forward to seeing the quality from the main conference submissions first-hand!

Oh, and see you in Wellington!

3 birds…

Let’s kill two birds with one picture, as it were…

Point 1? I got an Honours scholarship. Yay me! Secondly? I got my final mark today (for Functional Analysis), a very satisfying 95 (better than my previous marks for the semester by a long way). This means that I now officially have sufficient credit to graduate to a Bachelor of Science (though this is mostly a formality, I’ve been doing Honours study for two weeks now), and will do so in two weeks time. Awesome!

The third bird? My Honours thesis topic has been allocated. Put as vaguely as possible, it’s about augmenting a machine learning-based object detection system (for images) to use colour images instead of black and white. My supervisor is Mike (my ACM-ICPC coach, as it were). I’ll _try_ and explain it better once I’ve done a bit more reading than I have so far…

Normal service to be resumed later,

–Chris

More Thingies!

Time for another status report on things that have happened recently!

More Uni!

First up, I’ve started on my Honours year! Isn’t that exciting? As I’ve learnt this week, the next 12 months for me will consist of 4 coursework units, and a research thesis. This semester, it looks like I’ll be studying Embedded Systems (yay! I get to program some microprocessors! Whoo!), Computing in Context (a research-intensive unit in HCI), and possibly one other, depensive on what the unit outline for it looks like. My thesis I’m not so sure about, given that the process by which we get assigned supervisors hasn’t occurred yet. Currently, I have a pile of 12 project areas for my perusal, from which I must rank 6 proposals by order of how much I want to study them. At the moment, there are some interesting-looking proposals relating to Machine Learning, and some interesting ones relating to web monitoring; I find out what I’ve been assigned by Friday (very exciting, no?).

Linux.conf.au 2010

Linux.conf.au 2010 is being held in Wellington, New Zealand. One of the things that makes LCA a truly wonderful conference is the first two days, devoted to single-day “miniconfs” on topic areas of interest to the Free and Open Source Software communities. I’m currently involved with two proposals; I’m primary proposer of a developers’ miniconf (called “Open Languages”) aimed towards uniting the developer communities of open source programming languages, and I’m secondary proposer of an education-flavoured miniconf. I’d be equally happy if either of these proposals get up, but with 30 other awesome proposals competing for 12 openings for miniconfs, there’s going to be some very stiff competition.

Blackjack?

Hey, turns out I turned 21 on Wednesday. How did I manage that?

Worldwide Photo Walk 2009

I had the fortune yesterday to go on the Hobart edition of Scott Kelby’s Worldwide Photo Walk 2009. The WWPW, in its second year, is an organised photo walk, with groups taking photos in 900 cities across the world. This year was the first time it had been run in Hobart, and was organised by local photographer Nigel Honey. The walk started in Molle Street, following the Hobart Rivulet to the Cascade Brewery, and back along Macquarie Street.

I used the day as an excuse to finally use my new ultrawide for an extended period of time, which I’ve been waiting for for over a month now: the difference in shots that an ultrawide affords you is incredible, the flipside is needing to spend far more time paying attention to composition and ensuring that the entire frame of the photograph is well-used (being selective about subjects is very difficult due to massive depth-of-field).

Perhaps the most interesting find of the day was an abandoned scrapyard in South Hobart near the Brewery, apparently a dumping ground for old cranes, and this is where my most interesting set of shots came from:

Worldwide Photo Walk -- Hobart

Light on Steel Beams

Worldwide Photo Walk -- Hobart

The Photo Walk should be happening again roughly this time next year, if you enjoy taking photos of things, events like this present a really good opportunity to improve your skills, learn tips and tricks from people with similar interests to you, and to explore places that you might not have considered visiting before. It’s certainly something I hope to do more regularly myself, in the not-too-distant future.

End.

After a somewhat self-enforced marathon exams session, I finished my last (and arguably most difficult) exam on Monday, that was for Functional Analysis, and my first results came out this morning: 3 HD marks and a Distinction, not quite as good as my excellent run of last year, but still not dreadful either. Given that I’ve passed everything, it means that I’ve finished the undergrad component of my degree! Hurrah!

Graduation is in early August, but before then, the Honours programme starts Friday, after only three days worth of holidays. Excellent!

What? Where did the last 2 months go?

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… 😛

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!

Cocomo: An experiment in metaprogramming in python

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(): 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): 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.

We interrupt your previously scheduled silence…


Ubuntu Cola, originally uploaded by Christopher Neugebauer.

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)

Leavin’ on (a) jet plane(s)

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!