similar to: Quick Question: Random item from array

Displaying 20 results from an estimated 10000 matches similar to: "Quick Question: Random item from array"

2006 Mar 22
3
Which JavaScript effect is this?
http://canadaonrails.com/ (when you hover over news and events) I''ve seen this implemented on a few rails sites now and I was just wondering if it is just a simple javascript from the prototype library. Does anybody know of any links on how to do this? Thanks in advance! -- Posted via http://www.ruby-forum.com/.
2006 Jun 01
7
Active Record Basics - Making it commentable
hi everyone, I hope someone can help me out with some active record basics? I''ve been banging my head for the past 4 hours and I can''t seem to get it to work. I am trying to add comments to a caption (just like how one adds a comment to a post in a blog). I seem to be able to read posts just fine from the DB, however, I can''t use the "recordComment"
2006 Jul 04
1
Quick question: Iterate through a collection - no duplicates
Hi, is there a simple way to iterate through collection and not include duplicates? Thanks in advance. Jordan -- Posted via http://www.ruby-forum.com/.
2006 Jun 03
6
Calculating row COUNTs
hi everyone, I''m trying to do a simple calculation in my rails project. I would like to find all rows in a table that match the given id of another table (ie. comment_id) and has the value = 1 ("value" is a field in the table), then add those values up. Next find the same rows with the value = -1 and add those values up also. Finally, I would like to find the total.
2006 Feb 14
6
Creating a String of Random Characters and Numbers
I want to create a random string of length n that is made up of characters and integers. Is there a function in rails or ruby that allows me to do this? Thank you my friend :-). John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net
2005 Dec 18
2
Could someone host my 1mb rails app??
Hi Everyone, Would someone be able to do a huge favor for me and host a very small 1mb rails app for me?? I can''t get my hosting up and running yet and I really need it up and running by today for my professor to check it off. I only need it up for about two weeks. You will get a lot of karma points for it :) Thanks in advance!! Jordan -- Posted via http://www.ruby-forum.com/.
2006 May 11
9
Undoing a SHA1
Hello for my password recovery system I want to recover the users password and send it to them. In the DB its saved via SHA1 (login generator) -- Posted via http://www.ruby-forum.com/.
2007 Jun 19
3
another issue with highlighting
Hi, I''m encountering another highlighting issue. (about the first one "range search and highlighting", i received no response. I don''t even know if somebody tried to reproduce and/or if it''s normal behavior) about the new issue, an example will be easier for you to reproduce: I''m filling an index with random data, i try to match for "*1*"
2007 Nov 20
9
Testing Models without fixtures
Hi, I would like to test a sorting method that is in the user model, it''s a class method called search. What I would like to do is create 2 users and load the test database with just those 2 users, so that I can call User.search("john") and it would return those two users. Not sure how to clear the test database and populate it just with these 2 users for that specific
2006 May 29
3
Timer for executing events
Hi Everyone, I hope you guys can help me out. What is the best way to go about using a timer to execute events? I would like to execute a block of code every 24 hours (or at midnight - server time). Is this possible? What I am trying to get at is that I would like to create a new page every 24 hours and have that serve as my front page. Is it possible to route to this ''new
2004 Mar 30
1
classification with nnet: handling unequal class sizes
I hope this question is adequate for this list I use the nnet code from V&R p. 348: The very nice and general function CVnn2() to choose the number of hidden units and the amount of weight decay by an inner cross-validation- with a slight modification to use it for classification (see below). My data has 2 classes with unequal size: 45 observations for classI and 116 obs. for classII With
2006 May 30
4
Hide parent element
I have some code that calls a partial to display one or more blocks within a div tag. I want to have a close button (or cancel link) that will fade that block but leave the others. Here is the code: LINK: <%= link_to_remote "Add Miscellaneous Link", :url => { :action => :add_iyc_link } %> add_iyc_link.rjs: page.insert_html :bottom, ''links'', :partial
2006 Jun 08
5
Displaying Calculation on Index
Hi, I am trying to create a simple point system and display the total on my index page. So I have my db basically setup like this: Posts id, body, created_at, user_id Post_points id, post_id, user_id, created_at, value So as you can see I am allowing other users to create points on the post and my db will store who gave the point as well. "value" is the point value which can
2008 Dec 13
2
Need Help in converting php encryption decryption code to ruby on rails
Hi guys i found this encryption decryption in php and try to convert it in rails but i am unable to successfully convert it. So plz help me. I you write the whole conversion code then it will be great. PHP code is like this ================ # #/********************************************** #** #** MD5 block cypher #** #** Author..: leapinglangoor [
2005 Dec 18
5
restarting fastCGI process
Hi, I am very new to this so please go easy on me... I am trying to deploy my app on dreamhost and I seem to be having problems getting it working. One of the troubleshooting items on the wiki states: Rails apps in production mode do not reflect changes made after they start running. So, if you found a bug, fixed it and nothing appeared to happen--this is probably because you
2007 Dec 11
2
Patch 10463: has_many through using uniq does not honor order
Hi, I''ve just submitted a patch for ActiveRecord; http://dev.rubyonrails.org/ticket/10463 The patch includes new fixtures because I could not find a applicable combination among the existing fixtures. I hope that''s okee. Please +1 or comment it. Thanks, Remco --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the
2008 Dec 04
2
Ruby fun with MegaMillions
I thought I would write a lottery number generator since I have not had any luck winning the big jackpot - http://megamillions.com/. So far, after over 1.2 million tries, I still have not hit all the numbers from yesterday: 2, 17, 22, 32, 51, 35 (last one is the mega ball). Fun little project that and I thought others would be interested. Let me know if you have a cleaner implementation in mind.
2007 Nov 29
3
Strange Array behaviour
I''m having a strange thing when using the Enumerable extensions for Rails: Have a look at the following code: class Invoice < ActiveRecord::Base has_many :invoice_lines def total invoice_lines.sum(&:total) end end class InvoiceLine < ActiveRecord::Base belongs_to :invoice def total amount * price end end Now, when calling invoice.total, I get wrong
2006 Jun 23
2
Storing Array in Database
Hey all, I''m storing an array of timestamps in a field in my database as an array. When the items get saved, however, some minus signs are appended to the text: sample output: --- - 1151971200 - 1152576000 - 1153180800 - 1153785600 - 1154390400 Is this normal behavior? When I retrive the value out of the database and .to_a, the three minus signs (---) are counted as the first
2006 Jan 21
1
Sortable Element with Partials?
Hi Everyone, I posted this last month and unfortunately, I didn''t recieve any replies. Maybe this time I''ll have better luck. I originally had my sortable element list working properly like so: <ul id="sortable_list"> <% @items.each do |item| %> <li id="item_<%= item.id %>"><%= image_tag "dragme.gif"