Yes, It IS Obnoxious
No, I don’t care.
Unless by some misfortune you are deaf, you probably noticed that there is auto start music on this page, as well as many other parts of this blog.
Sorry.
I can’t help myself. It goes against everything I have learned, but the music is staying, at least 10 more hours. that’s when I’ll have had some sleep.
Have a listen, its over there.
<—
June 25, 2008 No Comments
My Summer Job Will NOT Be Boring.
A few weeks ago, I built a soda bottle raft. It was a big, wooden waterproof box that had 96 empty soda bottles underneith held in by door screening. I can sit on it, and still have the top stay about 4-6 inches ( 10 cm - 15 cm ) out of the water.It was easy to turn, but hard to move.
Now how can this become a summer job?
Easy, sell stuff from it! there is a river near by that has many kayakers paddling up and down the river every day. my plan is to make a pair of anchors to keep me in one spot, and sell water bottles to thirsty paddlers.
It would beat working at a supermarket.
June 18, 2008 1 Comment
Oui FM Player
Last summer I went on a vacation with my family to Britain and France. While we were in France, specifically Paris, I found a radio station that I actually enjoyed ( as opposed to the crap where I live ). This radio station was called Oui FM. I wasn’t able to understand much of what was being said but I was able to catch a web address. Ouifm.fr . (Oui.fm would have been much better.)
Upon arriving back in my home country I decided to check out their site. I was pleased to find a live stream of the station! I “tuned in” and began listening to the same great stuff. Around mid-winter I stopped listening. I dont know why, I just didnt feel like it anymore. Recently, however, I came back to find a flurry of new songs that I had not heard, but liked all the same. Problem was that Windows Media Player wouldent tell me whats playing. thats when this project started.
I started by going to Oui FM’s home page. once there I found this flash app that gives the artist and song that is currently playing. I fired up SmartSniff (a smaller and faster wireshark like program) and loaded the flash app, it happily divulged where it was getting the information. It was coming directly from the site, right here in fact. I wrote a quick php script that took the data, parsed it, made it look a little nicer (caps, etc.), and put it into xhtml. Now I needed a way to play it without the song being interuppted. i settled on using the JW Media player to play the stream and ajax to update the page.
you can see the working script here: Oui FM player . I advise doing just that, they tend to have good music playing.
June 17, 2008 No Comments
Neoclassical Image Rotator Rewrite
Aight, first post on a new Wordpress install. It seems like every time I pick a new theme I need to make some modification to the code. I guess it’s my way of leaving my mark. This time around, I chose to modify the image rotator. From the Neoclassical Theme. For those of you who dont know, the current code looks like this:
<?php
$random_image = rand(1,5); // the second number should equal the total number of images that you want to rotate
?>
<img src=”<?php bloginfo(’template_url’); ?>/headers/header_<?php echo $random_image; ?>.jpg” alt=”Random header image… Refresh for more!” />
it’s simple, and it gets the job done, but it means that whenever you want to add a new image, change and old image, or delete an image you need to rename it by a given pattern, and modify a script. My script fixes all that by scanning the directory and building an array that is filtered to make a list of images that can be used. my code looks like this:
<?php
$excluded_files = array(”exclude_me.jpg”); //Put the name of any file that you DON’T want to see in here, this includes non image files, but not dirs
$dir = TEMPLATEPATH.’/headers’;
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$dir_contents[] = $filename;
}foreach ($dir_contents as $file) { //This loop filters the array
if (!is_dir(TEMPLATEPATH.’/headers/’.$file)){
if (!in_array($file,$excluded_files)) {
if (str_replace(’.jpg’,’.notjpg’,$file) != $file || str_replace(’.jpeg’,’.notjpeg’,$file) != $file) { //does both .jpg and .jpeg
if ($file != ‘.’ && $file != ‘..’ && $file != NULL){
$images[] = $file;
}
}
}
}
}$random_image = $images[rand(0,count($images)-1)]; //no more changing this
![]()
?>
<img src=”<?php bloginfo(’template_url’); ?>/headers/<?php echo $random_image; ?>” alt=”Random header image… Refresh for more!” />
It’s much longer, but it is less demanding on the end user, and will save time an energy when you decide to change the default images.
at a glance:
- php 4 compatable
- works with default installs of neoclassical, changed images, or basically anything else
- easy to install
installation:
- Download
- unpack
- upload and replace the original “rotating_images.php” (found in: “<WORPRESS DIR>/wp-content/themes/neoclassical/”) file with the new one
June 16, 2008 No Comments
Hello world!
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
June 16, 2008 1 Comment