Google Ajax Feed API

http://code.google.com/apis/ajaxfeeds/documentation/

This is Google’s framework extension to RSS feeds with Ajax loading on page. You can build slideshows from pictures tagged in Flickr, PhotoBucket, and more.

HOWTO: Mount an ISO file in Ubuntu Linux

How to mount a CD ISO Image and read files in UbuntuI recently downloaded some language CD ISO files and wanted to transfer to my ipod. Usually ISO files are designed to be burnt to CDs but if you just want to mount the image and read the files CD free there are a couple of options in Ubuntu.

(more…)

Flipping Wordpress Blogs

Firstly I want to apologise for my not being around over the last month. After finally getting my kidney stone blasted I was in a lot of pain with an infection that kept me away from the computer. I am back on track now after wading through the mountain of 3000 odd e-mails that were waiting for me on my return :)

I wanted to bring up the subject of flipping wordpress blogs today, as opposed to flipping html or php websites. From the many e-mails I get from you guys and gals there seems to be some confusion on how this would work and why they are worth more. AND they are worth more.

There are a few more technicalities in flipping wordpress blogs than an html or php website, but they are minor. I have broken the process down into small chunks below. If something doesn’t make sense ‘Google It’ as it is ouside the scope of this post. Obviously if the buyer is keeping the current hosting that you provide this is all irrelevant as it would be with another type of website, no moving involved.

FLIPPING A WORDPRESS BLOG PROCESS

1) Back up the database for the wordpress blog. This is the most important step. If you miss this and something goes wrong the blog is gone forever.

2) Back up (download using a ftp program) ALL FILES and FOLDERS for the wordpress blog. This is the easiest way to ensure that nothing is missed.

3) Make a note of any specific settings needed just incase they don’t get transferred.

4) Change the nameservers, upload ALL the files to the new server, create a database and import the backup from step 1, change the wp-config.php to reflect any changes in the database details should you need to.

5) Check everything is working ok, but you should be good to go.

NOTE: You can install wordpress through fantastico although it is not advised and harder to make certain changes.

The benefits of flipping wordpress blogs over other websites are that they can be updated more often, can include more info, are easier for you to create, are liked more by the search engines. There are also lots of things that can be done with simply with a wordpress blog that would need a lot more work and coding with an html or php website, like a membership site, affiliate/affiliate site or store site.

As you can see the possibilities are endless. So get going flipping those wordpress blogs :)

I have a new theme coming for you in a few weeks as well as some inside info on some great new plugins to help explode your traffic. I am going on holiday next week, but should have internet access over there to keep up to date. I tell you a few weeks out and you almost have to go back to square one. The one thing I learnt from this though is that you should only stay subscribed to people’s lists if they actually offer you something of value …

Bookmark This …
[blinklist][Bloglines][del.icio.us][Digg][Facebook][Furl][Google][MySpace][Reddit][Simpy][Spurl.net][Squidoo][StumbleUpon][Technorati][Windows Live][Yahoo!] More »

HOWTO: Install Ruby on Rails on Ubuntu 7.10 Gutsy Gibbon

1. Enable the universe repository
sudo vi /etc/apt/sources.list
Find and uncomment the following lines
deb http://us.archive.ubuntu.com/ubuntu dapper universe main restricted universe
deb http://security.ubuntu.com/ubuntu dapper-security universe

2. Install ruby
sudo apt-get install ruby ri rdoc

3. Install rubygems
sudo apt-get install rubygems

4. Install Rails
sudo gem install rails
NOTE: If you get, as I did, an error at this point:

uninitialized constant Gem::GemRunner

then the fix is:
sudo vi /usr/bin/gem
After the line require ‘rubygems’ add the line:
require 'rubygems/gem_runner'

5. Test installation
cd
rails testapp
cd testapp
./server start

Open a browser to http://localhost:3000 and you should see the rails welcome page.

You can remove the testapp with:
cd
rm -fr testapp

