ruby

Rails Deployment on Win32 Best Practices: Lighty + Sgci

I've received some really great guidance from users of this site, and I'm thinking some advanced Rails people could assist me in resolving the following problem. I'm attempting to deploy a simple Rails application on a win32 server. I've been carefully working through these instructions (see http://functionalelegant.blogspot.com/2008/0...

Can't run ruby script/console

I get this error when trying ruby script/console "Rails requires RubyGems >= . Please install RubyGems and try again:" I expect this has something to do with the $PATH, however, I don't know what to do? I'm running ruby 1.8.6 and rails 2.3.2. I'd appreciate any help, thanks! ...

'Object' named class in Ruby

Does it have any drawbacks if I use Object as a name for my class inside module? module Some class Object; end end ...

Setup a Capistrano task to only run on deploy, not deploy:cold

I am using craken to run cron processes on my aws machine instance. I have defined the following custom tasks in Capistrano: namespace :craken do desc "Install raketab" task :install, :roles => :cron do set :rails_env, "production" unless exists?(:rails_env) set :env_args, (exists?(:env_args) ? env_args : "app_name=#{applica...

How do I use ffmpeg on a remote machine via ssh

I have three computers on my LAN, one running ubuntu, one running openSuse and my server running Archlinux. I've only managed to get ffmpeg to work properly on my server. I would like to write a script that would pretend to be an ffmpeg installation on the local machine, but would actually just be using the server's ffmpeg. Example...

I get this window while editing Ruby Files in Vim. What is it?

I usually get this new window open up suddenly while I am editing a Ruby file in VIM. This is getting irritating because, i cant type in anything while its processing. And it usually happens arbitarily. Does any one here know which plugin could be doing this? Or is this somekind of VIM's process? ...

How can you do a safe, backwards-compatible "reverse-monkeypatch" in Ruby?

If your coworker "opens" ("monkeypatches") a class in Ruby and redefines some important functionality that you need to use, how do you access that original pre-monkeypatched functionality without breaking a system that already relies/has dependencies on his monkeypatched definitions? ...

Installation problem of Ruby on Rails

I am beginner of Ruby on Rails and use Windows for development. I do the following steps: 1. Download Ruby v.1.9.1 ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.9.1-p0-i386-mswin32.zip Extract it and put it into C:\ruby 2. Download the latest Aptana and install it 3. Install the RadRail plugin in Aptana. 4. Set the ruby path ...

How do I display progress bars from a shell command over ssh.

I've got a script thats supposed to mimic ffmpeg on my local machine, by sending the command of to a remote machine, running it there and then returning the results. (see previous stack*overflow*** question.) #!/usr/bin/env ruby require 'rubygems' require 'net/ssh' require 'net/sftp' require 'highline/import' file = ARGV[ ARGV.index(...

In Ruby, what's the equivalent of Java's technique of limiting access to source in a cowork situation?

In Java when you compile a .java file which defines a class, it creates a .class file. If you provide these class files to your coworkers then they cannot modify your source. You can also bundle all of these class files into a jar file to package it up more neatly and distribute it as a single library. Does Ruby have any features like ...

How can you influence the sequence in which Ruby code is loaded?

Let's say your coworker monkeypatches the Fixnum class and redefines the + method to subtract instead of add: class Fixnum def +(x) self - x end end >> 5 + 3 => 2 Your problem is you want to access the original functionality of the + method. So you drop this code in before his in the same source file. It aliases the + method ...

Uninitialized constant MyClass (NameError) in Ruby

I have a module Shish(which acts like an abstract class) and a visitor class Only_Onions. I want to instantiate Only_Onions in the module Shish so that all the classes extending Shish can use the object to deteremine if they have only__onions. module Shish only_onions_class = Only_Onions.new end class Only_Onions def for_skewe...

does someone know how to show content on screen (covering up any window) using Ruby or Python?

using Ruby or Python, does someone know how to draw on the screen, covering up any other window? Kind of like, press a key, and the program will show current weather or stock quote on the screen (using the whole screen as the canvas), and then press the key again, and everything restores to the same as before? (like Mac OS X's dash boa...

How do I use ActiveResource with a custom URL scheme?

I'm trying to create ActiveResource objects for three objects in an internal application. There are Tags, Taggings, and Taggables: http://tagservice/tags/:tag http://tagservice/taggings/:id http://tagservice/taggables/:type/:key Tag's :tag is the URL-encoded literal tag text. Tagging's :id is an autoincremented integer. Taggable's ...

Print space after each word

Hi, what is an easy/effective way to combine an array of words together with a space in between, but no space before or after? I suppose it is possible to remove the space after combining everything in a loop (something like sum += (term + " "))...I don't like it though. Preferably code in Java, Python, or Ruby. Thanks! ...

Ruby Function with Unlimited Number of Parameters

Hi, How do I create a Ruby function that does not have an explicit number of parameters? More clarification needed? Thanks ...

Rapid Prototyping Twitter Applications?

I'm looking forward to create a bunch of Twitter applications for a website, and was wondering what solution stack worked best when trying to rapidly prototype small twitter applications? Google App Engine + Python/Django? Google App Engine + Java? Heroku + RoR? Good Old LAMP? Also, any recommendations on particular frameworks/librar...

Ruby Definition of Self

Hi, I was reading a Ruby book and came across this definition of the pseudo-variable self: self - receiver object of the current method Could someone break down that definition and explain what it means? I don't understand any of it. EDIT: I actually have a pretty good idea of what self is (and its applications) and I know how t...

Sequel Model set_schema not found

Can any one volunteer why the class below fails? ... src/model/user.rb:18: undefined method `set_schema' for User:Class (NoMethodError) I've looked in the Sequel-3.0 lib/ folder and the set_schema method is defined in a ClassMethods module. I'm sure the solution is simple. I was thinking it should work "as is". Thanks in advance /...

Ruby FTP extremely slow under Windows XP

A couple of weeks ago, I wrote a simple Ruby script to test a couple of FTP commands in a Windows XP environment. Everything worked as expected, and I wasn't even aware of the time taken for the code to run (I'd guess 3-4 seconds at the very most.) A few days ago, a much more involved Ruby application I'm developing started running very...