Monthly Archives: July 2008

Stormy Kaukapakapa

New Zealand current season is winter, and this winter has been a pretty wet and wild! For the last week or so there has been “Record wide and deep lows” Thats equates a shit load of rain ( half a meter in this area ( or around 19 inches )). Along with losing power and my post “July rain brings no power” which is happening far to frequently for my liking and losing a few trees over fence lines and sadly loosing a couple of calves due the the cold weather, we now have more flooding !

Installing PHP5 and mySQL on Mac OSX Leopard

There has been a lot of posts on a lot of sites that explain how to get PHP and mySQL working & talking on OSX Leopard, but none that are fully step by step. So with thanks to The Busy Geek ( www.thebusygeek.com ), Here is a comprehensive guide.

You will need a very basic knowledge of using OSX Terminal ( Command Line Commands) and your root password.

Step 1:

Go to Developer.MySQL.com and download the copy that matches your Machine. In my case because I am on a G4 PowerPC iBook, I had to download the 10.4 version (Mac OS X 10.4 (PowerPC, 32-bit)) as there is no 10.5 version for PPC.

Once you have downloaded the package, install all 2 packages, and the preference pane.

Installing the MySQL packages.

Installing the MySQL packages.


Step 2:

Open Terminal ( Applications / Utilities / Terminal.app ) and log in as root;

sudo su

Enter your root password when prompted.
Navigate to your mysql directory;

cd /usr/local/mysql

If you view the directory you should see something like the following;

ls

COPYING			data		scripts
EXCEPTIONS-CLIENT	docs		share
INSTALL-BINARY		include		sql-bench
README			lib		support-files
bin			man		tests
configure		mysql-test

Next we start mySQL.

./scripts/mysql_install_db --user=mysql

It should run a whole lot of commands, starting with…

Installing MySQL system tables...

Once that has finished we add the mySQL User permissions

./bin/mysqld_safe --user=mysql &

Which will ( or should ) give this..

Starting mysqld daemon with databases from /usr/local/mysql/data

Now the mySQL root user’s password. and then confirm password and database location.

./bin/mysqladmin -u root password '**PASSWORD**'
./bin/mysqladmin -u root -h **IP_ADDRESS** password '**PASSWORD**'

Now, All going well, Lets hope you get this error:

./bin/mysqladmin: connect to server at '**IP_ADDRESS**' failed
error: 'Host '**IP_ADDRESS**' is not allowed to connect to this MySQL server'

Thats good news, This means mySQL is running and that is step 2 finished.

Step 3:

Next Step, We will install PHP, You think huh? Apple already has a copy of PHP pre-complied in OSX?
Yeah, true, but ( No Offense Apple ) its shit.

Still as root user:

cd /usr/local/

We want to download the newest build of PHP from Marc Liyanage’s site. Thank you to Marc, who has openly releasd and supported Great PHP builds for years! And totally for free!
* Make sure this path represents the newest version.

curl -O http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz

We have used cURL as OSX does not support wGet. Remember the -0.

You will see if download like this…

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 51 85.2M   51 43.4M    0     0  47790      0  0:31:10  0:15:54  0:15:16 52563

Once the download has completed, uncompress it with this command:

tar -zxvf php5-5.2.5-6-beta.tar.gz

Making sure that the file name represents the downloaded file name.
(z = gunzipp, x = uncompress, v = view, f = force ).

View the dir;

ls

You should get a directory looking like this;

OpenSourceLicenses	include		mysql-5.0.51b-osx10.4-powerpc
OpenSourceVersions	lib		php5
bin			mysql		php5-5.2.5-6-beta.tar.gz

Go into the PHP5 Directory; Then view the dir.

CD php5
ls
bin			etc		info		libphp5.so	php.d
entropy-php.conf	include		lib		man		share

Then Copy the entropy-php.conf file in to the Apache2 Dir installed by Apple.

cp entropy-php.conf /etc/apache2/other/

Now we need to tell Apache to use our new version of PHP and not the original Apple build.

cd /etc/apache2/

Open the httpd.conf and comment out the following line.

LoadModule php5_module        libexec/apache2/libphp5.so

by placing a # in front of it.

#LoadModule php5_module        libexec/apache2/libphp5.so

