Re: deploying clojure/compojure web apps

2013-01-09 Thread kinleyd
Yes, thank you all. This was a very useful thread. On Thursday, January 10, 2013 9:35:38 AM UTC+6, John Gabriele wrote: > > Thanks, all. Updated CDS basic web dev tut with this deployment info. > > ---John > > -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: deploying clojure/compojure web apps

2013-01-09 Thread John Gabriele
Thanks, all. Updated CDS basic web dev tut with this deployment info. ---John -- 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 pat

Re: Reader syntax for uri objects

2013-01-09 Thread Taylor Sando
Here is what I came up with (defmethod print-method java.net.URI [x w] (print-method (symbol (format "#uri [%s]" (symbol (str x w)) (pr-str (java.net.URI. "www.google.com")) "#uri [http://www.google.com"; If used with the cljs parser from above, it works. Thanks On Wednesday, January 9,

Re: Reader syntax for uri objects

2013-01-09 Thread Dave Sann
It's not going to be easy to read the # > The URIs are coming from a datomic database that actually stores the > values as java.net.URIs. All I'm doing is transferring the query values > from the database to the client. The server uses pr-str before sending > back the results, and the client u

[ANN] Datomic Workshop - Bay Area

2013-01-09 Thread Siva Jagadeesan
Hi All, I wanted to make a quick announcement about a Datomic workshop run by Amit Rathore: if you're interested in a hands-on, deep-dive into Datomic, this is a really good option (this is a paid workshop). http://www.meetup.com/The-Bay-Area-Datomic-User-Group/events/98256602/ Thanks, -- S

Re: Delay with atom

2013-01-09 Thread Dave Sann
Create the atom in a let, in the function - so it's new and isolated better still - use an accumulator in the loop, not an atom. take, map an others are lazy. you may need to (doall ...) Dave On Thursday, 10 January 2013 08:22:57 UTC+11, Simone Mosciatti wrote: > > Hi everybody, > > I was impl

Re: Reader syntax for uri objects

2013-01-09 Thread Taylor Sando
The URIs are coming from a datomic database that actually stores the values as java.net.URIs. All I'm doing is transferring the query values from the database to the client. The server uses pr-str before sending back the results, and the client uses reader/read-string to get the results. On

Re: Reader syntax for uri objects

2013-01-09 Thread Dave Sann
why not just print/send your uris as strings? you only need a reader tag if you want to read/interpret it in a particular way at read time in the client. do you want to do this? D On Thursday, 10 January 2013 12:20:53 UTC+11, Taylor Sando wrote: > > I am looking for a way to transfer URI objec

Reader syntax for uri objects

2013-01-09 Thread Taylor Sando
I am looking for a way to transfer URI objects from a clojure client to a clojurescript client. The printed representation of a java.net.URI object is # The problem is that I can't read in this data when it's structured like that. For example, I'd like to be able to pass this data strucutre

Re: deploying clojure/compojure web apps

2013-01-09 Thread Phil Hagelberg
John Gabriele writes: > Ooof. Of course. It needed a `(:gen-class)` at the end of handler.clj's ns > macro. You don't actually need gen-class, you can do a fully-non-AOT'd uberjar and just invoke it with -cp instead of -jar: $ java -cp myproject-1.0.0-standalone.jar clojure.main -m myproject

Re: deploying clojure/compojure web apps

2013-01-09 Thread John Gabriele
On Wednesday, January 9, 2013 5:03:49 PM UTC-5, Aaron Cohen wrote: > > On Wed, Jan 9, 2013 at 4:27 PM, John Gabriele > > wrote: > >> On Wednesday, January 9, 2013 4:08:50 PM UTC-5, Phil Hagelberg wrote: >>> >>> >>> John Gabriele writes: >>> >> >>> and this in main.clj: >>> >>> (defn -main [

Re: deploying clojure/compojure web apps

2013-01-09 Thread Aaron Cohen
On Wed, Jan 9, 2013 at 4:27 PM, John Gabriele wrote: > On Wednesday, January 9, 2013 4:08:50 PM UTC-5, Phil Hagelberg wrote: >> >> >> John Gabriele writes: >> > >> and this in main.clj: >> >> (defn -main [& [port]] >> (let [port (Integer. (or port (System/getenv "PORT") 5000))] >>

Re: deploying clojure/compojure web apps

2013-01-09 Thread John Gabriele
On Wednesday, January 9, 2013 4:39:06 PM UTC-5, John Gabriele wrote: > > > Still though, need to add a :main to project.clj I think. > > BTW, tried `:main my-webapp.handler`. `lein uberjar` succeeds, but when I try to run the jar (via `java -jar my-webapp-0.1.0-SNAPSHOT-standalone.jar`), it fails

Re: deploying clojure/compojure web apps

2013-01-09 Thread John Gabriele
On Wednesday, January 9, 2013 4:27:57 PM UTC-5, John Gabriele wrote: > > On Wednesday, January 9, 2013 4:08:50 PM UTC-5, Phil Hagelberg wrote: >> >> >> and this in main.clj: >> >> (defn -main [& [port]] >> (let [port (Integer. (or port (System/getenv "PORT") 5000))] >> (jetty/r

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Andy Fingerhut
Is there any chance a patch to remove all the obsolete :static keywords from Clojure's core.clj would be accepted? Or perhaps there isn't much point in doing so? I've removed :static as an example keyword in the Metadata section of the latest Clojure cheatsheet published here: http://jafi

Re: deploying clojure/compojure web apps

2013-01-09 Thread John Gabriele
On Wednesday, January 9, 2013 4:08:50 PM UTC-5, Phil Hagelberg wrote: > > > John Gabriele writes: > > > What would I need to do in order to embed jetty so I can create an > uberjar > > (`lein uberjar`) and deploy it (I suppose via: `java -jar > > my-webapp-0.1.0-standalone.jar &`)? > > > > Wh

Re: ANN: bouncer, validation library for clojure

2013-01-09 Thread Leonardo Borges
Stathis, That's a very good point. I've been thinking about the usefulness of returning the errors map in the original map since the errors map itself is returned as the first element in the call to 'validate'. To be honest I'm tempted to remove that with the next release, making validate return

Re: String wrapper that supports meta-data...

2013-01-09 Thread Jim - FooBar();
hehehe...I'm really stupid aren't I?:-[ thanks Stuart... Jim On 09/01/13 21:11, Stuart Sierra wrote: You could also do: (defrecord MString [string]) -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Delay with atom

2013-01-09 Thread Simone Mosciatti
Hi everybody, I was implementing a skip list, just for fun. I implemented the list and just to be sure that it were working I wanted to count how many steps it compute to find a value. SkipList --> http://en.wikipedia.org/wiki/Skip_list To do so I was using a atom, and the code looks like this:

Re: deploying clojure/compojure web apps

2013-01-09 Thread Murphy McMahon
Thanks to technomancy for the very nice basic Clojure webapp template. Very cool. On Wed, Jan 9, 2013 at 7:08 PM, Phil Hagelberg wrote: > > John Gabriele writes: > > > What would I need to do in order to embed jetty so I can create an > uberjar > > (`lein uberjar`) and deploy it (I suppose via:

Re: String wrapper that supports meta-data...

2013-01-09 Thread Stuart Sierra
You could also do: (defrecord MString [string]) -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post

Re: deploying clojure/compojure web apps

2013-01-09 Thread Phil Hagelberg
John Gabriele writes: > What would I need to do in order to embed jetty so I can create an uberjar > (`lein uberjar`) and deploy it (I suppose via: `java -jar > my-webapp-0.1.0-standalone.jar &`)? > > What would need to be added to / changed in the project.clj? > > What exactly should the `-mai

Re: deploying clojure/compojure web apps

2013-01-09 Thread Tony Pitluga
I found this example: https://gist.github.com/raw/887596/d5804f1e7c550cd4c25e1194c58190e816ceadb0/core.clj here: http://www.myclojureadventure.com/2011/03/getting-started-with-ring-and-compojure.html Just substitute your app-routes for handler and put the (run-jetty) form in your -main method. T

Re: deploying clojure/compojure web apps

2013-01-09 Thread John Gabriele
On Wednesday, January 9, 2013 1:26:07 PM UTC-5, Phil Hagelberg wrote: > > > I recommend simply embedding jetty and writing a -main function that > uses run-jetty. Then you can just ship an uberjar out to deploy. > Ok. Suppose I've got a stock webapp generated via lein new compojure my-webap

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Stuart Sierra
> 4. what does ^:static do? Nothing. It's leftover from an old experiment in the Clojure compiler. -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are

Re: What's the current status of Clojure-in-Clojure?

2013-01-09 Thread Stuart Sierra
There is no "official" work (i.e., happening under the Clojure Contributor Agreement) on Clojure-in-Clojure. ClojureScript is as close as it gets right now. -S On Tuesday, January 8, 2013 6:44:16 PM UTC-5, Thor wrote: > > I think this would be a fun project to contribute to, but a few searches

Re: ANN: bouncer, validation library for clojure

2013-01-09 Thread Leonardo Borges
The ones I looked at were https://github.com/r0man/validation-clj and https://github.com/michaelklishin/validateur Cheers, Leonardo Borges www.leonardoborges.com On Wed, Jan 9, 2013 at 4:29 PM, Karim Nassar wrote: > what are the other validation libraries? > > TIA, > Karim > > -- > Karim > > >

Re: ANN: bouncer, validation library for clojure

2013-01-09 Thread Stathis Sideris
Hey Leonardo, This is very interesting, but I'd like to know whether it's possible to validate a map that contains an :errors key. Would bouncer overwrite this with its own :errors key? Should it not be using a fully-qualified keyword (as in ::errors) to avoid the clash? Thanks, Stathis On

Re: Convincing employer to go for Clojure

2013-01-09 Thread Ben Mabey
On 1/7/13 4:02 PM, David Jacobs wrote: What other tips do you have for convincing an employer that Clojure makes good business sense? (Of course I've already told them about domain-tailored abstractions, containing complexity, the ease of data manipulation with a functional language, etc.)

Re: Idiom for transforming a map

2013-01-09 Thread Jim - FooBar();
On 09/01/13 18:20, Jim - FooBar(); wrote: Alex's solution is also quite idiomatic and it takes care of the transient/peristent conversion as well...It seems slightly heavier though cos you're building an intermediate vector. CORRECTION: you'd be building MANY intermediate vectors...as many as

Re: deploying clojure/compojure web apps

2013-01-09 Thread Phil Hagelberg
Josh Kamau writes: > I am new to clojure. My question is: Whats the common practice when it > comes to deploying webapps built on compojure? running via lein ring server > or creating a war file ? I would also like to know which is the best way > to put load configuration files i.e using proper

Re: Idiom for transforming a map

2013-01-09 Thread Jim - FooBar();
obviously, you would use 'assoc' in your reducing fn...If your old-map is rather big then you can start with a transient version of a map and persist it at the end of the entire operation. new example: (peristent! (reduce-kv #(assoc! % (transform %2) %3) (transient (hash-map)) old-map)) ;;% is

Re: Idiom for transforming a map

2013-01-09 Thread Jim - FooBar();
you can use reduce-kv...This is exactly its purpose - to be able to reduce maps without the need of destructuring example: (reduce-kv some-fn-with-3-args {} old-map) Jim On 09/01/13 18:09, Jonathon McKitrick wrote: I have a map derived from JSON data where the keys are strings. I want to bu

Re: Idiom for transforming a map

2013-01-09 Thread Baishampayan Ghose
Something like this? (into {} (for [[k v] my-map] :when (pred k v) [(transform k) v])) ~BG Sent from phone. Please excuse brevity. On 9 Jan 2013 23:39, "Jonathon McKitrick" wrote: > I have a map derived from JSON data where the keys are strings. I want to > build a new map from this one

Idiom for transforming a map

2013-01-09 Thread Jonathon McKitrick
I have a map derived from JSON data where the keys are strings. I want to build a new map from this one, where the new keys are based on integers extracted from the strings of the old keys by a regex. Not all entries will be transformed into the new map. In Common Lisp, I would LOOP and PUSH

clojure.core/ns documentation glitch?

2013-01-09 Thread wujek . srujek
The documentation of clojure.core/ns says nearly to the end of its docstring: "If :refer-clojure is not used, a default (refer 'clojure) is used." Shouldn't it say that a default (refer 'clojure.core) is used? -- You received this message because you are subscribed to the Google Groups "Cloju

Re: What's the current status of Clojure-in-Clojure?

2013-01-09 Thread Steve Miner
I think you're looking for: https://github.com/kanaka/clojurescript I just saw a tweet about a talk be accepted for ClojureWest: https://twitter.com/bus_kanaka/status/289037484787118080 On Jan 8, 2013, at 6:44 PM, Thor wrote: > I think this would be a fun project to contribute to, but a few s

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Aaron Cohen
On Wed, Jan 9, 2013 at 10:17 AM, Wujek Srujek wrote: > So take this definition from master: > > (def > > ^{:arglists '([x]) >:doc "Return true if x implements ISeq" >:added "1.0" >:static true} > seq? (fn ^:static seq? [x] (instance? clojure.lang.ISeq x))) > > static is used twice he

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Aaron Cohen
On Wed, Jan 9, 2013 at 9:24 AM, Philip Potter wrote: > On 9 January 2013 08:37, wrote: > You're quite right, this changed in 1.3. It's even the first entry in > the 1.3 changelog: > > https://github.com/clojure/clojure/blob/clojure-1.3.0/changes.txt > > which reads: > > 1.1 Earmuffed Vars ar

String wrapper that supports meta-data...

2013-01-09 Thread Jim foo.bar
Hi all, I often find myself wanting to attach meta-data to built-in Java classes and particularly to the 'String' class. In a text-mining and NLP context, it is very useful for example to have a dictionary of strings where each string 'knows' its synonyms...Of course one can get around that

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Wujek Srujek
So take this definition from master: (def ^{:arglists '([x]) :doc "Return true if x implements ISeq" :added "1.0" :static true} seq? (fn ^:static seq? [x] (instance? clojure.lang.ISeq x))) static is used twice here. What is / was the difference? Is it correct to say that it is now just

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Philip Potter
On 9 January 2013 08:37, wrote: > 4. what does ^:static do? I read on SO that it is not used any more, but the > source code in clojure.core still has these, and various tutorials use them > as well. This SO thread seems to describe it well: http://stackoverflow.com/questions/7552632/what-does

Re: deploying clojure/compojure web apps

2013-01-09 Thread Oleksandr Petrov
We're using that technique for both long-running server processes and small web applications, i've covered in a blog post some time ago: http://coffeenco.de/articles/how_to_deploy_clojure_code.html Basically, create a jar and run it from a jar. If you don't want to embed jetty, you can deploy to

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Wujek Srujek
Thanks. Yes, I know about ^String being ^{:tag String} because it is mentioned all over the place. ^:dynamic is not. Thanks for the links, I haven't seen them before, and they do clear this issue up. On Wed, Jan 9, 2013 at 10:03 AM, Andy Fingerhut wrote: > > On Jan 9, 2013, at 12:37 AM, wujek.sr

Re: All the ways to define metadata (and ^:static)

2013-01-09 Thread Andy Fingerhut
On Jan 9, 2013, at 12:37 AM, wujek.sru...@gmail.com wrote: > Hi. I am currently learning clojure, which is a nice experience, but you all > know that. > I have question about certain metadata definitions, which I couldn't find a > straight answer to on the net, and in none of the books I'm read

All the ways to define metadata (and ^:static)

2013-01-09 Thread wujek . srujek
Hi. I am currently learning clojure, which is a nice experience, but you all know that. I have question about certain metadata definitions, which I couldn't find a straight answer to on the net, and in none of the books I'm reading: 1. is ^:dynamic the same as ^{:dynamic true}, just a shortcut? 2

Re: ANN: bouncer, validation library for clojure

2013-01-09 Thread Karim Nassar
what are the other validation libraries? TIA, Karim -- Karim On Thu, Jan 3, 2013 at 10:56 PM, Leonardo Borges < leonardoborges...@gmail.com> wrote: > Hey guys, > > I extracted a small validation library from a side project I'm working > on and bouncer is the result. > > While I do know there a