Archive for the 'rants' Category


Willfull Ignorance 2

Sometimes, writing good code is really hard. But other times, writing good code is so darn easy you shouldn’t even have to think about it. In fact, it shouldn’t even be called “good code” — in these cases there should never be anything else, so we’ll just call it “code”.

For instance, if I see another line of code that does this:

$foo = isset($foo) ? $foo : 'default value';

I think I’ll kill someone.

Let me clear something up for you: using the ternary operator does not make you cool. However, assigning a variable to itself makes you very uncool.

if (!isset($foo)) $foo = 'default value';

Now why is that so hard to write?

I’m in DC 2

So, as I mentioned a while ago, I’m presenting at DC PHP ‘08. It’s this week.

The presenter I’m listening to right now just reminded me why I hate MVC on the web. But I’m not going to go into it.

The conference appears to have gotten the wireless correct, at the very least. The past two conferences I’ve been to have both had extremely flaky wireless connections, which presented problems for not only the attendees, but presenters who were depending upon an internet connection.

My talk is tomorrow, so for now I just listen.

Unplugged and overplayed 1

Time for a blast from the past. Harmlessly enough, this technology was originally introduced to save users the pain of manually configuring their ISA cards (do you even remember the ISA bus?). I’m referring, of course, to ‘Plug and Play’ (PnP for short; ‘Plug and Pray’ for the cynical).

End of flashback.

Today, ‘plug and play’ can describe just about anything that the marketers have decided is easy to set up and use (seemingly whether or not it actually is). For instance, do you think the term was ever meant to apply to residential solar power systems? Or search Amazon.com for the term, and marvel at the number of video games that are ‘plug and play’ — and that’s perhaps the most literal usage of the phrase ever. You plug the game in to your TV, and you play it. Plug and play.

Yet, oddly enough, it didn’t make CNet’s list of the top 10 buzzwords. To their shame, in my humble opinion.

Pharmacists 5

Tonight I installed dnsmasq as a caching DNS forwarder on our home network (under a VM, no less). Additionally, I changed our primary DNS servers to those hosted by OpenDNS. To double-check that things were working, I figured I’d whip up a quick script to make a bunch of DNS requests and give an average time. First round, I faced the OpenDNS server against Cox’s own. I’d never really benchmarked the Cox DNS servers, so this was quite enlightening:

andrew@ubuntu-server-vm:~$ php ./dns_bench.php dothedrew.net 208.67.222.222
Average response time: 27.53
andrew@ubuntu-server-vm:~$ php ./dns_bench.php dothedrew.net 68.105.28.11
Average response time: 158.58

This only serves to strengthen my belief that all cable ISPs are run by pharmacists.

To satisfy morbid curiosity, here are the results against the local dnsmasq daemon:

andrew@ubuntu-server-vm:~$ php ./dns_bench.php dothedrew.net 127.0.0.1
Average response time: 0.21

That’s only about, oh, a 755x improvement. Hopefully that’ll sufficiently speed things up.

Outside the Box 3

Not long ago, Canon announced the newest offering in their Digital Rebel lineup, the Rebel XSi. Despite both being aimed at the consumer market, it’s predecessor, the Rebel XTi, has been extremely popular with the so-called “prosumers”, as it’s inherited much of its technology from Canon’s upper echelon of cameras without inheriting their prices.

Consequently, I was disappointed to discover that the XSi had forsaken CompactFlash — currently the de facto standard in all serious DSLRs — for the smaller (both in physical dimension and capacity), slower SD cards. Is there some hidden advantage to SD that Canon is privy to (did they really need the marginal amount of extra space to pack in LiveView?), or is Canon perhaps trying to steer the prosumer market towards their double-digit D line? Or maybe it’s a bid to lure the consumers already using SD cards in their point & shoot digitals into a camera with a heftier price tag.

Either way, I find it unfortunate — looks like the Rebel party may have ended for the prosumer.

How… 1

How do people get talking slots at conferences with a subject “to be determined”? When I submitted my talk, I had to fill out an entire assortion of bios, contact info, and an abstract. What does their abstract say?

I am a l337 PHP h4×0r. Let me talk.

Who wouldn’t give him an hour?

Perhaps I’m just frustrated because it took me like 4 tries to finally get a talk accepted. I’m sure — like just about everything else in the world of business — it’s all politics.

$vonage != $service 5