Zend Framework & Doctrine

A few months ago, I did a presentation at the meeting on putting together a MVC framework containing pieces of Zend Framework and Doctrine. Originally conceived by Cory Powers and myself, the result is named Crystal Core. The slide show presentation can be found here.

Crystal can be checked out via Subversion from here.

If you have any questions about the project or want to help out, please contact me through my website.

How To Sort A Zend_Db_Table_Rowset

So you figured out how to define the relationships between your Zend_Db_Tables and you have issued a call to findDependentRowset(). You get your Rowset back but you need to sort the results by one of the columns in the dependent table. How do you do that?

The short answer is, you can’t! Unfortunately, this functionality won’t be available until the 1.5 release of the Zend Framework. But you can write your own utitlity function to sort your Rowset for you.

In my project I am working with Patients and their Medications. There is a one to many relationship between patients and medications. One patient can have many medications but a medication belongs to only one patient. I have the following database tables and classes (stripped down for the sake of this example):

PLAIN TEXT
MySQL:

  1. CREATE TABLE patients (
  2.   id INT AUTO_INCREMENT NOT NULL,
  3.   name VARCHAR(50),
  4.   PRIMARY KEY(id)
  5. );
  6.  
  7. CREATE TABLE medications (
  8.   id INT AUTO_INCREMENT NOT NULL,
  9.   patient_id INT,
  10.   name VARCHAR(50),
  11.   PRIMARY KEY(id)
  12. );
PLAIN TEXT
PHP:

  1. // file: Patients.php
  2.  
  3. class Patients extends Zend_Db_Table_Abstract {
  4.   protected $_name = “patients”;
  5.   protected $_dependentTables = array(“Medications”);
  6. }
PLAIN TEXT
PHP:

  1. // file: Medications.php
  2.  
  3. class Medications extends Zend_Db_Table_Abstract {
  4.   protected $_name = “medications”;
  5.   protected $_referenceMap = array(
  6.     ‘Patient’ => array(
  7.       ‘columns’=>‘patient_id’,
  8.       ‘refTableClass’=>‘Patients’,
  9.       ‘refColumns’=>‘id’
  10.     )
  11.   )
  12. }

Suppose then that you want to get an alphabetical list of all the medications a particular patient is taking. The code looks like this:

PLAIN TEXT
PHP:

  1. // Make sure your Zend_Db_Table class is loaded
  2. Zend_Loader::loadClass(“Patients”);
  3.  
  4. // Instantiate your Zend_Db_Table class
  5. $patients = new Patients();
  6.  
  7. // Select Zend_Db_Table_Row for patient with id of 12
  8. $patient = $patients->find(12)->current();
  9.  
  10. // Select all of the medications for the patient
  11. $medications = $patient->findDependentRowset(‘Medications’);

At this point, $medications now contains a Zend_Db_Table_Rowset that holds a list of Zend_Db_Table_Row objects representing the medications associated with our patient. Suppose now you want to sort the list of medications alphabetically by the name of the medication.

I was irked to learn that there was no way to tell findDependentRowset() to order by one of the selected columns. So I decided to start a Utilities class of static methods that I can use for situation such as this. I wrote the function sortRowsetBy()

PLAIN TEXT
PHP:

  1. class DU_Utils {
  2.  
  3.   /**
  4.    * Sort a Zend_Db_Table_Rowset by the specified column
  5.    *
  6.    * @param Zend_Db_Table_Rowset - The Rowset to sort
  7.    * @param String $colName - The name of the column by which to sort the Rowset
  8.    * @return Array - An sorted array of Zend_Db_Table_Row objects
  9.    */
  10.   public static function sortRowsetBy($rowSet, $colName, $direction=‘desc’) {
  11.     foreach($rowSet as $key => $row) {
  12.       $rows[] = $row; // Convert Rowset into an array of rows
  13.       $vals[$key] = $row->$colName; // Create array out of specified column name
  14.     }
  15.     // Sort the $rows array based on the $vals array
  16.     ($direction == “desc”) ? array_multisort($vals, SORT_DESC, $rows) : array_multisort($vals, SORT_ASC, $rows);
  17.  
  18.     return $rows;
  19.   }
  20.  
  21. }

