Category Archives: Advice / Tips

Tips & Advice to get you started

Installing ZooKeeper for PHP on CentOS 6.3

This post is very short, simply as a reference to anyone out there that would like to install ZooKeeper on CentOS 6.3, and connect via the PHP Bindings.

To download ZooKeeper, you can visit Globocom’s GitHub page for updated versions. Below are the versions I used at the time of writing.

Install ZooKeeper:

curl -O http://cloud.github.com/downloads/globocom/zookeeper-centos-6/zookeeper-3.4.3-2.x86_64.rpm
rpm -ivh zookeeper*
service zookeeper restart

ZooKeeper is now up and running, but you need to install some more stuff before you can connect to it!

curl -O http://cloud.github.com/downloads/globocom/zookeeper-centos-6/libzookeeper-3.4.3-2.x86_64.rpm
rpm -ivh libzookeeper*
curl -O http://cloud.github.com/downloads/globocom/zookeeper-centos-6/libzookeeper-devel-3.4.3-2.x86_64.rpm
rpm -ivh libzookeeper-devel*

Install php-zookeeper from Andrei Zmievski:

git clone https://github.com/andreiz/php-zookeeper.git
pear build
./configure
make
make install

add zookeeper.so to your php.ini, or create zookeeper.ini and place it in your php.d folder!

Hope that helps someone!

Cheers

Share

Apple or Android / Apple or Microsoft

With it being over 6 months since my last blog post, I figured I’d stick another post in. This time I’m looking for your opinion on whether I should stick with my current setup (below) or move to a new setup!

My Current Setup (Got a problem with Dell? Well it’s never failed for me!)

Desktop: Dell Dimension 9200 Tower w/19″ Widescreen (Windows 7 Ultimate)
Laptop: Dell Inspiron 1545 w/15.6″ Widescreen (Windows 7 Ultimate)
Phone: Google Nexus One (Froyo AKA Anroid2.2)

I’ll start with my Dekstop: I bought it in June 2007 as I needed a “super-fast” computer for working with .NET and the Silverlight Framework in my new job – as it happens I decided to focus my ‘career’ down the PHP route, so I’ve never really utilsed the power. Naturally though, this meant that it was always meant to be a Windows-based PC, and it came with Vista (which I have since upgraded to Windows 7). I’ve played with Ubuntu before, and I like it – but I have too many applications that I cannot get to work correctly within it (Photoshop, Fireworks, Flash etc). So, I’m using Windows 7 – and it’s great (no, seriously, it is!)

It’s pretty much the same story with my laptop.

Roll forward to April 2009, and I bought my shiny Apple iPhone 3G – I gave my iPod Nano away, and loaded all my music onto the phone. The iPhone was Awesome, but that didn’t stop me buying a Google Nexus One (January 2010). Why? Because I love Google! After using both, I can definately say that the Android device offers much more than the iPhone 3G, and that I know I made the right decision.

I now use Dropbox to syncronise my Desktop with my Laptop, and also have the Dropbox App on my phone. So everything is perfect, it’s all good – but I want something new and shiny to play with, like an iPhone 4, and an MacBook Pro…

Can someone convince me that I’m being stupid, or persuade me enough to go out and buy one…?!

Share

iPhone SDK on a Mac G4 without a intel based CPU.

So,

last weekend i spent about 2 hours watching the “getting started” videos on how to use the apple iPhone SDK. I proceeded to try to download the iPhone SDK but to my disappointment this is only possible if you have Mac OS X. I currently use a Core 2 DUO with 2 GB RAM running Windows 7; whereas my laptop is a Core2duo with 3GB RAM running Vista. I didn’t fancy dual booting with a dodgy copy and hacked version of Mac OS X

The idea was to create an application for the company I work for; so during the week my boss found me a spare Mac Mini PowerPC G4. It’s been laying around on a desk collecting dust for god knows how long. So last night I fetched it home…(my first mac, EVER!)

After upgrading from Panther to Leopard 10.5; I upgraded to 10.5.8 and downloaded the 2GB iPhone SDK (bundled with the latest verison of xcode) from the Apple site. I proceeded to open the installation only to discover that whilst I can install xcode the iPhone SDK option is only available if you have an Intel-based Mac. This was rather infuriating! Anyway; long story short – I Googled until I was highly delighted with finding the following site:

How to run iPhone SDK on a non intel based Mac (G4, G5 etc)

At the above URL. there are instructions on how to get xcode to let you build an iPhone app on a non-intel based Mac. Just in case the link doesnt work , I have pasted the post here:

Officially the iPhone SDK requires an Intel Mac with OSX 10.5. Since I have a four year old dual G5, which is still running like a young dear, I don’t want to buy a new Mac just for writing iPhone Applications.

After some research, I found out, that it’s possible to make it work on PPC since the iPhone SDK are universal binaries.

To share my knowledge, I write a small tutorial. Note, that I don’t take responsibility, for any defects cause somebody used my code!

How to get the iPhone SDK to work on PPC Macs

