developing new ideas and looking to events and problems with new, different and open point of view.

Mourning Aaron Swartz

On Friday, January 11, 2013, this world has lost - at the age of only 26 years - one of the innovators who have not had a sufficient degree of fame in their lives. It is Aaron Swartz.

Among many accomplishments, Aaron is known for being one of who contributed to the development of the first version of the RSS protocol that is used to get updates published by news websites, blogs and other sites. In addition to numerous posts on Wikipedia that made the most famous encyclopedia website mourn him and put his name in the list of "Deceased Wikipedians".

Aaron Swartz was found after committing suicide at his home in New York on Friday, January 11, 2013. And the cause of suicide is likely to be the depression he suffered because he was accused in a series of felonies with total penalties up to $4,000,000 fines and 50 years in jail. Don't be surprised when you know that the only act that brought him all this was downloading a collection of scientific articles from the archives of Academic journals to publish them and make them available to public.

Having 2 instances of a Singleton!!

Who said only one instance of a Singleton can live in a JVM?
Assume we have a singleton class written correctly to avoid having 2 instancea by a multithreading trick. Is there any method by which we can have 2 instances from this class? The answer is yes!

First let's see how can the singleton class be written with a tester main method.

  1. public class SingletonTest {
  2. public static void main(String[] args) throws Exception {
  3. Singleton singleton1 = Singleton.getSingleton();
  4. Singleton singleton2 = Singleton.getSingleton();
  5.  
  6. System.out.println(singleton1);
  7. System.out.println(singleton2);
  8. }
  9.  
  10. private static class Singleton {
  11.  
  12. private static Singleton singleton;
  13.  
  14. private Singleton() {
  15. }
  16.  
  17. public synchronized static Singleton getSingleton() {
  18. if (singleton == null) {
  19. singleton = new Singleton();
  20. }
  21. return singleton;
  22. }
  23. }
  24. }

Software development occurs in IDEs not in word processors

Don't wonder!
Some people really believe that software development is done in word processors (like Microsoft Word or OpenOffice.Org Writer). And actually they seem to be doing so. I don't mean writing code in a word processor. I mean writing documents more than code!

Second Birthday

Monday 01/02/2010 was the second birthday of The Online Brain website http://www.online-brain.com.
This year, I was very busy and I wrote only 5 blog entries comparing to first year in which I wrote 11 blog entries.

In this year, the first brother of this website was born which is http://www.androbex.com, the website of my first android application "Androbex". Also I was very busy not to give Androbex and its website the time they deserve.

I even was very busy not to publish this page at time on 01/02/2010. Anyway, I hope this will change in the next year and I can be more active on this website.

Happy birthday for me, for the website, and for everyone who find this site good and useful.

My Expectations for 2010

Hello,
Happy new year 2010 and best wishes for everyone. I won't say what are my wishes but to be more practical, my expectations.
As a software engineer, I'll say some expectations in my field! Hope also to know what you think about my expectations and what expectations (or wishes) do you have.

Transparent Images Created at Runtime in JavaME

JavaME has a good set of APIs that are useful to create good mobile applications. Especially the game package (javax.microedition.lcdui.game). Creating tiled layers and sprites and managing them via a layer manager and delegating game canvas' paint to the layer manager are really funny. Sprites are commonly used in mobile games (and may be other types of applications as well). Sprites are usually not rectangular (have transparent backgrounds). Because sprites are usually created from images from resources, there is no problem. A png image with a transparent background is used and everything is ok.
But what if we want to alter the image before creating a sprite from it or even create it from scratch at runtime? for example, if we are developing a football game and players can wear kits with any color. It isn't good - for many reasons - to use a separate image for a player wearing every possible color. So, we don't have a solution except altering the image (re-coloring it) before creating the sprite of the player.
According to MIDP documentation, there are two types of images, mutable and immutable images. Mutable images are editable but immutable images consume less memory and the most important thing is that they support alpha!

In the previous scenario, we will load the image of player from resources, create a mutable image from it, re-color it and finally create the sprite from the new image. The bad surprise is that, we will lose the transparent background and every player is now a rectangle! So, what? How can we alter the image and keep the transparent background?

This is why I love open source!

If you have read my previous articles about open source software, you of course noticed that I am biased for this kind of development and I love it. from few days I read a blog entry written by a SunMicrosystems engineer and was talking about why the "jar" command is taking time longer than it actually needs to accomplish its task. The blog entry is here http://blogs.sun.com/CoreJavaTechTips/entry/superduper_slow_jar

Bypassing work netowrk security

In a previous article (Value of Brains) I talked about companies managers and administrators who think they can prevent developers from accessing some websites from inside company network for stupid reasons like protecting source code, optimizing bandwidth usage, or maximizing work time.
As a developer you must be able to bypass these stupid mechanisms. But if you are still junior or beginner in network stuff, here is a help to do this. This is a guaranteed way that almost can not be blocked.
For criminals to smuggle weapons inside countries, they dig underground tunnels and we will do the same. Yes, the idea we are going to use is called Tunneling.

I published my frist NetBeans plugin

After days of reading and exploring NetBeans platform and of course programming, I finished my first NetBeans plugin which I called UnicodeConverter.
This plugin adds a very simple but very useful feature (at least for me) which is changing Strings written in languages rather than English to standard unicode format ("\uXXXX").
Well it doesn't look like a high impact feature. But if you have worked with non-English user interfaces and tried to compile your code on many machines and systems, you most probably have faced problems of character encoding. And surely you decided to use standard unicode format. This decision of course made you breath easily thinking your problems are end. But now, you find yourself can not read resources files and if you want to change a non-English string, you are facing the nightmare of how could I find this string in unreadable resources files?!
If you experienced this scenario, this plugin is for you.

First Birthday

Today 01/02/2009 is the first birthday of The Online Brain website http://www.online-brain.com
Please tell me what you think by comment or by taking some short polls.
take Polls here
Syndicate content