Friday, June 29, 2012

How to Install Apache Ant

Its really simple.
1. Make sure you have java environment installed in your system.
2. Download Ant binary distribution form here.
3. Uncompress the file downloaded.
4. Set the environment variables.
         Click new button to add new environment variable. Type "ANT_HOME" as the variable name and give the path of the directory where you uncompress Ant as the value. Then edit the path variable. For Windows add %ANT_HOME%/bin and for Linux add ${ANT_HOME}/bin to the value value of the path variable. At the end the value of the path variable should be shown like this. C:\Program Files\Java\jdk1.6.0_22\bin ; %ANT_HOME%/bin.
5. Click OK and save all the changes.

Now your are ready to use Apache Ant.
You can make sure that Ant is installed correctly by executing the command 
ant -version in command prompt. If it is installed correctly it should show the version information of Ant distribution. 

Friday, June 22, 2012

Apache Ant - Java-Based Build Tool


                  Apache Ant is a powerful Java-based build tool which automates the building process of a project. Mainly Ant is used to build Java applications. But It supports many program application like C, C++, Python etc. Ant can be used to many purposes. If we want to get the results of several programs which is written and executed in different languages we can use ant to do that.
                 We can configure Ant project by using "build.xml". "build.xml" is normal xml file. There we can define all the tasks, properties and variable which are used in the build process. Ant has lost of free defined tasks. Also We can define our own task.
                  After preparing the build.xml file we can simply execute "ant" command in command prompt of terminal. Then it builds the project.
                  Ant support both Windows and Linux platforms. You cant download the binary distribution of Ant form here. For more information you can refer the Apache Ant Project Site.
I hope to bring you series of post about Apache Ant.

Tuesday, May 22, 2012

Brightness Changing Algorithm - Image Processing Basic

There are many libraries which are used to Image processing applications. But the algorithms behind these libraries use basic mathematical operation. I hope to bring you series of blog posts which describe the fundamental image processing algorithms implemented in mathematical operation without using any library. Following java class change the brightness of an image.
We should input our image to the method changeBrightness as a BufferedImage. increasingFactor is an integer which determine the brightness level of the image. Positive values will increase the brightness while negative values decrees. Range of the increasingFactor should be between -255 to 255.

Original Image
Brightness Increased
Brightness Decreased

Friday, March 30, 2012

Android Application to Send a File to Remote Server

This simple Android application sends a file to a remote server. In this example code server runs on local host. When the Send button is clicked the file is sent to the server.

Android Client Application
Server Application

Thursday, March 29, 2012

Simple Client-Server Application for Android

Note: Here is the updated tutorial of the following tutorial for the latest Android version: 

Following tutorial is based on Android 2.3 (API Level 10). It is not compatible with later versions since API Level 11 introduced AsyncTask implementation for network communication. Refer the above link instead for working solution. 

This application is a simple client-server application which has a Android mobile client and a Java server which is run on a machine. In this example, client is run on the Android emulator and the server is run on the local host. In Android is the IP address for local host. This application allow to type a text message on a text field and when the Send button is press the message is sent to the server. Server continuously listen to the port. When there is a incoming message server read it and show it on the standard output.

Client Side Application

Server Side Application

Friday, February 10, 2012

Roman Number Converter - Java Program

This is a simple Java program to convert Roman numbers to Hindu-Arabic numbers. This Java method "convertRomToInt()" gets the Roman number as a string and converts it in to corresponding Integer value.
Even though this program seems simple, the algorithm is bit complex. When we convert a Roman number to Hindu-Arabic number manually, we do it in the following manner.
MCMXLIV = 1000 + (1000 − 100) + (50 − 10) + (5 − 1) = 1944
Value of each number is added together. When smaller values precede larger values, the smaller values are subtracted from the larger values, and the result is added to the total.
This algorithm use above technique to the conversion. "for" loop gets each character of the roman number string from the beginning and gets its integer value from the "getInt()"  method. At each iteration character is compared with the next character value. If the next character is the same, the value is added to mediator to add in the next iteration. If it is large, the value is added to mediator to subtract in the next iteration.

Saturday, January 7, 2012


                Today I am going to discuss about something which you are really familiar. If you are using any wireless modem or mobile phone you may have used these words. But most of the people don’t have a clear idea what those technical acronyms stand for even though they frequently use it.

Global System for Mobile Communications (GSM) is a digital cellular phone technology. This includes set of standers to support the 2G digital cellular networks. 2G is the replacement of first generation analog cellular networks. GSM operates with TDMA (Time Division Multiple Access) technology based on circuit switching network. TDMA technology interleaves multiple digital signals on to high speed data channel. GSM supports voice calls and data transfer (SMS) speed up to 9.6kbit/s. Today GSM networks have spread over 218 countries worldwide and it allows the international roaming capability.
Mobile phone or any device which supports GSM technology includes a SIM (Subscriber Identity Module) card. This smart card has programmed so that it contains the details of the user account information.

General Packet Radio Service (GPRS) is an improved data service in GSM networks. GPRS added a packet data transfer capability to circuit switched GSM networks. GPRS enables data rate up to 40 kbit/s. MMS, instant messaging and WAP are few services are offered by GPRS technology. 2G cellular technology together with GPRS is sometimes called 2.5G which described as a transition of 2G to 3G mobile telephony.

Enhanced Data rates for GSM Evolution (EDGE) is a further enhancement of GPRS and GSM network technologies. EDGE is four times efficient than GPRS technology. GPRS uses four coding schemes (CS-1 to 4) while EDGE uses nine modulation and coding schemes (MCS-1 to 9). The normal data rate of EDGE is 40-50 kbps per timeslot and maximum is 40-50 kbps per timeslot. EDGE technology supports both circuit and packet switching techniques. EDGE technology can provides all the capabilities of the GPRS and directly map with the structure of the GSM network. Therefore EDGE is called backward compatible technology. No any changes are required for the existing GSM network for use of EDGE except the installation of EDGE transceiver at base stations. EDGE is only a software upgrade with GSM technology. EDGE cannot work without GSM technology, because EDGE networks are built upon the GSM networks. EDGE has all the requirement for the 3G standers and it is accepted as a 3G network technology.

Wideband Code Division Multiple Access (WCDMA) is a third generation (3G) cellular network technology. This technology has much higher data speed than the previous technologies which has described above. The data rates of the WCDMA technology are 2 Mbps for local area networks and 384 kbps for wide area networks. Even though it uses the same cored network as the GSM/GPRS/EDGE, WCDMA transmits on a pair of 5 MHz wide radio channels. WCDMA works with both frequency division duplex (FDD) and time division duplex (TDD). WCDMA provides mobile multimedia services such as music, tv/video image and internet access in addition to the voice, text and MMS services.

High Speed Packet Access (HSPA) is a mobile wireless technology which represents the 3.5G family. HSPA is a combination of HSDPA (High Speed Downlink Packet Access) and HSUPA (High Speed Uplink Packet Access)  technologies. HSPA uses FDD transmission scheme. HSPA rates are 1 to 4 Mbps and HSPA uplink speeds are 500 kbps to 2 Mbps. But theoretically peak speed of downlink is 14 Mbps and the peak speed of uplink is 5.8 Mbps in a 5 MHz channel. HSPA is backward-compatible with UMTS, EDGE and GPRS. Besides the speed the advantage of the HSPA is the low cost of transmission for a data unit.