December 17, 2013

Devyani khobragade's cheap and corrupt act

A very regrettable act by Indian diplomat Devyani khobragade in US. She was sent over as in Indian representative, her actions are supposed to reflect Indian values. What does she do over there?
She hired a maid from India on pretext of paying 4500 per month while she paid her meager amount of 600 per month.That right there shows her corrupt mind and cheapness of her character. She's at fault and should be punished irrespective of she being a woman or mother. Her defense is that she can't afford so much money for a nanny. You can't steal an iPad on the pretext of not having enough money, you just don't buy it.
I'm more saddened by the actions of government rather than her. The Indian government has been taking few steps in support of someone who has degraded Indian values as seeks help just because she's a woman and mother. She should be punished either by Indian or US government and she deserves it. The news channels have been asking for sympathy as she was kept with drug addicts; it's a jail and what else did she expect?
Consular immunity as shouted by our journalists and government is readily accessible on Wikipedia as such:
Consular immunity privileges are described in the Vienna Convention on Consular Relations of 1963 (VCCR).[1][2] Consular immunity offers protections similar to diplomatic immunity, but these protections are not as extensive, given the functional differences between consular and diplomatic officers. For example, consular officers are not accorded absolute immunity from a host country’s criminal jurisdiction, they may be tried for certain local crimes upon action by a local court, and are immune from local jurisdiction only in cases directly relating to consular functions.
Vienna convention consular immunity is provided at the following link:

July 28, 2013

HTML5 Web storage

Currently, these are the important forms of storage systems present in the browsers.
  • Cookies
  • Web Storage
  • Indexed database API
  • Web SQL Database

Cookies:
A very tiny amount of storage used by websites to store important information. Generally, this is used to store tracking or authentication data.
Examples are
Cookie to track user’s browsing habits by third-parties
Cookies to evaluate if the user has already been logged into website

Web storage:
It’s a simple mechanism to store larger amounts of data. The CURD operations are performed over a key/value persistence system. Also known as localStorage system.

Pros
  • Really simple API.
  • Already available in all major new browsers.
Cons
  • No query language, schemas, really nothing you'd normally call a database. So it wouldn't scale well where you need to impose organization on a larger data set.
  • They didn't put transactional safety into the standard. I don't think I can sleep at night with an app running that might have race conditions and then have the risk of corrupt data.
  • Closing an app would lose the entire data. Hence, this storage mechanism can’t be used for developing HTML5 based native apps.

Indexed Database (IDB) :
IndexedDB is an API for client-side storage of significant amounts of structured data and for high performance searches on this data using indexes. IndexedDB basically provides a simple flat-file database with hierarchical key/value persistence and basic indexing.
IndexedDB provides separate APIs for synchronous and asynchronous access. The synchronous API is intended to be used only inside of Web Workers but it isn't implemented by any browser yet. The asynchronous API works both within and without Web Workers.
Pros :
  • Pretty similar to NoSQL
Cons :
  • Not yet available in most new browsers.

Web SQL Database
Web Sql is basically sqlite embedded into the browser. It's one of the most useful form of HTML5 web storage.
Pros :
  • Fast and pretty feature-rich sql implementation (besides select/insert/update/delete, you can do joins, inner selects, etc).
  • Advantageous for developing ios and Android apps as the storage persists even after the application is closed.
Cons :
  • Available in Chrome and webkit-based browsers (Safari, etc.) but not Firefox or IE.
  • The W3C Working Group has put a hold on the standard since they say they want at least two independent implementations of the standard, and there's only one so far, since everybody is using sqlite.

Useful links

July 26, 2013

Developing and native packaging for Sencha Touch applications


REQUIRED PROGRAMS


  1. Java
  2. Sencha Touch
  3. Ruby
  4. Compass and Sass
  5. node.js
  6. Sencha Cmd
  7. Android SDK
  8. Cordova
Java
Version: No particular version is required; Latest stable version is preferrable
URL : http://www.oracle.com/technetwork/java/javase/downloads/index.html
Note: Android SDK requires Java
1. Download and install a Java Run-time Environment or JRE
2. The JRE version must be at least JRE 6, JRE 7 is best.
3. Set the JAVA_HOME path on your respective operating systemcls

Sencha Touch (ST)

Version: 2.1.*, Previous apps were built over ST2.1
URL: http://www.sencha.com/products/touch/
Download URL: http://cdn.sencha.com/touch/sencha-touch-2.2.1-commercial.zip
1. Download the appropriate version of Sencha touch bundle from the url.
2. Unzip the downloaded archive
3. The 'sencha-touch-' directory consists of 'touch-', a container of the sencha touch install, examples and documentation.

