Re: [cn-clojure:2334] {ANN} A clojure macro and ruby script to profile clojure program.

2013-06-08 Thread stream

弱弱的问一下,为什么解析不用clojure呢。
是因为基于JVM的clojure太重了,不方便命令行吗


On 2013-6-8, at 下午9:46, dennis zhuang  wrote:

> A macro named `p` to log data, and a ruby script to parse log file,and it 
> will give the statistics result of a clojure program:
> 
> 
> Parsing log file test.log ...
> Prowl profile results:
> Labels:
>   Label:logic count:1
> Method: method2mean: 10.81  
> min: 10.81  max: 10.81  count: 1
> Method: method1mean: 145.90 
> min: 145.90 max: 145.90 count: 1
> Method: start  mean: 159.59 
> min: 159.59 max: 159.59 count: 1
> 
> Methods:
>   Method: method2mean: 10.81  
> min: 10.81  max: 10.81  count: 1
>   Method: method1mean: 145.90 
> min: 145.90 max: 145.90 count: 1
>   Method: start  mean: 159.59 
> min: 159.59 max: 159.59 count: 1
> It's on github,have fun.
> 
> https://github.com/killme2008/prowl
> 
> -- 
> 庄晓丹 
> Email:killme2...@gmail.com xzhu...@avos.com
> Site:   http://fnil.net
> Twitter:  @killme2008
> 
> 
> 
> -- 
> 中文社区博客:http://blog.clojure.cn/
> 中文问答网站:http://ask.clojure.cn/
> 中文邮件列表:https://groups.google.com/d/forum/cn-clojure?hl=zh-CN
> --- 
> 您收到此邮件是因为您订阅了 Google 网上论坛的“CN-Clojure”论坛。
> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 cn-clojure+unsubscr...@googlegroups.com。
> 要向此网上论坛发帖,请发送电子邮件至 cn-cloj...@googlegroups.com。
> 通过以下网址访问此论坛:http://groups.google.com/group/cn-clojure?hl=zh-CN。
> 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
>  
>  

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




请教一个问题

2013-06-12 Thread stream
Hi all
我在看 lein-ring插件源码时,发现很多 语法引用符号 ` 都用在defn里。
   `(do ~(start-nrepl-expr project) ~(start-server-expr project))

(defn load-namespaces
  [& syms]
  `(require
~@(for [s syms :when s]
`'~(if-let [ns (namespace s)]
 (symbol ns)
 s


我的直觉是这些最好是用在编译期的宏里。

用在运行期的的函数里是什么意思呢, 比较愚笨,希望高手解答。谢谢

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




ring 如何实现热加载代码?

2013-06-13 Thread stream

今天看了一下ring代码,想看一下,如何实现热加载clj代码。

我尝试 run-jetty :join true
导致server被阻塞,然后emacs nrepl 无法热加载代码。

改成 join false,jetty 进程不加入主进程里,才可以正常加载。

我翻查源码,没发现是如何分离server与逻辑代码,从而实现只热加载handler的。

哪位大神能科普一下呢,谢谢

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: why clojure.lang.Compiler.LOADER is null in clojure 1.5.1

2013-06-17 Thread Stream


在 2013年5月9日星期四UTC+8下午2时00分54秒,Stream写道:
>
> Hi all 
>
> i wanna change the classloader of Clojure RT. in 1.5.1 
> so , i try to 
> clojure.lang.Var.pushThreadBindings(clojure.lang.RT.map( 
> clojure.lang.Compiler.LOADER, cl) ); 
>
> but throws exception that cojure.lang.Compiler.LOADER is null 
>
> Caused by: java.lang.NullPointerException 
> at clojure.lang.RT.baseLoader(RT.java:2043) 
> at clojure.lang.RT.load(RT.java:417) 
> at clojure.lang.RT.load(RT.java:411) 
> at clojure.lang.RT.doInit(RT.java:447) 
> at clojure.lang.RT.(RT.java:329) 
> ... 9 more 
>
>
> However this is work in the 1.4.0 
>
> someone could tell me what had happened in 1.5.1 
> thanks


--

Sorry , i have disappear a month for my own things..

the problem is still hung. i don't how to resolve it , except back version 
of clojure to 1.4.0

The intention is that vertx project http://vertx.io/ use clojure as one of 
scriptlang to execute some logical

so, i have own classloader which is cl, could load any other lib of jar 
dynamically.

as @atkaaz desc, it seems  LOADER has set NULL. and reason @sean corfield 
has given.

i hope someone could give me a idea 

thanks again.




 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




How to get value which been created in java from cli file

2013-07-02 Thread stream
Hi all
my english poor i hope someone could know what i said.

i create Var in Java
such as

RT("mysapce" "xv" object);

and then i load a clj file

RT.loadResourceScript("xx.clj");

the question is how to get Value of xv in xx.clj
and could reload it in nrepl.

i try to do something like

(use 'mysapce)

(println xv) 

throw error unable to resovle symbol xv in this context .

someone could help me  may i have missing something?



-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




why clojure.lang.Compiler.LOADER is null in clojure 1.5.1

2013-05-09 Thread stream
Hi all

i wanna change the classloader of Clojure RT. in 1.5.1
so , i try to 
clojure.lang.Var.pushThreadBindings(clojure.lang.RT.map( 
clojure.lang.Compiler.LOADER, cl) );

but throws exception that cojure.lang.Compiler.LOADER is null

Caused by: java.lang.NullPointerException
at clojure.lang.RT.baseLoader(RT.java:2043)
at clojure.lang.RT.load(RT.java:417)
at clojure.lang.RT.load(RT.java:411)
at clojure.lang.RT.doInit(RT.java:447)
at clojure.lang.RT.(RT.java:329)
... 9 more


However this is work in the 1.4.0

someone could tell me what had happened in 1.5.1
thanks

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.