Archive | Programming

Tags:

Updating your dev environment after a Snow Leopard upgrade

Posted on 01 July 2010 by Demian Turner

I’ve avoided upgrading to Snow Leopard for ages for a number of reasons:

  • didn’t want to spend ages re-setting up all my ports, I’ve heard SL creates a havoc
  • wanted to maintain java apps that stop working in SL, like Zend 5.5 (it may be old but still has the best debugger around)
  • wasn’t crazy about tinkering with my Cocoa dev environment

Finally I was forced to upgrade, in a panic in fact, as it’s the only way to build iOS apps for iPhone and iPad for version 4 or later.  And since the iOS 4 update broke a lot of our 3.1.3 apps, I had to get fixes out asap.

So what’s involved?  Well on the database side, forget about downloading the dmg for MySQL, it’s poorly setup.  And forget about globally upgrading your ports, the various approaches suggested here and here simply don’t work.

Unfortunately you have to take the advice on the official Macports page and uninstall everything, then selectively re-install the ports you want.  The suggestion labelled “Automatically reinstall ports” refers to a script that collapses almost instantly when it fails to find Tcl libs which certainly don’t exist in my bog standard ports setup.

So one thing you need to keep in mind is to reinstall your ports with the +universal option which specifies 32 and 64 bit architectures will be accommodated.

For a basic PHP+Apache install this page has some good suggestions but is not up to date.  And you need to go here for advice on installing MySQL, which obviously needs to be done before you install PHP.  I’ve summarise the steps required here:

Apache 2

Install apache as follows:

sudo port install apache2 +universal

Then run the following, as advised, to get it to startup automatically after reboots:

sudo port load apache2

Just installing apache installed 16 ports including all the deps.  For tweaks the config the file is here:

/opt/local/apache2/conf/httpd.conf

MySQL 5.1

To get the ball rolling with MySQL, the following:

sudo port install mysql5 +universal

Then you need to issue you a

sudo port install mysql5-server +universal

which just takes a few secs and the server is setup.

To start the server on reboot do

sudo port load mysql5-server

and if you wanted to setup a new db from scratch you could issue

sudo -u _mysql mysql_install_db5

If you want to change any of the configuration the file is here:

/opt/local/etc/mysql5/my.cnf

PHP 5.3

Now that you have your Apache and MySQL installed, it’s time to install PHP and link to them:

sudo port install php5 +apache2 +universal

To enable PHP in Apache, run

cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so

then add the PHP modules you want after:

sudo port install php5-mysql

Then, to get MySQL working with PHP you need to edit /opt/local/etc/php5/php.ini and set

mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket to /tmp/mysqld.sock

And that should do the trick!

edit /opt/local/etc/php5/php.ini and set
mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket
to /opt/local/var/run/mysql5/mysqld.sock

Comments (2)

Tags: , ,

Learning PHP, MySQL, and JavaScript

Posted on 02 June 2010 by Demian Turner

Learning PHP, MySQL, and JavaScriptO’Reilly asked me to be a technical reviewer for this book by Robin Nixon, I forgot to mention that it was published several months ago.

If you’re a newb I recommend giving it a read, you can pick up a copy on Amazon.

Comments (2)

Tags:

Programming Jargon Gems

Posted on 27 May 2010 by Demian Turner

yoda

Stackoverflow has a great list of terms programmers have come up with where the standard jargon just didn’t cut it.  A few gems in here, see if you can guess what the following might be:

  • Yoda conditions – arrg, right up there with with leaving off the ?> in PHP, “training wheels best practices” …
  • shrug report – I get this on a daily basis
  • Egyptian brackets
  • Refuctoring – one word speaks volumes
  • Stringly typed – one of my favs – check out Yii framework if you’re unfamiliar with the concept
  • Heisenbug – an old and painful classic, I get them all the time
  • Fear Driven Development – I think we’ve all been there
  • Baklava code – this one is just begging to enter your vocabulary

Comments (1)

Tags: , , , ,

PHP interns in Paris required

Posted on 13 April 2010 by Demian Turner

Soluo is looking for an intern in PHP Web Programming to join the development team in Paris. The focus of this internship will be the core developement of a SaaS Web Application. The intern should start by April 2010.

