Saturday 19 December 2009

Symfony

An exciting couple of days have just passed. I had a great telephone conference call with a business associate about a new project. It's something that will keep us busy for a good few months.
The need for a decent development framework is now even more pressing, so yesterday afternoon, I downloaded and installed the most recent supported version of the Symfony framework.
Installation was fairly straightforword: just a case of RTFM and taking my time. The one slight problem I had was getting the apache virtual host directives to work properly. These were sorted out this morning - I was tired and forgotten to change a couple of parameters that appeared in the vanilla directives given in the Symfony manuals. I had also forgotten to add an entry into my /etc/hosts file.

It was quite a surprise to find and fix the problems so quickly as one of our dogs ate something unpleasant (fox or cat poo) a day or two ago. Since then she's had a bit of an upset tummy which came to a head at bedtime. Standing at the back door at 2:00am when it's -2C waiting for a dog to relieve herself for the umpteenth time isn't conducive to a good night's sleep. She's a bit quiet at the moment and probably very hungry as all she's had is a tablespooon of rice for breakfast.

Anyway, time for a(nother) cup of restorative coffee and a shower.
Once I'm fairly compus-mentis, I have Christmas presents to wrap and I want to have a go at making a Stollen.

A bientot!

Tuesday 15 December 2009

Printers, Netbeans and OOP

Quite a productive day again! I finally fixed a problem with our Samsung ML-1640 printer. It's connected to an Ubuntu server and I have had no problems at all printing from my Ubuntu workstation or a PC running Windows XP: however, printing from a Macbook would throw up errors and occasionally, just print blank pages. It's been driving me to distraction for ages and today, I decided to look at the problem one more time.

The Samsung ML-1640 is a great little printer. Cheap as chips, excellent print quality and fully supported under Linux. My first port of call was to the Samsung website to download a new linux printer driver, which was duly installed on the server. Then I noticed that my Macbook was running with a driver for the ML-1630! So I downloaded the correct driver for the Mac and eventually had everything printing as it should.
The hardest thing was remembering the correct syntax for connecting a network printer to a Windows XP machine using HTTP. Something that I realised AFTER I had deleted the previous instance of the printer in the control panel! But I got there in the end and all of the problems have all been fixed.

I started using Netbeans in anger today. It's a cracking editor, though it can be a bit slow as it checks all of the syntax as you type. I really like the way it's possible to expand and collapse code blocks. The way it highlights instances if variables in a file and braces or brackets is a real boon too.

My attempts at learning Object Oriented PHP are going well too. I had a bit of a shaky start, but I've just finished my first OOP script and the penny is dropping. I have a couple of ideas for mini-projects to consolidate my learning as well as build pieces of code that will be useful for some forthcoming projects.

It's play time now as I've just take delivery of a Bluetooth keyboard for my Macbook!

Ciao!

Monday 14 December 2009

Beanz meanz Netbeans!

It's been a really fun day. I spent quite a bit of time going through some object oriented php tutorials on the killer php website. There are some excellent tutorials plus short video clips that go a long way to explaining what object oriented PHP is all about and how to start using it.
My previous projects have been based on "traditional" programming methods, making extensive use of functions. Whilst I have gone to great lengths to try and separate dislay code form "business" code, I think a more structured approach is needed for future work. The approach will make a huge difference to maintainability and scalability of any new applications that I write.

I successfully downloaded the Netbeans 6.8 IDE package this evening. Once I had installed a JDK, the package went in without a hitch. I love the way it integrates with Subversion and has support for the Symfony framework right out of the box.
Netbeans is a really feature-rich package and it will take a while to get the hang of its myriad features. The time invested in this (and getting stuck into OOP) will reap dividends though with respect to productivity and code quality.

I also love the fact that I can run the same package on my Macbook as well as my Ubuntu workstation - or Windows if it comes to it, though hopefully, I can avoid THAT route!

Sunday 13 December 2009

Downtime

One skill that I have recently acquired is baking bread. As I type this, I have two batches rising. The first batch is destined to become a couple of wholemeal loaves. It's a basic recipe from an old Good Houskeeping cookery book that my wife has had since the year dot. The second, is an enriched dough (by that I mean I've replaced some of the water with soya milk and a couple of eggs), which I'll use to make bread rolls for Christmas. Most of them will be destined for the freezer. I have some ideas for the rolls, for example, incorporating some stilton and walnuts into some of them.
You may be wondering what all this has to do with IT. Well, two things: first, as the proverb says, "All work and no play makes Jack a dull boy" and second, kneading dough gives me a great opportunity to ponder things that need to be "background-processed", such as the look and feel of my next project, which framework and so on.

Talking of frameworks for PHP, I'm going to have a look at Symphony and will probably install that tomorrow, along with Netbeans, as I think my current PHP editor, Bluefish, could be better. A full IDE will make me much more productive.

Anyway, I think my first batch of dough is ready for knocking back and putting into tins ready for proving.

TTFN


Friday 11 December 2009

Definitely good Karma!

My installation of Ubuntu 9.10, the Karmic Koala went without a hitch. Well, that's not strictly true, as I did have a few problems getting the BackupPC server to restore data onto my newly formatted and repartitioned hard drive.
It was a fairly simple fix though - I had forgotten to add a couple of parameters into my rsyncd.conf file: something that became apparent after a cup of strong coffee and a ponder.
Once the rsyncd.conf file was corrected, I was able to start moving data between the backuppc server and my workstation with surprising rapidity.

The main problem I had was restoring my mySQL databases. I had used mysqlhotcopy to create backup copies of the databases on the system. It took a couple of attempts to get the databases working, but I got there in the end.

The process I followed was:
  • log in to the mysql client and create the databases (create database {databasename})
  • stop the mysql server
  • when the databases have been created, copy the backed up files to /var/lib/mysql/{databasename}
  • As I copied the files over as root, I then needed to call chown mysql:mysql /var/lib/mysql/{databasename}/*
  • start the mysql server
  • log into the mysql client and check the databases were OK - a couple of describes and selects does the trick. It's pretty obvious when there's a problem
  • finally, test the web application(s) that use the databases.
As far as my website development projects were concerned, rather than use backuppc to restore them, I opted to use subversion to load them from the repository I set up last weekend.

So, apart from a couple of applications that I need to load and setting up rsync so it runs as a daemon, the system is fully functional.

My first impressions are of a system that loads really quickly. The new versions of OpenOffice.org now supports the latest .docx files, so it looks like it's fully compatible with the most recent versions of MS Office. That said, I haven't tried spreadsheets yet...

Overall, a good day's work. Time for another coffee and a surf to find out more about PHP development frameworks!

Wednesday 9 December 2009

Good Karma...

I downloaded the latest version of Ubuntu this evening. Version 9.10 is known as the "Karmic Koala". I have been running "Hardy Heron" for quite a while and whilst I am generally happy with it, there have been a couple of things that bothered me. Moreover, there are new versions of Firefox and OpenOffice.org which I am definitely interested in.

The new version looks much slicker and loads very quickly indeed, so I will definitely upgrade.

Upgrading won't be a trivial task though as I will have to reinstall quite a lot of software. The list includes: Apache, MySQL, PHP, Thunderbird, Bluefish, Subversion and GPass amongst others. Ubuntu's package manager makes software installation nice and easy. My broadband connection will be busy tomorrow morning!

I have good quality backups of my data, having installed BackupPC on my "server", which is actually another PC running as an ubuntu workstation with Apache, MySQL, PHP and Subversion. For added belts and braces, I have added all of the websites that have been under development to my Subversion repository. This is in addition to the BackupPC backups!
When I pluck up the courage, the desktop edition on this machine will be replaced with a server edition.

I think tomorrow will be an interesting day - hopefully it won't be too "interesting"!

The other thing that piqued my interest today was the Zend framework for developing web applications. This and other development frameworks look very exciting and I will be doing quite a bit of research on Zend and other frameworks before I make a start on coding my next project.

Saturday 5 December 2009

Version Control

Now that I have almost finished developing the back-end code for David Pentland's website, it has become increasingly clear that some form of version control system is no longer a "nice to have". Having created many new php files (and edited even more), keeping track of all of the changes has been a bit of a challenge. Moreover, I am just about to start work on an exciting new project with a partner and it makes good sense to sort out this issue before coding starts in earnest in the next few weeks.
I acknowledge that there is a bit of an overhead in running a version control system, but the advantages more than outweigh the disadvantages.
For me the main disadvantage is having to learn a new way of working and get my head around the ins and outs of the version control system. The advantages are:
  • always knowing where I am with respect to code versions;
  • being able to regress changes easily by "rolling back" to an older version, or being able to "undelete" files which have been marked for deletion;
  • having a repository on another machine means I have a backup of the code by default, albeit minus any committed changes.
Fortunately, I spotted an article in an recent version of Linux Format magazine which compared three open-source version control systems, namely: Bazaar, Git and Subversion. After some fairly careful consideration, I opted to install Subversion on my server.

The manual for Subversion, which, like the software is free, runs to something like 480 pages. It all seems a bit daunting to start with, but thanks to another article in Linux Format magazine and a couple of 'how to' articles, including one particularly good one by MichaƂ Wojciechowski , I had a fully functioning Subversion server up and running within an hour or so.

Now, all I have to do is read the manual, become familiar with Subversion and move my websites into the repository.

Simple!