Semaphore Bull Memorial

I joined Easy Forex back in 2012 to work on a rather complex project – migrate main website of the company from a really outdated version of DotNetNuke to WordPress.  WordPress, even though it is an absolutely amazing platform, turned out not to be the right tool for the job.  But we’ve managed to deliver anyway.  One of the annoying practices that we had to employ though was a semaphore flag for the database changes – only a single developer could work on the database at any given time.  (Again, this wasn’t a WordPress limitation, but rather specifics of our environment at the time).  That was the time when we introduced the Semaphore Bull to our development process.

Semaphore Bull

 

It worked out quite well.  But being a soft toy, it got abused a lot along the way.  It lost a leg, which was screwed in for a while.  Then it nearly lost the whole butt.  Then the head.  Beaten, barely alive, it still stood its ground and did the job!  At some point it got so bad, that we’ve had to place it into the plastic container, where it survived for a few more month.

Today we’ve finalized our migration of the main website from WordPress to CakePHP.  The system is so simple now that we don’t even need a database  anymore.   And with that, the job of the Semaphore Bull ends.   Gone, but not forgotten though!

Because of its huge contribution to our work, because it saved us from countless painful hours of resolving SQL conflicts, we’ve decided to create a memorial.  Ironically, the memorial to Semaphore Bull is built out Semaphore Bull itself, and the container it lived in.  For the future generations to remember the deed, we’ve printed out the snippet of the developer’s manual and embedded it into the memorial together with the dates.   Here’s how it looks altogether now.

Semaphore Bull memorial

Thank you, Semaphore Bull.  You’ve done us a great service.  Rest in peace.

Searching CakePHP pages

CakePHP framework comes with the default PagesController which is an awesome out of the box way to build a website of mostly static pages.  There is one rather annoying limitation though – no search option.  If you need a website of mostly static pages with search functionality, you are out of luck.  I spent a good chunk of time Googling (searching, eh?) for a solution and even talking to people in #cakephp IRC channel.  The best alternatives, it turned out are listed in this StackOverflow answer:

There is no built in way to search static pages as they are just files on disk.

You have three options

  • Build a model to hold the data somewhat like a CMS so you can use mysql search.
  • google search for sites
  • the more hacky approach of reading the contents of all the pages and using preg_match() or similar on the contents to find matches.

The first option is probably the best depending on your use case. The second option is the easiest if its public facing content. The third option is a horrible idea

Since I need the solution for a public facing website, it looks like I’m gonna go with Google Custom Search Engine option.

CakePHP 2.1.4, 2.2, and a pick into 3.0

There’s been a stream of good news from the CakePHP headquarters recently.  If you are as slow as me on catching up with these things, here is a quick summary.

  • CakePHP 2.1.4 has been release, and that’ll be the last release for the 2.1 branch.  It’s time to move on.
  • CakePHP 2.2 stable has been released, and that’s what you should be using for your projects.
  • CakePHP 3.0 has been mentioned, so if you are interested in contributing early, here is your chance.

CakePHP 3.0 will take a few month to develop.  Mainly, the work is focused around the following:

  • Drop support for PHP 5.2.
  • Add and improve support of PHP 5.4+.
  • Reorganized CakePHP classes to use namespaces to avoid collisions with other libraries and classes.
  • Improve bootstrapping for better control by developers.
  • Rewrite the model layer to support more drivers, object mapping, richer API, etc.
  • Rewrite the routing to work faster and be more flexible.

Overall, it looks like some really healthy activity in CakePHP project.

CakePHP 2.0 released!

I’ve been a bit all over the place these last few days, but I knew that this was coming shortly – CakePHP team released the new and much improved version 2.0 a couple of days ago. There are a lot of changes. And I do mean a lot. Here are some of my favorite:

  • PHP5 support. CakePHP was working with PHP before, of course. But in this release, support for PHP4 was dropped and all code has been updated to utilize PHP5 goodies.
  • Lazy class loading. Previous versions of CakePHP could easily get slow with a lot of models. There were solutions like Containable behavior and others. But it was annoying never the less. CakePHP 2.0 is much improved in this regard. It only loads things that are actually needed and used. That is a huge performance improvement.
  • Improved Console. The new Console is so much better that I’m even considering using CakePHP 2.0 for some of my non-web-based projects. It’s that good!
  • PHPUnit. Previous versions of CakePHP were using SimpleTest framework for unit tests. CakePHP 2.0 switched to the de facto standard PHPUnit. Tests are now easier to write. And integrating CakePHP projects with other Quality Assurance tools should be a breeze.

There are, of course, more changes. These are just the top few that I am particularly glad about.

Also, CakePHP 2.0 release is special to me. It’s been a long while since I participated in the development process of an Open Source project. I usually just report bugs and provide help via forums and blog posts. I did more than that with CakePHP 2.0. I actually wrote a couple of patches that were accepted and merged into this release. They were no rocket science, but a contribution nonetheless.

If you haven’t tried CakePHP before, now is the perfect time to do so. If you have tried older CakePHP versions, you’ll find this one to be much of an improvement. If you have tried it already, please share your thoughts in the comments. Let me know what you think of it.