The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

SSteve (24) [Avatar] Offline
#1
When I ran the code in the Nesting section (for Figure 2.7) I got an error message. It turned out to be because of the asynchronous nature of d3.json(). d3.nest() was getting called before tweets.json was loaded. (I ran the code by entering it into my HTML document, not by typing it in the console.)

This version of the code avoids the race condition:

var nestedTweets;
d3.json("tweets.json", function (data) {
nestedTweets = d3.nest()
.key(function(el) {return el.user})
.entries(data.tweets)});
elijah.meeks (127) [Avatar] Offline
#2
Re: Chapter 2 - Race condition in Nesting code example
Thanks, Steve. Not sure how that ended up like that, but it will be fixed soon. Hopefully we'll have revised Chs. 1-3 and Ch. 4 up very soon!