blog:

The Mixed Messages of swfobject

swfobject must be one of the most useful javascript files ever created. I could explain why I feel this way, but going over the brief history of flash embedding is too painful to relive. If you don't know what swfobject is, check it out here here. It will save your life.

There's one thing that has always bugged me about swfobject - the alternate content. In every implementation of swfobject I've ever seen, there's always a friendly message for the users to upgrade their flash player as a fallback in case the javascript detects that the users don't have the correct flash version.

At first glance, this seems like a great idea. Here's the problem, though: with the way this is always implemented, if javascript breaks or is disabled, the users are told to upgrade flash. In other words, if the javascript doesn't run, the user is told the problem lies with their flash player rather than javascript. At this point, you've just given the user a completely false error message. Imagine the pleasure of leaving the site to upgrade your flash player to either find out you already have the latest version, or return to the site to find that it's still telling you to upgrade. This is a major oversight in the standard implementation of swfobject.

Fortunately, there's an incredibly easy way around this. In fact, it's so simple, there's no reason not to do it - I'll show you how...

Continue reading →

Tags: ,

Function Arguments: You Only Need One

For me, the usefulness of abstracting a function in javascript always had a threshold at the number of arguments it needed to work. Imagine calling this function, for example:


function myFunction(title, height, width, color, border, offsetX, offsetY) {
//do stuff
};

Now try remembering what all of the arguments are (without looking). I must admit, I've written more than a few crappy functions like this.

There is a better way: use a configuration object as an argument. Javascript has supported this for quite a while, and all of the major javascript libraries seem to take advantage of it; It's not a new idea, just a really good one.

Continue reading →

Tags:

We Have Evidence that Iran Has Gained Access to the Clone Stamp Tool

clone stamps
A fine contribution from BoingBoing.

Progressively Enhanced Graphs with canvas

Looking toward the future of client-side web development, the fate of elements like SVG (Scalable Vector Graphics) and canvas (a new html element) are uncertain. As usual, a major factor is the lack of support from Internet Explorer (6, 7, and even IE8).

Unfortunately, these powerful tools for authoring graphics on web pages have other strikes against them; between Apple's intellectual property claims and the so-called "glacial pace" of the standardization bodies like the W3C and WHATWG, most developers are weary of using them (and rightly so!).

I do feel, however, that canvas and SVG have so much potential that they deserve a closer look anyway. canvas in particular should get the spotlight here for one important reason: You can make it work. Thanks to the clever folks at explorercanvas, it's actually possible to use the canvas element while maintaining support for all major browsers!

If you aren't already familiar with canvas, it basically leverages the ability of the browser to translate code into painted pixels on the screen, and it provides an API in the form of JavaScript.
This gives us a lot of options... I will go over just one application of many in this article

Using Tabular Data and canvas to Draw a Graph

It seems like the sky is the limit when it comes to what can be done with canvas. As for right now, I've decided to focus on a simple, yet incredibly powerful use of the element: visually representing data.

Continue reading →

Tags: , , ,

Firebug for Firefox 3

For those of you fortunate enough to upgrade to Firefox 3, you've also been unfortunate enough to loose firebug (bummer). Here is the version that works with FF3 RC2 and apparently RC3:

http://justtalkaboutweb.com/downloads/firebug_1.2.0a30X.xpi

Open with Firefox, install, and enjoy (hopefully this link will stay alive as the download day frenzy continues).

Tags:

Can A Pop-up Be Beautiful?

When people think of pop-up windows, users and developers alike may cringe a little. Making a link open a new window is one of the most simple things you can do with javascript & HTML, yet there are so many ways to get it wrong. I think though, when you get it right, it really is what I would call beautiful code.

Continue reading →

Tags: ,

Disable Smart Quotes in WordPress 2.5

Anyone who wants to blog about code on WordPress will have some trouble with the text formatting functions that convert regular quotes into curly 'smart quotes'. Typographically speaking, it's beautiful, but you just can't have those diacritical characters hanging around in code examples.

WordPress versions earlier than 2.3 had a convenient place you could comment this out in the php, but version 2.5 was a bit more of a challenge. After much searching, I figured out how to do it...

Continue reading →

Tags: ,

500null Has That New Website Smell

So here it is. I now have everything I need to easily publish whatever is on my mind and organize it with a real content management system (WordPress makes and amazingly easy and powerful CMS). I hope to be very active here in the next few months as I finally have a place to share tutorials, code, presentations, and ideas about web development. As you can see, I already posted a presentation - there is more to come.

Also, I think I'll do some random blogging for the first time ever. This should be fun...

Tags:

Presentation: "Using IE Root"

All browsers have their bugs, but Internet Explorer takes the cake. Fortunately, we web designers have quite a few tools to work around this. Hacks, conditional comments, version targeting, and more; but none of them are perfect.
I was lucky enough to find a wonderful alternative that seems to work for any project, big or small. I first read about this technique at
Position is Everything about 6 months ago, and I’ve been using it ever since. This presentation breaks the technique down and hopefully persuades more developers to start using it so we can fix less and build more!

Check the presentations page for full details or just view the slides. The code example is after the jump...

Continue reading →

Tags: , , , , ,