The function makes use of a little known PHP function called array_multisort(). This is a peculiar little function to grasp but it’s worth figuring out because of it’s power. There is a good bit of documentation on the PHP website about what the parameters mean and what the function does. In a nutshell, this function sorts one array by another. In our context, the first array is essentially the column you want to sort by and the second array is the table you want to sort. In between the two arrays you can pass some flags to specify how you want to sort the array – ascending or descending – and the type of sort you want to perform – regular, numeric, or string. Note, that both arrays must be the same size in order for array_mulitsort() to do its job.

In conclusion, here is the code to sort our Rowset of medications alphabetically by the name of the medication.

PLAIN TEXT
PHP:

  1. // Make sure your Zend_Db_Table class is loaded
  2. Zend_Loader::loadClass(“Patients”);
  3.  
  4. // Instantiate your Zend_Db_Table class
  5. $patients = new Patients();
  6.  
  7. // Select Zend_Db_Table_Row for patient with id of 12
  8. $patient = $patients->find(12)->current();
  9.  
  10. // Select all of the medications for the patient
  11. $medications = $patient->findDependentRowset(‘Medications’);
  12.  
  13. // Sort the medications
  14. $medications = DU_Utils::sortRowsetBy($medications, ‘name’);
  15.  
  16. // Note that medications is now an array of Zend_Db_Table_Row objects
  17. // not a Zend_Db_Table_Rowset after the sort.
  18.  
  19. // Loop throught the sort list of medications
  20. foreach($medications as $med) {
  21.   // Do something with each medication
  22.   print($med->name);
  23.   print(“<br/>”);
  24. }

PHP 5 Cool New Features & Search Engine Optimization (SEO)

Joshua Eichorn discusses some of the cool new features in PHP5.

Paul Yurt opens with discussion on Search Engine Optimization SEO.

The meeting starts at 7 at Walt’s TV in Tempe and will be followed by food and conversation at Boulders on Broadway.

Technical Lead - Ruby on Rails Development (Agile, XP, SCRUM), London - £60k - £75k OTE + Healthcare

Job Title: Technical Lead - Ruby on Rails Development (Agile, XP, SCRUM)

Salary: £60k - £75k OTE dependent on experience + Healthcare

Company Introduction

A London based E-Commerce agency, specialising in the design and build of transactional web sites for a range of clients including Multi-Channel Retailers and Blue Chip brands. My client also provide a range of E-Marketing and Usability Services.

Continually developing and evolving its E-Commerce offering with current developments including Web 2.0 based Community features within an online retail environment.

As technical lead for the development team, you will be driving best practice and productivity working in a stimulating Agile environment where test-driven development and pair programming is a natural part of the day-to-day job.

Current clients include Sainsbury’s, BUPA and Dollond & Aitchison.

Job Description

Core skills required include:

· Proven track record running successful projects/teams

· Solid Ruby on Rails knowledge (1+ years of commercial experience)

· 4+ years commercial experience in web development

· Test-driven development

· Strong interpersonal and communication skills with team experience

· Agile / Scrum

Leadership skills

· Team management, ensuring team collaboration and continuity

· Making key strategic and architectural technology decisions

· Managing pair programming and test strategy

· Ensuring communication (stand-ups, bi-weekly/monthly technical update/progress meetings as requested by the team)

· Coach the team on problems solving

· Motivate the team to be proud of the work they produce

Experience in one or more of the following areas would be advantageous:

· E-Commerce

· Systems Integration

· Community / Web 2.0

· Extreme Programming

Keywords

