Hi!
My Ruby script:
imap = Net::IMAP.new('imap.gmail.com')
imap.login("[email protected]", password)
I get exception
A connection attempt failed because
the connected party did not properly
respon after a period of time, or
established connection failed because
connected hos has failed to respond. -
connect(2)
What's wrong?
...
I am looking for basic examples of YAML syntax and how to work with it in Ruby.
Basically, by looking at the examples, I hope to better understand how to map YAML scalars to object attributes, and whether to use different YAML files or having one YAML file containing multiple objects.
...
Hi all, in Ruby, there's this awesome library called a Mash which is a Hash but through clever use of missing_method can convert:
object['property']
to
object.property
This is really useful for mocks. Anyone know of a similar kind of thing in Python?
...
Hey,
I have a Rails application that lately is behaving very weird. If I start the server, I can do one successful request, but the next one ends with a failure (exactly the same request). This is not true for all pages, but for most with dynamic contents. When the failure occurs, I get this error:
Processing StartpageController#index ...
I would like to upgrade my 2.3.5 apps to 3.0.
But i want to be careful in doing it. what are the places where i cannot rely on backwards compatibility.
How do i upgrade in one step if possible?
Edit: Thanks anand for the link... I also have another doubt... Is it advisable to upgrade applications that are live?
Is the 3.0 beta stabl...
Hello, I'm trying to get some information from this tutorial: http://m.onkey.org/2008/11/18/ruby-on-rack-2-rack-builder
basically I want to have a file config.ru that tell rack to read the current directory so I can access all the files just like a simple apache server and also read the default root with the index.html file...is there a...
Hi,
I have an array something like this,
arr = [4, 5, 6, 7, 8, 4, 45, 11]
I want a fancy method like
sub_arrays = split (arr, 3)
This should return me [[4, 5, 6], [7,8,4], [45,11]]
...
I have three models each having the following associations
class Model1 < ActiveRecord::Base
has_many :model2s
has_many :model3s
end
class Model2 < ActiveRecord::Base
belongs_to :model1
has_many :model3s, :through => :model1 #will this work... is there any way around this
end
class Model3 < ActiveRecord::Base
belongs_to :model1
has_m...
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)?
Here we use Python, Java and Ruby, and may use other languages as well in the future.
...
I've faced this issue several times. I have a method that adds a
component to a container. Should it return self (this) (for method chaining),
or the component.
The problem arises when the method 'add' might create the component (for
user's convenience). The caller now needs the handle of the component to
call methods on it. I obviously...
I have a CSV file which I'm parsing and inserting bits of it in a database. I'd like to write a parser which takes account of the fact that the column order may change in the future.
I thought that I could do this by grabbing the header line as an array, and for each line, putting the value in a dynamically created local variable (usin...
Controller ClientDocument.
def upload_document
ClientDocument.upload_client_document(params)
end
Model ClientDocument.
Class method..
def self.upload_client_document(params)
self.new :uploaded_data => params[:Filedata],:client_id => params[:client_id]
rename_document_name(params) # Call instance method
end
Instance method..
...
I really love the way the StackExchange family of sites allow someone to log in using their OpenID or OAuth provider, which has been open-sourced as DotNetOpenAuth. This is absolutely wonderful, but I am unable to use it on a *AMP stack.
Is there anything analogous that runs in PHP, Perl, Python or Ruby?
...
Model ..
def self.upload_client_document(params)
client_document = self.new :uploaded_data => params[:Filedata],:client_id => params[:client_id],:document_name => self.default_document_name,:document_description => self.default_description_name
client_document.rename_document_name
client_document.save!
# RAILS_ROOT + client_docu...
I upgraded my ruby to 1.9.2 and now when I try to start up a Rails 2.3.5 app with script/server I get this error:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- script/../config/boot (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/server:2:in `<main>'
...
Right now i am storing files in public folder.
After that i want to upload those file from public folder to another application which providing services for document management.
To upload document to another application.
They provided link, username and password .
Like
http://demo.testltd.com/V12345/search.aspx?username=test1&pa...
I want a one-liner to return true/false, that tests each element in an array for whether it's an Integer or not. So if any element in the array is not an Integer, it should return false, else true. Here's my try:
>> ([2,1,4].map {|x| (x.is_a? Integer)}).reduce {|x, result| x and result}
=> true
>> ([2,"a",4].map {|x| (x.is_a? Integer)})...
Hi,
I've a long text file with some invalidad encoded characters in UTF-16. So far, I've been trying to convert it using the following code:
ic = Iconv.new( 'UTF-8//IGNORE', 'UTF-16' )
urf_8_str = ic.iconv( an_invalid_encoded_utf_16_string )
And I get an Iconv::InvalidCharacter exception.
I'm using OS X 10.6 (since it seems that the...
I'm trying to write out some examples for a Proc that will be passed to a function as a block to be yield'd various values.
I'd like to be able to specify that
given some inputs, it will just return a value to the function
given other values, it will break (or return) a value, skipping the rest of the function's execution.
How can ...
I would like to read the deleted statuses on twitter since i can already have the user_id and status_id of the deleted tatus using "on_delete" method.
here is my code:
require 'rubygems'
require 'tweetstream'
TweetStream::Client.new(USER,PASS).follow(3331681,15846407,30592818,21249843,1367531,428333, 196218494,82158673, :delete ...