Archive for the ‘Web Development’ Category

Optional parameters and named parameters in C# 4.0

One little quirk of C#, which has pretty much become a defining characteristic of the language, is the default parameters system, or lack thereof.

If you want to have a default set of arguments for a function or constructor then you have to create several overloaded versions of the function for each possible set of parameter that you want to be able to accept.

This will no longer be the case in C# 4.0 with the addition of optional parameters and named parameters features. This is one little change I am really looking forward to in a big way.

Read more…

Reset cascading style sheets are bad practice

Firebug Reset CSS

We’ve all seen them, most of us have used them, almost every CSS framework is built on one and you instantly know one is present when you open Firebug and see a hundred levels of CSS inheritance declarations. Reset cascading style sheets (a.k.a. reset.css).

The idea of the reset style sheet is to globally target every markup element and set all of its possible attributes to zero, default or inherit. This gives the developer a “clean slate” with no browser default styles. Many say that this is the first thing you should add when you start building a web page, but I firmly disagree.

I’m sure that I am one of the small minority of web developers who’s saying this, but reset style sheets are bad practice, and it’s time to stop using them.

Read more…

EXSLT set:distinct in MSXML for Internet Explorer

JScript Screenshot

I’ve recently talked about how XSLT is pretty good as a presentation layer for web applications. XSLT is a powerful template language by itself but it is woefully missing several functions and interfaces which you will eventually find absolutely necessary for some purposes. EXSLT is the solution. EXSLT is a collection of extensions for the XSLT. It has numerous functions and features that XSLT is missing.

EXSLT functions are widely used and extensively tested. Not only is it available for every server-side XSLT engine, but it is also available in Mozilla Firefox, Safari, Chrome and Opera.

Unfortunately, as usual Internet Explorer throws a wrench in the whole works. Microsoft in their infinite wisdom decided not to implement the EXSLT functions and specs in their browser. Instead they implemented their own MSXSL extensions, which are frankly terrible. It doesn’t have anywhere near as much functionality as EXSLT and will never work with anything other than Internet Explorer.

The most common (and difficult to replicate) EXSLT function that I use is set:distinct. It is an extremely powerful function that lets you grab a distinct list of nodes, attributes, or values without impacting your current context in the style sheet.

This function is not available in any form in MSXML, so I decided to build it.

Read more…

AddThis: friendly widget and brilliant viral tracking scheme

AddThis Logo

I was once a huge fan of the AddThis social bookmarking widget, it’s a simple device for adding the social network buttons that everyone expects to see on every page on the internet (now-a-days). It has excellent browser support and is very simple to implement, modify and configure. As far as social bookmarking widgets go, it is probably the best.

However, in the latter half of 2008 AddThis was acquired by Clearspring, an online media company. They were able to see the value in having a glorified tracking bug on hundreds of thousands of sites across the internet. It’s grown to such an extent that Clearspring now sees what half of the internet is doing.

I’m no tinfoil hat paranoid, but I was a bit surprised at the scale and power of this system. Personally I congratulate them on their wild success. It was a brilliant idea and has become an internet phenomenon. However, I have no interest in giving Clearspring information on my visitors (for free).

So lets reduce it’s tracking ability with a couple lines of JavaScript.

Read more…

Poor man’s code repository and versioning with Dropbox

Dropbox Logo

By now just about everyone knows about Dropbox, the simple file syncing/sharing and online backup solution. The software is available for several operating systems and is very fast and intuitive. It even has a good online interface so you can access your dropbox from anywhere.

But did you think about using it as a poor man’s CVS? It’s actually a really good solution for personal projects, or for a small group of people working on a project. I have fallen in love with the service for several reasons.

Read more…