jerakeen.org

by Tom Insam

notes☴

code☷

links☲

photos☵

Programmable twitter clients

created 30 November 2009 in notes tagged programming and twitter.

Dave Winer wants a programmable twitter client.

Unix had a shell language. DOS had a batch language. Lotus 1-2-3 had its macro language. Emacs is a programming tool as much as it is a text editor. We have gotten out of the habit of making programmable end-user products, but they are still just as important today as they were a couple of decades ago.

What if there were a relatively simple and low-power programming language built into a Twitter client that allowed power users to build their own little apps on top of Twitter.

I have a few thoughts about this. Firstly, I think the reason lots of apps don’t bother packaging a programming language any more is that programming languages are better now. The DOS batch language is horrible compared to Python. Or even Perl.

Secondly, Twitter has an API. It’s a really really easy to use API. There are clients for it in lots of languages. A unfollow-for-24-hours app would not be difficult to just write.

But more importantly, I have a programmable twitter client. Shelf already asks Twitterrific about the currently displayed tweet so it could display other data about the user. I could do this because just about every application on my preferred platform is already programmable.

Python vs Ruby, slightly more in-depth « Rudimentary Art of Programming & Development

Python vs Ruby, slightly more in-depth « Rudimentary Art of Programming & Development

created 04 August 2009 in links tagged programming, python and ruby.

These languages are interchangeable, especially for building web application. Neither are more awesome. They get the job done and they make programmers happy,

Amen. via Marco.

http://rapd.wordpress.com/2009/07/13/python-vs-ruby-sligh...

The Small Stuff

created 11 June 2009 in talks tagged hate, javascript, perl, programming, python and ruby and is geotagged

A talk I gave at the BCS Evening of Dynamic Languages event, on some of the small, trivial, and therefore really annoying differences between the four programming languages I spend the most time using.

AppKiDo

AppKiDo

created 07 May 2009 in links tagged cocoa, macos and programming.

AppKiDo, one of my favourite Cocoa documentation reading tools, has an iPhone-specific version. Yay.

http://homepage.mac.com/aglee/downloads/appkido.html

Ruby / EventMachine

Ruby / EventMachine

created 12 February 2009 in links tagged eventmachine, programming and ruby.

Ruby equivalent (sort of) of Python’s Twisted, with the advantage that I actually understand what’s going on with this one. Hard to get it to build, though (needed to update rubygems, for reference). I’m thinking of playing with Jabber bots or something, and this seems like the sort of framework bots should be built on.

http://rubyeventmachine.com/

Warcraft guild achievements as RSS

created 10 February 2009 in notes tagged achievements, guild, programming, python, rss and warcraft.

I play World of Warcraft. Oh, the shame. But I play it because I’m in a fun guild - we do science!. Well, actually they do science. I’m still at the ‘cleaning the glassware afterwards’ stage, but a tauren can dream..

Anyway, I code. It’s what I do. So once WoLK came out and half the guild went completely insane and started chasing the really silly achievements, it was clear we were going to need an RSS feed of the things. So I built one. It’s based on the Armory, like most WoW tools, and is a complete kludge, like most of my tools. But here are my notes anyway.

The trick to scraping the Armoury is pretending to be Firefox. If you visit as a normal web browser, they serve you a traditional HTML page with some Ajax, and it’s all quite normal and boring. If you visit the armoury in firefox they return an XML document with an XSL stylesheet referenced in the header that transforms the XML into a web page. Why are they doing this? It must be a huge amount of work compared to just serving HTML, I don’t get it. Let’s ignore that. Fake a firefox user agent, and you can fetch lovely XML documents that describe things! There’s no ‘guild achievement’ page, alas, so let’s start by fetching the page that lists the people in the guild. Using Python.

import urllib, urllib2
opener = urllib2.build_opener()
# Pretend to be firefox
opener.addheaders = [ ('user-agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4') ]
url = "http://eu.wowarmory.com/guild-info.xml?r=%s&n=%s&p=1"%( urllib.quote(realm,''), urllib.quote(guild,'') )
req = urllib2.Request(url)
data = opener.open(req)

(This is the EU armoury, because that’s where I am). The armoury is a really unreliable site, so in practice I put lots more error handling round this. But error handling makes for very hard-to-read example code. The XML looks like this:

