Continuous Code Validation using JSLint


Callbacks are often found in JavaScript code. Some say ‘They are inconvenient and make code harder to understand’. Actually, it is a matter of habit and JS code may be as readable and easy to understand as any other. Additionally, this approach of coding allow us to ‘release’ program flow. No function is waiting for another’s result. Everything goes like stream.

Few month ago there was buzz around Node.js: Google’s V8 JavaScript engine acting as server. Before that nobody thought about event-based programming on server side. Every I/O operation in Node.js is asynchronous (database queries, reading from file or fetching content of some webpage). These are all the time used in web applications, especially real-time ones. Besides, lightweight and high-performance Nginx server is using event model.

There is enough articles about Node.js functioning. Today, I’ll show how to create real application that is checking in continuous way if our code project in JSLint by Douglas Crockford. All with growl notifications.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

jQuery vs MooTools Nightly Benchmark


MooTools team suprised us by releasing 1.3 beta. One of the most notable features was Slick – very fast selector engine. It does not use MooTools code, so finally we can use it without attaching whole MooTools Core. On other side, as everybody knows, jQuery seems to have fastest selector engine among JavaScript libraries – SizzleJS . So include SizzleJS or Slick? Check our benchmarks and decide yourself.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

Unit Testing in JavaScript: Selenium


I’ve described tools like QUnit or JSSpec. They allow us to test JavaScript functions, classes, generally things that works without refreshing the page. But what if we need to check existance of “Log in” page, whether navigation works properly or user is able to modify settings of his account. These actions require loading several pages on different browsers and systems. Here comes Selenium. Suite of tools to automate web app testing across many platforms.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

JavaScript oddities explained. Comparing.


This post is inspired by Brian Leroux and his wtfjs tumblr blog. JavaScript is full of unexplained oddities. I’m going to prove you that every each of them can be explained. There are several causes of such interpreter behavior: inaccurate specification, hyper-correct interpreting, understatements, waywardness of browsers creators. The first type of such ‘features’ are these related to comparing.

0.1 + 0.2 == 0.3

11111111111111113 != 11111111111111111

01234 != 0668

0123 == "0123"

NaN == NaN

3 != "03"

"4" - "1" == "1" + "2"

If you think that TRUE is answer to any of above expressions (and don’t know why it’s exactly opposite) then you should certainly read rest of this article.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

Mobile Application Development using JavaScript


JavaScript is not only for webpages and web applications. Among other things, You can create realtime applications, serverside solutions, desktop and mobile applications. There are two types of moble applications: running in browser and native ones. These latter are often faster and more powerful. That’s because they have access to filesystem, accelometer, camera and et ceatera. Native applications are usually written in phone-specific language like Objective-C or Java, hence stanalone programmers generally choose HTML+CSS+JavaScript solutions. Happily, thanks to lastest technology, we are able to easily transform browser application into truly native one.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

HTML5 JavaScript API. What’s new?


HTML5 has a lot of new features. There’s new HTML, CSS and, of course, JavaScript. Officially HTML5 specification and implementation won’t be ready until 2022. Personally I don’t believe in this. Majority of JavaScript features described further are already implemented in modern browsers (e.g. Sarafi, Chrome, Firefox, Opera). Even Internet Explorer gained capability to render canvas and other stuff (supposing we use ExplorerCanvas or Chrome Frame). Take a closer look at what’s going to make your live better and happier :

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

Games development in JavaScript: Canvas vs DOM benchmark




Canvas vs DOM animations performance test

In my last article I described four frameworks used in games’ developing. What differentiate frameworks is the way in which they render graphic. Each framework I mentioned used DOM and CSS, only one enabled the use of Canvas too. But it’s obvious that in time more and more frameworks will work with it – it’s just still a developing standard.

During writing the previous article, I went in for comparing a performance of Canvas and DOM. It’s known that those are two completely different technologies with different capacities. HTML presents data, CSS gives them an appearance, Canvas draws. So I wondered how to compare them since they are so different.

As the result of my observation I decided that that the most important and the hardest thing is to animate many objects simultaneously (eg. missiles, enemies, obstacles). At the outset I strongly simplified a game model  to moving squares. Afterwards I was testing different variants achieved with CSS.  So I didn’t test anything what wouldn’t be feasible in CSS – it’s clear that Canvas would be better there (I mean such capacities as drawing diagonal lines or polygons).

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

Unit Testing in JavaScript: JSSpec


If you are not familiar with definition of Unit Testing or you are wondering about solutions in JavaScript go to one of my previous articles.

If you want to see real example of Unit Testing or Test Driven Development, go to article Unit Testing in JavaScript: QUnit.

Today’s Unit Testing Framework is JSSpec. It is used by MooTools, TiddlyWiki and others.  Because it is purely JavaScript (Browser-side) tool like QUnit, which have been already described I’m going to point out only important things, without going into details.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

Unit Testing in JavaScript. QUnit


If you are not familiar with definition of Unit Testing or you are wondering about solutions in JavaScript go to one of my previous articles.

The first type of JavaScript unit test frameworks are solutions like JSSpec or QUnit. They are written entirely in JavaScript and require a browser to run . The undoubted advantage of these solutions is an amazing simplicity of writing tests. But if we want them to run in different browsers, we are forced to do it manually. Unfortunately without some tricks we can’t run them from console, nor at once in different browsers or computers. However, there are adapters that let you to extend their functionality. Famed examples are JsTestDriver, Test Swarm and Selenium. Thanks to them we are able to control multiple browsers on multiple computers from one place. Anyway, I will describe them in future. Today we’ll take care of the basics.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com

Games development in JavaScript: part 1 – frameworks


What is the point of making games in JavaScript? you may ask and it’s a good question. Everybody knows that since the web’s begining Flash had better ability to become a base technology for games development. But times change. Javascript is gaining two types of allies – such technologies as Canvas, CSS3
or SVG and much better performance of browsers engines. Brett Fattori, Render Engine frameworks author, wrote:

I realize that some people will question my motives, considering that Adobe Flash is available and offers more capability than Javascript does (at this point), however, the entry fee is fairly steep for most individuals. The Render Engine is targeted at those individuals who would like to create games but who don’t have access to Flash, don’t want to pirate Flash and risk their future, or don’t have the skills necessary to create games with it.

What is more, Flash is closed technology managed by only one company. It needs plugin which isn’t available for every

single device. That’s what makes JavaScript and connected technologies an interesting alternative for the Flash. Also when we talk about games.

Read entire post »


Add to Del.cio.us

RSS Feed

Add to Technorati Favorites

Stumble It!


Digg It!

        www.sajithmr.com