Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday, April 25, 2011

Save (write) JPEG Images Without DPI Change in Java

If you try to write a BufferedImage on disk using ImageIO.write you will see that the result image will have a DPI of 96 regardless of the source image's DPI!
In order to keep the source DPI or set your own DPI you need to write your image using JPEGImageEncoder class.

Monday, April 11, 2011

Friday, December 18, 2009

NetBeans IDE 6.8

I've just installed NetBeans 6.8.
I went through Feature Highlights and as a Java programmer I guess I will like it. As a PHP 5 programmer, I must say I will defiantly like it since it supports PHP 5.3 new features. :)



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.

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.

Sunday, January 6, 2008

Oh all those cats!!!

Amir Hossein has posted about a book written by Hank Rainwater here which is about leading software teams.
You can download the eBook here! :)