toxicsoftware.com

RANDOMIZE USR 0

toxicsoftware.com header image 1

WWDC 08

June 7th, 2008 · No Comments · Default

Off to WWDC in a few hours. I’ve updated my contact page with my mobile phone number in case anyone wants to get ahold of me directly.

I’m going to try attending most of the events conveniently compiled here by iPhoneDevCamp. Hope to see to see you there.

→ No CommentsTags:···

iPhone Development

March 10th, 2008 · 9 Comments · Default

I don’t need to say too much about the iPhone and the newly released SDK. I have however created a Google source code repository for iPhone/Cocoa Touch related projects.

So far I’ve added three projects to the repository:

  • TouchXML: A Foundation NSXML style API for parsing XML files (based on libxml2)

  • TouchSQL: Yet another library for talking to sqlite databases. This is actually old code that I’m bringing up to date for 10.5, the iPhone and objc-2.0

  • TouchJSON: My [CocoaJSON] project brought up to date.

I’m trying to add Unit Tests and documentation to all three projects so they’ll be suitable for public consumption.

Tim Burks has also graciously added nu makefiles and unit tests for each project too. Thanks Tim.

Oh and…

Yes I am potentially interested in iPhone related consulting work. jwight@mac.com

→ 9 CommentsTags:·····

AcornImage

February 19th, 2008 · 7 Comments · Default

It was just your typical InterfaceBuilder 3 window…

AcornImageIB3.png

with your vanilla NSImageView…

AcornImageView.png

referring to an image file within an Xcode project…

AcornInXcode.png

Holy Cow! An Acorn file? Does that mean I can use Acorn files directly in Interface Builder 3? Does that mean you’ve written an NSCustomImageRep that understands the Acorn file format? Does that mean I can use Acorn files directly in my Cocoa projects? And that means I no longer have to keep exporting these bloody files as pngs so I can use them in Cocoa, right? Will this give rixstep some ammunition to go apeshit insane about?

Yes! Yes!! Yes!!! Yes!!!! Yes!!!!! Almost certainly.

Not only does Gus Mueller generously provide details about the Acorn file format, he has even released the source code to his Acorn Quicklook plugin. This gives me everything I need to convince NSImage to load Acorn files.

You might well be asking yourself why. I was getting annoyed with having to constantly keep exporting original Acorn images as pngs or TIFFs so I could use them in Xcode. I’m prototyping a new application that uses a lot of custom UI elements. These elements are made up of one or more pngs, some of which needed a lot of tweaking and attention to detail to get right. Acorn is perfect for UI work (although it needs more than 2000% zoom! cough) but having to export as png (or another format that Cocoa understands natively) and manage two sets of images (original Acorn, exported png) was turning into a pain.

I’ve taken Gus’ QuickLook code and wrapped a small NSCustomImageRep around it. Very small. I’ve repackaged it up as a Framework so you can refer to it from an Interface Builder 3 plugin. This gives you the ability to do this:

[NSImage imageNamed:@"IAmAnAcornFile"];

You should be able to use Acorn files anywhere an NSImage is used. Just embed your Acorn files in your XCode project resources and refer to them by name in your NIBs or in code.

I’ve put the code on my public googlecode.com subversion repository.

I’m currently on the fence about whether it is a good idea or not to ship your application with Acorn images. It certainly makes sense to me to use them during the interface design stage of application development. Once the user interface churn settles down I should be able to finalize the images and convert them to pngs or whatever (keeping the originals of course).

A best of both worlds solution might be to make a little command line tool that can convert Acorn files:

#!/usr/bin/python
from AcornImage import *
# Everything else is an exercise for the reader.

And then automatically convert from Acorn to whatever during the Xcode build process. I might investigate this technique at a later date. But for now - have at it.

→ 7 CommentsTags:····

Making Mercurial use the Mac OS X Keychain

February 13th, 2008 · 5 Comments · Default

