Tuesday, November 18, 2008

Triple Boot A System - Windows, Fedora, OpenSolaris

Install Windows on the system by creating a primary partition (termed C, also known as hda0 for Linux). Then create an extended partition where you can then split it into logical drives (like D, E, F, etc. - the entire extended primary partition is recognized as hda1 in Linux).

Next Install Fedora 9 taking care that the MBR is installed at the first location of its corresponding drive (hda2, as hda2 is the newly created primary partition).

Note - This is a reference image and the name of the drive, sda1 may vary.

  • This is taken care during the installation where we have a choice either to install the MBR at the first location of the hard disk, or at the first location of the Fedora partition; select the later
  • Fedora creates the swap partition also as a primary partition, so avoid swap as Windows can recognize only three primary partitions (Windows C + Fedora hda2 + Fedora swap) and we won’t be left with another primary partition to install OpenSolaris. Else create the swap partition of the Linux as an extended partition
  • Now don’t get panicked if Fedora doesn’t load, just keep on going because we have not allowed Fedora to update the MBR

Install OpenSolaris 2008.05 on the system, and complete the installation without any hassles on another primary partition (hda3).

Boot the Solaris and got to /rpool/boot/grub/menu.lst, this is a privileged file and it requires to be logged in as the root.

Add these lines to the grub of Solaris at the end of the file -

title Fedora root(hd0, 2) chainloader +1

Wednesday, October 08, 2008

OpenSolaris 2008.05

Following the inauguration of S.O.U.R.C.E on 20th September, there was an enthusiastic response from the members of the group to present sessions on Sun's open source technologies.

On 4th October 2008, a technical session focusing on OpenSolaris 2008.05 was conducted. This session had an introduction on OpenSolaris by Gautam Muduganti (Sun OU Campus Ambassador) followed by a detailed presentation by Mr. Raghuveer and Mr. Laxman, both third year CSE students.

The sessions covered the following:

  • Installation of OpenSolaris in dual boot and triple boot models. The Triple boot model was emphasized as many of the existing systems had Windows XP and Fedora
  • Running OpenSolaris 2008.05 under VirtualBox environment installed on Windows XP
  • Package Manager features specifically for downloading additional software with emphasis on C compiler
  • Creating, Compiling and Executing C, C++, Java programs
  • Configuration of Internet on Router based Static IP model and on PPPOE with standard broadband connections
  • An overview of advanced topics of OpenSolaris - ZFS, Image Packaging System, Dtrace, Containers
  • A Live demonstration of Compiz Fusion on OpenSolaris
  • A Live demonstration of installation of Triple Boot Operating System Model

The Tech-Session concluded with interaction with the audience where their queries were answered and feedback was taken so as to make the future sessions, more efficient and interesting. Following the session, OpenSolaris 2008.05 CD's were distributed among the attendees in-order to encourage them to install OpenSolaris and experiment with the operating system. The installation procedure was documented and was made available at the OSUM site for reference.

There was an excellent support from our Faculty (Mr. M.V.S. Subramanyam) who provided two write-ups on Internet configuration and installation of OpenSolaris.

A total of about 35 - 40 enthusiastic students participated in this event.

Tuesday, September 30, 2008

S.O.U.R.C.E Inauguration

On 20th September 2008, we, the students of Osmania University successfully started a new open source group, named S.O.U.R.C.E (Students of Osmania University to reach the Realms of Computer Excellence) in our college to propagate Sun Open Source Technologies.

Initially a core group of Third Year CSE students spent a day and discussed the name of the group and also the day it should be launched. The group decided that the best day to launch the S.O.U.R.C.E should be "Software Freedom Day" and there was total unanimity in this decision. The core group also coined the acronym S.O.U.R.C.E as it reflected the goals and focus of the open source group.

Following the above decisions, the next aspect the core group considered how the event launch should be publicized in the Campus. A day was spent on the Poster Designing. A lot of thought and debate had gone into this Poster design especially with respect to positioning Sun Brand in this launch. The Poster finally was designed with Sun Brand Colors, Fonts and Logo and with the focus on the team.

Another day was spent seeking permissions from Head of the Computer Science and Engineering Department, Prof. S.Ramchandram and Principal of Osmania University, Prof. Venu Gopal to formally launch the Group in the University. We also explained to them about the Open Source focus and integration with Sun Open Source Strategies. They were appreciative of the initiative. We invited both of them to preside over the inauguration. In parallel the posters were printed and put up on the notice boards of all the Departments, Library and Hostels to catch attention.

