GithubHelp home page GithubHelp logo

yesodweb / yesodweb.com-content Goto Github PK

View Code? Open in Web Editor NEW
67.0 67.0 111.0 19.69 MB

Content for the www.yesodweb.com site

Home Page: http://www.yesodweb.com/

License: Other

HTML 99.97% Haskell 0.02% Shell 0.01% Dockerfile 0.01% Just 0.01%

yesodweb.com-content's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yesodweb.com-content's Issues

Error compiling blog example

Haskell newbie, likely doing something dumb. I'm trying to run the blog example from Yesod book, and am getting an error:

blog.hs:183:36:
    Expecting two more arguments to `SqlPersistT'
    Expected kind `*', but `SqlPersistT' has kind `(* -> *) -> * -> *'
    In the type `SqlPersistT'
    In the type instance declaration for `YesodPersistBackend'
    In the instance declaration for `YesodPersist Blog'

Googling takes me to what looks like a similar report (yesodweb/yesod#244), but I don't understand the described fix. Is this the same thing?

Broken links to hackage for apiname package:module

I don't know how apiname element is rendered into HTML, but when provided with a module, the book links to hackage are broken (. in module name not translated to - in link), eg from the forms chapter:

yesod-form:Yesod.Form.Types

results in a link to http://hackage.haskell.org/packages/archive/yesod-form/latest/doc/html/Yesod.Form.Types.html

FWIW a package or field results in a working link; latter does translate . to - eg

yesod-form:Yesod.Form.Fields:intField

I see non-broken http://hackage.haskell.org/packages/archive/yesod-form/latest/doc/html/Yesod-Form-Fields.html#v:intField

Render/display issues

Often when I go to yesodweb.com to read blog posts the site does not render correctly on the first load. I normally have to reload the page several times in order to get everything rendering correctly. Code blocks often are the only blog elements other then the template that seem to render correctly. What renders and what does not often changes on every load though all similar elements render together or not at all.

Here are some samples.
http://imgur.com/a/l7JPN

I see this on

chrome: 33.0.1750

but not

safari: 7.0.3

"Blog: i18n, authentication, authorization, and database" errors

This particular example seem to be removed from this repo, so submitting issue instead of PR.

Compiling this example from the book will yield some errors. Here's a fix in pseudo-diff:

- 7 import Yesod.Auth.BrowserId (authBrowserId)
- 9 import Network.HTTP.Conduit (Manager, newManager, def)
- 250     manager <- newManager def
+ 7 import Yesod.Auth.BrowserId (authBrowserId, def)
+ 9 import Network.HTTP.Client (defaultManagerSettings)
+ 10 import Network.HTTP.Conduit (Manager, newManager)
+ 251     manager <- newManager defaultManagerSettings

Create a "Deploying with Docker" chapter

The existing "Deploying your Webapp" chapter has great information on deploying an app with full stack setup. Increasingly, docker is being used to deploy apps so there should probably be a chapter on it. As a nice to have there could be a section on how to deploy to some of the major cloud providers like AWS and Google Cloud. Also, since the currently deploying chapter already has a lot of information it may make sense to have it as a separate chapter under the advanced section. Thoughts?

Chapter "Widgets": text about inserting Julius scripts

Section "Constructing Widgets" (first paragraph) currently reads as (highlighted by me):
"In order to use widgets, you’ll obviously need to be able to get your hands on them. The most common way will be via the ToWidget typeclass, and its toWidget method. This allows you to convert your Shakespearean templates directly to a Widget: Hamlet code will appear in the body, Julius scripts inside a <script> tag in the head, and Cassius and Lucius in a <style> tag."

Actually, scripts are inserted at the end of the body as shown in Synopsis section. So section text should be adjusted.

Texts instead Text

yesodweb.com-content / book / chapters / routing-and-handlers.dita line 179 is
/wiki/_Texts WikiR GET
and I believe it should be
/wiki/_Text WikiR GET

otherwise please explain, why its "Texts".

License covers yesodweb.com-content as well?

As this is a separate repository within yesodweb (yesodweb.com-content is separate from yesodweb.com here at GH), it isn't absolutely clear that the license which states that it otherwise covers documentation and source is applicable here. It would be nice to have a license file here making this clear (or clarifying what license is used for the content part, if different of course, I certainly hope there's no question that documentation is under a free/open license)

Lost changes

