Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Introducing JavaScript native file management

TL;DRThe Mozilla Platform keeps improving: JavaScript native file management is an undergoing work to provide a high-performance JavaScript-friendly API to manipulate the file system.The Mozilla Platform, JavaScript and FilesThe Mozilla Platform is the application development framework behind Firefox, Thunderbird, Instantbird, Camino, Songbird and a number of other applications.While the performance-critical components of the Mozilla Platform are developed in C/C++, an increasing number of components and add-ons are implemented in pure JavaScript. While JavaScript cannot hope to match the spee...

1,591 0       JAVASCRIPT FILE LOCAL FILE FIRFOX MOZILLA


  JavaScript-style object literals in PHP

The object literal notation in JavaScript looks like:var fido = {name: "Fido", barks: true};or var fido = {};fido.name = "Fido";fido.barks = true;From assoc arrays to objectsIn PHP you would call that an associative array. $fido = array( 'name' => "Fido", 'barks' => true);And you can easily make it an object too:$fido = (object)$fido;echo gettype($fido); // "object"Or if you want to start with a blank object and add stuff to it:$fido = (object)array();or$fido = new StdClass();and then$fido->name = "Fido";$fido->barks = true;A little explanation maybe: objects in JavaScript are ha...

3,486 0       PHP JAVASCRIPT OBJECT FUNCTION CALL SELF VS THIS


  A turing machine in 133 bytes of javascript

Multiply turing machineThe fact it took me 20 lines of javascript to implement a nondeterministic turing machine simulatorlast week kept me up at night. All weekend. Too much code for something so simple and I kept having this gut feeling implementing a basic version shouldn’t take more than 140 bytes.Sunday afternoon I sat down for about an hour, collected my thoughts, and started pumping out code with cryptic variable names. It was beautiful, first version ...

3,083 0       JAVASCRIPT TURING MACHINE SIMPLE CODE


  The Ultimate GetElementsByClassName, Anno 2008

Two and a half years ago, I released the first version of getElementsByClassName. With how web browsers has evolved since, I thought I’d release a real ultimate version, dated 2008. Native Web Browser SupportSafari 3.1 has native getElmentsByClassName support, and upcoming Firefox 3 and Opera 9.5 will have it too. It only leaves out, you’ve guessed it, Internet Explorer.The Necessity Of This ScriptLiving in a world where Microsoft is halting every possible way the web could evolve, this means that you will need a custom script for this for years to come. Also,...

1,932 0       JAVASCRIPT IMPLEMENTATION GEELEMENTSBYCLASSNAME CROSS BROWSER COMPATIBLE


  Hash Tables in Javascript

IntroductionHash tables are a permutation of associative arrays (i.e. name => value pairs). If you use PHP, then you are very familiar with this type of data structure already since all PHP arrays are associative.The Javascript language implements very loose and somewhat limited support for associative arrays. Any JavaScript array can use other objects as keys, making it a hash, but there exists no formal constructor for initializing them and it is more or less unweildy to work with. A short example of a hash in JavaScript would be as follows:var myArray = new Array();myArray['one'] = 1;myA...

4,851 0       JAVASCRIPT ARRAY IMPLEMENTATION HASHTABLE


  Writing forward-compatible websites

This is a list of best practices for creating websites that do not break when browsers are updated. It's not always possible to follow all of these, but following as many of them as possible will help future-proof your website. This is especially important for intranet applications and other non-public websites where problems are likely to not be noticed during testing by browser vendors.JavaScriptPrefix all global variable access in onfoo attributes with “window.”When an event handler content attribute (onclick, onmouseover, and so forth) is used on HTML element, al...

2,069 0       JAVASCRIPT WEB DESIGN CSS WINDOW FORWARD COMPATIBLE


  Basic Patterns for Everyday Programming

For most of you the patterns mentioned below should be nothing new. These are very basic stuff we slap into our code everyday and at times feels they are actually code smells than smart patterns. However, I've been doing some code reviewing lately and came across many code that lacks even these basic traits. So I thought of writing them down as a help for novice developers who would want to get a better grasp at these.These patterns are commonly applicable in most general purpose programming languages, with slight syntactical changes. I use Ruby and JavaScript for the examples in this post.Ver...

4,526 0       JAVASCRIPT CODE PATTERN FUNCTION NULL ASSIGN DEFAULT VALUE


  JavaScript JVM runs Java

The world of software is made slightly crazy because of the huge flexibility within any computer language. Once you have absorbed the idea of a compiler written in the language it compiles what else is there left to gawp at? But... a Java Virtual Machine JVM written in JavaScript seems like another level of insanity.In fact it is a quite reasonable idea which is only made mad by the usual positions that Java, the top dog, and JavaScript the underling, usually occupy. Java is compiled not to machine code but to a special byte code which is then run on a virtual machine which is usually implemen...

4,727 0       JAVASCRIPT JVM BICAVM CROSS PLATFORM JAVASCRIPT WRITTEN JVM