Archive | November, 2002

A Quick Intro to N-Tier

Posted on 29 November 2002 by Demian Turner


OK, that’s all very general but here’s my attempt to lay down some rules that should apply if a system is to be described as N-Tier;

  • Each layer must be able to exist of a physically independent system. It is not a requirement that each layer should exist on a separate system but rather by making is possible that a layer can be distributed elsewhere, the architecture as a whole is completely scalable.
  • Each layer should exchange information only with the layers above and below it. For example, the presentation logic tier must not exchange information directly with the data access tier but instead with the business tier.
  • Each layer should be interchangeable. This results in some further rules;
    • Each layer should have a clearly defined data interface (API: application program interface).
    • Layers should expect nothing of other layers except that they use the defined APIs to exchange data.

    The data access tier, for example, should not expect a particular database, such as Oracle, to reside below it. In other words it should be possible to replace Oracle with an alternative database without any impact on the data access tier (or any tiers above it).

Comments (0)

Dynamically Creating Barcodes with PHP

Posted on 28 November 2002 by Demian Turner

from Marcelo Subtil Mar?,, by way of the PEAR list

“I have made a class that outputs a Interleaved 2 of 5 barcode of a
string. This class uses gd functions and the generated image can
be any of gd supported image types.

New barcode types can be added easely. I’m working on Code 39 now.”

Comments (1)

Mandrake 9.0 speeds into the installation lead

Posted on 28 November 2002 by Demian Turner

After spending an age downloading the 3 ISO images required to install Redhat 8.0, I wasted about a week trying to install the bugger. I burned about 8 CDs and hit just about every hitch you can imagine along the way: “cd 2 does not match cd 1”, “missing libraries on ISO image”, KDE desktop would not install, Gnome default desktop ran at a continuous 1.5 load … Then I went for Mandrake 9.0 (only 1 ISO required) which went like a charm without a single complaint.

(LinuxWorld) — Last week, we took an “unofficial” look at the Xandros 1.0 installation. This week, we are back on the straight-and-narrow — the “official” install comparo — with Mandrake 9.0 stepping into the spotlight. Can the Mandrake installation compare favorably to that of W2K and Windows XP and dethrone our defending champion, Red Hat 8.0? Let’s find out.

Comments (0)

Converting ASP to PHP

Posted on 28 November 2002 by Demian Turner