On the following day, the core group went to each Engineering Department and gave an introduction about the group S.O.U.R.C.E highlighting open source philosophy and Sun Microsystems Inc. We encouraged all the departments to join us and stressed that open source is just not software but a philosophy.

Once the above aspects were covered, the core group spent a day discussing the Agenda, identifying the Show Anchor and Seminar Topics. In addition seminar hall was checked for all facilities and Open Office was installed on machines in Seminar Hall. In parallel the logistics were taken care of like procurement of Bouquets, Cakes, Snacks, Water Bottles etc., On Friday evening with all arrangements in place, we kept our fingers crossed hoping that everything should go well and Murphy Law would not show its face.

On the D-day i.e., Saturday, the Core Group was very early in the College and reviewed once again all the arrangements.

People started coming in trickles and by 9:45 AM, the entire seminar hall was full with a whooping strength of 70. This was amazing and encouraging.

The inauguration was started by presenting bouquets to Prof. S.Ramchandram and Prof. Prem Chand. The senior faculty provided the group with some inspiring words and ensured their support always for this initiative. They shared their experiences and wisdom about Open Source Philosophy. A cake was then cut as a part of the celebrations of "Software Freedom Day".

This was then followed by a seminar by Mr. Roopak Bhartee, a third year CSE student, who spoke about open source and its benefits to the people in today's world. He also gave an insight about "Software Freedom Day".

Subsequently a presentation on "Sun's contribution to Open Source Community", was given by Mr. Muduganti Gautam (Sun OU Campus Ambassador) which covered SUN, it's participation in open source communities, various open source technologies of Sun like Solaris (OpenSolaris project), VirtualBox, Java, GlasssFish, NetBeans, etc. The presentation also explained Sun OSUM (Open Source University Meetup) and how S.O.U.R.C.E fits into that framework.

The participants were then encouraged to sign-up at the OSUM site and join our group at the site.

The event was concluded by a "Vote of Thanks" by Mr. Harish. The entire event was well anchored by Miss. Apoorva.

The entire S.O.U.R.C.E core group was encouraged and enthused with the success and response for the event.

Check out the photos at http://picasaweb.google.com/osum.source

Friday, September 05, 2008

Google Chrome - First Impressions

As many of you have already heard about it, Google has finally released its own web browser. Google Chrome is a free and open source web browser developed by Google. A Beta version of Chrome was released 3 days ago i.e. on 2nd September 2008. Download It From Here

The Android team of Goggle played a significant role in the development of Chrome. Chrome fared well in Acid1 and Acid2 tests but couldn't clear the Acid3 test and scored an overall rating of 78/100 which is far higher than Internet Explorer 7 and Firefox 3.

Chrome uses the WebKit rendering engine and it was primarily assembled from 26 different code libraries from Google and other third parties such as Netscape.

Well let us see a few important features of Chrome in the following sections

Security

Chrome primarily maintains security in the form of two blacklists - one for phishing and the other for malware. Further each tab in Chrome is sandboxed into its own process to avoid offensive activities of one tab on another, such as a malware in one tab accessing the credit card number in another tab.

A private web browsing feature call Incognito mode is provided as well. This mode prevents the browser from storing any history information or cookies from the websites visited.

Speed

Main focus on speed was made in the JavaScript Virtual Machine. A new engine named the V8 JavaScript Engine was developed with features such as Hidden Class Transitions, Dynamic Code Generation and Precise Garbage Collection.

Tests have shown that with the help of V8 JavaScript Engine Chrome performs faster than all its other competitors.

Stability

Following a lot of study, Chrome was implemented as a multithreaded browser with a multiprocessing architecture. It should be noted that all the existing web browser implementations are inherently single-threaded.

A separate process is allocated for each tab and for each plug-in, so that even if an attacker gains access to one tab, he won’t be able to access the others at once, causing failure to his motives.

However the pop-ups are restricted to their tab scope, they won’t appear outside the tab unless dragged by the user. And a separate process isn't allocated for the popup.

Further Chrome features a process management utility called the Task Manager which allows people to see which websites are using the most memory and identify the plug-ins which are exploiting the system resources. And terminate them if necessary.

User Interface

