i was writing a script on Windows Vista to move the files in a folder to another hard drive, but found that Ruby 1.8.6 or 1.9 both would get back filenames with Unicode characters in it replaced by "??????"
so for example, the filename "Chart for ???????.doc" is returned
so the file cannot be moved at all...
i used
filename.each_byt...
I read from some books that Phusion Passenger is the answer to easy Ruby on Rails deployment. But my friend said that first there was Apache + bunch of Mongrels, and then lighttpd, and then nginx, and now Passenger, and it seems endless...
he also said he uses dreamhost which uses Passenger, and sometimes he sees his request not being ...
I'd like to run a basic asynchronous job
exec('curl -0 '+url)
from a sinatra app,
I've tried to do that with fork and detach but it seems bogus.
(I'm on windows)
...
In my Ruby program, I'm trying to lazy-load a library (crack for the curious).
If I do this:
require 'rubygems'
require 'crack'
Everything is working fine. However, when I try this:
require 'rubygems'
autoload :Crack, 'crack'
A LoadError is raised. (no such file to load -- crack)
Why is this error being raised? Is it because 'cra...
When I run
gem install <somegem>
command the gem utility tries to access my home directory. It contains some non-latin characters and installation fails because of that. For example:
E:\ruby\bin>gem install <somegem>
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - C:\Documents and Settings\<user>
I...
I'm trying to convert a column in my Rails app, for arguments sake let's pretend I'm trying to change the age column in my users table to a string representation rather than an int.
In my migration I have this;
def.self up
add_column :users, :age_text, :string
users = User.find(:all)
users.each do |u|
u.age_text = ...
when starting Ruby on Rails programming, I will use
rails first
rails second
and try out things in these "first" and "second" projects
but as they get more mature i want to check them into SVN and develop further, so can i rename them into
"superapp"
or
"web30"
and check into SVN and develop further without any side effects? I...
I am having trouble with Openx; here is the issue
OpenX::Services::Base.connection returns the class variable @@connection which is populated by OpenX::Services::Base.connection if it has previously not been initialized.
The problem with it being a class variable is that it persists across connections, which means if there is a lull i...
I am working on a project using Ruby on Rails and I need to monitor web requests to generate traffic analytics (hits, unique visitors etc), but I have been instructed that using an external service, such as Google Analytics, is unacceptable (don't ask me why, I may break down and cry).
I can however, use a plug in or anything else which...
I do not have a Mac, or an iPhone. However, the concept of taking C and making it more dynamic towards the idea of smalltalk, python or ruby is really attractive to me. I'd love to start on objective C.
Is objective C just a syntax superset of C or is it really like C. As in, can it be compiled with gcc etc..?
I do most of my program...
I want to access a given Requests ServerVariables, but I can't seem to find anything on Google on how to get access to the Server Vars of the request object. How do I do this or am I doomed to simply never know?
An example of why I'd want to do this (but not actually what I want to do):
User logs in, and you want to store the IP addres...
The situation
I have a simple model with an attached image using paperclip, which has a couple of processed styles for it (thumbnail, full, feature). At this point it works as it should, and makes a directory structure for each object in /public/assets/foo/, containing subdirectories for original, thumbnail, full, and feature.
The prob...
Hi guys i am using a dropdownlist which have the value please specify other, when that value is selected in prompts out a textfield which has the value please specify other, but for the user to type in anything in the textfield he has to delete the value manually..i am looking for a code which can delete the value automatically when the ...
I want to create a test DNS server in ruby, but could not find anything suitable. I found pnet-dns(http://rubyforge.org/projects/pnet-dns/). This project is incomplete and buggy. Is there any alternative?
...
I have a list of Fruit structs called basket. Each Fruit struct has a name (a string) and a calories (an integer). I would like to sort basket so that:
The Fruits with the highest calories appear first. For example, a fruit with 500 calories appears before a fruit with 400 calories.
If two Fruits have equal calories, the Fruit whose na...
Is there a Ruby library for Amazon's SimpleDB that can generate joins from Ruby classes? For example, if you define Ruby classes for Game and Ball, and each Game has one Ball, code should be generated that queries for the appropriate Ball given an instance of Game, much in the way ActiveRecord works.
RightAWS is the most popular Ruby A...
I'm having trouble diagnosing a problem I'm having on my ubuntu scalr/ec2 production environment.
The trouble is apparently randomly, database queries and/or memcache queries will take MUCH longer than they should. I've seen a simple select statement take 130ms or a Memcache fetch take 65ms! It can happen a handful of times per request,...
Right now I have
def min(array,starting,ending)
minimum = starting
for i in starting+1 ..ending
if array[i]<array[minimum]
minimum = i
end
end
return minimum
end
Is there a better "implementation" in Ruby? This one still looks c-ish.
Thanks.
...
When I sort an Array using the native sort method, which algorithm does RUBY decide to use? Is it data-dependant (i.e If the data is small it uses X algorithm else uses Y algorithm)? Is it a stable sort? What is the average time complexity?
...
In python we can use multiprocessing modules.
If there is a similar library in Perl and Ruby, would you teach it?
I would appreciate it if you can include a brief sample.
...