… using asp2php ( is the highly successful society for single members of Cambridge University – it’s fun, free, and very popular.

The site was initially implemented on MS IIS, using ASP and the Access “database” on Windows 2k. When I took over, we had outgrown this “toy” solution, and it was crashing weekly, and the database was always corrupted. After a brief dalliance with Sun’s buggy Chilisoft ASP on Linux, I rewrote the site to use PHP. (Thanks a lot to asp2php for doing much of the conversion).

Comments (0)

The Economist: A Touch of Sarcasm

Posted on 24 November 2002 by Demian Turner

Is it just me or does anyone else notice the Economist becoming increasingly sarcastic in its commentaries? Take this snippet from last week’s newsletter:

Somalia’s peace talks got bogged down. Rival warlords from 22 factions took three days to agree on the first three words of a ceasefire pact: “We, the undersigned”.

Comments (0)

Why someone should choose PHP over ASP

Posted on 23 November 2002 by Demian Turner

Apologies if you’ve read this somewhere else 😉
“For that kind of money, you should expect robust enterprise-strength software, which just works all the time.” – Rasmus Lerndorf on investing USD 300,000 for a basic Microsoft Solution.

Q: Do you have any thoughts as to why someone should choose PHP over Microsoft’s Active Service Pages (ASP)?
A: This is a difficult question to answer without getting into philosophical issues. I will try to avoid those and just look at it from a practical perspective:

  • Windows 2000 Server: USD 3,999
  • Internet Security and Acceleration Server: USD 5,999 per CPU
  • SQL Server 2000 Enterprise Edition: USD 19,999 per CPU
  • MSDN Universal Subscription (w/ DevStudio): USD 2,799 per developer

List prices from

This can add up quickly. And you probably need to add some Internet connector licenses, maybe an Exchange server license if you are doing e-mail handling and perhaps the content management server, which is a whopping USD 42,999 per CPU.

Many will of course argue this point, but I can build you a similar setup using Linux, Apache+SSL, PHP, PostgreSQL and Squid. And there are a number of good open-source content management systems I can throw in as well. They don’t all come in shrink-wrapped boxes with slick documentation, but the one thing they certainly do is work.

Set up a nice load-balanced architecture using Squid as a reverse proxy on the front end to a couple of Web servers on the back end with a separate database server. Toss in some database replication for load balancing and robustness. So perhaps five machines with two CPUs in each. The software alone could cost you over USD 300,000 for that, compared to USD 0. In this economy, this is significant.

Then there is the fact that managing an IIS [Microsoft Internet Information Server] server has been a nightmare this year. One security issue after another.

This doesn’t mean that the alternatives don’t have security issues every now and then, but at least you are not paying someone USD 300,000 on top of having to keep up with frequent security patches. For that kind of money, you should expect robust enterprise-strength software, which just works all the time. I don’t mean to offend the Microsoft crowd out there, but that just hasn’t been the case up to now.

Comments (0)

Managing Software Engineers

Posted on 23 November 2002 by Demian Turner

Software engineering is different because the organization can’t afford to lose the individual productivity of the best people by pushing them into management. A truly great programmer may generate 10 times as much business value as a merely good programmer. Can the organization afford to take someone who can do the work of 100 average programmers and push him or her into a pure management role? Probably not. Can the organization afford to put people with weak technical skills into management roles? Probably not. Once you give Joe MBA a title and ask him to coordinate eventually he will be making decisions that have engineering implications. Thus many of the best programmers are eventually forced at least to assume project leadership and mentoring responsibilites. Since they are still expected to produce designs, software, documentation, and journal articles, the danger is that the new manager will become glued to his or her screen and never look up to see how the project team is doing.

Comments (0)

Using PCRE and the preg_*() Family of Functions

Posted on 23 November 2002 by Demian Turner

from the PHP UK list, Keith Young
When using PCRE (Perl Compatible Regular Expressions) you need to surround the expression to be evaluated with a delimiter.


The above are all equivalent… Most people use // as the delimiters.

There is one more “problem” in the PCRE you wrote.  The “.” in a PCRE denotes ANY character.  So if you had “wwwx” it would match.  To force the “.” to evaulate as a period you need to escape it:


More information about PCRE and how to use it (in PHP) is available on the PHP website (I find the pattern syntax page to be the one I reference more often – link below):

One last point.  If you are doing a straight replace that doesn’t require any level of complexity to the pattern matching, then as someone else suggested, using str_replace is a better solution, since it is much easier on the PHP engine.  This is more noticable in situations where the replacement will occur multiple times (like in
loops and such).

Comments (0)

What Does B. Gates Think About Next Gen Internet?

Posted on 23 November 2002 by Demian Turner

be sure to check out the Brain, every blue link in the article.
[…]The next generation Internet will be a computing and communications platform in the same way that the PC is. Programs “written to” the Internet (just as they are written to the PC platform) will run across multiple Web sites, drawing on information and services from each of them, and combining and delivering them in customized form to any device you like.

[…]Everything that can think will link–transparently and automatically. So if you are traveling and need medical attention, your personal physician service will be able to locate the best local doctor, make an appointment that fits into your schedule, share the appropriate medical records and arrange payment. All you’ll need to do is give your permission.

Comments (0)

The Human Computer

Posted on 22 November 2002 by Demian Turner


[…]But human brains are still better than supercomputers in some respects.

ASCI Purple will have 50 terabytes (trillion bytes) of memory; Morvec estimates a brain to have a 100-terabyte capacity.

Brains are portable; ASCI Purple will be the size of 197 refrigerator-size boxes covering 8,900 square feet (about the size of two basketball courts) and will weigh 197 tons. The average brain is 56 cubic inches and weighs 3.3 pounds.

The human brain is distinguished by its ability to think and create in addition to simply processing information quickly, said Wise Young, director of the Keck Neuroscience lab at Rutgers University in New Jersey.

Comments (0)



Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists



PHPkitchen recommends you also check out the following sites :

Accounting for Small Businesses

FreeAgent sign-up