Scientific modules for Ruby - ruby

I've been using quite a number of Python modules such as Numpy in large machine learning projects. Previously, I used Django for the web application and mod_wsgi as a front end to these. Now, someone is making the case to transfer to Ruby on Rails. Are similar libraries available for Ruby?

As Benjamin Tan pointed out, SciRuby is working on this. Commenters rightly noted that not much work has been done on the sciruby gem, but NMatrix is under extremely active development. The goal is to replace NArray.
There are also quite a few stable gems associated with SciRuby: Statsample, distribution, minimization, integration, Rubyvis (a Ruby port of Protovis), and so on.
SciRuby actually just got Google Summer of Code support, too, and a grant from the Ruby Association a few months ago, so we're hopeful that it will go places.
Full disclosure: I'm one of the lead developers for NMatrix and a co-founder of the SciRuby project.

The closest would be SciRuby.

Related

How do I easily and cleanly update ruby 1.9 to the latest version on Windows Server 2008 r2

Full disclosure. I do not use Ruby. I never have even looked into learning it as a language.
We use ruby at our company to power an integration between a couple of our tools. Due to a TLS update we have to update our ruby version from 1.9.2 to the newest version.
On this windows server 2008 r2 machine I have that version of ruby and need to update. The problem is this tool is in constant use. So I cannot reasonably take the server down for a whole day while I try to figure out what to do. Initial research shows that these older versions of ruby are problematic to update.
I have only a half dozen gems to worry about (and found a really good guide on updating those - I think).
Looking for a kind soul who is willing to help a lost soul.
Is this a case of needing to completely uninstall and if so does that mean uninstall my gems as well? Or can I just run an update via cmd?
This is mostly going to come down to your gem dependencies.
As for just the language, the odds of encountering anything that works with Ruby 1.9.3, but not Ruby 2.0+ will be highly unlikely. Plenty of features have been added, but on a whole, backwards compatibility has been maintained.
This is not necessarily the case with gems, as the dependencies and robustness of the code can vary wildly depending on the source. The only real way to answer anything with confidence is to check/compare dependencies of each gem you require with your target Ruby version. Typically increasing the Ruby version is less likely to "break" anything than lowering it obviously, but it is still a significantly plausible scenario you must be wary of and prepare against.
The only real way to do this without downtime is to clone or setup a new environment for testing, install the newer Ruby, install the required gems you have researched dependencies, and test to make sure everything runs/works as expected.
Unfortunately there is no "magic bullet" here that is going to solve this issue for you. Luckily, the vast majority of this does not require knowledge of Ruby syntax and coding, and if everything goes well, will require nothing more than installing Ruby, installing gems, and comparing versions. If you run into issues with specific gems, I am confident that there is a host of people here on SO that can help guide you through reconciling it.

Sample Ruby Application

I'm going to learn Ruby to use Ruby on Rails in future to look for new horizons. I've read a lot about Ruby, but... I doesn't found any real applications that are built with Ruby? For Mac I've found only CLI apps.
Does anyone have use cases for pure (and popular) Ruby applications?
Try googling for "ruby code for applications"
I found this:
http://www.fincher.org/tips/Languages/Ruby/
If your ultimate goal is Rails applications, I would learn that at the same time (that search is easy too. Many folks start with the famous hartl tutorials and Ryan Bates Railscasts), particularly to get experience with the miriad conventions that you need to know to write good rails apps. If you got good at ruby first you could end up writing a lot of code in rails apps... that could be written for you via rails conventions and external gems.
I would advise you to learn both stacks simultaneously. The ruby you need for bread and butter work on Rails is not that complicated. Furthermore Rails is very centered on the framework itself. Unless you need to write your own GEMs (plugins) you will not dive too deeply into the ruby part.
A good start for Rails are the courses mentioned here:
http://rubyonrails.org/screencasts
For specialized knowledge I can only emphasize Ryan's Railscasts listed there.
For books I recommend the Galileo Computing "Ruby on Rails" books. For Rails 2 there is a free version online. For 3.x, which you prpbably want to use, you have to buy it.
I would recomend Ruby Best Practices, good guide how to build applications.

Is there an English version of the Ruby Hacking Guide?

