Re: in keyword withing where claus java-jdbc

2012-12-05 Thread Amir Wasim
aha, thanks Sean

I tried alternate and did the following

=> (sql/with-connection (db-connection)
 (sql/do-commands (str "update TASK_T_MSGIDS set status='T' where 
msg_id in (" (apply str (interpose \, acks)) " )" ))
   )

=> (sql/with-connection (db-connection)
 (transaction (sql/do-commands (str "update TASK_T_MSGIDS set 
status='T' where msg_id in (" (apply str (interpose \, acks)) " )" )))
   )
==>  (sql/with-connection (db-connection)
  (with-open [^Statement stmt (let [^java.sql.Connection con 
(sql/connection)] (.createStatement con))]
  (.addBatch stmt (str "update TASK_T_MSGIDS set status='E' where 
msg_id in (" (apply str (interpose \, acks)) " )" ))
  (sql/transaction (.executeBatch stmt

and none of them worked. with exception of do-commands which halts the jvm 
but there is no error on terminal.

Do you know a way to raw update statement with "in" within Where clause...

On Wednesday, December 5, 2012 4:53:39 AM UTC+1, Sean Corfield wrote:
>
> ... in ? is not supported in c.j.jdbc
>
>
> On Tue, Dec 4, 2012 at 6:16 AM, Amir Wasim 
> > wrote:
>
>> I am trying to use the following 
>>
>> (defn commit-acknowledged
>>   [acks]
>>   (sql/with-connection (db-connection)
>> (sql/transaction
>>   (sql/update-values "MSGIDS" ["msg_id in ?" acks] {"status" "H"})
>>   )
>> )
>> )
>>
>> here acks is type of clojure.lang.PersistentVector when i call this 
>> function i am getting java.sql.SQLException: Invalid column type
>>
>>
>> does anyone know why i am getting this?
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>
>
> -- 
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>  

-- 
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

Latest JOGL with Clojure in Eclipse?

2012-12-05 Thread Andrew P. Lentvorski, Jr.
Anybody have some advice for me about the latest JOGL(2.0 rc11) with 
Clojure on Eclipse?  I'm running Eclipse Juno SR1 with Counterclockwise on 
OS X 10.6.8.

The JOGL tutorial sets up by creating a JOGL project that you then make new 
Java projects depend upon.  This works fine for Java and seems to be 
considered the "official" way of making things go with Eclipse and Java.  I 
can create a new Java project, add the JOGL project to the Java Build Path, 
set up OpenGL and draw a basic triangle.  The project finds all the 
dependencies and everything runs.

This doesn't seem to work for Clojure for some reason.  I could post 
specific errors, but given that I'm a clojure newbie, I figured I should 
probably take a further step back since I'm likely to be barking up the 
wrong tree completely.  So, my question is:

What is the proper way to get JOGL running under Clojure on Eclipse?

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

Re: Latest JOGL with Clojure in Eclipse?

2012-12-05 Thread Karsten Schmidt
Hi Andrew,

in summer I've uploaded a lein compatible re-packaged version of JOGL
& JOCL to Clojars:

https://clojars.org/org.clojars.toxi/jogl
https://clojars.org/org.clojars.toxi/jocl

Both will also require Gluegen of course, but can't remember if I've
included a dependency for it in their POM or if you have to include it
manually. In any way, lein specs are here:

[org.clojars.toxi/jogl "2.0.0-rc10"]
[org.clojars.toxi/jocl "2.0.0-rc10"]
[org.clojars.toxi/gluegen-rt "2.0.0-rc10"]

Hth! K.
--
http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk

On 5 December 2012 10:41, Andrew P. Lentvorski, Jr.  wrote:
> Anybody have some advice for me about the latest JOGL(2.0 rc11) with Clojure
> on Eclipse?  I'm running Eclipse Juno SR1 with Counterclockwise on OS X
> 10.6.8.
>
> The JOGL tutorial sets up by creating a JOGL project that you then make new
> Java projects depend upon.  This works fine for Java and seems to be
> considered the "official" way of making things go with Eclipse and Java.  I
> can create a new Java project, add the JOGL project to the Java Build Path,
> set up OpenGL and draw a basic triangle.  The project finds all the
> dependencies and everything runs.
>
> This doesn't seem to work for Clojure for some reason.  I could post
> specific errors, but given that I'm a clojure newbie, I figured I should
> probably take a further step back since I'm likely to be barking up the
> wrong tree completely.  So, my question is:
>
> What is the proper way to get JOGL running under Clojure on Eclipse?
>
> 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 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


Re: Latest JOGL with Clojure in Eclipse?

2012-12-05 Thread Frank Wilson
Hi Andrew,

I have been working on a maven build that installs jogl 2.0 jars into .m2
repo. Its not complete yet as it only installs dependencies for
win32/amd64. But adding other platforms should be easy. You will need to
install the 7z plugin and the 7z binding project on my github to make it
work. I have setup a maven repo yet, but I intend to do so soon.

If you are pulling JOGL 2.0 dependencies via maven or maybe lein this might
help.

Best regards,

Frank
On Dec 5, 2012 10:41 AM, "Andrew P. Lentvorski, Jr." 
wrote:

> Anybody have some advice for me about the latest JOGL(2.0 rc11) with
> Clojure on Eclipse?  I'm running Eclipse Juno SR1 with Counterclockwise on
> OS X 10.6.8.
>
> The JOGL tutorial sets up by creating a JOGL project that you then make
> new Java projects depend upon.  This works fine for Java and seems to be
> considered the "official" way of making things go with Eclipse and Java.  I
> can create a new Java project, add the JOGL project to the Java Build Path,
> set up OpenGL and draw a basic triangle.  The project finds all the
> dependencies and everything runs.
>
> This doesn't seem to work for Clojure for some reason.  I could post
> specific errors, but given that I'm a clojure newbie, I figured I should
> probably take a further step back since I'm likely to be barking up the
> wrong tree completely.  So, my question is:
>
> What is the proper way to get JOGL running under Clojure on Eclipse?
>
> 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 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

Re: Latest JOGL with Clojure in Eclipse?

2012-12-05 Thread Frank Wilson
Hi Andrew,

I have been working on a maven build that installs jogl 2.0 jars into .m2
repo. Its not complete yet as it only installs dependencies for
win32/amd64. But adding other platforms should be easy. You will need to
install the 7z plugin and the 7z binding project on my github to make it
work. I have setup a maven repo yet, but I intend to do so soon.

https://github.com/zenlambda/jogamp

If you are pulling JOGL 2.0 dependencies via maven or maybe lein this might
help.

Best regards,

Frank
On Dec 5, 2012 10:41 AM, "Andrew P. Lentvorski, Jr." 
wrote:

> Anybody have some advice for me about the latest JOGL(2.0 rc11) with
> Clojure on Eclipse?  I'm running Eclipse Juno SR1 with Counterclockwise on
> OS X 10.6.8.
>
> The JOGL tutorial sets up by creating a JOGL project that you then make
> new Java projects depend upon.  This works fine for Java and seems to be
> considered the "official" way of making things go with Eclipse and Java.  I
> can create a new Java project, add the JOGL project to the Java Build Path,
> set up OpenGL and draw a basic triangle.  The project finds all the
> dependencies and everything runs.
>
> This doesn't seem to work for Clojure for some reason.  I could post
> specific errors, but given that I'm a clojure newbie, I figured I should
> probably take a further step back since I'm likely to be barking up the
> wrong tree completely.  So, my question is:
>
> What is the proper way to get JOGL running under Clojure on Eclipse?
>
> 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 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

Re: A Working nrepl-ritz Setup?

2012-12-05 Thread terjesb
Did you update your ~/.lein/profiles?

https://github.com/pallet/ritz/tree/develop/nrepl

kl. 06:49:49 UTC+1 onsdag 5. desember 2012 skrev frye følgende:
>
> Hey all, 
>
>
> I like the promise of nrepl-ritz. But I can't get a working setup. 
>
>
> 1) I start from an empty "*~/.emacs.d/*" 
> 2) I then populate init.el from the example in 
> ritz/nrepl
>  
> 3) I open a lein project and run `*M-x nrepl-ritz-jack-in*`
>
> **) The error I get back is: 
>
> "*error in process sentinel: Could not start nREPL server: 'ritz-nrepl' 
> is not a task. See 'lein help'.*"
>
>
> **) So emacs can't find the *ritz-nrepl* task. But i) my system 
> definitely has "*~/.emacs.d/elpa/nrepl-ritz-0.6.0/nrepl-ritz-pkg.el*". 
> And ii) I'm on the latest version of leinigen (*2.0.0-preview10*). 
>
>
> Anyone have this working? 
>
> Thanks 
> Tim 
>

-- 
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

ANN tools.trace 0.7.5

2012-12-05 Thread Softaddicts
Hi all,

a new release of tools.trace made it to Maven:

* added traced? and traceable? fns
* removed reflection warnings

This release fixes tickets ttrace-1 and ttrace-2.

Have a nice morning/afternoon/evening/night where ever you might be :)

Luc P.

--
Softaddicts sent by ibisMail from my ipad!

-- 
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


Re: clojurescript browser repl possible regression

2012-12-05 Thread Herwig Hochleitner
One more strange fact: When you remove third-party, but run with the
released closure-library, you don't see the warning, but repl still doesn't
work. Thinking of it, I have run into that before.

So my theory is, that the build with the plain goog.jar fails because its
deps.js refers to ../third_party entries. This causes the build to fail,
even if a third-party jar is available on the classpath.
In http://dev.clojure.org/jira/browse/CLJS-276 this got fixed for the
release jars. Now that the repl depends on third-party too, it becomes
apparent that the goog.jar generated in bootstrap suffers from this issure
too.

So why are there no warings when compiling with just the official
closure-library?
The ../third_party entries get removed from the released jar here:
https://github.com/clojure/clojurescript/blob/master/script/closure-library-release/make-closure-library-jars.sh#L49
Supposing that, with an incomplete deps.js, closure compiler doesn't warn,
that would explain it.

I think this could be solved by regenerating a combined deps.js for
closure_library and third_party and unifying the build of the release jars
and the dev jars.

-- 
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

Re: clojurescript browser repl possible regression

2012-12-05 Thread Brent Millare
Ah finally, some progress. This is very relieving, I'm not that crazy it 
seems. It's enough for me to fix my cljs tools for now. Thank you.

On Wednesday, December 5, 2012 8:35:26 AM UTC-5, Herwig Hochleitner wrote:
>
> I can reproduce this.
> When I replace lib/goog.jar with google-closure-library-0.0-2029.jar, 
> however, it works. No idea why (seriously, why?).
>
> git clone git://github.com/clojure/clojurescript.git
> cd clojurescript
> ./script/bootstrap
> rm lib/goog.jar
> cp 
> ~/.m2/repository/org/clojure/google-closure-library/0.0-2029/google-closure-library-0.0-2029.jar
>  
> ./lib
> cp 
> ~/.m2/repository/org/clojure/google-closure-library-third-party/0.0-2029/google-closure-library-third-party-0.0-2029.jar
>  
> ./lib
> ./script/repl
>
> Clojure 1.4.0
> user=> (require '[cljs.repl :as repl])
> (require '[cljs.repl.browser :as browser])
> (def env (browser/repl-env)) 
> (repl/repl env) 
>
>

-- 
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

Re: [ANN] Typed Clojure 0.1.4

2012-12-05 Thread Ambrose Bonnaire-Sergeant
I just pushed Typed Clojure 0.1.5 (and analyze 0.2.5).

Here are some of the kinds of errors messages you can expect from Typed
Clojure now.
I've borrowed the error messages from Typed Racket.

https://gist.github.com/4213669
https://www.refheap.com/paste/7313

Thanks,
Ambrose


On Tue, Dec 4, 2012 at 10:01 PM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> https://github.com/frenchy64/typed-clojure
>
> Leiningen (Clojars): [typed "0.1.4"]
>
> Highlights:
>
> - Supports Clojure 1.4.0 or later
> - Better error messages, contains syntax + line + column number (if using
> a Clojure version with column numbers)
>
> See README for more detail.
>
> Thanks,
> Ambrose
>

-- 
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

Re: A Working nrepl-ritz Setup?

2012-12-05 Thread Timothy Washington
Yes, I updated "*~/.emacs.d/init.el*" and "*~/.lein/profiles*", as outlined
on that page. But somehow nrepl server thinks *'ritz-nrepl' is not a task*.


Tim



On Wed, Dec 5, 2012 at 7:59 AM, terjesb  wrote:

> Did you update your ~/.lein/profiles?
>
> https://github.com/pallet/ritz/tree/develop/nrepl
>
> kl. 06:49:49 UTC+1 onsdag 5. desember 2012 skrev frye følgende:
>
>> Hey all,
>>
>>
>> I like the promise of nrepl-ritz. But I can't get a working setup.
>>
>>
>> 1) I start from an empty "*~/.emacs.d/*"
>> 2) I then populate init.el from the example in 
>> ritz/nrepl
>>
>> 3) I open a lein project and run `*M-x nrepl-ritz-jack-in*`
>>
>> **) The error I get back is:
>>
>> "*error in process sentinel: Could not start nREPL server: 'ritz-nrepl'
>> is not a task. See 'lein help'.*"
>>
>>
>> **) So emacs can't find the *ritz-nrepl* task. But i) my system
>> definitely has "*~/.emacs.d/elpa/nrepl-ritz-0.6.0/nrepl-ritz-pkg.el*".
>> And ii) I'm on the latest version of leinigen (*2.0.0-preview10*).
>>
>>
>> Anyone have this working?
>>
>> Thanks
>> Tim
>>
>

