Thinking

March 31st, 2009

Ray Drainville

Are HDR images the new velvet paintings?

Nick Rutherford

The DNS Problem

If you own an Apple Airport device or Timecapsule you may have come across the issue of it (unlike similar products from DLink and other specialists) not having an inbuilt DNS service hooked up to the DHCP requests (i.e. being able to resolve local computer names to lan ips the same way you might resolve a website to an ip address, by DNS).

This annoyed me greatly yesterday. Today Ray reminded me of Bonjour, Zeroconf, whatever you want to call it. This tech reminds me of the old windows networking protocol. It may be completely different, but it's amusing to see an abhorred concept coming back again.

Problems have solutions you know

Things worked one way out of the box (8.10), I was able to use ssh hostname.local from Ubuntu to my Mac right off. This is nice as with a default and a public key exchange this is a seamless remote login process.

The other way was not working, but not far out of reach. On my install avahi-demon was already present with the zeroconf plugin, both configured and running, it just didn't have anything to shout about.

This forum thread is recent and works, which is more than can be said for the Ubuntu documentation page for this particular subject.

A template ssh broadcast file is provided with the avahi install. Template so far as you can just copy-paste it into position and ssh will start being broadcast on the network.

sudo cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services

sudo /etc/init.d/avahi-daemon restart

Service Browsing Apps

iStumbler comes with a Bonjour plugin, so you can use it to monitor what's available on your network visually.

For Gnome there is an application "Service Discovery Applet" available via Synaptic (which you can then add by right clicking the menu bar/panel, add, browse down to zeroconf discovery).

Playing on a Grid

March 25th, 2009

Nick Rutherford

For my dissertation I'm working on a genetic algorithm solution to the guitar fingering problem. It's got just under 2 months to run now, and it's time to start wrapping it up.

Part of the process is getting results and evaluating them. I have running code now so it's time to start putting it through its paces.

The department provides students with access to a 'grid' computing setup, which is basically a batch processing system you access by ssh.

Unfortunately it's not a parallel architecture, but not having to play with threads is probably a good thing for me as they aren't something I am familiar with. The task I am addressing is very parallel, a favourite analogy of mine being natural selection occurring on a number of islands and the fittest individuals occasionally migrating between islands. Batch processing is sufficient to get similar effects, and I'll be toying with some ideas for that over the next week or two.

I thought I'd share some scripts and terminal output since they are pretty short and it's not something most people come across.

Scripting your application

Getting things running is deceptively simple. Make a script to run your program, I'm hoping to use Ruby later but went with (Ba)sh for now.

bash-3.2$ cat ./run_fingar
cd fingar
java -Xmx2g nruth.fingar.Run pop=400000 gens=500

The JRE arg is to set the maximum heap size to 2GB, rather than the default 128MB (though it should auto-configure itself to be higher because of something called Ergonomics that went into Java 5). Yes I do need that much memory, it's that kind of application. The grid notes have 3GB available so they can handle this, which is a bonus as it means I can increase population sizes greatly and see how they compare to smaller ones, and various other settings.

I/O

This is trivial really, write an app that uses Stdio and Stderr and when you run the job they will get piped into a specified log file. Mine just sit in the home directory for now. I will be changing that (with ruby, along with the rest of the statistical analysis scripting) to name by date, run parameters, code git revision, etc.

Submitting your job

Once I ssh into the distribution mechanism/scheduler I get presented with the usual home directory and terminal for my network account. There is a script to run which bolts on the grid commands I need, so I've made a wrapper for this & executing the above script to run my code. It's not ideal as I have to do this again to use qstat and so on, but that's just terminal script hackery and I am sure there is a work around (for example I have another script using source to load the settings into bash without having to look up the path every time).

bash-3.2$ cat ./run_fingar_et
#!/bin/bash
. /data/sungrid/default/common/settings.sh
qsub -cwd -l qp=LOW -P Basic -j y -o et_log run_fingar

