Place: Dunn Bros. Coffee, Downtown St. Paul
Attendees: Allie Micka, H.J. Schmidt, Tim McGuire, Eddie Maddox, Franz, Tom Murray, Carl Narvisson, Noah Bratzen, Robert G. Pappas
- News:
- H.J. launched his new php application. It is a health care terms database. You can get a free 24 hour evaluation password and he would love to have you test it out: http://www.hctonline.net
- Possibility of holding next meeting at Health Partners office near the airport.
- Allie's Short Article On Evolt discusses how to build those 'breadcrumbs' at the top of your page and how to automatically include certain formatting files
- PHP Basics: How PHP does variables
- Everything starts out as a text
variable and is automatically converted to number if numeric functions are
performed on it.
- PHP allows you to get away without declaring variables. "Just start using them!" (see below)
- Important! PHP variables can be over written by variables of different
scope with the same name.
- The order of precedence, or egpcs order in PHP 4, defines which variables are parsed first.
- The default is egpcs (Environment, Get, Post, Cookie, Server).
- This means that Environment variables are overwritten by get variables and get variables are overwritten by Post variables of the same name.
- egpcs order is controlled by the variables_order in your php.ini file.
- You can set this to "pg" which would mean post variables are parsed first and can be overwritten by get variables of the same name.
- PHP allows you to avoid some good programming practices. Overcome the temptations.
- H.J.: this behavior can come back to bite you
as your application grows. The reason that structured languages evolved
the way they did to require variable declarations is so that these problems do
not haunt you the way they can in PHP.
- Poor coding can
become a security flaw as someone types in a URL string with your variables
defined in it.
One way around this is to declare all variables as zero or false or empty string at the beginning of your page. - Part of the solution is to be sure register_globals
is turned off either in the php.ini file or in your page. This will stop the behavior described
in B. above of variables over writting one another.
Then, you must access your variables with the following associative arrays:- $_get (same as $HTTP_GET_VARS) array of all the variables contained in URL string
- $_post (same as $HTTP_GET_VARS) array of all variables sent in a posted form
- $_ENV array of all environmental variables
- $_COOKIE(same as $HTTP_COOKIE_VARS)
- $_SERVER - contains session vars
- Coding best practices and
naming conventions
A good book is Code Complete . Readable, thorough discussion of how to do programming right. A lot of what he says is based on research into coding practices that answers the questions of what are most errors caused by. Brief Notes from Code Complete:- Most important is to to some design and planning before coding. Write pseudo code and plan the variables you will need and what you will name them.
- "The most important consideration in naming a variable is that the name fully and accurately describe the entity the variable represents." - Code Complete
- Names of subroutines(functions) should describe everything that subroutine does. (If the names get long and silly, then divide up the operations among more subroutines so that you have reasonable names)
- Assign values to variables right before they are used instead of at the top of a page or in an include file.
- Package even the smallest operations in a subroutine instead of in the main body of code.
- Establish a naming convention.
- Form Field Arrays
- Make form fields show up in the called page as arrays in forms with multiple
rows when posted by putting brackets after the field name
<INPUT TYPE = "TEXT" NAME = "frequency[]"> - Caution: be aware that brackets in field names are not part of W3C recommendation and are not XHTML Compliant.
- How to address controls named this way in the Javascript DOM:
Solution:
An HTML input control namedfrequency[]can be addressed as follows in JavaScript:var theform = document.forms[0];
var intFrequency;
for(i=0;i<numrows;i++){
intFrequency = theform["FREQ["+i+"]"].value;
.....
}
- WDDX was a
technology that has pretty much died, but was an early attempt at creating a
common protocol between languages so it could do things such as pass Server side
arrays to JavaScript.
- Apache
2.0
- Biggest deal is this: Apache 2.0 gives you the advantages of both Unix type threads and processes and use them both to manage how Apache handles requests.
- Works much better on Win32 platform than earlier versions.
- Each Child Process has its on unique user name and group name so that it can spawn its own threads.
- Apache 2.0 threads are not fully implemented on FreeBSD.
From the Install File: *If you are building on FreeBSD, be aware that threads will be disabled and the prefork MPM will be used by default, as threads do not work well with Apache on FreeBSD. If you wish to try a threaded Apache on FreeBSD anyway, use "./configure --enable-threads". Allie tried --enable-threads but Apache hung on connect. (There has since been a fix issued, but it is not really fixed yet)
- This article about Multiple Processing Modules (MPMs) discusses the Apache implementation of thread behavior.
- This thread on the apache development mail list gives insight into the decisions to release Apache 2.0 as GA (general availability) instead of another Beta release.
- Only has experimental support for PHP!
- Other
Where is php.ini on OSX? Possible that it is not even there. PHP would run fine without php.ini
- Make form fields show up in the called page as arrays in forms with multiple
rows when posted by putting brackets after the field name