-- 
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

Re: A Working nrepl-ritz Setup?

2012-12-05 Thread Hugo Duncan
Timothy Washington  writes:

>
> 1) I start from an empty "*~/.emacs.d/*"
> 2) I then populate init.el from the example in
> ritz/nrepl
>
> 3) I open a lein project and run `*M-x nrepl-ritz-jack-in*`
>
> **) The error I get back is:
>
> "*error in process sentinel: Could not start nREPL server: 'ritz-nrepl' is
> not a task. See 'lein help'.*"

This is actually a lein message, and it is saying that the lein-ritz
plugin is not in the :plugins vector of a lein profile. There is an
example of setting this up in ~/.lein/profiles.clj on the page you
linked.

HTH,

Hugo

-- 
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


Re: A Working nrepl-ritz Setup?

2012-12-05 Thread Hugo Duncan
Timothy Washington  writes:

> Yes, I updated "*~/.emacs.d/init.el*" and "*~/.lein/profiles*", as outlined
> on that page. But somehow nrepl server thinks *'ritz-nrepl' is not a task*.

Does running `lein ritz-nrepl` from a shell within your project
directory work?

Hugo

-- 
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


[ANN] Clojure Meetup in Cape Town, South Africa

2012-12-05 Thread Robert Stuttaford
I am hosting a Clojure meetup in Cape Town on the 15th of December. If there 
are any Cloders down here that want to attend, please contact me off list for 
details!

-- 
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


Default random in Clojure doesn't seem to fit fp paradigm

2012-12-05 Thread JonC
Ok: first of all, Clojure has outstandingly the best core library I've 
seen. I am awed by how wonderfully the protocol approach makes data 
structures, and the good taste applied to getting an API that's reasonably 
minimal and wonderfully complete. I've not posted before because I've had 
nothing to ask - everything is super-clear, especially now I have a copy of 
JoC. But I would suggest that there is one easily corrected area where 
things are imperfect: -

One of the big advantages of functional coding to me is rock solid 
testability - same inputs, same outputs; easy to test, easy to debug. 

Obviously psuedo-random  numbers and io present problems with this. Now, 
the normal way for an API to discourage something problematic is to make it 
difficult, and to encourage correct behavoiur by making it easy. So list's 
lack of nth but possession of first, second rest and last shout out "Do NOT 
use for random access!" while vector's api says "Use me instead!"

Now we come to rand, rand-int, rand-nth. They're the easiest things to use 
for their purpose, so they shout "Use me!" But.. they break the 
repeatability paradigm. Because they use Java's default random number 
generator instance, which has a private and unsettable seed, you can't get 
repeatabilty. In Java, this isn't actually too awful because you can 
instantiate an rng of your own and use it in just the same way - but if you 
do this in clojure, bang goes your rand-nth. Yes, the problem is one you 
can easily solve with a few minutes coding. But an api should gently lure 
into doing things the right way rather than wrong one - so wouldn't it be a 
good idea to add change the standard api to include a function that takes a 
seed? A random that allows you to see the last "seed" would be even better. 
That way when you get

