Category Archives: Tech - Page 2

My program for hotkey switching between speakers and headphones…

…has been updated.

Herein find out how to survive a nuclear war.

Picture taken of the atomic bombing of Nagasak...
Image via Wikipedia

Michael Anissimov talks about the book, Nuclear War Survival Skills by Cresson Kearny.  Some interesting stuff in there…

Kearny points out that many casualties in a nuclear attack might be due to people running to windows in major cities, looking at the sky lit up by SLBMs, only to be killed by blades of glass when otherwise-survivable ICBMs explode.

A hotkey to switch between headphones and speakers. Soundswitch.

I use USB headphones. I also use regular speakers connected to my sound card. Windows makes it a multi-step process to switch from headphones to speakers.

I tired of this, so I wrote a program to rectify the situation and I called it Soundswitch because I’m a wordsmith. You can find this program here:

Available here.

Basic Use and Installation

Unzip it to the directory of your choice.

Look in the Sound applet in control panel to see which two sound devices you want to switch between. In the following image, the two I switch between are labeled 1 and 4. Thus, in the ini file, I used 1 for Source1 and 4 for Source2.  Update:  Note that the number of items will vary based upon whether you have “Show Disabled Devices” and “Show Disconnected Devices” checked (Right click anywhere in the list to see these).  For the purposes of Sound Switch make sure both options are checked before counting the items. The screenshot below doesn’t reflect this.


The ini by default has the switch key assigned to Ctrl-Alt-F12. Edit this as you like.

Tested on Win7 x64 and Vista x32.   Update:  XP no longer works with the latest updates.  Use this older version for XP compatibility:  soundswitch

Any comments on this are welcome and I’ll try to fix any bugs reported.

Version 2 Notes

I’ve added a good number of features in the latest version. All accessible through the .ini file.

  • “Scroll” through each enabled item in your Sound panel.
  • Hide the tray icon
  • Switch between two speaker configurations for your current active playback device
  • Switch/scroll just the default comm device, default playback device, or both
  • Hotkey to terminate the program

JSON feed for Source servers

I’m kind of a statistics whore.

To further my pursuit of more statistics, I’ve developed a Python CGI which provides a JSON feed of all sorts of information about servers based on Valve’s Source engine.

This script has three dependencies outside of what is in the standard Python library:

Once you have those installed (worst-case scenario just drop them in the same directory as, you need to edit sourcejson.ini.  This file just has three options: rcon_pass, ip, and port.  If you don’t have the rcon password for the server you wish to monitor just leave it blank.

To access the JSON feed just use the url to  Something like this:


To access the extended information that having an rcon password allows use:


If you use the extended format, but haven’t provided an rcon password in sourcejson.ini, it will just default to the basic feed.

Included in the zip is a .htaccess to prevent directory listings, which will help protect the contents of sourcejson.ini.

Download sourcejson here!

Using Python 2.6 + MySQL on Windows is nearly impossible

Update:  I made progress on this issue.  See my newer post here.

If you’re interested in writing Python scripts on Windows which access MySQL databases, be sure you avoid Python 2.6.

The standard way to interact with a MySQL database via Python is to install the mysql-python package The problems arise because of several things.

  1. mysql-python still doesn’t have compiled binaries for 2.6
  2. Windows doesn’t ship with a C compiler.
  3. It’s a SOB to use any of the free C compilers to compile from source.

A couple of kind souls have provided their own compiled versions in this forum thread, but neither of the provided versions works on the two Windows machines I’ve tried them on.

I tried following the official directions to compile on windows using the “ build”-method, but MinGW spits out several bajillion lines indicating the following(bolded part indicates error found over and over again):

C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\opt/mysqlclient.lib(./mysqlcli
ent.dir/relwithdebinfo/inftrees.obj):(.text[_inflate_table]+0x4e3): undefined re
ference to `@__security_check_cookie@4′
collect2: ld returned 1 exit status
error: command ‘gcc’ failed with exit status 1

There’s very little useful information to be found from a google search on this, so as it stands, I’m pretty much unable to use Python 2.6 + MySQL.

I really wonder why MySQL support isn’t packaged with Python.  It’s not like accessing MySQL is an unheard of operation…

Three events do not an “issue” make.

Xbox 360 Wireless Controller
Image via Wikipedia

Referring to a few stories they’ve done about violence associated with gadgets, in this item on Gizmodo, Sean Fallon asks:

In the last few months we have seen a runaway teenager die after having his Xbox 360 taken away, a teenager kill his parents over Halo 3 and 30-year old brothers stab each other over a PS2 controller. Naturally, this begs the question—what the hell is going on here? Is this a parenting issue, a social issue, or a scary psychological disorder that needs to be taken more seriously?

This paragraph seems to imply there’s some sort of pattern to analyze here.  Three examples don’t show a pattern.  Especially given the hundreds of millions of gadgets out there.

Automatic MP3 organization using AutoIt

Somebody on the Something Awful forums asked me about my code that automatically organizes MP3’s I download, so here’s how it works…
Read more »

How I recovered my photos and much of the metadata with a few tools (Part 2)

This is a continuation of another post detailing how I recovered thousands of photos from an accidentally formatted hard drive. Read that post here.

The Problem – Part 2

At this point, I was definitely breathing easier, but there was still a lot of problems to deal with.  The problem with what PhotoRec does is that, it doesn’t look at the data on your hard disk at the file/directory level.  It looks at the raw data on the hard drive and recognizes if it’s a picture and then restores it to the location of your choice.  This means that filenames and directory structure are lost.  This also means, that nearly every jpeg file on the formatted hard drive was recoved…including tens of thousands of images from Firefox’s cache along with hundreds(thousands?) of other various images like wallpapers that I’ve downloaded over the years, with no obvious way to distinguish between them and actual photos.
Read more »

The most important post on this blog…ever

Automatic Baby Walker

I just had to share this video here so one day when I have a kid, I can find it again.