DISQUS

DISQUS Hello!  The comments on this profile are unclaimed and thus are unverified.

Do they belong to you? Claim these comments.

Ana's picture

Unregistered

Feeds

aliases

  • Ana

Ana

5 months ago

in Cooler on e168f08
Off-topic, did anyone else rsvp to that 4-week rails class at sermo that John forwarded a few days ago? I haven't heard anything back and was wondering if anyone knows if it's actually happening.

5 months ago

in Cooler on e168f08
Rakefile not getting packaged?
Hi, I am trying to rake package to submit but for some reason the rakefile isn't getting packaged up. It seems to be the only file that's missing. The weird thing is, it's in the package directory but it's not in the .zip. (I'm using the zip_in_ruby script that came with metricsmine)
1 reply
xertroyt's picture
xertroyt Strange.

The e168:submit task uses the standard rake package target, so it should be grabbing the Rakefile normally.

I just verified the e168:submit task, but I'm on a Mac.

Just ZIP up your project with any tool -- or, if you like, use the e168:submit task and zip up the Rakefile separately.

5 months ago

in Cooler on e168f08
Fantastic, thanks!

5 months ago

in Cooler on e168f08
Quick question about links/routes/atom feeds:

I'm exposing an atom feed for a user at the url: http://localhost:3000/posts/feed/username.atom

In my posts controller:
def feed
@user = User.find_by_login(params[:id])
@posts = @user.posts.find(:all, :order => :created_at).reverse
respond_to do |format|
format.html
format.atom
end
end

Now in the html I want to put in an link tag using <%= auto_discovery_link_tag :atom, {:controller=>:posts, :action=>:feed, :id=>@user.login }, {} %>

But that gives me
http://localhost:3000/posts/feed/username
instead of
http://localhost:3000/posts/feed/username.atom

Is there any way I can get the suffix in there?
1 reply
Keith auto_discovery_link_tag :atom, { :controller => :posts, :action => :feed, :id => @user.login, :format => :atom } %>

6 months ago

in Screencast - RestfulAuthentication - 1 on e168f08
Hey, I solved my problem by adding a couple of options to config.action_mailer.smtp_settings:

:tls => 'true',
:domain => 'gmail.com',
1 reply
Rachel I'm having a similar issue: 530 5.7.0 Must issue a STARTTLS command first. k44sm41710024rnd.1

C:/Ruby/lib/ruby/1.8/net/smtp.rb:576:in `auth_plain'
C:/Ruby/lib/ruby/1.8/net/smtp.rb:570:in `__send__'
C:/Ruby/lib/ruby/1.8/net/smtp.rb:570:in `authenticate'
C:/Ruby/lib/ruby/1.8/net/smtp.rb:410:in `do_start'
C:/Ruby/lib/ruby/1.8/net/smtp.rb:377:in `start'
C:/Ruby/lib/ruby/1.8/net/smtp.rb:315:in `start'
C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:628:in `perform_delivery_smtp'
C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `__send__'
C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `deliver!'
C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:383:in `method_missing'
app/models/user_observer.rb:3:in `after_create'
app/controllers/users_controller.rb:18:in `create'

Code from my environment.rb file:
Rails::Initializer.run do |config|
config.active_record.observers = :user_observer
config.gem 'rubyist-aasm', :lib => 'aasm', :source => 'http://gems.github.com'
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:authentication => :plain,
:user_name => 'myemail',
:password => 'mypassword',
:tls => 'true',
:domain => 'gmail.com'
}

I've tried to reinstall action_mailer_tls but it looks like the website isn't up -- is there another place to get it?

6 months ago

in Screencast - RestfulAuthentication - 1 on e168f08
Drat. Good to know that the code works but I begin to fear it is a windows issue!
Here's the output (I added require 'rubygems' at the start):

$ ruby mytestmail.rb
From: viewsnortheast@gmail.com
To: viewsnortheast@gmail.com
Subject: this is a test message
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8

this is the body
c:/ruby/lib/ruby/1.8/net/smtp.rb:680:in `check_response': 501 Syntax error in parameters or arguments (Net::SMTPSyntaxEr
ror)
from c:/ruby/lib/ruby/1.8/net/smtp.rb:653:in `getok'
from c:/ruby/lib/ruby/1.8/net/smtp.rb:623:in `helo'
from ./vendor\plugins\action_mailer_tls\lib\smtp_tls.rb:42:in `do_helo'
from ./vendor\plugins\action_mailer_tls\lib\smtp_tls.rb:15:in `do_start'
from c:/ruby/lib/ruby/1.8/net/smtp.rb:378:in `start'
from c:/ruby/lib/ruby/1.8/net/smtp.rb:316:in `start'
from c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:628:in `perform_delivery_smtp'
from c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `__send__'
from c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `deliver!'
from c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:383:in `method_missing'
from mytestmail.rb:32


For using string as the body, I found this tutorial: http://rubybook.ca/2008/07/13/gmail/
1 reply
xertroyt's picture
xertroyt I will try it on Windows tomorrow.

I sent you an e-mail earlier -- check again for another msg.

6 months ago

in Screencast - RestfulAuthentication - 1 on e168f08
Hi John, I followed all the steps in the screencast including installing tls and setting the gmail settings. I've got a stripped down test prog below that still has the same issue. I'm on windows xp if that makes a difference.

require 'action_mailer'
require 'vendor\plugins\action_mailer_tls\lib\smtp_tls'
class MyMailer < ActionMailer::Base
def message()
from 'viewsnortheast@gmail.com'
recipients 'viewsnortheast@gmail.com'
subject 'this is a test message'
body 'this is the body'
end
end
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:authentication => :plain,
:user_name => MYEMAIL,
:password => MYPASSWORD
}
puts MyMailer.create_message()
MyMailer.deliver_message()
1 reply
xertroyt's picture
xertroyt Works perfectly for me. On my system, I did have to require 'rubygems' at the start, and I changed backwards slashes to forwards to get the smtp_tls.rb require to work.

Could you paste in the exception trace for the sample program?

Incidentally, you are showing something that works but that I couldn't find in the documentation: Where did you read that you should sent a String to body? Docs always use a Hash and a template.

6 months ago

in Screencast - RestfulAuthentication - 1 on e168f08
Hi all, I'm trying to get this working and running into a Net::SMTPSyntaxError whenever I try to create a new user. I'm still trying to get to the bottom of this but if anyone has any insight I'd appreciate it! Here's the error:

Net::SMTPSyntaxError in UsersController#create

501 Syntax error in parameters or arguments

RAILS_ROOT: c:/development/class-ruby/sandbox/test-rest-auth
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/1.8/net/smtp.rb:680:in `check_response'
c:/ruby/lib/ruby/1.8/net/smtp.rb:653:in `getok'
c:/ruby/lib/ruby/1.8/net/smtp.rb:623:in `helo'
vendor/plugins/action_mailer_tls/lib/smtp_tls.rb:42:in `do_helo'
vendor/plugins/action_mailer_tls/lib/smtp_tls.rb:15:in `do_start'
c:/ruby/lib/ruby/1.8/net/smtp.rb:378:in `start'
c:/ruby/lib/ruby/1.8/net/smtp.rb:316:in `start'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:628:in `perform_delivery_smtp'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `__send__'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:508:in `deliver!'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer/base.rb:383:in `method_missing'
app/models/user_observer.rb:3:in `after_create'
app/controllers/users_controller.rb:18:in `create'
2 replies
xertroyt's picture
xertroyt Ana: For restful auth, you need to have your SMTP settings all right. You can change them "globally" by putting them in config/environment.rb, or for a particular environment (development, production, etc.) by putting them in the environment-specific file in config/environments/ -- e.g., config/environments/development.rb. Have you done so? For GMail, those settings look like this:

config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:authentication => :plain,
:user_name => 'GMAILUSERNAME',
:password => 'GMAILPASSWORD'
}

Additonally, for GMail, you need to support TLS security. To do this, you want to use the right plugin:

script/plugin install http://code.openrain.com/rails/action_mailer_tls/

