- My PHP Inside talk for ConFoo

This commit is contained in:
Derick Rethans
2011-03-07 21:55:37 +00:00
parent 8a1f104975
commit 32625ff3c4
19 changed files with 281 additions and 1 deletions

93
phpinside-confoo11.xml Normal file
View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<presentation
template="css"
navmode="html"
navbarbackground="#4373b4"
navbartopiclinks="0"
navColor="#f1fbff"
logo1=""
stylesheet="presentations/slides/ezc/ez.css"
backgroundfixed="1" >
<topic>PHP-GTK</topic>
<title>PHP Inside</title>
<event>ConFoo</event>
<location>Montréal, Canada</location>
<date>March 10th, 2011</date>
<speaker>Derick Rethans</speaker>
<email>derick@php.net</email>
<url>http://derickrethans.nl/talks.html</url>
<joindin>http://joind.in/2823</joindin>
<twitter>derickr</twitter>
<slide>slides/dbus/title.xml</slide>
<slide>slides/toolbox/me.xml</slide>
<slide>slides/inside/phone.xml</slide>
<slide>slides/inside/mad.xml</slide>
<slide>slides/inside/twitter.xml</slide>
<slide>slides/inside/gtk.xml</slide>
<slide>slides/inside/compile.xml</slide>
<slide>slides/inside/storage.xml</slide>
<slide>slides/inside/twitter-experience.xml</slide>
<slide>slides/inside/twitter-result.xml</slide>
<!-- INTRODUCTION -->
<!--
Photo of phone
Am I mad?
First thing: twitter
So I needed a gui thing
GTK
compiling PHP and GTK
sqlite - slower,indexes are *vital* — say something about keeping track what you've downloaded
twitter API is rather... unstable
- you don't have to mock for failures
- expect to request the same data more often
- very convoluted JSON returns
GUI finger design
5.2 vs 5.3 with GC
-->
<slide>slides/inside/tube1.xml</slide>
<slide>slides/inside/tube2.xml</slide>
<slide>slides/inside/tube3-scraping.xml</slide>
<slide>slides/inside/tube4-json-api.xml</slide>
<slide>slides/inside/tube5-demo.xml</slide>
<!--
tube status app
needs scraping
really large files
designed a caching API as a webservice
- app pulls 1k from that API
If website structure changes, just adjust the service — all installed apps will continue working
-->
<slide>slides/inside/talking-to-hardware.xml</slide>
<!--<slide>slides/dbus/what-is-dbus.xml</slide>
<slide>slides/dbus/design-overview.xml</slide>
<slide>slides/dbus/identifying-objects.xml</slide>-->
<!-- PHP -->
<slide>slides/dbus/php-dbus-ext.xml</slide>
<slide>slides/dbus/php-as-client.xml</slide>
<slide>slides/inside/kindle.xml</slide>
<slide>slides/inside/kindle-warning.xml</slide>
<slide>slides/inside/kindle-hacking.xml</slide>
<slide>slides/inside/php-on-kindle.xml</slide>
<slide>slides/inside/php-on-kindle-cross.xml</slide>
<slide>slides/inside/kindle-hard-software.xml</slide>
<slide>slides/inside/kindle-screen.xml</slide>
<slide>slides/inside/kindle-download-file.xml</slide>
<slide>slides/inside/kindle-left.xml</slide>
<slide>slides/inside/conclusion.xml</slide>
<slide>slides/dbus/end.xml</slide>
<!--
SMS, phone, addressbook sucked
in order to talk to hardware -> dbus
adding GPS to twitter client
-->
</presentation>

BIN
slides/inside/caution.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
slides/inside/caution2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -6,6 +6,7 @@
<bullet>Bandwidth is a real issue</bullet>
<bullet>Lack of APIs</bullet>
<bullet>PHP *can* run on them, but whether it's smart is to be seen</bullet>
<bullet>Issues with proprietary systems</bullet>
<bullet>Next experiment: PHP on Android/WebOS/Meego?</bullet>
</list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

View File

@@ -0,0 +1,52 @@
<slide>
<title>Kindle Hacking</title>
<subtitle>Downloading files from PHP</subtitle>
<image align="center" filename="caution2.jpg"/>
<div effect="fade-out">
<list>
<bullet>You need to use Amazon's proxy</bullet>
<bullet>Each request with the proxy needs to be authenticated, otherwise:
<example>HTTP/1.1 403 Forbidden+for+Client%3A+amz%5F2020
Date: Thu, 03 Mar 2011 20:54:10 GMT
Content-Type: text/html
Transfer-Encoding: chunked
x-kn-retry: 300
a0
There is a problem with your Kindle account. Please call Customer Service at 1-866-321-8851 or 1-206-266-0927. For UK customers, please call +44(0)800 496 2449.
0</example>
</bullet>
</list>
</div>
<div effect="fade-in">
<example><![CDATA[<?php
$url = "tcp://87.238.83.84:80";
$fp = stream_socket_client($url, $errno, $errstr, 1);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, <<<ENDREQ
GET http://derickrethans.nl/ws/tubestatus.ws.php HTTP/1.1\r
Host: derickrethans.nl\r
User-Agent: Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600x800; rotate)\r
Referer: http://mobile.twitter.com/\r
Cache-Control: max-age=0\r
Accept-Encoding: gzip\r
Accept-Language: en-US\r
x-fsn: R0pdR...personal-key...qpxX1J\r
x-kn-appId: BBookletV3\r
\r
\r
ENDREQ
);
while (!feof($fp)) {
echo fgets($fp, 1024);
}
fclose($fp);
}?>]]>
</example>
</div>
</slide>

View File

@@ -0,0 +1,15 @@
<slide>
<title>Kindle Hacking</title>
<image align="center" filename="caution2.jpg"/>
<break lines="2"/>
<blurb>In order to get shell, you have to do the following:</blurb>
<list>
<bullet>Install a jailbreak</bullet>
<bullet>Install USB networking</bullet>
<bullet>Install Launchpad</bullet>
<bullet>http://www.mobileread.com/forums/showthread.php?t=88004</bullet>
</list>
<break lines="2"/>
<image align="center" filename="ssh-kindle.jpg"/>
</slide>

View File

@@ -0,0 +1,19 @@
<slide>
<title>Kindle Hacking</title>
<blurb>The Kindle:</blurb>
<list>
<bullet>Runs Linux</bullet>
<bullet>Does not run X, but a framebuffer</bullet>
<bullet>Has WiFi (and 3G), but requires a proxy to work</bullet>
</list>
<break/>
<blurb>Getting GTK to run on framebuffer is a pain, and so far I have
not managed to get PHP-GTK running on it.</blurb>
<div effect="fade-in">
<break lines="2"/>
<image filename="sad-cat.jpg" attr="http://www.flickr.com/photos/emptysound/3768519920"/>
</div>
</slide>

View File

@@ -0,0 +1,11 @@
<slide>
<title>Kindle Hacking</title>
<blurb>What is left?</blurb>
<list>
<bullet>A PHP extension to talk to the screen</bullet>
<bullet>Figure out how to stop the Kindle's main application from running when our own app is going</bullet>
<bullet>How to write an interface, and or interface with the keyboard just like the Kindle does</bullet>
</list>
</slide>

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@@ -0,0 +1,27 @@
<slide>
<title>Kindle Hacking</title>
<subtitle>Accessing the screen</subtitle>
<div effect="fade-out">
<list>
<bullet>Open framebuffer %/dev/fb0%</bullet>
<bullet>mmap the open file</bullet>
<bullet>Screen data is stored with every two pixels stored in one byte, in total 800 rows, with 300 bytes per row (600 pixels)</bullet>
</list>
<example>
(40 more)
66 55 55 65 66 54 45 68 CF FF (290 more)
77 77 66 78 77 65 65 55 7B FF (290 more)
(858 more)
7B = 0111 1011
`--´ `--´
| `---- 2nd nibble: 11/15
`----------1st nibble: 7/15
</example>
</div>
<div effect="fade-in">
<image filename="kindle-read-screen.jpg"/>
</div>
</slide>

View File

@@ -0,0 +1,7 @@
<slide>
<title>Kindle Hacking</title>
<break/>
<image align="center" attr="" filename="caution.jpg"/>
<break/>
<blurb align="center">Playing around with your Kindle can make Amazon angry</blurb>
</slide>

BIN
slides/inside/kindle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

5
slides/inside/kindle.xml Normal file
View File

@@ -0,0 +1,5 @@
<slide>
<title>Kindle</title>
<image filename="kindle.png"/>
</slide>

View File

@@ -3,6 +3,6 @@
<title>PHP Inside</title>
<break lines="2"/>
<image filename="freerunner.jpg" align="center" pdf-scale="0.8"/>
<image filename="freerunner.png" align="center" pdf-scale="0.8"/>
</slide>

View File

@@ -0,0 +1,26 @@
<slide>
<title>Kindle Hacking</title>
<subtitle>Cross-compiling</subtitle>
<list>
<bullet>Install the cross compilers from Emdebian:
<example>echo "deb http://www.emdebian.org/debian/ testing main" >> /etc/apt/sources.list
apt-get update
apt-get install gcc-4.3-arm-linux-gnueabi</example>
</bullet>
<bullet>Configure "like normal":
<example>CC='arm-linux-gnueabi-gcc' \
'/home/derick/dev/php/php-src/branches/PHP_5_3/configure' \
'--disable-all' \
'--prefix=/home/derick/install/kindle/cross/target' \
'--enable-sockets' \
'--enable-pcntl' \
'--with-pcre-regex'</example>
</bullet>
<bullet>make</bullet>
<bullet>Edit the last line, remove everything until %arm-linux-gnueabi-gcc%</bullet>
<bullet>Add %-static% after %-fvisibility=hidden%</bullet>
<bullet>Replace every %.lo% with %.o%</bullet>
<bullet>Run %arm-linux-gnueabi-gcc -export-dynamic -g -O2 -fvisibility=hidden -static ext/date/php_date.o% .... %-lcrypt -o sapi/cli/php%</bullet>
</list>
</slide>

View File

@@ -0,0 +1,24 @@
<slide>
<title>Kindle Hacking</title>
<subtitle>Getting PHP on the Kindle</subtitle>
<image align="center" filename="caution2.jpg"/>
<break lines="2"/>
<list>
<bullet>Install the cross compilers from Emdebian:
<example>echo "deb http://www.emdebian.org/debian/ testing main" >> /etc/apt/sources.list
apt-get update
apt-get install gcc-4.3-arm-linux-gnueabi</example>
</bullet>
<bullet>Cross compile PHP</bullet>
<bullet>Copy it over and run:
<example>scp sapi/cli/php root@kindle:/tmp
ssh root@kindle
/tmp/php -v</example>
<example>[root@kindle root]# /tmp/php -v
PHP 5.3.6-dev (cli) (built: Mar 7 2011 13:42:56)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies</example>
</bullet>
</list>
</slide>

BIN
slides/inside/sad-cat.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB