Archive for April, 2010

So… I’m a Dad now…

Friday, April 30th, 2010

… and it actually feels great. People aren’t kidding when they say it’s a life-changing event, and in more than the obvious ways.

The labor went really quick, but the first few parts didn’t seem like it. Sabriena has had back problems since forever, so we were hoping she could do it without the epidural – everything was going great, she dilated most of the way without it and was doing well coping with the pain… until it came time for the baby to start moving.

I guess doctors describe the baby’s position in the uterus on a ten-point scale from -5 to +5… -5 being chilling way up like it’s nowhere near time for delivery, and +5 being ready to poke out if he moves any further. Well she went from -1 to +2 (or 30% of the baby’s total non-delivery movement, so I gather) in 30 minutes… so 10% every 10 minutes. From what she tells me it was pretty excruciating, so we went ahead and ordered the epidural – which was just as well we didn’t mess around any further because after the epidural it turns out she was 8cm dilated, and they wouldn’t have done it any later. :(

Not long after the epidural, it came time to push – and that part flew by. It seemed like one minute I was feeling like it was never going to end, and the next I was watching my kid being lifted up onto my wife’s stomach. A doctor’s handing me surgical scissors and pointing at the cord, and I get the stereotypical “am I qualified for this?” thought before I go ahead and get it done – it was a lot harder to cut than I expected!

I was pretty worried about his health, because as I understand it I was a pretty sick kid… and Sabs’ sister had a bunch of problems with Jeremy, so I think I was just naturally expecting a repeat of that… but he came out flawless. He’s strong, healthy, a bit on the small side but there’s nothing wrong with that.

We waited for what seemed like an eternity for the hearing test, only to find out somewhere around the 24 hour mark ourselves that he was by no means deaf… every time we moved… opened a soda can… or some kind of food wrapper… that boop from the barcode scanner whenever the nurses would scan Sabriena’s medication… everything warranted him sitting up and checking it out.

We’re home now, and I’m so glad. Hospital beds suck, along with the guest beds – even though our room was pretty cushy. Even though our mattress isn’t the greatest it’s so nice to be on our own bed… even though I haven’t got any sleep yet.

Starcraft2 Beta

Monday, April 26th, 2010

So a friend of mine (who will remain nameless at the moment) let me in on his beta account so I could check out Starcraft 2, and… well.. it’s a little underwhelming. Of course I think it’s still kind of early in the beta, so perhaps there’s a lot more good stuff coming.

But the 3D effects are almost a waste! You could be forgiven for thinking it’s just Brood War at a higher resolution, the zoom in/out is really limited in scope and unless I was doing it wrong it looks like there’s no ability to rotate. It looks almost like it’s the WC3 engine with SC sprites.

Contrast this to something like Spring/Total Annihilation – which is well over a decade old and has had this kind of stuff all along, and it’s easy to see where I’m coming from. Play some of the cooler spring mods, then switch to SC2 and SC2 is about as exciting as your Uncle Joe’s jeans.

The game itself is pretty though, if you lower your expectations, and it’s classic Starcraft really. If I got a new PC (mine doesn’t quite have enough CPU and freezes periodically during games) I’d probably buy it, but it’s not entirely what I was expecting.

You all are probably getting sick of this…

Sunday, April 25th, 2010

…but I’m on an optimization kick and can’t stop talking about it. Hungry Hacker just gobbled down another fistful of slimming pills now in the form of a removed jQuery library from Arthemia. Well that’s not strictly accurate, because Arthemia doesn’t included jQuery by default – the bottom right portion of the footer contains a box that lists the “most popular articles”, which is powered by the WP-PageViews plugin which… you guessed it, uses jQuery.

To me it’s almost a case of “everything looks like a nail” with respect to jQuery – it’s one hell of a fat (cool, but fat) library for just ensuring a script is called without cache control. The same thing could be fixed with a transparent image, or a lightweight home-brew AJAX call-home without the entirety of the library included for every page view.

Disabling this plugin lopped off 25% of the average page’s uncompressed total file size – to be fair, with gzip compression on it was probably closer to about 5KB actually saved (though I have no idea how much jQuery weighs gzipped) but the fact is we saved another HTTP request, and a script request in the <head> of the page no less.

Median page-load times according to the PageSpeed plugin for Firebug look to be between 600ms and 1 second – I think that’s good enough, actually. I just need to think of something to put in the unoccupied territory of every page now, and then I should probably get back to work putting up content.

Premium Themes – Turbocharged

Friday, April 23rd, 2010

As I wrote about earlier, I spent the better part of the last couple of days trying out various tricks to soup-up WordPress websites. One of the things I managed to do was re-imagine the thumbnailer common to a good portion of those “premium themes”, to allow it to serve mostly-static content instead of relying on PHP all the time.

The results are pretty freakin’ awesome – based on some rough benchmarks I’m expecting somewhere between ten to fifty times as much users during load when it’s teamed up with nginx.

Of course it has some serious caveats, not entirely unlike the side effects of diet pills (pooing out fatty jelly isn’t entirely out of the question) and it’s rather annoying to have to edit your theme every time you want to change your look… but I think the results are worth it.

I’ve released the instructions for Super-caching TimThumb on Hungry Hacker, it’d be awesome if it were somehow rolled into the main script.

nginx – I think I’m in love!

Friday, April 23rd, 2010

Well, it’s no secret to anyone reading my blog that we’ve been experimenting with building dig-proof sites. Today, those experiments took a huge leap forward. It’s probably also no secret that I’m a bit of an Apache fanboy – I’ve been using it for well over a decade now, and I’m a little reluctant to let go of it.

However, Apache has to take a back seat for some of our sites now (at the time of writing, Hungry Hacker is the only one) as we’re giving nginx a test drive. The preliminary results are stunning – absolutely stunning.

At first I wasn’t convinced, because on my little home test server (a celeron with measly amounts of RAM) it appeared like both Apache (event MPM, tons of modules removed, all kinds of speed hacks) and nginx (out of the box from ports) both appeared to run out of steam around the same time.

A short time later I realized that while the benchmarks on both machines appeared to choke up around the same place, the box was a whole lot more responsive with nginx under siege. While Apache was able to keep up with nginx (something to the tune of 2-4% behind it), the shell on the machine was pretty unstable during it.

So I decided to give it a shot on a live server, with a live site (hungry hacker), considering there’s very little involved in building nginx at all. With a bit of config-fudging, I managed to build a reverse proxy out of nginx for dynamic pages, with super-cached pages being served directly via nginx. The results are like night and day (it should be stressed these are non-keepalive requests):

Apache: 684.73 [#/sec] (mean)
nginx+Apache: 10027.18 [#/sec] (mean)

Without gzip enabled (I’m working on some nginx-config-fu to selectively serve pre-compressed super-cache files to browsers that’ll accept it, so far without much success), the ~10,027 requests/second resulted an almost-saturated gig-e port.

If we can pre-cache the text-based data (average savings of ~65% or so on Hungry Hacker), I’m pretty optimistic we can host absolutely surge-proof WordPress sites.

Akismet’s still proving itself useful, blocking a ton of shit like lipofuze reviews and other diet pill crap along with the usual suspects of “I really enjoyed your blog! I will check back often” on what’s usually the most boring page on the site. The real irony was that a good proportion of the spam is aimed at Strykar’s article on screwing over spammers!

More WordPress gripes :(

Monday, April 19th, 2010

We’ve been hacking a lot on WordPress lately, spread out over various sites… and I really have to wonder who made some of the design decisions or if, like most of the PHP I (and a good portion of the world) write, some parts of it were never designed and were instead grown. The result is some really idiotic default behavior for which there’s no easy workaround when you want to do something remotely out of the norm.

Take, for example, using category stubs as part of your perma-link URLs. A good many advanced themes have “meta categories” – Arthemia, for example, which we’ve hacked up for Hungry Hackers, has two: “headline” of which the latest post is shown up the top left, and “featured” of which several are shown on the top right.

It stands to reason you’re going to add these categories first, and then as your site develops you’ll be adding more later on. Well, when constructing a perma-link URL for a post, if you’re using /%category%/%postname%/, the lowest ID category is chosen for the “main” category, whose stub will be used to craft the perma-link – and there doesn’t appear to be any way to change that.

Sure you could make all your categories first, and then the “meta” ones later – but what happens later on when you want to add another category to an established site? Nightmare category juggling, or having featured articles having the URL /featured/some-great-article/. The worst part is, if an article is in two categories and you try to access it via the stub of a different one, it 404s. So at some point you have a really popular featured article, it gets a shitload of back-links, then you move it out of the “featured” group for some reason – all those back-links are useless. They 404.

Even if you’re not using any “meta” categories, in my opinion this is still silly behavior. It stands to reason that in most sites that grow in a sane way, the highest IDed category is going to be the most significantly relevant category. Think about it, your site is small and you start out writing about Flowers, putting all your articles in “/flowers/”. Later on, you add two new categories for “indoor” and “outdoor” – it’d make more sense for the URL to be based off the more specific category… except of course you have that whole 404 thing going on if you so much as move a post to another category.

I started out hacking on the WP-core, it’s simply a matter of swapping two comparison operators in _usort_terms_by_ID() and the highest ID category’s selected. Of course this might break shit in future, and would cause a ton of URLs to 404 if I update the WordPress core at some point and neglect to re-hack the change. But it’s really quite an easy hack in wp-includes/category-template.php (swap the underlined operators):

function _usort_terms_by_ID( $a, $b ) {
if ( $a->term_id > $b->term_id )
return 1;
elseif ( $a->term_id < $b->term_id )

I reverted that though, because I didn’t want to have to remember to do it with every WP patch. The very first “click here to update” notice could spell a whole lot of un-indexed content in search engines…

In the end, I ended up just re-numbering my meta categories to 999 and 1000, and hoping I don’t ever create 999 categories to cause a conflict. It was simply a matter of removing all posts from those categories, then editing the SQL database tables.

Update the term_ids in wp_terms and make them match in wp_term_taxonomy, and you’re good to go. That is, until such a time as you end up making your 999th category, so perhaps I should have selected a number just a little higher? ;D

ARGH WordPress! ;(

Sunday, April 18th, 2010

Maybe someone else can explain why this is such a fantastic idea – for Hungry Hacker, I wanted to have the page title before the site title, and I wanted it separated by a hyphen. Doesn’t seem too hard to do, wp_title() accepts a few arguments just perfect for the purpose.

So I reverse the two tags, and change wp_title() to wp_title(‘-’, 1, ‘right’), which puts the separator on the right hand side instead of the left. Awesome!

Wait, something’s not quite right – the dash is a little longer than the one before “Mozilla Firefox”. I go to check another page – Google’s Webmaster Tools – and they’re using a plain ol’ hyphen and it looks the same. What the fuck is this? I check the source of my rendered WP blog, and it’s not a hyphen at all.

For some reason, if you set wp_title’s “sep” parameter to ‘-’, it arbitrarily changes it to an “en dash” (&ndash; or a dash the width of an “n”). Considering that the default is &raquo;, I can’t for the life of me figure out who the hell thought this would be a good idea.

Can someone explain it to me? If I meant to have an &ndash;, I’d have put one!

Hungry Hacker Paintball

Saturday, April 17th, 2010

Since we’re hopefully going to be playing more than one or two games this summer, I started taking inventory of what’s required to get my paintball gun in tip-top working condition.

Since I was doing that, I decided to take the various parts of my old paintball pages from Hungry Hacker and update them to put on the new site. We decided to make a whole knew section for Paintball, and since OtterSC Customs’ domain has expired, I’m also going to be putting together somewhat of a “Spyder Bible” since I can’t really see too much in the way of sites like that at the moment.

It’s funny to see the neighbours’ reactions when I go out and test-fire our paintguns in the back yard. Especially the welfare trash across the street (though to be fair, some of them are stuck on social security disability, hopefully for good reason) – those jerks always glare at us for no reason. :(

Getting old is awesome!

Saturday, April 17th, 2010

Apparently Sabriena and I are old enough now that we’re no longer considered dipstick adolescents and are now trustworthy with our vehicles. We now qualify for car insurance for next to nothing (comparatively speaking) – we’re current at around $60-70 for both of us on both vehicles… a far cry from about four or five years ago when it was closer to $200 a month for one vehicle!

But cheap auto insurance isn’t the only advantage, we’re also slowly getting our credit sorted out too.

Someone buy me a new PC :(

Friday, April 16th, 2010

I had a pretty good time playing Team Fortress 2 for a little while tonight, and while I was doing it I played a bit with the beta for the new Steam UI. It looks positively gorgeous, but god it runs like trash on my PC.

Sabriena and I are planning on buying new computers sometime in the next two years if our finances keep going the way they have been – our poor desktops are rather tired, and we may just end up picking up a couple of mid-range laptops to keep us going in the mean time unless we suddenly become made of money. I’m figuring we’ll aim for something with a Core2 processor and whatever’s cheapest with a gaming-capable graphics card.

Steam had a free weekend a while back for the multiplayer portion of MW2, so I figured I’d give it a shot despite the fact I have it for PS3 – a new group of people to play with might be fun, I thought… well, even though I’ve still stolen Sabriena’s DX9 graphics card, it doesn’t support Pixel Shaders 3.0. :(

The Mumble developers are looking for someone who owns the Steam copy of Battlefield: Bad Company 2 to hack the offsets for positional audio, which at the time of writing only works for the retail boxed version and not for the Steam version (different builds, so different offsets)… same thing again, my PC just won’t run it so it’s not even worth looking at (besides, I already beat it for PS3).

Sometimes I wish we could just hit the lottery, but then I remember we don’t play it. :(