PHP


9
Dec 09

Multiprocessing part 1: Quick & Dirty

DEC Alpha AXP 21064 microprocessor

DEC Alpha AXP 21064 microprocessor

PHP can do only one thing at a time. Usually (for websites) this isn’t a big problem because you only have to process a request. On the other hand, if you are doing something more time-consuming PHP could be to slow.

An example is my chat bot server (Mai Ocean). For each conversation I have to make a connection with a server, so for each conversation I have a socket that I have to listen and write to. So if 10 people are talking to my bot I have at least 11 socket connections (10 conversations + main server), you could imagine that this would be way to much for just one script. So how can we solve this? Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

5
Dec 09

PHP, Hell or Heaven: Documentation

Hell or Heaven?

Hell or Heaven?

A programming language can be great but if you do not know how it works then it’s (practically) worthless. In general you can say that the documentation is a important part of a programming language. Returning to this series, we can only tag PHP as “Heaven” if it has a good documentation. Now that’s the question we should answer today.

If you have used PHP before you should already now the answer to this question. It is definitely yes. I have never heard someone saying that the documentation was bad or somehow not good enough. Even people who hate PHP can’t disprove that (of course they could try). Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

2
Dec 09

PHP, #3 Most popular programming language

The comany TIOBE collects statistics about the popularity of programming languages. In their last analysis PHP was on position 3 and that is something to be proud of. :) The only two that are popular than PHP are C and Java. PHP is also in the race for “Programming Language of 2009″ together with C and C#!

The development in the rankings can be found in the graph below:

Long term trends for the top 10 programming languages

Long term trends for the top 10 programming languages

The total ranking list can be seen on the TIOBE website.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

1
Dec 09

The bootstrap: Germination of your application

Sunflower seedlings

Sunflower seedlings

After the start of your (PHP) application it will grow. You will include more and more files, execute more functions and handle more data. When you are finished processing, all memory will be released and your app will ‘die’. Summarized you could represent your application as something simple like a plant!

The first part of “it’s life” is germination, your application has to start and set up everything he needs. In more technical terms you can call this term the bootstrap. If you use a framework such as Zend Framework you’ve probably already heard from it. Using a .htacess file you direct all traffic to your bootstrap that then will startup the main application. For a person like I (who creates PHP CLI apps) the bootstrap is a way of setting important environment variables. So what should a bootstrap do? Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

27
Nov 09

PHP, Hell or Heaven: Data types

Hell or Heaven?

Hell or Heaven?

This is the first post of the new series “PHP, Hell or Heaven?”. Today I’m going to talk about data types in PHP and compare their usage with other languages.

In PHP there are multiple data types but the main difference between other languages (especially more low level languages such as C++) is that you can assign any value to any variable. This is also called type juggling. Therefore in PHP the type of an variable is defined by its content and not by the developer or by the way it’s been set-up. Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

25
Nov 09

Unit testing in PHP

Unit testing with PHPUnit

Unit testing with PHPUnit

‘Everyone’ says unit testing is important. If I quote Wikipedia you should under stand why:

In computer programming, unit testing is a software verification and validation method in which a programmer tests if individual units of source code are fit for use.

Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

24
Nov 09

Assertions, protection against yourself

When I write new code (especially objects) I tend to build in extra security measures to protect the code against myself or other developers. Please note that I do not mean users but only the people who use the code. Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

23
Nov 09

Mai Ocean, a PHP bot server

Mai Ocean Logo

Mai Ocean Logo

Besides studying and living I like to work on my Open Source project Mai. Mai is a project that consists of several sub projects and one in particular, Mai Ocean, I want to discuss here. It is currently my focus of development because it is an vital part of the Mai Project.

So what is Mai Ocean exactly? In a few words you could say that it is a bot server written in PHP. Of course this doesn’t say much so let me explain further. Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS

23
Nov 09

Securing forms with form keys

Secure Your Forms With Form Keys

Secure Your Forms With Form Keys

A few months ago I wrote an article for Nettuts+ about securing forms with form keys (or nonces). It is a great way to add some extra security to your forms. The original tutorial can be found here:

http://net.tutsplus.com/tutorials/php/secure-your-forms-with-form-keys/

Continue reading →

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Hyves
  • LinkedIn
  • Live
  • MySpace
  • Netvibes
  • PDF
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Add to favorites
  • NuJIJ
  • RSS