Most of the tutorials I found in the Web are not up to date, because there where no “Aspen” packages anymore. With the iPhone SDK for IPhone OS 2.1 (build 9M2517) you can follow these steps:
1. Download the official iPhone SDK here.

2. Mount the .dmg image and install the iPhone SDK (the iPhone SDK will be grayed out!).

3. After rebooting the Mac, mount the image again and go to the folder Package. Install all packages which have iphone in the name (e.g. Simulator, SDK, Documentation).

4. Go to the folder /Platforms on the local HD and copy the iPhone.platform and theiPhoneSimulator.platform folders to /Developer/Platform.
Don’t copy the whole platforms folder, Xcode will not run correctly anymore!

5. Now we come to the interesting part. Xcode has now access to the iPhone SDK, you can already create iPhone projects, but Xcode still wants to compile the sources for the Intel architecture. To change that, open the folder /Developer/Platforms/iPhoneSimulator.platform/Developer/
Library/Xcode/Specifications/
.
In this folder you will find the file iPhone Simulator Architectures.xcspec. Make a backup and open it in any text editor. The content should look something like this:

(
// 32-Bit
{ Type = Architecture;
Identifier = Standard;
Name = "Standard (iPhone Simulator: i386)";
Description = "32-bit iPhone Simulator architectures";
ListInEnum = YES;
SortNumber = 1;
RealArchitectures = ( i386);
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";
},

// Old-style Debug
{ Type = Architecture;
Identifier = Native;
Name = "Native Architecture of Build Machine";
Description = "32-bit for build machine";
ListInEnum = YES;
SortNumber = 101;
ArchitectureSetting = "NATIVE_ARCH";
},

// Intel
{ Type = Architecture;
Identifier = i386;
Name = "Intel";
Description = "32-bit Intel";
PerArchBuildSettingName = "Intel";
ByteOrder = little;
ListInEnum = NO;
SortNumber = 105;
},
)

6. Change the line “RealArchitectures = ( i386);” to “RealArchitectures = ( i386, ppc);“.

7. Add the architecture configuration for G3, G4 an G5, the edited file should now look like this.

(
// 32-Bit
{ Type = Architecture;
Identifier = Standard;
Name = "Standard (iPhone Simulator: i386, ppc)";
Description = "32-bit iPhone Simulator architectures";
ListInEnum = YES;
SortNumber = 1;
RealArchitectures = ( i386, ppc7400 );
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";
},

// Old-style Debug
{ Type = Architecture;
Identifier = Native;
Name = "Native Architecture of Build Machine";
Description = "32-bit for build machine";
ListInEnum = YES;
SortNumber = 101;
ArchitectureSetting = "NATIVE_ARCH";
},

// G3
{ Type = Architecture;
Identifier = ppc;
Name = "Minimal (32-bit PowerPC only)";
Description = "32-bit PowerPC ";
PerArchBuildSettingName = "PowerPC";
ByteOrder = big;
ListInEnum = No;
SortNumber = 201;
},

// G4
{ Type = Architecture;
Identifier = ppc7400;
Name = "PowerPC G4";
Description = "32-bit PowerPC for G4 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 202;
},

// G5 32-bit
{ Type = Architecture;
Identifier = ppc970;
Name = "PowerPC G5 32-bit";
Description = "32-bit PowerPC for G5 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 203;
},

// Intel
{ Type = Architecture;
Identifier = i386;
Name = "Intel";
Description = "32-bit Intel";
PerArchBuildSettingName = "Intel";
ByteOrder = little;
ListInEnum = NO;
SortNumber = 105;
},
)

Now you should be able to compile the iPhone project and run the app in the iPhoneSimulator. I never tried to put an App into the AppStore, but I think it should work.

So – if you follow those instructions (like I did) then you should be able to open xcode and build an iPhone app!

Worked a treat for me!

Share

Increase Your Web Presence with Google Webmaster Tools

It’s one thing to get your site showing up in Google. It’s another thing to make sure you get all your pages into Google.

The easiest way to do this is by using an XML sitemap & Google Webmaster Tools (GWT).

GWT allows you to analyse your website from the Google Bot’s perspective to ensure that all your links are working, your meta tags are not duplicated and many other things such as setting the rate at which bots visit your site.

All you need is a Google Account & access to the HTML of your homepage.

Once you’ve signed in, it’s fairly easy to follow the on-screen instructions to setup your domain.

Google will index your pages, and you can also use your sitemap on Yahoo!, Live and other search engines.

If you dont have it already, get Google Webmaster Tools now!

Share

My 7 Must-Have Plugins for WordPress

I make sure I use these on ALL my WordPress blogs. I use many more, but this is a list of plugins that I think anyone who is serious about maximising the potential of their blog should be using.

All in One SEO Pack
Google Analytics for WordPress
Google XML Sitemaps
TweetMyBlog!
wp-cache
Add to Any: Share/Bookmark/Email Button
YARPP

If you have others that you believe are essnetial and should be mentioned then leave a comment and I shall consider updating this list.

Share