Good quick reference screencasts
Found a good set of screencasts as quick references for functions, namespaces, collections, destructuring, sequences and conditional flow. Quick 1 to 2 min screencasts on each: http://www.pluralsight.com/training/Courses/TableOfContents/clojure-fundamentals-part-one And the more advanced for concurrency: http://www.pluralsight.com/training/Courses/TableOfContents/clojure-concurrency-tutorial The other really good resource I found so far as a beginner is: http://www.braveclojure.com/ And of course clojure-docs, the clojure cheat sheet and the doc function in the repl. -- 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/d/optout.
Re: Image processing
Agreed if your img processing use case is minor, prob not worth it. If there's a lot of member submitted content for example and speed/smaller file sizes are important, there's value in graphicmagick. Its a simple 1 line command install and thereafter I've never touched it except via code to process imgs or to update. Graphicmagick is a fork of Imagemagick, more performant and more actively updated. Ref the addl dependency point, as a frame of reference most common way folks in ruby world process images is via gems for imagemagick/graphicmagick, not with native ruby img proc libs. They bring in sass, coffeescript, etc, best tool for the job. They even use Go Worker in Go lang than a ruby equivalent for background processing. -- 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: Image processing
Yes via im4clj - https://github.com/neatonk/im4clj [im4clj "0.0.1"] The developer recommends shell scripting with Conch with standard command line syntax, however im4clj works perfectly fine for 2 core needs for photo gallery apps: 1. resize with proportions, and 2. crop thumbnails from center If shell scripting is preferred, here's the command line version of resize & crop from center: gm convert in_path_and_file -antialias -resize '150x150' -gravity center -extent 100x100 out_path_and_file -- 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: Latest web framework for clojure
I would also recommend Luminus as a user friendly start you can generate a new project with Selmer for views (Django style), authentication, migrations and db persistence out the gate with either mysql, postgres, mongo (or H2 as default if you select neither) and Korma as db dsl. It will give you good understanding of how the moving parts work together and the docs are really good. http://www.luminusweb.net/docs/profiles.md - to see how to create a project with the tools you want To generate a site with postgres for example: lein new luminus myapp +site +postgres Then to fire up the app server: lein ring server And you'll see the project in your browser to start experimenting with the plumbing. The home page will instruct you how to run the migrations as your first step. I found it to be an excellent entry to Clojure web dev, mixing in and trying different libraries. -- 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: Image Resizer lib exception error
I got the file naming fixed with: (upload-file (img-path) (assoc-in file [:filename] new-file-name)) The last part is reading in the uploaded file so it can be resized with Image Resizer. I wrote the code as: (with-open [rdr (clojure.java.io/reader (str (img-path) "/" new-file-name))]) As a test on an existing pic, if I put the wrong file path or file name, sure enough it shows the error of either not existing. If I put the correct path and file name, I get a null exception. Is my syntax correct or off. Going back to clojure docs to look again. -- 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: Image Resizer lib exception error
Hi Moritz and Michael, thanks for the pointer in the right direction. Almost there except for 1 point I think. The whole operation is made of 2 functions, one to upload/resize/save and the other to provide a unique filename by original filename + timestamp. (defn add-timestamp [filename] (let [ext-position (.lastIndexOf filename ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substring filename 0 ext-position) "-" timestamp (.substring filename ext-position)) (str filename "-" timestamp (defn update-profile2 [firstname lastname email file] (let [member-id (session/get :member-id) redirecturl (str "/member/" member-id) originalfile (str (img-path) "/" (:filename file)) *new-file-name* (add-timestamp (:filename file)) photofile (str (img-path) "/" new-file-name)] (upload-file (img-path) *(update-in *file [:filename] *new-file-name*)) <--- this is where I'm stuck, changing the name of the uploaded file (resize (file (with-open [rdr (clojure.java.io/reader photofile)])) 100 100) (memberdb/update-member member-id firstname lastname email (str new-file-name)) (resp/redirect redirecturl))) I checked output of new-file-name and photofile, they do provide the new file name alone or with full path. Where I'm still goofing up is applying *new-file-name* to the *update-in*function, prob cause its now 6am :) If I can update the filename to *new-file-name *value, the *with-open*reader should read the file so it can be resized. 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: Image Resizer lib exception error
Hi Moritz and Michael, thanks for the pointer in the right direction. Almost there except for 1 point I think. The whole operation is made of 2 functions, one to upload/resize/save and the other to provide a unique filename by original filename + timestamp. (defn add-timestamp [filename] (let [ext-position (.lastIndexOf filename ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substring filename 0 ext-position) "-" timestamp (.substring filename ext-position)) (str filename "-" timestamp (defn update-profile2 [firstname lastname email file] (let [member-id (session/get :member-id) redirecturl (str "/member/" member-id) originalfile (str (img-path) "/" (:filename file)) new-file-name (add-timestamp (:filename file)) photofile (str (img-path) "/" new-file-name)] (upload-file (img-path) *(update-in file [:filename] new-file-name))* (resize (file (with-open [rdr (clojure.java.io/reader photofile)])) 100 100) (memberdb/update-member member-id firstname lastname email (str new-file-name)) (resp/redirect redirecturl))) I checked output of new-file-name and photofile, they do provide the new file name alone or with full path. Where I'm still goofing up is applying new-file-name to the update-in function, prob cause its 6am :) Been at it too long, likely missing the obvious. If I can update the filename to *new-file-name*, the *with-open reader *should read the file so it can be resized. 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.
Image Resizer lib exception error
Hi, I'm trying to use Image Resizer and am goofing up on the syntax somewhere: (defn update-profile [firstname lastname email file] (let [member-id (session/get :member-id) redirecturl (str "/member/" member-id) original-file-path(str (img-path) "/" (:filename file)) new-file-name (add-timestamp (:filename file)) new-name-filepath (str (img-path) "/" new-file-name)] (upload-file (img-path) (update-in file [:filename] add-timestamp)) (-> new-name-filepath ((resize-fn 100 100))) (memberdb/update-member member-id firstname lastname email (str new-file-name)) (resp/redirect redirecturl) )) I get the following error: java.lang.IllegalArgumentException No matching method found: read Reflector.java:80clojure.lang.Reflector.invokeMatchingMethod Reflector.java:207clojure.lang.Reflector.invokeStaticMethodutil.clj:10 image-resizer.util/buffered-imageresize.clj:31 image-resizer.resize/resize-fn[fn]members.clj:101 sikhpyar.routes.members/update-profile2members.clj:168 sikhpyar.routes.members/fncore.clj:94compojure.core/make-route[fn] core.clj:40compojure.core/if-route[fn]core.clj:25 compojure.core/if-method[fn]core.clj:107compojure.core/routing[fn] core.clj:2443clojure.core/somecore.clj:107compojure.core/routing Does anyone have any experience with this lib and the correct way to employ it, I'm not making much progress from the readme docs. 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 --- 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
I managed to get Postal delivery working with Mandrill, still use of templates with formatting v helpful. Mailer and Postal have a slight problem on recognizing the meta info for smtp auth. So with some fiddling figured out how to merge Clostache into Postal for html templates with dynamic vars as follows: dependencies: [com.draines/postal "1.11.1"] [de.ubercode.clostache/clostache "1.3.1"] (:use clostache.parser) (:require [postal.core :as postal] (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)}) }] }) The hello.html.mustache template file: Hello {{name}}, My member id is: {{memberid}} Best, Scrappy Doo. The template path root is the app src folder. So your app/src/email/templates/hello.html.mustache So this works but the use of Clostache still seems a bit boilerplatish. Does anyone know of a more elegant option if possible. Thank you for the other tips, will try out the native java and the other Mandrill code option, see which is the best overall approach long term. -- 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
I'm not inferring it doesn't work at all as obviously over the years some of these libs have worked for someone. However these libs are not working for me with Mandrill which has worked seamlessly for email delivery in other langs. I checked the API logs on Mandrill and it appears in the last 100 succeeded API calls, not a failed API call. Yet in the API log full response it says "Status: invalid" I don't think the Mandrill acct is the problem as I'm using it to deliver email invoices and receipts in another language. Its likely something missing in the email body perhaps. Here's my code to send email with Postal, perhaps there is something wrong or missing in the syntax: (ns myapp.routes.members (:use compojure.core [clojure.string :only (join split)]) (:require [myapp.views.layout :as layout] [noir.session :as session] [noir.response :as resp] [noir.io :refer [upload-file resource-path]] [noir.validation :as vali] [noir.util.crypt :as crypt] [ring.util.response :refer [file-response]] [ring.middleware [multipart-params :as mp]] [myapp.models.members :as memberdb] [clojure.java.jdbc :as jdbc] [clojure.java.io :as io] [myapp.models.schema :as schema] [clj-time.core :as time] [clj-time.coerce :as tc] [postal.core :as postal] [myapp.util :refer [galleries img-path]]) (:import [java.io File FileInputStream FileOutputStream] javax.imageio.ImageIO)) (postal/send-message ^{:host "smtp.mandrillapp.com" :user "testg4521@.com" :pass "rssvZq9llJ7pjkjkj8989hjhj" :port 587} {:from "testg4521@.com" :to "testg4521@.com" :subject "Hi from Scrappy Doo" :body "How are you Uncle Scooby?"}) Maybe there's a conflict with my libs? I changed the email and api key as its for a client. And here is the info in the Mandrill log file, its not in the fail section yet it doesn't get delivered. I have another option with a clojure lib for Postmark which I'll try out in the next couple hours. { "from_email": null, "ip_pool": null, "raw_message": "Received: from 192.163.1.145 (unknown [69.106.86.42])\n\t(Authenticated sender: rshjkhjkhjkhk098904y...@gmail.com)\n\tby ip-10-244-148-99 (Postfix) with ESMTPA id 35E1C3A0086\n\tfor ; Mon, 24 Feb 2014 23:10:07 + (UTC)\nDate: Mon, 24 Feb 2014 15:10:07 -0800 (PST)\nFrom: testg4521@.com\nTo: testg4521@.com\nMessage-ID: \nSubject: Hi from Scrappy Doo\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 7bit\nUser-Agent: postal/1.11.1\n\nHow are you Uncle Scooby?", "async": false, "key": "rshjkhjkhjkhk098904YEiQ", "send_at": null, "from_name": null, "return_path_domain": null, "to": [ "testg4521@.com" ] } Full Response [ { "email": "testg4521@.com", "status": "invalid", "_id": "fcbb8fbb76124f31b88b3c4f4ae10b10", "reject_reason": null } ] Perhaps Mandrill needs something in the body of the email to verify its a legit sendable email? In either event its not been a smooth journey trying out a few diff libs. I will get in touch with Mandrill ref why the email is not delivered and try out some of the other options mentioned here. Thank you for the feedback and tips. -- 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
I'm not inferring it doesn't work at all as obviously over the years some of these libs have worked for someone. However these libs are not working for me with Mandrill which has worked seamlessly for email delivery in other langs. I checked the API logs on Mandrill and it appears in the last 100 succeeded API calls, not a failed API call. Yet in the API log full response it says "Status: invalid" I don't think the Mandrill acct is the problem as I'm using it to deliver email invoices and receipts in another language. Its likely something missing in the email body perhaps. Here's my code to send email with Postal, perhaps there is something wrong or missing in the syntax: (ns myapp.routes.members (:use compojure.core [clojure.string :only (join split)]) (:require [myapp.views.layout :as layout] [noir.session :as session] [noir.response :as resp] [noir.io :refer [upload-file resource-path]] [noir.validation :as vali] [noir.util.crypt :as crypt] [ring.util.response :refer [file-response]] [ring.middleware [multipart-params :as mp]] [myapp.models.members :as memberdb] [clojure.java.jdbc :as jdbc] [clojure.java.io :as io] [myapp.models.schema :as schema] [clj-time.core :as time] [clj-time.coerce :as tc] [postal.core :as postal] [myapp.util :refer [galleries img-path]]) (:import [java.io File FileInputStream FileOutputStream] javax.imageio.ImageIO)) (postal/send-message ^{:host "smtp.mandrillapp.com" :user "testg4521@.com" :pass "rssvZq9llJ7pjkjkj8989hjhj" :port 587} {:from "testg4...@gmail.com" :to "testg4...@gmail.com" :subject "Hi from Scrappy Doo" :body "How are you Uncle Scooby?"}) Maybe there's a conflict with my libs? I changed the email and api key as its for a client. And here is the info in the Mandrill log file, its not in the fail section yet it doesn't get delivered. I have another option with a clojure lib for Postmark which I'll try out in the next couple hours. { "from_email": null, "ip_pool": null, "raw_message": "Received: from 192.163.1.145 (unknown [69.106.86.42])\n\t(Authenticated sender: rshjkhjkhjkhk098904y...@gmail.com)\n\tby ip-10-244-148-99 (Postfix) with ESMTPA id 35E1C3A0086\n\tfor ; Mon, 24 Feb 2014 23:10:07 + (UTC)\nDate: Mon, 24 Feb 2014 15:10:07 -0800 (PST)\nFrom: testg4521@.com\nTo: testg4521@.com\nMessage-ID: \nSubject: Hi from Scrappy Doo\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 7bit\nUser-Agent: postal/1.11.1\n\nHow are you Uncle Scooby?", "async": false, "key": "rshjkhjkhjkhk098904YEiQ", "send_at": null, "from_name": null, "return_path_domain": null, "to": [ "testg4521@.com" ] } Full Response [ { "email": "testg4521@.com", "status": "invalid", "_id": "fcbb8fbb76124f31b88b3c4f4ae10b10", "reject_reason": null } ] Perhaps Mandrill needs something in the body of the email to verify its a legit sendable email. In either event its not been a smooth journey trying out a few diff libs. I will get in touch with Mandrill ref why the email is not delivered and try out some of the other options mentioned here. Thank you for the feedback and tips. -- 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
I'm not inferring it doesn't work at all as obviously over the years some of these libs have worked for someone. However these libs are not working for me with Mandrill which has worked seamlessly for email delivery in other langs. I checked the API logs on Mandrill and it appears in the last 100 succeeded API calls, not a failed API call. Yet in the API log full response it says "Status: invalid" I don't think the Mandrill acct is the problem as I'm using it to deliver email invoices and receipts in another language. Its likely something missing in the email body perhaps. Here's my code to send email with Postal, perhaps there is something wrong or missing in the syntax: (ns myapp.routes.members (:use compojure.core [clojure.string :only (join split)]) (:require [myapp.views.layout :as layout] [noir.session :as session] [noir.response :as resp] [noir.io :refer [upload-file resource-path]] [noir.validation :as vali] [noir.util.crypt :as crypt] [ring.util.response :refer [file-response]] [ring.middleware [multipart-params :as mp]] [myapp.models.members :as memberdb] [clojure.java.jdbc :as jdbc] [clojure.java.io :as io] [myapp.models.schema :as schema] [clj-time.core :as time] [clj-time.coerce :as tc] [postal.core :as postal] [myapp.util :refer [galleries img-path]]) (:import [java.io File FileInputStream FileOutputStream] javax.imageio.ImageIO)) (postal/send-message ^{:host "smtp.mandrillapp.com" :user "mailtowin...@gmail.com" :pass "rssvZq9llJ7pjkjkj8989hjhj" :port 587} {:from "testg4...@gmail.com" :to "testg4...@gmail.com" :subject "Hi from Scrappy Doo" :body "How are you Uncle Scooby?"}) Maybe there's a conflict with my libs? Or maybe Postal or Mandrill don't like Scooby Doo tests? I changed the email and api key as its for a client. And here is the info in the Mandrill log file, its not in the fail section yet it doesn't get delivered. I have another option with a clojure lib for Postmark which I'll try out in the next couple hours. { "from_email": null, "ip_pool": null, "raw_message": "Received: from 192.163.1.145 (unknown [69.106.86.42])\n\t(Authenticated sender: rshjkhjkhjkhk098904y...@gmail.com)\n\tby ip-10-244-148-99 (Postfix) with ESMTPA id 35E1C3A0086\n\tfor ; Mon, 24 Feb 2014 23:10:07 + (UTC)\nDate: Mon, 24 Feb 2014 15:10:07 -0800 (PST)\nFrom: testg4521@.com\nTo: testg4521@.com\nMessage-ID: \nSubject: Hi from Scrappy Doo\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 7bit\nUser-Agent: postal/1.11.1\n\nHow are you Uncle Scooby?", "async": false, "key": "rshjkhjkhjkhk098904YEiQ", "send_at": null, "from_name": null, "return_path_domain": null, "to": [ "testg4521@.com" ]} Full Response [ { "email": "testg4521@.com", "status": "invalid", "_id": "fcbb8fbb76124f31b88b3c4f4ae10b10", "reject_reason": null } ] Perhaps Mandrill needs something in the body of the email to verify its a legit sendable email. In either event its not been a smooth journey trying out a few diff libs. I will get in touch with Mandrill ref why the email is not delivered and try out some of the other options mentioned here. Thank you for the feedback and tips. -- 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
Hi Jim, am not opposed to using java and put the code in a diff namespace to reuse. Am going to try out a lib for delivery svc, one for Mandrill and the other for Postmark. If any glitches there, will use java as you suggested. Thanks for the working example. 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.
Email delivery libs not working
Hi, I'm new to clojure and have got a productive handle on CRUD, sessions, routing, writing functions. Last couple things are email delivery, image processing (resizing). So I looked on the clojure-toolbox site for email delivery libs with smtp authentication for a Mandrill acct fo transactional emails. I've used Mandrill in other langs right away zero glitch. Here's the results thus far in Clojure as a frame of reference for web domain use 2014: POSTAL https://github.com/drewr/postal#encryption-gmail-example Doesn't deliver. Tried number of examples in the docs. MAILER https://github.com/clojurewerkz/mailer Worked briefly, but not via Mandrill, no emails reached there. Authentication settings have no impact, uses Postal above lib for delivery. Tried number of examples in the docs. CLJ MAIL https://github.com/MayDaniel/clj-mail Out of date syntax. I googled and found a couple more in the quest to avoid having to do this via java heaven forbid: MMEmail http://blog.8thlight.com/micah-martin/2010/04/21/mmemail-my-first-clojure-open-source-contribution.html Says cannot connect to port 25 although my settings specify port 587 for Mandrill POSTMARK http://sjl.bitbucket.org/clojure-postmark/ Transactional email delivery service with a clojure lib. Will create an acct in morning and try it out. Doe anyone know of any other smooth workable out the gate solutions for email delivery? -- 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: java.jdbc 0.3.3 select query exception: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn
You're right :) When I isolated the issue thanks to some help it turns out java.jdbc is working fine but I wasn't getting the resultset output properly in the function. So got it resolved and working like this: (defn get-member [id] (let [id (parse-int id) member (first (jdbc/query db ["SELECT id, username, firstname, lastname, email FROM members WHERE id = ? ORDER BY id ASC LIMIT 1" id]))] (session/put! :member member) (session/put! :next (+ id 1)) (layout/render "member/profile2.html" {:member member}))) So java.jdbc working just fine, able to get the results, set in session, etc. Thanks for all the feedback. On Saturday, February 15, 2014 9:55:16 PM UTC-8, edbond wrote: > > I spot invalid let here: > > (defn get-a-member [id] > (let [id (parse-int id) member] > [member (memberdb/get-member id)] > > should be > > (defn get-a-member [id] > (let [id (parse-int id) > member (memberdb/get-member id)] > > > On Sunday, February 16, 2014 4:01:03 AM UTC+2, The Dude (Abides) wrote: >> >> Thanks, here's the entire stack trace: >> >> java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to >> clojure.lang.IFn >> members.clj:33 sikhpyar.routes.members/get-member >> members.clj:50 sikhpyar.routes.members/fn >> core.clj:94 compojure.core/make-route[fn] >> core.clj:40 compojure.core/if-route[fn] >> core.clj:25 compojure.core/if-method[fn] >>core.clj:107 compojure.core/routing[fn] >> core.clj:2443 clojure.core/some >>core.clj:107 compojure.core/routing >> RestFn.java:139 clojure.lang.RestFn.applyTo >>core.clj:619 clojure.core/apply >>core.clj:112 compojure.core/routes[fn] >>core.clj:107 compojure.core/routing[fn] >> core.clj:2443 clojure.core/some >>core.clj:107 compojure.core/routing >> RestFn.java:139 clojure.lang.RestFn.applyTo >>core.clj:619 clojure.core/apply >>core.clj:112 compojure.core/routes[fn] >> middleware.clj:17 >> sikhpyar.middleware/template-error-page[fn] >> middleware.clj:10 sikhpyar.middleware/log-request[fn] >> middleware.clj:44 >> noir.util.middleware/wrap-request-map[fn] >> keyword_params.clj:32 >> ring.middleware.keyword-params/wrap-keyword-params[fn] >>nested_params.clj:70 >> ring.middleware.nested-params/wrap-nested-params[fn] >> params.clj:58 ring.middleware.params/wrap-params[fn] >> middleware.clj:12 hiccup.middleware/wrap-base-url[fn] >>multipart_params.clj:107 >> ring.middleware.multipart-params/wrap-multipart-params[fn] >> validation.clj:153 >> noir.validation/wrap-noir-validation[fn] >> cookies.clj:72 noir.cookies/noir-cookies[fn] >> cookies.clj:171 >> ring.middleware.cookies/wrap-cookies[fn] >> session.clj:142 noir.session/noir-flash[fn] >>flash.clj:31 ring.middleware.flash/wrap-flash[fn] >> session.clj:97 noir.session/noir-session[fn] >> session.clj:85 >> ring.middleware.session/wrap-session[fn] >>Var.java:415 clojure.lang.Var.invoke >> reload.clj:18 ring.middleware.reload/wrap-reload[fn] >> stacktrace.clj:17 >> ring.middleware.stacktrace/wrap-stacktrace-log[fn] >> stacktrace.clj:80 >> ring.middleware.stacktrace/wrap-stacktrace-web[fn] >>jetty.clj:18 ring.adapter.jetty/proxy-handler[fn] >>(Unknown Source) >> ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle >> HandlerWrapper.java:116 >> org.eclipse.jetty.server.handler.HandlerWrapper.handle >> Server.java:363 org.eclipse.jetty.server.Server.handle >> AbstractHttpConnection.java:483 >> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest >> AbstractHttpConnection.java:920 >> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete >> AbstractHttpConnection.java:982 >> org.eclipse.jetty.server.Abst
Re: java.jdbc 0.3.3 select query exception: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn
Thanks, here's the entire stack trace: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn members.clj:33 sikhpyar.routes.members/get-member members.clj:50 sikhpyar.routes.members/fn core.clj:94 compojure.core/make-route[fn] core.clj:40 compojure.core/if-route[fn] core.clj:25 compojure.core/if-method[fn] core.clj:107 compojure.core/routing[fn] core.clj:2443 clojure.core/some core.clj:107 compojure.core/routing RestFn.java:139 clojure.lang.RestFn.applyTo core.clj:619 clojure.core/apply core.clj:112 compojure.core/routes[fn] core.clj:107 compojure.core/routing[fn] core.clj:2443 clojure.core/some core.clj:107 compojure.core/routing RestFn.java:139 clojure.lang.RestFn.applyTo core.clj:619 clojure.core/apply core.clj:112 compojure.core/routes[fn] middleware.clj:17 sikhpyar.middleware/template-error-page[fn] middleware.clj:10 sikhpyar.middleware/log-request[fn] middleware.clj:44 noir.util.middleware/wrap-request-map[fn] keyword_params.clj:32 ring.middleware.keyword-params/wrap-keyword-params[fn] nested_params.clj:70 ring.middleware.nested-params/wrap-nested-params[fn] params.clj:58 ring.middleware.params/wrap-params[fn] middleware.clj:12 hiccup.middleware/wrap-base-url[fn] multipart_params.clj:107 ring.middleware.multipart-params/wrap-multipart-params[fn] validation.clj:153 noir.validation/wrap-noir-validation[fn] cookies.clj:72 noir.cookies/noir-cookies[fn] cookies.clj:171 ring.middleware.cookies/wrap-cookies[fn] session.clj:142 noir.session/noir-flash[fn] flash.clj:31 ring.middleware.flash/wrap-flash[fn] session.clj:97 noir.session/noir-session[fn] session.clj:85 ring.middleware.session/wrap-session[fn] Var.java:415 clojure.lang.Var.invoke reload.clj:18 ring.middleware.reload/wrap-reload[fn] stacktrace.clj:17 ring.middleware.stacktrace/wrap-stacktrace-log[fn] stacktrace.clj:80 ring.middleware.stacktrace/wrap-stacktrace-web[fn] jetty.clj:18 ring.adapter.jetty/proxy-handler[fn] (Unknown Source) ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle HandlerWrapper.java:116 org.eclipse.jetty.server.handler.HandlerWrapper.handle Server.java:363 org.eclipse.jetty.server.Server.handle AbstractHttpConnection.java:483 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest AbstractHttpConnection.java:920 org.eclipse.jetty.server.AbstractHttpConnection.headerComplete AbstractHttpConnection.java:982 org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete HttpParser.java:635 org.eclipse.jetty.http.HttpParser.parseNext HttpParser.java:235 org.eclipse.jetty.http.HttpParser.parseAvailable AsyncHttpConnection.java:82 org.eclipse.jetty.server.AsyncHttpConnection.handle SelectChannelEndPoint.java:628 org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle SelectChannelEndPoint.java:52 org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run QueuedThreadPool.java:608 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob QueuedThreadPool.java:543 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run Thread.java:744 java.lang.Thread.run Here's the route function: (defn get-a-member [id] (let [id (parse-int id) member] [member (memberdb/get-member id)] (session/put! :member-id (member :id)) (session/put! :nexto (+ (member :id) 1)) (session/put! :username (member :username)) (session/put! :firstname (member :firstname)) (session/put! :lastname (member :lastname)) (session/put! :email (member :email)) (layout/render "member/profile2.html" {:member member}))) The route: (GET "/member/:id" [id] (get-a-member id)) The model: (defmulti parse-int type) (defmethod parse-int java.lang.Integer [n] n) (defmethod parse-int java.lang.String [s] (Integer/parseInt s)) (defn get-member [id] (let [id (parse-int id)] (jdbc/query db ["SELECT * FROM members WHERE id = ? LIMIT 1" id]))) I'm using parse-int to explicitly specify id as an integer. If I use just the query with no output to layout, or sessions, etc, it does show the output from the db. If I put just (str id) on the route handle
java.jdbc 0.3.3 select query exception: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn
Hi, I'm writing some queries using java.jdbc 0.3.3 as follows: (defn get-member-url [id] (jdbc/query db ["SELECT * FROM members WHERE id = ? LIMIT 1" id])) However this results in an exception error: java.lang.ClassCastException clojure.lang.LazySeq cannot be cast to clojure.lang.IFn Not sure what I'm missing here. Db is postgres with [postgresql/postgresql "9.1-901.jdbc4"] and have the require [clojure.java.jdbc :as jdbc] at top of the model file. The above syntax is following the instructions here: http://clojure-doc.org/articles/ecosystem/java_jdbc/using_sql.html#reading-rows Any idea what I may be missing. I tried the row-fn and doall, but no dice so far. -- 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.
Korma Sql model not accepting url var
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 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: Rename file uploaded
Thanks for the feedback Jarrod, the gallery-path did exist because I was able to upload files without renaming them and I saw the map with keys per your tip. I just wasn't familiar enough with the plumbing in noir.io or the language as I finally had the time to spend a week getting into clojure more seriously. Took a look in more depth in noir.io, surprisingly concise and simple to understand. With some much appreciated help finally got it working as follows: (ns pgapp.routes.upload (:require [compojure.core :refer [defroutes GET POST]] [pgapp.views.layout :as layout] [noir.io :refer [upload-file resource-path]] [noir.session :as session] [noir.response :as resp] [noir.util.route :refer [restricted]] [ring.util.response :refer [file-response]] [taoensso.timbre :refer [error]] [pgapp.models.db :as db] [clj-time.core :as time] [clj-time.coerce :as tc] [pgapp.util :refer [galleries gallery-path thumb-uri thumb-prefix unique-prefix]])) (defn upload-page [info] (layout/render "upload.html")) (defn add-timestamp [filename] (let [ext-position (.lastIndexOf filename ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substring filename 0 ext-position) "-" timestamp (.substring filename ext-position)) (str filename "-" timestamp (defn handle-upload [file] (upload-file (gallery-path) (update-in file [:filename] add-timestamp)) (resp/redirect "/upload")) (defroutes upload-routes (GET "/upload" [info] (upload-page {:info info})) (POST "/upload" [file] (handle-upload file))) The key to it was the 2nd line in handle-upload as: (upload-file (gallery-path) (update-in file [:filename] add-timestamp)) -- -- 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: Rename file uploaded
Hi Jarrod, thanks for your help. I tried that but got a java.lang.NullPointerException error again. I tried the code without the add-timestamp and still get the java.lang.NullPointerException When I try it as just :filename filename it does in fact show only the file name. So not sure why this is being so tricky, rest of clojure stuff has been very straightforward, this one file load issue is more boilerplate than I'm used to in ruby or coldfusion, and it just seems v tricky as the error codes are not yielding the source of the problem or maybe I don't yet know how to interpret them properly. It doesn't seem the problem is in the "add-timestamp" function, as the operation croaks even before getting there when I isolate it to just 'handle-upload' function without ever calling the add-timestamp function. I'll post the entire code again just in case you may spot where the error maybe. Perhaps the problem is in the libs I'm requiring or importing? Again thanks for taking a look, much appreciated. (ns pgapp.routes.upload (:require [compojure.core :refer [defroutes GET POST]] [pgapp.views.layout :as layout] [noir.io :refer [upload-file resource-path]] [noir.session :as session] [noir.response :as resp] [noir.util.route :refer [restricted]] [clojure.java.io :as io] [ring.util.response :refer [file-response]] [taoensso.timbre :refer [error]] [pgapp.models.db :as db] [clj-time.core :as time] [clj-time.coerce :as tc] [pgapp.util :refer [galleries gallery-path thumb-uri thumb-prefix unique-prefix]]) (:import [java.io File FileInputStream FileOutputStream] javax.imageio.ImageIO)) (defn upload-page [info] (layout/render "upload.html")) (defn add-timestamp [filename] (let [ext-position (.lastIndexOf filename ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substring filename 0 ext-position) "-" timestamp (.substring filename ext-position)) (str filename "-" timestamp (defn handle-upload [filename] (upload-file (gallery-path) (add-timestamp (:filename filename))) (resp/redirect "/upload")) (defroutes upload-routes (GET "/upload" [info] (upload-page {:info info})) (POST "/upload" [file] (handle-upload file))) -- -- 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: Rename file uploaded
Hi Jarrod, you're exactly right, filename feeds the entire map as: {:size 17401, :tempfile #, :content-type "image/jpeg", :filename "AngryBaby4.jpg"} How can feed it just the :filename portion of the map as string to the add-timestamp function? Checking that link right now. On Friday, January 24, 2014 9:05:35 PM UTC-8, Jarrod Swart wrote: > > Well that isn't quite what I meant. In that case you are just casting > what is likely the map of upload data to a string. > > Try this: > > (defn handle-upload [filename] >(str filename)) > > Why? This will show you what type of data you receiving on upload. My > guess is that it is a map containing all the data about the file upload. > > Following this: > http://www.luminusweb.net/docs/static_resources.md#handling_file_uploads > should > help. > > In short: you still don't have the right kind of data going into your > function. Change your handle-upload to the above and verify that you are > getting the filename alone in your (let [filename (...)] ...) binding. > > Hope that helps. > > On Friday, January 24, 2014 11:28:00 PM UTC-5, The Dude (Abides) wrote: >> >> Hi Jarrod, I tried changing filename to string as follows >> >> (defn handle-upload [filename] >> (upload-file (gallery-path) (add-timestamp (str filename))) >> (resp/redirect "/upload")) >> >> and still got an error as: >> >> java.lang.NullPointerException >> >> >> My entire file code is: >> >> (ns pgapp.routes.upload >> (:require [compojure.core :refer [defroutes GET POST]] >> [pgapp.views.layout :as layout] >> [noir.io :refer [upload-file resource-path]] >> [noir.session :as session] >> [noir.response :as resp] >> [noir.util.route :refer [restricted]] >> [clojure.java.io :as io] >> [ring.util.response :refer [file-response]] >> [taoensso.timbre :refer [error]] >> [pgapp.models.db :as db] >> [clj-time.core :as time] >> [clj-time.coerce :as tc] >> [pgapp.util >> :refer [galleries gallery-path thumb-uri thumb-prefix >> unique-prefix]]) >>(:import [java.io File FileInputStream FileOutputStream] >> javax.imageio.ImageIO)) >> >> (use 'ring.middleware.params >> 'ring.middleware.multipart-params) >> >> (defn upload-page [info] >> (layout/render "upload.html")) >> >> (defn add-timestamp [filename] >> (let [ext-position (.lastIndexOf filename ".") >>timestamp(tc/to-long (time/now))] >>(if (pos? ext-position) >> (str (.substring filename 0 ext-position) >> "-" timestamp (.substring filename ext-position)) >> (str filename "-" timestamp >> >> (defn handle-upload [filename] >> (upload-file (gallery-path) (add-timestamp (str filename))) >> (resp/redirect "/upload")) >> >> (defroutes myapp-routes >> (GET "/upload" [info] (upload-page {:info info})) >> (POST "/upload" [file] (handle-upload file))) >> >> I changed filename to (str filename) in the handle-upload function, but >> still no dice :( >> >> The :refer [galleries gallery-path thumb-uri thumb-prefix >> unique-prefix]]) are just references to file paths in util.clj vs >> hardcoding them. >> >> I got productive with clojure ref routes, sessions, views with selmer and >> queries either raw or with korma all easy peasy. However this one thing, >> this file upload issue has thrown me for a loop for 3 days now :) It is the >> bane of my existence right now :) >> >> If I can get a handle on it, am considering creating a library to make >> this easier akin to file upload plugins in ruby world like carrier-wave. >> Thanks for any pointers on what I'm doing wrong with the above code. >> > -- -- 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: Rename file uploaded
Hi Jarrod, I tried changing filename to string as follows (defn handle-upload [filename] (upload-file (gallery-path) (add-timestamp (str filename))) (resp/redirect "/upload")) and still got an error as: java.lang.NullPointerException My entire file code is: (ns pgapp.routes.upload (:require [compojure.core :refer [defroutes GET POST]] [pgapp.views.layout :as layout] [noir.io :refer [upload-file resource-path]] [noir.session :as session] [noir.response :as resp] [noir.util.route :refer [restricted]] [clojure.java.io :as io] [ring.util.response :refer [file-response]] [taoensso.timbre :refer [error]] [pgapp.models.db :as db] [clj-time.core :as time] [clj-time.coerce :as tc] [pgapp.util :refer [galleries gallery-path thumb-uri thumb-prefix unique-prefix]]) (:import [java.io File FileInputStream FileOutputStream] javax.imageio.ImageIO)) (use 'ring.middleware.params 'ring.middleware.multipart-params) (defn upload-page [info] (layout/render "upload.html")) (defn add-timestamp [filename] (let [ext-position (.lastIndexOf filename ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substring filename 0 ext-position) "-" timestamp (.substring filename ext-position)) (str filename "-" timestamp (defn handle-upload [filename] (upload-file (gallery-path) (add-timestamp (str filename))) (resp/redirect "/upload")) (defroutes myapp-routes (GET "/upload" [info] (upload-page {:info info})) (POST "/upload" [file] (handle-upload file))) I changed filename to (str filename) in the handle-upload function, but still no dice :( The :refer [galleries gallery-path thumb-uri thumb-prefix unique-prefix]]) are just references to file paths in util.clj vs hardcoding them. I got productive with clojure ref routes, sessions, views with selmer and queries either raw or with korma all easy peasy. However this one thing, this file upload issue has thrown me for a loop for 3 days now :) It is the bane of my existence right now :) If I can get a handle on it, am considering creating a library to make this easier akin to file upload plugins in ruby world like carrier-wave. Thanks for any pointers on what I'm doing wrong with the above code. -- -- 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.
Rename file uploaded
Hi, I'm new to clojure and am trying to rename an uploaded file with a unique identifier such as a long time stamp as follows: (defn add-timestamp [filename] (let [ext-position (.lastIndexOf filename ".") timestamp(tc/to-long (time/now))] (if (pos? ext-position) (str (.substring filename 0 ext-position) "-" timestamp (.substring filename ext-position)) (str filename "-" timestamp (defn handle-upload [filename] (upload-file (gallery-path) (add-timestamp filename)) (resp/redirect "/upload")) However the above throws an error as follows: java.lang.IllegalArgumentException No matching method found: lastIndexOf for class clojure.lang.PersistentArrayMap Would appreciate any feedback on what I may be doing wrong in the add-timestamp function. -- -- 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.