12th February 2001

So here I am, winging my way to Amsterdam.

I’ve set my ThinkPad’s brightness to low, switched to using only VCs, and I’m armed with two extra batteries for my ThinkPad’s Ultrabay, which, in theory, should give me about 8 hours of undisturbed, MP3 accompanied hacking pleasure.

At the other end, my ex-girlfriend will be waiting to pick me up, and drive me to see one of my cats, who died after investigative surgery last week and is now lying in state in a fridge somewhere.

The older I get, the more life likes to remind me of its essential irony. You send in your cat for surgery to see if that lump underneath his skin could be malignant and possibly life-threatening, and then the combined trauma of not having been fed that day, having been removed from a familiar environment, being put in a cage, transported in a car, poked around at the vet’s, anaesthetised, cut open, and then waking up, dizzy and unable to stand, turn out to prove too much and lead to a heart attack.

Many people don’t understand the loss of a pet. It’s really no different to losing a person; worse in some cases.

Once that little treat has been dealt with, I’ll proceed to my storage lock-up to retrieve my CDs and computer books, the only things I’ve missed during the year I’ve been in the US.

I used to be incredibly materialistic in my teens and early twenties, but now I’ve discovered a freedom from material possessions that I could only have dreamt of in those heady days of compulsive record and comic collection.

These days, it seems the only thing I really can’t do without is my beautiful, kind, warm-hearted girlfriend, Sarah. Oh, I choose to populate my life with a few trinkets: the DVD player of the boss and some CDs, but essentially I own and need nothing.

Sarah made a very astute observation while we were walking to Mamma Mia the other week, namely that a passing homeless lady had more belongings in her shopping trolley than I currently have to my name in San Francisco. I would like to have felt nothing but pride in the realisation of my ability to live such an austere yet happy life, but somehow, this fact was still tinged with sadness: here I am, a few days shy of my 34th birthday, with nothing to show for more than 3 decades of life on this planet, but a handful of pay-slips, a second-hand bicycle, the laptop and Palm V that my employer issued me with upon my arrival in San Francisco last March, and a pile of immigration related paperwork.

What’s it all really about, anyway?

So, I’m free. I don’t care whether I live in Amsterdam, San Francisco, Providence, Boston, Sydney or Hong Kong. Nowhere is home and yet, paradoxically, everywhere is potentially home. Home is where Sarah is and right now, that’s San Francisco. Who knows where we’ll be a couple of years from now?

The Dutch newspapers on the seat next to me cause me to ponder how long it’ll be before I start to lose my fluency in Dutch. Having mastered the language as an adult during almost nine years of residence in Amsterdam, I don’t feel the language has cemented itself in my head the way the native language of a child does. A linguist could probably tell me exactly what the differences are between the way a child’s brain learns and stores language, compared to that of an adult.

I don’t want to lose my Dutch. Ik wil erover blijven beschikken. Ik vind het nog steeds een heel mooie taal, zij het dat het tegenwoordig raar klinkt om het uit mijn mond te horen komen, juist omdat het geen dagelijks gebeuren meer is. Het vertrouwde geluid van de Nederlandse taal komt nu ietsje vreemd over. De bekendheid is weg en doet mij geloven dat ik de taal niet meer beheers, maar als ik er even over nadenk, komt het weer als vanouds in me op.

I need to find some Dutch friends or some Dutch language society or suchlike when I return to San Francisco. I really don’t want to lose my Dutch, since I definitely can’t rule out wanting to live there again in a few years. Besides, I’m naturalised as a Dutch citizen, so it’s my language now. It would be appalling to no longer be able to speak it. Had a fun time at the weekend, hacking away on pompeiisneaks‘s wireless LAN. The tiny grain of youthful materialism left in me would like to get DSL and wireless connectivity at the apartment once I get back, but the better part of me knows that the temptation to spend my home time in front of the computer would then be too great, and the more important personal side of my life would suffer as a result. Two working people in the Bay Area hardly have enough time for each other as it is; I want to avoid doing anything that might make matters worse. Apart from which, DSL is expensive and needs to be used to be justifiable.

So, time to hack some code. It’s a long way to Amsterdam.

[time passes…]

Consider this meta-cd completion function for bash 2.04:

_cd()
{
        local cur=${COMP_WORDS[COMP_CWORD]} dirs=()
 
        # get standard directory completions
        COMPREPLY=( $( compgen -d $cur ) )
        # that's all if parameter contains a /
        [[ "$cur" == /* ]] && return 0
 
        [ -n "$CDPATH" ] && {
                # we have a CDPATH, so loop on its contents
                for i in ${CDPATH//:/ }; do
                        # create an array of matched subdirs
                        dirs=( $( compgen -d $i/$cur ) )
                        # add subdirs to list of completions
as necessary
                        [ ${#dirs[@]} ] &&
COMPREPLY=(
${COMPREPLY[@]} ${dirs[@]#$i/})
                done
        }
 
        return 0
}
complete -F _cd cd

Put that code into a text file and source it. You now have a cd built-in that honours the CDPATH variable.

CDPATH is set to the following on my laptop:

CDPATH=:~:~/docs:~/src:~/src/c:~/src/perl:/mnt:/opt:/proc:/var/spool:/usr/src/redhat:/usr/src/redhat/RPMS:/usr/src:/usr/local:/usr/lib

This means that typing cd i<Tab> from my homedir results in the following completions:

i386           i686           include        irc         
isos        iwidgets
i486           ical             info           irq         
itcl3.2     iwidgets2.2.0
i586           ide             internet-docs  isdn 
itk3.2      iwidgets3.0.1

None of these directories are immediate subdirs of my homedir; in fact, only one of them is located somewhere under ~ at all.

cd <Tab> produces a list of all subdirs of $PWD, plus those of every directory listed in CDPATH.

I wonder if this is a useful completion facility. What do you think?

Unfortunately, setting the $COMPREPLY array with an explicit compgen -d has the annoying side-effect of moving the cursor to the right of a successful completion, thus starting a new parameter.

For example, if I type cd /u<Tab>, I would like to perform standard directory completion and end up with /usr/, so that another <Tab> will complete on subdirs of /usr. Sadly, the cursor just completes to /usr and moves the cursor to the right to begin the next parameter. I haven’t yet found a way to counter this annoying behaviour.

Another thing I need to find a way of doing is getting the list of possible completions redirected to a file. I just haven’t been able to figure out a way of doing this yet. Some hackery with exec redirection would seem the way to go, but how would you make it global across all completion functions? A patch written in C is probably the only way to achieve this. …which reminds me, as if I needed reminding: I need to find some time to get my C coding back up to scratch. But how do you do that and still stay on top of emerging technologies, whilst still devoting enough time to other skills that they don’t atrophy?

As if I didn’t have enough to do, it’s looking like work is going to require me to learn some IOS skills and delve deeper into BGP, EIGRP, and GRE tunnels than I have until now. I’ll probably be taking some training when I get back to work, my main goal for which is to learn enough about Cisco equipment to confidently and reliably replace it with Linux boxes.

Hmm, looks like these Ultrabay batteries are not only not hot-swappable, they’re also not detected as being fully charged if the laptop’s own internal battety has been run down.

Both the internal and the Ultrabay battery were fully charged when I opened up my laptop. I’ve now been using the laptop for a good many hours, and APM was warning me that I had just three minutes of battery power left, so I saved my work, shut down the system, removed the dead Ultrabay battery and replaced it with a new, fully charged battery. However, the system didn’t recognise its charge. Damn, that’s a pain.

This entry was posted in Advogato. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *