Passing Curiosity

Archives

This is the complete archive of posts at Passing Curiosity in reverse chronological order.

Posts before September 2007 were originally posted on other -- now defunct -- blogs. I'm gradually cleaning them up, but there may be some broken links and the like.

19 Sep 2011

Tweaking the configuration of cabal-dev

While cabal-dev is great, I need to make a few tweaks to its default configuration before it's useful.

31 Aug 2011

Using git repositories for platform versioning

This is a guide to my current thoughts on using git to maintain and distribute platform releases for Drupal-based projects.

11 Jul 2011

Drupal 7: theming forms with tables

This is a quick guide to using tables for layout of forms in Drupal 7 without being naughty.

01 Apr 2011

Trip to Japan

I'm on holiday in Japan right now.

18 Jan 2011

Getting rid of Boot Camp volumes

A short overview of my last few hours fighting to get rid of the Boot Camp, Ubuntu Linux and rEFIt volumes on my Macbook Pro with Snow Leopard. It was a struggle, but I got there.

12 Jan 2011

Planning for DrupalDownunder

I'm off to Brisbane later this month for DrupalDownunder (and LCA). This is a quick overview of the things I'm looking forward to.

10 Nov 2010

IE performance problem turns out to be images not found

A quick post describing a performance problem I encountered in Internet Explorer and what it turned out to be.

10 Nov 2010

Fixing the "Reformat Quoted Text" command in TextMate

How to fix the "Reformat Quoted Text" command in TextMate so that it works on Intel Macs (without installing Rosetta).

11 Oct 2010

Using ImageMagick and GD2 together with Drupal ImageCache

A quick (working!) introduction to using ImageMagick in custom ImageCache actions while using GD as your default toolkit.

06 Jul 2010

Going Further with Litecal

This article builds on my last by adding additional features to a calendar view based on litecal.

05 Jul 2010

Using Litecal

This is a quick introduction to using the litecal module to display month calendars on Drupal powered web-sites.

11 May 2010

Providing default settings for Django applications

There doesn't seem to be an official way for a Django application to provide default values for its "custom" settings - you just document them somewhere and hope that the users take note. Here is some proof of concept code to automatically inject an application's defaults into Django's settings.

14 Apr 2010

Updating an INI file with AWK

A colleague asked if I knew a way to edit a line in a particular section of a .ini file in a shell script. There are plenty of ways to do this, but my answer is in AWK.

10 Apr 2010

Barcamp Perth rides again

Barcamp Perth 4.0 (or 2010, there seems to be some confusion) was held today at the Central Institute of Technology. Here are some notes about the day.

18 Jan 2010

Attribute Oriented Programming in PHP

The fourth talk at the Open Programming Language Miniconf 2010 was Peter Serwylo's presentation about Attribute Oriented Programming in PHP.

18 Jan 2010

Notes on Preparing for PHP6

My notes on Ben Balbo's talk at Open Programming Language Miniconf 2010: Preparing for PHP6.

18 Jan 2010

Notes on Introducing Gearman

My notes on Giuseppe Maxia's talk at Open Programming Language Miniconf 2010: Introducing Gearman -- Distributed server for all languages.

18 Jan 2010

Notes on Haskell, and all the wonderful things it doesn’t let you do

My notes on Stephen Blackheath's talk at Open Programming Language Miniconf 2010: Haskell, and all the wonderful things it doesn’t let you do.

17 Jan 2010

Welcome to LCA2010

So LCA2010 is underway. It's been busy and it's only day two (day one really), so I'll give a brief recap so that I can remember it later.

15 Jan 2010

In Wellington for LCA2010 and DrupalSouth

I'm currently in Wellington, New Zealand for linux.conf.au 2010 and then DrupalSouth. It's going to be a pretty awesome week! I'm looking forward to getting back up to speed with Linux which I've used only superficially for the last few years after switching, on a lark, to FreeBSD and then to Mac OS X.

I'm looking forward to seeing just how much Linux has changed since I last built my own kernel (circa 2003).

I'll be going to the Open programming languages, Multicore and Parallel Computing, Data Storage & Retrieval, and System Administration miniconfs. Session wise, I intend to look in on most of the kernel and low-level user space talks that I can.

After LCA per se is done (but during open day, unfortunately) I'll be at DrupalSouth to pick up some more Drupal-fu by osmosis.

If you're interested, you can see more LCA and Drupal specific articles in the LCA archive and Drupal archive.

13 Jan 2010

Progress with Jekyll

I've made a bit of progress hacking on this blog the last few nights...

12 Jan 2010

Converting to Jekyll

This blog has been languishing for months now, nearly untouched. I'm changing that now, by throwing WordPress away and replacing it with Jekyll.

04 Nov 2009

Nick Cowie's talk on Progressive Enhancement with CSS3

My notes on Nick Cowie's talk "Progressive Enhancement with CSS3" at Edge of the Web 2009.

04 Nov 2009

Dmitry Baranovskiy's talk on Your JavaScript Library

My notes on Dmitry Baranovskiy's talk "Your JavaScript Library" at Edge of the Web, 2009.

04 Nov 2009

Lachlan Hardy's session The Open Web

My notes on Lachlan Hardy's presentation "The Open Web" at Edge of the Web, 2009.

04 Nov 2009

Anil Dash's keynote on "Next Year's Web"

My notes on Anil Dash's keynot speech on "Next Year's Web" at Edge of the Web, 2009.

03 Nov 2009

Logging the locking in SPIP

The rather hackish way I instrumented SPIP to record debugging information about its file locking to a remote syslog server.

02 Nov 2009

Edge of the Web 2009

A list of the sessions I plan to attend at the Edge of the Web, 2009.

20 Oct 2009

Treatments, Typography, and Markdown for SPIP

A quick and rather hackish way to replace SPIP's built-in text markup format with Markdown.

14 Oct 2009

UML Statecharts meeting in Perth

Last night I went to my second (or third, does the first "yes, we should" meeting count?) meeting of the Perth UML State Charts reading group. Curtin University is a bit of a trek for me (two busses out and three busses back; each trip takes around an hour), but at least I didn't wind up walking after getting off half way there! Unlike the first meeting (which was primarily about the book), we spent most of this meeting talking about projects and interesting things that we've seen around. What follows is in no particular order, and just a taste of the discussions (hooray for a poor memory).

I'd just installed the Arduino, so I got that up on the projector for those who hadn't seen it before and talked a little bit about the goals of the Arduino project and how that has affected the implementation. Talking about the libraries and the "shield" approach helped solidify it in my mind a little and it's an interesting approach to this sort of development that seems new to some of the others (who're familiar with real embedded development). I also explained a few things about Haskell and the approach (as I understand it; i.e. "poorly") used in the atom library. I'm planning to have some more to say (show!) about using Haskell to implement hierarchical state-machines next fortnight.

Harry spoke about his numbatcam project (which he also talked about at Perth Barcamp 2009) in a bit more details and showed us some of the code. He mentioned the idea of reducing the duplication of states (one of the reasons we use hierarchical state-machines is to reduce the state explosion inherent in other state-machine formalisms) involved in his handling of setting the current time and the alarm time (each is an arrangement of a few states and transitions which are identical, other than their differing parent states).

I suggested that it would be possible, in a framework which supports orthogonal state-machines (multiple machines which run concurrently and independently of one another), to implement a "time chooser" state-machine and replace the current duplication with waitingToSetTime and waitingToSetAlarm states which have an entry action (posting a SET_TIME(curr) event) and a single transition on TIME_SET(new) events. Given that the UI state-machine is can be in either the waitingToSetTime or the waitingToSetAlarm states, then the "time chooser" state-machine can handle the entire choose-a-time interaction and then post the TIME_SET(new) event to the UI state-machine and whichever state it's currently in can set the time or the alarm as it wishes. Alas, the framework used in the numbatcam doesn't support orthogonal state-machines (easily).

Russell spoke about the doorbell system he'd been working on as a learning exercise. Rather than just play a sound every time the button is pressed, Russell's doorbell incorporates a "polite pause" a light and a buzzer (to deal with those annoy people who feel the need to press the button repeatedly). Though just a learning exercise, it was certainly an interesting one. Even more interesting was his hierarchical state-machine-based hierarchical state-machine generator! Based on a description of a hierarchical state-machine description in emacs outline format (plus some support code), his project will generate the C code implementing the state-machine. Even more impressive, it's implemented in exactly the same framework as the programs it generates. The only way he can make it more awesome would be to treat the current version as a bootstrap, and generate the next version from a state-machine description (to "eat his own dog food" so to speak).

In any case, there's lots of interesting stuff going on in the group. I'm looking forward to the next meeting.

26 Sep 2009

Some links on public key encryption in Python

This is the text of the first answer I've posted on Stack Overflow. You can see it in context , but I've posted it here with all the links:

My blog post (the http://passingcuriosity.com/2009/aes-encryption-in-python-with-m2crypto/ link in John Boker's answer) does AES -- a symmetric encryption algorithm -- using the M2Crypto. M2Crypto is a Python wrapper around OpenSSL. If the public key encryption algorithm you need to use is supported by M2Crypto, then you could very well use it to do your public key cryptography. The API is pretty much a straight translation of OpenSSL's into Python, so the somewhat sketchy documentation shouldn't be too much of a problem.

I found the M2Crypto test suite to be a useful example of using its API. In particular, the RSA, PGP, and EVP tests will help you figure out how to set up and use the library. Do be aware that they are unit-tests, so it can be a little tricky to figure out exactly what code is necessary and what is an artefact of being a test.

20 Sep 2009

A complaint regarding the ABC's uncritical dissemination of anti-vaccine propaganda

Here is my complaint to the ABC regarding one of their recent articles regurgitating anti-vaccine propaganda from the AVN loons.

ABC News recently published an article titled "Vaccine could be 'more dangerous than swine flu'."

Judging by the title and text, the entire article appears to be nothing more than a credulous regurgitation of propaganda from a known anti-vaccine campaign group. The article contains direct quotes from only a single source -- Meryl Dorey, from the Australian Vaccine Network -- and even a cursory examination of the background of Dorey and her organisation shows that they are not only not a reputable source, but they about as biased a source as the author could find.

I find it worrying that the ABC is assisting the AVN -- by publishing their entirely discredited views -- to undertake behaviour that is the subject of a complaint to the New South Wales Health Care Complaints Commission, a fact that the ABC has itself mentioned in previous reports (http://www.abc.net.au/news/stories/2009/08/06/2647604.htm).

I hope that the ABC will take steps to ensure that future coverage of this and similar issues -- which, after all, may already be resulting in the preventable deaths of Australian children -- are based in fact obtained from credible sources. Continuing to spread such disinformation is, in my opinion, a discredit to the ABC and its audiences.

Regards,

Thomas Sutton

See Sean the Blogobaut's post Aunty* gets it wrong ñ ABC online aids in the promotion of vaccination fears (though my ego point's out I tweeted about it yesterday) and there are plenty more stories at Podblack, Skeptic Zone, and Sean the Blogonaut.

01 Sep 2009

Haskell on Snow Leopard

Being the closet Apple fanboy that I am, I pre-ordered Snow Leopard and had my Macbook upgraded the day of release. Unfortunately, this had the effect of completely breaking my Haskell environment. I've managed to resolve all of the problems that I encountered and have noted the various solutions here. See the end of this post for notes.

Thanks to HowManyFiles you can now read a Japanese Translation: 日本語訳.

First, there's the matter of getting GHC to compile anything. The problem is that Snow Leopard, and all it's compilers, are now 64-bit by default. Alas, the code GHC generates on on Mac OS X is 32-bit and thus the assembler and linker both error out resulting in errors like this:

/var/folders/1J/1JKije6yHpm78qqdjF5N2U+++TI/-Tmp-/ghc7743_0/ ghc7743_0.s:1357:0:
suffix or operands invalid for `push'

/var/folders/1J/1JKije6yHpm78qqdjF5N2U+++TI/-Tmp-/ghc7743_0/ ghc7743_0.s:1401:0:
suffix or operands invalid for `push'</code>

The solution is to get GHC to pass -m32 flags to the compiler (if used), assembler, and linker.

The quickest way ^1 to do this is by editing /usr/bin/ghc -- a shell script which calls the "real" GHC binary -- to add the flags -optc-m32 -opta-m32 -optl-m32. This ensures that the arguments are passed to all invocations of the compiler.

thread](http://www.mail-archive.com/haskell-cafe@haskell.org/msg64038.html).

Alas, this is not the end of the story. The next step in setting up a Haskell development environment is to install cabal-install. This depends on the HTTP and zlib packages. HTTP is no problem now that we can build and run ./Setup.lhs, but zlib appears to be broken and reports "incompatible version" errors at runtime. The error itself seems to originate in Codec/Compression/Zlib/Stream.hsc, but other than that, I'm completely stumped.

The only way forward for me is to either leave my Haskell development for a while (even Hugs won't install with Macports) or, what I'll actually do, do all my development on Linux in a VirtualBox. This is obviously less than ideal and I hope that the GHC developers can fix the issue in time for the next point release of GHC.

Update

The first problem is getting GHC to compile, assemble, and link 32-bit code. This involves a modifying the ghc script as noted above, but also requires that you pass a bunch of flags to Setup and cabal if the code you're compiling links against external libraries (libcurl or libpq, for example). My command lines look like this:

./Setup configure --ld-options="-arch i386" --gcc-option=-m32

The --gcc-option=-m32 probably isn't necessary (the -optc-m32 inserted in /usr/bin/ghc does the very same thing), but the other option is required to convince the linker to use the correct architecture. Otherwise linking will fail and you'll get nothing or, even worse, a broken library or executable. This could probably even be incorporated into the /usr/bin/ghc edits above (-optl-arch\ i386 or similar might do it).

The second problem I encountered (I've seen this problem before in the context of Python packages) is managing to have 32-bit libraries to link against. This last point doesn't matter if you aren't linking against external libraries, but if you are then you may be installing some of them with Macports. In this case, do please make sure that you install the universal variants of every package that you'll want to link against. Without this you'll be installing x86_64 only and the i386 Haskell code will not be able to link. The easiest way is to edit /opt/local/etc/macports/variants.conf to contain +universal before you start installing things. Because rebuilding every package is no fun.

If you're upgrading to Snow Leopard and already have a bunch of stuff installed, then you might want to rebuild it all as universal. Make the change mentioned above and then force macports to rebuild everything as suggested by the Ruby on Rails people:

sudo port selfupdate
sudo port sync
sudo port upgrade --force installed

18 Aug 2009

HAgg: a Haskell FastCGI application (in development)

I've had just about as much of PHP as I can take. I distrust the language itself and most of the packages written in it and have finally had enough. Rather than throwing in the towel and taking up garbage collection as a profession, I'm going to migrating at least my personal sites to Haskell.

Before I can do so, I need to get a firm handle on Haskell web development. I've tried this before but usually get lost in trying to build the perfect web application monad with configuration loading, database connection, error handling, etc. built in. Usually, I'm also trying to brush the cobwebs off my knowledge of Haskell at the same time, so it only lasts a few days before I get distracted by something shiny.

This time I'm using a much simpler project as a starting point: I'm writing a simple "life stream" -- an application which will aggregate a number of feeds and display the most recent entries from them -- as a FastCGI application. This post is a short introduction to my goal, the approach I'm taking, and the project's status.

What is a life stream?

"Life stream" is the rather unappetising name given to an application which aggregates the various feeds of a persons online activity -- their entire online life, if you will -- and produces a summary. A life stream is also usually a live stream in that it reflects changes in the source feeds relatively quickly.

Why implement a life stream Haskell?

Implementing a life stream makes a good first project with which I can get to grips with Haskell web development precisely due to its function as a pure aggregator. I don't need authentication, or serialisation, or data storage, or any sort of interactive functionality. All I need to do is periodically download and parse some feeds (easy with the download-curl and feed packages) and produce a summary to keep in memory and, in as many threads as I choose to use, serve FastCGI requests using this summary.

Easy.

Approach

As the previous sections makes clear, I'm taking a very simple approach here. The execution of the program will go something like this:

  1. Load the list of feed URLs.

  2. Spawn a feed loading thread to:

  3. Fetch the feeds.

  4. Prepare an in-memory "summary" of them.
  5. Put this summary into a shared variable.
  6. Sleep for a while.

  7. Spawn a bunch of threads to handle FastCGI requests:

  8. Fetch the summary.

  9. Render the summary as HTML (or whatever).
  10. Serve it to the client.

I'm using software transactional memory to mediate access to the shared data store (i.e. the variable pointing to the list of data) and leaving error handling to whatever happens to be the default.

There is a single concession to the realities of the FastCGI environment in this "architecture" (if this even merits the name). My first instinct was to load the feeds during initialisation before starting the FastCGI request loop. This, of course, is just asking for a slow feed to cause the FastCGI process manager to think we've failed to start and start throwing 500 errors around. Instead, we begin with an empty state ("render the summary" means fold the list of items into an HTML document) which will be filled in not too long after we start serving requests.

The code

Given the simplicity of the approach described above, it's only right that the code is simple too. And, indeed, the code is simple. The entire application is only four modules:

  1. HAgg -- the main function.
  2. HAgg.Config -- the data types and configuration loading.
  3. HAgg.Fetcher -- the feed processing and update thread.
  4. HAgg.Handler -- the CGI request-handling code.

All up, its just 205 lines of code -- comments and white-space included -- and almost all of that is importing modules and plumbing values from one library function to another.

At the moment, it's extremely limited -- the feed URIs and update period are hard-coded, the "processing" is just pulling out the item title, the feed "merging" is just list concatenation, etc. -- but it does fetch feeds and does publish the "processed" data via FastCGI.

All up, I'm very impressed with how easy it is to get something like this off the ground. Certainly it's no PHP with SimplePie but neither does it require a PHP interpreter (and the few dozen megs of RAM to run it in), or permanent storage for caching. The whole thing uses around 2MB of RAM with 20 request handling threads, the update thread, and the feed data in memory.

Improvements

There are a number of ways in which I could improve HAgg.

  1. The most obvious is by recording the data in permanent storage (i.e. a database of some sort) and presenting a more complete record of my online activity.

  2. Another improvement that suggests itself is by having a per-feed update schedule and by paying attention to feeds that specify an update period.

Further improvements might include an actual template system and actually attempting to handle and deal with errors.

Conclusion

If you'd like to look at the code, it's all available at github.com/thsutton/hagg/. As soon as it's ready, it'll be running on thomas-sutton.id.au.

16 Aug 2009

Reversing the arrow; or how to break canonical URLs

My colleagues and I have recently been working to improve our practices when it comes to semantic mark-up, document structure, metadata, and other fun stuff. Part of this has entailed developing (or having Pierre, who was doing an internship with us at the time, develop) metadata management features for the CMS we use. This new plug-in has a number of features, which basically boil down to automatically generating a number of <meta /> and <link /> elements based on the client's data.

This is all fairly normal -- any CMS that doesn't do this (either by default or with the help of a plug-in or extension of some sort) is pretty defective -- but it can raise a few issues, especially when we make mistakes. In the rest of this post I'll describe our mistake and it's effects.

Generating metadata

Our metadata plug-in has four main features. It can:

  1. generate (and, if configured, let the user manage) page metadata;
  2. generate canonical URIs;
  3. embed Google Webmasters Tools verify; and
  4. embed Google Analytics tracking code.

The metadata the plug-in embeds include title, description, keywords, copyright, and authorship <meta /> elements, and a robots directive. If it's enabled it'll also output <meta /> and <script> elements for Google Webmaster Tools and Google Analytics (we're looking at extending this support for other tools including Xiti).

The problem, and the topic of this post, is our support for canonical URLs. The "Canonical URLs" feature is a exactly what it sounds like: a method which allows a document to specify the official, canonical URL by which it's content should be indexed and accessed. This helps resolve the "duplicate content" problem and is supported and encouraged by Google (see Specify your canonical), Yahoo! (see Fighting Duplication: Adding more arrows to your quiver), Bing (see partnering to help solve duplicate content issues) and Ask.com (see Ask Is Going "Canonical"!), amongst others.

The problem

Our plug-in currently includes markup like this on every page it generates:

<link rev="canonical" href="http://example.com/An-Article.html" />

If your familiar with [X]HTML, you may have noticed a problem with this: we've used the @rev attribute instead of a @rel. This is a small difference -- just a single character; just three bits difference in ASCII -- but the effect on the semantics of the metadata we're generating and embedding on every page is large.

rel vs. rev

The @rel attribute specifies the relation between the subject (the document containing the <link>) and the object (the URI specified in the @href). That is, <link rel="help" href="help.html" /> says that the help for this document is help.html. It's like an arrow pointing from this document, to another document.

The @rev attribute, on the other hand, inverts this meaning. That is, <link rev="help" href="foo.html" /> says that this document is the help for foo.html. It's like an arrow pointing to this document from some other document.

Allowing this reversed relation may make sense for some relationships (namely, those which are ignored by pretty much everything), but with something like canonical -- which is interpreted by search engines -- it can be dangerous. Our metadata plug-in is generating code which says, on every version of every page (and every page has as many as half a dozen URIs under SPIP), you shouldn't use that page (the genuine canonical URL), I'm the real deal! That is, we're telling the world at large that the canonical URL is not canonical. This is bad and wrong (though I suspect that the search engines probably just ignore such claims).

Needless to say, I'm going to fix this (or have one of the others do it) and push the new version to our sites first thing on Monday morning.

Why does such a thing exist?

In the mean time, I wondered why anyone could possibly want such a thing? I've not read too much into this topic, but it seems reasonable to think that the @rel attribute was originally included for the sake of symmetry. Alas, symmetry is great in a closed system -- one where you can trust all claims because you know that every part of the system can be trusted -- but can cause problems in an open system like the web -- where you can't necessarily trust every participant in the system.

Given that we have @rev (though it's probably going to go away in HTML5, and similar updates to XHTML), what is it used for? One use case is using URL shortening services like TinyURL, Bitly, Tr.im, etc. If you use Twitter or some similar service you're probably familiar with these: they essentially give a shorter alias to a long URL. Doing this with a reversed canonical is patently stupid (see Counting the ways that rev="canonical" hurts the Web for the reasons why its stupid), and I'm pretty sure no search engine or semantic web application will actually use it (intentionally, at least), but there you go.

Conclusion

For more information, see the "rel" attribute frequently asked questions at the Microformats wiki, or search the web for such phrases as "canonical url rev rel". There's plenty of information out there.

Thanks to Pierre Rousset (who still needs a web-site I can link to when I mention him) for his typo which lead me to this interesting topic, Mark Aeschlimann who noticed and questioned it, and the various people who've written about and documented <link>, @rel, @rev and related topics.

16 Aug 2009

AES encryption in Python with M2Crypto

I've needed to write some Python code to handle encryption and decryption recently. This is a short post describing how I did it.

I'm interacting with a system which encrypts data in transit like so:

The encryption algorithm is AES with a 16 bit [sic] key. The cipher mode is CBC with PKCS5 padding. The initialisation vector is 16 bytes of 00.

Thus I need to handle 128-bit AES in CBC mode, and padding according to PKCS5. In addition, the key and encrypted data is all base64 encoded.

There are a number of cryptography packages for Python. The first I found was a blog post describing PyCrypto. My requirements include PKCS5 padding, which PyCrypto doesn't seem to do. It also has it's own implementations of the encryption algorithms.

The padding algorithm seems pretty simple. If I understand correctly, it'd go something like this in Python:

pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]

But I've got better things to do than convince myself that I've implemented it correctly.

Thankfully, there's another options: Me Too Crypto. Unlike PyCrypto, M2Crypto is a Python wrapper around OpenSSL which is nice, as my code will be running under mod_wsgi embedded in Apache along with mod_ssl.

Alas, it has rather poor documentation. The best guide to using it I've seen is the test code. I'm using the EVP interface, and found test_AES() in the EVP tests invaluable.

Without further ado, the code:

from base64 import b64encode, b64decode
from M2Crypto.EVP import Cipher

__all__ = ['encryptor', 'decryptor']

ENC=1
DEC=0

def build_cipher(key, iv, op=ENC):
    """"""""
    return Cipher(alg='aes_128_cbc', key=key, iv=iv, op=op)

def encryptor(key, iv=None):
    """"""
    # Decode the key and iv
    key = b64decode(key)
    if iv is None:
        iv = '\0' * 16
    else:
        iv = b64decode(iv)
   
   # Return the encryption function
    def encrypt(data):
        cipher = build_cipher(key, iv, ENC)
        v = cipher.update(data)
        v = v + cipher.final()
        del cipher
        v = b64encode(v)
        return v
    return encrypt

def decryptor(key, iv=None):
    """"""
    # Decode the key and iv
    key = b64decode(key)
    if iv is None:
        iv = '\0' * 16
    else:
        iv = b64decode(iv)

   # Return the decryption function
    def decrypt(data):
        data = b64decode(data)
        cipher = build_cipher(key, iv, DEC)
        v = cipher.update(data)
        v = v + cipher.final()
        del cipher
        return v
    return decrypt

10 Aug 2009

Security and SPIP

SPIP is an open source content management system written in PHP. It was originally designed to use a MySQL, but now supports a number of SQL databases including PostgreSQL and SQLite. Like most software systems, it sometimes has bugs and flaws and, like many web-based systems, these can sometimes lead to exploitable security holes. This post describes the latest security problem in SPIP (which resulted in the released of SPIP 2.0.9) and how to help reduce the risk of your SPIP sites being hacked using similar flaws in the future.

A coincidence of vulnerabilities

On the 5th of August, one of our clients forwarded me a notification that Google had detected malware on their web-site. After a quick look at the site, I discovered that someone had injected an <iframe> into the site -- the title of a news item, to be precise. I had a look in the administration interface and found that the title of that news item actually did contain the <iframe> code. At first I thought that this was simply a matter of some attacker guessing or stealing a password, but there were no FTP accesses during that period and the only SPIP users had strong passwords. This was when I started to get worried.

I took a backup of the whole site over FTP and had a quick grep, but couldn't find anything that had changed appreciably. Anything, that is, other than the config/ directory. Somehow, the site had been switched from using MySQL to SQlite2. Asking around the office made it clear that none of us would do something so strange (storing SQLite databases in the web-root is a pretty strange thing to do in the first place!) so I was stumped, especially because this SQLite database was full of the correct content, ignoring extraneous <iframe>s.

I jumped on the phone to the hosting company and asked them to check their web server logs and Ender (their excellent system administrator) quickly found a bunch of accesses to /ecrire/ (the SPIP administration interface) which looked odd (especially with all the ..s and //s in GET parameters), especially seeing as they came from Saudi Arabia. He dumped the those entries and e-mailed them to me (and reset every password associated with the account). Now I had something to work on.

Filtering out the various noise that you get in http log files (css files, javascript files, etc.), it was clear that something really strange was going on. The attacker, whomever they were, seemed to be exploiting a path escaping bug in SPIP (investigated by Pierre Rousset, who finished his internship with us last week) which, in combination with an authorisation bug, allowed anyone to cause SPIP to make a backup file (and write it with any filename the attacker chooses, and in any directory the server can write to). To make matters even worse, they could use another security hole in SPIP to begin a re-install and they were able to create their very own SQLite database and run through the installation procedure. After restoring the backup that they triggered, there was very little way to tell that the site had been hijacked!

Preventing exploitation

These flaws are very serious and, while the fix is very short (the patch modifies four lines of code in three files), they seem to me, to be indicative of a design flaw that can be seen in many web applications: pieces of code are responsible for their own input validation and their own authentication and/or authorisation checking. Exacerbating the problem is the fact that SPIP encourages users to install it with an insecure configuration. Everyone say it together: if the application can modify its code, then it is insecure.

Preventing the site from being hijacked is reasonably simple: all you need to do is prevent SPIP from modifying config/ and the files and folders in it. That's it: just chmod -R -w config/. Done!

For better security, make sure that config/ and it's contents are not owned by the web-server user (usually nobody, www-data or similar). Otherwise, the crafty attacker may be able to chmod them then trigger the original bug. If you're paranoid like me, you'll also want to put add a number of things to your Apache configuration (or .htaccess file):

  • Turn off automatic directory indexes; all they do is leak information to a potential attacker.
  • Turn off PHP execution within IMG/, local/, and tmp/. Any script in those directories is going to be include()ed and doesn't need to be directly executable.
  • Deny all access to your tmp/ directory, either with Deny from all, or by using RewriteRules.

For the even more paranoid, you can try to:

  • Rename spip.php, squelettes/ and ecrire/ to reduce your exposure to automated attacks.
  • Suppress the inclusion of produce names and version numbers (in particular, the Composed-By: header which identifies the version SPIP and of all of the installed plugins).

Needless to say, I'm going to keep doing most of these things on my SPIP sites, even after the release of the newly re-secured version 2.0.9.

Conclusion

There are several morals that, I think, can be taken from this story:

  1. An application should not be able to modify its own code. If it "needs" to, then it is going to be insecure.

    There are a variety of reasons that the SPIP developers don't agree with this -- and that is, of course, their prerogative -- but, as we all discovered last week, this leaves them, and their users, vulnerable.

  2. An application should leave checking user authentication or authorisation to "action" code. The application's framework should require authentication for all actions and a sensible default authorisation policy. It should allow these defaults to be overridden, certainly; but the default should be for secure, not insecure. It is easier to allow what is necessary, than deny what is not.

    This has been been good advice since it was proposed by Saltzer and Schroeder in their 1974 paper The protection of information in computer systems.

  3. A quick and effect response from the developers can turn a potential disaster into a feel good moment. I, for one, feel a bit more forgiving of this sort of bug when it dealt with and resolved as quickly as it was.

This article could be read as rather harsh criticism of SPIP, but it shouldn't be. These are pretty common classes of flaws -- incorrect input validation and ineffective user authorisation -- and can be difficult to get right. Input validation, in particular, can be a nightmare of encoding and decoding bugs and vulnerabilities, before you can even start to think about application-specific validation rules.

On the glowingly complementary side of things: the SPIP developers did an exceptionally good job of finding and fixing the problem. Within a day of my initial report, they'd released SPIP 2.0.9, a patch for people who don't want to upgrade, and an updated "security screen" script which blocks exploits without fixing the problems). Bravo SPIP team!

Update: Added a mention of Pierre Rousset.

05 Aug 2009

Adding a distance function to MySQL

This is a quick and rather hackish way to add a "distance" function to MySQL and call it from the Django ORM framework.

27 Jul 2009

The Ethos Effect by L. E. Modesitt Jr

Feeling a bit scifi-y over the weekend, I wound up buying and reading The Ethos Effect by L. E. Modesitt Jr.. I've read one or two of his Recluse books, but this is my first of his science fiction. While it had a one or two short comings, I enjoyed it immensely and will definitely be reading more of his sci-fi.

The Ethos Effect is set (or so wikipedia tells me) in the same universe as a previous novel (The Parafaith War), but I didn't have any difficulty in following the plot or the characters without having read it. The plot follows the political, economic, and military events in the arm, a region of space occupied by a number of human societies including the large and powerful: the theocratic Revenants, sustainability-focused Eco-Tech Coalition, and Argentis; through the middling the Republic of Tara, and Keltyr; to the small and only tenuously independent. The book follows events as they unfold around Commander Van C. Albert, a black officer in the Taran Republic Space Force.

Through a series of unusual events, including a mysterious attack and two attempted assassinations, Van is promoted and retired from the Space Force as a Commodore. He returns home but is unable to find work as a pilot and finds himself compelled by yet another assassination attempt to accept a job offer from Integrated Information Systems, a mysterious foundation from the Echo-Tech Coalition he first encountered during his brief posting as military attaché at a Taran embassy.

The remainder of the book follows Van's experiences as pilot of one of IIS' three interstellar ships (far from being the commercial couriers they appear each is armed and equipped as a light cruiser) and a roving Director of the powerful foundation. Through his role, Van learns of and experiences the economic and political beginnings of what eventually degenerates into a war with the theocratic and expansionist "Revs" giving up their back-room economic for all out invasions.

This book, like many of Modesitt's, contains numerous excerpts from in-universe authors, in this case a treatise on societal ethics. In addition to these quotations are the discussions and introspection by Van and the other characters about the nature of ethical action on the parts of both individuals and societies. At times a touch preachy, these passages and the ideas they discuss are interesting and on occasion provoke more than a little thought (as well they ought: ethics, both personal and societal, seems rather too neglected a topic in Western societies these days).

The denouement of the story comes as Van (and those readers who did not read The Parafaith War) that the mysterious Trystin, head of the IIS, feels responsible for the Revs' society and the destruction they've wrought over the past several hundred years. When Trystin takes drastic actions to prevent the Revs from killing even more millions of victims, Van is left in a similar position: feeling at least some responsibility for the reprehensible actions of a culture and with the means of preventing them, though at a terrible cost.

Were is waxes philosophical, the ideas presented are intriguing, and the action sequences are well written and replete with well conceived details and interesting touches. Some of the characters and their interactions seemed a touch stilted in places and the parallels between some of the Arm cultures and their Old Earth predecessors were perhaps a little too clear, but overall it's an excellent book and has inspired me to look at the rest of Modesitt's work.

20 Jul 2009

Writing view decorators for Django

Using decorators to wrap and modify Django views is quick, easy, composable, and just about the most awesome thing I've seen in a while. It also takes a little bit of figuring out. Here's my explanation...

18 Jul 2009

Notes on "Tuning MySQL performance"

Trent "lathiat" Lloyd talking about MySQL performance tuning. The slides are available on his talks page.

Default MySQL configuration

Use small amounts of memory (8-64MB) and then push stuff back out to disk. Small number of conc. connections/users, small temp. table sizes. Very conservative.

Show global status

"SHOW GLOBAL STATUS" returns 240 rows.

  • Com_insert (number of inserts run)
  • Com_select (number of selects run)
  • Connections (currently)
  • Created_tmp_tables (temporary tables for joins, etc)
  • Created_tmp_disk_tables (number of temporary tables it's put on disk)

Should have 1/10th reads to requests (i.e. 90% cache hits).

Settings

tmp_table_size = 64M (def. 32M) max_heap_table_size (should be the same).

query_cache_size = 64M (caching results based on the exact query text). Shouldn't be much higher or it will be slower due to overhead of flushing the cache every write. He's had 3-4 customers in last 6 months who've set this too high.

table_cache = 1024 keep instances of tables instead of closing them. Avoids having to open, close, open, close, tables.

max_connections = 200 each connections use 3-4MB. Too many open connections and your RAM is gone!

MyISAM or InnoDB?

MyISAM: non-transactional, no rollback. Not ACID. The original engine.

InnoDB: newer engine, transactional, can rollback. Actually ACID. Has higher overheads, as might be expected.

Can turn InnoDB's persistance to get consistency but much faster.

MyISAM uses a key buffer to cache the keys. key_buffer_size = 1GB (def. 8MB) to avoid accessing disc every query.

innodb_buffer_pool_size = 2G the buffer for both keys and data. Actually allocates this RAM at load. Based on RAM size: 0-75% of RAM.

Other stuff

There are tools which will analyse a config file and estimate memory usage.

See Trent's web-site for the slides, links, etc.

18 Jul 2009

Notes on "Statecharts and Numbats"

This post consists of my notes on the Statecharts and Numbats presentation by Harry McNally at Perth Barcamp 3.0.

18 Jul 2009

Notes on Perth Barcamp 3

Some notes about Barcamp Perth 3.0.

18 Jul 2009

Notes on "Building scalable web apps (and why no-one really bothers)"

A presentation by Adrian Chadd (adrian@creative.net.au) on building scalable web applications.

Failure in scaling means running out of: CPU, memory, disks, db, network. Any one of these can look like the others. People are pretty expensive, so most outfits buy more gear.

Sometimes, the resource isn't scalable (e.g. a DB server). Scaling isn't linear (2x machines do not get 2x performance).

(Facebook have written a PHP to native bytecode compiler, it's easier than rewriting it and makes it all faster.)

What about the "cloud"? Mostly marketing speak. Usually: dynamically allocated, managed resources.

Given this all: how can we write stuff that scales?

  1. How does the network work?
  2. How does the computer work?
  3. Live and historical monitoring (so we can tell what needs improvement)

The size of a code base does not correlate with the runtime performance. Typically large code bases will have layers upon layers of abstraction. If one layer has problems, it and everything that interacts with it may need to be modified.

A security layer that deserialises a tree of permissions every single request, for instance, may work well for 30 pages, but crash and burn for 30K.

Disks

Disks are not infinitely fast. Static resources, logging, etc. What happens to your app when disk I/O is maxed out? If you can't load the bit of AJAX Javascript from disk, will everything die?

DBs

phpBB, for instance, starts grinding at about 500k posts. People tend to assume that you can "just get a bigger DB server". What if you can't?

Per-user utilisation

What happens when you have large numbers of concurrent users? If each connection requires large amounts of resources, it may work fine on a LAN (w/ millisecond range execution times) but crash and burn on the tubes (w/ hundreds of millisecond execution times).

How you cope with this? Risk management: rather than doing the work for a worst case that may happen, perhaps do a little work upfront so that you can fix if it does happen.

How much of your app would you need to modify for it to work on an iPhone? All of it?: you fail.

Networking

You LAN is not the internet and apps do not perform the same way! Applications behave differently on a WAN.

Learning how the network behaves is good and useful.

TCP/UDP (e.g. DNS would fall over w/ TCP)

HTTP: caching content yourself, client caching, etc.

HTTP

Learn about HTTP and user experience.

Caching, content negotiation, etc.

Stop thinking that you can pigeon-hole yourself and actually learn about everything you need to know, not just your little web world. The reverse is true to: systems people should know how their systems are being used.

Cloud

The systems version: lots of machines coming up and down as you want.

The Google and Yahoo! version: write your app this way and we'll take care of the running and moving and data tracking and such for you.

Databases like bigtable instead of relational databases. Content delivery through CDNs, etc. Seperated "how do you use the data" from "how do you move the data around". Using map/reduce, etc. makes it possible and easy to scale from 1 to 1,000,000 processors but is very different w.r.t. "normal" programming techniques (unless your a functional programmer).

Amazon S3 "cloud": virtual *nix machines under Xen. Use "storage" and "database" to distribute content and info.

Google Apps: Use their Python/Javascript frameworks; map/reduce, bigtable, etc. and Google do the "cloud" bits for you.

Suggestions

Look at decoupling your app into bits and pieces to be tied together. Seperate data management, processing, page fragment generation, page generation, caching, etc.

Learning about HTTP, caching, the network, etc. even superficially. Learning to identify the bottlenecks.

Break the app up and you can start caching between the layers.

Example

Load balancer in front of app servers. Use the reverse proxy with a crap load of RAM as a buffer: the app servers can free the request resources quickly and let the proxy handle the slowness.

Add a caching layer between the reverse proxy/balancer and web apps and assemble fragments from the apps at the front end. This only works for certain apps (portals, etc), typically few writes with huge numbers of reads, shared content between users (widgets for weather, etc.) Can replicate in multiple places.

18 Jul 2009

Notes on "Adruino hacking"

Notes from a session on Arduino hacking are Barcamp Perth.

13 Jul 2009

Notes on "Debunking Christianity"

This post is some notes I took during a presentation at the Perth Atheist Meetup given by Aaron Alderman. They were taken at speed (and without the overhead presentation which we were supposed to see as well) and are certain to contain errors.

I've edited this article since I originally posted it. Some material has been added, some expanded, but none deleted.

Introduction

Aaron Alderman

Aaron introduced himself and described his background a little (raised in a secular family which became religious after an adverse life event) before jumping into eight objections to Christianity.

Which one is True?

There are roughly 30,000 denominations of Christianity which can be grouped into various categories:

All of these denominations have various differences, many are mutually incompatible.

How are people saved? Is it on the basis of the a person's actions during their life (do good = go to heaven; do bad = go to hell)? Or is it based on their faith in god alone (believe in Jesus = go to heaven; don't = go to hell)?

What is Heaven? Is it a new Earth, this time without bad things? Is it hanging out with your new best buddy god? Is it a big party in the sky?

Do we have free will? Can we actually affect our own fate? Or has god already decided which people are to be saved and which damned?

What is baptism? Just a symbol?

Is god really a homophobe?

These points and many more differentiate the various denominations, and many of them are mutually incompatible. Some denominations claim to be exclusively true. How are we supposed to determine which one actually is true?

Should we not expect a perfectly good god with limitless power to convey its will and message correctly? If the holy spirit is really guiding them and their understanding of its well, why are there so many different interpretations? Why are there so many sects, schisms, reformations, etc?

Epistemology comes into it: they seem to lack an sound epistemology. There is no epistemological basis on which to distinguish any of these particular sets of claims so it seems any and all of them have an equally valid (or perhaps that ought to be: invalid) claim to truth.

The Bible

Many books: 66 (if you're catholic), 78 (Greek Orthodox), 81 (?).

The Old Testament comprises:

  • Torah: The Law
  • Nevim: ???
  • Ketuvium: ???

And the New Testament includes:

The Gospels

  • Matthew
  • Mark
  • Luke (and Acts) 80-130 CE
  • John 90-120 CE

Matthew and Luke had a copy of Mark as they wrote.

Pauline epistles:

  • About eight.
  • About four which are traditionally counted as Paul's work, but it's now acknowledged are not. They seem not his "style", etc.

The Epistles:

The Apocalypse:

A good source is EarlyChristianWritings.com

Early Christianity

150 CE: We have five papyri

Nine small fragments

250 CE: 38 fragments in reasonably good quality

Various codices

Codex vaticauns: 350 CE. First complete New Testament we have. Misses Hebrews 9--

Codex ciniticus?

We don't have complete texts until 150-200 years after the fact. Does this matter? Christians claim: no. Other ancient texts have been recovered from 1000 years after the text. But we aren't trying to base 30,000 different religions on these other ancient texts, nor are we claiming that they are true!

We "know" that there are around 150,000 changes in the bible, based on the fragmentary documents that have been discovered. Some errors are due to scribal errors (remember that many scribes and copists were illiterate), margin creep (integrating marginalia on an original into the text of a copy), purposeful changes (supporting the idea of the trinity).

The earliest copies don't have Mark 16:9 -- :20. I.e. nothing involving the resurrection. These were clearly added decades or centuries after the fact, but they form the basis of Pentecostal theology.

Mark 1:40-:41 Jesus touched a leper and said: I'll heal you. Some scripts have Jesus angry at the leper rather than compassionate. There is certainly motivation for this change (Jesus is supposed to be nice!), but it could also be accidental (in the Greek, the two words are quite similar.)

"Let he who is without sin, cast the first stone." turns out that isn't in the earlier texts.

The early Christians were poor and working class. It's a few hundred years before the upper class joins in. This is important because the cheaper (possibly amateur) scribes used were more likely to make mistakes. There are also comparatively few copies as relatively few people could afford to have copies made.

For most of the history of Christianity they've been using an apparently errant bible.

From a secular (even just rational) point of view, the idea that god has guided translation, transcription, interpretation so that it is still "religiously" correct seems to beg the question.

Some of the audience

The Old Testament

The history of the Jews. Problem: lots of it didn't happen. Eden, the flood, the promised land, the exodus, Canan. The conquered land and formed a united monarchy of Israel. Didn't happen.

No Adam and eve: no original sin. Why did Jesus die if not to save us of our sins?

Canan didn't happen? That's pretty good. God didn't tell us to kill women and children and donkeys.

Fourth: Where is Jesus and the Trinity in the OT?

Many Christians will suggest that the OT contains "hints" about the trinity, etc. Here's a hint: it doesn't.

Fifth: Jesus was not the messiah.

There are many, many prophecies regarding the messiah that Jesus did not satisfy (all the following vaguely paraphrased):

"Once he is king, nations will look to him for guidance." They didn't look to him for guidance.

"Knowledge of God will spread around the world." It didn't, for a very long time. Depending on your meaning of "knowledge", it still hasn't.

Christians try to use ad-hoc arguments to get around these, but it raises the question again: if this is the inerrant, inspired word of a just and powerful god, why do they need to split these hairs?

New Testament

Paul: earliest gospels. He's more authoritative w.r.t. early Christians beliefs. There was fragmentation though.

Did Jesus rise bodily or spiritually?

Sixth: Paul didn't believe the bodily resurrection

Paul didn't meet Jesus. Just had hallucinations and visions.

Didn't say much about Jesus' life, etc. focusing mainly on the implications of his death.

Paul was all about the "spiritual body."

Seven: The resurrection stories were embellished

Luke: attempts to write history. Tries to find eye witnesses, etc.

John: theological, 2nd C. AD.

Mark: "just a story." Fabricated, uses plot devices like role reversals (Mary vs Mary). Many intelligent Greeks were given Homer as an example of good writing. There are many parallels with Mark. Lots of strange claims: given a royal blue robe. The tomb was covered by a rock that could be rolled away (this start to happen until circa 70 AD).

Mathew copies a lot from Mark. Tries in vain to match it to the OT prophecy. The virgin thing doesn't appear in the Hebrew; it was a translation error into the Greek of the Septuagint. The coming into town on two asses is another translation error. The death scene is also odd: J dies, the sun darkens, the tombs open and the dead walk. Why did this not convert everyone.

Why did the author of Mark not tell us who, what, and where they were. Seems to have been plagiarised from other works with Jesus pasted in. Josephus' war of the Jews. Claims that he saw a heifer give birth to a lamb in the middle of a Jewish temple. How is a know, reliable historian eye-witness within 10 years claiming nonsense. Why should we accept the Gospels?

But the Christians were telling the truth!

The disciples died for their beliefs: we should take them seriously. Lots of evidence that they didn't. Even if they did, we don't know what the believed.

The women were are the tomb. But this is just a reversal of expectations (one of the aforementioned plot devices): women were the lower classes and Jesus was a working class hero.

Christianity grew very quickly, so it must be true. But Mormonism grew more quickly, in even more adverse conditions (like overcoming Christian hegemony to convert followers).

Eight: Where is the secular evidence?

Josephus and someone else are the first non-believers to describe biblical events.

Conclusion

  1. Which Christianity is true?
  2. We don't really know what the earliest Christians wrote?
  3. A lot of the "history" of the Jews didn't happen.
  4. Where is Jesus and the New Testament in the Old Testament?
  5. Jesus was not the messiah and did not fulfil many of the prophecies.
  6. Paul did not believe in the bodily resurrection.
  7. The resurrection stories were embellished, unattributed, etc.
  8. There's no secular evidence for Jesus.

Questions

Catholics believe that we have souls. Pope Pius and JP II said that they accepted evolution (but they only accepted it on the basis that Adam and Eve were the first humans). Benedict is a very good theologian but rather too conservative socially for most.

Someone mentioned: many paths to one destinations. Blah, blah.

If Jesus does rise as a zombie. Should we shoot him or run away?

What about the recent (Catholic) abolition of limbo. If the previous Popes were actually infallible then there must have been a limbo with souls in it. Where did the people that were in limbo go?

There's an Episcopalian Bishop who says Paul was a latent homosexual based on his misogyny, homophobia, etc.

25 Jun 2009

Haskell FastCGI with Apache

Getting started writing web applications in Haskell is pretty easy with FastCGI.

22 Jun 2009

Django form fields and templates

Determining the type of a form field object from a Django template requires writing a new filter.

16 Apr 2009

Specifying a UNIX socket using MySQL with Django

Configuring Django to connect to MySQL with a socket according to the official documentation works fine (for me), but it breaks the dbshell command (for me). This is how I configured it so that Django works and so does the dbshell command.

30 Mar 2009

Installing the Python Imaging Library on Mac OS X Leopard

Like many other developers, I work on a variety of UNIX-like operating systems including Linuxen, BSDs, and Mac OS X. While it's generally pretty easy to build and install new software on Linux and BSD-based systems, it can be something of a pain in the arse to get some things to build on OS X, particularly when the multiple-architectures stuff comes into play. The most recent trouble I've had is in installing Python Imaging Library (henceforth PIL).

*[PIL]: Python Imaging Library

Thankfully, it's not too hard to figure out the problems and get it built, installed and passing the tests. This post provides a few pointers to getting PIL working on OS X 10.5.6 with the Python 2.6 package and a bunch of libraries installed using Macports.

The first thing to do is download the source code from the PIL download page. Unpack it as usual and then try to build it in the usual distutils fashion:

tar xzf Imaging-1.1.6.tar.gz && \
cd Imaging-1.1.6 && \
python2.6 setup.py build

If your system is like mine, the build process will error out like this:

ld: in /opt/local/lib/libxml2.2.dylib, file is not of required architecture for architecture ppc

collect2: ld returned 1 exit status

lipo: can't open input file: /var/folders/nk/nka0oBX-Gsy7r+w2hIFEfk+++TI/-Tmp-//ccMSWw7I.out (No such file or directory)

error: command 'gcc' failed with exit status 1

This is a relatively straight-forward error: it's complaining that a library it needs doesn't support an architecture that it's trying to compile for, namely PPC. There are two ways to fix this:

  1. Build this file manually without support for PPC (quick and easy); or
  2. Install universal versions of all of the libraries that PIL depends on (likely to be slow and tedious but not particularly difficult).

Building manually

The first option is the quickest, so I'll describe it first. Simply copy the gcc command that failed (it starts "gcc" and wraps over the next five lines) and paste it into your Terminal. Then delete the -arch ppc (if you're on an x86 machine) or the -arch i386 (if you're on a PPC) and run the edited command. When it completes, simply run python2.6 setup.py build again and it'll take up where it left off and you'll soon be ready to python2.6 setup.py install.

Installing universal libraries

The second option is a little bit more painful, because there are a number of libraries that you may need to reinstall as Universal. I'll give instructions that I used and for [Macports][macports]. If you use something else, you'll need to figure it out yourself.

Installing a universal version of a Macports package is pretty easy. All you need to do is add the +universal variant to it like so:

sudo port install apackage +universal

Updating an already installed package as a universal is similar:

sudo port upgrade apackage +universal

I had to update the following packages (in order) before PIL would build:

  1. libxml2; and
  2. zlib

But you may also need to reinstall:

  1. jpeg; and
  2. freetype2

With that done, setup.py should be able to build and install PIL.

The complete set of commands then is:

sudo port upgrade libxml2 +universal
sudo port upgrade zlib +universal
sudo port upgrade jpeg +universal
sudo port upgrade freetype +universal
tar xzf Imaging-1.1.6.tar.gz
cd Imaging-1.1.6/
python2.6 setup.py build
sudo python2.6 setup.py install
python2.6 selftest.py

With luck, you should now be ready to go!

References

I used the following references in tracking this information down:

  1. a comment on a blog post about Installing PIL on OS X 10.5.3.
  2. a message by Christopher Barker to the Image-SIG list.
  3. If you're a fink person, you might find Kill PIL – The Python Imaging Library Headache or Building PIL on Mac OS X helpful.

30 Mar 2009

Authorising user actions in SPIP

One of the APIs that many SPIP plug-ins will need to use is `autoriser()` -- the function which determines whether a user should be permitted to perform a given operation. As I couldn't find any document on using this function, here are a few notes.

27 Mar 2009

SPIP tags with multiple aliases

This post describes creating SPIP tags with multiple "names" (like #INCLURE and #INCLUDE) and taking the technique further to implement families of related tags.

11 Mar 2009

Dynamic tags, fake arguments, and AST mangling in SPIP

Sometimes a dynamic SPIP tag (one evaluated at request time) needs details about the template, but this information is not available. This post describes a technique for passing data from the AST into the tag's static and dynamic evaluation functions.

11 Mar 2009

Creating custom tags for SPIP - Dynamic Tags

A lot of the content on modern web-sites is dynamic: from lists of "currently online" user and targeted advertising, to widgets full of live data, dynamism is as much the catch cry of the Web 2.0 as "user created content". To add dynamic elements like these to your SPIP site, you'll need to make use of it's facility for dynamic tags (or break out into PHP, but then what's the point of a template language?). In this article I'll describe SPIP's dynamic tags and how to create your own. I'll also touch a little on SPIP plug-ins as they'll make things a little easier.

If you haven't already read Creating custom tags for SPIP -- Static tags -- the previous post in this little series -- you probably should do or this might seem a bit confusing.

Dynamic tags in SPIP

SPIP is fairly complex and its design and implementation make it quite expensive to generate pages. To stop this high cost from making it completely unusable, SPIP has a built-in caching mechanism to ensure that that it can serve most requests quickly. This makes process of generating a page and displaying it to the user a little more complex in SPIP than it is in most systems. Thankfully, it's not too much more complex:

Briefly (and a little inaccurately), the process of turning a SPIP template into HTML fit for a client goes like this:

  1. Parse the template into an AST
  2. Evaluate the static portions of the AST
  3. Generate PHP to calculate the dynamic portions at run-time
  4. Cache this PHP for future requests
  5. Evaluate the PHP and send ^1 the HTML to the client

the time being.

// Handle the #DYNAMIC_EXAMPLE tag.
function balise_DYNAMIC_EXAMPLE($p) {
        $args = array();
        return calculer_balise_dynamique($p, // The AST node for this tag
                'DYNAMIC_EXAMPLE', // The name of the tag
                $args); // The environment to capture
}

// Determine the static parameters for the #DYNAMIC_EXAMPLE tag.
// The arguments to the tag and filters applied to it are passed in as
// the arguments to this function.
function balise_DYNAMIC_EXAMPLE_stat($args, $filters) {
        // Calculate the current date and time...
        $now = date('Y-m-d H:i:s');

        // Return the arguments to pass to the dynamic calls...
        return array($now);
}

// Calculate the dynamic value to be output. The array values 
// returned by balise_DYNAMIC_EXAMPLE_stat are passed in 
// the arguments.
function balise_DYNAMIC_EXAMPLE_dyn($then) {
        // Determine the current time.
        $now = date('Y-m-d H:i:s');

        // Return a message containing the value from
        // balise_DYNAMIC_EXAMPLE_stat and the value we just
        // generated.
        $s = "Page generated: $then<br />Now: $now";

        return $s;
}

When we use #DYNAMIC_EXAMPLE in a template, SPIP calls out gathers up all the values we asked for in $args (nothing, in this case), and passes them to balise_DYNAMIC_EXAMPLE_stat. It then takes the array returned by that call and generates some code like "balise_DYNAMIC_EXAMPLE_dyn('2008-12-01 22:22:22')" which forms part of the PHP code generated from the AST.

Adding a user-interface

Given the great lengths the developers have gone to to make SPIP easy to customise, it'd be silly if dynamic tags were limited to returning a string to be output. Thankfully, they aren't. Instead of returning a string to output, dynamic tags can return an array which will be used to find, parse and render a template with dynamic content. Rather than modifying the code that implements a tag, web-masters can just create a new template in their squelettes/ folder overriding the default one to generate the output they want.

When using this feature, the balise_*_dyn() function returns an array containing three elements:

  1. the name of the template to evaluate;
  2. the amount of time the result can be cached^2; and
  3. an environment array to be passed (as #ENV) to the template.

The previous example modified to use a template might look like this:

function balise_DYNAMIC_EXAMPLE_dyn($then) {
        $now = date('Y-m-d H:i:s');

        $env = array(
            'then' => $then,
            'now' => $now,
        );
        return array('formulaires/dynamic_example', 0, $env);
}

With a template called squelettes/formulaires/dynamic_example.html like so:

Going Further

I've barely scratched the surface of what's possible using SPIP's dynamic tags feature in this article, but most of the ground work is here. In a few shorter articles I'll be posting later today, I'll describe some tricks and techniques that can help make the most of SPIP's tags -- both static and dynamic -- and other features.

05 Mar 2009

Hierarchical Rights in Drupal

There's been a bit of noise about alternatives to the rather limited permissions system in Drupal. Here are a few of my thoughts about one proposal.

03 Mar 2009

Extending Lua in C

Lua is a small, portable, and fast scripting language designed for embedding in other software. Being designed for embedding, it has a simple but powerful API which makes it easy to communicate both ways: from C into Lua and from Lua into C. In this post, I'll describe the process of writing a small module adding support for OpenSSL's hashing functions to Lua.

Hashing data with OpenSSL

Generating hashes of data is an relatively simple problem to address in a library: is has a small, simple interface which can be implemented using any of a large number of hashing libraries. Rather than locate, evaluate and include one of the many open source or public domain hashing libraries, I've decided to wrap the hashing functions from OpenSSL. This provides a number of benefits:

  1. It's reasonably well trusted (and I don't have to try to vet it).
  2. It's installed pretty much everywhere (so I don't need to include it with my code).
  3. It's API is simple, consistent, and flexible.
  4. We'll see later that it makes my code powerful and lends it an elegant interface.

Before I can write a Lua wrapper for the OpenSSL functions, I'll need to know how they work. The man pages help immeasurably, especially as they contain code demonstrating how to hash data using OpenSSL. Following the example in that man page, a first cut of my code will look like this:

unsigned char *digest(char *algorithm, void *data, size_t len) {
    // The hash context
    const EVP_MD *md;
    EVP_MD_CTX mdctx;
    // The hash
    unsigned char  hash_data[EVP_MAX_MD_SIZE];
    unsigned int   hash_len = 0;
    unsigned char *hash_str = NULL;
    // Loop variables
    unsigned char *cur = NULL;
    unsigned int i = 0;

    // Get the hash algorithm the caller requested
    OpenSSL_add_all_digests();
    md = EVP_get_digestbyname(algorithm);
    if (! md ) {
        // The requested algorithm is not available
        // This is an error
    }

    // Initialize the hashing context to use the algorithm named in md
    EVP_MD_CTX_init(&mdctx);
    EVP_DigestInit_ex(&mdctx, md, NULL);

    // Feed the data to the hash function
    EVP_DigestUpdate(&mdctx, data, len);

    // Finalize the hashing context putting the hash into hash_data and
    // it's length into hash_len
    EVP_DigestFinal_ex(&mdctx, hash_data, &hash_len);
    EVP_MD_CTX_cleanup(&mdctx);

    // Translate the data into a string of hexadecimal characters
    cur = hash_str = (unsigned char*)malloc(1 + 2 * hash_len);
    for ( i = 0; i < hash_len; i++ ) {
        snprintf(cur, 3, "%02x", hash_data[i]);
        cur = cur + 2;
    }
    cur[0] = '\0';

    // Return the hex string of the hash
    return hash_str;
}

Easy! Variable arguments are a pain in the arse in C, so I've omitted them from the code above but it'd be great if the Lua module will accept any number of input values and hash them all. Thanks to the great OpenSSL API, doing so is just a matter of calling EVP_DigestUpdate() in a loop over each of the input values. It couldn't be simpler!

Calling C code from Lua

Now that I can hash values with the OpenSSL functions, it's time to think about calling that code from Lua. Lua has a fairly simple API for implementing module in C:

  • functions take a single argument -- the state of the Lua interpreter
  • they can manipulate that state, including pushing or poping values off the argument stack
  • and then return an integer -- the number of items they push onto the stack as return values.

As simple example may help illustrate. The following function inspects the stack to see how many parameters it was invoked with, and returns a message state such. Unlike the stacks used in many other systems, the Lua stack is indexed (you can access any item by its index, rather than only the top item) and these indexes start from 1 (instead of the traditional 0). As a consequence, the index of the top of the stack is the number of items on it.

static int example(lua_State *L) {
    unsigned int n = 0;

    // Get the index of the top of the stack
    n = lua_gettop(L);

    // Push a string onto the stack using a printf-like convenience
    // function.
    lua_pushfstring(L, "You passed %d arguments.", n);

    // Return the number of return values pushed onto the stack.
    return 1;
}

Using just few more functions from the API, I can modify the OpenSSL code above to be called from Lua. All it requires is a change of signature, a call to lua_tolstring() to get the algorithm name, a call to lua_gettop() to get the number of inputs, a loop calling lua_tolstring() to get each of them in turn and feed them to the hashing code, and a call to lua_pushstring() to push the return value onto the stack.

The revised code looks like this:

static int hash_hash (lua_State *L) {
    EVP_MD_CTX mdctx;
    const EVP_MD *md;
    unsigned char md_value[EVP_MAX_MD_SIZE];
    char *algorithm = NULL;
    char *digest = NULL;
    char *cur  = NULL;
    unsigned int md_len = 0;
    unsigned int arguments = 0;
    unsigned int i = 0;
    size_t msg_len = 0;

    // Get the algorithm name from the closure
    algorithm = (char *)lua_tostring(L, 1);

    // Get the number of stack arguments
    arguments = lua_gettop(L);

    // Get the digest
    OpenSSL_add_all_digests();
    md = EVP_get_digestbyname(algorithm);
    if (! md ) {
        lua_pushfstring(L, "No such hash algorithm: %s", algorithm);
        return lua_error(L);
    }

    // Initialise the hash context
    EVP_MD_CTX_init(&mdctx);
    EVP_DigestInit_ex(&mdctx, md, NULL);

    // Add the arguments to the hash.
    for ( i = 2; i <= arguments; i++ ) {
        cur = (char *)lua_tolstring(L, i, &msg_len);
        EVP_DigestUpdate(&mdctx, cur, msg_len);
    }

    // Finalise the hash
    EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
    EVP_MD_CTX_cleanup(&mdctx);

    // Convert the hash to a string
    msg_len = 1 + 2 * md_len;
    cur = digest = (char*)malloc(msg_len);
    for (i=0;i<md_len;i++) {
        snprintf(cur, 3, "%02x", md_value[i]);
        cur = cur + 2;
    }
    cur[0] = '\0';

    // Push the result onto the stack
    lua_pushstring(L, digest);
    free(digest);

    // Return the number of return values
    return(1);
}

With the function itself written, registering it so that it can be called by Lua code is simple too. Each C module (whether compiled into Lua or loaded as a shared object library) has a luaopen_*() function that is responsible for initialising the library and registering the resources it provides. There are utility functions to automatically register entire modules based on arrays of function pointers, but I've only got one function and there's no point cramming it into a table, so I'll go it alone. Again, it's really easy:

LUALIB_API int luaopen_hash(lua_State *L) {
    lua_register(L, "hash", hash_hash);
    return 0;
}

An elegant API

This is all very well and good, but the API is pretty poor as it stands: a single function which takes a string (denoting the actual function to compute) and a bunch of inputs. It's pretty cool that we can support all these functions with a single piece of code, but it'd be even better if our single piece of code implementing many functions looked like the many functions to the callers. Rather than hash(&quot;md5&quot;, v1, v2, v3), we should be writing md5(v1,v2,v3). Happily, this too is a cinch!

Tables and meta-tables

You may or may not be familiar with tables -- Lua's single complex data-structure. Tables are a combination of arrays (sequential, integer indexed, etc.) with dictionaries/hashes (matching arbitrary keys with a value). Lua uses tables for pretty much everything including environments (wherein variables are stored) and modules (like our library).

If that was all there was to tables, then they wouldn't be such a big thing. Thankfully it is not. In addition to their workaday nature as Lua's catch all storage thingy, the semantics of tables can be modified using meta-tables full of functions which implement aspects of their table's semantics. Using meta-tables I can override the default behaviour of, say, looking up a value my module table and return a brand new object instead. An object that didn't even exist until you asked for it.

Using this facility along with closures and anonymous functions I can hide my hash_hash() function above in a meta-table. It's as simple as modifying hash_hash() to take the algorithm name from its closure (rather than the first parameter) and adding a new wrapper function to create these closures on request. It is this wrapper function that will go in the meta-table to give us a shiny new API.

Creating the closure

The first task is to create a closure of hash_hash() along with the algorithm name. Bearing in mind that this function is going to be called as the index operation, it will need to take two parameters: the table and the key. Given that it'll only be called for my module table, I'll just ignore the table argument.

static int hash(lua_State *L) {
    char *algorithm = NULL;

    // Get the name of the algorithm (the key)
    algorithm = lua_tostring(L, 2);
    lua_pushstring(L, algorithm);

    // Push a closure of that value with hash_hash()
    lua_pushcclosure(L, hash_hash, 1);

    return 1;
}

This code just reads the key from the stack as a string and pushes it back onto the stack (this may not be necessary, I'm not sure). Then it pushes a closure of this one value with hash_hash() onto the stack.

Modifying hash_hash() to use this closure value is just as ease. I just need to modify the lua_tostring() call that gets the algorithm name to get the first value from the closure instead of the first argument on the stack:

algorithm = (char *)lua_tostring(L, lua_upvalueindex(1));

and modify the for loop to start at first argument instead of the second:

for ( i = 1; i <= arguments; i++ ) {
    // ...

Now I'm ready to build and install the meta-table for my module and my powerful new API will be complete.

Hiding behind a meta-table

Binding this all up as an API is a little involved. As everything needs to pass through the stack, it's easiest to create the various objects in order and avoid having to shuffle them around. In code order:

  1. Create the module table;
  2. Create the meta-table;
  3. Add a reference to hash_index() in the meta-table;
  4. Join the table and the meta-table; and
  5. Assign the table to the global variable "hash".

This isn't much longer in code. The body of luaopen_hash() now looks like:

// Create the table
lua_createtable(L,0,0);

// Create the meta-table
lua_createtable(L,0,1);

// Add the __index
lua_pushcfunction(L, hash_index);
lua_setfield(L, -2, "__index");

// Set the meta-table
lua_setmetatable(L, -2);

// Set the global hash
lua_setfield(L, LUA_GLOBALSINDEX, "hash");

A few notes might help make the above a little clearer. The stack can be accessed with negative indices which count from the top rather than the bottom (i.e. -1 is the top, -2 is second from the top, etc.) and there are a number of magical indices that access such things as the globals table (like LUA_GLOBALSINDEX).

With these changes made, my code now has an API that's actually pretty great: a single table that, by the magic of meta-tables, looks-up the appropriate function as requested by the caller. It exposes a lot of functionality (six different functions on my machine) but is implemented which only a fraction of the code a traditional approach would need (about a sixth of it).

"Where do we go from here?"

The code I've described in this post is very simple but provides a powerful, elegant interface that belies that simplicity.

The complete code for the module developed in this article is available as lhash.c. Note, though, that I make no warranty as to its correctness or its fitness or suitability for any purpose.

Useful though it is, there are many ways it could be improved. Perhaps the most important is improved error handling. As it stands, my code delays error detection and handling 'til the latest possible moment: right as it's about to perform the hashing operation. It's entirely reasonable (given Lua's first class functions) that a user might get a reference to a hash function and not call it until much later in the program. It would be nice if, instead of happily returning a closure, code like

f = hash.nonsense

would fail immediately, rather than waiting until the program tries to call f. To make it so, I need only to make to the code is to copy and paste the algorithm lookup and test and -- for good measure -- move the OpenSSL initialization call into the library open function. See the revised lhash2.c for these changes. To make this even more useful, I'd like to find out how to set the function name in the call stack without registering it (and thus allowing the users to call it directly).

It's also not particularly self-documenting. Tables in Lua are iterable just like similar structures in other languages. It'd be nice if callers could iterate over the table and get a list of the valid keys, just as they can with most other modules.

While generating a new closure every time the user wants one is cheap, it would be nice to add memoization so that hash_index() doesn't need to create a new closure if it's already created one for the requested algorithm. This would also ensure that references to the same hash algorithm are identical which is not currently the case (alas hash.md5 != hash.md5).

Finally, allowing the user to hash values other than strings and numbers. Alas, this would be rather more complex what with having to serialize tables for hashing (a difficult task without a stable sort and in the possible presence of arbitrary opaque values from other C extensions).

When that lot's done, it'll be time to move on to the rest of OpenSSL...

03 Mar 2009

Content types and dispositions in PHP

Exporting data as CSV is pretty run of the mill for most web developers (though generating "valid" CSV is not exactly trivial), but every time I do I find myself figuring out how to force the browsers to save it to a file. This quick post is about using a Content-Disposition header to strongly suggest that browsers save the data to a file.

10 Dec 2008

Accessing SQL databases with Haskell -- HSQL

(Or "Connecting to SQL databases with Haskell" as per DoeL's suggestion, it was getting a bit long)

As the first step on my journey into web-development with Haskell, I'm looking at interfacing with SQL databases. While there are a number of options available, only a few of them are currently maintained and none are usable (as I write this) out of the box using the current stable release of GHC. Given that it's a little bit of work to get going, that it's raised with some regularity on the Haskell mailing lists, and that if I don't write it down, I'm liable to forget, this post will describe accessing SQL databases using the HSQL package and one or more of its driver packages.

This post is literate Haskell (download the original) and was tested with GHC 6.10.1.

First, I'd like to note that there are plenty of other tutorials and explanations and snippets out there in Intertubes land and there's nothing really special about this one. If you have any suggestions for improvements or "better" ways, please comment or track-back away. With that said, lets get down to accessing some data.

After you've managed to get HSQL and the driver package for your database installed (if you run into trouble, see the links at the end of this post), everything else is reasonably straight-forward. You simply import the HSQL package and whichever drivers you need (I've used SQLite3, MySQL, and PostgreSQL):

> import Database.HSQL as Hsql
> import Database.HSQL.SQLite3 as SQLite
> import Database.HSQL.MySQL as MySQL
> import Database.HSQL.PostgreSQL as PgSQL

along with a few more for utility functions:

> import IO (try, IOMode(..))
> import System.Environment (getArgs)
> import Data.List (elemIndex)
> import Control.Monad (mapM_, liftM, guard)
> import Network.URI (parseURI, uriScheme, uriPath, uriAuthority, 
>     uriUserInfo, uriRegName)

and you can connect to the databases. Each of the different database driver packages implements it's own connect function. The SQLite3 connect is simple: just pass it the name of the database file and the mode to open it:

> connectSQLite3 name = do
>     tryconn <- try $ SQLite.connect name ReadWriteMode
>     either (\err  -> fail "Could not connect to database")
>         (\conn -> return conn)
>         tryconn

Connecting to server-based databases is a little more complex, but essentially identical for both MySQL and PostgreSQL:

> -- | Connect to a MySQL database
> connectMySQL host db user pass = do
>     tryconn <- try $ MySQL.connect host db user pass
>     either (\err  -> fail "Could not connect")
>         (\conn -> return conn)
>         tryconn
> -- | Connect to a PostgreSQL database
> connectPgSQL host db user pass = do
>     tryconn <- try $ PgSQL.connect host db user pass
>     either (\err  -> fail "Could not connect")
>         (\conn -> return conn)
>         tryconn

To make your programs generic, you can create a simple wrapper around the connection functions to that you can use URI-style connection string like some of the popular Java and PHP-based solutions. First, the strings should look fairly similar to HTTP URIs:

  • mysql://username:password@hostname/database
  • pgsql://username:password@hostname/database
  • sqlite:///path/to/file

Such strings are usually URIs, so I'll make use of the Network.URI module that comes in the standard library. The following function parses the database type out of the connection string and then calls the next function to extract the username, password and host if they are necessary (this code requires that the string contain all three).

> parseConnString cs = do
>     uri <- parseURI cs
>     db <- return $ init $ uriScheme uri
>     path <- return $ uriPath uri
>     (user, pass, host) <- parseAuthString db $ uriAuthority uri
>     return (db, user, pass, host, path)
> parseAuthString "sqlite" _ = return ("", "", "")
> parseAuthString _ as =  do 
>     as <- as
>     i <- elemIndex ':' $ uriUserInfo as
>     let (user, pass) = splitAt i $ uriUserInfo as
>     let host = uriRegName as
>     return (user, init $ tail pass, host)

Calling these functions works just as you'd expect them to,

*Main> parseConnString "blahblahblah"
Nothing

*Main> parseConnString "sqlite:///path/to/db"
Just ("sqlite","","","","/path/to/db")

parseConnString "mysql://user:pass@host/database"
Just ("mysql","user","pass","host","/database")

Now that we can parse connection strings, it's easy to write a generic database connection function. First call the parsing function, then call the appropriate connection function depending on the result:

> -- | Connect to any supported database
> connectToDB cs = do 
>     (scheme,user,pass,host,db) <- maybe 
>         (fail $ "Invalid connection string: "++cs) 
>         (return) 
>         (parseConnString cs)
>     case scheme of 
>         "sqlite" -> connectSQLite3 db
>         "mysql"  -> connectMySQL host (tail db) user pass
>         "pgsql"  -> connectPgSQL host (tail db) user pass
>         s        -> fail $ "Unknown database: " ++ s

Now we've got a single function which takes a URI specifying the database to open and returns a HSQL Connection value and we can leave the choice of database system up to the users of our program. As an example, this program will connect to the database specified in its first argument, drop the table foo if it exists, and then create it again with a single INT column:

> main = do
>     db <- (liftM head) getArgs
>     putStrLn $ "Connecting to "++db
>     conn <- connectToDB db        -- Connect
>     putStrLn $ "Connected to "++db
>     s <- Hsql.query conn "DROP TABLE IF EXISTS foo;"
>     Hsql.closeStatement s
>     s <- Hsql.query conn "CREATE TABLE foo ( col1 INT );" 
>     Hsql.closeStatement s
>     putStrLn $ "Closed connection to "++db
>     Hsql.disconnect conn

I run it like this:

$ ghc --make -L/opt/local/lib/mysql5/mysql/ post.lhs
[1 of 1] Compiling Main             ( post.lhs, post.o )
Linking post ...

$ ./post "pgsql://foo:@localhost/foo"
Connecting to pgsql://foo:@localhost/foo
Connected to pgsql://foo:@localhost/foo
Closed connection to pgsql://foo:@localhost/foo

$ ./post "mysql://foo:foo@localhost/foo"
Connecting to mysql://foo:foo@localhost/foo
Connected to mysql://foo:foo@localhost/foo
Closed connection to mysql://foo:foo@localhost/foo

$ ./post "sqlite:///tmp/test.sql"
Connecting to sqlite:///tmp/test.sql
Connected to sqlite:///tmp/test.sql
Closed connection to sqlite:///tmp/test.sql

Of course, just because you can connect to SQLite3, MySQL, and PostgreSQL databases, it doesn't mean they'll all work -- like all SQL databases, each accepts quite different sub-/super-sets of SQL -- but that is an issue for some blog.

If you found this post useful or have any feedback or questions, please leave a comment or a trackback from your own blog.

Useful links

If you run into trouble getting this to work, try the following links, or leave a comment (but if you do, please be ready for me to ask what have you tried?)

08 Dec 2008

Literate Haskell with Markdown and Syntax Highlighting

This post describes the scripts I (used to) use to turn a literate Haskell programme (with Markdown formatted literate comments) into HTML and PDFs using Pandoc.

07 Dec 2008

Installing hsql and HDBC on GHC 6.10.1

I've become more interesting in using Haskell for web development lately, so I've started playing around with it a bit. As so much of web development is CRUD, that means I'll need a database access library. There are a two real options^1 to consider when it comes to accessing SQL databases from Haskell: hsql and HDBC. The former has a native MySQL driver and the latter is actually maintained, but neither will build with the current GHC and Cabal without assistance. The rest of this post describes the [small] changes necessary to get both packages built and installed with GHC 6.10.1.

You may encounter numerous errors when trying to build hsql or HDBC, but most of them are pretty trivial to resolve. hsql 1.7 doesn't import a module that it needs, resulting in and error like this:

Database/HSQL.hsc:66:7:
    Could not find module `System.Time':
      it is a member of package old-time-1.0.0.1, which is hidden

Just add old-time to the list of modules needed to build it in hsql.cabal:

build-depends:  base, old-time

and try again. Next it will complain about a language extension being disabled (the messages mention things like -XRankNTypes). There are a few errors like this. Each time you see a new one, you can just add the extension it mentions (without the -X) to the list in hsql.cabal like so:

extensions:     ForeignFunctionInterface, TypeSynonymInstances, CPP, RankNTypes

Finally, you'll get an error like:

Database/HSQL/Types.hs:145:23: Not in scope: `throwDyn`

This is because it's being built against the new base library, when it needs things from the old one. There are two ways^2 to fix this: tell Cabal to use the old base library, or change the code to look in the write place in the new base library. To use the old library (quickest and easiest) modify the build-depends line in hsql.cabal to specify a version:

build-depends: base == 3.*, old-time

or pass it in as an argument to the configure phase:

runhaskell Setup.lhs configure --constraint='base<4'

If you want to change the code instead, you'll need to change references to Control.Exception to Control.OldException^3.

You may also encounter these errors when installing the various database driver modules. Just take the same approaches to each type of error and everything should go fine (GHC 6.10.1, Mac OS X 10.5.5).

HDBC suffers from the same "old exception problem". You can either make it use the old version of base, or change the references to Control.Exception to Control.OldException. One that's done, you can install HDBC with:

runhaskell Setup.lhs configure
runhaskell Setup.lhs build
runhaskell Setup.lhs haddock
sudo runhaskell Setup.lhs install --global

Once you've installed the database driver modules of your choice (I used sqlite3 with both), you should be able to access databases from Haskell.

03 Dec 2008

Stability for the win?

The company that I use to host this site had a rather large problem yesterday -- routine maintenance of some power supply equipment by the service company went wrong when they blew the fuses on the UPS', couldn't get replacements, and ran out of diesel for the generator. Everything go boom. It took a while but everything is back up now and none of the sites I or my employer host with them appear to have lost anything but uptime.

Hopefully it won't happen again.

25 Nov 2008

A better way to control attributes in SPIP templates

This post describes a PHP function to replace SPIP's inserer_attribut and extraire_attribut filters with a single jQuery-inspired attr filter.

19 Nov 2008

Hosting change finally complete

The migration of this site to my new VPS is finally complete. After a bit of faffing around and waiting for request approvals to go through, the DNS migration happened yesterday but took more than 30 hours to become active due to the ridiculously long TTL on the NS records my old hosting company used.

This is now hosted with software I control, on a [virtual] server that I control and is not oversubscribed. Readers (both of you) can expect better performance and, in the next few days, a few new posts.

03 Nov 2008

An Experiment in Social Media Stuff

I'm a member of the Perth Atheists meet-up and we had our monthly get together at the Flying Scotsman in Mount Lawley tonight. Instead of the usual short talk (which are always entertaining, informative, excellent and awesome) this week was for "housekeeping" -- namely talking about what sort of group we want to be. The "housekeeping" label might have had something to do with the slightly reduced numbers, but the discussion was good nonetheless, with some excellent views and ideas of who and what and how our little group can grow and be and do something.

One avenue that was reasonably obvious to all (it is, after all, a meeting organised through a web-site) is an online presence to call our own: a web-site with some form of "easy-to-use" CMS or blogging platform installed and integrated with the various social media widgets that all the cool kids are using these days. Given that I work as a web-developer, I've put my hand up to help make a go of it.

There's already a domain name perthatheists.org and hosting and people enough who can generate at least a little content, so we'll probably start simple with a blog (probably WordPress), a bit of social network integration -- post to X, link on Y, a Twitter bot, etc. -- and an e-mail list. In the next month or two we'll probably launch a small campaign or two like Read Your God Damn Bible and the Gideon Removal Project.

In the mean time, a few of us will get to work preparing some content, developing a web-site, socialising the media, and hooking it all up to the intertubes. This time next month, we'll have us a web-site.

10 Aug 2008

Matching Brackets in Cocoa

Once you've got a piece of code to check that a string uses correctly matched brackets, hooking it up to widgets in Interface Builder is pretty simple.

02 Aug 2008

A List Apart Survey for People Who Make Web Sites 2008

I just finished the A List Apart Survey for People Who Make Web Sites, 2008. They told me I ought to post this on my blog and I do find the results interesting to look over, so why don't you follow the link below and do of yourself (if you make web-sites)?

I Took the 2008 Survey! And so should you.

24 Jul 2008

Matching Brackets in Haskell

I have no idea where I came across the link (someone's solution in PHP?), but I stumbled on A Programming Job Interview Challenge #13 - Brackets the other day. It's a pretty trivial problem but I was bored tonight, so I hacked up a quick solution in Haskell. Haskell is a statically typed, non-strict, purely functional programming language that has whole great big piles of awesome built right in. What follows is pretty routine, but in world dominated by the likes of Java, C, .Net and the other misfits, Haskell is pretty strange so I'll try to explain.

As Haskell is a purely functional programming language, its functions are first class (you can given them names, pass them around, create new ones, etc., etc.) and they are functions in the mathematical sense (the same values yield the same results, every single time). This latter point implies that there is no mutable state (i.e. variables that can change). While this might seem like a pretty big handicap, it actually means that entire classes of bugs are impossible, that compilers and optimisers can do more to your code, and too much other stuff to mention here (and a super cool feature called monads lets us use mutable variables even though there aren't any).

Enough about Haskell on with the show: given a string of characters we need to determine if the brackets in it are or are not validly nested. That is, we've need to define a function that takes a String and returns a Bool (True when they are valid and False when they are not). I used a pretty standard pattern in Haskell, whereby we use a thin wrapper to provide a convenient interface to a worker function that does the real work. We'll call the wrapper check and the worker check' (again, this is a pretty standard naming convention in Haskell).

Thinking about the problem a little, it should be pretty clear what algorithm we need to use: for each character in the input:

  • If it is not a bracket, skip it.
  • If it is an opening bracket push its opposite onto a stack of expected closing brackets.
  • If it is a closing bracket, pop the value of the expected stack. If they are not equal, then the brackets are invalidly nested and you can stop now. Otherwise keep going.

When you've processed all of your input, the stack should also be empty (otherwise you haven't seen a closing bracket you were expecting).

In Haskell, a String is a list of characters, so we'll use one String as our input and one String as our stack. Our wrapper then will need to take the input, and pass it and an empty stack (we aren't expecting any brackets yet, after all) to our worker:

check :: String -> Bool
check = check' ""

(Notice that we don't explicitly mention the input. The way Haskell does typing and evaluation means that the compiler can just take it as read.)

To help make writing the code a little easier, we'll use a fairly stupid helper function to tell us which closing bracket to expect given an opening one. Alas, for the sake of brevity, I've left this as a partial function: given some character from a small set, it will return the matching bracket. Given a character that isn't a bracket, though, it'll simply raise an exception and terminate the program.

-- | Given an opening bracket, return it's closing counterpart 
expect c = fromJust $ lookup c $ zip "[{(<" "]})>"

Finally we get to check' -- the function that actually does all of the work. It takes two parameters -- the stack of closing brackets it should expect to encounter, and a string to process -- and returns True if the stack and input are both exhausted without encountering an inconsistency and False otherwise.

-- | Checks to see if a String contains only correctly nested brackets.
check' :: String -> String -> Bool

The first clause in the definition handles the "we've run out of input" case. If there are no input characters to be processed, then the input was correct if and only if the stack of closing brackets we are expecting to see is also empty.

check' s []    = null s

If there is input still to be processed, take the first character c. If c is not a bracket, then we continue processing the rest of the input. If c is an opening bracket, then we add its matching closing bracket to the stack of those we're expecting and continue processing the rest of the input. If c is a closing bracket and we are expecting to see a closing bracket, then the input was correctly nested if it is the brackets we were expecting (the top of the stack) and the rest is nested properly. In any other case, the input must not have been correctly nested.

check' s (c:r)
    | (not$ elem c "[]()<>{}")      = check' s r
    | elem c "([{<"                 = check' (expect c:s) r
    | elem c ")]}>" && (not.null) s = (c == head s) && check' (tail s) r
    | otherwise                     = False

There it is: a fairly trivial solution to a fairly trivial problem. There are definitely better solutions out there (folding the list into Maybe [Char] where a result of Just [] is success or maybe filtering the iterated input) but it works.

23 Jul 2008

Native iPhone/iPod Touch WordPress Client

This is my first post using the native client on my WorsPress client. It is very nice (and free) but makes me miss copy and paste even more.

21 Jul 2008

Emulating Operators for Core Data

My last Cocoa post described a problem I encountered extending a Core Data tutorial by using bindings operators to aggregate a property of Core Data entities through a relationship. With a bit of grovelling through documentation and some help and guidance from Tim Isted I've managed to get it to work, sort of.

Given Department and Employee entities and a 'employees/department' relationship between them, I tried to bind a column in an NSTableView to employees.@sum.fte to display the Full Time Equivalent staffing for each department. Alas, it was not to be and in this post I'll explain [a little] why this is not the case, and one way [a dirty, filthy hack] to work around it.

The problem is caused by the way in which Core Data returns the collection of entities at the "other" end of a to-many relationship. Core Data, as you may already know, loads data from a backing store lazily, that is: only when it absolutely must (or is told to). This has a number of benefits from a whole-system point of view including reducing memory consumption, decreasing data staleness, etc., etc. Core Data does this using faulting: when a piece of data is needed that hasn't been loaded yet, it generates a fault (this is a grossly simplified over generalisation). Ordinarily this isn't a problem: if you're using entities through a controller (that prepares it's content) or, I suspect, through a one-to-one relationship then everything works transparently. It does become a problem in this case when you want to use the far end of a to-many relationship. Rather than return a NSArray and NSSet or some other standard collection class, the relationship returned an _NSFaultingMutableSet a private-ish (not the underscore) class that implements most of the interface of an NSMutableSet. The key word here is most.

Where NSMutableSet, NSArray, their subclasses, and assorted others allow the use of set and array operators, _NSFaultingMutableSet apparently doesn't. Or not those that depend on the objects in the collection -- like @sum.

The new problem then is to convert this _NSFaultingMutableSet into something the widget can display. Looking at the binding inspector in Interface Builder, the most obvious option is that Value Transformer box. Thankfully, value transforms are reasonably simple, especially when they are one way. After you subclass NSValueTransformer to do what you need, create an instance, and register it with a given name (I did it in [MyDocument init] as suggested by Tim, how ever you do it, it probably needs to be done before the NIB is loaded). Then entering the name in the Value Transformer box in IB gets it called. A little bit of code using an NSEnumerator to emulate @sum and it now works:

Emulating Operators with an NSValueTransformer

Thanks to Tim Isted for his help, guidance, and sample code. Suggestions are welcome as to other, perhaps better, ways to get this to work.

20 Jul 2008

Protecting Content with SPIP

SPIP is a great CMS with lots of powerful features, but it does embed quite a lot of policy within its workings. One aspect of this is the difficulty of restricting access to content to authenticated users. Doing so is not particularly difficult, but doesn't appear to be documented in any great detail anywhere, so I'll describe the approach I used for one client's site.

Before we get down to the details, I'll describe the use-case. The site this formed part of was for a small professional organisation. They wanted a way to post resources and a small forum both accessible only to their members. For various reasons, the site was to be implemented with SPIP, without any of the several forum plugins, and we very much wanted to keep the members from needing to access the SPIP back-end.

The first order of business was giving users accounts without allowing them to access the back-end. Thankfully SPIP has a number of different levels of user: administrators, editors, and visitors. Administrators can do anything, editors can create and modify content, and visitors can (depending on the configuration) participate in forums and petitions and suggest content. The visitor status is disabled by default, but can be enabled under "Site Configuration -> Interactivity" in the back-end. Somewhat confusingly, you cannot create a visitor account unless one already exists, but this didn't much matter as I used a script to create the hundred plus accounts anyway.

Once you're users have accounts, you need them to be able to login. There are two ways to do this: use the normal SPIP login page with a destination, or embed the login form in a template. The former involves getting the user to http://example.com/spip.php?page=login&url=URL where the latter requires that you use #LOGIN_PUBIC to embed the login form in your page. In my case the designers included the a user-menu/login-form box on every page, so I had the decision made for me.

Telling when the user is or, more importantly, is not authenticated is a little trickier: you can either break out into PHP and check $auteur_session as described at the bottom of the SPIP Forms documentation, or use the apparently undocumented #SESSION tag. I chose to use the former, but the latter is probably a better choice if you can be bothered figuring out how to use it (see the comments in ecrire/public/balises.php).

Tying this all together then: to protect the content displayed using a template you should use a piece code like the following.

// If the user is authenticated...
<?php if ($auteur_session): ?>
    // ...display the content
    [(#TEXTE|paragrapher)]
<?php else: ?>
    // ...otherwise display the login form
    <p>This content is protected...</p>
    [(#LOGIN_PUBLIC)]
<?php endif; ?>

Something that you should be aware of when doing this sort of thing the current version's (the 1.9 series) login form is, in my opinion, seriously broken by it's two-stage process, JavaScript of dubious utility and the fact that it leaks information like a sieve. Thankfully the development version that will become version 2.0 resolves many of these issues and you'd be well advised to wait for it, or use the redirection method (which I'll describe in a future post).

18 Jul 2008

Computed Attributes in Core Data, How?

I've worked through a few Core Data and Cocoa tutorials in the last few weeks and most of them are exceedingly awesome. That fact that there are so many capable Cocoa developers out there who spend time creating tutorials and sharing their hard earned experience is fantastic and speaks volumes about the Cocoa and the wider Mac communities. To (not really) give a little back and (more) attempt to solicit suggestions I'll be posting about some of the problems that I've run into trying to move beyond the "getting started" tutorials and ways to solve them. First up is computed attributes in Core Data applications.

Many of the Core Data tutorials available use a personnel database as an example (perhaps after the RaiseMan example in Cocoa Programming for Mac OS X and I seem to recall seeing a guide or piece of sample code from Apple along similar lines?). I'm not one to buck a trend and it's easier to build on something than to start from scratch, so I'll do the same. Continuing from where I left my post on using bindings operators with Core Data we'll first extend our app to display the number of employees in each department.

This is pretty simple: just add a second column to the departments NSTableView, title it "Staff" and bind it to the Departments.arrangedObjects with the path employees.@count. You'll probably also want to make sure it is not editable (it'd be a strange use case indeed in which it would be editable).

Adding department staff numbers

As in my last post, we're using bindings to call count: on the array of employees for each department. Last time we just used it as a flag, but this time we're actually displaying it. Save the NIB (or XIB) and rebuild the app. You should now get employee counts like this:

Counting department employees

Great! We made the change we were after: the user now gets to see (and use) the number of employees in each department. If our employment practices were more complex we might have part-time and job-sharing employees and need to display Full Time Equivalent staff members: this should be pretty easy too. We could add an 'fte' field between 0.01.0 to the Person entity and rather than just counting the number of staff we could total up their fte values fields by binding to employees.@sum.fte. At least, we might expect to be able to. Alas, I couldn't get it too work.

Even if it did work, I'm far from convinced that this is the "Right Way"(tm) to solve this problem. Surely there is a way to add a computed field like this one to a Core Data model without having to use a custom NSManagedObject subclass and to recalculate the value of transient property it every time it's requested (or using KVO or some such to recalculate it every time the fields it depends on change)? If so, I haven't been able to figure it out...

I've described a way to work around this problem using a subclass of NSValueTransformer in my post Emulating Operators for Core Data.

15 Jul 2008

Binding Operators With Core Data

Tim Isted posted an excellent tutorial on building Core Data applications with multiple windows which really cleared up some of the mystery of using Core Data for me. He guides you through the process of modifying a "Core Data Document-based Application" project to support multiple windows per document. There are a few enhancements to the project that simply cry out to be made.

Tim notes that the user interface can be improved by ensuring that the "add" and "remove" buttons for the Departments and People are enabled and disabled based on the state of the model. This is, as he points out, pretty simple, and it's described in very nearly every bindings tutorial out there. Simply bind "Enabled" to the canAdd and canRemove keys of the appropriate NSArrayControllers.

Properly enabling and disabling the "open employee window" button is slightly more difficult: where the other bindings in this tutorial simply bind values (the departments to display, the name of the person, etc.) here we're interested in binding to a property of the value -- whether it's empty or not -- rather than the value itself. Happily, this is almost as trivial as the previous cases. Rather than simply binding the values of a controller or model we'll need to use an operator to transform the value of a controller key so that we can use it.

The enabled binding expects its bound value to be a boolean: a widget is either enabled or disabled. The select of an NSArrayController is some other collection or other (I'm not entirely sure which, but it's definitely not a BOOL). To transform this possibly empty collection of NSManagedObjects into an empty-or-not BOOL we can exploit one of it's operators @count (the rest are describe in the Set and Array Operators section of the Key-Value Coding Programming Guide). @count is basically just the good old count: method from NSArray: called on a collection, it returns the cardinality of that collection as an int. As we all know, most C-based and C-like languages allow you to treat pretty much anything as a BOOL with 0 being NO and every other value YES. This is exactly what we want.

To solve our problem then, we should bind "Enabled" for the "open employee window" button to "People.selection.@count". Now the button should be disabled when no people are selected and enabled when there are people are selected.

Button disabled with no selection

Button enabled with selection

Alas, the rest of the set and array operators (@sum, etc.) don't seem to work. See more on this problem in Computed Attributes in Core Data, How?and one (not entirely pleasing) solution in Emulating Operators for Core Data.

08 Jul 2008

Web-Development with SPIP

SPIP is an open-source content management system based on PHP and MySQL. It has excellent support for multi-lingual sites, for community generated content, obtains exceptional search engine results with little effort, and has a very good administrative interface. Excellent though it is, it can be difficult to get started developing web-sites using SPIP due to its sometimes patchy English documentation. Thankfully the SPIP community is helpful and very friendly and I work with a Francophone who doesn't mind reading code and documentation to me.

The posts in the SPIP category contain various techniques I've gradually built up using SPIP full-time for the last six moths.

[SPIP]: Système de Publication pour l'Internet Partagé or Participatif [PHP]: PHP Hypertext Preprocessor

08 Jul 2008

Resources for Learning Cocoa

While Cocoa is nowhere near as large as some other APIs, it does cover an enormous amount of ground and it can be difficult to know how and where to get started. Thankfully, there is no paucity of information out there. Some of the resources that I've found particularly useful are listed here, partially so that I can find them again and partially so that other who stumble onto this page can do so too.

Books

Documentation

Sites

  • CocoaDev is a wiki for Cocoa programmers. There are diamonds here, but they are accompanied by plentiful dross, like any wiki.
  • Cocoa Dev Central has an archive of excellent articles and tutorials on many aspects of Cocoa programming. It also
  • MacResearch has a series of excellent tutorials looking at Mac development for scientific purposes.
  • LabNotes is a series of articles going beyond the Become an XCoder book linked above.

Blogs

28 Jun 2008

Beginning Cocoa Programming

I made the switch to Apple computers nearly four years ago when I used part of a scholarship to by an iBook for use at work. Like pretty much everyone else I knew, the idea of a UNIX-based system that Just Works and does the Right Thing was intriguing. The first thing I did when I got it home was connect it to power, and the second was install the developer tools. Since that time I have done almost nothing to forward my goal of developing software for the Mac platform. This is changing...

Earlier this year I bought [Cocoa Programming for Mac OS X (2nd ed.)] only to find that the [third edition] was expected out in a few months. Pre-ordering it on Amazon, I put off taking up the Mac development gauntlet until I had a single coherent resource which covers the new APIs like CoreData and CoreAnimation. Soon, I had the book in my hot little hands but still I put off beginning my path on the road to Cocoa--developer-dom. Then, my application for the iPhone developer programme was accepted and I paid the $US99. I don't mind paying for books and not reading reading them -- I like to look at owning a book as being, if not a substitute, at least a placebo for reading it -- but if I'm paying for a programme membership, by Invisible Spaghetti Monster I'm going to use it. Spurred by my resurgent yearning for a semblance of legitimacy as a past student of CS and my sense of fiscally-inspired entitlement both, I downloaded the SDK, picked up the book, put my head down, and started learning. This blog a record of my process of learning Objective-C and Cocoa development, along with my other interests.

10 May 2008

World Blog Awards

Notes from an announcement at Barcamp Perth 2009 about the "World Blog Awards".

10 May 2008

Using Rails and Flex

Notes from a talk on Using Rails and Flex at Barcamp Perth 2009.

10 May 2008

TiddlyWiki presentation

Notes on a talk about TiddlyWiki at Barcamp Perth 2009.

10 May 2008

Starting your own web-business

Notes from a Barcamp Perth 3.0 talk on starting your own web business by Paul Faix.

10 May 2008

Myles-i the web guy

Notes from a question and answer session with Myles Eftos at Barcamp Perth 3.0.

10 May 2008

Model View Controller

Some notes from a Barcamp talk about Model-View-Controller in ASP.Net.

10 May 2008

Live blogging BarCamp2

This is a live blog of Perth BarCamp2. If you're here and want to be added as an author, DM or email me.

10 May 2008

AWIA Edge of the Web

Myles is talking about BarCamp2, it's an AWIA thingy, just like port80, barcamps, blog awards.

They've announced the Edge of the Web web conference to be held on 6--7 November, 2008. I've signed up for the email list, and voted on the logo. Should be pretty good.

10 May 2008

Angel Funding Q & A session

Some questions and answers about angel funding and venture capital for web projects and about Silicon Valley.

10 Jan 2007

Pumpkin and sweet potato soup

Given that we've got half a pumpkin and a sweet potato to use up, I made a soup based on the Spiced Pumpkin Soup and Pumpkin Soup recipes from the Wikibooks Cookbook.

I made a few concessions to expediency (I only had dried onion, didn't have any garlic, etc.), but it turned out fairly well.

Ingredients

  • 1 tablespoon butter
  • 2 tablespoons dried diced onion
  • 3 tablespoons plain flour
  • 1/2 teaspoon curry powder
  • 1/4 teaspoon ground cumin
  • 1/4 teaspoon ground nutmeg
  • 1/4 teaspoon salt
  • 1 sweet potato, peeled and cubed
  • 1/4 of a pumpkin, peeled and cubed
  • 2 carrots, peeled and sliced
  • 1 litre vegetable stock
  • 1 cup whole milk

Method

  1. Melt the butter in a large saucepan and add the onion, flour, and spices. Sauté for a few minutes.
  2. Add stock, salt and vegetables. Boil until the vegetables are cooked.
  3. If possible and desired, blend in a food processor until smooth (allow to cool for 10-20 minutes first).
  4. Bring back to boil (if you blended it) and add the milk. Simmer for 5-10 minutes.

10 Jan 2007

An eclectic taste in music

I bought two CDs from Mojo Music today. My selections (The Black Parade by My Chemical Romance and Beatles Go Baroquea CD of classical treatments of some of the Beatles most popular songs — arranged by Peter Breiner) provoked a remark from the guy who served me about my having an eclectic taste in music. I can't imagine why. ?

09 Jan 2007

Bought "Myth of Ability"

It's the 9th of January and I've already broken my main new-year's resolution by buying the Myth of Ability by John Mighton which I saw for 25% off at Angus & Robertson.

04 Jan 2007

Resolution for 2007: no more books!

One of my resolutions for 2007 is to beat my book buying habit. Too often I find myself buying a new book, reading the first few chapters, and abandoning it in favour of another new purchase. I have a deck of playing cards which I used a bookmarks and almost all of them are in books, some of which I began reading more than two years ago. I therefore resolve not to buy another book (excepting required textbooks) until I've finished those I already own. To start with, I've selected twelve shorter unread books:

  • Thomas Paine, Common Sense
  • Thorstein Veblen, Conspicuous Consumption
  • Marcus Aurelius, Meditations
  • Harry Brighouse, Justice
  • Alastair Hannay, On The Public
  • Lynne Truss, Eats, Shoots & Leaves
  • Jonathan Mills (ed.), Barons to Bloggers: Confronting Media Power
  • Alain de Botton, The Consolations of Philosophy
  • Chris George, The Book of Digital Photography
  • Karen Cheng, Designing Type
  • Gordon Rennie, David Bishop, Simon Jowett, Peter Evans & James Swallow, I Am the Law
  • Thomas Hardy, Tess of the d'Urbervilles

04 Jan 2007

Adding LaTeX output to HsColour

My patch adding LaTeX output to HsColour (a syntax highlighter for the Haskell programming language) was accepted into the main darcs repository. There was a previous post announcing the patch.

04 Jan 2007

Adding LaTeX output to HsColour

My patch adding LaTeX output to HsColour (a syntax highlighter for the Haskell programming language) was accepted into the main darcs repository. There was a previous post announcing the patch.

22 Dec 2006

Lois and Clark on DVD

I bought a copy of season one of Lois & Clark on DVD. It was nice to actually get the DVDs of the first season instead of the second season, as I got when I tried to buy it from Coles.

22 Dec 2006

1407

I bought a copy of season one of Lois & Clark on DVD. It was nice to actually get the DVDs of the first season instead of the second season, as I got when I tried to buy it from Coles.

20 Dec 2006

LEGO Mindstorms

I borrowed a LEGO MindStorms for Schools kit from the University today. I'm going to have a go at using Esterel, a synchronous reactive programming language, to solve the sorts of problems students face in the RoboCup Junior Tasmania. Should be fun.

20 Dec 2006

A patch adding latex support to HsColour

HsColour is a syntax highlighter for Haskell that can generate output in a number of formats including, if the patch I just submitted is accepted, LaTeX. To get LaTeX output from HsColour:

darcs pull http://darcs.thomas-sutton.id.au/hscolour/

Or wait for it to show up in the main-line.

19 Dec 2006

1404

I want to really learn Ruby on Rails so I've decided to start working on a project. Being interested in online learning, I'm going to create a virtual learning environment.

I'll need to read up on a bunch of things like standards (SCORMIMS LD, and Becta's learning platform specifications) and pedagogical approaches (constructivism, etc.) before I can really get started, but I hope to have something useful going within two or three months.

18 Dec 2006

Programming language design ideas

This post will contain some of my musings on programming language design. At some point, my first programming language will be based on these ideas.

Transactions are an interesting solution to maintaining the consistency of shared memory concurrent systems, while the ?-calculus seems to be the bee's knees for distributed systems and the join calculus looks pretty cool for concurrency all round. I'm sure it's been done, but an extension of the join calculus to work over communication channels such as are used in the ?-calculus might be an interesting and useful foundation for a language.

Automatic parallelisation and vectorisation of code will be an interesting problem, particularly for areas like statistics and numerical analysis which are currently served by languages like R. Combining a real type-system with automatic vectorisation of folds and maps would, I think, make a more elegant and probably-not-slower solution to the problem, though it might lessen the ability to do exploratory programming.

18 Dec 2006

Wanted: a better understanding of constructive logic

I was thinking about how little I understand of type systems today -- I know that they tend to be an embedding of a constructive logic, Int for example, but I don't have any sort of intuitive understanding of what this actually means. This is probably because I haven't done much with intuitionistic logics.

I think that I'll start trying to get a better understanding of intuitionistic logics by reading Eleanor Donovan's honours thesis: "Automated Proof Search in Bi-Intuitionistic Logic Using Sequent Calculi".

18 Dec 2006

1401

I've just moved this blog to my new host: thomas-sutton.id.au. I'm not sure what else to make available here, but for the time being, this will do. I'm planning on importing all my old posts and consolidating all of my blogs on this one, but that'll have to wait a few weeks.

24 Nov 2006

Little Women

Just watched Little Women. Beth recovered (after a fashion, and for a while), but I wonder what happened to the baby (which introduced the scarlet fever)?

Given that, in 8Little Men, Alcott describes Jo as being not at all handsome, but [having] a merry sort of face..., I can't quite understand what possessed them to cast Winona Ryder to play her ("not at all handsome" being probably the least apt description of Ryder as is both conceivable and not "exceedingly ugly" or some such). In any case, she played the role very well indeed in-spite of being rather more "handsome" than the character.

24 Nov 2006

"Do you REALLY want to be a NPC?"

In a recent rant, Fred Gallagher (a.k.a. Piro) wrote:

Don't just blow voting off like its a game you just aren't interested in playing. You are in the game, whether you like it or not. Not voting makes you an Non Player Character. Do you REALLY want to be a NPC, letting others decide what happens in the game?

17 Nov 2006

Adding to the Wikipedia

I've just added my first real contribution to the Wikipedia: Image:Airfield_traffic_pattern.svg, a vectorisation of Image:Airport_traffic_pattern.jpg.

Airfield traffic pattern

16 Nov 2006

Week 2

The preliminaries out of the way, we began looking at "real" physics in week two -- kinematics. Various definitions, as is often the case, were a useful place to start; before we worked through an example problem. After considering the implications of negative values for some of the measurements we're concerned with, we examined the formulæ relating them to each other.

16 Nov 2006

Cooking (and Blogging Software)

I made some baklava yesterday and, as I do occasionally, I took some photographs of the process and posted them on Flickr. I just noticed that Google have a photo web-site too, so I'm posting this as a demo.

Making Baklava

Update: While Picasa Web has a nicer interface (i.e. doesn't leave me enough time to make a coffee between clicks), it doesn't have any of the browsing, searching, or group features that make Flickr so great.

08 Nov 2006

The Units in Short

To ensure that all students are starting at the same point, the first topic to be covered is the International System or Units, or SI. The SI specifies units to measure every conceivable quantity and a range of prefixes to help make these measurements more manageable.

The SI uses seven base units in terms of which all other units can be defined (although two of these, the candela and the metre, are now defined in terms of other base units, they are still know as such for historical reasons):

metre (m)
length
kilogram (kg)
mass
second (s)
time
ampere (A)
electrical current
kelvin (K)
absolute temperature
mole (mol)
quanity of matter
candela (cd)
luminous intensity

The three that we will use most frequently are the metre, the kilogram and the second.

In addition to the seven base units, there are numerous derived units so called because they are derived from the base units. The derived units we'll see include

joule (J)
energy, work
newton (N)
force

In addition to the seven base units and various derived units, the SI defines a number of prefixes to make it easier to deal with large and small numbers. Each prefix specifies an order of magnitude in the same way the exponent in scientific notation (which will be the topic of the next post) does. Thus one millimetre (1 mm) is 1x10<sup>-3</sup> m, or 0.001 m. The prefixes we will likely encounter in this course are:

Prefix Symbol ExponentMultiplier
teraT121 000 000 000 000
gigaG91 000 000 000
megaM61 000 000
kilok31 000
hectoh2100
decada110
01
deci d-10.1
centic-20.01
millim-30.001
microµ-60.000 001
nanon-90.000 000 001

08 Nov 2006

The Course Outline

The first lecture began with the distribution (in three locations several hundred kilometres apart) of textbooks, questionnaires, course outlines, and a sheet of useful data and formulæ. The skeleton of the course is described below, with more detail to come in subsequent posts.

Week One - Introduction

  1. Units
  2. Scientific Notation
  3. Rounding
  4. Vectors

Week Two - Kinematics

  1. Definitions of s,v and a
  2. Graphs of s,v and a
  3. Equations of motion
  4. Projectile motion

Week Three - Energy

  1. Forms of energy
  2. Work and power
  3. Kinetic energy
  4. Gravitational potential energy
  5. Conservation of mechanical energy
  6. Elastic potential energy

Week Four - Forces and Newton's Laws

  1. Forces
  2. Newton's first
  3. Newton's second
  4. Newton's third
  5. Inclined plane
  6. Friction

Week Five - Momentum, Circular Motion

  1. Conservation of momentum

Week Six - Circular Motion

  1. Circular motion
  2. Torque
  3. Angular momentum

There are readings and several problems from the course textbook (Walding, Rapkins and Rossiter's New Century Senior Physics) for each topic covered.

08 Nov 2006

Significant Figures & Rounding

The concept of significant figures, which came up toward the end of the previous post on scientific notation, deserves a bit more of an explanation. when writing a number, particularly a very small or very large number, it is common to write a number of zeros at its start or end, respectively. These leading/following zeros convey no information other than "move along, there's nothing to see here", you might even say that they are rather 'insignificant' when compared to the other digits, which we call significant digits, or significant figures.

One of the attractions of using scientific notation is that it allows us to omit non-significant figures as the only information that they convey (the magnitude of the number — that these places are empty) is given in the exponent.

An important, and related, idea is that of rounding. Much of the mathematics used in physics involves numbers with many of significant digits (the physical constants, for example) or operations which may result in such numbers (like taking roots and the trigonometric functions). When we combine these with other numbers the result will usually have a large number of significant figures, perhaps belying the accuracy of our input numbers. We usually, therefore, round our answers to as many significant figures as the input with the least. Thus our estimate of "3 m or so" does not result in an answer with a dozen digits — near enough it good enough.

For more information on rounding, including the variety of rounding methods, see some of the links below.

More information can be found at the Wikipedia articles on rounding and the Wolfram Mathworld articles on significant digits.

08 Nov 2006

Scientific Notation

As the talk of 'prefixes' in the previous post on units suggests, physics involves working with both very large and very small numbers. While we humans are pretty good at working with numbers with rather small numbers of digits (one, two, three, even four or five digit numbers can be handled with a fair degree of precision and reliability), if we increase the number of digits to ten or twelve, then we slow way down and start making more mistakes.

To help reduce the burden of large and small numbers on we mere humans, scientists often work with numbers using what's called scientific notation. Rather than writing a large or small number as we might normally, we split it into two parts: a mantissa and an exponent. Rather than muddy the waters with an inadequate explanation, I'll give an example.

According to my calculator (and Google), the speed of light in a vacuum is 299,792,458 m/s. When working in scientific notation we write the speed of light as:

2.99792458 ×108 m/s. Here '2.99792458' is the mantissa and '8' is the exponent. Scientific notation means exactly what is says: take the mantissa, and multiply it by 10`exponent`. The multiplier is always 10, so this is the same thing as moving the decimal point `exponent` places to the left or right. Using scientific notation helps us write numbers with many non-significant digits in a more compact form (the weight of an electron, for instance, begins with thirty-one 0's and the mass of the Earth ends with twenty 0's), helps us determine the order of magnitude of a number (instead of counting the digits, we can just look at the exponent), and reduces the effect of transcription errors (if we skip, transpose, or mistake one of the digits in the mantissa, the number will at least be in the same order of magnitude as the original). For more information, you might like to see the Wikipedia articles on [scientific notation](http://en.wikipedia.org/wiki/Scientific_notation) and [order of magnitude](http://en.wikipedia.org/wiki/Order_of_magnitude) and the Wolfram MathWorld articles on [scientific notation](http://mathworld.wolfram.com/ScientificNotation.html) and [order of magnitude](http://mathworld.wolfram.com/OrderofMagnitude.html).

08 Nov 2006

A Brief History of Physics

Aristotle was perhaps the first in the Western tradition to look at mechanics in any sort of structured way. A philosopher, rather than physicist, Aristotle thought about the way objects interact with each other, particularly their motions.

One of the ideas to come from Aristotle's work is that objects "like" to remain at rest. This seems rather reasonable — put a book on a table and it remains still, push it gently and it will move until you stop. This begs the question, though — what happens when we throw ad object? Our hand stops pushing, but the object continues to move. Likewise when we roll a ball — we release the ball and it continues to move. Aristotle's answer was impetus.

When an object is moved by another (your hand, for example, throwing a ball), it accrues impetus. When the mover stops acting upon the movee, the impetus it accrued whilst being acted upon is used to continue the motion. Under this model, we would expect objects to exhibit straight-line trajectories (see figure one) rather than the parabolic trajectories (see figure two) we see when we throw an object.

Figure 1: A straight-line trajectory of the sort predicted by Aristotle's theory of impetus.

Figure 2: A parabolic trajectory of the sort predicted by classical mechanics.

A second idea of Aristotle's is that heavier objects fall faster than lighter objects. It does, at first glance, seem rather reasonable but it is, like the idea of impetus, quite easily shown incorrect.

The Aristotleans didn't bother to take observations or do experiments to support their beliefs and most of those that came after them were content to trust Aristotle. Thus for more than 100 years, our understanding of mechanics was fundamentally flawed. It is the resolution of this flaw that brings the next major milestone in mechanics: experimentation.

During the 16th and 17th centuries, Galileo Galilei and other became amongst the first physicists when they used experimentation to confirm and reject their ideas about the motion of objects. Among Galileo's more famous experiments (though the story is now considered to be untrue) is his dropping balls of varing mass of the Leaning Tower of Pisa by which he showed that, contrary to Aristotle's account, the speed of a falling object is independant of its mass. It is precisely this power — to overturn wrong ideas, even if though they have been believed true for centuries, and to suggest a more complete understanding — that makes experimentation so central to all of the sciences.

This experimental focus was not the last development in the physics that we'll be looking at, though it did help pave the way for it. This next and final (for our purposes) leap was due to Newton — using mathematics to describe physics. After that, classical mechanics was essentially complete, with "only" quite a few decades of improvements and polishing before the introduction of relativity and quantum mechanics. It is physics at this level, the state of the art of classical mechanics circa the mid 19th century, that we'll be studying in this course.

07 Nov 2006

Notes on a Course in Physics

Over the course of the next six weeks, I will be taking an enabling course in physics. Designed to prepare people without a formal education in physics to study it at an undergraduate level, the course aims to cover enough of a high-school physics syllabus to meet university entry requirements in approximately six weeks.

On this blog, I will post notes, links, and other materials that may be of use to others who wish to begin studying physics.

07 Nov 2006

My iBook is in the shop again

So my Apple iBook G4 is in the shop. Again. Getting repaired. Again. Having its logic board replaced. Again.

I love the system -- OS X is, hands down, my favourite operating system -- but I don't think I'll be getting another Mac. I need a computer that will work, not one that needs a major component replacing twice in two months. As soon as I can afford to replace it, I think I'll get a PC laptop to run a Linux or BSD and retire the Apple to desktop use or even as a household server.

04 Nov 2006

Lucas

Chickenfeed have been flogging some cheep DVDs lately and every time I'm in one of their shops, I have a look at what they have in stock. The last time I did so, I got a copy of Lucas — Winona Ryders' first feature film. I just got around to watching it tonight and, while it's really cliched in places, it does have a few redeeming features.

The fairly drawn-out love-triangle (or, square, or even pentagon, depending on how you count) could have been resolved a lot quicker. It would have been nice to see a resolution to the Rina-Lucas sub-plot, though doing so would have interfered with that time honoured '80s feel-good film tradition: the closing freeze frame of the hero triumphant. My view can quite easily be summed up as: O.K., but more Winona Ryder would have been nice (as though it needs to be said).

30 Oct 2006

A well-rounded practical experience

I've just put in my preferences for my Professional Experience 3 placement next semester. In the interest of a well-rounded set of practical experiences, I've requested a placement in either of the senior secondary colleges in Launceston — Launceston College and Newstead College. I did put both down as my first and second preferences for prac. this semester, but didn't reckon with exams, or whatever else made them decline prac. students (or, maybe, just me). Once I have some senior secondary experience, I'm planning on doing my internship at one of the private schools, hopefully Scotch Oakburn College or the Launceston Church Grammar School.

If everything goes to plan, I'll have had six weeks in public secondary schools (7-10), four weeks in a public senior secondary school (11-12), and about seven weeks in a private secondary school. I'll have covered the full secondary age range (12 y.o. to 17 y.o.) from a range of socio-economic backgrounds in both the public and private systems.

Tags:

10 Oct 2006

A Second First Lesson

Today I took my first CAD lesson as teacher. I'd intended for the students to use this first lesson to being the self-paced tutorials for SketchUp, the program we'll be using. Rather than start the tutorials, most of the class had them finished half way through the lesson.

As a stop gap, I drew some simple figures on the board (just a few basic roof, door and window shapes) for the ones who finished earlier than I was expecting to complete and asked the students that finished even those to model items from around the class room. The main thing that I got out of this lesson is the need to have extension work planned and ready to go — making up extension problems one at a time doesn't work nearly so well when it's the whole class.

Feed back from my colleague teachers includes the need for me work on getting and maintaining the students' attention (e.g. when giving instruction) as I have a tendancy to try to talk over the top of them which doesn't work very well as a) I'm not loud enough, and b) they listening. I also need to make sure that I keep them on task.

This post was written ex post facto.

Tags: /

02 Oct 2006

The Teaching Begins

The second week of PE2 began with my colleague teacher off ill. This was a little inconvenient, but everything went well with the relief teacher. In the science lesson first up, the students had plenty of work to do on their inquiry projects which are due this Friday, but we could only use the computer lab for the first half of the period. This left some of them with little to do for half a lesson, but on the whole, they were on task and much more settled than they were during the lesson I taught last week.

During the two periods between recess and lunch, we had maths and both classes went quite well. Some of the students got their assignments on perimeter, area, volume and surface area handed in, whilst others will [hopefully] have them finished for my colleague teacher's return tomorrow. Many of the students that hadn't finished managed to get it polished off, and all of them worked relatively well, so it was good.

During the final period, I took my first IT class. As the grade tens were attending a whole grade event, I had the ninth grade students from mine and two other classes. As it was a one-off, I took them through a Google Earth my colleague teacher had ready. The students has to locate a number of features ranging from relatively easy (just type it in a Google Earth will find it for you) to more challenging (such as streets in towns Google Earth doesn't know about). All up I thought that it went pretty well, especially with the potential for disturbance posed by the mixture of three classes together.

After school ended there was a general staff meeting which, while interesting, I have no intention of writing about here.

Tags:

29 Sep 2006

A Week Accompli

The last day of my first week began with the IT class talking about web-page design and Dreamweaver. The discussion about "the aspects that make a web-page good or bad" did not, in my opinion, go as well as it might have — many questions went unanswered and when they were, the responses tended to be focus more on content than design. Whether this was a result of the natural reticence of adolescents to single themselves out by volunteering the answer to a question or a lack of sophistication in their current understanding of design, usability and æsthetic appeal, I'm not sure.

In the second lesson of the day, the science group continued thinking about gravity. In particular, they looked at the formula for the magnitude of the attraction between two masses and the role both the masses and the distance between them has in determining the force exerted. One thing that I'll need to bear in mind during future science teaching is the utility of diagrams as a pedagogical device. Getting a student to draw a diagram of a situation and the forces at play really helped explain buoyancy to them.

During the C.A.D. lesson, the group finished off their current project and many of them began looking at SketchUp in anticipation of next week. Judging by their performance today, the next two or three weeks (I'm not sure if this class will be affected by the impending time table change) will be interesting for them and me both. If all goes well, there will soon be a few more objects in the Google 3D Warehouse.

Tags:

28 Sep 2006

Planning and Professional Development

Today was the fourth day of PE2 and I spent it mainly on planning and professional development. Before school started I attended the staff meeting where a number of issues were discussed, particularly enforcing the school's policy on mobile telephones. If teachers see students using mobile phones during class, we are required to confiscate them and hand them in to school office to be collected by the child's parent or guardian. The principal emphasised the need for consistency in our implementation of this policy and this is something that I'll have to work on as I returned confiscated phones at the end of the lesson several times on Monday.

During the first two blocks, I got the opportunity to take part in a professional development session on anger management. The session was given by a community social worker based in a near by major town and focussed on a programme for boys with anger management problems and their families that the school will be joining next year. It was a great opportunity and I got a lot out of it, but I would have liked to hear more about specific strategies for helping students deal with their anger.

Between recess and lunch I was in the C.A.D. class I'll start teaching next week. I managed to learn a few more names and I think that by the end of tomorrow, I'll know most of the boys' (the whole class is boys) names.

After lunch I spent the last two periods of the day planning for the IT class I'll start teaching next week. I'm going to take them through a unit on computer hardware, common components of computer systems and the like. I'm pretty sure I know what I'll cover and how I'll present it, so it should work out pretty well. After I finished at the school, I went in to Ulverstone's CBD and took a few photographs of buildings that I'll take the C.A.D. class to see on their excursion.

I think that's about it. I'll have to remember to phone my university supervisor tomorrow.

Tags:

27 Sep 2006

My First Lesson

I taught my first lesson of PE2 in a year ten science class today. Last term they began a physics unit on forces and today, to help review what they learnt last term and introduce some new material, I spent a lesson working with them on the subject of mass, weight, and gravity. I had them use spring balances and sets of weights to measure the force of Earth's gravity (~9.8 newtons). They then weighted themselves (and/or each other) and calculated the weight of their own mass on other planets.

I think that the lesson could have gone better, but my colleague teacher was fairly happy with it. I would have liked it if they had been more interested in what I thought would be an interesting topic and activity, but they did seem to get what I wanted to teach out of it. The main thing that came out of it for me is that I still need to work on ways to manage students, particularly my voice. I speak and shout (in the "speak loudly" sense, of course) in from my throat and mouth rather than my chest, so talking for longer periods tends to give me a sore throat, never mind having to control a distracted class.

On the planning front, we've decided that I'll need to get my unit on computer hardware for the IT class ready for us to review on Monday before I start teaching it next week. When I'm finished this post, I'm going to go and revise the plans for my Sketch Up unit to include some design theory content and a possible excursion and to fit in the shorter time span I'll have to teach it.

I might have the opportunity to take part in a professional development activity on anger management tomorrow morning depending on spaces, etc., which will be good (though I'm not sure when I was last 'angry').

Tags:

26 Sep 2006

The First Day of Classes

Today was the second day of PE2 and the first day of classes for term three. We've sorted out my time-table, office, computer and photocopier accounts, and keys and I have a list of things to plan and teach during the next four weeks.

I started the day with a double lesson Computer Graphics class. The students are going to spend this week finishing off an TurboCAD assignment from last term and starting next week I'll take them through my Designing with SketchUp unit. Part of the feedback I got from the lecturer is that the unit could do with some design theory, so I'm going to look at cutting down the work (one project instead of two) and adding in some discussion of design movements and the like. Hopefully it'll wind up being about three weeks.

After recess, I was with my primary colleague teacher in two maths classes. It was reasonably similar to my experiences during PE1 and left me even more convinced that my experience of mathematics as a high-school student was unusual.

After lunch I had a free block and began thinking about the lessons and units I'll be teaching in the coming weeks. Tomorrow I'll be taking one lesson of a grade ten science class looking at forces. I'm planning to get the students to use force meters to measure weight and then calculate the weight of various objects under various strengths of gravity.

Next week I'll be starting my unit on SketchUp as described above and a unit on computer hardware for a class of students in grades nine and ten. I expect them both to go fairly smoothly. In two and a half weeks the time table changes, due to interference caused by the student production, and I'll have a class of students in grades seven and eight for IT for the last week. As these students will have such a wide range of ability (while some can program, others haven't used computers much at all) I'll be covering Internet safety and basic computer skills with them.

After school ended I spoke with a teacher who had a few questions about getting audio materials from the Internet (streaming audio, podcasts, that sort of thing). In the course of the discussion, I mentioned the resources I have from the outreach programme at NICTA last year, so I might present those short lessons to a maths extended class.

That's about everything that's happened so far. I'm off to plan tomorrow's science lesson.

Tags:

25 Sep 2006

QMAP Day

Today was the first day of my second practicum which I shall spend at Ulverstone High School. It was also a pupil free day, whether by coincidence or by design, I am unsure. During the course of the day, the teachers of the Central Coast cluster gathered at Penguin High School to participate in the Quality Assurance and Moderation Process. The day was broken up into three sessions -- two of moderating the assessment of work samples, and one of professional development.

During the first moderation session I was part of a group looking at work samples to be assessed for Being Numerate. We assessed a number of work samples from a class activity based on identifying patterns, finding rules and synthesising symbolic expressions of those rules. It was a relatively straightforward process and the group achieved consensus fairly easily in most of the cases.

During the second session, we looked as two work sampled assessed under Being Information Literate. As I experienced doing QMAP during PE1, everyone seems to have their own interpretation of the BIL standards and progression statements. The requirements about the safe, ethical, etc., use of information especially seems to cause much strife - why, some ask, should an other wise excellent piece of work be relegated to standard two just for a lack of referencing? In any case, it took us quite a while and a number of deviations from the QMAP protocol to come to a decision.

In the afternoon, I worked with a group of secondary teachers on "good questions" in numeracy. We used Bloom's Taxonomy along with the Being Numerate standards to explore questions we might ask of, and explore with, students about the concepts of money and finance. The suggestions and discussions we had were quite interesting.

Tags:

18 Sep 2006

Illiteracy

I read this comment on a story a few days ago and was appalled.

i am a 15 year old australian i think i am what americans would call a jok id prifer to run laps around a football or soccer field then reed eny thing i havent read eny thing in years but i started reeding this story at 11 at night and finished at 7in the morning i reeded 233 pages (i red some the night bifor) with out stoping and i reely injoyed it i reely want to know how it ends

I'm not sure which is worse, the abysmal spelling and grammar, or the idea that the writer hadn't "read eny thing in years." If I hadn't encountered students with such poor literacy before, I'd think that it was a joke.

Tags:

20 Aug 2006

Undead and Unwed

I've just finished reading Undead and Unwed by MaryJanice Davidson (who has a blog) and published by Piatkus Books, the first in her Undead series. It was a good read and it is certainly an interesting departure from the other books in this genre I've read (though Betsy did remind me of Charlaine Harris' Sookie Stackhouse).

I'm not sure if the next book will continue the theme (judging by the excerpt, I think not), but Betsy brought to mind David Eddings' description of his hero, Garion, as a "Sir Perceval":

Sir Perceval [...] is dumb — at least right at first... A dumb hero is the perfect hero, because he hasn't the faintest idea of what's going on, and in explaining things to him, the writer explains them to his reader.

In any case, I'll definitely have a look at the rest of Davidson's books.

Tags: , , , , , ,

15 Aug 2006

1400

This is a test of the new Blogger Beta. There are a few rough edges (literally — some of the "buttons" have jaggies as a result of dithering with the wrong background colour) and the AJAX would be nicer wall-to-wall, but I have no doubt that the Blogger team will clean up the various other bits and pieces in no time at all.

14 Aug 2006

Alas, the knitting, it would not felt

I finished my knitting off last night and today I tried to felt it to no avail. I shall have a go using the washing machine and tumble drier, but the thought has occurred to me that perhaps the wool was treated to prevent felting?

In any case, I'll give it a go and if it doesn't work, I'll just use my knitting as knitting (instead of felt).

Tags:

13 Aug 2006

Internet language resources for the win!

I've been thinking about trying to learn another language for a while now. I'd really like to learn Japanese or Welsh, but I think that I'm going to start with French. As in all things, I think that the best way to go about picking up a new skill is probably to start with something I'm familiar with and two years of French at primary school have made me much more familiar with it than Katherine Kerr's books have done for my knowledge of Welsh; my anime habit has done for Japanese; or a few years of lessons at high-school did for Indonesian.

After a little bit of searching, I found the 'French for Beginners' podcast from the French Ecole. I'll post a review after I've listened to a few episodes.

Tags:

13 Aug 2006

Internet cookbooks for the win!

Rather than buy a few cookbooks, or a guide to leather-work or knitting, I usually hit the 'Net. For some reason, though, I often have difficulty finding recipes for really basic things. All too often, All Recipes won't have a simple no-frills recipe or, more often, will have dozens and dozens of variations.

This is where sites like the Wikibooks Cookbook and Cooking for Engineers can come in handy. Concise, clearly written instructions based on personal experience (although wikibooks, like all things wiki, can be a mess of contradictory information) with all the constraints so implied — they are simple, realistic and provide few, if any, endless variations on a particular theme.

Tags:

11 Aug 2006

Working with wool

This is the first of what will be a series of posts over the next few days. Each of them will cover a topic from my work at uni that I found interesting. This post, as the title may have hinted, will be about my work with wool in Curriculum and Method Studies: Technology Education 1B.

We started the semester with felting — take some wool fibre, apply warm soapy water, rub vigourously and hey presto! It's felt! All I've got so far is a beanie that I don't feel too bad about done and a number of bits and pieces of felt in a few colours that I don't have any plans for as yet. As our felt work is to be handed up at the end of next week, I've been thinking about what else I want to submit.

The goal of the assignment is to develop our skills through making a example pieces we can use as a teaching resource when we're out in schools teaching felting. As such, our submission is supposed to demonstrate a range of techniques. My beanie shows the use of a template (a piece of plastic slipped into the middle gives the beanie its basic shape and size) and felting several pieces together to get a pattern.

I'm planning on using another technique whereby the wool is bonded to a light fabric ("you need to be able to blow through it" according to the lecturer) during the felting process. This can result in interesting textures, colour effects, etc., especially if you use something like a lace or fishnet material. I can't see this being anything more than a sample, though one of the other students has made some rather interesting gloves using this technique.

If I can figure out how to roll them properly, I'll make a felt ball or two for fun — and because my few attempts today failed — and I imagine I'll wind up making some baby's booties out of the pieces I have on hand following the pattern we were given in class.

My last piece, if I can get it finished, will use knitted and embroidered wool in an attempt to add a design to a felt product in a more satisfactory way than by felting two pieces, then trimming them to shape and felting them together. I plan on knitting panels in my base colour and then embroidering them with other colours before felting the whole lot. If I can manage to knit enough, I'm also going to try to make a genuinely nice pair of baby's booties, rather than some made out of odds and ends, with little pom-poms and everything (I was just reminded of the technique for making pom-poms — the Patons web site is a great source of information on knitting and the like).

When everything is finished, I'll post a few pictures.

Tags:

11 Aug 2006

Megatokyo volume four

My copy of Megatokyo volume 4 (buy) finally came in and I bought it yesterday. It's good to see another Megatokyo book out and it's fantastic that it took so long to come in (having sold out, etc.).

The presentation is essentially the same as the first three volumes by Dark Horse. The only shortcoming I can see in the book is the binding — for some reason CMX couldn't manage to glue the pages level. It's no worse than the last book from Dark Horse and it is a fairly minor flaw, but it would have been nice if they'd put that little bit extra into the book's construction.

Tags:

11 Aug 2006

A paucity of posts

I've been neglecting this blog quite badly. I had intended to post semi-regularly about my studies toward a Bachelor of Teaching but I've dropped the ball fairly thoroughly. As an attempt at redressing the balance, I'll post several entries over the next few days.

04 Aug 2006

Long time no blog

It's been quite a while since last I posted (here, or anywhere else), so I think it's about time for an update. Things are going adequately on the school front -- it was a little touch and go, but I managed not to fail anything last semester -- and I'm about to start a support job with a research project which will bring a welcome injection of funds (which have been rather tight lately).

On the "reading" front, I purchased my copy of Advanced Topics in Types and Programming Languages (companion and somewhat successor to TAPL) this morning. I've had a bit of a flick through it and it looks really, really interesting. Hopefully having spent almost $200 on the two books will provide an added incentive to not only start, but finish, reading them and hopefully even work through the problems.

I've been thinking about typography and book design lately which has suggested, amongst other things, that I see if it'd be possible to get my copy of ATTAPL rebound with some extra pages. It would be nice, for example, to insert the extended version of chapter 10 - the essence of ML type inference and to "fix" any errata with updated pages. I imagine, though I haven't bothered to investigate at all, that this'd be quite a difficult and expensive thing to do for a single copy, so it'll probably be a long while before I do it, if ever.

Before that though, I've been focussed on getting through Logic by Greg Restall. I'm almost half way through and while I'd have preferred a slightly difference syntax (I prefer &and; as conjunction, rather than &amp;), it's easy to read and is much more accessible than most other books I've seen with titles like "Logic".

11 Jul 2006

Maria-sama ga Miteru

I just got caught up on my reading of the Maria-sama ga Miteru translated by Lililicious. Revisiting marimite brings back my wish that the books (other than the first) were available in English.

30 Jun 2006

Resources for Teaching Pythagoras' Theorem

I've decided to make the lesson plans, materials and such I write freely available under an Attribution, NonCommerical, ShareAlike license from Creative Commons.

The first lot of material I'm making available are the lesson plans for teaching Pythagoras' Theorem that I developed last semester (and wrote about using). If you're interested in teaching, mathematics, or teaching mathematics why not have a look at my free lesson plans.

28 Jun 2006

Mizuiro Jidai

I've just finished watching the first episode of Mizuiro Jidai. If the first episode and the AnimeNFO entry are anything to go by, it seems like one of those slice of life/high-school school/drama/romance shows. It was OK (for something drawn in 1996), but I'm not sure I'm willing to download the next 46 episodes (forty-seven!).

Animesuki | BT Tracker

27 Jun 2006

Interactive and Media Programming

As I've mentioned a few times, I'm hoping to work on some materials for computer science education this semester. The gist of my current plans is a core of basic computer science material (very basic data structures and algorithms) backed up by a range of individual and small group projects. I hope to provide a wide enough range of projects to ensure that most students will find something engaging enough that they learn (even in spite of their wanting only to use the Internet).

I'm currently anticipate designing projects using some, if not all, of the following pieces of software:

Haskore
A computer music system based on Haskell.
Pan (or Pan# or one of the several variations on the theme)
A functional graphical processing language similar to Haskell.
Pivotal
A document centred presentation of Haskell.
FunWorlds
An interactive 3D animation package in, you guessed it, Haskell.
You may have noticed a trend in the projects above: they all use, or are closely related to, the Haskell programming language. This is for a number of reasons:
  1. I like functional programming, in general, and Haskell, in particular.
  2. I don't like the languages usually taught to students (Java, VisualBasic, etc.)
  3. I think that a different, more fundamental, approach might help (supported, I think, by the experiences of teachers using SICP in high schools in the U.S.).
We'll see how things pan out. If possible, I'd like to integrate some of the above packages into a single whole. Haskore and one of the portable Haskell variants of Pan, for example, might be integrated with Pivotal to give a relatively simple environment for interactive, multi-media Haskell programming. Haskore, in particular, could benefit extraordinarily from such an integration: the student be able to "code", visualise and listen to their musical compositions from the same program.

Tags:

27 Jun 2006

Inclusive Education

I'm currently sitting in a lecture about inclusion and inclusive schooling. We're discussing a case-study about a primary school class and approaches that we might take to differentiating our curriculum and practice for students with disabilities. In particular we're considering a hypothetical student with Down Syndrome in a grade 5/6 class. We've had some interesting points raised including the inherent inclusivity of the Essential Learnings and the possible effects of differentiating the curriculum (will we be, in effect, "dumbing down" the curriculum?).

More later.

Tags:

23 Jun 2006

Buffy the Vampire Slayer - Once More, With Feeling

Still on a musical note (sorry), I just bought Once More, With Feeling the cast album of the musical episode of Buffy the Vampire Slayer. It really demonstrates the versatility of the Buffy cast -- most of the tracks would, in my opinion, be releasable as commercial music. They sing really well for a bunch of actors and Josh Whedon did a really good job on the songs. If you're at all fond of Buffy the Vampire Slayer I recommend you get it.

Tags:

19 Jun 2006

LaTeX output for HsColour

On a somewhat related subject to my last post (the one about LaTeX), I've just started working on adding LaTeX support to hscolour. The structure of the program has made it easy to add support for LaTeX output: all I had to do is add two items to a pattern match (for option handling), and define a function to render the code to LaTeX (plus a few helpers to escape LaTeX special characters, etc.).

Once I've managed to get it working adequately, I'll submit a darcs patch to the maintainer.

See also Malcolm's posts about hscolour: one and two.

Tags:

14 Jun 2006

Classical-y Music

I've been looking around on iTunes Music Store today and managed to spend more than $20, mainly on classical-y songs.

I started off looking for a good recording of Joseph and the Amazing Technicolour Dreamcoat, my favourite Andrew Loyd Webber musical. A few track from the musical, and another also by Linzi Hateley (who sings the part of the narrator in the London Palladium cast), I moved on to that other staple of the musical genre (or, at least, my taste in musicals): Gilbert & Sullivan. After a few track from a number of renditions of The Pirates of Penzance (The Mastersingers track The Pirates of Penzance is particularly good, I'll have to look at more of their music), I moved on to classical music proper.

I only wound up buying a couple of tracks from the album Enchantment by Charlotte Church (of whom I'll have to buy more) and Ode II Joy (From Symphony No. 9) by OperaBabes (whom I'm also going to have to get more of).

For some reason, I've also been interested in Russian music lately — probably as an outgrowth of the interest in choral works — so I also bought Kalinka from the Alexandrov Red Army Choir.

If anyone has any suggestions of good music in similar vein to the above mentioned track and artists, please leave a comment so that I can chase them up!

Tags: Opera Classical Music Musicals

12 Jun 2006

Suzuka

I've been watching fansubs of the anime series Suzuka lately. Suzuka is about a boy (Yamato Akitsuki), a girl (Suzuka Asahina), their friends and the track and field team of an athletics oriented high school in Tokyo. It's been a while, but Suzuka reminds me a little of Kimi ga Nozomu Eien (another sport-related dramatic romance).

Hopefully, I'll get around to downloading and watching the rest of the series (I've watched 12 of 26) soon.

You can find more information about Suzuka at Animesuki or A.N.N..

04 Jun 2006

David and Leigh Eddings

I've just begun rereading that masterpiece of epic fantasy, David and Leigh Eddings' series: The Belgariad. I was given The Pawn of Prophecy as a gift one birthday and it became my "gateway drug" to the realm of fantasy. I've since read it so many times that it has quite literally fallen to pieces (annoyingly as that cover is no longer in print). Even after these ten or so years and probably near three or four times that many readings, it is still able to capture me more completely than nearly any other book I've read.

If you haven't read the Eddings' work yet, you don't know what you're missing. Get thee to a bookshop and grab The Pawn of Prophecy or The Diamond Throne (book one in the Eddings' other great pair of series: The Elenium and The Tamuli).

Tags:

28 May 2006

Wanted: LaTeX packages

I've got a hankering to dig out my incomplete thesis and polish it off as an excuse to really get up to speed with LaTeX. As such, I'm looking for LaTeX packages that accomplish a number of tasks:

Unicode and symbols
The main thing I'm after is a package that will allow me to '∧' instead of '\wedge' in my LaTeX source and have it Just Work(TM). A single package that provides consistent symbol handling would be nice too.
Metadata support
While hyperref can be used to add PDF metadata, and xmpincl can include an RDF license when using pdftex, you still need to do it all yourself. It'd be nice if there was a module that would do it for you.
Font handling
A single, consistent way to handle real fonts. I like Computer Modern as much as the next person, but once in a while I'd like to be able to use another font without having to wrestle with TeX.
I'll admit that most of my desire for packages to address these issues is probably an issue more of my knowledge of existing code than that code's availability, but it'd be nice if there was a little more consistency in my LaTeX environment and a lot more consistency in Google's LaTeX search results.

Tags:

28 May 2006

Any Dream Will Do...

Just finished watching Joseph and the Amazing Technicolor Dreamcoat. Mum has had a tape of the soundtrack for many, many years and often played it in the car. As a result I was able (read: compelled) to sing along to each and every song.

Tags:

28 May 2006

An Interesting Find

One of my house-mates made an interesting find yesterday: a 36 inch folding ruler. After a bit of cleaning up (it was caked with grease and grime) it's presented as being even more curious.

It is constructed of four wooden segments of equal length joined with what I assume to be brass pins and hinges. Both sides bear scales. The inside face has a single scale on the lower edge with inches and sixteenths marked. The outside face bears an inch scale marked on both edges and three different sub-inch scales: the bottom edge is marked in inches and eighths, the first seventeen inches of the top edge are marked inches and twelfths, the last seventeen inches of the top edge are marked in inches and tenths, and the middle two inches of the top edge are unmarked as the hinge makes them unusable as a line or measure.

The ruler has a number of markings in addition to the scales marked: each of the sub inch scales are labelled with the appropriate number, and each face bears a "3FT" before the brass end cap. The outside face bears what may be some manufacturers marks between the thirteen and sixteen inch marks. While they are too faint to make out with any degree of certainty, the first appears to be a rectangular border containing an entirely illegible first line and a second line: "LUCAS". The second might be "made in England" but is even fainter than the first and only "and" may be made out reliably. The third mark is quite easily made out and reads "354".

I had a bit of a poke around on eBay and did a bit of Googling, but haven't been able to find out much. Any information would be appreciated.

Tags:

27 May 2006

Transactional memory with data invariants

A few thoughts about a Transactional memory with data invariants by Tim Harris and SPJ.

26 May 2006

Fundamental Constructs in Mathematics Education

Fundamental Constructs in Mathematics Education. John Mason and Sue Johnston-Wilder (Eds.). (buy)

After an introduction to the beingness of the thinghood of constructs (named, described phenomena as far as I can tell), this book launches straight into extracts describing some of the most important and influential experiments in mathematics education. I've read the first chapter which describes a number of experiments that have been used to investigate the way children learn mathematical concepts. So far it has been a good deal more readable than I was expecting.

Tags:

19 May 2006

Eurovision 2006

I've just watched the semi-finals of the Eurovision Song Contest for 2006 on SBS. The only comment that springs to mind is that it is a travesty that Poland's entry Ich Troje didn't get a place in the finals.

Tags: Music Listening Eurovision

11 May 2006

Categories and Tags

As on my other blog, I've added support for tags and categories to TR[W[WL]]OACSS using Del.icio.us. Readers with a browser that supports JavaScript should see a list of categories at the top of the sidebar.

It's not terribly useful yet (in particular, the tag and category links lead to the whole Del.icio.us tag, not just those items that are posts on this blog), but we'll see how it goes.

Tags:

10 May 2006

The Other Shoe Drops

Today was the third day of Professional Experience One and the other shoe dropped. Continuing with the material I've planned, the first class ripped along, even those who were absent yesterday and needed to catchup.

The second class was another matter entirely. A number of them managed to finish everything and I was really happy with three or four of them in that we've managed to resolve their initial confusions and get them to the point where they are completing problems quicker than 90% of the class. Other students in this class managed to avoid completing much at all, even when I was stood next to them trying to find out if they needed assistance or were just being lazy. Some of this is to be expected (they were distracted by an event being held after my class), but I'm not sure how I'll be able to get through to them if they're like this tomorrow.

Tags:

09 May 2006

Teaching; A Second Reaction

My second day of teaching went quite a bit better than the first. I managed to address quite a few of the points my colleague teacher raised yesterday as well as improving my structure and delivery. Where yesterday the way I presented the examples and instructions wasn't as effective as it should have been introducing a new unit of work (I think that I was still stuck in 'university seminar' mode rather than 'high-school lesson' mode), I think that the main thing lacking today was the polish that will come with experience. One reflection of this is that the comments provided by my colleague teacher amount to one-and-a-bit pages today rather than the three pages of notes on yesterday's lessons.

The most glaring omissions yesterday were:

  1. my lack of action toward learning the students names;
  2. my poor use of the whiteboard to reinforce and record explanations; and
  3. the structure of the lesson.
I started addressing the first two points more adequately today, but I need to pay more attention to the third. One way this came out was in my use of examples. As my colleague teacher pointed out to me, we should use examples and explanations to 'scaffold' the students understanding: we explain a concept; they practice it; we extend the concept; they practice this extension... Today, I explained a concept (deriving the length of one side of a right triangle given the length of the other two sides), and then asked them to do some problems about concept that is not related (or, rather, not related in a way immediately obvious to high-school students). This resulted in a bit of confusion which I needed to resolve by explaining in a lot more detail.

Tomorrow, I'll try to focus on my structure ('scaffolding' is the key word here) and learning the students' names.

Tags:

09 May 2006

Categories and Tags

I've added support for tags to this blog using Del.icio.us. New posts will be tagged with links to the appropriate tag on my Del.icio.us account and readers with Javascript enabled should see a list of categories at the top of the right-hand column.

I'll need to experiment some more before I make up my mind just how useful this'll be.

Update: It looks like Technorati has managed to index the tags on the last two posts.

Tags:

08 May 2006

Teaching; A First Reaction

Today was the first day of my first block of professional experience at a high-school in Tasmania. I'm teaching a unit on Pythagoras' Theorem (which states that the square of the hypotenuse of a right triangle is equal to the sum of the squares of the other two sides usually written: a2+b2=c2) to two classes.

I introduced the topic by drawing a right triangle on the board, labelling its angles A, B, and C in ascending order, then labelling the sides a, b, and c after their opposite angle. C is obviously the right angle, and c is the hypotenuse. I then stated the proposition that: a2+b2=c2; illustrated that proposition by way of drawing a triangle abc with a square of the appropriate size on each side and proposed that we would, as a group, be proving that it is true (that it is a theorem).

I introduced the students to two different dissection proofs of Pythagoras' Theorem:

  1. The first dissects two squares (a+b)2, one into a2, b2 and four triangles 0.5ab; and the other into c2 and four triangles 0.5ab. We can describe the relationship between the areas of the two squares as a2+b2+2ab = c2+2ab. The 2ab on each side cancel each other out (being trivially equal) and we are left with a2+b2=c2. Q.E.D.
  2. The second proof beings with a diagram of the square c2 (drawn using four right triangles arranged within a square (a+b)2). If we draw within the c2 four right triangles arranged to leave a gap in the centre (a square of (b-a)2). These five pieces taken from c2 can be rearranged to form a2+b2. Q.E.D.
These two proofs can be seen at the Digital Mathematics Archive's page of dissection proofs of Pythagoras' Theorem. The first proof can be seen in the second diagram on that page, and the second proof is illustrated (in the same way I explained it) in the sixth diagram. Both classes managed to complete both of these proofs in just over 40 minutes, though I think that the first group may have suffered due to my nervousness.

My colleague teacher (who usually teaches these classes) gave me a lot of feedback on my performance. I managed to miss many, many, many of the little bits and pieces that keep things together:
  1. introducing myself;
  2. beginning with a question (to find out what they already know and get them thinking about the topic);
  3. writing pertinent terms on the board (like "Pythagoras' Theorem" for example);
  4. structuring the lesson into 'direction' and 'doing' blocks effectively; and
  5. three pages of other bits and pieces.
Hopefully, I'll be able to resolve most of them by the end of this two week placement.

Tags:

06 May 2006

Three new philosophy books

I've just bought three new philosophy books: Logic by Greg Restall (buy); Conspicuous Consumption by Thorstein Veblen (buy); and On The Public by Alastair Hannay (buy).

I happened to spot Logic on the shelf and needed to buy it. Hence, now that I've got a bit of money to spare, I have bought it. I expect it will be brilliant.

I've already read one volume from Routledge's Thinking In Action series and, as previously noted, I really liked it. Hopefully On The Public will be just as good.

I've liked some of the other books in Penguin's Great Ideas series, so I hope that Conspicuous Consumption will be just as interesting.

Tags:

05 May 2006

The Fun of Programming

The Fun of Programming edited by Jeremy Gibbons and Oege de Moor. (buy)

My copy of The Fun of Programming came in the other day and I've been looking through it. It has chapters covering a wide range of topics:

  1. functional data-structures, amortised analysis, etc.;
  2. testing and specification with QuickCheck;
  3. programming with folds, unfolds, etc.;
  4. music programming;
  5. representing financial contracts;
  6. graphics programming;
  7. hardware description;
  8. combinators;
  9. arrows; and
  10. phantom types
amongst other topics. This looks to be a fascinating mixture of methods (data-structures, testing, folds, arrows, etc.) and applications (music, graphics, financial contacts, hardware description, logic programming, etc.) if a little thin for its price.

Both the software from the book and details about the symposium from which its content comes are available on the Oxford Computing Laboratory web-site.

Tags:

05 May 2006

The Cloudbuilders

We've just read a sci-fi story called The Cloudbuilders in my ICT curriculum class which, as far as I can tell was written by Colin Kapp in 1968. While a little formulaic (though, being nearly 40 years old, it probably helped to define the formula) it was an interesting read and did result in an interesting discussion of technology education touching on educational approaches, little white lies, paternalism, etc.

You might be able to find more information through Google but there doesn't seem to be a great deal on the first page.

29 Apr 2006

The Gold Falcon

I went into town today and saw that Katherine Kerr's new book The Gold Falcon is out. I'm just over fifty pages in so far, and I've already squee'd twice (something I'm not generally disposed to doing).

Update: One thing that is different about The Gold Falcon compared to Kerr's earlier books is a distinct lack of parts and chapters.

Earlier volumes in the Deverry series had, to the best of my recollection, a normal proportion of chapters for novels of their length and were typically divided into several parts each set in a different era as events required, or invited, the introduction of some historical context. The Gold Falcon, on the other hand, has a few pages to reintroduce the central plot (about which is constructed several hundred years of engrossing stories and characters) and a single part spanning the current era and some 400-odd pages. No chapters, no detours through eras past, nothing.

Finally: Having finished the book, I'm struck by just how much I like Katherine Kerr's writing. I found myself, with every revelation, thinking "I remember him, or her, or that;" I could identify the origins of her characters by their patterns of speech; I could foresee some of the problems the characters encountered but the eventual outcome (of the next few books) is still very far from obvious.

One point that did occur to me is that if I hadn't been reading the Deverry books for years I might think that certain aspects were somehow inspired by recent events. The desire of the main martyrdom expressed by Alshandra's worshippers and the problem of dealing with them is reminiscent of fundamentalist Moslem suicide bombers and the problems (or, more accurately, failures) that Western countries have had in responding to them.

All up, this is another awesome book in the Deverry series. It takes a bit of a departure from the previous books in its structure, but the end of the saga is in sight.

Tags:

28 Apr 2006

Teachers, students & the law

I've just finished reading Teachers, students & the law by Andrew Hopkins (published by the Victoria Law Foundation). It covers a number of legal issues important to teachers and school staff including the duty of care, mandatory reporting of abuse and rights and responsibilities.

The thing that really surprised me in reading this book is that corporal punishment may be permitted in schools in the Northern Territory and non-government schools in Queensland, Victoria and Western Australia. I wonder when these states will catch up with the rest and abolish corporal punishment in schools altogether...

Tags:

28 Apr 2006

A Final Post On 'On Education'

I've just finished reading On Education by Harry Brighouse. It is, without exception, the most accessible, well written and well presented philosophical work I have read. This should be essential reading for everyone involved in education; teachers, administrators, policy makers and the community at large.

The next time I have $30 to spare, I'm going to get On the Public (buy), another volume in Routledge's Thinking in Action series.

Tags:

26 Apr 2006

Cad, Arrogant Cad

Watched Moonraker again last night. Was surprised at how repulsive I found Mr. Bond. Perhaps shouldn't have been. I much prefer Pierce Brosnan's Bond; if nothing else he doesn't come over as such an arrogant cad.

Tags:

24 Apr 2006

The Relativity of CSS Units

The Surfin' Safari Blog has three posts on making the CSS pixel a relative unit (and the fact that, to an extent, it already is). Anyone interested in graphics, display technologies, the web or related topics should read them: I, II, and III.

Tags:

20 Apr 2006

The Teaching of Programming

Having decided that computer science isn't really my thing (I prefer it as a hobby, rather than a career), I'm now training to be a teacher and, as such, spend a certain amount of time thinking about ways to present material. One of the topics that is of no small interest to me is the teaching of programming, as distinct from teaching programming languages.

I spent some of the 2.5 hour bus trip back from classes in Hobart today thinking about ways to present monads. As a result, I've decided to write my very own version of that mainstay of the Haskell community — Yet Another Monads Tutorial. The goals of this project are twofold:

  1. to try to solidify my understanding of monads, their uses and theory; and
  2. to present programming in a way that very few or, more likely, no students will experience before advanced undergraduate CS classes.
My current thinking is to introduce functional programming in terms of expression reduction (using Hugs or, maybe, GHCi). This will segue into a discussion of evaluation semantics (specifically, lazy evaluation) which will raise the problem of sequenced computations. Monads (as we already know) provide a solution to this problem which will be demonstrated with some work in the IO monad. To really understand how Monads work in Haskell, we'll have to take a brief detour through type classes before we look at defining our own instances of Monad.

The main example (and the only one that I've thought most about) will be a Monad that allows us to compose transformation matrices for 3D work in monadic style. In this Monad, we'll be able to create a transformation matrix by doing something like: myTransform = do
    identityMatrix;
    rotateAbout Z 90;
    scale X 1.5;
    translate Y 20
rather than explicitly creating the matrix for each transformation and multiplying them together or, worse, poking at the individual members of the transformation matrix. Furthermore, this example lends itself quite well to extension. Instead of calculating a matrix which performs the appropriate transformations, we might instead create an data-structure encoding the calculation which will, when evaluated, yield such a matrix. This data-structure could then be evaluated (like, if I understand correctly runST does for the ST monad) or it could be subjected to symbolic manipulation (perhaps allowing the students to implement a simple optimiser).

This will probably turn into my major project for next semester (developing plans and materials for an entire unit). If it does, I'll probably make it available online somewhere.

Tags:

20 Apr 2006

Integrating support for undo with exception handling

Integrating support for undo with exception handling by Avraham Shinnar; David Tarditi; Mark Plesko and Bjarne Steensgaard.

This paper appears to have as its object a solution to similar problems as those addressed by software transactional memory; i.e: maintaining memory consistency. Where STM provides transactions that can be used to implement multithreaded programmes much more simply that traditional explicit locking approaches, this paper uses a similar mechanism to handle unexpected failures (uncaught exceptions) and roll-back the effects of the failed code.

he authors describe their implementation of an undo mechanism in Bartok, an experimental optimising C# compiler and CIL runtime. Their system extends C# with a try_all block which acts as a catch-all exception handler. If an exception propagates is raised within a try_all block and is not handled before it reaches the scope of the block, then the roll-back mechanism is engaged.

The main difference between Haskell's STM is the goal: where STM is concerned with maintaining memory consistency in the face of concurrently executing threads, this system is concerned with simplifying error handling and recovery.

Google | CiteULike | Del.icio.us | LtU

Tags:

14 Apr 2006

More on "On Education"

An already noted, I recently purchased Harry Brighouse's new book On Education and I've just now finished reading the first two chapters. These present arguments supporting the propositions that:

  1. we ought to education students to be autonomous (i.e: capable of deciding upon a way of life that suits them; able to follow such a way of life; etc.); and
  2. we ought to educate students so that they are able to engage with the economy, and not to fulfill certain economic needs.
The ease with which I have been able to engage with the material covered in spite of my rather limited knowledge of philosophy (of education, or otherwise) is testament to the clarity of Brighouse's presentation. If the other books in the series are as interesting (and the certainly appear to be), I'll have to look into getting some of them.

Amazon | CiteULike | ISBN.nu

Tags:

14 Apr 2006

Going Away; or Catching Up

I'm going away for a few days tomorrow (or, having looked at the clock, today) and do not plan on checking my e-mail, my news feeds, or in anyway interacting online. Hopefully, this'll give me a chance to catch up on some reading and get to some of the half-dozen papers I've been wanting to read and post here.

More in a four or five of days.

13 Apr 2006

Appleseed

I bought Madman Entertainment's special edition DVD of Appleseed today and I've just finished watching it. The art is absolutely beautiful — equalling, if not surpassing, Ghost in the Shell: Stand Alone Complex which is the current top of my ooooh-pretty-shiny-art list.

One thing that struck me while watching it is that while the mecha and environments were absolutely gorgeous, the characters had a rotoscoped look to them (especially the shadows and hair) which seemed a little strange at first but definitely grew on me.

Another thing that noticed (though it took until I watched the trailers afterwards) was that the scene where Deunan leapt from the top of a building to mount her Landmate bears quite a strong resemblance to the scene in Ghost in the Shell when Major Kusanagi leaps off the top of a tower wearing optical camouflage. I'm not sure if it was homage to GitS, a coincidence, or Masamune Shirow likes that shot enough to have it used in this film too; but I'd prefer to think it the homage.

In short, this is yet another kick-ass film based on Masamune Shirow's work. If you liked the art in GitS:SAC, the philosophy of GitS and MMI, the watch-ability of Dominion Tank Police and want it mixed with more mecha action than you can shake a stick at, you'll love Appleseed.

12 Apr 2006

On Just Education?

Justice and On Education, both by Harry Brighouse.

My first Harry Brighouse book (Justice) left me with a bit of a bad taste in my mouth. While the text is well written, accessible and far from dry; the content is interesting and the design is reasonably attractive, what I have read of it so far (about 60 pages) gives the impression that it has not enjoyed the benefit of a copy editor, or even spell and grammar checked in a word processor. Needless to say, this detracts somewhat from the impression of scholarly rigour.

While Justice was an impulse purchase (motivated by recognition of the name of a blogger I read), my buying On Education was a more deliberate — motivated not only by my enjoyment of Brighouse's writing, but a nascent (or emerging, I'm not sure which) interest in education and its philosophy. From a quick flick through, I get the impression that this book will have much higher production values than Justice did and, hopefully, won't have contain the same evidence of a lack of copy editing.

Along with On Education, I also bought Teachers, students & the law and VectorWorks 10 For Windows & Macintosh, the former because it looked interesting and was cheap, the latter because it was recommended and will come in useful if I wind up teaching technical drawing.

Tags:

11 Apr 2006

Transactional memory with data invariants (DRAFT)

A few thoughts about a draft paper Transactional memory with data invariants.

11 Apr 2006

Threads Cannot Be Implemented As a Library

Threads Cannot Be Implemented As a Library by Hans-J. Boehm. In PLDI'05. (PDF)

I read this paper for a presentation I had to do for Advanced Run Time Systems last year. Using Pthreads as an example, Boehm points out that implementing threads purely as a library can result in a number of errors which are difficult to find and resolve. The paper presents three examples:

  • concurrent modification — where races are introduced by optimisations ignorant of concurrency requirements;
  • rewriting adjacent data — where race conditions are introduced when variables protected by different locks are packed into the same memory location;
  • register promotion — where register promotion optimisations can modify protected variables outside of an atomic region.
As is mentioned in the Lambda the Ultimate discussion (linked below), this paper doesn't describe anything terribly new but it was an interesting read.

ACM | Google | Del.icio.us | CiteULike | LtU

11 Apr 2006

Learning Content Management Systems

.LRN -- a free software educational content management system based on the OpenACS platform. Quite difficult to get installed (a task that I have not yet managed to complete).

Moodle -- an open source educational content management system written in PHP.

Rhaptos -- an open source educational content management system based on Plone (which, in turn, is based on the Zope application server). Uses MathML and supports a number of browser plugins for advanced features.

OCW -- MIT use a system based on Microsoft Content Management Server. (See: 1 and 2).

UCalgary have a learning object repository.

Heriot Watt University, Cranfield University and the University of Birmingham collaborate on EEVL, "the Internet Guide to Engineering, Mathematics and Computing".

Chalkface are publishers of online courses, lesson plans, photocopy masters, etc. for secondary education in a wide range of subjects.

09 Apr 2006

Wondrous oddities: R's function-call semantics

Wondrous oddities: R's function-call semantics

As much as I disliked using R, it does have some very cool features. The post above describes R's function calling semantics which are not only very different (probably unique), but also very well suited to R's domain.

09 Apr 2006

Great Moments in Logic...

Great Moments in Logic... by Greg Restall.

A short survey of 30 important logicians, philosophers and mathematicians and their 'great moments' in logic. Well written and very accessible, anyone interested in philosophy, logic, mathematics or their history will find it worth reading.

Del.icio.us

Tags:

08 Apr 2006

Stark Effect

Stark Effect has a number of MP3 tracks up ranging from We Like Repartee (dictionaraoke -- songs sung by the pronunciation guides from online dictionaries) to Wonderbottle (Christina Aguilera Genie in a Bottle vs. Oasis Wonderwall). Take a look.

Del.icio.us

07 Apr 2006

Magical Lists

A not very recent post (I'm trying to catch up; only 970 messages to go) to the Haskell-cafe mailing list pointed out that jhc treats (:), [] and (,) as normal data constructors. Some might see this as removing some of the magic from lists, but I see it as sharing the magic around. The number of times I've been annoyed that (:) is hard-coded for lists boggles the mind.

05 Apr 2006

Even Spammers Need Subsidising

Even spammers, it would seem, need to subsidise their operations with advertising. In the screen capture above, you can see that this Nigerian scam email has a couple of ads (for Yahoo! messenger) appended to it. This is probably the result of some bit of filth spammer sending their message from Yahoo!'s web-mail service to an e-mail list instead of doing the job properly. It appears as though spammers standards, low though they have always been, are slipping.

04 Apr 2006

Order of Operations

A recent experience reminded me of some posts on Math and Text, a blog on mathematics education. So Long, Aunt Sally! discusses mnemonic devices for the order of operations (and reasons that such are a Bad Thing(TM)) and Order of Operations motivates the standard order of operations in terms of error reduction (performing those operations which will most effect the magnitude of the result first will reduce our error in the event that we've misread a number).

Both of these posts interest me as I think that they both contain within them interesting insights to mathematics as seen by most of us (the non-mathematicians). The standard mathematical notation (that is, infix operators interpreted according to the standard order of operations) has a long history and is very much embedded with our understanding of maths. Unfortunately it is also rather poorly suited to expressing complex sentences: it requires that we interpret sentences with respect to a specific order of operations (exponentiation, multiplication/division, addition/subtraction) and use grouping operators (parentheses, brackets and the like).

This shortcoming is, however, addressed in a class of expression languages called prefix and postfix languages. The difference between an infix language (like the standard mathematical notation), a prefix language and a postfix language is suggested by their names. An infix language situates operators in-between their arguments, a prefix language writes operators before their arguments and a in postfix language the operators follow their arguments.

Where there is an ambiguity in infix languages as to which operators ought to be evaluated first (Left-to-right? Inward? Outward? According to precedence?), sentences of pre- and post-fix languages have only one possible interpretation. In these languages operations are performed in the order that they are written and we can express every sentence without using grouping operators (like brackets).

In an infix language, the sentence "1+23" is ambiguous and can be parsed in two different ways: "(1+2)3" and "1+(23)" (see figure 1). Without a system of operator precedence, there is no way in which we can determine which of these two interpretations is "correct." In a pre- or post-fix language however, these two different interpretations are actually written differently. In postfix form, they can be written as "1 2 + 3 " and "1 2 3 * +" respectively.


Figure 1: Parse trees for the sentence "1+2*3" with main operator being + (left) and * (right).


As they don't need an operator precedence scheme to determine which possible interpretation, these languages are much easier to parse and evaluate. This makes them ideal for use in constrained environment like calculators and printers. It is no surprise then, that many printers use the language Postscript to describe documents to be printed (with operators like draw-line and change colour, in addition to add and multiply) and some calculators use a programming language called RPN (though newer calculators also provide more complete languages).

The algorithm for evaluating an expression is postfix form is:
  1. Read a token;
  2. If it's a value push it onto the stack;
  3. If it is an operator:
    1. Pop the appropriate number of arguments off the stack;
    2. Perform the operation on those arguments; and
    3. Push the result of the operation onto the stack
  4. Repeat until there is no more input and the answer will be the [single] item remaining on the stack.

04 Apr 2006

Films; French and Otherwise

I've watched a couple of good films recently. First, a couple French films distributed in Australia by Madman Films.

The Dinner Game (or Le Diner De Cons) is a wonderful comedy about a yuppy and the man who was to be his guest to an "idiots dinner." This is a fabulous film and everyone, lover of farce or not, should see it.

Tais Toi (Official site). The description on the Madman site is better than anything I could come up with, though it does spoiler the entire plot. Starring Gerard Depardieu and Jean Reno, this is one of the best films I've seen this year.

MirrorMask (IMDB) sees Helena transported from her own life (travelling and performing in her family's circus) into another world. Stephanie Leonidas makes a wonderful heroine and her engagement with the almost entirely artificial world around her is testament to her ability as a actor. While the prevalence of special effects was a little overwhelming and the characters did occasionally seem a little detached from the mostly animated world around them, the art and design was absolutely gorgeous. Graphic artists and anyone who like Neil Gaiman's work would do well to see this film.

02 Apr 2006

Dead Witch Walking and Pure Dead Magic

Dead Witch Walking by Kim Harrison.

Dead Witch Walking is yet another paranormal romance. In a similar vein to the works of Laurell K. Hamilton, Tanya Huff, Charlaine Harris, Kelly Armstrong, Sherrilyn Kenyon and many others, this blends aspects of the thriller; the fantasy; the crime and the romance novel into one compelling whole.

Buy | Amazon



Pure Dead Magic by Debi Gliori.

The first in a trilogy of children's books with magic and the supernatural as a main theme, Pure Dead Magic is 220 pages long. Being a children's book, the writing, plot and characters are a little simple, but it was entertaining none the less. The Strega-Borgia family has about it an aura of the Addams Family, though Titus and Pandora (the 12 and 10 year old, respectively, hero and heroine) aren't as idiosyncratic as Pugsley and Wednesday Addams.

A good book, from a good author, it'll appeal to most kids of an age to find Emily Rodda's Deltora Quest and Rowan of Rin books interesting.

Buy | Amazon

31 Mar 2006

Permission-based ownership: encapsulating state in higher-order typed languages

Permission-based ownership: encapsulating state in higher-order typed languages by Neel Krishnaswami and Jonathan Aldrich. In PLDI'05.

I'm still puzzling through the examples, but it looks pretty cool. The essential idea is to use the type system (an extension of System F with references and ownership called System Fown) to ensure that the internal details of modules cannot be messed with.

They give an illustrative example involving customers in one domain, banking machinery in a second and account details in a third. The customers are allowed to call the banking machinery, and the banking machinery can access the account details, and all other access is invalid. The goal of System Fown is to prove these sorts of properties.

ACM | Google | Del.icio.us | CiteULike

31 Mar 2006

Gold Falcon

I saw a little display in Birchall's today advertising the imminent release of Katherine Kerr's latest book Gold Falcon (excerpt). This is very, very good news — if they're sending posters out to bookshops, then it's all but certain to actually ship!

22 Mar 2006

Google Page Creator

I just got an email telling me that I've got a Google Page Create account.

I've got a demonstration page up at http://thsutton.googlepages.com/home.

21 Mar 2006

Essential Language Support for Generic Programming

Essential Language Support for Generic Programming by Jeremy Siek and Andrew Lumsdaine.

This paper presents an extension of System F called System FG. The motivation for the work is in the construction of generic algorithms and, more importantly, the verification of their use. It looks to me as though the authors have taken a little bit too much of C++ on board.

The concepts of the paper are very similar to Haskell's type classes (according to section two, the main difference is that type classes are designed to allow Hindley-Milner type inference) and the associated types seem to me to be filling a similar role as functional dependancies. I found it rather interesting and it's the first type system paper I've read since I achieved a vague understanding of type systems.

ACM | Google | Del.icio.us | CiteULike | LtU

19 Mar 2006

Jingle Bells: Solving the Santa Claus Problem in Polyphonic C#

Jingle Bells: Solving the Santa Claus Problem in Polyphonic C# by Nick Benton.

This paper presents the solution to the Santa Claus problem in the Polyphonic C# language. Polyphonic C# is an extension of Microsoft's C# language with concurrency primitives based on those of the join calculus. It was intended for use in "orchestrating distributed applications built on asynchronous messaging," but is "equally applicable to programming with multiple threads in a shared-memory environment."

This is, the authors claim, another piece of evidence supporting the claim that the join calculus is an effective basis for concurrent, as well as distributed, programming.

Google | Del.icio.us | CiteULike | LtU

19 Mar 2006

Harry Potter and the Half-Crazed Bureaucracy

Harry Potter and the Half-Crazed Bureaucracy by Benjamin H. Barton.

An interesting paper from the Michigan Law Review. The author interprets the Harry Potter books as presenting a particular view of government (libertarianism) based on J. K. Rowling's rendering of her fictional Ministry of Magic. The structure, corruption and abuses by the Ministry of the populace (and Harry and his friends in particular) are presented, if I recall correctly, as an allegoric parallel of the U.S. and U.K. governments. I'm not sure how much of this aspect of J.K.R.'s work is intentional but, Barton's analysis is certainly compelling (even if I don't agree with the politics of conclusions he reaches).

SSRN | CiteULike | Del.icio.us

19 Mar 2006

An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes

An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes by Craig Chambers, David Ungar, and Elgin Lee. (PS)

I read this paper for a compulsory milestone papers course at the ANU Department of Computer Science. In it, the authors describe the techniques used to implement that the SELF efficiently. SELF was unusual (and still is, in some respects) in that it was a dynamic, prototype-based object-oriented language. The techniques pioneered by the SELF team formed the foundation upon which most modern virtual machines, including the various JIT technologies for Java, are built.

This paper and SELF have been discussed at Lambda the Ultimate on a number of occasions.

DOI | ACM | Google | CiteULike | Citeseer

18 Mar 2006

Recursive functions of symbolic expressions and their computation by machine, Part I

Recursive functions of symbolic expressions and their computation by machine, Part I by John McCarthy.

A milestone paper in computer science, this is one of, if not the, first LISP paper. This contains one of the earliest descriptions of garbage collection, functional programming and several other topics. It doesn't contain anything particularly enthralling for modern readers, but that is due to the fact that everything that is in it has been absorbed into every aspect of modern computer science.

One thing that I found interesting was the syntax given for conditional expressions:
(p1 → e1, …, pn → en) where pi is a propositional expression (one that is either true of false) and ei is an arbitrary expression. The value of a conditional expression is that of the first ei such that pi is true (or is undefined).

This is quite similar to the description of structures in the ρ-calculus given in Matching Power.

ACM | DOI | CiteULike

18 Mar 2006

On the Revival of Dynamic Languages

On the Revival of Dynamic Languages by Nierstrasz O, Bergel A, Denker M, Ducasse S, Gälli M, Wuyts R.

This paper reads a little like propaganda for dynamic languages. The discussion on Lambda the Ultimate (linked below) raises some interesting points and points out some of the inconsistencies in their argument (static languages can't prove everything, so let's use dynamic languages which prove nothing).

That aside, the authors do discuss some interesting language features. First-class namespaces can be used, as they describe, to implement horizontal sub-classing (a compelling use case has been discussed on LtU). Similarly, their desire for pluggable type systems seems a little reminiscent of the approach that the PyPy project has taken with object spaces. On the other hand, I don't really like their suggestion that image-based languages are the way to go (I much prefer to write code in my favourite editor, manage it using my favourite version control system, etc.). All up, it's an interesting read (if only for the descriptions of the various language features the authors like).

DOI | CiteULike | Del.icio.us | LtU

08 Mar 2006

Yet Another Blog

I've just started yet another blog: The Education of an Educator. As the title might suggest, this new blog will focus on the classes, discussions, readings and experiences I have during my training as a teacher. All of the relevant posts I've made here are already posted there, as is some new material, so go and have a look.

Update: the new blog has now been deleted and the content (what there was) migrated back here. Wordpress may be nice, but it failed to save drafts and make posts one too many times, especially when compared with Blogger which has not yet failed me once. The only thing that Blogger lacks over Wordpress is categories, and I could emulate those with Technorati or Del.icio.us if I could be bothered.

08 Mar 2006

Design and Technology

This week's practical session we started working on the first three of the C.A.D. worksheets we're using to learn VectorWorks.

In the lecture, Robyn talked about the format we'll need to use for the essay we're to do later on in the semester (Harvard referencing, etc.). After a recap of last week's material (technology as systems and processes rather than just hardware; the drivers of technological development; the dichotomy between science and technology; the situation of technology within a social context) we watched the first part of 2001: A Space Odyssey (the bit with the apes). I'm still not entirely sure what we're supposed to have gained from that other than an appreciation of just how cultish some cult films are and that tools provide an advantage.

Next Robyn talked a bit about ways to communicate with others. Specifically, she discussed a list of "don'ts"; things like judge, criticise people, diagnose, threaten, divert, question, rationalise, etc. Some of these are fairly self explanatory and other took a little more explanation than the single word she started with. Say that we ought not criticise, question, advise or use logic in a discussion didn't make a great deal of sense until she narrowed them to ad hominem criticism, excessive and provocative questioning, giving unwanted or inappropriate advise and rationalising problems and concerns.

After a discussion about these issues to do with communication, we watched part of another video; this time on Philosophy for Children.

07 Mar 2006

Teacher Identity

This morning's professional studies lecture was about teacher identity. Dr. Cole covered a number of topics beginning with the question: "What is a teacher?" He contrasted the rather anachronistic view of the teacher as authority and disciplinarian whose primary relationship with students is one of power (he drew parallels to similar relationships between Britain and the rest of the Empire) with a stereotype of the "progressive" teacher who is full of enthusiasm, a drive to change the world and is soon run down by the relentless grind. He then described a more realistic view of the teacher as a (small) part of the educational institution: a system whose structure, goals and values are fixed and within which we must work.

Dr. Cole talked about assessment and its role as part of the learning process rather than a separate and distinct thing (undertaken alone in a sterile environment).

He finished by talking about professional development and how we can become more professional:


  • Action research -- reflecting on our own practice and the practice of others, and using this to guide our own development (i.e: acting upon research we do).

  • Expert status -- most educational systems offer some form of "expert status" certification.

  • Student relationships -- we can teach more effectively when we have closer relationships (e.g: empathy) with the students. This can be difficult when we are limited to two periods a week, etc.

  • Team teaching -- we are not alone. Working together with our peers and colleague teachers can help us improve.

  • Work within the school -- we must locate our own values, goals, etc. within those of the institution.



When we do our professional experience, we will be assessed by teachers from our placement school according to certain criteria (he showed the New Beginning Teacher Criteria from 1996, but I think that we'll be assessed according to different criteria), but we may not have opportunity to demonstrate all of them in our first placement.

07 Mar 2006

Professional Studies Tutorial 1

In our first professional studies tutorial, we formed our Professional Learning Teams. The purpose of these teams is to give us a small group (a total of five people) with whom to discuss what happens during our school placements.

My team consists of:

  • T (me) -- secondary IT and Technology and Design;
  • P -- English and SOSE;
  • K1 -- Primary education;
  • C -- Design and Technology (I didn't get C's other specialisation down); and
  • K2 -- SOSE and LOTE.
Next week, we have a two hour tutorial to get acquainted with SUPP and the next five or six weeks we'll be spending every Monday in a school.

07 Mar 2006

Development in an Educational Context

This afternoon (though I'm posting this the day after) we had Dr. Marion Myhill give a lecture on development in an educational context, the first lecture in the developmental strand of professional studies.

Dr. Myhill described the reasons that we, as educators, are interested in development (it allows us to understand students as members of a cohort, gives us a way to understand them according to the ranges of capabilities typical of specific age groups, etc.). Developmentalists look beyond individuals to the generalities, to systematic changes and continuities seen across the cohort. This is particularly interesting to teachers as they deal with students as a group more often than with a specific individual.

We can view the development of children as a series of orderly changes. Individual children will have individual capabilities and characteristics (physiological, psychological, emotional and cognitive), but there will be a range within which most of the cohort are situated. We can also examine the rate at which development progresses. The development of an infant is very much faster than that of a late adolescent.

Where once there was a perception that development took us from undeveloped infants to developed adults, we now recognise that it is a life-long process -- deficiencies in early development can be remediated (as opposed to the view that short-comings in early development become insurmountable obstacles). While we now recognise that development is life-long, our potential for change does reduce over time (e.g: it is easier to learn a second language as a child than as an adult).

M talked about the four aspects of development (physical, social, emotional and cognitive) and that these aspects are interrelated. Developments which affect one aspect will often affect the others in some way.

As said above, while development does occur in stages and their are commonalities across cohorts, the each child's development and capabilities are still individual and it is our goal in education to narrow the gap between the best and brightest and the less able in each area. "While not everyone has the potential to be a Cathy Freeman, almost everyone can run a marathon with training."

07 Mar 2006

Books

On this page I shall provide a partial list of the books required and recommended for my units. Where appropriate I will provide links to the author's, publisher's and book's web site as well as to Amazon.

ESA160 -- Professional Studies 1A

Required:Recommended:

ESA166 -- Information Technology 1A

Required:
  • Guidebook for Developing an Effective Instructional Technology Plan by L. Anderson. PDF 232Kb
  • Tasmanian Certificate of Education Information Technology Documents. Online
  • Introduction to Information and Communication Technology in Education by D. G. Moursund. PDF 952Kb
Recommended:Additional reading:

ESA184 -- Design and Technology

Recommended reading:

06 Mar 2006

Maria-sama ga Miteru Novel English Translation Project

Some of my favourite anime and manga are based on Japanese novels which can be quite frustrating: anime and manga are accessible by dint of fan translation efforts, but translations of novels is pretty rare. That is why Geoff Zichterman's Maria-sama ga Miteru Novel English Translation Project is so awesome: he has managed (with assistance) to translate the entirety of the first volume of KONNO Oyuki's Maria-sama ga Miteru.

This has inspired me to make a somewhat belated new-years resolution: by the end of 2006 I hope to be able to read this book in Japanese.

Del.icio.us

03 Mar 2006

Week One Roundup

With the first week of classes over, it looks as though I'm going to enjoy this degree: Professional Studies looks like it'll be interesting (especially the school experience aspect); Multi-Literacies won't be too bad; Technology will be an opportunity to do things I haven't really though about before (design in wood, etc.); and it's going to be interesting looking at ways to apply information technology to other curriculum areas in IT as well as the details of teaching IT in its own right.

03 Mar 2006

Podcasts

Playing with Del.icio.us in the sidebar made me realise that I really ought to list the podcasts that I subscribe to. Here then is a list of my listening habits:

  • All in the Mind from ABC Radio National
    Delving into all things mental: the latest research and expert commentary on our brains and behaviour.
  • Books and Writing from ABC Radio National
    Books and Writing is the foremost national literary program broadcast throughout Australia. It features in-depth discussions focusing on books, ideas and writing.
  • By Design from ABC Radio National
    Alan Saunders looks at how we shape our world, from the ground up.
  • Craphound.com: The Literary Works of Cory Doctorow by Cory Doctorow
    Short-stories in progress by an award-winning science fiction writer, read aloud in small regular chunks.
  • The Nature Podcast
    The Nature Podcast provides insight and context to groundbreaking research, and allows the scientists to explain the significance of their work in their own words.
  • Ockham's Razor from ABC Radio National
    Thoughtful people have their say, without interruption, on important science-related topics.
  • The Science Show from ABC Radio National
    RN's science flagship: your essential source of what's making news in the complex world of scientific research, scandal and discovery.
  • Sunday Night Safran from Triple J
    John Safran and his guests (including regular Father Bob) talk an amusing mix of religion and politics. We've taken the program, and edited the music out to a 60-70min program.
  • Raw Comedy from Triple J
    We bring you selected highlights from the Raw Comedy Festival heats and finals from around the country. These range in length (and quality) but are usually no longer than ten minutes.

01 Mar 2006

Designing Effective Step-By-Step Assembly Instructions

Designing Effective Step-By-Step Assembly Instructions by Agrawala M, Phan D, Heiser J, Haymaker J, Klingner J, Hanrahan P, Tversky B. In ACM Transactions on Graphics, 2003.

My first CAD class today reminded me of this paper; I can't remember how I came across it, but it was quite interesting. It's in my stack to re-read and I'll post more about it when it pops off the top.

DOI | ACM | Google | Del.icio.us | CiteULike

28 Feb 2006

Technology Education

ESA184 - Technology Education (Single)

In the next few days (i.e: before Thursday), I need to decide on a technology module to do this semester. The co-ordinator told us this morning that there are six choices:

  • principals of design;
  • design in wood; and
  • food technology
run concurrently in the morning, and
  • textiles;
  • hard materials design; and
  • computer aided design;
run concurrently in the afternoon class.

I'll probably do C.A.D. (what with my other specialisation being ICT and all).

28 Feb 2006

Professional Studies Lecture 1

ESA160 - Professional Studies 1A.

The course has undergone a lot of change since last year, most of which regards the proportion of lectures and tutorials: this year’s course features more tutorial time and the tutorials have a more central role; they are practising what they preach in that they are going to be teaching us in the same way that want us to teach.

During the first 45 minutes, there was a little bit of touchy, feely stuff (the degree is not just a journey into teaching, it’s also a journey into knowing ourselves, etc., etc.), but on the whole it was a very interesting first hour.

In a few weeks, we will be starting our professional experience with the School University Partnership Programme (or SUPP), during which we each spend every Monday in a classroom observing specific facets of education in a real learning environment. The goal of SUPP is to give us some experience in the practice of education to help ground our understanding of the theory that we’ll be learning during lectures. While we don’t have any choice which school we wind up visiting, I am quite looking forward to it.

The lectures during the rest of the semester will focus on four themes:

  • Professional Perspectives: Teacher Identity;
  • Development in an Educational Context;
  • Schools and Schooling; and
  • Curriculum and Pedagogy.
There are three required texts for the course, though one of them can be left until next semester: How to Make a Classroom Management Plan(buy) by Robert Cope, Educational Psychology for Learning and Teaching(buy) by Kerri-Lee Krause, Sandra Bochner and Sue Duchesne and Case Studies in Teaching and Learning: Australian Perspectives(buy) by Nola Purdie and David Smith.

According to the lecturer (whose voice reminded me of the woman from a popular show about current affairs on NPR), these same books will be used for professional studies during all four semester of the degree, so they'll be a good investment (especially compared to some of the $90+ books I bought for by Bachelor of Computing and didn't even open). She described Cope as a very good book (published last year); Krause as comprehensive, up to date and used throughout the degree; and said that we won't really need Purdie until next semester.

The recommended texts are The Teaching for Understanding Guide by Tina Blythe (the theory upon which the Essential Learnings Framework of the Tasmanian Department of Education is based), Effective Teaching Strategies: Lessons from research and practice by R. Killen (good; basic teaching strategy; practice in theoretical context) and Disability in Australia: Exposing a social apartheid by Gerard Goggin and Christopher Newell (about special needs education in an Australian context).

20% of our final grade will come from our attendance and participation in tutorial and the remainder will be based on the documents we produce as a result of our observations during SUPP.



After about 45 minutes on administrivia, the lecturer moved on to looking at the topic of question and questioning. She began by presenting some dialogue typical of a teacher and students. The teacher used questions to provoke the students into thinking and to lead them to understanding of the topic by drawing an analogy between an orchestra (which needs a conductor to keep the players co-ordinated) and the hormonal system (which also requires co-ordination).

She presented five purposes for which questions are asked:
  1. for review or revision;
  2. to make connections;
  3. for teacher feedback;
  4. to encourage students to ask questions (modelling); and
  5. to cause students to use a variety of thinking processes.
She then questioned reason four: how often do students ask non-procedural questions (that is, questions other than "What page are we on?" and the like) of their teacher? She finished by examining the term question in more detail (the online OED's entry for the word "question" is 9 pages long, apparently).

It looks, so far, that this is going to be a really interesting unit.

28 Feb 2006

Multi-Literacies 1

ESA196 - Multiliteracies 1A

After professional studies we had our first multi-literacies ICT class, in which the lecturer introduced all the ICT skills they'll be making sure we have. Word processing, spread sheets, presentations, multi-media, the Internet (and, more importantly, finding anything useful on it), etc. We'll also be covering the various bits of ICT stuff we'll need to know to be able to do the course (like using Vista).

He also made sure to cover the various rules we need to follow (don't look at porn at school; don't copy CDs at school; computer use is monitored; etc.) and be aware of. The thing that really, REALLY pisses me off is that the contagion that is plagiarism detection software, namely Turn It In, seems to have infected Education. The sole objection I have to using the software is that Turnitin keep a copy of all the work submitted in their database to check future submissions against: they are using my work as part of the service for which they charge lots of money.

We ended with a lot of confusion as to when and where our classes for the next few weeks are (the Bachelor of Teaching timetable is both complex and fluid as it has to work around the student's practicals and other staff commitments).

28 Feb 2006

A Change in Focus

Today I took the first step on a new path, that of teaching, with orientation day for the Bachelor of Teaching. This semester I will be taking:

The next few posts will concern my first impressions.

26 Feb 2006

Putting Curry-Howard to Work

Putting Curry-Howard to Work by Tim Sheard.

This paper describes some type system feature suggested by the Curry-Howard isomorphism (which states that types are propositions and that programs are their proofs). The language Ωmega is a descendant of Haskell in which the author has implemented all of the features described in the paper.

I still haven't finished reading it, but it's at the top of my pile.

DOI | Del.icio.us | CiteULike | LtU

26 Feb 2006

Posting Splurge

This is the last in a posting splurge I've had this afternoon: six paper posts have been added and one has been updated. I intend this to be the first in a series of weekly or biweekly session in which I post the papers I've been reading. Perhaps now that I'm studying education rather than computer science, I'll be able to get some more reading done.

Suggestions of papers to read are most welcome and can be sent by email.

26 Feb 2006

Matching Power by Cirstea H, Kirchner C and Liquori L.

Matching Power by Cirstea H, Kirchner C and Liquori L.

This is the first paper I've read about rewriting calculi and, if nothing else, it's made me want to read more. In it, the authors provide an introduction to pattern matching, introduce the syntax and semantics of the ρ-calculus, and present a number of compelling examples of its power. Section four is the most interesting part of the paper (the rest being primarily and introduction to the calculus): in it the authors present encodings of the Lambda Calculus of Objects (Fisher, Honsell, and Mitchell) and the Object Calculus (Abadi and Cardelli) into the ρ-calculus.

ACM | Google | CiteULike | Del.icio.us | LtU

26 Feb 2006

Interpreting the Data: Parallel Analysis with Sawzall (Draft)

Interpreting the Data: Parallel Analysis with Sawzall (Draft)

While MapReduce and GFS allow Google to use their massive computer clusters effectively, the use of C++ can make programming for such a systems more difficult than it needs to be. Cue Sawzall, a new language that Google use to write distributed, parallel data-processing programs for use on their clusters. While the language isn't particularly attractive (I've never liked C-style syntax's), the approach is very interesting and the implementation issues they describe are enlightening.

LtU | CiteULike | Del.icio.us

26 Feb 2006

Finger Trees: A Simple General-purpose Data Structure

Finger Trees: A Simple General-purpose Data Structure by Ralf Hinze and Ross Paterson.

This paper presents 2-3 finger trees, a purely functional representation of persistent sequences. The ends of each sequence can be accessed in amortised constant time and they can be concatenated and split in logarithmic time. Best of all, the paper develops them in Haskell.

I've started working through the code myself, but have not yet managed to get it finished.

DOI | LtU | CiteULike | Del.icio.us

24 Jan 2006

What To Do?

So I'm back in Tasmania (at Mum's place) and I'm looking for something to do. At the moment, the plan is to do a teaching degree (at UTas), but we'll see how that goes.

03 Dec 2005

Lock-Free Data Structures using STMs in Haskell

Lock-Free Data Structures using STMs in Haskell. Anthony Discolo, Tim Harris, Simon Marlow, Simon Peyton Jones, and Satnam Singh. Submitted to FLOPS'06.

An interesting paper demonstrating the use of STM (and it's superiority over explicit locking) in Haskell. The authors present two Haskell implementations of the ArrayBlockingQueue class from Java: one using STM and the other explicit locking. Not only did the version using STM outperformed the explicit locking version consistently in the multi-CPU benchmarks, but the STM code is much simpler.

Previously: 1 2
LtU | Del.icio.us

29 Nov 2005

Stupid, Noisy Pricks

Why are Internet/games places always full of noisy pricks? I'm sitting here waiting for my email to download, DarwinPorts to update, some torrents to download and I don't think it's too much to ask that I not have to listen to two intellectually challenged individuals not scream at each other (in spite of the fact that they are sitting right next to each other).

I hate gamers.

04 Nov 2005

Writing and Ownership

My thesis was due last Friday (delayed to last Monady) and I have an extension (or, rather, an I-don't-have-it-done) until today. Unfortunately, it doesn't look like I'll have it done by my deadline today either. For some reason, I just haven't wanted, or been able to, write.

I think that this is due, in part, to the fact that this is my own project (rather than the one I originally started on) which I'd been thinking about for a while before I started my Honours year. As such, I don't feel any sort of obligation to work on it for any purposes other than my own gratification. While this is a good thing by some measures (it's a project that I am interested in, etc., etc.) it is very, very, bad by others (like that fact that I don't feel any particular drive to write about it).

All I know is that I'm well and truly sick of University and computer science. If Honours is a taste of research and a hint of what a Ph.D. is like, then I want nothing to do with either. This used to be fun...

03 Nov 2005

Wanted: A feed module for iPhoto

While iTunes does a decent job of managing MP3 enclosures in news feeds (pod-casts), iPhoto could really do with similar functionality. I have my iBook randomly choose images from an album in my iPhoto library and it would be fantastic if I could get iPhoto to automatically download pictures from some of the fantastic sources on the 'net. Sites like Botany Photo of the Day provide some amazing images.

I'll see if I can figure out how to do this over the summer as my first piece of mac software.


I had a quick go at knocking this up with Automator, but it didn't work very well as I can't seem to get Safari to extract the image URLs from an XML feed and most interesting sites have a bunch of junk images as well (Flickr, for example, has heaps and heaps of blank GIFs for spacing).

02 Nov 2005

Books To Read

I've decided that I'm going to try to read everything nominated for the Booker Prize. The short list shouldn't be too much trouble (most of the books on it look interesting enough) but I imagine that there'll be a few boring books in the long list. We'll see how I go.

26 Oct 2005

New Books

Numbers, Groups and Codes (2nd ed.) by J. F. Humphreys (University of Liverpool) and M. Y. Prest (University of Manchester)
A Gentle Introduction to Category Theory - the calculational approach by Maarten M Fokkinga
Latin: First Year by Robert J. Henle
Latin Grammar by Robert J. Henle

I seem to be racking up more and more mathematical reading material. I just bought a copy of Numbers, Groups and Codes from the Co-op Bookshop and have found the first few sections surprisingly readable. I hope that the rest of the book is as good as what I've read so far.

Another mathematical work near the top of my "to read" pile is A Gentle Introduction to Category Theory (and, at some point, his Ph.D. thesis - Law and Order in Algorithmics).

I also picked up (also from the Co-op) Latin: First Year and Latin Grammar. Along with Types and Programming Languages, Concepts, Techniques and Models of Computer Programming, Practicle Common Lisp and the assorted other and papers (especially the various Haskell papers I want to read), I've got more than enough to keep me studying for most of next year).

26 Oct 2005

Music

I recently found a CD full of MP3's that a friend gave me whilst I was in England a few years ago. On it I found a bunch of songs by groups I hadn't thought about in a while. With the new songs stuck in my head, I ran out and bought the Lost Prophets' The Fake Sound of Progress and Start Something, both of which kick ass.

Next on the "to be acquired" list is Alien Ant Farm's Anthology album.


Update: Apparently not as Ill Nĩno have a new album. I'll have to get Anthology later (when I can find it in a record shop, as there hasn't been a copy in any of the places I've looked).

26 Oct 2005

Manga

I've recently (i.e. since my last post on manga) purchased a whole bunch of new manga books. Today I got The One I Love by CLAMP (Tokyopop's translation of わたし の すきなひと), which is a great little book.

I've also got a whole bunch of Viz Media books including Koko wa Greenwood (or Here is Greenwood in English), Maison Ikkoku books 1-5 (with 6-10 on order) and Hanazakari no Kimitachi e (Viz, and everyone else, call it Hana-Kimi).

I've bought so many books whilst here in Canberra that I'm going to have to get them shipped when I leave (as opposed to taking them as checked luggage on my flight home).

It seems that Western comics in the manga style are becoming popular. So much so that Tokyopop are publishing an Australian artist's book! I can't wait to see if The Dreaming is as good as it looks.

PS: The Japanese input mode on Emacs (which I used to type the hiragana above) is shit-hot. Much easier than trying to use the Japanese Kana Palette or any other input method I've tried.

19 Sep 2005

Elizabeth II of the United Kingdom - Wikiquote

Elizabeth II of the United Kingdom - Wikiquote



It is a pity that Her Majesty is prevented by tradition from voicing her own political opinions. If only she were able to share her wisdom and experience (and, if the attributed quotes at Wikiquote are to be believed, a rather amusing sense of humour) with the commons (that's us) rather than just her Prime Ministers...

17 Sep 2005

Why do Chokito bars taste like crap?

I've just had (or started) a Nestle Chokito. I'd forgotten just how revolting they are. What a waste of $1.90.

16 Sep 2005

Bodoni Tag

I'm not sure how I found this, but I did: Bodoni Tag



A cool little story, with a twist at the end.

12 Sep 2005

The Evangelical Atheist - God is a Dick

The Evangelical Atheist - God is a Dick



The "God is a Dick" series by I Am over at the Evangelical Atheist is one of the best critiques of the depravity of the biblical "god" I've read.

Everyone, no matter what their delusion (or "faith", if that makes you feel better), should read these stories, if only to realise that children need to be protected from the filth in the bible.

02 Sep 2005

Who knows what evil lurks in the hearts of men? The Shadow knows.

I've just been looking for material on The Shadow. I've managed to find a fan novelisation of the 1994 film staring Alec Baldwin which looks promising and I already have a copy Dark Horse's book featuring The Ghost and The Shadow. I'm going to try and find the film on DVD as it was absolutely fantastic and I much prefer it to the original mythos (what I know of it).

02 Sep 2005

Aggravation

I've just finished the second assignment for the data mining course I'm doing this semester. The one thing I got out of it is a strong desire to avoid R.

There is something about that language and system that just rubs me the wrong way. I have no idea how the type system (such as it is) works and any such understanding would be of little value (as it is dynamic anyway). I cannot understand how someone managed to write a libxml wrapper that is harder to use than the C library.

To make matters a little better, the ESS (Emacs Speaks Statistics) package makes editing R code and interacting with the R interpreter easy, though emacs started acting peculiarly after I installed it.

All in all, R is (in my opinion, by my standards and for my purposes) something to be avoided.

31 Aug 2005

Relational Algebra in Haskell

I've just spoken to Jon about the problems and ideas I have posted about previously. One of the things I came away with is the suggestion that I might be thinking about relational algebras (perhaps an algebra over a set) rather than hypergraphs. I'm not entirely sure that this is the case (the "hypergraph" Wikipedia article above seems to describe what I'm thinking of), but the "algebra over a set" article is certainly applicable as well).

As a result, I've been able to dig up a couple of things that look like they might help me implement support for generic frames (i.e. those with an arbitrary number of n-relations for arbitrary values of n greater than 0).

While I've seen A Relational Algebra Simulator in Haskell before, it didn't occur to me that it might be applicable to my problem. RATH - Relation Algebra Tools in Haskell, however is new to me and looks like it provides a complete library (rather than the example program of the first link).

Whether I have enough time to catch up on my course-work, finish my system (as it stands), write a thesis and learn enough about this topic to extend the system using such a generalisation remains to be seen.

Another possibly useful generalisation might be to extend the concept of "relation" from sets of tuples to mutisets (or bags) of tuples, thereby allowing relations in a frame to be mutigraphs (i.e. graphs allowing multiple edges between a given pair of vertices). The Data.Graph.Inductive library supports labelled edges which suggests that it might also support multigraphs to some degree (if edges with non-identical labels are non-identical, then you can simulate an unlabelled multigraph by labelled each edge with an index).

I'd like to write a generic graph library with support for multigraphs and [uniform] hypergraphs, possibly by extending Data.Graph.Inductive, but this will probably wind up being pushed back until the Christmas break.

31 Aug 2005

Modal Logic Wikipedia Articles

I've been poking at Wikipedia again (I dislike free time) and decided that a list of articles relevant to modal logic might be useful. To that end, I present a partial list of Wikipedia articles:

In addition to the articles above (which aren't really directly relevent to my work), there are a number of articles that I've found useful in trying to puzzle my way through things. A partial list of these useful articles is:More articles will be added to this list as they are uncovered.

30 Aug 2005

A Distraction

HASH(0x8e31480)
People view you as a Loner Artist. Loner Aritist are exactly as their title says, loners and artist. Now you are not alone by choice but many people find you odd. This only bothers you when you're in a public place like a dance club or a crowded lunchroom so you tend to steer clear of those places. You might have a friend or two but they're either Loner Artists like you or Truly Dark. Fear not! So many artists are not appreciated in their own times!

What Do People Truly See You As? (lots of outcomes and stunning pictures) (brought to you by Quizilla)



werewolf
Werewolf - Evil or Not?

What type of evil being are you inside?
brought to you by Quizilla


HASH(0x8cd667c)
You're crying because you are lonely. Maybe you weren't always alone, but you've never felt so alone now. You 're afraid to stay so alone. You feel like no one cares what happens and that no one even realizes you exist.

Why are you crying? (beautiful pics)
brought to you by Quizilla


Nihilist Bear
Nihilist Bear

Which Dysfunctional Care Bear Are You?
brought to you by Quizilla


HASH(0x8be451c)
You're the dark school girl. Most people like to label you as gothic or punk but you don't car what people think. You've been hurt badly and are cold towards others and very mysterious. Someone is watching you from afar though and admires your calm and different outlook on life. Maybe someday you'll meet them. Then maybe, you can finally be happy.

What kind of school girl are you? (cute pics)
brought to you by Quizilla

26 Aug 2005

A List of Things to be Read

There are a few topics that I'm interested in reading about, but haven't got any books on yet. This post will serve as a repository of these topics (so that I don't forget about any of them).

More will be added as the need arises.

25 Aug 2005

Yet Another Book Purchase or This Time, It's Maths

Recent Data Mining lectures have been looking at the Apriori Principle. The discussion of a set-theoretic framework within which to consider data mining (more specifically, market basket analysis) prompted me to have a look in the maths section of the Coop Bookshop for a book on the topic.

I came out with a copy of Introduction to Lattices and Order. What [little] I've read of it so far is very well written.

The bad news is that I need to get back into reading so that I can write the literature review and background sections of my thesis without screwing anything up or misrepresenting anything too badly. I have a feeling that it's going to be a long time before I finish up the 17 books I've got bookmarks in.

25 Aug 2005

Annoyances of the Feature Kind

Yesterday, I finally sat down and wrote a priority queue (a heap to those in the know) to store the formulae on a branch that still need to be processed. Chris Okasaki (in his book Purely Functional Data Structures) defines the interface of a heap as follows:

class Heap h where empty :: (Ord a) => h a
isEmpty :: (Ord a) => h a -> Bool

insert :: (Ord a) => a -> h a -> h a
merge :: (Ord a) => h a -> h a -> h a

findMin :: (Ord a) => h a -> a
deleteMin :: (Ord a) => h a -> h a


This is a problem (in my opinion) in that it requires that heaps (all heaps) be over ordered data-types. The entire reason that I am attempting to extend the heap is to remove the ordering from the contained type, and use a priority type instead. Thus we are no longer saying that, for example, ? < ? but that (priority ?) < (priority ?)

I'll be the first to admit that this isn't much of a distinction to make (especially from a pragmatic "programmer" point of view), but it is a nicer approach.

I got around this problem, such as it is, by modifying my Prioritised class to have a function to inject values into my Priority type and one to extract them. The heap then is a type synonym:type PriorityHeap t = LeftistHeap (Priority t) with the restriction that you need to explicitly wrap values you insert into a heap:let h' = insert (priority v) h in ... and unwrap those you get out: let v = value $ findMin h' in ...

Not terribly inconvenient, but not ideal. I'm fairly sure that this could be solved with some functional dependancies magic, but the current state of affairs is good enough to be getting on with.

22 Aug 2005

Pharyngula::Is this elitism?

Pharyngula::Is this elitism?


If so, I'm guilty too.

20 Aug 2005

What sort of person?

What sort of person drinks coffee with cream? Milk - yes, cream - no.

16 Aug 2005

The Existance of Time

A while ago, I watched the annual Burton and Garran Hall public speaking competition. One of the speakers presented an argument that "the structure and perception of time are invalid." This post will describe the argument made (in more or less broad strokes as suit my purposes) and some objections to it.

The analysis of temporality and related phenomena has always been a mainstay of modal logic. The study of objects and their properties, on the other hand, is usually studied in first order logic or some other logic with quantification. The study of objects and their properties over time has yielded a number of logics and philosophies each of which has a different goal. Here we consider a fairly naive quantified temporal logic that is capable of considering non-existent objects (such as Sherlock Holmes and a flying pig).

If we consider such a logic, it becomes clear that the argument the speaker presented conflated two concepts:

  • the existence of an objects; and
  • the existence of a state (or set of states).
The former is a statement made of an object (that it exists), possibly indexed by some particular time, like "now" or "250 million years ago". The later is a statement made of a state, or set of states: an instant in time. That instants, or periods, of time are not objects ought to be obvious - objects are temporally located and have some degree of persistence and identity through time (though the exact nature of these properties may be disputed).

Thought I have not seen any other informal arguments against "time," I imagine that conflations and confusions might be common. This is, perhaps, an argument in favour of the adoption of a more formal approach...

16 Aug 2005

Alleged "Intelligent", Alleged "Design"

What jeezuz me off is the way that people are serious in considering "Intelligent Design". As many, many, many articles (by qualified commentators) have pointed out, "Intelligent Design" is not a scientific theory.

It is founded on arguments from ignorance, appeals to emotion, argument from consequences and a complete misunderstanding of the goals and methodology of science and reason. The fact of the matter is that there is no evidence to suggest any sort of "design" in the world. That creationists (sorry: "IDers") do not understand the theory of evolution; that they feel that there is "more" to life; that they don't like the alleged consequences of rationalism (which rationalists dispute) and that they don't understand the difference between a scientific theory and a speaking out of one's arse tells nothing of the validity of the scientific method or any of the theories it suggests.

Equal time only applies to equally valid alternatives. Science is not fair: the theories that adequately explain observed phenomena are valid and those that do not are invalid. It makes no more sense to teach ID in science classes than to teach poetry in those same classes.

15 Aug 2005

Jane Austen

I've just started reading Mansfield Park by Jane Austen. I got an etext from the eBooks@Adelaide collection of free web books at the University of Adelaide Library.

It's a great resource for anyone interested in the classics (I've put their editions of Austen's and the Bronte? sisters' books on my to-read queue).

14 Aug 2005

Stupid Military Aircraft

There is some stupid air show going on (part of the Salute to Veterans I think) here in Canberra. There have been helicopters flying around fairly persistently for the last couple of days, but they aren't too hard to ignore. Today, however, there have been fighter jets flying over the lake and making enough noise to disturb that part of the city situated around Lake Burley Griffin.

If they want to salute veterans, why can't they do so quietly and without burning huge amounts of fossil fuels?

14 Aug 2005

More Tai Chi

For my second week of Tai Chi lessons (there are two a week), I've managed to remember the first few steps of the short version of Tai Chi (I'm not sure which style we're learning, but it might be the Combined 48 Forms).

In addition to learning another step in the movement, we also learnt the fifth of the Eight Brocades which are exercises to strengthen the body and promote the development and circulation of Chi. The first fours aren't too bad, but the fifth (called "Shake the Head and Weave the Tail") wore me out. I'm still feeling it six hours later.

13 Aug 2005

Open Letter

Open Letter



An open letter to the Kansas School Board asking them to give "equal time" to Flying Spaghetti Monster-ism in their new science curriculum. They have numerous testimonials by persons qualified to make them (whereas Intelligent Design has none), lots of evidence (well, more then ID has anyway) and some truly inspirational art depicting Him and His Noodly Appendage.

RAmen.

12 Aug 2005

Purely Functional Data Structures

The Haskell code from Purely Functional Data Structures by Chris Okasaki can be found as his web-site at the United States Military Academy.

08 Aug 2005

A Humanities Kick...

I seem to be on a bit of a humanities kick... I've recently read a book on economics and a book on the working poor, am currently reading a book on linguistics and most of the feeds I read on anthropology and related disciplines. To make matters worse, I've just bought a handful of new books on media (Barons to Bloggers, series editor Jonathan Mills), "social issues" (Affluenza, Clive Hamilton and Richard Denniss), immigration/politics (Following them Home, David Corlett) and more media (Do Not Disturb: Media and Aust Politics, editor Robert Manne).

I've been meaning to buy Affluenza and Following them Home since I heard about them (probably on Sunday Night Safran or Hack, both shows on Australia's national youth radio station: JJJ) and only, by chance, there they were along with two other interesting looking books.

I need to stop going into bookshops...

07 Aug 2005

Wrongness and Evilitude

There are three items that have shown up on my feeds that I thought I'd post here.

I've just read that Robin Cook is dead. Chris Bertram at Crooked Timber linked to his resignation speech, in which he gave reasons why Britain should not have gone to war with Iraq, and announced that he was resigning as Leader of the House of Commons because of the war. I hadn't read this speech before and it makes a simple and powerful case. If only they had listened.

Another item is the leaked e-mails about the rigged Guantanamo Bay tribunals (via Leiter Reports). If anyone, anywhere still believes that these people (held, if not in breach of any law, then in breach of common decency) will receive a fair trial before an impartial court, they are either stupid, naive or wilfully deceiving themselves.

Finally, this piece about the motivations of the young men who carried out the attacks in London makes a point that everyone seems to be trying their hardest to ignore. Terrorism is "the use of violence and intimidation in the pursuit of political aims." Whether it is perpetrated by states (the U.S., Britain, Spain, Australia and friends in their Afghani and Iraqi adventures) or private individuals (the young men in London), violence and intimidation turned to political ends is terrorism. Just as they are terrorists, so too are we.

07 Aug 2005

Tai Chi

I've just had my first Tai Chi lesson. Hopefully I'll manage to remember some of it next week.

06 Aug 2005

Bond (the string quartet, not the spy)

I've just watched the DVD of Bond live at the Royal Albert Hall (which I bought on special at JB Hi-Fi in Canberra). I normally don't like recordings of concerts and this DVD demonstrates most of the reasons.

First, and most importantly: the music. A lot has been said about Bond's music. It's been called "classical", "New Age", "crossover" and "pop" by various reviewers. They were banned from the British classical music charts because their music isn't in the "classical idiom" and isn't by a recognised classical composer (I don't call myself an aficionado of classical music, but even I can recognise the sources of many of their songs). In spite of their use, sometimes a touch too heavy, of elements more reminiscent of dance and rock music, Bond's music is fantastic and the DVD of this concert isn't an exception. Far from the usual complaints of poor quality live recordings, the audio on the DVD is crystal clear and well mixed.

Second: the concert itself. While the music is great, the video is not. Some parts are awfully cut, with awkward, even amateurish, transitions between shots. The camera work is uninspired and uses a number of truly peculiar shots. One camera that is used way too much is positioned on the ceiling above the stage focussed directly down. Another is the roof and balcony cameras. The video editors have done a great disservice to the music and the band.

Third: the menus and extras. The menus are well designed and easy to navigate. A few tricks might have been welcome (the photo-gallery might have benefited from the usual trick whereby one need only press a direction, rather than a direction and enter), but on the whole, pretty good. There are a number of extras included: an interview with Bond, two music videos, a small gallery of publicity shots and a quiz on the DVD and some a poster and ring-tones on the DVD-ROM.

In short, the music is great, the extras are interesting and the menus are well presented. The only down note is the video which, while not bad, is not brilliant. If you're a Bond fan, I'd encourage you to get it. If you've been under a rock for the last couple of years and haven't heard them, you might like to think about it: at the place I bought it, this DVD is cheaper than the albums on CD.

05 Aug 2005

Vendetta (by Throwdown)

As I'm on a roll of posts about anime, books, blog-posts and the like, I've decided to branch out into music as well. My first post on music (this one) is a bit of a review of the album Vendetta by Throwdown (released in Australia by Road Runner Records).

It's a solid metal album, heavy on the guitars and drums, with powerful vocals. While it is good and will be going on my playlist, there isn't too much, in my opinion, to differentiate it from the offerings of acts like Killswitch Engage, American Head Charge (thought tend to be slightly more melodic) and Fear Factory.

In short: kick-ass metal, but not too inspired.

05 Aug 2005

The B&G Public Speaking Competition

I've just watched the annual Burton and Garran Hall public speaking competition. There were eight speakers who each had seven minutes to make their point, whatsoever it was, in-front of an audience of their peers and a panel of three judges. What follows is my recollection of the speakers most important (from my perspective) points.

The first speech (by the president of the residents association) advocated that hall residents be held accountable not to the laws of the land, but to a special code of our own. This lead him to propose that we would then need a group to police these laws, a group of Student Storm-troopers ("an SS", if you will). His last point was a suggestion that this "SS" would need a strong, reliable, dedicated person to set the laws and to lead their enforcement. He finished with a "Thank-you" (after a hastily stifled "Danke").

The second was a rather humorous speech about terrorism. It began with a brief discussion of some of the more inept members of the intelligence, security and governmental communities and moved on to a brief discussion of terrorism and security. While the speaker got in a few good points (and a laugh or two) the later part of the speech focussed on humorously portraying some prominent residents as "terrorists".

The third speaker took on the problem of global poverty. With a number of appalling statistics (that 70 children died of malnutrition during the speech, for example) and some good rhetoric, he made well the point that it is revolting that one in two people exist in abject poverty (surviving on less than $2 per day) when so much is spent on weapons. This speaker won second place and a prize of $100.

The fourth talk discussed Barbie and her recent break-up with Ken. Perhaps, the speaker posed, this is a sign that Mattel is attempting to make the world Barbie and her friends more resemble the one in which we live, to make their live more resemble the way we live ours. Or perhaps, she countered, it is an attempt in marketing driven by the fact that the boyfriend is no-longer popular with the target audience.

The fifth speaker told us about that cornerstone of modern technology (and comedic practice): the screw. This lively, entertaining talk took us back to the screw's invention in ancient Greece, through its use in war and peace to the development of the more modern varieties that surround us today. He ended with an exhortation that we all "keep screwing" and was awarded first place and the prize of $150.

The sixth contender returned to the discussion of global poverty. While his talk was amusing and he raised some valid points (contending that Bob Geldof is going the wrong way about ending poverty) I didn't pay much attention and so this brief mention will have to do.

The seventh brave soul to face us attempted to show that "the structure and the perception of time are invalid." A noble and learned topic but one which I am not sure can be covered in seven minutes. In her talk, the speaker appeared to conflate a number of concepts (time and our perception of it being the chief example) drawing on the weakness of one subjective definition of the present, proposing another point out that they are mutually exclusive (which is not, in my opinion, the case) and moving on from that "contradiction" to assert that time does not exist.

The eighth and final speaker (and the winner of $50 and third place) spoke to us of the game of murder (hunting your assigned target with a water-pistol whilst avoiding your own assassin) and the fear it caused, of spending hours lurking in wait only to find you she was waiting in the wrong building, of deciding that food and bathing were really that important -- "it's only five days." A very funny speech about fear and its role as both a motivator and an inhibitor of our actions.

05 Aug 2005

RSChem is Burning Down, Burning Down, Burning Down...

There was a fire at the Research School of Chemistry.

05 Aug 2005

Intelligent Design

Intelligent Design is dangerous. The thought that anyone, anywhere, could think of teaching this as fact (which, in the scientific sense, implies some form of verifiability) is truly mind blowing. Have we not yet moved on from being frightened by thunder and lightning?

If science teachers were to stop teaching science and start teaching poetry would that be a good thing? Why ought we ask (or allow) them to teach religion in science class?

05 Aug 2005

Intelligent Design

Intelligent Design is dangerous. The thought that anyone, anywhere, could think of teaching this as fact (which, in the scientific sense, implies some form of verifiability) is truly mind blowing. Have we not yet moved on from being frightened by thunder and lightning?

05 Aug 2005

And Watchings and Listenings...

I've just added another "W" and an "L" to the name of this blog to stand for "Watching" and "Listening". "Watching" has been added due to the fact that I've reviewed some anime before and am likely to do so again. "Listening" has been added in anticipation of my next post, a review of an album.

02 Aug 2005

Postcasts and Recharging

A while ago, Hack programme on JJJ did a story on iPods. According to one of the Apple service people they interviewed, the short battery life that lots and lots and lots of people experience with an iPod is due to excessive recharging.

Like most battery technologies, those used in the iPod will only last a certain number of recharge cycles. Once that number has passed, the battery life begins to decline. The obvious solution is the charge only when necessary. The obvious problem with this solution is that my iPod charges automatically when it's attached to my iBook.

My question then is, if we aren't supposed to charge unless necessary, and if the iPod charges when connected to a computer, then why does iTunes have support for podcasts?

01 Aug 2005

A question for Jonny...

A thought just occurred to me. Has John Howard ever actually identified an election promise as "non-core"? Or is it something that we need to divine for ourselves?

31 Jul 2005

More Freakonomics...

I've just finished reading Freakonomics and my overall impression is that it could have done with an appendix on statistical analysis, regression analysis in particular. The later chapters appeal to regression analysis a number of times and the one serious lack is an explanation of what that means.

Readers familiar with statistical analysis will not find this a problem, but this is not a book aimed at statisticians and economists. It is (as I see it) a book aimed at the reader of popular science, the reading public. Such an appendix might not have been bigger than the section of notes (some 21 pages), but would be provide a lot more support, in the mind of the casual reader, for the author's arguments and interpretations than the lists of citations, references and sources.

29 Jul 2005

Hmmm.

The presentation is over and done with. It didn't go too badly, though I did run under-time: I finished my presentation and asked (begged) for questions half way through my time slot. I'm not sure how much of it the audience caught, or what sort of comments the assessing academics will give me, but I'm reasonable happy with my performance.

Having seen all of the presentations, I find myself wondering at how many of the projects involve writing compilers and optimisers. One is attempting to learn tests to avoid computing expensive functions unless they're required (with collision detection as the experimental framework). Another is doing something with symbolic optimisation of robot dynamics (which looks a lot like single static assignment). I'm compiling a DSL to Haskell. Someone else is experimenting with interval arithmetic (which I want to implement in Haskell) for scientific computations.

28 Jul 2005

Presentations...

I have to give my mid-term seminar tomorrow afternoon and I'm getting rather nervous about it.

My supervisor has told me that my slides aren't accessible enough (i.e. I require too much prior knowledge), but I can't see any way to simplify things or remove content without missing important things. I'm not happy, but I don't the time fine-tune it any more.

If you're at the ANU (I'm not sure if the public is allowed) and free tomorrow at 1:00 (my presentation is at 1:26), come along to the Department of Computer Science seminar room (N101) and watch me embarrass myself.

27 Jul 2005

Live UI Editing

Some language communities (CommonLisp is probably the largest, most obvious example) are used to incremental development, live updates, online bug-fixing and the many other benefits of a language with a REPL.



Mike Austin is currently working on bringing some of this style of development to the GUI arena with his work on Live UI Editing. Hopefully he'll release a demo in the not too distant future.

27 Jul 2005

D-squared Digest -- A slightly overweight thirtysomething without a good word for anyone

D-squared Digest -- A slightly overweight thirtysomething without a good word for anyone via Crooked Timber



An well-written, insightful look at the recent killing of an innocent suspect by police in London from the business school perspective.

26 Jul 2005

No Thru Road!

I've been playing with hs-plugins, trying to get a version of my generated propositional calculus code working as a dynamically loaded plug-in. I've run into some difficulties with the type signatures of the plug-in API, a concrete plug-in, and the plug-in user.

I've tried using existentially quantified constructors as well as the more usual with class-constrained type variables, but I haven't been able to make any progress. If I can't manage to resolve the problem, it looks like I'll have to find another approach, perhaps by building an executable for each calculus (though that would suck as it'd have to compile everything, from scratch, for each and every calculus to get it to type-check).

Worrying.

If I can get it to work, I'll have an alpha release with support for K out as soon as possible.

26 Jul 2005

Freakonomics

I'm about half-way through reading Freakonomics and, while it hasn't changed my opinion of economics, it has impressed upon me the flexibility of modern statistics. If you're dubious about the status of economics as a science in its own right, I don't think that this book will convince you one way or the other (it hasn't changed my opinion), but it is a fascinating, well written book.

25 Jul 2005

Stupidity or How Dumb Can I Get

I've just been trying to install hs-plugins on my iBook with GHC 6.4. Sorting out the dependancies, getting stuff to build and getting the libraries installed has been ridiculously complex.

Now that I've got it built and installed (part of which required using hugs because runghc refused to run the setup programme), it doesn't appear to have registered the package, which means I need to manually provide the details to GHC every time I compile some code using System.Plugins (rather than just tell the compiler to use the package: -package plugins).

I need to figure out what it going wrong with my environment and fix it. Perhaps by tearing some capabilities out...

Update: I've got that problem fixed (make install doesn't appear to update the package database). Now all I need to do is work out a way to be able to specify the data-types in the plug-ins.

25 Jul 2005

Generality for its own sake

System.Console.GetOpt is a Haskell port of the GNU getopt library (which is almost impossible to find, unless they mean getopt(3) in glibc). In spite of being written in Haskell, the awfulness of getopt shines through.

25 Jul 2005

Dependancies...

I'm currently experimenting with hs-plugins, a library which supports dynamically loading plugins in Haskell. Or, rather, I would be if I could manage to sort out the various hassles I'm encountering in installing it.

The only problem is that hs-plugins depends on Language.Haskell.Hsx. This would be fine, if it came in the GHC distribution. Alas it doesn't, so I've had to find and install it myself. This isn't too much trouble - I have, after all, been using UNIX-like systems for at least 7 years now. The only bump in this stretch of the road is that Language.Haskell.Hsx depends on Happy.

Haskell is getting to the point where it could really do with a CPAN-style package archive, if only because introducing it now will be so much easier than later when it is actually necessary. Cabal already provides these sorts of features (dependancy chasing, etc).

23 Jul 2005

Shoes and Shoelaces

Why don't shoes have real eyes for the laces? Is there some aversion suffered by the makers and designers of modern footware, to holes that don't tear? Stupid bastards!

21 Jul 2005

More on Literate Haskell

I've been having fun extending my environment for literate Haskell programming in LaTeX. While I still haven't looked at the suggestion my previous post provoked (though I'll get round to it eventually), I have been taking the opportunity to learn some of the more programme-y things one can do in LaTeX.

The macro I use for the title of each module (called \module funnily enough) now checks to see if it is a sub-module (i.e. contains a '.' in its name) and makes it a \subsection if it does. For now, this will be enough, but later on there will be some configurability to this to make sure that we don't typeset modules as sub-sections of random other modules.

I'm also planning on making the pretty-printing code build a list of imported modules as it typesets the Haskell and then include the appropriate files (I've got an \import macro all ready and waiting) afterward.

I like playing with LaTeX.

20 Jul 2005

That [W] is now for "Watching" too

I've just finished watching a wonderful anime series: Someday's Dreamers. The characters are engaging, especially Yume and Angela, and the way that the apparently unrelated incidents come together to drive the last few episodes is very well done. The production values were obviously very high, with good voice acting (the Japanese, I didn't bother listening to the American), good art and animation and a gorgeous soundtrack.

The only thing that disappointed me was Inoue being the object of Angela's desire when I was expecting it to be Yume. Oh well, you can't have everything.

A very nice show. Everyone should give it a try.

20 Jul 2005

Buying Software

I just bought a copy of Photoshop Elements 3.0. As I've got a digital camera now, I thought that I'd better get something in which to edit the photographs I sure to take. It's been a very long time since I last used (perhaps "fumbled with" might be more accurate) Photoshop and I'm looking forward to learning it.

On the other hand, if the application itself is as dodgy as the installer, then this could be a painful experience.

19 Jul 2005

Thoughts on Hypergraphs

I'll start this post with a disclaimer that I am a mathematically naive person and don't really know what I'm talking about.

After my post last night (or this morning), I though a bit more about hypergraphs and started playing with a few ideas for a data structure based on incidence lists (lists of every edge incident on a particular vertex). While I've got something that works (after a fashion and in a naive and trivial sort of way), I've come to a realisation that I don't really know what a lot of the things I might want to do to such graphs actually mean.

What,if anything, do reflexivity, transitivity and symmetry mean in the context of a hypergraph? I've been trying to figure this out using the composition relation from arrow logic as an example but I'm still not sure I'm getting anywhere.

Be that as it may, I've started working on a prototype of a hypergraph package for Haskell and if I can figure out how various things ought to work and how to generalise it to relations of arbitrary arity, I'll release it separately.

19 Jul 2005

Literate Haskell

Last night I spent a while wrestling with latex, vim, make and ghc as part of my source-code reorganisation. One of the things I've been wanting for quite a while, is a vim syntax highlighting mode that understands the LaTeX literate Haskell syntax and displays both the Haskell code and the LaTeX code properly. Last night, I finally got it to work, though it has taken a bit of hackery in my Haskell files: I need to have a comment in every file so that the highlighter can detect the LaTeX.

This is a problem as the LaTeX detection heuristic appears to be:

  1. Look for a \documentclass macro (the begining of a LaTeX document); or
  2. Look for a LaTeX command; or
  3. Assume that the "literate" part is not LaTeX
Needless to say, this is rather annoying as I'm writing a program with a number of modules (and thus a number of files) and want to produce a single document from them. To ameliorate this problem, I just make sure to include a LaTeX-style comment on the first line of every literate Haskell file and use a few macros to do include imported modules into the LaTeX document.

I'm also using the listings package to pretty-print the Haskell code and my next goal is to use its custom keyword handling capabilities to automatically include the modules that we import (if they exist in our source tree and are LaTeX-style literate code).

19 Jul 2005

Licencing

A fourth post for today, also on a non-logic related topic. I'll be releasing an initial, non-modal, version of my code soon (in the next couple of weeks) and need to think about a licence for it. I've narrowed it down to four alternatives:

I'm leaning toward the Creative Commons licences at this point, but the Australian Public License could be good as well.

If anyone has suggestions or arguments for or against any licence (please don't bother suggesting the GPL and friends), please leave a comment.

18 Jul 2005

The Natural Numbers

One of the statements in my calculus language is the operator declaration:

Neg operator "~" has arity 1, fixity 0, priority 1.
As negative numbers don't really make much sense as the arity and fixity of an operator, I've just spent a while knocking up a Haskell implementation of the natural numbers.

While I dislike programming in Java and other "OO" languages, they do make it a lot easier to extend types than is the case in Haskell. It would be much easier to do this sort of thing if Haskell supported instance declarations (the things that make most polymorphic functionality work in Haskell) on type synonyms. If it did, Natural.hs would be about 6 lines of code (plus a few lines of boiler plate) rather than nearly 60 lines.

My new type Natural (just a wrapper around Integer) is an instance of eight separate type classes:
  1. Eq (they can be compared for equality)
  2. Ord (values can be ordered with respect to each other)
  3. Show (values can be converted to strings)
  4. Read (values can be parsed out of strings)
  5. Bounded (the range of values is bounded), though Natural shouldn't have an upper bound
  6. Enum (values can be enumerated)
  7. Num (values are numbers)
  8. Real (values are real numbers)
  9. Integral (values are integral numbers)
It probably ought to have a few more like:
  • Random (values can be randomly generated); and
  • Ix (values can used as array indices)
but it'll get the job done -- all I need from it is Eq and Ord.

18 Jul 2005

Renovation in Progress

I'm about one third of the way through the rewrite of the system so far, this time using doing the job properly (checking that there aren't too many or too few of anything in particular, that the numbers all agree, etc). Even if they had no other worth, the clarity that the monadic approach lends to code (parsing and error handling at the moment) more than justifies the presence of monads in Haskell.

I expect to have the system into a fairly robust state in the next day or two after which I'll knock together a small test suite (De Morgan's Laws, a bunch of tautologies and the like) and then move on. I hope to have the features required to implement K finished well within two weeks.

If anyone knows of a way to define a hypergraph inductively, please drop a note in the comments. If I can't find such a representation then I'm going to have a hard time supporting ternary and higher relations.

18 Jul 2005

Harry Potter and the Half-Blood Prince

Based on some of the fan fiction out there (already), it sounds like Harry winds up with Ginny in book six. It's quite lucky that I've been "spoiled" as I was going to buy it tomorrow and I certainly don't want to waste money on it if that is the direction canon is going.

18 Jul 2005

Dr. Seuss on Parser Monads

Dr. Seuss on Parser Monads



Every time I see this, it strikes me as more and more amusing.

17 Jul 2005

New Books

I've just bought two new books: Freakonomics and Purely Functional Data Structures.

I'll read PFDS fairly immediately (as I'm hoping it'll help me with my honours project), but I've got a feeling the Freakonomics is going to have to wait a while.

17 Jul 2005

Female Vampire Associates

I'm not sure how recent a development it is, but there certainly seem to be a fair (and growing) number of books out there with female main characters who "associate" with vampires and the supernatural. Laurell K. Hamilton's Anita Blake, Tanya Huff's Vicki Nelson, Kelley Armstrong's Paige Winterbourne, Charlaine Harris' Sookie Stackhouse, the list goes on (though I can't think of any more off hand).

This type of book focuses on a female main character who is dragged into (or perhaps is already a part of) the seedy underworld of the supernatural. Some of these books (the Anita Blake, Vampire Hunter series for example) have a gritty, realistic edge to them: the more or less human characters are caught up in a whirlwind of violence and death managing to survive only by chance, by the sufferance of monsters, or (by the skin of their teeth) by their own abilities.

Others of this genre (the Sookie Stackhouse Vampire Mysteries for example) sport a softer, less harshly-realistic look at the denizens of the night and their associates. Sporting just as many fatalities, these books offer a lighter, more accessible and more palatable read.

I've only read the first two Sookie Stackhouse books, but I found them more enjoyable, if slightly less intense, than the Anita Blake books. If you like the Hamilton, Huff or Armstrong's books, you'll probably enjoy Charlaine Harris' Sookie Stackhouse Vampire Mysteries.

17 Jul 2005

Apple - iTunes - Podcasting

Apple - iTunes - Podcasting


With the new iTunes update, I've been able to throw out one more of the third-party applications on my iBook: iPodder.

Pretty soon, I won't need any thing but the applications OS X ships with (plus LaTeX and iWork).

14 Jul 2005

Pieta by Haruno Nanane

I love Lililicious. They have done translations of some great manga and Pieta is, in my opinion, one of the best of those. If you are looking for a nice (if a little angsty) shoujo-ai story, Pieta might be worth a download.

Download a scanlation from Lililicious or go find it on Amazon Japan.

12 Jul 2005

A Delay or Murphy Strikes

I've just had to take my iBook in to The Mac Shop to get its charger (or perhaps the power regulation circuitry) fixed as it no longer wants to charge.

Unfortunately, this means that I'm unable to do any work for the next few days and may not get as much as I'd like done before my return to Canberra.

10 Jul 2005

Parsing and Patterns

The logic compiler generates Haskell code to implement a calculus. This includes a data-type to represent formulae, a function to resolve those formulae into sub-formulae, functions to format them for output, miscellaneous utility functions and a parser to parse formulae in the language the calculus operates with. As the code stands currently, the logic language allows the user to define operators with arbitrary arity and fixity. One might, if one were of a mind, define a 4-fix # operator with an arity of 3. A formula with such an operator might look like:

α1 α2 α3 # α4

As the code stands, the generated parser is built using the buildExpressionParser facility of the Parsec parser library. Unfortunately, buildExpressionParser is only capable of handling expression languages with unary prefix, binary infix and unary postfix operators, meaning that we can't generate parsers for all calculi that can be defined with our language.

To fix this, I'm going to have to write a more general expression parser generator (hopefully using buildExpressionParser as a base) that can handle operators of arbitrary arity and fixity. Either that, restrict the system to only unary and binary operators which would make implementing some [conceivable] logics very difficult, if not impossible.

On the other hand, buildExpressionParser has greatly simplified the pattern handling code in the compiler. In our language (which is so simple as to not need a name), we define rules such as:

Resolve "a->b" to "~a" or "b".

The patterns (the bits in quote marks) are formulae using the operators of the calculus, with arbitrary alphabetic names for variables (which can stand for any sub-formula - we can make no distinction at this point between sub-formulae and propositions as I haven't got round to implementing that yet). Our compiler generates at run time a parser for the formulae of the calculus and uses it to parse the rule patterns and generate appropriate snippets of code which we use for pattern-matching in the Haskell code implementing the calculus. For example, the rule above would be translated to the Haskell code

resolve (Impl a b) = Or [(Neg a), b]

Once we've parsed the pattern and generated a function, we get the pattern matching at run-time for free from Haskell.

10 Jul 2005

Hmmmm

I'm currently sitting in an Internet cafe in Launceston, which hasn't changed in the nearly eight months I've been away. It'll be good to get back to Canberra though.

10 Jul 2005

Cool Things That'll Help

In the cool things that will help implement this project, the Haskell Hierarchical Libraries contain a Graph library which supports querying the existence a path between specified nodes, just what I'll need to implement box rules.

Another cool thing I need to look at more is the definition of "a monad for stateful non-deterministic computations" in the All About Monads tutorial.

I need to learn more about monad transformers.

09 Jul 2005

Done! or It's A Start!

Last night (or, more correctly, this morning) I constructed a model: ~a, b for the formulae: ~a, a∨b using only the tableau framework and an automatically generated implementation of the propositional calculus:

Tableau> prove [Neg (Prop "a"), Disj (Prop "a") (Prop "b")]
Model [b,~a]

Now all I have to do is fix the bugs, extend what's there to labelled tableau and test it all. :-)

03 Jul 2005

I can do it, I can do it...

The system is nearly to the stage where I can write the propositional logic in it. I've been held up by a bit of trouble writing the code to generate a formula parser from the definitions of the logical operators. Once that is written, I need to modify it slightly (to generate a parser, rather than generate code to generate a parser) to parse the rule patterns, and logic compiler will be finished.

Then it'll need a Makefile (or something similar) to link a logic with the tableau engine (the simple, unlabelled version of it is finished), and we'll be finished with this initial stage of development.

27 Jun 2005

Stupid QANTAS

I've been flying with Virgin Blue since they started and if I had any lingering doubts about returning to QANTAS, this past weekend has resolved them. The only problem that flying with Virgin Blue causes is that they only fly into Launceston, a two hour drive from home. To make it easier, I decided to fly QANTAS into Devenport instead. I will not be making the same mistake again.

I caught a taxi to the airport at 12:10 and checked in to find that my flight had been cancelled, but I'd be able to get the next flight after that and still make my connection. This was fine with me, it just meant I'd be spending the hour wait at Canberra instead of Melbourne. We landed in Melbourne at 14:25 (the time my next flight was supposed to start boarding) and I rushed to the departures screen to determine which gate my next flight departed from, only to find that it too had been cancelled.

I eventually found a customer service desk with staff and discovered that, yet again, I'd have to catch a later flight. In an attempt, I suppose, to make up for some of the inconvenience they gave me a voucher to get a meal. Melbourne airport is a particularly boring place, though the numerous and frequent announcements about delayed, rescheduled, redirected, reassigned and cancelled flights did keep me (and the throngs of other affected passengers) somewhat entertained.

At the end of the day, QANTAS got me to Devenport more than three and a half hours later than my itinerary (booked not three days previous) stated, thereby inconveniencing myself and my family and resolving any doubt in my mind as to whether I'd be returning to QANTAS.

At the other end of the spectrum, the QANTAS ground and cabin crew were pleasant and helpful. It's a pity their logistics aren't as good as their service.

27 Jun 2005

Incremental Development

Incremental development is fun. I've just added support for branching as required to implement the disjunction and implication rules of my propositional calculus and it's been quite interesting to see just how easy a functional programming language makes with sort of exploratory approach to design and development.

Once I've got this up and running (all I need to do is add a check for contradiction), I'll refactor it to be a little neater, write a parser and generator that supports all of the features and get an initial, pre-alpha, demonstration version posted.

Hopefully that'll be in the next two or three days.

24 Jun 2005

Reusing Throwaway Code

I've just had my first go at writing a monad, and it's harder than it would seem. As a result of my moderately dismal failure, I've decided to go back and actually read the monads sections of the various Haskell tutorials (the Gentle Introduction, Yet Another Haskell Tutorial, and anything else I find laying around on my hard disc). I've just been looking at Yet Another Haskell Tutorial and the section on computations (Section 8.4.2 in the PDF) defines a small graph library which might be a useful starting point when I need to start dealing with transitive, Euclidean and even more bizarre frames and rules with conditions on them.

In one section, I get some [hopefully] usable code, and a better understanding of monads.

24 Jun 2005

Another Night's Worth of Code

I've just finished the first major part of my first step along the road to [real] implementation: I now have a working type for propositional calculus, a simple representation of a tableau branch, can saturate said branch (modulo the rules which branch) and generate a model (which is simply a list of literals at this point).

Next, I need to extend this tableau implementation to support branching and then complete the logic with correct rules for branching connectives (disjunction and implication). Once that is done, I'll rewrite my language parser and code generator so that I can actually generate this implementation of the propositional calculus from the definition.

Once that is done, I'll move on to the basic propositional modal logic: K. Getting K to work will require that I implement labels, relations and extend my language so that it can import and extend existing logics. Once that is done, I'll move onto a more complex modal logic (perhaps S4) before tackling intuitionistic logic (which uses two-part labels).

23 Jun 2005

The Trees Deserve It

I ordered another book today: Purely Functional Data Structures by Chris Okasaki.

I downloaded a PDF of his PhD thesis (PDF, 616K) and had a brief flick through. It looks as though some of the structures will be just what I need. One of the main differences (that I am aware of) between the thesis and the book is that the book includes the source code in both ML and Haskell, whereas the thesis only uses ML. The book will, therefore, be of a lot more use to me than the thesis and at less than $AU70, it'll hardly break the bank.

23 Jun 2005

I'm on my Way...

The mid-semester holiday starts, for me, when I submit my second report for Milestone Papers in Computing, that is, tomorrow morning. Rather than spend the next few weeks in cold, wet Canberra, I'm going to wet, cold Tasmania.

While I'm there, my Internet access will be rather limited and I hope, in-spite (or perhaps because of) this, to get a lot of work done on my honours project.

23 Jun 2005

[Haskell-cafe] Re: Using type classes for polymorphism of data constructors

Re: Using type classes for polymorphism of data constructors

A message on the Haskell-cafe mailing list gives an alternative (better, even) approach to the polymorphism of formulae using differential types. It works just as well as my solution, and results in much more complex (and therefore complete) types:

Main> :t (Impl (Prop "p") (Poss (Prop "p")))Impl (Prop "p") (Poss (Prop "p")) :: PC2 PC0 (Modal1 PC0)

I'm not yet sure which route I'll take. My approach results in a single data type (PC, Modal, etc) for each language, which is good, but the types don't mean much and it isn't Haskell-98 (or, at least, Hugs won't load it as such). Ralf's approach also works, the types is assigns formulae contain more information and it is Haskell-98.

I'll probably wind up using a version based on Ralf's example, unless I run into problems.

23 Jun 2005

Goals: the Motivation of Procrastination

So far, I have:

We've now entered the mid-year holiday between the two semesters and I am hoping to get a large amount of my implementation done during the break. On my list of things to do are:
  • define a state monad (to model the saturation of a branch);
  • define a backtracking monad (to model the branching of non-deterministic choices);
  • find a way to compose them (perhaps by deriving a monad transformer);
  • finalise the structure of the logic modules;
  • write a realistic (perhaps even production) parser and code generator for the logics;
  • learn to use hs-plugins to write dynamically loadable modules (and find a way to make logic modules dynamically loadable); and
  • implement some representative test logics (propositional calculus, K, intuitionistic logic, something with transitive frames, etc).
I've got a lot of work ahead of me, but the next few weeks are going to be fun. At the end of it, I will (I hope) have a running system to extend and improve and a much greater knowledge of Haskell.

23 Jun 2005

Deriving Backtracking Monad Transformers

I started reading Deriving Backtracking Monad Transformers, by Ralf Hinze, this afternoon (or, rather, yesterday afternoon). It's already been valuable, though that was more of a side effect.

I've haven't read too much of it yet, but I've been able to understand what I have read, which means either

  • I'm learning; or
  • Hinze is a good writer; or
  • deriving backtracking monad transformers is simple.
I hope that it's due to an increase in my understanding, but either of the other two cases might be true as well.

Next on the list is Backtracking, Interleaving, and Terminating Monad Transformers by Oleg Kiselyov, Chung-chieh Shan, Daniel P. Friedman and Amr Sabry.

23 Jun 2005

A4 paper format / International standard paper sizes

A4 paper format / International standard paper sizes by Markus Kuhn.

I just checked a PDF to see if I'd be able to print it and needed to find which paper size is 216 mm wide by 279 mm tall. A quick Google returned the page linked above. It includes an explanation of the ISO paper size standard, points out the regularity of the ISO sizes, their relation to other ISO units and the utility of such regularities.

It also explains just how brain-damaged the North American formats really are. I hadn't realised that North Americans can't enlarge documents properly as their paper sizes have several height to width ratios. I also didn't realise just how wide spread the ISO paper sizes are. According to Kuhn, the United States of America, Canada and Mexico are the only industrialised nations which don't use the ISO sizes widely.

I just wish that all the papers, books and theses that they produce came as A4 formatted PDFs.

22 Jun 2005

There is no spoon

Today's NotYASS session is entitled The Matrix as metaphysics. According to the blurb, we'll be discussing the various bits and pieces of work about the matrix as reality, the likelihood of this being the matrix, how one ought to live given that this is probably a simulation, etc.

Some of the papers on this topic (many can be found at www.simulation-argument.com) are quite interesting and many of them specific to The Matrix require surprisingly little prior knowledge.

Sounds like it'll be fun.

22 Jun 2005

The Matrix is in the Eye of the Beholder

The NotYASS session on the Matrix was interesting. A lot of people (or, rather, more than usual) showed up, including a lot of philosophers (from RSSS and the Department of Philosophy I suppose). There wasn't much more than the various points, arguments and objections raised in the various papers at www.simulation-argument.com, but the discussion was interesting.

I'll be missing the next session (I think it's been cancelled anyway due to a conference or some such), but there are a few more philosophical topics scheduled for the next few session after that. They should be interesting if nothing else.

22 Jun 2005

Polymorphism and Generality Redux; or The Beneficial Side Effects of Reading

I've started looking at how to code my backtracking monad (the framework that will provide the branching, failure, etc within which the tableau method for each logic will be implemented). To try to get a handle on the subject, I've started looking at Deriving Backtracking Monad Transformers by Ralf Hinze.

Section 3 of the paper defines an abnormal termination (i.e. exceptions) monad and 3.1 begins to define a transformer to extend an arbitrary monad with exceptions. As part of this, it uses an existentially quantified type variable in the definition of a type constructor (for :>>=). Needless to say, the similarity to my previous attempts to make polymorphic formulae was obvious.

Although I'm still, by any meaningful standard, a Haskell novice and haven't looked at this extension before, I've managed to extend that example (by restricting the type variable to members of my Formula type class) and Hey, Presto! I can now create polymorphic types representing my inter-mixable logical languages.

As an example, I've got a type PC for the propositional calculus, and a type < span style="font-family: monospace;" >Modal for alethic modal logic. The connectives of each language can take formulae of either type (or both) as parameters, and everything Just WorksTM.

Polymorphism, they way it was intended.

21 Jun 2005

Death, Jr.

Death, Jr.

I've just read issue two of Death, Jr. and it is even better than the first. Ted Naihef's art is brilliant; the contrast between Death (Jr.'s dad) and the rest of their suburban existence if wonderful.

Run out and grab a copy now, you [probably] won't be disappointed.

[Edit: Issue #2 got a fairly bad review at Comics Should Be Good. I agree with everything said there, but I still liked it.]

20 Jun 2005

Word of the Day

Today's Word of the Day is: unbosom.



Some words derived from archaic or specialised usage, like disrobe perhaps, have evolved to have a more general meaning. Unbosom, though sounds contrived, a little bit naughty and, to me at least, gives not the slightest hint of its meaning: to confide (one's thoughts or secrets).

20 Jun 2005

Finding the Muse

Finding the Muse

Recently I've been on a Harry Potter fan fiction trip. Specifically, I've been revisiting my fascination with Pumpkin Pie, or the Harry and Hermione "ship". While it has been wonderful rereading some of my favourite stories, I've also discovered some brilliant new stories.

Finding the Muse is, while not strictly speaking Pumpkin Pie, one such gem. While lots of Harry/Hermione stories have plots reminiscent of Days of our Lives, Eastenders or Home and Away, this is a truly wonderful story that explores an aspect of Harry Potter's world that I, for one, had never even considered but not seems glaringly obvious: the lack of music.

I'm sure that echoes of Finding the Muse will be appearing in my thoughts and writing on Harry Potter for a long while.

17 Jun 2005

Stupid Blinking Lights

I have never liked strobing lights. From flashing on the TV screen, to lights at clubs, flashing lights make me uncomfortable. I doubt that it is photosensitive epilepsy.

Lately, I've been irritated by the banner adds for the US Green Card Lottery (or whatever it is called). For some reason, someone has decided that a large blinking red/yellow block would be the best way to advertise the Green Card Lottery (which, in my opinion, has to be the single stupidest way to manage an immigration system).

I'm not sure if it has effected any photosensitive epileptics, but it sure as hell shits me off something chronic!

16 Jun 2005

Meta-post: Inward Links.

Wow, this blog has been mentioned in both Consequently (Greg Restall's blog) and That Logic Blog (Jon Cohen's blog).

Now I'll just have to get some meaningful posts up.

11 Jun 2005

Polymorphism and Generality

One of the main goals of this project, to my mind at least, is generality. The prover must be easily extendable with support for a wide range (ideally, the entire range) of labelled tableaux calculi. Furthermore, it ought to be possible to define new logics as extensions to existing logics: propositional modal logic, for example, is an extension of the propositional calculus to support two new operators: ◇ and □.

Unfortunately, I've not been able to get determine just how to get this level of flexibility to work under Haskell's type system. I've asked the Haskell-cafe mailing list for pointers and, in the mean time, have moved on to doing this composition in the compiler for my mini-language rather than in the generated Haskell code.

Hopefully, I'll get this to work as it will be quite useful and, unless I'm mistaken, interesting.

11 Jun 2005

Hello, I'll be your host tonight as we play...

Name that Project...

My project is in need of a name. Rather than give it an acronym, I've been trying to think of a name at least somewhat relevant to the topic at hand and my approach. I'm currently thinking about "Vindaloo" with the rather tenuous link being Haskell Curry and that the project will, I hope, be pretty hot (for some definition). "Vindaloo," though, doesn't have all that much to do with modal logic.

Names have never been a strong point of mine (I still don't know the names of many of the people I've seen and talked to every day this year), so I'll take this opportunity to solicit suggestions: If you can think of a name for a labelled tableaux theorem prover written in the Haskell programming language please leave your suggestions in a comment, or email them to me at: thsutton at gmail dot com.

10 Jun 2005

Parsing stuff in Haskell

I've just started looking parsing in Haskell with Parsec. After a few hours of reading and poking at examples, I've got a prototype working

10 Jun 2005

Parsing stuff in Haskell

I've just started looking parsing in Haskell with Parsec. After a few hours of reading the documentation (PDF, 424K)and poking at the examples, I've managed to hack together a parser for my little language.

Only a few hours after I started looking at Parsec, I've got a prototype which generates code in an abstract syntax suitable for passing to a semantics checker and code generator (the system will generate Haskell from specs written in my DSL, which is then linked against some infrastructure). Very cool. Haskell is great for my productivity.

10 Jun 2005

Data Structures

I'm getting to the point where I'll have to start thinking about the data structures used to implement my tableaux. They need to be as small as possible and allow fast membership testing and updating. As my current goal is to accept a formula to prove and produce either a counter-model or a "yes" as output. As such, I will only ever need access to those parts of the tree on the path from the current node, to the root. The tree is, essentially, the progress of the computation backtracking over time.

As such, I'm looking forward to trying to write the run-time (once I've finished figuring out how the logic-specific code the DSL will be transformed into will work). It will require a bit of input handling (in the IO monad), parsing (in the Parser monad) and backtracking (in some backtracking monad) along with some state (perhaps a State monad, perhaps built into the backtracking monad) and a whole bunch of lazy computation (the actual tableau rules).

Unless I am overlooking something (I'm sure I am and I imagine that Raj and Pietro agree), my main data structure will be...
a list. The main rationale behind this decision (rather than trying to build some sort of tree structure, or some bizarre nested set-like structure) is that, as I'm merely trying to build a model, the tree itself is expressed in the computation (or, rather, its backtracking). Furthermore, as I'm working with labelled tableaux (with an explicit modal relation), all I need to construct a model once I've found an open branch is the list of formulæ (and relations) from the end of that branch, to the root of the tree.

In Haskell, lists act like (and probably are) singly linked lists of cons cells with a pointer to the item, and one to the rest of the list. This means that you can add stuff to the front of a list without modifying the original list. This is rather helpful as it means that we can add junk onto one end of a list, which is what we'll be doing with tableaux (adding things to the end of the branch), and you can have multiple lists sharing the same tail (to give an right-way-up tree structure, like an upside-down tableau or a sequent proof). As we're going to be doing backtracking (because we can through away everything we don't need to write a model), and we've got a ready-made tree structure that can be extended at the leaves, there is a very simple way to code it all up: as a monad (for the backtracking) over the list pointers.

Using a monad (probably a MonadPlus) to implement backtracking will allow us to express branching naturally (using mzero "fail" on branch closure and mplus to do the "branching" evaluation) and if we add in a little state to each branch (a pointer to the current head of the list, for instance) we have a backtracking model search procedure. All that remains is to implement it (no doubt discovering that my understanding of monads is completely wrong) and find out which mountains I need to move to get this approach to work for the non-simple case...

10 Jun 2005

Advice, Suggestions and Supervision

I've just had a talk with Pietro about my project and directions in which I might move it. Pietro's PhD project (the Tableaux Work Bench) is written in OCaml (an eager functional programming language) and works with implicit tableaux. My Honours project (which needs a name, suggestions are welcome) is written in Haskell (a lazy, pure functional language) and works with labelled tableaux.

In spite of these differences, the projects are quite similar and Pietro's advice and suggestions are going to be invaluable. In our meeting, we discussed the data structures I am planning on using which has helped solidify my thoughts, which I shall write up and post this evening.

09 Jun 2005

"That's Dr. Rex to you, buddy"

That's Dr. Rex to you, buddy

One person present during the defense described it as if I were “chasing five motherf***ers down the street with a baseball bat in my underwear.”

Sounds... spirited.

08 Jun 2005

Web 2.0

I've been playing with some of the tools that people are talking about when they mention the Web 2.0 or, at least, the current day ancestors of those future systems:

CafeSpot
del.icio.us
Tag Cloud
CiteULike

08 Jun 2005

Neil Gaiman - Stardust

Stardust by Neil Gaiman

After fighting a losing battle against procrastination this morning, I went into town and came back with a few more books to add to my collection (Dymocks are having a sale). Amongst them, was Stardust by Neil Gaiman. After the slight disappointment of The Gene of Isis (which I plan to finish next week), I've been pleased to note that Stardust is a quite pleasant read. The first few dozen pages dragged me in whilst I was eating dinner and, hence I have been unable to give the notes for Software Quality Management (the exam I have tomorrow) one last read over.

The characters, what I've seen of them so far, are nice but the most enjoyable aspect of the book (at this point in time) is the language. The Gaiman's prose simply flows off the page. This really, really needs to be an audio book, read by someone like Stephen Fry.

Do yourself a favour and read Stardust.

08 Jun 2005

More on The Gene of Isis

Yesterday, I began reading The Gene of Isis by Traci Harding.

I've just finished reading part one of The Gene of Isis and, I must say, I am slightly disappointed. I began the book hoping that Harding would manage to avoid some of the more cloying "New Age" themes in her earlier works, but soon enough the mischievous elemental spirits emerged (if only in mention) accompanied with the various psychic and auric phenomena of the Indic tradition (if I recall my New Age hype correctly) so popular amongst the New Age community.

Part one is set in 19th century England. The main character Ashlee Granville is a young woman with psychic abilities having to deal with "coming out" into high society and the attendant problems, such as marrying, that confront her. While the characters mannerisms and dialogue have a tinge of the formality characteristic of the era, I still get the impression of a certain modernity, especially with respect to Ashlee. Perhaps a more formal turn of phrase, circumlocutious though it might be, would lend the story an air more appropriate to a story set in such times.

Disappointing though these points are (especially Harding's approach to the mystical, which is difficult to credit as anything other than a kowtow toward the popular New Age movement), the tale is well-told; the premise, intriguing; and the characters, especially Ashlee, engaging.

If you can bring yourself to brave the New Age elements of the story (or perhaps have enjoyed Harding's other stories, especially The Alchemist's Key and The Ancient Future Trilogy) then I would heartily recommend reading The Gene of Isis. If, on the other hand, the more popularist New Age approach to the supernatural makes you cringe, perhaps you'd better pass this one over and save yourself $AU29.95.

07 Jun 2005

Fantasy Books

The Gene of Isis by Traci Harding, published by Voyager

I've just started reading Traci Harding's latest book: The Gene of Isis and it looks like it'll be another great read. While I loved The Ancient Future Trilogy and The Alchemist's Key, her other books The Celestial Triad left me feeling somewhat disenchanted (what with the miasma of "New Age" that permeates those books), so much so that I didn't bother reading Ghostwriting or Book of Dreams.

Happily her latest work, if the rest of the book is at all like the first few pages, seems to have taken a less grating approach to the supernatural. The prologue, an entry from the journal of a character, has about it a charm reminiscent, to my mind at least, of the era in which it is set. The odd turn of phrase seems a little too modern, but the overall effect is most pleasing.

If you like fantasy, and are not averse to a bit of incarnation-hopping, then I'd thoroughly recommend giving Traci Harding a read.


On a related note, Voyager are celebrating their 10th birthday. Part of this (see the link) is a book containing a "sneak peek" of some of this years new books. I'm looking forward to a number of them, especially Trudi Canavan's new book: Priestess of the White, due for release in November.

Another book on my list of eagerly awaited new titles is Katherine Kerr's new book: The Gold Falcon (presumably to be published by HarperCollins here in Australia). There are two excerpts available on her web site.

05 Jun 2005

About Labelled Tableaux

On this blog I will chronicle the work on my Honours project in computer science: developing a system to construct counter-models for non-theorems of modal logics. This system will be a small theorem prover based on tableaux, written in Haskell.

I will link to relevant papers and technical reports, technical details which I encounter whilst coding, material that I make available to download, and anything else in the slightest bit relevant to the topic at hand.

31 May 2005

Spam - The Other Pink Gelatinous Substance

I just received a spam (regarding lifestyle medication) with the following as its filter-avoidance random text...

I like the word 'indolence.' it makes my laziness seem classy.
Gossip is sometimes referred to as halitosis of the mind
What's another word for Thesaurus?
Money is good for bribing yourself through the inconveniences of life.
Perhaps spam is turning over a new leaf and attempting to contribute something back to the Internet, even if it is a few bad jokes that only a person such as myself would find amusing.

28 May 2005

Tomb of Thomas Sutton

Tomb of Thomas Sutton



I like finding interesting things about my name.

28 May 2005

Science Fiction...

A while back, I bought a novel on impulse (it was cheap). To my surprise (and delight) it turned out to be the first space opera I've bought that was actually good. If you're looking for an interesting story, with an intriguing cast of characters, then I'd highly recommend Trading in Danger by Elizabeth Moon.


Another recent find (this time of the on-line variety) is a science fiction story called "The Outers" by "The Angst Guy". Though it is a piece of fan fiction (based on the only good thing MTV has brought to the world Daria), The Outers is an enthralling read. Perhaps its only fault is that it The Angst Guy is not continuing it (or not currently, at least).

28 May 2005

Finally...

My copy of CTM as finally arrived. It's only been 45 days since I ordered it.

On a similar note, a number of comic books I've ordered have arrived at Impact Comics which, on top of my recently ordered iMac, means that I'm going to be very broke for the foreseeable future. When it rains it pours...

26 May 2005

Google

I'm currently reading up on Google so that I can prepare my presentation on The Anatomy of a Large-Scale Hypertextual Web Search Engine by Brin and Page. This paper describes the original implementation of the Google search engine (originally http://google.stanford.edu, but that is now Stanford's search engine, powered by Google though it may be).

I'm going to try to cover the original Google architecture described in the paper, and then move on to some more modern material from the Google File System and MapReduce papers, though I'm not sure how much detail I'll be able to give.

Depending on how useful they wind up being, I might put my report and slides on-line.

24 May 2005

Work for Idle Hands

After a meeting with my supervisor, I've decided that this week is the last straw - if I can't manage to get a handle on my pile of assignments this week, then I obviously don't want to be here right now. I had a bit of a go at some of it last night and seemed to get on all right.

If I can finish my report on neural networks by tonight, read the Google papers (the original paper and that on map-reduce) and get a good way through the first algorithms assignment tomorrow, I think I'll get there.

24 May 2005

Well that was interesting...

I've just been poking at my iPod mini's innards (in the software sense) and had a bit of a scare. It started when my quitting iTunes somehow managed to knacker something or other causing iTunes to crash on start-up, without fail. After a few attempts to fix it (including nuking my playlists, damn it!), I unplugged my iPod, and iTunes started working again.

Mystified, I started poking around in the iPod volume on the shell and, let me tell you, it is a lot more interesting from the command line. In Finder, all you can see are the Calendars, Contacts and Notes folders. From the command line, you get all sorts of junk ('Desktop DB' and 'Desktop DF', the spotlight index, .Trashes, etc) including a folder called iPod_Control. In iPod_Control, there is all sorts of interesting stuff including the music files themselves (in 'iPod_Control/Music/') and some miscellaneous data (in 'iPod_Control/iTunes/').

Nuking 'iPod_Control/iTunes/' had the effect of fixing my problem, with the side effect of making iTunes (and perhaps the iPod, I didn't check) unaware of the music on my iPod. I won't have time for a while, but I'm going to have to poke around in there some more...

22 May 2005

Procrastination...

I can't help but wonder if my current bout of procrastination is self sabotage. Perhaps, deep down, I don't want to be a computer scientist?

19 May 2005

I'm Still Waiting...

I'm not sure what the hold-up is, but I am still waiting for my copy of Types and Programming Languages. I do wish they'd hurry it up a little.

In other, some what related (in the sense that is also involves an order), news I gave in to my primitive, lustful urges and ordered a 20-inch iMac.

In even more, ..., news some of the books I've had on order came in today. I have in my hot little hands (read: hot little desk), Ojo and Breakfast After Noon.

14 May 2005

Speaking

It's 2152 on Saturday, and I've just spoken my fourth word for the weekend (In case anyone cares, the were two 'hello's, a 'thanks' and a 'cheers'). One day, I'm going to see just how long I can go without speaking (to another person, as I can't help but speak to myself).

13 May 2005

The Logic of Communicating Processes

I saw a talk by Professor Robin Cockett last night on the topic of The logic of communicating processes. I've just finished making a post to Lambda the Ultimate about the talk and related papers, so hopefully we'll see some interesting discussion.

08 May 2005

Clublife

Clublife



There are two things that make me love Blogger, the whole 'free blogging' thing and their Blogs of Note list.

Some of the funniest stuff I see on the 'net comes from that list. If humour is your thing, stop wasting time with the shitty "joke" sites, and get a Blogger account. Its well worth it.

07 May 2005

The Cost of Dead Trees

I've just been reading a bit of CTM. As I often do, I've used the receipt as a book mark (primarily because the bookshop staff put the receipt in the book when I ask them not to put my purchases in a bag).

CTM cost me, after the Co-op members discount, $97. The Revised Haskell 98 Report cost me $108. I'm sure there is some obtuse economic explanation involving economies of scale and the like, but it seems fairly counter intuitive that a book that is over 900 pages long is cheaper than one with less than 300.

The cost of books in general, and academic texts in particular, is (in my opinion) revolting.

05 May 2005

Azumanga Daioh

I got the first volume of ADV Manga's translation of Azumanga Daioh today and, having just read about half of it, I much prefer the scanlations to the licensed product. Why can't the American companies that buy the rights to translate anime and manga into English resist the urge to re-interpret the characters and their lines?

We buy anime and manga precisely because we want to read Japanese comics and watch Japanese animations. The horrible, grating, little changes that ADV Manga made to make the book more palatable to an American audience (i.e. to dumb it down) mean that I'll not likely buy another book from ADV Manga. I'd rather buy books from Japan and download scanlations from the 'net than give my money to butchers...

04 May 2005

Grice and Implication in Conversation

There was a meeting of NotYASS (Not Yet Another Seminar Series) tonight, this time with the topic of: 'Implicature and conversational meaning. Christian Rau began by talking a bit about communication in general before explaining the basics of Grice's account of communication (his maxims).

It led to an interesting discussion covering a range of topics, from the utility of the maxims, the difference between maxims and axioms, a rather large number of examples, various conditional operators (material, strict, Lewis/Stalnacker and intuitionistic) and the implications of/for AI.

A very interesting discussion.

03 May 2005

Problems, problems, problems...

I had a meeting with my supervisor today and thought that I'd better raise some of the issues I've been having. Basically, what it all boils down to is motivation, or rather a lack there of. If one took all of the time I've spent working on my honours project, my coursework and attending lectures, labs and tutorials over the last 2 months or so, it would not amount to a full week.

After a long talk with my supervisor, we've come up with a plan to, hopefully, get me back on track. I've unsubscribed from the mailing lists and turned off my email notifications on the sites that have been distracting me lately, we're considering a new project (one that I started hacking on during the mid-semester break to avoid working on my official project) and I'm going to see the honours convenor about an extension on the big assignment due this Friday that I haven't started yet.

It would be better not to be in this position at all, but I am and I feel a lot better about it now that I've spoken to someone, and have a plan of attack.

Thanks R! (Who doesn't read this, as far as I'm aware.)

03 May 2005

Mac OS X Tiger

Apple - Mac OS X

I've just installed Tiger on my iBook and, I must say, some of the new features are great. The RSS support in Safari is very nice (now I don't need a separate news aggregator), Dashboard is quite nice and Spotlight has already been useful. I'm not sure I like all of the changes to Mail (when you "wrap" to the next most recent message when paging through them with spacebar, it remembers the old position in the next message instead of going to the top), but I think I can get used to them.

All in all, I feel that it was well worth the investment, and I've only been playing with it for an hour or two. I'll get some more fiddling done when Monolingual finishes removing all the useless translation data from the newly installed stuff. With Panther, I saved about 750MB by removing all the languages I don't need (i.e. all of them but the various English variants), with Tiger it was just over 1GB.

(On the down side, it looks like I'm going to have to get some more RAM. Dashboard, spotlight and everything else can't be cheap to keep in memory.)

30 Apr 2005

[Even More] Books, Glorious [Even More] Books

I picked up Practical Common Lisp from the Co-op Bookshop yesterday. Looks promising.

Now all I'm waiting for is Types and Programming Languages (at the Co-op Bookshop) and a bunch of comics (at Impact Comics).

Now I have four books to read...
Plus numerous papers...
I pity my eyes.

25 Apr 2005

Freakonomics

Freakonomics



I've read some good things about this book. Coupled with some of the articles on the book's web site, I get the feeling that perhaps not all of economics (and all economists) deserve the vehement reaction that they it (and they) sometimes receive.

Yet another book to get...

25 Apr 2005

Coming Back

I got back to Canberra this morning, after 10 days in Tasmania. Now that I'm back, I can't remember having actually done anything during the time. Sure, I read (logic papers mainly), wrote (notes on said papers and Z specification for an assignment), saw (a younger sibling's primary school sports carnival), and did (helped take some stuff to the rubbish dump) some stuff, but not 10 days worth of stuff. On the other hand, it was good to catch up with my family and my friends in Launceston.

Why does Canberra's airport shuttle bus not run on weekends and public holidays? If Launceston airport has enough traffic to make public holiday airport runs worth the operators while, I don't see how Canberra cannot.

In a similar manner, I don't see why so much stuff is closed here in Canberra. I've just got back from town and everything (with the exception of a few cafes) is shut. Even the supermarket. Strange city...

25 Apr 2005

Books (and Comics), Glorious Books (and Comics)

I've just got back from Tasmania (visiting my family and friends). With me, I've bought the rest of my comics collection. The first 18 volumes of Lone Wolf and Cub have certainly helped fill up my book case. When you throw in the rest of my books (novels, texts, references and popular sciences) and my CD and DVD collection, I need more shelf space. The only problem is that there is nowhere to put a book case. I suppose I'll just have to make do.

Returning to comics, I've just added 6 books to my list of things to order, which is both good ("New comics. Yay!") and bad ("Where did that $100 go?!?"). Most of them are books by Andi Watson. Looks like I'll soon have all of Watson's releases, or at least the trade paperbacks of them.

On the books front, CTM (or more completely: Concepts, Techniques and Models of Computer Programming by Peter Van Roy and Seif Haridi) has come in. I'm going to pick it up tomorrow, but it'll be a while before I can start reading it (what with the million and one things I have to do in the next week or so).

14 Apr 2005

Books, Glorious Books

One field of Computer Science I am particularly interested in is programming languages. In a probably futile attempt to speed my learning in this area, I ordered a few books from The Coop Bookshop the other day. I chose the books based on the various recommendation on the Lambda the Ultimate weblog forums (adjusted by price, availability, and recency of publishing).

After a bit of um-ing and ah-ing, I finally settled on Benjamin Pierce's Types and Programming Languages, Peter Seibel's Practical Common Lisp and Concepts, Techniques and Models of Computer Programming by Peter Van Roy and Seif Haridi.

That's a bit of $300-worth of books, so I hope to get around to reading them at some point between when they arrive (somewhere between a week and a month away, I imagine) and the end of the year.

Suggestions of other books suitable for beginners in the areas of type systems, programming language theory, and related fields are most welcome in the comments.

11 Apr 2005

A Comics Update

Notes on a few new comics including Nightmares & Fairy Tales, Courtney Crumrin, and Gloom Cookie.

10 Apr 2005

Dirt Cheap

Dirt Cheap by Elisabeth Wynhausen

I've just finished reading Dirt Cheap, a book detailing the author's attempt to live on the minimum wage. A well written and engaging book, it has reinforced exactly how revolting Australia (and Australians) are. Some of the statistics included (and referenced in the end notes) are truly disturbing:

  • Not only does Australia have the third highest quality of life, but also the third highest percentage of people living below the poverty line.
  • One in five families is jobless, including more than 660,000 children
This trend looks set to continue with the Howard government gaining control of the Senate thanks to the election of last year, guided no doubt by the wisdom of the free market. The question remains however of who will consume the market's produce? Surely the Centrelink executives, who are paid (I doubt that they earn it) $128,165p.a. (up over $40,000p.a. from 1997/8) can't consume ALL of the domestic and imported product.

An enthralling book that I would recommend to anyone with an ounce of humanity, or the ability to see beyond the next fiscal year or federal election.

09 Apr 2005

Cultural Pollution

I've been reading quite a bit of fan fiction recently and it has caused me to ponder cultural pollution. A lot of the stories I have read recently have been for fandoms with a non-American background. In spite of stories being set in the UK and with a cast of characters from the UK, many of these stories are littered with Americanisms, some of which indicate an alarming lack of knowledge about the rest of the world.

I have encountered time and again such terms as 'college' for a university, 'freshmen' for students (of some variety), 'sidewalks' for footpaths, 'trash cans' for rubbish bins, 'cable' for pay television, etc. The ways in which American usage has diverged from the rest of the English speaking world (i.e. the Commonwealth) never ceases to amaze me. That I encounter so many stories in which allegedly British (or Australian, New Zealander, etc) characters utilise the language in ways that I'm not sure they would even understand makes me wonder just how one sided the "pollution" is. Just how much the average American (or more correctly, the average American fan fiction writer) knows about the world outside the USA.

In some cases (such as 'cable', 'trash can' and 'sidewalk') the slips can be forgiven as the authors unfamiliarity with what amounts to foreign usage. In other cases though (especially 'freshmen', 'seniors', etc and 'college') such terms are not just "out of character", they can be plain wrong. In one story, a character described a class at Oxford as being "college freshmen" in spite of the facts that the character probably wouldn't know what 'freshmen' meant in any more than the most general sense and that using the word 'college' in reference to a collegiate university is not only contrary to usage, but so ambiguous as to be wrong.

Is such ignorance endemic to the US? Is the flow of culture so one sided that they do not realise that we speak differently? Perhaps they simply do not care? What ever the case, I find myself agreeing with Jacques Chirac and those like him: measures must be taken to protect other cultures from being overwhelmed. We must not allow our differences in usage, the peculiarities that help to give character to our language, be subsumed by the behemoth that is American English. Our idiosyncrasies, our peculiarities, our divergences are part of what make us who we are, as communities. The world, I feel, would be a sadder place without that variety.

On the other hand, you probably don't agree with me.
:-)

08 Apr 2005

Stupid Apple!

As much as I love my iBook, want a iMac and find my iPod handy, I hate Apple. I recently bought a remote control for my iPod. You know, the one that goes in between the ear-phones and the iPod. The one with the clip to conveniently attach it to your clothing so that you can get to it.

As it is designed to be used in a manner that makes it susceptible to the buttons being knocked, the Apple engineers put a hold switch on it, so that you can disable the buttons while not in use. After less than a week of use, the hold switch fell of my iPod remote control. While it was locked. Needless to say, I was a little surprised.

Naively, I took my remote to the Apple store at which I purchased it. After a bit of a wait (they were busy) one of the staff told me that I had to phone Apple and gave me the number. When I phoned Apple, the telephone operator told me (after a while on hold) that I needed to fill in a form on the Apple web site and then take it and the item to be returned to Australia Post (what I do with it then was left as an exercise for the reader). As annoying as this is, I can accept that Apple is a big company and, as such, they need procedures like these to get anything done.

What really shits me off, is that I can't submit the form on the Apple web site because it requires credit card information. I don't have a credit card, I don't want a credit card and if I did have a credit card, I most certainly wouldn't give it to a company in these circumstances.

While I love Apple's computers and find my iPod and Airport Express base station handy, I can't help but be appalled at:

  1. the fact that a remote control, a device designed to be carried around, broke after less than a week; and

  2. that I need to enter my credit card details to return an item that, as I see it, was not fit for the purpose for which it was sold.
I suppose that I need to phone the help line again to find out what I'm supposed to do, but in the mean time, I can't help but resent it.

05 Apr 2005

Another interesting post on LtU

programmatic nature of subatomic make up | Lambda the Ultimate



All that I can say is: what the fuck? One day, I hope to understand this post and its implications. One day...

04 Apr 2005

RFC4042: UTF-9 and UTF-18 Efficient Transformation Formats of Unicode

RFC4042: UTF-9 and UTF-18 Efficient Transformation Formats of Unicode

I can't tell if this is an April Fools RFC (the probable status) or a genuine proposal that has been misunderstood. It is certainly a far cry from the HTCPCP (Hyper-Text Coffee Pot Control Protocol) RFCs of yore. If nothing else, a nine-bit encoding is an interesting exercise.

04 Apr 2005

Branching Time Temporal Logic

Deciding branching time logic

We've been looking at temporal logics for the last couple of lectures in Software Quality Management which has lead me to think a bit about the semantics of CTL (Computation-time Temporal Logic), primarily because they weren't spelt out in the lectures and the first page of results from Google Scholar didn't look promising.

CTL is a logic used to reason about the characteristics of programmes over time. As such it needs to be able to analyse a particular "run" (i.e. a linear sequence of states). It must also be able to deal with the non-determinism present in many programmes. To do this it must be able to handle branching of the successor relation, i.e. a state having multiple possible successors.

CTL has 4 modal operators: A ("for all paths"), E ("for some path"), F ("sometime") and G ("always"). These four operators are always used in pairs: AF, AG, EF and EG. The AG operator is equivalent to a □ (the box or "necessary" operator) and the EF operator is equivalent to a ◇ (the diamond or "possible" operator).

After a bit of thought, I think I've nearly got the semantics worked out in my head. At interpretation of CTL would be a Kripke frame (some worlds and a relation on them) and a valuation function (giving the truth values for formulæ at worlds). The relation R is irreflexive and non-transitive. The modal operators that handle the branching (A and E) are interpreted with R. The linear-temporal modal operators (F and G) are interpreted with the reflexive and transitive closure of R.

This is the point I have reached. Having written this, I don't think I've fully understood the implications of F and G being linear. I'll need to go through it again. On the plus, this might be useful for my thesis: all I need to do is try to find a natural-looking way to find the correct semantics for CTL, whatever they may be, using counter-models for intended theorems of CTL. It is a fun exercise in any case.

27 Mar 2005

Stanford: Stop Hiring Me (Aaron Swartz: The Weblog)

Stanford: Stop Hiring Me (Aaron Swartz: The Weblog)

Holy crap! I wish people would throw jobs like that at me. On the other hand, if they did, I'd probably be even further behind on my course work and research.

15 Mar 2005

God - Isomorphism Lacking

Comments

In the comments on a post (at LtU) about the recent Knuth interview, someone posted a rather amusing reply to a monotheistic comment. It is linked above.

11 Mar 2005

Project Description and Literature Review

We've passed the first milestone in the Honours program: project descriptions and literature reviews were due today. I'm fairly happy with mine. The literature review proper could have been improved, but I'm really happy with the background sections.

Writing it was fun! This is the first piece I've had to write that I've actually enjoyed writing for its own sake (and not for the adrenaline of starting to research an assignment 9 hours before it is due). Trying to describe modal logic and tableau systems concisely was a challenge!

If anyone is interested, I'll post a PDF after I check with my supervisor and the convenor that it is ok to do so.

11 Mar 2005

Past the First Post

Well, I'm past the first post (even if I'm not the first past it): my project description and literature review has been submitted to the Honours convenor. If anyone is interested in reading about counter-model construction in the context of modal tableau systems, leave a comment and I'll post a PDF of it.

The next milestone in the Honours program is the introductory seminar I'll have to give on the 29th (IIRC). I'm going to have to start thinking about that soon.

In the coursework stakes, we've got our first assignment for COMP4100 (Software Quality Management) which is proving some theorems in HOL. It's in pairs, so I'll be doing it with the other Honours student Raj is supervising. I've also got a stack of reading to do to catch up with COMP4710 (AI) and COMP4100 (SQM) and I've got to at least look at the available papers for COMP4200 (Milestone Papers in Computing) before I choose one.

I'm going to be very busy for the rest of this year, I think. If the rest is as fun as this last week has been, I'm going to have a good year.

08 Mar 2005

Megatokyo

Megatokyo: 683 Crazy Talk

I've just caught up with Megatokyo (I'm between bank cards, so I've not been able to put any money on my 'Net account at home) and, for some reason, the last two or three strips have me left me feeling a bit weird. For one, I didn't realise that Largo and Erika were "together" although I suppose playing games together a while back was a bit of a hint. For two, it seems to me (and I'll be way out, due to my social ineptitude) the Largo is being a prick, which makes me sad for Erika.

PS: I've ordered books two and three from the local comic shop, book two is in (and waiting only for me to have access to money) and I hope book three won't be too long.

06 Mar 2005

Animal Farm

George Orwell: Animal Farm



I've just finished reading Animal Farm again and it has reinforced my opinion that Orwell is one of the most impressive writers. Animal Farm and 1984 are two of the books that everyone ought to read.

05 Mar 2005

Rush Limbaugh Eats Everything

Rush Limbaugh Eats Everything



For all the fact that this is funny, I can't help but feel that it is more truth than fiction. I know people who accept and make arguments just like those made by Rush in this comic. It scares me that there are human beings in industrialised, progressive nations with access to some of the best education systems the Earth has ever seen (to our knowledge) that still cannot understand the simplest of arguments.

That there are people like Rush and his fellow neocons (or whatever they call themselves) is, in my opinion, just as much evidence of humanities origins as the fossil records and emerging genomic data.

05 Mar 2005

Nostalgia (A Sneak Preview)

For some reason, I got the urge to look up some of the people I went to high school with. So far, I haven't been able find a trace of any of them. It's a bit strange when you think about it: some of them have extremely distinctive names and Google doesn't know them. I went back to Bunbury for a few weeks a couple of years ago and caught up with some old friends there, but I only managed to meet a couple of people from my grade at school (and those by chance).

I was surprised by the number of my friends that didn't go to university after high school and I can't help but wonder what my class mates (especially the interesting ones I didn't know very well) are up to now...


If anyone who went to Bunbury Senior High School in the graduating class of 2001 reads this, drop me a comment.

05 Mar 2005

A Meta-blog Update

On a meta-blog note: I've just updated the title in recognition of the fact that most of my posts lately have been my holding forth on topics somewhat inspired by something I've read. Hence the [and Writing] in the title now. I'm not sure if it makes any difference whatsoever as I'm fairly sure that no-one reads this thing anyway.

02 Mar 2005

The Halflife of a Moral

America unbuttons a new front in the war on breasts

A chain of thought typical of my mode of thinking (that is to say: tenuous and somewhat arbitrary) lead me to consider some connection between radioactive decay and the "moral decay" that some groups tend to harp on about. Coincidentally, an opinion piece in The Australian today reminded me of this absent thought and so I'll ponder the topic online (and in public) rather than leave it to its rest (as perhaps might be wise).

Radioactive decay is the process that atoms (or rather their nuclei) undergo transforming from unstable to stable forms. An unstable nucleus will emit a particle (alpha, beta or gamma) as it transforms into a more stable state (be it as a a lower energy form of the same element, or a different element altogether). Perhaps the idea of "moral decay" might be characterised in the same manner.

A society, in its development, transitions from unstable states (those in which the society is at risk of fracturing due to the ridiculous strictures it places on its members) to more stable states (in which the society is more harmonious) by ejecting particles from its core values, i.e. by abandoning those mores likely to create division or to impinge on societal progress.

It was just a curious pondering but it is, perhaps, worth considering next time I hear a religious nut, right-winger, or RSL member holding forth on the "moral decay" of the "Youth of Today"...

PS: Any religious nuts, right-wingers or RSL members offended by the above please note: you deserve it.

02 Mar 2005

The Bank, Redux

Today, the ATM ate my card. I'm not sure why the banks expire bank cards, but I'm sure that there is a good reason. I just wish that they would wait until the new card is activated until they do so. Now I am without a bank card until next week some time, when the new new one arrives. (The old new one appears to have disappeared somewhere on the path from the bank to me via my old residence in Tasmania and my families home.)

On the plus side, the person I spoke to was more than happy to tell me that although the Commonwealth Bank doesn't offer a debit card one can use on the Visa/Mastercard networks, St. George do. It was nice to get helpful advice for a change. I've heard good things about St. George a number of times now. Perhaps I'll look at switching...

02 Mar 2005

Research in Higher Education

The Australian: Higher Education

In the Higher Education section of The Australian newspaper today, some of the potential changes to Australia's higher education system were discussed. In my opinion these changes are worrying from a number of angles. The first is that they are yet another facet of the implacable drive of the Howard Government to privatise every remaining asset of the Australian people. As a left-leaning person, I cannot help but be horrified by the moves the Howard Government has made to turn our public services into businesses. How much longer can it be until we are expected to pay for our services rendered by our police forces?

The second manner in which these changes worry me is what I see as an abandonment of the very nature of a University. To my mind, the role of a University in society (any society) is the investigation of ourselves, as human beings and a society, and our environment. The University should be dedicated to extending our understanding of ourselves and our world through the sciences, through the humanities and through the arts. The University ought to be conducting research into every aspect of our existence with the passion, drive and focus exhibited by the very best academics and researchers the world over. Furthermore, the University ought to be sharing the results of this research and instilling in the next generation the same desire to explore, to investigate and to innovate. By divorcing research from teaching, we will be divorcing the University and its work from the students, we will be removing the opportunity of the next generation of researchers to be exposed to one of the University's most important roles in society.

As a current student hoping, some day, to become an academic and to help contribute to my science and the education of future generations of scientists, I cannot help but feel that I have missed the boat. I cannot help but feel that, in fours years time, when I have my doctorate and look for a position in academia, I will have no choice but to move overseas. I will have no choice but to become part of the brain-drain, to become part of the problem.

I realise that my view on the University and its role may be considered archaic, that many people see economic rationalism as the way to go, that competition between academic institutions can only help our students. I cannot help but wonder if somewhere there might be a country that supports its academics and researchers and the role they play in society. If things here continue the way that I imagine they will, as soon as I discover this mythical country, I'll be off (being sure to repay the HECS debt incurred during my undergraduate studies of course).

02 Mar 2005

Funny 'Blogs, Redux

I got all my front pube hairs waxed

Some people have the coolest ideas!

01 Mar 2005

The Supernatural

Cerulean Sins by Laurell K. Hamilton
Industrical Magic by Kelley Armstrong


I finished reading the eleventh book in the Anita Blake, Vampire Hunter series last night. It was good, but I can remember lowering the book (to change position as I switch sides quite frequently when I read lying down) and thinking "There isn't much time left to wrap up the mystery." I seem to recall thinking something like that while reading a number of these books. It doesn't detract from them, indeed the frantic pace of the last couple of chapters lends them something that some other books don't have.

I had intended to get the latest book in the series (Incubus Dreams) today, but I became engrossed reading some more of the Handbook chapter I wrote about yesterday and missed closing time. I'll just have to get it tomorrow (or rather, today).

A while ago (probably sometime in November) I got Industrial Magic by Kelley Armstrong on a whim. For some reason I like these sorts of books now. Maybe it is that they tend to be more mature than the genre fantasy I have read almost to the exclusion of all else 'til now. That they are similar is obvious (even the publisher's website agrees with me), but I'm fairly sure I'm not in their target demographic. For some reason the realistic, gritty nature of these books involving the supernatural (even film media like Channel 4's Ultraviolet) is attractive to me right now.

I'd appreciate any suggestions of more books similar to those above.

01 Mar 2005

Tableau Methods for Modal Logics

Tableau Methods for Modal and Temporal Logics in Handbook of Tableau Methods, M D'Agostino, D Gabbay, R Haehnle, J Posegga (Eds.), Kluwer Academic Publishers, 1999.

I've been reading Rajeev Goré's chapter on tableau methods for modal logics for the last few days. I think I'm starting to understand the unlabelled tableau systems now, though I still don't see why one would want to use an unlabelled tableau calculus over a labelled one, especially for mechanisation. This new-found semi-understanding makes me think that I'm going to have to re-read the Matsumoto and Mouri papers I looked at last week.

I've still not encountered anything about counter-model extraction in Goré yet, perhaps it was only meant to introduce me to the basics. I'm not yet sure, but since I've started reading these papers, I've developed a bit of a sinking feeling: perhaps counter-model extraction won't be as challenging as we expect. I'd really rather not have implementation issues of the user interface aspect dominating my thesis, if at all possible. Perhaps I'll be able to take a detour through one of the more unusual logics to demonstrate the counter-model extraction...

What ever happens, I've got a lot of work (and reading) ahead of me. I won't know if it'll all be worth it until I get my first class [finger crossed] Honours at the end of the year, but here's hoping.

01 Mar 2005

Music and the Purchase Thereof

Less Than Jake: B is for B-Sides
4 Strings: Believe


I posted my brother his birthday present the other day (only a week late) which was good to get out of the way. Since I was skipping my first tutorial for the year, I thought I'd better do something useful done, hence the posting.

I'd asked him what he wanted and his reply was something along the lines of "I dunno" followed, after some prompting, by "a Less than Jake CD, but not the one with the cardboard cover". Armed with that information, I got him B is for B-Sides, the limited edition version that comes with a t-shirt.

I, personally don't have much time for punk, or ska, or whatever genre they classify themselves as, but it is his present I suppose.

On the more self-fulfilling side, I also got myself 4 Strings' Believe. For some reason, I've been leaning more toward dance music for the last month or so. It is quite strange as I usually prefer classical music (especially anything involving lots of strings) and metal. I'd really like to know why I've started liking, or at least tolerating, music with a more mainstream bent lately, but I don't imaging it'll last too long. I do need to get some more classical CD's though.

01 Mar 2005

Laundry: The Bane of Existence

I've come to a realisation: doing laundry is the bane of all that is good and right in the world. This epiphany came after spending quite a bit of time doing, or attempting to do, my laundry last weekend. I prefer to hang my clothes on a washing-line rather than tumble dry but, as I don't know everyone in that lives in the hall, I'd rather not expose my clothes to that risk (as my washing usually includes almost all of my clothes, few though they may be). As hanging them to dry in their own time is not an option with which I am comfortable, I am reduced to wasting energy by using a drying machine.

For some reason the dryers at B&G seem to hate me. On my first attempt to dry my clothes (on Saturday), the only drier free, wouldn't work. I don't know if this was because it knew the lint filter was missing (gone to I don't know where) or if it was suffering from some other mysterious malady, but it refused to work. After going away for a while, I returned to find two dryers empty and, splitting my load, claimed them for myself. Unfortunately, one of them had decided, for whatever reason, that it wasn't going to heat, and so I ended up with one load of dry clothes and another of damp, though will-aired, clothes.

Transferring them to the other dryer, I put them on over night, but the time I put the first load on wasn't enough, so they were STILL damp. At which point, I had my epiphany. Laundry is the bane of existence.

24 Feb 2005

Software for OS X

GNUPlot (needs AquaTerm)
O'Caml
Graphviz

I've been playing with some Open Source software for OS X lately. There are links above, and brief descriptions follow.



GNUPlot is everybodies favourite graph plotting software. At the link above, you can download a version compiled for OS X against AquaTerm, a package that allows gnuplot to draw to a native window under Aqua.

O'Caml, is an object-oriented functional programming language in the ML family. I'll be working with it this year. From the official download page (linked above) you can get source distributions, or pre-compiled binary packages for many platforms, including OS X.

Graphviz is a package for drawing diagrams of graphs and networks. The link above, is for an excellent OS X port of graphviz with a document-based GUI and support for lots of output format. It won a couple of awards and the OS X port, and Grapviz itself, is open source.



I'll post links to some more useful OS X software later on.

23 Feb 2005

On (or rather next to) my iPod

iPod Note Reader User Guide (PDF)

The other week, I bought myself a new iPod (and iWork) from my local Apple shop. Today I was poking around Apple's site and decided to see if they had an SDK of any description for the iPod. Apparently they do not, but I did find the user guide for the Notes application. It looks like you can get it to do some pretty cool tricks. When I get the time, I'll have a go at knocking together a bit of a demo of the sorts of things it can do, maybe set a short story to music and sound effects or some such, like those children's books with little icons in the text which cue the child to press the appropriate button to get a sound effect.

I'm not sure I understand the reasoning behind using XML for some of that stuff, but it's their product after all, so they can engineer it anyway they like. All we have to do is buy them... :-)

23 Feb 2005

Now with 10% extra!

So my first week of classes as an Honours student is well underway and I can't help but feel that it was just a little anti-climactic. Classes, as far as I can tell, won't be too much better than they were doing a Bachelor degree. On the plus side, COMP4100 Managing Software Quality looks like it'll be interesting. The AI unit (COMP4710) looks like it will be interesting: my previous studies in AI had a more symbol processing oriented approach, whereas COMP4710 is going to be taking an agent-systems oriented approach.

The other courses I'll be doing include "Milestone Papers in Computing" (COMP4200) and "Advanced Algorithms" (COMP4700). I haven't had a lecture for either of these units as COMP4700 doesn't start until next week and I have a feeling that I missed the first lecture of COMP4200.

On top of that lot, I had to buy some clip-on sunglasses today because I went to the Union courtyard to grab some lunch and it was painful to have my eyes open due to the glare and general brightness. On the good side, I got two new books today (the texts for AI and Algorithms) which was good, even though they cost nearly $200, even with the Co-op members discount.

I've also started reading up on my Honours topic. I've written a little bit about it on my reading 'blog.

23 Feb 2005

And so it begins...

On Friday, Pietro gave me a few papers and chapters to read regarding the theoretical aspect of my Honours project: techniques for extracting counter-models from open tableaux and implementing these techniques (or at least support for them) in the Tableau Work Bench. I've just finished my first reading of the first of these papers, and I'll note some points below.


I've just gone over the research report A tableau system for modal logic S4 with an efficient proof-search procedure by Toshimasa Matsumoto. It will take a few more readings (both of the paper itself and of those it references) before I get most of it, but it seems quite cool. As I understand it, the basic idea is to use the histories to prevent re-application of formulae and the attendant loops. This is quite straight forward. The bits I am still trying to wrap my head around are the way the tableau rules for CS4 accomplish this. I think that I've nearly got it worked out in my head, I just need to think about it a bit more.

What happens is applying rule (T) takes Γ, α to Γ, α, α and does not modify the history. When the transitional rules, (S4)s and (S4)t are applied, the α is converted back to α and is recorded in the history iff the current history is strictly smaller (i.e. subset but not equal to) than the history with α added to it, i.e. the history does not already contain α. This is cool, and I almost understand how the tableau rules do it.

The (T) rule, unless I am completely wrong, replaces the tree rule I am familiar with. The (S4)s and (S4)t rules replace the rule I am familiar with. The (S4)s and t rules also keep track of the applied s by updating the history. This is somewhat the equivalent of ticking the , and noting a world for a in the system I learnt last year.

The completeness proof, proof of termination and time complexity analysis all look interesting, but the most important part of the paper, for my purposes, is the section on constructing counter-models from an open tableau. As well as being relevant to what I'll be working on, this section was easier to read, as its content was somewhat familiar.

PS: I have used ∇ above to stand in for the filled box used in the paper, primarily because I can't be bothered making an image of a black box. In addition, neither the ☐, nor the ◊ are all that appropriate either.

11 Feb 2005

Orientation and O-Week

The SRs and the B&G Members Association and Co seem to be gearing up for O-Week. As I write they are busy painting signs about the weeks events, decorating their floors and buildings, and what have you.

It's going to be strange. At UTas, O-Week was, for me at least, the first week. Nothing more, nothing less. Burgmann college (where I stayed over summer) is supposed to have a party (probably several) that usually gets noise complaints. To the police. From the other side of the lake.

I'll either love it, or hate it.




On the "here and now" side, I went and saw Weifa Liang (the Honours Convenor) today after getting enrolled, getting my logon and password (the reason for the lack of posts this last week) and all the rest of it. So now I have a desk at the DCS (in honours room, a.k.a. "The Zoo") and I had an email from Rajeev Gore (my supervisor) about getting some office space at the RSISE as well.

I'm not sure which I'll prefer: both Raj and Pietro (the PhD student whose software I'll be working with and modifying) are at the RSISE, but the environment there is professional. The "Zoo", I imagine, will be a little more relaxed. I'm not sure which will be the more productive environment, but I suspect having more contact with my supervisor will be of significant import, in that it'll encourage me to actually do work before my deadlines.

04 Feb 2005

Things I hate about my Flatmate

Just found a piss funny 'blog via "Blogs of Note" on Blogger.com: Things I hate about my Flatmate.

04 Feb 2005

The End...

Today, the summer research scholarship program comes to an end (a lot of people have already buggered off) and with it, my project. I've given my presentation, have had my exit interview and am writing my report. It would be time to move on if it weren't for that pesky lack of results.

Although this was a rather experimental "poke it an see what happens" project, the "results" (or rather "result", or even more correctly "data") that I got is not really satisfactory. To see if I can get any further, I'm going to reimplement the technique using another library (the InfoVis Toolkit) whose data representation is more suited to these purposes and will, hopefully make the technique fast enough to eliminate the annoying lags the prefuse implementation suffered from.

Hopefully, I can get the reimplementation done, and finish the work on the log processor quickly enough so that John has time to work the results into a paper for CADE. I'd also like to try and get a paper (or a poster) ready for submission to GD 2005. I'm not expecting to get anything into the conference, I don't even know if my technique is original, but the paper writing practice can't hurt.

04 Feb 2005

Some More Comics

Notes on a few new comics and manga: Dead@17, Aria, and Remote.

02 Feb 2005

The Seikai Trilogy

The Seikai Trilogy

I made the mistake of going into Impact Comics on the way back to school today, and came out the owner of all three volumes of the Seikai Trilogy manga (redone in English by Tokyopop).

What I've seen of the anime (Crest of Stars, Banner of Stars and some of Banner of Stars II) that was based on the original novels is brilliant. It is fascinating watching the characters and their relationships grow and develop over the course of however many years.

Whilst in the shop, I noticed that they have most of Lone and Cub (forgive the lack of a link, but I can't find the Dark Horse site for the series anymore), which I'll have to finish off as I bought the first 19 volumes whilst I was in England a few years ago.

They also have a lot of stuff that just looks interesting. I can feel my fluid fiscal state evaporating as I think about it.

02 Feb 2005

Public Speaking

I used to hate public speaking, now I just dislike it. I've had to give presentations on a number of occasions and, normally, my mind goes blank, I forget to so much as look at my notes and I manage to muddle through whatever I was supposed to say without screwing up too badly, but without the level of technical detail I should be able to impart.



This morning (11:00AM Canberra time) I gave my presentation about my summer research project and, as a result I can't help but feel I'm gradually getting over my hatred of public speaking. This is probably a good thing as I expect to have to give a number of presentations this year during Honours.

02 Feb 2005

More on the Seikai Trilogy

The Seikai Trilogy

I've just read/skimmed Crest of Stars, Banner of Stars I and started Banner of Stars II and I have to say, I'm not all that impressed with the production quality. I love the art, especially in the first two books, but the editing is not too impressive (with text placed awkwardly in the "bubbles") and the glossaries of Abh words seem to have been quite rushed as they are missing some terms that appear in the text (Though I haven't looked in the other books yet for terms I've encountered in one) and one of the definitions has been run into the previous, without the appropriate bolding and italicisation.

In short, I get the impression that these particular books didn't have very stringent proof-reading, etc before they went to press. Perhaps they were rushed out due to the US release of the anime?

If anyone knows what happened (my previous Tokyopop books have been pretty good), I'd be interested to know...

02 Feb 2005

Money: Who Needs It?

TROACSS: The Seikai Trilogy
TROACSS: More on the Seikai Trilogy

I saw a comic shop whilst in town today, and decided to pop in for a look. I left having spent nearly $60 on the Seikei Trilogy. I've written a little about it in the two posts above from my reading blog.

01 Feb 2005

The Co-op Bookshop

The Co-op Bookshop

One of the things that surprised me upon arriving in Canberra (about eleven weeks ago now) is the Co-op. Here, it's open 9AM 'til 5PM, seven days a week. In Launceston, it doesn't open 'til 5PM every weekday, or at all on weekends. I think that they had a staffing problem this past year, but it is still telling. That the bookshop is open seven days, and carries more than just the set and recommended texts for the various courses, is threw me out.

I have a feeling I'll get used to it though: books, every day of the week.

01 Feb 2005

An Interesting Experience

It struck me today, that this year is going to be an interesting experience. This won't be the first time I've lived in a student residence, but it will be the first time I've lived in a residence populated with adults instead of college kids (in Tasmania, where I was last resident in student accommodation, "college" is the last two years of high school, not University). I'm still of two minds about it.

Rooms at B&G are supposed to be quite small, but it is self catered (which is always a plus in my book), on campus and cheap enough for me to afford. All in all, the only thing that might suck is the other residents and the facilities such as the shared toilets, showers and kitchens. On the plus side, if I didn't live in a Hall or College on campus, I would probably finish the year having met only the other Honours students and the lecturers at the Department of Computer Science.

All in all, I think this year is going to be an interesting experience. Only time will tell.

28 Jan 2005

The Joys of Working Code

I've discovered that the AffineTransform support in prefuse appears to be broken. Flipping (i.e. scaling by a negative factor) doesn't work, or at least misplaces the transformed co-ordinates. Rotating the display appears to expose some form of redrawing bug, as parts of the display aren't drawn (or need the display to be panned or scrolled).

This is in addition to what I imagine is a race condition of some description that causes a ConcurrentModificationException (if that is the correct exception class) to be thrown by a collection somewhere in the bowels of the library.

All in all, I'm glad that:

  1. the AffineTransform modification didn't take too much time;

  2. that I've been able to get some diagrams done for my presentation; and

  3. that not much was riding on this project.

While it would have been nice to have a complete package to deliver to my supervisor, I can deal with having a dodgy hack. In addition, I don't think I'll be able to get my log filter scripts completed in time for my presentation or, probably, the end of the project. I'd have liked to have more than one problem displayable, but I can't seem to get the filters to deal with things like subsumption and demodulation properly.

Curses!

28 Jan 2005

Kripke: Names, necessity, and identity

Kripke: Names, necessity, and identity

This sounds like an interesting book. I'll have to see if I can get a hold of it some how, as I don't really want to spend $130 on a book without at least looking at it first. On the other hand, if I spend $130 on a book, perhaps I'll bother to read it which will be an improvement.

Normally I buy books, and put them on my bookshelf, occasionally after having read a chapter or two.

28 Jan 2005

A little bit on logic and trans-world identity

I've just posted a little bit about modal logic (more specifically the idea of trans-world identity) to a message board I read. My post was in response to a post in a thread about a story in which a character uses a portal to visit herself in other worlds. The originating post, my reply and a follow-up by personal message follow.

If anyone spots any glaring mistakes or omissions in the below, I would very much appreciate having them pointed out in the comments (as though anyone will read this).

et alia wrote:

Believe it or not, there's a work of contemporary philosophy devoted to this topic: Saul Kripke's Naming and Necessity. Anyone else here know it? If I remember correctly and follow his arguments from that work (two big ifs), it'd be girl with the same name that Daria should talk to.

Argh!--just realized this: since the hypothesis of the story is that Daria analogue opens the open, then n world Daria should open the door, i.e., the girl who looks like Quinn, etc, but is named Daria. There's potential for "who's on first" dialogue:

My reply:

The issue of trans-world identity is quite interesting philosophically and is one in which there are a lot of points of view.

I, personally, like the counterpart theory (due to Lewis), in which there are no objects that are the same from world to world. What we mean when we speak of Daria from world n is the thing that is most similar to the actual Daria (i.e. the one we thing is "real"). All the "Daria"s are equally real, and completely unrelated, except through the counterpart relation.

There are alternative views in which the Darias are all part of one trans-world object, a kind of Uber-Daria. This is called mereology (IIRC) and the various Darias are just world indexed parts of the trans-world Daria. This view is somewhat related to the idea of temporal identity (i.e. am 'I' the same thing that sat here yesterday and browsed this forum?). The temporal variant is pretty much the same (just replace "world" with "time"), but also a lot stronger as a person has some form of spacial continuity between instants (i.e. I'm pretty close to where I was from one instant to the next), whereas there is no continuity between objects at different worlds.

Another view which might be taken into account is haecceity (literally, "this-ness") in which there is some ineffable thing (a je ne sais quoi if you'll forgive the pretension) that makes Daria-n identical to Daria-m, even if one is a person and the other a cement block. This is, needless to say, a little weird, but the whole concept of trans-world identity is a bit strange anyway.

If anyone cares to read more, I can post some references, or you can just look for books on modal logic (if you like formalisms) or the attendant philosophy of possibility (and lots of other stuff) in your local library.

My follow-up by PM:

First of all, I'm no expert, so you'll have to take what I've said, and will say with a grain of salt. Additionally, I'm more interested in the formalisms of modal logic than the attendant philosophical issues, so I don't pay as much attention to them than I might otherwise. I'm writing this the better part of three months after the end of my unit on modal logic. Needless to say, I'll probably make a few mistakes.

If you're familiar with formal logic, you might be familiar with the concept of an interpretation which assigns values to logical formulae. In propositional calculus, or PC, (ordinary two-valued logic with 'and', 'or', 'not', 'implies' and 'equals' and an alphabet of propositional parameters 'p', 'q', ... which stand for propositions). An interpretation of PC is simply a function v [the Greek letter nu, if you can type it :-)], which is a function from logical formulae to true or false.

PC is normal everyday logic. It is simple, obvious, and to most people fairly intuitive. It also doesn't really match the way we speak or think about a lot of things. Things like possibility and necessity ("Surely it is possible that I be Prime Minister."), temporality ("Tomorrow, we will try to take over the world!"), belief ("If Jill knows that John is drunk, she'll ...") and a whole bunch of other things that we talk about can't really be encoded into PC without causing problems.

Modal logic is one approach concerned with reasoning formally about these concepts. In general, modal logic is concerned with reasoning about relational structures, like possible worlds, or instants in time, or any set of things that can be represented as a graph (or network).

The most basic interpretation of modal logic is , as set of Worlds, a Relation between them, and an interpretation function that is a little more complex than that for PC.

I'll skip the whole great big raft of crap on modal operators and more than one modality here, as there are plenty of books on the subject and I wouldn't be able to write a passingly good blurb, never mind a book.

Another form of logic for reasoning about relational structures is quantification theory (QT). The main difference between modal logic and QT, is their perspective. In modal logic, one examines the structure from the inside (e.g. from the "world n", or "time t", etc) whereas with QT one has a gods eye perspective (e.g. you can see all the objects, not just the ones you can reach from here).

With plain modal logic, W (the set of worlds, times, whatevers) contains the "things" with which the logic is concerned and the most we can do regarding things IN the worlds (or times, etc) is say "the cat is green" is true or not. Combining QT with modal logic however we can say things like: it is possible that, for all objects x, if x is a cat, then it is green (which would be something like:

◇(∀x. isACat(x) -> isGreen(x))

where the ◇ is a diamond modal operator and the ∀ stands for "forall".

This then leads to a number of logics, one of which has the interpretation , a Domain of all objects (all the objects in all the worlds), a set of Worlds (times, etc), an accessibility relation between the members of W, and v (the truth function). Then all the mess comes in about objects being present in two worlds (if there is me in world n and me in world m, then are they two different objects in D? Are they the same object in D? If they're the same object, how can they be in two worlds at the same time?, etc). There is LOTs of stuff about this, Lewis is a good start (a search for Lewis and modal logic will probably get you heaps), Meinongianism is an interesting perspective where there are non-existent objects like the proverbial pigs-with-wings (Routley Exploring Meinong's Jungle and Beyond). On the other hand, modal logic is not a give and does have detractors. The only one that springs to mind is W. V. Quine.

Merging QT and K (the basic modal logic) as above leads us to questions about identity between objects in different worlds. Is the Daria in canon the same person as the Daria in John? There are four approaches to this that I'm familiar with. The first is to say that there is no identity between worlds, that canon-Daria and John-dating-Daria are completely different entities. This is called extreme essentialism and one proponent is Chisholm.

The second is the counterpart theory proposed by David Lewis and explained, however briefly, in my post on the message board.

The third is haecceitism, also covered above. It is also something of a cop-out to say that "canon-Daria and John-dating-Daria are identical because they are" (in my opinion at least).

The fourth is mereology. This holds that canon-Daria and John-dating-Daria are parts of Uber-Daria, a trans-world "whole" composed of all the Darias in all the worlds. This is similar to an approach to temporal identity, as I explained previously. An interpretation of a mereological modal logic might be where the Domain is a set of parts (the things in worlds) and the members of the set of Worlds (times, etc) are linked by a Relation. There is also a set of Functions which, given a world, return a part from D. The members of D then, are the things that exist in worlds, and the functions in F are "individuals". That is, f (a member of F) represents Daria. At the world canon, f returns canon-Daria, which is the thing that is "Daria" at the world canon. At the world John, it returns John-dating-Daria, which is the thing that is "Daria" at the world John. There are a few philosophical approaches that result in a semantically equivalent logics, but I can't really remember them.

If you're interested, I'd recommend seeing if your local University offers a course about modal logic, and see if you can go along. There are also a wealth of fairly good books on modal logic. If you like formalisms (i.e. mathematical proofs, etc) "Modal Logic" a volume in the Tracts in Theoretical Computer Science series from Cambridge University Press is good as well as detailing the true generality of modal logic (the modal operators and multiple modalities mentioned above). Finally, there are a large number of resources on the web. There are lots of 'blogs by students of logic, and you should be able to find a lot of paper, most of which won't make much sense.

Once again if anyone has any pointers to interesting material, comments or criticisms of my explanations above, please feel free (I'd like to say obliged, but you aren't) to post comments.

Additionally, this post wouldn't have been possible without the efforts of Dr. James Chase to endow a class of undergraduates with some little (in my case at least) understanding of modal logic during HPA292 - Logic and Philosophy.

24 Jan 2005

Tools for reading

Since I got my iBook, I've been using Bibdesk to manage a BibTeX database of the papers I've downloaded (and bothered transferring to my laptop). It's quite cool. Well, once you get past a few bugs, it's quite cool. It ties in with Preview's recent documents or will move a file that you select to your "papers folder" (it won't do both as far as I can tell).

Whilst this is pretty cool, I've been thinking that BibTeX is a little annoying (what with it wanting to rewrite capital letters unless you use braces as the string delimiters, etc). Lately I've been thinking that perhaps an XML format might be just what the doctor ordered. DC probably supports as many fields as necessary. The only problem might be the bunch of publication types that bibliography styles typeset differently, though I'm sure that there is a DC element (and maybe a dictionary of terms) to describe document types.

In any case, I'm too lazy to switch from something that works (BibTeX, et al) to something that I'd have to write myself (because using someone else's would defeat the purpose :-).


Other things that might be useful are some software to convert PDF and PS documents to text and an automatic text condenser and an outline editor. The former would help process those pesky documents without abstracts, whilst the latter would help note-taking and the like. If anyone happens to read this and knows of any free software (for Mac OS X, or UNIX) which fits the descriptions here, post links in a comment.

20 Jan 2005

On the Benefits of Documentation and Its Reading

I am stupid. That is the only possible explanation for the way I've wasted most of the last couple of weeks of work, by hard-coding a number of transformations into my code when the library I'm using (prefuse, just in case you'd forgotten) supports java.awt.geom.AffineTransform, in all it's glory, or should that be gory. So now, I've been hacking out all my size handling code; all my device co-ordinate handling code; all the uncommented, unnecessary, inexplicable cruft that has been cluttering up my code, and replacing it all with a single AffineTransform applied to the Display.

This has meant that I've been able to trash my idea of creating a new class. I'd already pretty much finished AdjacencyMatrixManager which was to know the size we were drawing at (i.e. the dimensions of the matrix we were filling in) and be able to convert points in a useful co-ordinate system (such as one with the origin at the bottom-left) into device co-ordinates. As quick as it was to hack up, it didn't take much longer to tear out again.

Now, all my classes are smaller (most of the are just a couple of one-liners in an interface stub), my code is [probably] going to be faster (there are a lot fewer method calls), and it is a lot simpler, with all of the stupidity caused by the device co-ordinates confined to one place.

The only problem I can see will be in adding interface elements that I don't want the AffineTransform to be applied to. Things like tooltips mustn't be transformed, or we'll wind up with huge, unreadable text the obscures its subject. On the other hand, it will be a lot easier to do things like highlighting effects, and such like as I no longer need to pass around various parameters.

On the whole, this is the better path, even though I may need to start poking at prefuse's insides.

20 Jan 2005

On a Mac

I like this. I'm sitting here at my desk in my room at Burgmann College (paid for by the RSISE as part of my Summer Research Scholarship). I've just posted an entry on my other 'blog (Very Big Graphs, the content is now integrated with this blog) to the effect that I've just discovered that I needn't have done a lot of the work I have done and that, had I read the documentation for the library I'm using, I would've known that.

The part of this situation that I like is that I only realised this because I've been working in Xcode on my new iBook for the last two days. The iBook is seriously cool. If anyone on the OS X team ever reads this: you rock (and could you tell the hardware engineers to read this next bit). If anyone of the Apple engineering team ever reads this: you rock (and could you tell the OS X people to read that last bit). This is probably, of all the computers I've owned, my favourite.

The only problem is the I now have the urge to switch completely: the Mac mini is looking quite tempting. I'll be able to hold out for a while (primarily due to a lack of disposable income), but once I've got my enrolment, accommodation and various other fees out of the way, I think that some small part of my scholarship might become available for conversion to a more solid, white, Mac branded form.

Another benefit is the software. I'm starting to get used to everything "just working". Unfortunately there are a few bugs in some things I've been using (like Bibdesk, a bibTeX database editor), but on the whole, I like it.

19 Jan 2005

Thoughts on a Programming Language

I've been thinking for quite a while now, that I'd like to have a go at writing my own programming language. I've been slowly working my way, little by little, through some of the ideas I'd like to experiment with in my language over the last couple of years. The Software Systems and Programming Paradigms units I took last year gave me a lot to think about, as have exposure to languages like Io, Haskell, Scheme, Python, Java 1.5.

Though I still have a lot to study in more depth (especially in the areas of semantics and type systems, neither of which I have actually studied), I've come up with a few features that I want in my language.

  1. A lightweight, flexible type system.

    I'd like my language to have a type system that includes a number of features usually only found in heavy weight languages like Java, Common Lisp and C#. First amongst these is some form of inheritance and polymorphism. This has fairly obvious benefits, and is something I missed during my brief foray into the world of Haskell (either because it isn't possible, or I didn't know how). Second is some form of parametrised types to implement generics (and whatever else one uses parametrised types for). Parametrised types and generics are a more subtle beast. I don't really know if they will be any harder [than inheritance and polymorphism] to implement, but they will make any language immeasurably more usable, especially for collections and various patterns involving proxying of one form or another.

Another aspect of the type system that will be essential is being light weight. If the language winds up supporting run-time loading of objects (like Java, C#, et al) it will need to support run-time type checking, which means that it'll have to have some form of type tagging, boxing, etc. I would like to keep this as minimal as possible, ideally, it would be [at most] a single word per object.

  1. Support for object-oriented programming.

    Hand in hand with the specialisation and polymorphism and parametrisation (in my opinion at least) is support for object-oriented programming techniques. Whilst I'm still of two minds about making everything an object, I do think that the <object>.<verb> form makes a lot of sense for certain operations. I also think that supporting a restricted multiple inheritance, be it mix-ins or just interfaces, paired with polymorphism, can provide similar amounts of power to operator overloading in C++, or type classes in Haskell.

  2. Fine grained memory access, if you want it.

    In addition to object orientation, I think that fine grained access to memory is essential. One of the main goals I have is to be able to do similar things with objects and collections in my language, as I can do with arrays of structs in C, with similar efficiency. This will probably mean that the user will need to have some way of controlling memory access, probably via the type system.

  3. A functional flavour.

    Whilst I do like functional programming, sometimes (especially when dealing with things like the "tables" described in point 3) a little bit of statefulness is essential. As cool as the monads in Haskell are, I'm going to try making functional-ness optional. Things like predicates should be functions. Things like operators should, arguably, be functions. Accessor methods probably shouldn't.

  4. Real support for concurrency.

    I love the idea of language level support for concurrency. Transactional Memory (see my earlier posts) is a brilliant idea. The paper on undo in C# is also fairly interesting. I intend to use native threading support in my run-time to implement things like co-routines and actors as well as more traditional concurrency primitives. This is one the aspects I find most interesting. Adding support for high level concurrency primitives will have, I hope, a similar degree of impact on the languages usability as generics.

On the whole, I'm not much closer to being able to write my own language than I was last year, but my ideas have coalesced into a much more coherent form. I hope to start working some time this year on it, which means I need to start reading up on many aspects, especially formal semantics, in between doing my Honours.

I'd better get started.

17 Jan 2005

More on Modal Logic

Whilst I appreciate and, I hope, understand the pedagogical value of using "practical" examples to offer motivation for topics that can, like modal logic, seem purely theoretical, I am beginning to appreciating just how interesting, versatile and useful a field modal logic really is by looking at it from a more theoretical and general point of view. The first twenty-four pages of Modal Logic (Blackburn, de Rijke and Venema)) have impressed upon me more readily and immediately than umpteen different modally interpreted implication operators or logics of time did, the flexibility of the modal semantics that I was taught in Philosophy and Logic.

That is not to say, however, that the more theoretical approach is better or more suitable than teaching "by example". In a course without prerequisites in mathematical reasoning, teaching modal logic by focusing on examples of its use is the most obvious, and quite probably the best, course. Without the opportunity to study modal logic in such a course, it would probably not have caught my attention and I would be in no position to be reading this book.

13 Jan 2005

Input Processing: The Joys of a Dodgy Hack

Just finished a rewrite of the input processing scripts. I now have a single Python script that reads a SOFTIE log from a file and does a few things with it. The first new feature is that it processes the option and parameter declarations output at the start of the log and warns the user if very_verbose, print_kept and print_deleted are not turned on. It understands enough to set and unset option flags and parameters, but the parsing is a little stupid. It will ignore warning lines, but treats everything else that looks like a parameter or option as a parameter or option, until it sees the start of the theorem proper.

It then proceeds to build a number of lists of clause Nodes. There is a list of all clauses and a list each of those that were kept, deleted and subsumed. Whilst building the lists of clauses, it keeps an eye on the time (i.e. the iteration) and increments it when necessary.

Once it is done building the lists of clauses, it, by default, prints out the list of kept clauses as a graph in the XML dialect used by [prefuse][1], with the nodes and edges bearing the attributes that the visualisation software expects.

[1]

Though it would probably be faster if written with more care (or in a text processing language like Perl or awk), this new script has turned what used to be a 5 (or more) stage process with 3 passes over the log file, into a single stage process with one pass over the data. It doesn't spawn any processes and doesn't use much memory (as opposed to the old shell scripts, and the libxml2 Python scripts respectively).

13 Jan 2005

Colouring Inside the Box

SET012-demo.png (PNG Image, 2551x284 pixels)

Now that the data sets can be reprocessed more easily, and have more, relevant, data in them, I've started working on the colouring code. At the moment, I've just cleaned up the colours (to get rid of the grey fill colour, etc) and added highlighting of factors. In the image linked above, factors appear as blue points, the green points on the left-hand side are the "given" clauses and the black points are any edges not created by factorisation.

Also evident in this image are the diagonal lines mentioned in a previous post, caused by the implementation of the theorem prover.

All in all, it has been a fairly productive day (so far).

10 Jan 2005

More on Composable Memory Transactions

Caveat: I am not an RTS expert, not a Haskell expert, nor a concurrency, languages, or OS guru. This little spiel is probably rife with errors, but I'll publish this post in the hope that someone will point them out.

Having read the rest of the paper, its strikes me [even more than it did] just how cool software transactional memory (STM) is. I wonder how effective it would be in an language with object oriented features. In a language like Haskell (what with its functional purity and laziness) it makes sense for the atomicity of transactions to be guaranteed by the runtime systems thread scheduler, but I couldn't help but see the potential the implementation in GHC has for helping map Haskell threads onto OS thread primitives.

The simple scheme described in the paper for validating and committing transactions might be extended, to allow concurrent validations and commits by adding per TVar locks and locking the TVars accessed by a transaction. If I recall correctly, deadlock and a number of other concurrency pitfalls could be avoided by using a lock-ordering protocol of some description (probably just ordering locks on the TVar pointer order). I'm not sure how much, if any, improvement in throughput might be observed, but allowing concurrent commits would probably increase the utility in adding more fine-grained multithreading to Haskell, by easing the development of safe concurrent programs.

As I said at the top of this post, I am not an expert in any of the fields touched on here, but I'd love to hear from those who are if anyone would like to point out my errors.

10 Jan 2005

Composable Memory Transactions

Composable Memory Transactions. Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy. Submitted to PPoPP 2005.

I found this paper through a link from Lambda the Ultimate, a weblog about programming languages.

Though I've not yet read the complete paper, it has really impressed me. This use of monads, for me at least, justifies them in a way and to an extent that none of the rather limited set of explanations I've seen to date has been able to. The simplicity with which the transactional framework described in the paper can be used is amazing. Though I've yet to understand everything it describes (especially the semantics and implementation which sections I haven't even read yet), I think I'm going to have to get the GHC head, and return to learning Haskell.

I think I'm going to have to go through the MS Research publications site for more interesting things to read.

06 Jan 2005

The end is nigh. Or at least in sight.

The end is nigh, or in sight, depending on which way you look at it. There are only a few weeks left of the summer scholarship program, and a lot of work still to be done.

On the other hand, a meeting with my supervisor (John Slaney) today has reassured me that I'm not doing as badly as I had expected, and when you look at the graphs I've been drawing on a large scale, you can see why. The matrix style diagrams display a number of features that clearly illustrate properties of the system, and the problems being solved.

In the SET012 problem, we can clearly see repeating patterns which may be a graphical reflection of the symmetry of the problem (from Set Theory and regarding some relation between sets and another). Another interesting feature is a number of peculiar 'gaps' in the graph where large numbers of factors are generated consecutively. One of these gaps is several tens of clauses wide.

Also clearly visible are sloping vertical "lines" (in reality they are just adjacent points). This appears to be caused by the method used by the reasoning system. To generate new clauses from a given clause, the system attempts to unify it with the clauses in the usable set. This process traverses the list of usable clauses in reverse order which, for given clauses that unify with a large number of usable clauses, gives the appearance of sloping lines.

Other noticeable features include the appearance of a number of short horizontal "lines", strangely regular patterns, patterns that appear to be interrupted then continue and some patterns that bear a small resemblance to the Game of Life and other cellular automata. I'm about to start working on adding some useful features to help give some more meaning to the graph. Unless I have a stroke of genius, this will probably be restricted to colouring the nodes (to easily differentiate factors, given clauses, etc) and highlighting those nodes that form part of the proof.

When these features are added in (hopefully be tomorrow or early next week), I'll move on to dynamic exploration. Some form of "zoom" function whereby those parts of the graph not in the immediate vicinity of the cursor are scaled down may be useful due to the rather long horizontal axis. Another feature that I'll have a go at implementing is a "cross-hair" on the cursor to allow the user to view other relations involving the node/s they are interested in, trace across to row and column labels, etc. Another possibility is to have the system display the text of a clause, the method that generated it and other possibly interesting data.

All in all, there is too much to do, and too little time.

06 Jan 2005

The Code Book (Simon Singh)

The Code Book by Simon Singh

A week or two ago, I finished reading Simon Singh's second book: The Code Book and it is every bit as good as Fermat's Last Theorem was. Simon Singh is, in my opinion and experience, one of the best popular science writers around (though I still need to get a copy of A Brief History of Time). I'd write more on the book but anything I could say, has already been said.

Buy The Code Book from Amazon.

06 Jan 2005

A Traditional Adjacency Matrix

John just raised the point that the size problem would be solved by using a 'full' adjacency matrix on the usable set (instead of all clauses). This would indeed give us a square of n size, with the triangular half of it filled. It might also be interesting in that it would allow us to, more easily, represent numerical statistics. These might include the number of clauses that were subsumed by a particular set of clauses, the number of children or the distance from the proof.

On the less positive side, it is possible that the plot might tend toward completeness. This may be a boon however as there may be some relation between its tendency toward completeness and the likelihood of finding a proof. Also, with a denser graph it may be reasonable (though probably quite naive) to assume that any blank space will be more meaningful.

These issues need, and deserve, to be addressed by implementing this idea. Sounds like I'm going to be trying to get a lot of little things done tomorrow.

27 Dec 2004

Onward, to a less nonsensical visualisation!

SET012-clip2.png

The new, matrix inspired, visualisation method is coming along nicely and, as can be seen in the picture linked above, allows one to identify possibly interesting features of the dataset. In this case, there are three points early in the graph that are well above the line formed by the given parent edges. These three, and a number of strange plateaus in the line are probably cause by factorisation.

Factorisation is a technique used by the prover to 'modify' clauses and is done (in these cases at least) when the clauses are added to the "database" of clauses. That is, when they are created. This leads to points that ignore, almost completely, the rest of the graph.

The first thing on the agenda for the coming week is to finish and polish the visualisation itself. Dealing with the gap a the start of the graph caused by the clauses of the theorem not having any parents will be near the top of the list, as will testing the layout code to ensure that it is not piling nodes on top of each other (I believe that it is, though it didn't seem to be when I had a quick look I've had at this problem). When the drawing code is complete and correct, I'll move on to adding in some useful features like drawing the axes, labelling rows and columns, etc.

After the essential features are implemented, the visualisation will need to be evaluated with respect to the goal of my project. If it doesn't seem to make the search process any more obvious, I'll have to reconsider my approach to the problem. On the other hand, if this approach is useful, I'll start to add some more exotic abilities to the application focusing on the dynamic exploration of the dataset. Animation, dynamic colouring of graph elements and querying and constraining the dataset will all, I hope, help the user explore and understand the data set.

Another avenue that will need to be explored is the sheer size of the visualisation. The SET012 graph has the same [very approximately] dimensions as twenty seven and a half, 17 inch monitors side-by-side. Needless to say, this will be difficult to navigate, especially on machines with a single, or smaller, screens. Fortunately there is a lot of research the area of zoomable interfaces, and a number of toolkits like Piccolo and ZVTM should help implement some form of scaling.

27 Dec 2004

Logic, modal and otherwise.

Attending the Logic Summer School at the Australian National University has encouraged me to continue my studies of formal logic begun with the unit HPA292: Logic and Philosophy> more informally on my own.

To this end, I purchased the Cambridge Tracts in Theoretical Computer Science book Modal Logic. My initial impressions are favourable, though I've not read much of the book.

I'll expound here in further detail on the merits of this book at a later time.

22 Dec 2004

Java Programming Language

Java Programming Language, JDK 5

I was just digging through the Java 5.0 API docs and found my way to the description of the latest language enhancements. The changes to the language in JDK 5 (nee 1.5) are seriously cool. The descriptions of the new features and constructs read like a who's-who of modern language features:

  • typed-checked generics

  • a useful for loop

  • static imports

  • useful enums

  • annotations.

Java is growing up. The for-each style loop and typed generics, as much as I dislike the <> syntax, will significantly improve the experience of programming in Java and the comprehensibility of the resultant code. Static imports, annotations and enums are, in my opinion, more open to abuse, but with discipline they too will make Java a much more attractive language to code in.

I can't help but wonder how long it will take these features to filter into programming and software engineering courses.

20 Dec 2004

Automated Deduction Image Gallery

I've started on a layout algorithm based on the concept of adjacency matrices. At the moment, it's a full matrix, but as soon as I can think of an elegant way to code it, I'll be tearing out as much of the white space as I can. In essence, the new layout will be a visual parallel of the adjacency lists data structure for storing sparse graphs.

We'll see how I go, but I think that this approach might be more general than a radial layout algorithm. Having animations of a few minimal spanning tree or network flow algorithms would be quite cool.

http://rsise.anu.edu.au/~sutton/matrix/

20 Dec 2004

Alternative Relations on Graphs

This project has, so far, focused on visualising graphs of only one relation on clauses, namely the parent-child relation. Whilst the addition of temporality adds an extra dimension to such a view, it would be interesting to expand the number of relations.

Another point which might bear investigation is the degree of temporal locality in the graphs growth. A graph with iterations (or whichever time quanta is appropriate) as nodes and the relation between the nodes of one quanta and another being an edge between them. The degree of the relation might be reflected in the weight of the edge. This could be visualised with a time quanta being positioned in a ring layout, with the temporal relation forming the ring, and the "share-a-relation" relation being the internal links.

18 Dec 2004

Alternative Visualizations and Pseudo-semantic Orderings

I've started thinking about alternative visualisation methods in the last couple of days. The most promising alternative is an adjacency matrix tweaked slightly to handle the added temporal "dimension". An adjacency matrix will [I hope] make patterns easier to spot, will be easier to code, and will probably be a lot faster to run. The added speed will enable the use of a number of run-time effects to aid in exploration of the data sets (highlighting related elements, selecting temporal "regions" of the data set, etc).

On the the other hand, the lecture yesterday by Thomas Meyer (which happened to be the final day of the Logic Summer School) was about belief revision and mentioned using epistemic entrenchment to impose an ordering on the set of clauses (or rather beliefs). The though struck me that this technique, or one similar, might be just what I need to impose some form of ordering on the set of clauses to be able to plot them effectively.

The only problem is that any such ordering would not be stable, so it would not allow comparison between two visualisations of different set of clauses (in the most obvious way at least). This might be applicable to both the radial network layout and an adjacency matrix. The radial layout might derive a clauses polar coordinates from its position in the ordering and from the time at which it was created. On the other hand, having a non-temporal ordering relation allow the adjacency matrix to be more useful in animating the graphs growth and development. I imagine that such a visualisation's appearance would be obvious to experts in automated reasoning, but it seems a lot more promising (and useful) than layout out the graphs to minimise edge crossings, etc.

15 Dec 2004

Summer Project

I remembered today that I had a Blogger account and thought that I should probably use it for something. What better purpose than to document my summer research project at the Research School of Information Sciences and Engineering of the Australian National University. This blog then will focus on my attempts to find a visual metaphor to help [humans] understand the search an automated reasoning system performs whilst attempting to prove a theorem.

Essentially this boils down to displaying very large graphs and the way they change over time. Some examples of preliminary work [could] be found at my project web page.

[Note: Posts previous to this one are based on work notes and have been back dated.]

15 Dec 2004

A Radial Layout

My first approach at generating a radial layout of the graph data logged by the theorem prover.

26 Nov 2004

Verbosity: Not always a bad thing!

It appears that we need to set `very_verbose` to get the prover to output clauses generated by factorisation, etc. Without this, we get only 5 clauses from LCL403 instead of the nearly 30,000 expected.

25 Nov 2004

Data, Data, Everywhere

The amount of data produced by the problems may pose a problem. LCL005 produces more than 600MB of output and generates over 6,000,000 events. Processing this data into a graph description is the next phase of the project.

24 Nov 2004

Graphviz, Dot, Large Graphs and Crashing!

Running GraphViz on my generated `dot` files exhausts memory and dies. I'll need to either use a smaller problem, or another visualisation tool.

23 Nov 2004

Graphviz, Dot and Large Graphs

Notes on my graph visualisation project.