source: project/gazette/src/issues/10.wiki @ 21153

Last change on this file since 21153 was 21153, checked in by Mario Domenech Goulart, 9 years ago

gazette #10: added more news to yolklore

File size: 11.3 KB
Line 
1((title . "Issue 10")
2 (authors "Mario Domenech Goulart")
3 (date . 1288436938))
4
5== 0. Introduction
6
7Welcome to issue 10 of the Chicken Gazette!
8
9
10== 1. The Hatching Farm
11
12It has been a fruitful week for the egg repository: two new eggs and lots of bug fixes and improvements.
13
14[[http://wiki.call-cc.org/users/moritz-heidkamp|Moritz Heidkamp]] has created the [[http://wiki.call-cc.org/egg/zmq|zmq]] egg, which contains bindings for the [[http://www.zeromq.org/|ZeroMQ]].
15
16[[http://wiki.call-cc.org/users/felix-winkelmann|Felix Winkelmann]] has ported [[http://snow.iro.umontreal.ca/?viewpkg=tar|Marc Feeley's tar]] implementation from the [[http://snow.iro.umontreal.ca|Scheme Now (Snow)]] project to Chicken, available as a chicken egg called [[snowtar]].
17
18[[http://wiki.call-cc.org/users/peter-bex|Peter Bex]] has fixed a serious issue in [[http://wiki.call-cc.org/egg/spiffy|Spiffy]], the Chicken web server.  As Peter noticed in [[http://lists.nongnu.org/archive/html/chicken-users/2010-10/msg00171.html|his message]] to the [[http://lists.nongnu.org/mailman/listinfo/chicken-users|chicken-users]] mailing list, earlier versions (i.e., 4.8 and older) are not affected by that bug. Spiffy users are encouraged to upgrade from version 4.9 to 4.10 (which also includes a fix for handling empty path components that are now preserved by [[http://wiki.call-cc.org/egg/uri-generic|uri-generic]]).
19
20Several eggs have been updated with minor changes:
21signal-diagram,
22[[http://wiki.call-cc.org/egg/make|make]],
23[[http://wiki.call-cc.org/egg/fast-generic|fast-generic]],
24vandusen,
25[[http://wiki.call-cc.org/egg/html-tags|html-tags]],
26[[http://wiki.call-cc.org/egg/srfi-27|srfi-27]],
27[[http://wiki.call-cc.org/egg/message-digest|message-digest]],
28[[http://wiki.call-cc.org/egg/simple-units|simple-units]],
29[[http://wiki.call-cc.org/egg/error-utils|error-utils]],
30interval-digraph,
31[[http://wiki.call-cc.org/egg/getopt-long|getopt-long]],
32[[http://wiki.call-cc.org/egg/format-textdiff|format-textdiff]],
33[[http://wiki.call-cc.org/egg/filepath|filepath]],
34[[http://wiki.call-cc.org/egg/digraph|digraph]],
35[[http://wiki.call-cc.org/egg/moremacros|moremacros]],
36[[http://wiki.call-cc.org/egg/sigma|sigma]],
37[[http://wiki.call-cc.org/egg/nemo|nemo]],
38miniML,
39[[http://wiki.call-cc.org/egg/json-abnf|json-abnf]],
40[[http://wiki.call-cc.org/egg/npdiff|npdiff]],
41[[http://wiki.call-cc.org/egg/html-form|html-form]],
42ext-direct,
43[[http://wiki.call-cc.org/egg/dict|dict]],
44[[http://wiki.call-cc.org/egg/uri-dispatch|uri-dispatch]],
45[[http://wiki.call-cc.org/egg/log5scm|log5scm]],
46and
47[[http://wiki.call-cc.org/egg/chickadee|chickadee]].
48
49Several egg authors have adopted the exit status "protocol" for [[http://tests.call-cc.org|tests]] with [[http://wiki.call-cc.org/egg/salmonella|salmonella]].  The tests are very important for the robustness of eggs and Chicken itself.  Since tests are executed by the Chicken core code from the [[http://code.call-cc.org/cgi-bin/gitweb.cgi?p=chicken-core.git;a=shortlog;h=refs/heads/master|git master branch]] they also help catching bugs in the compiler.  So, adding tests to eggs not only improves the quality of eggs themselves, but the whole Chicken system.
50
51
52
53== 2. Yolklore
54
55Our [[http://bugs.call-cc.org/ticket/332|esteemed team leader]] and core developer [[http://wiki.call-cc.org/users/felix-winkelmann|Felix Winkelmann]] has been put some work on the [[http://code.call-cc.org/cgi-bin/gitweb.cgi?p=chicken-core.git;a=shortlog;h=refs/heads/experimental|experimental branch]] of the git repository for the Chicken core code.
56
57Erik Falor has reported [[http://bugs.call-cc.org/ticket/418|a bug]] in the build system regarding to the relinking of {{libchicken}}, which has been fixed by Felix.
58
59Iruatã Souza has contributed a patch for basic proxy authentication for {{chicken-install}}.
60
61Alan Post reported a [[https://bugs.call-cc.org/ticket/421|bug]] which affected optional parameters in lambda lists, which was instantaneously fixed by Felix.
62
63Felix has also fixed some bugs in {{find-files}}, {{delete-directory}} and blob read-syntax, among other fixes and improvements.
64
65
66== 3. Chicken Talk
67
68Some Chicken developers are going to meet during the 5th edition of [[http://www.t-dose.org/|T-DOSE]], a free and yearly event held in The Netherlands to promote use and development of Open Source Software. This year's event will be held on 6 and 7 November 2010 at the Fontys University of Applied Science in Eindhoven.  If you plan to go to T-DOSE, visit the Chicken stand to meet Chicken developers and enjoy some Chicken software demonstrations which are planned for the event.
69
70The  [[http://lists.nongnu.org/mailman/listinfo/chicken-users|chicken-users]] mailing list has been quite active lately.
71
72[[http://wiki.call-cc.org/users/christian-kellermann|Christian Kellermann]] has published the [[http://lists.nongnu.org/archive/html/chicken-users/2010-10/msg00138.html|results of a survey]] he run to find out the platforms used by Chicken users.  The survey results publication was followed by even more late results, which showed that some people are running Chicken on ARM architecture.
73
74[[http://wiki.call-cc.org/users/felix-winkelmann|Felix Winkelmann]] has started a [[http://wiki.call-cc.org/wish-list|wish-list]] page in the [[http://wiki.call-cc.org|Chicken wiki]].  Users can write there suggestions and things they would like to have in Chicken.
75
76The thread started by Alan Post regarding to [[http://lists.nongnu.org/archive/html/chicken-users/2010-10/msg00111.html|using mmap files as strings]] has continued, with several suggestions and comments.  We are glad to have Alan Post back to Chicken development and discussions.
77
78Yi Dai asked about [[http://lists.nongnu.org/archive/html/chicken-users/2010-10/msg00143.html|the interaction between the readline egg and procedures line {{read}} and friends]].  [[http://wiki.call-cc.org/users/mario-domenech-goulart|Mario Domenech Goulart]] suggested [[http://lists.nongnu.org/archive/html/chicken-users/2010-10/msg00144.html|a hack]], but Yi Dai said that he'd like something like [[http://www.gnu.org/software/guile/guile.html|Guile]]'s behavior.
79
80Alan Post asked on IRC's {{#chicken}} for a directory for a new egg called {{genturfahi}}.  Alan said that {{genturfahi}} will allow for building parsers that can parse packrat/RATS! parser specifications.
81
82Among the usual lurkers and talkative {{#chicken}} users, a nice surprise was the presence of [[http://wiki.call-cc.org/users/daishi-kato|Daishi Kato]], a long time Chicken user and developer.
83
84
85
86== 4. Omelette Recipes - Tips and Tricks
87
88For this omelette recipe I'll try to follow [[http://wiki.call-cc.org/users/jim-ursetto|Jim]]'s mom advice ("write what you know") and show you a little example with a mix of two eggs: [[http://wiki.call-cc.org/egg/awful|awful]] and [[http://wiki.call-cc.org/egg/sandbox|sandbox]]. 
89
90[[http://wiki.call-cc.org/egg/awful|awful]] is a web framework built on top of [[http://wiki.call-cc.org/egg/spiffy|Spiffy]] and several web-related Chicken eggs (like [[http://wiki.call-cc.org/egg/http-session|http-session]] and [[http://wiki.call-cc.org/egg/spiffy-request-vars|spiffy-request-vars]]).
91
92The [[http://wiki.call-cc.org/egg/sandbox|sandbox]] egg provides a safe evaluation context for basic Scheme expressions. 
93
94We're going to implement a very simple web-based Chicken REPL using a sandbox environment for safe evaluation.
95
96The idea is to have a web page with an input box.  Users type the forms they want to evaluate and submit them to the server.  The server evaluates the given forms in a sandbox environment and return the results.
97
98Here's the commented code:
99
100<enscript highlight=scheme>
101(use html-tags awful sandbox)
102
103;; Here we define the REPL page.  It uses the session to store the
104;; sandboxed environment.  By default, the `main-page-path' parameter
105;; value is "/".
106(define-session-page (main-page-path)
107  (lambda ()
108
109    ;; Create the sandbox environment (if it does not exist yet) and
110    ;; store it in the user session.
111    (unless ($session 'sandbox-env)
112      ($session-set! 'sandbox-env
113                     (make-safe-environment
114                      parent: default-safe-environment
115                      mutable: #t
116                      extendable: #t)))
117
118    ;; Here we set an ajax handler for the REPL expressions
119    ;; submission.  When users change the REPL input widget (i.e., by
120    ;; pressing ENTER), the contents of the text input field are
121    ;; submitted and handled by the procedure given as the forth
122    ;; argument to `ajax'.
123    (ajax "eval" 'repl-input 'change
124          (lambda ()
125
126            ;; This binds the variable `repl-input' from the POST
127            ;; method the the `repl-input' Scheme variable
128            (let ((repl-input ($ 'repl-input)))
129
130              ;; We'd better handle exceptions when trying to
131              ;; evaluate the expressions given by users.
132              (handle-exceptions
133               exn
134               ;; If something goes wrong, we print the error message
135               ;; and the call chain.
136               (<pre> convert-to-entities?: #t
137                      (with-output-to-string
138                        (lambda ()
139                          (print-error-message exn)
140                          (print-call-chain))))
141               ;; Here we try to evaluate the given expression in the
142               ;; sandboxed environment stored in the user session.
143               ;; The `repl-output' page div is updated with the result.
144               (<pre> convert-to-entities?: #t
145                      (safe-eval
146                       (with-input-from-string repl-input read)
147                       fuel: 100
148                       allocation-limit: 100
149                       environment: ($session 'sandbox-env))))))
150
151          ;; Here we pass the contents of the text input to the ajax
152          ;; handler.  The default HTTP method used by `ajax' is POST.
153          arguments: `((repl-input . "$('#repl-input').val()"))
154
155          ;; The output of the ajax handler updates the `repl-output'
156          ;; page div.
157          target: "repl-output")
158
159    ;; Here's what is displayed to users
160    (++ (<h1> "Sandboxed Chicken web REPL")
161        (<input> type: "text" id: "repl-input")
162        (<div> id: "repl-output")))
163
164  ;; This tells `define-session-page' to link the page to JQuery
165  use-ajax: #t)
166</enscript>
167
168To run the code above you'll need to install awful and sandbox:
169
170  $ chicken-install awful sandbox
171
172Then (considering you save the code above in a file called {{web-sandbox.scm}}), run:
173
174  $ awful web-sandbox.scm
175
176and access {{http://localhost:8080}}.
177
178
179Here are some screenshots of the code above running on Firefox:
180
181[[image:http://parenteses.org/mario/misc/web-sandbox.png|Screenshot of the sandboxed web REPL running on Firefox]]
182
183If you try something nasty, the sandbox will abort the evaluation and you'll get an error message and the call chain:
184
185[[image:http://parenteses.org/mario/misc/web-sandbox-loop.png|Screenshot of the sandboxed web REPL running on Firefox]]
186
187We can also compile the web application:
188
189 $ csc -s web-sandbox.scm
190 $ awful web-sandbox.so
191
192
193
194== 5. About the Chicken Gazette
195
196The Gazette is produced weekly by a volunteer from the Chicken
197community. The latest issue can be found at
198[[http://gazette.call-cc.org]] or you can follow it in your feed
199reader at [[http://gazette.call-cc.org/feed.atom]]. If you'd like to
200write an issue,
201[[http://bugs.call-cc.org/browser/gazette/README.txt|check out the instructions]]
202and come and find us in #chicken on Freenode!
Note: See TracBrowser for help on using the repository browser.