Wednesday, 8 of September of 2010

Archives from day » 22, September 2009

Concept of float datatype in j2me

Nearly everyone would feel pains for float datatype in j2me. This article will give you a broad concept to implement or more precisely simulate float in j2me.

First of all, how a float data look like?

78.98, 34.98885, 3.141759 …. and like this.

If you look closer, you will find every float has very small variable unit.

Say 78.98. Its unit is 0.01.  Similarly 3.141759. Its unit is 0.000001.

To implement in j2me, we will have smallest unit is 1 and also this is fixed. So what to do?

First of all for every data we will need to pre-assume maximum length. This is so because it will help to choose appropriate type like short, int or long.

int speed = 0;

//Say we need speed similar to 0.5.

Next is enlarge our data as per necessity.

Now,

speed = speed+1;

To get simulated speed of 0.5, we need speed to divide by 2. So the next step will be…

speed = speed / 2;

Actually this will give you 2 consecutive same values like 1,1,2,2,3,3,4,4,….

The same concept will work for larger values.

That’s it for now.


Do your comment

Future of flash?

Adobe is going to release next version of Flex with the name of Flash.

Question is where is our old Flash?

Current versions has already lost its legend characteristics of Flash.

I am okay with flex. Good for business based applications. Lots of graphs, easy to use services, components and libraries, rapid development and many revolutionary things. Flash is separate thing to do things differently. Adobe is try to make it dot net kind of environment but I recall this to adobe that people have already things similar to flex but what they do not have is FLASH.

Another problem is Adobe is not keeping its promise to make flash platform independent. I am specifically targeting towards linux. More than a decade and flash or flex is still a dream for linux users.

Therefore, I request Adobe to not to loose legend core of flash.

[The article is not targeting flash environment but that Flash language and IDE]


Do your comment