Tuesday, January 21, 2014

Phoengap Push Notifications for Android and iOS

DESCRIPTION

This plugin is for use with Cordova, and allows your application to receive push notifications on both Android and iOS devices. The Android implementation uses Google's GCM (Google Cloud Messaging) service, whereas the iOS version is based on Apple APNS Notifications
Important - Push notifications are intended for real devices. The registration process will fail on the iOS simulator. Notifications can be made to work on the Android Emulator. However, doing so requires installation of some helper libraries, as outlined here, under the section titled "Installing helper libraries and setting up the Emulator"

Phoengap Push Notifications for Android and iOS

 

Wednesday, January 8, 2014

PhoneGap: Detect File Loaded from Phonegap or Not

/** * Determine whether the file loaded from PhoneGap or not */

 function isPhoneGap() { 
     return (cordova || PhoneGap || phonegap) 
     && /^file:\/{3}[^\/]/i.test(window.location.href) 
     && /ios|iphone|ipod|ipad|android/i.test(navigator.userAgent); 
}
 if ( isPhoneGap() ) { 
     alert("Running on PhoneGap!"); 
} else { 
     alert("Not running on PhoneGap!"); 
}

Tuesday, January 7, 2014

Roman Number Converter Using PHP

PHP

Number to Roman convert:

function roman_numerals($input_arabic_numeral='') {

    if ($input_arabic_numeral == '') { $input_arabic_numeral = 1; } // Default value 1
    $arabic_numeral            = intval($input_arabic_numeral);
    $arabic_numeral_text    = "$arabic_numeral";
    $arabic_numeral_length    = strlen($arabic_numeral_text);

    if (!ereg('[0-9]', $arabic_numeral_text)) {
return false; }

    if ($arabic_numeral > 4999) {
return false; }

Roman Number Converter Using Javascript

Javascript 

Number to Roman convert:

function toroman (num) {
if (!+num)
return false;
var digits = String(+num).split(""),
key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
"","I","II","III","IV","V","VI","VII","VIII","IX"],
roman = "",

Thursday, December 12, 2013

Hybrid vs Native mobile apps



This is an interesting question.
Few years ago, now late Steve Jobs proclaimed that HTML5 is the future of web development. Ok this needs to be viewed in a broader context, at that point in time Apple was waging a war against Flash and HTML 5 was a unlucky winner.
Steve Jobs quote:
They are lazy, Jobs says. They have all this potential to do interesting things but they just refuse to do it. They don’t do anything with the approaches that Apple is taking, like Carbon. Apple does not support Flash because it is so buggy, he says. Whenever a Mac crashes more often than not it’s because of Flash. No one will be using Flash, he says. The world is moving to HTML5.