Gwt wouter
description
Transcript of Gwt wouter
PHP starter
•install•variable•function call•array•for-loop•sum•if
Wouter van der Ploeg, CMD, 2010
PHP starter
•http://www.php5.org/
•apache: http://httpd.apache.org/download.cgi#apache22•php: http://windows.php.net/download/•configuration:•http://www.thesitewizard.com/php/install-php-5-apache-windows.shtml•important: httpd.conf in /.../apache2.2/conf and php-files in /.../apache2.2/htdocs
•OR•http://www.wampserver.com/en/index.php•php-files in /.../wamp/www
Wouter van der Ploeg, CMD, 2010
PHP starter
every php program
<?php //start// body?> //end
Wouter van der Ploeg, CMD, 2010
PHP example 1<html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body> </html>
Output:
Wouter van der Ploeg, CMD, 2010
PHP example 2<?php echo '<p>Hello World</p>'; ?>
Output:
Wouter van der Ploeg, CMD, 2010
•put text example2 in a file "hello2.php"•put the file "hello2.php" in /../../htdocs•(or if wamp in /.../wamp/www)•address browser = localhost/hello2.php
PHP example 3<?php phpinfo(); ?>
Output:
Wouter van der Ploeg, CMD, 2010
PHP starter - function
<?phpphpinfo(); ?>
Wouter van der Ploeg, CMD, 2010
function call
PHP starter - variable
<?php$number = 2;
$text = 'voorbeeld';echo $text;
echo $number; ?>
Wouter van der Ploeg, CMD, 2010
variable value
show value of $text
Output ?
PHP starter - variable
<?php$num1 = 3;$num2 = 7;echo $num1+$num2;echo $num1*$num2; ?>
Wouter van der Ploeg, CMD, 2010
Output ?
PHP starter - variable
<?php$num1 = 3;$num2 = 7;echo 'the sum is: ';echo $num1+$num2;echo '<br />';echo 'the product is: ';echo $num1*$num2; ?>
Wouter van der Ploeg, CMD, 2010
Output ?
PHP starter - array
<?php$nums = array(1,2,3,4,5,6,7,8); print_r($nums); ?>
Wouter van der Ploeg, CMD, 2010
Output ?
PHP starter - array
Wouter van der Ploeg, CMD, 2010
Output:Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 )
valueindex
PHP starter - for-loop
Wouter van der Ploeg, CMD, 2010
Output ?
for-loop
block
for ($tel = 1; $tel <=10; $tel++)
{ echo $tel*$tel, ' ';
}
start end count
PHP starter - for-loop - sum
Wouter van der Ploeg, CMD, 2010
Output ?
$sum =0;
for ($tel = 1; $tel <=10; $tel++) { $sum = $sum + $tel; } echo 'total sum =',$sum;
PHP starter - for-loop & array
Wouter van der Ploeg, CMD, 2010
Output ?
$nameArray = array('jan', 'kees', 'pieter', 'klaas', 'gerben');
for ($tel = 0; $tel <=4; $tel++){ echo $nameArray[$tel];
}
PHP starter - if
Wouter van der Ploeg, CMD, 2010Output ?
<?php$number = 4;if ($number > 3) { echo $number, 'is larger then 3'; } ?>
PHP starter - if
Wouter van der Ploeg, CMD, 2010Output ?
<?php$number = 4;if ($number > 3) { echo $number, 'is larger then 3'; } elseif ($number < 3) { echo $number, ' is smaller then 3'; } else { echo $number, ' is equal to 3'; }
?>
PHP starter - for-loop - if
Wouter van der Ploeg, CMD, 2010
Output ?
for ($tel = 1; $tel <=10; $tel++)
{ if ($tel % 2 == 0) { echo $tel*$tel, ' '; }
}
PHP starter - for-loop - if
Wouter van der Ploeg, CMD, 2010Output ?
function even($num) { if ($num % 2 == 0) return true; else return false; }
for ($tel = 1; $tel <=10; $tel++){ if (even($tel)) { echo $tel*$tel, ' '; }
}
PHP starter - if
Wouter van der Ploeg, CMD, 2010Output ?
$nameArray = array('jan', 'kees', 'pieter', 'klaas', 'gerben');
for ($tel = 0; $tel <=4; $tel++){ $naam = $nameArray[$tel]; if (substr($naam, 0, 1) == 'k') { echo $nameArray[$tel]; };
}
PHP starter - assignments
Wouter van der Ploeg, CMD, 2010
$nameArray = array('jan', 'kees', 'pieter', 'klaas', 'gerben');
1.write 3rd-powers of numbers from 1-992.show squares of even numbers (1-99)3.show name if name is shorter then 5 char's4.give list of names and their length. (look for function length of string)5.give all the names in capitals6.count names shorter then 5 char's
GWTGoogle Web Toolkit
how to program for all browsers
Wouter van der Ploeg, CMD, 2010
• GWT
JDK (java)
Apache
Ant
GWT
SDK
Wouter van der Ploeg, CMD, 2010
• Pyjamas
(port
of
GWT)
Python (>=2.4)
pyjamas
Wouter van der Ploeg, CMD, 2010
• RubyJS
(port
of
GWT)
Ruby
rubyjs
Wouter van der Ploeg, CMD, 2010
GWTinstallation
Wouter van der Ploeg, CMD, 2010
•http://code.google.com/webtoolkit/gettingstarted.html•download & unpack gwt-2.0.3.zip (SDK)•download & install (if needed) JDK >= 1.5 •download & unpack Ant 1.8.1
• http://ant.apache.org/bindownload.cgi•Add the bin directory to your path (e.g. add to path ;D:\GWT\apache-ant-1.8.1\bin )•Set the ANT_HOME environment variable (e.g. ANT_HOME = D:\GWT\apache-ant-1.8.1 )•try in shell D:\ ant•if the answer is: Buildfile: build.xml does not exist!•Build failed•All is OK, ant is installed
•test GWT go to•http://code.google.com/intl/nl-NL/webtoolkit/gettingstarted.html