The Mac mini is an excellent computer for basic use at home - it starts (from sleep mode) in seconds, it's small and quiet. I now bought the latest mini but refused to pay Apple's price for the large disk and 4GB of memory. Doing the upgrade yourself is not that hard if you have some experience doing things like that. The OWC video showing the steps is a must of course. Without that video you would be quite lost.
Google loves JavaScript. Here's a pretty amazing collection of js experiments.
C would be Judaism - it's old and restrictive, but most of the world is familiar with its laws and respects them. The catch is, you can't convert into it - you're either into it from the start, or you will think that it's insanity. Read the whole list at Aegisub...
How true - usability explained in another way. The Encore on Computers is also good.
Last week upgraded my 3 year old SonyEricson W800 to a brand new W902. I didn't expect it to be more difficult to use...
It's mostly been the clock and calendar that messes up. It turns out if Daylight Savings Time change, then the calendar is a mess (1 hour mismatch). I use goosync to synchronize and the company says it's the phone's fault ("clocks on these devices may change correctly for the DST change but the calendar events will not be changed") and that all you can do is reset everything and start over. You should be careful though to do it the correct way - read the instructions carefully!
I bought a new mobile phone this week. I installed synchronization of the phone's calendar with my Google calendar. I use Goosync for this - a nice and free utility that works just fine.
In step 2 I synced my mobile with my contacts in Outlook. I use Outlook only for contacts, no email, no tasks, no calendar. What I didn't realize was that when the phone did this sync with Outlook it made a reset of the calendar (since the Outlook calendar was empty, of course).
In step 3 (a bit later) I did a sync of my phone using Goosync. I think you can see what this lead to: all of my Google Calendar was reset. For the sync service it looked like I had cancelled all my appointments in my mobile phone calendar and now wanted to update that fact to the main calendar. Oh man... there is no undo in Goosync, the phone or Google I can tell you.
Many ugly words later I sat down and made a small script that downloads my Google Calendar to my computer and rotates a log of old backups. Use it if you like. If you use an online calendar as your only calendar you do need some kind of backup. There are more ways than I described to loose your calendar entries.
For this script to work you need access to (unix) shell commands and the wget command. If you use Linux everything is probably already there. If you use Windows you might look into installing Cygwin. I scheduled this script to run each morning using crontab. The same can be done on Windows using the builtin scheduler.
#!/bin/bash
# make sure wget is on your path
PATH=$PATH:/it/sw/gnu/bin/
# EDIT: how many previous versions to keep
NUMBACKUP=9
# EDIT: the backup files are saved in this folder
DIR=/home/erikb/private/cal
# EDIT: URL to your calendar (ICS version), look in your settings at Google
URL=http://www.google.com/calendar/ical/USERNAME%40gmail.com/public/basic.ics
# name of file when downloaded, given by the URL above
TMP=basic.ics
# filename for saved backups
PRE=gcal.ics
### Enough settings, do the backup thing now
# goto backup folder
cd $DIR
# clean up old stuff, just in case
rm -f $TMP
# shift backups
COUNTER=$NUMBACKUP
while [ $COUNTER -gt 0 ]; do
let i=$COUNTER-1
mv -f $i.$PRE $COUNTER.$PRE
echo "mv -f $i.$PRE $COUNTER.$PRE"
let COUNTER=COUNTER-1
done
# download calendar
wget $URL
# rename file
mv -f $TMP 0.$PRE
# clean up, just in case
rm -f $TMP
Nice way to visualize methods calls in code. Impressive graphs.
This is just a short post about the first experiences with my new computer. My benchmark post concluded the new system is twice as fast as my previous build.
Step 1: as always, it is recommended to put most components together outside the box. At least the CPU, cooler and memory need to be installed this way.
Step 2: change case fans to someting really silent. I use the beige "NOCTUA NF-S12-800 SILENT CASE FAN 120MM", even if the default fan in the Antec Sonata Designer 500 is pretty ok as it is. This fan, and the cpu cooler, is what will create most of the noise so it is important to spend some money on quiet quality componets. Noctua isn't cheap.

