Clojure client for Beanstalkd forked

Beanstalkd is a distributed task queue written by Keith Rarick. I just forked the clojure client as the original version is no long active. Some features are added:

  • Add commands: stats-tube, stats-job, pause-tube, list-tubes, list-tube-used and list-tubes-watched
  • Use yaml library to decode stats output into clojure data structure.

Use it in your leiningen project:
[org.clojars.sunng/beanstalk "1.0.5"]

Clojure Developers You Should Follow

介绍一下Clojure社区的活跃人物,有助于大家更好地学习和了解clojure,以下罗列的前提是包含但不限于,排名亦不分先后。

Rich Hickey (richhickey)

Clojure的创始人。

Michael Fogus (fogus)

The joy of clojure一书的作者,clojure社区的活跃人物,Clojure/core的成员。参与和维护着很多clojure项目。

James Reeves (weavejester)

Compojure等一系列web框架的作者。是Clojure web开发方面的先驱,还维护着大量的clojure项目。

Mark McGranaghan (mmcgrana)

Clojure web规范Ring的创始人,还维护着clj-redis等项目。

Stuart Hallowa (stuarthalloway)

Programming Clojure一书的作者,Clojure的核心开发人员之一。

Christophe Grand (cgrand)

cgrand是clojure web开发方面的专家,维护了enlive moustache等库。

Phil Hagelberg (technomancy)

Clojure构建工具leiningen的作者。

Zach Tellman (ztellman)

Zach是框架aleph/lamina/gloss的作者,是clojure网络编程的专家。

Nathan Marz (nathanmarz)

Nathan是twitter的clojure dev,维护着一些与hadoop相关的clojure项目。

以上列举的人都可以在github和twitter上找到。

苏制油罐车模型

前段时间说发展兴趣爱好,于是又多了一个心灵手巧的爱好:静态模型。昨天买了一套油罐车模型(ATZ 5-4320)1:72,今天上午花了一上午时间就把它组装起来了。这种静态模型需要用胶水把各个零件粘合起来。所以对心灵手巧的要求程度比较高,作为一个小时候手工课沿着线剪纸都剪不齐的娃来说,其实这是一种挑战。
DSC_0001

DSC_0002

DSC_0003

DSC_0004

DSC_0005

DSC_0006

DSC_0007

DSC_0008

这个是乌克兰的品牌叫做ICM,1:72的模型通常在50元上下。质量一般,有的小零件刚刚还没有拆下来就损坏了。当然全看个人喜好,我之所以买这个来入门主要是出于随便。静态模型入门的工具,需要一个水口钳(用来把零件剪下来),一瓶模型专用胶水(味道不太好),一把镊子,一把钢尺,一张砂纸。网上还说的角刀一类,暂时可以不用。

上面的照片是还没有上漆的效果,等到我把第二个也做出来,再买一点专用的油漆把它刷出来。敬请留意。

我小时候的愿望就是住一楼有个院子,在一角能开辟一个沙盘,把我的小人兵通通部署上去。我小时候确实就生活在这种没有硝烟的战争里。。。

Clojure Chinese User Group第一次线下聚会

今天下午赶到上海参加了clojure中文用户的第一次线下聚会,见到了国内clojure的的主要用户。感谢一直在努力组织这次活动的朋友,还有提供场地的朋友。

这是我关于clojure构建工具、生命周期管理的slides

欢迎对clojure感兴趣的朋友加入中文用户邮件列表,希望这样的聚会活动可以长期的办下去。

Using Google closure library with ClojureScript

Google closure library is shipped with ClojureScript, and could be compiled with ClojureScript into a minimized javascript file. So closure library is doubtlessly the first candidate when you are considering to use an external Javascript library in your cljs browser application.

However, different from clojure’s interoperability with Java, ClojureScript has its own characteristics when you are interoperating with JavaScript and JavaScript based libraries.

Clojure types are not fully compatible with JavaScript types
In ClojureScript, you can never treat a Clojure map as a JavaScript object although they have similar characteristics. You have to do some conversion before passing a clojure map to javascript functions. Matthew Gilliard made a sample of such conversion.

JavaScript package is not Clojure namespace
This could be a common mistake for ClojureScript newbie. Actually, JavaScript doesn’t have concept of “Package” or “Namespace”. Many JavaScript libraries(dojo, Google Closure) made enhancement on this. ClojureScript also takes advantage of this mechanism. So before you start to coding with closure, you may browse closure library API document, and find a module called goog.net which includes lots of types. Then you write this:

(ns myjs
  (:require [goog.net :as gnet]))

But compiler shows you “ERROR: JSC_MISSING_PROVIDE_ERROR. required “goog.net” namespace never
provided at … “. This is not a PATH issue. The root cause is that closure module has a lower granularity than Clojure ones. Types are often contained in their own modules. You can find closure source code in clojurescript/closure/library/closure. Modules are declare with goog.provide function. Thus, you should require this name instead of the logical module name.

(ns myjs
  (:require [goog.net.XhrIo :as gxhr]))

In addition, ClojureScript does not support ‘use’.

Just use full name for JavaScript class
For functions contains in some module, you can refer it with the clojure way:

(ns myjs
  (:require [goog.dom :as dom]))
(dom/$ "element-id")

But for classes, just use the full name and ignore the module alias.

(ns myjs
  (:require [goog.net.XhrIo :as gxhr]))
(def xhr (goog.net.XhrIo.))

These are basic tips before you start using Closure with ClojureScript. Leveraging on Google’s closure library, you can create cross-browser JavaScript application with Clojure easily.