/
feed
394 lines (280 loc) · 32.4 KB
/
feed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text" xml:lang="en">SKURO! -- Shading lights</title>
<link type="application/atom+xml" href="http://skuro.tk/rss2/" rel="self"/>
<link type="text" href="http://skuro.tk" rel="alternate"/>
<updated>2013-03-27T16:47:25+01:00</updated>
<id>http://skuro.tk</id>
<author>
<name>Carlo Sciolla</name>
</author>
<rights>Copyright (c) 2010-2011 Carlo Sciolla</rights>
<entry>
<title>October Amsterdam Clojure 2012 is coming up!</title>
<link href="http://skuro.tk/2012/10/14/october-amsterdam-clojure-coming-up/"/>
<updated>2012-10-14T00:00:00+02:00</updated>
<id>http://skuro.tk/2012/10/14/october-amsterdam-clojure-coming-up/</id>
<summary type="html"><p>Saturday, October 27th. Less than two weeks. That's the time when
October Amsterdam Clojure, the biggest Clojure free event in the
Netherlands, will be up on stage. I'm so incredibly excited about it,
I can't wait to see all the seasoned clojurians, passionate
technologists and curious newbies meet together to discuss one of the
most intriguing technologies of our present day. Here's a couple of
things to remind you of what's ahead of us.</p>
<h1>Don't forget to bring a ticket</h1>
<p>As much as the event is totally free to attend, our limited logistics
imposes us a limit on the attendance. In order to reserve your seat at
the event, just go on the event
<a href="http://bit.ly/octamsclj-register">Meetup page</a> and RSVP. This much,
and you'll be joining us and have full access to the conference.</p>
<h1>How to reach us</h1>
<p>As it goes with all Amsterdam Clojurians regular meetup, the big
October event will be also hosted by
<a href="http://www.backbase.com">Backbase</a>. You can find the <a href="http://www.backbase.com/contact/DIRECTIONS-backbase-INIT.pdf">directions to
the venue</a> on the official <a href="http://amsclj.nl/october.html">event page</a>.
While it's not far from Central Station, make sure to take note of the
correct address. Once you're in the neighborhood, it's easy to find
us: just go to the main entrance of the big, glass building with the
huge newspapers logos on top. Yes,
<a href="http://www.cctvinfo.com/news_images/Geutebruck_INIT_building_ext.gif">that one</a>.
You'll find some of our awesome Clojurian volunteer to wait for you
downstairs.</p>
<h1>Afterparty drinkup</h1>
<p>We're still in the process of organizing a drinkup right after the
event, make sure your agenda is free in order to join the swarm of
Clojure coders and discuss functional programming philosophies over a
couple of beers!</p>
<h1>Stay up to date</h1>
<p>Events are complex beasts, and we'll try hard to let you always be up
to date with any sudden change of the plan. If you want to double
check the official plan, here's where you can find all the info you
need:</p>
<ul>
<li><p>the official <a href="http://bit.ly/octamsclj-register">event page</a></p></li>
<li><p>#OctAmsClj at
<a href="http://www.meetup.com/The-Amsterdam-Clojure-Meetup-Group/events/74036402/">Meetup.com</a></p></li>
<li><p>our official social channels (<a href="http://www.meetup.com/The-Amsterdam-Clojure-Meetup-Group/events/74036402/">Twitter</a></p></li>
<li><p>our official social channels (<a href="https://twitter.com/amsclj">Twitter</a>,
(Facebook)[http://www.facebook.com/AmsterdamClojurians] and
<a href="https://plus.google.com/107873826198867434419/about">Google+</a></p></li>
</ul>
<p>Looking forward to meet you there!</p>
</summary>
</entry>
<entry>
<title>org4idea adds org-mode support to Intellij IDEA</title>
<link href="http://skuro.tk/2012/09/08/org-mode-intellij-plugin/"/>
<updated>2012-09-08T00:00:00+02:00</updated>
<id>http://skuro.tk/2012/09/08/org-mode-intellij-plugin/</id>
<summary type="html"><p><em>tl;dr:</em> <a href="https://github.com/skuro/org4idea">org4idea</a> is a brand new
project to add <a href="http://orgmode.org">org-mode</a> support to <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a></p>
<h2>A coin with two sides</h2>
<p>Given the gargantuan size of the feature list of
<a href="http://orgmode.org/">org-mode</a>, there's hardly any competition of
note taking systems for hackers. I'm completely sold on it since long
time already, so much that
<a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?uptime">uptime(1)</a> returns
always a quite precise approximation of the Emacs process lifetime.</p>
<p>While such setup makes for a merry and seamless experience while
hacking on my <a href="http://clojure.org/">Clojure</a> projects, the dream
breakes when I move to work on Java code, where I shall have no other
IDE besides <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a>.</p>
<h2>Baby steps</h2>
<p>As there's no better way than a quick hacking session to start the
weekend, I eventually decided to take some time to put together a
minimal plugin to support editing org files within IntelliJ: a few
hours later <a href="https://github.com/skuro/org4idea">org4idea</a> landed on my
GitHub account. It's a ridiculously tiny plugin at the moment, only
providing syntax highlight for comments and outlines.</p>
<p>While I'm
not planning to support all the features and plugins of org in
IntelliJ you can safely bet I'll be adding new features with time. You
can always open an <a href="https://github.com/skuro/org4idea/issues">issue</a>
to try to buy some karma points to that specific feature you desperately
need to be implemented (well, in such cases you could also realize you're just
one fork away).</p>
<h2>Installation</h2>
<p>While the plugin still awaits approval in the official
<a href="http://plugins.intellij.net/plugin?pr=&amp;pluginId=7095">repository</a> you
can manually install the plugin by downloading <a href="https://github.com/downloads/skuro/org4idea/org4idea.jar">org4idea.jar</a>
and feed it to the <em>Settings -> Plugins -> Install plugin from disk</em>
dialog.</p>
<p>Happy GTD!</p>
</summary>
</entry>
<entry>
<title>Slides from Dispatch in Clojure</title>
<link href="http://skuro.tk/2012/08/31/dispatch-in-clojure-presentation-slides/"/>
<updated>2012-08-31T00:00:00+02:00</updated>
<id>http://skuro.tk/2012/08/31/dispatch-in-clojure-presentation-slides/</id>
<summary type="html"><h2>Presentation slides</h2>
<p>A bit late, and already announced
<a href="https://twitter.com/skuro/status/233285542769487875">elsewhere</a>, but
here you can find the slides from the <em>Dispatch in Clojure</em>
presentation I gave at the
<a href="http://www.meetup.com/The-Amsterdam-Clojure-Meetup-Group/events/73689122/">August 2012 meetup</a>
of the
<a href="http://www.meetup.com/The-Amsterdam-Clojure-Meetup-Group/">Amsterdam Clojurians</a>
group. Hopefully it will ease you bearing to wait for the <a href="amsclj.nl/october.htm">October
Amsterdam Clojure</a> event later in October :-)</p>
<p>The code samples I used in the presentation are available on <a href="https://github.com/skuro/clj-dispatch">GitHub</a>.</p>
<iframe src="http://www.slideshare.net/slideshow/embed_code/13915010" width="427" height="356" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen> </iframe>
<h2>The story behind</h2>
<p>In a previous meetup a discussion arose about
<a href="http://clojure.org/protocols">protocols</a> and how they relate to
<a href="http://en.wikipedia.org/wiki/Mixin">mixins</a> in other languages such
as <a href="http://www.ruby-lang.org/en/">Ruby</a>. A quick mention to virtual
methods dispatch table was enough to let my head spin around all the
details I was missing on low level Clojure mechanics. A presentation
was due.</p>
<h2>What's in</h2>
<p>What I was curious about, and eventually ended in the presentation, is
how Clojure implements function calls and method dispatch from both a
low level JVM and high level language syntax perspectives, and how
they relate to each other. What's (briefly) covered in the
presentation:</p>
<ul>
<li>JVM bytecodes used for method call</li>
<li>plain <a href="http://clojure.org/functional_programming">function call</a> in Clojure</li>
<li><a href="http://clojure.org/multimethods">multimethods</a></li>
<li><a href="http://clojure.org/Protocols">protocols</a></li>
</ul>
<p>What couldn't be entered in the presentation is the interesting
digressions we had during the meetup using an open REPL, some sample
projects and a Java decompiler.</p>
<p>Video recordings are still a pending TODO in the meetup list, so if
you're around Amsterdam make sure you come and <a href="http://www.meetup.com/The-Amsterdam-Clojure-Meetup-Group/">join us</a> for some other
awesome Dutch Clojure nights!</p>
</summary>
</entry>
<entry>
<title>Slides from Alfresco the Clojure way</title>
<link href="http://skuro.tk/2011/11/10/slides-from-alfresco-the-clojure-way/"/>
<updated>2011-11-10T00:00:00+01:00</updated>
<id>http://skuro.tk/2011/11/10/slides-from-alfresco-the-clojure-way/</id>
<summary type="html"><p>I just gave a talk at the Alfresco DevCon 2011 in London, and I published the slides at slideshare:</p>
<div style="width:425px; padding-left: 10%" id="__ss_10104981">
<iframe src="http://www.slideshare.net/slideshow/embed_code/10104981" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div>
<p>There's also an <a href="http://slidesha.re/uqUqOW">extended version</a> of the presentation that I originally wrote, which ended up being too big for the time slot I had.</p>
<p>Hope you either enjoyed the talk or the slides, next steps are getting to <a href="https://github.com/skuro">GitHub</a> and fork <a href="https://github.com/skuro/lambdalf">lambdalf</a> and <a href="https://github.com/skuro/spring-webscripts-addon-clojure">clojure webscripts</a> away!</p>
</summary>
</entry>
<entry>
<title>October Amsterdam Clojure with Uncle Bob</title>
<link href="http://skuro.tk/2011/09/27/october-amsterdam-clojure-with-uncle-bob/"/>
<updated>2011-09-27T00:00:00+02:00</updated>
<id>http://skuro.tk/2011/09/27/october-amsterdam-clojure-with-uncle-bob/</id>
<summary type="html"><p>I'm very excited to announce that we have finalized the details, and
Wednesday, October 12th we're going to have a great <a href="http://bit.ly/ams-clj">Amsterdam Clojure meetup</a>", with great talks and an awesome guest speaker: <a href="http://twitter.com/#!/unclebobmartin">"Uncle" Bob Martin</a> from <a href="http://www.objectmentor.com/">Object Mentor</a> and of <a href="http://www.cleancoders.com/">Clean Coders</a> fame.</p>
<p>Thanks to <a href="http://www.sourcesense.com">Sourcesense</a>, which is once again backing up and ultimately allowing this event to happen in an awesome location such as the <a href="http://www.dezwijger.nl/">Pakhuis de Zwijger</a>, I look forward to meet a number of Clojure enthusiast, newcomers or tired Java developers looking for something new.</p>
<p>We have limited seating possibilities, so make sure to register at the <a href="http://www.meetup.com/The-Amsterdam-Clojure-Meetup-Group/events/33351892/">meetup official page</a> to ensure there will be a spot for you!</p>
<p><a href="http://bit.ly/ams-clj"><img src="http://download.skuro.tk/flyer.jpg" alt="&quot;Click to register&quot;" /></a></p>
</summary>
</entry>
<entry>
<title>Clojure makes it to the Alfresco DevCon2011</title>
<link href="http://skuro.tk/2011/09/04/clojure-makes-it-the-alfresco-devcon-2011-emea-london/"/>
<updated>2011-09-04T00:00:00+02:00</updated>
<id>http://skuro.tk/2011/09/04/clojure-makes-it-the-alfresco-devcon-2011-emea-london/</id>
<summary type="html"><p>If you're a bit into Alfresco, you surerly know what the <a href="http://www.amiando.com/alfresco-devcon-london-2011.html">DevCon</a> is.</p>
<p>To use the same words from <a href="http://blogs.alfresco.com/wp/devcon/2011/08/04/save-the-date-alfresco-devcon-san-diego-london/">Jeff Potts</a>:
&nbsp;<br/>
&nbsp;</p>
<blockquote>the premier event for digging into the details of the Alfresco platform and collaborating with others who are doing the same</blockquote>
<p>Now, as soon as I received the <a href="http://ecmarchitect.com/archives/2011/08/09/1449">CallForPapers</a> I immediately (and impulsively!) submitted a talk named <em>Alfresco, the Clojure way</em> in the Customizing Alfresco track, where I wanted to introduce to enthusiastic Alfresco developers how to do their job using a fantastic <a href="http://clojure.org">programming language</a>. It was just last week that I was notified that yes, my talk made it to the conference schedule! Clojure goes to London!</p>
<p>It will be great chance for Clojure to prove itself a great tool, and to get some more exposure to software professionals around Europe and beyond. Now that things got serious, I really need to put my presentation together, and that's where you can provide some help.</p>
<p>I still don't know the time slot the presentation will be given, but surely enough I'll publish online the full version of it as soon as I'll be back from London. The following is the initial list of topics I'd like to cover, but I'm eager to know from you what you would like to add to it.</p>
<h2>High level topics</h2>
<ul>
<li>crash-course on <a href="http://clojure.org/reader">Clojure syntax</a></li>
<li>extremely fast digression on some core language features and <a href="http://en.wikipedia.org/wiki/Functional_programming">functional programming</a> topics</li>
<li>introduction to <a href="https://github.com/skuro/lambdalf">lambdalf</a>, a Clojure adapter to the Alfresco <a href="http://wiki.alfresco.com/wiki/Java_Foundation_API">Foundation API</a></li>
<li>introduction to the <a href="https://github.com/skuro/spring-webscripts-addon-clojure">Clojure addon</a> for the Spring Web Script framework</li>
<li>show and tell: start Alfresco, start a <a href="https://github.com/technomancy/swank-clojure">swank</a> server and do live coding against the repository</li>
<li><em>OPTIONAL:</em> showcase a Clojure-based <a href="https://github.com/skuro/lambdalf-samples">sample</a> Alfresco application</li>
</ul>
<p>Again, I don't know how much time I'll be given, so I can't even guarantee I'll have time for all the above topics to get a proper introduction, but since I also might have still enough time to cover other topics, what would you like to see in there?</p>
</summary>
</entry>
<entry>
<title>More Clojure for Spring Surf</title>
<link href="http://skuro.tk/2011/05/10/more-clojure-for-spring-surf/"/>
<updated>2011-05-10T00:00:00+02:00</updated>
<id>http://skuro.tk/2011/05/10/more-clojure-for-spring-surf/</id>
<summary type="html"><p>After some time from my <a href="http://www.skuro.tk/2010/05/23/spring-surf-meets-clojure">initial announcement</a>, I've started again working on my <a href="https://github.com/skuro/spring-webscripts-addon-clojure">Clojure addon for Spring Surf</a>. While it's still a rudimentary piece of glue code, it's now getting better and better, so much that I decided it's good enough now to release an alpha version on <a href="http://clojars.org/it.sk.spring.surf.clojure/spring-webscripts-addon-clojure">clojars</a>. Here's what this library currently provides:</p>
<ul>
<li>a <a href="https://github.com/skuro/spring-webscripts-addon-clojure/blob/master/src/main/java/org/springframework/extensions/webscripts/processor/ClojureScriptProcessor.java">ScriptProcessor</a> that allows webscript controllers to be written in Clojure</li>
<li><a href="https://github.com/skuro/spring-webscripts-addon-clojure/blob/master/src/main/clojure/spring/surf/webscript.clj">a <em>WebScript</em> protocol and some utility functions</a> to ease development of your own web scripts</li>
<li>enough <a href="https://github.com/skuro/spring-webscripts-addon-clojure/tree/master/src/main/resources/org/springframework/extensions/clj/webscripts">spring configuration</a> to enable this addon just by importing the provided contextes</li>
</ul>
<p>The approach is indeed easy and hopefully straightforward: the idea is to have your WebScript clojure controllers return an instance of a concrete implementation of the WebScript protocol, which will implement the <em>run</em> method the way you like.</p>
<p>Here's the sample code from a <a href="https://gist.github.com/965008">gist</a> you might want to have a look at to better understand how to use this library:</p>
<script src="https://gist.github.com/965008.js?file=sample.get.clj"></script>
<p>You can also find other samples in the project <a href="https://github.com/skuro/spring-webscripts-addon-clojure/tree/master/src/test/resources/webscripts/test">tests</a>.</p>
<p>The next episode will be about <a href="https://github.com/skuro/lambdalf"><em>lambdalf</em></a>, an Alfresco AMP I've been initially developing to prove the Clojure surf addon works fine, but that is now growing to be a full blown project by itself: a Clojure API for Alfresco!</p>
<p>Stay tuned. <span style="color: #ffffff;">UVBRKNJTRFH7</span></p>
</summary>
</entry>
<entry>
<title>Performance boost in Clojure 1.3 (alpha4)</title>
<link href="http://skuro.tk/2011/01/24/performance-boost-in-clojure-1-3/"/>
<updated>2011-01-24T00:00:00+01:00</updated>
<id>http://skuro.tk/2011/01/24/performance-boost-in-clojure-1-3/</id>
<summary type="html"><p>As release 1.3 of Clojure is <a href="http://www.assembla.com/spaces/clojure/milestones/238781-release-next">on its way</a>, I decided to give the currently available alpha4 a try and see some of the good stuff it brings. First thing first, I wanted to experiment myself with the performance gain that the extended support for native types would bring. I ran into an old <a title="old post, but inspirational" href="http://hughw.blogspot.com/2009/01/clojure-vs-javafx-script-only-5x-slower.html">post</a> from which I got the inspiration for the specific test to run: the <a title="Takeuchi function on Wikipedia" href="http://en.wikipedia.org/wiki/Tak_(function)">Takeuchi function</a>.</p>
<p><img class="aligncenter size-full wp-image-340" title="Full disclosure: I own a Triumph Street Triple and I love Clojure" src="/img/post/clj-triple.jpg" alt="Full disclosure: I own a Triumph Street Triple and I love Clojure" width="375" height="322" /></p>
<p>The Java implementation for Tak provided me with a bottom line for performance comparison:</p>
<script src="https://gist.github.com/788834.js?file=Tak.java"></script>
<p> Then I used the Clojure version provided in the original blog post run to test against Clojure 1.2: <script src="https://gist.github.com/788834.js?file=tak2.clj"></script></p>
<p>Finally, I leveraged the new syntax for the <a href="http://dev.clojure.org/display/doc/Enhanced+Primitive+Support">enhanced primitives support</a> to test against Clojure 1.3 (thanks to <a href="http://twitter.com/neotyk">neotyk</a> to point that out to me):</p>
<script src="https://gist.github.com/788834.js?file=tak.clj"></script>
<p>As you can see, timing is tracked from the application code, as various accessory overhead like JVM and Clojure runtime bootstrap are not in the scope of this post.</p>
<p>As this benchmark is "just for fun", I won't pretent I did an extensive benchmark, or that I engineered a bullet proof benchmark strategy and the like. I just ran the above code some tens of times and here follows the average running time for the three versions:</p>
<p><span style="color: #ff0000;">NOTE: an updated benchmark is provided down below</span>
<span style="color: #ff0000;">NOTE2: to have a more fair performance comparison, <a href="#reloaded">keep reading</a></span>
<img class="aligncenter size-full wp-image-344" title="Benchmark results" src="http://www.skuro.tk/wp-content/uploads/2011/01/clj-bench-graph.png" alt="Average running time in ms" width="467" height="292" /></p>
<p>The results tells of a <strong>~4.5x</strong> speed gain, <del datetime="2011-01-26T09:59:07+00:00">getting close to match plain Java code performance</del>.</p>
<p>Now, even if such a benchmark won't be any news to the Clojure community, it's still <strong>absolutely awesome</strong> to see such a performance gain in the next release of this beautiful Lispy language :-)</p>
<p><strong>Update: </strong>following the advice by <strong>Jürgen Hötzel</strong> in his comment, I slightly modified my Clojure sources to change <span style="font-family: monospace;"><a href="http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/-">clojure.core/-</a></span> with <span style="font-family: monospace;"><a href="http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/unchecked-subtract">clojure.core/unchecked-subtract</a></span> and re-run the test. Here's the final results, which are way better for Clojure, especially for version 1.2:</p>
<p><img class="aligncenter size-full wp-image-350" title="clj-bench-graph-unchecked" src="http://www.skuro.tk/wp-content/uploads/2011/01/clj-bench-graph-unchecked.png" alt="" width="493" height="302" /></p>
<p><strong>Update 2:</strong> the following graph shows the impact of the direct use of the <span style="font-family: monospace;">recur</span> special form tested against plain recursive invocation of Tak, as per requested in some comments
<img class="aligncenter size-full wp-image-353" title="clj-bench-graph-norecur" src="http://www.skuro.tk/wp-content/uploads/2011/01/clj-bench-graph-norecur.png" alt="" width="476" height="267" /></p>
<p><strong>Update 3:<a name="reloaded"></a></strong> even if this all started as a quick&amp;dirty, amatorial benchmark, it attracted quite some <a href="http://news.ycombinator.com/item?id=2134950">attentions</a>, demanding more fair and precise benchmarks, especially on the Java vs Clojure comparison. As in the Java version of Tak I used Integers and not primitive types, there is an unfair burden Java had to carry along the computation. The following is the result of a re-run of the test for Java (using primitive <span style="font-family: monospace;">long</span>) and Clojure 1.3:
<img class="aligncenter size-full wp-image-356" title="clj-bench-reloaded" src="http://www.skuro.tk/wp-content/uploads/2011/01/clj-bench-reloaded.png" alt="" width="463" height="272" /></p>
</summary>
</entry>
<entry>
<title>Spring Surf meets Clojure</title>
<link href="http://skuro.tk/2010/05/23/spring-surf-meets-clojure/"/>
<updated>2010-05-23T00:00:00+02:00</updated>
<id>http://skuro.tk/2010/05/23/spring-surf-meets-clojure/</id>
<summary type="html"><p>For those who missed it, some time ago the <a href="http://www.alfresco.com/">Alfresco</a> guys <a href="http://www.alfresco.com/media/releases/2009/12/spring_surf/">donated</a> their <a href="http://wiki.alfresco.com/wiki/Surf_Platform">Surf Platform</a> to <a href="http://www.springsource.com/">SpringSource</a>, giving birth to the now-called <a href="http://www.springsource.org/extensions/se-surf">SpringSurf</a>, which is thereby described as:</p>
<blockquote>a view composition framework for Spring MVC that plugs into your existing Spring applications. It provides a scriptable and content-centric approach to building web applications.</blockquote>
<p>I'm not going to introduce you how to use this yet-another MVC framework, but Michael Uzquiano provided an <a href="http://blogs.alfresco.com/wp/uzi/2009/11/03/using-surf-in-your-spring-apps/">awesome blogpost</a>, in case you were interested into learning more about it.</p>
<p>Part of the job of this Spring Surf framework is to provide an easy to use web scripting framework, REST like, that enables you to easily put together a View and, optionally, a Controller to implement a web API, provide them in the classpath together with a small XML descriptor, and your REST API is deployed right away. In the SpringSurf parlance, this is called called WebScript. Again, technical insights about the framework are better explained <a href="http://blogs.alfresco.com/wp/webcasts/2010/01/introducing-spring-surf-and-spring-web-scripts/">elsewhere</a>, so no repetitions here. What I think is cool about Spring Surf, and I'm here with you to discuss, is it's multi-language focus: web script Controllers can be written in Javascript, PHP or Groovy right out of the box, allowing you to choose whichever language you prefer. Moreover, if you just peek at Spring Surf <a href="https://anonsvn.springframework.org/svn/se-surf/tags/release-1.0.0.M3/spring-webscripts-addons/">source code</a>, plugging in support for new languages doesn't look so hard, so I decided to challenge myself and write support for Clojure backed webscripts. You can find the result of my efforts on <a href="http://github.com/skuro/spring-webscripts-addon-clojure">github</a>, with a sample webscript that proves the concept.</p>
<p>Following the webscript framework praxis, a <em>model</em> map object is passed around that acts as a container for whichever result your computation will produce, that will at the end handed over to a view rendition engine, <a href="http://freemarker.sourceforge.net/">Freemarker</a> in our case, to build the resulting document. Webscripts are intended to support a number of different output formats, from JSON to XML to plain text, so being generic here is not an option.</p>
<p>Anyway, the first thing you usually do is to populate the <em>model</em> map with a number of objects that will be needed by the rendering engine to build the response. To support this use case, this first implementation of the Clojure backend for Spring Surf webscripts expects your Clojure "script" to yield a map, in Clojure sense. This map will be then forwarded to a Freemarker template and used to build a webpage or whatever the user asked for, i.e. this controller:</p>
<pre><code>(ns web.script.test)
{:foo "bar"}
</code></pre>
<p>and this freemarker template:</p>
<pre><code>foo: ${foo}
</code></pre>
<p>will provide "foo: bar" back to the client.</p>
<p>This is just an experiment at the moment, and far from being production-quality stuff. Still, it has been instructing to build a Java-to-Clojure integration, and nonetheless it might come in handy when I'll be trying to put more Clojure in my working life.</p>
<p>(bye)</p>
</summary>
</entry>
<entry>
<title>Amsterdam Clojurians meeting #4 - Dojo style</title>
<link href="http://skuro.tk/2010/04/14/amsterdam-clojurians-meeting-4-dojo-style/"/>
<updated>2010-04-14T00:00:00+02:00</updated>
<id>http://skuro.tk/2010/04/14/amsterdam-clojurians-meeting-4-dojo-style/</id>
<summary type="html"><p>Today the fourth meeting of the Amsterdam Clojure user group was held at the now usual <a href="http://www.sourcesense.com">Sourcesense</a> offices venue in Amsterdam.</p>
<p>It has been probably the most successful one until now: thanks to some newcomers we had the most participated event ever with 10 nerdy, awesome geeks sitting together to discuss about nerdy, awesome stuff with lots of parenthesis.</p>
<p>As previously proposed by <a href="http://lifeisagraph.net/">Jeff Rose</a>, we started thinking about improvements we could provide to the standard Clojure REPL, deciding for colorful messages for the <strong>doc</strong> function. <a href="http://sam.aaron.name/">Sam Aaron</a> proposed then to follow a dojo-like approach, with a single laptop connected to a projector where everybody has the chance to step in and do some coding while everybody else discuss possible approaches and alternatives.</p>
<p>The resulting code from this session is available on <a href="http://github.com/ams-clj/clansi">github</a>. It does just a simple thing, it provides a way to override the default <strong>doc</strong> behavior in order to make use of our custom, colorful implementation of <strong>print-doc</strong>. And even if it doesn't look like rocket science, I can guarantee that being there and looking at how we came up with that, from some impressive vim-fu showed by <a href="http://blog.rubyenrails.nl/">Michiel de Mare</a> to the clever and clean code provided by <a href="http://blog.remvee.net/">Remco van 't Veer</a>, was indeed a lot of fun!</p>
<p>If all this sounds interesting to you, go and checkout the group <a href="http://groups.google.com/group/amsterdam-clojurians">mailing list</a> or just show up at the next meeting, second Wednesday of each month at the <a href="http://www.sourcesense.nl/contact/">Sourcesense office</a>.</p>
</summary>
</entry>
</feed>