December 12, 2013

PhoneGap Installation and running Sample Application on iOS



Pre-requisites


Softwares

     iOS SDK
     Xcode command line tools
     Node.js
     Cordova (Zip)

Setup Environment Variables


     NODEJS_HOME
     CORDOVA_IOS

PATH Environment Variable Update

1) Open a terminal prompt

2) Type sudo vi /etc/launchd.conf (note: this file might not yet exist)

3) Put contents like the following into the file

# Set environment variables here so they are available globally to all apps
# (and Terminal), including those launched via Spotlight.
#
# After editing this file run the following command from the terminal to update
# environment variables globally without needing to reboot.
# NOTE: You will still need to restart the relevant application (including
# Terminal) to pick up the changes!
# grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl
#
# See http://www.digitaledgesw.com/node/31
# and http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x/
#
# Note that you must hardcode the paths below, don't use enviroment variables.
# You also need to surround multiple values in quotes, see MAVEN_OPTS example below.
#

# Nodejs Installed path. By default the path is your home directory->.npm directory path
setenv NODEJS_HOME $HOME/.npm

# Choose the location where you have unzipped the cordova iOS folder
setenv CORDOVA_IOS /cordova-ios


PATH Environment Variable Update

create .bash_profile file in your home folder
Enter the following content

#!/bin/bash
export PATH=$PATH:$NODEJS_HOME:$CORDOVA_IOS/bin

Install phonegap

If you are behind a proxy please set the proxy to npm (Node.js) command
Syntax:-
(For HTTP) $ npm config set proxy http://proxy.company.com:port
(For HTTPS) $ npm config set https-proxy http://proxy.company.com:port

Run the install command

$ sudo npm install -g phonegap
$ sudo npm install -g cordova

Note: If you face any errors
  • Remove the .npm directory from the home folder
  • Upgrade npm (sudo npm install -g npm)
  • Clear the global npm cache (sudo npm cache clear)
  • Clear the user npm cache (npm cache clear)

Create Project

Syntax: phonegap create
$ phonegap create hello com.example.hello "HelloWorld"

By default the skeleton folder structure will be created.
Note: if you didn’t get the default skeleton (www, js, css folders and other files), please copy from the sample-hello-world project of phonegap to your www project folder

$ cd hello
$ cordova platform add ios
$ phonegap build ios



Adding Plugins to your project

Pre-requisites

                       Install Git
Tip: If you are behind a proxy then please add it your configuration
Syntax: git config —global http.proxy http://proxyusername:proxypassword@server.company:port
Ex: git config —global http.proxy http://abc:123@xyz.com:8081

                       Add git\bin to your PATH environment variable
                       You need to download the git files from https://git-wip-us.apache.org. So make sure that the above specified URL is not blocked by your firewall
                       Navigate to your project directory in command prompt by changing the directory
cd

Note:
If you have some issues download cordova zip (unzip cordova-ios zip) and copy it to your home directory-> ~/.cordova/lib/ios/cordova/3.2.0/

Install Plugin

Syntax: phonegap local plugin add
Ex:- phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin add
Ex:- cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

Add the Feature to config.xml (Ex: Accelerometer)

    name="Accelerometer">
        name="ios-package" value="CDVAccelerometer" />
   


Remove Plugin

Syntax: phonegap local plugin remove
Ex:- phonegap local plugin remove https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin remove
Ex:- cordova plugin remove https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

Alternative
You can install “plugman” to plug and play with plugins by following this link
Using Plugman to Manage Plugins
Note: plugman doesn’t take proxy

References

PhoneGap Installation and running Sample Application on Windows


Pre-requisites


Softwares

1.       Node.js
2.       Ant (Zip)
3.       Java SDK 1.7
4.       Android SDK
5.       Eclipse (Zip)
6.       Cordova (Zip)

Setup Environment Variables

1.       NODEJS_HOME
2.       ANT_HOME
3.       JAVA_HOME
4.       ANDROID_SDK
5.       CORDOVA_ANDROID

PATH Environment Variable Update

