GodMode in Windows 7
To enter “GodMode,” simply create a new folder and then rename the folder to the following:
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
http://news.cnet.com/8301-13860_3-10423985-56.html?tag=mncol;txt
To enter “GodMode,” simply create a new folder and then rename the folder to the following:
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
http://news.cnet.com/8301-13860_3-10423985-56.html?tag=mncol;txt
For no real reason other than saying that I did it, I wanted to have the last 10 songs that I’ve played on my PC listed in the sidebar of my blog. Simple enough..
Here’s what I have: I’m a fan of Last.FM, plus I have about 25Gigs of mp3s that I like to randomize. I also like simplicity, so I use RhythmBox on my Ubuntu desktop. It has a built-in interface to Last.FM (among others) and handles my mp3 library with ease. It also is easily extensible.
At first, I was going to write my own plugin to get the song info, then I found the NowPlaying XML plugin. Perfect! Simply unzip it to your ~/.gnome2/rhythmbox/plugins directory and you’re set (you may have to create the directory first, as did I). Fire up RhythmBox, click “Edit”, “Plugins” and make sure that your NowPlaying XML plugin is checked. Play a song and it should create a file at /tmp/nowplaying.xml.
The /tmp/nowplaying.xml file looks something like this:
<?xml version="1.0" ?><nowplaying><song><album>Saturate</album><track-number>0</track-number><title>Polyamorous</title><artist>Breaking Benjamin</artist><genre></genre><duration>177</duration><bitrate>0</bitrate></song></nowplaying>
Yep, all one line, but that’s okay. It has the data that we want…
Now, to get it into WordPress. First, I created a table in my blog database:
create table music_history (id int primary key not null auto_increment, title nvarchar(30), artiist nvarchar(30), played nvarchar(30));
Yes, I mis-spelled artist, and yes, I probably should have used a datetime data type for played, but work with me here…
Next, I created a Perl script on my workstation called updatePlayHistory.pl that looks something like this:
#!/usr/bin/perl
use Date::Format;
use XML::Simple;
$now = time2str("%D %r", time);
$file = '/tmp/nowplaying.xml';
## make sure that the file exists, if not just exit.
unless (-e $file) { exit(0); }
$xml = new XML::Simple;
## read the xml file in
$data = $xml->XMLin("/tmp/nowplaying.xml");
## get our song object
$song = $data->{song};
## get the song details
$title = $song->{title};
$artist = $song->{artist};
## set up our connection
use DBI;
$dbh = DBI->connect('DBI:mysql:blogdatabase;host=myhost', 'dbuser', 'dbpass')
|| die "Could not connect to the database: $DBI::errstr";
## get the last song inserted and see if it is the same as the current one
$sql_last = "SELECT id, artiist, title FROM music_history order by id desc limit 1";
$out_last = $dbh->prepare($sql_last);
$out_last->execute;
($id, $lastArtist, $lastTitle) = $out_last->fetchrow_array;
$out_last->finish;
## if its the same one, exit out
if (($lastArtist eq $artist) && ($lastTitle eq $title)) {
$dbh->disconnect();
exit(0);
}
## insert the song
$sql_insert = "INSERT INTO music_history (title, artiist, played) VALUES ('$title', '$artist', '$now')";
$out_insert = $dbh->prepare($sql_insert);
$out_insert->execute;
$out_insert->finish;
$dbh->disconnect();
The comments should be pretty self explanatory. Tweak as needed. Now, ‘chmod +x’ your script edit your crontab (‘crontab -e’) to run it every minute:
* * * * * * /home/gkurts/scripts/updatePlayHistory.pl
Last, we need to tweak WordPress to display the last 10 played songs. For this, I just copied some of the existing code for one of the widgets and modified it to select the last 10 played and loop through them..
<?php
$songs = $wpdb->get_results("SELECT id, title, artiist, played from music_history order by id desc limit 10");
?>
<div class="widget">
<h3>Song History <span style="font-size: 10pt">(Last 10 played)</span></h3>
<?php if($songs) : foreach($songs as $song) : ?>
<ul>
<li><b><?php echo $song->title; ?></b> by <b><?php echo $song->artiist; ?></b><p style="font-size: 7pt; margin-top: 1px; padding-left: 5px;"><?php echo $song->played; ?></p></li>
</ul>
<div class="fixed"></div>
<?php endforeach; endif; ?>
</div>
That should be it. It’s really pretty simple. If you use this or have any questions, let me know!
If you’ve tried to install TweetDeck on Ubuntu 9.10 (Karmic Koala) 64-bit, you’ve probably run into the error saying that something like “TweetDeck has encountered problems”… blah blah blah “we are working with Adobe on it”… etc etc etc. (Sorry, I forgot to get a screenshot of the actual error).
The problem stems from Adobe AIR being dependent on 32-bit libraries and not being able (obviously) to find them in a 64-bit environment. Luckily, there is an easy solution for it!
Assuming that you have already installed Adobe AIR and TweetDeck at this point (if not, go ahead, it’s safe), do the following:
Enjoy!
Why can’t things just be simple? Really, it’s only a few steps… Surely the folks at VMWare could fix this. Ugh!
When cloning a Linux virtual machine (Ubuntu Server, in my case – YMMV based on distro), the clone’s networking fails to start up. Doing an ifconfig only shows the loopback adapter and no amount of rebooting, adding / removing the adapter in the VM’s settings, or cussing will make it work.
Thanks to this post I found by Jamis Buck (thanks!), it’s easily fixed (okay, his post was for VMWare Fusion, but it works equally well in VMWare Workstation):
Again, why can’t they fix this?!?! Oh well, enough ranting for the day.
So Oracle is buying Sun, and in-turn, is getting MySQL… Something they’ve tried to aquire several times in the past. Monty Widenus, the original founder of MySQL, is pleading for people to sign a petition for Sun to structure the sale agreement in such a way to prevent Oracle from getting becoming the owner of MySQL.
Visit http://www.helpmysql.org/en/petition and sign the petition to help do your part!
Visit Monty’s blog for a thorough Q&A on the matter. Good reading.