<page globalSearch="1" lang="en_us" requestUrl="/guild-info.xml">
  <guildKey factionId="1" name="unassigned variable" nameUrl="unassigned+variable" realm="Nordrassil" realmUrl="Nordrassil" url="r=Nordrassil&amp;n=unassigned+variable"/>
  <guildInfo>
    <guild>
      <members filterField="" filterValue="" maxPage="1" memberCount="66" page="1" sortDir="a">
        <character achPoints="2685" class="Hunter" classId="3" gender="Male" genderId="0" level="80" name="Munchausen" race="Tauren" raceId="6" rank="0" url="r=Nordrassil&amp;n=Munchausen"/>
        <character achPoints="1175" class="Paladin" classId="2" gender="Male" genderId="0" level="80" name="Jonadin" race="Blood Elf" raceId="10" rank="1" url="r=Nordrassil&amp;n=Jonadin"/>
        ...

I parse XML using xmltramp, because I’m very lazy and it works. I use xmltramp for all my XML parsing needs. It’s old, and there might be something better, but I don’t really care. This is a toy.

import xmltramp
xml = xmltramp.seed( data )
toons = xml['guildInfo']['guild']['members']['character':]

That gets us a list of people in the guild. The rendered web page has pagination, but the underlying XML seems to have all characters in a single document, so no messing around fetching multiple pages here. (I’ve tried this on a guild of 350ish people. Maybe it paginates beyond that. Don’t use this script on a guild that big, it won’t make you happy.)

Alas, the next thing we have to do is loop over every character and fetch their achievements page (that’s why you shouldn’t run this script over a large guild). This is extremely unpleasant and slow.

for character in toons:
    char_url = "http://eu.wowarmory.com/character-achievements.xml?r=%s&n=%s"%( urllib.quote(realm,''), urllib.quote(character('name'),'') )
    char_req = urllib2.Request(char_url)
    char_data = opener.open(char_req)
    char_xml = xmltramp.seed( char_data )

The achievement XML looks like this:

...
<achievement categoryId="168" dateCompleted="2009-02-08+01:00" desc="Defeat Shade of Eranikus." icon="inv_misc_coin_07" id="641" points="10" title="Sunken Temple"/>
<achievement categoryId="168" dateCompleted="2009-01-31+01:00" desc="Defeat the bosses in Gundrak." icon="achievement_dungeon_gundrak_normal" id="484" points="10" title="Gundrak"/>
<achievement categoryId="155" dateCompleted="2009-01-31+01:00" desc="Receive a Coin of Ancestry." icon="inv_misc_elvencoins" id="605" points="10" title="A Coin of Ancestry"/>
...

My biggest annoyance here is that there’s no timestamp on these things better than ‘day’, so you don’t get very good ordering when you combine them later. I could solve this by storing some state myself, remembering the first time I see each new entry, etc, etc, but I’m trying to avoid keeping any state here, so I don’t do that. The XML also lists only 5 achievements per character, and getting more involves fetching a lot more pages, so the final feed includes only the 5 most recent achievements per character. Again, something I could solve with local storage.

Anyway, now I have a list of everyone in the guild, and their last 5 achievements. It’s pretty trivial building a list of these and outputting Atom or something. I do it using ‘print’ statements, myself, because I’m inherently evil. You can’t deep-link to the achievement itself on the Armoury, so I link to the wowhead page for individual achievements.

Because the Armoury is unreliable, and my script is slow, I don’t use this thing to generate the feed on demand. I have a crontab call the script once an hour, and if it doesn’t explode, it copies the result into a directory served by my web browser. If it does explode, then meh, I’ll try again in an hour. The feed isn’t exactly timely, but we’re not controlling nuclear power stations here, we’re tracking a computer game. It’ll do.

The code I actually run to generate the feed can be found in my repository here, and the resulting feed (assuming you care, which you shouldn’t, you’re not in the guild..) is here. feel free to steal the code and do your own guild feeds.

Thinking of leaving the industry

Thinking of leaving the industry

created 21 January 2009 in links tagged downturn, joel, programming and whining.