The main UI consists of the traditional buttons like the back, forward, bookmark, go, refresh and cancel buttons. The Minimize, Maximize and Close buttons look similar to Vista.

The entire UI is based on the WebKit rendering engine with features such as auto complete for the URL box.

Besides these Chrome concentrates on the developer too, with features such as

  • Show Source - A common utility to show the HTML code of the web page
  • JavaScript Debugger - Used to debug the JavaScript if any bugs are present
  • JavaScript Console - A JavaScript console where commands can be written and executed
  • Task Manager - Shows the allocation of resources

Further movement of tabs between different instances of Chrome is also possible. Of course relative positioning of the tabs is also possible.

Inspect Element

Well this is a feature in Chrome which I found useful being a web developer. Right click any part of the screen and select inspect element, a screen pop-ups called the Inspector with the page layout.

You can explore the CSS, DOM and HTML and other stuffs here. Also, on the lower left corner, there's an icon named Show Console. Click on this and it brings up a console where you can type commands and the DOM elements and nodes and other stuff.

Besides these you can edit the web page offline using the Inspector with a little knowledge of HTML and DOM. Here is a small example where I could change the web page offline using the Inspector.

Chrome has a hidden feature which actually invokes the pipes screensaver present in Windows XP in the web browser. Check it out yourselves by entering about:internets at the URL Box.

Well that’s it. I recommend you to download Chrome and do try it out. It might make an impression on you. And before I end here is the comic book released by Google on its Chrome release.

Will Google Chrome affect the usage of Microsoft Internet Explorer? That's a question we all have to wait and see!!!

Tuesday, August 05, 2008

Qt - Conclusion

Strengths of Qt

The resource editor of Qt is very powerful. The message loop of Qt can be coded manually, unlike several other widget toolkits. It has a powerful layout manager to simplify work.

Qt consists of several powerful features such as Controls, XML, Regular Expressions, Platform Independence, Template classes, memory management, Network API, Database API, OpenGL API. It also has a very good documentation, both online and offline.

Future of Qt

Qt aims at further simplification of UI designing for various platforms. It is now concentrating on extending itself to embedded systems such as mobile phones and PDAs.

Better services are expected for music, video, television, imaging, games and business mobility for mobile devices with the help of Qt. Better cross-platform independence is to be achieved and further extension of Qt into other languages is expected.

Qt Designer

Qt Designer is a GUI based Qt programming tool to make UI programming simpler. It is based on the concept of dialogs which is further built on XML.

Several looks can be previewed using it like Motif, Windows, etc. Simplifies the concept of Signals And Slots using GUI. Supports creation of complex widgets and user-defined slots.

Download the entire presentation here.

Code Less ...
Create More ...
Deploy Everywhere ...

Qt - Gaming In Qt

The previous article covered a simple GUI application, let’s extend this concept to a game, written completely in Qt. Here is the screen-shot of the game. This game is popularly known as "Pocket Tanks" in the gaming market.

I won’t be explaining the entire code here, but let me give you a description about it. Like before, lets first split the entire setup into simpler components.

  • Three buttons - Quit, Shoot, New Game
  • Two LCD Numbers - Hits, Shots Left
  • Two LCD Numbers connected to sliders - Angle, Force
  • A Screen consisting of a cannon, wall and a brick

Download the source here.

First let’s construct the complex widget - LCD Range where a LCD Number is connected to a slider. A LCD Number is created and a slider is also created with specifying a certain range. These two are connected by generating a signal from slider that the value has changed to the LCD Number slot display.

Two of these complex widgets are created - Angle and Force.

Now let’s design the gaming area itself. Here we will be using a very powerful tool known as the QPainter. It provides us with tool for drawing almost anything, lines, arcs, circles, etc.

The wall and the brick are rectangles each with their own dimensions and color. Now comes the cannon, we use a circle here with a rectangle covering a part of it corresponding to the angle. As the angle varies, the position of the rectangle will also vary. Also the brick is placed at a random to make the game more challenging.

Once the UI is done the next step is building the AI (Artificial Intelligence) for the game. Going back to physics, for a body projected at a certain angle, the following formulae exist

Vx = V * cos(angle)
Vy = V * sin(angle)
X = x + Vx*t
Y = y + Vy*t - ½*g*t*t

where,

Vx - starting velocity in x- direction
Vy - starting velocity in y- direction
X - position in x direction of the cannon-ball after a time t from firing
Y - position in y direction of the cannon-ball after a time t from firing
g - acceleration due to gravity

