Search this blog for:

Friday, August 26, 2005

Joel on Software

Joel on software

I'm pretty sure that the LZW algorithm was originally credited to Ziv and Welch... Or am I wrong?

Tuesday, August 09, 2005

JavaScript FAQ

JavaScript FAQ

Interesting website on JavaScript. Unfortunately a little deprecated... I'm going to proceed to make some notes on several of its examples and pages....

The Kitchen Geek: Hacking burgers

The Kitchen Geek: Hacking burgers

"So, ostensibly, one of the aims of this blog is to talk about how food is hackable. The burger is certainly one of the most hackable foods."

How interesting...

Monday, August 08, 2005

JavaScript Coding Standards - Window Event Chains

JavaScript Window Event Overrides
Often developers come across a problem where they require functionality to occur on window resize, load, or close. Sometimes (in larger projects) the developers do not have access to the body tag or the head of the html document. In these situations, the developer may attach a function to the window.onload (or other) property.

However, when this is done, the previous funcitonality is lost. A better solution is to cache the old functionality.

For example:

function setWindowEvents(){
var oldResize = window.onresize;

window.onresize = function(){
if(oldResize) oldResize();
// new functionality here

This implements a chaining of functionality that can be reused several times in html document, without losing, or disabling hierarchial functionality. The order of the above code is important. It is possible to pass the function that we wish to be run, to the function.

The variable oldResize is not global (nor do we want it to be - this would detriment the repeatability of this code). The variable oldResize is visible in the scope of the outer function.

JavaScript Coding Standards - Introduction

JavaScript is a prototype based object oriented programming language. In that all entities in JavaScript are actually prototypes, and instances of these entities may be created at the whim of the developer or user. The language itself follows the syntax of its namesake, belonging largely to the genre dominated by C. It even shares many of the keywords belonging to these languages, though some of these are not used; int is an example of this interesting stance.

JavaScript is supported differently by several different web browsers to varying levels of compliance with widely accepted standards. This often leads developers to create significantly different styles of similar scripts for different browsers. The wide range and degree of JavaScript support in web browsers, in conjuction with the variety of functionality caused by different standards modes in web browser and the variety of functionality that the language itself allows, has led to a huge degree of methods to approach different problems with JavaScript.

It is my intention to create a JavaScript style guideline that can be used by developers to approach typical JavaScript problems in consistent manner.