Showing posts from 2011

World's cheapest Aakash tablet at a price of 2500/- INR each

Datawind, the maker of the world's cheapest tablet has put up for sale about 30,000 tablets online at a price of Rs 2500 each, with a delivery period of seven days.

Link: or

Detailed specifications of Aakash and UbiSlate 7 tablets are as follows:

I have pre-ordered UbiSlate 7 (The upgraded version of Aakash) which is due in late January. Above table does not show UbiSlate 7 tablet screen size but in pre-book mail confirmation from Datawind it shows size as 7" inch. See the following snippet of the mail I received from Datawind today:

The product features are:
    7" Android 2.2 Tablet at an Unbeatable Price of Rs. 2999
    Monthly internet charges: Rs.98 / 2GB
    High Quality Web Anytime & Anywhere
    Multimedia Powerhouse
    Full sized-USB port & Micro-SD slot and much more.

In the mail It shows Android version of tablet as Android 2.2. On official site ( Andriod version of U…

Getting started with R statistical language

R is a programming language and software environment for statistical computing and graphics. The R language is widely used among statisticians for developing statistical software, and R is widely used for statistical software development and data analysis.

Recently, I started reading about R. I found following resources mentioned in references section to learn R. I was particularity interested in R with GPU and R with Hadoop. I will update this post again once I am ready with some good examples of R + GPU and R + Hadoop. It would be even better if I can make an example use case with R + Hadoop + GPU.

R with GPU computing:

Recent advances in consumer computer hardware makes parallel computing capability widely available to most users. Applications that make effective use of the so-called graphics processing units (GPU) have reported significant performance gains.

One of the most affordable GPU available is NVIDIA’s CUDA. Incidentally, the CUDA programming interface is vector orient…

How to get address bar appear again in Android 3.2 tablet browser?

Recently, I was testing one app on Motorola Xoom Android 3.2 (Honeycomb) tablet. I noticed address bar from top of the screen disappeared. I was unable to enter new URL and navigate to it. After bit of investigation, I found out that there is a hidden menu in android browser which appears if you hold the finger of the screen on left or right side then one semi circular menu appears which shows all the browser menu options like refresh, bookmarks, setting, etc.. 

If you still need address bar on top of the screen all the time then just restart you tablet. That fixed the issue for me.

I am still not sure what caused my address bar to disappear in first place but at least I have a work around now. Please tell me what you think about the post or if you have anything else to add.


How to use HTML5 local store?

I have prepared a small example which show how to use HTML local storage feature. The concept is similar to cookies, but it’s designed for larger quantities of information. Cookies are limited in size, and your browser sends them back to the web server every time it requests a new page which takes extra time and precious bandwidth.

<!DOCTYPE html>

function putInLocalStore(){
    localStorage.setItem("comments", document.getElementById("comments").value);

function getFromLocalStore() {
    var data = localStorage.getItem("comments");
    var comments = document.getElementById("comments");

    comments.value = (data != "") ? data : "";

function pageOnLoad(){

    <body onLoad="pageOnLoad();">
        Enter data to put in local store: <input id="comments" type="text" >

What are new features in Java 7 or JDK7?

I was looking at all new features of Java 7. List of features include to simplify common, day-to-day programming tasks: Strings in switch statements, try-with-resources statements, improved type inference for generic instance creation ("diamond" or "<>"), simplified varargs method invocation, better integral literals, improved exception handling (multi-catch), and my favorite feature fork-join framework. I found many blog posts mentioning them. I developed following simple examples to demonstrate all new JDK7 features. Click on following links to see the example code and its detailed explanation:

JDK7 feature's list of examples:
An example of new feature in JDK 7 which can do type inference for generic instance creation.Try-with-resources statementString object is allowed in switch-case statementCatch multiple exceptions in a single catch block & more precise exception re-throw exampleExpress literal values in binary with prefix '0b' (or '…

Getting started with Android application development

Many Java developers have shown their interest in Android application development but they don't know where to start. Few are planning to join Android training in some training institute. I advice not to do that. Internet is your best teacher. That is the way, I started learning Android.

Following are few links which I started reading to understand Android platform. These links will give you good idea about Android basics and help you setup Android development environment using Eclipse IDE:

Why do I get missing "use strict" statement error when I run my java script code through Crockford's JSLint?

Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a "strict" operating context. This strict context prevents certain actions from being taken and throws more exceptions. Strict mode helps out in a couple ways:
It catches some common coding bloopers, throwing exceptions.It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object).It disables features that are confusing or poorly thought out.Also note you can apply "strict mode" to the whole file... Or you can use it only for a specific function. Conclusion is it helps you make fewer errors, by detecting more things that could lead to breakages.

You can also look at article about that : John Resig - ECMAScript 5 Strict Mode, JSON, and MoreYou can try JSLint (The JavaScript Code Quality Tool) online by visiting: looks pretty interesting too: http…

How to use web database feature of HTML5? HTML5 + Web Database + Java Script + Android + Chrome

I have created a HTML5 sample which demonstrates how to use web database.

In following sample, jquery and jsapi are being downloaded from internet on the fly at run-time. So make sure you have internet connection when you test the sample. Otherwise, you can download both jquery and jsapi from source and copy them in some local folder then load jquery and jsapi scripts from local folder.

HTML5 web database sample is as follows:
<!DOCTYPE html>
    <title>Offline Contacts Store using HTML5 Web Database</title>
    <script src=""></script>
      google.load("jquery", "1.4.1");
      var db = window.openDatabase("contacts", "", "contacts", 1024*1024);

      if (db == null) alert ("Database not found DB: " + db);

      function insertRecord(number, name, email) {

How to run HTML5 app from Android app? Android + WebView + HTML5 + Java Script + Web DB

I was trying to make HTML 5 sample run from Android app. I was trying to use local database feature of HTML 5 app which works well with my Android 2.3.3 version device.

Following code worked for me:

WebView webview = (WebView) findViewById(;

webview.setWebChromeClient(new WebChromeClient() {
public void onExceededDatabaseQuota(String url, String
databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(estimatedSize * 2); // try to keep quota size as big as possible else database will not get created in HTML 5 app

WebSettings settings = webview.getSettings();

String databasePath = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();

Issue: I was using following java …

Getting started with MonoCross

What is MonoCross?

MonoCross is a C# .NET Model-View-Controller (MVC) framework where the Model and Controller are shared across platforms and the View is implemented for every specific platform and/or target architecture. It allows the development of both native and HTML5 web apps that share business logic and data code.

MonoCross is based on a modified Model-View-Controller pattern that enables separation of the presentation layer, (View) from the application code (Model + Controller). This modification enables portability of application code across multiple platform targets.
Source code and solution files for the MonoCross pattern, and the Best Sellers sample. Includes container projects for Windows Console, Mobile WebKit, iOS*, and Android^
*iOS projects require MonoTouch and MonoDevelop, all other platforms can be developed in Microsoft Visual Studio.
^Android projects require Mono for Android and Visual Studio Professional 2010.

Although MonoTouch and MonoDroid use the same langua…

How to enable internet access from Android emulator using proxy?

I was able to access internet in the past from Android 2.2 emulator but suddenly it stopped working. Problem was, I was behind firewall and I had to access internet using proxy server. I searched for solution and I found following command which worked for me.

Go to "<android-sdk-home>" directory and go to tools folder from command prompt.Type command: emulator -avd -verbose -http-proxy http://host-id:portAbove specified command will start virtual emulator, then I was able to access internet from Android browser.

If you are trying to access internet from any app, make sure you have set following internet access permission in your AndroidManifest.xml:

Android 3.1 has Android Open Accessory Development Kit Support

The Android 3.1 platform (also backported to Android 2.3.4) introduces Android Open Accessory Development Kit support, which allows external USB hardware to interact with an Android-powered device in a special "accessory" mode. When an Android-powered powered device is in accessory mode, the connected accessory acts as the USB host and the Android-powered device acts as the device.

Android USB accessories are specifically designed to attach to Android-powered devices and adhere to a simple Android accessory protocol that allows them to detect Android-powered devices that support accessory mode.

expand »Android Open Accessory support overcomes this limitation and allows you to build accessories that can interact with an assortment of Android-powered devices by allowing the accessory initiate the connection.

For more information, visit link:

Android 3.1 Released

A new flavor of Android is now available at large, namely Android 3.1 Honeycomb, already rolling-out on Motorola XOOM devices as an incremental release.

Android 3.1 Platform Highlights:

The New Features of Android 3.1 and Ice Cream Sandwich:

Android Marketplace coming to Google TV soon:

Stay tuned for more updates.

Run Linux Kernel on CUDA based GPU

KGPU is a GPU computing framework for the Linux kernel. It allows the Linux kernel to directly execute CUDA programs running on GPUs.

The current KGPU release includes a demo task with GPU augmentation: a GPU AES cipher based eCryptfs, which is an encrypted file system on Linux. The read /write bandwidths are expected to be accelerated by a factor of 1.7 ~ 2.5 on an NVIDIA GeForce GTX 480 GPU.

For more information:

The source code can be obtained from, and news and release information can be found at

Getting started with JCrasher - An automatic robustness tester for Java

JCrasher is an automatic robustness testing tool for Java code. JCrasher attempts to detect bugs by causing the program under test to "crash"--to throw an undeclared runtime exception. Although it has the advantage of being completely automatic: no supervision is required except for online inspection of the test cases that have caused a crash. Compared to other similar commercial and research tools, JCrasher offers several novelties:
JCrasher transitively analyzes methods, determines the size of each tested method's parameter-space and selects parameter combinations and therefore test cases at random, taking into account the time allocated for testingJCrasher defines heuristics for determining whether a Java exception should be considered a program bug or the JCrasher supplied inputs have violated the code's preconditionsJCrasher includes support for efficiently undoing all the state changes introduced by previous testsJCrasher produces test files for JUnit--a…

Why do you get Error in opening servicehost. System.ServiceModel.AddressAccessDeniedException?

Error in opening servicehost. System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:MyUri/ . Your process does not have access rights to this namespace. Net.HttpListenerException: Access is denied

I was using Windows 7 (64 bit), Open command prompt with admin privileges and execute following command that fixed the issue for me:
netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user
For more information look at the link:

iPhone and Android smartphones track and store your locations

Got an iPhone or iPad ?
You would be surprised to know that iPho is regularly tracking down your location. What makes the situation more worst and worrying is that is the file is unencrypted and unprotected, and it's on any machine you've synched with your iOS device. Anybody with access to this file knows where you've been over the last year, since iOS 4 was released.

Is it really dangerous? May be not, look at following link for more information:

Android is tracking your location too:
A security researcher has discovered that smartphones running Google's Android operating system are tracking users' locations and storing that data in files on the phone. This news comes only days after it became widely known that a similar file on Apple's iPhone also logs a complete history of users' travels by way of timestamped latitude and longitude coordinates.

Two files called cache.cell and cache.wifi located in the /data…

How to execute service once every day on Android?

I am trying to search for a solution which can help me execute a task every day on Android once on predefined time. I found a link which might help.

I am still working on the solution. Lets hope above link helps.

Why do you get android.os.NetworkOnMainThreadException?

This exception is only thrown for applications targeting the Honeycomb (Android 3) SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it's heavily discouraged. See the document Designing for Responsiveness. See API documentation at below link for more information:


The exception that is thrown when an application attempts to perform a networking operation on its main thread.

How to fix it?

You must either use a handler or a AsyncTask. Check out this site for tutorials (

I used the AsyncTask method. I created a CustomAsyncTask class, Extended AsyncTask class and just put everything inside the doInBackground(String[]) method. Once created, a task is executed very simply: newCustomAsyncTask().execute(...);
It till need to fine tune my logic to work w…

How to remove App from Android Emulator

First,make sure the emulator is running. Then follow below steps:
1. go to tools directory in command
2. adb shell
3. cd /data/app
4. ls (It will display all the .apk installed in your emulator)
5. rm ***.apk(which you want to remove)
6. exit

One more way is to delete the Andoird image file which looks like “userdata-qemu.img” and at can be found in “C:\Users\\AppData\Local\Android”.

The other option is enable “-wipe-data” param in your emulator start up profile.

How to make Android Emulator Run Faster?

I noticed Android emulator startup was very slow. Even after starting, navigating apps was also slow.

I tried following tweaks on Android 3.0 (HoneyComb) emulator to speed up the emulator but above tweaks should work on any android emulator which supports snapshots.

I was looking for the solution and I learnt following few good tricks from Android blogs:
Use this options whilte starting eumlator:
emulator -cpu-delay 0 -no-boot-anim -cache ./cache -avd avd_name

or emulator -cpu-delay 0-no-boot-anim -cache ./cache -scale 0.8-avd avd_nameYou can also use Android Snapshot feature described here.

Or you can follow below steps to enable snapshot feature:
When creating (or editing) an AVD, tick the 'Snapshot enabled' box.The launch dialogue for a snapshot-enabled AVD will offer additional 'Launch from snapshot' and 'Save to snapshot' options.The first time a snapshot-enabled AVD is launched, there is no snapshot data so it will boot normally. Pressing the close butt…

Sharing learnings I had while working on Microsoft Sync Framework 4.0 (CTP)

Recently, I started using Microsoft Sync Framework 4.0 (CTP). I faced many issues in the begining when I was configurating it. There were some basic doubts in my mind about what it can do and what it can not do. Basically, what should I expect from it.

Following are list of questions (FAQs) I had and answers I found from Sync documentation, official forums and blogs:
Does Microsoft Sync Framework 4.0 need to talk to SQL Server directly? Is it possible if I introduce SOA layer between Microsoft Sync Framework 4.0 and SQL Server?yes it needs to. it needs to ask the database server what to sync. if you dont want to use the built-in providers, you can write your own, but then, Sync Fx will still need to talk to your provider and your provider to SQL. the WCF-based sync service already provides a good abstraction to the back-end database such that the client need only know the service and not where and what the database is. How can Android talk to Microsoft Sync framework?No, we just didnt hav…

What is HyperGraphDB?

HyperGraphDB ( is a storage framework based on generalized hypergraphs as its underlying data model. Borislav Iordanov is a creator for HyperGraphDB. It originated from an AI project ( and its power is partly in its data model and in its open-architecture framework.

Two unique features of HyperGraphDB:
Higher-order, n-ary relations are unique to HyperGraphDBOpen-architecture: there’s a very strong “frameworky” aspect to HyperGraphDB, it’s not a black box with fixed, restrictive data-model. The storage layout is open and documented. One can plugin customized indexing, customized type handling, customized back-end storage, customized distribution algorithms etc.A HyperGraphDB database is a generalized graph of entities. The generalization is two-fold:
Links/edges "point to" an arbitrary number of elements instead of just two as in regular graphs. Links can be pointed to by other links as well. Feature Summary:
Powerful data mode…

Getting Started with MongoDB

The name MongoDB comes from "humongous". Its most notable key-features are: FLOSS (Free/Libre Open Source Software), horizontally scalable, very fast, schema-less, document-oriented, written in C++ with native drivers to most programming languages out there e.g. C, C++, C# & .NET, ColdFusion, Erlang, Factor, Java, JavaScript, PHP, Python, Ruby, Perl, etc. belongs into the so called NoSQL category of DBMSs. The way it works is so that it manages collections (the equivalent to tables in RDBMSs) of JSON (JavaScript Object Notation) documents (the equivalent to rows in RDBMSs) which are stored in a binary format referred to as BSON (Binary JSON).

Following is a comparison of MySQL, Oracle, PostgreSQL (DBMSs) with MongoDB (NoSQL):

MySQL, PostgreSQL,...
- Database(s)
- Table(s)
- Row(s)
- Column(s)

- Index
- Join

- Database(s)
- Collection(s)
- Document(s)
- Field(s)

- Index
- embedding and linking

BlackBerry Application Development

BlackBerry is a fun mobile platform to start with and it is based on J2ME. Don't think of mobile app development as something new. Till now you might have deployed web apps on web servers and now you will deploy on black berry simulator. As you are a Java developer you will feel at home with BlackBerry too.

First, decide for which OS or mobile model you are going to development. If not sure then avoid working on latest version of OS (OS 6 is the latest). Reason being whatever is developed in OS 6 will only work with latest compatible phones. Few latest APIs may not work in older phones so make sure you start development using OS 4.7 or 5.0 version.

To start BlackBerry app development you need to do following:

1. Download and install BlackBerry eclipse plug-in and its free. Link: (If you have done already, run sample and see if simulator is working properly)

2. To deploy app on real device you need to pay onetime fee of …

Upload file using servlet

I was looking for easy way to upload excel file from JSP. I came across very good link which contains working example. I had to make few changes in servlet code but thanks a lot for the information provided at the link. See following link for more information.

Title: Servlet File Upload Example