Saturday, December 20, 2014

IntelliJ Plugin Development Tutorial - Hello World Plugin

This is a very simple example plugin for IntelliJ IDEA plugin development. You can create this plugin in less than 10 minuets.
This plugin creates a menu bar item called "Hello World". Under that there is an option called "Say Hello". When you click on that option you will see a message window.

Following are the two files you should work with.

When you click on the action item "Say Hello" the method called actionPerformed is executed and the message will be displayed.

Following are the GitHub URL's for complete plugin project. You can clone the project or downolad the project as a zip file. To run the project open IntelliJ IDEA and import the project.

GitHub repository URL -
GitHub HTTPS clone URL -
Download Project as a Zip -

Sunday, October 5, 2014

Android USB Debugging in Huawei Tab

If you are writing android applications you may definitely do USB debugging. In case you don't know the the term, USB debugging (On-device Developer Option) is using a real android device to debug your android application by connecting it through USB port.
In this blog post i am going to explain you how to use your Huawei android tab for USB debugging. I have tested this with a  "Huawei Mediapad 7 Lite".

On Android developer guide it has been mentioned that we have to install USB driver software for this, but you may not able to find the relevant driver software for Huawei.
In our case, more interesting thing is you don't want to bother for finding driver software. Lets do this step by step.

1. Declare your application as "debuggable" in your Android Manifest.
If you are using Eclipse, this may have been automatically declared. Otherwise go to AndroidManifest.xml and add android:debuggable="true" to the <application> element.

2. Enable USB debugging on your device.
Go to Settings > Developer options. (For  Android 3.2 or older Settings > Applications > Development)
Developer options is hidden by default on Android 4.2 and newer. To un-hide it, go to Settings > About phone and tap Build number seven times. Then go back to the previous screen to find Developer options.

3. Plug your device to your PC using the USB cable.
The device will notice you that you have connected the dive to the PC.

4. Click on the notification bar of the device (Where are time/battery/signal information are). On the pop-up menu you may see the USB connection type. Probably it would be "Connected as a media device".
If you have properly activated the USB debugging mode, it may also be shown as "USB debugging connected".

5. Click the "Connected as a media device" option (Or any other "Touch for other USB option" menu item). You may be navigated to a "Connect As" menu in the Settings > Storage menu.
There select the "HiSuite" option. You will be notified the action. Your device UI will change to HiSuite UI.

6. Now move to your PC. Navigate to the device from the PC file browser (If you are using Windows OS go to Computer > HiSuite in removable storage category).

7. There you may find the HiSuiteSetup.exe file and double click and install the software.

8. Once it is installed, you are done!

9. Remove the device and plug the device again. Make sure you have connected the device as "Connected to HiSuite". The HiSuite software will automatically start-up on your PC.

You can verify that your device is properly connected  by executing adb devices from your Android SDK platform-tools/ directory.

Following is the UI of the HiSuite PC software. Using this software you can do many things related to your Huawei Android device (Not only USB debugging).

Saturday, August 23, 2014

Share Laptop Internet Connection With Android Device

Without using any software you can simply crate a wifi hotspot in Windows.

1. Open command prompt with administrator privileges. (Right click -> Run as administrator).

2. Enter following command to create the connection.
netsh wlan set hostednetwork mode=allow ssid=MyWifiName key=myPassword

Here you can give any values for 'ssid' and 'key'. ssid will be you wifi connection name and key will be the password.

3. Enter following command to start the network.
netsh wlan start hostednetwork

Make sure you have turn on wifi on your laptop. Otherwise you will be getting a message like following.
The hosted network couldn't be started.
A device attached to the system is not functioning.

When everything is properly configured, your command prompt would look like following.

4. Now open the "Network and Sharing Center" (Click internet connectivity icon on the task bar and open Network and Sharing Center or Go to control panel and click network and internet related options).
Click the "Change adapter setting" option in right hand-side of the window.
There you will see all your network connections also with our newly created network connection "MyWifiName".

5. This step is very impotent. Right click on you current internet connection icon (not on your MyWifiName icon). Click on the "Sharing" tab in the window you are getting. There tick the option "Allow other network users to connect through this computer's internet connection".
Then select your newly created MyWifiName connection as the "Home networking connection" in the drop down. There you won't have the name MyWifiName but the title name related to that connection. You can get that title name from Change adapter setting window. Click ok button.

6. Now you are done!

Turn on your Android or any device and connect to MyWifiName wifi hotspot using the password myPassword.

To turn off the network you created, enter the following command

netsh wlan stop hostednetwork

Monday, May 5, 2014

Simple Android Client-Server Application

This is an android application which sends a text message to a server. When you press the send button, the application sends the message in the text field to the server program. Here the program been written so that the client runs on the Android emulator and the server runs on the local host. IP address  can be used to connect to the local host with Android. Server program is continuously listening to the port 4444. When an incoming message arrived, server read it and show it on the standard output.
This tutorial is based on Android 4.4 (API Level 19 - KITKAT) version.

Following are the source codes of main components.

Android Text Client Application


activity_slimple_text_client.xml (res/layout/activity_slimple_text_client.xml)

Java Sever Program

Following are the both Android client and Java server complete projects. You can clone or download them as zips from Git-Hub.

Git-Hub HTTPS clone URL:
Git-Hub Repository URL:
Download as a Zip:
You can run the projects by importing them to the IDE. Or just create you own project and copy and paste above source files.

Tuesday, April 22, 2014

Start-Up, Shutdown or Restart the Tomcat Server Using an Ant build.xml

Following Ant build script can be used to start, stop or restart your Tomcat server. First you should set the property "tomcat.home" to your Tomcat home directory. Then when you just execute the "ant" command, it will restart your running server.
Here are all the commands you can use with this script.

Start Up:    "ant tomcat-start"
Shutdown:  "ant tomcat-stop"
Restart:      "ant" or "ant tomcat-restart"

Depending on the web application you are running, you may be getting an Out of Memory PermGen space error. If so, remove the comment marks and enable jvm argument <jvmarg value="-XX:MaxPermSize=256m"/> in the script (line 16).