Now these objects are placed properly and set as the main widget to the application. Compile it and run it. That’s it, happy gaming.

Qt - A Simple Example

Enough of the theory; let’s get into the action. Here is a sample window which will take a name and displaying a message. Before we get into the coding part, it is more important to analyze how the window works.

Basically this window can be broken down into 4 components

  1. A Text Label
  2. A Text Field
  3. A Button
  4. A Message Box

Now let’s see how the system works. A user keys in his name, then clicks the button, once the button is clicked a message box appears which reads from the text field and displays a message. Download the source from here.

Primarily an application is created from the QApplication class, and then a complex widget is created and assigned as the main widget of the application and then is displayed after resizing it.

As there are many simple widgets in the application, a complex widget is created from them, and then set to the application. Here the class ComplexBox represents the complex widget. Remember every widget is derived from the QWidget class.

Firstly the components are to be created and then placed on the screen; this is done by using a layout, namely the grid layout. Where the component is placed based on the co-ordinates of the layout. For example the text label is placed at position (1, 1) extending to (1, 2), that is it occupies 2 columns and 1 row starting from (1,1). Similarly all the other components are placed.

Next we have the inter-actions between various components. As we can see, clicking the button leads to display of the message. This is the perfect situation of an action listener; this is implemented in Qt by a signal-slot relationship. The signal and the slot are primarily functions. Here the signal is generated by a pre-defined signal called the clicked() of the button, as a result an action is performed by the call() slot of the ComplexBox object itself. As seen the slot is declared in the header.

That’s it; our first Qt program is over. Run these commands to compile it

qmake –project
qmake
make
./dir-name

Qt - Programming In Qt

The primary prerequisite of learning Qt is C++. As already stated that Qt builds on the libraries of C++, it is vital to know the concepts of C++ like classes; private, protected and public members; inheritance, etc.

Like any traditional C++ program, the execution of a Qt program also starts from the function main(). A few enhancements do exist for Qt such as Signals And Slots. These are primarily responsible to establish connectivity between various widgets of the application.

Every Qt program consists of an application and several widgets built inside it.

Main Classes of Qt

Qt is based on widgets and intercommunication. A widget is any component with which a user can interact. It can be a button, a text box, anything. Complex widgets can be created from simpler ones.

Like any GUI toolkit, even Qt has several predefined widgets, namely QPushButton, QRadioButton, QCheckBox, QLabel, QLineEdit, QLCDNumber, QSlider, etc.

An entire list of Qt classes can be found in the help documentation of Qt, under the section Qt’s classes.

Writing A Program

The primary steps to be followed while writing a program are

  • Define the problem properly
  • Make sure what the widgets used will be, and how they are interconnected

Every Qt program is an application and is created from QApplication class. Further widgets are created and are attached to this application. And later the application is displayed. Generally simpler widgets are combined to form a complex widget, which is then used in the program.

Qt - Introduction To KDE

KDE stands for K Desktop Environment. Qt can be significantly experienced on a KDE desktop. The Qt toolkit was used for the KDE project. Every window available on the KDE desktop is a part of the Qt design.

Actually KDE is primarily built on several technologies such as

  1. KHTML - an HTML engine
  2. Plasma - desktop and panel widget engine
  3. Phonon - multimedia framework
  4. Solid - device integration framework

On top of this the entire UI is built on the technology of KDELibs, which is in turn built on Qt.

Qt - Introduction And Working

Qt is a cross-platform application development framework, widely used for the development of GUI and non-GUI programs. Originally Qt was developed by a Norwegian company, Trolltech. It is presently being acquired by Nokia.

Examples of GUI applications using Qt are the VLC Media Player, Opera, Adobe Photoshop Album, Google Earth, Mathematica, etc. Non GUI applications include console tools and servers.

Qt is primarily based on C++ with several non-standard extensions. That is Qt was built by modifying the traditional C++ so as to achieve easier GUI programming. It uses an additional preprocessor that converts this code into standard C++ code before compilation.

Notably, Qt isn’t restricted to UNIX, it is also extended to various platforms such as Windows (98, NT, ME, 2000), Macintosh (Mac OS X). Further, Qt can be used in several programming languages such as Ada (QtAda), C# (Qyoto), Java (Qt Jambi), Ruby (RubyQt) and several others. Qt is also available for embedded systems such as cell-phones, PDA’s and others under the name of Qtopia.

