Diving into the Yahoo! Open Stack – SF PHP Meetup April 2nd, 2009

When: 6:30pm Thursday April 2nd, 2009
Where: CBS Interactive – 235 2nd Street San Francisco, CA
RSVP: Diving into the Yahoo! Open Stack

Join the SF PHP Meetup for an exploration into the Yahoo! Open Stack and learn how to leverage Yahoo’s platforms and scalability to build your next application. We will examine the components that make up Yahoo’s open stack: developer tools (YUI), data apis (YQL, BOSS), social apis, and the application platform (YAP).

  • Overview
    • What is the Yahoo! Open Stack?
      • Developer Tools – YUI, Tutorials
      • YOS SDK for PHP
    • Data APIs – YQL, BOSS …
    • Social APIs – Profiles, Connections, Updates, …
    • Application Platform
      • OpenSocial Support
  • How does it all work?
    • Development Workflow
  • Building an open application with PHP and YOS
  • Common Problems & Solutions
    • CAJA
    • OpenSocial

More about the event after the break

Posted under Events, Internet, PHP, Technology, Tips & Tricks, Web Development

This post was written by Michael Tougeron on March 11, 2009

Tags: , , , ,

svn pre-commit & post-commit hooks

I have to say I love subversion (svn) hooks.  I’ve only been playing around with the concept fairly recently and I’m surprised that I lasted this long without them.  I wanted to take a few minutes and share my favorite ways of using them.  As well as a few that I don’t use but I think could be pretty helpful.

Before we keep going, if you don’t know what svn hooks are you can read up on them at http://svnbook.red-bean.com/en/1.1/ch05s02.html.  svnbook.red-bean.com is my reference site of choice whenever I need to look up a svn command.

My #1, all-time, greatest in the world, bestest favorite is a svn pre-commit hook to syntax check my PHP code.  There is nothing I hate more than a developer checking in code with syntax errors and breaking qa or stage or even, god-forbid, production.  It’s as easy as setting up the hook to run a script that calls “/path/to/php -l /path/to/file.php” and on failure reject the commit.  This way code that has syntax errors will never make it into SVN.  Now if only open-source projects like ZendFramework did something like this before releasing their code.  To be fair, the syntax errors are in their documentation not in the /library/ files but that’s still pretty dumb & annoying.

Another nice way to use a post-commit hook is to run something like PHP_CodeSniffer against the commit.  CodeSniffer is an awesome PEAR package that scans your file and flags coding standards violations.  It comes pre-packaged with sniffers for the PHPCS, PEAR, Squiz and  Zend.  Set it up to run and if it finds coding standard violations you can have the hook send out nasty little blame messages.  😉  This isn’t something that I’d want to run on pre-commit just in case you really need to get something into production NOW.  But if I hosted an open source project, I’d consider it.

Having minified JavaScript & CSS has become the standard way of serving JS & CSS.  But who really wants to take the time to minify or combine them?  Once again, enter svn hooks.  One of the developers set this up for GameSpot and it has been working great!  Basically it checks the commits against a defined naming standard, file.src.js or file.src.css, and then runs the YUI! Compressor on it and commits in file.min.(js|css).  He also made it check a global.conf in the file’s directory so it came mash up smaller js files into a global.min.js so we serve one file instead of ten.

Of course, let’s not forget about what is probably the most common svn hook; the post-commit email hook.  I like svnmailer better than mailer.py that comes with svn by default.  I think it’s easier to configure/change and to setup rules for how you want the emails to look or where to go.

If you’re using a ticket tracking system like Bugzilla or Trac that doesn’t have its own way of peeking into svn (like JIRA can with this plugin) you can write a post-commit hook to update the ticket when something is committed.  You can see how Trac recommends you do it at http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook.

To help you on the way to creating your own svn hooks, tigris has a few hooks that are distributed with svn.  They can be quite helpful so you should take a look at them.

Posted under PHP, Tips & Tricks

This post was written by Michael Tougeron on March 7, 2009

Tags: , , , ,

Validating HTML with tidy

If you ever have to do HTML validation or parsing in PHP the tidy extension is the way to do it! This extension lets you use the abilities of tidy in some pretty powerful ways. The extension, written by John Coggeshall, has been around for several years now. I can see how if someone just took a quick glance at it they could think it was nice, but not really something they need. How wrong they would be! If you take a few minutes and look under the hood, tidy is an extremely powerful tool. Not only can it format html to standards (what most people use it for), it can also be a powerful parser and validation tool.

When I’m dealing with user inputted data where I want to allow HTML I have two concerns. First, I don’t want to allow XSS (some xml parsers think <p kkk=”></p>” closes the <p> tag). Second, the user frequently enters invalid html (e.g., doesn’t close the <a> tag). Fortunately tidy can easily deal with both. The second issue is the easiest to solve by running tidy->cleanRepair() on the html. The first is taken care of by looping through the tidy nodes and rebuilding the html using a whitelist. More about how to do this after the break. Read More…

Posted under PHP, Security, Tips & Tricks, Web Development

This post was written by Michael Tougeron on January 15, 2009

Tags: , , , , ,

Making frameworks suck less – SF PHP Meetup Nov 2008

Terry Chay will be returning to speak again!  Due to popular demand Terry has agreed to give his recent “Making frameworks suck less” talk that he gave to the ZendCon08 UnCon this year. Be sure to wear comfortable shoes ’cause Terry will pack the room!

RSVP here: http://php.meetup.com/139/calendar/8911737/

The blurb from ZendCon08:
Terry Chay, the original PHP Terrorist, is well known for his criticism and ridicule of the Ruby on Rails framework. He criticizes, mocks, and f-bombs his enemies into surrender. In this discussion, Terry will share his ideas and thoughts on making frameworks better.

Map to CNET Networks, Inc.
When you arrive, please look for the PHP Meetup sign pointing you to the conference room. Please RSVP if you are attending so that I can prepare enough snacks and beverages.

Look forward to seeing you there!

This event can be found at:

Posted under Events, Internet, PHP, Technology, Web Development

This post was written by Michael Tougeron on October 9, 2008

Tags: , ,

SF PHP Meetup July 2008 – PHP::$unicode->i18n()

Kudos to Mariano for taking the lead while I’m out on paternity leave (I’m going to write about that ones of these days) and setting up July’s PHP Meetup.  Thanks to an introduction from Terry, Mariano asked Andrei Zmievski to talk about the unicode updates to PHP 6.  Due to the 4th of July, we’ve moved the meetup from it’s normal date/time to Thursday July 10th @ 7pm.  It is still at CNET like usual (thanks to GameSpot.com funding the meetup).

Title: PHP::$unicode->i18n()

PHP 6 brings fully functional and mature Unicode support to the Web world. This talk will cover all the layers of the PHP (bread)/Unicode (butter)/i18n (jam) sandwich. Come and find out how to work with locales, use collation to compare and sort strings, and format numbers, currencies, and dates for any country in the world. Bring your appetite because the toasty goodness is waiting.

When: Thursday, July 10th, 2008 at 7pm
Where: CNET Networks: 235 2nd St, San Francisco, CA  94518

You can RSVP on the SF PHP Meetup’s site or just show up.  I always like it when people RSVP so that I know how much food to buy.  But it isn’t a prereq or anything.

EDIT: I just saw that Terry mentioned PB&J and I like the idea.  So PB&J it is; plus the usual chips, sodas, candy, etc. of course.  🙂

Posted under Events, PHP, Technology, Web Development

This post was written by Michael Tougeron on June 29, 2008

Tags: , , ,