cvs: presentations /slides/advanced Test_UrlParser_Link.phpt Test_UrlParser_Text.phpt UrlParser.php UrlParser1.php adv_what.xml apidocs.php cache.php
d_api.xml d_api1.xml d_architecture.xml d_architecture1.xml d_bad.xml d_bad1.xml d_good.xml d_phpdoc1.xml d_source.xml e_handling.xml e_handling1.xml
e_logging.xml e_logging1.xml e_recieving2.xml future.php p_benchmark1.xml p_profiling.xml s_arch.xml s_encrypt.xml s_encrypt2.xml s_injection.xml
s_injection1.xml s_validation.xml s_validation1.xml simpleexcept.php t_intro.xml t_stress.xml t_stress2.xml t_unit_phpunit1.xml t_unit_phpunit2.xml
t_unit_phpunit3.xml t_unit_phpunit4.xml url_parser.php url_parser.phpt url_parser1.php url_parser1.phpt

From: Date: Fri, 16 Jan 2004 04:13:23 +0000
Subject: cvs: presentations /slides/advanced Test_UrlParser_Link.phpt Test_UrlParser_Text.phpt UrlParser.php UrlParser1.php adv_what.xml apidocs.php cache.php
d_api.xml d_api1.xml d_architecture.xml d_architecture1.xml d_bad.xml d_bad1.xml d_good.xml d_phpdoc1.xml d_source.xml e_handling.xml e_handling1.xml
e_logging.xml e_logging1.xml e_recieving2.xml future.php p_benchmark1.xml p_profiling.xml s_arch.xml s_encrypt.xml s_encrypt2.xml s_injection.xml
s_injection1.xml s_validation.xml s_validation1.xml simpleexcept.php t_intro.xml t_stress.xml t_stress2.xml t_unit_phpunit1.xml t_unit_phpunit2.xml
t_unit_phpunit3.xml t_unit_phpunit4.xml url_parser.php url_parser.phpt url_parser1.php url_parser1.phpt
Groups: php.pres 
Request: Send a blank email to pres+get-929@lists.php.net to get a copy of this message
sterling Thu Jan 15 23:13:23 2004 EDT Added files: /presentations/slides/advanced Test_UrlParser_Link.phpt Test_UrlParser_Text.phpt UrlParser.php UrlParser1.php Removed files: /presentations/slides/advanced url_parser.php url_parser.phpt url_parser1.php url_parser1.phpt Modified files: /presentations/slides/advanced adv_what.xml apidocs.php cache.php d_api.xml d_api1.xml d_architecture.xml d_architecture1.xml d_bad.xml d_bad1.xml d_good.xml d_phpdoc1.xml d_source.xml e_handling.xml e_handling1.xml e_logging.xml e_logging1.xml e_recieving2.xml future.php p_benchmark1.xml p_profiling.xml s_arch.xml s_encrypt.xml s_encrypt2.xml s_injection.xml s_injection1.xml s_validation.xml s_validation1.xml simpleexcept.php t_intro.xml t_stress.xml t_stress2.xml t_unit_phpunit1.xml t_unit_phpunit2.xml t_unit_phpunit3.xml t_unit_phpunit4.xml Log: Update these slides, refinements and the like. Get rid of all sliding bullets.

Index: presentations/slides/advanced/adv_what.xml diff -u presentations/slides/advanced/adv_what.xml:1.3 presentations/slides/advanced/adv_what.xml:1.4 --- presentations/slides/advanced/adv_what.xml:1.3 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/adv_what.xml Thu Jan 15 23:13:22 2004 @@ -2,12 +2,12 @@ <break lines="3"/> <blurb align="center" fontsize="5.0em">~Developing Large Applications.~</blurb> -<list marginleft="4.0em" fontsize="4.5em"> -<bullet effect="slide">Testing &amp; Debugging</bullet> -<bullet effect="slide">Documentation</bullet> -<bullet effect="slide">Error Handling</bullet> -<bullet effect="slide">Security</bullet> -<bullet effect="slide">Performance</bullet> +<list marginleft="2.0em" fontsize="4.5em"> +<bullet>Testing &amp; Debugging</bullet> +<bullet>Documentation</bullet> +<bullet>Error Handling</bullet> +<bullet>Security</bullet> +<bullet>Performance</bullet> </list> </slide> Index: presentations/slides/advanced/apidocs.php diff -u presentations/slides/advanced/apidocs.php:1.1 presentations/slides/advanced/apidocs.php:1.2 --- presentations/slides/advanced/apidocs.php:1.1 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/apidocs.php Thu Jan 15 23:13:22 2004 @@ -39,7 +39,7 @@ function getReasoning($name) { if ($this->isLorax($name)) { - return 'piss off you bloody bugger'; + return 'piss off you bugger'; } else { return 'because thneeds are what everyone needs!'; } Index: presentations/slides/advanced/cache.php diff -u presentations/slides/advanced/cache.php:1.1 presentations/slides/advanced/cache.php:1.2 --- presentations/slides/advanced/cache.php:1.1 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/cache.php Thu Jan 15 23:13:22 2004 @@ -1,14 +1,15 @@ <?php if(file_exists("/cache/first.cache")) { - $stat = @stat("/cache/first.cache"); + $stat = @stat("/cache/first.cache"); - // cache for 10 seconds - if ($stat[9] && (time() > $stat[9] + 10)) { - unlink("/cache/first.cache"); - } else { - include("/cache/first.cache"); - return; - } + // cache for 10 seconds + if ($stat[9] && + (time() > $stat[9] + 10)) { + unlink("/cache/first.cache"); + } else { + include("/cache/first.cache"); + return; + } } $cachefp = fopen("/cache/first.cache", "w"); @@ -21,8 +22,8 @@ </html> <?php if ($cachefp) { - $file = ob_get_contents(); - fwrite($cachefp, $file); - ob_end_flush(); + $file = ob_get_contents(); + fwrite($cachefp, $file); + ob_end_flush(); } ?> Index: presentations/slides/advanced/d_api.xml diff -u presentations/slides/advanced/d_api.xml:1.2 presentations/slides/advanced/d_api.xml:1.3 --- presentations/slides/advanced/d_api.xml:1.2 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_api.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="API Documentation"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> -<break lines="6"/> +<break lines="4"/> <blurb fontsize="4.0em"> Good API documentation is an essential component of any application. </blurb> Index: presentations/slides/advanced/d_api1.xml diff -u presentations/slides/advanced/d_api1.xml:1.1 presentations/slides/advanced/d_api1.xml:1.2 --- presentations/slides/advanced/d_api1.xml:1.1 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_api1.xml Thu Jan 15 23:13:22 2004 @@ -1,15 +1,11 @@ <slide title="API Documentation"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> -<break lines="6"/> +<break lines="3"/> <list fontsize="4.0em"> <bullet>API documentation consists of *two* components.</bullet> <bullet marginleft="2.0em">Generated API docs.. Function definitions and summaries (%doxygen%, %PHPDocumentor%).</bullet> <bullet marginleft="2.0em">Handwritten API documentation. Usage summaries, tutorials, email responses.</bullet> -<bullet>One without the other is like:</bullet> -<bullet marginleft="4.0em" type="none">... Siegfried without Roy</bullet> -<bullet marginleft="4.0em" type="none">... Ebert with that annoying new guy</bullet> -<bullet marginleft="4.0em" type="none">... Microsoft without Satan</bullet> </list> </slide> Index: presentations/slides/advanced/d_architecture.xml diff -u presentations/slides/advanced/d_architecture.xml:1.1 presentations/slides/advanced/d_architecture.xml:1.2 --- presentations/slides/advanced/d_architecture.xml:1.1 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_architecture.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Architecture"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> -<break lines="9"/> +<break lines="3"/> <blurb fontsize="4.0em"> Most of the problems in my life can be attributed to incorrect architecture documentation Index: presentations/slides/advanced/d_architecture1.xml diff -u presentations/slides/advanced/d_architecture1.xml:1.1 presentations/slides/advanced/d_architecture1.xml:1.2 --- presentations/slides/advanced/d_architecture1.xml:1.1 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_architecture1.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Architecture"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> -<break lines="6"/> +<break lines="4"/> <list fontsize="4.0em"> <bullet>Use Wikis</bullet> <bullet type="none" marginleft="2.0em">... Wikis associate dates with entries</bullet> Index: presentations/slides/advanced/d_bad.xml diff -u presentations/slides/advanced/d_bad.xml:1.2 presentations/slides/advanced/d_bad.xml:1.3 --- presentations/slides/advanced/d_bad.xml:1.2 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_bad.xml Thu Jan 15 23:13:22 2004 @@ -1,9 +1,7 @@ <slide title="Bad Documentation"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> - -<break lines="8"/> - +<break lines="7"/> <example><![CDATA[<?php /** * Find the mean average of the contents of $a, and return that @@ -11,26 +9,22 @@ */ function calculate_a_and_b($a) { - $i = 0; // set number of elements to 0 - $c = 0; // set total value of all elements to 0 + $i = 0; // set number of elements to 0 + $c = 0; // set total value of all elements to 0 - /** - * Loop through all the values of $a, and put the current - * loop value in $b - */ - foreach ($a as $b) { - /** - * increment by the current loop value - */ - $c += $b; + /** + * Loop through all the values of $a, and put the current + * loop value in $b + */ + foreach ($a as $b) { + // increment by the current loop value + $c += $b; - /** - * increment the number of elements found - */ - $i++; - } + // increment the number of elements found + $i++; + } - return ($c / $i); + return ($c / $i); } ?>]]></example> </slide> Index: presentations/slides/advanced/d_bad1.xml diff -u presentations/slides/advanced/d_bad1.xml:1.2 presentations/slides/advanced/d_bad1.xml:1.3 --- presentations/slides/advanced/d_bad1.xml:1.2 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_bad1.xml Thu Jan 15 23:13:22 2004 @@ -1,12 +1,12 @@ <slide title="Bad Documentation"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> -<break lines="8"/> +<break lines="5"/> <list fontsize="4.5em"> <bullet>Code is documentation</bullet> <bullet>Document the abstract algorithms, not the programmatical constructs</bullet> <bullet>If you can't figure out what a piece of code does by looking at it, chances are the code is wrong</bullet> -<bullet type="none" effect="slide" marginleft="4.0em">... Its the web stupid!</bullet> +<bullet type="none" marginleft="1.0em">... Its the web stupid!</bullet> </list> </slide> Index: presentations/slides/advanced/d_good.xml diff -u presentations/slides/advanced/d_good.xml:1.2 presentations/slides/advanced/d_good.xml:1.3 --- presentations/slides/advanced/d_good.xml:1.2 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_good.xml Thu Jan 15 23:13:22 2004 @@ -1,6 +1,6 @@ <slide title="Good Documentation"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> -<break lines="10"/> +<break lines="7"/> <example filename="future.php"/> </slide> Index: presentations/slides/advanced/d_phpdoc1.xml diff -u presentations/slides/advanced/d_phpdoc1.xml:1.1 presentations/slides/advanced/d_phpdoc1.xml:1.2 --- presentations/slides/advanced/d_phpdoc1.xml:1.1 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_phpdoc1.xml Thu Jan 15 23:13:22 2004 @@ -1,8 +1,7 @@ <slide title="PHPDocumentor"> <break/> <image filename="doi.jpg" align="right" marginright="1.0em"/> -<break lines="3"/> <blurb fontsize="4.0em">Because Thneeds are what *everyone* needs</blurb> -<break lines="2"/> +<break lines="1"/> <example filename="apidocs.php"/> </slide> Index: presentations/slides/advanced/d_source.xml diff -u presentations/slides/advanced/d_source.xml:1.2 presentations/slides/advanced/d_source.xml:1.3 --- presentations/slides/advanced/d_source.xml:1.2 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/d_source.xml Thu Jan 15 23:13:22 2004 @@ -7,7 +7,7 @@ <list fontsize="4.5em"> <bullet>Documentation is over proselytized</bullet> <bullet>Documentation is very good</bullet> -<bullet marginleft="4.0em" effect="slide" type="none">... but it needs to justify its own existance</bullet> +<bullet marginleft="1.0em" fontsize="2.7em" type="none">... but it needs to justify its own existance</bullet> </list> </slide> Index: presentations/slides/advanced/e_handling.xml diff -u presentations/slides/advanced/e_handling.xml:1.1 presentations/slides/advanced/e_handling.xml:1.2 --- presentations/slides/advanced/e_handling.xml:1.1 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/e_handling.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Error Handling"> <break/> <image filename="stonehenge.jpg" align="right" marginright="1.0em"/> -<break lines="5"/> +<break lines="3"/> <blurb fontsize="4.5em"> *Sterling's Law:* </blurb> Index: presentations/slides/advanced/e_handling1.xml diff -u presentations/slides/advanced/e_handling1.xml:1.1 presentations/slides/advanced/e_handling1.xml:1.2 --- presentations/slides/advanced/e_handling1.xml:1.1 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/e_handling1.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Error Handling"> <break/> <image filename="stonehenge.jpg" align="right" marginright="1.0em"/> -<break lines="5"/> +<break lines="3"/> <blurb fontsize="4.0em"> Error handling is *not* about stupidity prevention. That's data validation. </blurb> Index: presentations/slides/advanced/e_logging.xml diff -u presentations/slides/advanced/e_logging.xml:1.1 presentations/slides/advanced/e_logging.xml:1.2 --- presentations/slides/advanced/e_logging.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/e_logging.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Logging"> <break/> <image filename="stonehenge.jpg" align="right" marginright="1.0em"/> -<break lines="5"/> +<break lines="3"/> <blurb fontsize="4.0em"> Logging must be designed for extensibility </blurb> Index: presentations/slides/advanced/e_logging1.xml diff -u presentations/slides/advanced/e_logging1.xml:1.1 presentations/slides/advanced/e_logging1.xml:1.2 --- presentations/slides/advanced/e_logging1.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/e_logging1.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="The Humanity!"> <break/> <image filename="stonehenge.jpg" align="right" marginright="1.0em"/> -<break lines="5"/> +<break lines="3"/> <blurb fontsize="4.0em"> *Do Not* email yourself the logs for every failed message. Write high priority failures to a log file, and then email yourself that logfile (or the location of that logfile). Index: presentations/slides/advanced/e_recieving2.xml diff -u presentations/slides/advanced/e_recieving2.xml:1.1 presentations/slides/advanced/e_recieving2.xml:1.2 --- presentations/slides/advanced/e_recieving2.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/e_recieving2.xml Thu Jan 15 23:13:22 2004 @@ -3,6 +3,6 @@ <image filename="stonehenge.jpg" align="right" marginright="right"/> <break lines="5" /> <blurb fontsize="4.0em">Exceptions allow you to catch errors and change your flow control</blurb> -<blurb fontsize="4.0em">They are incredibly useful when it comes to error handling</blurb> +<blurb fontsize="4.0em">They are for *exceptional* circumstances.</blurb> <blurb fontsize="4.0em">They are PHP *5* only</blurb> </slide> Index: presentations/slides/advanced/future.php diff -u presentations/slides/advanced/future.php:1.1 presentations/slides/advanced/future.php:1.2 --- presentations/slides/advanced/future.php:1.1 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/future.php Thu Jan 15 23:13:22 2004 @@ -1,13 +1,14 @@ <?php -function get_future_date($daycount, $t = -1) +function get_future_date($days, $t = -1) { - if ($t == -1) { - $t = time(); - } + if ($t == -1) { + $t = time(); + } - // use strtotime() instead of just multiplying by - // 86400 * $daycount, because strtotime() takes - // daylight savings time into account. - return strtotime("now + $daycount days"); + // use strtotime() instead of + // multiplying by 86400 * $daycount, + // because strtotime() takes + // daylight savings time into account. + return strtotime("now + $days days"); } ?> Index: presentations/slides/advanced/p_benchmark1.xml diff -u presentations/slides/advanced/p_benchmark1.xml:1.1 presentations/slides/advanced/p_benchmark1.xml:1.2 --- presentations/slides/advanced/p_benchmark1.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/p_benchmark1.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Benchmarking"> <break/> <image filename="ninja.gif" align="right"/> -<break lines="4"/> +<break lines="1"/> <blurb fontsize="4.0em"> The two classes you need for benchmarking are %Benchmark_Timer% and %Benchmark_Iterate% </blurb> Index: presentations/slides/advanced/p_profiling.xml diff -u presentations/slides/advanced/p_profiling.xml:1.1 presentations/slides/advanced/p_profiling.xml:1.2 --- presentations/slides/advanced/p_profiling.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/p_profiling.xml Thu Jan 15 23:13:22 2004 @@ -2,7 +2,7 @@ <break/> <image filename="ninja.gif" align="right"/> <break lines="8"/> -<list marginleft="5.0em" fontsize="5.0em"> +<list fontsize="5.0em"> <bullet>Identify Bottlenecks</bullet> <bullet>Track Resource Usage</bullet> <bullet>Generate Call Trees</bullet> Index: presentations/slides/advanced/s_arch.xml diff -u presentations/slides/advanced/s_arch.xml:1.1 presentations/slides/advanced/s_arch.xml:1.2 --- presentations/slides/advanced/s_arch.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/s_arch.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Infrastructure"> <break/> <image filename="bb-small.jpg" align="right" marginright="1.0em"/> -<break lines="4"/> +<break lines="2"/> <blurb fontsize="4.0em"> Infrastructure is the most common vulnerability. </blurb> Index: presentations/slides/advanced/s_encrypt.xml diff -u presentations/slides/advanced/s_encrypt.xml:1.1 presentations/slides/advanced/s_encrypt.xml:1.2 --- presentations/slides/advanced/s_encrypt.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/s_encrypt.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Cryptography"> <break/> <image filename="bb-small.jpg" align="right" marginright="1.0em"/> -<break lines="5"/> +<break lines="2"/> <list fontsize="4.0em"> <bullet>Your data be not safe!</bullet> <bullet>I've hacked common webhosts in under 2 minutes</bullet> Index: presentations/slides/advanced/s_encrypt2.xml diff -u presentations/slides/advanced/s_encrypt2.xml:1.1 presentations/slides/advanced/s_encrypt2.xml:1.2 --- presentations/slides/advanced/s_encrypt2.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/s_encrypt2.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Mcrypt"> <break/> <image filename="bb-small.jpg" align="right" marginright="1.0em"/> -<break lines="4"/> +<break lines="1"/> <blurb fontsize="4.0em"> Use the mcrypt extension which provides a rich set of "real" cryptography </blurb> Index: presentations/slides/advanced/s_injection.xml diff -u presentations/slides/advanced/s_injection.xml:1.1 presentations/slides/advanced/s_injection.xml:1.2 --- presentations/slides/advanced/s_injection.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/s_injection.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Injection problems"> <break/> <image filename="bb-small.jpg" align="right" marginright="1.0em"/> -<break lines="8"/> +<break lines="2"/> <blurb fontsize="4.0em"> An example injection vulnerability is shown below </blurb> Index: presentations/slides/advanced/s_injection1.xml diff -u presentations/slides/advanced/s_injection1.xml:1.1 presentations/slides/advanced/s_injection1.xml:1.2 --- presentations/slides/advanced/s_injection1.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/s_injection1.xml Thu Jan 15 23:13:22 2004 @@ -5,7 +5,7 @@ <list fontsize="4.0em"> <bullet>*Never* rely on the value of %magic_quotes_gpc%</bullet> <bullet>Escape SQL query variables with the native database functions when available</bullet> -<bullet marginleft="2.0em">Use %AddSlashes()% when no better alternative exists</bullet> +<bullet marginleft="1.0em">Use %AddSlashes()% when no better alternative exists</bullet> <bullet>Escape shell commands with %EscapeShellArg()% and %EscapeShellCmd()%</bullet> </list> </slide> Index: presentations/slides/advanced/s_validation.xml diff -u presentations/slides/advanced/s_validation.xml:1.1 presentations/slides/advanced/s_validation.xml:1.2 --- presentations/slides/advanced/s_validation.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/s_validation.xml Thu Jan 15 23:13:22 2004 @@ -1,10 +1,10 @@ <slide title="Data Validation"> <break/> <image filename="bb-small.jpg" align="right" marginright="1.0em"/> -<break lines="4"/> +<break lines="1"/> <list fontsize="4.0em"> <bullet>Turn *off* %register_globals%. Access variables via %$_GET%, %$_POST%, %$_COOKIE%, etc.</bullet> -<bullet type="none" marginleft="5.0em" effect="slide">... Dude, its faster! Heh! Hehe!</bullet> +<bullet type="none" marginleft="1.0em">... Dude, its faster! Heh! Hehe!</bullet> <bullet>Create specific parameters for input data, and make sure they match only that data</bullet> </list> <example><![CDATA[<?php Index: presentations/slides/advanced/s_validation1.xml diff -u presentations/slides/advanced/s_validation1.xml:1.1 presentations/slides/advanced/s_validation1.xml:1.2 --- presentations/slides/advanced/s_validation1.xml:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/s_validation1.xml Thu Jan 15 23:13:22 2004 @@ -1,7 +1,7 @@ <slide title="Data Tampering"> <break/> <image filename="bb-small.jpg" align="right" marginright="1.0em"/> -<break lines="4"/> +<break lines="1"/> <blurb fontsize="4.0em">Do not allow users to manually modify hidden variables or cookies</blurb> <example filename="cookie.php"/> </slide> Index: presentations/slides/advanced/simpleexcept.php diff -u presentations/slides/advanced/simpleexcept.php:1.1 presentations/slides/advanced/simpleexcept.php:1.2 --- presentations/slides/advanced/simpleexcept.php:1.1 Mon Jul 7 18:05:47 2003 +++ presentations/slides/advanced/simpleexcept.php Thu Jan 15 23:13:22 2004 @@ -2,27 +2,28 @@ class ConnectException extends Exception { } -function db_connect($host, $user, $pass) { - if (mt_rand() % 6) { - throw new Exception('Russian Roulette is fun'); - } +function db_connect($host, $user, $pass) +{ + if (mt_rand() % 6) { + throw new Exception('Russian Roulette is fun'); + } - $conn = mysql_connect($host, $user, $pass); - if (!$conn) { - throw new ConnectException( - sprintf('Cannot connect to host: %s', mysql_error()) - ); - } + $conn = mysql_connect($host, $user, $pass); + if (!$conn) { + throw new ConnectException( + sprintf('Cannot connect to host: %s', mysql_error()) + ); + } - return $conn; + return $conn; } try { - $conn = db_connect('localhost', 'user', 'pass'); + $conn = db_connect('localhost', 'user', 'pass'); } catch (ConnException $e) { - echo $e->getMessage(); + echo $e->getMessage(); } catch (Exception $e) { - echo $e->getMessage(); - + echo $e->getMessage(); +} -?> +?> Index: presentations/slides/advanced/t_intro.xml diff -u presentations/slides/advanced/t_intro.xml:1.5 presentations/slides/advanced/t_intro.xml:1.6 --- presentations/slides/advanced/t_intro.xml:1.5 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/t_intro.xml Thu Jan 15 23:13:22 2004 @@ -1,9 +1,9 @@ <slide title="What is testing?"> <image filename="testing.jpg" align="right"/> <break lines="6"/> -<list marginleft="3.0em" fontsize="4.5em"> -<bullet effect="slide">Assuring that your application works as it should.</bullet> -<bullet effect="slide">~Ensuring that your application doesn't work as it shouldn't.~</bullet> +<list fontsize="4.5em"> +<bullet>Assuring that your application works as it should.</bullet> +<bullet>~Ensuring that your application doesn't work as it shouldn't.~</bullet> </list> </slide> Index: presentations/slides/advanced/t_stress.xml diff -u presentations/slides/advanced/t_stress.xml:1.1 presentations/slides/advanced/t_stress.xml:1.2 --- presentations/slides/advanced/t_stress.xml:1.1 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/t_stress.xml Thu Jan 15 23:13:23 2004 @@ -1,6 +1,6 @@ <slide title="Stress Testing"> <image filename="testing.jpg" align="right"/> -<break lines="8"/> +<break lines="5"/> <list fontsize="4.5em"> <bullet>Applications behave differently under extreme loads</bullet> <bullet>"Unforseeable" Race Conditions</bullet> Index: presentations/slides/advanced/t_stress2.xml diff -u presentations/slides/advanced/t_stress2.xml:1.2 presentations/slides/advanced/t_stress2.xml:1.3 --- presentations/slides/advanced/t_stress2.xml:1.2 Sun Jul 6 19:12:24 2003 +++ presentations/slides/advanced/t_stress2.xml Thu Jan 15 23:13:23 2004 @@ -1,16 +1,12 @@ <slide title="Finding Race Conditions"> <image filename="testing.jpg" align="right"/> -<break lines="2"/> -<blurb fontsize="4.5em">Use %cherry%!</blurb> +<break lines="3"/> +<blurb fontsize="4.0em">%cherry% is a command line program that runs +a large number of requests against a given webserver and makes sure all +the results are equal. +</blurb> <break/> -<example><![CDATA[% cherry -c 100 -n 10000 -v --similar http://localhost/ -getting initial data from http://localhost/... done -generating rabin 64 checksums... done -stress testing... - 100 - 200 - 300 - [..] -done +<example><![CDATA[% cherry -c 100 -n 10000 http://localhost/ +Request 10 doesn't match! %]]></example> </slide> Index: presentations/slides/advanced/t_unit_phpunit1.xml diff -u presentations/slides/advanced/t_unit_phpunit1.xml:1.6 presentations/slides/advanced/t_unit_phpunit1.xml:1.7 --- presentations/slides/advanced/t_unit_phpunit1.xml:1.6 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/t_unit_phpunit1.xml Thu Jan 15 23:13:23 2004 @@ -3,5 +3,5 @@ <break/> <blurb fontsize="4.5em">Remember, Tests First!</blurb> <break/> -<example title="url_parser.phpt" filename="url_parser.phpt" result="1" fontsize="1.5em"/> +<example title="Test_UrlParser_Link.phpt" filename="Test_UrlParser_Link.phpt" result="1" fontsize="1.5em"/> </slide> Index: presentations/slides/advanced/t_unit_phpunit2.xml diff -u presentations/slides/advanced/t_unit_phpunit2.xml:1.5 presentations/slides/advanced/t_unit_phpunit2.xml:1.6 --- presentations/slides/advanced/t_unit_phpunit2.xml:1.5 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/t_unit_phpunit2.xml Thu Jan 15 23:13:23 2004 @@ -1,7 +1,7 @@ -<slide title="url_parser"> +<slide title="UrlParser"> <image filename="testing.jpg" align="right"/> <break lines="2"/> <blurb fontsize="4.5em">Can you spot the error(~s~) in this code?</blurb> <break/> -<example filename="url_parser.php" fontsize="1.7em"/> +<example filename="UrlParser.php" fontsize="1.7em"/> </slide> Index: presentations/slides/advanced/t_unit_phpunit3.xml diff -u presentations/slides/advanced/t_unit_phpunit3.xml:1.3 presentations/slides/advanced/t_unit_phpunit3.xml:1.4 --- presentations/slides/advanced/t_unit_phpunit3.xml:1.3 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/t_unit_phpunit3.xml Thu Jan 15 23:13:23 2004 @@ -1,7 +1,9 @@ <slide title="Offensive Regexes"> <image filename="testing.jpg" align="right"/> -<break lines="5"/> -<example fontsize="3.0em" title="Bad"><![CDATA[@<a[^>]*href=\"([^"]+)\">[^<]*</a>@ix]]></example> +<break lines="4"/> +<example title="Original"><![CDATA[@<a[^>]+href=\"([^"]+)\">([^<]+)</a>@ix]]></example> <break/> -<example fontsize="3.0em" title="Good"><![CDATA[@<a.*?href=\"([^"]+)\">[^<]*</a>@ix]]></example> +<example title="Problem"><![CDATA[<a href="link.html">This <i>is</i> bad!</a>]]></example> +<break/> +<example title="Solution"><![CDATA[@<a[^>]+href=\"([^"]+)\">(.+)</a>@ix]]></example> </slide> Index: presentations/slides/advanced/t_unit_phpunit4.xml diff -u presentations/slides/advanced/t_unit_phpunit4.xml:1.2 presentations/slides/advanced/t_unit_phpunit4.xml:1.3 --- presentations/slides/advanced/t_unit_phpunit4.xml:1.2 Thu Jun 19 03:14:13 2003 +++ presentations/slides/advanced/t_unit_phpunit4.xml Thu Jan 15 23:13:23 2004 @@ -3,5 +3,5 @@ <break/> <blurb fontsize="4.5em">Let's add our test!</blurb> <break/> -<example title="url_parser1.phpt" filename="url_parser1.phpt" fontsize="1.5em" result="1"/> +<example title="Test_UrlParser_Text.phpt" filename="Test_UrlParser_Text.phpt" fontsize="1.5em" result="1"/> </slide> Index: presentations/slides/advanced/Test_UrlParser_Link.phpt +++ presentations/slides/advanced/Test_UrlParser_Link.phpt <?php require_once('PHPUnit.php'); require_once('UrlParser.php'); class Test_UrlParser_Link extends PHPUnit_TestCase { private $data = 'This is some sample data with a <a href="http://www.google.com/">link</a> or <a href="http://www.alltheweb.com/">two</a>.'; function TestLink() { $u = new UrlParser(); $u->SearchText($this->data); self::assertEquals('http://www.google.com/', $u->GetUrl(0)); } } $suite = new PHPUnit_TestSuite(); $suite->addTest(new Test_UrlParser_Link('TestLink')); $result = PHPUnit::run($suite); echo nl2br($result->toString()); ?> Index: presentations/slides/advanced/Test_UrlParser_Text.phpt +++ presentations/slides/advanced/Test_UrlParser_Text.phpt <?php require_once('PHPUnit.php'); require_once('UrlParser1.php'); class Test_UrlParser_TagText extends PHPUnit_TestCase { private $data = '<a href="link.html">This <i>is</i> bad.</a>'; function Test_TagText() { $up = new UrlParser(); $up->SearchText($this->data); self::assertEquals('This <i>is</i> bad.', $up->GetTitle(0)); } } $suite = new PHPUnit_TestSuite(); $suite->addTest(new Test_UrlParser_TagText('Test_TagText')); $result = PHPUnit::run($suite); echo nl2br($result->toString()); ?> Index: presentations/slides/advanced/UrlParser.php +++ presentations/slides/advanced/UrlParser.php <?php class UrlParser { public $urls; public $titles; function SearchText($text) { preg_match_all( '@<a.+href=\"([^"]+)\">([^<]+)</a>@ix', $text, $matches); $this->urls = $matches[1]; $this->titles = $matches[2]; unset($matches); } function GetUrl($index) { return $this->urls[$index]; } function GetTitle($index) { return $this->titles[$index]; } } ?> Index: presentations/slides/advanced/UrlParser1.php +++ presentations/slides/advanced/UrlParser1.php <?php class UrlParser { private $urls; private $titles; function SearchText($text) { preg_match_all( '@<a.+href=\"([^"]+)\">(.+)</a>@ix', $text, $matches); $this->urls = $matches[1]; $this->titles = $matches[2]; unset($matches); } function GetUrl($index) { return $this->urls[$index]; } function GetTitle($index) { return $this->titles[$index]; } } ?>
« previous php.pres (#929) next »