If you are NOT using GMail, note that the standard (non-secured) port for SMTP is: 25. I.e., instead of 587 above. Also, if you're using regular SMTP (not GMail), look again in AWDR.
xertroyt's picture
xertroyt P.S. Looking at your settings: It "smells" like you're using a server that does not support TLS. So that would be the wrong port. Are you going after GMail?

7 months ago

in Protected: Panel of Ruby/Rails Professionals, Dec. 17 on e168f08
In lecture yesterday you mentioned that you think there will be a shift from rails to a new platform in the next year or so. It would be nice to expand on that: what are the problems that might lead to such a shift, where are things heading, etc.

7 months ago

in Protected: Panel of Ruby/Rails Professionals, Dec. 17 on e168f08
As someone who is returning to the software industry and thinking about switching tracks, I'd love to hear about the actual organization/life cycle of a ruby/rails shop. What does the team consist of, what do you all actually do all day, how long _does_ it take to get the first cut out the door? Etc.

7 months ago

in Protected: Panel of Ruby/Rails Professionals, Dec. 17 on e168f08
Are there any significant non-web applications that people are tackling with ruby?

8 months ago

in Protected: Assignment 3 on e168f08
Can we have the rest of the assignment?

8 months ago

in Assignments on e168f08
When do you think we might see grades for assignment 2?

8 months ago

in Assignments on e168f08
Did the grades get sent out yesterday? I haven't gotten mine.
1 reply
xertroyt's picture
xertroyt I asked the TAs to send them out last night, but it was pretty late . . .

9 months ago

in Assignment 2 on e168f08
Looks like the script is expecting "README" (not "readme.txt"). Just rename your file "README" and it works.
1 reply
Manuel Ledesma Thanks, It works.

9 months ago

in Assignment 2 on e168f08
Weird, I got that right out of the pickaxe. Thanks, John!
1 reply
xertroyt's picture
xertroyt It must be something new for 1.9.

I wrote a message on Thomas's "errata" page at pragprog.com asking that he flag new things a bit better.

Amy, Keith, Harlan - refute must be new?

9 months ago

in Assignment 2 on e168f08
I was trying to write some tests for my game and I'm having a little trouble. I define this test:

class TestHand < Test::Unit::TestCase
include CardTestUtils

def test_has_lowest_card?
h = Hand.new("some_player")
h.accept(shuffle(to_cards(%w{ sa sk s2 d2 da dk })))
assert(h.has_lowest_card?, "Recognize that hand contains the lowest card")

h = Hand.new("some_player")
h.accept(shuffle(to_cards(%w{ sa sk s3 d2 da dk })))
refute(h.has_lowest_card?, "Recognize that hand does not contain the lowest card")
end
end

assert() is fine but for refute() I get the following error:

test_has_lowest_card?(TestHand):
NoMethodError: undefined method `refute' for #<TestHand:0x44402b0>
lib/testpusoydos.rb:33:in `test_has_lowest_card?'

Am I doing something wrong?
1 reply
xertroyt's picture
xertroyt There is no method: refute

Here's the whole list: http://www.ruby-doc.org/stdlib/libdoc/test/unit...

Folks: Ana is writing tests because she's simulating a different game from poker.

For assignment 2, you should not need to write any of your own tests.

9 months ago

in Assignment 0 on e168f08
Thanks!
--Ana

9 months ago

in Assignment 0 on e168f08
Hi guys, can I get some clarification on when assignments 0 & 1 are due?

- On the syllabus it says: Sunday, Oct. 5: Assignment 1 (Ruby One-Liners) due and there is no date for Assignment 0
- On the assignment 0 page it says due Sunday, Oct. 5
- On the assignment 1 page it says due Sunday night, Oct. 19.

So I just want to be sure. Do I hand in BOTH assignments 0 & 1 on Oct 5?

Thanks!
--Ana
1 reply
xertroyt's picture
xertroyt My (John) bad: #0 is due Sunday Sept. 28; One-liners due Oct. 5. I will update the various pages.
Returning? Login