Translate

Thursday, December 15, 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: http://www.akashtablet.com/ or http://www.aakashtablet.com/

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 (http://www.akashtablet.com/) Andriod version of UbiSlate 7 tablet is mentioned as Android 2.3. To confirm the version again I visited official site (http://www.akashtablet.com/) again today but it was down.

Following was the contact information given in Datawind pre-order mail confirmation:

If you would like to channelize Datawind products, then please email us at channel@datawind.com

If this is a media or a press related inquiry, please contact us at pr@datawind.com

If you have any bulk/corporate/institutional related queries, please email us at erp@datawind.com

If you would like to get more details, contact us NOW at 1800-180-2-180

Update1:
UbiSlate 7 tablet specification at official link: http://www.ubislate.com/specifications.html

Following is the screen shot from that site:


Update2:

On UbiSlate home link: http://www.ubislate.com named latest version of Aakash from UbiSlate 7 to UbiSlate 7+. No idea what is the difference between UbiSlate 7 to UbiSlate 7+ because specification remains same.

Conclusion:

I have not seen UbiSlate 7 tablet any where in the market or in any blogs. Only few online blog/news link show some pictures of the device. I am not expecting much from it because cheapest Android 2.3 phone in the market cost not less than 8000/- INR. But this tablet will surely help me test my Android applications.

I will update the blog post again with my review comments of the tablet when I receive it.

Please share your comments below if you have any other information about Aakash or UbiSlate 7 tablet.

Tuesday, November 29, 2011

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 oriented, and fits perfectly with the R language paradigm.

R will not deal with CUDA directly or its advanced C/C++ interface. Instead, R will rely on rpud and other R packages for studying GPU computing. For more details look at link in references section.

As it turns out, I need to have CUDA compatible GPU to test R + CUDA samples. Without it I will not be able to run R + CUDA samples. CUDA does not have a CPU fallback if comptible GPU is not found. Latest CUDA toolkit (see the CUDA toolkit link in references section) does not event install. This is totally unlike AMD Aparapi which falls back to CPU if compatible GPU is not found on host machine.

References:
  1. WIKI: http://en.wikipedia.org/wiki/R_%28programming_language%29
  2. R introduction: http://www.r-tutor.com/r-introduction
  3. GPU Computing with R: http://www.r-tutor.com/gpu-computing
  4. R + CUDA Toolkit Download: http://www.r-tutor.com/content/download
  5. Latest version of CUDA toolkit download link: http://developer.nvidia.com/cuda-toolkit-40
  6. Free R eBooks: http://stackoverflow.com/questions/192369/books-for-learning-the-r-language
  7. Other free statistics eBooks: http://www.r-statistics.com/2009/10/free-statistics-e-books-for-download/
  8. R Notes: http://www.johndcook.com/R_language_for_programmers.html

Friday, November 11, 2011

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.

References:
http://www.xoomforums.com/forum/new-member-introduction-site-assistance/571-igoogle-browser-issues.html

Thursday, August 11, 2011

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.

Sample:
<!DOCTYPE html>
<html>
<head>
<script>

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(){
    getFromLocalStore();
}

</script>
</head>
    <body onLoad="pageOnLoad();">
        Enter data to put in local store: <input id="comments" type="text" >
        <input id="submit" type="button" value="Store" onclick="putInLocalStore();" />
    </body>   
</html>

Chrome browser supports most of the HTML5 features. Copy the sample and execute it on latest chrome browser.

Monday, July 25, 2011

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:
  1. An example of new feature in JDK 7 which can do type inference for generic instance creation.
  2. Try-with-resources statement
  3. String object is allowed in switch-case statement
  4. Catch multiple exceptions in a single catch block & more precise exception re-throw example
  5. Express literal values in binary with prefix '0b' (or '0B') for integral types (byte, short, int and long)
  6. Fork-Join Framework for supporting Parallel Programming
  7. Performance comparison of Executor framework vs ForkJoin framework’s RecursiveTask feature in java or JDK7 
  8. More informative varargs warnings

Following are few links/posts I found informative and useful:
  1. 7 new cool features in Java 7: http://sellmic.com/blog/2011/07/08/7-new-cool-features-in-java-7/
  2. Hidden Java 7 Features – System and Process CPU Load Monitoring: http://sellmic.com/blog/2011/07/21/hidden-java-7-features-cpu-load-monitoring/
  3. JDK 7 Features: http://openjdk.java.net/projects/jdk7/features/ 
  4. Java Fork/Join for Parallel Programming: http://www.javacodegeeks.com/2011/02/java-forkjoin-parallel-programming.html
  5. New Java 7 Language Features: http://java.dzone.com/articles/new-java-7-language-features?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+zones%2Fnetbeans+%28NetBeans+Zone%29
There are lots of new goodies, I will add more details regarding Java 7 features once I am ready with running examples.

Recently, I read about Java 7 having some severe bugs. Quoting "Some loops are mis-compiled due to errors in the HotSpot compiler optimizations, which causes programs to fail. This bug affects several Apache projects directly — Apache Lucene Core and Apache Solr have already raised a warning, noting that the bug might be present in Java 6 as well." For more details visit following blogs:
  1. Java7 Hotspot Loop Bug Details: http://www.infoq.com/news/2011/08/java7-hotspot
  2. Java 7 Ships With Severe Bug: http://developers.slashdot.org/story/11/07/29/1639233/Java-7-Ships-With-Severe-Bug?utm_source=slashdot&utm_medium=twitter 
  3. Don’t Use Java 7, For Anything: http://www.lucidimagination.com/blog/2011/07/28/dont-use-java-7-for-anything/

    Thursday, July 21, 2011

    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:
    1. http://developer.android.com/guide/topics/fundamentals.html#proclife
    2. http://www.vogella.de/articles/Android/article.html#installation_eclipse
    3. http://developer.android.com/guide/index.html
    4. http://developer.android.com/resources/tutorials/hello-world.html

    Tuesday, July 12, 2011

    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.

    References:
    1. You can also look at article about that : John Resig - ECMAScript 5 Strict Mode, JSON, and More 
    2. You can try JSLint (The JavaScript Code Quality Tool) online by visiting: http://www.jslint.com/ 
    3. JSHint looks pretty interesting too: http://www.jshint.com/

      Wednesday, June 22, 2011

      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>
      <html> 
        <head>
          <title>Offline Contacts Store using HTML5 Web Database</title>
          <script src="http://www.google.com/jsapi"></script>
          <script>
            google.load("jquery", "1.4.1");
          </script>
          <script>
            var db = window.openDatabase("contacts", "", "contacts", 1024*1024);
           
            if (db == null) alert ("Database not found DB: " + db);

            function insertRecord(number, name, email) {
             db.transaction(function(tx) {
                tx.executeSql('INSERT INTO contacts (number, name, email) VALUES (?, ?, ?)', [number, name, email]);
             });
            }
           
            function renderResults(tx, rs) {
              e = $('#search_results');
              e.html("");
              for(var i=0; i < rs.rows.length; i++) {
                r = rs.rows.item(i);
                e.html(e.html() + ' number: ' + r['number'] + ', name: ' + r['name'] + ', email: ' + r['email'] + '<br />');
              }
            }

            function renderContacts(name) {
              db.transaction(function(tx) {
                if (!(name === undefined)) {
                  tx.executeSql('SELECT * FROM contacts WHERE name = ?', [name], renderResults);
                } else {
                  tx.executeSql('SELECT * FROM contacts', [], renderResults);
                }
              });
            }

            $(document).ready(function() {
              db.transaction(function(tx) {
                tx.executeSql('CREATE TABLE IF NOT EXISTS contacts(number INTEGER PRIMARY KEY, name TEXT, email TEXT)', []);
              });

              $('#contacts_form').submit(function() {
                  insertRecord($('#number').val(), $('#name').val(), $('#email').val());
            
                renderContacts();
                return false;
              });

              $('#filter_results_form').submit(function() {
                e = $('#filter_by_name').val();
                renderContacts(e);
                return false;
              });

              renderContacts();
            });
          </script>
        </head>
        <body>
        <h2>Contact Details</h2>
          <form method="get" id="contacts_form">
            <ul>
            <li>
              <label for="1">Contact Number</label>
              <input type="text" id="number" name="number" size="30"  />
            </li>
            <li>
              <label for="2">Name</label>
              <input type="text" id="name" name="name" size="30" placeholder="Enter Name" size="30" />
            </li>
            <li>
              <label for="3">email</label>
              <input type="email" id="email" name="email" placeholder="Enter your email address" size="30"/>
            </li>
            <div>
              <input type="submit" value="Insert Contact" />
            </div>
            </ul>
          </form>
          <div>
            <h2>Search Results</h2>
            <form id="filter_results_form">
              <input type="Name" placeholder="Filter by name" size="30" id="filter_by_name" />
              <input type="submit" value="Search Contact" />
            </form>
          </div>
          <div id="search_results">

          </div>
        </body>
      </html>

      Sample creates database if not available. Creates table if not already created and performs INSERT and SELECT queries on the table. Soon I will update sample with UPDATE and DELETE query samples too. UI does not look good but it does the job.

      Most Android browsers support web database. I tested above sample on Android 2.3.3. To test sample on Android, deploy above sample in some web server and hit the page from your Android browser or WebView sample I have posted in previous blog: http://rashidnoorani.blogspot.com/2011/06/how-to-run-html-5-app-from-android.html

      Note:
      I tested above HTML5 sample in Chrome 12.0.742.100 version. Web database is not supported in Firefox 5. Sample gives "window.openDatabase is not a function" error in FireFox 5.

      Monday, June 13, 2011

      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(R.id.webview);

      webview.setWebChromeClient(new WebChromeClient() {
      @Override
      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();
      settings.setJavaScriptEnabled(true);
      settings.setJavaScriptCanOpenWindowsAutomatically(true);
      settings.setDatabaseEnabled(true);

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

      Issue: I was using following java script code to create database:
      var database = window.openDatabase("total", "", "main total", 1024*1024);

      Some how database object in HTML 5 was always coming as NULL both in emulator and device. Same HTML 5 code was working properly in Crome browser. In the end, I drilled down to quotaUpdater.updateQuota() method, I tried various quota sizes but at the end "estimatedSize * 2" worked for me which is mentioned in above code sample.

      I was actually working on hybrid android app. ( Hybrid = Android Native + HTML5) I have explained HTML5 web database example in separate blog post: http://rashidnoorani.blogspot.com/2011/06/how-to-use-web-database-feature-of.html.
      Following HTML5 sample can be used to test above Android WebView sample app:

      <!DOCTYPE html>
      <html> 
        <head>
          <title>HTML5 Sample</title>
        </head>
        <body>
          <form method="get" id="employee_form">
            <div>
              <label for="1">Employee Id</label>
              <input type="number" min="1" id="id" name="id" size="5" step="1" placeholder="Enter employee Id" />
            </div>
            <div>
              <label for="2">Employee Name</label>
              <input type="text" id="firstName" name="firstName" placeholder="Enter employee name"  />
            </div>
            <div>
              <label for="3">Contact</label>
              <input type="number"  id="contact" name="contact" size="12"  placeholder="Enter contact number" />
            </div>
            <div>
              <label for="4">E-mail</label>
              <input type="email" id="email" placeholder="Enter email address" size="30"/>
            </div>
            <div>
              <input type="submit" value="Save Employee Record" />
            </div>
          </form>
        </body>
      </html>

      You can use www.html5test.com to check if specific HTML5 feature is supported by your browser.

      Current web browsers support HTML5 to varying degrees. Modernizr JavaScript library built to make browser detection of HTML5 features easier. It can be used to check if certain HTML5 features required by the app is supported by the browser or not.


      References:
      HTML5 Database API Support in an Android WebView
      Link: http://www.rohanradio.com/html5-database-api-support-in-an-android-webv

      Wednesday, June 8, 2011

      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 language and development environment, they still require knowledge of the native coding conventions when building a presentation layer. MonoTouch uses the same native concepts that are used in CocoaTouch, (View Controllers and Delegates), and MonoDroid uses the same Activity based model used in native Android Java.

      Container:
      In order to run the shared application, you must create at least one container project that references the appropriate shared assembly, and renders the application into the targeted presentation platform. The BestSellers application is initially published with three platform containers:
      • Console.Container - A Windows Console based deployment; this is the simplest example and is a good place to start in understanding the pattern.
      • WebKit.Container - An HTML 5 deployment using ASP.NET and WebKit to render to small form-factor mobile devices, (iPhone, iPod, Android, etc.).
      • Touch.Container - A native iOS deployment using MonoTouch.

      Controller:
      MonoCross controllers will be derived from the abstract MXController class. This class defines the base functionality necessary to register your controllers in your MonoCross application, and initialize your model objects for delivery to your container(s). You'll accomplish this by overriding the MXController.Load() method.

      Model:
      Design your model in a way that delivers only the information your audience needs at the time they need it. Less is definitely more when it comes to mobile application design. Take an "outside-in" view of your information with the device or devices you intend to support in mind.

      View:
      When constructing your views, MonoCross lets you take full advantage of the capabilities of your native platform. So construct your views in a manner that will present your information in a manner optimized for your deployment. MonoCross views inherit from the MXView class. The view Render() method must be overridden to implement any actions necessary to initialize and present your model information to the target platform.

      Application:
      Now that you have defined your model and your controllers you need to register your controllers in your shared application. The MXApplication class is an abstract super-type that contains the constructs needed to define your workflow, and register your controllers for use in your container.
      To initialize your shared application you need to override the OnAppLoad() method of the abstract base-class. This method is called when your application is initialized, and contains the code necessary to establish your app structure.

      Navigation:
      The NavigationMap property is a collection of all the controllers necessary to render your application to your desired platform target(s). The NavigationMap is keyed using a URI template model which defines your application workflow. Each user-action will initiate a navigation based on the URI patterns defined in your NavigationMap.
      This navigation paradigm is key to the MonoCross pattern, and enables tremendous flexibility in construction of your application. Controller-View combinations can be re-used at different points in your workflow by simply defining multiple endpoints in your NavigationMap with unique URI definitions.

      Binding your App to the Container:
      Now that your views are defined, all that remains is to initialize your application and bind it to your container. there are three steps to the process that must be completed in the Main() method, or equivalent entry point to your platform-specific container application
      • App Initialization - set the view load event delegate, and initialize the MXContainer with an instance of your app.
      • View Registration - register your views with your container using the MXContainer.AddView() method.
      • Initial Navigation - perform an MXContainer.Navigate() navigation to the initial view of your application.

      I have tried to define each component which is part of MonoCross framework. I collected above information from various sites mentioned below in resources section. MonoCross example is explained well in WIKI article UsingMonoCross link: http://code.google.com/p/monocross/wiki/UsingMonoCross

      Resources:
      MonoCross Home page: http://www.mobileframework.net/
      MonoCross Download: http://monocross.net/
      UsingMonoCross WIKI article: http://code.google.com/p/monocross/wiki/UsingMonoCross
      MonoCross basic overview: http://vagabondrev.org/2011/04/20/monocross-the-technology/

      Tuesday, May 24, 2011

      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.

      Steps:
      1. Go to "<android-sdk-home>" directory and go to tools folder from command prompt.
      2. Type command: emulator -avd -verbose -http-proxy http://host-id:port
      Above 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:name="android.permission.INTERNET" /> 

      Wednesday, May 11, 2011

      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.

      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: http://developer.android.com/guide/topics/usb/adk.html

      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.
      Link: http://news.softpedia.com/news/Android-3-1-Released-Available-Now-for-Motorola-XOOM-199608.shtml

      Android 3.1 Platform Highlights: http://developer.android.com/sdk/android-3.1-highlights.html

      The New Features of Android 3.1 and Ice Cream Sandwich: http://lifehacker.com/5800417/the-new-features-of-android-31-ice-cream-sandwich

      Android Marketplace coming to Google TV soon: http://androinica.com/2011/03/android-marketplace-coming-to-google-tv-soon-what-apps-would-you-want/

      Stay tuned for more updates.

      Monday, May 9, 2011

      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: http://gpgpu.org/2011/05/04/kgpu-gpu-computing-in-linux-kernel

      The source code can be obtained from https://github.com/wbsun/kgpu, and news and release information can be found at http://code.google.com/p/kgpu/.

      Thursday, May 5, 2011

      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 testing
      • JCrasher defines heuristics for determining whether a Java exception should be considered a program bug or the JCrasher supplied inputs have violated the code's preconditions
      • JCrasher includes support for efficiently undoing all the state changes introduced by previous tests
      • JCrasher produces test files for JUnit--a popular Java testing tool
      • JCrasher can be integrated in the Eclipse IDE.
      For more information, visit the link: http://ranger.uta.edu/~csallner/jcrasher/index.html

      There is a paper written on JCracher which can be found at location: http://www.cs.umass.edu/~yannis/jcrasher.pdf

      Download location: Download JCrasher.

      I am also learning how to use it. Once, I have created few good samples, I will update the post.

      Wednesday, May 4, 2011

      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: http://msdn.microsoft.com/en-us/library/ms733768.aspx

      Saturday, April 23, 2011

      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. http://goo.gl/YfVwz

      Is it really dangerous? May be not, look at following link
      for more information: http://goo.gl/XidQY

      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/data/com.google.android.location/files directory on Android phones contain records of the last 50 cell towers the device has communicated with and the last 200 Wi-Fi networks the phone has discovered, respectively.
      However, unlike the file found on the iPhone, this data is overwritten as the files become full. Accessing the file also requires full administrator privileges (aka, "root" access) to the device in question.

      Is this really invasion of privacy?
      Can this information be misused in future?

      Question is what should be done now, good thing is, this has caught public's eye. Lets see what is smartphone makers next move.

      Wednesday, April 20, 2011

      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.
      Link: http://stackoverflow.com/questions/3020405/android-having-a-service-run-every-day-at-4am

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

      Tuesday, April 19, 2011

      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:

      Link: http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html

      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 (http://www.vogella.de/articles/AndroidPerformance/article.html).

      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: new CustomAsyncTask().execute(...);
       
      
      It till need to fine tune my logic to work with AsyncTask but at least I was able to make my code work.

      You can also use StrictMode to detect such issues. StrictMode is a developer tool which detects things you might be doing by accident and brings them to your attention so you can fix them.
      StrictMode is most commonly used to catch accidental disk or network access on the application's main thread, where UI operations are received and animations take place. Keeping disk and network operations off the main thread makes for much smoother, more responsive applications. By keeping your application's main thread responsive, you also prevent ANR dialogs from being shown to users.

      If you find violations that you feel are problematic, there are a variety of tools to help solve them: threads, Handler, AsyncTask, IntentService, etc. But don't feel compelled to fix everything that StrictMode finds.

      StrictMode is not a security mechanism and is not guaranteed to find all disk or network accesses. While it does propagate its state across process boundaries when doing Binder calls, it's still ultimately a best effort mechanism.
      To know more about StrickMode visit link: http://android-sdk.appspot.com/reference/android/os/StrictMode.html

      Monday, April 18, 2011

      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.

      Sunday, April 17, 2011

      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_name
      You can also use Android Snapshot feature described here.

      Or you can follow below steps to enable snapshot feature:
      1. When creating (or editing) an AVD, tick the 'Snapshot enabled' box.
      2. The launch dialogue for a snapshot-enabled AVD will offer additional 'Launch from snapshot' and 'Save to snapshot' options.
      3. The first time a snapshot-enabled AVD is launched, there is no snapshot data so it will boot normally. Pressing the close button will save the state (if that's been selected) and then quit the emulator.
      Once the snapshot has been saved loading is faster.

      Other points to note with snapshot AVDs:
      • If you want to reboot the phone, you need to un-tick the 'Load from snapshot' option.
      • The time is corrected to the current time of day from the emulated cell tower, on average after 8 seconds after restore.
      • Some emulated systems, like cell tower strength, may not be saved to the snapshot, and will restore with the emulator's default setting.
      Issues faced:
      While I was debugging my code, I was making lots of code changes and reloading my app again and again from eclipse. I noticed due to above tweaks may be my app was not getting reloaded properly. I was playing around with Android Sync provider may be due to that I was facing these issue.

      Friday, April 15, 2011

      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 have the time/expertise in the team to generate an Android sample. I think there are some c# to Java source code converters that you may employ to convert the Wm6.5 sample. This should give you a good starting point for the Android sample.
      if you are looking for pure Android code I can´t help you but for MonoDroid there is a nice solution which already supports the sync framework 4.0 CTP. I am currently evaluating this nice oodb called siaqodb. For more informations goto www.siaqodb.com
      • What work does 'SyncSvcUtil.exe' utility do to instrument the database?
      SyncSvcUtil is just a utility to provision/deprovision scopes, generate code for WCF-based sync service, isolated store and client entities.
      The only changes that we do to the database when you use SyncSvcUtil is to use the SqlSyncScopeProvisioning/SqlSyncScopeDeProvisioning API's from SyncFx 2.1 to provision/deprovision the database based on the request.
      This means that we create insert/update/delete triggers, tracking tables and few stored procedures per table for change tracking/enumeration/change application purposes. This is exactly similar to what you would have done, had you used SyncFx 2.1 to manually provision the database.
      • How can I disable this redirection to $syncscopes???
      A service that is generated by SyncFx 4.0 CTP only uses OData as the wire format since it is a widely recognized format for representation od data. The SyncFx service does not perform OData operations as documented in odata.org instead it only knows how to upload and download incremental changes. To make this possible, we made some additions to the OData format to support sync specific constructs like knowledge, tombstones etc. The redirection to $syncscopes is our way of letting you discover what scopes are available for sync from the service. Internally, the service uses Sync Framework 2.1 database providers.
      • Issue faced: Server error in fetching remote contacts: HTTP/1.1 500 Internal Server Error
      Following steps fixed the issue for me:
      I had installed 32 bit version of Sync Framework 2.1 SDK. Installation was successful for me so I thought things are working fine until I got HTTP 500 error. 500 error appears usually if something is wrong on server side.
      I removed total Microsoft Sync Framework 4.0 (CTP) and installed freshly as mentioned in download instructions for 64 bit installation. That worked for me. See following link for more information regarding the issue.
      http://social.msdn.microsoft.com/Forums/en-US/synclab/thread/3e50b656-1a6c-4d2b-ae16-5971e75a690c/#1f024612-43a2-4477-94c2-e9b35320635c
      If server side setup is proper then make sure IIS application pool's Process Model is set to LocalSystem. This will not be that secure but check it to make sure things are working fine on IIS side.
      If that is done and still you are facing issue then make sure you have done as follows:
      1. Launch SQL Server Management Studio.
      2. Expand Security, right-click Logins, and then click New Login.
      3. Enter NT AUTHORITY\NETWORK SERVICE for the Login name, switch to the User Mapping tab.
      4. Select listdb from the database list and select db_owner from the role list, and then click OK.

      Wednesday, January 12, 2011

      What is HyperGraphDB?

      HyperGraphDB (http://www.hypergraphdb.org/) 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 (http://www.opencog.org) and its power is partly in its data model and in its open-architecture framework.

      Two unique features of HyperGraphDB:
      1. Higher-order, n-ary relations are unique to HyperGraphDB
      2. Open-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:
      1. Links/edges "point to" an arbitrary number of elements instead of just two as in regular graphs.
      2. Links can be pointed to by other links as well.
      Feature Summary:
      1. Powerful data modeling and knowledge representation.
      2. Graph-oriented storage.
      3. N-ary, higher order relationships (edges) between graph nodes.
      4. Graph traversals and relational-style queries.
      5. Customizable indexing.
      6. Customizable storage management.
      7. Extensible, dynamic DB schema through custom typing.
      8. Out of the box Java OO database.
      9. Fully transactional and multi-threaded, MVCC/STM.
      10. P2P framework for data distribution.
      More I learn about it., more interesting it becomes. Still working on examples. Detailed information is coming up soon.

      HyperGraphDB Resources:
      1. Home: http://www.hypergraphdb.org/
      2. Downloads: http://www.hypergraphdb.org/downloads
      3. API Doc: http://www.hypergraphdb.org/docs/javadoc/index.html
      4. Q&A (Faqs): http://www.hypergraphdb.org/learn?project=hypergraphdb&page=QuestionsAndAnswers

      Thursday, January 6, 2011

      Getting Started with MongoDB

      Introduction:
      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,...
      ----------------------
      Server:Port
      - Database(s)
      - Table(s)
      - Row(s)
      - Column(s)

      - Index
      - Join

      MongoDB
      --------
      Server:Port
      - Database(s)
      - Collection(s)
      - Document(s)
      - Field(s)

      - Index
      - embedding and linking

      The concept of server, database and index are very similar but the concepts of table/collection, row/document as well as column/field are quite different.
      In RDBMSs a table is a rectangle made of columns and rows. Each row has a fixed number of columns, if we add a new column; we add that column to each and every row.
      In MongoDB a collection is more like a really big box and each document is like a little bag of stuff in that box. Each bag contains whatever it needs in a totally flexible manner (read schema-less).
      Note that schema-less does not equal type-less i.e. it is just that with MongoDB any document has its own schema, which it may or may not share with other documents.
      In practice it is normal to have the same schema for all the documents in a collection. The concept of a column in RDBMSs is closest to what we call a field (key/value pair) in MongoDB — note however what we said above: we can create/read/update/delete individual fields for a particular document in a collection. This is different from creating/reading/updating/deleting a column in RDBMSs, which happens for every row in the entire table.
      Indexes are more or less the same for RDBMSs and MongoDB. Joins however do not exist in MongoDB but instead we can embed and/or link documents into/with other documents.
      Good resources on GUIs can be found http://www.mongodb.org/display/DOCS/Admin+UIs . Also, assuming a mongod process is running on localhost then we can access some statistics at http://localhost:28017/ and http://localhost:28017/_status.

      The software implements a protocol called GridFS that is used to store and retrieve files from the database. This file storage mechanism has been used in plug-ins for NGINX and lighttpd.
      MongoDB uses memory-mapped files, limiting data size to 2GB on 32-bit machines (64-bit systems have a much larger data size).

      Getting Started:
      Download MongoDB from link: http://www.mongodb.org/downloads
      Unzip downloaded file and follow below instructions.

      By default MongoDB will store data in \data\db, but it won't automatically create that folder, so we do so here:
      C:\> mkdir \data
      C:\> mkdir \data\db

      The important binaries for a first run are:
      • mongod.exe - the database server
      • mongo.exe - the administrative shell
      To run the database, click mongod.exe in Explorer, or run it from a CMD window.
      Start the administrative shell, either by double-clicking mongo.exe in Explorer, or from the CMD prompt. By default mongo.exe connects to a mongod server running on localhost and uses the database named test. Run mongo --help to see other options.

      By now MongoDB should be running. You can connect to it by using following Java samples. Download Java driver from link: https://github.com/mongodb/mongo-java-driver/downloads

      Samples:
      m = new Mongo();

      // Two other ways to connect MongoDB running on localhost
      // Mongo m = new Mongo( "localhost" );
      // Mongo m = new Mongo( "localhost" , 27017 );

      // Authentication (Optional), name and password are valid for the database then auth will be true
      //boolean auth = db.authenticate(myUserName, myPassword);

      //At this point, the db object will have a connection to MongoDB server for the specified database.
      DB db = m.getDB("mydb");

      //Getting A List Of Collections
      Set colls = db.getCollectionNames();

      for (String s : colls) {
      System.out.println(s);
      }

      //Once you have this collection object, you can now do things like insert data, query for data, etc
      DBCollection coll = db.getCollection("testCollection");

      /*
      * Example to insert a document in following format:
      * {
      * "name" : "MongoDB",
      * "type" : "database",
      * "count" : 1, "info" : { x : 203, y : 102 }
      * }
      */
      BasicDBObject doc = new BasicDBObject();

      doc.put("name", "MongoDB");
      doc.put("type", "database");
      doc.put("count", 1);

      BasicDBObject info = new BasicDBObject();

      info.put("x", 203);
      info.put("y", 102);

      doc.put("info", info);

      coll.insert(doc);

      //findOne() operation to get the first document in the collection
      DBObject myDoc = coll.findOne();
      System.out.println(myDoc);

      Advantages of using MongoDB:
      MongoDB combines the functionality of key-value stores - which are fast and highly scalable - and traditional RDBMS systems - which provide rich queries and deep functionality. It is designed for problems that are difficult to be solved by traditional RDBMSs, for example databases spanning many servers.
      The database is document-oriented so it manages collections of JSON-like documents. Many applications can, thus, model data in a more natural way, as data can be nested in complex hierarchies and still be query-able and indexable.
      Right now (October 2010) we can use MongoDB from at least C, C++, C# & .NET, ColdFusion, Erlang, Factor, Java, JavaScript, PHP, Python, Ruby, Perl. Of course, there might be more languages available in the future.
      Scalability, fault tolerance and load balancing. Big words! Sounds scary, sounds hard, sounds expensive. All true, except when armed with MongoDB.
      Ad hoc queries
      In MongoDB, any field can be queried at any time. MongoDB supports range queries, regular expression searches, and other special types of queries in addition to exactly matching fields. Queries can also include user-defined JavaScript functions (if the function returns true, the document matches).
      Queries can return specific fields of documents (instead of the entire document), as well as sorting, skipping, and limiting results.
      Querying nested fields
      Queries can "reach into" embedded objects and arrays. If the following object is inserted into the users collection:
      {
      "username" : "bob",
      "address" : {
      "street" : "123 Main Street",
      "city" : "Springfield",
      "state" : "NY"
      }
      }

      We can query for this document (and all documents with an address in New York) with:
      > db.users.find({"address.state" : "NY"})
      Array elements can also be queried:
      > db.food.insert({"fruit" : ["peach", "pear", "plum"]})
      > db.food.find({"fruit" : "pear"})

      When not to use MongoDB:
      1. We need strict transactional behavior with any query/write (read ACID) as for example often required with applications/problems in the financial/scientific domain. However, please note that for ordinary use cases the level of ACID provided by MongoDB is by and large sufficient.
      2. Our data is very relational. In this case one should just stick to one of the many RDBMSs (Relational Database Management Systems) out there.
      3. Related to 2, we want to be able to do joins on the server (but can not do embedded objects/arrays).
      4. We need triggers on our tables (called collections in MongoDB parlance) — note: there might be triggers available soon.
      5. Related to 4, we rely on triggers (or similar functionality) to do cascading updates or deletes. As for #4, this issue probably goes away once triggers are available.
      6. We need the database to enforce referential integrity (MongoDB has no notion of this at all).
      7. If we currently (October 2010) need 100% per node durability — there will be major improvements coming with version 1.8 however. Go here for more information.
      8. Write ahead log. MongoDB currently (October 2010) does not have one simply because it does not need one — we believe true durability can only be achieved with a cluster setup and never with a single node (this is true for any DBMS used). However, since there is great demand/desire for improved per node durability, the decision has been made to improve per node durability with version 1.8 or sooner.
      9. Crystal reports is an example of a type of use that MongoDB is not good at: Dynamic aggregation with ad-hoc queries. These reporting systems (business intelligence) require being able to aggregate and apply mathematical expression to multiple joined sets of data (like across collections). This is something that MongoDB can not handle very well, or at all. Data warehousing, large graph representations (with efficient traversal) and many other types of data, and analysis just do not fit well into the restrictions and choices MongoDB has made, but unlike most of those, reporting is a more generic need that is not well supported.

      Useful tips:
      1. Use 64-bit version. 32-bit version has a limit on about 2.5GB of data stored. Yeah, it’s probably enough for playing around. But when you start configuring your production (or staging) system, remember to choose 64bit flavor, since you can’t just “fix” that later on, you’ll have to reinstall everything.
      2. _id and _ns elements have been added automatically by MongoDB to your document. Remember, MongoDB reserves element names that start with _ for internal use.
      3. “Ctrl+C“ is a valid way to shutdown MongoDB.

      Issues faced:
      1. Exception in initAndListen std::exception: dbpath (/data/db/) does not exist, terminating
      Solution: I could start it only with exact dbpath argument on Win - >mongod.exe --dbpath c:\data\db

      Resources:
      1. MongoDB Road Map: http://jira.mongodb.org/browse/SERVER?report=com.atlassian.jira.plugin.system.project:roadmap-panel
      2. Helpful link: http://www.markus-gattol.name/ws/mongodb.html
      3. Beginner’s tips: http://senko.net/en/mongodb-gotchas/
      4. Tutorial: http://www.mongodb.org/display/DOCS/Tutorial
      5. MongoDB Java driver usage tutorial: http://www.mongodb.org/display/DOCS/Java+Tutorial
      6. Videos: http://www.10gen.com/video/mongosv2010/crazy
      7. WIKI: http://en.wikipedia.org/wiki/MongoDB
      8. Downloads:
      a. MongoDB downloads: http://www.mongodb.org/downloads
      9. Drivers Downloads:
      a. https://github.com/mongodb/mongo-java-driver/downloads
      b. http://api.mongodb.org/
      c. http://www.mongodb.org/display/DOCS/Drivers
      10. Books: http://www.10gen.com/books
      11. Recently added features: http://blog.mongodb.org/post/2388886125/five-new-replica-set-features-in-1-7-x
      12. Java Api Docs: http://api.mongodb.org/java/2.5-pre-/index.html

      Wednesday, January 5, 2011

      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: http://us.blackberry.com/developers/javaappdev/javaupdate.jsp (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 20$. (This is not required for learning purposes)
      The online application form for signing keys is available at link: https://www.blackberry.com/SignedKeys/
      An administration fee of $20.00 USD will be charged to a valid credit card to complete the registration process. Typically, keys are sent via email within 48 hours of submitting the necessary forms, but occasionally the process can take up to 10 business days. For support contact BlackBerry support at 1-877-255-2377.
      You can find more information and register for the code signing keys at
      link: http://na.blackberry.com/eng/developers/javaappdev/codekeys.jsp

      You can visit following links for more information related to BlackBerry App development:
      1. Link: http://us.blackberry.com/developers/started/bbdevapproach.jsp
      2. Link: http://us.blackberry.com/developers/started/mobiledev101.jsp

      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
      Link: http://www.jsptube.com/servlet-tutorials/servlet-file-upload-example.html