Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Rubygems

For general discussion related FlowStone

Rubygems

Postby sal » Wed Dec 21, 2011 4:49 pm

Hi,
any chances to add rubygems support?

Thank You

Sal
sal
 
Posts: 42
Joined: Thu Aug 19, 2010 4:56 pm

Re: Rubygems

Postby DSP » Wed Dec 21, 2011 6:05 pm

It already supports Ruby Gems!
DSP
 
Posts: 150
Joined: Fri May 14, 2010 10:55 pm

Re: Rubygems

Postby sal » Wed Dec 21, 2011 7:37 pm

how?
I tried the ruby way without success
sal
 
Posts: 42
Joined: Thu Aug 19, 2010 4:56 pm

Re: Rubygems

Postby sal » Thu Dec 22, 2011 9:41 am

Code: Select all
gem install mysql
gem install sqlite3-ruby
gem list


how do i accomplish this ?


mr DSP how do you install and use gems?
sal
 
Posts: 42
Joined: Thu Aug 19, 2010 4:56 pm

Re: Rubygems

Postby infuzion » Fri Dec 23, 2011 7:50 am

sal wrote:
Code: Select all
gem install mysql
gem install sqlite3-ruby
gem list
How do I accomplish this ?
Have you tried to install the gems manually?
http://docs.rubygems.org/read/chapter/3
infuzion
 
Posts: 109
Joined: Tue Jul 13, 2010 11:55 am
Location: Kansas City, USA, Earth, Sol

Re: Rubygems

Postby sal » Fri Dec 23, 2011 3:22 pm

yes i tried that, but at the moment the use of gems is not allowed as confirmed by dsp robotics on pm due to bugs caused by gems on windows platform.
Hope they will find a solution at least for adding database connectivity and network usage.
sal
 
Posts: 42
Joined: Thu Aug 19, 2010 4:56 pm

Re: Rubygems

Postby infuzion » Fri Dec 23, 2011 3:59 pm

Oh, OK, cheers.
infuzion
 
Posts: 109
Joined: Tue Jul 13, 2010 11:55 am
Location: Kansas City, USA, Earth, Sol

Re: Rubygems

Postby Embedded » Tue Jan 10, 2012 5:47 pm

Sal - here's the workaround to get Gems working inside FS.
As said before many of the Gems will not work on Windows!

FOR ADVANCED PROGRAMMERS ONLY!!!

Step 1) Install Ruby on your PC

In order for this to work it needs to be a mswin32 compiled version of Ruby not a ming32 version.

Try this: http://www.dsprobotics.com/Files/Ruby192MSwin.zip

Just copy the folder to somewhere on your PC, you can also have the ming32 one installed in a different folder.

Check: Ruby -v

Should say something like: i386-mswin32

Step 2) Create a shortcut on your desktop

Right click - shortcut etc.

Use this string: C:\WINDOWS\system32\cmd.exe /E:ON /K D:\Ruby192MSwin\bin\setrbvars.bat

but remember to modify the path to match your ruby installation.

Step 3) download Install Gem on your system:

Put the downloaded gem in the gem folder: D:\Ruby192MSwin\lib\ruby\gems\1.9.1\gems (using your own path)

then in Ruby:

gem install gemname

You should see the gem install:

Gem Install.png
Gem Install.png (5.55 KiB) Viewed 38152 times


Step 4) Add the new path to FlowStone's ruby

Open FS2 and enter something like this into a Ruby edit module:

$LOAD_PATH << "D:/Ruby192MSwin/lib/ruby/gems/1.9.1/gems/myGemFolder"

Remembering to use / not \

This only has to be done once!

Step 4) Test Gem

Start with a new Ruby Edit module and test if it loads:

ie. require 'MyGemName'

Results: the first time it load you get a result of True, from then on False - both are good it has been loaded!

Ruby Gem Test clip-2.png
Ruby Gem Test clip-2.png (5.39 KiB) Viewed 38152 times


If the loaded gem causes a crash then it is the gem that doesn't work on Windows NOT FlowStone!

Thanks 'DSP' for you help on this..
Embedded
 
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: Rubygems

Postby DSP » Tue Jan 10, 2012 11:22 pm

Embedded - You're welcome, glad I could help...

Also worth mentioning is that gems are all the rage, but on Windows dll's have been doing these things for years.

dlls work perfectly with FlowStone V2 & Ruby on Windows, so if you have any specific need it's probably more reliable to just make a call to the dll.
DSP
 
Posts: 150
Joined: Fri May 14, 2010 10:55 pm

Re: Rubygems

Postby Tronic » Wed Jan 11, 2012 7:25 pm

i have already tested this but for example this simple sock call
Code: Select all
require'socket'
#Socket.ip_address_list
Addrinfo.udp("192.168.0.2", 10001).bind {|s|
  p s.recv(10) #=> "hello"
}

stop the ruby code
""Execessive processing detected...etc.etc"

and even this

require 'Win32API'

Code: Select all
getForegroundWindow = Win32API.new('user32', 'GetForegroundWindow', 'V', 'L')
window_handle = getForegroundWindow.Call()
getWindowText = Win32API.new('user32', 'GetWindowText', 'LP', 'I')
title_buffer = ' ' * 512
getWindowText.Call(window_handle, title_buffer,512)
title_buffer


but the oddity is that, by removing the buffer size, working
getWindowText.Call(window_handle, title_buffer,512)
getWindowText.Call(window_handle, title_buffer)

Code: Select all
getForegroundWindow = Win32API.new('user32', 'GetForegroundWindow', 'V', 'L')
window_handle = getForegroundWindow.Call()
getWindowText = Win32API.new('user32', 'GetWindowText', 'LP', 'I')
title_buffer = ' ' * 512
getWindowText.Call(window_handle, title_buffer)
title_buffer
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Next

Return to General

Who is online

Users browsing this forum: No registered users and 37 guests