Sunday, November 1, 2009

New Features in Ubuntu 9.10 (Karmic Koala)

Finally I'm able to connect to internet from new Ubuntu 9.10 (Karmic Koala). After waiting for a year and half struggling with many distro's finally few tweeking arround helped me to dial my Huwei ETS 2288 WLL modem to internet from the Karmic Koala, I should thank Omshivaprakash's for his post on Hacking BSNL EvDo on Linux and Ubuntu forums. Well now comming to the point Ubuntu Karmic has got many new features with it, I'm going to write about few of them which amazed me.

1. The installation speed and Method : I should tell the installation screens with slide shows and the speed of installation impressed me very much. Till now propereitory OS like Windows and other Linux distribution like RHEL, Novel SUSE and Mandriva had this slide show features during installation. Due to this feature you won't feel bored any more during installation ;). Speed of installation is approximate 12 minutes on a Laptop with 2GB RAM. It took only 8 minutes after the partition, pretty awsome ah..

2.Boot up and Shutdown speeds : Unlike previous version boot up is pretty fast around 16 seconds with flashy screens. So is shutdown with in 2-3 seconds your system is off. This speed is reminded me of Mac Leopard only difference Mac is having Micro Kernel where as Ubuntu with Monolithic Kernel.

3. iBus : This feature impressed me pretty much old SCIM is now replace with iBus (Intelligent input Bus) which has all the language preloaded including Kannada. I didn't have to install any kannada fonts all were there in iBus by default. So for new users of Ubuntu who need local language doesn't have to undergo trouble of downloading and installing fonts and db's of any more, thanks to the Karmic team. Here is screen shot of the iBus in my system. Check out how the kannada fonts appears in firefox without installing any fonts by myself.

From Karmic Screen Shots

From Karmic Screen Shots

From Karmic Screen Shots

3. Ubuntu Software Center : Well I love this new interface to Add/Remove program now called as Ubuntu software center. I can install multiple software at the same time i mean while i'm installing one software I can go back select another software and install it, pretty nice feature.

4. Preloaded themes and Wall paper : Till now Ubuntu came with only 2 wall papers and few now there are many cool wall papers and themes checkout the following screen shot.

From Karmic Screen Shots

5. Cloud Computing support : Last but not the least the support for cloud computing starting with Ubunut One which allows you to share yor files, photos and videos with friends and family and also allows you to access it from any computer in any part of the world. Currently Ubuntu one provides 2GB space for free and for more space you may need to pay a little amount plus each Ubuntu has the Ubuntu one client which allows accessing your files from the system itself. One more feature is export option in F-Spot which allows you to directly upload the photos into Flickr, Picasa Web Albums etc. Check the following screen shots

From Karmic Screen Shots

From Karmic Screen Shots

Well there are several more new features, so go on download a Karmic CD install it and checkout for yourself ;)
Do promote Ubuntu by passing the CD to your friends. Enjoy the new experience with Karmic Koala.

Wednesday, October 14, 2009

Generating thumbnail from a captured image in Blackberry

Blackberry OS v4.6 and later will allow you to directly interact with camera and capture images. Till OS v4.5 for capturing image you needed to invoke the default camera application present in Blackberry using Invoke api. After capturing you may want to display the image as a thumbnail to user so now you will have question how can you do this. Even I had this same question and looked into many forums but didn't get a satisfactory answer later when I saw the Blackberry api reference i found a function by name scaleImage32 under EncodedImage class. But I couldn't make it work properly since i had to convert my Bitmap image into EncodedImage and then use the function and get the Bitmap from this scaled image using getBitmap which is an expensive call requiring lot of processing along with that whatever i get as output of this function was only 4bytes which means there was some problem in my logic. After struggling a lot I looked at the class Bitmap in the JDE refernce i found the createBitmapFromBytes allowed scaling and this function worked perfectly fine. Below is the piece of code which does this work.



FileConnection fc = null;

InputStream is = null;

int length;

byte[] data = null;

Bitmap thumbnail = null;

try

{

fc = (FileConnection)Connector.open(filename);

is = fc.openInputStream();

if(fc.exists())

{

length = (int)fc.fileSize();

data = new byte[length];

fc.read(data,0,length);

thumnail = Bitmap.createBitmapFromBytes(data,0,length,20);

}

}

catch(Exception e)

{

}



Prototype of createBitmapFromBytes is as follows
static Bitmap createBitmapFromBytes(byte[] bytes, int offset, int length, int scale)
Here I've just mentioned the logic modify it to suite your needs. Your thumbnail will be returned as Bitmap object which you can use easily in your application.
One more thing I wanted to add here is scale factor to get thumbnail sized image your scale factor should be more than 20. C ya till next time

Sunday, October 11, 2009

Managing data using XML in Blackberry

XML files are good medium for storing and exchanging the data over the network and they are widely used in many technologies to store and exchange the data. A good example which I can provide here are the web services, configuration files of many java based application servers and java based web projects and also in the API's of famous social network sites like twitter.
It is easy to store the data as a XML file in application that you develop for the blackberry. Though there are storage options like record store and persistent objects available in Blackberry I prefer the XML files over them. Blackberry provides SAX parser for parsing and modifying XML but I felt little difficult to use SAX api so I choose KXML as best alternative for SAX. I'm going to tell how to create a XML file using KXML without loosing a sweat and parsing the already existing XML files.
1. Creating a simple XML file using KXML2 api's

Consider a simple XML file as shown below.

<? xml version="1.0" encoding="UTF-8" ?>



<company>
<employee id="1">
<fname>Vasudev</fname>
<lname>Kamath</lname>
<address>Karkala</address>
</employee>
...
</company>