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
FS & Custom Ruby Installation
9 posts
• Page 1 of 1
FS & Custom Ruby Installation
. . .Oh Ruby, show me your delights. Do not obscure from me, for I am one with you. . .
Ahhh ok I want to start a thread here which goes into the topic of using custom Ruby source in FS apps.
Based on this thread: http://www.dsprobotics.com/support/viewtopic.php?f=2&t=941
So for my first endeavor I want to make a FS exe that connects to the net using Ruby's standard net/http libraries. Which will then, from inside the app, connect to a webpage & parse the html.
The second journey for us would be to use the EZCrypt gem & encrypt a string inside Ruby.
Let's start at no.1 shall we?
My understanding is that to get the net/http libraries included in Ruby, you need to compile your own Ruby source.
So I followed digitalwhitebyte's advice:
All compiled 'n snug in a bug in a rug with a . . .you get the point
So I load up FS, make a Ruby module and type:
Grrrr. . .Ruby isnt playing nice here! Its saying the socket.so file isnt compatible. So I find the socket.so file in my compiled Ruby & place it in the FS lib folder.
Aw damn! Now Ruby is telling me: uninitialized constant Encoding::UTF_7
Google search returns some info but mostly side shoots rather than trunks
but ahah! something glistening in the wet dark google search . . . .
hmm so it seems that Encoding::UTF_7 is used in openssl. Ive checked my libs for that but its not in the compiled folder of Ruby.
Has anyone used this before?
Are there easier ways. . . gems????
Ahhh ok I want to start a thread here which goes into the topic of using custom Ruby source in FS apps.
Based on this thread: http://www.dsprobotics.com/support/viewtopic.php?f=2&t=941
So for my first endeavor I want to make a FS exe that connects to the net using Ruby's standard net/http libraries. Which will then, from inside the app, connect to a webpage & parse the html.
The second journey for us would be to use the EZCrypt gem & encrypt a string inside Ruby.
Let's start at no.1 shall we?
My understanding is that to get the net/http libraries included in Ruby, you need to compile your own Ruby source.
So I followed digitalwhitebyte's advice:
Get the source zip from the download page,
After downloaded unzip it locally to say c:\ruby-src
Open CMD prompt, but make sure you run it as administrator,
run vcvars32.bat, you can locate it in your MSV folder like <MSV path>\VC\bin
Make a folder for your build say c:\ruby-build. Move into it / change dir
c:\ruby-build> c:\ruby-1.9.3-p0\win32\configure.bat
c:\ruby-build> nmake
c:\ruby-build> nmake test
c:\ruby-build> nmake DESTDIR=c:/ruby-build install
To use them, then you can simply link them like
$LOAD_PATH << "C:/ruby-build/usr/lib/ruby/1.9.1"
$LOAD_PATH << "C:/ruby-build/usr/lib/ruby/1.9.1/i386-mswin32_90"
All compiled 'n snug in a bug in a rug with a . . .you get the point
So I load up FS, make a Ruby module and type:
$LOAD_PATH << "C:/ruby-build/usr/lib/ruby/1.9.1/i386-mswin32_90"
reuire 'net/http'
Grrrr. . .Ruby isnt playing nice here! Its saying the socket.so file isnt compatible. So I find the socket.so file in my compiled Ruby & place it in the FS lib folder.
Aw damn! Now Ruby is telling me: uninitialized constant Encoding::UTF_7
Google search returns some info but mostly side shoots rather than trunks
but ahah! something glistening in the wet dark google search . . . .
Problem: You encounter an error reading NameError: uninitialized constant Something or NameError: uninitialized constant Object::Something (with various class names in place of Something).
Solution: You've most likely referred to a class or module that doesn't exist. Most likely, you've forgotten to require a gem or library needed for the code to work, or you've made a typo. Another possibility is that the class you'd like to refer to is in another module. If that's the case, you'll have to refer to it with its full name as in the following code.
#!/usr/bin/env ruby
module MyModule
class MyClass; end
end
c = MyModule::MyClass.new
hmm so it seems that Encoding::UTF_7 is used in openssl. Ive checked my libs for that but its not in the compiled folder of Ruby.
Has anyone used this before?
Are there easier ways. . . gems????
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: FS & Custom Ruby Installation
what error you have when compiled the source?
-
digitalwhitebyte - Posts: 106
- Joined: Sat Jul 31, 2010 10:20 am
Re: FS & Custom Ruby Installation
omg thank you Dwb!
Well i noticed that when I compiled
When it came to installing openssl, it just said failed! I cant remember if it gave a reason. . .
Am I doing this correctly? To say that the "$LOAD_PATH. . . " line tells Ruby to look into that folder for files too?
Well i noticed that when I compiled
c:\ruby-build> nmake
When it came to installing openssl, it just said failed! I cant remember if it gave a reason. . .
Am I doing this correctly? To say that the "$LOAD_PATH. . . " line tells Ruby to look into that folder for files too?
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: FS & Custom Ruby Installation
sorry but I did not understand, you were able to compile the source?
-
digitalwhitebyte - Posts: 106
- Joined: Sat Jul 31, 2010 10:20 am
Re: FS & Custom Ruby Installation
Yeah it compiled fine, just not with the openssl libs.
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: FS & Custom Ruby Installation
Ok, now to install rubygems there are still two libraries to compile, yaml and zlib from source,
a bit complex to do.
I try to tidy up the procedure and ready as soon as I add it to the original post.
however this is done,
every time you install a rubygem will always have to launch the file vcvars32.bat first before giving in the console, the command to install the gems.
and verify that the environment variables in the PATH variable there is the path of the ruby that you compiled.
this need because some gems is compiled from C code,
and ruby need to know the paths of the compiler in use on the system.
but keep in mind that they did all this, some gems will not be able to function,
because the code will turn off if a thread takes too long to finish its execution.
especially with executions of code to use web connections, they use a socket that is executed in a loop running,
it definitely will block the ruby code.
a bit complex to do.
I try to tidy up the procedure and ready as soon as I add it to the original post.
however this is done,
every time you install a rubygem will always have to launch the file vcvars32.bat first before giving in the console, the command to install the gems.
and verify that the environment variables in the PATH variable there is the path of the ruby that you compiled.
this need because some gems is compiled from C code,
and ruby need to know the paths of the compiler in use on the system.
but keep in mind that they did all this, some gems will not be able to function,
because the code will turn off if a thread takes too long to finish its execution.
especially with executions of code to use web connections, they use a socket that is executed in a loop running,
it definitely will block the ruby code.
-
digitalwhitebyte - Posts: 106
- Joined: Sat Jul 31, 2010 10:20 am
Re: FS & Custom Ruby Installation
especially with executions of code to use web connections, they use a socket that is executed in a loop running,
it definitely will block the ruby code.
So basically network & Ruby is out the window?
- Drnkhobo
- Posts: 312
- Joined: Sun Aug 19, 2012 7:13 pm
- Location: ZA
Re: FS & Custom Ruby Installation
can not use anything that has a thread that does not end in a period of time imposed by Malc to judge that a ruby execution is blocked.
all this because at the end of ruby does not run in a multithreaded environment.
all this because at the end of ruby does not run in a multithreaded environment.
-
digitalwhitebyte - Posts: 106
- Joined: Sat Jul 31, 2010 10:20 am
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 101 guests