Pieter Vogelaar

Pieter Vogelaar

(23 comments, 60 posts)

Hi, my name is Pieter Vogelaar. I’m a web developer / DevOps engineer / IT consultant and specialized in high traffic and high profile websites. I love open source and have a great passion for automating and developing things!

Home page: http://pietervogelaar.nl

Posts by Pieter Vogelaar

Create Git bare / shared remote repository

1

This blog post will describe how to setup a central repository where everybody pulls from and pushes to. This is actually the default work flow in Subversion.

Create a “git” user on your server.

sudo adduser git
nano /etc/group
git:x:1000:myusername,www-data,nobody
sudo mkdir /opt/git_projects
sudo chown git.git /opt/git_projects
sudo chmod 2770 /opt/git_projects
cd /opt/git_projects

Git has a naming convention that repositories that you share with others have a “.git” suffix. Local repositories have just a name. To create a git bare (also called shared remote) repository do the following on the command line.

su git
mkdir example.git
chmod

More >

Zend Framework – Add custom resource type to autoloader

1

This week I wanted to created the folder “application/grids/” to store my grids in. For example the path to the grid is “application/grids/Product.php”. The code inside this PHP file:

class Application_Grid_Product { }

You will now get the error “Fatal error: Class ‘Application_Grid_Product’ not found”. The new path must be added to the Zend Autoloader in order to load the required classes. Your bootstrap must look like this:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {     protected function _initLoaderResources()     {        

More >

Auto escape variables in Zend Framework

0

In Zend Framework you can use the $this->escape() view helper to escape variables to protect your website against XSS attacks.

Unfortunately, there is no possibility to enable this by default so that EVERY variable is escaped by default. It’s a bit odd because some other popular frameworks like Symfony provide this by default. And Symfony 1 was released earlier than Zend Framework, so you’d think it would be picked up, but no

Ofcourse if everything is escaped by default, there are situations were variables were escaped earlier in the application like a form element. But when you More >

poedit_zf_1

Ubuntu 11.10 – Configure POEdit for Zend Framework

3

In this post I’ll desribe how to configure POEdit for Zend Framework in Ubuntu. However POEdit is cross platform compatible and has the same GUI on Windows and Mac, so for these platforms you can also follow several steps below.

If you don’t have POEdit installed yet, open a terminal and execute:

apt-get install poedit

Now start the application with “Alt + F2″ and type “poeditor” and double click the icon. If you start POEdit for the first time, you’ll see the preferences dialog.

Append ” -L php” to the end of the “Parser command:” text field.

More >

PiKe multi translate with Zend_Translate and application.ini

1

With Zend Framework it’s not possible to define multiple translate sources for one Zend_Translate instance that will be stored in the Zend_Registry. Also if you want to add a logger to Zend_Translate, it’s not possible to do this only in your application.ini. The closest you get is to define all translate settings, than create a bootstrap method and “extend” the settings and add a instance of Zend_Log with a writer there.

But we made it possible at the PiKe project to define all this purely in your application.ini.

You only need the file following file, or just add More >

Drupal 7 – Exclude node type in search results

1

Websites that use the search of Drupal 7 core have now ability to restrict the search and exclude some node types for example. I see some articles that Drupal 8 probably will have this kind of functionality.

However, it’s possible to rewrite the SQL query that selects the search results. Thanks to the Drupal database layer this can be done quite easily.

/**  * Excludes node type "foo" from search results  *  * @param object $query  */ function mymodule_query_alter(&$query) {   $is_search = FALSE;   foreach ($query->getTables() as

More >

Show IE6 upgrade warning on your website

0

Nobody wants to support Internet Explorer 6 (IE6) these days.

Internet Explorer 6 is over 9 years old, that’s Internet ‘centuries’! It has security issues, does not support some much loved features (such as tabbed browsing) and lacks support for many modern web standards and technologies. Even Microsoft itself says it’s on old browser and users should upgrade. See http://www.ie6countdown.com.

It’s very easy now to show an IE6 upgrade warning on your website and force users to upgrade to IE6. Checkout: http://code.google.com/p/ie6-upgrade-warning. The warning blocks further use of your website for an IE6 user. This way More >

Pieter Vogelaar's RSS Feed
Go to Top