Opslag

Kom uden om DR's flash-afspiller

Jeg ser nogen gange Bonderøven på DR1. Men selv om programmerne er tilgængelige via flash-afspilleren, så er DR er langsomme til at lægge programmerne ud til download. Flash-afspilleren er ret irriterende, da man for eksempel ikke kan putte den i fuldscreen, og så samtidigt klikke rundt på sin sekundære skærm. Så siden flash-afspilleren må hente videoen et sted fra, så må jeg da også kunne hente den derfra, og så afspille den fra den downloadede fil. Første trin er at bruge Chromium's developer tools til at "inspecte" flashplayeren på http://www.dr.dk/dr1/bonderoeven . Den har kildekoden <object id="nettvPlayer" height="349px" width="620px" type="application/x-shockwave-flash" data="/nu/assets/swf/NetTVPlayer_10.swf"> <param name="quality" value="high"> <param name="allowScriptAccess" value="always"> <param name="wMode" value="transparent"...
PHP's implementation of fgetcsv() and fputcsv() does not follow RFC 4180 or Wikipedia's description, and does not work in all cases with Excel or OO Calc, as described in bug http://bugs.php.net/bug.php?id=50686 . Here is an RFC 4180-complient implementation in PHP. This can parse more than 1MiB of CSV text per second, so should be fast enough for most uses. It is fairly strict, in that it does not allow whitespace before the start of a quoted item, such as 1, "2" ,3 , in according to the standard, but it would be simple to make it laxer. It supports both \r\n and \n linebreaks, where the standard only supports \r\n. whitespace is just another data character, so '1, 2,3 ' becomes Array(1, " 2", "3 "). backslashes are also just another character, as backslashes have no special meaning in RFC 4180. The code below may be used and redistributed without restrictions. You may consider buying me a beer if you find it useful. class csv { priva...

Sid Meier's Alpha Centauri on Linux

I own Sid Meier's Alpha Centauri Planetary Pack in the Linux edition from Loki. However, it unfortunately does not seem to run on a modern Linux distribution. So I decided to make a virtual machine image of an old Linux distribution to make it work. That way I will never have to reinstall it, as long as I save the virtualized image. So the procedure is: 1) Download Red Hat 8 (in 2 disks): ftp://ftp.gmd.de/archive.download.redhat.com/redhat/linux/8.0/en/iso/i386/psyche-i386-disc1.iso and ftp://ftp.gmd.de/archive.download.redhat.com/redhat/linux/8.0/en/iso/i386/psyche-i386-disc2.iso . 2) Create a virtual disk image: emu-img create -f qcow2 smac_redhat8.img 5G 3) Optionally install kqemu kernel module to accelerate qemu (Red Hat 8 didn't work with kvm,presumably because my CPU is not known by Red Hat 8). 3) Install Red Hat 8 in virtual image: qemu -cpu pentium2 -hda smac_redhat8.img -m 1024 -soundhw ac97 -cdrom psyche-i386-disc1.iso (You change cdrom in qemu by CTRL-ALT-2 and the...

Hardcover Books and Market Segmentation

New books are usually only available in hardcover for about a year. Wikipedia writes that Hardcover books tend to cost more than paperback versions of the book. This is due to price discrimination by booksellers who observe that consumers are willing to pay a premium for hardcover editions over paperbacks beyond the extra costs in materials and production. This bugs me. I think that for most for-fun reading where you aren't taking notes, paperbacks are ergonomically better. So not only do I have to pay more, I am paying more for an inferior product. If they do insist on charging more for new books (fair enough), at least make it an expensive paperback.