Add NODEJS\bin;ANT_HOME\bin;JAVA_HOME\bin;ANDROID_SDK\tools;ANDROID_SDK\platform-tools

Install phonegap

If you are behind a proxy please set the proxy to npm (Node.js) command
Syntax:-
(HTTP) C:\> npm config set proxy http://proxy.company.com:port
(HTTPS) C:\> npm config set https-proxy http://proxy.company.com:port

Run the install command

C:\> npm install –g phonegap
C:\> npm install –g cordova
Note: If you get any ”shasum (Checksum)” error, then please
i)                    clear the npm and npm-cache directories from %User%/AppData/Roaming folder
ii)                  Install the latest npm version
Currently it is 1.3.21
npm install https://registry.npmjs.org/npm/-/npm-1.3.21.tgz
npm install -g phonegap


Create Project

Syntax: phonegap create
Ex: phonegap create FirstPhnGpPrj com.pg.firstphngpprj PhoneGapPrj1

·         Now it will create some folders and corresponding files (HTML, CSS, JS)
·         Change the directory to your project directory
o   Ex:- C:\> cd FirstPhnGpPrj

Add Platform

Syntax: cordova platform add
Ex:- C:\FirstPhnGpPrj> cordova platform add android

Tip:
If it’s not working then you need to install the cordova (npm install –g cordova)
Copy the cordova-android\bin from your downloaded&extracted zip file to %User%\.cordova\bin

Run Phonegap for Individual Platform

Syntax: phonegap run
Ex:- C:\FirstPhnGpPrj> phonegap run android

1.       By now, you will be getting your Android project hierarchy in your project_folder\platforms\android\
2.       Import the existing android code from your Eclipse
3.       Create\manage AVD
4.       Run the project

Adding Plugins to your project

Pre-requisites

·         Install Git
Tip: If you are behind a proxy then please add it your configuration
Syntax: git config –global http.proxy http://proxyusername:proxypassword@server.company:port
Ex: git config –global http.proxy http://abc:123@xyz.com:8081

·         Add git\bin to your PATH environment variable
·         You need to download the git files from https://git-wip-us.apache.org. So make sure that the above specified URL is not blocked by your firewall
·         Navigate to your project directory in command prompt by changing the directory
cd

Install Plugin

Syntax: phonegap local plugin add
Ex:- phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin add

Remove Plugin

Syntax: phonegap local plugin remove
Ex:- phonegap local plugin remove https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Tip: If this doesn’t run then try with cordova
Syntax: cordova plugin remove

Alternative

You can install “plugman” to plug and play with plugins by following this link

References


October 08, 2013

OpenVPN Server Windows 7 Installation

Objective

Install OpenVPN Server on Windows 7 machine.
I have followed the tutorial from OpenVPN community. https://community.openvpn.net/openvpn/wiki/Easy_Windows_Guide

Pre-requisites

Disable the Windows Firewall (OR) Enable an Inbound Rule for the port 1194 [2]

