Older blog entries for lkcl (starting at number 351)

this is _way_ cool code, and i wrote it :)




def add_d2(*args): """ cool function for making dictionaries of dictionaries ad infinitum.

1st arg: top-level dictionary of .... of .... of ... of dictionaries [... keyname for dictionary of dictionaries of dictionaries ...] [... keyname for dictionary of dictionaries ...] [... keyname for last dictionary ...] final arg: value to be stored. """

dict_list = [args[0]] key_names = list(args[1:-1]) val = args[-1]

for keyname in key_names[:-1]: dict_list.append(dict_list[-1].setdefault(keyname, {})) dict_list[-1][key_names[-1]] = val

you use it like this:

 
    d = {}
    add_d2(d, keyname1, keyname2, asmanykeynamesasyouwant, val)

and then you can do this:


    print d[keyname1][keyname2][asmanykeysasyouwant]

and it will return val.

i've been using a two-dimensional dictionary-of-dictionaries-of-values for quite some time in some of the code i've been working on, and when i needed a third dimension i went RRRRIGHT, that's it, i'm writing a multi-dimensional dictionary-storing-thing.

it even works for 1-dimensional dictionary things (duh, so why bother?? just do d[x] = y but yes, if you have a function which does multidimensional storage then it's useful not to have to special-case 1 dimension)

y'know... _just_ sometimes, a simple bit of code can be... really cool :)

5 Feb 2007 (updated 5 Feb 2007 at 21:21 UTC) »

i'm just doing the first backup of my laptop - ever. dating back to nearly 1999, when i was working for linuxcare i got given the 10gb hard drive from the laptop i was using at the time and i continuously transferred the data from that drive to the next machine, every, what... 18 months or so.

now, i am using rsync to do backups of a 60gb drive, which i haven't fully partitioned yet, and there are 1.3 MILLION files on it.

gahhd _damnnn_.

ncm: i'll take that orinoco card off your hands. seriously!

luke: spam...

ok, the stop-windows-from-being-able-to-be-installed problem is a variant on this:

http://support.microsoft.com/kb/314458/en-us

basically, the XP install cd doesn't understand the partition layout that linux fdisk can end up creating. so, that's 512 bytes which can, if put into a virus payload, wipe out windows, wholesale.

3 Feb 2007 (updated 3 Feb 2007 at 15:36 UTC) »

wow.

i've just discovered a way to terminate any possibility for windows xp to be installed on computers.

the implications are staggering. a small LVM partition scheme of only 512 bytes in size, when overwritten by a virus to a hard drive's boot sector, would be sufficient to wipe out a large proportion of the world's internet-enabled computers.

i absolutely love it.

oh dear god, it's not limited to HP machines. i've tried on a dell optiplex, too. and i've tried both XP home and XP pro install disks.

30 Jan 2007 (updated 30 Jan 2007 at 15:01 UTC) »

badger, perhaps you are in a unique position to explain this one to me.

why is it that fedora is reinventing all of the infrastructure that has been available in varying degrees in debian for ... what... fifteen years, now, and ubuntu for a couple of years?

and how the bloody hell did anyone either cope or expect to get anywhere _before_ such infrastructure existed?

on a different note: i installed a fedora core 6 system last week, and i am extremely glad that the person whom it was destined for was happy to take over, as the process of locating and installing the appropriate software, with yum, was a complete fuckup.

the kernel version installed was incorrectly detected by FC6 (it's a P4 2.6ghz system and the version of the kernel installed was 586 or something which didn't even have p4-clockmod or cpufreq _in_ it).

search words on yum search are ORed not ANDed, which made locating cpu freq / power management utilities and the a working kernel _really_ difficult to track down.

yum itself takes forever to show anything.

the display output is shit as it contains no summary (apt-cache search + apt-cache show: there's no obvious equivalent, all i could find was yum search)

i had to pipe the output from yum to a file and then go through it manually.

then when i actually located a kernel, i installed 2.6.19 thinking that would work, then discovered that there was a 2.6.18 kernel that would _actually_ work, and got some bitch-stupid complaint about not being able to downgrade!

what the fuck has a kernel got to do with an operating system??

i should be able to put any number of kernels on WITHOUT complaint or molly-coddling from some stupid tool.

the whole exercise was a genuine waste of time, and i spent several hours earning a grand total of about 15 GBP profit. i would be better off signing on for unemployment benefit.

p.s. who the bloody hell thought that xml would provide a good database index for yum?

y'know, it's weird. i do so much with computers - messing about with them, getting them sorted for people to use. the contrast between what they require and what i can do is so stark, that, when i am done configuring a machine, i feel kinda...

empty...

it's very strange: i just don't know what to do.

it just emphasises, in-your-face, that computers really are, at present, just a tool.

Advogato seems to have quite a lot of power with google :) this is a good thing, i believe, but with that power comes responsibility, on our part, to make sure that the information linked to is actually important - so for god's sake don't abuse it.

my link Toshiba Satellite Pro A100 which is a report on installing debian on one of these machines is on the first page of the search words - very amusing.

The only things that outrank it are article reviews (trustedreviews.com ha ha) and people quite likely to be paying some money to google for advertising the sale of their A100 laptops (kelkoo, laptopsdirect, etc. etc.) but hey whether they are or aren't, i find it amusing to be near the top of the list.

the same thing happened for the Acer 5044WLMi, which, as a less popular machine, ends up as the top hit ha ha.

well, the conversions to linux go on.

i'm doing about one every week, so far - that's five new reports of laptops, three of which are written up, in the past couple of months. cool!

the one i did last month was my sister's laptop - _really_ nice screen (1280x768) _really_ odd resolution - i think it's a dell.

there are only a couple of laptops with that size screen.

fortunately, installing the 915resolution package, along with xdebconfigurator, xresprobe, detect, discover and read-edid (apt-get ....) as well as the xserver-xorg package, made it happily auto-detect the screen size and successfully configure Xorg.

i was really impressed.

it's all listed here:

http://lkcl.net/d-i/etch/classes/kdedesktop/late_script

exim4 virtual domains i've been looking for these instructions for _ages_! they work, beautifully.

342 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!