ruby

Installing ruby using RVM fails, without trace...

Ok, I installed RVM. I tested using: type rvm | head -n1 The output: "rvm is a function". So far so good. Then I tried: rvm install 1.8.7-p302 All went smoothly, but then: $ ruby -v The program 'ruby' is currently not installed. You can install it by typing: sudo apt-get install ruby RVM says all went fine through the install....

Ruby or Python instead of PHP?

I'm considering learning a new language as an alternative to PHP. I'm considering Python and Ruby. Which one is a better language based on the following four criteria, and any other qualifiers you may have? Which is more stable? Which is more scaleable? Which is more secure? Which is easier to learn? EDIT: Keeping the original quest...

How-To Implement Cross-Browser @font-face Support in rails

I am developing a small rails app to serve fonts to other sites say a request http://url/fonts/fontname will return woff,eot or ttf font based on the browser type. This app is working fine in my localhost but not in other ip... I know the problem is something to do with Cross-Origin Resource Sharing restriction but don't know how to so...

Ruby vs Python when building high performance webapp

Hello there I'm building a high performance webapp, it needs a) good team scaling i.e. new team member needs to be able to quickly get started b) good app scaling, so the request load can grow I was thinking between RoR and ruby + postgres vs Python and some framework; I would like to avoid windows server administration and also I had...

Command - R like functionality in MacVim

I'm on a Mac and when I am in TextMate editing a ruby file I can simply hit Command-R to execute the file and see the results in a new window. Is there something similar to this using MacVim? It's really important that I be able to open up a NEW window. Reason is because in the current window I might have more than one full page of info...

Passenger Rack app 'cannot infer basepath'

I have a simple config.ru file for my Sinatra app. require 'sinatra' require 'app' run Sinatra::Application However, Passenger is failing with the error no such file to load -- app. I've tried using the 1.9 method require_relative but that now causes the error cannot infer basepath. I'm currently using the very hacky require File.jo...

Cannot Install Ruby Gems 1.3.7 on Mac OSX 10.6.4

I am following the instructions at http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard to install ruby 1.9.2 and rubygems 1.3.7 Everything goes smoothly until I get to the "Compile and Install RubyGems" part and enter the command line: sudo /usr/local/bin/ruby setup.rb This continually returns the followin...

Converting non-Latin characters (bulgarian) to ASCII with Stringex

It looks like converting Cyrillic is specifically suited for the Russian language, however in a Bulgarian context it sounds funny. For example: "голем проблем" is converted to "goliem-probliem" :) Can I change how some of the characters are converted? ...

Help me find out why new and build method doesnt work

Hello, I have problem with my associations. I have n:n relation and everything going good but if i want initialize new object and then save it, it will by save with out associations. For example. Models: class User has_many :users_in_organizations, :class_name => 'UserInOrganization' has_many :organizations,:through => :users_in_o...

Rails RESTful controllers vs. view specific controllers

This design question needs a bit of context, so please bear with me. I currently have three models that go something like this: class MyItem < ActiveRecordBase has_many :my_list_items ... class MyList < ActiveRecordBase has_many :my_list_items has_many :my_items, :through => :my_list_items ... class MyListItem < ...

Underline in Ruby Report

Hey all, I'm trying a very simple thing here in Ruport but I don't seem able to get it working. All I want is underline a part of a text. I already have the substring that I want to underline, because i thought <u></u> would do the trick (<i> and <b> work) Anybody got a working solution for this? Thanks! ...

Low-overhead Ruby profiling?

I have a Ruby program that takes about 4 minutes to complete task and I'd like to get it down to under 1 minute. I tried ruby-prof from gem but enabling it increases running times to ~30 minutes, and doesn't even seem to preserve monotonicity particularly well (some changes reliably improve performance-with-profiler and as reliably dete...

How do I create a view that is aware of full route. (Rails 3)

How can I design my view such that it "remembers" its route? So that "Back" on /team/1/members/1 links to /team/1/members and /members/1 links back to /members? I have models of team and member. Teams have many members. My routes allow me to view all member or members on a team. resources :teams do resources :members end re...

ActiveRecord > MySQL Adapter > undefined method `more_results'

I have incorporated ActiveRecord into a script I am writing to process some data in a MySQL database. In my development environment, using Mac OS X, everything works fine, however, when I attempt to deploy the script in a Linux environment, I keep getting the following error: /activerecord-3.0.0/lib/active_record/connection_adapters/mys...

How do I run ruby commands in my bash script without getting "ruby: command not found"

my script= #!/bin/bash echo ************************BEGIN LOG******************************>>/root/backup_scripts/new_scripts/vmbackup.log 2>&1 date +"%m/%d/%Y %H:%M:%S $HOSTNAME">>/root/backup_scripts/new_scripts/vmbackup.log 2>&1 ruby /root/backup_scripts/new_scripts/aapxen01.rb>>/root/backup_scripts/new_scripts/vmbackup.log 2>&1 rub...

Accessing an array within a hash - Ruby

Hello, I'm writing an application that pulls values out of an excel spreadsheet and then stores those values in a hash using the version number as a key. Everything seems to be working correctly until I try and retrieve the information from the hash. Here is the code that builds the hash. @version_numbers.each do |version| user_var...

Can I use Capistrano from a windows dev setup to deploy to a Linux server?

Can I use Capistrano from a windows dev machine to deploy to a Linux server? This is for a rails app. ...

I want to search for a given word in a line of text with ruby.

Hi everyone, I want to find a given word in a line of text through a regular expression, but the search should not just look for the whole word, but also instances where the word is prefix or sufix, or inside other words. For example (I'm not very creative with examples.. but it should get the point): Look for green in "I live in everg...

multiple paperclip attachements with watermark processor

Hi guys! I'm having a ton of trouble with uploading multiple attachments with paperclip and processing them with a watermark. I have 2 models, Ad and Photo. The Ad has_many :photos and the Photo belongs_to :ad. To be more exact in /models/ad.rb I have: class Ad < ActiveRecord::Base has_many :photos, :dependent => :destroy accep...

ruby twitter api :uninitialized constant Twitter::HTTPAuth (NameError)

require 'rubygems' require 'twitter' httpauth = Twitter::HTTPAuth.new('myusername', 'mypassword') client = Twitter::Base.new(httpauth) It is throwing : uninitialized constant Twitter::HTTPAuth (NameError) i have "twitter" in my gem list, i dotn understand where is the problem ...