The MOBI version of new edition of the book (new title) has not been updated. The PDF version is OK.
Will the book be compatible with react v15?
In the last PDF this is not yet corrected.
Today is Feb 16 and no sign of epub nor mobi.
Will you include any kind of information about the new version 3.2?


Juan Manuel
In the MOBI version listing 3.1 is completely wrong. It mixes imports from a Java file with parts of a maven pom.xml file.
The PDF version does not have this problem.
In this section of chapter 5 (sorry, but the listing has no numbering) we have:

val close: Account => Account = {_.copy {dateOfClosing = Some(today)}}

def close(no: String, closeDate: Option[Date]) = for {
_ <- update(no, close)
a <- query(no)
} yield a

I have two problems:
- closeDate is never used (so the Account is always closed with today's date)
- Why do you a query after the update? I suppose it is to propagate possible errors in the repository, but I'm not sure.

Thanks !!!
It is not Bill Dean but Billy Beane.
It is not director but General Manager.

Juan Manuel
I suppose the programming language is java so:

private List<Listener> listeners = new List();

should be

private List<Listener> listeners = new ArrayList<>();

Juan Manuel
Yes, but nowadays Java w/o generics feels strange (and, btw you use them in other parts of the book).

Besides, you'll have to explain all the strange casts you have to do when extracting elements from the list to people coming from Ruby or Python (because they won't understand them either).

Juan Manuel
Some Java code lacks use of generics, which nowadays is nonsense.

The error about instancing List (first post on the forum) remains in the secon version.

Juan Manuel
In the code of page 4, it appears the line:

this.authors = new List<Author>();

but List in Java is an interface, not a concrete class. You should use ArrayList or LinkedList to instantiate the list, for example:

this.authors = new ArrayList<Author>();

And, if java 7 or higher is used, you can use the diamond operator to infer the type of the list.

this.authors = new ArrayList<>();

Juan Manuel
There are some things I don't follow in your explanation (text in the book is in italics and my comment in boldface):

First, there’s a key difference in how instance and local variables are implemented. Instance variables are stored on the heap, whereas local variables live on the stack. Local variables are therefore implicitly confined to the thread they’re in. But in Java, all threads share a common heap, where the instance variables are stored. This can give rise to concurrency bugs, if two threads try to access the same instance variable.

So the last phrase seems to imply that better not capture instance or static variables but they can be captured without restrictions !!!

As a result, allowing capture of mutable local variables opens new thread-unsafe possibilities, which are undesirable: what if a lambda capturing a local variable is passed to another thread and then both threads try to modify the value of the local variable?

But, I think, this is not worse than the problem with instance and static variables, so it makes not sense to forbide their capturing

Worse, local variables are popped from the stack as the method exits. What if the method defining a lambda exits but the lambda capturing a local variable continues to live in another thread? What should happen to the value of the captured variable?

This, I think, is the actual reason for the final restriction on locals. From the sharing point of view you have the same problems because a final local can be mutable so as dangerous as a nonfinal instance or static variable.

Have I completely missed the point?

Thanks for your clarifications.

Juan Manuel
How can I send the captures to you? In this forum I cannot attach any file.

Juan Manuel
The text that appears in the figures it is unreadable because it renders completely pixelated on the iPad both in the pdf and the mobi versin.

Juan Manuel
Under the edit box I have three buttons named Preview, Post Message and Cancel.

Wish I could attach you a capture of the box as I see it smilie

Juan Manuel
Code fragments on the kindle appear too much indented to the right, wasting precious horizontal space even in landscape.

The figures with sbt lists of commands are almost unreadable.

Thanks for a much needed book !!!!

Juan Manuel
Code is almost unreadable on ebook. Even on an ipad with minimum size letter and in landscape the code does not fit on the page.

Maybe it look great on paper but on ebook listings are almost useless.

Juan manuel
When will the mobi version be avalilable for the definitive book?

In chapter 14 some functions are not formatted as such, so they get printed as normal text.

I don't know wether this affects other chapters because I'm not reading the book sequentially.

Juan Manuel
I'm reading the MEAP in the kindle and all footnote links go to the next note. So, for example, if I click on note 7 I go to note 8, just after note 7.

FWIW this is not the only manning book with this problem, so I think it could be a problem with the tooling.

Juan Manuel
The prefix tel is used but not defined.

In the kindle app for iPad, some [CA] strage characters appear in Listings 4.2 and 4.3.

Juan Manuel
Didn't know about the tel uri scheme.

Maybe it's worth a footnote to enlight readers about it.

Juan Manuel
This listing gets very bad formatted on the kindle app for iPad.

Juan Manuel
Some of the arrow heads in the figures are missing or difficult to see (e.g. 2.8, 2.9).

Juan Manuel
I know you know when it is valid to use fragments in the urls, but having said that, in genereal, better avoid them, you use it in the example. This, in general, misleads the readers because usually people copy more from the examples than from the "theory".

