A simple “google for” Tcl script

I make extensive use of Google throughout the day and I’ve always got “g” set up as the keyword for a Quick Search in Firefox. However, I also spend a lot of time at shell prompts, and sometimes I don’t want to bounce to a browser just to Google for something.

So, tonight, I wrote a small Tcl script that lets me “google for” at the prompt. Just save the previous link and rename it to “google” and move it somewhere in your PATH like /usr/local/bin, then make it executable with chmod 755.

The script requires Tcl with tDOM installed, as well as Tidy–both of these things are installed out-of-the-box on MacOS X 10.5 Leopard.

Once you get the script installed, you can do something like this:

'google for' screenshot

If you notice, for Google search queries that have a special result like the one above, the script displays it separately before the results. The script also emits the search query URL so you can just Control-click on it in Terminal and then select “Open URL” and have it pop up in your browser, which also works for any of the search result URLs.

I don’t know if anyone else would find this script useful, but it’s already saved me a ton of time–especially when I’m on a slow 64 kb/s GPRS connection like I am this evening. Either way, I’m releasing this script into the public domain.

Tags: , ,

Vodacom 3G speed tests in Johannesburg and at Sun City

Just a quick post with a few speed tests captured at Cresta Shopping Center in Johannesburg and at Sun City near Pilanesburg.

Cresta Shopping Center

Vodacom 3G speed test at Cresta Shopping Center

Sun City

Vodacom 3G speed test at Sun City

Tags: , , ,

Vodacom 3G with Huawei Mobile Connect E172 in South Africa

This morning I stopped into the Vodacom store in Cresta Shopping Center, where I picked up a Huawei Mobile Connect E172 USB adapter for around R2,400 (roughly USD $240) without a contract. I purchased a SIM card for another R12, and signed up for a 5GB/mo data bundle for R980.

Vodafone E172 (Huawei Mobile Connect) USB adapter

First impression: If this is 3G, then 3G just isn’t that impressive. Right from the shopping center, my speed tests were showing 82 ms pings (nice!) but only 1,075 kb/s down and 324 kb/s up. It’s very usable, but nowhere close to the “7.2 mbit/s” sales pitch of 3G. Still, the low latency makes it suitable for VoIP calling which is great.

What does impress me is the fact that right now I am sitting in Pilanesburg at Kwa Maritane and I’m able to get a GPRS connection, 539 ms ping with 47 kb/s down and 28 kb/s up. I’m practically “in the middle of nowhere” and I can still get GPRS. Back in America, this would almost certainly be a dead spot with no reception at all.

I’ll be here for the week, trying to survive on this slow connection–it’s okay for pushing and pulling emails without attachments and simpler web pages, but it’s going to make doing most of my work really challenging. I might have to pop down to Sun City to see if I can get better speeds to work with.

Tags: , , , , ,

My Mongolian ball-in-cage puzzle, solved!

I love problem solving and puzzles. My friend Christina brought me back a fun one from her trip to Mongolia. Here it is, solved:

Mongolian ball-in-cage puzzle, solved

Apparently this puzzle type is what Stewart Coffin calls “Locked Nest.”

It may not look like much, but the challenge is to assemble it from a completely disassembled state. It’s not only geometrically challenging, having to visualize the pieces in their final states, but physically challenging, having to hold the thing together as you put it together. Several times, while I was working on the puzzle, a pin would slide out or a rod would be out of alignment and the pin would miss it.

This is definitely a puzzle I’ll enjoy solving many times over. It’s quite challenging.

Tags: , ,

Opening up Windows Firewall for File and Printer Sharing

By default, Windows Firewall’s setting for File and Printer Sharing is set to “subnet” scope: only allow requests from the same subnet as itself. This is generally a good default security policy that balances safety with convenience, but on my home network, I run several different subnets (wired, wireless, VPN, etc.) and this tends to be an issue.

Here’s a very simple VB script that can be run with Windows Scripting Host to expand the scope from “subnet” to “any”:

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

Set colServices = objPolicy.Services
Set objService = colServices.Item(0)
objService.Enabled = TRUE
objService.Scope = 0

I stick that in a file named winfw-smb-scope-any.vbs and run it from a DOS prompt with cscript.exe. Done!

Do you have any other handy scripts you think are really useful? Tell me about them in the comments … thanks!

Tags: , , ,

TiVo Hacking: Getting a Linksys WUSB54G working

So, I have a TiVo Series 2 stand-alone DVR with a Product Lifetime subscription. For years, I’ve had it connected to the home network using a Linksys WUSB11 wireless network adapter, but it finally died. I went and grabbed a Linksys WUSB54G as a replacement, but found out that the TiVo doesn’t support it. No problem, I know the TiVo runs Linux and there’s plenty of documentation on how to “hack” the TiVo so I can load my own kernel modules on it, etc.

It turns out that the Linksys WUSB54G v4 uses the Ralink 2570 chipset. Fortunately, there’s been effort on native Linux drivers for the Ralink family of wireless chipsets. The hurdle, of course, is that the TiVo’s MIPS R5432 is big-endian, so it presents a bit of a challenge porting the driver to the TiVo.

Working off the latest code for the legacy rt2570 driver from CVS, I’ve gotten it to compile using TiVo’s Linux 2.4.20 kernel. Loading the module, however, results in this:

rt2570: init
usb.c: registered new driver rt2570
rt2570: idVendor = 0x13b1, idProduct = 0xd
rt2570: idVendor = 0x13b1, idProduct = 0xd
rt2570: using permanent MAC addr
rt2570: Active MAC addr: 00:12:17:89:f5:02.
rt2570: driver version 1.0.0
Unaligned Access to 0x80230b2b in kernel mode at 0xc0217be4
Unaligned Access to 0x80230b2d in kernel mode at 0xc0217c04
Unaligned Access to 0x80357076 in kernel mode at 0xc021b3dc
Unaligned Access to 0x80357076 in kernel mode at 0xc021b408
Unaligned Access to 0x80357076 in kernel mode at 0xc021dc2c
Unaligned Access to 0x80357076 in kernel mode at 0xc021dc08
Unaligned Access to 0x80357076 in kernel mode at 0xc021cd8c
Unaligned Access to 0x80230f47 in kernel mode at 0xc0217be4
Unaligned Access to 0x80230f49 in kernel mode at 0xc0217c04
Unaligned Access to 0x80231155 in kernel mode at 0xc0217be4
Unaligned Access to 0x80231157 in kernel mode at 0xc0217c04

So, now I get to go fishing through /proc/ksyms and try to fix up all these unaligned access errors. Hopefully, I’ll be able to get through all of this and get the driver working.

Anyone out there have experience porting Linux device drivers like this? Got any tips or techniques that might help me? I’d really love any help I can get …

Update: I’m posting my debugging progress in a rt2x00 forum thread. Given enough eyeballs, all bugs are shallow, right?

Update: I’ve gotten it working! I’ve addressed the majority of the unaligned access traps and I can now use my WUSB54G as a wireless NIC on my TiVo! Here’s a patch against rt2570-cvs-2008102616 of the driver and the corresponding kernel module binary:

If you have a SA2 TiVo and want to use a Linksys WUSB54G as your wireless NIC, this driver is what you want. It works for me, anyway!

Tags: , , , , ,

Is DRM finally going away for real?

Back in 2003, when I started working for AOL, there was a race to launch a digital music store for the Windows platform. The company to beat was Apple, who launched their Windows port of iTunes in October 2003. At that time, AOL was still claiming to have over 24 million subscribers. Clearly, if AOL could push out a digital music store offering as part of their service to that many customers before Apple, it might have made a difference.

But, wait … AOL launched its MusicNet offering as early as February 2003, you say? Beating Apple didn’t make much of a difference, after all, right?

