Thursday, February 28, 2008

command line email in Cygwin

As mailx is not part of the Cygwin distribution, you don't have that many choices if you want to send an email from a shell script. In this regard, Jeremy Reed has kindly provided a nice substitute script that can help us out:

If you have Cygwin installed, you'll need to do the following things:
1) install ssmtp
2) configure ssmtp with ssmtp-config
3) install Jeremy's mailx shell programs

There are a couple of gotchas with step 2 above.
1) make sure you have the directory /etc/ssmtp created
- for some reason, the ssmtp-config program doesn't create it
2) make sure you define a fully qualified hostname
- if not, you'll get the following error
$ /usr/bin/mailx -s "test" < test.txt
3) make sure that you have a symbolic link created for /usr/sbin/sendmail that links to /usr/sbin/ssmtp and that /usr/sbin is in your PATH. Otherwise, you'll get this error:
$ -s "test" < test.txt

That's it.

I preferred to use Jeremy's program over nail, because it gives me the same arguments as mailx did.

Thanks Jeremy!

Tuesday, February 12, 2008

Site Overlay in Analytics is lame

We can only look a gift horse in the mouth so often. So when Google stumbles with a small feature in the free toolsets that they provide us, we shouldn't yell at them.

Case in point: the Site Overlay feature in Google Analytics.

Site Overlay *should* be very cool, giving us a visual representation of the traffic to our websites by overlaying the percentage of traffic directly on the page itself. For my site, it looks something like this:

Notice all those 0%'s? Unfortunately, Site Overlay only works with static pages. It chokes on dynamic content, CSS, javascript links, redirects and almost any recent technology used to power a website. Here is the company line from a rep I emailed regarding what Site Overlay can and cannot do:

Thank you for your email. I understand you are concerned about zero datain your Site Overlay reports. Please note that the site overlay report uses cURL to request a web page, and displays clicks on standard links that are embedded on that page. Its functionality is currently limited to static pages with unique links to content located elsewhere on the website.

The site overlay is not currently able to work with Javascript links, CSS content, Flash navigation, downloadable files, outbound links, frames, or automatic redirects.

In the above cases, it's common to see missing overlay bars, or bars with zero content. If there are multiple links on a page that all point to the same place, Analytics will total the clicks to on all those links and display the total number for each overlay bar on each of those common links.

If you have a filter that changes your Request URI, the Site Overlay report may display 0 in your report.

Oh well. If Google updates this feature to allow for the use of dynamic content, I'll let you know.

Saturday, February 09, 2008

understanding CSS using Firebug

Blogger templates are dense with Cascading Style Sheets and can pretty difficult to understand if you need to edit them. I didn't really understand them until I picked one apart using Firebug (, the developer's plugin to Firefox. I have to tell you, Firebug really kicks ass and makes understand the CSS of any HTML page very clear. Enjoy the video!

Wednesday, February 06, 2008

upgrading Cygwin: dos2unix

I recently converted from a very old version of Cygwin Beta 20 (circa 1999) to the latest 1.5.25-7 version of the Cygwin DLL. I noticed when I tried to execute some of my existing scripts that had executed under the old beta version, I now would receive a lot of these errors:
./ line 40: $'\r': command not found
./ line 5: syntax error near unexpected token `$'do\r''

Looks to me like the command interpreter on the new version of Cygwin is a lot more picky than the old one. Specifically, Cygwin is choking on the carriage returns that Windows XP Notepad inserts at the end of each line of the file. Yuk.

I wondered if this was something configurable with an environment variable (, so I first tried setting the CYGWIN environment variable to nobinmode ( Unfortunately, this change had no effect. I did find a bit of background here:

I had a bit more success using one of the nice little utilities Cygwin has called "dos2unix". Dos2Unix strips out any carriage return or line feed characters in text files and automatically saves the file. The command is simple:
dos2unix [filename]

where [filename] is the name of the file you wish to convert. Dos2Unix has no man page, so don't bother looking for it.

Unfortunately, I had quite a few scripts in various directories, so I just went through each directory and typed:
dos2unix *.sh

I could have written a script to interate through the directories, but there were only about fifteen, so I got lazy and just ran the command manually. After running the command, I was able to execute the scripts without error.


Saturday, February 02, 2008

tag cloud for Blogger blog labels

Phydeaux3 has posted some very easy-to-follow instructions on how to create a tag cloud for labels on your Blogger blog:

A tag cloud looks like this:

You can see a working implementation of a label cloud here:

The one thing that Phydeaux doesn't provide is an overview of the steps necessary in order to create the tag cloud. Here is the overview:
  1. Back up your blog template
  2. Add the label cloud stylesheet to your blog template (before the end skin tag)
  3. Add javascript variables for the cloud to your template before the end HEAD tag
  4. Replace the template code for your existing Label widget with the custom Label Cloud code
Finally, Phydeaux adds some troubleshooting tips as well as some hints for editing the label cloud text sizes and colors:

Nice job, Phydeaux!!

ps - If you're new to Blogger, I've posted a number of videos here that you may find useful:
Feel free to drop me a line or ask me a question.