Head First Programming

Errata for Head First Programming

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page 39
Program code in it's current form line 3

Address line is "http://www.beans-r-us.biz/prices.html" on page 39. IDLE Illustration on page 40 drops the "www." in the URL address. With the www in the address the results are different then the results in the Python Shell illustration on page 40. I think the code on page 39 should have the URL address = "http://beans-r-us.biz/prices.html" without the "www."

Note from the Author or Editor:
I've tried it both ways and it makes no difference. But, yes, the code in the illustration should match the code in the book. But, as I said, with or without the "www" prefix is working for me.

bill  May 12, 2010  Jul 12, 2013
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 39
first illustration

the site address: "http://www.beans-r-us.biz/prices.html" takes me to godaddy.com I found a very different site and had to work to find a solution, here's my code: import urllib.request page = urllib.request.urlopen("http://ycharts.com/indicators/world_coffee_arabica_price") text = page.read() .decode("utf8") #price = text .index("<div id="pgNameVal">") #p = text .index("pgNameVal") encontramos el indice de una cadena unica #y contigua a lo que nos interesa #buscando en el codigo html #print (p) imprimimos ese indice, contamos caracteres en el sitio para #averiguar cuanto sumarle a p #price = (p+?) nos da el caracter de inicio, contamos hasta donde queremos #imprimir y lo sumamos a p+1, esto nos da el caracter final price = text[8747:8773] print (price)

Note from the Author or Editor:
That URL no longer exists. Please see this forum entry for an explanation: http://forums.oreilly.com/topic/88296-do-not-use-beans-r-usbiz/

Eduardo Lopez  Sep 21, 2013 
Printed, PDF, Safari Books Online
Page 48
3rd paragraph

"Goethe" instead of "Geothe"

Note from the Author or Editor:
Change "Geothe" to read "Goethe" under the second Head FIrst paragraph.

Anonymous  Oct 03, 2011  Jul 12, 2013
Printed
Page 49
Last bullet point, bottom of the page.

The bullet point reads: "Subtract the second index from the first to work out how long the substring should be." It should read: "Subtract the first index from the second to work out ...." As an example of the error: If the substring were, s[10:25], then subtracting the second index from the first would produce a substring with a negative length (in this case, -15)!

Note from the Author or Editor:
Yes, you are correct. We got the order wrong on page 49 ... thankfully it is OK on page 44. Thanks for this. --Paul.

Harvey  Jan 06, 2010  Jul 12, 2013
Printed, PDF, Safari Books Online
Page 51
Paragraph "The price moved"

"... more dynamic than ..." instead of "... more dynamic that ..."

Note from the Author or Editor:
Change "dynamic that" to "dynamic than".

Anonymous  Oct 03, 2011  Jul 12, 2013
Printed
Page 67
The code throughout the rest of chapter 3

The code switches back from the loyalty pricing page to the regular pricing page for the rest of the chapter. The regular pricing is too high for the while loop to ever finish. The loyalty pricing properly completes the loop randomly.

Note from the Author or Editor:
The URL used on pages 67, 71 and 73 should be "prices-loyalty.html", not "prices.html" as shown.

Onelow  Aug 04, 2010  Jul 12, 2013
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 70
near bottom

time.timezone, which does not employ parentheses, reports in seconds, not hours

Note from the Author or Editor:
Last item on list. Remove the parens from "time.timezone()" and replace the word "hours" with the word "seconds" in the description.

Anonymous  Sep 19, 2012  Jul 12, 2013
Printed
Page 86
83-85,87

The float function is taken out of the example code for the get_price function listed on the pages both before and after the program listed on page 86

Note from the Author or Editor:
Yes, the code for the get_price() function on page 86 should convert the price found to a float using the float() BIF, so as to allow for it's use within calculations within the calling code (as shown on page 90 and subsequent pages).

Onelow  Aug 04, 2010 
Printed
Page 88
The answer to the 4th question

"prgrammers" should be "programmers"

Dawn  Apr 21, 2010  Jul 12, 2013
Printed, PDF, Safari Books Online
Page 93
2nd paragraph

Twitter say that from 16th August they no longer support basic authentication. Is there any advice on how this code can be modified?

Note from the Author or Editor:
The solution to this Twitter change of policy is, thanks to David, "fixed" here: http://forums.oreilly.com/content/Head-First-Programming/20756/Sending-Messages-To-Twitter/

Fraser  Aug 21, 2010  Jul 12, 2013
Printed, PDF, ePub, Mobi, Safari Books Online
Page 93
send_to_twitter() figure

The figure here (which I think is the result of the previous erratum for page 93) doesn't send "I am a message that will be sent to Twitter" as shown on page 94. Instead it already incorporates the parameterization that's the task of the Sharpen Your Pencil on pages 97-98.

