cvs: presentations /slides/top7 arrayaccess.png complex.xml complex1.xml complex2.xml content.xml custerrorhandler.php db.xml errobjframework.php
errorhandl.xml errorhandlobj.xml holes.xml logical.xml mistake1.xml mistake2.xml mistake3.xml mistake4.xml mistake5.xml mistake6.xml mistake7.xml
objects_ex.php objects_ex1.php prototyping.xml rglobals.xml sample.txt shell.xml shell_command.php thanks.xml todo trycatch.php trycatch.xml
trycatch1.php types.xml types1.xml types_ex.php

From: Date: Thu, 14 Nov 2002 06:56:42 +0000
Subject: cvs: presentations /slides/top7 arrayaccess.png complex.xml complex1.xml complex2.xml content.xml custerrorhandler.php db.xml errobjframework.php
errorhandl.xml errorhandlobj.xml holes.xml logical.xml mistake1.xml mistake2.xml mistake3.xml mistake4.xml mistake5.xml mistake6.xml mistake7.xml
objects_ex.php objects_ex1.php prototyping.xml rglobals.xml sample.txt shell.xml shell_command.php thanks.xml todo trycatch.php trycatch.xml
trycatch1.php types.xml types1.xml types_ex.php
Groups: php.pres 
Request: Send a blank email to pres+get-527@lists.php.net to get a copy of this message
sterling Thu Nov 14 01:56:42 2002 EDT Added files: /presentations/slides/top7 arrayaccess.png complex.xml complex1.xml complex2.xml content.xml custerrorhandler.php db.xml errobjframework.php errorhandl.xml errorhandlobj.xml holes.xml logical.xml objects_ex.php objects_ex1.php prototyping.xml rglobals.xml sample.txt shell.xml shell_command.php todo trycatch.php trycatch.xml trycatch1.php types.xml types1.xml types_ex.php Modified files: /presentations/slides/top7 mistake1.xml mistake2.xml mistake3.xml mistake4.xml mistake5.xml mistake6.xml mistake7.xml thanks.xml Log: add top7 presentation

Index: presentations/slides/top7/mistake1.xml diff -u presentations/slides/top7/mistake1.xml:1.2 presentations/slides/top7/mistake1.xml:1.3 --- presentations/slides/top7/mistake1.xml:1.2 Sat Nov 2 01:38:41 2002 +++ presentations/slides/top7/mistake1.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,4 @@ <slide title="Necessity Coding"> +<blurb><![CDATA[<br /><br /><br />]]></blurb> +<blurb align="center" fontsize="5.0em">"It had to be in by monday, so I'll just put this in and hope it kinda works!"</blurb> </slide> Index: presentations/slides/top7/mistake2.xml diff -u presentations/slides/top7/mistake2.xml:1.2 presentations/slides/top7/mistake2.xml:1.3 --- presentations/slides/top7/mistake2.xml:1.2 Sat Nov 2 01:38:41 2002 +++ presentations/slides/top7/mistake2.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,4 @@ <slide title="Prototyping"> +<blurb><![CDATA[<br /><br /><br />]]></blurb> +<blurb align="center" fontsize="5.0em">No need to wait till the end of a project to fail.</blurb> </slide> Index: presentations/slides/top7/mistake3.xml diff -u presentations/slides/top7/mistake3.xml:1.2 presentations/slides/top7/mistake3.xml:1.3 --- presentations/slides/top7/mistake3.xml:1.2 Sat Nov 2 01:38:41 2002 +++ presentations/slides/top7/mistake3.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,5 @@ <slide title="Security Considerations"> +<blurb><![CDATA[<br /><br /><br />]]></blurb> +<blurb align="center" fontsize="5.0em">If your site is at all visited, than you will always +have people trying to break your system in many different ways.</blurb> </slide> Index: presentations/slides/top7/mistake4.xml diff -u presentations/slides/top7/mistake4.xml:1.2 presentations/slides/top7/mistake4.xml:1.3 --- presentations/slides/top7/mistake4.xml:1.2 Sat Nov 2 01:38:41 2002 +++ presentations/slides/top7/mistake4.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,6 @@ <slide title="Error Checking"> +<blurb><![CDATA[<br /><br />]]></blurb> +<blurb align="center" fontsize="5.0em">Comprehensive error checking is essential in any +commercial application, you need to know when an error happens, where it happens and politely +inform the user that it happened</blurb> </slide> Index: presentations/slides/top7/mistake5.xml diff -u presentations/slides/top7/mistake5.xml:1.2 presentations/slides/top7/mistake5.xml:1.3 --- presentations/slides/top7/mistake5.xml:1.2 Sat Nov 2 01:38:41 2002 +++ presentations/slides/top7/mistake5.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,5 @@ <slide title="Database Access"> +<blurb><![CDATA[<br /><br /><br />]]></blurb> +<blurb align="center" fontsize="5.0em">Misabuse of databases is probably the +most costly performance related issue when optimizing a website.</blurb> </slide> Index: presentations/slides/top7/mistake6.xml diff -u presentations/slides/top7/mistake6.xml:1.3 presentations/slides/top7/mistake6.xml:1.4 --- presentations/slides/top7/mistake6.xml:1.3 Sat Nov 2 01:41:52 2002 +++ presentations/slides/top7/mistake6.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,11 @@ -<slide title="Separation of Logic and Display"> +<slide title="Logic &amp; Content"> +<blurb> +<![CDATA[<br /><br /><br />]]> +</blurb> + +<blurb fontsize="5.0em"> +PHP an excellent templating language so people often make +the mistake of interspersing programming logic and content. +</blurb> + </slide> Index: presentations/slides/top7/mistake7.xml diff -u presentations/slides/top7/mistake7.xml:1.2 presentations/slides/top7/mistake7.xml:1.3 --- presentations/slides/top7/mistake7.xml:1.2 Sat Nov 2 01:38:41 2002 +++ presentations/slides/top7/mistake7.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,5 @@ <slide title="Misapplying Semantics"> +<blurb><![CDATA[<br /><br /><br />]]></blurb> +<blurb align="center" fontsize="5.0em">Not understanding some of the fundamental concepts that +make PHP, well, PHP.</blurb> </slide> Index: presentations/slides/top7/thanks.xml diff -u presentations/slides/top7/thanks.xml:1.2 presentations/slides/top7/thanks.xml:1.3 --- presentations/slides/top7/thanks.xml:1.2 Sat Nov 2 01:38:41 2002 +++ presentations/slides/top7/thanks.xml Thu Nov 14 01:56:42 2002 @@ -1,2 +1,8 @@ -<slide title="Thank You"> +<slide> +<title>Thank You!</title> +<blurb><![CDATA[<br />]]></blurb> +<link fontsize="4.0em" align="left" leader="These Slides, " href="http://talks.php.net/"/> +<blurb> +</blurb> +<link fontsize="4.0em" align="left" leader="My Email, " href="sterling@php.net"/> </slide> Index: presentations/slides/top7/complex.xml +++ presentations/slides/top7/complex.xml <slide title="Objects are Types"> <blurb> </blurb> <example filename="objects_ex.php" result="1"/> </slide> Index: presentations/slides/top7/complex1.xml +++ presentations/slides/top7/complex1.xml <slide title="Objects cont..."> <blurb> Objects must be explicitly defined as references in PHPv4, otherwise they will be copy-on-write like all other PHP variables. </blurb> <example filename="objects_ex1.php" result="1"/> </slide> Index: presentations/slides/top7/complex2.xml +++ presentations/slides/top7/complex2.xml <slide title="Hash"> <blurb> Arrays are hashes, objects are two hashes. </blurb> <image align="center" filename="arrayaccess.png" title="An Array Access"/> </slide> Index: presentations/slides/top7/content.xml +++ presentations/slides/top7/content.xml <slide title="Content"> <list> <bullet effect="slide">Presentation Logic</bullet> <bullet marginleft="2.0em" effect="hide">HTML</bullet> <bullet marginleft="2.0em" effect="hide">CSS</bullet> <bullet marginleft="2.0em" effect="hide">Javascript</bullet> <bullet effect="slide">Data</bullet> </list> </slide> Index: presentations/slides/top7/custerrorhandler.php +++ presentations/slides/top7/custerrorhandler.php <?php function get_error($errno, $errstr, $errfile, $errline) { print "Fuddy Duddy error in $errfile on $errline [$errno]: $errstr\n"; } set_error_handler('get_error'); $d = 1 / 0; print $d; ?> Index: presentations/slides/top7/db.xml +++ presentations/slides/top7/db.xml <slide title="Database Queries"> <blurb>To escape database queries use the %AddSlashes()% function.</blurb> <example result="1" type="php"><![CDATA[<?php $user = "' OR id='1"; $query = "SELECT * FROM table WHERE id='%s'"; var_dump(sprintf($query, $user)); print "\n<br />\n"; var_dump(sprintf($query, AddSlashes($user))); ?>]]></example> </slide> Index: presentations/slides/top7/errobjframework.php +++ presentations/slides/top7/errobjframework.php <?php class simple { function getName($id) { if ($id == 10) { return "Sterling"; } else { $err = &new simple_error(-10, "Invalid id given!"); return $err; } } } class simple_error { var $str; var $number; function simple_error($number, $str) { $this->str = $str; $this->number = $number; } } // start sample code $s = &new simple; $name = $s->getName(20); if (is_object($name)) { die ("An error occured " . "[{$name->number}]: " . "{$name->str}\n"); } else { print "Name for ID 20 was found\n"; } Index: presentations/slides/top7/errorhandl.xml +++ presentations/slides/top7/errorhandl.xml <slide title="Hooks"> <blurb>PHP supports the %set_error_handler()% and %trigger_error()% function in order to allow you to easily trap application errors.</blurb> <example type="php" filename="custerrorhandler.php" result="1"/> </slide> Index: presentations/slides/top7/errorhandlobj.xml +++ presentations/slides/top7/errorhandlobj.xml <slide title="OO Errors"> <blurb>Large frameworks often use objects to represent errors.</blurb> <example filename="errobjframework.php" result="1" type="php" /> </slide> Index: presentations/slides/top7/holes.xml +++ presentations/slides/top7/holes.xml <slide title="Holes"> <list fontsize="4.0em"> <bullet>Running Outdated Software</bullet> <bullet>Incorrectly handled user input</bullet> <bullet>Using uninitialized variables</bullet> <bullet marginleft="2.0em" effect="hide">Use %E_ALL%!</bullet> </list> </slide> Index: presentations/slides/top7/logical.xml +++ presentations/slides/top7/logical.xml <slide title="Logic"> <list> <bullet effect="slide">Data Access &amp; Manipulation</bullet> <bullet marginleft="2.0em" effect="hide">Database Connections</bullet> <bullet marginleft="2.0em" effect="hide">Parsing and Regenerating</bullet> <bullet effect="slide">Calculations (Mathematical, Monetary)</bullet> <bullet effect="slide">IPC (Sockets, pipes)</bullet> </list> </slide> Index: presentations/slides/top7/objects_ex.php +++ presentations/slides/top7/objects_ex.php <?php class simple { var $name; } function changeName ($o) { $o->name = "Sterling Hughes"; } $o = new simple; $o->name = "Johnny Red"; echo $o->name . "\n<br />\n"; changeName($o); echo $o->name . "\n<br />\n"; ?> Index: presentations/slides/top7/objects_ex1.php +++ presentations/slides/top7/objects_ex1.php <?php class simple { var $name; } function changeName (&$o) { $o->name = "Sterling Hughes"; } $o = &new simple; $o->name = "Johnny Red"; echo $o->name . "\n<br />\n"; changeName($o); echo $o->name . "\n<br />\n"; ?> Index: presentations/slides/top7/prototyping.xml +++ presentations/slides/top7/prototyping.xml <slide title="About prototyping"> <list fontsize="3.5em"> <bullet effect="slide">Constant customer feedback</bullet> <bullet marginleft="2.0em" effect="hide">Involve them in the design process</bullet> <bullet marginleft="2.0em" effect="hide">Make smaller internal releases where customers can overview progress</bullet> <bullet effect="slide">Write it hacky</bullet> <bullet marginleft="2.0em" effect="hide" type="none">... Fix the hacks ...</bullet> <bullet effect="slide">Needs based development</bullet> </list> </slide> Index: presentations/slides/top7/rglobals.xml +++ presentations/slides/top7/rglobals.xml <slide title="Register Globals"> <blurb fontsize="4.0em">Register Globals is evil and you should disable it</blurb> <example type="php"><![CDATA[<?php if ($name == "Sterling") { $loggedin = 1; } if ($loggedin) { echo "Super Secret Information\n<br />"; } ?>]]></example> <blurb fontsize="3.5em">Use %$_FILES%, %$_GET%, %$_POST%, %$_COOKIE%, %$_REQUEST% instead.</blurb> <example type="php"><![CDATA[<?php if ($_GET['name'] == "Sterling") { $loggedin = 1; } if ($loggedin) { echo "Super Secret and Somewhat Safe Information\n<br />"; } ?>]]></example> </slide> Index: presentations/slides/top7/sample.txt +++ presentations/slides/top7/sample.txt no one will ever read this... its our dirty little secret Index: presentations/slides/top7/shell.xml +++ presentations/slides/top7/shell.xml <slide title="Shell Commands"> <blurb>To escape shell commands use the %escapeshellcmd()% and %escapeshellarg()% functions.</blurb> <example filename="shell_command.php" result="1" type="php"/> </slide> Index: presentations/slides/top7/shell_command.php +++ presentations/slides/top7/shell_command.php <?php $user = "/usr/local; rm -f /"; $command = "ls -l "; var_dump( escapeshellcmd($command . $user) ); var_dump( $command . escapeshellarg($user) ); ?> Index: presentations/slides/top7/trycatch.php +++ presentations/slides/top7/trycatch.php <?php try { $d = 1 / 0; print $d; } catch (Exception $e) { die("There was an error: " . $e->getException()); } ?> Index: presentations/slides/top7/trycatch.xml +++ presentations/slides/top7/trycatch.xml <slide title="Exceptions"> <blurb>PHP 5 supports the concept of exceptions via %try% and %catch%.</blurb> <example filename="trycatch.php" type="php"/> <blurb>Custom Exceptions are also supported.</blurb> <example filename="trycatch1.php" type="php"/> </slide> Index: presentations/slides/top7/trycatch1.php +++ presentations/slides/top7/trycatch1.php <?php class MyException { function MyException($_error) { $this->error = $_error; } function getException() { return $this->error; } } function ThrowException() { throw new MyException("'This is an exception!'"); } try { ThrowException(); } catch (MyException $exception) { print "There was an exception: " . $exception->getException(); print "\n"; } ?> Index: presentations/slides/top7/types.xml +++ presentations/slides/top7/types.xml <slide title="PHP Types"> <blurb> </blurb> <example result="1" filename="types_ex.php"/> </slide> Index: presentations/slides/top7/types1.xml +++ presentations/slides/top7/types1.xml <slide title="PHP Types cont..."> <list> <bullet effect="slide">PHP is actually typed</bullet> </list> <list marginleft="2.0em" type="none" effect="hide"> <bullet>... %null%</bullet> <bullet>... %boolean%</bullet> <bullet>... %integer%</bullet> <bullet>... %float%</bullet> <bullet>... %string%</bullet> <bullet>... %array%</bullet> <bullet>... %object%</bullet> </list> </slide> Index: presentations/slides/top7/types_ex.php +++ presentations/slides/top7/types_ex.php <?php // XXX: Presentation system hack chdir(getcwd() . "/presentations/slides/top7"); $fp = fopen('sample.txt', "r"); while ($line = fread("$fp", 1024)) { echo $line; } fclose($fp); ?>
« previous php.pres (#527) next »