Coming to the working of Qt, Qt uses the native APIs of the underlying platform so as to draw the Qt controls, achieving platform independence. It also offers SQL database access, XML parsing and threads management.

Further a new concept was introduced to C++ on a whole, which was that of intercommunication, under the name of Signals and Slots. This was possible with a tool known as the Meta Object Compiler. This tool handles the mechanism of signals and slots, run-time type information and dynamic property system. However this concept has been greatly criticized for the absence of type safety.

Qt - UI (User-Interface) Designing

Technically UI design refers to the design of computers, applications and websites with the focus on the users experience and interaction. There are several tools for UI design.

  • Windows API specific to only Microsoft Windows. This is achieved by primarily including “windows.h” and using its functions to create windows
  • Java and Swing. The Swing package of Java can be used to create any UI required. However the entire Swing package is based on Java, and to run any of these windows, a JVM is required

Coming to UNIX, several toolkits have been designed for the X Window System. The most popular of them being -

  • GTK+, standing for “The GIMP Toolkit” - Examples of applications using this is the GIMP, Terminal and others
  • Qt, pronounced as cute

The KDE desktop environment is built on Qt. And the GNOME (GNU Object Model Environment) desktop environment is built on GTK+.

Wednesday, July 23, 2008

VirtualBox

VirtualBox is an x86 virtualization package originally created by Innotek, and now being developed by Sun Microsystems.

VirtualBox helps us to load and run an operating system on an existing operating system. The operating system on which VirtualBox is installed is called the host OS, and the OS running on the host with the help of VirtualBox is called the guest.

For example, consider a machine with the Windows XP operating system loaded on it, VirtualBox can be installed on this, and another OS, such as Fedora or Solaris can be loaded via the VirtualBox. Here Windows XP is the host OS and the other OS (Fedora, Solaris) becomes the guest.

A free copy of VirtualBox can be downloaded from here.

Further VirtualBox manages the guest OS on the host OS using the concept of a Virtual Machine. Well here comes the tricky part, any OS requires primarily three things.

  • A Processor to run the various tasks
  • A memory unit, commonly known as the RAM
  • Some storage space, basically available on the hard disk

Whenever a guest OS is installed on a host, the VirtualBox takes care that the guest receives these three resources whenever the OS runs.

VirtualBox manages the processor, without any user-interference, however coming to the RAM and the Storage Space, user discretion is required, as we will be seeing a little latter.

Steps for starting up a virtual OS

Create a new VM using Machine->New or the New icon available on the screen.

Follow the wizard, which will be first asking for the name and type of the OS being installed, this will entirely depend on guest OS which you will be installing.

Next the amount of RAM to be reserved for the operating system will be asked, this will depend on your machine and how much you would like to spare.

Remember! The RAM which is reserved here will not be available to the host, when the guest is running. That is if you reserve 512 MB from a 2 GB RAM, the available RAM to the host will be only 1.5 GB as long as the guest is running, however this will be returned once the guest is closed.

Caution!!! Your host will also be requiring memory while the guest is running, never lower the RAM for the host significantly, this will lead to insufficient memory for the host, and as a result it might lead to errors.

Now comes the best part that VirtualBox has to offer. It allows us to create a virtual hard-disk, more specifically reserve some space on our hard-disk for the guest OS. Here an *.vdi image will be created at the specified place.

Here an existing *.vdi can be mounted by clicking the Existing button and then adding it to the list via the Add button and then Select it.

Or a new *.vdi image can be created by clicking the New button. The wizard will ask you whether a static image or a dynamic image is to be created. A static image is one where the entire memory is allocated at one go, whereas on the other a dynamic image is one where a maximum amount is specified, but the size increases as the data is added onto the guest OS. For example consider 25 GB is allocated for the guest. In static the entire 25 GB will be a single *.vdi image, where as in dynamic the basic installation will take some space, and latter as files are added the size will increase.

And don’t forget to mention where you want the image to be, otherwise it will written onto a default directory. Here dynamic memory occupies only required amount of space, and is beneficial if you a normal user and if you are not sure how much you will using, as the host will lose the space which is not being used by the guest if created statically.

Once you finish this you will taken back with the new hard-disk selected. Finally click Finish, and you will be able to see your image on the left-hand side of the screen. Now right-click the image on the left and select Start, or left-click and click the Start button.