You will be involved in Web Application design and development, third-party integrations (Social Networks such as Twitter, LinkedIn, Facebook) via Web Services / API / XML, development and integration of reporting tools, design and implementation of SQL databases.

We are offering an enriching experience, within a small and agile team, mentored by a senior architect. And hey, maybe you could end up joining the team? Forgot to ask how good is your sea-legs as you will be working in an amazing boat on the Seine. But don’t worry, you should get used to it within 2 weeks.

In this internship you will:
• develop sclalable, secured and reliable Web Applications
• integrate third-party applications
• use Social Web platforms to enhance the App (LinkedIn, Twitter, Facebook, …)
• learn to optimise and enhance through iterations
• get satisfaction in seeing the product launch before the end of your internship
• learn and implement development best practices

You are:
• passionate about Web Application Development
• curious and proactive
• constantly reseraching innovative solutions
• enthusiastic about getting involved in a startup

You have:
• strong skills in PHP5 and MySQL and knowledge of at least one php framework
• experience in OOP, Test Driven Development and Agile Methods
• good system administration skills
• a good level of English

You like:
• being autonomous in your work
• working in small teams
• to speak/write English obviously
If you think this is you, just drop us an email at recrutement*_at_*soluo.fr, specifying the reference webdev1003.

Tell us about a challenging project you are proud of which you have realised in the framework of your studies. We will get back to you.

Comments (0)

Tags: ,

Programmer Competency Matrix

Posted on 30 December 2009 by Demian Turner

A very nice matrix exploring programmer aptitude.

Comments (0)

Tags: ,

How to Block Flash

Posted on 20 December 2009 by Demian Turner

ClickToFlash IconI wish I hadn’t waited so long to install the ClickToFlash plugin, it totally improves the web experience. The idea is simple, all flash animations are paralyzed by default ;-) To view flash, including videos like youtube, etc, you have to click to play. A lot healthier for the laptop, no more CPU running at 100% nor mindless distractions when you’re trying to absorb valuable content.

Comments (0)

Tags: , ,

PHP shell rocks

Posted on 09 November 2009 by Demian Turner

shellI’ve written about this before, but since the interactive mode of PHP (php -a) seems to be broken on OS X, I think it’s worth singing the praises of Jan Kneschke’s php shell project once again.

It’s a piece of cake to install the tool with the PEAR installer, and since I last used it 2 great new features are on offer:

  • tab completion for all (or many) PHP functions and built-in classes and interfaces
  • handling of fatal errors

What a relief to have this working again!  I was ssh-ing onto my Fedora servers just to test out code but of course this became impractical pretty quickly.  And did I mention it runs great on PHP 5.3?

And if you’re tempted to use the similarly named phpsh project from the Facebook open src stables, I can confirm this is not an option with the latest version of PHP.

Comments (0)

Tags: , , , , ,

PHPterror on OXID eShop

Posted on 26 August 2009 by Demian Turner

puremvc-patternsI can’t believe Zend is publishing articles on OXID eShop, this is definitely some of the worst code I have seen in ages.

As “the PHP company” I think Zend ought to at least select projects that have some merit in terms of software design, as surely beginner PHP devs look to Zend for good examples and copy/emulate whatever they showcase.

PHPterror took a closer look at some of the OXID code, really jaw-dropping stuff.

Comments (4)

Tags: , ,

Introducing PHPterror: bad PHP usage exposed

Posted on 24 August 2009 by Demian Turner

unit-testing-webdesigner

A new look at how to create unit tests – using Photoshop!  Sense of humour required …

Comments (1)

Tags: , ,

Working with unreliable APIs

Posted on 27 July 2009 by Demian Turner

Bad API

Thanks to Andrew Betts, a PHPlondon regular, for coming up with BadAPI, a service that allows you to simulate misbehaving APIs.

These days there’s almost no such thing as a web app that’s not integrating data from various external APIs, and with that integration comes a new set of problems the developer must handle.

From the BadApi website:

BadAPI allows you to simulate misbehaving APIs. This is useful if your site relies on the availability of service X, and you want to ensure that any downtime experienced by that service has minimal impact on your own application.

Comments (1)

Advertise Here
Advertise Here

Subscribe by email

Enter your email address:

Delivered by FeedBurner

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook