2010-06-30

The Days of Horror Story

Quite a while ago, I wrote out some of my experiences at a previous employer, as a cathartic release on the tension they caused me. It helped a lot,

Todays The Daily WTF titled "Got Time?" reminded me of one of those horrible hacks I had to deal with when I was there.

We used to have one of those business rules. "X business days from now". Where weekends, and national public holidays, were not considered "business days". Because this business rule was observed in the Oracle Forms interface that was used by our operations staff, a way to take now() + N business days was needed.

# select * from days_of_week order by num;
day_of_week num
----------- ---
...
31/07/2005 401
01/08/2005
02/08/2005
03/08/2005 402
04/08/2005 403


In this entirely ficticious example from my memory of this table, that's what the data looked like. All saturdays and sundays and public holidays were listed in the table with a blank 'num'. To find a date 10 business days from now, you would do: select day_of_week from days_of_week where num = (select num from days_of_week where day_of_week = today()) + 10.

Every so often we would "run out of days" and an email would be sent. Then a script would be written to add another batch of days to the table, then we'd be good until we run out again...

I've been at my current employer for over 5 years now, and am extremely happy I left tripe like what I've just dredged out of my memory behind.

2009-05-25

Disable Hal Daemon Polling

I had cause today to stop hal from polling its CD-ROM/DVD-ROM drives on a large number of systems.

$ cat /etc/hal/fdi/information/disable-polling.fdi
<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
<device>
<match key="storage.media_check_enabled" bool="true">
<merge key="storage.media_check_enabled" type="bool">false</merge>
</match>
</device>
</deviceinfo>
This will turn of the 'media check' which polls the IDE device every 2 seconds to see if a CD is inserted. None of these systems have anything listening to HAL events, nor will have removable media inserted, so we can safely ignore the events.

hal-disable-polling is an ''interesting'' program. C programmers doing this stuff should really get an XML library that's useful, and actually use it. Using fprintf for emitting xml isn't kosher :(

2009-03-26

OSDC Brisbane 2009

I am pleased to announce that Brisbane is the new host city for the Open Source Developers Conference in 2009.

I am leading the organisation committee for the conference, which we intend to hold at the lovely Bardon Conference Center in Brisbane.

More details to come, stay tuned. :)

2008-12-15

On Packaging Python

I’d love if there was a language-neutral library installation and management tool that really worked. Linux system package managers are absolutely not that tool; frankly it is absurd to even consider them as an alternative. So for now we do our best in our respective language communities. If we’re going to move forward, we’ll have to acknowledge what’s come before, and the reasoning for it.
A Few Corrections To “On Packaging” - Ian Bicking

I disagree with him so much I don't know where to start. Operating system packages are the best way to install anything on nice systems. Python is not 'special' in this regard, there's no reason not to use operating system packages.

I spent a couple hours a few months ago making it easier, and I should return to that project and get more done on it, at the moment it's far to pypi-centric.

Oh, and if someone could fix Python Issue 1533164 for Fedora 10, that'd be great too. :)

2008-12-13

Mairix and Mutt for Mail

After a long time of using webmail and things, I've finally gotten around to hosting my mail locally on my computer.

Keeping with the 'search not sort' philosophy of mail, I have set up a system where when I get email (using 'getmail' to download it via pop from my email hosting) I deliver the email to two places. One is an archive (named for the day it was received on) and the other is an Inbox.

When I read email in the inbox, I delete it. The archive is always there.

I have a mairixrc configured to index all my archive. Unfortunately the globbing for mairix doesn't seem to work for subdirectories, so I have all my archives in yyyymmdd named folders instead of yyyy/mm/dd folders. This way I can say maildir=Maildir/Archive/*.

Now that I have my email sorted like this, and mairix is indexing it (on a cronjob), I can search it. I wrote a little script to search my email. The idea is that I can select some text and click a button on my toolbar, or I can hit a button my toolbar and enter some text into a search prompt, then mutt will spawn pointed at a folder containing my search results.

Here is the one that prompts for input:
#!/bin/sh

searchdir=/var/tmp/searchresult-$$
selection=$(Xdialog --inputbox "Search For?" 18 45 2>&1)
# exit if Xdialog had a nonzero exit.
[ $? -ne 0 ] && exit "Okay, nevermind"

echo Searching for $selection
mkdir -p $searchdir
mairix -o $searchdir "$selection"
mutt -f $searchdir
rm -rf $searchdir


The one that uses the xclipboard just does selection=$(xclip -o) instead of the Xdialog dance.

2008-12-09

Xrandr for dual head on IBM X200s

I tried to use xrandr on my new laptop (IBM X200s) and I had an error.
$ xrandr --output VGA --left-of LVDS
xrandr: screen cannot be larger than 1280x1280 (desired size 2960x1024)
It turns out that Fedora 10 has an X that doesn't need an xorg.conf, and therefore doesn't have one, so it's hard to put in the fix for this, which is putting in a Virtual line in the Screen.

This is what I had to put in xorg.conf to allow me to do dual head. Bear in mind that if you do this, then DRI will not work, and thus there will be no 3D acceleration.
Section "Device"
Identifier "Videocard0"
Driver "intel"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
SubSection "Display"
Virtual 2960 1050
EndSubSection
EndSection
And that was all that was needed. I can now use my external monitor via xrandr.

2008-09-09

$15.24 for 2 zones


$15.24 for 2 zones
Originally uploaded by Stephen Thorne
Go-card is fail. A workmate of mine just got charged 6.5x the correct fare for his trip into work yesterday.

Total. Utter. Fail.

2008-09-06

Booting and Stuff

So it turns out that my epic journey into "why doesn't this board boot" this week had a really anti-climatic ending.

Just so everyone knows, the Intel DG945GCLF board, which is a mini-itx board with 1.6ghz atom 230 chip on it, will not boot from a hdd unless one of the partitions on that drive is marked bootable.

This might seem obvious, but it doesn't make much sense :( the BIOS is supposed to just load the first 512 bytes of the drive and run it*.

So, things I learned this week:
  • grub-install is a shell script.
  • What grub stage1, e2fs_stage1_5 and stage2 are.
  • The layout of the partition table.
  • Various tricks with 'dd' and 'xxd' to read partition tables.
  • Editing hex values in partition tables and the grub stage1 on the disk is kinda fun the first time.
  • Knowing what bytes are what on a raw disk is knowledge that can't be erased with beer.
  • Beer is good for day 3 of dealing with non-booting systems.
So after something like 15 kernel compiles, various operating systems and rescue disks, it turns out that I needed to make a 2 character change to the sfdisk script that created our partition layout.

* yes, i know this is a lie.

2008-09-01

SSH Fail

I'm very very angry just at the moment, I'm angry about a total mismatch of expectations in the name of 'usability' that has invalidated what I thought was a totally reasonable security mechanism that I more or less took for granted.

I have an SSH key. ~/.ssh/id_dsa. I have a passphrase on that key, so that if someone compromises my machine, all they have is a key, and they have to brute force my (rather long) passphrase. I have ssh-agent to remember my passphrase in memory so that I don't ever let that passphrase hit disk, but have the passphrase cached.

Running ssh-add -D should wipe that passphrase from memory so I have to type it again. I was toying with doing this nightly so that it would wipe the passphrase every night so when I log in the next morning my passphrase needs to be re-entered.

This is where the nightmare begins. On the weekend my machine crashed so I had to start a fresh this morning. I sit down, log in, fire up a terminal, and ssh into another host.

Bam, I'm straight in. No passphrase, no prompt, nothing. Just straight in. This shouldn't be possible. Either the passphrase has been removed from my key so that it can be used without a passphrase, or something is saving it to disk without my knowledge.

Fedora 9 in its default configuration will save your passphrase to disk if you're logged in under gnome. I don't know how to turn it off. I feel angry, violated, annoyed and really really frustrated. It was a simple thing and it's been fucked. I can't turn it off, I can't stop gnome from remembering my passphrase, I feel like pulling the drive, hitting it with a hammer, and going back to OSX instead.

At least OSX can get simple things like ssh-agent right.

*sigh*

2008-08-01

Cafe Babe

Q: What's the difference between Old Java and New Open Source Java?

A: The Old Java worked in my browser dammit.