Archive for February, 2006


Bad Thoughts

Monday, February 20th, 2006

Bad Thoughts

I just came across a great article on the techniques people use to bend a conversation, typically an arguement, in their favour. It’s appropriately called, Conversational Terrorism.

But it reminded me of a book I read, which goes into much greater depth about the underhanded ways people try to win arguments. The book is Bad Thoughts by Jamie Whyte. It’s a must read if you get into a lot of arguments with dimwits. ;)

Disclaimer: Just in case you hadn’t noticed, I’m experimenting with referal links to Amazon. But don’t let that put you off getting the book.

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Bad Thoughts digg.com digg it!  |  reddit reddit!

Offsite Backups

Monday, February 20th, 2006

Like with most people I don’t do regular backups, and at best I only copy it to another hard disk. This has proved sufficient in the past and I haven’t lost a serious amount of data. In fact I can probably dig up every email I’ve sent and received in the past decade. Part of the neglect is that I was just shuffling data between PCs in one room, so that only really covers me against hardware failure. Fire and theft, I’m screwed.

Why am I thinking about backups again? A couple of things. First was my recent hardware issues, for a while I thought about scrapping my desktop and only being left with my laptop. I’d also like to make the desktop into a media PC and could use every ounce of disk space. There are several gigs of backup living on it that could be better used for a hard disk recorder. This would make my laptop the only copy of my data, I’m not comfortable with this, a laptop is fragile and prone to theft. If I was to make it my only PC I’d need proper backups. The second thing is the proliferation of online storage companies. Now there’s a viable place to store things offsite.

But why pay for something I already have? With DreamHost I have 26GB of storage and 1TB bandwidth a month doing nothing. Time to put it to use.

The tool I chose to use it rsyncbackup. It’s a perl script that lets you define various sets to be backed up, specify several destinations and have them backup at different times. At first the config files can be a little confusing but they’re reasonably well documented. Here are my test configs (the default config files have more detailed examples):

backupset.conf

[default]
test|test|true|

destinations.conf

test|ssh[key=id_dsa]:user@host:~/backup/laptop|true|

sources.conf

##################
# SOURCE FILE
##################

# This file includes all sources
# Syntax:
# tag|path|conditionalShellCode|rsyncoptions

test|local:/home/miles/test|true|-a

Then you can run it with:

rsyncbackup -b

N.B. This assumes you’ve got a ssh key pair and you’ve setup your remote server to accept it. If your key has a password, you’ll also need to be running keychain to automate this process.

One slight hitch I encountered was that it wanted the executable and all the config files to be in a directory called ‘backup’ in your home directory rather than in the directory structure in the zip file. A quick glance shows it’s hard coded in the script, that can be sorted out later.

The test run went smoothly so I’ll try it with some chunkier data. But I think for most of the data I’ll bzip2 it copy it over manually to prep the backup directories. No point it letting it take longer than it should. Another hiccup I can see is that my current wifi driver (hostap) doesn’t like large transfers, i.e. it has a habit of dying if you copy a large file. But this was only locally and maybe the bandwidth restriction of my ADSL line will keep it alive. If it fails I can always fall back onto ethernet.

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Offsite Backups digg.com digg it!  |  reddit reddit!

Yahoo! 360°

Friday, February 17th, 2006

Yahoo! has released a UK version of Yahoo! 360°. I remember reading some hype about this when it was first released in the US but couldn’t get through to it because I add a UK account. I’m not sure exactly what it is, at first glance it looks like some community building tool + your own little home on the web.

It might become the place Yahoo! decides to unify all these startups they’ve bought in recent months. Or it might just be another portal. Definitely worth investigating because of all the things Yahoo! is doing in the web 2.0 and social networking space.

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Yahoo! 360° digg.com digg it!  |  reddit reddit!

ONJava slipping?

Thursday, February 16th, 2006

Not really but apparently provocative (mis-leading) headllines are the way to get on the ‘A-List’. ;) (Note: He’s changed the paragraph about titles so it’s much softer than what I got in my RSS feed).

So what’s wrong with ONJava? It’s their latest article, Integrating Ant with Eclipse, Part 1. For those of you who don’t use Eclipse and Ant to integrate them you need to do:

  1. Window > Show View > Ant
  2. Drag build.xml from the Package Explorer into the new window pane

And you’re done. How does this warrant an article?

On closer examination it’s an excerpt from an oldish book, and most of it is about setting up Eclipse and writing an Ant build script. But if you’re not already using Eclipse and have an Ant build script, why would you read an article titled ‘Integrating Ant with Eclipse’?

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit ONJava slipping? digg.com digg it!  |  reddit reddit!

Does logic belong in the database?

Tuesday, February 14th, 2006

Builder UK has done an indepth interview with David Heinemeier Hansson, Ruby on Rails: The importance of being 1.0. I like Rails and would like to use it more, but was never very happy with it’s lack of SQL features. From the interview:

Regarding the specifics, it’s no secret that I’m not a big fan of logic in the database. I don’t think the database is an appropriate place to maintain a coherent domain model. And I don’t think you should integrate multiple applications through the database. So if you follow that and shield your database from access of multiple applications, you can move all of that logic you would have put in stored procedures, triggers, and what have you into an object-oriented model that can take advantage of the last 20-plus years of progress in software-development techniques.

There’s a fair point but in the past I’m pretty sure DHH mentioned foreign keys were unnecessary too, which I found frustrating when I switched from PostgreSQL to MySQL (DreamHost doesn’t support the former).

But now I look back at it, it doesn’t look bad. Rails has several features that makes it possible to maintain data integrity and allows you to keep all the details of your model in one place, e.g. hasmany, belongsto in ActiveRecord. Also Rails apps tend to be built from the ground up (rather than built on top of legacy systems) so if you control the only access points to the database, why not limit your checks to one place? There are two things that come to mind that made me think keeping all the data integrity in the source code was a bad thing.

ACS 4.0 Tcl My first real programming job was at ArsDigita. They had a toolkit know as the ACS (ArsDigita Community System), which at the time was written in Tcl. Tcl is a scriping language, a fairly simple one at that. One of the big new features in ACS 4 was object orientation. I can’t remember how they did OO in Tcl but I do recall the extends they went to to mimic OO features in the database. Object hierarchies were modelled by table hierarchies, with lots of constraints, we even wrote OO data retrieval functions in Oracle PL/SQL. Beyond that there was also a lot of emphasis on reducing the amount of SQL queries each web page makes and optimizing them where ever possible. If you’re interested, here’s the full indoctrination.

JDBC The other thing I’m going to blame is how hard it is to do SQL in Java. It’s just painful. How verbose is this!

Connection c = ... // I won't bother including connection setup code
PreparedStatement ps = null;
ResultSet rs = null;

try {
    ps = c.prepareStatement("select id, name, password from users where id = ?");
    ps.setString(1, id);
    rs = ps.executeQuery();

    if (rs.next()) {
        String id = rs.getString(1);
        String name = rs.getString(2);
        String password = rs.getString(3);

        User user = new User(id, name, password);
        return user;
    }
} 
finally {
    // I won't bother with closing code either
    close(rs);
    close(ps);
}

With Rails you declare your User class as:

class User < ActiveRecord::Base

end

and the lookup code is:

user = User.find(id)

and you’re done. True the ActiveRecord limits you to fairly simple object models, but when the framework makes your life this easy, you can cope. My main point is using SQL in Java is painful enough I’d push as much logic as I can down into the database in the form of constraints, cascades, triggers, PL/SQL, etc. so I could simplify my JDBC code.

So does logic belong in the database? Yes and no. If you think your database is going to out live your application, then it’s probably a good idea to make sure it contains all your data integrity rules. But that’s not always the case, sometimes the database is just a store that’s meaningless without your application, so why duplicate logic? Rails is full of ‘it really doesn’t have to be that hard’ moments. I’m surprised I’m still coming across them.

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Does logic belong in the database? digg.com digg it!  |  reddit reddit!

Amarok iPod Support

Tuesday, February 14th, 2006

Amarok have announced the beta of their next version, ‘Fast Forward’. One feature I’m exciting about is the improved iPod support. They’ve switched to use libgpod, which is supposed to add a lot more features than the kioslave they used to use. I’m hoping this makes Amarok into a true iTunes replacement and kick starts me into transferring my music from a dormant Windows machine to a Linux box.

Recently I’ve starting using the FM radio on my phone for music. But a recent change in work policy has meant I have to be in the office by 9.00, this has the unfortunate side effect that for half my walk I have to listen to adverts/news/travel info instead of music. Time to dig out that iPod.

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Amarok iPod Support digg.com digg it!  |  reddit reddit!

