Thursday, December 22, 2005

Google Desktop Plug-ins: How to install the Hello World plugin

I recently installed the Google Desktop. It has some very nice built-in features that let you read your gMail and regular mail at a glance, as well as some very advanced local and remote search capabilities. But what really interested me was the vast number of Google Desktop plugins being developed, and the capacity to create my own plug-ins. I'm especially interested in the SideBar plug-ins that allow you to embed a program in the sidebar.



I poked around and found the necessary SDK to do Google Desktop Plug-in development. I found that getting the first, Hello World plug-in up and running was a little involved, so I thought I would post how I did it in case anyone else had this problem.



How to Install the Google Desktop Hello World Plug-in

  1. Download the Google Desktop SDK from http://desktop.google.com/downloadsdksubmit. This will download the file GD_SDK.zip. Unzip it. For this example, I'll assume you unzip it to c:\GD_SDK.


  2. Download the WiX Toolkit (Windows Installer XML) from http://wix.sourceforge.net/latestrelease.html. You want to download the file called "binaries...".


  3. Important: Unzip the WiX binaries file to c:\GD_SDK\api\tools.


  4. Open a command window. Change directories to the location of the Hello World plugin:

    cd c:\GD_SDK\api\samples\scripts\display\HelloWorld


  5. Execute this command to create the Hello World.msi file:

    c:\GD_SDK\api\tools\GoogleDesktopPluginInstaller.exe plugin.gdp


  6. Run the resulting Hello World.msi. This will install the plug-in to your Google Desktop sidebar.



Of course, you have to learn a lot more than just this to write Google Desktop Plug-ins, but this process will ensure you have what you need to produce them.


Sunday, December 18, 2005

Musipedia lets you search for music by whistling the tune

I just found a web site that I had been looking for for years now: Musipedia lets you search for a song by whistling the tune:



http://www.musipedia.org/whistle.0.html

You have to go through a bit of configuration to allow your Java plugin to record the sound of your whistling.



Basically, on Windows XP/2000, you have to save a file called "c:Documents and Setting.java.policy" with these contents:




grant {
permission javax.sound.sampled.AudioPermission "record";
};


After that, you will be able to whistle or sing a tune, then search for it.



I tried out whistling part of Vivaldi's "Concerto in D minor for two mandolins". It came back as a possible finding, along with (among others) Lennon & McCartney's "No Reply".



It works by using something called The Parsons Code for musical contours. Basically, it tracks relative note values by listing if the melody when Up, Down or Repeated, as U, D, or R. So the Parsons Code that I whistled into the search engine was "*UDDDDDRR", which is also the pattern for part of "No Reply".


Monday, December 12, 2005

Should Mardi Gras 2006 go on?

I just saw that a group of people are suggesting that Mardi Gras 2006 be called off. Actually, I've been telling folks that Mardi Gras would most certainly go on-- that if it did not, people would take it as a sure sign that New Orleans was dead.

I'm not sure what's right now. I sympathize with the people who are homeless and would rather see the resources put to other use. But Mardi Gras really defines New Orleans... it's not really New Orleans without it.

I've put up a poll question about this. Please comment.

My running gear

I can't run right now because I slipped on some ice walking out my front door and hurt my knee. This is what being 41 is all about-- I took up weightlifting last year with no injuries, then hurt my back yawning.



Anyway, in light of my injury, I thought I thought I'd write a little about what I'm running in. This isn't a list of recommendations-- in fact I'm considering changing my shoes because my knees are really taking a beating. Anyway...



Shoes: I'm running in a pair of Nike Free 5.0s. I know, you're probably wincing. The recommendation is to use these for 20 minutes a week, and I'm using them as my standard shoes. But I have this dumb purist idea that if my running style is good enough, I should be able to run barefoot. Don't be like Tim, Tim's brains are trying to kill Tim's knees.



Friday, December 9, 2005

Javascript Date Since Calculator

This is a simple piece of code to calculate the number of days since an event:




function daysSince(yr, mo, dy) {
var anniv_date = new Date(yr, mo-1, dy);
var today = new Date();
var diff = (today - anniv_date)/1000/60/60/24;
document.write(parseInt(diff));
}


You call this within your HTML as daysSince(2001, 09, 30) where the parameters are the year, month, and day of the anniversary.



You can see an example of this at http://timallen.org/blog/staticpages/index.php?page=days_since

Thursday, December 8, 2005

37:50 Race, Front, South, Broad, Arch loop (4 miles)

A pretty standard run, just very cold (about 34F). I started out the run just fine temperature-wise, which means, of course, that I was over-heating by the end of the run.