Step 3: I added two front fans, so that the flow through the case would be improved. They suck in air right over the hard drives and onto the passive graphics card. I use power adapters to clock down the fan rotation by 50% (included from Noctua). You cannot hear these fans at all at this slow speed. Again Noctua, 2 x 92 mm.
Step 4: the drives go in. Even if the rubber band mounts have beed improved from previous case versions, I don't quite trust them. I used the screws with rubber pads.
Step 5: most things are in place. A graphics card and some cabling remains. I wish I had known about the Asus EN3650 Silent Graphics Card - it seems to have the right mix of performance and cooling. It has passive cooling (a must) and has 2 DVI connectors - it's easy to find passive cards with DVI+VGA but 2xDVI are still a bit rare. I now use the similar "ASUS EN8600GT" but it's rather old and gets a bit hot. 
Final step: OS installation and then finalize all cabling.
The system is very quiet and (so far) is running just fine. My shopping list was:
Case: Antec Sonata Designer 500 Motherboard: ASUS P5E3 Deluxe - ATX - iX38 CPU: Intel Core 2 Duo E8400 / 3 GHz CPU fan: ARCTIC COOLING - FREEZER 7 PRO Disc: 2 x Samsung SpinPoint T166 - 500 GB Graphics: ASUS EN8600GT SILENT/HTDP - GF 8600 GT DVD: Samsung Super-WriteMaster SH-S203P - DVD±RW Fans: NOCTUA NF-S12-800 SILENT CASE FAN 120MM + 2x NOCTUA NF-B9 SILENT CASE FAN 92MM
A nytimes article on the growing fight against information overload, especially email addiction. I like the solution with Google's E-Mail Addict - "an experimental feature for the company's e-mail service that lets people cut themselves off from their in-boxes for 15 minutes."
"There's a competitive advantage of figuring out how to address this problem," Mr. Tang said. He said that there was "a certain amount of irony" in the fact that the solutions are coming from the very companies that built the digital systems in the first place.
A new CPU, a new java version: almost exactly twice as fast as the old benchmark from two years ago.
> java -server -cp . jnt.scimark2.commandline SciMark 2.0a Composite Score: 894.2564204678547 FFT (1024): 592.4730423267126 SOR (100x100): 1180.732257373216 Monte Carlo : 327.4601432249603 Sparse matmult (N=1000, nz=5000): 577.6641556409897 LU (100x100): 1792.9525037733952 java.vendor: Sun Microsystems Inc. java.version: 1.6.0_10-beta os.arch: x86 os.name: Windows Vista os.version: 6.0
Benchmark number 2: ripping a CD. Exactly the same CD as before. I used Incognito's album "Eleven", CDex ripper with quality=2 (high) and 256 kbps setting.
Almost no change at all. The CPU is not the slowest component it turns out.
2008: Intel Core2Duo E8400, 3.0 GHz, 2:25 minutes. 2006: AMD Athlon 64 X2, dual core 4200+: 02:55 minutes. 2005: Intel P4, 2.26 GHz: 08:26 minutes.
With a couple of plugins in the browser you easily waste screen estate. Here's a few tips on how to get that space back. Note that you have to configure the new menu to include (some of) the buttons from the old navigation menu.
A beautiful solution for sharing files online, with a group, between computers or whatever your need is. (via fosfor.se)
I used to have these old classic K141 headphones along time ago. Solid construction - but more important - they sound good even at very high volume levels. I used to really put them to the test, and nothing... in the end they wore out mechanically. I now bought the updated Studio version (55 ohms). It's easier to use with mp3 players and at work (computer output). The result: many albums got a whole new life and sound - I'm very pleased.
The sound is close to neutral. Bass is better compared to the more common ear plugs that many use. It's on a whole different level really. I now see (damn) AKG just released the MK II version.
I guess you have to be a bit of a nerd to find this funny.
"I need a woman (obviously) who is willing to raise a child with me in the method of Unix."
The slashdot take on this wanted ad was:
ohtani@darkstar:~$ man woman Segmentation fault (core dumped)
"Bad software usually just annoys people but bad engineering can kill. An even more fascinating metric is this: 5% of programmers are 20x more productive than the other 95%. If this were a science, like it claims, we could figure out how to get everyone to the same level."
I'm not sure what Bruce Eckel is trying to say? Thay JRuby is strange? The feedback return values are fantastic. False is good, nil is not an exception and therefore a good thing...
IDG testar tv: "Efter att ha hårdgranskat skillnaderna mellan plasma och lcd i en vecka var det dags för blindtest. Vilken typ av tv ger bäst bild, och hur viktig är upplösningen för upplevelsen? Efter vårt test blev det tydligt att inte ens experterna ser skillnad mellan hd och full-hd på riktigt nära håll."
For those that don't follow the Google news: Android is a software stack for mobile devices that includes an operating system, middleware and key applications.
I didn't expect it to be available for download so soon.
Welcome to dork talk with Stephen Fry.
ACM Queue speaks with two Sun engineers: Jeff Bonwick and Bill Moore. They developed ZFS to address many of the problems they saw with current file systems, such as data integrity, scalability, and administration.
Tom's Hardware has a piece on a new type of storage. Solid-state drives (SSD) seems the way to go. What I miss from the review is a more subjective opinion on how it affects normal use; Tom's reviews tends to focus only on the numbers. All aspects except random write seems better with SSD.
More about the disks at SanDisk. Their whitepapers are not fantastic reading (just a bit biased you could say), but still something with more detail. Tom says a SSD with 32 GB will cost about $400 at the moment.
I bought an AirPort Express more than a year ago. It's been sitting next to my Mac Mini, in its original box. I'm ok with connecting to the Internet using cable so I don't really know why I got this device.
I remember my old D-Link Base Station and the hard work it was to make it do anything. Without a manual you couldn't do anything. With a manual you could cause a big mess. That was it, more or less.
This Sunday, I plugged the AirPort into a socket in my living room, connected it to AUX on my stereo (that is, no internet cable attached to the AirPort), then turned on the Mac Mini. It connected to the AirPort and said there was new version of the firmware available - "Should I get it?". I clicked yes, waited while the Mini downloaded it, installed it wirelessly, rebooted the AirPort and then said "all done". A few more clicks and the connection was running encrypted (WPA2). This took less than 3 minutes.
Now I can use iTunes to play music through my stereo wirelessly. It's not often you find computer devices with this kind of usability.
Everybody knows that the iPhone can make phone calls, play movies & music, surf the web, and a lot more. But, Will It Blend? That is the question.
See willitblend.com for more things (not) to blend.
As most Linux users I've read about ReiserFS. The wiki page about the file system is.. laconic?:
"ReiserFS was the default file system in Novell's SUSE Linux Enterprise until Novell decided to move to ext3 on October 12, 2006, two days after principal author Hans Reiser was charged with the murder of his wife."
In short: Reiser denies killing his wife, her body has not been found, the trial is set to begin in July.
Wired's Joshua Davis met him in jail. It's a strange, strange read - a mix of low-tech implementation facts and the murder case, filled with details about a bizarre life. Hans Reiser: Once a Linux Visionary, Now Accused of Murder
Wall Street Journal has the info.
I love that people have the time and energy to do these kinds of things.
Want more? The get a first life page is pretty funny.
When you look at how digital cameras produce images it is a wonder they look like the real thing. There are so many strange things about how images are constructed; twice as many green sensors, interpolation of colors and the whole filtering issue. There's a good tutorial about sensors by Sean McHugh.
Now Kodak says they have something dramatically better. Looks impressive.
The Guardian says 60 grams!
Has it really been that long? See W3C's history and highlights from 10 years with style.
Not exactly wizard code, but why not publish it anyway... I googled for an example like this myself but had trouble finding a good match. Maybe it was more a question of finding the right keywords to search for.
I use this code on the Swedish site for the World Usability Day.
function daystogo() {
// my target date is November 14th 2006
$then = mktime(0, 0, 0, 11, 14, 2006);
// calculate difference between now and then
$now = time();
$diff = $then - $now;
// second, minute, hour
$days = round(0.5 + $diff / 60 / 60 / 24);
// make sure we do not return negative zeros
if ($days == -0) $days = 0;
return $days;
}
// somewhere later in the code...
$days = daystogo();
// if ($days > 0) ...
I upgraded from my old Ixus 50 to the brand new Ixus 850. The 850 has image stabilization (IS) which was my main reason for the switch.
I took a shot of my office, made a crop of the air condition switch and part of the whiteboard. It's quite a big difference, not only because of the higher resolution but also in quality.

Ixus 50, crop 100%
Ixus 850, crop 100%
Ixus 50, crop+resize
Ixus 850, crop+resize
The image quality is a lot better on the 850. The display on the back is also more usable. The old camera had a better casing though - solid metal, and really tight and compact. The new 850 has a plastic feeling and is clumpsier.
Steve Yegge, a developer at Google, writes about software life at Google. Steve lays out some of the software development practices (Agile) that make Google work. A good read.
Come on... it has to be a fake! Nobody can fly like that. The plane seems to hover in air, by itself. If this is true, birds will be jealous of this pilot.
Jag skulle nog kunna tänka mig en låda ActiveGPS, för att bli informerad om kommande vägkameror. Lådan kanske kan få en att bättre hålla fartbegränsningarna? Företaget borde i alla fall göra om lådan även för ett mer seriöst syfte, inte enbart som en pryl för att slippa fortkörningsböter.
Den skulle kunna varna när man kör mer än, säg, 10 km/h för fort. Jag ser inte riktigt att den skulle hjälpa mot dålig körning, som de själva illustrerar med denna bild. Svarta streck innan en vägkamera - genom deras box så bromsar man alltså i god tid, men har i övrigt lika dålig trafikmoral, eller?

I tried to update the software on my mobile phone, a Sony Ericsson w800i. There's a handy tool for that, called Update Service, that you can download from Sony Ericson. I like that you can do that yourself - without having to go to the phone resellers (and even have to pay for it). Of course the update software didn't work. I would have been surprised if it did, actually. My experience is that companies like this do not care about customer software. If they did we would not have projects like floAt's Mobile Agent. Exactly the same goes for many other tech companies, like Philips and Creative.
When trying to run the update, I got this window.

