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.

Wednesday, October 03, 2007

Hidden Files Not Shown

This is another problem associated with the w32.USBWorm seen in the previous post. Sometimes this problem occurs even independently, without any association to the mentioned virus. This is basically due to a wrong registry key value.

The following steps have to be taken so as to restore hidden files and folders.

  1. Go to Start > Run, then type Regedit
  2. Navigate to the registry folder HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL
  3. Find a key called ChekedValue
  4. Double click CheckedValue key and modify it to 1. This is to show all the hidden files

Now you should be able to view all the hidden files, and also to alter its status from folder options.

Removing Orkut Hater - w32.USBWorm

I don't hate Mozilla but use IE or else
Use Internet Explorer U Dope
Orkut is banned you fool, The administrators didn't write this program guess who did?? MUHAHAHA!!

These are not any statements to encourage the use of IE or defame Orkut, but the indications of a virus infected machine, yes Virus. This virus is basically a malware named as w32.USBWorm and spreads primarily through pen drives. Well on the brighter side, this virus is a decent one and does not affect any of your files or damage your system.

Now coming to its removal, unfortunately many of the anti-virus software today are not in a position to detect this virus. So it has to be removed manually, the following steps have to be followed for its removal,

  1. Press CTRL+ALT+DEL and go to processes tab
  2. Look for svchost.exe under the image name. There will be many but look for the ones which have your username under the username
  3. Press DEL to kill these files. It will give you a warning, Press yes
  4. Repeat for more svchost.exe files with your username and repeat. Do not kill svchost.exe with system, local service or network service!
  5. Now open My Computer
  6. In the address bar, type C:\heap41a and press enter. It is a hidden folder, and is not visible by default
  7. Delete all files here
  8. Now go to Start --> Run and type Regedit
  9. Go to the menu Edit --> Find
  10. Type "heap41a" here and press enter. You will get something like this "[winlogon] C:\heap41a\svchost.exe C:\heap(some number)\std.txt"
  11. Select that and Press DEL. It will ask "Are you sure you want to delete this value", click Yes
  12. Now close the registry editor

Now the virus is gone. But be sure to delete the autorun.inf file and any folder whose name ends with .exe in the pen drive.

Thursday, July 05, 2007

Download Your Favorite Videos

Every day, we see thousands of videos being uploaded in many of the video hosting sites like Dailymotion, Youtube, Veoh. These sites are very interesting as there is something in every genre - Science and Technology, Gaming, Music.

In fact any video can be found with a proper search. However a small problem exists with these videos, they can be seen but cannot be downloaded straight from the website as there is no download facility in most of these sites. So the storage of our favorite videos is not possible. But as usual, there is always a solution to a problem.

Let me explain this with an example. Consider this video, It is from Dailymotion from the games genre. It is the preview of the latest Need For Speed game - The Prostreet (I know I can embed the video here, but I want you to go to the original site).

Now, you can see the video being buffered so that it can be viewed; scroll down a bit in the page. Here two important links will be given. One is the permanent link and the other is the embeddable player. The embeddable player code can be copied into an html page for the video to be embedded onto the webpage. However we are aiming to save it on our system. This is now possible with a few websites that help us to download video content. A few of them are KeepVid, ClipNabber.

Consider I am downloading from ClipNabber. I paste the permanent link in the space given there, which is right below the logo and click the download button. Now scroll on the same page a bit, and just after the logo you will find a "download link" button. Click on that and select save, select the folder where it is required and the job is done. The video will be stored in the computer. Whatever maybe the format of the downloaded video, change the extension of the file to .flv. You will need Flash Player to play files with this format.

Better players can be found with a little bit effort. The beauty of the flv format is its small size, that is in this example 45 seconds of video was only of about 1.5 MB, which is very less when compared to other formats. This video can be converted into other formats with the help of video converters also if required.

This solves a large part of our initial problem, but not the entire problem. That is because this works with videos that are available directly without any registration. Now what if a registration is required, we cannot use any of these sites for download. Generally registration is required for some websites and a few videos of the above-mentioned sites. However this problem was solved by the latest version of Real Player that was released. This player can download video that can be watched by us. For example, if there was a video which can viewed only after registering, all we have to do is register and go to the video, immediately a small pop up will appear above the video saying "Download this video using Real Player". Click on this and the video will be downloaded on to the system. However Real Player 11 is still a beta version and its limitations cannot be told yet.

Before I conclude this article, I would like people to know that this article is not for supporting piracy, but only for videos which have proper rights. After all an original will always be an original.

Have fun!