Friday, September 2, 2011

How to lauch iphone app from command prompt

If you want to launch you iOS app, iphone app from command prompt/terminal, here are the steps.

1. Download iphonesim source code from https://github.com/jhaynie/iphonesim

2. Untar the package and use xcodebuild to build the package


$unzip jhaynie-iphonesim-d930444.zip
$
$ cd jhaynie-iphonesim-d930444
$ ls
README iPhoneSimulatorRemoteClient iphonesim_Prefix.pch
Source iphonesim.xcodeproj
$
$ which xcodebuild
/usr/bin/xcodebuild
$
$ xcodebuild -project iphonesim.xcodeproj -alltargets

3. After you build iphonesim project, it will create an iphonesim binary in Release folder

$ pwd
jhaynie-iphonesim-d930444/build/Release
$ ls
iphonesim iphonesim.dSYM
$

4. You can run the application by first building your application in xcode using the xcodebuild command from the command line. You can then run it in the simulator using follwing an an example:

$ iphonesim launch ~/tmp/yourproject/build/Debug.simulator/yourproject.app

You need to point to either Debug.simulator or Release.simulator based on which build type you built with.


Wednesday, February 16, 2011

Install PHPunit and upgrading PEAR.

PhpUnit manual has all information about to install phpunit on your server.

http://www.phpunit.de/manual/3.5/en/phpunit-book.html#installation

PHPUnit 3.5 requires PHP 5.2.7 (or later) but PHP 5.3.3 (or later) is highly recommended.

sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com

This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel:

sudo pear install phpunit/PHPUnit

After the installation you can find the PHPUnit source files inside your local PEAR directory; the path is usually /usr/lib/php/PHPUnit.
After installation, if you don't find phpunit utility, the please check your pear installation version.
Phpunit installation requires PEAR version >= 1.9.1
You can update PEAR version by using command,

sudo pear upgrade pear

This will upgrade pear and then if you run 'pear install phpunit/PHPUnit' this will install phpunit correctly.

If you see following error,

Failed to download pear/HTTP_Request2 within preferred state "stable", latest release is version 2.0.0RC1, stability "beta", use "channel://pear.php.net/HTTP_Request2-2.0.0RC1" to install
phpunit/PHPUnit can optionally use PHP extension "dbus"
pear/XML_RPC2 requires package "pear/HTTP_Request2" (version >= 0.6.0)
phpunit/PHPUnit requires package "pear/XML_RPC2"
No valid packages found
install failed

To install this missing HTTP_Request2 package, run following command,

sudo pear install HTTP_Request2-2.0.0RC1

If you see following error while executing above command,

Failed to download pear/Net_URL2 within preferred state "stable", latest release is version 0.3.1, stability "beta", use "channel://pear.php.net/Net_URL2-0.3.1" to install
pear/HTTP_Request2 requires package "pear/Net_URL2" (version >= 0.3.0)
pear/HTTP_Request2 can optionally use PHP extension "fileinfo"
No valid packages found
install failed

Then in that case you will need to install Net_URL2 package first, for doing so use following command,

sudo pear install NET_URL2-0.3.1

now install HTTP_Request2 and then PHPUnit.