Re: lein-daemon 0.3

2012-06-25 Thread Joao_Salcedo


On Thursday, May 12, 2011 2:18:57 PM UTC+10, Allen Rohner wrote:
>
> I've released a new version of lein-daemon. daemon is like 'lein run', 
> only it runs the process in the background rather than blocking. 
>
> 0.3 and up is a complete re-write, that no longer depends on apache 
> commons daemon. The new version has no dependencies on any external 
> programs. 
>
> For more, see https://github.com/arohner/lein-daemon 
>
>
On Thursday, May 12, 2011 2:18:57 PM UTC+10, Allen Rohner wrote:
>
> I've released a new version of lein-daemon. daemon is like 'lein run', 
> only it runs the process in the background rather than blocking. 
>
> 0.3 and up is a complete re-write, that no longer depends on apache 
> commons daemon. The new version has no dependencies on any external 
> programs. 
>
> For more, see https://github.com/arohner/lein-daemon 
>
>
On Thursday, May 12, 2011 2:18:57 PM UTC+10, Allen Rohner wrote:
>
> I've released a new version of lein-daemon. daemon is like 'lein run', 
> only it runs the process in the background rather than blocking. 
>
> 0.3 and up is a complete re-write, that no longer depends on apache 
> commons daemon. The new version has no dependencies on any external 
> programs. 
>
> For more, see https://github.com/arohner/lein-daemon 
>
>
On Thursday, May 12, 2011 2:18:57 PM UTC+10, Allen Rohner wrote:
>
> I've released a new version of lein-daemon. daemon is like 'lein run', 
> only it runs the process in the background rather than blocking. 
>
> 0.3 and up is a complete re-write, that no longer depends on apache 
> commons daemon. The new version has no dependencies on any external 
> programs. 
>
> For more, see https://github.com/arohner/lein-daemon 
>

Hi All I am using lein-daemon so it is a really great tool.
I have a question it might be silly , but when I run " lein daemon start 
:project-name" it is great but how can I get the propmt back
it is running compojure and the last line is 
2012-06-26 12:51:16.234:INFO:oejs.AbstractConnector:Started 
SelectChannelConnector@0.0.0.0:3000
but I need the prompt back to start other scripts.
Any ideas about how can I achieve this.

Cheers,

JS 

-- 
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: Is there a better way to do this

2012-06-17 Thread Joao_Salcedo
Hi Sean,

That works just perfect !!!

JS

On Saturday, June 16, 2012 11:58:30 AM UTC+10, Sean Corfield wrote:
>
> On Fri, Jun 15, 2012 at 7:30 AM, Baishampayan Ghose  
> wrote: 
> > This is how it should be done, really - 
> > 
> > (defn get-events-hlpr 
> >  "Retrieves events from MongoDB." 
> >  [] 
> >  (vec (map #(dissoc :_id %) (mc/find-maps "events" ;; remove the 
> :_id as well 
>
> Or in Clojure 1.4.0 and later: 
>
> (defn get-events-hlpr 
>  "Retrieves events from MongoDB." 
>  [] 
>  (mapv #(dissoc :_id %) (mc/find-maps "events"))) ;; remove the :_id as 
> well 
>
> mapv, filterv and reduce-kv are new in 1.4.0. 
> -- 
> 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: Is there a better way to do this

2012-06-17 Thread Joao_Salcedo
Hi ALL,

Thanks that is exactly what i was looking for :)

On Saturday, June 16, 2012 12:30:45 AM UTC+10, Baishampayan Ghose wrote:
>
> > Hi Baishampayan, 
> > 
> >> (defn get-events-hlpr [] 
> >>   "Retrieves events from MongoDB." 
> >>   (vec (mc/find-maps "events"))) 
> > 
> > Is that Emacs Lisp or Common Lisp? 
> > 
> > Bye, 
> > Tassilo 
> > 
> > Just nitpicking that you adapted the OP's error of adding the docstring 
> > after the parameter vector. ;-) 
>
> You are right, Tassilo, I just copied the original code to a scratch 
> buffer and edited it without looking at the doc-string. 
>
> This is how it should be done, really - 
>
> (defn get-events-hlpr 
>   "Retrieves events from MongoDB." 
>   [] 
>   (vec (map #(dissoc :_id %) (mc/find-maps "events" ;; remove the 
> :_id as well 
>
> Regards, 
> BG 
>
> -- 
> Baishampayan Ghose 
> b.ghose at gmail.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

Is there a better way to do this

2012-06-15 Thread Joao_Salcedo
HI All,

I am receiving a sequence from a particular function so I want to get that 
sequence and converted to a vector o I can return a vector instead.

(defn get-events-hlpr []
"Retrieves events from MongoDB."
(init)
(def items (mc/find-maps "events")) ;; get the sequence
(loop [vtr []
   data items]
(if (zero? (count data))
vtr
(recur
(conj vtr (dissoc (first data) :_id))(rest data)

Is the right way?

-- 
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 can I return the exact value or values

2012-06-13 Thread Joao_Salcedo
Hi All,

I am running the following 

(defn json-response [data & [status]]
  {:status (or status 200)
   :headers {"Content-Type" "application/json"}
   :body (json/generate-string data)})

(GET "/events/s3" []
(let [response (s3files/fetch-data-aws)]
(println response)
(json-response response)))

;;Function to fetch data is the following

(defn fetch-data-aws []
 (let [objs (s3/list-objects credentials bucket-name)]
;(println "Fetching S3 files.")
;(println objs)
(doseq [item (:objects objs)]
;(println (map? item))
;(println (:key item))
(let [theKey (:key item)]
;(println (s3/get-object credentials bucket-name theKey))
(let [in (:content (s3/get-object credentials bucket-name theKey))]
(with-open [rdr (io/reader in)]
(let [event (reduce conj [] (line-seq rdr))]
(println event)
event )))

it returns : (it is fine)

[{"data":"text"} {"data":"text"} {"data":"text2"} {"data":"ex001"} 
{"data":"xyz"} {"data":"xyz"} {"data":"xyz"} {"data":"xyz"} {"data":"xyz"} 
{"data":"test123"} {"data":"test345"}]

but when I render the page I get 
*
*
*null*
*
*
*Any ideas of how can I return the right value ???*

-- 
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 read an InputStream

2012-06-13 Thread Joao_Salcedo
HI all,

I am trying to read a InputStream that is coming from S3
I am using clj-aws-s3 library

When I get the object I get a #
How can I get the content inside this InputStream, any ideas, unfortunately 
I do not know how?

Any example code would be great.

Cheers
JS

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

2012-06-11 Thread Joao_Salcedo
hi Trevor could you share how did you solve the issue.

I would like to learn more about it.
If you can share your solution would be great

On Saturday, January 8, 2011 4:13:17 AM UTC+11, Trevor wrote:
>
> What's the best way to kick off Clojure code at scheduled times? I 
> have some that would run once a day. Some that might run 2 or 3 times 
> a day based upon a test being met. 
>
> 1. I could write a function that sleeps an interval, check the time 
> differential to perform a time-box triggered function, but would that 
> consume too much memory?, cause long term problems? 
>
> 2. I could use quartz, but that seems like overkill. 
>
> 3. I could set a job-schedule using the OS to run a clojure script. 
> I'd rather not, I would like to do things like send emails / check 
> status via web app (making option 1 more appealing). 
>
> I'm looking for input/guidance. What are your experiences? 
>
> 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