Re: Swing unit testing

2010-01-12 Thread Roger Gilliar
Hi, we use Jemmy for this purpose (https://jemmy.dev.java.net/) Regards Roger -- 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

Re: making sense of condp :

2010-01-03 Thread Roger Gilliar
there would be no match. Or have I misunderstood the API description ? Regards Roger why Am 02.01.2010 um 22:47 schrieb Meikel Brandmeyer: Hi, Am 02.01.2010 um 15:23 schrieb Roger Gilliar: I'm just trying to understand why I would use : in a condp expression. The followjg code shows

Re: whats the meaning of alias ?

2010-01-03 Thread Roger Gilliar
As I understand it, the Clojure reader expects to be able to resolve namespace references as soon as it sees them. Since alias is a function, the c alias doesn't exist until sometime after the reader has already run. I think you will encounter a similar problem with the import macro. Ok,

Re: whats the meaning of alias ?

2010-01-03 Thread Roger Gilliar
Hi ! Now that you understand it, can you explain it me? :) - I said it makes sense not that I understand it ;-) The make sense part is: Calling alias inside a do is something I probably won't do in production code. It would make more sense to

making sense of condp :

2010-01-02 Thread Roger Gilliar
Hi, I'm just trying to understand why I would use : in a condp expression. The followjg code shows how I tried to write a test for condp, but the question remains. Why would I want to use : ? Regards Roger (defn foo [x] (println x) (condp = x true 1

whats the meaning of alias ?

2010-01-02 Thread Roger Gilliar
Hi ! Given the code below, I'm wondering why I get No such namespace: c It would be nice if some could explain to me what I'm doing wrong. Regards Roger (ns coretest (:use [clojure.test]) ) (defn foo [x] (condp = x true 1 false 2

Re: logging.clj and org.apache.commons.logging

2009-10-06 Thread Roger Gilliar
Hi, the import syntax for the java libs in the correspondig clojure contrib source is wrong. Just change them to the correct syntax and it works. At least that worked for me. Regards Roger Am 06.10.2009 um 11:14 schrieb dan.pomoh...@gmail.com: Hi, I have a maven project with java

Re: server-socket on exit event

2009-10-01 Thread Roger Gilliar
I want to write a simple socket server in Clojure. I want to perform some action when a client disconnects. --- The following code works for me. read-input returns nil if the socket is closed (the client disconnects) Regards Roger (defn read-input

Re: server-socket on exit event

2009-10-01 Thread Roger Gilliar
Am 01.10.2009 um 21:28 schrieb ngocdaothanh: Roger, your code is not event based. What do you mean by not event based ? Regards Roger --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: question regarding agents

2009-09-24 Thread Roger Gilliar
Thanks for the answer. Wrapping a mutable thing like an output stream in an agent seems dubious to me. It was intended to use an agent here since I need to control the access to the write object. But what I forgot was ' the validator succeeds or if no validator was given, the return

Re: Q: is there a better way to do this

2009-09-23 Thread Roger Gilliar
And even then, ensure is often not needed and overkill. Make sure you have a real business requirement that the predicate remain true (or value fixed) on transaction completion. We need to move to a world in -- It seems that my problem falls exactly in this category. Ensuring

question regarding agents

2009-09-23 Thread Roger Gilliar
I have the following code: (defn handle-client [in out] (binding [ *in* (reader in) ] (with-connection db (let [outstream (agent (writer out))] (loop []

Re: Architecting a large multi-threaded process

2009-09-23 Thread Roger Gilliar
What I want is some way to schedule tasks to be executed by some set of worker threads, and then be able to control the number of worker threads on a server. What I'm interested in is other people's opinions on how I should architect this app. This

Re: Q: is there a better way to do this

2009-09-22 Thread Roger Gilliar
Hi, thanks a lot. Your code looks much better than mine. But there is one part that I don't understand: (defn producer [] (if (dosync (if (not @consuming) (alter data conj 1))) (recur))) How can I be sure that no more data is added to data after @consuming was set to

Re: Q: is there a better way to do this

2009-09-22 Thread Roger Gilliar
thanks a lot. Your code looks much better than mine. But there is one part that I don't understand: (defn producer [] (if (dosync (if (not @consuming) (alter data conj 1))) (recur))) After rereading the docs several times It seems that I begin to understand how this

Re: Q: is there a better way to do this

2009-09-22 Thread Roger Gilliar
.. It waits until the value is actually needed. For more details on this, see http://ociweb.com/mark/stm/article.html. . Great article.Thanks ! Roger --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure

Re: Q: how to solve this concurrency problem ?

2009-09-21 Thread Roger Gilliar
Am 21.09.2009 um 06:50 schrieb Roger Gilliar: 2.) I modify the code like this: (if cache (cache-message content) (if (mesage-cache-agent-is-running) (send-of *message-cache-agent* send-last-message-with content

Q: dosync semantics

2009-09-21 Thread Roger Gilliar
I still have some problems to correctly understand the dosync semantic. What happens exaclty if two threads try to modify the same list: Example thread 1: (dosync append an item to a list ... ) thread 2: (dosync remove an item from a list .. ) Is it true that If thread 1 is

Re: Q: dosync semantics

2009-09-21 Thread Roger Gilliar
Hi ! Am 21.09.2009 um 15:55 schrieb Jarkko Oranen: In any case, the synchronisation guarantees that if you have a starting list A, either the remove or the append operation will be applied to it, producing A', and the remaining operation will be applied to A', producing the final value of

Q: why doesn't this script terminate

2009-09-21 Thread Roger Gilliar
I call test.clj like this: java -cp /Users/roger/Library/clojure/clojure-1.0.0.jar clojure.main test.clj The script is: (defn syncnow [] (println Hello World) ) (dorun (pcalls syncnow syncnow syncnow)) But this script doesn't terminate. I have to press ctr-c to

Q: is there a better way to do this

2009-09-21 Thread Roger Gilliar
This is some sort of repost from yesterday. But I hope that this one describes my problem more precisely. I have n threads that produce something. At some point in time a consumer starts and if the consumer starts, no more data should be produced. Right now I can only come up with the

Re: problem with threading and sql lib

2009-09-20 Thread Roger Gilliar
Nothing leaps out at me as a likely cause of a dropped message. - The only reason I can think of: It could be a problem when the loading of the JDBC driver is happening inside a thread. At least that would explain why calling (with-connection db nil ) before

Q: how to solve this concurrency problem ?

2009-09-20 Thread Roger Gilliar
Hi, im not sure how to solve the following problem: (defn parse [outstream-agent xml] (let [content (clojure.xml/parse (ByteArrayInputStream. (. xml getBytes))) first-element (:tag content) ] (try (if @*is-syncing*

Re: problem with threading and sql lib

2009-09-19 Thread Roger Gilliar
Not from my code. Regards Roger Am 19.09.2009 um 12:11 schrieb Christophe Grand: is db dynamically rebound? On Sat, Sep 19, 2009 at 7:07 AM, Roger Gilliar ro...@gilliar.de wrote: Hi, re you opening something, using it to return a lazy sequence, and then closing it before

Re: problem with threading and sql lib

2009-09-19 Thread Roger Gilliar
You mention threading in the subject and you have a (binding [...] ...) form. Are you starting a thread, or communicating with one, or using pmap, future, an agent, or etc. inside the binding, and expecting the binding to affect the code that runs in the thread/ map/future/agent?

Re: problem with threading and sql lib

2009-09-18 Thread Roger Gilliar
Hi, re you opening something, using it to return a lazy sequence, and then closing it before consuming the sequence? No. I started with just opening the database connection in the handler function. Regards Roger --~--~-~--~~~---~--~~ You received