Quote

"Between stimulus and response there is a space. In that space is our power to choose our response.
In our response lies our growth and freedom"


“The only way to discover the limits of the possible is to go beyond them into the impossible.”


Tuesday, 18 June 2013

Mobile App notifications while App is not Running

Application running on Android or IOS need not be running to receive on device notifications. Android provides ‘GCM’ and IOS provides ‘Apple Push’ service to send notifications to the application installed on Android and Apple mobile devices. Let us take the example of GCM to understand how it works.

Google Cloud Messaging (GCM) is service provided by Google to enable delivery of notifications to applications on Android devices. GCM on android provides mechanism for unique identification of the target application to which the notification has to be delivered and communication with the application server which intends to send the notification to the mobile users.

GCM Notifications

 
For GCM implementation the device needs to be running Android 2.2 or greater with play store installed on it. For devices with less than 4.0.4 the device needs to have a signed in Google account. If the device is running 4.0.4 or higher then Google account sign-in is not required. The following credentials are required and are a part of the notification process:
  • Sender ID: Used in registration to identify the delivery destination
  • Application ID: The identifier of the application that registers to receive messages or notifications
  • Sender Auth Token: The API key stored in the third party application server to access the Google services
  • Registration ID: Helps uniquely identify the application running on the device that is supposed to receive messages/notifications
  • Google account: Required for Android versions less than 4.0.4

Sunday, 28 April 2013

Advantages and Disadvantages of MEAPS



Experience Summary of Using a MEAP Paltform


 
We just delivered our first banking mobile product developed using a MEAP (Mobile Enterprise Application Platform). It has been a mixed experience from the MEAP usage perspective. Throughout the development cycle we were left wondering several times weather choosing a MEAP was the right strategy that we took. Most of the times were those when we were left hanging due to lack of support/expertise for delivering a feature necessary to our enterprise mobile application.  The primary reasons for those hiccups were that the MEAP platforms itself are evolving and they will take some time to stabilize.
 

MEAP definitely make great business sense that is why they have a high growth gradient over the years. Considering the mobility surge over the past few years it may not be all due to the advantages of MEAP. In terms of development costs, time to market, and targeting more number of mobile platforms, MEAP has a definite advantage over native development. But in terms of matching capabilities of the native SDK it has a definite disadvantage.

 
Another turn-off was the regression issues caused due to an update of the MEAP platform plugin. Already tested and working features can break if the platform plugins are not thoroughly verified. With the MEAPs being emerging state, it can only be said as ‘expected’. So additional rounds of testing and verification are required as each Plugin update can cause potential issues. The fast pace in which the mobility arena is moving updated plugins will be expected on a very regular basis. So this becomes a major risk factor towards the end of the development lifecycle.

 
MEAP usage throws some challenges which need to be addressed properly to extract the advantages claimed by the MEAP platforms. The idea is that you shouldn’t be rushing to a MEAP platform because the world is doing so. And yes enterprises should keep in mind that MEAP is not the only answer to the cross platform mobility challenges.  Mobile web backed by HTML5 power is turning out to be an alternative to the MEAPs in addressing the cross platform mobility challenges. HTML5 being backed by the industry biggies, such as Microsoft, Apple, Amazon, and Google has grown significantly over the last two years and developers and the community are still trying to make it stronger.

 

Advantages and Disadvantages of MEAPS

 
Based on the sweet sour experience of developing an enterprise application using a MEAP platform the advantages and disadvantages of MEAPS can be generalized as follows:


Advantages of MEAPS:

  • MEAP Platform makes business sense by minimizing the development cost
  • MEAP Platform makes business sense by minimizing the time to market
  • MEAP Platform makes business sense by enhancing the mobile platform coverage
  • MEAP development does not require advanced development skills
  • MEAP development is platform agnostic
  • MEAP development is device agnostic
  • MEAPs provide centralized management for MAM and MDM
  • MEAPs provide security guidelines and compliance 


Disadvantages of MEAPS:

  • MEAP platform adds another Risk factor
  • Too much dependency on MEAP vendor
  • MEAPs do not have proper version control mechanism
  • Migrating from MEAPs difficult, you are at the mercy of the vendor
  • MEAP applications are more fragile as compared to robust native applications
  • At times one of the supported mobile platform runs into issues jeopardizing the release 
  • Individual platform specific deployments challenges remain
  • Individual platform specific testing challenges remain
  • Unit testing of the code is a nightmare
  • Apart from the native platform expertise, the MEAP platform expertise is also critical to maintain and update
  • The MEAP platform support is a big challenge as the MEAP platforms itself are evolving and the churn in MEAPs
  • Regression issues in platform plugin updates: Features stopped working only because of plugin updates. So even if you do not change your application code but you may lose a perfectly working feature due a plugin update required to fix another issue

