Tuesday, January 6, 2009

Is MS Windows Accurate?

I'm reading the book Killer Game Programming in Java. The part which is explaining FPS and the issues in different operating systems is so amazing for me:

In Windows 95 and 98, the resolution is 55 ms, which means that repeated calls to currentTimeMillis( ) will only return different values roughly every 55 ms.In the animation loop, the overall effect of poor resolution causes the animation to run slower than intended and reduces the FPS. This is due to the timeDiff value, which will be set to 0 if the game update and rendering time is less than 55 ms. This causes the sleep time to be assigned the iteration period value, rather than a smaller amount, causing each iteration to sleep longer than necessary.To combat this, the minimum iteration period in GamePanel should be greater than 55 ms, indicating an upper limit of about 18 FPS. This frame rate is widely considered inadequate for games since the slow screen refresh appears as excessive flicker.On Windows 2000, NT, and XP, currentTimeMillis( ) has a resolution of 10 to 15 ms, making it possible to obtain 67 to 100 FPS. This is considered acceptable to good for games. The Mac OS X and Linux have timer resolutions of 1 ms, which is excellent.

Tuesday, December 16, 2008

Ajax Islands Tutorial - AjaxCSSJS Class (Part 1)

You can load JavaScript and CSS files dynamically. AjaxCSSJS can do the task for you simply. In this video you can see how to use it to load CSS files.

Sunday, December 14, 2008

Friday, December 12, 2008

AjaxImageReflection

I developed the 5th island which is not actually an Ajax component but DHTML component. Using it you can add nice and customizable reflection effects to IMGs on your pages; Only if your browser supports HTML canvas. It means it doesn't work in IE7.
Something like this:

Go ahead and take a look at examples here. You can download it too.

Thursday, December 4, 2008

AjaxContent

AjaxContent Class
The 2nd island of Ajax Islands is released. Using this class you can add Ajax links to your HTML pages without getting involved with JavaScript and XMLHttpRequest. You can associate a link (An A tag or any kind of HTML element as a link), a container (A DIV tag or any other container element) and URL(In fact, from the same server). So when the user clicks the link, the content of the URL will appear in the container. You can also introduce an image as a loading indicator to be displayed at the center (horizontally and vertically) of the container, so the user can wait for the new content to be fetched.

Download AjaxContent and take a look at live examples

The class has a very nice and powerful feature:
The last argument of the constructor, which is supposed to be a Boolean value, determines that if the script tags in the content should be added to the document scripts or not!!! (Not using a simple eval). So if you pass a true value to this argument, all script tag from the content will load and can be accessed from the current scripts of the page. 

Monday, November 17, 2008

Google Chrome


I've just installed Google Chrome web browser. I can say it's a Google product indeed: simple, powerful and elegant

Sunday, November 16, 2008

JavaScript Object Model - OO Programming


JavaScript is a C++-like scripting language and like most of its relatives let the programmers to write in both object oriented and procedural style. But there is a big difference between JavaScript and other popular OO languages such as C++ and Java which are class based languages.
OO languages are either class based or prototype based. JavaScript is one of prototype based languages out there.
There are lots of references and tutorials about OO programming in JavaScript in the Net. Most of them are so useful and explain a single aspect of OO programming in the language. Some are based on a particular framework such as Prototype, JQuery ... while some explain the pure JavaScript rules.If you are curious to read yet another nice article about JavaScript Object Model, I strongly suggest you to spend 15 minutes to read JavaScript's class-less objects by Stoyan Stefanov.
The article explains the dynamic features of the JavaScript and explains different ways to implement inheritance in the language and then compare them with Java's way.