I have a little script
(use
:reload-all
'com.example.package1
'com.example.package2
'com.example.package3
'com.example.testlib)
(run-tests
'com.example.package1
'com.example.package2
'com.example.package3)
that I use to quickly reload everything and fire off the unit tests.
trouble is that each time (deftest ... ) is evalua...
I can not find any info on how to parse xml documents and access elements.
I have found two ways to parse the xml document
(clojure.zip/xml-zip (clojure.xml/parse file))
and
(parse-seq file)
but i can seem to find any info on how to process the resulting structure?
Source file's refers to zip-query.clj on how to query the result...
I just started w/ Clojure (coming from Ruby) and I would like to build an small app with a command-line interface. How do I handle input/output to a CL?
I noticed that there is a clojure.contrib.command-line, but documentation is slim.
http://github.com/richhickey/clojure-contrib/blob/ffa868411cda6c617105b52b4f6f9e0f37ee8c24/src/clojur...
I'm trying to decide whether to use James(http://james.apache.org/) or Javamail(http://java.sun.com/products/javamail/) to build a email system that takes and processes email. It will send and recieve email along with processing the content, checking for spam etc. What are the advantages/disadvantages of each and which do you recommend I...
Both Junit and TestNG provide mechanisms for iterating over a collection of input parameters and running your tests against them. In Junit this is supported via the Parameterized annotation, while TestNG uses @DataProvider.
How can you write data-driven tests using the test-is library? I tried using for list comprehension to iterate ove...
I'm relatively new to Clojure and a complete HTML/Compojure virgin. I'm trying to use Compojure to create static pages of HTML using a function similar to this:
(defn fake-write-html
[dir args]
(let [file (str dir *file-separator* *index-file*)
my-html (html
(doctype :html4)
[:html
...
I want to combine the results of three zip-filter queries on an xml tree. The XML I am parsing looks like this:
<someroot>
<publication>
<contributors>
<person_name>
<surname>Surname A</surname>
</person_name>
<person_name>
<given_name>Given B</given_name>
<surname>Surname B</surname>
...
I'm confused as how to idiomatically change a xml tree accessed through clojure.contrib's zip-filter.xml. Should be trying to do this at all, or is there a better way?
Say that I have some dummy xml file "itemdb.xml" like this:
<itemlist>
<item id="1">
<name>John</name>
<desc>Works near here.</desc>
</item>
<item id="2">...
I want to automate filling in data on a website using clojure.
For this I want to query elements of webpages and create http requests. I have been looking at using HttpUnit and contrib.clojure.zip-filter.xml. So far neither approach feels right.
Are there alternative libraries to aid with this task?
thanks
...
I can't seem to find a way to launch the Clojure REPL with the contrib library included. If I understood the documentation correctly then this command should do it:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp clojure.jar:clojure
-contrib.jar clojure.main
Exception in thread "main" java.lang.NoClassDefFoundError: clojure...
I'm writing a Compojure TODO app and with MySQL as the primary data store. I'm using clojure.contrib.sql to interface with MySQL as follows:
(def db {:classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname "//localhost:3306/todo"
:user "<user>"
:password ""})
The queries I'm using seem to w...
I'm playing around with Clojure, and I can't figure out how to import a function from clojure-contrib.jar. Working from this answer, I'm doing the following:
Running the REPL like so:
java -cp clojure.jar:clojure-contrib.jar clojure.main
Then trying to import a function:
user=> (use '[clojure-contrib.duck-streams :only (writer rea...
I need to write raw bytes to the file. I do it with:
(.write (FileOutputStream "/path") bytes)
...where bytes must be of type byte[]. Please note it cannot be Byte[].
I tried to convert my sequence with both (bytes) and/or (into-array) functions and got frustrated, one example:
user=> (bytes (into-array (filter #(not (= % 13)) (to-b...
I've been reading an excellent introduction to monads for Clojure programmers. The article illustrates that the Identity monad is functionally equivalent to Clojure's let and that the Sequence/List monad is equivalent to for.
When the article gets to monad transformers, it shows an example combining the Maybe and Sequence monads. Ok, s...
The clojure.contrib.sql library returns BigDecimals for all numeric fields. What's a good way to have some fields as Integers? Example code below:
(sql/with-connection my-db
(sql/with-query-results res
[sql-str 6722]
(into [] res)))
In the resulting collection of records all numbers are BigDecimal. Some of these are ...
Hi,
I tried to migrate a project from clojure 1.1 to 1.2 because of the new protocols introduced in 1.2. But when I try to :use clojure-contrib.duck-streams I get a warning about 'spit' which already exists in clojure.core. The same problem with clj-time.core and 'extend' which also exists in clojure.core.
Can anyone explain what would...
Command line is "D:\Progra~1\Java\jre6\bin\java.exe -jar D:\Old\Clojure\clojure.jar D:\Old\Clojure\clojure-contrib.jar"
Following error appears:
clojure.lang.Compiler$CompilerException: clojure-contrib.jar:0: Unable to resolve symbol: PK♥♦ in this context
clojure-contrib version is 1.1.0
How to invoke clojure with libraries right?
...