I was thinking a bit about the shooting of Rigoberto Alpizar. I don't really know what to think. I *do* think it's an unfortunate coincidence for the Bush administration that our agents attacked, someone died, and then the Weapon did not materialize-- kind of like the WMDs....

How to extract query text from a Microsoft Access Database

How to extract the text from MSAccess Views:

I needed to extract the SQL text of a bunch of MSAccess views recently. I was hoping for a system table with this information, like Oracle's DBA_VIEWS. I did not find anything like that, so I wrote this script.



Create a VBA module in the Access project (To do this hit Alt-F11, Right click "Modules", insert-> Module)



You will need to add references to Microsoft DAO and Microsoft Scripting objects (Tools->References) , then add in this text:




Sub extract_view_sql()
' Add two references to the project:
' 1) Microsoft DAO 3.6 Object Library
' 2) Microsoft Scripting Runtime

Const viewdir = "C:\TEMP\"

Dim db As database
Dim qd As querydef
Dim fso As New FileSystemObject
Dim f As TextStream

Set db = CurrentDb()

For Each qd In db.QueryDefs
Set f = fso.CreateTextFile(viewdir & qd.Name & ".sql")
f.WriteLine qd.Name
f.WriteLine qd.SQL
Set f = Nothing
Next

MsgBox "Done."

End Sub


Run this by clicking within the sub text and hitting F5. The text of each query will be stored to a text file.



This felt kludgy, but I have found no other way to get SQL text from Microsoft Access Views.

Tuesday, December 6, 2005

35:05 Arch,Front,South,Broad,Arch loop (3.8 miles) - Black EyedPeas/Elephunk

It's cold in Philadelphia, about 36F, and snowed a little last night. This made for a slower run, because there were patches of ice every now and then. Still, a good run. I picked up enough speed to turn over 9:15 miles, which is very good for me in the city.



I'm not normally a rap fan, though I'm sometimes surprised to find something I really like. In the movie Be Cool, The Black Eyed Peas did a number called "Sexy", which is a rap over Jobim's "Insensatez". This song got me listening to Bossa Nova again, and I got to where I could play "Insensatez". I started listening to the Peas one day and found that I really like them.



The Black Eyed Peas have a lot going on musically, it's not all just rap, and they talk about things other rappers don't. The song "Sexy", for example, is pretty much all about a consensual relationship, something notably lacking from a lot of rappers' repertoires. "Sexy" also stands out because the Peas brought in Sergio Mendes to play the piano part (nice).



"Shut Up" is a painfully faithful rendition of an escalating argument between two lovers, a la Albee's Who's Afraid of Virginia Woolf. Particularly wrenching is this section of dialogue:



That was a different thing

No it ain't

That was a different thing

No it ain't

That was a different thing

It was the same damn thing



in which you hear everyone's favorite theme of lovers' quarrels: semantics over substance. On second thought, don't listen to this if you're married, it'll just make you depressed.

Monday, December 5, 2005

Katrina Pictures

These are pictures I took when I went to New Orleans to get our stuff. I didn't get many good pictures-- the devastation was so great that it was impossible to do it justice. You can't take a picture of what 360 degree complete destruction looks like (not yet-- maybe if we keep electing the Bush family we'll get enough experience to get it just right).



Friday, December 2, 2005

FIX: SQL Server Error 2132

Note update: this is a one-time fix to resynchronize backup devices. Once you do this, you can resume doing normal backups on the backup devices. Thanks to the Data Iguana for pointing this out.



Problem: I have a SQL Server 2000 maintenance job that backs up my transaction logs every ten minutes by running this step:




BACKUP LOG [Tryout] TO [Tx01], [Tx02]
WITH NOINIT,
NOUNLOAD,
NAME = N'Tryout Tx 10 Mins',
NOSKIP,
STATS = 10,
DESCRIPTION = N'Tryout Tx 10 Mins',
NOFORMAT


This returned this error:




Executed as user: Tim. The media set for database 'Tryout' has 2 family members
but only 1 are provided. All members must be provided. [SQLSTATE 42000]
(Error 3132) BACKUP LOG is terminating abnormally. [SQLSTATE 42000]
(Error 3013). The step failed.


What was happening is that I'm trying to backup to two different backup devices on two different systems, but one of the devices was not correctly formatted.



Fix:I fixed this with the following statement:




BACKUP LOG [Tryout] TO [Tx01], [Tx02]
WITH INIT,
NOUNLOAD,
NAME = N'Tryout Tx 10 Mins',
STATS = 10,
DESCRIPTION = N'Tryout Tx 10 Mins',
FORMAT


You run this statement once to resync your two backup devices. After that, the normal backup statement will work correctly.



Note: This solution reformats both backup devices, so you will want to do a complete backup to a different backup device prior to doing this.