Saturday, September 27, 2008

Doctor Who Marathon

I've been doing a marathan-of-sorts of Doctor Who Season 4 this week. Since Season 4 is not yet finished (I think), I've only gone through the first 6 episodes. I've been a Doctor Who fan since the 5th or 6th grade since a friend introduced me to the character. Back then, his stories were available on pocketbooks only since the TV series wasn't being aired here locally. I must have collected a good couple of dozen Doctor Who pocketbooks during this time.

Doing a bit of research on the Time Lord from Gallifrey known only as "The Doctor", I was surprised to find out that it is actually listed in the Guiness Book of World Records as the longest running sci-fi tv show in the world having started back in 1963! And since the character was designed to be able to "regenerate" himself several times whenever he is about to die, the producers of the show was able to conveniently explain having different actors play the role.

The current Doctor (actually the tenth already) is played by David Tennant. I think he portrays the Doctor's quirkiness, eccentricity and humor quite well. I wasn't a big fan of the ninth doctor played by Christopher Eccleston. I think the character of Donna Noble (Catherine Tate) is a bit too old to be the Doctor's companion though. I would have preferred a younger sidekick.

I was also surprised to find out that BBC has spun-off a couple of series recently based on the Doctor Who characters -- The Sarah Jane Adventures, K-9 and Company, and Torchwood (which turns out to be an anagram of "doctor who"). The Sarah Jane Adventures is based on one of the longest running companion of The Doctor, Sarah Jane Smith, while K-9 and Company is based on The Doctor's robotic dog sidekick, K-9. Both Sarah Jane and K-9 are familiar characters back from my pocketbook days, and its pleasant to know that their mythos have survived all these time and they have become main characters in their own storylines.

Tuesday, September 23, 2008

Opening Command Prompt at Desired Folder

Another really useful application I downloaded from Microsoft's PowerToys for XP is the Open Command Window Here utility. I often have to open the command window first, then change drive, then type the long folder name. With the Open Command Window Here utility, I just need to right-click on the folder name (from Windows Explorer) and choose the "Open Command Window Here" item on the pop-up menu. The command prompt opens and you are right there already! Saves me lots of typing.

The Alt-Tab Task Switcher is also interesting. Its more of bells-and-whistles though. It gives you a graphical preview of how the window of a certain application looks. So if you open multiple MS Word, for example, no need to guess anymore which Word document you want to switch to. The Alt-Tab Task Switcher gives you a thumbnail view of each Word session that is opened.

Monday, September 22, 2008

XP Virtual Desktop Manager

I finally got around to installing Microsoft's Virtual Desktop Manager today. Its a free download and is part of the Microsoft Power Toys for XP. I actually downloaded it the other day, but couldn't figure out how to get it to work. It just goes through the installation and then nothing. No icon on the desktop. Nothing added on the Start >> Programs menu bar. I had no idea where it was going and how to actually start it.

I had to do some research today and found the answer from this other blog entry. It apparently gets added to the taskbar's menu when you right-click it. Choose toolbars from the pop-up menu and you will see Desktop Manager.

The Desktop Manager gives you up to 4 virtual desktops. You can open new windows on each virtual desktop and avoid cluttering your main display. Its not as intuitive as virtual desktops in Linux though. I noticed that if you open a new application on a virtual desktop, even when you switch virtual desktops, the new application still appears at the bottom taskbar of the other desktops. Shouldn't it only appear on the taskbar of the particular virtual desktop that it was opened in?

It also does not shows you a thumbnail representation of the content of a virtual desktop. I remember using Borland's Sidekick utility that does the same about 15 years ago. At that time, it already shows you a thumbnail representation of its other virtual screens. I believe Linux virtual desktops also has the same capability.

Being able to switch virtual desktops by pressing the Windows Start button + "1", "2", "3" or "4" is a nice trick. Each virtual desktop can also have its wallpaper customized.

Saturday, September 13, 2008

Cashing Out with GCash