Lead developer, technical lead, test driven, agile, TTD, XP Xtreme Programming, Extreme Programming, Test Driven Development, Ruby on Rails, MVC, Design patterns, SCRUM

PHP frameworks revisited - CodeIgniter vs Zend

We are about to start a project from scratch at my new job and have been evaluating PHP frameworks. We’ve shortlisted CakePHP, CodeIgniter, Symfony and Zend.
I have put them through their paces by building the same application with all four of them (a simple wiki application) and hopefully, we’ll settle on one soon enough.

Full Disclosure: I have tried to be as unbiased as I possibly can but I’m already a CodeIgniter fan. That said, the company I work for is a Zend Partner (we already use the Zend Platform and Zend Studio) and I can’t help factoring that in.

Although the initial plan was to review four PHP frameworks, this post has become a direct CodeIgniter to Zend Framework comparison. I have had to exclude Symfony and CakePHP from the list after spending a few hours going through all four frameworks for the following reasons:

  • Learning curve:
    Both symphony and CakePHP have a very steep learning curve. CakePHP has strict rules about database table names, where files should be placed, method names and class names. Symfony stores its configuration in .yml format (requires learning although it’s not really that hard) and a lot of the interaction with the application is through a console. Creating database tables, data models and various other files are done using the command line.
  • Strict ORM:
    CakePHP and Symphony have full-blown object-relational mappers (ORM) to provide access to the database and these cannot be disabled without a lot of effort. These ORM have strict rules and conventions which must be adhered to for the application to work.
    In contrast the Zend Framework and CodeIgniter are flexible about using models and how they are used. Using a model is optional and while they each have data mappers, applications can work without them. The application will be extremely database intensive and we would rather not be limited in our choices.
  • Flexibility:
    The Zend Framework and CodeIgniter are more flexible than the other two frameworks.

The Duel

  CodeIgniter Zend Framework
Set Up CodeIgniter is very easy to set up. Copy all the framework files to the web server and it’s good to go. It also has a small folder size - about 2.1 Mb and I could display the default home page less than five minutes after I started the set-up. The Zend Framework requires a bit of effort to setup the project. It requires the creation of a bootstrap file with all the initialisation stuff it. The framework is relatively large - about 12.4Mb and the set-up process took about 19 minutes.
Documentation The documentation is very well-structured and organized although it is a bit less detailed than the Zend framework documentation.
CodeIgniter also has forums and a wiki which feature a lot of user-submitted code.
The Zend Framework has very detailed documentation with a lot of examples. It is less organised than the CodeIgniter docs in my view although this could be down to the afore-mentioned detail and the large number of components available in the framework.ZF also has a wiki with a few tutorials.
Templating CodeIgniter includes a template parser class although in my opinion its use is limited as it does not support logic (e.g. if statements) in the views.However the CI recommendation is to use PHP tags in the views. The Zend framework includes a Layout class designed to provide a common layout (or multiple layouts) for the entire website or application. It uses PHP tags for templating although it does provide an abstract view class which can be extended with a 3rd party template library.
Components CI has a lot of libraries and helpers to simplify the developer’s life.While it does have less of these than ZF, in the main, the usage of the CI variants is simpler. ZF has a massive number of classes and components.These are well documented although the usage is usually a bit more difficult than in CI.
Database Access CI includes a database class which handles the database connection. The database class can be used for standard SQL queries creating, retrieving, updating and deleting data in the standard PHP way.CI also includes an active record class which is a modified version of the Active Record Database Pattern. This pattern allows information to be retrieved, inserted, and updated in your database with minimal scripting. In some cases only one or two lines of code are necessary to perform a database action.Beyond simplicity, a major benefit to using the Active Record features is that it allows the creation of database independent applications, since the query syntax is generated by each database adapter. It also allows for safer queries, since the values are escaped automatically by the system. Zend_Db and its related classes provide a simple SQL database interface for Zend Framework. It allows for standard SQL queries but simplifies retrieving the SQL results.It also includes an ORM using both the Table Data Gateway and the Row Data Gateway. These represent the database table and row respectively as objects and can drastically reduce development speed.The downside is a slight performance deficit when compared to the modified active record pattern used in CodeIgniter which does not use objects as extensively.Zend_Db can also model table relationships in PHP classes making database joins a breeze.
Flexibility CI is very flexible allowing almost all defaults to be modified. ZF is simply a collection classes and as such any file or folder can be placed anywhere as long as the location is added to the bootstrap file.
Validation Data validation in CodeIgniter is handled via a validation class. A set of rules gets defined and assigned to the validation object.The validation object automatically validates the data passed via the URL or form. From there, the programmer can decide how that gets handled.The validation class can also help automate some of the process of setting error messages for specific fields. The Zend_Validate component provides a set of commonly needed validators. It also provides a simple validator chaining mechanism by which multiple validators may be applied to a single datum in a user-defined order.In ZF, each validator is a separate class and the class is added to the data (like a filter) rather than the data being passed into the class like it is in CodeIgniter.
Forms The Form Helper file in CI contains functions that assist in working with forms.It aids in the generation of form fields although it does not completely eliminate the need to write HTML code. Zend_Form simplifies form creation and handling. It handles element filtering and validation, escaping data and form rendering.Using Zend_Form, ZF can represent a form completely in PHP code including labels, validation and error messages.
Performance CI has about double the performance of the Zend Framework. The Zend Framework is about half as fast as CodeIgniter.
Testing CodeIgniter has a unit testing class but it encourages mixing the test code with the actual source code so I don’t recommend it.A third-party extension for SimpleTest is available though.Using PHPUnit with the CI classes should also be possible. The Zend Framework does not have a built-in unit testing class but the core classes use PHPUnit as their test framework and this can be extended to include any additional classes.Using SimpleTest with the ZF classes should also be possible.
Internationalisation No Yes
License BSD-style New BSD

Summary

I was rather surprised at the performance difference (measured using apachebench loading the home page with one call to the database to retrieve four rows). I expected the efficiency of using PHP5 only features to make up for the extra size of the Zend framework.

The Zend Framework advantages include:

  • The “official PHP framework”.
  • My workplace is already a Zend “partner”.
  • Full-featured layout and template system.
  • Massive number of classes and components.
  • Extremely flexible.
  • More advanced database library.
  • More advanced validation library.
  • Internationalization support.

CodeIgniter advantages include:

  • Extremely easy to setup.
  • Lower learning curve then the Zend Framework.
  • More accessible documentation.
  • Concise syntax - The Zend Framework syntax is wordier.
  • 100% faster than the Zend framework.

There isn’t any clear cut “winner” here in my opinion and we still haven’t chosen one yet.

Update: the benchmarks are now available

TyStreamer page moved to Still Designing

The TyStreamer page has moved from its old home on wiskars.com to the main Still Designing web site! This by itself is not necessarily “blog-worthy” as the content hasn’t changed much… yet. But some of you may have noticed that the VideoLAN team has just release VLC version 0.9.0-test1. TyStreamer now requires version 0.9.0 for its ability to stream flash video, allowing you to use 98% of all web browser installations to watch video on your TiVo or home computer anywhere on the internet. There hasn’t been a new release of TyStreamer in a while largely because VLC 0.9.0 has been a bit of a moving target. Now that we’re starting to see some slightly more stable releases from VLC, TyStreamer can likewise start showing its stuff. Some of the cool new features you can look forward to over previous versions:

  • Streams Flash video
  • View video files on your home computer as well as TiVo programs
  • Support for multiple video sources from the same TyStreamer installation
  • Cool new Web 2.0 user interface using jQuery!
  • Streams to the Nintendo Wii’s Internet Channel!
And much, much more! For the more intrepid souls, you can try using the latest from svn, or you can wait for an official release “Real Soon Now”(TM).
←Older