Ruby Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesRuby Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old July 7th, 2007, 11:01 PM
babygodzilla babygodzilla is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 197 babygodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 28 m 35 sec
Reputation Power: 5
A couple questions about Ruby on Rails

what is Rake? i dont understand what the use of it is. say I have already made a RoR app, it's all done and ready to go. i can just so script/server, and boom its running. what is the use of Rake tho? i understand that it's to "deploy" the app... but... what does that mean...?




another question, say my app gives you random polls, 1 at a time. if there is no user-based system, how do u prevent people from voting twice in one poll in Ruby, at least while the browser is still open. meaning if you close the browser, clear the cache, and open a new browser (or i guess just clear the cache in general), you could technically vote for the same poll again.

Reply With Quote
  #2  
Old July 8th, 2007, 11:00 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,430 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 21 h 41 m 55 sec
Reputation Power: 784
Rake is a program (written in ruby!) which can be used to build other ruby programs. It does this by reading a special file called a Rakefile, which contains a set of different tasks to do.

Among other things, you can do:
1. Generate documentation for your app (rake appdoc)
2. Create a test database from your dev. database (rake clone_structure_to_test)
3. Run unit tests (rake test_units) or functional tests (run test_functional) or all tests (rake)
4. Give you stats on your code (rake stats)
etc.

If you want to see the list of things you can do with your standard Rakefile, simply type:
rake --tasks
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month

Reply With Quote
  #3  
Old July 8th, 2007, 11:07 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,430 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 21 h 41 m 55 sec
Reputation Power: 784
As for your second question, there is no real way to prevent people from voting twice, aside from asking for some very personal information AND verifying that the personal information is valid, before letting the person vote. Even then, there is no way to prevent an identity thief from stealing personal information from someone else and then voting a second time.

There are a few ways you can prevent some obvious ballot stuffing.
1. Post processing after the fact. For instance, you could record the time, browser, IP address etc. of the voter. If too many votes for a particular choice are coming from the same IP address at around the same time, then it would be pretty easy to pick this up and discount all the extra votes.
2. Asking the user to register with their email first before they can vote (and disallowing registration from free webmail services like yahoo/gmail/hotmail etc.)

Reply With Quote
  #4  
Old July 9th, 2007, 10:39 AM
babygodzilla babygodzilla is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 197 babygodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 28 m 35 sec
Reputation Power: 5
ah i see. what about cookies, or sessions? i don't really know how either of those work, but can either be used for this purpose. can i send a cookie to the client every time he casts a vote on a poll, and check if the client has a certain cookie or not? how do u even check for cookies..

Reply With Quote
  #5  
Old July 9th, 2007, 11:15 AM
Oler1s Oler1s is online now
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2006
Posts: 1,477 Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Oler1s User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Weeks 13 h 21 m 32 sec
Reputation Power: 426
“Security” and “depending on the user” do not go together. Cookies are a terrible idea for that reason. They are stored on the client’s computer. Obviously, the client can delete them at his whim.

You’ll find sessions to be no better. They are just a way of tracking information about a user such as what page on a website he is on and so forth. Session systems commonly involve cookies. You may try to complicate it by checking the session with a table of IPs and so on. But then it’s practical to not even have a session system, and just log IP addresses. Trying to detect fraud by IP addresses isn’t very secure. You’ll find too many false positives (router/proxy on a large block of users) and too many false negatives (proxied connections).
__________________
C/C++: Books, C FAQ, C++ FAQ, C/C++ Reference.
Python: Website, Beautiful Soup.

Reply With Quote
  #6  
Old July 10th, 2007, 01:52 PM
babygodzilla babygodzilla is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 197 babygodzilla User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 28 m 35 sec
Reputation Power: 5
Quote:
Originally Posted by Oler1s
“Security” and “depending on the user” do not go together. Cookies are a terrible idea for that reason. They are stored on the client’s computer. Obviously, the client can delete them at his whim.

You’ll find sessions to be no better. They are just a way of tracking information about a user such as what page on a website he is on and so forth. Session systems commonly involve cookies. You may try to complicate it by checking the session with a table of IPs and so on. But then it’s practical to not even have a session system, and just log IP addresses. Trying to detect fraud by IP addresses isn’t very secure. You’ll find too many false positives (router/proxy on a large block of users) and too many false negatives (proxied connections).



I see. Well the use of cookies for my purposes is not for security. It's just to prevent from over-voting, cause that'll just ruin the fun.



Say, has anyone tried to use RadRails?


I just downloaded Aptana RadRails, and I tried to do two things:

1) I created a new project and added an existing project into RadRails. When I tried to run it, I got this:

Code:

/script/../config/boot.rb:18:in `require’: No such file to load—rubygems (LoadError) from ./script/../config/boot.rb:18 from ./script/server:2:in `require’ from ./script/server:2 from -e:4:in `load’ from -e:4 


Gem is installed on my machine for sure, version 0.9.2. I can’t figure out what’s wrong. I have the Rails, Rake, and Ruby configuration all correct (or at least I think I do). I am on Mac OSX 10.4.9, with Ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1]

2) Probably related to the first question: when I do a fresh Rails Project, I check the “Generate Rails application skeleton” option, and hit finish. After that, I check out the freshly created project, and WHAM! it’s empty. No structure, no folders, no files, no nothing. Probably because it couldn’t find the gems?

No idea, completely clueless. Please help! Thanks!

Reply With Quote
  #7  
Old July 24th, 2007, 08:44 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 362 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 35 m 16 sec
Reputation Power: 4
Did you install RubyGems? Your install should have been: Ruby --> RubyGems --> Rails Gem.

As for RadRails; I've never used it on Mac (TextMate FTW!) but I've toyed with it on Windows. I seem to have liked the old RadRails better than the new Aptana IDE.

as for over-voteing; Have you seen the acts_as_rateable plugin? Instead of using sessions or cookies to account for voting it uses the user_id table from the database. For every rating it stores a user_id and a object_id. If the user tries to vote again the app sees his user_id in the ratings table and instead of adding another vote it simple overwrites the old vote.

-Amir
__________________
I have summoned you here for a purpose

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesRuby Programming > A couple questions about Ruby on Rails


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway