Saturday, March 05, 2005

JPG image support in MIDP. How to detect it in J2ME

(Soporte para imagenes JPG en MIDP. Como detectarlo en J2ME)

At my last project we have to show certain downloaded images in a mobile phone using J2ME. The images are in jpeg format, and we pass them throughout an adapter for preprocess the width and the format.

As they are camera images, if we send to the phone in png format, they has more or less 15 KB, but if we send them in jpg, only 3 or 4 KB are needed, but...

As MIDP standard says:

"...Implementations are required to support images stored in the PNG format, as specified by the PNG (Portable Network Graphics) Specification, Version 1.0. All conforming MIDP implementations are also conformant to the minimum set of requirements given by the PNG Specification."

Well, to manage those problem we execute the following routine when the application loads.

boolean support_JPG = false;
try{
  Image img = Image.createImage("/res/p.jpg");
  support_JPG= true ;
  img = null;
  System.out.println("JPG support is true");
catch(Exception e){
    System.out.println("JPG support is false");
}

They idea is put a small pixel jpeg file(160 bytes) in the resources and try to load it, and if no exception is thrown, we suppose that the jpg format is supported by the phone, and we store this value in a boolean variable called support_JPG. Another thing thath you can do, is call this routine only the first time that the app runs in the phone and store this value using RMS(Recommended).


Permalink: JPG image support in MIDP. How to detect it in J2ME 

Tuesday, March 01, 2005

ILUNGA, the world's most difficult word to translate

(ILUNGA, la palabra mas dificil de traducir)

The world's most difficult word to translate has been identified as "ilunga" from the Tshiluba language spoken in south-eastern DR Congo.

Ilunga means "a person who is ready to forgive any abuse for the first time, to tolerate it a second time, but never a third time".

It seems straightforward enough, but the 1,000 language experts identified it as the hardest word to translate.

In second place was shlimazl which is Yiddish for "a chronically unlucky person".

Third was Naa, used in the Kansai area of Japan to emphasise statements or agree with someone.


Permalink: ILUNGA, the world's most difficult word to translate