//img.uscri.be/pth/5a4bb9a18e2618a49884a7f9bee0e700ebd894d6

Ruby on Rails for PHP and Java Developers

-

Livres

Description

1 Ruby is an open source programming language that was released in 1995. th 2 Ruby is ranked 10 in the TIOBE Programming Community index . Ruby 3 on Rails is an open source web framework that was released in 2004. Ruby on Rails is being widely adopted because of its simplicity, 4 maintainability and development speed. Computerworld lists Ruby on Rails as the one of the top 5 technologies for 2007. Motivation for this Book Ruby is often compared with PHP, which is the most commonly used scripting language, and with Java, which is the most commonly used programming language. In the trends graph of TIOBE index you might notice that since the middle of 2006 Ruby shows an increase in usage 5 while PHP and Java show a decrease in usage. OReilly Radar has noted the trend towards an increased usage of Ruby on Rails. Statistics aside, Ruby on Rails has some advantages over PHP, which are discussed below. 1. Ruby on Rails is more object-oriented than PHP, thus providing all the inherent advantages of an object-oriented language such as simplicity, modularity, modifiability, extensibility, maintainability and re-usability. 2. Ruby on Rails is web framework whereas PHP is only a scripting language.

Sujets

Informations

Publié par
Ajouté le 20 juillet 2007
Nombre de lectures 0
EAN13 9783540731450
Licence : Tous droits réservés
Langue English
Signaler un abus
Contents
Preface ....................................................................................................... VMotivation for this Book ....................................................................... VWho Should Read this Book? ...............................................................VIOutline to the Book Structure ............................................................. VIIPrerequisite Skills .............................................................................. VIIIAcknowledgements ........................................................................... VIIIAbout the Author ............................................................................... VIII
Contents ................................................................................................... XI
1 Ruby ......................................................................................................... 11.1 Introduction ...................................................................................... 11.2 Installing Ruby ................................................................................. 11.3 Creating a Ruby Application ............................................................ 31.4 Identifiers and Comments................................................................. 51.5 Strings ............................................................................................... 61.6 Arrays Hashes and Ranges ............................................................... 81.7Variables Constants and Operators................................................ 111.8 Classes ............................................................................................ 161.9 Methods .......................................................................................... 181.10Procs and Blocks .......................................................................... 241.11 Control Structures and Iterators .................................................... 281.12 Exception Handling ...................................................................... 331.13 Modules ........................................................................................ 361.14 Comparing Ruby with PHP .......................................................... 361.15 Comparing Ruby with Java .......................................................... 371.16 Summary....................................................................................... 39
2 Rails Framework................................................................................... 412.1 Introduction .................................................................................... 412.2 Overview of Rails ........................................................................... 412.3 Active Record ................................................................................. 432.4 Action Controller ............................................................................ 47
XII Contents
2.5 Action View.................................................................................... 502.5.1 Sub-Templates ......................................................................... 522.6 Ruby on Rails Commands .............................................................. 522.7 Installing Rails ................................................................................ 532.8 Developing a Rails Application ...................................................... 542.9 Rails Routes .................................................................................... 562.10 Stylesheets .................................................................................... 572.11 Helpers.......................................................................................... 572.12 Layouts ......................................................................................... 582.13 Partials .......................................................................................... 602.14 Rails Framework Examples .......................................................... 612.15 Configuring Rails with the MySQL Database ............................. 672.16 Comparing Rails with PHP........................................................... 692.17 Comparing Rails with Java ........................................................... 692.18 Summary....................................................................................... 69
3 CRUD on Rails ...................................................................................... 713.1 Introduction .................................................................................... 713.2 Scaffolding...................................................................................... 713.3 CRUD with PHP............................................................................. 723.4 CRUD with Java ............................................................................. 743.5 Creating a Rails Application........................................................... 753.6 Creating a Database Table .............................................................. 763.7 Migrations....................................................................................... 773.8 Creating catalogs Table with Migrations........................................ 823.9 Configuring with Oracle Database ................................................. 843.10 Configuring with SQL Server 2005 Database .............................. 853.11 Developing a CRUD Application ................................................. 863.11.1 Creating Dynamic Scaffolding .............................................. 873.11.2 Creating Scaffolding with Scaffold Generator ...................... 883.12 Ajax Scaffolding ........................................................................... 953.13 Validations.................................................................................. 1003.14 Summary..................................................................................... 106
4 Ajax on Rails ....................................................................................... 1074.1 Introduction .................................................................................. 1074.2 Overview of Ajax ......................................................................... 1074.3 Overview of XMLHttpRequest .................................................... 1084.4 Creating an XMLHttpRequest Object .......................................... 1104.5 Opening an HTTP Request ........................................................... 1104.6 Sending an HTTP Request ........................................................... 1114.7 Processing an HTTP Response ..................................................... 111
Ruby on Rails for PHP and Java Developers XIII
4.8 Ajax with PHP .............................................................................. 1134.9 Ajax with Java .............................................................................. 1134.10 Support for Ajax in Rails ............................................................ 1144.10.1 link_to_remote..................................................................... 1164.10.2 form_remote_tag ................................................................. 1174.10.3 submit_to_remote ................................................................ 1174.10.4 observe_field ....................................................................... 1184.10.5 observe_form ....................................................................... 1194.10.6 periodically_call_remote ..................................................... 1194.10.7 update_element_function..................................................... 1194.10.8 update_page ......................................................................... 1204.11 Creating a Ruby on Rails Application ....................................... 120 4.12 Creating a Database Table .......................................................... 121 4.13 Sending a Request ...................................................................... 124 4.13.1 Sending a Request with form_remote_tag Method ............. 125 4.13.2 Sending a Request with observe_field Method ................... 127 4.14 Processing a Request .................................................................. 128 4.15 Processing the Response ............................................................. 135 4.16 Summary..................................................................................... 142
5 Creating PDF and Excel Reports ..................................................... 1435.1 Introduction .................................................................................. 1435.2 Creating a PDF with PHP ............................................................. 1445.3 Creating a PDF with Java ............................................................. 1445.4 Creating a PDF File with Ruby on Rails ...................................... 1455.5 Creating a Table in PDF .............................................................. 1495.6 Creating a Spreadsheet with PHP ................................................. 1555.7 Creating a Spreadsheet with Java ................................................. 1565.8 Creating an Excel Spreadsheet with Ruby on Rails ..................... 1575.9 Creating a Spreadsheet with Ruby Spreadsheet ........................... 1675.10 Summary..................................................................................... 172
6 XML On Rails ..................................................................................... 1736.1 Introduction .................................................................................. 1736.2 Processing XML with PHP 5........................................................ 1736.3 Processing XML with Java ........................................................... 1746.4 Installing XML Builder ................................................................ 1756.5 Creating an XML Document with Ruby on Rails ........................ 1766.6 Creating an XML Document from a Database ............................. 1806.7 Parsing an XML Document with REXML ................................... 1846.8 Summary....................................................................................... 189
XIV Contents
7 PHP On Rails ...................................................................................... 1917.1 Introduction .................................................................................. 1917.2 Installing PHP............................................................................... 191 7.3 Installing PHPOnTrax .................................................................. 192 7.4 Creating a Trax Application ......................................................... 193 7.5 Creating a CRUD Application...................................................... 1977.6 Summary....................................................................................... 207
8 LDAP On Rails ................................................................................... 2098.1 Introduction .................................................................................. 2098.2 Installing OpenLDAP ................................................................... 2108.3 Installing Tivoli Directory Server................................................. 216 8.4 Installing Oracle Internet Directory .............................................. 232 8.5 LDAP with PHP ........................................................................... 247 8.6 LDAP with Java............................................................................ 248 8.7 Installing NET::LDAP.................................................................. 250 8.8 Creating a Rails Application......................................................... 252 8.9 Creating a Directory Entry............................................................ 253 8.10 Modifying a Directory Entry ...................................................... 260 8.11 Searching a Directory ................................................................. 263 8.12 Deleting a Directory Entry.......................................................... 2678.13 Summary..................................................................................... 273
9 Web Services On Rails ....................................................................... 2759.1 Introduction .................................................................................. 2759.2 Web Services with PHP................................................................ 2759.3 Web Services with Java ................................................................ 2769.4 Creating a Web Service with Ruby on Rails ................................ 278 9.5 Web Service API Class................................................................. 284 9.6 Dispatching ................................................................................... 285 9.6.1 Direct Dispatching ................................................................. 285 9.6.2 Delegated Dispatching........................................................... 286 9.6.3 Layered Dispatching.............................................................. 290 9.7 Protocol Clients ............................................................................ 2909.8 Summary....................................................................................... 299
10 Ruby on Rails in Eclipse................................................................... 30110.1 Introduction ................................................................................ 30110.2 PHP in Eclipse ............................................................................ 30110.3 Installing RDT ............................................................................ 30210.4 Creating a Rails Project in RDT ................................................. 30310.5 Creating a Database Table with RDT ......................................... 309
Ruby on Rails for PHP and Java Developers XV
10.6 Creating a CRUD Application with RDT ................................... 31310.7 Installing RadRails ..................................................................... 31610.8 Creating a Rails Application with RadRails ............................... 31810.9 Creating a CRUD Application with RadRails ............................ 32010.10 Summary................................................................................... 323
11 Rails Testing and Fixtures ............................................................... 32511.1 Introduction ................................................................................ 32511.2 Unit Testing in PHP and Java ..................................................... 32511.3 Rails Example Test ..................................................................... 32611.4 Assertion Types .......................................................................... 33111.5 Rails Testing ............................................................................... 33511.6 Fixtures ....................................................................................... 33611.7 Unit Testing ................................................................................ 33711.8 Testing Controllers ..................................................................... 34211.9 Summary..................................................................................... 349
12 Rails in Production ........................................................................... 35112.1 Introduction ................................................................................ 35112.2 Setting the Production Mode ...................................................... 35112.3Rails Best Practices and Performance ........................................ 35212.4 Deployment on Apache2 and FastCGI ....................................... 35412.5 Rails Web Hosting ...................................................................... 36012.6 Summary..................................................................................... 387
Sources of Information .......................................................................... 389
Index........................................................................................................ 391
http://www.springer.com/978-3-540-73144-3