Next it will ask you for the media type, where you can you either give an *.iso image or a CD/DVD/Floppy to load from. And then continue the regular process of installing the Operating System.

Once the installation is completed, you can turn on the guest OS by starting it as told above, and shut it down normally as done in that OS.

Important Tips after Installation

Once the VM is setup, the RAM occupied can be changed by right-clicking the image on the left hand side, and selecting Settings and changing the RAM accordingly. You can change the focus of the mouse and the sensitivity of the keyboard from the guest to the host by using the right-ctrl key.

The next important thing is to establish a connection between the guest and the host. This is done primarily by creating a shared folder. Before we create a shared folder, certain software called the VBoxGuestAdditions is to be installed. This is done by starting the OS, Devices->Mount CD/DVD-ROM and select VBoxGuestAdditions from the drop down menu, it is present there by default, otherwise search for it on your host. Immediately you will a CD available on your guest and install the appropriate executable for your guest. Next go to Devices->Shared Folder, add the folder to be shared between the guest and host to the machine folders. Then click Ok. That’s it, a shared folder is created. Search for it on your guest and you will find it in no time. For Example a shared folder in a UNIX type OS will be available in /mnt of the root. However this might vary from guest to guest.

Another way of achieving connectivity is via a pen drive. Once the pen drive is connected it will be automatically detected by the host. To gain access of the USB drive from the host, firstly go to the Settings menu of your guest OS. There from the USB tab Enable USB Controller. Now filters may be added for easy recognition of the USB drive. Now start the VM. From the Devices->USB menu, select the required USB drive, the required drivers will be installed on the host the first time it is done, and the USB drive will be available on the guest after some time. The USB drive may be removed from the guest by going back to Devices->USB and deselecting the USB.

I think these points are sufficient for a beginner to VirtualBox, however more advanced features can be easily explored by putting in a little effort.

Tuesday, June 10, 2008

Java 2 Micro Edition - Conclusion

The Good

J2ME is small, actually very small; writing programs for devices with very limited memory capabilities has been made into a reality by J2ME. J2ME allows the programmer to customize his program to the utmost possibility, right from the configuration he wants to work with to the very profile he is using.

Further, the future versions of the KVM will have the capabilities of integrating the present programs with further memory hungry operations.

The Bad

The very strength of J2ME is its biggest weakness. In order to make the KVM small, a lot of compromises had to be made in the Java language itself. Writing complex programs for J2ME requires higher skill and technique than writing one for computers and servers.

Further because of the configurations and profiles, the basic fundamental principle of portability had to be compromised. That is, a program written for a particular profile is portable with other devices following the same profile.

Future Of J2ME

J2ME is still in its blooming stages, and definitely the platform will be evolving. Many more configurations and profiles will be introduced. Further several technologies, such as Jini (network architecture for distributed systems), will arise with the help of J2ME, improving the capabilities of the mobile devices. Needless to say there will be many more devices following the J2ME technology in future.

Java 2 Micro Edition - Case Study

Extending one’s knowledge of Java to J2ME is very easy. Every program in J2ME is called a midlet and extends from the midlet class. Here is a sample program in NetBeans using the CLDC configuration and the MIDP 2.0 profile.

As evident from the screen-shots, the constructors in both the programs are very much similar. A few differences exist in the both such as the import statements in J2ME where two packages - midlet and lcdui are imported. Further an alert object is constructed to display the message.

Three important functions are present in every J2ME program. They are -

startApp Called whenever the application is started
pauseApp Called whenever the application is paused
destroyApp Called whenever the application is terminated


Java 2 Micro Edition - Profiles

A Profile primarily defines the type of device supported. Profiles are built on top of configurations, since they are specific to the memory available. They add an additional layer on the top of the configuration layer providing APIs for a specific class of devices.

Profiles are specific to the configurations selected. For different configurations, different profiles are available.

CDC Configuration

For CDC configuration, a foundation profile is available, which is primarily a skeleton profile over which we can create our own profile.

CLDC Configuration - MIDP, KJava And Doja

For the CLDC configuration, predefined profiles such as MIDP, KJava and Doja are available. The KJava profile is one of the popular profiles for the Palm OS. It consists of Sun specific APIs. Further it's not a standard J2ME profile.

The Doja profile is another popular profile, though not widely used in our mobiles; it is a rapidly growing profile, because of its simple user interface and as it easy to understand. This profile is popularly used in Japan for their local cellular phone companies. However its influence on the entire mobile network is still a long way ahead.

