Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discovering Ruby. Welcome to Barcamp Ireland!. I’m going to talk through my early days with ruby. I’m trying to build a ruby applications so what I know.

Similar presentations


Presentation on theme: "Discovering Ruby. Welcome to Barcamp Ireland!. I’m going to talk through my early days with ruby. I’m trying to build a ruby applications so what I know."— Presentation transcript:

1 Discovering Ruby. Welcome to Barcamp Ireland!

2 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. So what are you talking about? http://poignantguide.net/ruby/chapter- 2.html

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

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/ 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 you want to make a ruby application? 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.

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 Ruby and Mysql 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.

13 Ruby Gems http://rubyforge.org/proj ects/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? hook C:/ruby/rubygems-0.9.0/./post-install.rb failed: undefined method 'post_install_message' for # Error messages!


Download ppt "Discovering Ruby. Welcome to Barcamp Ireland!. I’m going to talk through my early days with ruby. I’m trying to build a ruby applications so what I know."

Similar presentations


Ads by Google