SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

mysql, ruby and #develop

Last post 04-29-2011 3:17 PM by MattWard. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-27-2011 11:59 AM

    • dglnz
    • Not Ranked
    • Joined on 03-05-2011
    • Posts 4

    mysql, ruby and #develop

    I have had the sharp develop ide load for sometime but only now starting to play with it to see how good it is.

    I like ruby and have a number of classes (one of which has connection setup to my Mysql server and uses sequel gem for the management of the conection).

    Last night i tried to do a simple act of putting a listbox onto a window and trying to use my script to get data displayed.

    the error i was getting is this..

    unknown: no such file to load -- gem_prelude.rb (LoadError)

    I had emailed Matt Ward and he kindly responded very promptly but alas I got no further.

    Tonight I thought maybe it's got something to with my script so i downloaded the Mysql .net 6.3.6 MSI and started playing with that BUT I cannot see how I can connect to my server let alone connect to my DB inside the server (Yes the server is local to my machine and is up).

    Anyone able to point me to a good tutorial that goes through this with #develop?

    From what i've seen playing with #develop's ruby i like it. I have used fxruby and foxGUIb for a wee while so can follow what is happening in the source code a bit.

     

    My source code...

    C:\Program Files\SharpDevelop\4.0\AddIns\BackendBindings\RubyBinding>

    MainForm.rb

    require "mscorlib"
    require "System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089"
    require "System.Drawing, Version=2.0.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a"
    require "sequel1" # this is my MYSQL data access code using sequel gem.

    class MainForm < System::Windows::Forms::Form
            def initialize()
                    self.InitializeComponent()
            end

            def InitializeComponent()
                    @listBox1 = System::Windows::Forms::ListBox.new()
                    self.SuspendLayout()
                    #
                    # listBox1
                    #
                    @listBox1.FormattingEnabled = true
                    @listBox1.Location = System::Drawing::Point.new(74, 115)
                    @listBox1.Name = "listBox1"
                    @listBox1.Size = System::Drawing::Size.new(439, 225)
                    @listBox1.TabIndex = 0
                    #
                    # MainForm
                    #
                    self.ClientSize = System::Drawing::Size.new(564, 367)
                    self.Controls.Add(@listBox1)
                    self.Name = "MainForm"
                    self.Text = "test_rb"
                    self.Load { |sender, e| self.load_form(sender, e) }
                    self.ResumeLayout(false)
                    @db = Dopen.new # code I've put in as I'm not too sure where to put
    it.
            end

            def load_form(sender, e)
                  # call a method in sequel1.rb to get a list of customers!
              data = @db.get_all_patrol_acccodes
             
              data.each do |rec|
                @listBox1.items.add(rec)
              end
            end
    end

    Program.rb

    require "mscorlib"
    require "System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089"
    require "System.Drawing, Version=2.0.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a"
    require "MainForm"


    Application = System::Windows::Forms::Application

    Application.EnableVisualStyles()
    form = MainForm.new()
    Application.Run(form)

    Filed under: , , ,
  • 04-27-2011 12:26 PM In reply to

    Re: mysql, ruby and #develop

    gem_prelude.rb is part of the standard Ruby library. SharpDevelop does not include this in its installer. I would download IronRuby 1.1.1 (assuming you are using SharpDevelop 4.0) and unzip the Lib folder. Then you'll need to set the load paths so the IronRuby console (ir.exe) can find the Ruby standard library. You may be able to define the path by creating an ir.exe.config file next to ir.exe, with the contents similar to the following:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <configSections>
        <section name="microsoft.scripting" type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting, Version=1.1.0.10, Culture=neutral, PublicKeyToken=7f709c5b713576e1" requirePermission="false" />
      </configSections>

      <microsoft.scripting>
        <languages>
           <language names="IronRuby;Ruby;rb" extensions=".rb" displayName="IronRuby" type="IronRuby.Runtime.RubyContext, IronRuby, Version=1.1.1.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1" />
        </languages>

        <options>
          <set language="Ruby" option="LibraryPaths" value="lib uby\1.9.1\;lib uby\site_ruby\1.9.1\"/>
        </options>
      </microsoft.scripting>
    </configuration>

    The above assumes that the ruby lib folder is in a subdirectory above ir.exe

  • 04-29-2011 2:08 PM In reply to

    • dglnz
    • Not Ranked
    • Joined on 03-05-2011
    • Posts 4

    Re: mysql, ruby and #develop

     Okay got this done

    Now how should i install gems?

    looking in on the rubybindings i don't see how i can install gems from the net.

    should i install the MSI of ironruby 1.1.1 or the zip file?

    as I use a couple of gems and most important of them is the sequel gem.

    I understand i could use the .net stuff but to be honest, I've not used this technology before and would need to be pointed to some good tutorials for me to get started on this.

    you're opinions would be appreciated.

     

    dave.

  • 04-29-2011 3:17 PM In reply to

    Re: mysql, ruby and #develop

    The IronRuby 1.1.1 zip file contains igem.bat alongside the IronRuby console (ir.exe). You should be able to use igem on the command line to install any gems you need.

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.