Archive for October, 2005

Software licenses and nuclear power

In a recent sample from Sun, I noticed the following in their license:


 * You acknowledge that this software is not designed, licensed or
 * intended for use in the design, construction, operation or maintenance
 * of any nuclear facility.

Given that the example code was for using MIDP apps to interface with a web service, I think I’m happy for the exclusion. Pondering being able to meltdown a nuclear reactor from a bug my cell phone.

Now that’s scary.

ICFP 2005

The Dylan Hackers have done a very good job at the ICFP 2005 programming content. There has been some media coverage, and the team themselves have done a very good write up.

Some people complained it were too much work for such a short period of time, but we think we’ve shown that using a sufficiently powerful programming language allows to be done with the mechanics part in time, leaving plenty of opportunity to care about the challenge itself.

Personally, I hadn’t heard anything about Dylan as a language before today however the above quote seems quite telling. Haskell was the other language to have a high level of success at the competition taking out the win, with second and the judges prize going to the Dylan team.

Entries were submitted in a range of languages, and over the years, it has consistently been the languages with high abstraction that allow programmers to focus on the problem at hand that have done the best.

I remember back when I was at uni that our Mercury team had done well at this competition for a similar reason. Mercury being a nice language which is to Prolog what Haskell is to Lisp, it provides a high level abstraction of a computing model while still being fast enough for daily use.

Saving a file using NSSavePanel

Saving a file was something I’d been avoiding for a while, as I hadn’t been able to find the right control in Interface Builder to make it happen. This had led me to believe it was going to be difficult and was delayed for a long time.

Today, I bit the bullet and spent some time to figure this out. My suspicion was that there existed a control that would do the work for me, as file handling is quite consistent from a UI perspective in Mac OS X. Reading through Cocoa Programming didn’t provide any enlightenment, so I went back to the XCode documentation.

By this stage of my Cocoa learning, I really should have known better. Apple’s documentation has solved too many problems for me to be consulting it as a last resort. Unfortunately, I suspect it is a lesson I will have to keep learning.

Apple provides this information about the NSSavePanel class. Finding this class was my ‘aha!’ moment for the day. No wonder I couldn’t find it in Interface Builder, it isn’t an IB control in the normal sense.

In Python, the simple version looks something like:


from AppKit import *

def saveFile_(self):
    sp = NSSavePanel.savePanel()
    sp.setRequiredFileType_('ics')

    if sp.runModal() < = 0:
        return

    print 'Filename: ' + sp.filename()

This will throw a standard file save modal dialog box and ask for a filename to save. There are a bunch more options on the NSSavePanel class, which I may explore later. The interesting part will be making the save panel appear in a sheet.

Something to explore later.