Re: Nginx-Clojure Let You Deploy Clojure Web App on Nginx Without Any Java Web Server

2014-01-14 Thread Feng Shen
Hi, Thanks for your work on nginx-clojure. It looks great! As I know Nginx spawns many processes(correct me if I am wrong), does that mean, there will be many JVM process? On Tuesday, January 14, 2014 4:44:18 PM UTC+8, Xfeep Zhang wrote: I have done the first one. The result is

Re: [ANN] http-kit 2.0.0 released

2013-05-03 Thread Feng Shen
2. less RAM usage The full update log: https://github.com/http-kit/http-kit/blob/master/history.md Updated client documentation: http://http-kit.org/client.html On Friday, March 29, 2013 2:03:38 PM UTC+8, Feng Shen wrote: Hello folks. I just released version 2.0.0 of http-kit. *2.0.0

Re: http-kit on heroku?

2013-04-30 Thread Feng Shen
Hi, here is how to do hot code reload: http://http-kit.org/migration.html#reload On Monday, April 15, 2013 12:48:50 PM UTC+8, Wei Hsu wrote: Thanks guys, got it sorted out. If I may ask a followup question, how do you run it in development? Pre-http-kit, I've been using lein ring

Re: what is a good book about Java queues?

2013-03-09 Thread Feng Shen
Yes, the javadoc is quite good, paste a link here: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html On Friday, March 8, 2013 4:32:38 AM UTC+8, larry google groups wrote: At some point on this mailist, someone suggested that to best understand concurrency in

Re: AOT and side-effects associated to ns initialization