To Save your changes press “ctrl x”, there will be a prompt to save, press “y”, then press “return” to save with the same filename.

Now restart Apache with this Command

apachectl restart

And we are done.

Installing PHP and MmySQL Summary

Begin writing your PHP/mySQL applications.

You can access your local Apache environment at two locations:

http://127.0.0.1/		/Library/WebServer/Documents/

or for your User account:

http://127.0.0.1/~username/		/Users/username/Sites/

Enjoy :)

July rain brings no power.

Saturday:
Power Outage: July 26th 11:38am
Power Returns: July 26th 3:17pm (Downtime: 2 hours, 49 minutes)
Power Outage: July 26th 3:26pm (Online: 9 minutes)
Power Returns: July 26th 4:52pm (Downtime: 1 hour, 26 minutes)

Sunday:
I know the power went out multiple times, but I was out braving the rain, so don’t know the times.

Leasons learnt with no power:

CD (Compact Disc’s) were made to hold 79 minutes of audio because that is the length of Beethoven’s 9th Symphony, 79 minutes.

It raining outside, It looks like a river down the drive.

Overview of my Desk, with no power.

My Desk, Nothing with power due to rain, except my router.

My UPS, keeping me online while there is no power.

Installing Windows in my PowerPC iBook running OSX Leopard

I don’t have my Intel Mac any more,  Until I finally get around to upgrading this iBook to an Intel based mac I can’t use programs like Parraels or VMware Fusion to run Linux or Windows operating systems on my mac.

I need to test my pages in Microsoft Internet Explorer,  and with out having a dedicated Windows machine for that one purpose I could not,  Until I came across Q.  

Q Emulator Q-0.9.0a89  is a free port of QEMU for OS X, that allows you to run Linux, most versions of Windows and many other operating systems on your Mac.

With the release of Intel based Macs, there have been several applications developed for running Windows on your Mac, with Parallel Desktop and Boot Camp being the most popular. Q emulator (QEMU) is a free alternativeapplication, that takes advantage of OS X most advanced technologies like openGL and CoreAudio.

 

FEATURES

  • Runs On Panther, Tiger And Leopard
  • Runs in Intel or PowerPC Mac’s
  • Switch Between Any Guest Computers
  • Restart A Guest Computer At Any Time
  • Exchange Files Between Host And Guest Computers
  • Import/Export Guest As Executable Packages
  • Supports Toolbar In Full Screen Mode Now
  • Much More
INSTALLING
You Need a copy of the Operating system you wish to install,  In my case Microsoft Windows XP SP3.
Installation was easy as,  Insert the Windows dick in to my mac,  open Q,  Select the Guest PC Menu -> New Guest PC.  And Install like any other Windows installation,  Slow and sluggish..  It took quite a while on my machine,  But I  was using it the whole time while installing it in the background.
It runs well once it is all installed,  It will run at the same resolution as your current system with Shard Ram and video.
I’m running it now to write this and luckily or not,  I still havn’t got the Blue Screen of Death (yet). 
Found on http://geeksaresexy.blogspot.com/2006/05/blue-shirt-of-death.html

Found on http://geeksaresexy.blogspot.com/2006/05/blue-shirt-of-death.html

Cyberduck to Transmit FTP

I work on the internet,  I program websites,  So I send a good portion of my day connected to either of my or my clients servers via FTP/SFTP.   I have for a long time,  used Cyberduck for all of my FTP needs.  It has been great,  Good bookmarking systems,  Project/Connection draw,  It allows my to work directly on my files with TextMate,  supports multiple connection types ( FTP,SFTP, WebDave, Bonjour, .Mac ( MobileMe)) and has done everything I have wanted in a Free FTP Client.

About a month ago, Cyberduck updated to Version 3.  It has some new features,  a different bookmark system,  QuickLook type image/file preview, and I find is a better interface.  With this new version it has become increasingly unstable.  The application crashes often,  too often.  Some times 2-3 times in an hour!  which is way too often and as a result I have lost files I have been working on.  If I have FTP’d files open in TextMate,  and Cyberduck crashes, that it, I can’t reopen my connection and continue working on those open files,  I have to copy out the changed code,  re-open the files,  paste in the new code and then continue.  This can take minutes just to get back to where I was,  and some times losing this time,  or break in motion really cause delays in what I was writing.

