ruby

I'm a .NET Programmer. What are specific uses of Python and/or Ruby for that will make me more productive?

I recall when I first read Pragmatic Programmer that they suggested using scripting languages to make you a more productive programmer. I am in a quandary putting this into practice. I want to know specific ways that using Python or Ruby can make me a more productive .NET developer. One specific way per answer, and even better if you ...

Django-like framework on Ruby?

Django as a framework is a neat little package. There are very few files (compared to Rails) and it's got a clean structure. The fact that you can plug and unplug apps between different projects is an extremely nifty feature. At the same time, Ruby's hacking ability is unparalleled. It's complete object-orientedness makes it more express...

The last 20% in Ruby on Rails

I am (quite) an experienced programmer but totally new to Ruby and Ruby on Rails. RoR looks great to get working quickly, specially the automatic screen generation for CRUD operations. It really it gets you productive quickly. The questions is with the last 20% of the work, when I must finish my application. Won't RoR conventions stan...

Calling Rubygem tmail from Dreamhost CRONjob

I have a cron job to run a Ruby script, which runs fine on the command line (from user "user"), but the cron fails because it cannot find a ruby gem TMail. I manually installed the tmail gem to my ~/.gems/ dir, pointed to by my ~/.bashrc script, as suggested by Nate. When invoked manually from the shell (on deadpool server) ./home/...

Rails Authlogic and GeoRuby conflict?

I have a problem with GeoRuby conflicting with Authlogic. I set up a very simple application that only lets me register and log in and out useing Authlogic. This works fine. Then I added GeoRuby to the application and I get the error: wrong number of arguments (1 for 2) when the current_user is called in the view. I'm quite new to...

What is the best way to obfuscate/minify dynamically generated javascript

I am looking to obfuscate and minify dynamically written javascript with ruby. Does anyone have any suggestions? Some kind of apache module that would intercept the .js file and obfuscate it before it was served would be ideal. ...

Find Apache Directory

I'm looking for a way to programatically detect the location of the Apache config directory, and the name of the configuration file. Bonus points if this is in Ruby or Bash. ...

Can I aim for TDD or BDD in my started project?

I have decided to give a try to TDD and BDD on my already started project, encouraged by answers to questions like this: http://stackoverflow.com/questions/294909/should-i-start-using-tdd-on-a-project-that-doesnt-use-it-already I am struggling to really start with it. My project (opensource, hosted in http://gitorious.org/rubots) is gam...

Why do Ruby developers appear not to use UML?

I always hear about UML being used in Java projects but never in Ruby ones. Is this just a cultural difference or is there less of a need for modeling in Ruby development because it's part of a more 'agile' culture? ...

Windows telnet + controlling local echo from remote

Hello, I have the same problem as http://stackoverflow.com/questions/1098503/how-to-unsupress-local-echo but none of the solutions in that thread are desirable. Specifically, I'm using telnet for communication with a simply Ruby program that requires authentication to connect remotely. When the user is prompted for a password I want to ...

Is there an add_days in ruby datetime?

In C#, There is a method AddDays([number of days]) in DateTime class. Is there any kind of method like this in ruby? ...

Cucumber & test data management for non-Ruby apps

I'm testing an app that's basically a message-handling application - a message comes in, it's content is analysed, then it's sent somewhere else for processing. The app isn't built in Ruby. As you might imagine, the main testing approah consists of generating a whole bunch of different types of (quite complex) messages, loading them in...

Can you eval code in the context of a caller in Ruby?

Essentially I'm wondering if the following can be done in Ruby. So for example: def bar(symbol) # magic code goes here, it outputs "a = 100" end def foo a = 100 bar(:a) end ...

Given a ruby script how to figure out what it depends on?

I want to distribute a ruby script to many of my friends, because it's useful. But how do I know what else they might have to install? I mean at the top of the script, there is this: require 'rubygems' # require 'activerecord' #TODO: figure out what packages this depends on require 'activesupport' # require 'duration' # Tha...

Rails Rake: How to pass in arguments to a task with :environment

So I am able to pass in arguments as follows desc "Testing args" task: :hello, :user, :message do |t, args| args.with_defaults(:message => "Thanks for logging on") puts "Hello #{args[:user]}. #{:message}" end I am also able to load the current environment for a Rails application desc "Testing environment" task: :hello => :environ...

[Ruby] open-uri + hpricot & nokogiri don't parse html correctly

I'm trying to parse a webpage using open-uri + hpricot but it seems to be a problem in the parsing proccess as the gems don't bring me the things I want. Specifically I want to get this div (whose id is 'pasajes') in this url: http://www.despegar.com.ar I write this code: require 'nokogiri' require 'hpricot' require 'open-uri' docu...

Snow Leopard + Ruby 1.9.1 + MySQL Gem = Huge problems

I tried for about 3-4 hours trying to get the mysql gem to install for ruby 1.9.1 on snow leopard. The mysql gem used to work just fine on 1.9.1 before I upgraded to snow leopard. I uninstalled MySQL server and gem from my machine. I then downloaded and installed: mysql-5.1.37-osx10.5-x86_64.dmg. I have been able to assert that this ...

Ruby soap4r build headers

Hi, Again with the soap. I am trying to build a header using soap4r that is supposed to look like this <SOAP-ENV:Header> <ns1:UserAuthentication SOAP-ENV:mustUnderstand="1" SOAP-ENV:actor="http://api.affiliatewindow.com"&gt; <ns1:iId>*****</ns1:iId> <ns1:sPassword>*****</ns1:sPassword> <ns1:sType>affiliate</ ns1:sType> </...

How to get the 'th' and 'rd' on a date?

strftime('%A, %B %d') Will output Monday, August 31 Any way to get it to do Monday, August 31st? ...

How do you assign new variable names when its already assigned to something? Ruby

The title really really doesn't explain things. My situation is that I would like to read a file and put the contents into a hash. Now, I want to make it clever, I want to create a loop that opens every file in a directory and put it into a hash. Problem is I don't know how to assign a name relative to the file name. eg: hash={} Dir.g...