By Developers, For Developers

Historical errata for Seven Web Frameworks in Seven Weeks

PDF PgPaper PgTypeDescriptionFixed onComments
viiTYPO

s/Not an Language Tutorial/Not a Language Tutorial/

2013-08-23
8SUGGEST

Your implementation of Hash#only is O (h*w)

I’d rather do an O (w) (as furthermore typically w < h)


whitelist.inject {} do | result, key |
result.merge key => self[key] # or even fetch if you want to check for presence
end
—-

2013-08-24Robert, \n \nThank you for your suggestion. I've made the change, and it will be in the next beta release of the book. \n \nFred \n
5SUGGEST

I know you don’t want the book to become an install guide but it may be worth pointing out common issues when installing some of the gems. In particular, on Ubuntu 13.04 I couldn’t install the sqlite3 gem until I had installed the *-dev package for ruby by doing apt-get install ruby1.9.1-dev. It may also be worth mentioning that gem install should be prefixed with sudo on the same platform.

2013-08-26Thank you Bruno for your note. As you said, we do not want to bog down the book with installation details. For example, if we mention 'sudo gem install', we would also have to mention the alternative of using RVM so that the 'sudo' prefix is not necessary under Linux.
11TYPO

In the epub version of the document, the arrow in the margin of the sinatra/erb/app.erb listing (and every other listing that has the same arrow in the margin) comes out as a large inline * character with lots of white space around it.

2013-12-05
15SUGGEST

Explain where to store the CSS files referenced in sinatra/erb/views/layout.erb such that Sinatra can find them and add a a link to the source. Generally speaking, it may be good to have a quick paragraph on how to reference static files (CSS, JS, images) and where to locate them in the directory structure.

2013-08-26Great suggestion Bruno, it will be added to the next beta release. Thanks, Fred
14SUGGEST

First sent. fst para “Using Partials”
Partials are templates that are meant to be pulled into other templates to
form a complete page.

Frankly I do not know how to interpret “to form a complete page” in this context.
E.g. A partial can surely use a partial and thus might not form a complete page.

Might this not be confusing for some1 not used to partials?

2013-09-04
16SUGGEST

When using ERB, we used the “respond_with” extension to respond with a web page or JSON depending on headers. It would be good to explain whether the same can be done with Mustache or whether there is any alternative. A couple of sentences would be enough.

2013-09-04
24ERROR

I will hopefully find some time soon to talk about specs on the suggestion page, but for now I will limit myself to the following remark

sinatra/validation/app_test.rb

it “sends an error code for an invalid update request” do
get “/bookmarks”

This will typically get you an empty list as response. And for very good reasons which I will try to explain in the suggestion section. For now I’ll stick to two:

* Eventually your specs will use a Database Cleaner or Transactional Setup

* Eventually your examples will run in random order to underline that they are isolated.

I suggest to setup a `before` block to create some records in the test db.

2013-09-04The code is actually not \n \nget "/bookmarks" \n \nas shown above, but rather \n \nget "/bookmarks/0" \n \nwhich tests the intended behavior.
32SUGGEST

It might be a good idea to explain, how to access the params of the routes defined by regexen.

  • The need to group the params
  • Access via params[“captures”]
  • Access via block params (preferred I guess?)
2013-09-04Because of limited space per chapter, we have to choose which details to go into and which to leave outside of the scope of topics covered.
38SUGGEST

The CanJS examples use jQuery 1.8.3. If you go to the jQuery site, the default versions you can download are 1.10.2 and 2.0.3 with a warning that it has changed quite a bit as of 1.9.0. In order to stay current, it would be good to use on of the latest versions.

2013-09-24
38SUGGEST

Similarly to my previous suggestion, the current version of CanJS is 1.1.7 rather than 1.1.5 and the way it is distributed seems to be different from what the book suggests. In particular, there is no can.jquery-all.js file, it’s either a zip file with lots of JS files in it or a custom file called can.custom.js. Adapting the examples to the way those libraries are distributed at time of writing would make them easier to follow.

2013-09-24
214204ERROR