Joel on programming as a career. > Despite the occasional idiot bosses and workplaces that forbid you from putting up dilbert cartoons on your cubicle walls, there’s no other industry where workers are treated so well. Jesus you’re spoiled, people. Do you know how many people in America go to jobs where you need permission to go to the bathroom?

http://discuss.joelonsoftware.com/default.asp?joel.3.7180...

Jinja2 Documentation

Jinja2 Documentation

created 16 January 2009 in links tagged jinja2, programming, python and templating.

This is the documentation for the Jinja2 general purpose templating language. Jinja2 is a library for Python 2.4 and onwards that is designed to be flexible, fast and secure

http://jinja.pocoo.org/2/documentation/

Mac Daddy World » Blog Archive » Adventures in Cocotron

Mac Daddy World » Blog Archive » Adventures in Cocotron

created 29 October 2008 in links tagged cocoa, development, porting, programming and windows.

The primary shortcoming of the Cocotron project may be the lack of a flagship product to drive the effort. It became apparent once we started the port, that the creators weren’t actively using it to create a shipping application

http://macdaddyworld.com/2008/10/27/adventures-in-cocotron/

Faking a message queue

Faking a message queue

created 10 October 2008 in notes tagged lazy, messages, programming and queue.

Right. Here’s an idea I want someone else to build, because I’m too lazy/busy. I want a Stomp interface to mysql.

Let me explain. There are lots of reasons you might want a message queue architecture in your new web application. You want long-running background processes, or you want to fan out changes to lots of users without tying up the web server process. Or you want to make calls to an API somewhere, again without tying up an expensive web server process. It’s a lot easier to build this stuff in from the beginning than to try to work out later which bits of your application flow don’t need to happen before the web page is returned to the user.

At the same time, it’s a tiny new web site. You don’t want to have to run a message queue just yet, so you want to fake it - write tasks into a database table, and have a long-running daemon loop forever, pulling out rows in order and doing them. Almost as good as a real message queue for small volumes of messages, and a lot cheaper. So what I want is a way of doing this that has the same API as a real message queue, so that when you cut over, you don’t have to change any code, everything just gets more responsive. Yay!

Right. Now someone do it. Let me know when you’re done.

blog.bjrn.se: Let’s build an MP3-decoder!

blog.bjrn.se: Let’s build an MP3-decoder!

created 02 October 2008 in links tagged decoder, mp3 and programming.

Nice guide on writing a (bad) mp3 decoder. Lovely low-level stuff that everyone should read. Reminds me a little of CypherSaber in that it’s something that I don’t ever need to do, but it’s nice to know how to do, or at least the basic principles.

http://blog.bjrn.se/2008/10/lets-build-mp3-decoder.html

The Continuous World of Dungeon Siege

The Continuous World of Dungeon Siege

created 27 August 2008 in links tagged dungeonsiege, games and programming.

Fascinating stuff about the techniques Dungeon Siege uses to power its continuous world. Includes scary threading, performance hacks, etc. via some other tab that’s long since been eaten by the ravages of time and system crashes (thank goodness for what little session saving Safari does) but I think I might have been tomc. (blech tells me it’s via Migurski’s uxweek notes )

http://www.drizzle.com/~scottb/gdc/continuous-world.htm

Revision 622: /code/obj-c/OAuthConsumer

Revision 622: /code/obj-c/OAuthConsumer

created 05 August 2008 in links tagged oauth, objectivec and programming.

an Objective-C oauth consumer library. For doing something with on the iPhone. Not sure what. Something.

http://oauth.googlecode.com/svn/code/obj-c/OAuthConsumer/

Practical threaded programming with Python

Practical threaded programming with Python

created 09 July 2008 in links tagged programming, python and threads.

http://www.ibm.com/developerworks/aix/library/au-threadin...

Cocoa Programming for Mac OS X

Cocoa Programming for Mac OS X

created 12 June 2008 in photos tagged book, cocoa, macos and programming.

Third Edition. Yay.

http://flickr.com/photos/jerakeen/2572118813

ElementTree Overview

ElementTree Overview

created 25 April 2008 in links tagged elementtree, programming, python and xml.

One of the better python XML libraries. Ships in core python.

http://effbot.org/zone/element-index.htm

Learning Ruby using Rails

