Archive for the ‘PHP’ Category

Poor programming practices

Friday, February 1st, 2013

When will it stop. These amateur programmers that simply cut/paste code really affect those good programmers in the ecosystem trying to make a decent living. I was reviewing a developed (but incomplete) PHP/MySQL system using a common framework (which in itself is irrelevant for this post).

In one source file there were 12 repetitions of the following code:

   //permissions
    $this->security_model->setUserPermissions($id);
    if (!array_key_exists($id,$this->session->userdata['permissions']) OR
	!array_key_exists('id', $this->session->userdata['permissions'][$id]) OR
	!array_key_exists('scope', $this->session->userdata['permissions'][$id]['name'])){
      $this->session->set_flashdata('alert', 'You are not authorized to go there.');
      redirect($this->agent->referrer());
    }

It’s bad enough when code is repeated and not put in a simple re factored function. When it’s repeated 12 times in one file, and OMG over 100 times in the product, that is a recipe for bugs, and high maintenance codes due to extremely poor coding practice.

Upcoming book – Expert PHP and MySQL

Wednesday, March 3rd, 2010

This month will see the release of the book Expert PHP and MySQL which I was a co-author of. Initially this will be available for purchase in PDF format from the Wrox website and I am hopeful this will be available in print format for the MySQL Users Conference.

More then just your standard PHP and MySQL there is detailed content on technologies including Memcached, Sphinx, Gearman, MySQL UDFs and PHP extensions. We will be posting more information at www.ExpertPhpandMySQL.com. You can download a PDF version of Chapter 1 Techniques Every Expert Programmer Needs to Know.

The book includes the following content:

  1. Techniques Every Expert Programmer Needs to Know
  2. Advanced PHP Constructs
  3. MySQL Drivers and Storage Engines
  4. Improved Performance through Caching
  5. Memcached MySQL
  6. Advanced MySQL
  7. Extending MySQL with User-defined Functions
  8. Writing PHP Extensions
  9. Full Text Search using SPHINX
  10. Multi-tasking in PHP and MySQL
  11. Rewrite Rules
  12. User Authentication with PHP and MySQL
  13. Understanding the INFORMATION_SCHEMA
  14. Security
  15. Service and Command Lines
  16. Optimization and Debugging

NY PHP – Sun & MySQL: A New Hope

Wednesday, March 26th, 2008

Tonight’s New York PHP community meeting was a talk by Philip Antoniades the MySQL Systems Engineering Manager.

With an interesting topic opener “A New Hope” I could not resist to hear Philip’s official MySQL presentation.

Some small points I took away from the presentation.

  • Sun is committed to Postgres with Josh Berkus and a team of 20 people.
  • Solaris.next is the next version of Sun, I thought that was a cool internal name, be it obvious
  • A marketing slide of the highest traffic websites listed Meebo, yousendit, alexaholic, techcrunch, feedburneer, istockphoto and vimeo as reported by Pingdom. Not sure were they get their data, but Google, Yahoo, FaceBook, Wikipedia, MySpace, Fotolog are sites I think of as high traffic. Indeed 3 of these listed sites I’ve never heard of.
  • MySQL 5.1 is expected GA in late Q2 (no year was mentioned).
  • Falcon in 6.0 was listed as the “Next Generation” transaction Storage Engine, an interesting term I’d not heard of before.
  • Sun provides Hosted Database Services (i.e. the cloud) via network.com.
  • MySQL has had an influx of Sun Engineers (60-80).
  • MySQL is being benchmarked more on Sun H/W.

This talk did remind me it’s time to download Open Solaris. With the interesting comment that out of some 1,200 Sun Engineers over 1,000 were Macbook users gives me great confidence it will work just fine on my Macbook.

Out of other discussions there was talk of ZFS, so this will be interesting in what backup opportunities for MySQL without a true Online Backup solution may exist.
Also there was discussion with Sun’s GUI Tool NetBeans, and this casts light on how this will sit with the MySQL GUI team and MySQL Workbench.

Interesting times, this new hope.

Sending email using PHP

Sunday, November 6th, 2005

I’ve had a number of recent inquiries about sending emails on a Web Form using PHP.

The following examples using the core PHP mail() function.

mail() syntax http://www.arabx.com.au/example/mail.phpView Source

HMTL form with mail() operation http://www.arabx.com.au/example/form.phpView Source