Home

A List Apart survey E-mail
Friday, 22 January 2010 20:30
A List Apart 2009 survey

Tags: A List Apart  survey  promotion  
 
How to set a cookie using PHP or JavaScript E-mail
Friday, 22 January 2010 12:27

In my jQuery Woopra plugin, I have added the feature to exclude visits by cookies.  Since Woopra does not yet have the ability to set cookies itself like Google Analytics, you must set it yourself.  Thankfully it's pretty easy to do.  Below I will show you how to set a cookie to use with the jQuery Woopra plugin to exclude visits based on that cookie.

Place the following within <?php and ?> tags in a PHP file.

 
$value = 'true';
setcookie('woopraExclude', $value, time()+(365*24*60*60))
 

The code above sets a cookie with:

  1. name = woopraExclude
  2. value $value = 'true'
  3. expiration = current time plus one year

This is the method I use on my sites.  I've placed the code below in a plain HTML file that loads as the start page on all my browsers, ensuring that all my visits to my own domains don't count as visits in analytics.

To set a cookie with JavaScript, I recommend using the webtoolkit.cookies.js script that comes bundled with the jQuery Woopra plugin.  To set a cookie using that script, place the following within <script type="text/javascript"> and </script> tags:

 
var Cookie = new CookieHandler();
var excludeCookie = Cookie.setCookie('woopraExclude','true',365*24*60*60);
 

The code above sets a cookie with:

  1. name = woopraExclude
  2. value $value = 'true'
  3. expiration = current time plus one year

To make use of this cookie in your Woopra analytics code, you would initialize your Woopra tracking function as:

 
$.trackWoopra({cookie: 'woopraExclude'});
 



 
Speeding up your WordPress site with plugins E-mail
Thursday, 14 January 2010 20:00

It's somewhat ironic that at one end we're collecting more and more data, we're clammoring for more and more bandwidth and storage space and ways to access it.  Yet on the other hand we obsess over the kilobytes and even bytes we can shave off our webpages in order to have them load fractionally faster.  We minify, we GZip, we cache, we do all sorts of things...anyway, it's just an observation I thought was interesting.

I wrote earlier about ways to speed up your website.  Those were mainly .htaccess fixes.  If you use WordPress, however, a lot of the hard work is taken care of for you by some excellent plugins out there.  Here are a few I've tried, and my experience with them on WordPress 2.8.6:

 Autoptimize

Autoptimize is advertised as a do-it-all plugin for your WordPress site, and it works pretty well although I haven't tried all its features.

Observations and conflicts

  1. Optimization of JavaScript code broke Hackadelic Slider Notes on one of my pages.  Enabling the "Add try-catch wrapping?" option, however, fixed that issue.
  2. "Optimize CSS Code" breaks WP-Cufon
  3. I have enabled "Rewrite Image URLs" and changed the "Image Base URL" to use CoralCDN's nyud.net URL appendage, but I haven't noticed it working on the images on my WordPress site.
  4. I enabled "Rewrite JavaScript URLs" and "Rewrite CSS URLs" and they work fine.  (I'm using CoralCDN's nyud.net for these as well.)


 Free CDN

Free CDN lets you use Coral CDN to reroute several types of assets on your website, including CSS, JavaScript, images, and external content.

Observations and conflicts

  1. This plugin worked unreliably in my experience.  I tried to figure out which other plugin(s) it was conflicting with but couldn't narrow it down because it's most likely more than one.  When it was working, it screwed up CSS rendering and some JavaScript functionality.  It should be noted that this might not be the plugin's fault at all.  It has been noted elsewhere that CoralCDN is better for bigger assets (pictures, movies, MP3s) than smaller ones (images, CSS, and JavaScript files).  Using CoralCDN with Autoptimize works fine, so most likely the problem is with the plugin.
  2. It seems to conflict with one of either the Star Rating for Reviews or WP Movie Ratings plugins, or maybe both.  The Movies page on my blog shows up blank when this plugin is activated, and both of those plugins are used on only that page.


 JavaScript to Footer

JavaScript to Footer is a no-frills plugin that does just what the title says: It moves all your JavaScript to the footer of the page for faster loading.

Observations and conflicts

  1. Works as advertised.  There is nothing to configure, just turn it on and go.
  2. It breaks WP-Cufon, which makes me wish it let you configure which files it moves and which ones it leaves alone.

 GZIP Output

Another simple plugin with nothing to configure, GZIP Output does just what it says: It Gzips the HTML content of your WordPress site before sending it out.