created 16 November 2007 in blog tagged programming, python, rails and ruby.

Recently I got dropped in the deep end and had to learn both Ruby and Rails very quickly. I didn’t think this would be a problem - everyone raves about how easy Rails is to pick up, right? - and it wasn’t. The problem is actually arriving now, as I start trying to use Ruby for things other than Rails applications. And I can’t, because I’ve learned all sorts of nice Ruby tricks that looked like they were core language features but actually turn out to be added to the built-in Ruby objects by Rails.

For instance, I really like the 3.days convention for turning numbers into time intervals. That’s added by this extension. In fact, in digging for this, I found out just how many things Rails adds to core Ruby. I’m scared.

I’m torn. I’d like to consider messing with the built in objects confusing and dangerous. And I’ve been bitten by this before. I’ve also had problems where one module’s patching to a Ruby builtin interferes with another module’s patching of the same object. Lovely.

At the same time, though, I love it. I love both the huge convenience and readability of being able to write Time.now + 3.days, and the fact that the language lets me do this. All languages should be this consistent - none of this ‘some types are special’ crap.

There are trade-offs. I love Python, but I hate that map is a global function and not a method on arrays, and I hate that certain types are special and immutable. But I’m sure there are scary speed benefits from doing things this way.

I wonder if part of the reason that Ruby has this ‘just for Rails’ reputation is because, having learned Ruby for Rails, you can’t use that Ruby for anything else without unlearning a stack of habits?

Optional catch in JavaScript

created 26 July 2007 in blog tagged exceptions, javascript, programming, rhino and spidermonkey.

One of the things that’s been annoying me about JavaScript recently is the inability to only catch certain classes of exception, as in Java or Python, for instance. The try {..} catch(e) {..} block has always seemed too inclusive. But recently Ash found a crazy syntax in SpiderMonkey that lets us only catch certain exceptions.

try {
  // something that can throw
} catch(e if e.bar == 'foo') {
  // an error is only caught here if it has a 'bar' property of 'foo'
} catch(e if e.bar == 'baz') {
  // there can be different catches for different conditions
} catch (e) {
  // otherwise it's caught here. Without this block, the error would fall
  // through the 'try' and be re-thrown.
}

I haven’t bothered testing this in Internet Explorer (or any other web browser for that matter), because I’m only interested in server-side JavaScript execution at the moment. It works in at least recent SpiderMonkey CVS and Rhino 1.6r6, not sure about earlier versions.

mod_js - a JavaScript Apache module

created 09 July 2007 in code tagged apache, javascript, programming and spidermonkey.

mod_js is an Apache module written by Ash Berlin and I that embeds the SpiderMonkey JavaScript engine and lets you run JavaScript code on the server as CGI scripts. As you’d expect, it’s very early, but is good enough to compile scripts, run the JavaScript, and print the output to the client. mod_js is licensed under the GPL3.

Server-side JavaScript under Apache

created 09 July 2007 in blog tagged apache, javascript, programming and spidermonkey.

Ash Berlin and I recently hacked together an Apache module that embeds the SpiderMonkey JavaScript engine and lets you run JavaScript code on the server as CGI scripts. We called it mod_js.

the Blogger, Movable Type and MetaWeblog XMLRPC APIs

created 26 February 2007 in blog tagged cms, programming and xml.

There are 3 different XMLRPC APIs for editing blog posts. I really don’t like the Atom Publishing Protocol, but given the state of the alternative, I can see why other people do..

Yet more E4X irritations

created 30 January 2007 in blog tagged javascript and programming.

I’m finding E4X to be one of those weird technologies that is alternately utterly wonderful and incredibly irritating. The ability to treat XML data as any other JavaScript data structure allows very fast app development and messing around, but every so often I find myself amazed at how awful the syntax is.

Today’s irritation is about E4X attributes.

// a perfectly normal E4X object.
var myXML = <xml foo="bar">content</xml>;

// the attribute with value 'bar'
var myAttribute = myXML.@foo;

Easy. I love this stuff. Unfortunately, Zimki, my company’s product, uses uneval to store complex objects, and the myAttribute variable there would count. uneval won’t produce JSON but it does produce a string that, when run through eval, will probably produce the original data structure, and we store that string in a database to store object.

