- Adding the missing slides

This commit is contained in:
Derick Rethans
2003-05-09 09:38:22 +00:00
parent e32f740154
commit e8d6d49359
22 changed files with 267 additions and 5 deletions

View File

@@ -36,6 +36,7 @@
<!-- Preventing -->
<slide>slides/errorhandling/user-input.xml</slide>
<slide>slides/errorhandling/user-input2.xml</slide>
<slide>slides/errorhandling/check-return-value.xml</slide>
<!-- Dry theory -->
@@ -45,16 +46,19 @@
<!-- Testing! -->
<slide>slides/errorhandling/function-lib.xml</slide>
<slide>slides/errorhandling/test-all-paths1.xml</slide>
<slide>slides/errorhandling/test-all-paths2.xml</slide>
<slide>slides/errorhandling/phpunit1.xml</slide>
<slide>slides/errorhandling/phpunit2.xml</slide>
<slide>slides/errorhandling/phpunit3.xml</slide>
<slide>slides/errorhandling/phpunit4.xml</slide>
<slide>slides/errorhandling/phpunit5.xml</slide>
<!-- Still problems? Debug! -->
<slide>slides/errorhandling/debug.xml</slide>
<slide>slides/errorhandling/xdebug.xml</slide>
<slide>slides/errorhandling/xdebug-cb-dump.xml</slide>
<slide>slides/errorhandling/xdebug-trace.xml</slide>
<slide>slides/errorhandling/xdebug-profile.xml</slide>
<slide>slides/errorhandling/xdebug-demo.xml</slide>
<slide>slides/errorhandling/weaverslave.xml</slide>
<slide>slides/errorhandling/questions.xml</slide>
<slide>slides/errorhandling/resources.xml</slide>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>Checking Return Values</title>
<blurb> </blurb>
<blurb>PHP 4:</blurb>
<example fontsize="1.2em"><![CDATA[<?php
if (@mysql_connect('localhost', 'root', 'ut34FblY:')) {
if (@mysql_select_db('game')) {
$r = mysql_query('SELECT * FROM news ORDER BY date DESC LIMIT 1');
...]]></example>
<blurb> </blurb>
<blurb>PHP 5:</blurb>
<example fontsize="1.2em"><![CDATA[<?php
try {
mysql_connect('localhost', 'root', 'ut34FblY:'));
mysql_select_db('game');
$r = mysql_query('SELECT * FROM news ORDER BY date DESC LIMIT 1');
} catch (Exception $e) {
/* Do recovery */
exit();
}]]></example>
</slide>

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em" title="Debug">
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<image align="center" filename="debug.gif" />
<list marginleft="4em" effect="slide" fontsize="5em">
<bullet>Not perfect code</bullet>
<bullet>Time to debug!</bullet>
<bullet>"echo" debugging</bullet>
<bullet>Time consuming</bullet>
</list>
</slide>

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em" title="Testing">
<image align="right" filename="monkey_typing.png" />
<example fontsize="0.7em"><![CDATA[<?php
function crop_string ($str, $length)
{
if (strlen($str) > $length - 3) {
$lines = split("\n", wordwrap($str, $length - 3));
return $lines[0]. "...";
} else {
return $str;
}
}
?>]]></example>
<example fontsize="0.7em"><![CDATA[<?php
include 'lib.php';
$tests = array (
'crop_string' => array(
array('foo...', 'foo', 1),
array('foo...', 'foo', 3),
array('foo', 'foo', 7),
array('', '', 1),
array('', '', 7),
array('Hello...', 'Hello world', 1),
array('Hello...', 'Hello world', 7),
array('Hello world', 'Hello world', 17),
),
);
$functions = get_defined_functions();
$functions = $functions['user'];
foreach ($functions as $function) {
if (isset($tests[$function])) {
$i = 0;
foreach ($tests[$function] as $test) {
$i++;
switch (count($test)) {
case 2: $res = $function($test[1]); break;
case 3: $res = $function($test[1], $test[2]); break;
}
if ($res != $test[0]) {
echo "FAILED test $function, $i: Expected '{$test[0]}' got '$res'\n";
} else {
echo "PASSED test $function, $i\n";
}
}
}
}
?>]]></example>
</slide>

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em" title="PHPUnit">
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<image align="right" filename="bug.gif" />
<list effect="slide" fontsize="5em">
<bullet>PEAR Class</bullet>
<bullet>%pear install PHPUnit%</bullet>
<bullet>Easy testing of class (methods)</bullet>
<bullet>Automated</bullet>
</list>
</slide>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em" title="Running Testsuite">
<example fontsize="0.8em"><![CDATA[<?php
class CropString {
function cropString($str, $length)
{
if (strlen($str) > $length - 3) {
$lines = split("\n", wordwrap($str, $length - 3));
$this->result = $lines[0]. "...";
} else {
$this->result = $str;
}
}
?>]]></example>
<example fontsize="0.8em"><![CDATA[<?php
require_once 'crop_string.class.php';
require_once 'PHPUnit.php';
class CropStringTest extends PHPUnit_TestCase {
function CropStringTest($name) {
PHPUnit_TestCase::PHPUnit_TestCase($name);
}
function emptyTest() {
$cstring = new CropString('', 1);
$this->assertTrue($cstring->result == '');
}
function fooTest() {
$cstring = new CropString('foo', 1);
$this->assertTrue($cstring->result == 'foo...');
}
function helloWorldTest() {
$cstring = new CropString('Hello world', 1);
$this->assertTrue($cstring->result == 'Hello...');
}
}
$suite = new PHPUnit_TestSuite();
$suite->addTest(new CropStringTest('emptyTest'));
$suite->addTest(new CropStringTest('fooTest'));
$suite->addTest(new CropStringTest('helloWorldTest'));
$result = PHPUnit::run($suite);
echo $result->toString();
?>]]></example>
</slide>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>User Input</title>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<list effect="slide" fontsize="5em">
<bullet>Users are evil!</bullet>
<bullet>register_globals == evil</bullet>
<bullet>$_GET, $_POST, $_COOKIE, $_REQUEST, $_ENV, $_SERVER</bullet>
</list>
</slide>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>User Input (2)</title>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<list effect="slide" fontsize="5em">
<bullet>Cross Site Scripting</bullet>
<bullet>SQL injection</bullet>
<bullet>String cut attacks</bullet>
<bullet>include() and eval()</bullet>
</list>
</slide>

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>Weaverslave</title>
<image align="center" filename="shot_4.png" />
</slide>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>Modified PHP functions</title>
<blurb> </blurb>
<blurb>Modified error handler: </blurb>
<image align="center" filename="error_cb.png"/>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb>Modified var_dump() function:</blurb>
<image align="center" filename="vardump.png"/>
</slide>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>Demo</title>
<blurb> </blurb>
<image align="center" filename="demo.png"/>
</slide>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>Profiling</title>
<image align="center" filename="profile.png"/>
<blurb> </blurb>
<list effect="slide" fontsize="4.5em">
<bullet>xdebug_start_profile()</bullet>
<bullet>xdebug_dump_function_profile(mode)</bullet>
<bullet marginleft="2em">8 profiling modes</bullet>
</list>
</slide>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em">
<title>Tracing</title>
<blurb> </blurb>
<image align="center" filename="trace.png"/>
<blurb> </blurb>
<blurb> </blurb>
<list effect="slide" fontsize="5em">
<bullet>xdebug_start_trace()</bullet>
<bullet>xdebug_dump_function_trace()</bullet>
</list>
</slide>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<slide fontsize="6em" title="Xdebug">
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<list effect="slide" fontsize="4.5em">
<bullet>Helps finding bugs</bullet>
<bullet>Zend extension</bullet>
<bullet type="none" marginleft="2em">zend_extension=/path/to/xdebug.so</bullet>
<bullet type="none" marginleft="2em">zend_extension_ts=C:/path/to/xdebug.dll</bullet>
<bullet>Hooks into error handler</bullet>
<bullet type="none" marginleft="2em">and function exection</bullet>
</list>
</slide>