RSS
 

Archive for October, 2008

In the Shadows of Media Giants

23 Oct

The McCain campaign will probably go down in history as one of the worst-run campaigns in American history. Not because of a few horrible gaffs (“helped create” the BlackBerry? intended to insult the Prime Minister of Spain? speaking in front of a green screen?) but because they forgot who their candidate was.

The following does not constitute rigorous proof. Just observation and conjecture.

For an experiment, I went to Google News and searched for “mccain” “palin” “obama” and “biden”, all separately, and just looked at the total results. (I looked on the second page because Google’s duplicate-finding algorithms usually seem to pare down results by the time you get to page 2.)

Here are the results:

Obama and McCain are fairly even (unsurprising, since most articles that mention one mention the other). What shocks me is that Sarah Palin, who almost no one in the country had heard of until two months ago, has already caught up to half of the candidates, who have been on the trail for a year and a half.

Unless Michael Palin has been making tons of news, lately?

She’s got two and a half times the press of Joe Biden, who’s been a US Senator for 35 years, so probably has some old mentions in there.

We see a similar trend in the regular Google search:

Here I attribute the difference between Obama and McCain to Obama’s lead among young voters. But Palin has even more momentum here, half of Obama and two-thirds of McCain. (I re-ran this search several times, because Google said it was customizing my results based on my recent queries.)

Why?

McCain picked an ambitious, photogenic campaigner. He, on the other hand, is an occasionally ornery, but usually soft-spoken old man. Barack Obama is a well-spoken Black man with a thousand-watt smile. Biden is the soft-spoken older man on that ticket.

Unfortunately for Senator McCain, he also picked an unknown, inexperienced Governor who usually sounds like a high school student who didn’t read the book, and looks like Tina Fey. Comic. Gold.

I realize that picking someone less exciting that John McCain may have been difficult, but picking someone much more interesting, and not in a particularly good way, was definitely a bad choice. Yes she energized the base. She also energized every comedian and reporter. So much so that they forgot about John McCain.

They are “voting for the chick.”

For disclosure, I only identify as a Democrat because they’re as far left as I can get and still have a realistic chance of winning. I’m roughly in the left side of the British Liberal Democrat party.

But, if I was a Republican, I would be angry about this. As a liberal, it’s just funny.

 
Comments Off

Posted in Uncategorized

 

Connecting PHP, IIS 6, and SQL Server 2005

23 Oct

I know I will be accosted for this, but at work we needed to run PHP on IIS 6 (fairly simple) and connect it to a remote database server running SQL Server 2005 (not terrible, once I gave up the Microsoft way).

Yeah yeah, do it in ASP.NET, I know. While I like C# as a language, I kind of hate ASP.NET as a framework, so what are you gonna do? Java was an option but the start-up time was too long for this project.

My first Google search for “PHP SQL Server 2005″ turned up the Microsoft SQL Server 2005 Driver for PHP. “Well great!” I thought. It’s just a PHP extension, very easy to install on Windows. But I didn’t know the horrid depths into which I was about to sink.

The Microsoft driver comes with an example application and database. The application assumes you are connecting to a local database. There is scant information about remote databases.

The driver defines this function:

sqlsrv_connect($host[, $connectionOptions[, ...]]);

The example application tells you to set $host to (local). Supposedly this works. However, after scouring the internet for several days, and trying every permutation of hostname, Windows networking name, port, IP address, white space, and several other variables that shouldn’t have been in there, I’ve decided it doesn’t talk to remote servers nicely.

PDO‘s ODBC driver, on the other hand, and a quick visit to www.connectionstrings.com, worked wonderfully.

Here is how I needed to create the PDO object. I hope this is useful for someone else:

(ed. The symbol « is a line break that’s not in the real code.)

$host     = '1.2.3.4';
$port     = '1433';
$database = 'MyDatabase';
$user     = 'MyDatabaseUser';
$password = 'MyDatabasePassword';

$dsn = "odbc:DRIVER={SQL Server}; «
 SERVER=$server,$port;DATABASE=$database";

try {
  // connect
  $conn = new PDO($dsn,$user,$password);
} catch (PDOException $e) {
  // fancy error handling
}
 
Comments Off

Posted in Database