Javascript Triangles (and real-time 3d)

October 18th, 2006

Update: Now works in IE6 thanks to a hack. Just look for the <!–[if lt IE 7]> conditional comment in the source code for details

For some reason, I decided that I want to draw triangles in a browser… without Flash, the canvas tag, or Java applets. I also wanted it to be as fast as possible, so that rules out the obvious method of creating a thin DIV for every horizontal scanline of the triangle (too many DIVs). After 2 evenings of work, I present this proof of concept.

If you like it, please digg it!

Updated $class Library Released

October 14th, 2006

I’ve finally released an updated version of the $class library. Includes many optimizations and refinements to make it even easier to develop complex object-oriented javascript. My next step will be to work on commenting the code and creating better documentation and examples.

Javascript’s null Value Has an Identity Crisis

June 12th, 2006

I came across another identity crisis in Javascript while working on my $class library. This time, it is the null value that needs help. Observe the output of the following expressions:


This time, all browsers agree: null is an “object”, but not an instance of Object. What does it mean? The way I see it, you can not use null as an Object, so it should have no relation to Object at all. You cannot access or create properties on null, you cannot evaluate null.toString(), etc.

My solution in the $class library library is similar to what I’ve done for undefined. I created a dummy class called Null and put a special case in the $class.instanceOf and $class.getClass methods to consider the null value to be an instance of Null and nothing else.

Spam Comments

June 7th, 2006

I got flooded with over 50 spam comments last night ranging from random phrases that mean nothing to a short pornographic story involving a 17 year old boy and his dog. Until I get some time to work on preventing automated comment submissions, I have changed my settings to allow only registered users to post comments.

Java-like Object-Oriented Code in Javascript

June 2nd, 2006

[extremely edited - I originally had a very detailed post here about a javascript library I just released. I realized that that amount of detail deserves a more static page than a blog entry, so I moved the details out of this post (to a page created through the blog software because I’m lazy :) )]

Javascript is a very loosely-typed and dynamic language. Variables can be of any type, function parameters can be of any type, and properties of objects can be added and removed at runtime. This can be very useful in many situations, but it can also create some pretty nasty messes that are a nightmare to maintain. Sometimes more rigid structuring is needed.

There are several techniques and libraries available for creating object-oriented Javascript that support inheritance, but they usually involve some difficult-to-read syntax and fail to provide other object-oriented features like abstract methods and interfaces. My goal is to create a Javascript library that provides many of these features and eases the pain of developing complex javascript solutions. My first step towards that goal is the initial release of The $class Library (as of this posting, I’ve actually made one change since the initial version in response to the first comment).

The $class Library will be improving as I receive feedback. Check it out and tell me how it could be better (I already know the file could be smaller; I’ll work on that soon).

Javascript’s RegExp Has an Identity Crisis

June 2nd, 2006

I came across something strange while working on a javascript library for defining classes, creating inheritance relationships and testing inheritance relationships. Click the buttons and observe the output:


So is a RegExp a function or not? In the Firefox browser, typeof says yes. In all browsers, instanceof says no. Common sense says RegExp can be called like a function, so it should be considered an instance of both Function and RegExp (I would think RegExp should inherit Function). I plan on addressing this issue in my library (which still needs a catchy name so I can stop calling it “a javascript library for defining classes, creating inheritance relationships and testing inheritance relationships”).

Well, there it is…

March 12th, 2006

…my blog.


  • order viagra no prescription required
  • purchase synthroid
  • levitra without a prescription
  • propecia online cheap
  • buy cheap accutane online
  • viagra no rx required
  • cialis cheapest price
  • zithromax prices
  • zithromax without prescription
  • viagra purchase
  • lasix
  • order cheap cialis online
  • lowest price lasix
  • where to buy cialis
  • propecia prescription
  • cheap cialis from usa
  • cheap generic synthroid
  • cheap synthroid online
  • discount accutane
  • buy cialis no prescription required
  • cheapest synthroid
  • soma cheap
  • buy cheapest viagra online
  • buy viagra lowest price
  • cheap cialis no rx
  • buy viagra
  • cialis no rx
  • buy cheapest cialis on line
  • levitra prescription
  • cheapest generic viagra
  • viagra without prescription
  • cialis pharmacy online
  • discount clomid
  • online zithromax
  • viagra overnight delivery
  • buy viagra online cheap
  • soma no prescription
  • cheapest soma
  • purchase propecia online
  • cheap soma
  • buy generic synthroid
  • viagra buy drug
  • order viagra in us
  • buy viagra generic
  • cheap accutane
  • zithromax generic
  • levitra online cheap
  • viagra no rx
  • buy zithromax without prescription
  • discount zithromax
  • buy viagra no prescription required
  • order viagra without prescription
  • synthroid
  • buy cialis internet
  • online synthroid
  • propecia without prescription
  • cheap cialis no prescription
  • accutane prescription
  • propecia no prescription
  • price of levitra
  • levitra no prescription
  • cheap acomplia
  • order discount cialis online
  • buy generic accutane
  • buy generic levitra
  • buy viagra overnight delivery
  • synthroid without a prescription
  • clomid
  • propecia cheap
  • fda approved cialis
  • cialis sales
  • order soma online
  • zithromax cheap
  • online soma