Creating Image Preview Tooltips with the YUI Overlay Widget

The Yahoo UI Library provides a nifty helper for creating tooltips. I started playing around with it when I wanted to add the same tooltip to a large number of elements on a page. What got me interested in this implementation, is the ability to use the same tooltip on a number of elements, rather than having each element have it’s own tooltip div, or implementation.

The tooltip library creates a div element for each tooltip when the document loads. I wanted to use the tooltip to display a larger version of an image when a user hovered their mouse over a thumbnail. I did not however want to load all the full sized images when the page loads.

I decided the best way to handle this task was to implement my own tooltip function and create my own panel. Continue reading

Posted in Programming | Tagged , , , , , | 21 Comments

Can Google’s Adsense bot understand gzipped html pages?

During my experiments with WP-Super-cache, I noticed a strange thing happen to my Adsense ads. A short while after getting gzip compression to work properly, all my ad content had foreign characters and strange seemingly unrelated content.

Having changed nothing on my blog except for installing WP-super-cache, I decided to add an additional check to my .htaccess. Here is a modified snippet that disallows Google’s Adsense bot from receiving the gzipped page:

RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
RewriteCond %{HTTP_USER_AGENT} !Google*
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.ht ml.gz -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz [L]

Notice the new line that says the User Agent can’t have Google in it’s description.

Sure enough, ads are back to normal. I’m not sure how exactly Google’s crawlers handle gzip compressed pages. They are sending an “Accept-Encoding” header that includes gzip or the page wouldn’t be served to them in the first place. Judging from the change in my Ads however, I’d suspect that the bot isn’t uncompressing the received file.

Posted in Web | Tagged , , , , , | 5 Comments

Configuring Apple Mail 3.0 (Leopard) to use Imap with Gmail

I recently purchased my first iMac. I’ve been having all kinds of fun learning about OS X features as well as playing with the newly certified Unix system (Darwin) that powers the operating system.

Anyhow, I’ve been pleasantly surprised at the level of integration that I was able to achieve with Apple Mail and Gmail with Gmail’s Imap forwarding. With Imap, Gmail exposes folders with the names of the labels you’ve created. You can customize Apple Mail to use the same folders as Gmail for Sent Messages, Drafts, and Spam. Continue reading

Posted in Software | Tagged , , , , | 6 Comments

Gentoo and the Next ATI Drivers (Catalyist 7.11)

As of a couple days ago, ATI released their next drivers for Linux. The drivers were previously announced to be versioned 8.43.x but ATI has converted to a new numbering system that follows the popular YEAR.MONTH notation. The 7.11 drivers therefore accurately represent their release date in November, 2007 and are what would have been 8.43.x.

Anyway, there isn’t a Gentoo ebuild for these drivers and there may never be one. When I checked, there wasn’t even a bug filed to have one created. The 8.42.3 drivers eventually made it into portage as a masked package (~x86) with the consensus that they will never be marked stable. The 7.11 drivers will probably not even make it that far since the list of changes is rather minimal and nobody has posted any benefit to upgrading to them. You can read the Gentoo forum on the subject for more details if you like.

Anyway, it looks like we’ll be waiting for 8.1, or whatever the next release date happens to be, to find out if we finally get a faster AIGLX implementation for X.org.

Update: Well, I guess I called that one wrong. This morning my portage update contained an ebuild for ati-driver 8.433, which is the 7.11 driver I talked about in the article. I still don’t think there is much benefit to upgrading though.

Posted in Software | Tagged , , , , , | Comments Off on Gentoo and the Next ATI Drivers (Catalyist 7.11)

A Few Latex Tips

I’ve been finishing up the final formatting for my thesis this last week at Utah State University. Latex is great when you are provided a style file beforehand. If you have to modify or create your own style however, beware. That is a more time consuming process. I haven’t yet switched back to a traditional word processor (heaven forbid) but I have had a few mornings of pulling hair.

I thought I’d add a few of the things I discovered here: Continue reading

Posted in Miscellaneous | Tagged , , , , | 2 Comments

Implementing the Apriori Data Mining Algorithm with JavaScript

I’ve been working on my thesis for a little too long. I’m hopefully about finished, but that is beside the point. Part of what I’ve been working on revolves around the Apriori Data Mining algorithm. If you know what Apriori is, and you are looking for how to implement it, then this post is for you.

I’ve created a JavaScript implementation of Apriori. Admittedly, JavaScript isn’t probably the most efficient programming language to implement Apriori with; however, I was constrained to use it for my project [1]. There have been many improvements to the Apriori Algorithm since Agrawal suggested it in 1993. I chose to instead create a simple implementation of the original algorithm. First, learn how the algorithm works; second, learn how to optimize it.

Continue reading

Posted in Programming | Tagged , , , | 34 Comments