How can I use the QtConcurrent Qt module in Ruby?
I'm developing a small app that uses Qt (through the qtbindings binary gem) in Windows (Ruby 1.9.3 mingw-32) but I couldn't find a way to use threads (or use simple concurrent methods calls).
Any help and any example would be very helpful.
Thanks in advance.
I have a feeling that its no different than PyQt4, where QtConcurrent is not available because they can't easily wrap it. If its not being built with your Ruby bindings, its probably not available. You would need to stick to QThread and its siblings.
Related
I'm wondering if an Iron Ruby class/object can be used in a native ruby interpreter(irb) driven class(using a gem sort of a thing) ? The main problem is that I have a ruby class that is using some gems(Ex: nokogiri) which are not compatible with Iron Ruby and Iron Ruby class is using .Net libraries. So in short, I want to know if there are any ways to communicate with iron ruby classes in native ruby. If there are any alternatives to solve this, please do mention them.
No other way than having two different processes for each ruby interpreter running with some kind of communication. You could use distributed ruby for that. Anyway, the best thing to do is to not use .Net libraries and replace them with something else from ruby world.
I'm using Windows.
Is there a Ruby Way to make a dll call? I want to use the GetAsyncKeyState() function.
Haven't been a Windows user in a long time, but there's a Win32API library. Maybe this article helps:
http://www.rubytips.org/2008/05/13/accessing-windows-api-from-ruby-using-win32api-library/
You might want to look at the WIN32OLE library, or the DL library. They are designed for DLL access and Windows programing in Ruby. (NOTE: Although the librarys work, dynamic C access from Ruby does not seem to be an easy task, so use them only for sparse calls to the API. A Win32 program will do better in C, C++, C#, or .NET)
You may want to give FFI a look. It provides a fairly seamless interface to native libraries.
I'm thinking of writing a basic Ruby debugger (interactive). Can you direct me to some resources or projects to learn more from?
A simple introduction into debuggers: http://t-a-w.blogspot.com/2007/03/how-to-code-debuggers.html. It even has a small part using ruby hashes as an example.
I guess you mean a Ruby debugger implemented in Ruby. A good place to start would be to take a look at the introspection and reflection interfaces documented here
If you want to be a bit more adventurous you could look at the source for ruby-debug
I'm sorry if this question is noob-ish but I'm not having much luck with Google. Can Ruby be used for UI based Windows apps? I'm not looking for a Rails app, just Ruby.
Thanks
You have couple of options.
Use Gtk Ruby which works on Windows as well (http://ruby-gnome2.sourceforge.jp/).
You can use WxRuby or Tk.
You can use JRuby and Swing.In fact there are high level libraries which can help you there, such as (http://monkeybars.rubyforge.org/)
Yes, but the experience will vary depending on how you hook up the UI. TK or gtk, wxRuby, ruby shoes (not sure how alive that one is right now), Qt (which is cool) and fox (aka fxRuby) are some of the options. If you like to hurt yourself, you can hook directly to Win32 libraries, but I doubt you'll want to.
Additionally, if you target the nascent IronRuby, you can use WinForms or WPF.
I also prefer wxRuby. It looks great, uses native components, yet is cross-platform. On the Ruby On Windows blog there is a great write-up of how to get started. It helped me a lot.
You bet. wxRuby is what I use, but others use GTK. wxRuby also works on Linux which is where I am writing a program, but it should suit your needs. You can install it using
gem install wxruby
You could check out wxRuby..
Depends what kind of Window app are you going to implement. If this is your own pet project, then definitely you can try WxRuby or GTK. There is no risk here.
However if this is going to be serious, commercial windows app then you have to think twice. It is really worth using Ruby? It is great language. I use it on daily basis. But for a Windows app, C# integration with the whole environment is hard to beat.
check out Shoooes!
This question already has answers here:
How to run untrusted Ruby code inside a safe sandbox?
(4 answers)
Closed 8 years ago.
I've found that there WAS a sandbox gem (created by the guys that made try ruby in your browser but it was compatible only with Ruby 1.8. Another problem is that I cannot find it anymore (it seems they stop serving the gem from the servers...).
So, is there any secure way of running ruby in a sandbox (so you can run it from your browser)?
Or an easy way to run (for example lua/python) in a sandbox (no filesystem access, no creation of objects etc) and be called from Ruby (Rails 2.2)?
I want to make an application like try_ruby even without having a ruby underneath. But it has to be an easy language (I saw there was a prolog in ruby, even a lisp but I don't think they are easy to learn languages...).
So, do you have any suggestions or tips? Or should I just start creating my own DSL in Ruby (if there is a solution in creating a somewhat safe system)?
Thx
I am developing an implementation of a sandbox for ruby based on a modification of the ruby interpreter written in C, I have released recently a functional version of the gem called shikashi (rdoc documentation).
You should try embedding JRuby in the browser.
http://ruby-in-browser.googlecode.com/svn/trunk/evalruby/index.html
The guy who wrote the original gem disappeared, Keyser Söze style:
http://www.rubyinside.com/why-the-lucky-stiff-is-missing-2278.html
I've read that the JRuby gem is more current or maintained, but I've found it buggy so far. Here are some setup instructions:
http://flouri.sh/2009/4/4/how-to-set-up-the-jruby-sandbox
Overall, it looks like Ruby is lacking a solid implementation of this right now :(
I came across This article on hackety.org(dead link) this morning. Maybe it can serve you as a guide into the right direction
Another way is like codepad.org does it (VM isolation and checking the calls)
I am not sure if you want to run any language in a sandbox. But I found that JavaScript has been running as a sandbox language for a long time. The ruby racer project lets you embed the v8 engine in ruby. Hope that helps.