Juan Manuel
The DBpedia project turns structured data in Wikipedia into RDF. Later we will show you how to get to the raw RDF as well.

-> I understand what you mean, but teh expression "raw RDF" feels somewhat strange because RDF is a model, not a format.

Juan Manuel
Can you update the statistics about LOD? I know that this kind of time depending information gets rapidly outdated, but the book will get published mid to late 2013 at least.

Juan Manuel
In listing 1.1 namespace eg is used but never defined.

Juan Manuel
qb and sdmx-measure were missing too.

Juan Manuel
The kindle versions are very bad formatted leaving both code and rdf turtle data almost unintelligible both on the kindle and the mac application.

Juan Manuel
Much clearer and easier to explain

Juan Manuel
I'me reading MEAPv6 and now 90% of the code of the listing is the same (the unique difference is in the Accept header.

Maybe a litttle refakltoring will further simplify the code.

Juan Manuel
In the javascript of listing 1.4 you use jquery but you don't use its facilities to make ajax requests, so you engage in low level details to get the XMLHttprequest object and you manage the status of the transaction. Jquery has facilities to simplify that, and the code can be much to the point that you want to show.

Juan Manuel
Code is mostly unreadable on the kindle. Left marging and indentation are too big and, even with the smallest fond and in landscape mode, all the line does not fit on the device.

Juan Manuel
Listings with refences read very bad on the kindle. Also, you can use the left and ringht arrows to navigate the sections.
Another problem with the kindle version is that footnote references seems to link to the next footnote (or at the end of the target note). For instance, if I click on footnote 3 I go to a page that begins with footnote 4.
> Juan - I do hope that you decide to come back to the
> book.

I'm sure I will. I love the book, it's only that the step from part 1 to part 2 is higher than expected.

> Taking a break after part 1 is actually a good
> idea--we should mention that in the preface and intro
> to part 2 if we haven't already.

Now I'm reading Martin's Programming in Scala and redoing some of the exercises from the fist six chapters.

> If you are new to
> Scala and FP, I think there is so much new content
> that it's good to just take a break after part 1,
> write some more Scala, and let it sink in before
> continuing on. I would not be at all discouraged if
> you found launching right into Part 2 daunting.

FYI I'm not new to FP (I've been using clojure) and I think that the problems I have is this "think the types first" approach.

> I'd love to hear more about your experiences when you
> do start getting into Part 2 more. Please keep us
> updated!


Juan Manuel

Mensaje editado por:
I've read up to the sixth chapter and done all the exercises and I've begun Part II and I feel a littel lost. I feel there's some continuity from Part I to Part II but the gap is difficult to cross.

I've left the book aside to give me time to read more about scala because I feel that I've hit a wall.

Juan Manuel
Now it is the actual version 16.


Juan Manuel
That's all.
Using TDD (or BDD) for developing with Node.ja, web sockets and asynchronous programming.
In the last capture on page 82 the GET line should be

GET / HTTP/1.0

and not 1.1.
In the first listing on page 83 the call to


should be

As you say in the text both are the same algorithm but, not deriving the equations, I think intuitively descending on the error function makes more sense. Because, intuitively, people can understand that different values for the parameters result on different values for the errors and you want to minimize that.

At least for me is more natural to minimize errors than maximize likelihood.

Juan Manuel
One little error:

p(grey|bucketB) = P (grey and BucketB)/P(BucketB)= 1/7 / 3/7 = 1/3

Juan Manuel
First line of listing 3.9 is bad formatted

Juan Manuel
Perhaps I'm wrong but I think the loop is unnecessary due to the fact that the for all the keys in secondDict the only one which is equal to testVect[featIndex] is precisely testVect[featIndex], si the loop can be substituted by:

key = testVec[featIndex]

if key in secondDict:

....val = secondDict[key]

....if isinstance(val, dict): classLabel = classify(val, featLabels, testVect)

....else: classLabel = val

Juan Manuel

After finishing chapter 3 and enjoying the book, I think I have enough comments about the style of the python code to deserve a message.

I'm very used to reading python code, and the code in the book feels a bit strange (unpythonic, whatever this word means), so take my comments as suggestions for a simpler and, IMHO, more readable code.

  • Iterating over a dictionary, iterates over its keys, so for k in d.keys(): ... is simply for k in d: ...

  • The same applies to not in d.keys() that is simply not in d

  • Maybe you want to avoid using classes, but using a function scoped in createPlot to reference the plot seems very strange. I thing that returning the plot and passing it explicitly is better. The (in)famous Zen of python (execute "import this" on your python shell) says: Explicit is better than implicit.

  • For naming functions and variables Style Guide for Python Code recommends lowercase separated by _, so instead of createDataSet it should be create_data_set.

  • To test if something is a dict (and you want to test using the class) you can use the builtin isinstance. For example, isinstance(secondict[key], dict).

  • Often you use a float as a counter (for instance errorCount = 0.0 and then errorCount += 1.0) when an integer would suffice and be clearer.

  • If you need to iterate something and you need a counter for each loop, you use enumerate. For instance, in listing 2.2 when you loop over the lines of the file, you can do:
    for index, line in enumerate(fr.readlines()): ...
    that, due to that a file is also an iterator of its lines, can be further simplified to: for index, line in enumerate(fr): ....

  • Instead of:

    if d.has_key(k): d[k] += 1

    else: d[k] = 1

    You can do d[k] = d.get(k,0) + 1

  • If you are interested in the set and not in the list, instead of:

    featList = [example[i] for example in dataSet]

    uniqueVals = set(featList)

    you use a generator expression (similar to a list comprehension but does not maintain elements in memory) to create the set and do

    uniqueVals = set(example[i] for example in dataSet)