Not so for E4X nodes. Playing in the SpiderMonkey JS console,

js> uneval( myXML );
<xml foo="bar">content</xml>

js> uneval( myAttribute );
bar

The first one is fine. That string will eval nicely back to the original E4X object. But the ‘bar’ there isn’t valid JavaScript - eval won’t restore the original object. In fact, had the original XML been something like:

<xml foo="delete_all_zimki_data()">bar</xml>

and we’d tried to use eval/uneval to store this XML, we’d have executed the attribute as JavaScript. Ick.

Unusually, Rhino handles this much better (normally I find Rhino lags in features..):

js> uneval( myAttribute );
<>bar</>

Not really an attribute node any more, but at least it’s valid JavaScript and won’t destroy my server.

I don’t even have a good solution for this. Right now I’m fudging E4X nodes in the storage engine, but I really feel that attribute nodes should uneval to something a little more sensible. Perhaps I’ll be able to produce a patch to SpiderMonkey, if I have time..

LSL Wiki : HomePage

LSL Wiki : HomePage

created 21 November 2006 in links tagged lsl, programming and secondlife.

LSL wiki

http://lslwiki.com/lslwiki/wakka.php?wakka=HomePage

Cocoa Dev Central: Building Easy Sheets

Cocoa Dev Central: Building Easy Sheets

created 16 November 2006 in links tagged cocoa, programming and sheet.

sheets in cocoa. Because it’s not clear how to close them safely otherwise.

http://cocoadevcentral.com/articles/000014.php

Ignoring resource fork files files with subversion

created 31 October 2006 in blog tagged macos, programming and subversion.

If you’ve ever edited files over samba, or on a fat partition, using a mac, you’ll know that it scatters annoying ._foo.txt files all over the place when you save things. These files are the system’s way of compensating for these filesystems not supporting ‘real’ resource forks, and they’re a complete pain. I feel this pain especially when I’m trying to see what’s changed in a subversion checkout using svn st, and it produces 30 lines of ? ._foo.pl complaints.

Fortunately, subversion allows you to ignore this stuff. Edit the file ~/.subversion/config (which is created the first time you use the subversion client), and search for the ‘miscellany’ section. Uncomment the line [miscellany] if it’s not already, and also uncomment the line beginning global-ignores. This line is a list of glob patterns for files that should be ignored when doing a svn st, or svn add (if you svn add on a folder, it won’t add any backup files in the folder, for instance). Add the pattern ._* to the end of it, and your resource fork woes are over…

On “Strongly Typed” Languages

On "Strongly Typed" Languages

created 16 October 2006 in links tagged programming, strong and typing.

greatest. slide. evar.

http://perl.plover.com/yak/12views/samples/slide045.html

JavaScript Lint

JavaScript Lint

created 20 September 2006 in links tagged javascript, lint and programming.

Check JS code for silly errors - missing trailing semicolons, etc, etc. A nice idea.

http://www.javascriptlint.com/

CamelBones, an Objective-C/Perl bridge for Mac OS X & GNUStep - Release Notes - 1.0.0

CamelBones, an Objective-C/Perl bridge for Mac OS X & GNUStep - Release Notes - 1.0.0

created 11 July 2006 in links tagged cocoa, mac, perl and programming.

Camelbones 1.0. Congratulations to Sherm

http://camelbones.sourceforge.net/documentation/history/d...

GTK+ 2.0 Tree View Tutorial

GTK+ 2.0 Tree View Tutorial

created 10 June 2006 in links tagged gtk and programming.

I really hate the way that the GTK+2 tree view works. The amount of setup you have to do is scary. But then, I’m just too used to cocoa.

http://scentric.net/tutorial/

NodeBox

NodeBox

created 04 June 2006 in links tagged graphics, macos, programming and python.

things to play with when I get back to a desk that has a mac on it.

http://nodebox.net/

Nearly All Binary Searches and Mergesorts are Broken

Nearly All Binary Searches and Mergesorts are Broken

created 04 June 2006 in links tagged google, maths and programming.

[[ It is not sufficient merely to prove a program correct; you have to test it too ]]

http://googleresearch.blogspot.com/2006/06/extra-extra-re...

