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.

Thursday, July 28, 2005

Package Documentation for org.apache.commons.beanutils Package

Package Documentation for org.apache.commons.beanutils Package

Beware using the struts package.. several quirks of the system are not widely documented... Just ran into an issue on a project trying to put values into a bean backed with a map... easy enough? Except our keys used an index that we need to put values into xpath...

For example, we have stuff like this: property="value(document/s25[1]/conditiontext)"

Unfortuantely, looking at the BeanUtils setProperty code:

// Invoke the setter method
try {
if (index >= 0) {
PropertyUtils.setIndexedProperty(target, propName,
index, newValue);
} else if (key != null) {
PropertyUtils.setMappedProperty(target, propName,
key, newValue);
} else {
PropertyUtils.setProperty(target, propName, newValue);
} catch (NoSuchMethodException e) {
throw new InvocationTargetException
(e, "Cannot set " + propName);

You can clearly see that if a property has an index (which is a property with square braces in it) then it uses setIndexedProperty.

So if you want to use setMappedProperty and your property key has square braces... well you'd better think again.

Friday, July 08, 2005

a l p h a f o o b a r :: Yahoo!

a l p h a f o o b a r :: Yahoo!

Long time no speak... Google toolbar for firefox and with it blogger is mine again (IE won me back from firefox 0.7 with the google toolbar... but Firefox got me back with 0.8).