Fireworks tip for the future

Little tip for those of you into the whole “explosives” thing…

When having a bottle rocket war, buy the cheap ones. Yes, the good ones have a more reliably burning fuse and thus are easier to aim and fire correctly, however they also have a much more powerful thrust to them, and thus the impact is more likely to leave serious wounds. I was pretty much pwned by my brother at our little rocket-fest last Tuesday, and the wound has turned into a fairly ugly scabbed over hole in my shoulder, along with some colorful bruising around it.

This is all from the impact of the rocket, mind you. The rocket itself rebounded off behind me and exploded a good distance away, as they always tend to do. Usually the cheap ones will have just enough thrust to tap you and possibly to burn your T-Shirt, however these packed a bit more of a wallop. They even bruised my leg through my blue jeans, although not nearly as badly and that wound has now healed entirely. The shoulder wound is recovering much more slowly and with a nice yellow jaundicey color patch for a bruise. )

But despite my disfigurement, I had a good weekend. Got my drink on at Sleep Out Louie’s. Nice place on the weekends, especially with brunch until 2. I love those crab meat omelets. Also finally got some shopping done and all that jazz. Looking forward to September though. D

More about Amazon Grocery

Back when I wrote about Amazon Grocery the first time, I also placed a couple orders.

I’d been wanting a particular book, and my Amazon Prime trial membership had just expired (and I didn’t feel that “free” shipping was worth $70+ a year), so I started looking for stuff I needed which they had.

What I found I was running low on was toilet paper.

A bit of searching and I ran across some TP on Amazon. Plus the price was just right to make both my book and the TP get free shipping. Perfect.

So off my order went, for my book and for Scott Toilet Paper. Excellent.

It took it about 10 days to get here. Good thing I was only running low and not out of the stuff. But the book is good, and the TP.. Well… It’s paper. I don’t expect much out of my TP.

Scott TP

Nice handy dispenser box, I must say. Although I did get some odd looks from the apartment people when I picked up my shipment of what was clearly a bulk box of toilet paper. Hey, I looked right back at ‘em. A man’s gotta wipe.

Plus, this is rapid-dissolving, supposedly, so no more damn clogged up toilets. ;)

I still don’t see myself using this Amazon Grocery stuff for anything more than filler items for when I order books and such, to get up to the free shipping amount, but still, at least now those filler items will be useful stuff that I happen to need. Not sure where I’ll put these bulk items though.

Sweet Zombie Jesus!!

The impossible has occurred. The robot devil is skiing in hell right now.

Futurama has been picked up by Comedy Central! Whooo!

From Digg:
Comedy Central has ordered 13 new episodes of the animated series that Fox canceled two years ago. Billy West, Katey Segal and other stars signed deals this week to return the show to TV. In getting a second life, “Futurama” is following the path taken by “Family Guy,” which also found post-cancellation success on DVD and cable reruns.

Excellent. Love that show.

read more | digg story

Picasa Web WordPress Widget

THIS PLUGIN DOES NOT WORK ANYMORE. I doubt I’ll be updating it any time soon.

Playing around with my new Picasa Web access, I found the RSS feeds quite nice. So I made a widget for them.

Picasa Web Widget

Basically it puts a slideshow of photo thumbnails from one or more Picasa Web RSS feeds into your sidebar. You can click them to go to the photo’s page on Picasa Web. Uses divs and names and all that good CSS stuff to make styling them easy, if you want.

Enjoy!

—-

Update: Version 1.1 actually works now. )

—-

Update: Version 1.2 now has four additional options. Now you can:
-Turn javascript image rotation on/off.
-Limit how many images will be rotated through.
-Display more than just the one image.
-Control whether or not the images are shown in a random order.

The image rotation script has also been corrected to work in both IE and Firefox (and probably others as well).

—-

Update: Version 1.3 adds Brian’s fix for filenames with unusual characters in them being in your web album.

—-

Update: Version 1.4
– Output will now validate as valid XHTML. Should work all the time. Important note: Use the class for CSS styling of anything, the ID is only there when you are only showing one image.
– Added the ability to display descriptions below the thumbnail. It even works with rotating images. )
– Fixed the case where you are showing multiple images in a non-random order.

—-

Update: Version 1.5 – Corrected a problem where it would only show the last feed when you give it multiple feeds.

—-

Update: Version 1.6 – Corrected some cases where the rotate images javascript would fail to work in certain scenarios.

New Photo Album

I just got access to the PicasaWeb test, and uploaded a bunch of pictures. Gotta say, this thing is great! Picasa is an excellent photo organizer, which now has a bunch of new features.

  • Geotagging of pictures, integrated with Google Earth.
  • Upload photos to your own online photo album.
  • Online albums have RSS feeds.
  • Choose the quality of your online pictures.
  • 250 meg of free album space (6 gig if you pay for it).

