matt good

musing coding

The Daily Show: Not "Fake News"

written by Matt, on Oct 13, 2006 4:02:40 PM.

Indiana University conducted a study of Comedy Central's "The Daily Show with Jon Stewart" comparing the amount of actual content in their coverage of the 2004 elections in comparison to "real" news shows. Regular watchers of The Daily Show will not be surprised to find that there was no significant difference in the amount of political content offered by the humor show.

The Daily Show has quite often ridiculed the rediculous topics covered by "real" new programs such as those on CNN, MSNBC, and Fox News. These shows are no less padded with "entertainment" than The Daily Show, though they lack the witty satire offered by Jon Stewart and his team of writers.

So, don't feel guilty about relying on The Daily Show to stay informed. You not only get a good source of news, but some good laughs as well.

Read the press release from Indiana University

Moleskine

written by Matt, on Oct 12, 2006 12:28:26 PM.

Like many others in the tech community I've been getting into the Getting Things Done fad. Since I use the computer a lot I've been using some different computer-based systems for tracking my next actions. These are good, but they don't help when I'm out and forget things I should be shopping for, or have an idea that I need to record.

So, the other day at the book store I saw a shelf of Moleskine notebooks and picked up a pack of 3 small lined journals. I've divided one up with Post-it Durable Tabs into 6 contexts, clipped on a pen and I keep it in my pocket. The Post-it tabs are really nice. They should hold up to being stuffed in a pocket without getting bent and the adhesive will peel up without tearing the paper, so you can reposition them later if you need to resize the sections. A fine-point felt-tipped marker works best for labelling them; ball-point pen didn't show up very well.

eMusic GNOME Project

written by Matt, on Aug 23, 2006 10:14:24 PM.

I've put up a Trac project for eMusic GNOME where you can filie bugs or enhancement requests.

eMusic GNOME 0.1.1

written by Matt, on Aug 22, 2006 5:14:00 PM.

Unsurprisingly the 0.1 release was not bug-free.

Changes:

  • Fix missing import found by Huw Lynes
  • Fix bug with "/" characters in filenames found by Huw Lynes
  • Implement the "strip special characters" setting for removing non-shell-friendly characters
  • capitalize GNOME
Download:
emusic-gnome-0.1.1.tar.gz

Darcs:

darcs get --tag=0.1.1 http://projects.matt-good.net/darcs/emusic-gnome/

eMusic Gnome 0.1

written by Matt, on Aug 22, 2006 1:27:00 PM.

The first release is done, go download it:
emusic-gnome-0.1.tar.gz

Update: I've made a 0.1.1 release due to a couple crasher bugs.

Check the README for requirements and installation.

http://matt-good.net/files/post-related/emusic-gnome-0.1.png http://matt-good.net/files/post-related/emusic-gnome-0.1-prefs.png

Current Features:

  • open .emp files from the toolbar or on the command-line
  • stop/start downloads
  • progress meters show estimated time remaining
  • preferences dialog based on Sound Juicer for setting the download location and file naming
  • GnomeVFS support

Source Repository:

The source is available via Darcs:

darcs get http://projects.matt-good.net/darcs/emusic-gnome/

eMusic Downloader

written by Matt, on Aug 21, 2006 9:14:26 AM.

Update: I've made a first release so go check it out.

Hadess recently mentioned the crappy eMusic Linux client which I stopped using long ago and resorted to downloading the tracks individually in my browser. There is eMusic/J which was written out of spite for the Linux client, but I try to avoid running Java apps as much as possible.

So, I decided it was time to sit down and make a nice eMusic client for Linux. Poking at the eMusic/J source led me to decrypt-emp where they got the function for decoding eMusic's ".emp" files. The emp decoding was easily ported to Python, and after learning a little PyGTK I've got a halfway decent prototype:

http://matt-good.net/files/post-related/emusic-downloader.png

Stay tuned for a release. There are a couple things I need to fix, but the basic functionality should be ready shortly.

Features planned for the near future:

  • display album art and extra track info
  • use DBus to append tracks to the currently open instance
  • show download progress in Mathusalem

Silver Lining

written by Matt, on Aug 11, 2006 12:23:05 PM.

Sunday my laptop's harddrive crashed. Everything had been working fine. Then I sat down and was getting some weird errors running things on the command line. I decided to reboot and it was gone; completely unrecognized by the system. It seemed like professional recovery was the only option and was far out of my price range. I'd heard putting the harddrive in the freezer would sometimes get it running long enough to backup critical data, but no such luck. So, I finally gave up and order a new drive.