Download and Installation

  • Download OpenVPN Server. http://openvpn.net/release/ (Get the latest Version executable based on time)
  • Install the downloaded .exe by running with Administrator privileges
  • Specify the path to a folder which doesn’t have spaces on path.
    • Example:-

      • C:\OpenVPN [Use] [I am installing in this directory and throughout this post, I will be referring this as default OpenVPN installed directory]
      • C:\Program Files (x86) [Don’t use]
  • Navigate to OpenVPN installed directory
  • Go to config folder
  • Create a file with name server.ovpn
  • Paste the content as specified below
  • Go to Network Connections in Windows 7 [Control Panel\Network and Internet\Network Connections]
  • Rename TAP-Win32 Adapter to “MyTap” as described in server.ovpn [Names should match in both server.ovpn and Adapter name]
  •    1: port 1194 #change to any port you see fit. The client needs to use the same port

       2: proto udp #switch to tcp if you wish to use a tcp connection, the client needs to use the same protocol. udp gives better performance

       3: dev tun

       4: dev-node MyTap #name of your TAP interface.

       5: server 10.8.0.0 255.255.255.0 #This may need modification as dictated by Internet Connection Settings. This is the default for ICS on Windows 7.

       6:  

       7: ca "C:\\OpenVPN\\easy-rsa\\keys\\ca.crt"

       8: cert "C:\\OpenVPN\\easy-rsa\\keys\\server.crt"

       9: key "C:\\OpenVPN\\easy-rsa\\keys\\server.key"  # This file should be kept secret

      10: dh "C:\\OpenVPN\\easy-rsa\\keys\\dh1024.pem"

      11: ifconfig-pool-persist ipp.txt

      12:  

      13: push "redirect-gateway def1" #tells all Internet traffic to go through the tunnel

      14: push "dhcp-option DNS 208.67.222.222" #OpenDNS servers, makes it easy to check if the tunnel is working properly

      15: push "dhcp-option DNS 208.67.220.220"

      16: keepalive 10 120

      17: comp-lzo #compression for better network performance. Disable if your server isn't powerful enough. Needs to be included in both server and client configs if you use it.

      18: persist-key

      19: persist-tun

      20: status openvpn-status.log

      21: verb 3



Certificates and Keys Creation

Initial Configuration

  • Open command prompt with Administrator privileges

  • Navigate to OpenVPN directory

  • cd C:\OpenVPN\easy-rsa\

  • run init-config.bat
    • C:\OpenVPN\easy-rsa> init-config

  • Open vars.bat

    • C:\OpenVPN\easy-rsa> notepad vars.bat

  • Change the HOME variable to your path
    • HOME=C:\OpenVPN\easy-rsa

  • Change country, province, City, Org, email

  • You can add KEY_NAME=your-name and KEY_OU=VPNer

  • Run the vars.bat file
    • C:\OpenVPN\easy-rsa> vars

  • Run the clean-all.bat file
    • C:\OpenVPN\easy-rsa> clean-all

Creating Certificates and Keys


Your Own Certificate Authority Generation

  • Open command prompt with Administrator privileges

  • Navigate to OpenVPN directory

  • cd C:\OpenVPN\easy-rsa\

  • run build-ca.bat

    • C:\OpenVPN\easy-rsa> build-ca

    • Accept the defaults and give Common Name as your-company CA

    • Ex:- OpenVPN-CA


Server Certificate and Key Generation

  • Open command prompt with Administrator privileges

  • Navigate to OpenVPN directory

  • cd C:\OpenVPN\easy-rsa\

  • run build-key-server.bat file

    • C:\OpenVPN\easy-rsa> build-key-server server

    • Enter common name as “server” since your command line input parameter is “server”

    • Sign Certificate: accept with ‘y’

    • Commit: accept with ‘y’


Client Certificate and Key Generation

  • Open command prompt with Administrator privileges

  • Navigate to OpenVPN directory

  • cd C:\OpenVPN\easy-rsa\

  • run build-key.bat file

    • C:\OpenVPN\easy-rsa> build-key client-name

    • Ex:- build-key my-laptop

    • Enter common name as “my-laptop” since your command line input parameter is “my-laptop”

 Key Exchange Certificate(Diffie-Hellman)

  • Open command prompt with Administrator privileges

  • Navigate to OpenVPN directory

  • cd C:\OpenVPN\easy-rsa\

  • run build-dh.bat file

    • C:\OpenVPN\easy-rsa> build-dh

Send Server Certificates and Keys to Client


Send the following files to client
  1. ca.crt

  2. client-name.crt

  3. client-name.key

All these files will be stored in C:\OpenVPN\easy-rsa\keys


Common Errors and Resolution

  • openvpn unable to write 'random state'
    • Change the HOME variable path to absolute path in vars.bat file

    • Ex: HOME=C:\OpenVPN\easy-rsa

  • openvpn server directive network/netmask combination is invalid
    • Give IP address as 10.8.0.0 in server.ovpn

  • TapAdapter not found

    • Go to Network Connections in Windows 7 [Control Panel\Network and Internet\Network Connections]
    • Rename TAP-Win32 Adapter to “MyTap” as described in server.ovpn [Names should match in both server.ovpn and Adapter name]


