Gwt_Wouter1

344 views

Published on

first slides for CMD programming 9-2010

Published in: Education
  • Be the first to comment

  • Be the first to like this

Gwt_Wouter1

  1. 1. PHP starter <ul><ul><li>install </li></ul></ul><ul><ul><li>variable </li></ul></ul><ul><ul><li>function call </li></ul></ul><ul><ul><li>array </li></ul></ul><ul><ul><li>for-loop </li></ul></ul><ul><ul><li>sum </li></ul></ul><ul><ul><li>if </li></ul></ul>Wouter van der Ploeg, CMD, 2010
  2. 2. PHP starter <ul><ul><li>http://www.php5.org/ </li></ul></ul><ul><ul><li>apache: http://httpd.apache.org/download.cgi#apache22 </li></ul></ul><ul><ul><li>php: http://windows.php.net/download/ </li></ul></ul><ul><ul><li>configuration: </li></ul></ul><ul><ul><li>http://www.thesitewizard.com/php/install-php-5-apache-windows.shtml </li></ul></ul><ul><ul><li>important: httpd.conf in /.../apache2.2/conf and php-files in /.../apache2.2/htdocs </li></ul></ul><ul><ul><li>OR </li></ul></ul><ul><ul><li>http://www.wampserver.com/en/index.php </li></ul></ul><ul><ul><li>php-files in /.../wamp/www </li></ul></ul>Wouter van der Ploeg, CMD, 2010
  3. 3. PHP starter every php program <?php //start // body ?> //end Wouter van der Ploeg, CMD, 2010
  4. 4. 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
  5. 5. PHP example 2 <?php echo '<p>Hello World</p>'; ?> Output: Wouter van der Ploeg, CMD, 2010 <ul><ul><li>put text example2 in a file &quot;hello2.php&quot; </li></ul></ul><ul><ul><li>put the file &quot;hello2.php&quot; in /../../htdocs </li></ul></ul><ul><ul><li>(or if wamp in /.../wamp/www) </li></ul></ul><ul><ul><li>address browser = localhost/hello2.php </li></ul></ul>
  6. 6. PHP example 3 <?php phpinfo(); ?> Output: Wouter van der Ploeg, CMD, 2010
  7. 7. PHP starter - function <?php phpinfo(); ?> Wouter van der Ploeg, CMD, 2010 function call
  8. 8. 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 ?
  9. 9. PHP starter - variable <?php $num1 = 3; $num2 = 7; echo $num1+$num2; echo $num1*$num2; ?> Wouter van der Ploeg, CMD, 2010 Output ?
  10. 10. 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 ?
  11. 11. PHP starter - array <?php $nums = array(1,2,3,4,5,6,7,8); print_r($nums); ?> Wouter van der Ploeg, CMD, 2010 Output ?
  12. 12. 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 ) value index
  13. 13. 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
  14. 14. 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;
  15. 15. 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]; }
  16. 16. PHP starter - if Wouter van der Ploeg, CMD, 2010 Output ? <?php $number = 4; if ($number > 3) { echo $number, 'is larger then 3'; } ?>
  17. 17. PHP starter - if Wouter van der Ploeg, CMD, 2010 Output ? <?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'; } ?>
  18. 18. 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, ' '; } }
  19. 19. PHP starter - for-loop - if Wouter van der Ploeg, CMD, 2010 Output ? function even($num) { if ($num % 2 == 0) return true; else return false; } for ($tel = 1; $tel <=10; $tel++) { if (even($tel)) { echo $tel*$tel, ' '; } }
  20. 20. PHP starter - if Wouter van der Ploeg, CMD, 2010 Output ? $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]; }; }
  21. 21. PHP starter - assignments Wouter van der Ploeg, CMD, 2010 <ul><li>$nameArray = array('jan', 'kees', 'pieter', 'klaas', 'gerben'); </li></ul><ul><ul><li>write 3rd-powers of numbers from 1-99 </li></ul></ul><ul><ul><li>show squares of even numbers (1-99) </li></ul></ul><ul><ul><li>show name if name is shorter then 5 char's </li></ul></ul><ul><ul><li>give list of names and their length. (look for function length of string) </li></ul></ul><ul><ul><li>give all the names in capitals </li></ul></ul><ul><ul><li>count names shorter then 5 char's </li></ul></ul>
  22. 22. GWT Google Web Toolkit how to program for all browsers Wouter van der Ploeg, CMD, 2010
  23. 23. <ul><li>GWT JDK (java) Apache Ant GWT SDK </li></ul>Wouter van der Ploeg, CMD, 2010
  24. 24. <ul><li>Pyjamas (port of GWT) Python (>=2.4) pyjamas </li></ul>Wouter van der Ploeg, CMD, 2010
  25. 25. <ul><li>RubyJS (port of GWT) Ruby rubyjs </li></ul>Wouter van der Ploeg, CMD, 2010
  26. 26. GWT installation Wouter van der Ploeg, CMD, 2010 <ul><ul><ul><li>http://code.google.com/webtoolkit/gettingstarted.html </li></ul></ul></ul><ul><ul><ul><li>download & unpack gwt-2.0.3.zip (SDK) </li></ul></ul></ul><ul><ul><ul><li>download & install (if needed) JDK >= 1.5 </li></ul></ul></ul><ul><ul><ul><li>download & unpack Ant 1.8.1 </li></ul></ul></ul><ul><ul><ul><ul><li>http://ant.apache.org/bindownload.cgi </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Add the bin directory to your path (e.g. add to path ;D:GWTapache-ant-1.8.1in ) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Set the ANT_HOME environment variable (e.g. ANT_HOME = D:GWTapache-ant-1.8.1 ) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>try in shell D: ant </li></ul></ul></ul></ul><ul><ul><ul><ul><li>if the answer is: Buildfile: build.xml does not exist! </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Build failed </li></ul></ul></ul></ul><ul><ul><ul><ul><li>All is OK, ant is installed </li></ul></ul></ul></ul><ul><ul><ul><li>test GWT go to </li></ul></ul></ul><ul><ul><ul><li>http://code.google.com/intl/nl-NL/webtoolkit/gettingstarted.html </li></ul></ul></ul>

×