source code bean

Archive for the ‘PHP’ Category

Recently I decided to switch hosting provider from a shared server to a VPS. My choice of linux is Ubuntu so i installed the latest version, Ubuntu 10.10 server. Instead of using Apache as webserver, which has been my choice of webserver for years, I decided to go for Nginx. Nginx is known for its [...]

06 Jun, 2010

Two new features I really like in PHP 5.3

Posted by: Peter In: PHP

Namespaces Finally PHP has support for namespaces, not one day too late! Before the days of object oriented PHP name clashes for functions was usually prevented by adding a prefix to your function names. When object oriented PHP was introduced function name clashes was less likely, but class names still had to be unique, ie [...]

In this post I am going to show how easy it is to create a JSON-RPC web service using the built in support in Zend Framework. First we need to create the php-file that will handle the incoming RPC calls. It is not advised to put this inside the MVC structure of a Zend web [...]

Today I upgraded a project we started working on last year from Zend Framework 1.7 to Zend Framework 1.9. I excepted to run into several API incompatibilities, but the only problem I got was the autoloader. In Zend 1.7, and earlier versions, the autoloader was registered like this:   require_once "Zend/Loader.php"; Zend_Loader::registerAutoload();   In Zend [...]

It used to be a bit tricky to get started with the Zend Framework. The Zend Framework is very flexible and allows you to set it up in almost any way that fits your needs. This means for example that the directory structure and location of files is up to you, however – there is [...]

23 Feb, 2009

Friendly URLs and the Zend Router

Posted by: Peter In: PHP|Zend Framework

Creating custom friendly URLs using the Zend framework is really simple. The default routing setup for Zend is : ‘:module/:controller/:action/*’, (* will match any var/value) which is fine for most setups. However on some pages having the var/value might not look very good, for example this url is not very readable: /popular/index/type/images/page/1/sortOrder/alltime (controller/action/var/value/var/value/var/value) We would [...]

Zend Framework ships with several View Helpers, such as the url View Helper. Anywhere in a view script one can call $this->url() to generate a url to a certain page. For example: $this->url(array(   ‘module’ => ‘moduleName’,   ‘action’ => ‘actionName’,   ‘additionalParam’ =>‘value’)) I wanted to create my own helper, for generating paths to [...]



  • Joe: It looks like IceCoffee Script may provide the 'await' keyword to JavaScript. http://maxtaco.github.com/coffee-script/
  • Florian: Dealing with events has two primary fashions: imperative (synchronous) code, and callback (asynchronous) code. Both are legitimate styles, for some
  • Joe: I think we haven't seen true PaaS offering yet in Azure. If you use a webrole you're still running on your own VM. This is still not true multi-tena

About

Welcome to source code bean! On this site I post stuff that I encounter in my job and spare time. The content is mostly related to .NET development, but my interest in techonology is very broad, so often you will find posts on totally different subjects!