Re: confusing macro issue: java.lang.InstantiationException

2012-01-21 Thread Cedric Greevey
On Sat, Jan 21, 2012 at 2:47 AM, drewn naylor...@gmail.com wrote:
 Thank you, that works great!  It's a nice use of destructuring too,
 which I should of thought of.

...

 Thanks for a great lesson on macros!

You're welcome. :)

-- 
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: clojure-clr loadpath points to D: harddrive

2012-01-21 Thread dmiller
On Jan 19, 10:25 pm, jayvandal s...@ida.net wrote:
 Why does the clr point to d: work?
 user= (use :reload 'ui)
 FileNotFoundException Could not locate db.mysql.clj.dll or db/
 mysql.clj on load
 path.  clojure.lang.RT.load (d:\work\clojure-clr\Clojure\Clojure\Lib
 \RT.cs:3065)

It is not looking in d:\work\... to resolve the load.

The  d:\work\clojure-clr\Clojure\Clojure\Lib\RT.cs:3065 indicates
the source line where the exception was thrown.

It should be looking for the file to load starting from the root.
From the text, it appears there is a load or use or require within
your ui.clj looking for db/mysql.  As the error statement indicates,
starting from the current directory, it has looked for ./
db.mysql.clj.dll or   ./db/mysql.clj.  The latter being clj source,
the former being the standard name for the assembly that results from
AOT-compiling of  db/mysql.clj.  Clearly something is not where it
should be.

You can set roots other than the current working directory via the
environment variable CLOJURE_LOAD_PATH.  Actually, I'm planning a post
for http://clojureclr.blogspot.com/ regarding all environment
variables that are referenced, plus some info on AOT-compilation.

-David

-- 
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: Seemingly simple shell commands taking forever

2012-01-21 Thread techwhizbang
Thanks Phil, that was it exactly. Duly noted!

On Jan 20, 2:28 pm, Phil Hagelberg p...@hagelb.org wrote:
 techwhizbang techwhizb...@gmail.com writes:
  I am using lein run -m to execute a simple database preparation task.
  I issue 2 very simple commands that execute very fast on their on own
  when executed in the shell. They also appear to execute very fast
  based on the print output to stdout. However, the problem is that
  after executing the 2 clojure.java.shell sh commands the process hangs
  on way after it completes. So much so that it feels wrong.

  Here is the gist.https://gist.github.com/1635837

 The agent thread pool is probably keeping the process open. Try calling
 (shutdown-agents) when you're done.

 This is a long-standing known bug/shortcoming in Clojure:

  http://dev.clojure.org/jira/browse/CLJ-124

 -Phil

-- 
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] oauth-clj

2012-01-21 Thread r0man
Hi all,

I just released another OAuth library for Clojure on top of
clj-http, supporting version 1 and 2 of the OAuth protocol.

Roman.

https://github.com/r0man/oauth-clj
http://clojars.org/oauth-clj

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

Must a page refresh fire an init event?

2012-01-21 Thread Folcon
I'm trying out Clojurescript one, but whenever I refresh the page the init 
event appears to fire so I lose the current state I'm in.

