Color Wheel

The color wheel is a Javascript color picker intended to display the 4096 web-smart colors. Some notes about it can be found in this blog entry. Not all 4096 colors are displayed, but many of them are. The png image was created with a PHP script

.

Blogquiz

Blogquiz is a perl script for scoring blog quizzes. The quiz itself goes on an accompanying html page. The source is free for any use, but requires cgi.

JPTracker

On The CGI Resource Index I found a hit tracker that I can run myself: ratlog. I hacked it up a bit to make it more like the hit-tracking service I used to use, Gumball Tracker. You don't need SSI to run it, just CGI on some server, somewhere. My version provides referring links and an option of not tracking hits for users with the magic cookie - so I don't track my own hits when I'm checking my pages. The tracker creates an NCSA combined format log file for each day, with entries of the following form:

63.186.65.76 - - [18/Mar/2003:23:20:52 +0000] "GET http://jemimap.freeshell.org/moveabletype/ HTTP/1.1" 200 - "http://www.seema.org/blogger.html" "Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)"

The first URL is the page that was hit. The second is the referring page. Browser information is included for each hit. I use Analog to analyze the log files every few months and one of their recommended tools to do the reverse DNS lookups quickly. (Analog will do them too, but slowly.) If you don't get many hits, you can just look through the raw files for what interests you.

Note that jptracker will not track hits on non-HTML pages (such as images or XML pages). You can run it on any server; I have it installed on Freeshell but it tracks hits on all my mirror sites as well. If you are using a redirector you may lose the referrer information, depending on how the redirector is configured. The hit itself will still be tracked. If a user's browser does not allow Javascript, the hit will still be tracked, but neither the page hit nor the referrer page will be recorded in the log. Here's an example of a non-javascript browser hit:

211.28.96.7 - - [17/Mar/2003:02:02:24 +0000] "GET HTTP/1.1" 200 - "" "Mozilla/3.01 (compatible;)"

Uniqueness of hits depends on the caching behavior of the individual browsers. As long as Javascript is on, you should get a new hit for every new page your visitor hits, but I'm not really sure what will happen on reloads or revisits of the same page. I haven't looked into that.

There are several parts to jptracker - the Perl script that writes the local log, the Javascript that gets the referring page information, the HTML that goes on each page you want to track, a transparent 1-pixel gif, and an optional Perl script for setting the magic cookie for people you don't want to track. Here are the files:

The file jptracker.cgi is the main Perl script. You should put it in a cgi-capable directory. Check the path to perl. Two lines of the file need to be edited: Replace /local/logfile/path/ with a full UNIX path to the directory where the script will write the log files (preferably not in your web directory if you have non-web space available). Also, set the URL path of the transparent gif, which can go anywhere in your web directory - that is, replace /urlpath/to/gifs/ with the URL minus the domain (in my case, without http://jemimap.freeshell.org), and minus the actual filename (clear.gif). Don't forget to grab the transparent gif, clear.gif, and put it in an appropriate web location.

If you need the cookie function, put jpsetcookie.cgi in the cgi directory. For convenience, I put the separate javascript file, jptracker.txt, in the same directory, but depending on your setup that may not work for you. I gave it a txt extension to avoid problems with free web servers, but you may find it clearer to rename the file to jptracker.js. You can call it anything and put it anywhere, as long as you adjust the HTML to match.

The HTML source is in jptrackerinsert.txt. You will need to change your.domain.here/yourcgidirectory/ to reflect the URL's you are using for jptracker.cgi and jptracker.txt. Once you've edited it to reflect your URL's, cut and paste this HTML into all the pages you want to track. I put it at the bottom of the page, right before the </body> tag. You can add the tracker to a blog by editing the blog template(s) and putting it somewhere near the bottom.

That's about it. If you have problems, feel free to email me.

Styleswitching JavaScript

The styleswitching script is complements of A List Apart. I use it with MovableType, but it could be set up for any web page that uses CSS stylesheets.

First, you need a set of stylesheets to switch between. For MovableType, I used a couple that I had already made for MT, plus the full set of seven from the MT website. Each of the stylesheets must be listed in the header of the pages (that is, at the top of each page template in MT - see the Technicolor instructions for the full list of templates), in the usual place for LINK tags, and must have a title element:

<link rel="stylesheet" href="<$MTBlogURL$>styles-site.css"
type="text/css" title="Default" />
<link rel="alternate stylesheet" href="<$MTBlogURL$>mtclean.css"
type="text/css" title="MT Clean" />
<link rel="alternate stylesheet" href="<$MTBlogURL$>mttrendy.css"
type="text/css" title="MT Trendy" />

If you're using Mozilla, you can already switch between these styles from the View menu. Otherwise, you'll need the javascript program to do the actual switching, styleswitcher.js. The javascript must be loaded by every page in the blog (or site) so it should be left in a separate file and loaded with a line in the header (near the LINK tags) thus:

<script type="text/javascript"
src="<$MTBlogURL$>styleswitcher.js"></script>

Next, you need the links that will run the program when clicked. As an added bonus, the javascript program includes a cookie to keep track of which style has been selected, and remembers it from page to page. All pages must include the javascript itself, and the LINK tags, but the switching links can be put on just the main page. These HTML links call the function setActiveStyleSheet, according to the title listed in the LINK tag:

<a href="#"
onclick="setActiveStyleSheet('Clean'); return false;">Clean</a>
<a href="#"
onclick="setActiveStyleSheet('Trendy'); return false;">Trendy</a>

I tried a few other things with this script; you can read about them in my blog under Moveable Style in the web category. There are three entries in a row and some later ones regarding the nature of persistent, alternate and titled stylesheets.

Installing Perl Scripts on Freeshell

Since people have asked, here's a little advice on installing Perl scripts, especially MovableType, on Freeshell. The main trouble is getting files over to Freeshell when you don't have ftp access and don't want to use zmodem. (Free accounts don't have ftp access.)

For something like MovableType, which is available on the web, you can use wget from the shell prompt on Freeshell, thus:

wget http://www.movabletype.org/url/to/download
I don't know the real url, but you should be able to get one if you fill out the MT registration form.

Another option is to use the Lynx text browser on Freeshell to fill out the form on the main MT download page:

lynx http://www.movabletype.org/download.shtml
and then it should let you do the download. This approach requires figuring out how to fill out forms in Lynx, which is pretty intuitive.

The other option is to email the gzipped file from your computer to your freeshell email account - that's what I used to do to upload new pages on my website before I got ftp access. You can save the attachment from pine to your main directory.

Once you have the MT files at freeshell you can follow the MT installation instructions to unzip it and install. You'll need a text editor to change the path to Perl, which on Freeshell is /usr/pkg/bin/perl, not the default that's in the files. (You'll need to do this for any perl script you upload to freeshell.) If you know vi or sed, you can use that to change the files, but I prefer Emacs. It's quick with a dired query-replace, but you can also edit the files individually. To save a file in emacs after you've edited it, use ctrl-x ctrl-s; to exit, use ctrl-x ctrl-c. Depending on your telnet terminal type, you may have to use the delete key instead of backspace in emacs. If it gets angry at you for using the backspace key, type ctrl-g (cancel).

I used the cgi-bin method of MT installation as explained in the directions, but I don't believe that's necessary on Freeshell - you can run scripts from any directory. You may have to write an .htaccess file in order to get cgi scripts to run in another directory, though - I don't know how that's configured for free accounts. If you need to know about .htaccess, you can read the Apache documentation, or just install all scripts in your cgi-bin directory.

Note that suwrap and cgiexec don't seem to be available on Freeshell. I'm not using the MySQL option, so I'm not sure whether that works.


Feedback: webmaster@jemimap.cjb.net | feedback form
Updates: jemimastrek-subscribe@yahoogroups.com
Link: http://jemimap.ficml.org/style/scripts.html | Top