Category: "PHP"

Comments - Etiquette

Comments are added to code to assist the reader in understanding the code. The following guidelines should be observed:

  • Comments should not be written to editorialize or entertain. Sarcasm should not be in comments. Questions can be placed in comments, where necessary, to ensure issues are identified and resolved.
  • Proper grammar and spelling are required. It reduces the opportunties for misunderstanding.
  • Comments, especially in an interpretive environment such as PHP, should be brief. Utilities that strip comments for distribution can eliminate this requirement.
  • Careful coding, with meaningful function and variable names may reduce the need for comments. Overly complex statements should be avoided.
  • Comments should be considered a visible part of the deliverable product and should be of appropriate quality. If it is a professional product, comments should be professional.
  • Comments must be updated to remain current as the code changes.

RIA server filesystem architecture

The /opt directory can be used to store shared components, as follows:

  • /opt/os - All open source components

  • /opt/common - All common scripts, such as form validation for contact us forms, anti-spam code.

    • /antispam

      • /html - (html and javascript) - to assist the user
      • /php - to protect the server
    • /footer - Footer text, specifically the company name and copyright indicator. This ensures it can be changed in one place to update every page on the server.

New accounts could access these components like so:


ln -s /opt/os/dojo 
ln -s /opt/os/Smarty 
ln -s /opt/os/Zend
ln -s /opt/common/html 
ln -s /opt/common/php
ln -s /opt/common/footer

These links allow relative references to the common resources, while providing central sourcing.

Drupal RPM Component Construction

The next major step for Drupal will be assembly of an RPM repository that bundles compatible components into RPMs that can be managed as such. In order for this to succeed the server filesystem architecture must be created such that a single installation of Drupal can run multiple sites.

just_a_test, great response

Several posts on this blog list the URLs of

<?php echo md5('just a test'); ?>

I recommend the above link for a better list.

unexpand for speed

Editing files often introduces extraneous spaces. The unexpand command will convert the spaces into tabs. This can result in a tremendous reduction in file size, code that is easier to read, and pages which are faster.

unexpand INFILE.php > OUTFILE.php