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

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

gazette #10: titlecasing Mr. Dai

File size: 11.2 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
61Felix has also fixed some bugs in {{find-files}}, {{delete-directory}} and blob read-syntax, among other fixes and improvements.
62
63
64== 3. Chicken Talk
65
66Some 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.
67
68The  [[http://lists.nongnu.org/mailman/listinfo/chicken-users|chicken-users]] mailing list has been quite active lately.
69
70[[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 plaftforms 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.
71
72[[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.
73
74The 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.
75
76Yi 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.
77
78Alan 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.
79
80Among 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.
81
82
83
84== 4. Omelette Recipes - Tips and Tricks
85
86For 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]]. 
87
88[[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]]).
89
90The [[http://wiki.call-cc.org/egg/sandbox|sandbox]] egg provides a safe evaluation context for basic Scheme expressions. 
91
92We're going to implement a very simple web-based Chicken REPL using a sandbox environment for safe evaluation.
93
94The 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.
95
96Here's the commented code:
97
98<enscript highlight=scheme>
99(use html-tags awful sandbox)
100
101;; Here we define the REPL page.  It uses the session to store the
102;; sandboxed environment.  By default, the `main-page-path' parameter
103;; value is "/".
104(define-session-page (main-page-path)
105  (lambda ()
106
107    ;; Create the sandbox environment (if it does not exist yet) and
108    ;; store it in the user session.
109    (unless ($session 'sandbox-env)
110      ($session-set! 'sandbox-env
111                     (make-safe-environment
112                      parent: default-safe-environment
113                      mutable: #t
114                      extendable: #t)))
115
116    ;; Here we set an ajax handler for the REPL expressions
117    ;; submission.  When users change the REPL input widget (i.e., by
118    ;; pressing ENTER), the contents of the text input field are
119    ;; submitted and handled by the procedure given as the forth
120    ;; argument to `ajax'.
121    (ajax "eval" 'repl-input 'change
122          (lambda ()
123
124            ;; This binds the variable `repl-input' from the POST
125            ;; method the the `repl-input' Scheme variable
126            (let ((repl-input ($ 'repl-input)))
127
128              ;; We'd better handle exceptions when trying to
129              ;; evaluate the expressions given by users.
130              (handle-exceptions
131               exn
132               ;; If something goes wrong, we print the error message
133               ;; and the call chain.
134               (<pre> convert-to-entities?: #t
135                      (with-output-to-string
136                        (lambda ()
137                          (print-error-message exn)
138                          (print-call-chain))))
139               ;; Here we try to evaluate the given expression in the
140               ;; sandboxed environment stored in the user session.
141               ;; The `repl-output' page div is updated with the result.
142               (<pre> convert-to-entities?: #t
143                      (safe-eval
144                       (with-input-from-string repl-input read)
145                       fuel: 100
146                       allocation-limit: 100
147                       environment: ($session 'sandbox-env))))))
148
149          ;; Here we pass the contents of the text input to the ajax
150          ;; handler.  The default HTTP method used by `ajax' is POST.
151          arguments: `((repl-input . "$('#repl-input').val()"))
152
153          ;; The output of the ajax handler updates the `repl-output'
154          ;; page div.
155          target: "repl-output")
156
157    ;; Here's what is displayed to users
158    (++ (<h1> "Sandboxed Chicken web REPL")
159        (<input> type: "text" id: "repl-input")
160        (<div> id: "repl-output")))
161
162  ;; This tells `define-session-page' to link the page to JQuery
163  use-ajax: #t)
164</enscript>
165
166To run the code above you'll need to install awful and sandbox:
167
168  $ chicken-install awful sandbox
169
170Then (considering you save the code above in a file called {{web-sandbox.scm}}), run:
171
172  $ awful web-sandbox.scm
173
174and access {{http://localhost:8080}}.
175
176
177Here are some screenshots of the code above running on Firefox:
178
179[[image:http://parenteses.org/mario/misc/web-sandbox.png|Screenshot of the sandboxed web REPL running on Firefox]]
180
181If you try something nasty, the sandbox will abort the evaluation and you'll get an error message and the call chain:
182
183[[image:http://parenteses.org/mario/misc/web-sandbox-loop.png|Screenshot of the sandboxed web REPL running on Firefox]]
184
185We can also compile the web application:
186
187 $ csc -s web-sandbox.scm
188 $ awful web-sandbox.so
189
190
191
192== 5. About the Chicken Gazette
193
194The Gazette is produced weekly by a volunteer from the Chicken
195community. The latest issue can be found at
196[[http://gazette.call-cc.org]] or you can follow it in your feed
197reader at [[http://gazette.call-cc.org/feed.atom]]. If you'd like to
198write an issue,
199[[http://bugs.call-cc.org/browser/gazette/README.txt|check out the instructions]]
200and come and find us in #chicken on Freenode!
Note: See TracBrowser for help on using the repository browser.