I’ve taken the plunge and am in the middle of switching from Subversion to Mercurial for revision control. Subversion has served me relatively faithfully for many years (I’ve even championed/led the adoption of subversion at two companies I’ve worked for in the past) but some of the warts and shortcomings were beginning to annoy me (. directories everywhere for example). Dave Dribin’s series of posts about the Mercurial DVCS software piqued my interest and I was soon switching repositories to hg.

One feature that added recently that hg lacked was the ability to store repository passwords in the Mac OS X keychain. In fact mercurial lacks the ability to store a repository password anywhere other than in the url used to access the repository (i.e. http://user:password@example.com/path). I think this is a bit of security flaw. The password is stored as plain text within the repository config file (’.hg/hgrc’) file.

Fortunately Mercurial provides a simple interface for extension modules. After a little bit of hacking I was able to write an hg extension that stores and retrieves the password from the keychain. I’ve put the code online for anyone to use. hgkeychain:

And yes the source code is currently hosted in a Subversion repository :-) I did mention I’m in the middle of transitioning to Mercurial didn’t I?

→ 5 CommentsTags:·····

Run Python Script: Amazon S3 Uploader

December 14th, 2007 · 4 Comments · Default

To help illustrate the usefulness of the “Run Python Script” Automator Action I blogged about in my previous post, here’s an action that will upload files to the Amazon S3 Web Service. The script is pure Python and uses the extremely cool boto Python module to interact with Amazon web services. The script is really a sample of what could be done with The Run Python Script action, but I think it really shows off how the action helps to turn Automator into a great tool for interacting with Web Services.

Amazon S3 Uploader Automator Action

→ 4 CommentsTags:·····

Run Python Script

December 14th, 2007 · 13 Comments · Default

I’ve written an Automator action that allows you to write python scripts directly inside your Automator workflow.

RunPythonScriptIcon

Run Python Script” Automator action (catchy title) is written using Python and PyObjC (now built-in to Mac OS X 10.5). Apple already provides “Run AppleScript” and “Run Shell Script” actions with Automator which give Automator a high degree of flexibility. However Python is my preferred scripting language and by writing a custom action purely for Python I was able to take advantage of some PyObjC features that in my opinion make my action superior to the provided Apple scripting action. I’m releasing all the source code to the action under the BSD Open Source license.

One of the main advantages of the action is that Python (with the help of PyObjC) understands the AppleEvent descriptors that Automator uses to pass data between workflow actions. This allows the user to create a custom action that accepts and provides data of any type. In contrast Apple’s “Run Shell Script” action can only accept and provide text (usually limited to file paths). Some work does need to be done to make working with any data (which is represented by NSAppleEventDescriptor objects) more convenient.

The default Python script for a new action in a workflow follows:

import sys

def main(input, *args, **kwargs):
    '''Your script goes here.'''
    print 'Hello world'
    return sys.stdout

RunPythonScriptMain

This is pretty simple. The action will optionally convert the input into Python types (currently limited to converting typeAlias AppleEvent descriptors into path strings) to allow simple processing. Output is (optionally) converted from Python types to native Automator types. See the Examples directory for more.

The following screenshot shows the action used in a real workflow. This workflow asks the user for a keyword and then the Python action downloads photos from the morguefile public stock photo archive that are related to the keyword. Once download it performs some processing on the files (scales them to 640 by 480) and produces a PDF “Contact Book” from the images.

RunPythonScriptScreenshot

The source code uses a 10.5 specific technique to create Python based bundles. It also has a simple Python syntax colouring NSTextView (using Python itself to colourise the source).

I’m calling the Action a 0.1 release and have some plans/ideas for further releases. See the TODO list.

Update: I’ve added a sample script showing how to upload files to Amazon S3 from within a workflow.

The code in subversion is a lot newer than the binary I’m linking to. If possible do a checkout and build the plugin yourself.

→ 13 CommentsTags:·····

A Special Kind Of Idiot

November 22nd, 2007 · 28 Comments · Default

