CommuterJoy » Logbook

« logbook home

Posted by mattc at Feb 28, 09 10:12 AM ... Comments (0)

I'm very busy at work. Things to launch, things to convice people about, blurgh...

Consequently most of my RSS reading that used to happen in quite moments during the office has had to be done during my 90 minute commute. I can bookmark to delicious from iPhone's Safari, but 3G is patchy, slow and Safari isn't a nice way to consume the Intenet when you are mobile unless you long for the days of 28kbp/s dial-up.

Newsgator, the RSS reader, solves this problem - fetching feeds, and sync'ing them across all my different devices, letting me read them without having to surf - but creates a new problem in that now most of my RSS reading is done this way my delicious feed is withering. Newsgator lets you bookmark things (they call it 'clippings') but the API to this is a bit rubbish.

I like delicious, it's plugged in to various other pieces of me - my social graph, this website etc. I don't think anyone really uses delicious as a bookmark tool (search wins over manual recall every time), it's just a link consumption log for people with bad memories.

To cut a long story short, I've had to grab my Newsgator feed, diff it against the previous days to extract the new posts, then cross-post these to delicious. Too much hassle, but at least my delicious feed is now representing my daily consumption again.

Posted by mattc at Feb 7, 09 12:21 PM ... Comments (0)

Matt kindly put our current project SVN logs in to code_swarm. We should add it to our project documentation.


project visualization with codeswarm from Matt Haynes on Vimeo.

Pretty amazing visualisation. It could do with a bit of curation to help explain key points/people ('who was Mike?', 'when was r0.1', 'why the big explosion of activity on Oct 20th?' etc.), a bit like the Python example on the code_swarm site.

Perhaps it could read & display some conventions from the log messages or release notes, but curation is quite a personal thing and only really doable to those with a intimate knowledge of the project, so here it goes...

Looking through our logs, mid-to-end of October marked the end of the technical prototype, where Al left and the project started in earnest with designers, flash developers, project managers all starting to make commits, which explains the flurry of activity.

Matt H, the main developer is a sort of persistant floating presence, he's joined by Darren in mid-November who replaced Al. Mike & Tom arrive for a few weeks then gradually fade away as they were contracted in to complete specialist parts of the build.

Pierre, the senior designer, fades out as the build goes on, indicating (in our department, at least) design is very much an up-front activity with lesser input the longer the project exists. As we start v2 of the project around April I'd expect the design activity to increase a lot more.

There's a nice long period of inactivity for xmas :)

The very tall lines in the histogram along the foot of the video are external dependencies (flex, phpdoc etc.) rather than huge commits by a single developer, otherwise they might indicate a developer has been saving up code on their working copy and committing it all at once, which of course would be naughty of them.

Peter B stays too long in the visualisation for my liking - he only committed once, and that was a mistake (we share our repository with the rest of the BBC) - so we should probably filter him out of our logs :)

I expect the project to settle down in to fortnightly bursts of activity to match our release pattern as we work toward a live release.

Posted by mattc at Dec 7, 08 07:11 PM ... Comments (0)

I noticed Opera have just shipped an alpha version of their next release that includes support for CSS3 web fonts, which amongst other things adds the ability to distribute fonts with your pages, TTF, OTF etc.

Most people use fonts to express the alphabet, punctuation etc. but typographers also ship some very pretty symbol typefaces known as dingbats.

Here's a demo of using an embedded dingbat typeface to add some bullet makers to a list via css3.

After setting up the font description,

@font-face {
  font-family: "Sarus";
  src: url("http://commuterjoy.co.uk/resources/ttf/sarus.ttf") format("truetype");
}

I can attach a letter to any node using the :before selector,

li:before {
 font-family: Sarus;
 font-size: 2em;
 content: "A";
 }

Then toggle the color & style of it using the :hover selector.

li:hover::before {
 color:red;
 content: "B";
 }

The best thing about native web fonts (unlike, say, image icons) is that they scale well and respond to standard CSS properties like 'color', 'font-weight', try upping the font size of the example.

Posted by mattc at Nov 18, 08 09:40 PM ... Comments (0)

I'm trying out Maven at work, it's not much fun.

It solves some of your problems quite neatly, like JAR dependencies. The subscriber concept works conceptually (ie. in Ant terms, targets listen out for standardised events rather than having to chain them together), but all the documentation I've read explains things in such a roundabout way that it just confuses matters. Here's a helpful quote from the O'Reilly Maven book (page 182),

The interesting phase in the clean lifecycle is the clean phase. The Clean plugin's clean goal (clean:clean) is bound to the clean phase in the clean lifecycle. The clean:clean goal deletes the output of a build by deleting the build directory.

Got that? Rather than,

<target name="clean">
 <delete dir="${build.dir}"/>
<target>

One good thing: Maven has a published XSD, which I don't think Ant has ever bothered with.

Maybe I'll get it in a week or two.

Posted by mattc at Nov 10, 08 10:13 PM ... Comments (0)

I copied what Paul did.

It's ok for browser testing, I guess you want to build a custom image with your favourite browsers rather than the off-the-shelf one. My main exploration is to see if I can use it to host an instance of Selenium RC to which I can point our CI server, otherwise we'll have to continue to use a bespoke underthedesktm solution.

Posted by mattc at Jul 7, 08 06:18 PM ... Comments (0)

It would be nicer if RegExp objects assigned the mismatched portions of the test string to an array in a similar fashion to which they store portions of successful pattern matches.

 var foo = /^[a-z]+$/;
 foo.exec("34asdf"); // returns null

So, the developer knows the input string ('34asdf') is invalid but not why. It would much more useful to the calling method to know the specifics of why the string didn't match the pattern and, say, in the cases of interfaces and web forms be able to communicate with precision to the user the reason why their input has failed not just that it has.

Eg. Given the regex test above, it would be useful to be able to look up a failure property that has been populated as a result of the test,

 foo.failures = [ "substring '3' found at position 1, expected '[a-z]'", ... ];

I'm not aware of any language that implements regex's doing something like this. In JS you'd have to either throw away your regex pattern and write a lot of custom substring checking functions or split your regex in to multiple parts, but by doing this you lose some of their concise beauty.

Posted by mattc at May 28, 08 01:13 PM ... Comments (0)

If you wanted to make a tarball but you have a bunch of .svn directories stuffing up the place this will make the tar.gz but exclude hidden directories,

tar -c --exclude '.*' -f - ~root/ | gzip > /tmp/foo.tar.gz

Posted by mattc at May 21, 08 09:37 AM ... Comments (0)

I feel a bit dumb for only having just discovered the patch command.

My local file system is full of copies of bits of code that have gradually morphed from what I set out to do to what I ended up with, a path strewn with fruitless (but brave, nonetheless!) diversions. Using Subversion does solve the problem managing ever changing files over time it's pretty bothersome to keep jumping around the revision history in your local working copy or even attempting to compare and run multiple versions of the same file at the same time. Even remembering which revision does what is a bit of a struggle unless you've got a good commit message convention.

I think patch can make this easier by allowing you to store your experiments from the main trunk code as a little library of diff snippets.

Eg.

Let's say you have a JavaScript file called 'original',

-- original --
// returns a charArray of a string
String.prototype.toCharArray = function(){
        var a = this.split("");
        return a;
}

If you copied the above file and added an experiment to it you might end up with this,

-- new --
// returns a charArray of a string
String.prototype.toCharArray = function(){
        if ( this.length == 0 ) // don't want empty arrays
                return false;
        var a = this.split("");
        return a;
}

You can now diff the two files and store the result as a patch file ...

diff orginal new > lengthcheck.patch

... the contents of which looks something like this,

-- lengthcheck.patch --
2a3,4
>       if ( this.length == 0 ) // don't want empty arrays
>               return false;

At some later date you can patch your code with following command.

patch -b orginal lengthcheck.patch

The -b switch makes a backup of your code. Patch will prompt you if it finds a problem and store any rejected patches in a seperate file for you to inspect.

The idea being that in the course of, say, a 2 day hacking session, you can keep the core code in your SVN trunk directory while the deviations, for better or worse, can be stored in a library of diff's that you can periodically merge in and out of your mainline development.


Posted by mattc at May 15, 08 12:48 PM ... Comments (0)

I think I might learn how to do things in Python, sysadmin tasks, mini web apps and the like.

I've come to know a healthy amount about Perl in the past few years, mainly due to it being the only language officially supported at work, but it has some things I've not really got on with.

It's error handling is a bit rubbish if you are used to the try/catch/throw style of some other languages. Errors in Perl are mostly handled by adding conditionals around (or on the end of) a bunch of statements.

# if there's a problem opening 'foo.txt' then exit with the error
open( file, 'foo.txt'  ) or die $!;

The OO stuff in Perl feels a bit contrived and it's easy to cheat or pick up bad habits. Some of Perl's basic functions remain resolute in their non-OOness...

# adding an item to an array, passing the array as an argument to the push functin
my @foo = ("a", "b", "c");
push(@foo, "d");

The feeling of tacked-on OO also manifests itself in calling a classes methods. You have to remember to pluck the object out from an implied argument before operating on it. Normally you'd expect to be able to use a 'this'-like reference without having to manage this sort of low-level stuff yourself.

# if foo was a method of some class, $class would hold a reference to the calling object.
sub foo{
 my $class = @_;
}

Perhaps the main reason I don't want to keep using Perl is that it hasn't seemed to introduce much of interest to the language over the 4 or 5 years since I've known it. Most other languages I know have had pretty significant upgrades and improvements in that time (XSLT, JavaScript ...). In that time Perl has had a few minor version number patches but I can't see anything to motivate a casual user like myself to upgrade so I just stick with whatever is on the box I'm using.

Maybe Python won't do these things any better, but I won't know until I try.

Updated

I forgot one other thing. Because I don't write Perl every day I find it a real struggle to remember the specifics of the often dense and syntax. For example to get the length of an array you need to remember the $# convention, which you eventually remember after the first few times, but something like '[array].length' would be more obvious. There's lots of little ticks like this $_ (implied variable), $! (error message), @_ (arguments to an subroutine) that you don't use so often as a casual developer and have to scout around to trigger your memory...

# assign the length of array 'foo' to $a
my $a = $#foo;

Posted by mattc at May 1, 08 03:36 PM ... Comments (0)

"Cannot write an implicit result document if an explicit result document has been written to the same URI: file:/path/to/my/file.xml" at net.sf.saxon.Controller.checkImplicitResultTree

Odd error of the week. Ant (or Saxon) seems to run over everything in the basedir twice, and at the second pass creates the above error message. I'm using the following to run the transforms over an directory of xml documents,

<xslt basedir="${project.trunk}/xml/"
 destdir="${project.home}www/"
 extension=".xml"
 style="${project.home}/xsl/foo.xsl"
 classpath="${ant.lib}/saxon9.jar;${ant.lib}/ant-trax.jar"
 processor="trax"
 force="true"
 >
 <param name="foo" expression="hello world"/>
</xslt>

I fixed it by adding a include directive (xslt supports implict filesets) as a child of the xslt task.

<include name="**/*.xml"/>

Posted by mattc at Apr 23, 08 01:33 PM ... Comments (0)

Find all the *.as files in the src folder and print every line that isn't just whitespace characters (spaces, tabs etc.)

find ./src -name *.as -print -exec grep -Rv ^[[:space:]]*$ {} \; | wc -l

Useful for counting lines-of-code.

Posted by mattc at Apr 14, 08 03:14 PM ... Comments (0)

Using Ant 1.7 on OSX 1.4 with commons-net-1.4.1.jar in my lib path and the built in FTP task behind our work firewall when I get the following message:

java.net.SocketException: SOCKS: Connection not allowed by ruleset

I fixed it by adding the full address of our firewall to the 'Bypass proxy settings ...' list in the System Preferences -> Network -> Connection Type -> Proxies.

Posted by mattc at Dec 7, 07 01:28 PM ... Comments (0)

find . -name *.xml -exec xmllint --noout {} \; 2> foo.txt

Validate a folder of xml files, write errors to foo.txt

Posted by mattc at Aug 28, 07 05:01 PM ... Comments (0)

I'm looking for a file in the repository that I know was there at some point in the last 6 months but it got deleted or moved somewhere or other and I can't remember where. I can remember a bit of the file name.

One method that worked for me was trawling through the SVN logs.

svn -v log ./trunk/path/to/dir | grep -C 3 "text to look for"

Turning on verbose mode ( -v ) prints the commit message as well as details about the files. Grepping this with about 3 lines of context (or more if you want) seems to find me my file.

I don't know if it's possible to grep through the contents of delete SVN files without writing a shell script.

Posted by mattc at Jun 17, 07 02:10 PM ... Comments (2)

Although I was unable to turn up on the Sunday, I thought I would tidy up a couple of hours worth of Saturday's hacking effort in to something functional.

The idea, entitled A Cloud of Teenage Angst, experiments with a way of nesting tag clouds (aka. weighted lists) inside each other to clarify the meaning of the terms.

screenshot

It uses the data from the weekly BBC Slink agony aunt column.

The main cloud is formed from the keywords that the BBC editorial team have associated with each column. Selecting a term in this cloud will result in a mini-cloud being inserted in to the document comprising of a frequency analysis of words in all agony columns containing the parent term.

Because the words most often used in free text tend to be the canonical ones (rather than slang, abbreviations etc.) we can create a fairly accurate nested cloud that better describes unfamiliar, abstract, or duplicte entries in the main cloud.

Would be interested in trying this on bigger sets of data.

random bookmark
link summary month October 2009 (1)
September 2009 (14)
August 2009 (16)
July 2009 (21)
June 2009 (24)
May 2009 (16)
April 2009 (2)
March 2009 (22)
February 2009 (11)
January 2009 (11)
December 2008 (9)
November 2008 (16)
October 2008 (18)
September 2008 (11)
August 2008 (12)
July 2008 (20)
June 2008 (15)
May 2008 (27)
April 2008 (9)
March 2008 (10)
February 2008 (8)
January 2008 (8)
December 2007 (12)
November 2007 (10)
October 2007 (10)
September 2007 (6)
August 2007 (13)
July 2007 (8)
June 2007 (10)
May 2007 (12)
April 2007 (5)
March 2007 (12)
February 2007 (13)
January 2007 (22)
December 2006 (21)
November 2006 (28)
August 2006 (1)
category code (15)
food (4)
notes (4)
photo (18)
project (2)
quote (12)
sketch (13)
soup (10)
travel (2)