=> (foo-uses-rand "bar')
..crazy result *sometimes*

then

=> (def wrong (get-last-rand-seed))

would give you the seed needed to repeat the last call to any random fn. So 
you could fix your code and verify by re-seeding with "wrong" and repeating 
the function call.

To me this seems a nice low-impact solution. It wouldn't make repeatability 
bullet proof, but I'd suggest it would be an easily implemented mild 
improvement for a future version of clojure.


-- 
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

Re: in keyword withing where claus java-jdbc

2012-12-05 Thread Sean Corfield
do-commands is intended for DDL, not SQL.

You just want do-prepared:

(sql/with-connection (db-connection)
 (sql/do-prepared (str "update TASK_T_MSGIDS set status='T' where
msg_id in (" (apply str (interpose \, acks)) " )" ))
   )


On Wed, Dec 5, 2012 at 1:13 AM, Amir Wasim  wrote:

> aha, thanks Sean
>
> I tried alternate and did the following
>
> => (sql/with-connection (db-connection)
>  (sql/do-commands (str "update TASK_T_MSGIDS set status='T' where
> msg_id in (" (apply str (interpose \, acks)) " )" ))
>)
>
> => (sql/with-connection (db-connection)
>  (transaction (sql/do-commands (str "update TASK_T_MSGIDS set
> status='T' where msg_id in (" (apply str (interpose \, acks)) " )" )))
>)
> ==>  (sql/with-connection (db-connection)
>   (with-open [^Statement stmt (let [^java.sql.Connection con
> (sql/connection)] (.createStatement con))]
>   (.addBatch stmt (str "update TASK_T_MSGIDS set status='E' where
> msg_id in (" (apply str (interpose \, acks)) " )" ))
>   (sql/transaction (.executeBatch stmt
>
> and none of them worked. with exception of do-commands which halts the jvm
> but there is no error on terminal.
>
> Do you know a way to raw update statement with "in" within Where clause...
>
>
> On Wednesday, December 5, 2012 4:53:39 AM UTC+1, Sean Corfield wrote:
>
>> ... in ? is not supported in c.j.jdbc
>>
>>
>> On Tue, Dec 4, 2012 at 6:16 AM, Amir Wasim  wrote:
>>
>>> I am trying to use the following
>>>
>>> (defn commit-acknowledged
>>>   [acks]
>>>   (sql/with-connection (db-connection)
>>> (sql/transaction
>>>   (sql/update-values "MSGIDS" ["msg_id in ?" acks] {"status" "H"})
>>>   )
>>> )
>>> )
>>>
>>> here acks is type of clojure.lang.PersistentVector when i call this
>>> function i am getting java.sql.SQLException: Invalid column type
>>>
>>>
>>> does anyone know why i am getting this?
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@**googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en
>>>
>>
>>
>>
>> --
>> Sean A Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>> World Singles, LLC. -- http://worldsingles.com/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>
>  --
> 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
>



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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

How to apply max to a list of values given a predefined value order?

2012-12-05 Thread scabbage
I need to apply a "max" operator to a list like this:

[Tier20 Tier10 Tier30]

It should give me "Tier30" as the max. My predefined order list (from low 
to high) is:

[Tier5 Tier10 Tier20 Tier30 Tier40 Tier50]

What's the best way to achieve this in clojure?

-- 
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

Re: Default random in Clojure doesn't seem to fit fp paradigm

2012-12-05 Thread Steve Miner
You should treat rand and friends like i/o.  Don't bury them deep in your code. 
 Write your pure functions so that they take a seed value (or sequence).  
Generate the random values from outside of the important functions,  maybe 
providing a convenience wrapper function around your main logic.

(defn foo-pure [val seed] ...)

(defn foo-uses-rand [val] (foo-pure val (rand)))


On Dec 5, 2012, at 1:48 PM, JonC  wrote:

> Ok: first of all, Clojure has outstandingly the best core library I've seen. 
> I am awed by how wonderfully the protocol approach makes data structures, and 
> the good taste applied to getting an API that's reasonably minimal and 
> wonderfully complete. I've not posted before because I've had nothing to ask 
> - everything is super-clear, especially now I have a copy of JoC. But I would 
> suggest that there is one easily corrected area where things are imperfect: -
> 
> One of the big advantages of functional coding to me is rock solid 
> testability - same inputs, same outputs; easy to test, easy to debug. 
> 
> Obviously psuedo-random  numbers and io present problems with this. Now, the 
> normal way for an API to discourage something problematic is to make it 
> difficult, and to encourage correct behavoiur by making it easy. So list's 
> lack of nth but possession of first, second rest and last shout out "Do NOT 
> use for random access!" while vector's api says "Use me instead!"
> 
> Now we come to rand, rand-int, rand-nth. They're the easiest things to use 
> for their purpose, so they shout "Use me!" But.. they break the repeatability 
> paradigm. Because they use Java's default random number generator instance, 
> which has a private and unsettable seed, you can't get repeatabilty. In Java, 
> this isn't actually too awful because you can instantiate an rng of your own 
> and use it in just the same way - but if you do this in clojure, bang goes 
> your rand-nth. Yes, the problem is one you can easily solve with a few 
> minutes coding. But an api should gently lure into doing things the right way 
> rather than wrong one - so wouldn't it be a good idea to add change the 
> standard api to include a function that takes a seed? A random that allows 
> you to see the last "seed" would be even better. That way when you get
> 
> => (foo-uses-rand "bar')
> ..crazy result *sometimes*
> 
> then
> 
> => (def wrong (get-last-rand-seed))
> 
> would give you the seed needed to repeat the last call to any random fn. So 
> you could fix your code and verify by re-seeding with "wrong" and repeating 
> the function call.
> 
> To me this seems a nice low-impact solution. It wouldn't make repeatability 
> bullet proof, but I'd suggest it would be an easily implemented mild 
> improvement for a future version of clojure.
> 

-- 
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


Re: How to apply max to a list of values given a predefined value order?

2012-12-05 Thread Mark Engelberg
(def order-list [Tier5 Tier10 Tier20 Tier30 Tier40 Tier50])
(def rank (into {} (map-indexed (fn [i x] [x i]) orders)))
(apply max-key rank [Tier20 Tier10 Tier30])

-- 
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

Re: ANN: Clojure/West 2013 registration, CFP, sponsorships, training

2012-12-05 Thread Alex Miller
Based on a very quick response, the early bird is now sold out!  Plenty of 
tickets left at the regular rate though of $350 though.

On Tuesday, December 4, 2012 11:43:46 PM UTC-6, Alex Miller wrote:
>
> Clojure/West  returns in 2013 to one of my 
> favorite cities: Portland, Oregon. It will take place March 18-20th. Based 
> on feedback from last year, we are reducing the number of tracks and 
> spreading over 3 days with a mixture of single- and double-track. Our venue 
> will be the Gerding Theater at the Armory in the heart of the Pearl 
> District. The Gerding is a wonderful venue and should be a great location 
> (lobby
> , main 
> theater
> ).
>
> Registration  is now open (
> https://regonline.com/clojurewest2013).  Only 50 early bird tickets are 
> available for just $275 rising to $350 for the remainder. Buy now if you 
> want the lower price - the early bird will go fast.
>
> Our conference hotel will be the Courtyard City 
> Center.
>  
> We have arranged a conference rate of $124/night and the block is now 
> available (King rooms code *cwccwca*, Queen rooms code *cwccwcb*). 
>
> Relevance will be running an all-day ClojureScript training 
> class led 
> by Stuart Sierra and Luke VanderHart on the day before the conference 
> (March 17). The venue is close to the conference hotel and the room block 
> is available the night before the training as well. Training registration 
> is open now .
>
> The call for presentations 
> for 
> Clojure/West is open till January 4th. Please check out the CFP and submit 
> a talk! Rich Hickey will be giving a keynote (and others to be announced). 
> Speakers receive free admission, airfare, and hotel.
>
> If your company is interested in sponsoring, the sponsorship 
> prospectus is 
> available. Clojure/West is a great opportunity to get your company's name 
> in front of a great group of crazy smart developers. 
>
> Alex Miller
> a...@thestrangeloop.com
>

-- 
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

Re: Default random in Clojure doesn't seem to fit fp paradigm

2012-12-05 Thread JonC


On Wednesday, December 5, 2012 8:45:00 PM UTC, miner wrote:
>
> You should treat rand and friends like i/o.  Don't bury them deep in your 
> code.  Write your pure functions so that they take a seed value (or 
> sequence).  


This is one approach to by-passing clojure's randoms, yes. (To be honest 
I'm surprised that Clojure didn't go the infinite sequence route.*) But

- See my point about API's ***that encourage you do the wrong thing.*** 
Quite simply, if you have api in an fp language and it is easily possible 
to make it behave in a more-or-less fp-ish way, then you probably should

- It won't help you worth a damn if you are using someone else's code and 
it uses randoms - but being able to set the seed probably will

- Adding a set rand is a backwards compatible fix for old code

* I sort of wonder if for the future it might be possible to make it so 
that IO, rand and other such beasts are handled exclusively by special lazy 
sequences, and such sequences could only be generated or received by 
functions with a special special form (an extra special form?) But that 
seemed too large a Dumb Idea to bring up on this little acquaintance with 
what is obviously an excellent language. (UHH! ME LIKE CLOJURE!  HIT WITH 
HAMMER TO MAKE MORE LIKE HASKELL WHILE NOT KNOW ENOUGH TO UNDERSTAND 
CONSEQUENCES! UHH!) Maybe using metadata? (UHH! ME STOP KIBITZING NOW!) So 
I stuck to the srand thing. (The taint thing was what impressed me about 
Haskell most - you probably guessed.)

-- 
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

Re: Default random in Clojure doesn't seem to fit fp paradigm

2012-12-05 Thread Karsten Schmidt
FWIW dynvars are quite a common solution to these kind of scenarios:
e.g. In my own library I've defined a default Random instance which is
used by all related library fns, e.g.:

(def ^:dynamic ^java.util.Random *rnd* (java.util.Random. 23))

(defn random
  ([x] (* x (.nextDouble *rnd*)))
  ([x y] (+ x (* (- y x) (.nextDouble *rnd*)

If client code want to use a different Random implementation than the
default, it only needs to wrap calls to these fns with a new temporary
binding:

(binding [*rnd* org.uncommons.maths.random.MersenneTwisterRNG] (random 100))

or via:

(defmacro with-random [r & body] `(binding [*rnd* ~r] (do ~@body)))

and then:

(with-random (org.uncommons.maths.random.MersenneTwisterRNG.) (random 100))

K.

On 5 December 2012 20:45, Steve Miner  wrote:
> You should treat rand and friends like i/o.  Don't bury them deep in your 
> code.  Write your pure functions so that they take a seed value (or 
> sequence).  Generate the random values from outside of the important 
> functions,  maybe providing a convenience wrapper function around your main 
> logic.
>
> (defn foo-pure [val seed] ...)
>
> (defn foo-uses-rand [val] (foo-pure val (rand)))
>
>
> On Dec 5, 2012, at 1:48 PM, JonC  wrote:
>
>> Ok: first of all, Clojure has outstandingly the best core library I've seen. 
>> I am awed by how wonderfully the protocol approach makes data structures, 
>> and the good taste applied to getting an API that's reasonably minimal and 
>> wonderfully complete. I've not posted before because I've had nothing to ask 
>> - everything is super-clear, especially now I have a copy of JoC. But I 
>> would suggest that there is one easily corrected area where things are 
>> imperfect: -
>>
>> One of the big advantages of functional coding to me is rock solid 
>> testability - same inputs, same outputs; easy to test, easy to debug.
>>
>> Obviously psuedo-random  numbers and io present problems with this. Now, the 
>> normal way for an API to discourage something problematic is to make it 
>> difficult, and to encourage correct behavoiur by making it easy. So list's 
>> lack of nth but possession of first, second rest and last shout out "Do NOT 
>> use for random access!" while vector's api says "Use me instead!"
>>
>> Now we come to rand, rand-int, rand-nth. They're the easiest things to use 
>> for their purpose, so they shout "Use me!" But.. they break the 
>> repeatability paradigm. Because they use Java's default random number 
>> generator instance, which has a private and unsettable seed, you can't get 
>> repeatabilty. In Java, this isn't actually too awful because you can 
>> instantiate an rng of your own and use it in just the same way - but if you 
>> do this in clojure, bang goes your rand-nth. Yes, the problem is one you can 
>> easily solve with a few minutes coding. But an api should gently lure into 
>> doing things the right way rather than wrong one - so wouldn't it be a good 
>> idea to add change the standard api to include a function that takes a seed? 
>> A random that allows you to see the last "seed" would be even better. That 
>> way when you get
>>
>> => (foo-uses-rand "bar')
>> ..crazy result *sometimes*
>>
>> then
>>
>> => (def wrong (get-last-rand-seed))
>>
>> would give you the seed needed to repeat the last call to any random fn. So 
>> you could fix your code and verify by re-seeding with "wrong" and repeating 
>> the function call.
>>
>> To me this seems a nice low-impact solution. It wouldn't make repeatability 
>> bullet proof, but I'd suggest it would be an easily implemented mild 
>> improvement for a future version of clojure.
>>
>
> --
> 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 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


Re: ANN: Clojure/West 2013 registration, CFP, sponsorships, training

2012-12-05 Thread Sean Corfield
How long did it actually take to sell all 50 early bird tickets?


On Wed, Dec 5, 2012 at 1:34 PM, Alex Miller  wrote:

> Based on a very quick response, the early bird is now sold out!  Plenty of
> tickets left at the regular rate though of $350 though.
>
>
> On Tuesday, December 4, 2012 11:43:46 PM UTC-6, Alex Miller wrote:
>>
>> Clojure/West  returns in 2013 to one of my
>> favorite cities: Portland, Oregon. It will take place March 18-20th. Based
>> on feedback from last year, we are reducing the number of tracks and
>> spreading over 3 days with a mixture of single- and double-track. Our venue
>> will be the Gerding Theater at the Armory in the heart of the Pearl
>> District. The Gerding is a wonderful venue and should be a great
>> location 
>> (lobby
>> , main 
>> theater
>> ).
>>
>> Registration  is now open (
>> https://regonline.com/**clojurewest2013).
>>  Only 50 early bird tickets are available for just $275 rising to $350 for
>> the remainder. Buy now if you want the lower price - the early bird will go
>> fast.
>>
>> Our conference hotel will be the Courtyard City 
>> Center.
>> We have arranged a conference rate of $124/night and the block is now
>> available (King rooms code *cwccwca*, Queen rooms code *cwccwcb*).
>>
>> Relevance will be running an all-day ClojureScript training 
>> class led
>> by Stuart Sierra and Luke VanderHart on the day before the conference
>> (March 17). The venue is close to the conference hotel and the room block
>> is available the night before the training as well. Training registration
>> is open now .
>>
>> The call for presentations 
>> for
>> Clojure/West is open till January 4th. Please check out the CFP and submit
>> a talk! Rich Hickey will be giving a keynote (and others to be announced).
>> Speakers receive free admission, airfare, and hotel.
>>
>> If your company is interested in sponsoring, the sponsorship 
>> prospectus is
>> available. Clojure/West is a great opportunity to get your company's name
>> in front of a great group of crazy smart developers.
>>
>> Alex Miller
>> a...@thestrangeloop.com
>>
>  --
> 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
>



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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

Re: ANN: Clojure/West 2013 registration, CFP, sponsorships, training

2012-12-05 Thread Alex Miller
Less than a day... I expected it to take longer!

We have room for at least 400 so there are still plenty of tickets
available (last year was about 300).


On Wed, Dec 5, 2012 at 4:33 PM, Sean Corfield wrote:

> How long did it actually take to sell all 50 early bird tickets?
>
>
> On Wed, Dec 5, 2012 at 1:34 PM, Alex Miller  wrote:
>
>> Based on a very quick response, the early bird is now sold out!  Plenty
>> of tickets left at the regular rate though of $350 though.
>>
>>
>> On Tuesday, December 4, 2012 11:43:46 PM UTC-6, Alex Miller wrote:
>>>
>>> Clojure/West  returns in 2013 to one of my
>>> favorite cities: Portland, Oregon. It will take place March 18-20th. Based
>>> on feedback from last year, we are reducing the number of tracks and
>>> spreading over 3 days with a mixture of single- and double-track. Our venue
>>> will be the Gerding Theater at the Armory in the heart of the Pearl
>>> District. The Gerding is a wonderful venue and should be a great
>>> location 
>>> (lobby
>>> , main 
>>> theater
>>> ).
>>>
>>> Registration  is now open (
>>> https://regonline.com/**clojurewest2013).
>>>  Only 50 early bird tickets are available for just $275 rising to $350 for
>>> the remainder. Buy now if you want the lower price - the early bird will go
>>> fast.
>>>
>>> Our conference hotel will be the Courtyard City 
>>> Center.
>>> We have arranged a conference rate of $124/night and the block is now
>>> available (King rooms code *cwccwca*, Queen rooms code *cwccwcb*).
>>>
>>> Relevance will be running an all-day ClojureScript training 
>>> class led
>>> by Stuart Sierra and Luke VanderHart on the day before the conference
>>> (March 17). The venue is close to the conference hotel and the room block
>>> is available the night before the training as well. Training registration
>>> is open now .
>>>
>>> The call for presentations 
>>> for
>>> Clojure/West is open till January 4th. Please check out the CFP and submit
>>> a talk! Rich Hickey will be giving a keynote (and others to be announced).
>>> Speakers receive free admission, airfare, and hotel.
>>>
>>> If your company is interested in sponsoring, the sponsorship 
>>> prospectus is
>>> available. Clojure/West is a great opportunity to get your company's name
>>> in front of a great group of crazy smart developers.
>>>
>>> Alex Miller
>>> a...@thestrangeloop.com
>>>
>>  --
>> 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
>>
>
>
>
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> 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 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

A bearded person, Clojure and JavaFX

2012-12-05 Thread Christian Sperandio
Hi,

I'm one of those bearded (Lin)Unixians person who love the black screen. 
I'm closer to back-office than front-office (it's may be my (too) pragmatic 
mind). 
But sometimes, for some programs, a GUI is a good thing for users. In 
particular when the sofware is not for barbed person :)
First, I want to give details about my GUI development experience. For some 
years now, I developed GUI with Cocoa (OS X, before IPhone and iOS out). 
Recently, I did some development in HTML5/CSS/JS (and I hope, in the 
future, I'll learn ClojureScript).

Back to now, I'd like to make a GUI for a Clojure program and being in the 
JVM world, I thought I would try a new framework: JavaFX2. Below, I give my 
feeling and anyone can write remarks about it.

We are living in the 2010's years and with JavaFX we find another framework 
whose the conception is inheritance spirit. The first thing you do, is a 
subclass of Application. Well, what do you do with delegation? Composition? 
I had a lot of pleasure with Cocoa because there was no (almost) 
inheritance. All your work was done by delegation. I found that more 
elegant and cleaner. As far as I like no more the Apple's philosophy (but 
it's another discussion), for this point I found that the Cocoa's 
architecture was well-thought. And I find that the Clojure code is damaged 
by the JavaFX inheritance. You must write  :gen-class extends to just 
display a window. And when I read documentation about bindings, I thought 
it was complicated to make a simple thing (look at watch in clojure). OK, 
the JavaFX bindings work but I feel writing code for writing code.

My second bad point for JavaFX, it's about the interactive development. I 
love languages like Groovy and Clojure because you can test the code in a 
console (GroovyConsole or REPL). Can we do that with JavaFX? My main 
problem is the following: for launching of your JavaFX application, you 
have to call the start method in your main. It blocks the current thread 
and the REPL waits for closing the window. While with Swing, you can create 
components on-the-fly (no start method to display your main frame) in the 
REPL. The "thing" lives and changes under your eyes. It's magic.

Did I miss something ? Did I have a bad feeling too soon because the code's 
weight and difficulties? When I read code like callback,XXX>, sorry but I'm discouraged. Some people laugh at Clojure 
because of its parentheses. But in this case, we can talk about Java and 
its arrows.

Finally, I think I'll turn to Swing. OK  it's less pretty and hype than 
JavaFX but the fact I can play with Swing inside REPL is fun. And 
seriously, why JavaFX's developers made something so unpleasant (I think 
again this inheritance point as soon as you want to launch a simple frame).

If some people work with JavaFX and think it's great, I'm ready to read 
your posts. Even if I'm a bearded person, I'm ready to reassess. Perhaps, I 
missed something.

Chris

-- 
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

Re: A bearded person, Clojure and JavaFX

2012-12-05 Thread charlie
What is the GUI for ?  I'm not sure I'm happy about it, but I think most
UI's are done in a browser now, and if you haven't checked out
clojurescriptone.com yet I'd take a look.



On Wed, Dec 5, 2012 at 5:38 PM, Christian Sperandio <
christian.speran...@gmail.com> wrote:

> Hi,
>
> I'm one of those bearded (Lin)Unixians person who love the black screen.
> I'm closer to back-office than front-office (it's may be my (too) pragmatic
> mind).
> But sometimes, for some programs, a GUI is a good thing for users. In
> particular when the sofware is not for barbed person :)
> First, I want to give details about my GUI development experience. For
> some years now, I developed GUI with Cocoa (OS X, before IPhone and iOS
> out). Recently, I did some development in HTML5/CSS/JS (and I hope, in the
> future, I'll learn ClojureScript).
>
> Back to now, I'd like to make a GUI for a Clojure program and being in the
> JVM world, I thought I would try a new framework: JavaFX2. Below, I give my
> feeling and anyone can write remarks about it.
>
> We are living in the 2010's years and with JavaFX we find another
> framework whose the conception is inheritance spirit. The first thing you
> do, is a subclass of Application. Well, what do you do with delegation?
> Composition? I had a lot of pleasure with Cocoa because there was no
> (almost) inheritance. All your work was done by delegation. I found that
> more elegant and cleaner. As far as I like no more the
> Apple's philosophy (but it's another discussion), for this point I found
> that the Cocoa's architecture was well-thought. And I find that the Clojure
> code is damaged by the JavaFX inheritance. You must write  :gen-class
> extends to just display a window. And when I read documentation about
> bindings, I thought it was complicated to make a simple thing (look at
> watch in clojure). OK, the JavaFX bindings work but I feel writing code for
> writing code.
>
> My second bad point for JavaFX, it's about the interactive development. I
> love languages like Groovy and Clojure because you can test the code in a
> console (GroovyConsole or REPL). Can we do that with JavaFX? My main
> problem is the following: for launching of your JavaFX application, you
> have to call the start method in your main. It blocks the current thread
> and the REPL waits for closing the window. While with Swing, you can create
> components on-the-fly (no start method to display your main frame) in the
> REPL. The "thing" lives and changes under your eyes. It's magic.
>
> Did I miss something ? Did I have a bad feeling too soon because the
> code's weight and difficulties? When I read code like
> callback,XXX>, sorry but I'm discouraged.
> Some people laugh at Clojure because of its parentheses. But in this case,
> we can talk about Java and its arrows.
>
> Finally, I think I'll turn to Swing. OK  it's less pretty and hype than
> JavaFX but the fact I can play with Swing inside REPL is fun. And
> seriously, why JavaFX's developers made something so unpleasant (I think
> again this inheritance point as soon as you want to launch a simple frame).
>
> If some people work with JavaFX and think it's great, I'm ready to read
> your posts. Even if I'm a bearded person, I'm ready to reassess. Perhaps, I
> missed something.
>
> Chris
>
> --
> 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 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

Re: A bearded person, Clojure and JavaFX

2012-12-05 Thread Christian Sperandio
It's for a little application. It's for manage foods and their expiration 
date (thus, we avoid forget items in the cupboard). 
I thought about browser. I just wanted to chang :) 

Le jeudi 6 décembre 2012 00:43:15 UTC+1, charlie a écrit :
>
> What is the GUI for ?  I'm not sure I'm happy about it, but I think most 
> UI's are done in a browser now, and if you haven't checked out 
> clojurescriptone.com yet I'd take a look.
>
>
>
> On Wed, Dec 5, 2012 at 5:38 PM, Christian Sperandio <
> christian...@gmail.com > wrote:
>
>> Hi,
>>
>> I'm one of those bearded (Lin)Unixians person who love the black screen. 
>> I'm closer to back-office than front-office (it's may be my (too) pragmatic 
>> mind). 
>> But sometimes, for some programs, a GUI is a good thing for users. In 
>> particular when the sofware is not for barbed person :)
>> First, I want to give details about my GUI development experience. For 
>> some years now, I developed GUI with Cocoa (OS X, before IPhone and iOS 
>> out). Recently, I did some development in HTML5/CSS/JS (and I hope, in the 
>> future, I'll learn ClojureScript).
>>
>> Back to now, I'd like to make a GUI for a Clojure program and being in 
>> the JVM world, I thought I would try a new framework: JavaFX2. Below, I 
>> give my feeling and anyone can write remarks about it.
>>
>> We are living in the 2010's years and with JavaFX we find another 
>> framework whose the conception is inheritance spirit. The first thing you 
>> do, is a subclass of Application. Well, what do you do with delegation? 
>> Composition? I had a lot of pleasure with Cocoa because there was no 
>> (almost) inheritance. All your work was done by delegation. I found that 
>> more elegant and cleaner. As far as I like no more the 
>> Apple's philosophy (but it's another discussion), for this point I found 
>> that the Cocoa's architecture was well-thought. And I find that the Clojure 
>> code is damaged by the JavaFX inheritance. You must write  :gen-class 
>> extends to just display a window. And when I read documentation about 
>> bindings, I thought it was complicated to make a simple thing (look at 
>> watch in clojure). OK, the JavaFX bindings work but I feel writing code for 
>> writing code.
>>
>> My second bad point for JavaFX, it's about the interactive development. I 
>> love languages like Groovy and Clojure because you can test the code in a 
>> console (GroovyConsole or REPL). Can we do that with JavaFX? My main 
>> problem is the following: for launching of your JavaFX application, you 
>> have to call the start method in your main. It blocks the current thread 
>> and the REPL waits for closing the window. While with Swing, you can create 
>> components on-the-fly (no start method to display your main frame) in the 
>> REPL. The "thing" lives and changes under your eyes. It's magic.
>>
>> Did I miss something ? Did I have a bad feeling too soon because the 
>> code's weight and difficulties? When I read code like 
>> callback,XXX>, sorry but I'm discouraged. 
>> Some people laugh at Clojure because of its parentheses. But in this case, 
>> we can talk about Java and its arrows.
>>
>> Finally, I think I'll turn to Swing. OK  it's less pretty and hype than 
>> JavaFX but the fact I can play with Swing inside REPL is fun. And 
>> seriously, why JavaFX's developers made something so unpleasant (I think 
>> again this inheritance point as soon as you want to launch a simple frame).
>>
>> If some people work with JavaFX and think it's great, I'm ready to read 
>> your posts. Even if I'm a bearded person, I'm ready to reassess. Perhaps, I 
>> missed something.
>>
>> Chris
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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 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

Re: A bearded person, Clojure and JavaFX

2012-12-05 Thread Stephen Compall
On Dec 5, 2012 6:38 PM, "Christian Sperandio" 
wrote:
> And I find that the Clojure code is damaged by the JavaFX inheritance.
You must write  :gen-class extends to just display a window.

There are many things in JavaFX for which documentation suggests
subclassing, but it is entirely reasonable to simply instantiate and call
methods.  Keep the API docs handy; they are your friend.

Even if occasionally you run into BuilderFactory or ill-typed lambda
representations.

> And when I read documentation about bindings, I thought it was
complicated to make a simple thing (look at watch in clojure). OK, the
JavaFX bindings work but I feel writing code for writing code.

Fortunately, Clojure has good tools for writing code for writing code.

> My second bad point for JavaFX, it's about the interactive development. I
love languages like Groovy and Clojure because you can test the code in a
console (GroovyConsole or REPL). Can we do that with JavaFX?

Yes, absolutely.

> My main problem is the following: for launching of your JavaFX
application, you have to call the start method in your main.

Spawning a thread to run start is as easy as (future (.start ...)) in
clojure.  Futures are GC-rooted in Clojure, so you can forget the future if
you want.

> It blocks the current thread and the REPL waits for closing the window.

Again, the documented approach is not always best; the API provides tools
for customizing initialization.

> When I read code like callback,XXX>,
sorry but I'm discouraged.

JavaFX's big problem is that it doesn't use *enough* type parameters,
really.

I won't call myself a "fan" of JFX, though, because as I recall the
implementation is not yet entirely Free, though most of it is available
under GPL.  If I am wrong, though, I encourage you to explore it further.

--
Stephen Compall
If anyone in the MSA is online, you should watch this flythrough.

-- 
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

Re: Default random in Clojure doesn't seem to fit fp paradigm

2012-12-05 Thread JonC


On Wednesday, December 5, 2012 10:30:26 PM UTC, Karsten Schmidt wrote:
>
> FWIW dynvars are quite a common solution to these kind of scenarios: 
>

And that's an excellent solution. However, I still think that it's a 
problem that shouldn't need solving in the first place - the basic library 
should have a set seed.

-- 
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

Re: A bearded person, Clojure and JavaFX

2012-12-05 Thread Dave Ray
Although it's not obvious from the JavaFX docs since they're written
for a Java audience, it is very possible to create apps in an
interactive style without inheritance. Two caveats:

* Ignore the Application class. Just create your scene, etc directly.
* Most execution has to run on the JavaFX thread so everything you do
has to be wrapped in an "invoke-now" that dispatches the code to that
thread and waits for the result. Swing is much more forgiving on this
front at the expense of allowing a lot of badly threaded code to be
written.

I've captured some of this stuff in upshot
(https://github.com/daveray/upshot) which is on hiatus at the moment
but kind of works at least. There's an example here [1] without an
Application or inheritance in sight.

Cheers,

Dave

[1] 
https://github.com/daveray/upshot/blob/develop/test/upshot/test/examples/example.clj

On Wed, Dec 5, 2012 at 4:08 PM, Stephen Compall
 wrote:
> On Dec 5, 2012 6:38 PM, "Christian Sperandio"
>  wrote:
>> And I find that the Clojure code is damaged by the JavaFX inheritance. You
>> must write  :gen-class extends to just display a window.
>
> There are many things in JavaFX for which documentation suggests
> subclassing, but it is entirely reasonable to simply instantiate and call
> methods.  Keep the API docs handy; they are your friend.
>
> Even if occasionally you run into BuilderFactory or ill-typed lambda
> representations.
>
>> And when I read documentation about bindings, I thought it was complicated
>> to make a simple thing (look at watch in clojure). OK, the JavaFX bindings
>> work but I feel writing code for writing code.
>
> Fortunately, Clojure has good tools for writing code for writing code.
>
>> My second bad point for JavaFX, it's about the interactive development. I
>> love languages like Groovy and Clojure because you can test the code in a
>> console (GroovyConsole or REPL). Can we do that with JavaFX?
>
> Yes, absolutely.
>
>> My main problem is the following: for launching of your JavaFX
>> application, you have to call the start method in your main.
>
> Spawning a thread to run start is as easy as (future (.start ...)) in
> clojure.  Futures are GC-rooted in Clojure, so you can forget the future if
> you want.
>
>> It blocks the current thread and the REPL waits for closing the window.
>
> Again, the documented approach is not always best; the API provides tools
> for customizing initialization.
>
>> When I read code like callback,XXX>,
>> sorry but I'm discouraged.
>
> JavaFX's big problem is that it doesn't use *enough* type parameters,
> really.
>
> I won't call myself a "fan" of JFX, though, because as I recall the
> implementation is not yet entirely Free, though most of it is available
> under GPL.  If I am wrong, though, I encourage you to explore it further.
>
> --
> Stephen Compall
> If anyone in the MSA is online, you should watch this flythrough.
>
> --
> 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 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


Re: A Working nrepl-ritz Setup?

2012-12-05 Thread Timothy Washington
Ahh yes, `*lein ritz-nrepl*` wasn't working. I got it working by changing
the file name to profiles.clj . So Hugo, in the
ritz/nrepl page,
you'll want to change the instruction text from *A)* to *B)*.

*A)* Add this to your ~/.lein/profiles file (requires lein version 2):
*B)* Add this to your *~/.lein/profiles.clj* file (requires lein version 2):


So with that, I get a little further. And running `*M-x nrepl-ritz-jack-in*`
gets me an nrepl shell and server. But the result of the jack-in is an
error (see below). I'm not sure if that has to do with ritz, but I'll play
around with it:

java.io.FileNotFoundException: Could not locate complete/core__init.class
or complete/core.clj on classpath:




 at clojure.lang.RT.load (RT.java:432)





clojure.lang.RT.load (RT.java:400)





clojure.core$load$fn__4890.invoke (core.clj:5415)





clojure.core$load.doInvoke (core.clj:5414)





clojure.lang.RestFn.invoke (RestFn.java:408)



Thanks very much
Tim



On Wed, Dec 5, 2012 at 12:27 PM, Hugo Duncan  wrote:

> Timothy Washington  writes:
>
> > Yes, I updated "*~/.emacs.d/init.el*" and "*~/.lein/profiles*", as
> outlined
> > on that page. But somehow nrepl server thinks *'ritz-nrepl' is not a
> task*.
>
> Does running `lein ritz-nrepl` from a shell within your project
> directory work?
>
> Hugo
>
>

-- 
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