Archive for the ‘PHP’ Category

Kill all PHP Processes on Unix

No Comments » by Jon Hibbins on 4 January 2012
Filed under: PHP, Quick Tips, Uncategorized, Unix/Linux

You can kill all the PHP processes in Unix with the following command :

killall php

Android Mobile SDK Web Browser Testing on OSX

No Comments » by Jon Hibbins on 3 October 2010
Filed under: Code, HTML, OSX, PHP, Platform, Quick Tips, Web

Because it’s painful, here’s how I did it on OSX :

1) Download Android SDK

2) Install it

/Android/android-sdk-mac_86
cd /Android/android-sdk-mac_86/tools

3) Setup the Emulator

./android
  • A Java app opens
  • Click SDK Platform Android 2.1 and download Archive for MacOS X
  • Click Virtual Devices and New
  • Give a name (AndroidTest), set the target to the SDK you downloaded
  • Set Size to 512
  • Create the AVD (Android Virtual Device)

4) Run the Emulator

./emulator -avd AndroidTest -partition-size 128

5) Setup the Hosts file

Set the device to read-write

./adb remount
./adb pull /etc/hosts

Edit the hosts with the following

nano hosts
10.0.2.2 localhost
./adb remount
./adb push hosts /system/etc

Congratulations you should now be able to browse the hosts

Zend Server CE on OSX 10.6 Snow Leopard

No Comments » by Jon Hibbins on 18 October 2009
Filed under: MySQL, PHP

When I installed Zend Server CE on OSX 10.6 Snow Leopard the admin interface failed, the following fixed the issue :

1. Download this: Watchdog update

2. Backup watchdog with the command

sudo mv /usr/local/zend/bin/watchdog /usr/local/zend/bin/watchdogOLD

3. Extract the new watchdog to /usr/local/zend/bin/ (I used the go to folder in finder, if you can view hidden files)

4. Run the following command to restart the Zend server

sudo /usr/local/zend/bin/zendctl.sh restart

4 Coding tips

No Comments » by Jon Hibbins on 26 August 2009
Filed under: .NET, C#, Code, Java, Objective-C, PHP, Quick Tips, Software Development

1: Delete It !
If a chunk of code comment or class is not used, don’t comment it out, just delete it.

2: Write clear code.
“make sure you document code that’s hard to understand”. Question: why is the code hard to understand?

3: Comment
Comments can indeed be useful but mostly as a summary of action

4: Don’t Repeat Yourself
Duplication is bad. If you have more than 4-5 lines of code that do the same thing in a single class, refactor to remove duplication.

Autostart Zend Core on Ubuntu

No Comments » by Jon Hibbins on 18 September 2008
Filed under: MySQL, PHP, Platform, Unix/Linux

This is the 2nd time I have had to search for starting up Zend Core automatically on Ubuntu Workstation, so here is the answer:

First change the permissions of /etc/rc.local by opening a terminal window (Applications|Accessories|Terminal) and enter the following command:

sudo chmod 777 /etc/rc.local

Then open this file with the text editor (Applications|Accessories|Text Editor) and put the following text before the exit 0 command

cd /usr/local/Zend/Core/mysql && ./bin/safe_mysqld &
/usr/local/Zend/apache2/bin/apachectl start &

Zend Core, PHP and MySQL should now all start automaticaly at boot time.