I wasn’t directly involved in any of that work at AOL so I’m just speculating here, but I know a lot of effort went into rights management systems and DRM. I’m willing to bet a lot more effort went into getting all that stuff working than actual work on making the product–the music store–kick ass. I kept complaining that AOL should take advantage of its then-800-pound gorilla nature and spend its budget and manpower to invent and pioneer a business model that was DRM-less, rather than spend all that time trying to satisfy everyone’s wacky demands trying to implement DRM.

At the time, I kept hearing responses that all boiled down to: it’s not going to happen. I’ve learned that nothing happens unless someone makes it happen and AOL certainly could have been one to make it happen. This reminds me of a quote I love: “People aren’t resistant to change. Matter of fact, people will change just about anything in order to maintain the status quo.”

Fast-forward five years to 2008: Amazon, Walmart and even Apple (through iTunes Plus) are offering completely DRM-free music downloads. Somehow, things are changing from “not going to happen” to “it’s happening” to “it’s happened.” What makes me sad is that instead of rendering itself irrelevant, AOL could have pioneered this.

Regardless, I’m happy that we can finally start saying goodbye to DRM for real. Now, companies can start focusing on really innovating where it counts–identifying, funding, producing and distributing quality digital content–instead of on meaningless technology like DRM.

Tags: , , , ,

This is “high speed” EDGE?

This is my BlackBerry Curve 8310 tethered to my MacBook Pro over Bluetooth:

Not the “high speed 3G EDGE” I was expecting. Is this really the height of technological achievement for 2008? Where’s my flying car? Jeez.

Tags: , , , ,

Migrating from Windows Pidgin to MacOS X Adium

In replacing my aging Dell C840 laptop with a new MacBook Pro, I need to switch from using Pidgin to using Adium for IM. Since they’re both based on libpurple underneath, I figured there ought to be a way to migrate my settings from one to the other. As it turns out, it might be possible.

Your libpurple settings are stored in %USERPROFILE%\Application Data\.purple on Windows. Similarly, they’re stored in ~/Library/Application Support/Adium 2.0/Users/Default/libpurple on OSX. If you simply replace the blist.xml and accounts.xml that Adium creates with the ones from Pidgin, that should work, right?

Wrong!

Adium’s preferences are stored in plist format which, can now be easily edited since 10.5 (Leopard), even through AppleScript. Luckily, there’s even a simple utility called plutil that can convert from XML to binary plist format.

It would be pretty straight-forward to write a simple script that parses the libpurple XML and wrote out the appropriate plist XML then use the plutil tool to convert to plist binary format – but, I’m feeling lazy and only have about 10 accounts to migrate, so I’ll just do it by hand. Of course, there’s more to migrate than just accounts (old chat logs, etc.) but it’s not enough to overcome the inertia of my lack of caring to do it right now.

Tags: , , ,

Google’s Protocol Buffers …

… or, “Everything old is new again!

Yesterday, Google announced Protocol Buffers, their data interchange format and API libraries. Before I say anything else, I want to say I’m glad they did it: it uses neither XML nor ASN.1, which means someone at Google has a clue.

What bothers me is that yet again, what was old is new again–their on-the-wire encoding of the data is simply TLV and AOL has been using SNAC/TLV for at least 15 years now. However, AOL’s SNAC/TLV covers a lot more use cases than what Protocol Buffers does. Then, there’s AOL’s FLAP transport for SNAC which Google hasn’t even approached. There’s still a lot more “work” that Google has to do–or, just use what AOL’s already proven works.

Of course, Google gets the community pat-on-the-back because they released this publically whereas AOL still has it hidden behind some proprietary lock and key. AOL, this is another technology opportunity missed: you could have continued to keep your internal, proprietary technology relevant if you’d simply opened this stuff up, first. Now, you’ll have to continue to replace it–at a huge sunk cost–with “standards-based implementations.” Oops.

In the end, I’m glad to finally see someone not blindly drinking the XML Kool-Aid. Maybe there’s hope, yet.

Tags: ,