Added Counter and SiteSpeed to Website

Well adding a counter turned out to be harder than I thought. Well, maybe not harder, but I got distracted a lot. Here is the story. If I get encouraged by lots of comments, I will post more of a tutorial of how to do it. So encourage me already!

I wanted a counter so I could know if people come to visit. Counters and comments give me feedback about what works and what doesn’t. Slow doesn’t work, and I am worried about speed. So I also wanted a way to measure speed.

I found two tools on the internet: Tizag PHP Counter and Numiun SiteSpeed. Both tools run entirely on my web sever (mine, Sherman’s — the one I am using), so they do not require an account or link to a 3rd party server. For example, the commenting tool (HaloScan) requires an account, and users see ads. The counter and SiteSpeed don’t. There are no adds.

To get the counter and SiteSpeed working, I had to learn something about PHP scripting, and I had to enable PHP on both my and Sherman’s webservers. This was not a big deal, and I finished that in an evening, even including the customizing, formating, etc.

I also needed to add the counter to every page of the website. Hmmm. Well, that shouldn’t be hard, since I have this great new RapidWeaver tool, right? Wrong. I use RapidWeaver to generate much of the site, but I use iView MediaPro to generate the photo galleries. And then there is a bunch of moving files around, and even some hand edits, to get everything working. Well with 14 galleries and counting, manual is not good. So I got distracted. Very distracted.

Knowing a little Perl, I knew it wouldn’t be that hard to automate all the moving files around. Even more importantly, I figured I could automate all the hand tweaks. I was right, but it took digging back into the Camel Book and several late nights to get it all right. But I found out, again, that I really do enjoy computer programming.

Now that I had the file manipulations so nicely automated, I couldn’t just plug through manual menu picks to generate 14 galleries, could I? No, I had to automate that too. So I learned AppleScript. AppleScript is an interesting language. It allows you to automate tasks in standard MacOS applications, like iView MediaPro. The language is easy to read, with syntax like “tell application “iView MediaPro” to make HTML gallery ” and “click button “Make…” of window “HTML Options””, so it is easy to believe that it is easy to write.

Not so. The most comprehensive reference for AppleScript is Apple’s AppleScript Language Guide last updated in 1999. It is pre-OS X, and is very out of date. There are other references on Apple’s website, but I found that mostly an exercise in frustration. The best book for learning AppleScript is from O’Reilly (of course). AppleScript: The Definitive Guide, 2nd Edition was extremely helpful, and though not very rigorous, it did get me where I wanted to go.

(In the process of deciding to read AppleScript: The Definitive Guide, I finally broke done as subscribed to O’Reilly’s Safari BookShelf. This has absolutely nothing to with the Apple Safari Web Browser. It is a service that for $20 a month, I get to read up to ten O’Reilly books online. Considering that most O’Reilly books cost about $40, and they go out of date quickly, this is a pretty good deal. I am actually quite glad I did it.)

So, now I have a website with a counter and a speed meter, and I know a lot more about PHP, Perl, and Applescript than I did before. Leave me comments if you want more info. Enjoy the website.