Hi There,
We are in the process of building a REST compliant API. The backend is implemented in PHP and we want the interface to follow the convention over configuration motto.
Many of the API consumers will be Rails developers, and following a TDD strategy to building out the API, we've considered using ActiveResource to implement a ...
I hear that WCF is the new standard for communication across the network and applications in .net. The idea seems to make sense as well, provide standard interfaces for programs to communicate.
Here is my situation, I have a .net app i want to communicate to a ruby application though pipes. On the .net side (server) I would like to use ...
I'm trying to make a comment system, identical to the stackoverslow's one. There's a 1-st level comment, and a bunch of a second level comments, attached to it. The first straightforward idea that came up in order to do that, was to create a separate model, sub_comment. But I still got this feeling, that I should inherit the initial comm...
I have model called User with a has_many relationship to UserFilter. UserFilter has a belongs_to relationship to User.
Within the User model I have a method called update_user_filters(filter_params_array)
This method modifies user_filters like something like this
def update_user_filters(filter_params_array)
new_filters = []
old_fi...
This is very strange to me:
irb(main):012:0> "100.7".to_f.modulo(1)
=> 0.700000000000003
Why the 3 at the end?
irb(main):019:0> "10.7".to_f.modulo(1)
=> 0.699999999999999
Same thing here...we are only getting the remainder of this value divided by one. It should be exact.
...
What's the best way to iterate over an array of arrays?
sounds = [ [Name_1, link_1], [Name_2, link_2], [Name_3, link_3], [Name_4, link_4] ]
I want to the output in html ul/li structure
Name_1, link_1
Name_2, link_2
Name_3, link_3
Name_4, link_4
...
So there is
record.new_record?
To check if something is new
I need to check if something is on it's way out.
record = some_magic
record.destroy
record.is_destroyed? # => true
Something like that. I know destroying freezes the object, so frozen? sort of works, but is there something explicitly for this task?
...
I'm working on an IDE for python, ruby and php.
Never having used Smallltalk myself (even it was very popular when I was at university) I wonder if the classic Smalltalk Browser which displays only one method is really an improvment or to classical file editing or not.
I myself like to have the overview of as much as possible in a cla...
Recently, a customer required a complex report with multiple transformations on a large dataset.
I employed Ruport - which is an excellent choice for quick and dirty reporting. However, after a few trials I realized that ruport nested groupings and normalized data don't go together. The choices that now remained included:
Denormalize ...
I consider myself experienced programmer in the sense that I have been working with various different languages and abstractions all the way from asm to object-oriented C++ and object-functionalish Python code.
I'm currently looking for a book about Ruby. The ideal book would assume that the reader already knows how to program some lang...
I have a namespace with different tasks:
namespace :mytest do
task :setup do; ... end;
task :task1 do; ... end;
task :task2 do; ... end;
end
When I run cap mytest I get the task `backup' does not exist.
How do I create a command which calls all tasks?
...
We're starting to think about the next stage of our company information strategy.
At the moment various departments have Delphi VCL applications that focus on the information that they manage about their Projects. Behind the scenes we've been making sure that the thinking joins up.
We're now at the point where we want to give people t...
Is there an easy way to have a rails action load up an external file of commands and then execute them?
For example, I'm trying to write a bunch of rails create methods to pre-populate a bunch of tables in a database.
Ideally, I'd like the action to check for the existence of the file, if it exists, run all of the commands, and then de...
Is there a mechanism for getting a reliable value for the number of active objects in a Ruby environment? I've found several approaches to produce an answer, and typically they resemble:
c = 0
ObjectSpace.each_object { c += 1 }
The unfortunate problem with this is that there's a large number of Fixnum objects created simply to tabu...
I am building a ruby application that grabs emails sent to a server and logs them to a database. Right now I don't have is a way to fully test the (Email -> Ruby -> Database) stack for downtime. I am using services that test the server the ruby is running on for downtime, and i'm using monit to make sure that the ruby daemon doesn't go d...
What is the difference between Marshalling and ActiveRecord Serialization?
Is there any particular occasion when it is preferable to use one over the other to save an object to the database?
...
Coming from a long history of C-style syntax and now trying to learn Ruby (on Rails), I've been having my share of issues with its idioms and such, but today I hit one I didn't expect to have a problem with and I can't see whatever it is that must be right in front of my face.
I have a Binary class that includes a private method to deri...
Hi everyone,
I use vim with various plugins for editing ruby code. I have proper syntax highlighting set up but I was wondering if anyone knew of a way to get ruby syntax checking, similar to what you might see in an IDE such as visual studio, radrails, etc?
Something that would simply turn stuff red or break highlighting when I'm m...
I am loading an arbitrary YAML document, and want to walk every node in the tree. I don't know how nested the tree is beforehand, so I can't just use a simple each statement to walk all the nodes.
Here is how I'm loading the document:
tree = File.open( "#{RAILS_ROOT}/config/locales/es.yml" ){ |yf| YAML::load (yf)}
...
I have a boss who is convinced learning Rails is too steep a learning curve and not cost effective from a labor standpoint when straight Ruby running as a CGI app on Apache is available. He is proposing, for our rewrite, that we use straight Ruby w/ no framework rather than Rails (or Merb, Sinatra, etc.) I believe in my heart that this...