Category: Writing Software

  • Java class file version numbering

    http://alumnus.caltech.edu/~leif/opensource/bcver/BcVerApp.html

    This page has a list which shows how java class version numbers relate to java platform version numbering. It’s useful if you get one of those UnsupportedClassVersionError errors.

    This relates to the Java ClassFile structure which defines how classes are represented.

  • Linux autologin

    I use a collection of virtual machines in parallels for a number of things, like testing SQLEditor and running web apps that would otherwise require lots of software dependencies. However I’ve been getting tired of logging in to my linux virtual machines all the time. If it were just a case of ssh then obviously I could set up ssh key pairs and do auto-login, but I also need direct terminal access too, in this case in the main parallels window.

    With a physical machine to get autologin in this situation would mean that the machine would boot and immediately log the user in without interaction.

    Important Warning

    This represents some security risk. You need to consider your circumstances carefully first to ensure that this will not open your machine to malicious use.

    (Of course there is always the point that if someone has physical access to your machine then there’s not much hope anyway. But still …)

    Fortunately this is possible and actually quite easy if you don’t mind editing a configuration file.

    The file you need is /etc/inittab

    Important Warning (2)

    /etc/inittab is vital to the operation of your machine. Incorrect editing will cause a number of problems.

    If you are making these changes to a virtual machine simply make another. Alternatively try logging in via ssh to undo the changes.

    The change you need to make is to find the line that looks like:

    1:2345:respawn:/sbin/mingetty tty1

    and change it to look like this (where username is the user that you want to autologin as)

    1:2345:respawn:/sbin/mingetty --autologin username tty1

    The original source of this is EasyMameCab; which looks like a clever idea in itself. They are using linux as the base system for building a video game cabinet, so obviously they don’t want logins appearing.

  • MacFuse released – userspace Mac OS X file systems

    I just noticed this announcement on the google mac blog.

    Amit Singh has released a mac version of Fuse, which is way for people to write interesting extensions to the file system without writing kernel code. The way it works (as I understand it) is that the Fuse system runs one kernel module which communicates with the actual file system code in userspace.

    It looks really clever and there are already a number of useful file systems available for fuse (including ssh as a filesystem and a ntfs driver).
    [link]

  • Writing Unit tests for Cocoa

    I realized something interesting today.

    I use unit testing to (hopefully) improve the quality of my code.

    With Java I use JUnit. With native Mac stuff I use OCUnit.

    One really clever thing about OCUnit that I realized today is that if you have several SenTestCase subclasses, each with multiple tests in it, you can put all of them into one XCode target and OCUnit will automatically run them as suites in one test run. This means that you get a summary of all of the tests at the end.

    Previously I had a separate XCode target for each test case, where each test case class reported its results separately, which isn’t nearly as good.

  • Crash with WSMethodInvocationInvoke and malformed XML

    I’ve been doing some stuff recently with XMLRPC for both SQLEditor and an unannounced new product.

    One of the key parts of XMLRPC in cocoa is the Apple web services Core. It provides almost everything you need to use web services.

    However I did discover one oddity that led to some puzzelment

    As part of my development I’d written a test server in php which operates a few simple functions that the client can try. This means that I can simulate various commands and cause intentional failures to see what happens. I also have a php client to check the server independently.

    I had been making alterations to check a particular function in the client worked correctly. It was a new function that provided an array of values that could be placed into a menu on the client. The idea seemed sounds, the design had been worked out and new functionality had been added to both client and server. The server seemed to work fine with its test client and I was ready to try my main client application.

    Unfortunately it either crashed or generated an exception on every call to WSMethodInvocationInvoke. Initally I assumed that it was a bug with my client application, perhaps I’d passed in the wrong arguments or made a mistake in setting up the context for the call.

    However after some testing of various possibilities I discovered what seems to be the actual cause.

    One of the included php files contained an extra new line character at the top before the doctype.

    Removing this extra new line solved the problem
    (presumably because it was now valid XML).

    Moral of this story:

    XMLRPC implementations and XML parsers are not always very forgiving of whitespace at the top.

    Interestingly, the xml parser in camino doesn’t like xml files with extra lines at the top either.

    I’m still looking to see if there is some setting that can be changed to make the parser more forgiving, or to pre-process the xml first.

    (I’ll be reporting this issue as soon as I can produce a suitable test case)

  • Forum for malcolmhardie.com

    Following the suggestions in this article, I’ve been considering forum software recently to offer customers (and others) somewhere to discuss SQLEditor.

    Currently I’m considering PunBB, because it seems to be simple, fast and well received by reviewers and users.

    PhpBB seems a popular choice but is probably a bit more than I actually need for this project.

  • flyspray subversion integration

    Somebody asked me to post a link to the script that integrates flyspray and subversion:

    Script is Attached to Bug 301

  • DocBook and Apple Help

    One of the key tools I’ve been using recently is Docbook. Docbook is an xml-schema which can be used to write documentation for things. This can then be converted via the wonders of XSL, XML and XML-FO processors into PDF, HTML or several other formats. I’ve written all of the documentation for SQLEditor using docbook and it is really handy. Slightly verbose, but really handy.

    Unfortunately at the moment there doesn’t seem to be an Apple Help stylesheet for docbook. Since one of my targets is Apple Help this is slightly unfortunate, but I suppose in time either I can write one or someone else will. In the meantime, I’m using the microsoft help stylesheet and altering the results a bit to work with Apple Help.

    Docbook is definitely a handy tool for documentation though. I wish I had discovered it earlier.

  • SQLEditor released!

    After a rather over-extended development cycle SQLEditor version 1.0 has now been released. Which is a great relief to me. I’ve been working on it for so long now that I can’t quite remember not working on it, which is weird. Admittedly that’s only really about 12 months, but still, it’s a significant portion of my life. It’s also the first major product I’ve released.

    In a moment of commercialism I would encourage you to buy a copy because it makes a wonderful christmas gift, or at least it might if the recipient really loved databases or if it was some other kind of program altogether. As it is, it probably wouldn’t make much of a Christmas gift. Socks or bottles of wine would be a better choice for almost anyone.

    Releasing SQLEditor isn’t the end of the situation though. Version 1.1 is already being planned and I’ve various other projects that I’m working on as well, but SQLEditor is first and will always be the first piece of software that I released for sale.

    Releasing software is complicated. In addition to the actual program, there is the distribution package, online help, the website, notifications to trackers like MacUpdate and Versiontracker, plus checking the online store is working correctly. Bad news with this release for anyone hoping for the pre-release discount. With the release of version 1.0 the offer expired.

    People keep talking about MacPAD but nothing seems to be happening at the moment, only MacShareware.net seems to be supporting it (which is logical, since the two are quite closely tied together). I’ve got a MacPAD file up now, but nothing much else. I haven’t integrated it with the release managment stuff I’ve written (a motley collection of php and make files with a bit of XML for good measure).

    If there was any market in it there is an interesting opportunity for a release management system (written perhaps in java?) that could generate everything automatically. Perhaps if I get really bored at some point I might do that.

    The next step is to write a press release and send it out today. Joy 🙁

    So, in conclusion, if you haven’t already tried SQLEditor, then version 1.0 will improve your life so much that you won’t know how you got by without it. Or at least might save some time when designing SQL databases.

  • Writing Documentation

    I’m currently in the middle of writing user documentation of SQLEditor. I finally settled on docbook as the format of choice since it seems the most compatible with other things.
    I’m using this tutorial to build the stuff although saxon has now made it into darwinports which is nice.
    http://www.boksa.de/tutorials/docbook_macosx.mpp