C# From a Java Developer’s Perspective

C# From a Java Developer's Perspective

created 25 May 2006 in links tagged c#, java and programming.

A comparison

http://www.25hoursaday.com/CsharpVsJava.html

isinstance() considered harmful

isinstance() considered harmful

created 25 May 2006 in links tagged programming and python.

python prefers objects to implement an interface, rather than forcing them to subclass things. This is most obvious to be when it comes to file objects, but it applies across the whole language. Perl does this to a much smaller extent, but you could also

http://www.canonical.org/~kragen/isinstance/

JavaScript strings - a followup

created 12 May 2006 in blog tagged javascript and programming.

Having played around with the JavaScript string type some more, I think I understand why it acts as it does. I’m a Perl monkey normally, so I’m not used to the concept of immutable strings, but JavaScript strings are immutable. Playing with the === operator (approximately, ‘is this the same object’) gives:

js> "a" === "a";
true
js> "a" + "b" === "ab";
true
js> "ab".replace(/./, "c") === "cb";
true

but

js> new String("a") === new String("a");
false

If strings were to magically upgrade themselves to objects, they’d change behaviour - previously equivalent strings would suddenly not be equivalent. Likewise, suppose this worked:

var a = "string";
var b = "string";
a === b; # true
a.foo = 1;

Shoud a still be equivalent to b? If not, a clearly isn’t immutable, as we’ve changed it. But if it is, then we’ve chanaged b at a distance - it’s grown a foo attribute.

Still all very annoying, of course, but I understand why now.

JavaScript string weirdness

created 29 April 2006 in blog tagged javascript and programming.

Recently, I mentioned a peculiar difference between uneval and toSource. Specifically (using the SpiderMonkey JS console):

js> uneval("");
""
js> "".toSource();
(new String(""))

"" and new String("") are different types of objects. The first is the basic string type, and only really has a value. The second is a full Object, that happens to have a value. However, it turns out that if you treat a basic string type as an Object, say by putting ‘.’ after it in an expression, the SpiderMonkey runtime will implicitly promote the string to a String. Hence, "".toSource() promotes the string object, then calls toSource on the new String object.

Annoyingly, the String Object doesn’t hang around, it’ll get thrown away as soon as you’re done with it. This leads to the weird case that you can set attributes on a basic string type (because it’ll get promoted to an Object, and Objects have attributes) but they don’t stay set (because the Object you’ve set them on gets thrown away as soon as the set call finishes).

By the way, all of this applies very specifically to the current CVS trunk SpiderMonkey. I don’t know what most web browser engines do with strings, so don’t assume this applies in, say, Internet Explorer. But I’d be interested if someone wants to find out and tell me…

uneval() does not produce JSON

created 22 April 2006 in blog tagged javascript and programming.

More playing with JSON and Spidermonkey has revealed yet another incredibly annoying fact (I hate those guys). Spidermonkey provides a lovely uneval() function, that does the exact opposite of eval() - turns JS objects into strings. It works on almost everything, and make life very very nice. There’s also Object.toSource() which does something similar (but not the same - try uneval("") vs "".toSource()).

But the strings that uneval produce are not valid JSON, as I have been assuming. I’ve been getting steadily more worked up at all the JSON parsers in the world, refusing to parse things that are clearly valid JavaScript, and eventually I go look at the spec, which fails to list ' as a valid string delimiter. And guess what delimiter uneval produces? Yay. So all the parsers are fine, and it’s just SpiderMonkey that’s broken.

Fortunately, Mochikit provides a nice serializeJSON() function.

Simon Wistow / Lingua-EN-Keywords-Yahoo-0.5 - search.cpan.org

Simon Wistow / Lingua-EN-Keywords-Yahoo-0.5 - search.cpan.org

created 22 January 2006 in links tagged extraction, keyword, programming and tags.

http://search.cpan.org/~simonw/Lingua-EN-Keywords-Yahoo-0.5/

Alice: Free, Easy, Interactive 3D Graphics for the WWW

Alice: Free, Easy, Interactive 3D Graphics for the WWW

created 22 January 2006 in links tagged graphics and programming.

http://www.alice.org/

Particletree · Quick Guide to Prototype

