com presentations: phpday tweaks: phpday12.xml slides/intro/eventmq2.xml slides/intro/key_ref2012.xml slides/intro/php5 4_binary.xml
slides/intro/php54_clstatic.xml slides/intro/php54_fad.xml slides/intro/php54_i mc.xml slides/intro/php54_json.xml slides/intro/p
hp54_object_func.xml slides/intro/php54_sarra ys.xml slides/intro/php54_server.xml slides/intro /php54_session.xml slides/intro/php54_tfcs.xm l
slides/intro/php54_traits.xml
| From: | Rasmus Lerdorf | Date: | Sat, 19 May 2012 05:41:20 +0000 |
| Subject: | com presentations: phpday tweaks: phpday12.xml slides/intro/eventmq2.xml slides/intro/key_ref2012.xml slides/intro/php5 4_binary.xml slides/intro/php54_clstatic.xml slides/intro/php54_fad.xml slides/intro/php54_i mc.xml slides/intro/php54_json.xml slides/intro/p hp54_object_func.xml slides/intro/php54_sarra ys.xml slides/intro/php54_server.xml slides/intro /php54_session.xml slides/intro/php54_tfcs.xm l slides/intro/php54_traits.xml |
||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-1805@lists.php.net to get a copy of this message | ||
Commit: 7f29f6fe84efcd9e57329505c15466be94620134
Author: Rasmus Lerdorf <rasmus@php.net> Sat, 19 May 2012 07:41:20 +0200
Parents: ab4a3e0532a871e32c8f8c224f591c2156274ac8
Branches: master
Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=7f29f6fe84efcd9e57329505c15466be94620134
Log:
phpday tweaks
Changed paths:
M phpday12.xml
A slides/intro/eventmq2.xml
M slides/intro/key_ref2012.xml
M slides/intro/php54_binary.xml
M slides/intro/php54_clstatic.xml
M slides/intro/php54_fad.xml
M slides/intro/php54_imc.xml
M slides/intro/php54_json.xml
M slides/intro/php54_object_func.xml
M slides/intro/php54_sarrays.xml
M slides/intro/php54_server.xml
M slides/intro/php54_session.xml
M slides/intro/php54_tfcs.xml
M slides/intro/php54_traits.xml
diff --git a/phpday12.xml b/phpday12.xml index adc6f7a..3584973 100644 --- a/phpday12.xml +++ b/phpday12.xml @@ -49,6 +49,7 @@ covered in this fast-moving session. <slide>slides/intro/2012_title.xml</slide> <slide>slides/intro/eventmq.xml</slide> +<slide>slides/intro/eventmq2.xml</slide> <slide>slides/intro/svm.xml</slide> <slide>slides/intro/php54_title.xml</slide> diff --git a/slides/intro/eventmq2.xml b/slides/intro/eventmq2.xml new file mode 100644 index 0000000..390d537 --- /dev/null +++ b/slides/intro/eventmq2.xml @@ -0,0 +1,84 @@ +<slide title="Event Abstraction"> +<break lines="1"/> +<link fontsize="4em" marginleft="0.5em" href="http://nodephp.org/"/> + +<break lines="1"/> +<blurb fontsize="4em">Simple Web Server</blurb> +<example title="" fontsize="1.5em" rfontsize="1em" result="0"><![CDATA[<?php +$i = 1; + +$app = new React\Espresso\Application(); + +$app->get('/favicon.ico', function ($request, $response) { + $response->writeHead(204); + $response->end(); +}); + +$app->get('/', function ($request, $response) use (&$i) { + $i++; + + $text = "This is request number $i.\n"; + $headers = array('Content-Type' => 'text/plain', + 'Content-Length' => strlen($text)); + + $response->writeHead(200, $headers); + $response->end($text); +}); + +$stack = new React\Espresso\Stack($app); +$stack->listen(1337); +]]></example> + +<break lines="1"/> +<blurb fontsize="4em">Barebones HTTP Server listening on 10 ports</blurb> +<example title="" fontsize="1.5em" rfontsize="1em" result="0"><![CDATA[<?php +$loop = React\EventLoop\Factory::create(); + +for($i=0; $i<10; ++$i) { + $s=stream_socket_server('tcp://127.0.0.1:'.(8000+$i)); + $loop->addReadStream($s, function ($s) use ($i) { + $c=stream_socket_accept($s); + $len=strlen($i)+4; + fwrite($c,"HTTP/1.1 200 OK\r\n". + "Content-Length: $len\r\n\r\n". + "Response from server $i\n"); + echo "Served on server number $i\n"; + }); +} + +$loop->run(); +]]></example> + +<break lines="1" /> +<blurb fontsize="4em">Downloading 2 files in parallel</blurb> +<example title="" fontsize="1em" rfontsize="1em" result="0"><![CDATA[<?php +$loop = React\EventLoop\Factory::create(); + +$files = array( + 'node-v0.6.18.tar.gz' => 'http://nodejs.org/dist/v0.6.18/node-v0.6.18.tar.gz', + 'php-5.4.3.tar.gz' => 'http://it.php.net/get/php-5.4.3.tar.gz/from/this/mirror', +); + +$buffers = array(); + +foreach ($files as $file => $url) { + $readStream = fopen($url, 'r'); + $writeStream = fopen($file, 'w'); + + $buffers[$file] = new React\Socket\Buffer($writeStream, $loop); + + $loop->addReadStream($readStream, function ($readStream) use (&$buffers, $loop, $file, $writeStream) { + if (feof($readStream)) { + $loop->removeStream($readStream); + $loop->removeStream($writeStream); + echo "Finished downloading $file\n"; + return; + } + $buffers[$file]->write(fread($readStream, 1024)); + }); +} + +$loop->run(); +]]></example> + +</slide> diff --git a/slides/intro/key_ref2012.xml b/slides/intro/key_ref2012.xml index cf3ac59..cb9984c 100644 --- a/slides/intro/key_ref2012.xml +++ b/slides/intro/key_ref2012.xml @@ -1,8 +1,8 @@ <slide title="Conclusion"> <break lines="2"/> <list fontsize="4em"> -<bullet>Make sure you are on PHP 5.3</bullet> -<bullet>Help us test PHP 5.4 now</bullet> +<bullet>Still running PHP < 5.3? Upgrade!</bullet> +<bullet>Test your code on PHP 5.4 and upgrade soon</bullet> <bullet>Contribute!</bullet> </list> <break lines="2"/> @@ -14,6 +14,7 @@ <link fontsize="2.5em" marginleft="2em" leader="SVM: " href="http://pecl.php.net/package/svm"/> <link fontsize="2.5em" marginleft="2em" leader="LibEvent: " href="http://pecl.php.net/package/libevent"/> <link fontsize="2.5em" marginleft="2em" leader="ZeroMQ: " href="http://php.zero.mq"/> +<link fontsize="2.5em" marginleft="2em" leader="Node.PHP: " href="http://nodephp.org"/> <link fontsize="2.5em" marginleft="2em" leader="xhprof: " href="http://pecl.php.net/package/xhprof"/> <link fontsize="2.5em" marginleft="2em" leader="Xdebug: " href="http://xdebug.org/docs/profiler"/> <link fontsize="2.5em" marginleft="2em" leader="HipHop: " href="https://github.com/facebook/hiphop-php"/> diff --git a/slides/intro/php54_binary.xml b/slides/intro/php54_binary.xml index 3c3eb1d..72916be 100644 --- a/slides/intro/php54_binary.xml +++ b/slides/intro/php54_binary.xml @@ -3,6 +3,6 @@ <blurb fontsize="4em">To go along with PHP's octal and hex notation</blurb> <example fontsize="2em" result='0' title=""><![CDATA[<?php $mask = 0b010101; -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_clstatic.xml b/slides/intro/php54_clstatic.xml index a72a91c..4edb86e 100644 --- a/slides/intro/php54_clstatic.xml +++ b/slides/intro/php54_clstatic.xml @@ -15,6 +15,6 @@ class Foo { $a = new Foo('bar');; $func = $a->getPrinter(); $func(); // Fatal error: Using $this when not in object context -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_fad.xml b/slides/intro/php54_fad.xml index bf0328d..b69fde0 100644 --- a/slides/intro/php54_fad.xml +++ b/slides/intro/php54_fad.xml @@ -6,6 +6,6 @@ function fruits() { return ['apple', 'banana', 'orange']; } echo fruits()[0]; // Outputs: apple -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_imc.xml b/slides/intro/php54_imc.xml index baf7f2c..fb4e732 100644 --- a/slides/intro/php54_imc.xml +++ b/slides/intro/php54_imc.xml @@ -51,4 +51,6 @@ class foo extends ArrayObject { echo (new foo( [1, [4, 5], 3] ))[1][0]; // 4 ]]></example> +<break lines="5"/> + </slide> diff --git a/slides/intro/php54_json.xml b/slides/intro/php54_json.xml index 88f392e..a09a682 100644 --- a/slides/intro/php54_json.xml +++ b/slides/intro/php54_json.xml @@ -10,13 +10,13 @@ class Foo implements JsonSerializable { } } echo json_encode(new Foo); // Outputs: {"data":"Bar"} -?>]]></example> +]]></example> <list><item>JSON Pretty Printer</item></list> <example fontsize="2em" result='0' title=""><![CDATA[<?php $a = array(1,2,3,array(4,5,6)); echo json_encode($a,JSON_PRETTY_PRINT); -?>]]></example> +]]></example> <example fontsize="2em" result='0' title=""><![CDATA[ [ 1, diff --git a/slides/intro/php54_object_func.xml b/slides/intro/php54_object_func.xml index 52efe39..2a648e9 100644 --- a/slides/intro/php54_object_func.xml +++ b/slides/intro/php54_object_func.xml @@ -13,6 +13,6 @@ class Money { } $Money = new Money(11.02/5*13); echo $Money(); // $28.65 -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_sarrays.xml b/slides/intro/php54_sarrays.xml index 6837863..2639b17 100644 --- a/slides/intro/php54_sarrays.xml +++ b/slides/intro/php54_sarrays.xml @@ -4,6 +4,6 @@ <example fontsize="2em" result='0' title=""><![CDATA[<?php $a = [1, 2, 3]; $b = ['foo' => 'orange', 'bar' => 'apple']; -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_server.xml b/slides/intro/php54_server.xml index eb42a58..dfb1d27 100644 --- a/slides/intro/php54_server.xml +++ b/slides/intro/php54_server.xml @@ -42,6 +42,6 @@ if (preg_match('!\.php$!', $_SERVER["REQUEST_URI"])) { } else { Framework::Router($_SERVER["REQUEST_URI"]); } -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_session.xml b/slides/intro/php54_session.xml index 5c77740..b858c76 100644 --- a/slides/intro/php54_session.xml +++ b/slides/intro/php54_session.xml @@ -12,6 +12,6 @@ SessionHandler implements SessionHandlerInterface { public int write ( string $sessionid , string $sessiondata ) } session_set_save_handler(new MySessionHandler); -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_tfcs.xml b/slides/intro/php54_tfcs.xml index 8c9c9d3..92e3031 100644 --- a/slides/intro/php54_tfcs.xml +++ b/slides/intro/php54_tfcs.xml @@ -15,7 +15,7 @@ class Foo { $a = new Foo('bar');; $func = $a->getPrinter(); $func(); // Outputs: Bar -?>]]></example> +]]></example> <break lines="1" /> @@ -27,6 +27,8 @@ $func = $a->getPrinter(); $func(); // Outputs: Bar $func = $func->bindTo($b); $func(); // Outputs: Pickle -?>]]></example> +]]></example> + +<break lines="5" /> </slide> diff --git a/slides/intro/php54_traits.xml b/slides/intro/php54_traits.xml index 75d6123..6de2dbd 100644 --- a/slides/intro/php54_traits.xml +++ b/slides/intro/php54_traits.xml @@ -19,7 +19,6 @@ class B extends ArrayObject { // Singleton method is now available for both classes A::getInstance(); -B::getInstance(); -?>]]></example> +B::getInstance();]]></example> </slide>
diff --git a/phpday12.xml b/phpday12.xml index adc6f7a..3584973 100644 --- a/phpday12.xml +++ b/phpday12.xml @@ -49,6 +49,7 @@ covered in this fast-moving session. <slide>slides/intro/2012_title.xml</slide> <slide>slides/intro/eventmq.xml</slide> +<slide>slides/intro/eventmq2.xml</slide> <slide>slides/intro/svm.xml</slide> <slide>slides/intro/php54_title.xml</slide> diff --git a/slides/intro/eventmq2.xml b/slides/intro/eventmq2.xml new file mode 100644 index 0000000..390d537 --- /dev/null +++ b/slides/intro/eventmq2.xml @@ -0,0 +1,84 @@ +<slide title="Event Abstraction"> +<break lines="1"/> +<link fontsize="4em" marginleft="0.5em" href="http://nodephp.org/"/> + +<break lines="1"/> +<blurb fontsize="4em">Simple Web Server</blurb> +<example title="" fontsize="1.5em" rfontsize="1em" result="0"><![CDATA[<?php +$i = 1; + +$app = new React\Espresso\Application(); + +$app->get('/favicon.ico', function ($request, $response) { + $response->writeHead(204); + $response->end(); +}); + +$app->get('/', function ($request, $response) use (&$i) { + $i++; + + $text = "This is request number $i.\n"; + $headers = array('Content-Type' => 'text/plain', + 'Content-Length' => strlen($text)); + + $response->writeHead(200, $headers); + $response->end($text); +}); + +$stack = new React\Espresso\Stack($app); +$stack->listen(1337); +]]></example> + +<break lines="1"/> +<blurb fontsize="4em">Barebones HTTP Server listening on 10 ports</blurb> +<example title="" fontsize="1.5em" rfontsize="1em" result="0"><![CDATA[<?php +$loop = React\EventLoop\Factory::create(); + +for($i=0; $i<10; ++$i) { + $s=stream_socket_server('tcp://127.0.0.1:'.(8000+$i)); + $loop->addReadStream($s, function ($s) use ($i) { + $c=stream_socket_accept($s); + $len=strlen($i)+4; + fwrite($c,"HTTP/1.1 200 OK\r\n". + "Content-Length: $len\r\n\r\n". + "Response from server $i\n"); + echo "Served on server number $i\n"; + }); +} + +$loop->run(); +]]></example> + +<break lines="1" /> +<blurb fontsize="4em">Downloading 2 files in parallel</blurb> +<example title="" fontsize="1em" rfontsize="1em" result="0"><![CDATA[<?php +$loop = React\EventLoop\Factory::create(); + +$files = array( + 'node-v0.6.18.tar.gz' => 'http://nodejs.org/dist/v0.6.18/node-v0.6.18.tar.gz', + 'php-5.4.3.tar.gz' => 'http://it.php.net/get/php-5.4.3.tar.gz/from/this/mirror', +); + +$buffers = array(); + +foreach ($files as $file => $url) { + $readStream = fopen($url, 'r'); + $writeStream = fopen($file, 'w'); + + $buffers[$file] = new React\Socket\Buffer($writeStream, $loop); + + $loop->addReadStream($readStream, function ($readStream) use (&$buffers, $loop, $file, $writeStream) { + if (feof($readStream)) { + $loop->removeStream($readStream); + $loop->removeStream($writeStream); + echo "Finished downloading $file\n"; + return; + } + $buffers[$file]->write(fread($readStream, 1024)); + }); +} + +$loop->run(); +]]></example> + +</slide> diff --git a/slides/intro/key_ref2012.xml b/slides/intro/key_ref2012.xml index cf3ac59..cb9984c 100644 --- a/slides/intro/key_ref2012.xml +++ b/slides/intro/key_ref2012.xml @@ -1,8 +1,8 @@ <slide title="Conclusion"> <break lines="2"/> <list fontsize="4em"> -<bullet>Make sure you are on PHP 5.3</bullet> -<bullet>Help us test PHP 5.4 now</bullet> +<bullet>Still running PHP < 5.3? Upgrade!</bullet> +<bullet>Test your code on PHP 5.4 and upgrade soon</bullet> <bullet>Contribute!</bullet> </list> <break lines="2"/> @@ -14,6 +14,7 @@ <link fontsize="2.5em" marginleft="2em" leader="SVM: " href="http://pecl.php.net/package/svm"/> <link fontsize="2.5em" marginleft="2em" leader="LibEvent: " href="http://pecl.php.net/package/libevent"/> <link fontsize="2.5em" marginleft="2em" leader="ZeroMQ: " href="http://php.zero.mq"/> +<link fontsize="2.5em" marginleft="2em" leader="Node.PHP: " href="http://nodephp.org"/> <link fontsize="2.5em" marginleft="2em" leader="xhprof: " href="http://pecl.php.net/package/xhprof"/> <link fontsize="2.5em" marginleft="2em" leader="Xdebug: " href="http://xdebug.org/docs/profiler"/> <link fontsize="2.5em" marginleft="2em" leader="HipHop: " href="https://github.com/facebook/hiphop-php"/> diff --git a/slides/intro/php54_binary.xml b/slides/intro/php54_binary.xml index 3c3eb1d..72916be 100644 --- a/slides/intro/php54_binary.xml +++ b/slides/intro/php54_binary.xml @@ -3,6 +3,6 @@ <blurb fontsize="4em">To go along with PHP's octal and hex notation</blurb> <example fontsize="2em" result='0' title=""><![CDATA[<?php $mask = 0b010101; -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_clstatic.xml b/slides/intro/php54_clstatic.xml index a72a91c..4edb86e 100644 --- a/slides/intro/php54_clstatic.xml +++ b/slides/intro/php54_clstatic.xml @@ -15,6 +15,6 @@ class Foo { $a = new Foo('bar');; $func = $a->getPrinter(); $func(); // Fatal error: Using $this when not in object context -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_fad.xml b/slides/intro/php54_fad.xml index bf0328d..b69fde0 100644 --- a/slides/intro/php54_fad.xml +++ b/slides/intro/php54_fad.xml @@ -6,6 +6,6 @@ function fruits() { return ['apple', 'banana', 'orange']; } echo fruits()[0]; // Outputs: apple -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_imc.xml b/slides/intro/php54_imc.xml index baf7f2c..fb4e732 100644 --- a/slides/intro/php54_imc.xml +++ b/slides/intro/php54_imc.xml @@ -51,4 +51,6 @@ class foo extends ArrayObject { echo (new foo( [1, [4, 5], 3] ))[1][0]; // 4 ]]></example> +<break lines="5"/> + </slide> diff --git a/slides/intro/php54_json.xml b/slides/intro/php54_json.xml index 88f392e..a09a682 100644 --- a/slides/intro/php54_json.xml +++ b/slides/intro/php54_json.xml @@ -10,13 +10,13 @@ class Foo implements JsonSerializable { } } echo json_encode(new Foo); // Outputs: {"data":"Bar"} -?>]]></example> +]]></example> <list><item>JSON Pretty Printer</item></list> <example fontsize="2em" result='0' title=""><![CDATA[<?php $a = array(1,2,3,array(4,5,6)); echo json_encode($a,JSON_PRETTY_PRINT); -?>]]></example> +]]></example> <example fontsize="2em" result='0' title=""><![CDATA[ [ 1, diff --git a/slides/intro/php54_object_func.xml b/slides/intro/php54_object_func.xml index 52efe39..2a648e9 100644 --- a/slides/intro/php54_object_func.xml +++ b/slides/intro/php54_object_func.xml @@ -13,6 +13,6 @@ class Money { } $Money = new Money(11.02/5*13); echo $Money(); // $28.65 -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_sarrays.xml b/slides/intro/php54_sarrays.xml index 6837863..2639b17 100644 --- a/slides/intro/php54_sarrays.xml +++ b/slides/intro/php54_sarrays.xml @@ -4,6 +4,6 @@ <example fontsize="2em" result='0' title=""><![CDATA[<?php $a = [1, 2, 3]; $b = ['foo' => 'orange', 'bar' => 'apple']; -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_server.xml b/slides/intro/php54_server.xml index eb42a58..dfb1d27 100644 --- a/slides/intro/php54_server.xml +++ b/slides/intro/php54_server.xml @@ -42,6 +42,6 @@ if (preg_match('!\.php$!', $_SERVER["REQUEST_URI"])) { } else { Framework::Router($_SERVER["REQUEST_URI"]); } -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_session.xml b/slides/intro/php54_session.xml index 5c77740..b858c76 100644 --- a/slides/intro/php54_session.xml +++ b/slides/intro/php54_session.xml @@ -12,6 +12,6 @@ SessionHandler implements SessionHandlerInterface { public int write ( string $sessionid , string $sessiondata ) } session_set_save_handler(new MySessionHandler); -?>]]></example> +]]></example> </slide> diff --git a/slides/intro/php54_tfcs.xml b/slides/intro/php54_tfcs.xml index 8c9c9d3..92e3031 100644 --- a/slides/intro/php54_tfcs.xml +++ b/slides/intro/php54_tfcs.xml @@ -15,7 +15,7 @@ class Foo { $a = new Foo('bar');; $func = $a->getPrinter(); $func(); // Outputs: Bar -?>]]></example> +]]></example> <break lines="1" /> @@ -27,6 +27,8 @@ $func = $a->getPrinter(); $func(); // Outputs: Bar $func = $func->bindTo($b); $func(); // Outputs: Pickle -?>]]></example> +]]></example> + +<break lines="5" /> </slide> diff --git a/slides/intro/php54_traits.xml b/slides/intro/php54_traits.xml index 75d6123..6de2dbd 100644 --- a/slides/intro/php54_traits.xml +++ b/slides/intro/php54_traits.xml @@ -19,7 +19,6 @@ class B extends ArrayObject { // Singleton method is now available for both classes A::getInstance(); -B::getInstance(); -?>]]></example> +B::getInstance();]]></example> </slide>