Re: Image processing

2014-02-27 Thread exel...@gmail.com
Hi Michael,

Got some good results on img processing tests. I got image resizer working 
nice, it was a resource path issue.

However after some side by side testing with graphicmagick, I found imgscalr 
outputs files at a 30% to 50% larger file size. About 30% on larger dimensions, 
50% on thumbnails.

So I've opted for graphicmagick as it processes faster, same quality, much 
smaller static files and v elegant syntax, I've been using it in ruby and 
coldfusion for years. One other thing is it bypasses java, does the buffering 
internally. 

If you have an image processing use case, hope that's helpful for anyone going 
so far as a cdn to scale static assets. Here's a couple syntax examples:

;resize to 300 proportionally
(convert photofile 
  (-antialias) 
  (-resize 300 300) 
  (str (img-path) "/lg_" new-file-name))

; resize to 150 proportionally then crop to a 150 square
(convert photofile 
  (-antialias) 
  (-resize 150 150) 
  (-gravity "Center") 
  (-extent 100 100) photofile)  

photofile is resource path and file name. I'll check into clojure-docs, see if 
I can help out on the web dev section based on my experience last few weeks.

Best,
Pardeep.

-- 
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: Email delivery libs not working

2014-02-25 Thread exel...@gmail.com
Let me know whenever its updated, dynamic email and img resize v heavy use 
cases. 

You guys are doing an amazing job with all the libs, most of them higher end 
stuff. I've never done msg queuing or used a graph db, so looking forward to 
expanding. Its a polygot reality hereon.

P.


On Feb 25, 2014, at 2:12 AM, Michael Klishin wrote:

> 2014-02-25 14:08 GMT+04:00 The Dude (Abides) :
> (postal/send-message 
> ^{:host "smtp.mandrillapp.com"
>   :user "your mandrill acct email address"
>   :pass "your mandrill api key"
>   :port 587}
>  {:type "text/html" 
>   :from "from email address"
>   :to "to email address"
>   :subject (render "Hi from {{firstname}}" {:firstname (session/get 
> :firstname)})
>   :body [{:type "text/html; charset=utf-8"
>   :content (render-resource "email/templates/hello.html.mustache" 
>{:name "Uncle Scooby" :memberid (session/get :member-id)}) }] 
> })
> 
> Let me just say that the choice to use metadata to pass crucial connection 
> arguments
> in Postal was wrong.
> 
> We will be replacing Postal in ClojureWerkz Mailer for this reason.
> -- 
> MK
> 
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/U8U8WfV0GR8/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Korma Sql model not accepting url var

2014-02-11 Thread exel...@gmail.com
Hi Shantanu,

Am trying out the diff solutions and will select one and post my results in a 
couple days. Will likely just use java.jdbc

Best,
Pardeep.

On Feb 11, 2014, at 9:38 PM, Shantanu Kumar wrote:

> 
> Btw, would you recommend using an ORM or straight java.jdbc and if an ORM, 
> any particular one you'd recommend?
> 
> ORMs are not prevalent in Clojure. You can use java.jdbc (the 0.3.x series or 
> later) with one of the SQL generators (HoneySQL, YeSQL etc) that you like. 
> See what works for you and post your feedback on this forum.
> 
> Shantanu
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/F9S5W9xEhWs/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Korma Sql model not accepting url var

2014-02-11 Thread exel...@gmail.com
Hi Shantanu,

I finally got it working as follows:

(defmulti parse-int type)
(defmethod parse-int java.lang.Integer [n] n)
(defmethod parse-int java.lang.String [s] (Integer/parseInt s))

(defn get-a-member [id]
  (layout/render "member/profile2.html"
{:member (db/get-member-url (parse-int id))}
(session/put! :member-id (parse-int id

So parse-int ensures id is specified as an integer for postgres.

I have another question. I'd like to get the username from this result set and 
put it in session. How would I add that to the above code. If I add :username 
username to the session PUT statement, it doesn't recognize it.

(defn get-a-member [id]
  (layout/render "member/profile2.html"
{:member (db/get-member-url (parse-int id))}
(session/put! :member-id (parse-int id) :username username)))

So I look up the record, and from that record I want to extract id and username 
and put them in session as member-id and username.

Btw, would you recommend using an ORM or straight java.jdbc and if an ORM, any 
particular one you'd recommend?

Best,
Pardeep.


On Feb 11, 2014, at 1:16 AM, Shantanu Kumar wrote:

> Can you post the SQL template (with ? symbols) you are trying to execute? 
> Usually, with PostgreSQL you can specify ?::integer in place of ? to imply 
> that the passed parameter is an integer.
> 
> Shantanu
> 
> On Tuesday, 11 February 2014 13:52:54 UTC+5:30, The Dude (Abides) wrote:
> Hi, I'm getting an error calling a record from an id passed via a url using 
> Korma Sql. The error says:
> 
> org.postgresql.util.PSQLException
> 
> ERROR: operator does not exist: smallint = character varying Hint: No 
> operator matches the given name and argument type(s). You might need to add 
> explicit type casts. Position: 57
> 
> I have a list of members, with a url /member/:id to call profile for that 
> member in the view showing the member list. Here's my 3 moving parts:
> 
> ROUTE
> 
> (GET "/member/:id" [id] (get-the-member id))
> 
> FUNCTION
> 
> (defn get-the-member [id]
> (layout/render 
>   "member/profile.html"
>   {:member (db/get-member-url id)}))
> 
> MODEL
> 
> (defn get-member-url [id]
>   (first (select members
>  (where {:id id})
>  (limit 1
> 
> Now if I hard code the id number in the model, it works, but its not 
> accepting the id var as an integer. How would I give it an explicit typecast 
> in this instance. Or would it perhaps be better to use java.jdbc or another 
> ORM like Sql Lingov, HoneySQL, Clojureql or clojure-sql? Rest of crud working 
> fine, but id var not being accepted by the model. The model itself works if 
> an id number is hardcoded. Perhaps I'm missing some simple syntax point here?
> 
> -- 
> 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 a topic in the Google 
> Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/F9S5W9xEhWs/unsubscribe.
> To unsubscribe from this group and all its topics, 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.