Wednesday, November 18, 2009

Git on a Flash Drive

Had some serious trouble figuring this one out...

The Idea: Use Git for source control on my Debian laptop, and keep a copy of the repository on a USB Flash Drive.

It should work something like this:

on flash drive:
mkdir project
cd project
git --bare init
on desktop:
git clone /path/to/usb/drive
make changes
git add .
git commit -m "did something"
git push origin master
But it didn't quite work that way

git clone resulted in the error messages "unable to chdir or not a git archive"
and "The remote end hung up unexpectedly"
The problem here is one of case-sensitivity. Git looks for a file named HEAD.
ls
branches config description head hooks info objects refs
but HEAD is lower case on the flash drive.

Attempts to Fix:
  • Renaming it to head results in an error (its already there).
  • Renaming to a temporary name and then to HEAD results in head showing up again.
So I look around on the drive and find out that NOT every file which has its name downcased. I check properties, and the flash drive is mounted using VFAT. In my configuration (Applications/System Tools/Configuration Editor) I check the VFAT settings (system/storage/default_options/vfat) and see a mount option of shortname=lower. I change this to mixed, remount the floppy and head is now HEAD.

Go google shortname=lower to find the world's opinion of this default...

Anyway, Git works on USB Flash Drives!

Monday, November 16, 2009

jQuery Dialog Input Focus

I'm a big believer in setting keyboard focus to the proper input. As a long-time laptop user, I avoid using the mouse wherever possible. It simply slows me down. Save the mice!

Using jQuery UI's dialog to pop up a form, I could not do this for some reason. Here is my code to set input focus in a dialog.


// In event handler
$('#mydialog').open();
$('#myinput').get(0).focus();


And nothing! I tried with many dialog options, and the only thing I could do to make it work, was to eliminate the dialog.

The only thing I can figure is that the dialog itself is setting focus, or blurring my focus. So I fixed this by delaying the focus call using a timer.


// In event handler
$('#mydialog').open();
setTimeout("$('#myinput').get(0).focus();", 500);


Note, times less than 200 ms were not reliable.

Thursday, November 12, 2009

Disable Windows Automatic Updates Now

If you are a developer using Windows, do the folowing right now

1. Open Control Panel
2. Select Automatic Updates (I know you already switched it to Classic View)
3. Select "Turn off Automatic Updates"
4. Hit Ok
5. Never reconsider this action.

Its not worth it. I've written about the troubles that Automatic Updates causes, how they used it to hijack Firfefox and the joke of Ray Ozzie's calling it a success.

Now, my overnight subversion download was interrupted because Windows Updated decided it would be a good time to update my OS (a server I'm remoting into - its gone off my laptop).

I've lost a day because of this stupid feature. Never again.

At home, my wife's Vista laptop is suddenly locking up since her last update. She believes this to be a plant to get people to buy Win7. Not beyond the realm of possibility, considering the source.