I am by far not saying Cyberduck is not a good application.  It is great and once the guys have released an update or bug fix I am sure I will go right back to using it.  It may be my computer system.  I am using a 1.42ghz PowerPC G4 iBook running OSX Leopard 10.5.4 So it may be that version 3 has more support for Intel Mac’s  which I am looking to upgrade,  but still love this ol’ girl,  She does well.

A couple of friends have recommended using Transmit From Panic Software.  It starts of way different,  I am yet to really get in to it and set it up.  I have started moving across my bookmarks have have set my default programs for it to use.  And will repost once I have with more info once I have used it more in the next few days.

If any one has any hints for using it better,  as always,  advise is welcomed.

I love apple

I love Apple,  I love their products,  their ideas and their beauty.  I have used them for as long as I have used computers.  I started as the only ‘Mac’ fan in my group of friends and have slowly converted a few and am always trying to convert more.  Even some of my die hard windows friends who would never own a mac hae them,  And others are looking to switch.

This makes me very happy.

I read and have read for a long time an Online Comic Least I Could Do  and today I read this post.  To see more and more people realise that apple is great,  not just for their iPods makes me,  an avid Mac fan, Smile :)

 

Least I Could Do Comic

Least I Could Do Comic

PHP Captcha Image Verification

This article is mostly based on my post on my business website Zipline Interactive, PHP Captcha Image Verification. For a demo refer to this link or contact me.

This CAPTCHA is a PHP script that protects websites against spam bots by dynamically generating a random string of text that humans can read but current computer programs cannot. For example, humans can read the randomized text as the one shown below, but automatic spam systems ca not read the random image text.

This CAPTCHA uses PHP, Sessions and PHP’s GD Library with PNG support.

The term CAPTCHA (for Completely Automated Turing Test To Tell Computers and Humans Apart) was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford of Carnegie Mellon University.

< ?php
// Captcha Image Verification by Sheldon Lendrum of Zipline Interactive
// http://www.gozipline.com
// http://www.gozipline.com/52,phpcaptchaimageverification
// info@gozipline.com
// 07/08/2008

// captch.php
// DECLARE SESSION

@session_start();

// LENGTH OF CAPTCHA STRING
$length=5;
// FONT SIZE 1 (SMALLEST) - 5 (LARGEST)
$font = 5;
// POSSIBLE CHARACTERS IN CAPTCHA STRING
$possible = "23456789bcdfghjkmnpqrstvwxyz";
// PATH TO PNG BACKGROUND IMAGE
$captcha = imagecreatefrompng("./captcha.png");
$i = 0;
$g = 60;
$hash = "";
// CYCLE THROUGH LETTERS TO MAKE STRING
while ($i < $length) {
// GET RANDOM COLOURS, 0-255
// IN THIS EXAMPLE I HAVE SELECTED DARK COLOURS ONLY SO THE
// S ARE READABLE ON THE LIGHT BACKGROUND
$c1 = rand(0, 155);
$c2 = rand(0, 155);
$c3 = rand(0, 155);
$colour = imagecolorallocate($captcha, $c1, $c2, $c3);
// CHOOSE RANDOM CHARACTER
$string = substr($possible, mt_rand(0, strlen($possible)-1), 1);
// BUILD STRING TO SEND TO PROCESSING
$hash .= $string;
// WRITE STRING TO IMAGE
imagestring($captcha, $font, $g, 20, $string, $colour);
$i++;
$g = ($g + 20);
// CLEAR LETTERS TO STOP DUPLICATES
unset($string);
}
// SET ENCRYPTED CAPTCHA STRING TO A SESSION STRING
$_SESSION['spammer'] = md5($hash);
// OUTPUT CAPTCHA IMAGE
header("Content-type: image/png");
imagepng($captcha);

?>

To show your new Captcha Image in your form, simply call the ‘captcha.php’ file in your image tag as follow:

Captch Image Verification

When you process your form, you need to compare the $_POST captcha data with your Session string:

< ?php
// Captcha Image Verification by Sheldon Lendrum Zipline Interactive
// http://www.gozipline.com
// http://www.gozipline.com/52,phpcaptchaimageverification
// info@gozipline.com
// 07/08/2008

// process.php
// DECLARE SESSION

