Re: How to use a Java SDK from Amazon?

2016-01-09 Thread Allen Johnson
I'm not sure if this helps but a quick glance at the github project you linked to contains a pom file which uses the following maven coordinates: com.amazon.alexa alexa-skills-kit 1.1.1 You may want to try that in leiningen instead. :dependencies [[org.clojure/clojure "1.6.0"]

Re: unusual question: how do you get morale?(or moral support)

2013-05-15 Thread Allen Johnson
I've recently been wondering about this. I'd say that I'm coming out of a burnout period that I've been in for at least the last few months. Also, reading things like hacker news gives me this feeling that I'm not doing enough with my time -- which adds to the weight that I already feel on my shoul

Re: Overtone - Actual Music!

2012-08-15 Thread Allen Johnson
Awesome. Sounds very Nine Inch Nails like. Time for Trent Reznor to get on some Clojure/Overtone ;-) AJ On Wed, Aug 15, 2012 at 6:50 AM, Sam Aaron wrote: > Hey everyone, > > sorry, I couldn't resist posting this, but I'm getting real close to making > decent music with Overtone now, and I jus

Re: Buggy FP behavior with Clojure 1.3

2012-06-26 Thread Allen Johnson
When I run the repl from leiningen (v2.0.0-preview6) I get the Infinity exception. But when I run the repl straight from the clojure.jar it works without error. java -jar ~/.m2/repository/org/clojure/clojure/1.4.0/clojure-1.4.0.jar AJ On Tue, Jun 26, 2012 at 11:25 AM, Armando Blancas wrote: >

Re: Doseq, map-style

2012-06-08 Thread Allen Johnson
Combine map with dorun and you get the same effect: (dorun (map println logs)) http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/dorun Allen On Thu, Jun 7, 2012 at 11:32 PM, David Jacobs wrote: > I would love to have a version of doseq that works like map (similar to > "each

Re: deps.js in cljsbuild?

2012-05-14 Thread Allen Johnson
I think the current fix is to add this JS declaration before you import your cljs generated js file. IIRC, this is only needed when building without advanced optimizations. var CLOSURE_NO_DEPS = true; AJ On Mon, May 14, 2012 at 9:21 AM, Murtaza Husain wrote: > Hi, > > I am using lein-cljs

Re: why can i not shut-down my pc from Java?

2012-05-07 Thread Allen Johnson
The function passed to (defmulti) must take the same args as (defmethod). Try this: (defmulti halt (fn [_ _] (let [os (System/getProperty "os.name")] (if (.startsWith os "Mac OS") :Linux (keyword os) AJ On Mon, May 7, 2012 at 4:53 PM, Jim - FooBar(); wrote: > Following my earl

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-02 Thread Allen Johnson
My example included a use of `map`. It is lazy and will work but you have to be sure that you aren't using it in a way that would hold onto the head of the sequence. When experimenting in a repl it might not seem that it is lazy since the repl will attempt to print the result of calling map when t

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Allen Johnson
Do you have example code that is failing? You should be able to use some of the items you listed as "problems". Try something like this: (->> (file-seq (io/file "/some/dir")) (map println) (dorun)) AJ On Wed, May 2, 2012 at 12:26 AM, Sean Neilan wrote: > I forgot to mention: > (nth

[ANN] WabbitMQ update v0.2.1

2012-04-28 Thread Allen Johnson
This update should fix all reflection warnings. Leiningen: [com.mefesto/wabbitmq "0.2.1"] Github: https://github.com/mefesto/wabbitmq Thanks, Allen -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: New release of Domina (now with reworked eventing)

2012-04-27 Thread Allen Johnson
I received the following error when performing a `lein deps` for this version [domina "1.0.0-beta4"] Could not find artifact org.clojure:clojurescript:pom:0.0-1069 in central (http://repo1.maven.org/maven2) Could not find artifact org.clojure:clojurescript:pom:0.0-1069 in clojars (http://clojars.o

[ANN] WabbitMQ v0.2.0 release

2012-04-06 Thread Allen Johnson
WabbitMQ v0.2.0 has been pushed to clojars. [com.mefesto/wabbitmq "0.2.0"] This release contains the following updates: * Updated RabbitMQ Java Client (v2.8.1) * Updated Cheshire JSON library (v3.1.0) * `consuming-seq` no longer depends on the deprecated QueueingConsumer class Tested again

Re: idiomatic list-ify

2012-03-08 Thread Allen Johnson
> So I've ended up writing the function with a conditional, like so.  Is there > a tidier way? > > (defn ls [x] (cond (list? x) (apply list x) >                    (nil? x)  '() >                    :else (list x))) If `x` is a list then is the call to `(apply list x)` necessary? (defn ls [x] (

Re: add records in mysql????

2012-01-06 Thread Allen Johnson
You'd want to use one of the insert functions for that: (defn add-user [user] (sql/with-connection db (sql/insert-record :books user))) http://clojure.github.com/java.jdbc Allen On Fri, Jan 6, 2012 at 3:13 PM, jayvandal wrote: > i am using leinningen  and mysql example. I can select reco

Re: Must PersistentQueue be stored in ref not atom?

2011-11-09 Thread Allen Johnson
On Wed, Nov 9, 2011 at 8:56 PM, Allen Johnson wrote: > In your example yes, but you could make it atomic by placing the > functionality in a function of it's own: > > ;; queue processing actions > (defn process-item [queue] >  (println "Processed item:" (peek qu

Re: Must PersistentQueue be stored in ref not atom?

2011-11-09 Thread Allen Johnson
In your example yes, but you could make it atomic by placing the functionality in a function of it's own: ;; queue processing actions (defn process-item [queue] (println "Processed item:" (peek queue)) (pop queue)) ;; usage (let [queue (atom (into PersistentQueue/EMPTY [1 2 3]))] (swap! que

Re: clojure.contrib.base64

2011-10-06 Thread Allen Johnson
Just wanted to add the Apache commons codec has a base64 encoder/decoder. With a quick test I was able to encode a ~100MB file in 2.3sec. Example code below: In leiningen: [commons-codec "1.4"] (require '[clojure.java.io :as io]) (import '[org.apache.commons.codec.binary Base64OutputStream]) (de

Re: Currently recommended CSV client, again ?

2011-10-04 Thread Allen Johnson
In addition, there is org.clojure/data.csv which says it works with Clojure 1.2 and 1.3. https://github.com/clojure/data.csv Allen On Tue, Oct 4, 2011 at 2:42 PM, Laurent PETIT wrote: > Self answer : either clojure-csv for full NIH clojure solution ( > http://github.com/davidsantiago/clojure-cs

Re: Anyone on Google+ yet?

2011-07-14 Thread Allen Johnson
> Yep, you're supposed to add everyone by hand and yes, it is totally unwieldy. > That's the way it is right now. > Circles are private and every user is supposed to make their own. I'm definitely liking it so far. Although I do find myself avoiding public posts to avoid spamming everyone in the C

Re: Anyone on Google+ yet?

2011-07-14 Thread Allen Johnson
> Please add link to your profile below. https://plus.google.com/101461247790324463561/posts > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are

Re: Avoiding nils

2011-07-07 Thread Allen Johnson
On Thu, Jul 7, 2011 at 4:27 PM, octopusgrabbus wrote: > This code > > (defn ret-odd >  [seq-val] >  (if (not (nil? seq-val)) >    (if (odd? seq-val) >      seq-val))) > > (def my-seq '(1 2 3 4 5 6 7 8 9)) > > (map ret-odd my-seq) > > finds the odd numbers, but also returns nil. How do I find just

Re: update xml attribute value

2011-06-02 Thread Allen Johnson
> Thanks Allen, it works, I did not know the loc can be treated like a hash. 'loc itself isn't a map even though zip/edit makes it seem that way. Behind the scenes zip/edit calls (zip/node loc) which will return a map, at least in the case of this xml example. zip/edit then applies the function yo

Re: update xml attribute value

2011-06-02 Thread Allen Johnson
> Does anyone know how to update xml element attribute value on the zipper > data structure? > I have something like > >     >     > > (:require (clojure [xml :as xml] [zip :as zip]) >      [clojure.contrib.zip-filter.xml :as zf]) > (let >   [src (-> "c:/my.xml" io/file xml/parse zip/xml-zip) >

Re: Passing "environment configuration parameters" to a Clojure web app

2011-05-24 Thread Allen Johnson
> lein-ring use it when it's present rather than generating one. Much better idea :) Allen > Just a thought from the suffering equine department. :-) > > - Chas > > On May 23, 2011, at 8:48 PM, Allen Johnson wrote: > >> On a related note. About a month or two

Re: Passing "environment configuration parameters" to a Clojure web app

2011-05-23 Thread Allen Johnson
his up and contact weavejester to see if it's something worth incorporating. https://github.com/mefesto/lein-ring/commit/3016142e1c7aadc77d273453e04f9196319406a2 Allen On Mon, May 23, 2011 at 7:43 PM, Allen Johnson wrote: > I'm also interested in this topic. It was discussed briefly o

Re: Passing "environment configuration parameters" to a Clojure web app

2011-05-23 Thread Allen Johnson
I'm also interested in this topic. It was discussed briefly on the clojure-web-dev mailing list a little while ago. What I've been doing is something like this: # lein ring project myapp/ config/ production/WEB-INF/myapp.properties development/WEB-INF/myapp.properties test/WEB-INF/my

Re: resultset-seq

2011-05-05 Thread Allen Johnson
it's default behavior matches the core version, exposing it > with the same name seems reasonable too since it won't break anyone's > code (right?). Won't break any of my stuff :) Allen > On Wed, May 4, 2011 at 4:06 PM, Phlex wrote: >> >> >> On 3

Re: resultset-seq

2011-05-05 Thread Allen Johnson
ehavior matches the core version, exposing it >> with the same name seems reasonable too since it won't break anyone's >> code (right?). >> >> Sean >> >> >> >> >> >> >> >> On Wed, May 4, 2011 at 4:06 PM, Phlex wrote:

Re: resultset-seq

2011-05-03 Thread Allen Johnson
IMHO c.j.j/resultset-seq should perform something like the following: ;; i want my columns as strings exactly how they are in the db (resultset-seq rs) (resultset-seq rs identity) ;; i want my columns as lower-case keywords (resultset-seq rs (comp keyword lower-case)) ;; i want my columns as upp

Re: clojure.org

2011-04-05 Thread Allen Johnson
Oops, didn't see this message from Stuart Sierra: http://groups.google.com/group/clojure/browse_thread/thread/39adfb3ae7c4dab0 -- 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 pos

Re: clojure.org

2011-04-05 Thread Allen Johnson
> What's with http://clojure.org/ website? Is it expired? I'm also having trouble accessing this. I receive a "Renew your domain name now" page. Allen -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: Init timing for ring web servlet running on Jetty?

2011-03-31 Thread Allen Johnson
> Is there some way to convince Jetty (or tomcat, or ...) to run the > init methods of a servlet before the first request comes in? Or maybe > a pointer to the appropriate forum? You can tell a servlet to init on startup with something like this in your web.xml: test-servlet myapp.servlet

Re: ANN: Clojure Toolbox (Early Beta)

2011-02-25 Thread Allen Johnson
> I'm sure I've covered only a very small proportion of Clojure > libraries out there, so if you'd like to suggest a project that's not > on there, please do so in this thread, or in an email to me. I'll try > and update the site as quickly as possible. How about: Messaging > WabbitMQ https://git

Re: XML navigation puzzles

2011-02-04 Thread Allen Johnson
Here is my attempt using enlive: (require '[net.cgrand.enlive-html :as html]) (import '[java.net URL])) (def *url* "http://api.twitter.com/1/statuses/friends/barackobama.xml";) (defn print-friends [url] (let [data (html/xml-resource (URL. url))] (doseq [user (html/select data [:user])]

ANN: WabbitMQ v0.1.0

2011-02-03 Thread Allen Johnson
Hey everyone. WabbitMQ is a simple Clojure wrapper for RabbitMQ's Java client v2.2.0. This is my first release and as such I'm sure there are plenty of mistakes and/or non-clojure-isms. Feedback welcome! :) https://github.com/mefesto/wabbitmq Allen -- You received this message because you are s

Re: a loop gives boxing warning when it shouldn't

2011-01-02 Thread Allen Johnson
> I can't see where the variables are boxed into objects. Both the loop > and the let declare them as primitives if they are given primitives. > Perhaps they are already objects before they reach the inc and dec > function calls in the recur, but if so, it's a mystery to me why. Yeah that is inter

Re: a loop gives boxing warning when it shouldn't

2011-01-02 Thread Allen Johnson
Here is my attempt. I changed the divide to use unchecked-divide-int and explicitly cast recur values to long. http://clojure.pastebin.com/xs79ruw1 Allen On Sat, Jan 1, 2011 at 5:47 PM, Albert Cardona wrote: > Hi all, > > I'd apreciate help on figuring out why a loop gets number boxing > warnin

Re: using aset in clojure-1.3-alpha4

2010-12-31 Thread Allen Johnson
ow I know .. :) thanks Allen. > Sunil. > > On Fri, Dec 31, 2010 at 8:19 PM, Allen Johnson > wrote: >> >> This worked for me on 1.3.0: >> >> (aset-int (make-array Integer/TYPE 3 4 5) 1 2 3 -1) >> >> Might have something to do with the enhanced primit

Re: using aset in clojure-1.3-alpha4

2010-12-31 Thread Allen Johnson
This worked for me on 1.3.0: (aset-int (make-array Integer/TYPE 3 4 5) 1 2 3 -1) Might have something to do with the enhanced primitive support which causes array handling to be stricter than it was in 1.2? Just a guess. Allen On Fri, Dec 31, 2010 at 8:53 AM, Sunil S Nandihalli wrote: > Hello

Re: Soap Client

2010-12-29 Thread Allen Johnson
JAX-WS 2.1 is pretty good and included in Java 6. On Wed, Dec 29, 2010 at 11:55 AM, Sean Devlin wrote: > Anyone know of a good soap client for Java? > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojur

Re: requiring files

2010-12-29 Thread Allen Johnson
Perhaps it has something to do with the underscore in the namespace. What if you try something like this in the repl: (require 'project-name.foo) (project-name.foo/my-fn) Allen On Wed, Dec 29, 2010 at 10:49 AM, Nicholas Wieland wrote: > Hi *, > I'm a bit ashamed but considering that I'm a newb

Re: resultset-seq improvement: mapping column names

2010-12-06 Thread Allen Johnson
+1 On Fri, Dec 3, 2010 at 10:25 PM, ka wrote: > I'm also stuck with the same issues: 1. no option to get string keys > 2. I don't understand, why do libs go through the trouble of > downcasing ? > > Having said that I totally agree with the point Ryan makes: >> A > greater feature of clojure is i

Re: REQUEST for feedback on http://clojure.org

2010-11-17 Thread Allen Johnson
I think annotations support was added in 1.2. Could we add some information to the Java Interop section regarding this? https://groups.google.com/group/clojure/browse_thread/thread/d2128e1505c0c117?pli=1 Allen On Sat, Oct 30, 2010 at 10:38 PM, Alex Miller wrote: > Hi all, > > I'm doing a bit of

Re: What is the best way to parasitically invade a java project with clojure goodness?

2010-08-23 Thread Allen Johnson
Oops, s/create an instead/create an instance/ :) On Mon, Aug 23, 2010 at 10:03 AM, Allen Johnson wrote: >> (:1 Should the clojure source files intermingle with the java source files, >> each according to it's relavance to the problem, or should there be a top >> level

Re: What is the best way to parasitically invade a java project with clojure goodness?

2010-08-23 Thread Allen Johnson
> (:1 Should the clojure source files intermingle with the java source files, > each according to it's relavance to the problem, or should there be a top > level separation between them?) IMO, they should be separated. Since the project was started with Java I'd continue treating it as the top-lev

Re: cool compiler-project?

2010-08-19 Thread Allen Johnson
+1 on Dalvik compiler :) -- 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 g

Re: Databases for a Concurrent World

2010-07-10 Thread Allen Johnson
include the following jars in the classpath: http://commons.apache.org/dbcp/downloads.html http://commons.apache.org/pool/downloads.html Allen On Sat, Jul 10, 2010 at 12:55 PM, Allen Johnson wrote: > To test with pooled DB connections I thought I'd mention Apache Commons > dbcp. It

Re: Databases for a Concurrent World

2010-07-10 Thread Allen Johnson
To test with pooled DB connections I thought I'd mention Apache Commons dbcp. Its a generic connection pool library that could be used for any jdbc connection. I'd post a example clojure usage but I'm afk atm. The lib's BasicDataSource is probably all you'd need. Depends on Commons pool. Just pla

Re: NullPointerException on disj

2010-05-27 Thread Allen Johnson
Opened ticket #360 for this. https://www.assembla.com/spaces/clojure/support/tickets/360-nullpointerexception-on-disj 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 pos

NullPointerException on disj

2010-05-26 Thread Allen Johnson
Hey everyone. I was playing around with the protocols/deftype stuff and ran into a weird NullPointerException when calling the satisfies? function. Seems to only happen with a java.lang.Object instance. Clojure 1.2.0-master-SNAPSHOT user=> (defprotocol Greeter (greet [this])) Greeter user=> (satis

Re: clojure.contrib.logging and Google App Engine

2010-04-25 Thread Allen Johnson
Sorry about the duplicated paragraph. My laptop touch pad is a pain. On Sun, Apr 25, 2010 at 4:17 PM, Allen Johnson wrote: >> What seems to be happening is that when I build my 'gen-class' package, the >> class is nailed down even though logging.clj itself is not ge

Re: clojure.contrib.logging and Google App Engine

2010-04-25 Thread Allen Johnson
> What seems to be happening is that when I build my 'gen-class' package, the > class is nailed down even though logging.clj itself is not gen-classed. I'm not familiar with GAE but as a workaround can you include the commons-logging.jar in your war file? Then configure commons-logging to delegate

Re: idiomatic clojure of this java style ?

2010-04-24 Thread Allen Johnson
Oops, just saw the error in send-message as I replied. StatusMap should (get recipient). (defn send-message! [xmpp recipient body] (let [status (.sendMessage xmpp (create-message recipient body)) result (.. status getStatusMap (get recipient))] (= SendResponse$Status/SUCCESS result))

Re: idiomatic clojure of this java style ?

2010-04-24 Thread Allen Johnson
Here's my attempt. I don't think you can do much about the imperative style when you are calling Java APIs unless someone was nice and wrote a clojure wrapper. But I'm just a n00b. --- (ns example.servlet.xmpp (:use[clojure.contrib.logging]) (:import [xmpp.package.here XMPPServiceFactory M

Re: JColorChooser

2010-03-22 Thread Allen Johnson
`showDialog` is a static method. Maybe something like below would work? (JColorChooser/showDialog parent "Choose Color" bisque) Allen -- 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

Re: macro headaches

2009-12-15 Thread Allen Johnson
I'm just learning lisp but wouldn't a macro be overkill? ; manually add each item (doseq [item items] (.add obj item)) ; or wrapped in a function (defn add-all [obj items] (doseq [item items] (.add obj item))) (add-all obj items) If your java object had an addAll method that accepted a

Re: macro headaches

2009-12-15 Thread Allen Johnson
~obj ~item (my-doall obj add ["item1" "item2" "item3"]) Allen On Tue, Dec 15, 2009 at 1:04 PM, Allen Johnson wrote: > I'm just learning lisp but wouldn't a macro be overkill? > > ; manually add each item > (doseq [item items] >