Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add ruby sample code

  • Loading branch information...
commit b5a143781705c6f201de2ac946c69a30932748c4 1 parent 5343023
Karmen Blake authored
Showing with 12,138 additions and 0 deletions.
  1. BIN  beginning_ruby/.DS_Store
  2. BIN  beginning_ruby/Fall_2006/.DS_Store
  3. +20 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo.sln
  4. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo.suo
  5. +187 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Form1.Designer.cs
  6. +87 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Form1.cs
  7. +120 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Form1.resx
  8. +20 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Program.cs
  9. +33 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/AssemblyInfo.cs
  10. +71 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Resources.Designer.cs
  11. +117 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Resources.resx
  12. +30 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Settings.Designer.cs
  13. +7 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Settings.settings
  14. +78 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/VS_CsharpDemo.csproj
  15. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/bin/Debug/VS_CsharpDemo.exe
  16. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/bin/Debug/VS_CsharpDemo.pdb
  17. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/bin/Debug/VS_CsharpDemo.vshost.exe
  18. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.Form1.resources
  19. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.Properties.Resources.resources
  20. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.csproj.GenerateResource.Cache
  21. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.exe
  22. BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.pdb
  23. +8 −0 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/VS_CsharpDemo.csproj.FileList.txt
  24. BIN  beginning_ruby/Fall_2006/array_and_hash assignment/CIS 282 - Arrays and Hashes Assignment.doc
  25. +36 −0 beginning_ruby/Fall_2006/array_and_hash assignment/blake_weather.rb
  26. +32 −0 beginning_ruby/Fall_2006/array_and_hash assignment/blake_weather_v2.rb
  27. +17 −0 beginning_ruby/Fall_2006/array_and_hash assignment/last_name_weather.rb
  28. +16 −0 beginning_ruby/Fall_2006/array_and_hash assignment/weather_forcast.xml
  29. BIN  beginning_ruby/Fall_2006/array_and_hash assignment/xml-simple-1.0.9.gem
  30. +14 −0 beginning_ruby/Fall_2006/array_in_class_assignment_SOLUTION.rb
  31. +13 −0 beginning_ruby/Fall_2006/blake_histogram.rb
  32. +4 −0 beginning_ruby/Fall_2006/blake_library.rb
  33. +18 −0 beginning_ruby/Fall_2006/bmi_blake.rb
  34. +77 −0 beginning_ruby/Fall_2006/cheerleader_library.rb
  35. +48 −0 beginning_ruby/Fall_2006/cheerleader_roster.rb
  36. +41 −0 beginning_ruby/Fall_2006/cheerleader_roster_on_hash.rb
  37. +121 −0 beginning_ruby/Fall_2006/class_demo.rb
  38. +61 −0 beginning_ruby/Fall_2006/class_design.rb
  39. +58 −0 beginning_ruby/Fall_2006/default_values_AND_named_parameters.rb
  40. +77 −0 beginning_ruby/Fall_2006/dog_program.rb
  41. +3 −0  beginning_ruby/Fall_2006/dogs.txt
  42. +28 −0 beginning_ruby/Fall_2006/file_demo.rb
  43. +62 −0 beginning_ruby/Fall_2006/files_r_us.rb
  44. +72 −0 beginning_ruby/Fall_2006/flow_control.rb
  45. +118 −0 beginning_ruby/Fall_2006/flow_control_demo.rb
  46. +119 −0 beginning_ruby/Fall_2006/hash_browns.rb
  47. +25 −0 beginning_ruby/Fall_2006/highline_demo.rb
  48. +12 −0 beginning_ruby/Fall_2006/intro_to_arrays.rb
  49. +26 −0 beginning_ruby/Fall_2006/language demos/GroovyDemo.groovy
  50. +25 −0 beginning_ruby/Fall_2006/language demos/JavaDemo.java
  51. +34 −0 beginning_ruby/Fall_2006/language demos/Main.cs
  52. +32 −0 beginning_ruby/Fall_2006/language demos/Main.vb
  53. +20 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp.sln
  54. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp.suo
  55. +211 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Form1.Designer.cs
  56. +66 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Form1.cs
  57. +120 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Form1.resx
  58. +20 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Program.cs
  59. +33 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Properties/AssemblyInfo.cs
  60. +71 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Properties/Resources.Designer.cs
  61. +117 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Properties/Resources.resx
  62. +30 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Properties/Settings.Designer.cs
  63. +7 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/Properties/Settings.settings
  64. +78 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/SumApp.csproj
  65. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/bin/Debug/SumApp.exe
  66. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/bin/Debug/SumApp.pdb
  67. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/bin/Debug/SumApp.vshost.exe
  68. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/obj/Debug/SumApp.Form1.resources
  69. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/obj/Debug/SumApp.Properties.Resources.resources
  70. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/obj/Debug/SumApp.csproj.GenerateResource.Cache
  71. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/obj/Debug/SumApp.exe
  72. BIN  beginning_ruby/Fall_2006/language demos/SumApp/SumApp/obj/Debug/SumApp.pdb
  73. +8 −0 beginning_ruby/Fall_2006/language demos/SumApp/SumApp/obj/SumApp.csproj.FileList.txt
  74. BIN  beginning_ruby/Fall_2006/language demos/c_sharpDemo.exe
  75. +20 −0 beginning_ruby/Fall_2006/language demos/javascript_demo.html
  76. +11 −0 beginning_ruby/Fall_2006/language demos/method_demo.py
  77. +18 −0 beginning_ruby/Fall_2006/language demos/method_demo.rb
  78. +20 −0 beginning_ruby/Fall_2006/language demos/php_demo.php
  79. +213 −0 beginning_ruby/Fall_2006/methods_demo.rb
  80. +47 −0 beginning_ruby/Fall_2006/my_menus.rb
  81. +15 −0 beginning_ruby/Fall_2006/named_parameteres.rb
  82. +70 −0 beginning_ruby/Fall_2006/pop_library.rb
  83. +50 −0 beginning_ruby/Fall_2006/pop_program.rb
  84. +89 −0 beginning_ruby/Fall_2006/repetition_demo.rb
  85. +1 −0  beginning_ruby/Fall_2006/sean_use_library.rb
  86. +7 −0 beginning_ruby/Fall_2006/string_methods.rb
  87. +72 −0 beginning_ruby/Fall_2006/syracuse_blake.rb
  88. +10 −0 beginning_ruby/Fall_2006/use_library.rb
  89. +4 −0 beginning_ruby/Fall_2006/use_library_v2.rb
  90. +69 −0 beginning_ruby/Fall_2006/using_objects_in_arrays.rb
  91. +130 −0 beginning_ruby/Fall_2006/wacky_fun_with_arrays.rb
  92. +1 −0  beginning_ruby/Fall_2006/warehouse.html
  93. BIN  beginning_ruby/Fall_2007/.DS_Store
  94. +43 −0 beginning_ruby/Fall_2007/array_filtering.rb
  95. +82 −0 beginning_ruby/Fall_2007/array_inclass_assignment.rb
  96. +99 −0 beginning_ruby/Fall_2007/arrays.rb
  97. +72 −0 beginning_ruby/Fall_2007/arrays_manage_names.rb
  98. +83 −0 beginning_ruby/Fall_2007/class_library.rb
  99. +44 −0 beginning_ruby/Fall_2007/classes101.rb
  100. +82 −0 beginning_ruby/Fall_2007/classes_math_fun.rb
  101. +99 −0 beginning_ruby/Fall_2007/classes_opening.rb
  102. +45 −0 beginning_ruby/Fall_2007/conditional_expressions.rb
  103. +53 −0 beginning_ruby/Fall_2007/file_utilities.rb
  104. +48 −0 beginning_ruby/Fall_2007/files_beginning.rb
  105. BIN  beginning_ruby/Fall_2007/hash_assignment/CIS 282 - Hash Assignment.doc
  106. +9 −0 beginning_ruby/Fall_2007/hash_assignment/grades.xml
  107. +16 −0 beginning_ruby/Fall_2007/hash_assignment/lastname_grades.rb
  108. BIN  beginning_ruby/Fall_2007/hash_assignment/xml-simple-1.0.9.gem
  109. +74 −0 beginning_ruby/Fall_2007/hash_demo.rb
  110. +15 −0 beginning_ruby/Fall_2007/hash_filtering.rb
  111. +15 −0 beginning_ruby/Fall_2007/hash_merge.rb
  112. +35 −0 beginning_ruby/Fall_2007/hello.rb
  113. +65 −0 beginning_ruby/Fall_2007/highline_demo.rb
  114. +46 −0 beginning_ruby/Fall_2007/highline_menus.rb
  115. +179 −0 beginning_ruby/Fall_2007/methods_arguments_flexible_fluff.rb
  116. +56 −0 beginning_ruby/Fall_2007/methods_beginning.rb
  117. +37 −0 beginning_ruby/Fall_2007/methods_multiple_returns.rb
  118. +42 −0 beginning_ruby/Fall_2007/methods_return_value.rb
  119. +91 −0 beginning_ruby/Fall_2007/name_library.rb
  120. +5 −0 beginning_ruby/Fall_2007/names.txt
  121. +32 −0 beginning_ruby/Fall_2007/names_app.rb
  122. +1 −0  beginning_ruby/Fall_2007/numbers.txt
  123. +4 −0 beginning_ruby/Fall_2007/out_file.txt
  124. +4 −0 beginning_ruby/Fall_2007/products.txt
  125. +12 −0 beginning_ruby/Fall_2007/products_managment.rb
  126. +35 −0 beginning_ruby/Fall_2007/ruby_basics.rb
  127. +14 −0 beginning_ruby/Fall_2007/rubyize.rb
  128. +18 −0 beginning_ruby/Fall_2007/rubyize_cooler.rb
  129. +52 −0 beginning_ruby/Fall_2007/states.rb
  130. +38 −0 beginning_ruby/Fall_2007/strings.rb
  131. +63 −0 beginning_ruby/Fall_2007/win32_stuff.rb
  132. BIN  beginning_ruby/Winter_2007/.DS_Store
  133. +56 −0 beginning_ruby/Winter_2007/array_assignment_solution.rb
  134. +39 −0 beginning_ruby/Winter_2007/array_in_class_solution.rb
  135. +15 −0 beginning_ruby/Winter_2007/array_inclass_assignment_pseudocode.txt
  136. +50 −0 beginning_ruby/Winter_2007/arrays_chapter11.rb
  137. +74 −0 beginning_ruby/Winter_2007/beg_arrays.rb
  138. +53 −0 beginning_ruby/Winter_2007/beg_methods.rb
  139. +73 −0 beginning_ruby/Winter_2007/chap10_scalarobject.rb
  140. +75 −0 beginning_ruby/Winter_2007/classes101.rb
  141. +1 −0  beginning_ruby/Winter_2007/cool_string_methods.rb
  142. +46 −0 beginning_ruby/Winter_2007/file_stuff.rb
  143. +28 −0 beginning_ruby/Winter_2007/files/file_demo.rb
  144. +46 −0 beginning_ruby/Winter_2007/files/file_stuff.rb
  145. +33 −0 beginning_ruby/Winter_2007/files/files_and_array.rb
  146. +62 −0 beginning_ruby/Winter_2007/files/files_r_us.rb
  147. +3 −0  beginning_ruby/Winter_2007/files/read_from_file.txt
  148. +33 −0 beginning_ruby/Winter_2007/files_and_array.rb
  149. +85 −0 beginning_ruby/Winter_2007/flow_control_update.rb
  150. BIN  beginning_ruby/Winter_2007/hash assignment/CIS 282 - Hash Assignment.doc
  151. +49 −0 beginning_ruby/Winter_2007/hash assignment/blake_grades.rb
  152. +9 −0 beginning_ruby/Winter_2007/hash assignment/grades.xml
  153. +15 −0 beginning_ruby/Winter_2007/hash assignment/lastname_grades.rb
  154. BIN  beginning_ruby/Winter_2007/hash assignment/xml-simple-1.0.9.gem
  155. +73 −0 beginning_ruby/Winter_2007/hash_demo.rb
  156. +67 −0 beginning_ruby/Winter_2007/highline_demo.rb
  157. +52 −0 beginning_ruby/Winter_2007/highline_menus.rb
  158. +13 −0 beginning_ruby/Winter_2007/highline_menus_methods.rb
  159. BIN  beginning_ruby/Winter_2007/humblerubybook.pdf
  160. +12 −0 beginning_ruby/Winter_2007/intro_to_arrays.rb
  161. +36 −0 beginning_ruby/Winter_2007/iterating_over_array.rb
  162. +26 −0 beginning_ruby/Winter_2007/method_return_values.rb
  163. +47 −0 beginning_ruby/Winter_2007/methods_default_and_named_parameters.rb
  164. +7 −0 beginning_ruby/Winter_2007/methods_in_another_file.rb
  165. +7 −0 beginning_ruby/Winter_2007/methods_program_that_uses_file.rb
  166. +68 −0 beginning_ruby/Winter_2007/methods_variable_argument_lists.rb
  167. +33 −0 beginning_ruby/Winter_2007/methods_variable_scope.rb
  168. +5 −0 beginning_ruby/Winter_2007/names.txt
  169. +51 −0 beginning_ruby/Winter_2007/names_program.rb
  170. +102 −0 beginning_ruby/Winter_2007/names_with_objects.rb
  171. +3 −0  beginning_ruby/Winter_2007/output_file.txt
  172. +78 −0 beginning_ruby/Winter_2007/product.rb
  173. +3 −0  beginning_ruby/Winter_2007/read_from_file.txt
  174. +29 −0 beginning_ruby/Winter_2007/symbols.rb
  175. +130 −0 beginning_ruby/Winter_2007/wacky_fun_with_arrays.rb
  176. BIN  intermediate_ruby/.DS_Store
  177. +17 −0 intermediate_ruby/Ruby_code_examples/.project
  178. +27 −0 intermediate_ruby/Ruby_code_examples/PersonClassDemo.rb
  179. +8 −0 intermediate_ruby/Ruby_code_examples/age.rb
  180. +35 −0 intermediate_ruby/Ruby_code_examples/arrays_and_hashes.rb
  181. +17 −0 intermediate_ruby/Ruby_code_examples/average.rb
  182. +24 −0 intermediate_ruby/Ruby_code_examples/calling_super_method.rb
  183. +23 −0 intermediate_ruby/Ruby_code_examples/class_demo.rb
  184. +8 −0 intermediate_ruby/Ruby_code_examples/conditionals.rb
  185. +13 −0 intermediate_ruby/Ruby_code_examples/grade_report.rb
  186. +56 −0 intermediate_ruby/Ruby_code_examples/group.rb
  187. +105 −0 intermediate_ruby/Ruby_code_examples/inheritance_demo.rb
  188. +42 −0 intermediate_ruby/Ruby_code_examples/iterators.rb
  189. +171 −0 intermediate_ruby/Ruby_code_examples/java_ruby_comparison.txt
  190. +8 −0 intermediate_ruby/Ruby_code_examples/learn.rb
  191. +45 −0 intermediate_ruby/Ruby_code_examples/methods.rb
  192. +20 −0 intermediate_ruby/Ruby_code_examples/min_of_three.rb
  193. +16 −0 intermediate_ruby/Ruby_code_examples/music_type.rb
  194. +65 −0 intermediate_ruby/Ruby_code_examples/my_classes.rb
  195. +19 −0 intermediate_ruby/Ruby_code_examples/rolling_dice.rb
  196. +8 −0 intermediate_ruby/Ruby_code_examples/rolling_dice2.rb
  197. +15 −0 intermediate_ruby/Ruby_code_examples/transactions.rb
  198. +22 −0 intermediate_ruby/Ruby_code_examples/wages.rb
  199. +9 −0 intermediate_ruby/Ruby_code_examples/winpercentage.rb
  200. +17 −0 intermediate_ruby/ruby_extend_existing_objects.rb
  201. BIN  intermediate_ruby/winter2007/.DS_Store
  202. BIN  intermediate_ruby/winter2007/UnitTesting.ppt
  203. +60 −0 intermediate_ruby/winter2007/arrays_chap11.rb
  204. BIN  intermediate_ruby/winter2007/blake_apps/.DS_Store
  205. +6 −0 intermediate_ruby/winter2007/blake_apps/Rakefile
  206. +22 −0 intermediate_ruby/winter2007/blake_apps/models/person.rb
  207. +57 −0 intermediate_ruby/winter2007/blake_apps/models/students.rb
  208. +4 −0 intermediate_ruby/winter2007/blake_apps/person_app.rb
  209. +19 −0 intermediate_ruby/winter2007/blake_apps/tests/test_not_dry_person.rb
  210. +54 −0 intermediate_ruby/winter2007/blake_apps/tests/test_person.rb
  211. +67 −0 intermediate_ruby/winter2007/blake_apps/tests/test_students.rb
  212. +69 −0 intermediate_ruby/winter2007/class_members.rb
  213. +88 −0 intermediate_ruby/winter2007/composition.rb
  214. +104 −0 intermediate_ruby/winter2007/cool_array_stuff.rb
  215. +18 −0 intermediate_ruby/winter2007/dog.rb
  216. +105 −0 intermediate_ruby/winter2007/enumerable_arrays.rb
  217. +68 −0 intermediate_ruby/winter2007/inheritance101.rb
  218. +44 −0 intermediate_ruby/winter2007/modules101.rb
  219. +46 −0 intermediate_ruby/winter2007/modules_201.rb
  220. +25 −0 intermediate_ruby/winter2007/modules_features_comments.rb
  221. +26 −0 intermediate_ruby/winter2007/more_array_stuff.rb
  222. +139 −0 intermediate_ruby/winter2007/ruby_idioms_dynamic.rb
  223. +166 −0 intermediate_ruby/winter2007/ruby_idioms_dynamic2.rb
  224. +76 −0 intermediate_ruby/winter2007/validatable-1.1.1/README
  225. +231 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/base.rb
  226. +23 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/errors.rb
  227. +9 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/validatable.rb
  228. +11 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/validations/validates_acceptance_of.rb
  229. +11 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/validations/validates_confirmation_of.rb
  230. +13 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/validations/validates_format_of.rb
  231. +17 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/validations/validates_length_of.rb
  232. +11 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/validations/validates_presence_of.rb
  233. +24 −0 intermediate_ruby/winter2007/validatable-1.1.1/lib/validations/validation_base.rb
  234. +51 −0 intermediate_ruby/winter2007/validatable-1.1.1/rakefile.rb
  235. +1 −0  intermediate_ruby/winter2007/validatable-1.1.1/test/all_tests.rb
  236. +72 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/functional/validatable_test.rb
  237. +16 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/functional/validates_acceptance_of_test.rb
  238. +18 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/functional/validates_confirmation_of_test.rb
  239. +34 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/functional/validates_format_of_test.rb
  240. +16 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/functional/validates_length_of_test.rb
  241. +16 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/functional/validates_presence_of_test.rb
  242. +18 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/test_helper.rb
  243. +9 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/errors_test.rb
  244. +47 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/validatable_test.rb
  245. +15 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/validates_acceptance_of_test.rb
  246. +15 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/validates_confirmation_of_test.rb
  247. +15 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/validates_format_of_test.rb
  248. +28 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/validates_length_of_test.rb
  249. +13 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/validates_presence_of_test.rb
  250. +35 −0 intermediate_ruby/winter2007/validatable-1.1.1/test/unit/validation_base_test.rb
  251. BIN  intermediate_ruby/winter2007/validatable-1.1.1/validatable-1.1.1.gem
  252. +22 −0 intermediate_ruby/winter2007/validatable_demo.rb
  253. BIN  intermediate_ruby/winter2008/.DS_Store
  254. +44 −0 intermediate_ruby/winter2008/ReviewAssignment_solutions.rb
  255. +121 −0 intermediate_ruby/winter2008/blocks.rb
  256. +121 −0 intermediate_ruby/winter2008/blocks_and_procs.rb
  257. BIN  intermediate_ruby/winter2008/cis283_demo_files/.DS_Store
  258. +13 −0 intermediate_ruby/winter2008/cis283_demo_files/beginning_comparable.rb
  259. +19 −0 intermediate_ruby/winter2008/cis283_demo_files/class_methods_math.rb
  260. +28 −0 intermediate_ruby/winter2008/cis283_demo_files/class_variables.rb
  261. +45 −0 intermediate_ruby/winter2008/cis283_demo_files/class_variables_and_methods.rb
  262. +23 −0 intermediate_ruby/winter2008/cis283_demo_files/comparable_custom_class.rb
  263. +60 −0 intermediate_ruby/winter2008/cis283_demo_files/modules_include_extend.rb
  264. +42 −0 intermediate_ruby/winter2008/cis283_demo_files/rolling.rb
  265. +23 −0 intermediate_ruby/winter2008/cis283_demo_files/sort_by.rb
  266. +30 −0 intermediate_ruby/winter2008/cis283_demo_files/sortable_cool_module.rb
  267. +12 −0 intermediate_ruby/winter2008/class_methods_and_variables.txt
  268. +17 −0 intermediate_ruby/winter2008/class_methods_math.rb
  269. +31 −0 intermediate_ruby/winter2008/class_methods_numbers_fun.rb
  270. +43 −0 intermediate_ruby/winter2008/class_methods_variables.rb
  271. +29 −0 intermediate_ruby/winter2008/class_variables.rb
  272. +238 −0 intermediate_ruby/winter2008/classes_metaprogramming.rb
  273. +15 −0 intermediate_ruby/winter2008/comparable_intro.rb
  274. +36 −0 intermediate_ruby/winter2008/duck_typing.rb
  275. +95 −0 intermediate_ruby/winter2008/enumerable_arrays.rb
  276. +59 −0 intermediate_ruby/winter2008/inheritance_demo.rb
  277. +23 −0 intermediate_ruby/winter2008/inheritance_intro.rb
  278. +34 −0 intermediate_ruby/winter2008/inheritance_super.rb
  279. +34 −0 intermediate_ruby/winter2008/modules101.rb
  280. +80 −0 intermediate_ruby/winter2008/product_needs_refactoring.rb
  281. BIN  intermediate_ruby/winter2008/rspec_tutorial/.DS_Store
  282. +7 −0 intermediate_ruby/winter2008/rspec_tutorial/person.rb
  283. +31 −0 intermediate_ruby/winter2008/rspec_tutorial/person_spec.rb
  284. +8 −0 intermediate_ruby/winter2008/rspec_tutorial/user.rb
  285. +14 −0 intermediate_ruby/winter2008/rspec_tutorial/user_spec.rb
  286. +470 −0 intermediate_ruby/winter2008/rubyisms.html
  287. +228 −0 intermediate_ruby/winter2008/rubyisms.rb
  288. +120 −0 intermediate_ruby/winter2008/simpson_inheritance_assignment.rb
  289. +55 −0 intermediate_ruby/winter2008/solution_with_modules.rb
  290. +56 −0 intermediate_ruby/winter2008/solution_without_modules.rb
BIN  beginning_ruby/.DS_Store
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/.DS_Store
View
Binary file not shown
20 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo.sln
View
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VS_CsharpDemo", "VS_CsharpDemo\VS_CsharpDemo.csproj", "{4A1478D5-032E-4B90-8707-0899F1867C9C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4A1478D5-032E-4B90-8707-0899F1867C9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4A1478D5-032E-4B90-8707-0899F1867C9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4A1478D5-032E-4B90-8707-0899F1867C9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4A1478D5-032E-4B90-8707-0899F1867C9C}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo.suo
View
Binary file not shown
187 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Form1.Designer.cs
View
@@ -0,0 +1,187 @@
+namespace VS_CsharpDemo
+{
+ partial class Form1
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.num1 = new System.Windows.Forms.TextBox();
+ this.num2 = new System.Windows.Forms.TextBox();
+ this.sumButton = new System.Windows.Forms.Button();
+ this.objectSumButton = new System.Windows.Forms.Button();
+ this.sumAnswer = new System.Windows.Forms.Label();
+ this.objectSumAnswer = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.nameList = new System.Windows.Forms.Label();
+ this.nameButton = new System.Windows.Forms.Button();
+ this.name = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(48, 35);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(53, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Number 1";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(48, 105);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(53, 13);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "Number 2";
+ //
+ // num1
+ //
+ this.num1.Location = new System.Drawing.Point(115, 28);
+ this.num1.Name = "num1";
+ this.num1.Size = new System.Drawing.Size(100, 20);
+ this.num1.TabIndex = 2;
+ //
+ // num2
+ //
+ this.num2.Location = new System.Drawing.Point(115, 98);
+ this.num2.Name = "num2";
+ this.num2.Size = new System.Drawing.Size(100, 20);
+ this.num2.TabIndex = 3;
+ //
+ // sumButton
+ //
+ this.sumButton.Location = new System.Drawing.Point(115, 149);
+ this.sumButton.Name = "sumButton";
+ this.sumButton.Size = new System.Drawing.Size(75, 23);
+ this.sumButton.TabIndex = 4;
+ this.sumButton.Text = "Get Sum!";
+ this.sumButton.UseVisualStyleBackColor = true;
+ this.sumButton.Click += new System.EventHandler(this.sumButton_Click);
+ //
+ // objectSumButton
+ //
+ this.objectSumButton.Location = new System.Drawing.Point(115, 213);
+ this.objectSumButton.Name = "objectSumButton";
+ this.objectSumButton.Size = new System.Drawing.Size(75, 23);
+ this.objectSumButton.TabIndex = 5;
+ this.objectSumButton.Text = "Object Sum!";
+ this.objectSumButton.UseVisualStyleBackColor = true;
+ this.objectSumButton.Click += new System.EventHandler(this.objectSumButton_Click);
+ //
+ // sumAnswer
+ //
+ this.sumAnswer.AutoSize = true;
+ this.sumAnswer.Location = new System.Drawing.Point(276, 158);
+ this.sumAnswer.Name = "sumAnswer";
+ this.sumAnswer.Size = new System.Drawing.Size(0, 13);
+ this.sumAnswer.TabIndex = 6;
+ //
+ // objectSumAnswer
+ //
+ this.objectSumAnswer.AutoSize = true;
+ this.objectSumAnswer.Location = new System.Drawing.Point(279, 222);
+ this.objectSumAnswer.Name = "objectSumAnswer";
+ this.objectSumAnswer.Size = new System.Drawing.Size(0, 13);
+ this.objectSumAnswer.TabIndex = 7;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(379, 28);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(66, 13);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "Enter Name:";
+ //
+ // nameList
+ //
+ this.nameList.AutoSize = true;
+ this.nameList.Location = new System.Drawing.Point(379, 115);
+ this.nameList.Name = "nameList";
+ this.nameList.Size = new System.Drawing.Size(0, 13);
+ this.nameList.TabIndex = 9;
+ //
+ // nameButton
+ //
+ this.nameButton.Location = new System.Drawing.Point(382, 70);
+ this.nameButton.Name = "nameButton";
+ this.nameButton.Size = new System.Drawing.Size(185, 23);
+ this.nameButton.TabIndex = 10;
+ this.nameButton.Text = "Click here to add name to list";
+ this.nameButton.UseVisualStyleBackColor = true;
+ this.nameButton.Click += new System.EventHandler(this.nameButton_Click);
+ //
+ // name
+ //
+ this.name.Location = new System.Drawing.Point(382, 44);
+ this.name.Name = "name";
+ this.name.Size = new System.Drawing.Size(100, 20);
+ this.name.TabIndex = 11;
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(654, 284);
+ this.Controls.Add(this.name);
+ this.Controls.Add(this.nameButton);
+ this.Controls.Add(this.nameList);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.objectSumAnswer);
+ this.Controls.Add(this.sumAnswer);
+ this.Controls.Add(this.objectSumButton);
+ this.Controls.Add(this.sumButton);
+ this.Controls.Add(this.num2);
+ this.Controls.Add(this.num1);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "Form1";
+ this.Text = "Form1";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox num1;
+ private System.Windows.Forms.TextBox num2;
+ private System.Windows.Forms.Button sumButton;
+ private System.Windows.Forms.Button objectSumButton;
+ private System.Windows.Forms.Label sumAnswer;
+ private System.Windows.Forms.Label objectSumAnswer;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label nameList;
+ private System.Windows.Forms.Button nameButton;
+ private System.Windows.Forms.TextBox name;
+ }
+}
+
87 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Form1.cs
View
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace VS_CsharpDemo
+{
+ public partial class Form1 : Form
+ {
+ ArrayList people;
+ public Form1()
+ {
+ InitializeComponent();
+ people = new ArrayList();
+
+ }
+
+ private void sumButton_Click(object sender, EventArgs e)
+ {
+ int sum = int.Parse(num1.Text) + int.Parse(num2.Text);
+ sumAnswer.Text = sum.ToString();
+ }
+
+ private void objectSumButton_Click(object sender, EventArgs e)
+ {
+ Math m = new Math(); //Math m = Math.new
+ objectSumAnswer.Text = m.sum(num1.Text,num2.Text).ToString();
+ }
+
+ private void nameButton_Click(object sender, EventArgs e)
+ {
+ people.Add(new Person(name.Text));
+ string output = "";
+ foreach (Person p in people)
+ {
+ output += p + "\n";
+ }
+ nameList.Text = output;
+ }
+ }
+
+ public class Math
+ {
+ public int sum(string num1, string num2)
+ {
+ return int.Parse(num1) + int.Parse(num2);
+ }
+ }
+
+ public class Person
+ {
+ private string name;
+
+ //constructor
+ public Person(string name)
+ {
+ this.name = name;
+ }
+
+ public override string ToString()
+ {
+ return "Hello my name is " + this.name;
+ }
+
+ public void setName(string name)
+ {
+ this.name = name;
+ }
+
+ public string getName()
+ {
+ return this.name;
+ }
+ }
+}
+
+
+
+
+
+
+
+
120 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Form1.resx
View
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
20 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Program.cs
View
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace VS_CsharpDemo
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+}
33 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/AssemblyInfo.cs
View
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("VS_CsharpDemo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("VS_CsharpDemo")]
+[assembly: AssemblyCopyright("Copyright © 2006")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e1f36592-cacd-4ab2-8baf-20dd39adc443")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
71 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Resources.Designer.cs
View
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace VS_CsharpDemo.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VS_CsharpDemo.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
117 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Resources.resx
View
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
30 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Settings.Designer.cs
View
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace VS_CsharpDemo.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
7 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/Properties/Settings.settings
View
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
78 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/VS_CsharpDemo.csproj
View
@@ -0,0 +1,78 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{4A1478D5-032E-4B90-8707-0899F1867C9C}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>VS_CsharpDemo</RootNamespace>
+ <AssemblyName>VS_CsharpDemo</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Form1.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Form1.Designer.cs">
+ <DependentUpon>Form1.cs</DependentUpon>
+ </Compile>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="Form1.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>Form1.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/bin/Debug/VS_CsharpDemo.exe
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/bin/Debug/VS_CsharpDemo.pdb
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/bin/Debug/VS_CsharpDemo.vshost.exe
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.Form1.resources
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.Properties.Resources.resources
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.csproj.GenerateResource.Cache
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.exe
View
Binary file not shown
BIN  beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/Debug/VS_CsharpDemo.pdb
View
Binary file not shown
8 beginning_ruby/Fall_2006/VS_CsharpDemo/VS_CsharpDemo/obj/VS_CsharpDemo.csproj.FileList.txt
View
@@ -0,0 +1,8 @@
+bin\Debug\VS_CsharpDemo.exe
+bin\Debug\VS_CsharpDemo.pdb
+obj\Debug\ResolveAssemblyReference.cache
+obj\Debug\VS_CsharpDemo.Form1.resources
+obj\Debug\VS_CsharpDemo.Properties.Resources.resources
+obj\Debug\VS_CsharpDemo.csproj.GenerateResource.Cache
+obj\Debug\VS_CsharpDemo.exe
+obj\Debug\VS_CsharpDemo.pdb
BIN  beginning_ruby/Fall_2006/array_and_hash assignment/CIS 282 - Arrays and Hashes Assignment.doc
View
Binary file not shown
36 beginning_ruby/Fall_2006/array_and_hash assignment/blake_weather.rb
View
@@ -0,0 +1,36 @@
+require 'rubygems'
+require 'xmlsimple'
+
+#read in xml and convert it to a hash
+weather_hash = XmlSimple.xml_in 'weather_forcast.xml', 'ForceArray' => false
+high_temp_hash = weather_hash['high_temps']
+sum = 0
+high_temp = -99
+high_day = ''
+high_temp_hash.each do |key,value|
+ value = value.to_i
+ sum += value
+ if value > high_temp
+ high_temp = value
+ high_day = key
+ end
+end
+puts "The hottest temperature of the week happend on #{high_day} at #{high_temp} degrees"
+puts "Average high temperature is #{sum/high_temp_hash.size}"
+
+
+
+sum = 0
+low_temp = 200
+low_day = ''
+low_temp_hash = weather_hash['low_temps']
+low_temp_hash.each do |key,value|
+ value = value.to_i
+ sum += value
+ if value < low_temp
+ low_temp = value
+ low_day = key
+ end
+end
+puts "The coldest temperature of the week happend on #{low_day} at #{low_temp} degrees"
+puts "Average low temperature is #{sum/low_temp_hash.size}"
32 beginning_ruby/Fall_2006/array_and_hash assignment/blake_weather_v2.rb
View
@@ -0,0 +1,32 @@
+require 'rubygems'
+require 'xmlsimple'
+
+#read in xml and convert it to a hash
+weather_hash = XmlSimple.xml_in 'weather_forcast.xml', 'ForceArray' => false
+high_temp_hash = weather_hash['high_temps']
+
+#get values array, use 'collect' method to convert string temps to integer temps
+high_temps_array = high_temp_hash.values.collect {|temp| temp.to_i}
+
+#get max value out of temps array
+high_temp = high_temps_array.max
+
+#invert the hash so I can use the temp as the key to get the correct day out of the hash
+inverted_high_temps = high_temp_hash.invert
+high_temp_day = inverted_high_temps[high_temp.to_s]
+puts "#{high_temp_day.capitalize} had the highest temperature of #{high_temp} degrees"
+
+#use the inject method to get a total of the degree values then divide by the length of the array
+average = high_temps_array.inject{|sum,element| sum + element}/high_temps_array.length
+puts "Average high temp is #{average}"
+
+
+#do the same with low temperatures
+low_temp_hash = weather_hash['low_temps']
+low_temps_array = low_temp_hash.values.collect {|temp| temp.to_i}
+low_temp = low_temps_array.min
+inverted_low_temps = low_temp_hash.invert
+low_temp_day = inverted_low_temps[low_temp.to_s]
+puts "#{low_temp_day.capitalize} had the lowest temperature of #{low_temp} degrees"
+average = low_temps_array.inject{|sum,element| sum + element}/low_temps_array.length
+puts "Average low temp is #{average}"
17 beginning_ruby/Fall_2006/array_and_hash assignment/last_name_weather.rb
View
@@ -0,0 +1,17 @@
+require 'rubygems'
+
+#must install first
+#gem install xml-simple
+require 'xmlsimple'
+
+#read in xml and convert it to a hash
+weather_hash = XmlSimple.xml_in 'weather_forcast.xml', 'ForceArray' => false
+#p weather_hash
+
+high_temp_hash = weather_hash['high_temps']
+p high_temp_hash
+
+puts
+
+low_temp_hash = weather_hash['low_temps']
+p low_temp_hash
16 beginning_ruby/Fall_2006/array_and_hash assignment/weather_forcast.xml
View
@@ -0,0 +1,16 @@
+<weather_forcast>
+ <high_temps>
+ <monday>88</monday>
+ <tuesday>87</tuesday>
+ <wednesday>81</wednesday>
+ <thursday>85</thursday>
+ <friday>90</friday>
+ </high_temps>
+ <low_temps>
+ <monday>55</monday>
+ <tuesday>56</tuesday>
+ <wednesday>54</wednesday>
+ <thursday>52</thursday>
+ <friday>60</friday>
+ </low_temps>
+</weather_forcast>
BIN  beginning_ruby/Fall_2006/array_and_hash assignment/xml-simple-1.0.9.gem
View
Binary file not shown
14 beginning_ruby/Fall_2006/array_in_class_assignment_SOLUTION.rb
View
@@ -0,0 +1,14 @@
+require 'rubygems'
+require 'highline/import'
+
+input_array = []
+say "Enter some strings and I'll sort them. Press 'Enter' key to stop"
+begin
+ input = ask "Enter string: "
+ input_array << input if(input.length > 0)
+end while input.length > 0
+input_array.sort!
+say "Sorted strings"
+say input_array.join("\n")
+
+gets
13 beginning_ruby/Fall_2006/blake_histogram.rb
View
@@ -0,0 +1,13 @@
+num_array = [0,0,0,0,0,0,0,0,0,0]
+
+#populate array
+100.times do
+ random_num = rand(100) + 1
+ correct_index = (random_num == 100) ? 9 : random_num/10
+ num_array[correct_index] += 1
+end
+
+#print histrogram
+for index in 0..9
+ puts "#{(index*10) + 1}-#{(index+1)*10} \t| #{'*' * num_array[index]}"
+end
4 beginning_ruby/Fall_2006/blake_library.rb
View
@@ -0,0 +1,4 @@
+def do_something
+ puts "woo hoo I'm doing it"
+end
+
18 beginning_ruby/Fall_2006/bmi_blake.rb
View
@@ -0,0 +1,18 @@
+require 'rubygems'
+require 'highline/import'
+
+upper_limit_for_healthy = 25
+healthy_range = 19..upper_limit_for_healthy
+while(agree("Do you want to check your bmi? (y/n)",true))
+ weight = ask("Enter weight in pounds.",Integer)
+ height = ask("Enter height in inches.",Integer)
+ bmi = (weight*720)/(height**2)
+ say "Your BMI is #{bmi}"
+ if bmi > upper_limit_for_healthy
+ say "You are above healthy range"
+ elsif (healthy_range).include?(bmi)
+ say "You are within healthy range"
+ else
+ say "You are below healthy range"
+ end
+end
77 beginning_ruby/Fall_2006/cheerleader_library.rb
View
@@ -0,0 +1,77 @@
+def setup_cheerleader_array
+ cheerleaders = ["Wilkens, Leah","Davis, Elizabeth","Ott, Whitney","Parker, Christina","Brown, Cori"].sort
+ #check to see if file exists? true or false
+ #use contents of file
+ if File.file? 'cheerleaders'
+ open('cheerleaders','r') do |file|
+ cheerleaders_string = file.read
+ cheerleaders = cheerleaders_string.split("\n")
+ end
+ end
+
+ #return array
+ cheerleaders
+end
+
+def add_cheerleader
+ #~ first_name = ask "Enter first name: "
+ #~ last_name = ask "Enter last name: "
+ #~ full_name = "#{last_name}, #{first_name}"
+ name = ask "enter first and last name"
+ name_array = name.split(' ')
+ full_name = name_array[1].capitalize + ", " + name_array[0].capitalize
+end
+
+def delete_cheerleader cheerleaders
+ cheerleaders.each_with_index {|cheerleader,index| say "#{index + 1}) #{cheerleader}" }
+ index = ask("Enter in number of the cheerleader you'd like to delete",Integer) - 1
+ cheerleaders.delete_at(index)
+ cheerleaders
+end
+
+def report cheerleaders
+ #do fancy stuff
+ #create html output string, push onto it
+ html = "<html><head><title>hola</title></head><body>"
+ html << "<h1>Your SCC cheerleaders!!</h1>"
+ html << "<ul>"
+ cheerleaders.each do |cheerleader|
+ html << "<li>#{cheerleader}</li>"
+ end
+ html << "</ul>"
+ html << "<table border='1'>"
+ html << "<tr><td>Last, First</td></tr>"
+ row_count = 1
+ cheerleaders.each do |cheerleader|
+ html << "<tr bgcolor='#{row_count%2==1 ? '#006688':'#000099'}'><td>#{cheerleader}</td></tr>"
+ row_count += 1
+ end
+ html << "</table>"
+ html << "</body></html>"
+
+ #write the html output string to a file
+ open('cheerleader_roster.html','w') do |file|
+ file.write(html)
+ end
+
+ #open ie, load the generated file into browser
+ ie = Watir::IE.new
+ ie.goto("h:\\cheerleader_roster.html")
+
+end
+
+def save_cheerleaders cheerleaders
+ #save the state of the array
+ open('cheerleaders','w') do |file|
+ file.write(cheerleaders.join("\n"))
+ end
+end
+
+
+
+
+
+
+
+
+
48 beginning_ruby/Fall_2006/cheerleader_roster.rb
View
@@ -0,0 +1,48 @@
+require 'rubygems'
+require 'highline/import'
+require 'watir'
+require 'cheerleader_library'
+
+cheerleaders = setup_cheerleader_array
+
+say "Welcome to our cheerleader management application"
+
+while agree("Would you like to continue to manage? (y/n)",true)
+ option = ask "Enter 'v' to view all, 'a' to add, 'd' to delete, 'r' to report"
+ case option
+ when 'v': say cheerleaders.join("\n")
+ when 'a'
+ cheerleaders << add_cheerleader
+ cheerleaders.sort!
+ when 'd': cheerleaders = delete_cheerleader cheerleaders
+ when 'r': report cheerleaders
+ end
+end
+
+#bye bye, save array out to file
+save_cheerleaders cheerleaders
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
41 beginning_ruby/Fall_2006/cheerleader_roster_on_hash.rb
View
@@ -0,0 +1,41 @@
+require 'rubygems'
+require 'highline/import'
+
+cheerleaders = {
+ "beanie"=>"Wilkens, Leah",
+ "bambi"=>"Davis, Elizabeth",
+ "scout"=>"Ott, Whitney",
+ "ople"=>"Parker, Christina",
+ "willie"=>"Brown, Cori"
+ }
+say "Welcome to our cheerleader management application"
+
+while agree("Would you like to continue to manage? (y/n)",true)
+ option = ask "Enter 'v' to view all, 'a' to add, 'd' to delete"
+ case option
+ when 'v'
+ cheerleaders.each do |pet_name,name|
+ say "#{pet_name}: #{name}"
+ end
+ when 'a'
+ name = ask "enter first and last name"
+ name_array = name.split(' ')
+ begin
+ pet_name = ask "Enter your pet name"
+ say "Duplicate pet name!" if cheerleaders.has_key?(pet_name)
+ end while cheerleaders.has_key?(pet_name)
+ full_name = name_array[1].capitalize + ", " + name_array[0].capitalize
+ cheerleaders[pet_name] = full_name #add to hash
+ when 'd'
+ begin
+ pet_name_to_delete = ask "Enter in the pet name of the cheerleader you'd like to delete"
+ say "Pet name does not exist!" unless cheerleaders.has_key?(pet_name_to_delete)
+ end until cheerleaders.has_key?(pet_name_to_delete)
+ cheerleaders.delete(pet_name_to_delete)
+ say "#{pet_name_to_delete} has been deleted."
+ #~ when 's': say cheerleaders.sort.join("\n")
+ #~ sorted_cheerleaders = cheerleaders.sort
+ #~ say sorted_cheerleaders.join("\n")
+ end
+
+end
121 beginning_ruby/Fall_2006/class_demo.rb
View
@@ -0,0 +1,121 @@
+#class definition
+#class is new key word
+#convention: start class names with uppercase
+#for now, singular
+class Student
+
+ #special: constructor
+ #only called once during the lifetime of an object
+ #!! huh? when you call the 'new'
+ def initialize(name="No name")
+ @name = name
+ end
+
+ #@variable_name has class scope
+ #setter: take value from external source
+ def set_name(name)
+ @name = name
+ end
+
+ #syntactic sugar
+ #setter: take value from external source
+ def name=(name)
+ @name = name
+ end
+
+ #getter: return a value to external caller
+ def name
+ @name
+ end
+
+ def name_greeting
+ "Hello my name is #{@name}"
+ end
+
+ def study
+ puts "Ouch, my brain is hurting."
+ end
+ def spinning_my_wheels
+ puts "I studied #{rand(12)} hours last night"
+ end
+ def print_letter_grade(gpa)
+ puts case gpa
+ when 4.0: "A"
+ when 3.0..3.9: "B"
+ when 2.0..2.9: "C"
+ when 1.0..1.9: "D"
+ else "Uh-oh"
+ end
+ end
+
+ def greeting
+ "Greetings! Hello World"
+ end
+
+end
+
+
+#instantiation
+#variable_name = ClassName.new
+student1 = Student.new
+puts student1.name
+#method call - object-based programming
+#use the variable_name.method_name
+student1.study
+student1.spinning_my_wheels
+student1.print_letter_grade(3.5)
+puts student1.greeting
+student1.set_name("sean") #calling the setter
+puts student1.name #calling the getter
+student1.name = "sean glover" #calling the setter
+puts student1.name
+puts
+student2 = Student.new
+puts student2.name
+student2.study
+student2.spinning_my_wheels
+student2.print_letter_grade(2.9)
+puts student2.greeting
+student2.set_name("doug")
+puts student2.name
+
+#instantiating a string object
+name = "tom"
+#call a method
+#use the variable_name.method_name
+name.length
+
+puts
+s3 = Student.new("dima")
+puts s3.name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
61 beginning_ruby/Fall_2006/class_design.rb
View
@@ -0,0 +1,61 @@
+class Thanksgiving
+ def initialize(appetizer,dinner,dessert)
+ @appetizer,@dinner,@dessert = appetizer,dinner,dessert
+ end
+
+ #attr* family is ruby specific, other languages you have to write setter/getter methods
+ attr_accessor :appetizer,:dessert
+ attr_reader :dinner
+ attr_writer :dinner_calories,:dessert_calories
+
+ def print_calorie_report
+ puts "Turkey calorie report: #{sum_calories}"
+ end
+
+ def sum_calories
+ @dinner_calories + @dessert_calories
+ end
+
+ def to_s
+ "#{@appetizer} #{@dinner} #{@dessert}"
+ end
+end
+
+meal = Thanksgiving.new("shrimp cocktail","turkey","pumpkin pie")
+puts meal
+
+#set/write
+meal.appetizer = "stuffing"
+meal.dessert = "pecan pie"
+
+#get/read
+puts meal.appetizer
+puts meal.dessert
+puts meal.dinner
+
+#cannot set dinner because it is read-only
+#meal.dinner = "ham"
+
+meal.dinner_calories = 3500
+meal.dessert_calories = 2000
+meal.print_calorie_report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
58 beginning_ruby/Fall_2006/default_values_AND_named_parameters.rb
View
@@ -0,0 +1,58 @@
+#optional arguments
+def product_by num, *numbers
+ numbers.each do |number|
+ puts "#{number} * #{num} = #{number * num}"
+ end
+end
+
+product_by 10,35,4,5,32
+product_by 2,35,34,3565
+
+puts
+
+#default parameters/arguments used for method definitions
+def print_sum num1=0,num2=0
+ puts num1 + num2
+end
+
+print_sum 34,563
+print_sum 34
+print_sum
+
+def print_name name="Name not provided"
+ puts name
+end
+
+print_name "Johnny"
+print_name
+
+puts
+#named parameters (uses a hash)
+def print_student something_else, blah, info={}
+ puts something_else + " " + blah
+ puts "#{info['name']} is #{info['age']} old and has a gpa of #{info['gpa']}"
+end
+
+print_student("yea","nay",{'name'=>'jon','age'=>99,'gpa'=>2.0})
+
+#without curly braces, it is assumed that the last parameter is a hash, so no curly braces were needed.
+print_student("oink","chirp",'name'=>'mary','age'=>78,'gpa'=>4.0)
+
+
+
+
+
+
+
+
+
+
+
+
+
+gets
+
+
+
+
+
77 beginning_ruby/Fall_2006/dog_program.rb
View
@@ -0,0 +1,77 @@
+class Dog
+ def initialize(name="Unknown",age=0)
+ @name, @age = name,age
+ end
+ attr_accessor :name,:age
+
+ def dog_years
+ @age * 7
+ end
+
+ def prepare_for_file
+ "#{@name} #{@age}\n"
+ end
+
+ def to_s
+ "Hello my name is #{@name} and I am #{@age}"
+ end
+end
+
+dogs = []
+myfile = File.open("dogs.txt", "r")
+myfile.each_line do|dog|
+ dog_array = dog.split
+ dogs << Dog.new(dog_array[0],dog_array[1].to_i)
+end
+myfile.close
+
+dogs.each { |dog| puts dog.dog_years }
+
+puts dogs[2]
+puts
+puts dogs[1]
+dogs[1].name = "johnny"
+puts dogs[1]
+
+output = ""
+dogs.each { |dog| output << dog.prepare_for_file}
+puts output
+open('dogs.txt','w') do |file|
+ file.write(output)
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
3  beginning_ruby/Fall_2006/dogs.txt
View
@@ -0,0 +1,3 @@
+fido 10
+johnny 3
+max 8
28 beginning_ruby/Fall_2006/file_demo.rb
View
@@ -0,0 +1,28 @@
+#write to a file
+open('demo','w') do |file|
+ file.write("hello\nworld\tok")
+end
+
+#read from file
+open('demo','r') do |file|
+ puts file.read
+end
+
+#append to a file
+open('demo','a') do |file|
+ file.write("\nkarmen was here!")
+end
+
+#read from file
+open('demo','r') do |file|
+ puts file.read
+end
+
+
+#write an array
+open('array','w') do |file|
+ file.write([1,2,3,4].join(", "))
+end
+open('array','r') do |file|
+ p file.read.split(", ")
+end
62 beginning_ruby/Fall_2006/files_r_us.rb
View
@@ -0,0 +1,62 @@
+ require 'watir' # the watir controller
+
+#write to a file
+open('warehouse','w') do |file|
+ file.write("hello doug\n")
+ file.write("hello sean\tblah")
+end
+
+open('warehouse.html','w') do |file|
+ file.write("<html><head><title>hola</title></head><body>")
+ file.write("<b>hello jon</b><br/>")
+ file.write("blah")
+ file.write("</body></html>")
+end
+
+# open the IE browser
+ie = Watir::IE.new
+ie.goto("warehouse.html")
+
+#reading from a file
+open('warehouse','r') do |file|
+ puts file.read
+end
+
+open('warehouse.html','r') do |file|
+ puts file.read
+end
+
+#write an array to file
+#first, convert array to string
+numbers = [3,5,3,5,9]
+open('num_file','w') do |file|
+ file.write(numbers.join(" - "))
+end
+
+open('num_file','r') do |file|
+ numbers_string = file.read
+ puts numbers_string
+ numbers = numbers_string.split(" - ")
+ p numbers
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
72 beginning_ruby/Fall_2006/flow_control.rb
View
@@ -0,0 +1,72 @@
+$stdout.sync = true
+#boolean logic
+# common relational operators
+# <, >, <=, >=, ==, !=
+# logical operators
+# && (and), || (or), ! (not)
+# truth table: (t is true, f is false)
+# t and t is t, t and f is f, f and t is f, f and f is f
+# t or t is t, t or f is t, f or t is t, f or f is f
+# All values and variables have a boolean value of true except a nil object and fals
+x = nil
+y = false
+if x or y
+ puts 'they have values'
+else
+ puts 'false values'
+end
+
+x = 11
+
+#short hand notation, not as readable
+if x > 10 then puts x end
+if x > 10; puts x; end
+if x > 10: puts x; end
+
+#more readable, recommended (required by me)
+if x > 10
+ puts x
+end
+
+#conditional modifier
+puts x if x > 10
+
+print "Enter an integer "
+x = gets.to_i
+if x > 0
+ puts "positive"
+elsif x < 0
+ puts "negative"
+else
+ puts "zero"
+end
+
+lucky_number = 35
+print "Guess lucky number: "
+num = gets.to_i
+if !(num == lucky_number)
+ puts "sorry, wrong guess"
+end
+
+if !(num == lucky_number)
+ puts "sorry, wrong guess"
+else
+ puts "you got it!"
+end
+
+#alternate more readable example
+# unless is the same as if not
+unless num == lucky_number
+ puts "sorry, wrong guess"
+end
+
+unless num == lucky_number
+ puts "sorry, wrong guess"
+else
+ puts "you got it!"
+end
+
+#case expression
+
+
+
118 beginning_ruby/Fall_2006/flow_control_demo.rb
View
@@ -0,0 +1,118 @@
+$stdout.sync = true
+
+#~ x = nil
+#~ y = false
+#~ if x or y
+ #~ puts "you exist"
+#~ else
+ #~ puts "false value"
+#~ end
+
+#~ x = 11
+#~ if x
+ #~ puts "you exist"
+#~ end
+
+#~ #alternate syntaxes for if, I do not recommend these
+#~ # not as readable
+#~ if x > 10 then puts x end
+#~ if x > 10; puts x; end
+#~ if x > 10: puts x; end
+
+#~ #readable
+#~ if x > 10
+ #~ puts x
+#~ end
+
+#~ #conditional modifier
+#~ puts x if x > 10
+
+#~ print "Enter an integer: "
+#~ x = gets.to_i
+#~ if x > 0
+ #~ puts "positive"
+#~ elsif x < 0
+ #~ puts "negative"
+#~ else
+ #~ puts "zero"
+#~ end
+
+#~ lucky_number = 35
+#~ print "Guess the lucky number: "
+#~ num = gets.to_i
+#~ if !(num == lucky_number)
+ #~ puts "sorry, wrong guess"
+#~ else
+ #~ puts "you got it!"
+#~ end
+
+#~ #unless is the same as if not
+#~ unless num == lucky_number
+ #~ puts "sorry, wrong guess"
+#~ else
+ #~ puts "you got it!"
+#~ end
+
+#case structure
+#equality comparison with a value
+#~ print "Enter test score: "
+#~ score = gets.to_i
+#~ case score
+ #~ when 90: puts "A"
+ #~ when 80: puts "B"
+ #~ when 70: puts "C"
+ #~ else
+ #~ puts "something below C"
+#~ end
+
+print "Enter test score: "
+score = gets.to_i
+case score
+ when 90..100: puts "A"
+ when 80..89: puts "B"
+ when 70..79: puts "C"
+ else
+ puts "something below C"
+end
+
+print "Enter test score: "
+score = gets.to_i
+letter_grade = case score
+ when 90..100: "A"
+ when 80..89: "B"
+ when 70..79: "C"
+ when 50..59, 60..69: "D"
+ else
+ "Failing"
+end
+
+puts "You have received #{letter_grade}"
+
+gets
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
119 beginning_ruby/Fall_2006/hash_browns.rb
View
@@ -0,0 +1,119 @@
+require 'rubygems'
+require 'highline/import'
+
+#empty array
+a = []
+#initialize arrays
+a = ['lsdfj','lsjdf','lsjdf']
+
+#empty hash
+empty_hash = {}
+#initialize hash values
+states = {'ct'=>'connecticut',
+ 'de'=>'deleware',
+ 'nj'=>'new jersey',
+ 'va'=>'virginia',
+ 'ny'=>'new york'
+ }
+
+#accessing a value by its key
+say states['nj']
+say states['ny']
+say states['de']
+
+#add an element to a hash
+states['wa'] = 'washington'
+states['id'] = 'idaho'
+
+say states['wa']
+
+#grab multiple values at one time and put into an array
+states_array = states.values_at("nj","wa")
+say states_array.join(', ')
+puts
+
+#access each key-value pair one at a time quickly
+states.each do |abbreviation,name|
+ say "#{abbreviation}: #{name}"
+end
+puts
+#access keys and put them into an array
+abbreviations = states.keys
+say abbreviations.join(', ')
+puts
+#access values and put them into array
+names = states.values
+say names.join(', ')
+puts
+
+#check for element existence, returns true or false
+say "does new york exist? #{states.has_key?('ny')}"
+puts
+
+#delete an element
+states.delete("ny")
+
+#access each key-value pair one at a time quickly
+states.each do |abbreviation,name|
+ say "#{abbreviation}: #{name}"
+end
+puts
+
+#check for key existence, returns true or false
+say "does ny key exist? #{states.has_key?('ny')}"
+#check for value existence
+say "does new jersey value exist? #{states.has_value?('new jersey')}"
+
+#check for empty
+say "is states empty? #{states.empty?}"
+
+#size of hash
+say "states size is #{states.length}"
+
+sorted_states = states.sort
+#p sorted_states
+#~ say sorted_states[0][0]
+#~ say sorted_states[0][1]
+#~ say sorted_states[1][0]
+#~ say sorted_states[1][1]
+say "first element is sorted array which so happens to be another array"
+p sorted_states[0]
+
+puts
+sorted_states.each do |state_array|
+ say "State info is: #{state_array[0]}: #{state_array[1]}"
+ #puts state_array
+end
+
+gets
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
25 beginning_ruby/Fall_2006/highline_demo.rb
View
@@ -0,0 +1,25 @@
+require 'rubygems'
+require 'highline/import'
+
+say "Hello there!"
+name = ask("Enter your name ")
+age = ask("Enter your age ", Integer)
+price = ask("Enter price ",Float)
+
+say "Name is #{name}"
+say "Age is #{age}"
+say "Price is #{price}"
+
+if agree("do you like ice cream? (yes/no)")
+ say "woo hoo!!"
+end
+
+question = "keep going? (y/n)"
+while agree(question,true)
+ say "going... and "
+ say question
+end
+
+say "gone"
+
+gets
12 beginning_ruby/Fall_2006/intro_to_arrays.rb
View
@@ -0,0 +1,12 @@
+names = ["Tom","Dick","Harry","Moe"]
+puts names.length
+#puts names
+puts names[2]
+puts names[0]
+puts names[1]
+names[1] = "Tim"
+puts names[1]
+puts names[4]
+puts names[100]
+puts names[-10]
+puts names[1].reverse
26 beginning_ruby/Fall_2006/language demos/GroovyDemo.groovy
View
@@ -0,0 +1,26 @@
+import java.util.Scanner
+
+class GroovyDemo{
+
+ static void main(args)
+ {
+ go = "y"
+ Scanner scan = new Scanner(System.in)
+
+ while(go == "y")
+ {
+ println "Enter number 1: "
+ num1 = scan.nextInt()
+ println "Enter number 2: "
+ num2 = scan.nextInt()
+ println "The sum of your numbers is: ${get_sum(num1,num2)}"
+ println "Do you want to run again? (y/n)"
+ go = scan.next()
+ }
+ }
+
+ static int get_sum(num1,num2)
+ {
+ return num1 + num2
+ }
+}
25 beginning_ruby/Fall_2006/language demos/JavaDemo.java
View
@@ -0,0 +1,25 @@
+import java.util.Scanner;
+
+public class JavaDemo {
+
+ public static void main(String[] args) {
+ int num1, num2;
+ String go = "y";
+ Scanner scan = new Scanner(System.in);
+ while(go.equals("y"))
+ {
+ System.out.println("Enter number 1:");