It’s good stuff, I recommend signing up if you haven’t already.

You can check out my public photo albums here.

Amazon Grocery

Just saw this on Digg. Amazon now sells groceries.

Looks like most of it is in bulk, but this also means that it qualifies for free shipping in a lot of cases. All non-perishable items as far as I can see.

So if you happen to need a lot of dish soap, or want to stock up on Mac & Cheese, or just have this craving for a freakin’ ton of jerky, click the banner above. )

DNF = No Rush…

Just saw this headline over on slashdot and got the shock of my life:
3D Realms Won’t Rush Duke Nukem Forever

No kidding? After 10 years of development, they’re not going to rush it out the door? Really? Shocking!

There’s a pretty funny discussion going on over there about this shocking, shocking news.

My favorite comment so far:
“…Duke Nukem Forever has taken more time to create than NASA took to design & build a pair of robots, fly them to Mars, and drive them around for a year.” (note, it’s actually 2.5 years)

Addition: A good page with info on the things that have happened while DNF has been in development: http://duke.a-13.net/

Fun with PHP and WordPress

Guy over here asked how to display hockey scores on his blog. Here?s my solution?

Edit: Fixed a minor problem with the regular expression. Some of the soccer team names caused problems on that feed.

A quick googling tells me that exactscores.com seems to have feeds for scores for lots of stuff, however they also put horrible amounts of advertising into the RSS feed. Nevertheless, that can be worked around, if you want. )

The actual score information in the feeds comes in the titles, and it looks like this:

(No)001/1 (BST+2h,Start at)03:00 (Home Team)EDM OILERS (Final)3-6 (Away Team)ANA MIGHTY DUCKS (Status)Finished (First Period)0-3 (Second Period)3-2 (Third Period)0-1 (Full Time)3-6 (Over Time)- (Penalties)- (Scorers)LUPUL(19)

Now, that is pretty ugly. But, at least it?s in a semi normalized format: (Key)Value? The Scorers at the end isn?t pretty, but we can deal with that later. Also, thankfully, the actual scores in all the ones I checked always start with (No), so we can use that to determine which bits of the feed are actual scores and which are not.

So here?s a simple script to retrieve a feed and then display only those bits that start with (No):

< ?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
$rss = fetch_rss('http://www.exactscores.com/HockeyLivescoreRss.xml');
echo '
    '; foreach ($rss->items as $item ) { if (preg_match('/^(No).*/i',$item['title'])) echo '
  • '.$item['title'].'
  • '; } echo ''; ?>

Obviously, the output of this is ugly, but it proves that we?re only getting scores out of the feed.

So, now we need to parse that string and get more useful data out of it. Here?s where preg_split and some rather disturbing regular expression syntax is your friend?

$uglyscores = preg_split('/^(([^)]*))[^s]|s(([^)]*))[^s]/',
	$item['title'], -1, PREG_SPLIT_DELIM_CAPTURE);

I called it $uglyscores for a reason. This returns an array with the bits of the scores nicely parsed out, but because of the regular expression I used, there?s a blank string between each pair of data, so let?s reformat this mess into something nicer:

$i=1; // skip the first element
$scores = array();
while ($i<count ) {
	$scores[$uglyscores[$i]]=$uglyscores[$i+1];
	$i+=3; // skip the blank separator
}

This gives us a nice array of elements that we can then reference by the key names. So we can use stuff like $scores[?Final?] and such.

So now that we don?t have to display everything, let?s put it all together. Here?s a combination of all of the above that outputs the two teams and the final score only:

< ?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
$rss = fetch_rss('http://www.exactscores.com/HockeyLivescoreRss.xml');
echo '
    '; foreach ($rss->items as $item ) { if (preg_match('/^(No).*/i',$item['title'])) { echo '
  • '; $uglyscores = preg_split('/^(([^)]*))[^s]|s(([^)]*))[^s]/', $item['title'],-1,PREG_SPLIT_DELIM_CAPTURE); $i=1; // skip the first element $scores = array(); while ($i<count ) { $scores[$uglyscores[$i]]=$uglyscores[$i+1]; $i+=3; // skip the blank separator } echo "Home Team: ".$scores["Home Team"].""; echo "Away Team: ".$scores["Away Team"].""; echo "Final Score: ".$scores["Final"]; echo '
  • '; } } echo ''; ?>

And there you have it. If you want to display different information, just modify the stuff in those echo lines towards the end.

The key is finding the RSS feed with the data you?re interested in. Once you have that, it?s usually fairly straightforward to parse it and redisplay it nicely. )

css.php