APE – Actionscript Physics Engine

August 31, 2008 § 1 Comment

APE is open source 2D physics engine for Flash or Flex. Written by Alex Cove.

Demo:

Crab demo 

Resources:

Prototype Window Class, JS library for creating DHTML window

September 10, 2007 § 2 Comments

Prototype Window Class is free (as in beer) and easy to use library for creating DHTML window.

It is based on prototype.js and doesn’t really require Scriptaculous.

Resources:

Gotapi.com: Finding documentation has never been so easy

September 2, 2007 § Leave a comment

For readers and all fellow developers: Finding documentation has become less of a pain. Thanks to Gotapi.

Currently they have:

  • HTML/CSS/Javascript. Too bad they don’t have MSDN Javascript.
  • Javascript UI libraries.
  • XML
  • C/C++ libraries.
  • PHP
  • Ruby on Rails
  • Python (Reading from blog.gotapi, Python is 1 of the first documentation)
  • Perl
  • Erlang
  • MySQL
  • and much more…

I highly recommend readers to go check Gotapi. RTFM has just gotten easier.

References:

Javascript callback

August 17, 2007 § 3 Comments

What is it?

Callback is an executable code that is passed to other functions as parameter.

Why is it useful?

When doing AJAX stuff it is impossible not to have callbacks. Callbacks are needed because Javascript in a browser is single threaded. Therefore order of execution could be achieved by chaining callbacks.

Reference:

Definition [Wikipedia]

Javascript: substr() v.s. substring()

July 12, 2007 § 16 Comments

substr() method extracts a specified number of characters in a string, from a start index.

Syntax: string.substr(start, length);

substring() method extracts the chars in a string between two specified indexes.

Syntax: string.substring(start, stop);

Quick Notes aout Substr:

  • If start is negative, Internet Explorer returns the whole string. That’s wrong! IE should use the last character in the string.

Quick Notes about Substring:

  • If start equals stop, it returns an empty string.
  • If stop is omitted, it extracts characters to the end of the string.
  • If either argument is less than 0 or is NaN, it is treated as if it were 0.
  • If either argument is greater than string’s length, either argument will use string’s length.
  • If start > stop, then substring will swap those 2 arguments.

UPDATE (Added Slice upon request)

slice() works like substring() with a few different behaviors.

Syntax: string.slice(start, stop);

Quick Notes about Slice:

  • If stop is omitted, slice extracted chars to the end of the string, exactly like substring().
  • If start > stop, slice() will NOT swap the 2 arguments.
  • If start is negative, slice() will set char from the end of string, exactly like substr() in Firefox. This behavior is observed in both Firefox and IE.
  • If stop is negative, slice() will set stop to: (string.length – 1) – stop (original value).

References:

« Read the rest of this entry »

Javascript: == OR ===

July 10, 2007 § Leave a comment

As it is similar to almost many other languages,

== checks the equality of values on both sides.

While === checks the equality of values as well as data type on both sides.

For example:

null == undefined is True, but

null === undefined is False.

Yet another simple and obvious tips to make readers even more awesome in Javascript.

Prototype property in Javascript

July 6, 2007 § Leave a comment

What it is not:

It is not Prototype Library (Toolkits for applying various DHTML effects)

What is it?

It is a built-in object that simplifies the process of adding custom properties/ methods to all instances of an object. In short, It applies any changes you made to all instances of a particular Javascript object.

Why is it useful?

When defining basic properties of Javascript object, you definitely need Prototype property.

For example, If your object is called robot, then robot.prototype would contain var head, var limbs, var body, etc. etc.

Tutorials:

Where Am I?

You are currently browsing the ECMAScript category at RAPD.