We had an online customer who paid us online via Globe G-Cash for a wire-bound picturebook a couple of weeks back. I never got around to cashing out since the Globe Hub at the Rockwell Power Plant closed down some time ago (I guess most residents in Rockwell use Smart?!). Since I needed some cash today, I dropped by the Globe business center in Blue Wave Marquinton of Marikina on my way to our store, to do a "cash-out" (that's what they call when you want to convert your G-Cash into real money).

My first problem was, I couldn't remember my MPIN. Globe requires that you keep changing your MPIN every few months. And you are not allowed to re-use your last 3 MPIN's. For people who don't use their G-Cash on a regular basis, its practically impossible to remember the latest MPIN. So as expected, my transaction failed.

The lady asked me to called the G-Cash hotline 2882 to request for a password reset. So I used my Globe Handyphone to call the number. For those of you with a Globe phone, try calling that number (its a toll-free number anyway). It has one of the DUMBEST Interactive Voice Response (IVR) prompt! Ever!

The prompt goes:
"Welcome to your G-Cash Hotline. If you wish to talk to a customer service representative, press '0'."

That's all! Now lets ponder about that for a second. Is it just me or do you see the stupidity of the whole prompt? Maybe I'm just picky because in a previous lifetime, I actually wrote IVR software. This one is just plain stupid. Why would you bother putting an IVR if **THERE IS ONLY ONE OPTION TO CHOOSE FROM ANYWAY** ?!

If there is no press '1' for this; press '2' for that; etc., then why even bother putting a prompt? Why not just direct the customer straight to the customer service representative holding queue? Its not as if you have any other choice anyway! Is that sort of a trick just to filter out stupid people who don't know how to navigate IVR's from talking to the human operator?

Anyway, I digress. I got to talk to the operator who helped me reset my MPIN. The next problem was -- Globe's SMS system seems to be overloaded this Sunday afternoon. When the lady sends a Cash-Out SMS Request, you have to reply back with the MPIN confirmation within 5 mins. Otherwise, the transaction fails. But because Globe's SMS was particularly slow this afternoon, I was practically receiving the MPIN request at the same time as the time-out notification! D'oh!

After doing it a couple of times with the lady, I finally was able to get my P850 in cash. The whole transaction (including my waiting time at the queue) must have taken 30 mins or more!

Wednesday, September 10, 2008

Bluetooth Programming with C#

I've been tinkering with an el-cheapo, unbranded, Bluetooth USB adapter that Purchasing bought from CD-R King for Php 250.00. I requested for the unit for R&D purposes with a planned kiosk project I have that needs to dispense digital music files onto bluetooth devices like mobile phones.

The device did not come with any CD installer. At first, that worried me. But when I plugged it in to my Windows XP, the OS automatically detected it and used its internal Bluetooth drivers. Based on my readings, it seems that there are only a handful of popular Bluetooth software stacks -- the built-in Microsoft stack, the one provided by Widcomm (now Broadcom) and Toshiba. The type of stack used seems to depend on the firmware of the adapter. Thankfully, my cheap USB adapter used the default Microsoft stack.

Since I have no plans of writing low-level code to talk to the hardware, I searched around for existing .NET libraries that work with Bluetooth. The most popular one seems to be 32feet.net by InTheHand. I'm not sure why "32 feet", other than maybe that's the typical short-range distance of Bluetooth? The free library actually is not limited to Bluetooth, but also supports Infrared (IrDA) and Object Exchange (OBEX).

The Bluetooth functions are easy to use. To scan for Bluetooth devices within the vicinity, you simply do a:

BluetoothClient bc = new BluetoothClient();
BluetoothDeviceInfo[] devices = bc.DiscoverDevices(8);


The BluetoothDeviceInfo structure will give you the device address (akin to an IP address) and device name. The device address is important since most commands would need to use it.

One can also invoke the built-in Bluetooth dialog boxes of Microsoft for searching devices by doing the following:

SelectBluetoothDeviceDialog sbdd = new SelectBluetoothDeviceDialog();
sbdd.ShowUnknown = true;
sbdd.ShowRemembered = true;
sbdd.ShowAuthenticated = true;
if (sbdd.ShowDialog() == DialogResult.OK)

{
...
}

OBEX is a communication protocol that facilitates the exchange of binary data between compliant devices. Using OBEX, one can send files from the phone (eg. photos taken by the camera phone) to the PC via Bluetooth; and vice-versa (eg. the PC-based kiosk sending a music file to the phone). It is pretty much based on standard HTTP technology and the .NET classes are fairly straightforward and similar to accessing web services.

Sending a file from the PC to the Bluetooth device is also very simple and takes only a few lines of code:

string filename = System.IO.Path.GetFileName(openFileDialog1.FileName);
Uri u = new Uri("obex-push://" + devAddr.ToString() + "/" + filename);
ObexWebRequest owr = new ObexWebRequest(u);
owr.ReadFile(openFileDialog1.FileName);
ObexWebResponse response = (ObexWebResponse)owr.GetResponse();
response.Close();


The call is blocking. I'm sure you can also implement this using async postback with the .NET library so it doesn't block, but I chose to implement it as a thread instead. The InTheHand library also contains samples on how to receive files on the PC side.

Saturday, September 6, 2008

Ethan Headbutts Me

While playing around with the kids on their bed tonight, Ethan suddenly jerked his head back and hit me on my left eyebrow using the back of his head. It was a really stinging headbutt. And while it really hurt on my side, Ethan did not feel a thing. He was still playing around.

This led me to think about one of the things that has always puzzled me -- what is the proper way of doing a headbutt that does not hurt the attacker -- only the recipient? I'm a big fan of professional wrestling (or at least, the sports-entertainment variety of WWE). And they often use headbutts too. And the one giving it doesn't seem to get hurt.

So I did some research on the Net to find the answers. The key seems to be knowing which part of your head is the hardest; then using that to hit the part of the head which is the softest. In general, anything above the eyebrow level is the hard part (the cranium protecting the brain); while anything below is is the soft part.

The strongest part of the skull is the crown, which is roughly where the hairline is. The nose is one of the easiest to break, so if an attacker grabs you from behind, a sudden jerk of your head can hit him square in the nose. Other soft parts are the eyebrow (where Ethan hit me) and cheekbone.

Here's a couple of how-to's I found on the Net on how to give effective headbutts:

http://www.hubbardtwppd.org/selfdefense/headbutt.htm
http://www.wikihow.com/Head-Butt