Of course I updated my Macromedia software. Who knows what version it expects... why it (at all) required Macromedia to flash the phone bios I don't understand.
It turns out that Internet Explorer needs the latest version of the Flash plug-in - not something a Firefox user really cares about. Ok, so that is now done and it is working.
When you update the phone, it says to remove the SIM card, press "c" and insert USB cable. Did this, but didn't realize to hold "c" pressed for maybe 10 seconds, until a new window pops up, saying "Let go of c". Oh man...
A pretty complete list of case mods.
My favourite is the Hypercube.
A comparison of how video games look now and 20 years ago. Computer graphics really have moved on...!
Gaming now and then. (fosfor gadgets)
I have an office webcam - a camera that sucks big time when it comes to the bundled software. All scripts and grabbers have to be written by the buyer, basically. It shows the view from my office. Not a very interesting view, but at least it's there and it's free.
I grab and publish a new image a couple of times per hour. Today I wrote some scripts that combine all those daily images into a small video clip. The clip is 21 seconds long, starting at 00:00 and ending before midnight. The clip is automatically updated every day. Check it out over here.
My plan is to make a clip of the whole year.
Songbird is a Web player built from Firefox's browser engine. Songbird is open source. Beautiful and technically interesting. Quite impressive. The music even sounds better...
I repeated the same old Scimark 2.0 benchmark, but now with a server setting for the jvm. The benchmark now runs 165 percent faster! Incredible.
> java -server -cp . jnt.scimark2.commandline SciMark 2.0a Composite Score: 449.17374212032354 FFT (1024): 360.08271871383903 SOR (100x100): 708.6998662588823 Monte Carlo : 62.282009179537155 Sparse matmult (N=1000, nz=5000): 320.3128048768835 LU (100x100): 794.491311572476 java.vendor: Sun Microsystems Inc. java.version: 1.5.0_06 os.arch: x86 os.name: Windows XP os.version: 5.1
What can you say about someone who is the creator of Del.icio.us, convinced Flickr to start using tags, and was involved in GeoURL... At 31!
Interview in the Guardian.
I made another benchmark test, by ripping a CD to MP3.
I used Incognito's latest album "Eleven", CDex ripper with quality=2 (high) and 256 kbps setting.
P4 2.26 GHz: 08:26 minutes.
AMD Athlon 64 X2, dual core 4200+: 02:55 minutes.
For ripping the new computer is 2.9 times faster. I'm quite happy about that.
I got the replacement power supply from my distributor and it solved the problem. The only obstacle was that I had to remove the motherboard to replace the power supply - not the best of solutions. It should be an easy fix for Antec to build the left side of the tower so that it is possible to slide the power amp out without having to rebuild the entire computer.
I ran the scimark2 benchmark again.
Composite Score: 271.17860249249054 FFT (1024): 109.01504 SOR (100x100): 509.6416128038548 Monte Carlo : 41.09544600963967 Sparse matmult (N=1000, nz=5000): 241.0298025378471 LU (100x100): 455.1111111111111 java.vendor: Sun Microsystems Inc. java.version: 1.5.0_06 os.arch: x86 os.name: Windows XP os.version: 5.1
So, the new machine is 1.7 times faster than the previous score.
It turns out the are (in-)compatibility issues between ASUS motherboards and Neo HE power supplies. This means there's no progress at all. To make it even worse, Antec has failed to label the upgraded power supplies with a tag so my reseller doesn't know if the shipped replacement supply will fix the problem. I'm guessing I will get another supply with the same old compatibility problem... This project is already one month long!
It's close now. Everything is connected. Some cables still require some work. Some of the cables are almost impossible to hide.
The left side panel is removable, and you can hide some cables through here. Good solution. Note the thumb screws on the front side fan intake.
It's not that visible (click to see a large image) but the CPU fan is in the way of the memory. You must use this first memory slot if you have two memory chips. I had to remove the fan from the cooler, mount the memory and put the fan back. I hope it will work.
Rubber mounting the drives. They kind of hang in the air. Not recommended for transport.
In order to know if the new computer is any faster I clocked my current machine. There are quite many ways to do this. For me, development in Java is one of the few performance-critical tasks (and ripping of CDs).
I used the straightforward Scimark 2.0 benchmark. My result is not very impressive. I ran the benchmark while all my normal apps were running (such as web, email, winamp, etc). That's close to 50 processes, almost all idle but still... CPU was at around 4% when idle.
I use a Dell Optiplex GX260: Pentium4 2.26 GHz. 640 MB of RAM.
> java -cp . jnt.scimark2.commandline SciMark 2.0a Composite Score: 161.214980498726 FFT (1024): 64.60150518518519 SOR (100x100): 314.6562679937868 Monte Carlo : 17.748972704108535 Sparse matmult (N=1000, nz=5000): 117.82812366457514 LU (100x100): 291.24003294597435 java.vendor: Sun Microsystems Inc. java.version: 1.5.0_06 os.arch: x86 os.name: Windows XP os.version: 5.1 > java -cp . jnt.scimark2.commandline -large SciMark 2.0a Composite Score: 121.90855699535048 FFT (1048576): 18.205057702127657 SOR (1000x1000): 299.16657188068535 Monte Carlo : 16.777216 Sparse matmult (N=100000, nz=1000000): 113.77777777777777 LU (1000x1000): 161.6161616161616
My 3 year old Dell feels slower each day. It's not good-looking at all. It makes noise. Time has come to upgrade. Just for fun, I will put together my new computer from scratch. I will document the whole process here, with photos.
Step one is buying the right components. Here's my shopping list:
The fosfor gadget blog tries it's best at convincing us - you need a new and better camera. Something like 39 megapixels per shot. That should do it. Then you will be able to fill your monthly Flickr quota with just about 50 photos or so... or just one (1) photo is you are on the non-pro account!
Turns out there are no fun tech jokes on Java. From Chet Haase's blog. Dry.
Two items walk into a ToolBar.
The bartender says, "Can I get you a menu?"
"No thanks, we're looking for a little action."
I tried to activate email in my brand new w800i but failed on the encryption part - "TLS/SSL unknown certificate authority". My email provider regards itself big enough to have their own certificate infrastructure (the Swedish Universities act as their own CA) and, of course, the phone does not know about this. Sadly, there is no way to enter or enable a new CA in the phone. Conclusion: no email for me.
SonyEricsson, please look into this...
Update: I spoke to SonyEricsson Support, and they said they already had made a request for self-signed certificates, but don't know if/when that will be added. A bit sad, as this will hinder quite a lot of services. In theory, this will prevent all Swedish University staff from using secure services.
This piece of code is mainly intended for our department staff. We have a free (as in free beer) SMS gateway which allows us to email our mobile phones. The email is converted to a SMS message of course. I think many operators have this kind of gateway even if they don't always like to inform customers of it.
This code is meant to run regularly, using your WinXP scheduler or unix cron. You or your sysadmin needs to install the perl package Quota first.
#!/it/sw/gnu/bin/perl
use warnings;
# see http://search.cpan.org/dist/Quota/
use Quota;
$debug = 0;
# what quota to check, change this to your home directory
$path = "/home/USERNAME";
# lower than this and a warning is sent, in kB
$limit = 50000;
# who to notify, using your cell phone SMS gateway
# UU/IT staff, see: http://www.its.uu.se/tjanster/minicall.html
$to = "0123456789\@sms.OPERATOR.COM";
# mailer
$mailprog = '/usr/lib/sendmail';
# must call with arg "check"
if (@ARGV > 0 && $ARGV[0] eq "check") {
$space = &checkquota();
if ($debug) { print STDOUT "quota left is $space\n"; }
if ($space < $limit) {
¬ify($space);
} else {
if ($debug) { print STDOUT "safe quota\n"; }
}
}
sub checkquota() {
$dev = Quota::getqcarg($path);
($bc,$bs,$bh,$bt,$ic,$is,$ih,$it) = Quota::query($dev);
if ($debug) { print STDOUT "$bc,$bs,$bh,$bt,$ic,$is,$ih,$it"; }
return ($bs-$bc);
}
sub notify {
my ($str) = shift (@_);
open (MAIL, "|$mailprog $to") || die "Can't open $mailprog!\n";
print MAIL "Subject: $path quota $str\n";
close (MAIL);
}
I'm not a big fan of laptops since I prefer to work at... work. This meaning a stationary computer.
Here's a simple device built-in in new PowerBooks. I saw this kind of technology used in early prototypes on an iPaq. The Digital guys used the motion control to navigate in games - Doom or Quake I think it was.
Having the same possibility in mobile phones would also make sense I guess.
Not really a surprise, but one of the great in Computer Science, Alan Kay, does not like Java. ACM Queue has an interview with him. Not for newbies.
There are strange people out there. Really strange.