It seems, that all changes, made between commit 2e3aad6 (on 29 Apr 2012) and book version splitting, have been lost. Changes from commit 2e3aad6 are in both versions, but changes from the next commit 2da5ce3 (on 14 May 2012) are not.

Possibly part of the changes is obsolete, but others may be still relevant (e.g, b86fcb8, 4b1e246 and 85d6823).

type error in restful-content of RepHtmlJson code sample

The sample code given won't compile because of a type error. In code of 'RepHtmlJson', function 'getNameR' line 176, it won't compile with:

let json = object ["name" .= name]

so it should be more like:

let json = return $ object ["name" .= name]

GHC gives the following error:
Home.hs:51:30:
    Couldn't match expected type 'HandlerT site0 IO a1'
                with actual type 'Value'
    In the second argument of 'defaultLayoutJson', namely 'json'
    In a stmt of a 'do' block: defaultLayoutJson widget json
    In the expression:
      do { let widget = ...;
           let json = object ...;
           defaultLayoutJson widget json }

Anchor links in book headlines

It would be easier to refer to specific parts of the book, if the headlines had anchor links to them.

I think a great example is the way Django documentation does it. When you hover over a headline, a line end symbol (or whatever it's called) appears and contains a link to the headline so that you can copy the link from there.

This is just a suggestion for enhancement. It's useful to refer people to specific sections in discussions when giving a link to whole chapter is too unspecific.

Add readme

I was about to make a pull request for a minor improvement in one of the book chapters, but I'm a bit confused if I'm supposed to edit the raw dita files or if this is the right place to make changes to the book.

A readme file would be great to have in the root of the repository, explaining if here is the right place to make edits for the book or not.

O'Reilly ebook update cycle?

Hi Michael,

I was wondering how often O'Reilly updates the ebook versus the current online version of the Yesod book (I noticed in my O'Reilly account the last update date is in March). Is it just from one major version (e.g., 1.4 to 1.5) or something like that, or can they update it real time even with minor updates to the framework and the online version of the book?

Is there anything like a private repo for subscribers to get regenerated PDF's?

Thanks :)

Some errors in the chapter about Persistent

Hi. I've spotted some error in the Persistent chapter. Probably the book just hasn't been up-to-date with the code.

  • persist quasi-quoter should be actually persistUpperCase or persistLowerCase
  • The EmptyDecls extension should be turned on

Thanks.

Are addCassiusMedia/addLuciusMedia still available in yesod-1.2?

I am unable to find them.

If not, what's the alternatives? And the widgets chapter needs to be updated.

addCassiusMedia, addLuciusMedia
Works the same as toWidget, but takes an additional parameter to indicate what kind of media this applies to. Useful for creating print stylesheets, for instance.

Website down (2013-07-23)

Hello,

your website appear to be down since 2013-07-23 03:00:00 (Error code: ERR_CONNECTION_RESET)

Sincerly,
Thibault.

Default time values in Yesod with PostgreSQL

Hello,

A moment ago, I needed a default time value in a new column of a table in one
of my Yesod pages. This was my table without the default:

Entry
    title Text
    posted UTCTime
    updated UTCTime
    content Markdown

"updated" is the new table. [1] uses "updated UTCTime default=CURRENT_TIME" somewhere, but indeed, PostgreSQL did not want to accept this:

Migrating: ALTER TABLE "entry" ADD COLUMN "updated" TIMESTAMP NOT NULL DEFAULT CURRENT_TIME
devel.hs: SqlError {sqlState = "42804", sqlExecStatus = FatalError, sqlErrorMsg = "Spalte \"updated\" hat Typ timestamp without time zone, aber der Vorgabeausdruck hat Typ time with time zone", sqlErrorDetail = "", sqlErrorHint = "Sie müssen den Ausdruck umschreiben oder eine Typumwandlung vornehmen."}

Well, this is german, so I'll translate the message: "Column "updated" has type timestamp without time zone, but the default expression has the type time with time zone"

Typewise, the expression "CURRENT_TIMESTAMP" would fit (according to the postgreSQL documentation, it has the type TIMESTAMP WITH TIME ZONE).
However, on saving this into a column without a time zone (as persistent generated from the definition above), PostgreSQL drops the time zone. In the end, it writes local time values into the database. I decided to use now and set the time zone explicitly:

updated UTCTime "default=now() at time zone 'utc'"

Perhaps it would be a good idea to use something like that in the Yesod Book

Best regards

Bastian

