How To: Install SVN on Mac

If you’ve open the terminal and run the “svn” command just to be told “-bash: svn: command not found” then do the following:

1) Install XCode
2) Open “Preferences” and click the “Accounts tab”
3) Add your Apple ID
4) Open the “Downloads” tab
5) Click the download link next to “Command Line Tools”
6) You  have SVN!

XCode Downloads

Facebook Connect Mobile: XML Schema Error on Mobile Devices

If you’re getting an XML error when you’re using Facebook Connect to post to a users stream using the function:


Then ensure the following:

  • You don’t have any double quotes in your attachment
  • You don’t have any ampersands in your return URL

For some reason the content is being placed in a hidden field on the page on “mobile” devices.  This isn’t escaping the contents of the post, and hence breaks if you have any of the above.

Highly frustrating!  Hope this helps someone.

Online Tool to Convert .ICS file to Excel/CSV

I couldn’t find a decent way online to convert ICS files into an Excel type format for easy manipulation, or adding to documents etc.  So I’ve built a simple one that is now available online:

This takes an iCal URL and provides you with a CSV file as a download.  Makes it much easier to get a list of dates from ICS files and use them for other purposes.

Also available is the CSV2SQL converter that I made last year, taking CSV files and coverting them into INSERT/UPDATE statements for use on a database.

How To: PHP OAuth Twitter

So, you’re building a web based twitter client in PHP.  Easy, just use a simple Twitter API client and call the Twitter API directly.  But what if you don’t want to store the user’s Twitter authentication information anywhere?  It’s a security risk anyway and some people don’t want to give up their account details to a 3rd party.  So what to do?  The solution is to use OAuth with Twitter. Continue reading “How To: PHP OAuth Twitter”

How-To: Create my.cnf file in MAMP

This is a simple process, however not something I could find documented anywhere easy to find. MAMP supplies you with a range of sample configuration files:


To setup one of these for MAMP, simply issue the following command:

sudo cp /Applications/MAMP/Library/share/mysql/my-choicehere.cnf /Applications/MAMP/Library/my.cnf

Google Maps: Zoom Level, Center from points on map

So you’ve created a pretty Google Map on your website.  You place a whole heap of markers on your map, driven from data you’ve got stored in your database.

A nice thing to do when we first show the map, would be to ensure that all the markers are visible on the map.

To do this, we need to set the zoom level and center point of the map dynamically. So how do we do this?  The answer is GLatLngBounds():

// Get your locations from the database
var mapLocations = <? echo json_encode(Locations::Find()) ?>;
// Initialise our map, add some controls and a default center point 
var map = new GMap2(document.getElementById("Mall_Map"));
map.setCenter(new GLatLng(15, 20), 2);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());

// Now the fun part - create a GLatLngBounds object
	var bounds = new GLatLngBounds();

for (var i=0; i<mapLocations.length; i++)
        var location = mapLocations[i];
        var point = new GLatLng(location.Latitude, location.Longitude);

        // createMarker() is a custom function which returns a marker for a given GLatLng
        var marker = createMarker(point);
        // extend our bounds to include this point

        // add our marker

// Now dynamically set the center and zoom level for our map based on our bounds!
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); 

The key is the use of the line:

map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); 

This uses our bounds (which we’ve dynamically extended to include each of our points) to determine what the center and bounds zoome level should be.

yum fails: Fixing Fedora Core 5 yum repositories

Fedora Core 5 is currently EOL – it’s not supported any more.  As a result, you might find you can’t use yum to install packages any more – you get an error message about this file not existing:

This is because the repositories that yum uses aren’t there anymore.  However you can modify the repositories in /etc/yum/repos.d/ and add these to fix the problem:

An example change would be to the /etc/yum/repos.d/fedora-core.repo file:

name=Fedora Core $releasever – $basearch
name=Fedora Core $releasever - $basearch

How-To Fix: MAMP won’t start

Okay, so sometimes our shiny friend and development support buddy MAMP won’t start properly.  I’ve found this often happens when you’ve first booted up your Mac and you try to start getting stuck into your code.

Symptoms are pretty simple to diagnose – you start MAMP, and it’s control panel pops up and shows that everything is running:

MAMP Control Panel

But for some reason you can’t access your webserver or database:

MAMP not working

What to do?  Restarting the servers generally doesn’t solve the problem.  However, there is a trick I’ve discovered.  Open up the control panel and click the “Preferences…” button.  Once this popups up, choose the “Ports” tab, change nothing – and click OK:

MAMP Preferences Pane

MAMP will automatically restart – and you should be up and running!