Archive for June, 2008

Perl and Movable Type

I finally made the switch for my blog to our own server, after Don got our new server up and running. We hammered through some DNS fun and then some PHP Horror, and then, after everything was set up, it was Perl time.

What went through my head was a little chant: ‘not a PHP install all over again.. not a PHP install all over again.. not a PHP install all over again.. ‘

And, it wasn’t quite that bad. Close, but not quite. The difference was that in the Perl install, most of my guesses were correct. Because, as always, installing any non-Microsoft language on a 2k3 box with IIS is never going to be fun. I unzipped the MovableType (version 4.12) file into my web directory, and set off to configure everything. (I already had IIS and MySQL installed at this point).

That said, the first thing I did was install ActivePerl from ActiveState, version 5.10.0.1003. At the time of writing, this was the latest and greatest. I did the install (something that, if following this as instructions, I urge not to do, at least of that version… follow further down), and everything worked… except that there was no MySQL module to be found. Bummer.

So, after hours of troubleshooting that I won’t bore you with, I finally googled around and found out that the 5.8 version (5.8.8.822, to be exact) still had the MySQL module. I uninstalled the old version and installed this older version, set up the extensions (IIS manager -> web site -> right-click, properties -> home directory -> configuration, add .cgi with the extension set to the perl.exe file where you installed perl, with the headers locked down to GET, HEAD, and POST). Basically, I followed this: MT Windows Installation. However, after all that was said and done, I still had the problem of it not working.

The first problem I had was that when I went to check the install by going to mt-check.cgi, it errored out halfway down the page. So, I opened up the ActivePerl Manager and set DBI and DBD-MySQL to reinstall. I also took the -original off of the “mt-config.cgi-original” file name.

The next thing to do is to open up that config file, and comment out
all of the data sources you’re not using.  Mine looked something like:

##          Movable Type configuration file                   ##
##                                                            ##
## This file defines system-wide settings for Movable Type    ##
## In total, there are over a hundred options, but only those ##
## critical for everyone are listed below.                    ##
##                                                            ##
## Information on all others can be found at:                 ##
## config

################################################################
##################### REQUIRED SETTINGS ########################
################################################################

# The CGIPath is the URL to your Movable Type directory
CGIPath    http://www.crimsondeviations.com/blog/

# The StaticWebPath is the URL to your mt-static directory
# Note: Check the installation documentation to find out
# whether this is required for your environment.  If it is not,
# simply remove it or comment out the line by prepending a “#”.
StaticWebPath    http://www.crimsondeviations.com/blog/mt-static

#================ DATABASE SETTINGS ==================
#   REMOVE all sections below that refer to databases
#   other than the one you will be using.

##### MYSQL #####
ObjectDriver DBI::mysql
Database movabletype
DBUser ********
DBPassword *************
DBHost localhost

##### POSTGRESQL #####
#ObjectDriver DBI::postgres
#Database DATABASE_NAME
#DBUser DATABASE_USERNAME
#DBPassword DATABASE_PASSWORD
#DBHost localhost

##### SQLITE #####
#ObjectDriver DBI::sqlite
#Database /path/to/sqlite/database/file

Then again, the mt-wizard page continued to error with “CGI Error. The specified CGI application misbehaved by not returning a complete set of HTTP headers”.  After more Googling around, I found out that you have to replace a line in every page in the main directory (luckily, not many: I opened them all in Notepad++ and did a “replace all in opened files”). You have to change:
use lib $ENV{MT_HOME} ? “$ENV{MT_HOME}/lib” : ‘lib’;
to
use lib $ENV{MT_HOME} ? “$ENV{MT_HOME}/lib” : ‘Y:\www\blog\cgi-bin\mt4\lib’;
(replacing, of course, with whatever your path is).

Which then fixed my errors of it not finding the right data source, having wrong headers, and it magically worked, and I was on my way to blogdom!

Tags: , , ,

Analytics

Having searched through a large number of analytics software, I was extremely surprised at the lack of, well, good software. It seemed that there were two ends on the spectrum: cheap (or free) software that took years to parse through IIS log files and then still recompiled every time you clicked a link, or there was the really, really expensive stuff that did everything you wanted and sends a team to wash your car every other Tuesday. Having looked through about a dozen tools, I finally found a fit: Google Analytics.

GA is a beautiful tool; just throw in a .js file, a couple variable configurations, and you’re done. It’ll show you everthing from the most common city people are visiting from, to the highest web browser / OS combo (which is extremely useful.. can we drop IE 6 YET? The CSS support is killing me). It’s got every metric I could hope to track. However, that doesn’t solve all problems – what do we do with old trending data? How do we get them together? How do we archive these Google reports?

Even then, the answer is clear: the holy grail of universal data format, XML. Google Analytics very conveniently exports all reports as XML format, so it’s really just a matter of taking all of the old data and pushing it through a little tool thrown together quickly using Visual Studio, which parses and exports data in Google’s XML format. Now we’ve got all of our data stored and backed up, and even ready for the next thing to come after Google.

I’ll attach a breakdown of all of the different tools we looked at, tomorrow.

Tags: ,