More talks

This commit is contained in:
Rasmus Lerdorf
2002-07-25 19:34:49 +00:00
parent a4c6eb6428
commit 393ebc5a5e
28 changed files with 460 additions and 12 deletions

View File

@@ -6,14 +6,20 @@
backgroundfixed="1"
>
<topic>PHP</topic>
<title>State of PHP</title>
<title>PHP 4.1 and Beyond</title>
<event>OSCON</event>
<location>San Diego</location>
<date>July 24, 2002</date>
<speaker>Rasmus Lerdorf</speaker>
<email>rasmus@php.net</email>
<slide>slides/state/titlepage.xml</slide>
<slide>slides/state/questions.xml</slide>
<slide>slides/intro/numbers.xml</slide>
<slide>slides/state/doc.xml</slide>
<slide>slides/state/timeline.xml</slide>
<slide>slides/state/changes.xml</slide>
<slide>slides/state/php430.xml</slide>
<slide>slides/state/pear.xml</slide>
<slide>slides/state/php50.xml</slide>
<slide>slides/state/announcements.xml</slide>
</presentation>

30
osconmysql.xml Normal file
View File

@@ -0,0 +1,30 @@
<presentation
template="php"
navmode="html"
backgroundimage="slides/intro/background.png"
backgroundrepeat="1"
backgroundfixed="1"
>
<topic>PHP</topic>
<title>PHP and MySQL</title>
<event>OSCON</event>
<location>San Diego</location>
<date>July 25, 2002</date>
<speaker>Rasmus Lerdorf</speaker>
<email>rasmus@php.net</email>
<slide>slides/intro/titlepage.xml</slide>
<slide>slides/intro/mysql_setup.xml</slide>
<slide>slides/intro/mysql_check.xml</slide>
<slide>slides/intro/mysql_connect.xml</slide>
<slide>slides/intro/mysql_pconnect.xml</slide>
<slide>slides/intro/mysql_create.xml</slide>
<slide>slides/intro/mysql_insert.xml</slide>
<slide>slides/intro/mysql_select.xml</slide>
<slide>slides/intro/mysql_time.xml</slide>
<slide>slides/intro/mysql_update.xml</slide>
<slide>slides/intro/mysql_opt.xml</slide>
<slide>slides/intro/squid1.xml</slide>
<slide>slides/intro/squid2.xml</slide>
<slide>slides/intro/repl1.xml</slide>
<slide>slides/intro/mysqlresources.xml</slide>
</presentation>

View File

@@ -2,5 +2,10 @@
<blurb title="Colour Handling">
For Truecolor images we have no such issues.
</blurb>
<example type="genimage" result="1" filename="slides/intro/image_colors_ex2.php" rwidth="312"/>
<example
type="genimage"
result="1"
filename="slides/intro/image_colors_ex2.php"
rwidth="312"
/>
</slide>

View File

@@ -1,7 +1,9 @@
<slide title="Introduction" logo1="images/animated_elephant.gif">
<list title="Philosophy" fontsize="5.5em" padding="0.6em">
<bullet slide="1" id="intro">Pragmatic approach to the Web Problem</bullet>
<bullet slide="1" id="intro">Direct and obvious solution for a simple problem</bullet>
<bullet slide="1" id="intro">Scalability driven by this simplicity</bullet>
<bullet slide="1">Pragmatic approach to the Web Problem</bullet>
<bullet slide="1">Direct and obvious solution for a simple problem</bullet>
<bullet slide="1">Scalability driven by this simplicity</bullet>
</list>
</slide>

View File

@@ -0,0 +1,13 @@
<slide title="Sanity Check">
<example title="Make sure MySQL is running" type="shell"><![CDATA[prompt:~> mysqlshow
+-----------+
| Databases |
+-----------+
| mysql |
| test |
+-----------+]]></example>
<example result="1" title="Or with the latest PHP"><![CDATA[<? echo mysql_stat() ?>]]></example>
</slide>

View File

@@ -0,0 +1,15 @@
<slide title="Connecting to MySQL">
<example title="The simple connection" result="1"><![CDATA[<?
$conn = mysql_connect('localhost');
echo $conn;
?>]]></example>
<example title="Other variations"><![CDATA[<?
mysql_connect('db.domain.com:33306','rasmus','foobar');
mysql_connect('localhost:/tmp/mysql.sock');
mysql_connect('localhost','rasmus','foobar',
true,MYSQL_CLIENT_SSL|MYSQL_CLIENT_COMPRESS);
?>]]></example>
</slide>

View File

@@ -0,0 +1,30 @@
<slide title="Creating a Database">
<php><![CDATA[<?mysql_query('drop database if exists foo')?>]]></php>
<example result="1" title="Create a DB"><![CDATA[<?
mysql_connect('localhost');
if(mysql_query("CREATE DATABASE foo")) {
echo "Database foo created";
} else {
echo mysql_error();
}
?>]]></example>
<example result="1" title="Create a Table"><![CDATA[<?
mysql_select_db('foo');
$result = mysql_query("CREATE TABLE users (
id varchar(16) binary NOT NULL default '',
Password varchar(16) NOT NULL default '',
Name varchar(64) default NULL,
email varchar(64) default NULL,
ts timestamp(14) NOT NULL,
PRIMARY KEY (id)
)");
if($result) {
echo "Table created";
} else {
echo mysql_error();
}
?>]]></example>
</slide>

BIN
slides/intro/mysql_info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,20 @@
<slide title="Inserting Data">
<example result="1" title="INSERT Query" fontsize="1.5em"><![CDATA[<?
function add_user($id, $pass, $name, $email) {
$result = mysql_query(
"insert into users values ('$id',ENCRYPT('$pass'),'$name','$email',NULL)");
if($result) {
echo "Row inserted<br />";
} else {
echo mysql_error()."<br />";
}
}
mysql_connect('localhost');
mysql_select_db('foo');
add_user('rasmus','foobar','Rasmus Lerdorf','rasmus@php.net');
add_user('carl','carlspass','Carl AlexandeR Lerdorf','carl@lerdorf.com');
?>]]></example>
</slide>

View File

@@ -0,0 +1,23 @@
<slide title="Optimizing MySQL Usage">
<list title="Check these">
<bullet>Don't fetch 10,000 rows and only use 5, use a LIMIT clause</bullet>
<bullet>Make sure you have keys on the right columns</bullet>
<bullet marginleft="1em">%--log-slow-queries[=file_name]% can help here</bullet>
<bullet marginleft="1em">So can %--log-long-format% to show non-indexed queries</bullet>
<bullet marginleft="1em">Use %mysqldumpslow% to look at these</bullet>
</list>
<example title="A non-indexed query" rfontsize="1.3em"><![CDATA[<?
mysql_connect('localhost');
mysql_select_db('foo');
$result = mysql_query("select * from users where ts>0");
?>]]></example>
<example result="1" title="And an indexed query" rfontsize="1.3em"><![CDATA[<?
$result = mysql_query(
"select * from users where id='rasmus'");
echo "<pre>";
system('mysqldumpslow');
echo "</pre>\n";
?>]]></example>
</slide>

View File

@@ -0,0 +1,15 @@
<slide title="Persistent Connections">
<example title="The simple connection" result="1"><![CDATA[<?
$conn = mysql_pconnect('localhost');
echo $conn;
?>]]></example>
<list title="Caveats">
<bullet>Watch out for multi-credential connections</bullet>
<bullet>Make sure you match up max_connections and MaxClients</bullet>
</list>
<image filename="slides/intro/pconnect.png" align="center" />
</slide>

View File

@@ -0,0 +1,24 @@
<slide title="Selecting Data">
<example result="1" title="SELECT Query" fontsize="1.5em" rfontsize="1.3em"><![CDATA[<?
mysql_connect('localhost');
mysql_select_db('foo');
$result = mysql_query("select * from users");
if(!$result) echo mysql_error();
else {
while($row = mysql_fetch_row($result)) {
echo "$row[0] - $row[1] - $row[2] - $row[3] - $row[4]<br />\n";
}
}
?>]]></example>
<example result="1" title="mysql_fetch_array()" fontsize="1.5em" rfontsize="1.3em"><![CDATA[<?
$result = mysql_query("select * from users order by id");
if(!$result) echo mysql_error();
else {
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "$row[id] - $row[Password] - $row[Name] -
$row[email] - $row[ts]<br />\n";
}
}
?>]]></example>
</slide>

View File

@@ -0,0 +1,19 @@
<slide title="Setup">
<example title="Check your PHP Setup for MySQL support"><![CDATA[<? phpinfo() ?>]]></example>
<image filename="slides/intro/mysql_info.png" align="center"/>
<blurb title="If not enabled">
Very rare since a MySQL client library is distributed with PHP and built into PHP
by default. However, it is possible to build PHP without MySQL support. Some
possible fixes:
</blurb>
<example type="shell"><![CDATA[apt-get install php-mysql]]></example>
<example type="shell"><![CDATA[rpm -Uvh php-mysql-4.2.2-1.i386.rpm]]></example>
<blurb> </blurb>
<example type="shell"><![CDATA[./configure --with-mysql=shared,/usr
cp modules/mysql.so /usr/local/lib/php]]></example>
<example><![CDATA[extension_dir=/usr/local/lib/php
extension=mysql.so]]></example>
</slide>

View File

@@ -0,0 +1,18 @@
<slide title="Dealing with timestamps">
<example title="Using DATE_FORMAT" result="1"><![CDATA[<?
mysql_connect('localhost');
mysql_select_db('foo');
$result = mysql_query(
"select id, email,
date_format(ts,'%W %M %D, %Y %r') as d
from users order by ts");
if($result) {
while($row = mysql_fetch_assoc($result)) {
echo "$row[id] - $row[email] - $row[d]<br />\n";
}
} else {
echo mysql_error();
}
?>]]></example>
</slide>

View File

@@ -0,0 +1,18 @@
<slide title="Changing Existing Rows">
<example title="Using UPDATE" result="1"><![CDATA[<?
mysql_connect('localhost');
mysql_select_db('foo');
$result = mysql_query(
"update users set email = 'babycarl@lerdorf.com'
where id = 'carl'");
if($result) {
echo mysql_affected_rows();
} else {
echo mysql_error();
}
?>]]></example>
<blurb title="REPLACE INTO">
You can also use %REPLACE INTO% to update a row if it exists and
insert it if it doesn't.
</blurb>
</slide>

View File

@@ -0,0 +1,13 @@
<slide title="Resources">
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<link fontsize="4em" marginleft="3em" leader="Home Page: " href="http://www.php.net"/>
<link fontsize="4em" marginleft="3em" leader="These Slides: " href="http://pres.lerdorf.com"/>
<link fontsize="4em" marginleft="3em" leader="Manual: " href="http://php.net/mysql"/>
<link fontsize="4em" marginleft="3em" leader="MySQL: " href="http://mysql.com"/>
<link fontsize="4em" marginleft="3em" leader="Books: " href="http://php.net/books.php"/>
</slide>

View File

@@ -0,0 +1,36 @@
<slide title="Announcements">
<image align="left" filename="slides/state/logo.png"/>
<blurb fontsize="3.5em">
The folks at LinuxMagazine are launching a quaterly PHP Journal in the fall.
See http://www.phpj.com for more information.
</blurb>
<image align="left" filename="slides/state/cjh-usenet.gif"/>
<blurb fontsize="3.5em">
*comp.lang.php* was added recently
</blurb>
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<list title="Wednesday PHP Talks">
<bullet>11:30 Jesus Castagnetto - Creating Web Services for a Web Application with XML and PHP</bullet>
<bullet>13:45 Shane Caraveo - Web Services for PHP</bullet>
<bullet>16:30 Geoffrey Speicher, Michael Beckish - From UML to PHP: Using an Open Source Class Library and Design Patterns to Implement Large-Scale Web Applications</bullet>
</list>
<list title="Thursday PHP Talks">
<bullet>10:45 Trevor Harris - Using the PEAR Database Abstraction Layer</bullet>
<bullet>13:45 Gregor J. Rothfuss - Special Purpose Application Servers</bullet>
<bullet>14:30 Rasmus Lerdorf - PHP and MySQL</bullet>
<bullet>15:45 Jim Winstead - The Care and Feeding of the PHP Community</bullet>
<bullet>16:30 Chuck Hagenbuch - Configuring Horde Applications: Getting the Most From Your Horde Installation</bullet>
</list>
<list title="Friday PHP Talks">
<bullet>10:45 PHP Lightning Talks</bullet>
<bullet>13:45 Rasmus Lerdorf - Creating PDF documents with PHP</bullet>
<bullet>14:30 Dan Kuykendall - phpGroupWare - Redefining Groupware Solutions</bullet>
</list>
</slide>

View File

@@ -1,40 +1,47 @@
<slide title="Important Changes">
<list title="PHP 4.0.6">
<list title="PHP 4.0.6" fontsize="4em" marginleft="1em">
<bullet>Multibyte Japanese string support added</bullet>
<bullet>GD 2 support added</bullet>
<bullet>DBX databse abstration extension added</bullet>
<bullet>mysql_unbuffered_query() added</bullet>
</list>
<list title="PHP 4.1.0">
<list title="PHP 4.1.0" fontsize="4em" marginleft="1em">
<bullet>MySQL 4.0 Support</bullet>
<bullet>Thread-safe performance improvement</bullet>
<bullet>New Process Control (pcntl) extension</bullet>
</list>
<list title="PHP 4.1.1">
<list title="PHP 4.1.1" fontsize="4em" marginleft="1em">
<bullet>Minor bug fix release</bullet>
</list>
<list title="PHP 4.1.2">
<list title="PHP 4.1.2" fontsize="4em" marginleft="1em">
<bullet>File upload security fixes</bullet>
</list>
<list title="PHP 4.2.0">
<list title="PHP 4.2.0" fontsize="4em" marginleft="1em">
<bullet>*register_globals* defaults to *OFF* now</bullet>
<bullet>Experimental Apache 2.0 support</bullet>
<bullet>Overloading extension added</bullet>
<bullet>Tokenizer extension added</bullet>
</list>
<list title="PHP 4.2.1">
<list title="PHP 4.2.1" fontsize="4em" marginleft="1em">
<bullet>domxml overhaul</bullet>
<bullet>Bug fixes</bullet>
</list>
<list title="PHP 4.2.2">
<list title="PHP 4.2.2" fontsize="4em" marginleft="1em">
<bullet>File upload security fix</bullet>
</list>
<list title="GTK" fontsize="4em" marginleft="1em">
<bullet>34 apps written in PHP-GTK listed at gtk.php.net</bullet>
<bullet>Coolest App - PHPMole</bullet>
</list>
<image filename="slides/state/gtk.png" marginleft="-2em"/>
</slide>

BIN
slides/state/cjh-usenet.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

14
slides/state/doc.xml Normal file
View File

@@ -0,0 +1,14 @@
<slide title="Documentation">
<blurb> </blurb>
<blurb> </blurb>
<blurb> </blurb>
<list fontsize="6em" marginleft="1em">
<bullet>Best online documentation anywhere</bullet>
<bullet>Around 320 people working on it</bullet>
<bullet>Translated into 16 languages</bullet>
<bullet>Currently 1971 Page PDF Document</bullet>
<bullet>HTML Version</bullet>
<bullet>PalmDoc and iSilo versions</bullet>
<bullet>Windows CHM version</bullet>
</list>
</slide>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

BIN
slides/state/gtk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
slides/state/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
slides/state/pear.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

108
slides/state/pear.xml Normal file
View File

@@ -0,0 +1,108 @@
<slide title="PEAR">
<image align="right" filename="slides/state/pecl.gif"/>
<image align="left" filename="slides/state/pear.gif"/>
<blurb title="PHP Extension and Application Repository">
A unified repository of code written in both PHP and C complete with
a dependency-checking installer.
</blurb>
<link leader="See: " fontsize="4em">|77AA77|http://pear.php.net|</link>
<example type="shell"><![CDATA[prompt:~> pear list
Installed packages:
===================
+----------------+----------+--------+
| Package | Version | State |
| Archive_Tar | 0.9 | stable |
| Console_Getopt | 0.11 | beta |
| DB | 1.2 | stable |
| Mail | 1.0 | stable |
| Net_Sieve | 0.8 | stable |
| Net_Socket | 1.0.1 | stable |
| PEAR | 0.91-dev | beta |
| XML_Parser | 1.0 | stable |
| XML_RPC | 1.0.3 | stable |
| XML_RSS | 0.9.1 | stable |
| XML_Tree | 1.1 | stable |
+----------------+----------+--------+]]></example>
<example type="shell"><![CDATA[prompt:~> pear remote-list
Available packages:
===================
+----------------------+---------+
| Package | Version |
| Archive_Tar | 0.9 |
| Auth | 1.0.2 |
| Auth_HTTP | 1.0.1 |
| Benchmark | 1.1 |
| Cache | 1.5.1 |
| Config | 0.3.1 |
| Crypt_CBC | 0.3 |
| Crypt_Rc4 | 0.1 |
| Date | 1.1 |
| DB | 1.3 |
| DB_ado | 1.1 |
| DB_Pager | 0.7 |
| File | 1.0.2 |
| File_Find | 0.1 |
| File_SearchReplace | 1.0 |
| HTML_Common | 1.0 |
| HTML_QuickForm | 2.3 |
| HTML_Table | 1.1 |
| HTML_TreeMenu | 1.0.3 |
| HTTP | 1.1 |
| HTTP_Request | 1.0 |
| HTTP_Upload | 0.8 |
| Log | 1.2 |
| Mail | 1.0 |
| Mail_Mime | 1.2 |
| Net_CheckIP | 1.0.1 |
| Net_Curl | 0.1 |
| Net_Dig | 0.1 |
| Net_Geo | 1.0 |
| Net_NNTP | 0.1 |
| Net_Ping | 1.0.1 |
| Net_POP3 | 1.1 |
| Net_Portscan | 1.0.1 |
| Net_Sieve | 0.8 |
| Net_SMTP | 1.0 |
| Net_Socket | 1.0.1 |
| Net_URL | 1.0.3 |
| Net_UserAgent_Detect | 1.0 |
| Numbers_Roman | 0.1 |
| Pager | 1.0.4 |
| Payment_Clieop | 0.1 |
| PEAR | 0.9 |
| PHPUnit | 0.3 |
| Science_Chemistry | 1.0.2 |
| System_Command | 1.0 |
| XML_CSSML | 1.1 |
| XML_fo2pdf | 0.97 |
| XML_image2svg | 0.1 |
| XML_Parser | 1.0 |
| XML_RPC | 1.0.3 |
| XML_RSS | 0.9.1 |
| XML_Transformer | 0.3 |
| XML_Tree | 1.1 |
+----------------------+---------+]]></example>
<example type="shell"><![CDATA[prompt:~> pear list-upgrades
Available Upgrades (stable):
============================
+---------+---------+------+
| Package | Version | Size |
| DB | 1.3 | 58kB |
+---------+---------+------+]]></example>
<example type="shell"><![CDATA[prompt:~> pear upgrade DB
downloading DB-1.3.tgz ...
...done: 59,332 bytes
upgrade ok: DB 1.3]]></example>
<example type="shell"><![CDATA[prompt:~> pear install PHPUnit
downloading PHPUnit-0.3.tgz ...
...done: 7,284 bytes
install ok: PHPUnit 0.3]]></example>
</slide>

BIN
slides/state/pecl.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

15
slides/state/php50.xml Normal file
View File

@@ -0,0 +1,15 @@
<slide title="PHP 5.0">
<list title="Proposed Features (so far)" fontsize="4em">
<bullet>New Object Model</bullet>
<bullet>Private and Protected properties</bullet>
<bullet>Objects are referenced and not copied by default</bullet>
<bullet>New cloning mechanism to copy objects</bullet>
<bullet>Nested class support which gives us Namespaces</bullet>
<bullet>Class destructors</bullet>
<bullet>Try/Catch exception handling</bullet>
<bullet>Dereference object directly from a function call</bullet>
<bullet>Native large number support</bullet>
<bullet>Bundle curl library to be used by streams-based connection handling</bullet>
<bullet>Move many extensions to PEAR</bullet>
</list>
</slide>

View File

@@ -0,0 +1,17 @@
<slide title="Common Questions">
<blurb> </blurb>
<blurb> </blurb>
<image align="right" marginright="2em" filename="slides/state/bridle1.jpg" />
<list fontsize="4.5em">
<bullet slide="1">Who uses PHP?</bullet>
<bullet slide="1">Why not use Perl, Python or Java?</bullet>
<bullet slide="1">Why isn't PHP exactly like Perl?</bullet>
<bullet slide="1">Why isn't PHP exactly like Python?</bullet>
<bullet slide="1">Why isn't PHP exactly like Java?</bullet>
<bullet slide="1">Why isn't PHP exactly like C++?</bullet>
<bullet slide="1">Why isn't PHP exactly like LISP?</bullet>
<bullet slide="1">What is PHP's Vision?</bullet>
<bullet slide="1">PHP is too easy too use, make it more complex!</bullet>
<bullet slide="1">Is that an Apple laptop?</bullet>
</list>
</slide>