This Thanksgiving I truly have something to be thankful for. It isn’t my Wife, my home, my family, my friends, my health or my business. Although I am thankful for all those things. What I’m most thankful for this Thanksgiving is: I got me a stalker!!!

Yep. I’ve got my very own nutjob on the internet who has decided he is going to go out of his way to fling poo at me! Seems like I did something to offend the, dare I say infamous, Rick Downes.

OK. I must admit when they were handing out the stalkers I wasn’t at the front of the queue. No Glenn Close (when she was still pretty darn hot) style femme fatales are after me alas. Instead I get some bitter, semi-retired Swedish geek who has oddly decided that I needed to be brought to task, for whatever it is I did to get his goat.

So who is this Rick Downes character? From his own site: “Rick Downes is an internationally acclaimed and respected computer scientist, long specialising in taking care of the ‘common man’ and in defending the rights of the common man against corporate and political abuses of power.” Go on, google him now, it should be easy to find some positive information on this person for who hundreds of thousands of individuals worldwide know and well respect”.

Rick, who has a extraordinary fondness for using ©, ® and ™ symbols for ironic emphasis, apparently runs a software company in Cyprus where he likes to release poetry inspiring Mac OS X software (if you only follow one link from this blog post follow that one), has been arrested for commercial spamming and drug trafficking and has absolutely nothing positive to say about other people’s Mac OS X software.

Apparently I am in good company. Rick isn’t frugal with his diatribes against, well apparently lots of things. Rick dislikes a whole lot of things. And people. And software. And TIFF files. Rick especially dislikes TIFF files. Oh and bloat. He really doesn’t like bloat.

And what does Rick say about things he doesn’t like? Why, you get your very own page on rixstep.com where Rick will lay into you about how un-optimised your TIFF files are. He might even accuse of you of being a Texan (yes, really he believes someone who spells optimise with an S is Texan)! Or maybe he’ll call you a tool. Or try to disparage the work you’re doing helping to teach technology to children.

Rick seems to think he can use the internet and his professional web-site to attack whatever it is he doesn’t like. Generally he limits his attacks to software but occasionally he decides individuals are fair game. Unfortunately for Rick these attacks have done nothing more than turn him into a laughing stock amongst the developer community.

So what did I do to deserve the wrath of such a vengeful spirit? Well I participated in the comment thread of a blog post about software optimisation (yes, that blog post). That’s all it takes to unleash the bile and slobbering attacks. I may have also referred to Rick as a “911 conspiracy theory-level fucking nutter.” My bad. But then in my defence I was linking to this posting of Rick’s where he seems to go slightly off the rails about some conspiracy of the imaginary elite Mac developers, the so called Landed Gentry of Mac Development™ (note that the United States Patent and Trademark Office doesn’t seem to have that trademark on file yet, I can only assume the application is in the mail).

Rick started on me gently, merely (and quite randomly I might point out) mentioning me in his totally unbiased review of MarsEdit, calling me an “insufferable blogger”, amongst other things. I emailed Rick at this point to see if we could resolve this seemingly bizarre issue. But the chances are that my e-mail got deleted by his rather paranoid email filters (for a company that claims to pride itself on serving the customer I find it odd that e-mail from such large providers as gmail and mac.com are summarily discarded).

But then the big guns came out. Rick devoted a whole blog post to just me, or rather to “Johnathan Right” (a misspelling I can only assume Rick is intentionally making to be just that extra bit juvenile), linking to it from his Industry Watch page (yes really, slagging off a fellow developer is considered “Industry Watch”).

In the blog post Rick posts select quotes from a what was believed to be private conversation between myself and a 3rd party. Not quite sure what this has to do with, well anything really, but when someone takes the time and energy to write a whole blog post trying to character assassinate someone, rationality isn’t a priority. For some reason Rick seems to think a comparison between his qualifications and mine are in order. Bizarre! Batshit insane bizarre? Well go read the blog post. You be the judge. And of course Rick dredges up two applications that have long since been abandoned. Rick is nothing if not swift. By the way, Rick, have you ever considered abandoning some of your apps? Funny Haiku’s aside, some of your apps could really do with being taken out back and put out of their misery.