As far as I can tell, a complete English translation of the Ruby Hacking Guide does not exist. I find this unbelievable given the fact that it was originally written in 2004. Of course, a few attempts have been made:
The RubyForge project is ostensibly the most official, but even a cursory look through the mailing list archives reveals that it has low traffic and is more or less dead.
C. E. Thornton also took a stab at translating it, calling his version the Integrated Ruby Hacker's Guide. While substantial, it too is incomplete: the "blue" chapters are machine translated.
This site gives the most thorough background that I could find.
My questions are as follows.
Does anyone know if there is another significant English translation of the Ruby Hacking Guide available?
Is there an active translation effort in progress?
Even if someone were to produce an English version of the Ruby Hacking Guide, would it still be relevant?
Apart from the Ruby Hacking Guide, what is the best resource for English-speaking developers who want to work on/understand Ruby internals?
The most important stuff is already translated in your links. Ruby has changed a lot since 2004, especially with 1.9. It would be better to write a new Ruby Hacking Guide instead of translating the old one.
I read a lot of books about Ruby but the Dave Thomas' screencast was by far the best on understanding the ruby fundamentals.
http://pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming
There is always the option to read the original source code of Ruby. A good alternative is the source code of http://rubini.us/ as most of it is already in Ruby.
http://ruby-hacking-guide.github.io had its translation completed in September 2013.
The site is based on https://github.com/ruby-hacking-guide/ruby-hacking-guide.github.com . Some minor changes have been made since September 2013.

Ruby GUI (non-complex layouts)

I've done quite a bit of research on Ruby GUI design, and it appears to be the one area where Ruby tends to be behind the curve. I've explored the options of MonkeyBars, wxRuby, fxRuby, Shoes, etc. and was just wanted to get some input from the Ruby community.
While they're definitely usable, the development on each seems to have fallen off. There is not a great deal of useful documentation or user bases that I could find on any (minus the fxRuby book). I'm just looking to make a simple GUI, so I don't really want to spend hundreds of hours learning the intricacies of the more complex tools or attempt to use something that is no longer even being developed (Shoes is the type of application I'm looking for, but it's extremely buggy and not being actively developed.) Out of all of the options, which would you guys recommend as being the quickest to pick up and that still has some sort of development base?
Thanks!
I don't know what you mean by Shoes being extremely buggy. It works perfectly fine for building your own little application :-)
Yes there are problems with shoes3 and packaging/installer. However the community is one of the nicest I ever saw. Always nice and helpful figuring out problems. You can reach the mailing list at shoes#librelist.com.
If you're looking for basic information Nobody Knows Shoes and the shoes manual are your best friends.
However we are currently working on shoes 4 - which is a complete rewrite having multiple backends in mind - first backend being jruby/swt
So I would definitely recommend shoes :-)
Shoes on!
I've been looking at similar needs and am considering picking up a javascript gui library like Dojo or Sproutcore; or using JRuby + Netbeans for a Java based GUI.
For me, Aptana was a nice environment to start trying the javascript libraries to test the pain starting the learning curve. I'm still trying to find time to finsh my comparison.
http://en.wikibooks.org/wiki/Ruby_Programming/GUI_Toolkit_Modules
might help
limelight looks interesting
You might try:
DialogBlocks to create an XRC file using wxWidgets / wxRuby
xrcise - to create a ruby file to load the XRC
I am faced with the task of writing many small GUI's and a few
that are complicated. The above has worked for me. While the
above works on Windows, I can only vouch for the Linux implementations
which work very nicely.
FYI: DialogBlocks will run you about $100. It will create C++
or XRC files. It is also good at switching platforms. I think
there's a demo version.
My version info:
ruby 1.9.1p243
wxWidgets 2.8.10
wxRuby 2.0.1
DialogBlocks 4.28
wx_sugar 0.1.22 (for xrcise)

Ruby off the rails

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
Sometimes it feels that my company is the only company in the world using Ruby but not Ruby on Rails, to the point that Rails has almost become synonymous with Ruby.
I'm sure this isn't really true, but it'd be fun to hear some stories about non-Rails Ruby usage out there.
One of the huge benefits of Ruby is the ability to create DSLs very easily. Ruby allows you to create "business rules" in a natural language way that is usually easy enough for a business analyst to use. Many Ruby apps outside of web development exist for this purpose.
I highly recommend Googling "ruby dsl" for some excellent reading, but I would like to leave you with one post in particular. Russ Olsen wrote a two part blog post on DSLs. I saw him give a presentation on DSLs and it was very good. I highly recommend reading these posts.
I also found this excellent presentation on Ruby DSLs by Obie Fernandez. Highly recommended reading!
I use Ruby extensively in my work, and none of it is Rails (or even web) based.
My domain is usually client-side Windows applications (wxRuby GUI) and scripts, automating Excel, Internet Explorer, SQL Server queries and report generation (win32ole COM automation). I also use the sqlite, pdf-writer, and gruff libraries for various data munging and graph generation tasks.
Rails' success has been great for Ruby, but I agree that Rails has received so much attention that Ruby's value beyond the web is often overlooked.
We are mainly a C++ shop, but we've found several areas where Ruby has proven quite useful. Here are a few:
Code Generation - Built several DSLs to generate C++/Java/C# code from single input files
Build Support
scripts to generate Makefiles for unix from Visual Studio Project Files
scripts for building projects and formatting the output for Cruise Control
scripts for running our unit tests and formatting the output for Cruise Control
scripts for manipulating Visual Studio projects and solutions from the command line
Integration Tests - We can crank out tests much quicker and cleaner using Ruby than C++
QA's entire testing suite is written in Ruby
Ruby is basically my go to tool for where it makes sense. And it makes sense in a lot of places.
Google Sketchup uses Ruby as an embedded scripting language. You can use it to perform all sorts of 3d modeling and import/export tasks. The scripting works with the free version and there's even decent documentation.
Ruby with a homebrew extension written in C++ does all the heavy pixel pushing for my photography processing. I was using Python+numpy but when doing artsy stuff, Ruby is just more fun. Also the relative lack of, or lesser maturity of, good image processing libraries makes me feel less like i'm reinventing wheels. I am clueless about Rails, other than i've heard of it, have a fuzzy idea what it is, and actually have a book on it (unopened)
We use Watir (Ruby library) to test our .net web application.
Check out Shoes, a simple API for building GUIs in Ruby aimed at novice programmers.
Or you could use Ruby to make music ala Giles Bowkett's Archaeopteryx. This presentation by Giles about Archaeopteryx is one of the best presentations ever. I highly recommend it.
RubyCocoa and MacRuby. Possible to make full Cocoa-based GUI apps without Rails. And then you get to use Interface Builder, too.
I worked on a museum project last year that used a lot of Ruby. (http://http://ourspace.tepapa.com/home)
The part that I spent most of my time on was an interactive floor map. The Map on the floor has sensors so when people walk on it lights are triggered and displays in the wall show images or videos and audio tracks are played.
All the control code for this part of the exhibit is ruby. I wrote C interfaces with ruby wrappers to communicate with the floor sensors and the lighting controllers. The system queries a MYSQL database for the media files to be displayed and then tells computers in the walls to play the media via UDP.
It's the most reliable part of the entire exhibit.
Ruby was used for the other major part of the exhibit, the Wall though I didn't have much to do with that. Most of the graphics were prototyped in ruby using interfaces to OpenGL, a bit of Cocoa and a physics library before being ported to pure Obj-C.
Puppet and Chef: DevOps
I didn't see a mention of Puppet or Chef in the 30 answers that preceded my arrival. Ruby appears to dominate current work in cloud automation and is the base, extension, and templating language of these two big players. They are used primarily to distribute system and application configuration information for server arrays and for general IT workstation management.
The DevOps field is quite Ruby-aware. Today, Perl has a competitor. While a really simple script may often still be written directly for sh(1), a complex task now might be done in Ruby rather than Perl.
The only site I've done with Ruby at work is using Rails, but I'd like to try Merb.
Other than that I do a lot of little utility programs in Ruby - for instance an app that reads RSS feeds and imports new posts into a dabase.
It's fun, so I also write some dumb stuff just because it's so quick. Yesterday I wrote an app to play the Monty Hall problem 100,000 times to help a friend convince her professor that switching is the correct strategy.
I almost take insult that ruby is a rails thing. It is like back when CGI was the latest trend and everyone figured that if you knew perl you must be doing it only because you programmed CGI apps. Ruby is just a scripting language for me, although not as mature as python so I somewhat regret having to jump through some of its hoops and recent changes, I still like it and use it. Although I work in a java shop and therefore groovy is the ideal choice for a scripting language, I still use ruby at home and for throw away scripts that aren't needed to be shared at work.
I was considering getting into RoR from all the buzz and how quick/simple it is, but after looking over rails I didn't see anything at all that was amazing or even the least bit innovative or rapidly fast about its development compared to any other framework. The only benefit I saw was that I could code in ruby, which would be nice, but initial setup, server maintenance and scaling is more difficult, thus re-offsetting the pleasure of coding in ruby.
I created a presentation -- coincidentally named Off The Rails -- to discuss Rack-based web applications:
https://github.com/alexch/Off-The-Rails
The git repo includes slides in Markdown format and sample code (in the form of running applications and middleware). Here's the abstract:
Ruby on Rails is the most popular web application framework for Ruby. But it's not the only one! If you think Rails is too big, or too opinionated, or too anything, you might be happy to learn about the new generation of so-called microframeworks built on Rack. And since Rails 3 is itself a Rack app, you don't have to give up Rails to get the benefit of Sinatra routes or Grape APIs.
And here are some references:
This talk lives at https://github.com/alexch/off-the-rails
Yehuda's #10 Favorite Thing About Ruby
Rack
rack-test
rack-client
Sinatra
Grape
Vegas
Siesta
Rerun
Hope you find it useful!
I'm mostly a Web developer, and I learned Ruby to use Rails, but I like the language so much that I started developing a desktop Swing application in Ruby, using JRuby and Monkeybars. I'm competent in Java, but don't much like using it, and the Swing API is horrible, so putting Ruby on top has been a big win.
We mainly use rails, but we have plenty of other non-rails ruby things - for example a standalone authentication daemon thing for centralized authentication of users, and an 'image processing server' which runs arbitrary numbers of ruby processes to process images in parallel.
Oh, and don't forget good old Rake :-)
Ruby is also used for Desktop application. Especially the use of JRuby to develop Swing desktop application.
I've used Ruby at work for
A data extractor, generating csv files from binary output.
A .ini file generator, turning a simple syntax into a repetitive .ini format.
A simple TCP/IP server, acting as stand-in for the customer's system during testing.
We use Ruby to implement our test automation software. This includes test framework and driver code for Selenium RC, WATIR and AutoIT.
Ruby is powerful enough to create comprehensive applications that can interface with Test tools like Selenium or WATIR, while at the same time reading from data files, interacting with a remote Windows UI and performing near transparent network communication. All while running on Windows or Linux.
The uncluttered syntax makes it ideal for new and inexperienced programmers to read. While its totally OO nature makes it easy for these same programmers to apply good (recently learned) OO techniques, from the start.
The flexible nature of Ruby's syntax also makes the use and creation of DSLs much easier. This allows less-technical people to get invovled, read and possibly create there own tests.
I have used Ruby for code generation of C# and T-SQL stored procedures in a project with unstable requirements. The data model was encoded in a YAML file and .erb templates were used for the classes and stored procedures. It also allowed for a much more DRY solution than would have been possible with straight C# as repetitve code could be factored out into a single method in the code generator.
Where I work, we use Ruby to do a number of different one-off type batch jobs. One example of that is a job that interacts with Amazon's S3 service. At the time, the Ruby S3 library was probably the easiest one out there for us to get up and running in a short amount of time.
I wrote an order processing expert system (see DSL answer as well), converted 100k lines of customer specific perl into about 10k lines of ruby handling dozens of customers. No web components at all, no Rails.
I am a webdriver user. ruby is used by webdriver for automating the build process thanks to rake. see http://code.google.com/p/webdriver/ for details
Heh, great question.
I used Ruby to convert Excel spreadsheet airport facility data to sqlite3 for the android phone platform while making an app for pilots.
I use Ruby with Sinatra which is much simpler than Rails. I did use Rails but just found that it has turned into a bit of a monster, although Rails is still amazing compared to web frameworks available for Java.
The main feature of Ruby that I love however is "eval" and "method_missing", which Rails actually uses for example in ActiveRecord so that you can use the amazing "find_by-field-name-" queries.
I used Ruby for a lot of back-end code simply because I was the only person who was tasked to do it and needed a nice clean language that allowed me to be very productive and write easy to maintain code. I find Ruby allows me to do that easier than Perl and Python. Other people's mileage might vary on that but it works well for me.
Besides that, I like how Sequel and Nokogiri work. I also used ActiveRecord for a while separately from Rails.
We use some Ruby for file manipulation but have not been able to incorporate rails yet.
I've used Ruby a lot professionally for quick scripts for things like shuffling files around. I'm the same way in that I was using Ruby first before touching Rails at all.
In Boulder there was an excellent group of Ruby users who met monthly. This point was made - that Ruby does have an existence beside its use in Rails. Plain Ruby users do exist, are begging for attention, have neat things to show, and can find each other at user group meetings.
They also had better pizza than the Python group, who met also the same day of the month. Can only pick one...
While we do have several Rails apps at work, we also use Ruby for some fairly intensive non-web stuff.
We've got an SMS delivery daemon, which pulls messages from a queue and then delivers them, and credit card processing daemon which other apps can call out to, which makes sure there's a central audit trail.

Resources