Monday, 25 October 2010
RedBook draft out for OSGi applications and JPA 2.0 feature pack
I have the great pleasure to announce that the OSGi applications feature pack, which I have been working on for the past year and so, will soon have a dedicated IBM RedBooks publication to its name. The open draft can be found here.
Friday, 24 September 2010
JLine clojure wrapper
I recently wanted to write a bit of interactive shell and to my dismay discovered that apparently no one in the wide clojure community has yet wrapped up the JLine library. What a shame!
So I have knocked up something as best as I could. The result is available under on GitHub: http://github.com/tuor713/uwh-clojure-common.
Example usage:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use 'uwh.common.jline) | |
(use '[clojure.contrib.io :only (file read-lines)]) | |
(def processor (atom identity)) | |
(defn nil-safe [f] #(if (nil? %) % (f %))) | |
(defn add! [f] (swap! processor #(comp (nil-safe f) %))) | |
(run | |
(commands | |
(transform [f :file] | |
(doall (map (comp (nil-safe println) @processor) | |
(read-lines (file f))))) | |
(reset [] (reset! processor identity)) | |
(include [re :any] | |
(add! #(if (.matches % (str ".*" re ".*")) | |
% nil))) | |
(exclude [re :any] | |
(add! #(if (.matches % (str ".*" re ".*")) | |
nil %))) | |
(replace [re :any s :any] | |
(add! #(.replaceAll % re s))) | |
(exit [] (reset! *exit* true)))) | |
Subscribe to:
Posts (Atom)