• Like
Gwt wouter
Upcoming SlideShare
Loading in...5
×
Uploaded on

first slides of CMD programming

first slides of CMD programming

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
532
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. PHP starter
      • install
      • variable
      • function call
      • array
      • for-loop
      • sum
      • if
    Wouter van der Ploeg, CMD, 2010
  • 2. 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
  • 3. PHP starter every php program <?php //start // body ?> //end Wouter van der Ploeg, CMD, 2010
  • 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. PHP example 2 <?php echo '<p>Hello World</p>'; ?> Output: Wouter van der Ploeg, CMD, 2010
      • put text example2 in a file &quot;hello2.php&quot;
      • put the file &quot;hello2.php&quot; in /../../htdocs
      • (or if wamp in /.../wamp/www)
      • address browser = localhost/hello2.php
  • 6. PHP example 3 <?php phpinfo(); ?> Output: Wouter van der Ploeg, CMD, 2010
  • 7. PHP starter - function <?php phpinfo(); ?> Wouter van der Ploeg, CMD, 2010 function call
  • 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. PHP starter - variable <?php $num1 = 3; $num2 = 7; echo $num1+$num2; echo $num1*$num2; ?> Wouter van der Ploeg, CMD, 2010 Output ?
  • 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. 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. 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. 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. 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. 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. PHP starter - if Wouter van der Ploeg, CMD, 2010 Output ? <?php $number = 4; if ($number > 3) { echo $number, 'is larger then 3'; } ?>
  • 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. 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. 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. 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. PHP starter - assignments Wouter van der Ploeg, CMD, 2010
    • $nameArray = array('jan', 'kees', 'pieter', 'klaas', 'gerben');
      • write 3rd-powers of numbers from 1-99
      • show squares of even numbers (1-99)
      • show name if name is shorter then 5 char's
      • give list of names and their length. (look for function length of string)
      • give all the names in capitals
      • count names shorter then 5 char's
  • 22. GWT Google Web Toolkit how to program for all browsers Wouter van der Ploeg, CMD, 2010
  • 23.
    • GWT JDK (java) Apache Ant GWT SDK
    Wouter van der Ploeg, CMD, 2010
  • 24.
    • Pyjamas (port of GWT) Python (>=2.4) pyjamas
    Wouter van der Ploeg, CMD, 2010
  • 25.
    • RubyJS (port of GWT) Ruby rubyjs
    Wouter van der Ploeg, CMD, 2010
  • 26. GWT installation 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:GWTapache-ant-1.8.1in )
          • Set the ANT_HOME environment variable (e.g. ANT_HOME = D:GWTapache-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