Collaborative Searching

Tuesday, February 14th, 2006

I’ve been asked to come up with ideas for improving searching when lots of people are involved. Actually it was more like ‘MMORPGs are great, apply their ideas to search’. A bit vague but I get the gist, basically what is it that keeps people coming back to MMORPGs? The obvious answer is they’re fun. Other answers could be:

  • Sense of community
  • Discovering things new
  • Reward for effort
  • Meeting place
  • Meeting new people

Keep in mind I haven’t played a MMORPG since the Ultima Online beta, and I was back in school then. World of Warcraft looks like to be the current ‘in thing’, but no computer I own can run it.

Applying these ideas to search is hard because I think of search as a solitary activity and you have a good idea what you’re looking for. Sure there are things like delicious, digg, etc. but those aren’t so much search, but more just collaborative filtering. My current domain of expertise is crawling the web and building searches.

In the Web 2.0 world the closest thing I can find is Yahoo’s MyWeb 2.0:

http://myweb2.search.yahoo.com

It’s a search engine where you can build up a collection of pages to form your own web. That by itself isn’t too exciting since it’s just a glorified bookmarks tool with a search across it. What’s more interesting is the community web feature. You can hook up with people with similar interests and form your own web of interesting pages. This puts a different spin on the whole delicious/digg thing, so instead of topical pages you can build up a database of useful information.

I think applying this to the web isn’t going to take off because there is so much information out there you’re unlikely to want to limit yourself, and people in your community are going to be covering a wide range of subjects. But the concept is good and the search engines I write are for corporate customers so when the community is a research team, this idea begins to make a lot more sense.

So I’m going to make Yahoo! MyWeb my default search engine for a while and see what ideas come from it.

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Collaborative Searching digg.com digg it!  |  reddit reddit!

Enum<E extends Enum<E>>

Tuesday, February 14th, 2006

Just as I begin to get comfortable with Java 5 I come across the class declaration ‘Enum<E extends Enum<E>>’. Now there’s a head scratcher!

Update: Here’s a good explanation of what’s going on: http://madbean.com/2004/mb2004-3

Basically it’s an idiom to allow a class to have methods that have a return type that is a sub class of itself.

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Enum<E extends Enum<E>> digg.com digg it!  |  reddit reddit!

Might have to switch to Firefox

Sunday, February 12th, 2006

My preferred browser is Firefox when some page refuses to play nice. Konqueror has nice features like an ‘up’ button that goes up one directory level in the URL, ability to change browser identification, translate a page, temporarily disable JavaScript all from the menu and other nice little touches that makes it feel more slick than Firefox. But Firefox definitely has the mindshare so it’s not too surprising that two interesting tools I just came across are Firefox plugins and not some KPart.

The first is Selenium IDE, which is a sort of macro recorder that generates Selenium scripts. Selenium is an automated in-browser testing tool written by ThoughtWorks. I had heard of it before, but back then you had to hand write scripts and it only ran in Internet Explorer. But now the scripts run in Firefox, hence on Linux, and this tool means you can create an automated web test suite by just using your site. If this really does what it claims, then it has the potential to saves years of my life from monotonous testing.

The second is FireBug, which the website describes as:

FireBug is a new tool that aids with debugging Javascript, DHTML, and Ajax. It is like a combination of the Javascript Console, DOM Inspector, and a command line Javascript interpreter.

I don’t tend to do much UI work myself but recently I had to look into some weird JavaScript bug and figure I need all the help I can get.

I’ll have an indepth look into each tool next week. It’s bad enough getting excited about testing and debugging tools on the weekend, but I’ll try to retain some dignity and wait until I get into the office to use them. :)

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Might have to switch to Firefox digg.com digg it!  |  reddit reddit!

Computer now running smoothly

Friday, February 10th, 2006

The Nvidia card decided to come back to life again so I could continue my upgrade but it still didn’t want to work in X. I found a Matrox G550 for £20 on eBay. Stuck it in last night and now everything is working like a charm. Only slight hitch was in my rush to find a card I failed to notice the card was designed to fit in a low profile case, but that was nothing that a pair of pilers couldn’t fix. :)

Spread the word: Technorati related  |  del.icio.us bookmark it!  |  submit Computer now running smoothly digg.com digg it!  |  reddit reddit!