Particletree · Quick Guide to Prototype

created 30 November 2005 in links tagged development, javascript, programming, reference and web.

http://particletree.com/features/quick-guide-to-prototype/

Helpful Tiger: It Only Hurts When I Laugh

Helpful Tiger: It Only Hurts When I Laugh

created 28 November 2005 in links tagged development, pragmatism, programming and tests.

On test-driven development in the real world - [[ All these are ugly solutions, design-wise. And Feathers knows it; he makes multiple apologies for his techniques. But he stresses that they work. ]]

http://www.helpfultiger.com/helpfultiger/2005/11/it_only_...

NewsGator API Homepage

NewsGator API Homepage

created 27 November 2005 in links tagged blog, programming, reference, rss, web and xml.

http://www.newsgator.com/ngs/api/default.aspx

TrimPath JavaScript Templates Demo

TrimPath JavaScript Templates Demo

created 23 November 2005 in links tagged javascript, programming, template and web.

Javascript templating language. Completely insane.

http://trimpath.com/demos/test1/trimpath/template_demo.html

The London Perl Workshop 2005

The London Perl Workshop 2005

created 28 October 2005 in links tagged conference, london, lwp, perl, programming and workshop.

Yay. I liked last year’s

http://london.pm.org/pipermail/london.pm/Week-of-Mon-2005...

further notes on JSON

created 16 October 2005 in blog tagged javascript and programming.

Off I go, making random unsubstantiated claims about the danger of using JSON with non-ASCII characters. This called for a Test. So I wrote one. Visit my JavaScript unicode test page and see how your browser interprets external JavaScript files - I serve an ‘é’ using JavaScript to the page via 3 methods and 2 character set encodings, and try to render them all.

My conclusions from some limited testing? Owch. You can’t include a JavaScript file and expect the client to interpret it properly, unless you control both the server serving the JavaScript and the HTML page requesting it, and can make sure that they’re both in the same character set. Alternatively, you can escape all non-ascii characters in your JavaScript files using the \xXX or \uXXXX notations, which seems to work everywhere I’ve tried, but also seems like a pathetic work-around. Anyway, needing a work-around for only the non-obvious case means that no-one will actually do it, because no-one ever seems to bother testing with non-ASCII (see any on the JSON examples page, for instance?).

However, requesting JSON using XMLHTTPRequest seems to do the Right Thing in every browser I’ve tested, including those that include JavaScript wrongly. So if you’re using JSON as an RPC transport, instead of XML, for instance, it looks safe. From a character-set point of view.

The Programmer’s File Format Collection

The Programmer's File Format Collection

created 12 October 2005 in links tagged file, format and programming.

http://www.wotsit.org/

JSON

created 12 October 2005 in blog tagged javascript and programming.

In the bad old days of web 1.7ish, the cool thing to do for dynamic web applications was to generate HTML snippets on the server-side, pull them into your app using XMLHTTPRequest, and shove them bodily into a DIV on the page somewhere. “generating DOMs is hard” was the excuse, “the server already has a nice templating language”, etc, etc. And this was Good.

Nowadays, of course, this is Evil. Pulling HTML across the wire? It’s inefficient! Even worse, we want to send XHTML to the client, because it’s cool, but then you can’t treat your HTML like a string, you really do have to mess with DOMs. Fortunately, cute tools like MochiKit make it really easy to create DOM nodes, and provide really nice tools for making ajax requests. We see the rise of JSON - serializing your raw data on the server into a JavaScript-evaluatable string and sending that across the network, then building the DOM on the client side based on that data. And this is Good.

Soon, I expect, people will run up against annoyances in JSON. For instance, I bet there are lurking character set issues. It’s also not very portable - if I go to all the trouble of writing and exposing interesting functions of my web application in machine-readable ways, I’d like to be able to access this data using things other than javascript. Sure, there are modules like JSON that will both create and parse these things, but throwing actual XML around seems much neater to me.

We have a strange mix of XML and JSON APIs at the moment, some toolkits even making it easy to ask for either. But I consider XML far superior for this sort of thing, if only because the character set issues (my personal bugbear) are properly solved with XML. It’s disadvantage is that the JavaScript tools for dealing with the DOM are very annoying, but when we have something like XML::Simple or xmltramp for JS, and reading incoming XML is almost as easy as reading JSON, we can get rid of it and use nice sensible RPC mechanisms. JSB is a lovely example of this, for instance. And this will be Good.