In addition to now having a larger drive, reinstalling Ubuntu has my system running more smoothly than before. Hibernate was working out of the box and following some simple instructions I was able to switch to the accelerated Nvidia driver and maintain the working hibernate feature.

Also, I was attempting to redownload GTDTiddlyWiki Plus, which seems to have disappeared. In the process of looking for it I discovered another GTD-customization of TiddlyWiki: MonkeyGTD. It's a bit more structured than GTDTiddlyWiki (Plus). It makes heavy use of tags to organize your contexts and tasks and seems to integrate a bunch of plugins to make managing tasks much simpler. So, at least in the process of recovering from the drive failure I've gotten a few benefits.

Disappearing Neighbors

written by Matt, on Jul 24, 2006 5:04:05 PM.

I recently signed up with Last.fm (my profile).

After my first week it generated a list of "neighbors" that shared my musical tastes. Now after another week it updated my listening charts again, and deleted my neighbors list! I guess I confused it from starting off with The Flaming Lips, Ween, and Lauren Hoffman topping my list, to MF DOOM, Girl Talk, and CunninLynguists the next week.

I guess it might take a little time for Last.fm to figure out my musical tastes.

Update: Either I was impatient, or Last.fm is reading my blog. I have a new set of neighbors now. Girl Talk's "Night Ripper" was definitely the album to listen to last week. Girl Talk is the top weekly artist for most of my neighbors, and it's the top mover on the Last.fm charts at 500%.

Disabling HTML <option>s

written by Matt, on May 16, 2006 8:30:54 PM.

If browsers worked as they should it would be pretty simple to disable some of the options in a select list:

<select>
    <option>Enabled</option>
    <option disabled>Disabled</option>
</select>

Of course IE doesn't support this part of the spec, and it's not included in the IE 7 beta, so it's unlikely it will be supported in the near future. So, one option that makes IE behave similarly to the disabled options is to replace them with <optgroup> tags. The <optgroup>s cannot be selected and with a little CSS they look like disabled options. However, the static solution suggested didn't work for me since I needed to be able to disable or enable options at runtime. So, with a little JavaScript (and the help of MochiKit's DOM functions) the options can be enabled or disabled dynamically:

var selectStyleDisabled = function(select) {
    forEach(select.options, function(opt) {
        if (opt.disabled) {
            var optgroup = OPTGROUP();
            updateNodeAttributes(optgroup, {
                label: opt.innerHTML,
                style: { color: 'graytext' }});
            optgroup._option = opt;
            swapDOM(opt, optgroup);
        }
    });
    forEach(select.getElementsByTagName("OPTGROUP"), function(optgroup) {
        var option = optgroup._option;
        if (option && !option.disabled) {
            swapDOM(optgroup, option);
        }
    });
};

addLoadEvent(function() {
    var selects = currentDocument().getElementsByTagName("SELECT");
    forEach(selects, function(select) {
        select._onfocus = select.onfocus;
        select.onfocus = function() {
            selectStyleDisabled(this);
            if (this._onfocus)
                return this._onfocus();
            return true;
        }
        selectStyleDisabled(select);
    });
});

The display of disabled options is updated in the "onfocus" method to make sure that changes in the disabled state of the options is reflected before the <select> is displayed again. Disabling options can be done directly to any of the option elements such as:

select.options[0].disabled = true;

However, a little care needs taken to re-enable options, since the <optgroup>s aren't in the "options" attribute of the <select>. The original option needs reenabled by accessing it through the "_option" attribute added to the <optgroup> element:

// reenable all disabled options in standards-compliant browsers
forEach(select.options, function(option) {
    option.disabled = false;
});

// reenable all disabled options in IE
forEach(select.getElementsByTagName("OPTGROUP"), function(optgroup) {
    optgroup._option.disabled = false;
});

To make sure that this IE hack only gets loaded in IE, put it in a .js file and wrap it in an IE conditional comment:

<!--if lt IE 8]>
<script type="text/javascript" src="select-ie-disabled-options.js"></script>
<![endif]-->

Python SQL Commandline

written by Matt, on Feb 25, 2006 11:56:00 AM.

I hacked together a simple command line app in Python for running SQL using any installed DB-API driver.

Usage depends on the arguments of the connect() method of your DB driver. For example:

python pysql.py psycopg "host=localhost dbname=mydb user=myuser password=mypassword"

or:

python pysql.py sqlite mysqlite.db

or with named parameters:

python pysql.py pymssql --host=localhost --user=sa --password=sapassword

Download: pysql.py