clojure

'Could not find us.bpsm:edn-java:0.4.3' error with Gradle for Clojure (Clojuresque)

谁说我不能喝 提交于 2019-12-24 05:28:24
问题 I'm trying to use Gradle for Clojure (Clojuresque), I have this build.gradle . buildscript { repositories { maven { url "http://clojars.org/repo" } } dependencies { classpath "clojuresque:clojuresque:1.7.0" } } apply plugin: 'clojure' repositories { maven { url "http://clojars.org/repo" } } When I execute gradle tasks , I have errors. I checked that there is no http://clojars.org/repo/us/bpsm directory. What might be wrong? > Could not resolve all dependencies for configuration ':classpath'.

I'm getting slightly different hmac signatures out of clojure and python

你离开我真会死。 提交于 2019-12-24 05:06:16
问题 The HMAC SHA1 signatures I'm getting from my python implementation and my clojure implementation are slightly different. I'm stumped as to what would cause that. Python implementation: import hashlib import hmac print hmac.new("my-key", "my-data", hashlib.sha1).hexdigest() # 8bcd5631480093f0b00bd072ead42c032eb31059 Clojure implementation: (ns my-project.hmac (:import (javax.crypto Mac) (javax.crypto.spec SecretKeySpec))) (def algorithm "HmacSHA1") (defn return-signing-key [key mac] "Get an

Clojure Regex: If string is a URL, return string

浪子不回头ぞ 提交于 2019-12-24 04:42:10
问题 How can I return a valid URL given a string in Clojure. (re-matches #"????" "www.example.com")) (re-matches #"????" "http://example.com")) (re-matches #"????" "http://example.org")) // returns "http://example.org" (re-matches #"????" "htasdtp:/something")) // returns nil 回答1: Validating URL is not simple. Perhaps it's too complex to validate with regexp. Fortunately, there's a library called Apache Commons , which contains UrlValidator. Since Clojure can use Java library, you can use Apache

How to integrate libraries (clojars) into Lightable plugins

情到浓时终转凉″ 提交于 2019-12-24 04:26:28
问题 As exercise to gain experience with ClojureScript I am writing a LightTable Plugin and I find no way to successfully use any standard library, I read the official documentation and even updated it to reflect latest changes regarding paths etc.. I followed this video and read the whole thread on the google group trying the proposed solutions, even working with the latest github source without luck. I tried including core.async or cljs.http (I know the embedded nodejs alternative, just as

Does Clojure STM has a relationship with atom and agent forms?

混江龙づ霸主 提交于 2019-12-24 04:22:58
问题 I am looking into the Concurrency programming in Clojure . http://clojure.org/concurrent_programming I got to know that atom , ref and agent forms are used to maintain program state. Only ref is used for coordinated updates , so dosync macro is used when performing changes. So it is obvious that STM engine is involved at this point. Just wanted to be clear about following doubt I have, Does Clojure STM has a relationship with atom and agent forms too? or are they just utilized java.util

Can In Gradle mix .java and .clojure and .scala files

眉间皱痕 提交于 2019-12-24 04:16:11
问题 Can In Gradle mix .java and .clojure and .scala files. I want to mix few programming languages, just searching best way to do it. 回答1: I'm starting with a project with mixed java, scala and clojure. In order to include scala I simply added the scala plugin apply plugin: 'scala' and the scala dependency to dependencies section: compile 'org.scala-lang:scala-library:2.11.7' To include clojure I followed this answer. My final build.gradle file looks like this: buildscript { repositories { maven

How to move an element within a structure, possibly with zippers?

假装没事ソ 提交于 2019-12-24 03:59:05
问题 I have this structure: [{"a" {"b" 1 "c" 2} "children" [{"a" {"b" 3 "c" 4} "children" []}]} {"a" {"b" 5 "c" 6} "children" []} {"a" {"b" 7 "c" 8} "children" [{"a" {"b" 9 "c" 10} "children" []} {"a" {"b" 10 "c" 10} "children" []}]}] I'm trying to write an algorithm to move and element within a vector. For example in the last element, it has children vector with: "children" [{"a" {"b" 9 "c" 10} "children" []} {"a" {"b" 10 "c" 10} "children" []}] My function is supposed to search for a specific

Clojure Zipper to EDN

不想你离开。 提交于 2019-12-24 03:10:21
问题 I have created the following graph using Clojure Zipper A / | \ B C D / \ E F using the following code: (require '[clojure.zip :as z]) (def g (z/vector-zip ["A" ["B" "C" "D"["E" "F"]]])) Now I want to create a Visualization in d3, So that I want to represent the graph in EDN format like, [{:from "A" :to "B"} {:from "A" :to "C"} {:from "A" :to "D"} {:from "D" :to "E"} {:from "D" :to "F"}] I've tried this (loop [t g] (if-not (z/end? t) (do (if-not (z/branch? t) (println {:from (-> t (get 1)

Installing Enclosure with Netbeans

ぃ、小莉子 提交于 2019-12-24 02:28:25
问题 I am having trouble installing Enclosure and getting it to work. I have followed this guide http://www.enclojure.org/gettingstarted and successfully installed Enclosure (I think). However, when I try to build the sample application (labrepl) I get a bunch of errors and a failed build. I haven't used Java in a long time and I've never used Netbeans, and the error doesn't seem very helpful with my limited knowledge of this domain. I'm using the latest Netbeans and the Enclosure URL from the

how to wait for a process to end in java or clojure

北慕城南 提交于 2019-12-24 02:11:54
问题 How can I be notified when a process I did not start ends and is their a way to recover its exit code and or output? the process doing the watching will be running as root/administrator. 回答1: You can check whether a process is currently running from java by calling a shell command that lists all the current processes and parsing the output. Under linux/unix/mac os the command is ps , under windows it is tasklist . For the ps version you would need to do something like: ProcessBuilder pb = new