Run OpenVPN GUI

  • Start->All Programs->OpenVPN->OpenVPN GUI

  • It will come to status bar as notification icon [Default: bottom]

  • Rightclick on OpenVPN GUI and click on “Connect”

  • It should display proper log, if any error please search in Google and openvpn forums

References


https://community.openvpn.net/openvpn/wiki/Easy_Windows_Guide

http://blog.defron.org/2013/01/openvpn-server-on-windows.html

Please send your feedback and comments to psrdotcom@gmail.com

Blogger Labels: OpenVPN,Server,Installation,Objective,Install,machine,tutorial,Easy_Windows_Guide,requisites,Disable,Firewall,Enable,Inbound,Rule,port,Download,Version,Administrator,privileges,Specify,path,folder,spaces,Example,directory,Program,Files,Navigate,Create,Paste,Network,Connections,Control,Panel,Internet,Rename,Adapter,MyTap,client,needs,connection,protocol,performance,node,interface,modification,gateway,traffic,option,OpenDNS,compression,status,Creation,Initial,Configuration,Open,notepad,Change,HOME,province,KEY_NAME,KEY_OU,VPNer,Certificate,Generation,Accept,Common,Name,Enter,parameter,Sign,Commit,laptop,Exchange,Diffie,Hellman,Send,Resolution,directive,combination,Give,TapAdapter,Start,notification,icon,Default,bottom,Rightclick,Connect,error,Google,Certificates,Errors,forums,References,wiki,config,ovpn,dhcp,init,vars

October 03, 2013

Chennai Autorickshaw Old Vs. New Fare Android Application Lite Version

Hi all,

I have released the free version of chennai autorickshaw android app in google play.

Please look at this app and send your feedback.

https://play.google.com/store/apps/details?id=info.pillisureshraju.chennaiautokaasulite

Get it on Google Play





 Download it for free.

Scan QR
and install on your phone directly.


September 27, 2013

Convert Physical/Virtual Machine to vSphere ESX using VMware vCenter Converter Standalone

Hi all,

Objective

Moving/converting locally installed VMware Virtual Machine to vSphere ESX

Procedure

Download VMware vCenter Converter Standalone
Install it on your own windows machine (or) client/server mode
Once the installation completed, run the coverter
Click on "Convert machine"
Select the VM type and select .vmx file
Enter your destination vSphere server/ip address, username and password
Click on "Next"
You can change the VM configuration before coverting
Click on Next
Now it will start converting your VM and copy the VM to your vSphere
On vSphere, like normal vSphere client, you can start your VM and enjoy the configured/already using VM on vSphere.

Please send your comments and feedback to psrdotcom@gmail.com

September 24, 2013

Chennai Old Vs. New Fare Meter Fare Comparision Android App on Google Play

Hi all,

I have designed and developed an app for all the Chennaites, who use auto tranportation.

There has been an hike in prices of autorickshaw fares. Most of the autos didn't get updated to new meter with GPS functionality. Those who are traveling in old autos, either they have to compute the new fare with old (OR) pay whatever auto guy says.

Lets not pay whatever they say, we have developed an app, where you can compute and compare the old and new auto fares.

Lets give a try into looking at our app.

Scan and download app:
https://play.google.com/store/apps/details?id=info.pillisureshraju.chennaiautokaasu&hl=en

Its a complete off-line application, which doesn't require any additional permission from your mobile.

Compute and compare exact amount of old and new Chennai auto-rickshaw fare with day and night time fares.

If your hired auto doesn't have new meter and you have to compute the old and new meter fare then its very easy with our app for your new price calculation.

You can select the traveled distance in exactly using kilometers (Kms.) and meters (Mts.). If any waiting time, select in hours (Hrs.) and minutes (Min.)

Automatically you can find the old auto fare and new auto fare with day and night paying amounts.

I hope you all make use of this.

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com