January 2007 Archives

Song quotations

| 3 Comments
I listen to Velvet Acid Christ a bit. It gets me in the mood for programming. I recently had the latest album gifted to me. What can I say, I really like it.
Then there was a quote towards the end of the love track.
Kill one man, you're a murderer. Kill a million, a king. Kill them all, a god.
-- Drake (Dominic Purcell; Blade Trinity)
Of course, I got sucked into another of those internet memes, and ended up filling in the 'What tarot card are you' and got....

You are The Lovers

Motive, power, and action, arising from Inspiration and Impulse.

The Lovers represents intuition and inspiration. Very often a choice needs to be made.

Originally, this card was called just LOVE. And that's actually more apt than "Lovers." Love follows in this sequence of growth and maturity. And, coming after the Emperor, who is about control, it is a radical change in perspective. LOVE is a force that makes you choose and decide for reasons you often can't understand; it makes you surrender control to a higher power. And that is what this card is all about. Finding something or someone who is so much a part of yourself, so perfectly attuned to you and you to them, that you cannot, dare not resist. This card indicates that the you have or will come across a person, career, challenge or thing that you will fall in love with. You will know instinctively that you must have this, even if it means diverging from your chosen path. No matter the difficulties, without it you will never be complete.

What Tarot Card are You?
Take the Test to Find Out.

Wonderful quote from the Guardian

| 1 Comment
Sir Ken Macdonald -- the UK's DPP (director of public prosecutions - basically makes the call as to whether a case goes to trial or not) has spoken out against the "war on terror":
He said: "London is not a battlefield. Those innocents who were murdered on July 7 2005 were not victims of war. And the men who killed them were not, as in their vanity they claimed on their ludicrous videos, 'soldiers'. They were deluded, narcissistic inadequates. They were criminals. They were fantasists. We need to be very clear about this. On the streets of London, there is no such thing as a 'war on terror', just as there can be no such thing as a 'war on drugs'.

"The fight against terrorism on the streets of Britain is not a war. It is the prevention of crime, the enforcement of our laws and the winning of justice for those damaged by their infringement."

Sir Ken, head of the Crown Prosecution Service, told members of the Criminal Bar Association it should be an article of faith that crimes of terrorism are dealt with by criminal justice and that a "culture of legislative restraint in the area of terrorist crime is central to the existence of an efficient and human rights compatible process".

He said: "We wouldn't get far in promoting a civilising culture of respect for rights amongst and between citizens if we set about undermining fair trials in the simple pursuit of greater numbers of inevitably less safe convictions. On the contrary, it is obvious that the process of winning convictions ought to be in keeping with a consensual rule of law and not detached from it. Otherwise we sacrifice fundamental values critical to the maintenance of the rule of law - upon which everything else depends."
It's great to see a civil servant complaining about the state of play of the government.
Makes a huge difference on my last entry :)
Peace out!

It's a clip from idolm@ster, a bit like dungeon master except with your own idol group. it is so kawaii.

Baggy sweatshirt problem

| No Comments
<ramble>
It's a problem when programming. You don't have to make a one size fits all solution to a problem. It just isn't worth the effort. I'm being reminded of the Simpson's episode parodying Mary Poppins... 'If you cut every corner you'll have more time to play'. i.e. if you can get away with it then fake it.
Polishing crap still leaves you with crap. Spend a half an hour experimenting with something to decide if it will work.
Learn to shoot your baby in the crib or It's too easy to get locked into a commitment that is really too much work.... i.e. even when you're half way through the experiment and you realize it's going to drive you mad trying to get it to work then issue a big old 'rm -rf'.
</ramble>
Strangely enough, I had actually thought of this before I made the post. Snapshots are a wonderful feature in zfs which allow you to take point in time images of a filesystem that are mutable and which themselves can be snapshotted.
Unfortunately, this leads an explosion of snapshots if we want to be able to arbitrarily remove any one application from the system.
Consider the following operation:
pkg(1) + pkg(2) + pkg(3)
Now remove pkg(2) without using anything other than snapshots.
snapshot before adding anything sn(0). snapshot after adding package 1 sn(1)(sn(0)). snapshot after adding package2 sn(2)(sn(0)) + sn(2)(sn(1)). snapshot after adding package3 sn(3)(sn(0)) + sn(3)(sn(2)) + sn(3)(sn(1)).
Repeat for arbitrary pkg(n).
Unless you're planning on creating a whole travelling salesmanOk, it's not quite the travelling salesman problem, but it gives you a good idea as to how much work is involved of snapshots, I think my mechanism is easier.
hello peter
I am a little scamp from moore street
that likes to suck on wet socks
that have been left to stew on my grannys corns
but fear not. Although this may seem like drunken gibberish I have only had one wee beer you are a good lad and I promise not to melt your face
This little piece of shell script attempts to find the 'lowest subprocess' of a passed in process. It works well with a straight tree of processes, and if there are the occasional pipes in the command tree then it will miss them most of the time.
Maybe tomorrow I'll talk about how to fix it.
function find_lowest_subprocess() {
        local -i parent=$1
        local pids
        typeset -a pids

        pids=$(pgrep -P $parent)
        while [[ -n "$pids" ]]; do
                if (( ${#pids[@]} > 1 )); then
                        local i=0
                        while (( i < ${#pids[@]} )); do
                                local sub=$(pgrep -P ${pids[$i]})
                                [[ -n $sub ]] && parent=$sub
                                ((i=i + 1))
                        done
                else
                        parent=$pids
                fi
                pids=$(pgrep -P $parent)
        done
        echo $parent
}
If you use windows then this is probably going to be very, very boring.
Every now and again you find yourself needing to install some piece of software on your computer from a source package. You tar xjf the package and descend into the subdirectory and type ./configure.
At this point I would yell stop! Rather than putting it into the default location of /usr/local, consider putting it in /usr/local/<package-version>.
How does this help I hear you ask. Well, using a simple script (in the extended entry), you create a set of symbolic links in the /usr/local directories which reference the files in the /usr/local/<package-version> directories.
If you decide to remove the package then simply remove the /usr/local/<package-version> directory and all the symlinks become broken. By using symlinks -rd /usr/local you clean the file system up and everything is peachy. If you don't have a copy of symlinks, it is available from the debian repository, where you should find the source package somewhere near the bottom.
#!/bin/bash -p

package=$1
destdir=${2:-/usr/local}
me=${0##*/}

[[ -z $package ]] && {
        echo "Usage: $me <package> [destination = /usr/local]"
        exit 2
}

cd $destdir/$package || {
        echo "$me: package $package does not seem to be installed"
        exit 1
}

# build the directory structure - this is a weakness
find . -type d | cpio -o | (cd $destdir; cpio -id)

find . -type f -exec $echo ln -s $destdir/$package/{} ../{} \;

Oh, and for solaris, as I'm using the file in various locations surrounded by symbols you will have to just pass it into a sub-program to execute the link command. Apparently solaris doesn't just substitute the name of the target for the link; instead it will only substitute the name of the target when it is isolated (i.e. you would need to use the {} on their own without anything surrounding them - which explains the space between the closing brace and the backslashed semicolon - old habits). I supposed I could throw a bit of perl at this problem but... it works on my box so frell the rest of you :).
Meh, the entire problem is annoying; generally I would always have to create a program to process the {} operation anyway to prevent space characters from getting in the way but as we say in the trade 99% is better than 0%. If you want a 100% solution you need to add a script that performs the link - one per line produced from the find.
FeatureBourne ShellBusybox ShellBash
Subprocess Execution`` (the backtick)`` or $()As Busybox
Math Evaluationuse expr (not builtin)$(( ))As Busybox; adds ((var=math))
ConstantsNoneNonetypeset -r
IntegersNoneNonetypeset -i
Evaluation[[[
Extended Evaluation/bin/[[ (1)/bin/[[ (1)[[

(1) The [[ operator is not the same as the program /bin/[[ as a program you need to still use double quotes around the variables to be expanded; thus defeating the reason for having them in the first place.

For Example:

	# file="/tmp/let me go"
	# touch "$file"
	# [[ -e $file ]] && echo "There"

Yields [Busybox]:

	[[: me: unknown operand
- as $file is word split before handing it to the command [[

Yields [bash]:

	There
- due to $file not being split when passed to the test -e.

I've started so I'll finish

| No Comments
I was saddened to hear that Magnus Magnusson has died at age 77. Most of us remember him as the quiz master for mastermind. A fiendish quiz show for the real swots.

Whiney applications...

| No Comments
If there's one thing I can't really stand, it's applications that whinge about everything that goes wrong with an array of practically useless dialogs. One of my biggest gripes at the moment is of all things Thunderbird. It has to be one of the most whiney applications. When things go wrong it pops up a dialog which generally has only one option 'ok'.
The most regular complaint dialog I get is because it's incapable of connecting to the mail server. Outlook has solved this years ago with the connection status bar at the bottom of the screen. When things go well, the notification goes away once the communication has completed. When things go wrong you get a 'send/receive errors' item in the status bar. It expands to a dialog which gives you the status of each of the activities it was performing at the time.
Thunderbird.... every failed connection is a modal dialog box with 'connection to foo failed'. I gather my email from many disparate sources and this is no end of an annoyance to me as normally when one fails they all fail.
Is is that there isn't a graceful way of bringing up failure notifications to users?
Young dermot was consulting the Ipod Oracle, so I decided to do the same.
You have a set of questions you ask. Put the player in random and based on the songs that come up you answer the questions and put in a comment.
The List of questions are hidden here:
The Complete List of my answers are hidden here:

VAT me baby (play)

| No Comments
Apparently play.com are being naughty with the VAT situation. Pick a price in pounds. If it exceeds a certain value (£18) it is subject to vat in the UK. Make sure this is the case.
Translate the price to euro using something like XE's universal currency converter. Then click on the 'price in euros' button on play. They're pretty similar.
Read the fine print in the terms and conditions... item 26 states you will be charged tax where appropriate ... item 32 states only if you're in jersey. Apparently play are paying tax to addresses delivered in the UK, but not to addresses in other european countries (like Ireland).
So the long and short of it is that they're pocketing the tax difference and then when customs screw you on delivery of your item and add a €5 handling fee you have every right to be angry with them. Suddenly those DVDs aren't cheap anymore. Mind you there's a getout clause. If the value of the item does not exceed €22 then you should not be charged VAT on it. This information is outlined in the Customs Duty and VAT at Importation leaflet.
It was something brought up by Joanna Rutkowska that her original pagefile attack on Vista was now stalled because Microsoft removed the ability of administrative users to perform write operations on the physical disk. So what happens to all those developers of undelete utilities (use a second disk?).
Firstly, lets look at the attack in more detail. What happens is that the kernel is forced to swap out pages of memory from drivers that are loaded in the kernel. These pages are swapped out to disk. I for one find this to be an incredibly stupid place to swap out the pages, as after all, until the kernel is completely done with a driver the original copy remains on disk.
Ok, maybe it had something to do with the new paging mentality of vista (you can page onto a usb memory device if it's fast enough).
Damn, I'm talking myself out of my own argument.
No, paging of code from binaries should revert to the on-disk copy unless they have made COW modifications to their segments (does windows do this?)

About this Archive

This page is an archive of entries from January 2007 listed from newest to oldest.

December 2006 is the previous archive.

February 2007 is the next archive.

Find recent content on the main index or look in the archives to find all content.