@session_start();

// $_POST['spammer'] IS THE NAME OF THE IMAGE VERIFICATION FIELD IN THE FORM.

// MAKE SURE BOTH THE FORM SPAMMER FIELD AND THE SESSION STRING ARE NOT EMPTY

if(empty($_POST['spammer']) or empty($_SESSION['spammer'])){
	// THE POST STRING OR THE SESSION STRING WAS EMPTY
	die("

The Captcha Image Verification was empty! "); }else{ // BOTH POST STRING AND SESSION STRING HAVE A VALUE. // MD5 POST STRING $postSpammer = md5($_POST['SPAMMER']); $sessionSpammer = $_SESSION['SPAMMER']; // COMPARE STRINGS if($postSpammer !== $sessionSpammer){ // THE POST STRING FROM THE FORM DID NOT MATCH THE SESSION STRING // RESET THE SESSION $_SESSION['spammer'] = NULL; die("

The Captcha Image Verification did not match. This is Case Sensitive!

"); }else{ // BOTH STRINGS MATCHED // RESET THE SESSION $_SESSION['spammer'] = NULL; // CAPTCHA IMAGE VERIFICATION PASSED, CONTINUE PROCESSING THE FORM... // ... } } ?>

Here is a PNG background image you can use.

Linksys SPA942 IP Phone

With my Job, I currently work from home in New Zealand, for a firm Zipline Interactive in the States. I use chat and email to talk with the office, but also have a Linksys SPA942 IP Phone. It connects to an asterisk server provided by Limelyte Technology. Considering how shit my internet here in NZ is and the price i get ripped of paying for it, the phone works bloody well. I just spent over an hour talking to a client, going over the job I am doing for him, all the time viewing the pages I was explaining, sending an email or two, and chatting on my IM.

I have a friend who yesterday got the same phone, So last night while my NZ Server was the unlucky recipient of a DoS Attack we spent a good couple of hours chatting over the phone working on resolving the issues, calling the two ISP’s involved, swearing and sharing porn links, I noticed the whole time the phone’s traffic was constantly less that 4kb, which is nothing.

We set about trying to customize some of the settings the SPA942 has.

Firstly: My SPA has four lines. I have 2 set up for my Zipline VoIP Server, And two for My New Zealand VoIP server. Being both Arron and I have the same phone we wanted to find out “Can I transfer a call from my NZ VoIP Service to my US VoIP?”

I have a cousin Near New York currently being a leader for one of those CampUSA type adventures. It sounds fun, but we miss him and I’m sure his family do also. So why have I mentioned Ed? cause he can call my US number, which rings my phone here in NZ, Then I can transfer him to my NZ line, then transfer his call to his parents and my other cousin who we are both close to.

So, Arron and I tried, called from either server, on different lines and transferred the call to the other voip line/server. It wouldn’t work? It would keep dropping the line. It appears that the two servers didn’t want to play….

But, all is not lost! These phones have Conference Call! and that works, and works well.

1) Make the first call.

2) Press hold, Call the second call.

3) Press ‘CONF’ and select your first caller.

Talk!

Secondly: Add a your BMP logo as a wallpaper:

This takes a little but of fiddling to get right, Solid colour bold text works the best.

I will explain how to do this in photoshop, and this is how it was explained to me, and all that i knew how to use.

1) Open Photoshop and create a new document. Create the document 128px x 48px, then set the Colour Mode to Bitmap 1bit.

2) Open or create your logo in a different window, resize it so the maximum length will fix in the bitmap image. Copy it in to your bitmap and save it to your computer.

3) To allow your phone to use the Image you need to upload it to a web server, and then log in to your phones web interface. To find your Phone’s IP if you don;t know it. Press the “Menu” button, scroll down to “Network” ( or press 9 ), You will see your Phones DHCP IP there. In my case it is 10.0.0.9 ( If your network is not running DHCP, scroll down to “Non DHCP IP Address” ( or press 8 ).

Open your favorite web browser, today is Safari and navigate to “http://10.0.0.9″, This will bring you to your phone settings, Click “Advanced” on the top right, then the “Phone” tab.

Now enter your http Image path as below:

I havn’t managed to add my own ring tones as of yet, So if any one can help me with that, I would really appreciate your help!