Sunday, July 13, 2014

MySQL - install on mac OSX

Installing MySQL using homebrew is the easiest way

$brew install mysql
Note: Perform a secure installation , else all log ins will be as an anonymous user.
DO: A secure installtion.
$mysql_secure_installation
The default root password is empty, so press "Enter" when prompted. Enter the new password that need to be assigned to the root user.

Errors: 
1.Command not found: mysql_secure_installation
The error clearly states that the command is not found. But we are sure that our installation was correct. To quickly rectify it, find where the command actually resides.
Do $which mysql_secure_installation

> /usr/local/bin/mysql_secure_installation

$cd /usr/local/bin -> Now continue with the previous step.

To login into mysql as root,
$mysql -uroot -p
Enter the password on prompt

Voila!

P.S. For beginners: The commands to be typed into the terminal, are italicized. $ refers to the command prompt, do not enter it in the terminal.

Saturday, May 3, 2014

Cordova - Build your application simultaneously on multiple mobile platforms!

Let's quickly put together a basic Cordova project.

INSTALLATION
We will be using Node Packaged Modules, so
$brew install node
$npm install -g cordova
$npm install -g cordova-cli
-g is needed for global access

SAMPLE PROJECT STRUCTURE
$cordova create projName com.package.name "Initial display of text"

Enter into the directory
$cd projName

Add platforms of development
$cordova platforms add android
$cordova platforms add ios

Edit the index.html page with the contents to be displayed.

Build Project
ios SDK is needed for it. Xcode 4.6+ supports this.
$cordova build ios
OR
$cordova build android
To start the simulator
$cordova emulate ios
OR
$cordova emulate android

This gets the basic setup of Cordova based IOS/Android app running.

NOTE: PLUGINS

A functionality that needs to be implemented natively is done by using plugins:
Eg: To add native alerts
$cordova plugin add org.apache.cordova.dialogs
<script src="cordova.js"></script> is needed in index.html so that CLI injects it at build time. cordova.js needn't be there in www folder.