-Ofun

-Ofun

created 09 October 2005 in links tagged philosophy and programming.

http://www.oreillynet.com/pub/wlg/7996

search.cpan.org: Perl::Review - Engine to critique Perl souce code

search.cpan.org: Perl::Review - Engine to critique Perl souce code

created 22 September 2005 in links tagged perl, pierre, programming and review.

http://search.cpan.org/~thaljef/Perl-Review-0.04/lib/Perl...

The State of Linux Graphics

The State of Linux Graphics

created 14 September 2005 in links tagged linux, programming, software and x11.

http://www.freedesktop.org/~jonsmirl/graphics.html

The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software

The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software

created 08 September 2005 in links tagged concurrency, cpu, programming and threading.

http://www.gotw.ca/publications/concurrency-ddj.htm

Rands In Repose: What To Do When You’re Screwed

Rands In Repose: What To Do When You're Screwed

created 19 August 2005 in links tagged management, programming and software.

http://www.randsinrepose.com/archives/2004/07/10/what_to_...

Unicode HOWTO

Unicode HOWTO

created 07 August 2005 in links tagged programming, python and unicode.

http://www.amk.ca/python/howto/unicode

Copia

Copia

created 06 August 2005 in links tagged programming, python and unicode.

http://copia.ogbuji.net/blog/2005/08/04#alt_unicod

Open Source ODBEditor

Open Source ODBEditor

created 30 July 2005 in links tagged cocoa, mac and programming.

http://gusmueller.com/odb/

Joel - Back to Basics

Joel - Back to Basics

created 09 October 2004 in links tagged fundamentals, joel and programming.

http://www.joelonsoftware.com/articles/fog0000000319.html

Joel - The Joel Test

Joel - The Joel Test

created 09 October 2004 in links tagged joel, programming and quality.

http://www.joelonsoftware.com/articles/fog0000000043.html

Joel - Why exceptions are bad

Joel - Why exceptions are bad

created 09 October 2004 in links tagged exceptions, joel and programming.

http://www.joelonsoftware.com/items/2003/10/13.html

More things I don’t like about Python

created 21 September 2004 in blog tagged programming and python.

I’ve played with python some more, and there are more things I don’t like about it.

For objects, attributes and methods are called with the exact same syntax, the ‘.’ character. So for an object ‘foo’, foo.bar is the attribute (member variable) ‘bar’ of foo, and foo.baz() is a function call on the method ‘baz’ of the foo object. But if a foo object has an attribute ‘bar’ and a method ‘bar’, foo.bar gets the attribute, and foo.bar() explodes, because an attribute isn’t a function. I don’t like that you can hide functions behind attributes.

More object stuff - there’s no abstract ‘call my superclass method’ calling convention. You have to either explicitly call a class method on your superclass (calling it by name, so changing your superclass would be Pain) and passing ‘self’ as the first parameter, or you use the magic ‘super’ method, which requires you to pass your class explicitly, also meaning Pain if you rename things. Hello? self.super? Sigh.

Incidentally, there are plenty of things about python I’m really liking - it’s not all pain. But people don’t blog about things that they like, they blog about things that annoy them. Human nature - deal with it.

programming languages

created 14 August 2004 in blog tagged programming.

Programming languages have grammar. There are languages like perl, where the grammar is composed almost entirely of random ‘$’ and ‘%’ symbols scattered throughout the code. And there’s languages like AppleScript, where the grammar is practically english, making it much nicer to read than perl. Hah, perl is often called a ‘write-only language’, it’s so incomprehensible.

But I loathe Applescript, and I think perl is luuurvely. And it’s for this exact rule. I can use computers. I’m a geek. And I’m prepared to learn a new grammar. That’s fine, and it’s a specialist grammar, and programming is like that, I’ve learnt a heap of these things. But english-like programming languages are confusing. I can speak english. I know how it works. In english, you can rearrange words and have the sentence still make sense. Try doing that in Applescript. Grammars that look like english, but aren’t actually english, annoy the hell out of me.