Communicate with certainty
and your Voice will be heard.

Category Archives: code


Adhesive 3.4.0 has been released! This latest version of the WordPress "sticky" post plugin is compatible with WordPress 2.6.5 and no longer breaks WordPress's native paging functionality.

Jeffrey Barke is senior developer and information architect at theMechanism, a multimedia firm with offices in New York, London and Durban, South Africa.

After benefiting from the site multiple times, I decided to start contributing to DZone Snippets, a source for useful source code snippets. There's not much there yet, but you can follow my snippets at http://snippets.dzone.com/user/jeffreybarke.

Also Webmonkey.com is having a re-launch party next Wednesday, 11 June, from 6 pm through 8 pm at Sweet & Vicious in Manhattan. There will be music, beverages and good cheer, and theMechanism will be attending.

Jeffrey Barke is senior developer and information architect at theMechanism, a multimedia firm with offices in New York, London and Durban, South Africa.

As I was perusing the glorious mess of code, bits and other fanciful nonsense we refer to as the “web”, I came upon some delightfully useless .js files and could think of no other purpose for it than to share them with the small, yet potent & planetary contingency that is our Readership…

Behold, disbelievers! A tutorial that allows you to change the favicon in your browser (on Opera and Firefox only) via a tickling of your keys…Have a peek.

Michael Mahemoff, a wildly talented London-based software & usability dude, as well as the author of Ajax Design Patterns, presumably came up with these scripts, so don’t for a second think that we’re slagging the cat. You will find it a worthwhile expedition to dig around his site.

But seriously, if you can think of a real world application of the mighty Favicon Demo, please let us know. Or perhaps, sometimes you just have to do stuff because you can, and ask the questions later…

theMechanism is excited to launch our newest podcast series: barKode.

While our other podcast, theMechcast focuses on group discussions, barKode (partially named after the last name of our Senior Developer in New York, Jeffrey Barke [note the wry use of his last name barKe in the title]) will be focused on educational web design and standards-based talks, including those delivered at the The New York Web Standards Meetup Group. The first episode of barKode is called, “Web Mapping Part One–Google Maps Tutorial” where Jeffrey Barke, Senior Developer at theMechanism, leads a two-part discussion on web mapping in general and Google Maps in particular. Part Two will be on February 21st at 6:30 at the New York Creative Bunker.

You can subscribe and enjoy future episodes of barKode at feedburner.

For the past three years, 24 ways has been the Advent calendar of choice for web developers. This year started off with an excellent article and script by Drew McLellan dealing with PNGs in IE5.5 and 6.

If you work with PNGs or plan to, this is a very concise and informative article. It quickly describes how PNG transparency works, outlines the problem with IE 6 and below, provides a solution, and details the limitations of this solution. I really can't recommend it enough.

SuperSleight

As if this information wasn't enough, Drew then introduces SuperSleight, a JavaScript that automates support for PNG transparency in IE5.5 and 6. Based on sleight by Aaron Boodman and bgsleight by Drew McLellan, "SuperSleight adds a number of new and useful features that have come from the day-to-day needs of working with PNGs:"

  • Works with both inline and background images, replacing the need for both sleight and bgsleight.
  • Will automatically apply position: relative to links and form fields if they don't already have position set. (Can be disabled.)
  • Can be run on the entire document or just a selected part where you know the PNGs are. This is better for performance.
  • Detects background images set to no-repeat and sets the scaleMode to crop rather than scale.
  • Can be re-applied by any other JavaScript in the page—useful if new content has been loaded by an Ajax request.

Since we use PNGs quite a bit at theMechanism, SuperSleight was of great interest to us, particularly in the London office. When I looked at the code, however, there was one thing I didn't like—to change two of SuperSleight's properties required changing values hard-coded in the object. To change the third required a separate call to the limitTo method.

Enter theMechanism

To make SuperSleight easier to implement for my colleagues in London, I added three parameters to the init and run methods of the supersleight object. Our version of SuperSleight (which I'm calling 1.1.0) is available here and partial instructions on how to use it are below. The primary documentation on SuperSleight is still Drew's 24 Ways article. You can see SuperSleight 1.1.0 in action here.

How to Use

  1. Download SuperSleight and unzip. Upload supersleight.js and x.gif to your webserver.
  2. Add the following code to the <head> element of any page that contains PNGs:

<!--[if lte IE 6]>
<script type="text/javascript" src="path/to/supersleight.js"></script>
<![endif]-->

That's it! By default, SuperSleight will run on page load, look for a transparent GIF named x in the same directory as supersleight.js, apply relative positioning to anchor and input elements, and process every PNG on the page. To change any of these default behaviors, open supersleight.js and edit or remove line 17:

supersleight.init();

The init method of the supersleight object takes three optional parameters:

  1. String path to the transparent gif file. Note this path is relative to the actual document, not the JavaScript document.
  2. Boolean value to apply relative positioning to anchor and input elements. Pass false to leave the elements as they are.
  3. String ID of an element to limit SuperSleight's operations to.

To see these parameters in operation, plese view our SuperSleight demo in IE 6 or less.

To call SuperSleight from a script, use the run method of the supersleight object. This method takes the same three optional parameters as the init method.

Download SuperSleight 1.1.0
View SuperSleight Demo

Adhesive is a WordPress plugin that allows one to easily mark certain posts as "sticky." Sticky posts always appear at the top of the page when WordPress displays several posts, but if more than one post is sticky, the post with the latest post time will appear topmost.

Adhesive was originally written by Owen Winkler and available at http://www.redalt.com/downloads/. Unfortunately, it is no longer available, and the last version by Owen doesn't play well with WordPress 2.1. So I fixed it and am making Adhesive available here.

Installation/Usage

Simply follow the download link below, unzip the download and drop it into your WordPress plugins directory. Then activate Adhesive via the plugin administration panel.

To make a post sticky, edit it and either check the "Sticky" checkbox located in the right column below "Keep this post private" or in "Custom Fields" add key sticky with a value of 1.

Please note that if you deactivate Adhesive, all posts marked sticky will revert back to regular status. To upgrade this plugin and preserve posts' sticky status, just overwrite the old Adhesive files with the new ones.

Download Adhesive

Adhesive 3.4.0 for WordPress 2.6.5. Last updated 29 November 2008. Release notes.

Adhesive has been tested under WordPress 2.6.5 in Firefox 3.0.4, Google Chrome 0.4.154.25, Internet Explorer 7, Opera 9.62 and Safari 3.2.1 running on Windows Vista. If something isn't working right, please leave a comment.

Jeffrey Barke is senior developer and information architect at theMechanism – New York, a multimedia firm with offices in New York, London and Durban, South Africa.