Praying to the Internet

The Internet accepts all queries,
responds to all requests,
but sometimes the answer is 404.

Posted in Uncategorized | Leave a comment

It’s 2010. Screw the Flying Car, Where’s My Ad Server?

When I watch shows like South Park online, they serve short video ads. Invariably, at least 3 of the 4 ads are the same ad, if not all 4 of them. However, without fail, all 4 ads are completely irrelevant to me.

Privacy is a huge concern for everyone (including people who use unsecured computers over Wifi), but I’m frustrated enough to trade some privacy to not have my time wasted. Show me something I’m remotely interested in. What a concept!

We have the technology. Can we get it together enough to not show the same ad to the same person more than twice per session? We’re web nerds; can’t we do better?

Oh, and when I’m watching the “clips”, don’t serve me a 30 second ad in front of a minute and 30 second clip. It’s ridiculous. Makes you look desperate for cash.

Hulu makes an effort with a tiny link asking ‘is this ad relevant?’ Plus they have Anime that features nude cartoon babes; that makes it worthwhile to sit through the ads. ;-)

Posted in Uncategorized | Leave a comment

Creating an Empty Object in PHP

Sometimes you want an empty Object. Here’s how I go about it:

$Object = (object) null;

I cast the value ‘null’ as an object. You can do this with other kinds of variables too:

$array = array('dog' => 1, 'cat' => 5);
$Object = (object) $array;

$Object now has two properties: dog and cat. Enjoy.

Posted in Uncategorized | Tagged | Leave a comment

Velociraptor vs. Sam Neil

I never believed that Sam Neil could outrun a Velociraptor. Not for a minute.

Posted in Uncategorized | Leave a comment

Accessing Values by Referrence in a Foreach Loop

Here’s a fun little trick. When looping over an array, you can access the values by reference. Instead of:

foreach ($things as $i => $thing)
{
  $things[$i] = strtolower($thing);
}

You can reference the values of the array:

foreach ($things as &$thing)
{
  $thing = strtolower($thing);
}

It’s a small difference, but it comes in handy once in a while, especially when you’re doing more significant processing with each item.

Posted in Uncategorized | Tagged | 3 Comments