Linux, SwissCenter, and the PopcornHour A-100

So I’ve been using the awesome SwissCenter media streaming server with my PopcornHour A-100 for a while now. Over the weekend, Windows XP decided it didn’t want to run on my file server any longer (yeah, I know… 🙂 ). In it’s place I installed Ubuntu 8.04 “Hardy Heron”. After migrating my SwissCenter settings over to the new Linux install, everything worked, except SwissCenter no longer showed up on the Sources page on the A-100.

After a few hours of searching and a post to the SwissCenter forums, I got a reply from the SwissCenter team pointing me at the broadcast.pl script that comes with SwissCenter. Out of the box, things were promising, as I could see the A-100 talking to the broadcast script, but still no link on the sources screen. After another few hours of testing (and a good nights’ sleep), I found the problem.

You can read more about the script and my fix, and download my broadcast script package over at the SwissCenter UPnP/SSDP Broadcast Script for PopcornHour A-100 page. If you have any questions, please leave a comment either on this post, or on the download page.

Dynamic Page Graphics in WordPress

Recently, while developing a WordPress theme for a client, I devised a handy trick to use different headline graphics for pages (it should work for posts too) based on the page title. The basis of the trick is to name your headline graphics the same as the pages they are to show up on (ex. about.png for the About page). Once you do this, you simply need to insert the following bits of code into your theme’s page template:

Part 1: Add this to the beginning of your template (just after the line that starts with “<?php get_header(); ?>”):

NOTE: Modified this to actually, you know, WORK! 🙂
If you tried it before, and it didn’t do what you expected, change the code at the top of your template to this new version.

<?php
	global $post;
	
	$title = $post-<post_name;
	$title = strtolower($title);
	$titlepic = $title.".png";
?>

For those who don’t read PHP, what this block does is gets the title of the current page, stores it in a variable, converts it to lowercase, and then adds “.png” (changes this if you use gifs or jpgs) to the page title to create the image’s file name.

Part 2: Add this where you want the graphic to appear:

<img src="<?php bloginfo('template_directory'); ?>/images/<?php echo $titlepic ?>" alt="<?php $title ?>" />

This is a standard XHTML image tag. Change the directory to suit your needs, but leave the “<?php echo $titlepic ?>” bit as this is what does the magic. The alt parameter could likewise be changed, but it does need to be there for the XHTML to validate.

So there you have it. A painless method to get dynamic graphics for your blog, based on your page titles.

CTC Updated, Version 4.5 Released!

Just a quick note to let everyone know that I have bumped everyone’s favorite tag cloud plugin for WordPress 2.3+ to version 4.5. What’s new? The biggest change is the addition of an Options page for configuring the plugin when used as a template tag. As always, you can see the full changelog, get the new version, and leave comments from the CTC page.

TextMate WordPress Development Bundle

Just a quick note to release my newest WordPress-related download, a bundle for the excellent OS X text editor TextMate for doing WordPress development. The bundle includes template for common WP theme files, updated snippets for newer versions of WP, and various other time-savers. Head over to the Bundle page to check it out and download it.

Reciprocity WordPress Theme

After switching my hosting and theme earlier this month, I decided to update and release my original blog theme to the general public. Head on over to the Reciprocity WordPress Theme page to take a peek and download the theme.…

After switching my hosting and theme earlier this month, I decided to update and release my original blog theme to the general public. Head on over to the Reciprocity WordPress Theme page to take a peek and download the theme.

Fun With Shell Scripts: autons

Being a freelance web developer, there are many times where I’m moving domains for clients (or more recently, myself), and need to know when the DNS entries change to point at the new version of a site. I could just keep submitting an nslookup request manually, but that requires me to stop whatever it is I’m doing, switch to my terminal app, and execute the command. After doing a few sites this way, I decided that there had to be a better way…and there is. I came up with the following bash script to automate this process.


#! /bin/bash
count=1
while [ 1 ]
do
echo Attempt $count
nslookup $1
sleep $2
count=`expr $count + 1`
done

Yes, it’s just that simple. As you can see, the script takes 2 parameters, the domain name to check, and a time (in seconds) to pause between each check. I don’t know if there’s a rule about the amount of time between requests for nslookup, but I usually don’t use anything lower than 5 minutes (300 seconds).

To use, just paste the code above into a file, save it (I named mine “autons”), and give it execute permissions (“chmod +x autons”). To test a site, use something like the following: “autons yahoo.com 300”. This would check the DNS address for yahoo.com every 5 minutes.

Wow, How True This Is…

Advertising is culture. In between advertising we do things like talk about what we have been up to, but all we have been up to is following the instructions of advertising. Going to the gym, going to Burger King, downloading the latest music or driving the latest car. If you think about it, even non-sponsored images are advertising: the old woman with her walker is an advertisement for old age; the young boy with no helmet and a cheap scooter is an advertisement for making the community nervous. He will die beneath the wheels of a car, and it is mathematically likely that it will be a neighbor of his at the wheel, and this will make one of the families have to move. A moving company makes five thousand dollars, or less, per move. On average.