ABBA showing improper foil use.

Hurley showing proper foil use, and accessorization.
I recently bought a webcam. It was a cheap Philips ToUCam, a real entry level model. This turned out to be a complete waste of money - you could only capture images using the boundled software. The software was extremely limited and of no use at all.
Today I bought a Creative NX Ultra. This is, I guess, a middle range model in the webcam domain. The camera itself is ok, image quality is acceptable and so on. My main problem is with the software. I couldn't even imagine it would be so difficult to perform the most basic webcam tasks: (i) schedule image captures and (ii) transfer the images to a web server.
The second thing that could be improved is the USB cord. I wish it was detachable (from the camera) so I could replace it with a longer one. USB extensions are not so fun to mess with.
Image capture scheduling is a real pain. You can (rather, have to) schedule them using the supplied software but the scheduling is awkward and not easy to get working. The scheduling does not show up as a normal scheduled task in Windows. What I would like to see instead is a command line tool that captures images according to supplied arguments. Then one could schedule the capture task the same way all tasks are scheduled in Windows. Something like this:
twaincam.exe -capture -quality high -folder C:\images -name foo.jpg
I know of TWAINCommander but I won't pay $199 for this.
The Creative developers included in the software a way to transfer images using ftp. ftp? Is anyone using that, still? I cannot even try that since most security-aware departments block incoming ftp. Bad as the ftp solution is, there is no way to name the image file so even if the transfer was working it would be of no use...
So, script writing again... I think I've got the capture thing working at last, so the webcam software now dumps images named like Img-20041109-11898198918.jpg into a specified folder. From that point on a script can rename and transfer the image.
:: capture.bat, rename webcam images + transfer to server
::
@echo off
:: webcam will dump images here
set from=C:\capture
:: path to our server
set dest=K:\some\where\on\a\server
:: name of image
set name="capture.jpg"
:: Rename the most recent file in directory to another name
:: go to destination directory
pushd %from%
:: find the newest file, should be my latest captured image
for /f %%i in ('dir /a:-d/b/o:d "*" ') do set file=%%i
:: must use "move", as "ren" cannot handle collisions
move /y "%file%" %name%
:: return to original directory
popd
:: Copy image to server
:: c ignore errors
:: q quiet
:: y supress promting to overwrite
:: i dest is dir
xcopy %from%\%name% %dest% /q /c /y /i
This script is easy to schedule using XP's builtin scheduler. All I need now is to find a way to transfer the file using some better protocol than smb/xcopy.
And here is the webcam. I know, it pointing nowhere useful at the moment.
This web page is generated for each access, by parsing an XML file and transforming the XML contents into HTML. All parsing and transformation is done in PHP. This is really nice from a functional point of view. Changes to the look and layout are very easy to do. The strong separation between content (the XML file) and the view (this HTML page) is valuable because it means the two formats are very loosely coupled - I can make changes to the content or view without affecting the other. The parsing and transformation code (the controller) forms the glue between the two formats. MVC for you programmers.
Parsing the XML data for each access is no problem if you have a fast computer. Today almost all computers are fast enough for such a tiny task. Sadly, the server I run on is busy doing a lot of other things - and sometimes you want to have a sound solution that also cares about practical issues and not just the functional ones. So, I decided to test if a cache of the XML contents would be possible. It turns out it was, and easier than expected too.
The functional solution, with parsing of the XML, is able to produce something like 3-4 pages per second. With the cache, the server now is able to do about 12 pages per second. Not too bad, especially considering it only took 15 lines of PHP code and there's no loss of functionality (no manual generation of the cache).
define("CACHE", "/some/path/web/cache"); // must be server writable
function parse($filename) {
if (file_exists(CACHE)) {
$origchange = filectime($filename); // when source content was changed
$cachechange = filectime(CACHE); // when cache was generated
if ($origchange < $cachechange) { // cache is newer than source
$file = fopen(CACHE, 'r');
$contents = fread($file, filesize(CACHE));
fclose($file);
return unserialize($contents); // return contents of cache
}
}
// we do not use the cache for this lookup
$data = parsefromfile($filename); // read original data from xml, the old way
$file = fopen(CACHE, 'w');
fwrite($file, serialize($data)); // save to cache
fclose($file);
return $data;
}
With this solution the cache is constructed by a simple serialization of the PHP data structure. For each access, if the cache exists and is newer than the XML contents, I read and unserialize the cache. If I make an update to the contents (the XML file) the cache is automatically re-generated (because it has an older timestamp) and I need not worry about the cache at all. Works out nicely I think.
This unserialization is almost 4 times faster compared to the XML parser. In reality, the unserialization is a lot faster but with all the overhead (generation of HTML etc) this is what I get when I look at the whole process of making this page. If you only compare the cache vs. parsing you would get a factor 10, if not more.
I filed this review under "tech" because it is a tech review. From one of the links in the review: "Notice how infra red transforms your average household moggie into the Beast of Satan!"

