O'Reilly Forums: Can't Get Past Example 2-2 - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can't Get Past Example 2-2

#1 User is offline   kwcloud 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 27-March 09

Posted 27 March 2009 - 12:50 PM

I set up AWS.rb with Examples 2-1 and 2-2 and inputed the example then get the error message -

NoMethodError: undefined method 'encode_base64' for #<Object:0xb7c709a4 @aws_secret_key="MySecretKey"> from .... in 'generate_signature'

Any thoughts?


0

#2 User is offline   JamesMurty 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 21
  • Joined: 20-March 08

Posted 28 March 2009 - 07:14 PM

The encode_base64 method is not defined until Example 2-10 (Utility Methods), but I neglected to mention this correctly at this point in the chapter. Sorry about that.

You can either skip ahead to Example 2-10 to find the full implementation of this method, or you can temporary replace the call to the encode_base64 method with the following:

b64_sig = Base64.encode64(digest)

We added the encode_base64 method relatively late in the development of the book, after we discovered that the default Ruby base 64 encoding method (as listed above) adds newline characters to the result. These characters cause issues for the Amazon services discussed later in the book. I intended to add a reference to Example 2-10 before the test script listing, but this line mistakenly refers to Example 2-2.

Thanks for reporting the issue. I hope this explanation and work-around helps.

Regards,
James

P.S. Don't forget that all the example code is available for download, to save you typing it all out. You can find the code archive here: http://examples.oreilly.com/9780596515812/

This post has been edited by James Murty: 28 March 2009 - 07:29 PM

0

#3 User is offline   JamesMurty 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 21
  • Joined: 20-March 08

Posted 28 March 2009 - 07:26 PM

The book includes the following statement on page 29, just after Example 2-2:

Be sure to implement the encode_base64 method in Example 2-2 before you perform this test.

This reference is incorrect and should point the reader to Example 2-10, which is where the encode_base64 method is defined. I have added a new entry to the book's errata for this error.

0

#4 User is offline   kwcloud 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 27-March 09

Posted 30 March 2009 - 03:50 PM

Thanks for the quick response, James. Your post worked for me.

I am new to Ruby so I like to type in the examples in the book, or any book like this when I am learning. Typing in all the examples helps me to learn the topic and the programming language. Usually I make a typo or two so I get to learn error messages, troubleshooting and debugging. I have downloaded the code but I haven't used it yet other than to double check examples 2-1 and 2-2. If I download and just use your code then I don't really learn anything.

Love the book.

Thanks again.



QUOTE (James Murty @ Mar 28 2009, 07:14 PM) <{POST_SNAPBACK}>
The encode_base64 method is not defined until Example 2-10 (Utility Methods), but I neglected to mention this correctly at this point in the chapter. Sorry about that.

You can either skip ahead to Example 2-10 to find the full implementation of this method, or you can temporary replace the call to the encode_base64 method with the following:

b64_sig = Base64.encode64(digest)

We added the encode_base64 method relatively late in the development of the book, after we discovered that the default Ruby base 64 encoding method (as listed above) adds newline characters to the result. These characters cause issues for the Amazon services discussed later in the book. I intended to add a reference to Example 2-10 before the test script listing, but this line mistakenly refers to Example 2-2.

Thanks for reporting the issue. I hope this explanation and work-around helps.

Regards,
James

P.S. Don't forget that all the example code is available for download, to save you typing it all out. You can find the code archive here: http://examples.oreilly.com/9780596515812/


0

#5 User is offline   DCS-1 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 25-July 10

Posted 26 August 2010 - 10:21 PM

looking for the answers too



Walt Disney's 100 Years of Magic 121 discs Collection DVD Boxset
0

#6 User is offline   ankitpdr 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 11
  • Joined: 09-August 12
  • Gender:Male

Posted 14 August 2012 - 12:27 AM

I very interested in the article. I feel confirmatory good about it and obviously searching more on this topic. If possible, as you gain expertise, would you mind updating your blog with more informative post.

Off Page Optimization | SEO India

This post has been edited by ankitpdr: 14 August 2012 - 12:30 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users