In the first example of using ‘runSqlite’ in the Yesod chapter, you write that you’re using Haskell’s ‘do’ syntax in step 2, but you actually don’t.

2013-09-25
169SUGGEST

The sudden introduction of gen_server with no explanation completely loses the reader: we suddenly end up with vastly more complicated code with no real explanation why.

This section should at least explain what gen_server offers that goes beyond what we’ve seen from Webmachine so far and why the author decided to use it.

In addition, some explanation of the header of the petite_url_srv.erl file on the next page would be good, such as:

- what is the behaviour statement?

- why do we have two export statements?
- what are the define and record statements?

I understand that this last point is more about Erlang than Webmachine but there is such a gulf between the concepts used in day 1 and those used in day 2 that an explanation is required, otherwise readers that are inexperienced in Erlang will just end up copying code without understanding it or just jump to the next chapter.

2013-09-25We unfortunately don't have the space to explain every language detail. Jack.
172SUGGEST

Add an explanation about what the supervisor does and how it fits into the Webmachine architecture.

2013-09-25Supervisors are better covered in an Erlang book. There is nothing special about Webmachine's use of supervisor compared to any other Erlang OTP app. Jack.
172SUGGEST

Specify that the changes to petite_sup.erl go in the init function: it’s not easy to find if you’ve never seen this file before.

2013-09-25
175SUGGEST

When specifying the changes to priv/dispatch.conf, please specify that the shorten line needs to be inserted before the fetch one otherwise Webmachine will match on fetch and return a 405 error as fetch only supports GET.

2013-09-25
177ERROR

When running the example, it results in an internal error because webmachine cannot find mustache:render. Presumably there is something more to do in order to enable this? Google is no use in providing answers as there appears to be several implementations of mustache.erl.

2013-09-25
201ERROR

The version of yesod installed on Ubuntu 13.04 (v 1.1.9.2) comes up with errors when compiling the book’s Hello.hs file.

If I have:
getHelloR :: Handler Html

I get an error saying Could not deduce (HasReps Html)

If I keep the original line like this:
getHelloR :: Handler RepHtml

It says “No instance for (Data.String.IsString RepHtml)”.

My understanding of Haskell is not good enough to fix the problem. If a specific version of Haskell or Yesod is needed, please specify it.

2013-09-25The book requires Yesod 1.2. Fixed.
91TYPO

Minor misspelling: “The view will diplay the bookmarks” ==> “The view will DISPLAY the bookmarks”.

2013-09-24
119SUGGEST

I am not sure, but did you miss to indicate to run “lein deps” after editing project.clj? Or is this not necessary?

2013-12-07`lein deps` is run automatically as part of any other command that would need the dependencies.
122TYPO

2nd para 2nd line
take a look at hte following
should be
ake a look at the following

2013-11-07
77SUGGEST

It would be good to explain how to obtain the different files that constitute AngularJS and what each of them does. If you go to the AngularJS web site, the big blue download button gets you to download angular.min.js. The others are available as well but need exploring the site to find.

2013-10-26
77SUGGEST

The examples on the AngularJS site suggest that the different AngularJS files be included by linking to ajax.googleapis.com rather than downloaded locally. A short paragraph explaining the two options would be good.

2013-10-26
83SUGGEST

The mustache template is introduced at the top of this page but not used until later, which is a bit confusing and makes you wonder whether you’ve missed something. Maybe it would read better if mustache was introduced at the point where it is actually used.

2013-10-26The purpose of the code shown is, as explained, the need to load the angular-resource.js file to use the resource service, rather than the use of a mustache template.
86SUGGEST

The index-test.html source code includes a reference to a test-runner.js script but nothing is said about this script and the content not explained. It should be explained and the code displayed for readers who do not have access to the internet there and then and cannot download it.

2013-10-26Due to space restrictions, we could not explain every file in detail and instead did our best to focus on the framework being discussed in the chapter.
85SUGGEST

Automated tests used jasmine but there is no explanation as to how to obtain jasmine and what part of it to use. I eventually found it but had to go through the github repository, find the right version and then search the content of the zip file to find where the different files that we need are. There is a lot besides the CSS and JS files that are used in the example and it is unclear what is needed and why.

