Enforcing coding styles in PHP

I came across a plugin for CakePHP which helps to check if the certain code follows CakePHP coding style.  While I haven’t tried it, I think the better way is to utilize CodeSniffer.  As per PHP_CodeSniffer PEAR page:

PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.

Which basically means that PHP_CodeSniffer is a generic tool for validating your code.  You can use for CakePHP, WordPress, or any other PHP project that you are working on.  The best part is that you can create your own set of rules regarding coding style and then make sure that your team follows it. If you don’t care that much for your own rules, then you can use one of the many existing rulesets.  Some of these come together with CodeSniffer package, others are available on the Web.

Setting up CodeSniffer for my team at work has been a long lasting TODO item, however it looks like I will be able to start working on this next week.  Once it created, tested, and everyone is happy with it, we’ll have it in the pre-commit hook in our Subversion repository.  This way, we will prevent commits of any code that does not follow our rules.  Of course, I plan to only run CodeSniffer against the code that we wrote in-house.  There is no need to re-format all the third-party code just for the sake of it.  Plus, we are rarely doing any modifications of the third-party code at all.

Bits and pieces

Once again I’ve noticed that my blogging is getting behind.  Busy at work, lazy, and going through the mood change for the upcoming Christmas holidays – that all has a role to play.  But that’s not the major issue.

Thinking of what am I doing differently these days, I realized that my blogging activity got spread out all over the web, and therefore became less noticeable on my own blog.  I do more of Twitter, which is now integrated with the blog in the form of daily briefs.  I favourite more videos on Youtube, which now notifies the Twitter, and later still ends up in the daily briefs on the blog.  I do more bookmarks on Delicious, which also end up via Twitter in daily breifs.  And there is something else I do, which doesn’t come back to the blog – shared and commented articles in my Google Reader.

Actually, as far as writing goes, Twitter and Google Reader happen to be the only two places where I write at all now.  Once I realized that, I wanted to find a way to pull the comments and shared items from Google Reader into my blog.  But then I doubt if that’s the right approach.  The alternative being blogging and commenting about things not in the Google Reader, but in the blog itself.

I am still undecided on the matter.  Google Reader provides a really good interface for commenting and interacting with other people who read about similar topics.  On the other hand, my blog has more exposure than my Google Reader shared items list, and has better interface for discussions.  Perhaps, I should try and see how it goes.

What’s your take on comments in Google Reader vs. blog posts?

Fedora 12

I’ve upgraded my laptop to Fedora 12.  I know, that wasn’t the smartest move, since the conference which I am attending is not over yet.  But I just couldn’t wait.

The upgrade process was as simple as:

  • Open up the terminal, switch to root user, and run “preupgrade“.
  • Select Fedora 12 from the list of available options and click Next.
  • Watch the downloads in progress.  Or, as I did, go and have a few beers and socialize.
  • When you are back from the beers, before you crash into bed, click the Next button for the installation to start.
  • Go to sleep.
  • Wake up to a shiny Fedora 12 distribution on your computer.

The only thing that got me worried for a second was that after the laptop rebooted into Fedora 12, for some reason the resolution of the screen went down to 800×600 or something like that.  But all I had to do was login into Gnome, navigate to System / Administration / Display and switch resolution back to what it was before the upgrade.

I didn’t have much time to explore things yet, just read through release notes and features list.  However things do look to be faster and more polished.  I’ll have to use it for a few days to know for sure.

Cyprus Mail – the new on-line face of the local newspapers

Cyprus Mail

I’ve noticed that @cyprusmail Twitter account became much more active recently.  Today I followed one of the posted links to read the news article, and was surprised by the new newspaper’s web site.  It is still in beta, but it’s already pretty good!

Finally, there is someone who knows what he (she?) is doing.  Based on Drupal CMS, utilizing Amazon S3 service, integrating with Twitter, Flickr, YouTube and Facebook, featuring proper RSS feed, slick feedback form, and even placeholders for stuff blogs – that’s quite an achievement!

I definitely welcome the new face (and body) of the Cyprus Mail and wish them great success and to keep up the good job.  Now their content is finally matched by its presentation and surrounding functionality.

Cyprus Linux User Group meeting

As you might have heard, there was yet another Cyprus Linux User Group meeting yesterday.  It was, as usual, aligned to the recent Ubuntu and upcoming Fedora releases.  This time the even took place in the new University of Cyprus campus, in Nicosia.  There were slightly more people than the last time, but I was hoping for even more.

There were three presentations and one workshop.   Theo did a traditional Ubuntu Linux presentation in Greek.  Alexandros presented, also in Greek, about Linux in Cyprus education – a very interesting one, too bad my Greek is so poor.  And then I did a presentation in English about what Linux has to offer to students and why they should get involved.  Here are the slides from my talk (Linux for Students and Linux for Students).  After the presentations, Constantinos did a workshop about Compiz and Elisa media library.  Both looked quite impressive.

After the event a few of us went to the tavern for some really awesome meze and beer.  Altogether – good fun.

P.S.: If you missed the event, keep an eye on Ubuntu Cyprus web site and forums for announcements of the next one. Hope to see you there.