(Maybe the last one is more advanced than what you intent for your audience.)

And, finally: This is the end of the message !!!

Best regards,

Juan Manuel

PS: In page 32, should be newValue = (oldValue - min) / (max - min)

Mensaje editado por:

The font you use for the python code reads very bad on iPad. I've tried different pdf viewers and all of them render it very uglily.

This forum does not allow for attachments, can you give a mail address to send them?
- Page 114: Equation don't read well.
- Page 127: Badly indented return in code
- Page 128 (and hereafter): Radial bias function -> I've always have been used the term radial basis functions. Maybe both terms are equivalent, but basis I think it's far more used.
- Page 142: In 7.2, after the definition of weak classifier you said that its error rate is greater than 50% in the two class case. But a weak classifier is better that just guessing so its error rate shoul be (slightly) better than 50%.

Juan Manuel Gimeno
- Page 85: text says top 100 words when should be 30
- Page 87: code uses key=lambda ... when you've been using operator.getitem(1) in all previous code.
- Page 89: last bullet says "in the our data".
- Page 91: sigmoid equation does not read ok in PDF
- Page 93: gradient expression does not read ok on PDF
- Page 98: (remember x0 was 0) should be was 1.0
- Page 107: Using list comprehensions and negative indexing coul make the code clearer, so instead of:

lineArr = []
for i in range(21):
....lineArr.append(float(currLine[ i ]))

you can do:

lineArr = [float(v) for v in currLine[:-1]]

and instead of using 21 for indexing the trainning labels, use -1.

And explain in the text that the last value of each line is the class.

- Most of the counting could be done using collections.Counter, simplifying the code even more.

Just a suggestion.

Juan Manuel
In chapter 10 you reference function neighbors from section 6.4 but this section is the summary of chapter 6 and contains no function.

- (rpn [1 2 + ]) should be [3] not 3
- Table 1.1 should say yes to loop being a recur target.
I feel strange the use of the inner parentheses in

(+ (Integer/MAX_VALUE) (Integer/MAX_VALUE))

Why do you use it? Are they needed (I think they are not)?

What is really strange is:

Clojure 1.1.0
user=> (- Integer/MAX_VALUE 1)
user=> (- Integer/MAX_VALUE (1))
java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0)
user=> (- (Integer/MAX_VALUE) 1)
user=> (fn? Integer/MAX_VALUE)

Page 156:


(qsort (nom 10))
;=> (1 25 27 47 56 56 59 77 84 92)

but (nom 10) can't generate this elements because all must be lower than 10

(or maybe the problem is in the definition of nom).


Will this book be offered in epub sand mobi formats? When?
I confirm that mobi version does not work on kindle, and on the kindle app for mac, texts reads ok but there are no figures.

I haven't tried epub.

Page 51: references to sampling in the text correspond to ch2 in the figure (2.3)
Don't read my previous mail. My mistake.


Juan Manuel
In table 2.2 you seem to imply that each time a @Test method is invoked a new instance of the TestClass is created. To my understanding all tests methods in a TestClass are executed in the same instance. That's why we use @Before and @After.


Juan Manuel
Figure 1.4 (referred in page 15) does no exists.

Version is 5/6/2009
I find confusing your definition of asserSame. I quote:

Asserts that the A and B objects have the same
value. While the previous assert method checks to
see that both the A and B are the same objects
(using equals method), the assertSame
method actually checks to see if the A and B
objects have the same value (using == operator).

- assertSame is not about the same value but about referring the same object.
- when referring the previous assert method (assertEquals) you seem to imply that it check if A and B are the same object, which does not make sense because it uses equals !!!!

Sorry, I meant Hashtable<Integer, HashSet><Integer>>.
In page 62 you say:

In Java, you can easily implement an adjacent list using Hashtable that will contain HashSets. So the definition of the variable Matrix in the class PageRankMatrix would look as follows: Hashtable<Integer, HashSet><Integer, Double>> matrix;

I think you mean a hastable of hashtables, so the right declaration would be Hashtable<Integer, Hashtable ><Integer, Double>> matrix;

Who is wrong, you or me?


Juan Manuel