I am writing plugins for Google SketchUp using their Ruby API. One of the common problems we (SketchUp scripters) have is that when a script is performing intensive operations it locks up the SketchUp UI and there is no way to see the progress of the current process.
What I would like to do is call the new Taskbar API in Windows7 in a h...
How may i fetch next and before current element from array while iterating array with each.
array.each do |a|
# I want to fetch next and before current element.
end
...
I am using the great Tequila-JSON Parser ( http://github.com/inem/tequila ) in an Web-application, to render more or less complex JSON server-replies. More and more the JSON-Templates (.jazz) are growing in somehow real "views". I am trying now, to get an instance-variable from the according controller, into the .jazz template, but this ...
I have a very simple Ruby program that acts as an "echo server". When you connect to it via telnet any text you type is echoed back. That part is working. If I add a 'putc' statement to also print each received character on the console running the program only the very first character displayed is printed. After that it continues to echo...
So I'm creating a Rails app that will function as a directory for contact information in our organization. But it's not as simple as it sounds.
We have a large LDAP-enabled directory which contains information for all of the users in our organization of tens of thousands.
We have a smaller, separate LDAP-enabled directory which contain...
The meaning of most nodes from mri's syntax tree can be easily infered. However the list is quite long (source: bin/parse_tree_abc):
:attrasgn, :attrset, :dasgn_curr, :iasgn, :lasgn, :masgn,
:and, :case, :else, :if, :iter, :or, :rescue, :until, :when, :while,
:call, :fcall, :super, :vcall, :yield,
:args, :argscat, :array, :begin, :block...
This is my string:
msgid """We couldn't set up that account, sorry. Please try again, or contact an ""admin (link is above)."
I want to remove all the double quotes except the first and last one.
How may I do that?
...
Is it true that in most cases, in Ruby, it is best to use &&, || instead of and, or, unless it is some special situations.
I think one of Ruby's design principles is to have least surprises as possible, so using and, or or actually have some surprises... such as and not having a higher precedence than or, while && has a higher precedenc...
I'm having a lot of trouble with Ruby after coming back to it from a long break.
I'm getting a lot of 'unexpected kEND' errors, and I've tracked it down to lines below. I'm not having trouble with a particular piece of code, but rather, the concept of 'unexpected kEND' .
if (condition)
do-one-line-thing()
and
# inside of a loop....
Hello, sorry for my english,
I have a model named Recipe and Recipe has an attribute named duration
In my form, I have 2 dropdowns to get duration attribute
select_tag 'duration[hours]'
select_tag 'duration[minutes]'
I need the value of duration attribute like this format hh:mm:ss
I have tried with
def duration=(d)
self.duration...
What I've done so far..
sudo gem install scrapi
sudo gem install tidy
This didn't work because it didn't have the libtidy.dylib
So I did this :
sudo port install tidy
sudo cp libtidy.dylib /Library/Ruby/Gems/1.8/gems/scrapi-1.2.0/lib/tidy/libtidy.dylib
Then I started following the simple railscast at : http://media.railscasts.co...
Is there a way to display Active Record results in table format in the script/console environment?
...
Hello, I am having problems with Ruby Telnet API. More specifically, the login command. My code is as follows:
options["Name"] ||= 'anonymous'
options["Password"] ||= '******'
@connection.login( options, &block )
And the output...
Trying 10.160.52.63...
Connected to 10.160.52.63.
login: a
...and then I get a T...
I am trying to update a string attribute in the database.
I tried using update_attribute but it isn't working. It works for integer attributes but not for String attributes.
How do i solve this ?
EDIT
code example:
@post = Post.find(params[:post_id])
@comment = @post.comments.create!(params[:comment])
@comment.update_attribute(:comm...
Let us say there are two gems
A ( depends on gem C version 2)
B ( depends on gem C version 1)
My rails application requires gem A, and B.
How do you handle the collision of two versions of the gem C while loading A and B.
...
Hi guyes,
what is the best way to make such deep check:
{:a => 1, :b => {:c => 2, :f => 3, :d => 4}}.include?({:b => {:c => 2, :f => 3}}) #=> true
thanks
...
I'm trying to get Custom Routes working in my Rails application (Ruby 1.9.2 with Rails 3).
This is my config/routes.rb file
match '/dashboard' => 'home#dashboard', :as => 'user_root'
devise_for :user do
get "/login", :to => "devise/sessions#new" # Add a custom sign in route for user sign in
get "/logout", :to => "devise/sessions#...
Hi,
I'm building an app in Rails 3. I currently have a user model which is authenticated via devise (email + password auth). I want to be able to show connect to facebook, connect to twitter buttons to the users once they are logged in.
After obtaining the keys from Facebook and Twitter, I'd want to store it in the database for futur...
I'm currently working on a large, highly trafficked Ruby on Rails website and in order to get our page load times down, we are looking at spriting our background images. There seem to be a lot of tools out there but many are in the early stages of dev and many don't support some of the features we need.
Features which are important to ...
I am trying to install the has_calendar plugin, and it says that is successfully installing. However, when I have a page with code the plugin should execute, I am returned errors of undefined functions.
Is there somewhere I need to reference the plugin as a helper?
Here the sample code, straight off the wiki page.
<%= calendar :year =...