Monday, 8 April 2013

Cleaning Data Bound by Foreign Key Constraints


Integrity constraints are put in place to ensure that the data insertion/updation and deletion are bound within the applied business logic. However there are situations where we might need to remove the data from certain tables but it is not allowed by the database system due to constraints imposed while creating/updating the database tables.
One of the constraints normally imposed between the tables is foreign key constraint where primary key data of one of the tables is used as a key record in the child table. Therefore in such cases the child records needs to the deleted before parent record. This ensures that there are no orphan records. In automated scenarios where data is generated on nightly/hourly basis it becomes the imperative the records be cleaned periodically to keep the volume in control.
If the system under test is external and has not been not designed for cleanup activities then the you might need to alter the tables/constraints to change the behavior as per the requirement. Oracle system provides three modes in which the constraints can be in:

  • ON DELETE CASCADE
  • ON DELETE SET NULL
  • ON DELETE NO ACTION

On using the ‘ON DELETE CASCADE’ option while setting or altering the constraint, only the parent record needs to be explicitly removed. The child records are automatically removed when this option is used.

On using the ‘ON DELETE SET NULL’ option the deletion of the parent records will be allowed but the child records are set to null.

On using the ‘ON DELETE NO ACTION’ option the deletion of parent records is prevented until the child records are present. This is the default mode if either of the above two states are not specified.

An example of creating the tables with ‘ON DELETE CASCADE’ option is as follows:


CREATE TABLE root
( root_id numeric(10) >not null,
  root_name varchar2(50) not null,
  contact_name varchar2(50),
  CONSTRAINT root_pk PRIMARY KEY (root_id)
);

CREATE TABLE branch
( branch_id numeric(10) not null,
  root_id numeric(10) not null,
  CONSTRAINT fk_root
    FOREIGN KEY (root_id)
    REFERENCES root(root_id)
    ON DELETE CASCADE
);

If the table already exists try to alter the constraints using the following:

ALTER TABLE <CHILD_TABLE_NAME> MODIFY CONSTRAINT <foreign_key_name> foreign key(ref_child_columnname) references parent_tablename(ref_parent_columnname) ON DELETE CASCADE;

Saturday, 9 March 2013

Debugging Mysql Installation on Linux Machines

I have seen most prolific and established software engineers/domain experts sometimes left guessing on how to fix simple installation and setup issues on Linux boxes. The primary reason is obsessive exposure to windows machines and lack of proper experience on the Linux architecture. To fix installation/setup issues it is important to understand the UNIX architecture and specifics of the software that is being installed or setup.
Installing Mysql on Linux is simple and easy but it can easily become messy by using different users with varying permissions and modifying the files with different users that create a lock on the files or make them inaccessible to the intended user profile.

Installation of Mysql on Linux



To create a a fresh installation of Mysql first check if there are any existing installations present on the Linux box. This can be checked by using the following command on the shell:

rpm -qa | grep -i Mysql

or

ls /etc/int.d | grep -i mysql

If Mysql is installed then uninstall it using the following command:

rpm -evf <mysql-package-name>

After Mysql installation is removed you can download latest or the required Mysql package and install it using the following command:

rpm -i <mysql-package-name>.rpm

The installation creates the following entries on the UNIX box:

  • /etc/init.d entries: to start the server automatically at boot time
  • /var/lib/mysql entries: for logfile and database
  • /usr/lib/mysql entries: for putting mysql libraries
  • /usr/sbin entries: for mysqld server
  • /usr/bin entries: for client programs and scripts

The installation will create a user named mysql and a group named mysql. Creation of these users and groups   require administrative privileges to the user which is being used for installing Mysql. The user needs to have the privilege to run the following commands useradd, groupadd, and usermod on the UNIX system.

Now try to start Mysql server by running the following command:

/usr/bin/mysqld_safe &

and check the status of Mysql server using the command:

service mysql status 

If it does not start then check the error logs in the /var/lib/mysql directory in a file named *err*.

If the logs have the error message: [ERROR] Fatal Error: Can’t open and lock privilege tables: table doesn’t exist 

then to run the following command: 

mysql_install_db --user=mysql --ldata=/var/lib/mysql

Mysql should start successfully after doing the above steps.