clojure

How to configure OAuth with Goodreads in Clojure

眉间皱痕 提交于 2019-12-23 05:07:57
问题 I am trying to configure OAuth to use it to access data from the Goodreads API using Clojure and Compojure framework. I basically want to get a list of firends that a Goodreads member has. I should mention that I am new to Clojure and completely new to OAuth and in general to API authentication so I would really appreciate it if it could be explained as simply as possible. I tried to find the answer online but was unable to find one that would help me as many sites deal with specific OAuth

Output compojure server print statements into figwheel terminal?

99封情书 提交于 2019-12-23 04:57:13
问题 Where does pprint / println output go in compojure?/Can I get it to show up in the terminal window that the figwheel repl is running in? (Sorry if this sounds dumb, google bested my efforts). 回答1: Actually Figwheel has a related feature to cause such symptoms. All print/prn statements in your ring handlers will be "swallowed" by the Figwheel process and will either go to a log file or to the console. Here is a snippet from project.clj: :figwheel {:http-server-root "public" :server-port 3449

clojure - strng-concat with group by in sequences of maps

╄→尐↘猪︶ㄣ 提交于 2019-12-23 04:42:03
问题 Given input data from a jdbc source such as this: (def input-data [{:doc_id 1 :doc_seq 1 :doc_content "this is a very long "} {:doc_id 1 :doc_seq 2 :doc_content "sentence from a mainframe "} {:doc_id 1 :doc_seq 3 :doc_content "system that was built before i was "} {:doc_id 1 :doc_seq 4 :doc_content "born."} {:doc_id 2 :doc_seq 1 :doc_content "this is a another very long "} {:doc_id 2 :doc_seq 2 :doc_content "sentence from the same mainframe "} {:doc_id 3 :doc_seq 1 :doc_content "Ok here we

Clojure Clostache error - No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil

对着背影说爱祢 提交于 2019-12-23 04:22:52
问题 Am using clojure - 1.5.1, compojure - 1.1.5, clostache - 1.3.1. The template file is present under resources/public/templates folder. Code : (:require [clostache.parser :as cp]) (cp/render-resource "templates/connectionDetails.mustache" {:jmsConnectionName "Michael" :rest-conn-names ["a" "b"]})) The call to Clostache's render-resource is throwing the below Exception : Exception: java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io

Sending input to a screen window from vim

妖精的绣舞 提交于 2019-12-23 04:14:17
问题 I have a vim function set up where I can highlight a line of text and execute in clojure. Here's the function: function! Clojure_execline() let cl = (getline(line("."))) // ... exec 'clojure -e "' . cl . '"' endfunction The problem with this is that it's slow to start and because it spawns a new clojure session every time I run it, I can't call a function I ran previously. Ideally, I'd like for a hidden repl to be running where I could send input from vim and retrieve the output from as well.

Generate javascript method call code with ClojureScript macro?

点点圈 提交于 2019-12-23 03:31:13
问题 I am using ClojureScript to detect which browser-specific version of 'requestAnimationFrame' method is defined. I use the following code: (defn animationFrameMethod [] (let [window (dom/getWindow) options (list #(.-requestAnimationFrame window) #(.-webkitRequestAnimationFrame window) #(.-mozRequestAnimationFrame window) #(.-oRequestAnimationFrame window) #(.-msRequestAnimationFrame window))] ((fn [[current & remaining]] (cond (nil? current) #((.-setTimeout window) % (/ 1000 30)) (fn? (current

Generate javascript method call code with ClojureScript macro?

冷暖自知 提交于 2019-12-23 03:31:04
问题 I am using ClojureScript to detect which browser-specific version of 'requestAnimationFrame' method is defined. I use the following code: (defn animationFrameMethod [] (let [window (dom/getWindow) options (list #(.-requestAnimationFrame window) #(.-webkitRequestAnimationFrame window) #(.-mozRequestAnimationFrame window) #(.-oRequestAnimationFrame window) #(.-msRequestAnimationFrame window))] ((fn [[current & remaining]] (cond (nil? current) #((.-setTimeout window) % (/ 1000 30)) (fn? (current

How i can deserialize record structure from file, already saved to file with print-dup?

可紊 提交于 2019-12-23 03:18:21
问题 I'm have a following code: (use 'clojure.java.io) (defrecord Member [id name salary role]) (defrecord Role [id name]) (def member-records (ref ())) (defn add-member [member] (dosync (alter member-records conj member))) ;;Test-data --> (def dev-r(->Role 1 "Developer")) (def test-member1(->Member 1 "Kirill" 70000.00 dev-r)) ;;Test-data <-- (defn save-data-2-file [] (with-open [wrtr (writer "C:/Platform/Work/test.cdf")] (print-dup @member-records wrtr))) (defn process-line [line] (println line))

is clojure.jdbc/insert! done in batch mode or one by one?

独自空忆成欢 提交于 2019-12-23 02:58:16
问题 After I use clojure.jdbc/insert! to insert some data, it printed many "1", so I am wondering whether the insert is done in batch mode which has better performance or done one by one which is slow. We'd better to have it run like java jdbc batch insert. clojurewerkz.testcom.core=> (time (apply (partial j/insert! postgres-db 'test_clojure [:a :b :c :d :e]) (map #(process-row % constraints) (repeat 10000 row)))) "Elapsed time: 540.111482 msecs" (1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

How to convert XML namespaces to Clojure namespaces during XML parse?

浪尽此生 提交于 2019-12-23 01:34:36
问题 How to convert XML namespaces to Clojure namespaces during parse? For example with clojure.data.zip.xml lib. Is it possible by connecting external parser though? For example, we have XSD file with a number of declared namespaces inside schema tag and some of them are used in definition below <?xml version="1.0" encoding="UTF-8"?> <!-- Generated by Fujitsu Interstage XWand B0237 --> <xsd:schema targetNamespace="http://www.cbr.ru/xbrl/bfo/rep/2017-10-31/tab/FR_1_001_01c_01" elementFormDefault=