Thanks!
Can you show me how to extract tables of MySQL in Ruby?
Thanks!
Can you show me how to extract tables of MySQL in Ruby?
Hi,
I tried to connect Ruby to MySQL following the instructions of this link, http://www.tutorialspoint.com/ruby/ruby_database_access.htm.
But, I could not go beyond installation. Whenever I tried to run the script which is the following:
%(#800000)[#!/usr/bin/ruby -w
require "dbi"
begin
# connect to the MySQL server
dbh = DBI.connect("DBI:Mysql:TESTDB:localhost",
"testuser", "test123")
# get server version string and display it
row = dbh.select_one("SELECT VERSION()")
puts "Server version: " + row[0]
rescue DBI::DatabaseError => e
puts "An error occurred"
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
ensure
# disconnect from server
dbh.disconnect if dbh
end]
It says 'warning:mismatch indentations, no file to load and many more.........'.
Can anyone help me with this problem? My computer has windows7 as OS.
Thanks.
Thank you very much. The code worked and will be uploading soon...
And I am learning ruby for sketchup from basics now..
I am a newbie in both sketchup and Ruby
The following is the part of ruby script I am working right now
cmd1 = UI;;Command.new("Show 01") {show_1}
cmd1.set_validation_proc {
true ? MF_ENABLED ; MF_GRAYED
}
cmd1.small_icon = "01_small.png"
cmd1.large_icon = "01_large.png"
cmd1.tooltip = "Show layer 01 with materials"
toolbar1 = UI;;Toolbar.new "Color the objects"
toolbar1.add_item cmd1
toolbar1.show
Till now, I am only able to create the icon on the toolbar with the image "01" I tried a lot to let the icon execute some commands but I failed all the time. (Still working on this for more than 72 hrs)
What I wanted to do is -
When some faces or entity is selected on the sketchup, and then, if I pressed that icon, I wanted to apply either color (from material library, such as color_A01),or texture (any jpg) on those selected face. Is it possible to do this?
Another thing I wished to do was put a roll down menu which gives the names of all the layers present in the sketchup model and when i press above mention key "01", it should select all the objects in the layer chosen and apply color or texture. Is it possible to do this?
I prefer color than texture.
How shall I do it?
Thank in advance