[1] http://www.yesodweb.com/book/persistent

Small wording problem in the book (Chapter 'Basics')

Hi there, I've just recently begun reading the yesod book and stumbled upon this sentence in the last paragraph of the 'Basics' chapter:

"For rapid development, you can use yesod devel is a good choice."

As far as I can tell this ought to be either:

"For rapid development, you can use yesod devel." OR
"For rapid development, yesod devel is a good choice."

Yesod Book is now NC-ND licensed‽

Was that something O'Reilly insisted upon? I was thinking of eventually contributing some improvements to the book, but now I'm not even allowed to use the material freely, and that's discouraging. NC is already non-free, but ND is additional restriction. That's an unfortunate mark, although I suppose it's true that there's at least the Haddock for the exact Yesod code, but the Yesod Book is otherwise the plain core documentation…

I'm not sure making this ticket is appropriate, but just wanted to clarify and understand the situation. I find it quite unfortunate. I suspect that the NC-ND terms do not actually lead to even the tiniest increase in sales or otherwise achieve anything positive whatsoever…

Thanks otherwise for all the great work on the software and licensing the rest of the site freely.

Header adding middleware problem

Hi

What's wrong with this addHead middleware? Custom header is not added.
It's similar to http://hackage.haskell.org/package/wai-extra-3.0.1/docs/src/Network-Wai-Middleware-AcceptOverride.html

Libraries: warp-3.0.0.4, wai-3.0.0.2

{-# LANGUAGE OverloadedStrings #-}

import Network.Wai.Handler.Warp
import Network.HTTP.Types.Status
import Network.Wai
import Data.ByteString.Lazy

main = run 8080 $ addHead $ body

body req respond = respond $ responseLBS (Status 200 "OK") [] "My server"
addHead app req = app $ req { requestHeaders = myHead : requestHeaders req }
myHead = ("X-Foo", "My very custom header")

What happened to forced logout plans for yesod 1.0?

In authentication chapter I stumbled upon subj (in the first note of the chapter). I do not remember anything about this topic in mailing list and can not find anything in haddocks.
Maybe this note should be updated?

ch00.xml doesn't exist

File book/yesod-web-framework-book.xml contains <xi:include href="ch00.xml"/>, but there is no such file. It seems to be an invalid docbook.

Snag with static.example.com domain

One snag with using a separate domain for static content is that if you want to serve the site over https you'll need a separate SSL certificate (or a wildcard, or one that gives static... as a Subject Alternative Name). It might be worth mentioning this.

Problems with blog example in book

I'm not sure if I can fix it directly on github or if the book's pages are still generated from some other source, so I'm reporting it here first. Some problems found by shapr on the yesod IRC channel:

  • in the browser, it looks like there's a line break on the share .. [persistLowercase| line
  • I18n section doesn't mention that file should be named en.msg and shakespeare doesn't give a helpful message either.
  • en.msg file contents should be highlighted or typeset differently somehow, line breaks are messed up
  • generateFormPost result type was changed
  • fieldLabel needs SomeMessage now
  • indenting between sections of code is difficult to keep track of, better provide a download link for the code (and en.msg)

Zoom broken on Safari

the web site goes berserk when Cmd-+ or Cmd-- is pressed for about 3-4 seconds, and then normalizes. It makes zooming in and out very inconvenient! I guess there's a JS component on the web site trying to make zoom animated, which is causing this?

External file example produces empty output in https://github.com/yesodweb/yesodweb.com-content/blob/master/book/shakespearean-templates.asciidoc#calling-shakespeare

The external file example in https://github.com/yesodweb/yesodweb.com-content/blob/master/book/shakespearean-templates.asciidoc#calling-shakespeare produces empty output.

(I am enjoying working through the book so far. great work!).

The output is an empty line, and if I intentionally break the lucius template, I don get any errors. Removing the CPP if/else/endif does not help, I get empty output from luciusFile and luciusFileDebug, and no error reported.

If I remove template.lucius, I do get an error. I'm on yesod-1.2.7.3

To eliminate typos, I copy pasted the example from yesod.com.

example with CPP out of the way:
{-# LANGUAGE OverloadedStrings #-} -- we're using Text below
{-# LANGUAGE TemplateHaskell #-}
--{-# LANGUAGE CPP #-} -- to control production versus debug
import Text.Lucius (CssUrl, luciusFile, luciusFileDebug, renderCss)
import Data.Text (Text)
import qualified Data.Text.Lazy.IO as TLIO

data MyRoute = Home | Time | Stylesheet

render :: MyRoute -> [(Text, Text)] -> Text
render Home _ = "/home"
render Time _ = "/time"
render Stylesheet _ = "/style.css"

template :: CssUrl MyRoute

template = $(luciusFileDebug "template.lucius")
--template = $(luciusFileDebug "template.lucius")

main :: IO ()
main = TLIO.putStrLn $ renderCss $ template render

intentionally broken lucius file (missing } ):

{- @template.lucius

foo { bar: baz

-}

ghc output:
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package filepath-1.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package unix-2.6.0.1 ... linking ... done.
Loading package directory-1.2.0.1 ... linking ... done.
Loading package process-1.1.0.2 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package text-0.11.3.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package parsec-3.1.3 ... linking ... done.
Loading package system-filepath-0.4.9 ... linking ... done.
Loading package system-fileio-0.3.12 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package shakespeare-1.2.1.1 ... linking ... done.
Loading package shakespeare-css-1.0.7.1 ... linking ... done.
Linking shakespeare04-external-stylesheet ...

FIXME in 'yesod typeclass' chapter

Michael, do you plan to fix it?
Do I undestand it right that the problem is Approot type which isn't mentioned in that chapter?
I'm translating this chapter right now and that FIXME bothers me a little bit

book-1.2/forms page is broken

This page on yesodweb.com is broken. Not sure if it's related to the actual content or not, though.

The error message is:

Internal Server Error

UnresolvedEntityException (fromList ["rsquo"])

Two small issues in the book:

Hi,
Firstly, thanks for all your time and work, this has been great to go through (I even bought a hardcopy, outdated as it is).

  1. At the top of every chapter, the "View source on Github" link directs you to an .xml file which 404s. The files are all .asciidoc

  2. In the first example ("Authenticate Me") of the "Authentication and Authorization" chapter, you import "def" from "Network.HTTP.Conduit". It seems as of http-conduit 2.0.0, you stopped exporting "def".
    Edit: I first tried using def from Data.Default, but there was no instance; I assume this is intentional. I was able to get it to work by importing "defaultManagerSettings" directly from "Network.HTTP.Client.Internal" of "http-client", but your warning there made it seem like you don't want people directly accessing it.

Thanks again!

Somewhat strange phrase in sphinx chapter (and broken convertion into HTML?)

I'm not sure how to post a link to a phrase on a website but in the source code it's located at https://github.com/yesodweb/yesodweb.com-content/blob/master/book/chapters/case-study-sphinx.dita#L1084 :

Let's first look at query:

And after that there is no code for query and just use of S.query (and before that you say that hasn't been defined yet and I understand it as it will be defined a bit later) inside quite long piece of code.

And there's a lot of copy-paste in this chapter. For Russian translation we are trying to cut code into the pieces which are described in the text nearby.
As I look into DITA sources it looks like DITA -> HTML conversion is broken (if -- START and -- STOP are part of DITA spec)

Chat example is broken

yesod-1.2.6.1

Chat/Data.hs, function getReceiveR:

    Couldn't match expected type `IO
                                    wai-3.0.2:Network.Wai.Internal.Response'
                with actual type `(wai-3.0.2:Network.Wai.Internal.Response
                                   -> IO wai-3.0.2:Network.Wai.Internal.ResponseReceived)
                                  -> IO wai-3.0.2:Network.Wai.Internal.ResponseReceived'
    In the return type of a call of `eventSourceAppChan'
    Probable cause: `eventSourceAppChan' is applied to too few arguments
    In the second argument of `($)', namely
      `eventSourceAppChan chan req'
    In a stmt of a 'do' block:
      res <- liftIO $ eventSourceAppChan chan req

In the Blog example, the Comment fetching retreives all comments made on all entries

When following the Blog example, I ran into the issue where comments from all entries were being loaded into a single Entry. Which is what the book is suggesting:

getEntryR :: EntryId -> Handler Html
getEntryR entryId = do
    (entry, comments) <- runDB $ do
        entry <- get404 entryId
        comments <- selectList [] [Asc CommentPosted]
        return (entry, map entityVal comments)

The following line:

comments <- selectList [] [Asc CommentPosted]

Shouldn't it be?

comments <- selectList [CommentEntry ==. entryId] [Asc CommentCreated]

So it only fetches the Comments for that Entry.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.