2013-10-26Page 85 actually does contain a reference/link to the Jasmine web site which contains a Download section with a Standalone Release link.
53SUGGEST

At the bottom of the page, the user is asked to run the Sinatra app from the sample code bundle. If the user hasn’t downloaded the bundle, they have no way to understand what they need to copy from the Sinatra chapter and where in order for the solution to work. A quick aside on how to do this would help a lot.

2013-10-26The Preface, under its Code Examples and Conventions section, indicates to download the sample code and use it to run the sample applications.
88SUGGEST

Same suggestion as page 53: add a short aside on how to configure the Sinatra app properly in order to work with AngularJS. A reference back to page 53 would be enough is it is explained in the CanJS chapter. At the moment, the only way to understand this is to download the sample code bundle, which some readers may not have done.

2013-10-26Please refer to #53072, thank you.
88SUGGEST

When I first run the tests on page 88, it fails with a error in AngularJS. Looking at the code in the sample bundle, it appears that the app.js file is constructed differently from the index-basic.js that implemented the “greeter” example.

index-basic.js goes:

var app = angular.module(“BasicApp”, []);

app.service(“greeter”, function() {

While app.js goes:

(function(app) {
// define factories, controllers, etc. on app
app.factory(“Bookmark”, function($resource) {

})(
angular.module(“App_base”, [“ngResource”])
);

This difference in syntax needs to be explained as it appears to be very important for the tests and is quite baffling at first sight.

2013-10-26Apologies if this was not clear enough, but indeed the differences between app.service and app.factory are covered in the chapter. As well, page 83 explains the requirement of specifying ngResource as a dependency to use the resource service.
100SUGGEST

The code as presented in the book results in failing tests. Looking through the code bundle, I cannot identify what parts I am really missing to get it to work. The following is unclear:

- what happens when we go to the / URL and what files does Sinatra use to present that view?

app.rb contains a simple handler for /:

get “/” do
redirect “/example/base”
end

which is then handled by

get “/example/:example”

- how does that view pull in the base.html file where the controllers are defined? I can’t find any reference to base.html anywhere.

the above handler in app.rb contains {:example => “base”} which is then used in index.mustache via example_template = IO.read("views/#{example}.html") and {{{ example_template }}}

- what is the role of the index.mustache file?

the handler in app.rb renders it with mustache :index

All of the above should be explained for the example to make sense and to work.

2013-10-26Please see comments inline, hope that helps. I understand that there are not explanations for every detail; we had to do our best to cover each framework in one chapter.
3030ERROR

555-555-0199@example.com

2013-10-30spam.
131TYPO

It’s spelled “hierarchy”, not “heirarchy”.

2014-04-07
20TYPO

In the bookmark_list.slim template, bookmark links read:
a<> href=“bookmark.url”
Because of the double quotes, the variable is not interpolated and the resulting HTML is

Instead it should be:
a<> href=bookmark.url
This problem is also present in the code archive.

2014-04-07
57TYPO

Formatting issue.

In the “Do” list of the “Day 2 Self-Study” section, the third bullet is in the middle of a sentence and shouldn’t be there.

2014-04-07
272SUGGEST

Currently, using inline `REFERENCES` for foreign key definitions is a `bug` (they have it classified as a feature request) in MySQL.

I’m running mysql 5.6.17_1 on OSX 10.9.3 install via brew.

MySQL bug link: bugs.mysql.com/bug.php?id=4919

162TYPO

We’ll starting building our example application …

should read

We’ll start building our example application …

8ERROR

Hash#slice method includes nil values - trying to implement the ordering by creation_date I’ve noticed that the update would actually delete properties contained in the whitelist but no values in the params hash, as slice adds them with a nil value to the input hash.
I’ve provided a fix on github repository drblinken/7web, branch erratum-page-8

140TYPO

Program listing: should (def app (-> app-routes …)) not be (def app (-> all-routes …)) to combine API- and app- routes?

46TYPO

The URI to open the example is /example/base - as the sinatra app adds the /example part to it.

Categories: