Difference between revisions of "Workbook"
Line 1: | Line 1: | ||
[[XML and Web Services]] >> Workbook | [[XML and Web Services]] >> Workbook | ||
+ | |||
+ | ==Ruby install on a USB stick== | ||
+ | |||
+ | 1. Download the One-click ruby installer from rubyforge http://rubyforge.org/frs/?group_id=167 (warning this is a big file!). The one I used was ruby186-25.exe but there may be a later version available. To be able to run the whole environment from a USB stick I’d really recommend you have about 500MB free (maybe it’s time to buy a new stick?) | ||
+ | 2. Double-click on the installer, after clicking next a few times, a screen like the one shown below is displayed. | ||
+ | |||
+ | |||
+ | 3. Ensure you install on your USB stick, not the C drive (check the drive letter, as shown. Mine is J:, yours may vary) | ||
+ | 4. Once Ruby is installed, open a cmd prompt (enter cmd into the ‘run’ box from the start menu) change to your ruby directory (e.g. j:\ruby ) and enter the follow command: | ||
+ | 5. gem install rails -y | ||
+ | 6. You may need to add the ruby directory to your system path, the setenv.bat file discussed in class will do this – the command is: | ||
+ | 7. set path=%PATH%;j:\ruby\bin; | ||
+ | Remember to change the drive letter (j: in the example above) to match the letter assigned to your USB stick. This will probably be different for each system – it’s a windows foible – what a wonderful system (maybe you should try Linux? – ok Rant over.) This is why we suggested in the lecture that you put the command above in its own file, which we called setenv.bat, so that it’s easy to change. | ||
+ | 8. The gem command should install rails, see below for a database. | ||
+ | |||
+ | ===Exercises=== | ||
+ | Create one (or more) programs using ruby that can perform the following tasks: | ||
+ | a) Create a program that can take a phrase as input and print it out in reverse. | ||
+ | b) Create a program that can take a phrase as input and output it’s length as a number | ||
+ | c) Create an application that can encrypt any phrase you enter using the rot13 algorithm | ||
+ | d) Create an application that can take a temperature in F or C and convert to the other form |
Revision as of 17:00, 6 February 2008
XML and Web Services >> Workbook
Ruby install on a USB stick
1. Download the One-click ruby installer from rubyforge http://rubyforge.org/frs/?group_id=167 (warning this is a big file!). The one I used was ruby186-25.exe but there may be a later version available. To be able to run the whole environment from a USB stick I’d really recommend you have about 500MB free (maybe it’s time to buy a new stick?) 2. Double-click on the installer, after clicking next a few times, a screen like the one shown below is displayed.
3. Ensure you install on your USB stick, not the C drive (check the drive letter, as shown. Mine is J:, yours may vary)
4. Once Ruby is installed, open a cmd prompt (enter cmd into the ‘run’ box from the start menu) change to your ruby directory (e.g. j:\ruby ) and enter the follow command:
5. gem install rails -y
6. You may need to add the ruby directory to your system path, the setenv.bat file discussed in class will do this – the command is:
7. set path=%PATH%;j:\ruby\bin;
Remember to change the drive letter (j: in the example above) to match the letter assigned to your USB stick. This will probably be different for each system – it’s a windows foible – what a wonderful system (maybe you should try Linux? – ok Rant over.) This is why we suggested in the lecture that you put the command above in its own file, which we called setenv.bat, so that it’s easy to change.
8. The gem command should install rails, see below for a database.
Exercises
Create one (or more) programs using ruby that can perform the following tasks: a) Create a program that can take a phrase as input and print it out in reverse. b) Create a program that can take a phrase as input and output it’s length as a number c) Create an application that can encrypt any phrase you enter using the rot13 algorithm d) Create an application that can take a temperature in F or C and convert to the other form