qsub is the scheduling script for the grid, the parameters mean something along the lines of use the current working directory, queue priority low, basic profile (i.e. plebs not academics), pipe stdio stderr to et_log, and finally the command to run.

Watching and waiting

Once you submit there is a command qstat which will show you all the jobs you have pending, which is handy, as you know whether the results are ready or not.

bash-3.2$ ./run_fingar_et
Your job 7484 ("run_fingar") has been submitted
bash-3.2$ qstat
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
   7484 0.00000 run_fingar   **ntr       qw    03/24/2009 23:08:29                                    1        
bash-3.2$ qstat
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
   7484 0.56000 run_fingar   **ntr       r     03/24/2009 23:08:43 LOW.q@car2.expresstrain.dcs        1

I'm currently waiting for a more ambitious run to complete,

SimpleHandPositionModelGAEvolver: 
population size: 400000
locus crossover likelihood: 0.16
allele mutation likelihood: 0.02
generation 1 of 500

I started running into memory issues at 100k with the JRE defaults, so it'll be interesting to see how this goes. It's been running for an hour so far…

Designing a Font

March 23rd, 2009

Ray Drainville

There’s a great article about designing a font over at “I Love Typography” that’s worth a thorough read.

I love, love, love articles like this: they stick you directly in the mind of the author & give you practical tips for doing something similar, if you’re interested in doing so. Even if you’re not interested in designing a font, the observations that arise from the article will help hone your vision for designing anything.

IE8: Doesn't Completely Suck

March 20th, 2009

Ray Drainville

If you’re a web developer, you’re going to be interested in the fact that Microsoft Internet Explorer 8 has been released.

There’s a lot of good news: it’s passed the Acid2 test & supports CSS tables, making it the last major browser to achieve both of these. Apparently it’s also more secure than previous versions, although that has yet to be fully tested in the real world. Finally, it’s also faster than previous IE versions, although according to Computerworld, IE8 is still the slowest browser based upon SunSpider benchmarks. In my (very limited) experience, IE8 is significantly faster than previous versions—not dramatically so against Safari or Firefox, however—but more importantly I’m grateful that it hasn’t munged up any of my layouts!

What a difference a few years make: when IE7 came out, it’s only real competition came from Firefox (with Opera as well, of course). It’s now a very full field, with Safari & Chrome freely distributed as well. It’s really great to see such strong competition, and it has to be said that the IE team seem to have done a good job on the browser.

It remains to be seen what the new release will mean for IE’s declining market share; I can’t speak to that. For developers, IE6 was pretty odious & IE7 a bastard step-child of a browser, as it only made half-steps towards standards compliance. IE8 has removed support for HasLayout, the code that trips up most developers, including me.

But… the insta-reviews aren’t positive, and although they’re concentrating mostly upon installation problems, the centre of my concern lies in advanced standards support. There’s still a lot of room for improvement from a developer’s point of view. Whilst the other major browsers have passed the Acid3 test, IE8 still fails, and pretty miserably.

Just as important is the lack of CSS3 support. One might argue that CSS3 isn’t a full recommendation yet, but its development was modularised so browser vendors could start implementing portions as they were completed. And on this score, Safari & Firefox roundly beat IE8. I know I’d love to have multi-column & RGBa support across the board. Yet even if IE8 did support these, it’d be years before we could use them with confidence, that is until older IE versions finally dropped off the face of the earth The fact that the IE team haven’t supported them yet means the day is that much farther away.

Maintaining Older Browsers for Testing

If you’re like me, you’ll have multiple slices of Windows so you can test sites against IE versions. To not get tripped up & accidentally overwrite an IE6 or 7 install because of an automatic update, I’d suggest you install the IE8 blocker toolkit.

Nick Rutherford

I recently Tumbld upon this somewhat festive oddity:

An unusual cross-browser compatibility issue

And Firefox strikes back

Each one is a single unicode character being rendered differently as indicated. The last one is Firefox on OSX.

This isn't really my area, but from what I saw in the markup I'm assuming it's different systems/browsers using different fonts.

As I quipped at the time, I'm surprised that Safari 4 (beta) does not look more like a slimmer relation of the Chrome snowman sporting a back-to-front baseball cap, neon mittens and disco snow.

Github Stickers

March 6th, 2009

Nick Rutherford

Those of you who use github and have a vinyl or octopus fetish may find these of interest:

Dr Otocat goes Vinyl

I'm hoping to get one for my laptop. Best be quick as they stop taking requests on the 11th of March!

When 1 Does Not Equal 1

March 5th, 2009

Ray Drainville

Something is amiss. From The currency widget in Mac OS X:

It looks like Apple’s using Yahoo for their currency widget data instead of… who was it again? In any event, this has been going on for a couple of days. I hope it’s fixed soon!

Synergise that Quality

March 4th, 2009

Ray Drainville

Frequently we are posted materials (or “literature”, as it’s often pompously called) from printing companies promoting their work. One popped into the slot the other day. The company in question seem to print quite well, but they mask a lot of what they do behind incomprehensible business-speak. Even their slogan, “Creating the unique makes the difference”, makes no sense. Especially since the company’s name isn’t “The Unique”.

Worse, there are a lot of errors in the text. Here are just some samples:

Now, you may think me an asshole for pointing these out. And fair enough. I’m as un-fond of Grammar Nazis as the next guy & it pains me to metamorphose into one. But that first example? It was from the second sentence in the entire pack. This isn’t a case of things slipping by: they didn’t proof-read this at all.

This company clearly spent a lot of money on their printing—and delivery, given that there was no postage on the envelope. They rather brazenly boast of their quality & “mastery of the digital world”. Well, mastery of the digital world includes spell- and grammar-checking. Quality is in the details—and even for companies whose trade is visual design, words matter & your mastery of them differentiates you from the ink-stained half-wit who works round the bend.

How to Make Circles in CSS

March 4th, 2009

Ray Drainville

As a fan of the cool Scriptaculous home page, I was wondering how we could achieve a similar look using pure CSS. It turns out that it’s child’s play.

NB: to use this effect, you’ll need to be using a browser that’s implemented CSS3’s border-radius. This means Safari & Firefox: other browsers will simply get a square. Because they’re square, man!

For the example, we’re going to have simply a DIV with a paragraph in it.

CSS Circle Effect Definitions

  div {
    width: 10em; height: 10em; 
    -webkit-border-radius: 5em; -moz-border-radius: 5em;
  }
  p {
    text-align: center; margin-top: 4.5em;
  }

The Explanation

You have to define your parent objec’s height & width & they must be the same (here, 10em). You then employ -webkit-border-radius (or, for Firefox, -moz-border-radius) & define it as half the amount of the height & width. There’s your circle. To get your paragraph looking awesome, align the text centrally.

I’ve placed a HTML/CSS sample here for viewing. Note that I added a border colour to verify that the DIV operates as a proper circle.

For the sample, I defined the P tag explicitly as 1em in height. A small paragraph would be square in the middle of the DIV, which means it would straddle the centre, hence a definition of 4.5em—5em being the centre of our example, 1 em being the height of our P, so we have to nudge the paragraph up by half its height, or 0.5em.

If you wanted to employ this for a real project, you’d have to consider what would happen to the enclosing content of your DIV, however. You’d almost certainly have to define your paragraph to be smaller in height & width than the parent DIV, otherwise your paragraph would bleed over the edges of your circle.

Anyway, some food for thought. Now go & make circles, my pretties!

Separated at Birth?

March 2nd, 2009

Ray Drainville

Fashionably late “a week is a year in politics” edition!

Bonus points for a video comparison between McCain’s acceptance speech at the RNC & Dr Evil’s reminiscences of his childhood.

Update: It’s already been done! Awesome (audio only):

Liquid error: undefined method `current_page' for #