2013-02-27 Thread Feng Shen
Hi, Another option: (ns you.ns // add :aot [you.ns] to project.clj (:gen-class)) (def server (atom nil)) (defn -main [ args]; command line args (reset! server (jetty/run-jetty #'app {:port 8000 :join? false}))) ;;; run it and pass command line arguments java -cp

Help on drafting a protocol for realtime communication between client and ring server

2013-02-15 Thread Feng Shen
Hi, I am trying to draft a protocol for realtime communication between client and ring server. http-kit http://http-kit.org/ try to implement the protocol, provide a fast scalable ring adapter with websocket async extension for Clojure web developers. Here is an initial version, any

Re: Help on drafting a protocol for realtime communication between client and ring server

2013-02-15 Thread Feng Shen
Opps, this post is intended to be posted on the Ring group, sorry for the noise. On Friday, February 15, 2013 5:50:15 PM UTC+8, Feng Shen wrote: Hi, I am trying to draft a protocol for realtime communication between client and ring server. http-kit http://http-kit.org/ try to implement

Re: Building/inserting multiple records

2013-02-15 Thread Feng Shen
Is it easy (and immutable) to build a collection of records to insert? I've been told CONJ is a good start. map maybe be helpful: (map (fn [d] return-map-of-records) datasets) Does the clojure jdbc interface support insertion of multiple records? I haven't seen such a function yet.

Re: Packaging/Deploying Web App

2013-02-13 Thread Feng Shen
Hi, here is one solution: add (:gen-class) to the main namespace, add something in your project.clj :aot [rssminer.main, rssminer.admin] :main rssminer.main :uberjar-name rssminer-standalone.jar lein uberjar Package up the project files and all dependencies into a jar file java -jar

Re: Clojure + Web Services + Web Sockets

2013-02-12 Thread Feng Shen
I updated http-kit's server documentation: http://http-kit.org/server.html How http-kit is used to serve both HTTP and websocket: http://http-kit.org/server.html#routing Cheers, Feng On Tuesday, February 12, 2013 7:36:46 AM UTC+8, Ryan T. wrote: Thanks both for your answers. @Bob, I didn't

Re: Bootstrapping Web Apps

2013-02-12 Thread Feng Shen
Hi, here is what I did for rssminer (A Clojure web app): https://github.com/shenfeng/rssminer/blob/master/src/rssminer/main.clj define a main function, accept args from stdin, parse them, save the argument, call `start-server`, do init, bind to port, accept request On Wednesday, February

Re: how to automatically and idiomatically add newlines to clojure code in emacs

2013-02-11 Thread Feng Shen
(defun indent-buffer () (interactive) (indent-region (point-min) (point-max))) (defun cleanup-buffer () (interactive) (indent-buffer) (untabify-buffer) (delete-trailing-whitespace)) ;; bind to other key if you like(global-set-key (kbd M-q) 'cleanup-buffer) cleanup-buffer is very

Re: Clojure Wiki

2013-02-08 Thread Feng Shen
http://clojure-docs.org/ = http://clojuredocs.org/ On Friday, February 8, 2013 8:17:41 PM UTC+8, Konrad wrote: Hello, fellow clojurians! For the next couple of months (or until I get a new functional job), I'll be working on honing my clojure skills, starting with getting a perspective

Re: ANN: http-kit 2.0.0.RC2, high performance HTTP Server Client for Clojure

2013-02-08 Thread Feng Shen
Just to add: 2.0.0-RC3 released, with a general purpose timer added: http://http-kit.org/timer.html On Sunday, February 3, 2013 11:20:27 AM UTC+8, Feng Shen wrote: Hi, After extensive test, known bugs fixed, documentation ready, http-kit reaches 2.0.0.RC2 [http-kit 2.0.0-RC2

Re: Building a REST API / efficient RPC interface in Clojure

2013-02-08 Thread Feng Shen
Hi, I did something similar during work (we are using Clojure) 1. Use HTTP as the transport: browser ajax call, mobile API call, intertal use 2. JSON as encoding. Javascript support it natively, mobile can decode it easily, Clojure has very good support for it Clojure can

Re: Sending Clojure Objects over TCP

2013-02-07 Thread Feng Shen
slacker - Transparent, non-invasive RPC by clojure and for clojure. https://*github*.com/sunng87/*slacker* * * 1. 2. On Thursday, February 7, 2013 9:16:03 AM UTC+8, JvJ wrote: Does anyone know if there's a simplified networking library that allows this? -- -- You received

Re: Simple Network Messaging

2013-02-07 Thread Feng Shen
For json, Clojure has a convenient lib: https://github.com/clojure/data.json for networking, how about using HTTP as the transport? Clojure has many libraries for HTTP server client, c# has many libraries too. On Friday, February 8, 2013 5:44:06 AM UTC+8, JvJ wrote: I'm looking to do

Re: Callbacks as Sequences

2013-02-06 Thread Feng Shen
I did something for a http lib: ;; get them concurrently(let [response1 (http/get http://http-kit.org/;) response2 (http/get http://clojure.org/;)] ;; handle responses one-by-one, waiting for response as necessary ;; other keys :headers :status :error :opts (println response1: (:body

Re: ANN: http-kit 2.0.0.RC2, high performance HTTP Server Client for Clojure

2013-02-04 Thread Feng Shen
-k http://127.0.0.1:8080 On Sunday, February 3, 2013 11:20:27 AM UTC+8, Feng Shen wrote: Hi, After extensive test, known bugs fixed, documentation ready, http-kit reaches 2.0.0.RC2 [http-kit 2.0.0-RC2] ; Add to your project.clj Documentation: http://http-kit.org Github: https

Re: dictionary sort in sortedmap

2013-02-04 Thread Feng Shen
Hi, 11 2 if string, 11 2 if integer. Your keys are string, convert to integer if need numeric order. On Monday, February 4, 2013 6:37:13 PM UTC+8, Amir Wasim wrote: I want to sort a map by its keys according to dictionary when i do the following (into (sorted-map) {1 A 2 B 11 C 3 D})

Re: Why is this code so slow?

2013-02-02 Thread Feng Shen
I can only think about a bit faster version: 46555ms = 23846ms for 20 (defn smallest-multiple-of-1-to-n [n] (let [divisors (range 2 (inc n))] (loop [i n] (if (loop [d 2] (cond ( d n) true (not= 0 (mod i d)) false :else (recur (inc d i

Re: is intellij idea a good ide for clojure development?

2013-01-29 Thread Feng Shen
I have programming Clojure for almost 2 years, for a living. Emacs is highly recommended. Emacs Lisp = lisp, Clojure is also Lisp. Emacs has special support for Lisp than others. As for intellj: I think it's quite good. Emacs is the perfect one. On Monday, January 28, 2013 7:37:54 PM

Re: Clojure web server benchmarks

2013-01-25 Thread Feng Shen
Hey, thanks for point out latency, I haven't look at them deeply. Here is how http-kit compare to Nginx when concurrency is 96: Server Software:http-kit Server Hostname:127.0.0.1 Server Port:8087 Document Path: / Document Length:1163 bytes

Re: a question about running embedded jetty

2013-01-19 Thread Feng Shen
I did not know #'app is for reload. It's very helpful. Thanks. On Saturday, January 19, 2013 5:26:06 PM UTC+8, Baishampayan Ghose wrote: On Sat, Jan 19, 2013 at 5:24 AM, faenvie fanny@gmx.de javascript: wrote: i have learned that for a ring/compojure-app the embedded jetty service

Re: a question about running embedded jetty

2013-01-18 Thread Feng Shen
Hi: (var app) can be simplified to just app. The detail: app is a function: accept a request map, return a response map. your server's logic is in app. ( see ring spec https://github.com/ring-clojure/ring/blob/master/SPEC for more detail) (var app) or #'app: get the var (clojure.lang.Var) of

Re: emacs - how to wean me off the family of Java IDEs

2013-01-16 Thread Feng Shen
Hi: I use Everything http://www.emacswiki.org/emacs/Everything to find files in project. Just type a part of the name, all files filter by your typing listed for you to choose from. Something like Eclipse's Ctrl +Shift + R (or Command + Shift + R on mac) . But you need some time to

Re: How to (easily) show the advantages of Clojure

2013-01-16 Thread Feng Shen
How about Clojure's web 1. Plain Clojure function as handler, request and response are just maps, they are printable. 2. Easy testable: handler is a function, pass a request, get the response, assert the response is wanted. 3. Easy mockable: use bindings to mock centain

Re: How to integrate front-end designers into Clojure/Ring/Jetty workflow?

2013-01-12 Thread Feng Shen
I have some similar experience, put here try to be helpful I am in a team: 1. 1 designer: No experience with Clojure, little knowledge about programming, but knowing HTML CSS well 2. 1 fronend developer: No experience with Clojure, knowing JS HTML well, 3. 2 Clojure coder.

Re: Tornado-like async (web) server framework?

2012-04-16 Thread Feng Shen
I am working on a tiny web server and http client in clojure and java. It's using java's async Socket IO. https://github.com/shenfeng/http-kit The code is mostly written in java, It will expose a nice clojure API. My goal are async, fast, RAM efficiency, clean and compact code. I write it for

How to write `when-lets`

2011-07-27 Thread Feng Shen
Clojure core.clj has a macro when-let, I am wondering how to write a macro `when-lets` (when-lets [symbol-1 test-1 symbol-2 test-2 ... ] body ) body only get evaluated when (and test-1 test-2 ) I am thinking about it, anybody

Re: Clojure for large programs

2011-07-07 Thread Feng Shen
Our codebase is 6.8k kloc of production code, 4k of test code. We use emacs, slime+swank to develop. The editor is great, REPL is great. But lacking debuging and refactoring support is a pain. On Jul 3, 9:26 am, Mark Engelberg mark.engelb...@gmail.com wrote: Ideally, I was hoping to start a