Resigning From Your Day Job

Last week I wrapped up my employment at Policy Reporter. It was bittersweet to leave a company where I got to play such a big role. During my time we saw tremendous business growth, hired and formed a management team, and had a successful exit when Policy Reporter was acquired by TrailCard. I also had the privilege of hiring and growing an amazing Engineering team, working with a lot of incredible people, form new departments, re-building the technical foundations of the product, building new products, and creating a culture where everyone is respected, friendly, open to learning together, and always looking for ways to get better.

Upgrade to Git

Remember when Subversion was the new tool that all the cool kids were flocking to? Well, Subversion is now the old and busted, and it’s time to move to Git. It’s time to upgrade your Subversion repo (if your still using it) to Git because of the benefits you will gain from moving to a more flexible tool. Distributed: When you checkout (or clone in the git world) a repository, you are checking out all the files in the repository, which means you can work independently of others.

Cache Password Protected Website

I needed to write a simple web app to automatically cache a password protected tumblr admin account, so I wrote simple symfony app to do it. It was pretty simple to do because I could leverage the sfWebBrowserPlugin which provides most of the heavy work for simulating a browser and logging into the site. While this project is setup to cache tumblr, you can easily modify it to cache any website.

WordPress Needs a Default Caching Plugin

I find it curious that WordPress, one of the biggest and best blogging platforms currently around does not come default with a caching plugin. I think the WordPress developers should either include one of the excellent WordPress caching plugins, or build their own and then enable it by default. Users and blog hosts worldwide would have better page load performance and improved scalability. This blog is build with WordPress, and in my first year of blogging, one of my posts received a lot of hits.

Sanitize User Input for XSS in PHP

The best way to sanitize any input from your user (in PHP) is to use the HTML Purifier library. HTML Purifier will remove any XSS from your code, produce valid HTML, and generally make you sleep just a bit safer at night. It doesn’t completely sanitize user input, and you still need to be careful with it before using it anywhere (such as an SQL statement), but it will remove all XSS attacks against your website.

Yii Override Command Parameters

The Yii Framework is very flexible and has a variety of way you can configure it. Here I will show you how you can customize parameters on a Command task. The default Yii Migration command asks the user for a confirmation before running if there are any tables that have been changed, this is quite a sensible default, but I don’t want to be asked if the command should be run after a deployment.

How to add Local Config Variables to Yii

Often times you want to be able to specify configuration parameters or settings that only apply to a single environment. These local configuration don’t need to, and shouldn’t be entered into version control, and should over ride default values. I needed a solution for a project I was working on so I wrote one for Yii. The main configuration file protected/config/main.php returns an array of parameters. Edit this file to merge 2 arrays, 1 from main.

Add an i18n Static Page to Symfony

My last post explained the basics on how to add static pages in symfony, this post expands on that and shows you how to do it for a multilingual site. We split the template finding code out for code maintainability, and we enhance it on where to look for the file. First it tries to find the template in the language and country eg: en_CA, then it tries to find the template in the matching language, and if that is not found, it falls back to the default language.

Add a Static Page to Symfony

Static pages can be added to Symfony quite easily. Edit your routing.yml file which is probably located at apps/frontend/config/routing.yml, and add the following routes to add an about, a privacy, and a terms and conditions page. # static pages about: url: /about param: { module: home, action: page, view: about } privacy: url: /privacy param: { module: home, action: page, view: privacy } terms: url: /terms param: { module: home, action: page, view: terms } If you are going to keep the generic rules, make sure you add these new rules before the default actions.

Web Development Best Practices

Choosing a Technology Framework Does it really matter if you use ASP.NET MVC, Struts 2, Yii, or Rails? Well it might, but for many websites these modern frameworks are just as competitive as the next. Use the stack that is most appropriate for your customer’s situation and is the best choice at the time. Since this is the real world, it will probably change a couple of years in the future.