How can I set it so that the init event only resets my state if I don't 
have any? (I'm intending to have an explicit reset event.)

Kind Regards,
Folcon

-- 
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: Must a page refresh fire an init event?

2012-01-21 Thread Daniel Jomphe
Folcon wrote:

 I'm trying out Clojurescript one, but whenever I refresh the page the init 
 event appears to fire so I lose the current state I'm in.

 How can I set it so that the init event only resets my state if I don't 
 have any? (I'm intending to have an explicit reset event.)


That's the nature of the web. A page refresh in a browser clears all 
client-side, transient state. You can restore state out of persistent state 
stores (cookies on the client side, or session on the server side), or you 
can also pass state elements through the HTTP request-response workflow.

All that said, if your intention was to try your code changes while you 
were developing, I strongly encourage you to watch this very nice 
screencast [1] and read that wiki page [2].

[1] http://vimeo.com/35153207
[2] https://github.com/brentonashworth/one/wiki/Development

Also, the rest of the wiki is very interesting [3].

[3] https://github.com/brentonashworth/one/wiki

-- 
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: Must a page refresh fire an init event?

2012-01-21 Thread Daniel Jomphe
The wiki page I really meant 
is https://github.com/brentonashworth/one/wiki/Workflow

Also, obviously, restoring state out of persistent state stores can only be 
made if you've explicitly saved stuff there before the user refreshed the 
page. The same is true of the HTTP request-response workflow. No state can 
survive through a browser refresh in any case unless the developer 
provisioned one of those ways for the state to flow through.

Daniel Jomphe wrote:

 Folcon wrote:

 I'm trying out Clojurescript one, but whenever I refresh the page the 
 init event appears to fire so I lose the current state I'm in.

 How can I set it so that the init event only resets my state if I don't 
 have any? (I'm intending to have an explicit reset event.)


 That's the nature of the web. A page refresh in a browser clears all 
 client-side, transient state. You can restore state out of persistent state 
 stores (cookies on the client side, or session on the server side), or you 
 can also pass state elements through the HTTP request-response workflow.

 All that said, if your intention was to try your code changes while you 
 were developing, I strongly encourage you to watch this very nice 
 screencast [1] and read that wiki page [2].

 [1] http://vimeo.com/35153207
 [2] https://github.com/brentonashworth/one/wiki/Development

 Also, the rest of the wiki is very interesting [3].

 [3] https://github.com/brentonashworth/one/wiki


-- 
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: Must a page refresh fire an init event?

2012-01-21 Thread Folcon
Hi Daniel,

I am aware of that, reading the wiki it appears that Clojurescript One 
keeps track of state in an atom and I was under the impression that it 
should be possible to recover the current state from this atom? Maybe I'm 
mistaken in this however.

Regards,
Folcon

-- 
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: Must a page refresh fire an init event?

2012-01-21 Thread Folcon
Actually thinking about this what you are saying seems to be correct, I 
just realised that the atom is stored on the client, not the server. Is 
there any cookie functionality I can access from clojurescript?

Regards,
Folcon

-- 
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: Bug in 1.3 with sets as functions?

2012-01-21 Thread Kevin Downey
Sets when used as functions are not predicates the do not return true or
false based on membership.

They return the looked up value, in this case false. You can say well I
passed in the value, why would I want it back but sets don't need to
return an identical object, just an equal object (could have different
metadata etc.

This behavior is not a bug. It seems unlikely that this interface/contract
would be changed, do you have compelling case for change?
On Jan 21, 2012 7:46 PM, Mark Engelberg mark.engelb...@gmail.com wrote:

 I believe it is a bug that:
 (#{true false} false) yields false
 whereas
 (contains? #{true false} false) yields true

 Can someone confirm or deny this?

 --
 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: Bug in 1.3 with sets as functions?

2012-01-21 Thread Phil Hagelberg
Mark Engelberg mark.engelb...@gmail.com writes:

 I believe it is a bug that:
 (#{true false} false) yields false
 whereas
 (contains? #{true false} false) yields true

 Can someone confirm or deny this?

It's intentional that calling a set as a function returns the argument
if it's a member. Part of the reason contains? exists is so that you can
find out whether nil is a member of a set.

-Phil

-- 
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: Must a page refresh fire an init event?

2012-01-21 Thread Daniel Jomphe
ClojureScript One is built on top of Ring, which provides nice middleware 
for handling cookies [1].

You may want to search for wrap- on the web page of One's marginalia 
documentation to see where you could add this middleware [2].

[1] https://github.com/mmcgrana/ring/wiki/Cookies
[2] http://clojurescriptone.com/documentation.html

But all of this is server-side, and if you need to persist state of which 
the server can't know about, then you need to set the cookies on the client 
side. There, accessing cookies can be done by calling standard 
cookie-handling javascript functions [3] (using ClojureScript's interop to 
javascript). Or you may prefer to use the Cookies class that comes with the 
Google Closure Library that's part of ClojureScript [4], which I would 
advise to do if you need to manage cookies client-side.

[3] http://www.w3schools.com/js/js_cookies.asp
[4] http://closure-library.googlecode.com/svn/docs/class_goog_net_Cookies.html

As for how to call either of those things from ClojureScript, I suggest 
looking at One's source code for lots of examples. (One doesn't use cookies 
at all but you'll see lots of calls of js stuff, and lots of usages of 
Closure Library stuff.)

On Saturday, January 21, 2012 9:37:26 PM UTC-5, Folcon wrote:

 Actually thinking about this what you are saying seems to be correct, I 
 just realised that the atom is stored on the client, not the server. Is 
 there any cookie functionality I can access from clojurescript?

 Regards,
 Folcon


-- 
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: Must a page refresh fire an init event?

2012-01-21 Thread Folcon
Thanks a lot Daniel, much appreciated!

-- 
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: Bug in 1.3 with sets as functions?

2012-01-21 Thread Mark Engelberg
Ah yes.  I knew that.  I've seen it on this list dozens of times.  And
yet, when it bit me, I was still surprised.  sigh

-- 
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: Bug in 1.3 with sets as functions?

2012-01-21 Thread Mark Engelberg
Thanks for reminding me.

-- 
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: Bug in 1.3 with sets as functions?

2012-01-21 Thread Mark Engelberg
Upon some introspection as to why I failed to remember this subtle
point, I realized that:
1. I expect get on sets to do the behavior where it returns the item.
2. I expect contains? on sets to do the behavior where it returns true or false.
3. I (incorrectly) expected function application of a set to behave
like contains? not get.

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