ANN: clojure.java.shell2 drop in replacement for clojure.java.shell

2013-06-25 Thread Marc Limotte
I'm announcing java.shell2 .  It
is backward compatible with clojure.java.shell.  This is a Clojure library
to facilitate launching of sub-processes and piping (streaming) data.

Features
- A declarative syntax for defining new processes to specify input, output,
encoding, and other behavior
- Handling for common use-cases (i.e. pass stdout/err of the process to the
same destination as the parent, merge stderr of the process to stdout,
output directly to a File, etc)
- The pipe macro handles all the complexity of managing multipe streams and
threads for streaming data through multiple processes and clojure functions.
- Backward compatible with existing code that uses clojure.java.shell (i.e.
a drop-in replacement)

Shell has additional predicates like :pass, which will connect STDOUT or
STDERR of the process to the STDOUT/ERR of the parent JVM.

(sh "wc" "-l" :in input :err :pass :out (io/file "/tmp/foo"))

So the above form reads input (which can be a file, stream, string, etc),
forwards the output to a file and redirects STDERR to STDERR of the JVM.

And here's an example of a pipe:

(pipe
  (sh "cat" :in input)
  my-filter-fn;A clojure function -- data is streamed
  (sh "wc" "-l"))


This library was developed at The Climate Corporation ,
so a big thank you to them for allowing me to open source this code under
an EPL license.  Climate Corp has one of the largest Clojure development
teams.  We are an established startup with offices in San Francisco and
Seattle; and are currently hiring full-time Clojure developers, data
scientists, product managers and more .

See the README for more details and many examples in the unit tests.

I know there are other shell libraries for Clojure.  My main motivation is
that I wanted something closer to the clojure.java.shell api.

Marc Limotte

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




Re: Database migrations

2013-06-25 Thread Marian Schubert
Hello,

few days ago I extracted DB migrations code from few of my pet projects 
into library called fun_migrations 
(https://github.com/maio/fun_migrations). I should probably also 
credit technomancy because in syme project he's using similar simple 
concept. It's just few lines of code so I didn't think it would be useful 
to make public, but seeing that someone else also came with similar code 
made me think that it might be useful to other people too.

In my previous non-Clojure projects I have been using http://dbdeploy.com 
with great success, but there were times when I really needed to run some 
non-SQL code. With fun_migrations you can run arbitrary Clojure code in 
each migration, you can use multiple DB connections, etc...

Please note that it's version 0.1.0 and it's also my first Clojure library 
so it might not be particularly stable. It works for my current use case, 
but it might not work for yours.

M


On Friday, June 14, 2013 6:24:39 PM UTC+2, Reginald Choudari wrote:
>
> Hello all,
>
> I am trying to implement database migrations with Clojure. So far I have 
> been looking at Drift (https://github.com/macourtney/drift) as a 
> candidate for implementing this. My question is, does anyone have a 
> database migration workflow that they use and would like to share? One 
> problem I have been thinking is how to tackle database credentials/db name 
> configuration. I know in Rails its common to use a YAML to provide this 
> info, wondering if there was something more idiosyncratic to clojure?
>
> Thanks in advance
>

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




Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-25 Thread Michael-Keith Bernard (SegFaultAX)
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L24

The implementation assumes you're attempting to conj one of the following 3 
things into the hash map:

   1. A MapEntry object
   2. A vector of the format [key value]
   3. A seq of MapEntry objects (commonly created 
   via 
http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html#entrySet() 
   and the like)


On Monday, June 24, 2013 11:57:46 AM UTC-7, Michael Gardner wrote:
>
> On Jun 24, 2013, at 11:14 , Sean Corfield > 
> wrote: 
>
> > On Mon, Jun 24, 2013 at 8:49 AM, John Gabriele 
> > > 
> wrote: 
> >> Why does `into` fail when the 2-element collections are lists and not 
> >> vectors? : 
> > 
> > Because the implementation special cases vectors :) 
> > 
> > It's the one place where a two element vector is treated like a 
> > Map$Entry so that you are not forced to somehow create Map$Entry 
> > instances for the key/value pairs. 
>
> Huh. I had assumed this would work with any 2-element collection, like 
> destructuring. Why not? Performance reasons?

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




Re: putting 2-element colls into a map: works with vectors, but not with lists?

2013-06-25 Thread Michael Gardner
On Jun 25, 2013, at 15:03 , Michael-Keith Bernard (SegFaultAX) 
 wrote:

> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L24
> 
> The implementation assumes you're attempting to conj one of the following 3 
> things into the hash map:
>   • A MapEntry object
>   • A vector of the format [key value]
>   • A seq of MapEntry objects (commonly created via 
> http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html#entrySet() 
> and the like)

If I read you correctly, you're saying the reason 'into et al. can't accept 
arbitrary two-element collections for adding to a map is that APersistentMap's 
.cons method does something special with seqable things that aren't vectors. 
Right?

Any insight into why Rich would have written .cons that way, instead of putting 
that seq-of-MapEntry functionality into a separate method?

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




Re: ANN: ClojureScript release 0.0-1798

2013-06-25 Thread gerrit . hentschel
Thanks a lot for the source map support. Made it possible for me to find the 
cause of my broken advanced compiled cljs. Without the source map I was totally 
lost...

In case anybody wonders how to enable it:

Just add a :source-map "path/to/js/folder/source-map-name.js.map" key value 
pair to the :compiler map of your :cljsbuild map.

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




Re: ANN: ClojureScript release 0.0-1798

2013-06-25 Thread David Nolen
Wow, really? I didn't really consider it usable yet as we don't emit quite
enough information for mapping symbols.


On Tue, Jun 25, 2013 at 7:14 PM,  wrote:

> Thanks a lot for the source map support. Made it possible for me to find
> the cause of my broken advanced compiled cljs. Without the source map I was
> totally lost...
>
> In case anybody wonders how to enable it:
>
> Just add a :source-map "path/to/js/folder/source-map-name.js.map" key
> value pair to the :compiler map of your :cljsbuild map.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: ANN: ClojureScript release 0.0-1798

2013-06-25 Thread Brandon Bloom
Even if it's horribly broken, maybe we should default it to on for advanced 
builds anyway? It's not like anything can be harder to debug than raw 
advanced compilation output. Besides, we might get some more interest and 
contributions if it *feels* like it's close!

On Tuesday, June 25, 2013 7:37:28 PM UTC-4, David Nolen wrote:
>
> Wow, really? I didn't really consider it usable yet as we don't emit quite 
> enough information for mapping symbols.
>
>
> On Tue, Jun 25, 2013 at 7:14 PM, >wrote:
>
>> Thanks a lot for the source map support. Made it possible for me to find 
>> the cause of my broken advanced compiled cljs. Without the source map I was 
>> totally lost...
>>
>> In case anybody wonders how to enable it:
>>
>> Just add a :source-map "path/to/js/folder/source-map-name.js.map" key 
>> value pair to the :compiler map of your :cljsbuild map.
>>
>> --
>> --
>> 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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>

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




Re: ANN: ClojureScript release 0.0-1798

2013-06-25 Thread David Nolen
I recall it adding a significant amount of time to advanced compilation so
I'm not sure that's such a good idea as a default. But documenting and
advertising its existence in the proper places seems like a good idea.

David


On Tue, Jun 25, 2013 at 11:07 PM, Brandon Bloom
wrote:

> Even if it's horribly broken, maybe we should default it to on for
> advanced builds anyway? It's not like anything can be harder to debug than
> raw advanced compilation output. Besides, we might get some more interest
> and contributions if it *feels* like it's close!
>
>
> On Tuesday, June 25, 2013 7:37:28 PM UTC-4, David Nolen wrote:
>
>> Wow, really? I didn't really consider it usable yet as we don't emit
>> quite enough information for mapping symbols.
>>
>>
>> On Tue, Jun 25, 2013 at 7:14 PM,  wrote:
>>
>>> Thanks a lot for the source map support. Made it possible for me to find
>>> the cause of my broken advanced compiled cljs. Without the source map I was
>>> totally lost...
>>>
>>> In case anybody wonders how to enable it:
>>>
>>> Just add a :source-map "path/to/js/folder/source-map-**name.js.map" key
>>> value pair to the :compiler map of your :cljsbuild map.
>>>
>>> --
>>> --
>>> 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 unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Detecting login and logout using friend

2013-06-25 Thread Steve Buikhuizen
Hi all,

I'm using Friend https://github.com/cemerick/friend for auth on my webapp 
and I'm measuring how many people login and use the app etc.

In order to do this I need to detect the login and logout events as well as 
the session-id cookie (I need a unique id for session) from the container. 
I've found this quite difficult. 

My current solution is to use custom ring middleware to detect the addition 
of a new session id cookie (from ring) in the response. I thought it would 
be simpler to detect the change in friend/current-identity but, when I 
tried that, I couldn't get the correct session id cookie and I need that 
also.

Logout detection is easier, I can check for the :session value in the 
response changing to nil. 

It's further complicated by the fact that the cookie re-generation on 
localhost/jetty is different to when running on Elastic Beanstalk.

Does anybody have some advice as to a cleaner way to detecting this event 
as well as seeing a unique id?

I thought of implementing a custom :session-store for ring as one option 
but I'd like to hear other ideas if you have them.

Thanks. If I find a better solution I'll update this thread.

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




Re: Database migrations

2013-06-25 Thread Kelker Ryan
To answer your first email, here's a Lobos based migration using the CHP framework https://github.com/runexec/chp#db-migrations. The configuration file is in resources/config/db.clj and is used by clojure.java.jdbc, KormSQL, and Lobos. 26.06.2013, 04:38, "Marian Schubert" :Hello, few days ago I extracted DB migrations code from few of my pet projects into library called fun_migrations (https://github.com/maio/fun_migrations). I should probably also credit technomancy because in syme project he's using similar simple concept. It's just few lines of code so I didn't think it would be useful to make public, but seeing that someone else also came with similar code made me think that it might be useful to other people too. In my previous non-Clojure projects I have been using http://dbdeploy.com with great success, but there were times when I really needed to run some non-SQL code. With fun_migrations you can run arbitrary Clojure code in each migration, you can use multiple DB connections, etc... Please note that it's version 0.1.0 and it's also my first Clojure library so it might not be particularly stable. It works for my current use case, but it might not work for yours. M On Friday, June 14, 2013 6:24:39 PM UTC+2, Reginald Choudari wrote:Hello all,I am trying to implement database migrations with Clojure. So far I have been looking at Drift (https://github.com/macourtney/drift) as a candidate for implementing this. My question is, does anyone have a database migration workflow that they use and would like to share? One problem I have been thinking is how to tackle database credentials/db name configuration. I know in Rails its common to use a YAML to provide this info, wondering if there was something more idiosyncratic to clojure?Thanks in advance --  --  You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en ---  You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.    



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