The funniest quote of the whole bizarre episode is “Ah Texas boy. We can relax. Texas has produced some ace programmers over the years. Like George Walker Bush.” Ignoring the half-arsed attempt at a Bush joke, Rick obviously spent 2 minutes searching my blog trying to find more mud to sling. And the best he could come up with is that I’m a Texan. Which of course, just happens not to be where I’m from at all.

I thought the Mac developer community had some oddballs in it before. But Rick totally takes the cake. A Mac software publisher whose catalog is so awful that there exists Haiku extolling their awfulness. A blogger who takes great pride in picking apart apps and slurring the developers of said apps with insults and ad-hominem attacks. Encouraging script-kiddies to deface websites. And let’s not forget the spamming and drug trafficking arrests.

So while I’m disappointed that my stalker isn’t a leggy blonde unafraid to do cruel things to bunnies, I must admit that as nutjobs go I think I’ve attracted one of timecubesque magnitude.

Of course I’ve committed the the biggest blunder on the internet: “Do not feed the trolls!”. Guilty I’m afraid. But maybe someone will hit this page while googling for Rick and realise what kind of person he is.

→ 28 CommentsTags:·

What’s in a name?

November 22nd, 2007 · 3 Comments · Default

You’d think that a rather uncommon last name like “Wight” would be a relatively easy name for others to spell correctly. It is uncommon enough that I’ve never met any other Wights outside of “my family“. And yet people seem to have trouble with it. People seem to think that it should be spelled more conventionally as “White”, or maybe with an extra “R” as “Wright”, or they wrongly spell it “Right”.

As anyone with a rather uncommon name can probably attest to, you just have to get used to people spelling or pronouncing your name incorrectly. Of course you can do your best to correct mistakes; back home I used to always say “Like the Isle of Wight” to help prevent error, but here in the USA that isn’t really so useful. My wife still gets annoyed at people spelling her last name incorrectly, but I’ve long gotten past that. Most people are happy to fix their errors when corrected and rarely make the same mistake more than once.

And of course there is occasional humour in someone intentionally misspelling or mispronouncing your name. Being referred to as “Jonathan Widget” never gets old. No really, it never gets old. Honest.

And still there are a plethora of alternative spellings for Jonathan too (all of them inferior of course) with “Jonathon” and “Johnathan” being perhaps the most common alternatives. But of course you pick your battles.

You’d think on the internet these mistakes would be less common. You certainly can’t blame these mistakes on mishearing the name. Generally the name is there, in ASCII form for you to see (or copy & paste), clear as day. But of course mistakes happen. On more than one occasion I have been confused online with Jonathan Wright, apparently an AI programmer at id Software. I would to think that Jonathan Wright has been mistaken for me in return. During a recent interview about Ironcoder I was quoted as “Jason Wright”, go figure.

It would take a special kind of Internet idiot to misspell a name more than say, a dozen times…

→ 3 CommentsTags:·

R.I.P Toxic Progress Indicator

October 30th, 2007 · 2 Comments · Default

Thanks to Matt Gemmell for pointing out that Apple has finally provided a pie chart style NSProgressIndicator for the circular/determinate modes. This style is new to Leopard. This means my Toxic Progress Indicator class can be retired, at least for 10.5+ only applications. Leopard has really helped to retire a lot of my code (for example my QuickTime Sequence Grabber code can probably be retired too) and I expect this trend to continue.

Toxic Progress Indicator should still be used on apps that need to run on 10.4, but I wont be supporting the class any more (not that it is really needed any support…)

CocoaPieChart.png

→ 2 CommentsTags:···

Ironcoder NEEDS You!

October 16th, 2007 · Comments Off · Default

needs you.jpg

Ask not what Ironcoder can do for you…

Comments OffTags:·