Ok, I am new to rails so I hope I explain this well. I seem to have a problem with a form collecting the proper information. Work in one spot and not another. Here is the situation.
I have created a blog with three tables, posts, comments, and votes. I have comments working correctly and votes working partially. Here is what I mean.
...
I've got an array in Ruby that essentially represents a square boolean matrix. Dots represent zeroes, while any other character represents ones. Example:
irb(main):044:0> g
=> [".b", "m."] # This grid has two '1' values and two '0' values.
I'd like to perform a specified logical operation (say, OR) on this array with another similar a...
I need to make a script to read images from a directory, rename them, resize them to a MAX_HEIGHT, MAX_WIDTH, put a watermark logo and save them in JPG.
I was thinking on doing this with an interpreted language, like Ruby, PHP, Perl, Python, or any with the image manipulation capabilities.
Which language would you recommend for this?
...
What is the fastest, one-liner/shortest way to get an Array of "strings/that/are/paths" from an XML file, using Nokogiri preferably. I'd like to build the array with an arbitrary attribute name ('id' in this case), but also knowing how to do it for the element name would be helpful.
So this:
<root id="top">
<nodeA id="almost_top"...
What are the drawbacks of using the content/data model of a blog like Blogger or Wordpress to store all of your information and then just having it redirect you to your "real" website? I'm wondering if it's a bad idea to setup a blog and just read/write from it but render it in a completely different project, so I don't have to recreate...
I've got the following models:
An Invoice has several statuses: Initially it's "draft", then it can be "sent", and "payed"
An Invoice has_many InvoiceLines. InvoiceLines have a text and a cost.
My question is: How can I perform the following validations?
If the Invoice Status is not draft:
No InvoiceLines can be added to it
The va...
is it possible to say output the current consumption of CPU and memory in ruby script ?rub
i am trying to find memory leaks in my jruby sript.
CPU usage keeps going up to 100% until it crashes.
...
Hi
I'm generating a lot of XMPP stanzas, and want to validate them against the specs available here in my unit tests.
At the moment I am using Nokogiri to achieve this with something like
xml = Nokogiri::XML( xmpp_stanza)
schema = Nokogiri::XML::Schema( xmpp_schema )
assert schema.valid?( xml )
Now this works fine except it gets...
hi
I have ran gem install rails and am running 2.3.4
but i am missing some rake tasks like 'db' and 'gems'
if i run rake -T i get the following tasks. How can i get all the others ?
rake apache2 # Build Apache 2 module
rake clean # Remove compiled files
rake clobber # Remove all generated
files
rake default # Bu...
What's the best way of doing this:
mail = "[email protected]"
mail2 = mail.do_magic
# puts mail2 will return "[email protected]"
I'm thinking regex of course, but is there another cool way? If not, how should I do it using regexp?
...
I'm in a databases course and the instructor wants us to develop an e-commerce app. She said we can use any framework we like, and now that we're halfway through the semester she decided that Rails does too much and wants me to explicitly write my SQL queries.
So, what I'd like to do is to write my own functions and add them to the mode...
I am new to rails so go easy on me. I have built a blog and I am attempting to add a "vote up" type feature to the /posts/index.html.erb page. Kind of like Facebooks's like feature. I have can successfully get the vote form to work. I have successfully been able to get the posts rendererd out through the <% @posts.each do |post| %> call....
I am new to rails so go easy. I have built my first blog and would like to set it up such that in the <% post.each do |post| %> render of the posts, I would like it to work such that it only displays 10 posts and then has a link to view the next 10.
I am hoping this is an easy question. Let me know if you would like me to post any code...
I am new to rails so go easy. I have created a blog with the ability to "vote" on a post by using a feature much like Facebook's "like". I am not using any authentication but would like to restrict voting on a particular post by IP. That is, once someone votes for a post, they cannot vote again (unless they reset their router of course)....
I have an issue with manipulating large number of record objects of type ActiveRecord model(Records are extracted from a complex operation but from the same table) and I want to pass that object set around between controller actions. So I have couple of solutions but is wage about which way to choose. Simpler but uglier solution is to sa...
I am new to Rails so go easy. I have created a blog and also created the ability for users to indicate they "like" a particular post. The way I am implementing this is by using the post table and a separate table 'vote'. When the user clicks the "like" button it sends the record to the 'vote' table with a value of '1' and the particular ...
I want to be able to do this:
def asdf():
print __method__
"asdf"
Thanks,
Noah
...
I'm developing a software in Ruby on Rails that saves information about documents that requires fisical signatures. The idea is do it all digital including the signature. How could I do that? Do I have to save a hash in the database?
EDIT:
Well, I mean Digital Signature
...
I've used ASP.NET and now I'm working on a Sinatra/MongoDB app. With ASP.NET architecture, the connection to the database a given request uses comes from a pool of connections that the ADO.NET manages. The connections are kept alive in the pool between requests so that the cost of building and tearing down the connection isn't paid f...
For example, when these tests are run, I want to ensure that test_fizz always runs first.
require 'test/unit'
class FooTest < Test::Unit::TestCase
def test_fizz
puts "Running fizz"
assert true
end
def test_bar
puts "Running bar"
assert true
end
end
Update: Why do I want to do this? My ...