1 / 16

Discovering Ruby .

Discovering Ruby. Welcome to Barcamp Ireland!. So what are you talking about?. I’m going to talk through my early days with ruby. I’m trying to build a ruby applications so what I know is based off that.

janina
Download Presentation

Discovering Ruby .

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Discovering Ruby. Welcome to Barcamp Ireland!

  2. So what are you talking about? • I’m going to talk through my early days with ruby. • I’m trying to build a ruby applications so what I know is based off that. • But I’m not with ruby that long either so if I look blankly at you, prompt me about where to ask. • http://poignantguide.net/ruby/chapter-2.html

  3. http://tryruby.hobix.com/ So where do you go to first?

  4. Whats the coolest thing you learn there?

  5. www.ruby-lang.org/ • The recently redesigned ruby homepage. • Good for downloading ruby, updates, finding links and the ruby reference library. • Bad for finding unusual but good ruby sources. • Bad for finding simple ruby examples.

  6. Other Resources to look at. • Ruby Garden.www.rubygarden.org/ • Ruby core library • www.ruby-doc.org/core/ • Ruby standard library • www.ruby-doc.org/stdlib/

  7. Ruby User guide. • Again we are looking at the very basics. • No ties to the standard library. So you cant see a follow through. • Hard to tell without running the code if the code is up to date. • Out of date code is a big problem when you are error checking.

  8. So how can you? Besides using ruby-on-rails. Pikeaxe says ruby-tk. So that’s what I went with.. However Ruby-tk is poorly documented. QT is considered better documented and prettier. So you want to make a ruby application?

  9. QT Verses Ruby-Tk • And don’t you partly use ruby for the prettiness. • So finding out ruby-tk is not pretty is upsetting. • QT is dual licensed. A commerical license and a GPL. • But I went with Ruby-tk so I cant help you with QT. • http://poignantguide.net/ruby/chapter-2.html

  10. http://pub.cozmixng.org/~the-rwiki/? • Useful due to lots of examples. • Unfortunately in japanese. • Unfortunately some of the code is out of date. • Still probally one of the best ruby-tk references.

  11. Some simple ruby-tk code.Button packing. require "tk" TkLabel.new { text "Top" pack('side' => 'top') } TkLabel.new { text "Middle" pack('side' => 'top') } TkLabel.new { text "Bottom" pack('side' => 'top') } Tk.mainloop

  12. So you need a database. For mysql you have two modules to choose from. Confused? Thought this was newbie-friendly? Well Ruby gems will help you install whichever one you pick. Ruby and Mysql

  13. Ruby Gems • http://rubyforge.org/projects/rubygems/ • Ruby gems helps you install add-ons to ruby. • It tries to make life easier. • However you will have to reinstall your gems every time you upgrade ruby.

  14. Mysql ruby test code from Kitebird. You will know this test. • Simple.rb • require “mysql” •    begin       #this example is used for checking if your installation is correct.       # connect to the MySQL server       dbh = Mysql.real_connect(”localhost”, “testuser”, “testpass”, “test”)       # get server version string and display it       puts “Server version: ” + dbh.get_server_info   rescue MysqlError => e       print “Error code: “, e.errno, “\n”       print “Error message: “, e.error, “\n”   ensure  # disconnect from server       dbh.close   end

  15. So you have the means • You have your database, ruby can connect to the database. • You have picked your gui method. • You think you can make one. • What now? • http://poignantguide.net/ruby/chapter-2.html

  16. Any questions? Error messages! • hook C:/ruby/rubygems-0.9.0/ ./post-install.rb failed:undefined method 'post_install_message' for #<Gem::Specification:0X3337fa8>

More Related