Letting the driver in front of you know what you really think of his driving skills…

If the driver in front of you is talking on his cell phone using a bluetooth wireless headset (which seem to be all the rage right now), or even that tool walking around with the bluetooth wireless headset always on his ear, let them know what you think! This hack uses a linux laptop and a direction antenna to snoop onto bluetooth wireless headsets and can also inject audio into the connection.

trifinite.blog: Introducing the Car Whisperer at What The Hack

My New Side Project…

A while ago I found both the pinout and the protocol for communicating with an ipod. I wanted to put together a program that would allow me to control my ipod from my computer using the dock cable. But I couldn’t figure out how to get a dock connector to serial adapter. Nobody makes one that I could find. I thought about buying a cheap power charger and cutting it up, but I didn’t want to drop $15 just to find out that they didn’t fully populate the connector (since they only need about 4 pins, it would make sense…).

All this changed this week when I found a page where you can buy blank ipod dock connectors. It is a guy in Australia, and he is going to ship me 6 of them. Total cost: $16 (And change). All I need to do is solder on some wires and hook it up to a serial port plug (can get at radio shack) and I have my cable.

The next step is to just write the code to communicate with the ipod. The protocol looks to be a simple serial protocol. I’m thinking of doing it in Java using the javax.comm packages to do the serial port communications. I would build it as two projects, a communications library and then the actual application. I’ll keep you guys informed on my progress….

Developing for ITunes under Windows with Python

When running ITunes under Mac OSX, you can use AppleScript to do all kinds of neat things. Under Windows you don’t have AppleScript, so Apple created a series of COM interfaces to allow programmatic access to ITunes and you music library (Microsoft has done the same things with Windows Media Player).

The nice thing about the COM solution is that you aren’t tied to any specific programming language (like AppleScript, for example). Of course the language that people use most for COM is C++, but there are COM bindings for VB, JavaScript (this is what the ITunes SDK examples are done in), Java, C#, Perl, and Python. Since my office has made the decision that all scripts are to be done in Python, I’ve been trying to do the same for any scripts that I write in my free time.

Back on topic. I’ve started to do some development with using the ITunes COM interface under Python. Having done my share of COM for C++, I was expecting the worst. But the Python COM bindings are really well done. If the COM object has a property, it appears in Python as a class member variable. If the COM object has a function, just call it like you would any Python function.

But not all is wine and roses… COM uses Unicode strings for all of its communications. Not a problem for Python as it is very happy with Unicode. But a problem when you try to print un-printable characters on the console. The offender in question: the single right quote. Not the apostrophe, but the single right quote. Subte difference. I tried many different ways to try and convert this extended character to something I could print (encoders, etc.) but ended up giving up. The only way I could get it to work was to go through every string I wanted to print and when it found a single right quote and replace it with the apostrophe.

The other problem that I ran into was how COM represents DATE objects. I wanted to compare two DATE objects to see which one was the most recent, but the obvious solution:

if (date1 > date2):
    do_something()

didn’t work. It turns out that you have to coerce each object into a float (the native COM representation for a DATE object) before you can compare them.

if (float(date1) > float(date2)):
    do_something()

Once I figured that out, things were pretty simple.

You can check out my scripts at my Wiki.

Just in time for the holidays

A computer built inside a gingerbread village. My favorite part: the “working” stoplight in the middle of the village…