Ruby

Version: Ruby 1.9.3 is required (Ruby 2.0 is not supported).
URL: http://www.ruby-lang.org/en/downloads/
Note: Compass and SASS use Ruby.
[Windows]
Download Ruby 1.9.3 from rubyinstaller.org. Download the RubyInstaller .exe file and run it.
[Linux]
1. Install distro-specific RVM [Ruby Version Manager]
curl -L https://get.rvm.io | bash -s stable --ruby
2. Install Ruby 1.9.3
rvm install 1.9.3
rvm use 1.9.3
rvm rubygems latest

Compass and Sass

URL: http://compass-style.org/install/
Note: Sencha uses Compass and Sass to develop CSS content.
1. Open terminal / command line on your system.
2. Enter the command 'gem install compass'. This will install the Compass and Sass

Node.js

Version: Latest stable version is preferred; using 0.10.13
URL: http://nodejs.org/
Node.js is requried by Sencha cmd to build the applications
Note: node.js requires python.
[Windows]
1. Download and run the .msi installer
[Linux]
1. $ wget
2. $ tar.gz $ tar -xvzf  
3. $ cd
4. $ ./configure
5. $ make # takes approx. 5-10 minutes
6. $ sudo make install

Sencha Cmd

URL: http://www.sencha.com/products/sencha-cmd/download
1. Download appropriate Sencha Cmd version.
2. Unzip the Sencha Cmd zip file and save the path in environment.
3. [Linux only]  Run the sencha cmd run file using command
./SenchaSDKTools-.run --mode text
4. Save the sencha SDK path in environment variables
5. To verify installation, open terminal/ command line and type 'sencha'. This would give help page of sencha.

Android SDK

Version: api-7 is required by Sencha Touch
URL: http://developer.android.com/sdk/index.html
1. Download the appropriate version of Android SDK for your platform.
2. Install SDK and download required Android platforms
3. Save the android installation directory path in environment variables

Cordova

Version: Currently packaging using 2.8.0
URL: http://cordova.apache.org/#download
Note: Phonegap is an extended feature set of cordova platform
Note: Cordova installation requires node.js to be installed
[Windows]
1. Download the latest version of Cordova
2. Unzip the cordova installation and unzip the required version (Android) platform
3. Set the cordova unzipped directory path into environment variables
[Unix\ Linux]
1.npm install -g cordova



Working with Sencha app

Creating a Sencha application
1. Verify Sencha Cmd is installed
2. We are using ST2.1, not latest 2.2. Latest ST build comes along Sencha Cmd tools
3. Make sure you have the required ST SDK
4. Create sencha app from command using command
sencha generate app app_name /path/to/app
sencha --sdk-path /path/to/specific/sencha/sdk generate app app_name /path/to/app
5. You have app created with the specified or default Sencha version in the specified directory



Converting from Sencha touch application to native android application

There are two different ways to package a sencha touch application to native application. Theya are
1. Cordova native packaging
2. Sencha native packaging

Cordova native packaging
1. Develop the Sencha touch application independently
2. Add cordova.js into resources/js of Sencha application and also add reference of it in app.json
3. Get the sencha touch production build using the command
'sencha app build production'
4. Create a new cordova application (Not in the previous sencha application directory) using command
'cordova create '
where,
- Name of the application like DriveTime
- Package name of the application like com.rr.drivetime
- Physical path of the application on disk
5. Add android to the required cordova application using command
'cordova platform add android'
'cordova build'
which, creates an android folder with the android project structure.
6. Create an Android project over cordova application.
i. Open eclipse
ii. Go to 'File'->'New'->'Project'->'Android Project from existing code'
iii. Select the 'android' directory in the cordova app created above
7. Create a 'www' folder in the 'asssets' directory of the android project
8. Copy and paste the production build created in (3) into the 'www' folder.
9. Deploy the project to device using adb, installed part of Android SDK

Sencha native packaging

1. Develop the sencha application.
2. Go to the sencha application path
3. Add cordova.js to 'resources/js' folder
4. Add cordova.js reference to js category in app.json file
5. Complete the packager.json file [Android sdk, device to install, application name, package name, 'key']
6. Build the native package of the application using Sencha Cmd using command
'sencha app build native'
7. The above step produces a 'apk' file. You can deploy or distribute this apk to devices.