Ask (Google) and ye shall receive

| No Comments
I've (re)discovered AutoHotKey and used it to solve a tremendously annoying Windows "feature" -- you can't move maximized windows.  I downloaded Easy Window Dragging -- KDE Style and hacked it to un-maximize a window before it moves it.

I also thought, Hey, you could implement a virtual window manager in AutoHotKey with not too much difficulty.  Some Googling leads me to an actual virtual window manager (VirtuaWin) and it's free and so far (all of 10 minutes in) I'm quite happy with it.  I wish I'd found it four years ago.

It's all way better than the LiteStep configuration I wasted, oh, two days on.  *shudder*  Suffice to say, run away.

xkcd: Devotion to Duty

| No Comments
For all you die hard Die Hard fans: http://xkcd.com/705/

I hate it when ... invalid models

| No Comments
I hate it when my internal model of a program doesn't quite match its actual behavior.

So I'm tailing a file: "tail -f file".  Tail recognizes when a file's been truncated and starts rereading it.  BUT, even if you say "-n +0" it still starts rereading from the new end, not from the beginning.  So if you have

# Terminal 1
date > file
tail -f -n +0 file

# Terminal 2
date > file
date > file
date > file
You'll never see anything new from tail, because the length of the file never actually changes.

More subtly, say you have

# Terminal 1
date > file
date >> file
tail -f -n +0 file

# Terminal 2
date > file
Here the tail will see that you truncated the file, but it won't show you the new line, because the file length changed from 58 to 29, not from 58 to 0 to 29.

All that's fine and maybe even "obvious" when laid out like that.  But you can get the same behavior like this:

# Program 1, pseudo-Perl
open LOGFILE, ">file";
while (my $request = get_request()) {
    print LOGFILE "the request\n";
    process( $_ );
}

# Terminal 1
tail -f -n +0 file
When you restart Program 1, you won't see the first request in the log file, because just as above, the file length went from (say) 100 to 50, not 100 to 0 to 50.

But if you cat the file, there it is.

Anyway, I hate it when that happens.

(The answer, by the way, is to unlink the file before you start writing to it again, and tell tail "--follow=name".)

An interesting practical tutorial on states of alertness.

| No Comments
If you should find yourself faced with a life-threatening attack by a criminal, as a typical normal person, you will be faced by three enormous difficulties. They are:


1. Recognizing the presence of the predator in time;

2. Realizing, internalizing, and accepting that THAT MAN, RIGHT THERE, is about to kill you for reasons you do not understand; if you don't stop him; and

3. Overcoming your reluctance to do lethal violence against a fellow human being.

Read the rest here.

These comments may be specific to running a Debian Linux guest on a Mac OS X host.

  • Time synchronization is briefly documented in the manual in chapter 9, Advanced Topics.
  • Time synchronization is performed by an in-guest daemon called VBoxService
  • You can tune VBoxService (on the guest) by running VBoxManage on the host.  As near as I can tell, you must restart VBoxService for any changes to take effect.  (In Debian, /etc/init.d/vboxadd-service restart.  To kill it, replace "restart" with "stop".  To start it after you've killed it, replace "restart" with "start".)
  • You can watch what VBoxService does by killing the daemon (see above) and running it from the command line in verbose mode, in the foreground (as root), "VBoxService -v -f".
  • By default, VBoxService wakes up every 10 seconds and adjusts the time.  If the time is off by less than 20 minutes, it adjusts the time by (very roughly) 0.005 seconds.  (Put another way, if your clock is slow by a whole second, it may take half an hour to catch up.)  If the time is off by more than 20 minutes, VBoxService just sets the time.
  • If you want VBoxService to just set the time when it's off by more than 1 second (1000 ms), instead of adjusting it gradually every 10 seconds, you can say
    • VBoxManage guestproperty set <vm-name> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
  • The "--" in the documentation and in the command above is not a typo.
  • Remember to restart VBoxService for your changes to take effect.

A handy guide to Google searches

| No Comments

Judging a "tablet"(?) by its cover

| No Comments
Apple anounced the iPad recently.  The response of one corner of the Internet: http://i.imgur.com/oRffH.jpg.

Skimming through Apple's iPad page makes it clear that they do not consider it a stand-alone device like other tablets, but an adjunct to some other system.  What other fully fledged computer has requirements listed for other computers (http://www.apple.com/ipad/specs/, "Mac system requirements" / "Windows system requirements")?

To be sure, form factor matters, and I suspect that there're a bunch of people out there that'd like something like an iPhone only larger, and now they can get one.  Except that apparently the iPad doesn't do voice (the 3G section of the specs says "data only").  *sigh*  Way to miss the boat, Apple.

It doesn't hurt that it can run iPhone apps and there're thousands of iPhone app developers waiting in the wings.  It has a pre-built developer community and approximately zero learning curve if you're already an experienced iPhone developer.

My basic reaction: Meh.  Sorry, Apple.  :)  I guess I'll stick to my Mac Pro and my iPhone.

VirtualBox doesn't suck

| No Comments
I wanted to run Linux on my Mac laptop, but didn't want to pay $80 for VMWare Fusion if I could avoid it.  It turns out, I could!  I'm not actually done installing Linux yet, but VirtualBox seems pretty nice so far.

I wouldn't bother, since Mac OSX is a Unix variant, but I recently got the hankering to run my Lispworks for Linux on my laptop, so that's what this is about.

Update: Finished installing Linux with KDE.  Worked out of the box.  Currently running konsole exported to the regular Mac X11 server.

Update 2: Hit a bit of a speed-bump on VirtualBox: networking.  The default NAT networking is great: it will take packets from the guest and put them on the host's network.  But ... what if you're currently unplugged?  Then your machine has no network, and no IP address.  Sure, your guest can't get to the outside world, but here's the thing: It can't get to your host, either.

So, try bridged networking.  As near as I can tell, the network you're bridging to has to be up and active.

Then there's host-only networking.  The guest can talk to the host even if the host is not currently attached to a larger network ... but even if it is, the guest can't talk to said larger network.

You can switch between the two, but only if you reboot the VM.

I shall attempt to enquire at the VirtualBox forum.

Update 3: While typing in my question at the VirtualBox forum, I thought of a possible solution, which I tried and it works: Add a 2nd NIC to the guest.  One NIC is NAT'ed to the outside world, the other uses "host-only" networking to talk to the host.  Still curious if there's a better way, though.  My VB forum question here.

The Psychopath Next Door

| No Comments
http://www.robertmatthews.org/psychopath_articles.html

Not all psychopaths are criminals, some are just Grade-A Bastards. Reading these articles, I inevitably thought of people I know or used to know, and basically crossed them all off the list of "possible psychopaths". (I'm sure you're all pleased. :) But one name did stay on the list. Happily, I don't really "know" him, as he's fictional: Greg House.

Spammers ruin it for everyone.

| No Comments

I'm just a tiny blog that no one reads (except you :).  And yet in the past few days I've started getting 10-20 trackback spams a day.  So I'm disabling trackbacks.  *sigh*

Tips welcome on what to do about that crap.