Note from the Author or Editor:
Yes, we appear to be ahead of ourselves here. Noted this to be fixed in 2nd edition.

Christopher Bohn  Aug 04, 2013 
PDF
Page 111
Programming Tools section, 7th point

it's should be its.

Erik Weibust  Jun 10, 2010  Jul 12, 2013
Safari Books Online
128
In Sharpen Your Pencil box

"You were think about what would make the program easier to" should read You were thinking...

Note from the Author or Editor:
Should read "You were to think..." - this is an issue in the printed book, too.

Cathy Austin  Apr 06, 2010  Jul 12, 2013
Safari Books Online
154
"In Take each of the keys in the hash in turn" pointer

for key in scores. keys() : print( scores[key] + ' had a score of ' + str(name_part) ) ***name_part is not defined. It should be:*** for key in scores. keys() : print( scores[key] + ' had a score of ' + str(key) )

Note from the Author or Editor:
The suggested fix is the correct code to use. Thanks.

Cathy Austin  Apr 06, 2010  Jul 12, 2013
Printed
Page 167
In the "Do this!" box

"Be sure to put the function near the top of *you* file" should be "Be sure to put the function near the top of *your* file"

Dawn  Apr 21, 2010  Jul 12, 2013
Printed, PDF, Safari Books Online
Page 182
Sharpen your pencil Answer

Explanatory comment about the Credit card length should point to the first "%16s" not the last which formats the Description.

Note from the Author or Editor:
Correct - the arrow is pointing to the wrong %16s.

Fraser  Aug 23, 2010  Jul 12, 2013
Printed
Page 183
Third line of code from the top of the page.

On p. 182, the format string we were to create appears thus: "%16s%07d%16s\n" % (credit_card, price * 100, description). On p. 183, however, we are told that the following is the string that we just created (the one that we're supposed to use in the code): "%s%07d%s\n" % (credit_card, price * 100, description). The second version is missing both instances of the sixteen-character padding formatting element. The result of this is that, in the transactions file, the description is not separated from the price by any spaces.

Note from the Author or Editor:
Change the code on 183/184 from: %s%07d%s\n to: %16s%07d%s\n"

Harvey  Jan 15, 2010  Jul 12, 2013
Printed
Page 194 ff
Various places.

The following error is one of inconsistency (but it's trivial). In chapter six the price of a latte is $2.0, until you get to p. 194. Beginning on p. 194, and for the rest of the chapter, the price of a latte is $2.20.

Harvey  Jan 15, 2010 
Printed, PDF, Safari Books Online
Page 212
Both sample transaction printouts

The braces for the comment have slipped sideways so instead of marking the price, they include the first digit of the credit card number.

Note from the Author or Editor:
Yes - they need to move to the left a little bit in two places (in both diagrams).

Fraser  Aug 23, 2010  Jul 12, 2013
Printed
Page 255
The "Python Tools" section

In the "Python Tools" section appearing at the end of chapter seven, we are told that we covered Python's "break" statement. This is incorrect: the "break" statement is NOT covered in chapter seven.

Note from the Author or Editor:
This is correct. The "break" statement is NOT covered in Chapter 7 (or anywhere else from what I can see). Well spotted. Thanks.

Harvey  Jan 23, 2010  Jul 12, 2013
Printed
Page 288
Bottom of the save_data() function

Near the end of the save_data() function, the following line appears twice: description.delete(0, END). It should appear once, only.

Note from the Author or Editor:
Yes, that's a typo. Only one of those statements is needed.

Harvey  Jan 24, 2010  Jul 12, 2013
Printed
Page 296 ff.
All of Chapter Eight

In my previous errata submission I pointed out the following typo: "Near the end of the save_data() function, the following line appears twice: description.delete(0, END). It should appear once, only." I have discovered that this typo is repeated in every occurrence of the "save_data()" function that appears in chapter eight. It occurs seven times.

Note from the Author or Editor:
Remove one of the duplicate lines.

Harvey  Jan 25, 2010  Jul 12, 2013
Printed
Page 341
first column

the first answer was talking about typos and there was actually a typo. “As using the word “from” makes a lot of sense when taking about a scale” (probably should be talking). If that was intentional, you got me…

David Griffiths
O'Reilly AuthorO'Reilly Blogger 
Jan 04, 2010  Jul 12, 2013
Printed
Page 357
2nd para

"checkoxes" should be "checkboxes"

David Griffiths
O'Reilly AuthorO'Reilly Blogger 
Jan 04, 2010  Jul 12, 2013
Printed
Page 360
Near bottom of code

The code from this page on uses "track.stop()" in the shutdown() function. It should read "mixer.stop()". The code on the book's website reflects this change, however, the printed book does not. Also an issue on page(s) 374, 379 and 380.

Paul Barry
Paul Barry
O'Reilly AuthorO'Reilly Blogger 
Feb 16, 2010  Jul 12, 2013