Archive for February, 2010

php memcache vs memcached

The newer memcached PHP extension was created recently by some guys at Digg.
It has some new features and performance enhancements.

Here’s a comparison
http://code.google.com/p/memcached/wiki/PHPClientComparison

But, the interface is not identical.

We’re going with memcache over memcached for it’s guaranteed backward compatibility.
The newer memcached has some additional features that I’m not really interested in.

If I had to worry about supporting over 10,000 daily uniques, it might be a different story.

Network Solutions Wildcard SSL Certificate

If you’re thinking of buying a Wildcard SSL Certificate from Network Solutions, beware it will not be valid for the base domain.

Your $400 SSL Certificate will cover

https://www.example.com
https://abc.example.com
https://whatever.example.com

But it will not cover

https://example.com

If you want SSL on example.com, you will have to buy ANOTHER SSL Certificate ($150).
I couldn’t find this fact mentioned anywhere on the Network Solutions website.
I had to call their 800 number to get an answer.

Note that some registrars do cover the base domain with their Wildcard SSL Certificates (like GoDaddy).

Not all SSL Certificates are created equal.

Multiple Arguments

In real life, I’m not a fan of arguments.
But sometimes in code, arguments can be a good thing.

function addFailure($id) {
	$query = "insert into billing_history (id, auth_success) values($id, 0)";
	mysql_query($query) or die(mysql_error());
}
function addSuccess($id) {
	$query = "insert into billing_history (id, auth_success) values($id, 1)";
	mysql_query($query) or die(mysql_error());
}

Sometimes 1 function with 2 arguments is better than 2 functions with 1 argument.

function billing_history_create($id, $success) {
	$query = "insert into billing_history (id, auth_success) values($id, $success)";
	mysql_query($query) or die(mysql_error());
}

KB927917

You get an error in IE6/7/8

Message: HTML Parsing Error: Unable to modify the parent container element 
before the child element is closed (KB927917)

Your javascript is attempting to append something to the body element before the body element is closed.

You need to enclose your javascript in an on-load event handler.

$(document).ready(function(){/* Your JS */});

What if the IRS had an API?

GET /people/123456789/year/2009/balance HTTP/1.1
Host           ssl.irs.gov
Accept         application/json
Secret-Api-Key f24b35a8f2e1dda6ca5a5166a5530b96
 
-
HTTP/1.1 200 OK
 
{"ssn":123456789, "balance":"12345.00"}
 
-
POST /people/123456789/year/2009/payments
Host           ssl.irs.gov
Accept         application/json
Secret-Api-Key f24b35a8f2e1dda6ca5a5166a5530b96
 
amount=12345.00&card[number]=1234567890123456&card[exp]=0112&card[name]=kev%20burns
 
-
HTTP/1.1 201 Created
Location: /people/123456789/year/2009/payments/1
 
{"ssn":123456789, "amount":"12345.00", "created_at":1265432844}
 
-
GET /people/123456789/year/2009/balance HTTP/1.1
Host           ssl.irs.gov
Accept         application/json
Secret-Api-Key f24b35a8f2e1dda6ca5a5166a5530b96
 
-
HTTP/1.1 200 OK
 
{"ssn":123456789, "balance":"0.00"}

Coupling vs. Cost vs. Time

In response to Subbu’s Coupling Vs. Cost

coupling-cost-time

It’s a wave, isn’t it? The sweet spot is somewhere between 0,1,0 and 1,0,1 depending on the project.

Bad future.

launch

Launch Launch Mass Effect 2 or Launch Mass Effect 2 Launcher?