I’ve had Vonage for just about three years now. Over the past year or so, our phone line has probably been down more than its been up (the miracle of technology). I’m not ready to blame that on Vonage, however, since the adapter itself appears to be on its last leg. While trying to reconfigure it a few weeks ago, I realized that the integrated switch (it’s a combined router/switch/VTA device) was no longer working. I also noticed that the device was inordinately hot, so I’ve chalked it all up to hardware problems initiated by overheating.

In the hopes of salvaging our home phone, I ordered a used VTA device from eBay. I didn’t think twice about it; it’s definitely not the first piece of technology that I’ve acquired second hand, let alone from eBay, and I’ve had very few problems with any of it.

Of course, I made the assumption that Vonage would allow me to activate a used device. That was apparently not only a naive assumption, but also a fatal one.

As chronicled in various parts and pieces here, here, here, and probably many other places, Vonage apparently refuses to reassociate the MAC addresses of their VTAs (unless, of course, it’s been “reconditioned” by them).

Did I just buy a paper-weight? I’d be more than aggravated.

Obviously, as most of us know, this is purely an artificial limitation imposed by Vonage. Why? Are they worried about people recording the MAC address, selling the device, and then cloning it to steal calls? Do they get a little bonus for selling new devices? I have no idea.

The worst part, however, might not be their refusal to reuse a device. I could live with that, had only I know before I spent money on something that’s (currently) useless. But even with a bit of searching, I can’t find a single warning from Vonage on the dangers of buying used. I can describe this as nothing short of irresponsible, almost criminal.

So the moral of the story is, and I’d say this in big bold, emblazoned letters if I thought that it would somehow get it more exposure across the interwebs: whatever you do, don’t use Vonage. Erm, I mean, don’t buy a used Vonage device.

Like the good deviant I one day hope to be, I’m currently in the process of attempting to clone the MAC address of my previous adapter on the new one. The device supports twiddling with the MAC address, but, once I changed it, has been unaccessible (at least from work via the various SSH tunnels I have going). Yet if I delete it’s DHCP lease from the router it immediately reacquires one, so I’m thinking it’s caught up in some endless reboot cycle after attempting contacting Vonage. I’m going to keep digging.

The Importance of Bits 2

With their abundant availability both in volatile and permanent storage (i.e., RAM and hard-disks), sometimes I think the value of bits is lost on more recent developers, especially those that write in a very high-level language, like, say, PHP. The past few weeks I’ve been working very closely with some data analysts in our company — in particular, I’ve been compiling some very large tables (think nearly 1 billion rows per month) into “views” (technically, they’re completely new tables) that are much more manageable.

Tonight, mostly as an exercise in futility, I began looking at some of the foreign keys stored in the gargantuan tables. One of them in particular links to a table that currently contains (oddly enough) 256 rows. It grows very, very slowly. Currently the column is a long integer: 4 bytes. Imagine for a minute that we replaced that with what MySQL calls a small integer, or 2 bytes. Last month’s table was in the neighborhood of 900,000,000 rows, times 2, divided by 1024… That’s something just shy of 2 GIGAbytes that we’ve saved. (Never mind that there are about 4 other foreign keys this could also be applied to).

Every byte adds up, folks. Save ‘em while you can.

(Some might call this inconvenient math. I’m not quite that unscrupulous.)

The Crusades 1

In this eBay listing for a Canon 10D digital SLR, the seller mentions that he’s “upgrading” to a Nikon system. Would it be rude to send him a message asking him to correct his description to “downgrading”? ;-)

The PDT (Or: I Don’t Like Zend) 1

My animosity towards Zend has really increased lately, due to a number of factors (the recent ZendCon, their character when dealing with open-source projects, etc.), so much so that I’ve sworn off Zend products. Which doesn’t really sound like a difficult task at first glance, since I only use one Zend product — but that one product just happens to be one of the only good PHP IDEs out there: Zend Studio.

Fortunately (and if you follow the PHP world, you’ve probably heard about this), Studio is receiving competent competition in the open-source world from the Eclipse platform in the guise of the PHP Developer Tools, or PDT. (And that’s competition in a very liberal sense of the word, since Zend is actually backing PDT — so they can rip it of– base future versions of Zend Studio on it.)

Anyways, the real goal here was just to talk about a quick PDT tip (now that I’ve switched), not rant and rave about how Zend seems to have a knack for positioning themselves in the middle of hugely conflicting interests.

The tip: Most people know that you can Ctrl+Click “into” a function call. What I didn’t know is that you can also Ctrl+Hover to get a tooltip containing the first ~10 lines of the function.

blah.jpg

This can be immensely useful when you’re just trying to figure out what a piece of code does, without completely losing your train of thought and switching contexts.

Next Page »