This repaint manager will make sure you call swing repaint operations from the right thread (the event dispatching thread).
From ClientJava: Easily Find Swing Threading Misakes
Not a bad idea, simple and easy to modify for your own needs.
//
RepaintManager.setCurrentManager(new ThreadCheckingRepaintManager());
//
public class ThreadCheckingRepaintManager extends RepaintManager {
public synchronized void addInvalidComponent(JComponent jComponent) {
checkThread(jComponent);
super.addInvalidComponent(jComponent);
}
private void checkThread(JComponent c) {
if (!SwingUtilities.isEventDispatchThread() && c.isShowing()) {
System.out.println("Wrong Thread");
Thread.dumpStack();
}
}
public synchronized void addDirtyRegion(JComponent jComponent,
int i, int i1, int i2, int i3) {
checkThread(jComponent);
super.addDirtyRegion(jComponent, i, i1, i2, i3);
}
}
I liked Mark's mp3 blog idea, and made a variation on the same idea using the (free) tools mp3splt and mp3wrap. This utility can capture snippets from a collection of mp3 files and then paste them together into one "preview". I did this via a simple shell script. Ok, I know the script is not very pretty... I use Cygwin under WinXP by the way.
#! /bin/bash
# path to the mp3 utilities; see http://mp3splt.sourceforge.net/
SPLIT=mp3splt.exe
WRAP=mp3wrap.exe
# temp dir to put files in
dir="split"
# remove any old mp3 file
echo -n "Clean old comp.mp3..."
rm -f "comp.mp3" ; echo "done"
echo -n "Clean temp dir..."
rm -fr $dir ; echo "done"
mkdir $dir
# arg1 is a folder with mp3 files we want to process
folder="$1"
# Capture 20 seconds of music, put result in $dir.
# The loop is written this way to be able to handle files with spaces
# in the filename; quotes around $file is also needed because of this.
ls $folder | while read file; do
cd $folder; $SPLIT -q -n "$file" 02.10 02.30 -d ../$dir ; cd ..
done
# append all files in $dir into one file comp.mp3
echo -n "Wrapping..."
cd $dir ; $WRAP ../comp.mp3 *.mp3 ; cd .. ; echo "done"
# remove added tag in filename? mp3wrap always adds this tag...
mv "comp_MP3WRAP.mp3" comp.mp3
echo -n "Remove temp dir..."
rm -fr $dir ; echo "done"
I took 20 seconds (02:10 - 02.30) of each song from my latest compilation and put them into this MP3 sound bite (5 MB). See playlist below.
I used to be a bit of a hifi nerd, buying and selling audio equipment for fun, looking for 180 gram vinyl pressings, reading really, really, cheesy hifi mags. Luckily those days are over. Today, I cannot stand reading hifi magazines, as they mostly are full of subjective nonsense. I switched over to the computer nerd group instead and have been happy ever since...
In my town (Uppsala) there used to live a guy called Bo Bengtsson. He was, and still is, the best swedish speaker designer ever (maybe in competition with Stig Carlsson). I think he now lives in the US? I know he used to design speakers for Cello, and later on for Red Rose Music (for Mr. Mark Levinsson). Bengtsson is now working on new speaker technology in his own company Transmission Audio. I wish I could afford one of those speakers.
I own speakers made by Bo Bengtsson's former company Audio-Tronic, model CM3. I scanned an old Audio-Tronic advert, available here as PNG. I had to scan with 300dpi in order to make it readable. It's about 2MB large.
Especially note Bo standing beside the huge Megatrend speakers!
Maybe it's time to form a fan club, "Audio-Tronic Sweden"?
"autop" is quite a handy (PHP) utility to convert newlines into a valid (html-)paragraph. This is way beyond my own skills in PHP...
The photo matt site is impressive, in both functionality and design. Good use of CSS too.
So I made this new site, using only PHP and XML. I was not so happy with the blog software out there - I don't want to install a database and lots of other tools just for this pupose. Where is the simplicity in those systems? You so easily get stuck with some tool that you have to use and support forever.
My solution is one single XML file that PHP transforms into this HTML code. It's fast enough (not exactly slashdot speed though), it's simple to modify and maintain, and I can easily edit the contents with an XML or text editor. If you need to have something similar, contact me and I will send you the code. You, of course, need a server (I run on Apache) with PHP4, and at least the php module domxml. This should be pretty basic stuff for any web server I think.
The pages are still a bit rough and not very pretty. I'm working on it...
Although we are just a small part (about 25 staff members) of a department we still get quite a bit of spam. The spam fills up our mailboxes and our log files.
As postmaster for our domain I find the reading of the
mail logs difficult and boring. Simply put, it never happens...
Each night, I automatically filter the mail log files into a readable text summary. That works ok but it can still be improved. In the next stage I transform the text summary into a periodic spam table for the last days. The transformation into a periodic spam table is done dynamically, per request.
Here's how to read the entries in the table:
I also extract some extra information, about days with the higest and lowest ratio of spams in relation to non-spam. See the table below.
| 4 days ago | 3 days ago | 2 days ago | yesterday |
| The day with most spam in relation to non-spam | The day with least spam in relation to non-spam | The day with higest number of spam |
The color coding is just a classification of the spam ratio.
See the result.
We all get a lot of email through a number of aliases. It would be convenient to see what alias the mail was sent to in the list of new mails. This way you don't have to open the mail to find out exactly what alias the mail was sent to.
Many mailing lists do exactly this. They append the name of the list on the subject line, so that it is easy to do filtering or just recognize that some email comes from a certain list.
I want to do this for a number of aliases,
such as "webmaster", "abuse" or whatever. These are aliases that
are important and I want to highlight those mails.
Also, I don't want to mess with
per-user .procmailrc files because that is more difficult
and might interfere with the delivery of mails. It is also
difficult to setup for someone not familiar with procmail.
Instead, I want to do this processing
in one single central place, for all users.
The image below shows what I want:
some mails have a tag first on the
subject line. This way I can, for example,
see that someone sent a message to the abuse alias.
I run sendmail 8.12.X on RedHat, right out of the box.
No modification of sendmail at all.
You'll also need procmail and formail. I think they are installed in most UNIX systems.
In my definition of aliases (in /etc/mail/aliases) I wrote:
abuse: "| /usr/bin/procmail -m /etc/procmailrcs/tag.rc [abuse] abusereal" abusereal: postmaster, kenny, "| /path/to/archiver abuse"
Here I define the desired public alias "abuse", and forward the email
to procmail to be processed.
-m means procmail runs as a mail filter.
Then follows the path to the procmail instructions, plus two arguments.
The file /etc/procmailrcs/tag.rc is my way to
rewrite the subject line and resend the mail.
It needs 2 arguments:
Note that I resend to another alias, which is the next line in the aliases file. This way I can define almost all behaviour in this single file (the aliases file) instead of having this information all over the place. It also enables further processing should that be desired.
This resource file for procmail looks like this:
# ----- tag.rc -----
# Rewrite subject line of the mail and resend:
# arg1 is text to pre-pend to the subject line,
# arg2 is the address to re-send the mail to
#
# get the text to prepend to the subject line
TAG=$1
# find out who to forward this email to
FORWARD=$2
# extract the original subject (this also eliminates leading whitespace)
:0
* ^Subject:[ ]*\/[^ ].*
{
SUBJECT=$MATCH
}
# create the new subject token
SUBJECT="$TAG $MATCH"
# insert it into the headers
:0hf
| formail -I "Subject: $SUBJECT"
# and forward
:0
! $FORWARD
# ----- END tag.rc -----