Observations and conflicts

  1. I didn't find this plugin conflicting with any other plugins.  However, I think going the .htaccess route is a more efficient way than using a plugin for Gzipping your HTML content.

 Parallel Load

Parallel Load loads all your JavaScript files in parallel, with the additional option to move them to the footer of your webpage.

Observations and conflicts

  1. jQuery fails to load with this plugin enabled, so it won't work for me.

 My CDN

By the author of Parallel Load, My CDN rewrites your URLs to use a CDN.  You can specify different URL for CSS, JavaScript, and theme files.

Observations and conflicts

  1. Rewriting the URLs to use CoralCDN's nyud.net breaks the loading of CSS files, similar to Free CDN.  Again, since CoralCDN works fine with Autoptimize, the problem is most likely with the URL rewriting method used in the plugin (I am just speculating because I haven't looked inside the plugin code).
  2. The good news is that this plugin does not break the site altogether like FreeCDN does.  It's a much smaller plugin with fewer features, which means fewer chances for conflicts with other plugins.

Please remember that these are just my experiences with these plugins.  Yours might be different, depending on the version of WordPress and other plugins you're running.



 
Useful websites and tools - 12/29 E-mail
Tuesday, 29 December 2009 14:53

General

  • Anybodyoutthere.com - came across this really unique site through MakeUseOf.com yesterday.  It's got an AJAX-ed interface that lets you chat with strangers without downloading anything or even registering.  I tried it out by chatting with a couple of people and it worked well.  It even lets you chat with multiple people simultaneously from the same browser window, and lets you register and create a profile while chatting.  It's AJAX in full form.

Books

  • Learning Flex 3 book

I chose this book because it was well-rated on Amazon.  Overall it's a great introduction to Flex.  I found a lot of typos and code errors in it, but they were pretty easy to spot.  I might have had an early copy since it was from the library, and they might have corrected it since then.



 
WordPress plugin: Flash Header Rotator E-mail
Sunday, 20 December 2009 17:36

Flash Header Rotator is an extension of the Header Image Rotator plugin by Matthew Hough that allows embedding of Flash SWF files along with the image files the original plugin allows.  Please see the original plugin's site for documentation on its features.  Below I will only be outlining the extended Flash features I have added to it.

Features

  • Ease of use: Simply upload your swf files to the wp-content/header-images folder and they will be rotated along with any image files in there
  • SWFObject: The plugin uses SWFObject to allow for a more robust embedding.  It detects if SWFObject is already loaded from another plugin.  If not, it loads it for you.
  • It automatically detects the dimensions of the Flash movie, but also allows you to override them manually.
  • You can specify from the WordPress Administration panel the minimum version of Flash you want your site's viewers to have for the Flash movies to display.

Usage

All you need to do is activate the plugin and upload your files for the plugin to work.

  • If you would like to override the default dimensions, rename the movie file as:

filename_width_height.swf

So if you have a file named kiki.swf and you want to show it at 700x200, rename it kiki_700_200.swf.

In the WordPress Administration panel, under Settings > Flash Header Rotator, you can set the following options:

  1. The minimum Flash version required for your Flash movies to display.
  2. The CSS you want to apply to the <div id="flash-_-header"></div> that wraps the Flash movie.
  3. The plugin uses the wmode: 'transparent' parameter to render the background of Flash movies transparent.  Since most headers contain navigation links, this setting is on by default.  This setting can be turned off on the plugin settings page.
  4. The plugin lets you specify whether you want SWFObject to publish your movie statically or dynamically.  The default setting is static.  See the official documentation here for more details.

Download

Download Flash Header Rotator WordPress plugin



 
Useful websites and tools - 12/16 E-mail
Wednesday, 16 December 2009 15:26

Web

  • Adobe Flex and ColdFusion - Adobe is nice enough to give away these applications for free to students as well as unemployed designers and developers.


 
Useful websites and tools - 12/15 E-mail
Tuesday, 15 December 2009 17:01

Web

  • ChangeDetection.com - simple easy-to-use website that sends you an e-mail alert when a webpage you specify changes.  You can specify several options, like words to look for in the change that occurs.
  • Mon.itor.us - site monitoring service with a very slick AJAX interface.  They can send you an e-mail if and when your site goes down and when it comes back up.
  • Yahoo! PIPES - cool service from Yahoo! (also with a very slick user interface) that allows you to manipulate data from various sources in various ways.  One simple PIPE I created in a matter of minutes was to filter out entries from an RSS feed containing certain words.  It was as simple as:
Yahoo! PIPES

 
«StartPrev12345678910NextEnd»

Page 8 of 18