The most popular profile used these days in the Mobile Information Device Profile (MIDP). It is mainly based on the CLDC configuration and is widely used in cellular phones and pagers. Currently there are two versions of MIDP that are available for programming - MIDP 1.0 and MIDP 2.0. Mainly the differences between these two profiles are the fact that the MIDP 2.0 has extended features when compared to MIDP 1.0 such as audio and 2D gaming. On the other hand MIDP 1.0 has greater portability when compared to MIDP 2.0. Many of the cellular phone brands such as Nokia, LG, Samsung, and Motorola use these profiles.

Java 2 Micro Edition - Configurations

Configurations define the basic run-time environment as a set of core classes. They add the classes required for the program to be compatible with the virtual machine.

J2ME has two main configurations – Connected Limited Device Configuration (CLDC) and Connected Device Configuration (CDC). These configurations actually specify the main type of the device, which defines how much memory is available for the operations to be performed.

CLDC requires less memory whereas CDC requires at least 2MB of memory to perform its computations. The CLDC configuration consists of classes and a set of libraries more specific to the mobile devices. The CDC configuration is basically a stripped down version of J2SE with the CLDC classes added to this.

The CLDC configuration is supported by KVM and the CDC configuration is supported by CVM. Configurations decide whether optional features such as multi dimensional arrays, threads, JNI and others have to be included or not.

CLDC configuration is used when the memory available is low, such as the case of PDAs and cell phones. CDC configuration is used when the memory available is more than 2MB but less than that available on our computers, such as the case of set-top boxes.

Java 2 Micro Edition - Virtual Machines

A virtual machine is the immediate layer overlying the operating system and is mainly responsible for running any program written in Java. This is the main reason that codes written in Java are highly portable. The virtual machine interprets the Java byte-code and converts into native system calls. Further as every program runs in the confinement of the virtual machine, no penetration is possible into the operation system, reducing the risk of viruses.

J2ME offers two different virtual machines, namely CVM (for higher end mobile devices) and KVM (for lower end mobile devices). CVM is used for devices which have higher memory capabilities and which are closer to computers whereas KVM is used for devices which have lower memory capabilities, such as mobile phones. KVM and CVM are primarily nothing but the subset of JVM. They can be thought as just shrunken versions of the JVM and are more specific to J2ME.

Java 2 Micro Edition - An Overview

Mobile devices have become a part and parcel of almost everybody’s life. By mobile devices, we don’t mean just our cell phones, but also devices such as pagers, personal digital assistants (PDA’s) and small retail terminals (devices such as set-top boxes).

To use these devices more effectively and more efficiently, programming was introduced into these devices. Every mobile device has a basic operating system which co-ordinates the various tasks to be performed by the device itself. Examples of these operating systems are the Symbian operating system, Windows operating system, Linux operating systems and many others. Many of the primitive models had a PROM built in them, instead of an operating system, so as to start the mobile device without any hassles.

Different file formats have been developed for these mobile devices. Many of these are basic extensions of a high level language so as to perform properly even at the availability of less memory. Examples of this are the *.sis and *.sisx file formats which are basic extensions of C, *.jar and *.jad which are basic extensions of the Java 2 Standard Edition.

Bringing J2ME Into The Picture

One of the popular languages used in the development of these mobile programs is Java, more specifically the Micro Edition of Java called J2ME. As known, Java is divided into three segments J2SE, J2EE and J2ME, while the former two are used for servers and higher end computers, J2ME is used for mobile devices.

At first J2ME was intended as a platform for game development, but now-a-days J2ME is used for developing almost every kind of application. Following the fundamental principle of Java, J2ME also follows the principle of "Write Once Run Anywhere (WORA)" to a large extent. Also the security of these programs is high as it runs in the confinement of the virtual machine itself. Further the possible users of this technology are estimated to be very high, making it popular as a whole.

J2ME Architecture

J2ME runs mainly on virtual machines, which actually runs the Java byte code on the device. Before the implementation of any byte code, every program written in J2ME should specify its configuration and its profile. They are layers immediately above the virtual machine layer, as shown in the figure. These layers form the very bone structure of the J2ME program and selecting these layers properly in the key of writing a suitable program for a particular device. The first and foremost layer is the Operating System layer which co-ordinates the tasks of the entire device itself.