slime and utf-8

2011-06-26 Thread Gregg Reynolds
Hi,

This seems to be an emacs problem.  I'm trying to read a file with utf-8
text using  (slurp foo.txt) in an emacs slime session.  It chokes and
says:

error in process filter:  Autoloading failed to define function debug

Furthermore if I use utf-8 in the file name, I get:

Coding system iso-latin-1-unix not suitable for 0076(:emacs-rex
(swank:listener-eval \(slurp \\\/Users...filename...\\\)\) \user\
:repl-thread 3)

I can live without utf-8 filenames, but it would be really useful to be able
to read utf-8 data and println it etc. from the repl.  Any suggestions?

Thanks,

Gregg

-- 
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

Re: slime and utf-8

2011-06-26 Thread Max Penet
Hi,

Try adding this line to your .emacs:

(setq slime-net-coding-system 'utf-8-unix)

On Jun 26, 1:34 pm, Gregg Reynolds d...@mobileink.com wrote:
 Hi,

 This seems to be an emacs problem.  I'm trying to read a file with utf-8
 text using  (slurp foo.txt) in an emacs slime session.  It chokes and
 says:

 error in process filter:  Autoloading failed to define function debug

 Furthermore if I use utf-8 in the file name, I get:

 Coding system iso-latin-1-unix not suitable for 0076(:emacs-rex
 (swank:listener-eval \(slurp \\\/Users...filename...\\\)\) \user\
 :repl-thread 3)

 I can live without utf-8 filenames, but it would be really useful to be able
 to read utf-8 data and println it etc. from the repl.  Any suggestions?

 Thanks,

 Gregg

-- 
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


Re: slime and utf-8

2011-06-26 Thread Gregg Reynolds
On Sun, Jun 26, 2011 at 6:55 AM, Max Penet zcams...@gmail.com wrote:

 Hi,

 Try adding this line to your .emacs:

 (setq slime-net-coding-system 'utf-8-unix)


Perfect!  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

Re: setting a xml value and save the root to a file

2011-06-26 Thread Ken Wesson
On Sat, Jun 25, 2011 at 3:23 AM, dive_mw dive...@googlemail.com wrote:
 Hi all,
 can anybody help me, how to fix the following problem? I have a
 function like this:

 (defn set-config-value
  sets a new value programatically to a config key
  [value  tags]
  ;; set the new value and save the config file?
  ;;(zip/edit tags (zip/xml-zip(load-config)) value )

  ;; Save this config xml file with the changed xml content
  (ds/spit ./config/config-tst.xml
    (with-out-str (lxml/emit (zip/root @config) :pad true)))

  )
 How can I set a new  value to the element
 = (set-config-value 5 :test)                       ?

Why not just nest the expressions:

(ds/spit ./config/config-tst.xml
  (with-out-str
(lxml/emit
  (zip/root
(zip/edit tags (zip/xml-zip (load-config)) value)) :pad true)))

Now it will load the config (innermost ()), alter the value, then
emit. Since you use with-out-str it's not going to be lazily reading
the file at the same time it tries to write it, either; everything in
with-out-str will evaluate, loading the config and changing it and
generating the new XML in a string, and then the string will be
returned, and ds/spit called at that point, overwriting the file.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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


Tree vaadin?

2011-06-26 Thread Antonio Recio
I would like to translate a java example of tree vaadin to clojure. I have 
to files in the same folder: planets.clj and core.clj. I am having problems 
and I need help. What I am doing wrong?
*
*
*;; In the file planets.clj:*
(ns project.planets)
(let [planets (doto (Object.)
  (Object. [Venus])
  (Object. [Earth The Moon])
  (Object. [Mars Phobos Deimos])
  )]

*;; In the file core.clj:*
(load planets)
(defn -cjinit [][[] (ref {})])
(defn -init [this]
  (let [tree (doto (com.vaadin.ui.Tree. The Planets and Major Moons)
   (loop [i 0]
 (str planet planets[i] 0)
 (.addItem planet)
 (if (= planets[i].length 1)
   (.setChildrenAllowed planet false))
 (loop [j 1]
   (str moon planets[i][j])
   (.addItem monn)
   (.setParent moon planet)
   (.setChildrenAllowed moon false))
 (.expandItemsRecursively planet)
 (recur (inc i]
(do (.addComponent main tree


*;; Java*
final Object[][] planets = new Object[][]{
  new Object[]{Mercury},
  new Object[]{Venus},
  new Object[]{Earth, The Moon},
  new Object[]{Mars, Phobos, Deimos},
  new Object[]{Jupiter, Io, Europa, Ganymedes,
Callisto},
  new Object[]{Saturn,  Titan, Tethys, Dione,
Rhea, Iapetus},
  new Object[]{Uranus,  Miranda, Ariel, Umbriel,
Titania, Oberon},
  new Object[]{Neptune, Triton, Proteus, Nereid,
Larissa}};
Tree tree = new Tree(The Planets and Major Moons);
for (int i=0; iplanets.length; i++) {
  String planet = (String) (planets[i][0]);
  tree.addItem(planet);
  if (planets[i].length == 1) {
tree.setChildrenAllowed(planet, false);
  } else {
for (int j=1; jplanets[i].length; j++) {
  String moon = (String) planets[i][j];
  tree.addItem(moon);
  tree.setParent(moon, planet);
  tree.setChildrenAllowed(moon, false);
}
tree.expandItemsRecursively(planet);
  }
}
main.addComponent(tree);
*
*
*;; The final result must be something like this:*

http://vaadin.com/download/current/docs/book/img/components/tree-example1.png

-- 
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

Re: Tree vaadin?

2011-06-26 Thread .Bill Smith
Can you describe the problem you are having?

-- 
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

Re: slime and utf-8

2011-06-26 Thread Alan Malloy
This has been added to recent versions of clojure-mode. I don't know
if there's an official release with this fix yet, but you can also try
running clojure-mode from a git checkout at 
https://github.com/technomancy/clojure-mode

On Jun 26, 5:48 am, Gregg Reynolds d...@mobileink.com wrote:
 On Sun, Jun 26, 2011 at 6:55 AM, Max Penet zcams...@gmail.com wrote:
  Hi,

  Try adding this line to your .emacs:

  (setq slime-net-coding-system 'utf-8-unix)

 Perfect!  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


Re: Tree vaadin?

2011-06-26 Thread Robert Lally
First problem:

In Java:
new Object[]{Venus}



On 26 June 2011 18:46, .Bill Smith william.m.sm...@gmail.com wrote:

 Can you describe the problem you are having?

 --
 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




-- 
Blog : http://robertlally.com

-- 
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

Re: Tree vaadin?

2011-06-26 Thread Robert Lally
Ooops - gmail malfunction

First problem, in Java:
new Object[]{Venus}

creates a new object array - containing the String Venus.

Your clojure code
Object. [Venus])

is trying to call the constructor of Object passing in a single argument
which is a Clojure Vector. This isn't going to work.

Look at
http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/object-arrayinstead.

R.


On 26 June 2011 21:08, Robert Lally rob.la...@gmail.com wrote:

 First problem:

 In Java:
 new Object[]{Venus}



 On 26 June 2011 18:46, .Bill Smith william.m.sm...@gmail.com wrote:

 Can you describe the problem you are having?

 --
 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




 --
 Blog : http://robertlally.com




-- 
Blog : http://robertlally.com

-- 
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

Re: setting the classpath in cake+slime (was Re: Screencast: Clojure + Emacs + slime + swank + cake + Overtone)

2011-06-26 Thread lambdatronic
The classpath is specified in the lein and cake scripts respectively.
lein is a shell script, and cake is a ruby script, so pop them open in
your favorite text editor and take a look.

  ~Gary

On Jun 24, 4:56 pm, Lee Spector lspec...@hampshire.edu wrote:
 Oops: Ignore my last BTW -- now load works for me too. Not sure why it 
 didn't previously. I'd still like to know where it is specified that src and 
 lib are on the classpath, but I guess I have everything working now.

 Thanks,

  -Lee

 On Jun 24, 2011, at 4:50 PM, Lee Spector wrote:









  Thanks Gary. With this I'm able to get :use to work correctly -- FWIW the 
  part I wasn't getting right (again :-() was the association between the 
  namespace names and the directory structure. In the context of your example 
  I was doing something like (ns core ...) rather than (ns overtone-test.core 
  ...), for a file in the same location. I now see that I can name it just 
  core (or whatever I want) if I put it up one level, just in src/ rather 
  than in src/overtone-test. FWIW I've been down a similar path and figured 
  out something about the namespace/directory structure mapping before, in 
  the context of some other tools, but forgot... I guess I still don't find 
  this very intuitive.

  One thing that I'd like to know more about: when you say Start a JVM in 
  this directory with the classpath set to contain and files in src or lib 
  I'm not 100% sure that I know how you mean to do that. I am starting a JVM 
  in that directory by saying cake swank, and this seems to work now that I 
  have the namespace names and file locations matched up. But how? Is the 
  classpath being set to contain files in src and lib automatically by cake? 
  Where does one specify this? It's not in my project.clj or anywhere else 
  that I see. So even though it's currently working it still seems mysterious.

  BTW also I still can't seem to get load to work... it never seems to find 
  the files I'd sort of like to know how to do that, to help dispel more 
  of the foggy classpath mysteries, but I guess that now that I can get :use 
  to work I can have a reasonable workflow one way or another.

  -Lee

-- 
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


Re: slime and utf-8

2011-06-26 Thread Phil Hagelberg
Alan Malloy a...@malloys.org writes:

 This has been added to recent versions of clojure-mode. I don't know
 if there's an official release with this fix yet, but you can also try
 running clojure-mode from a git checkout at 
 https://github.com/technomancy/clojure-mode

Well... sort of. It will set it if you use M-x clojure-jack-in. But if
you're using raw slime you have to set it yourself. 

Unfortunately I don't foresee this being fixed upstream in Slime itself;
they are still using CVS, so trying to convince them that iso-8895-1 is
passé would probably not go over well.

-Phil

-- 
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


Re: setting the classpath in cake+slime (was Re: Screencast: Clojure + Emacs + slime + swank + cake + Overtone)

2011-06-26 Thread Lee Spector

Ah. Non-obvious, but now I'm beginning to see how this works -- I found and 
looked into the cake script.

Thanks!

 -Lee

On Jun 26, 2011, at 4:30 PM, lambdatronic wrote:

 The classpath is specified in the lein and cake scripts respectively.
 lein is a shell script, and cake is a ruby script, so pop them open in
 your favorite text editor and take a look.
 
  ~Gary
 
 On Jun 24, 4:56 pm, Lee Spector lspec...@hampshire.edu wrote:
 Oops: Ignore my last BTW -- now load works for me too. Not sure why it 
 didn't previously. I'd still like to know where it is specified that src and 
 lib are on the classpath, but I guess I have everything working now.
 
 Thanks,
 
  -Lee
 
 On Jun 24, 2011, at 4:50 PM, Lee Spector wrote:
 
 
 
 
 
 
 
 
 
 Thanks Gary. With this I'm able to get :use to work correctly -- FWIW the 
 part I wasn't getting right (again :-() was the association between the 
 namespace names and the directory structure. In the context of your example 
 I was doing something like (ns core ...) rather than (ns overtone-test.core 
 ...), for a file in the same location. I now see that I can name it just 
 core (or whatever I want) if I put it up one level, just in src/ rather 
 than in src/overtone-test. FWIW I've been down a similar path and figured 
 out something about the namespace/directory structure mapping before, in 
 the context of some other tools, but forgot... I guess I still don't find 
 this very intuitive.
 
 One thing that I'd like to know more about: when you say Start a JVM in 
 this directory with the classpath set to contain and files in src or lib 
 I'm not 100% sure that I know how you mean to do that. I am starting a JVM 
 in that directory by saying cake swank, and this seems to work now that I 
 have the namespace names and file locations matched up. But how? Is the 
 classpath being set to contain files in src and lib automatically by cake? 
 Where does one specify this? It's not in my project.clj or anywhere else 
 that I see. So even though it's currently working it still seems mysterious.
 
 BTW also I still can't seem to get load to work... it never seems to find 
 the files I'd sort of like to know how to do that, to help dispel more 
 of the foggy classpath mysteries, but I guess that now that I can get :use 
 to work I can have a reasonable workflow one way or another.
 
 -Lee
 
 -- 
 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

--
Lee Spector, Professor of Computer Science
Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

-- 
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


Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
*Could* it *possible* to use a list with peek and pop to create the planets 
and moons list?

-- 
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

Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
Could anyone write the planet array of objects?

-- 
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

Handling java streams..

2011-06-26 Thread Andreas Liljeqvist
Are there any libraries out there for making java stream handling nicer?

My current project involves reading images from zipfiles, scaling them and
then write them to a new zipfile.

Any code I have seen involve mostly writing java in clojure and setting up
buffers and such.
Certainly I could do that, but it leaves me wondering if Java interop have
to be such a pain.
I would think one could patternize IO ops for most standard uses.

Might just be my less than fresh Java knowledge acting up...

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

Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
I could be fine this?
(def planets (object-array [[Venus] [Earth The Moon] [Mars Phobos 
Deimos]]))

-- 
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

Re: Strange Problem With Cake

2011-06-26 Thread octopusgrabbus
Thank you, and you are most correct. I'm getting there w/ remembering
parentheses.

defproject test-csv 0.1
  :description A clojure-csv test
  :dependencies [[org.clojure/clojure 1.2.1]
 [org.clojure/clojure-contrib 1.2.0]
 [clojure-csv/clojure-csv 1.2.1]]
  :main test-csv)

Problem solved.

On Jun 25, 7:46 pm, Alan Malloy a...@malloys.org wrote:
 It sounds like your project.clj is broken, possibly because it reads

 defproject test_csv
   ...

 instead of
 (defproject test_csv
   ...)

 But my psychic powers reach no further than that. Maybe you should
 paste your project.clj, or even your whole project on github.

 On Jun 25, 4:41 pm, octopusgrabbus octopusgrab...@gmail.com wrote:







  I'm on a home system, same version of Ubuntu as at work. I am able to
  build clojure-csv with no problems using cake.

  When sitting in my project directory, test_csv, even cake help results
  in this error

  Caused by: java.lang.Exception: Can't take value of a macro:
  #'cake.core/defproject

  but when I go up one level cake help displays the help.

  Any thoughts as to what is wrong? Did I forget to initialize
  something?
  Thanks.
  cmn

-- 
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


Re: Handling java streams..

2011-06-26 Thread Alan Malloy
clojure.java.io?

On Jun 26, 2:25 pm, Andreas Liljeqvist bon...@gmail.com wrote:
 Are there any libraries out there for making java stream handling nicer?

 My current project involves reading images from zipfiles, scaling them and
 then write them to a new zipfile.

 Any code I have seen involve mostly writing java in clojure and setting up
 buffers and such.
 Certainly I could do that, but it leaves me wondering if Java interop have
 to be such a pain.
 I would think one could patternize IO ops for most standard uses.

 Might just be my less than fresh Java knowledge acting up...

 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


Clojure + PostgreSQL

2011-06-26 Thread Lars Rune Nøstdal
Hi guys,
Anyone using Clojure and PostgreSQL? I'm trying to access PostgreSQL 
using https://github.com/clojure/java.jdbc at the moment, but it seems to 
have trouble with simple inserts:

   (insert-record :temp {:parent 42}) 
  #PSQLException org.postgresql.util.PSQLException: A result was returned 
when none was expected.


..etc.. Perhaps I'm on the wrong track; what do you guys use or do?

-- 
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

Re: Clojure + PostgreSQL

2011-06-26 Thread Lars Rune Nøstdal
Quick change to do-prepared* in internal.clj:



(defn do-prepared*
  Executes an (optionally parameterized) SQL prepared statement on the
  open database connection. Each param-group is a seq of values for all of
  the parameters.
  [return-keys sql  param-groups]
  (with-open [stmt (if return-keys
 (.prepareStatement (connection*) sql 
java.sql.Statement/RETURN_GENERATED_KEYS)
 (.prepareStatement (connection*) sql))]
(if return-keys
  (do
(doseq [param-group param-groups]
  (dorun (map-indexed (fn [index value]
(.setObject stmt (inc index) value))
  param-group)))
(transaction* (fn []
(.executeUpdate stmt)
(first (resultset-seq* (.getGeneratedKeys stmt))
  (do
(doseq [param-group param-groups]
  (dorun (map-indexed (fn [index value]
(.setObject stmt (inc index) value))
  param-group))
  (.addBatch stmt))
(transaction* (fn []
(let [rs (seq (.executeBatch stmt))]
  (if return-keys (first (resultset-seq* 
(.getGeneratedKeys stmt))) rs




 (with-connection db
(insert-record :temp {:parent (rand 42)}))
{:id 88, :parent 13}

 (with-connection db
(insert-records :temp {:parent (rand 42)} {:parent (rand 
42)}))
({:id 89, :parent 7} {:id 90, :parent 33})

 




This probably breaks something else though; I haven't tested ...

-- 
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

Re: Clojure + PostgreSQL

2011-06-26 Thread Sean Corfield
Sorry about that - known issue: http://dev.clojure.org/jira/browse/JDBC-10

It works fine on MySQL but breaks on PostgreSQL and SQL Server. I'll
get a fix in over the next couple of days (I'm away from home right
now).

Sean

On Sun, Jun 26, 2011 at 4:13 PM, Lars Rune Nøstdal
larsnost...@gmail.com wrote:
 Hi guys,
 Anyone using Clojure and PostgreSQL? I'm trying to access PostgreSQL
 using https://github.com/clojure/java.jdbc at the moment, but it seems to
 have trouble with simple inserts:
    (insert-record :temp {:parent 42})
   #PSQLException org.postgresql.util.PSQLException: A result was returned
 when none was expected.


 ..etc.. Perhaps I'm on the wrong track; what do you guys use or do?

 --
 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



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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


dynamically create cmdspec for clojure.contrib.command-line

2011-06-26 Thread Marc Limotte
Hi.

I'm trying to understand why the following macro doesn't work.  This is a
trivial example, but ultimately I want to create a macro that will let me
dynamically create the cmdspec for
clojure.contrib.command-line/with-command-line.  I haven't written many
macros, so my general understanding may be off.

user (use 'clojure.contrib.command-line)
user (def args [--foo 2])
user (defmacro my-with-cl [spec] `(with-command-line args desc ~spec (prn
foo)))
user (my-with-cl '[[foo something about foo nil]])
; Evaluation aborted.
Exception: Unsupported binding form: something about foo

I would expect this to be expanded to
  (with-command-line args desc [[foo a b]] (prn foo))

Which runs ok, directly in the repl:
user (with-command-line args desc [[foo a b]] (prn foo))
2
nil

And (macroexpand (my-with-cl ...)) throws the same exception.

How can I accomplish this, and why does my solution not work?

Thanks for any help.
Marc

-- 
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

Re: dynamically create cmdspec for clojure.contrib.command-line

2011-06-26 Thread Ken Wesson
On Sun, Jun 26, 2011 at 11:22 AM, Marc Limotte mslimo...@gmail.com wrote:
 And (macroexpand (my-with-cl ...)) throws the same exception.

Macroexpand's a normal function, not a macro, so you need to quote its argument.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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


Re: Tree vaadin?

2011-06-26 Thread Antonio Recio
How I can translate this in clojure?

for (int i=0; iplanets.length; i++) {
  String planet = (String) (planets[i][0]);
  tree.addItem(planet);

-- 
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

[ANN] emacs-clojure-vagrant: a sane development virtual environment

2011-06-26 Thread Justin Lilly
I've put together a simple development environment for those looking
for a stable place to work on clojure code. The idea was dual purpose:
a consistent environment for which to try out multiple code bases and
something that is familiar to me when working on a foreign operating
system.

The included vagrant file will setup an Ubuntu 11.04 virtual machine
with clojure and clojure-contrib 1.2, emacs 24 (with emacs-starter-kit
2 and all relevant clojure modes), tmux (similar to GNU screen),
Leiningen and Jark.

Special thanks to Phil Hagelberg for his help getting things setup.

Please check out the github project hosted by the Seajure user group
at https://github.com/Seajure/emacs-clojure-vagrant . Your forks and
contributions are appreciated.

Thanks,
 -justin

-- 
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


Re: Tree vaadin?

2011-06-26 Thread Linus Ericsson
Maybe

(map #(.addItem tree (.toString (first %))) planets)

where #(.addItem tree (.toString (first %))) should be replaced with the
correct java interop for inserting into the tree, and the % becomes one and
one of the items in the planets vector (that is regarded as a sequence) the
argument.

/Linus

2011/6/27 Antonio Recio amdx6...@gmail.com

 How I can translate this in clojure?

 for (int i=0; iplanets.length; i++) {
   String planet = (String) (planets[i][0]);
   tree.addItem(planet);

 --
 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 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

struct sharing same key?

2011-06-26 Thread Antonio Recio
I would like to create an struct with the names of differents nationalities. 
When people are the same nationality I would don't need to repeat again the 
nationality. Is there any way t0 get that. For example, I would like to 
write something like that:

(defstruct person :nationality :first :last)

(def people (struct person  english Jim
 Silvester
 Stephen Howards
   chinese Chiu Chiu))

-- 
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

Re: Tree vaadin?

2011-06-26 Thread Ambrose Bonnaire-Sergeant
I've never used it, but you would use amap instead of map in this situation,
because it is a Java array.

http://clojuredocs.org/clojure_core/clojure.core/amap

Ambrose

On Mon, Jun 27, 2011 at 1:08 PM, Linus Ericsson 
oscarlinuserics...@gmail.com wrote:

 Maybe

 (map #(.addItem tree (.toString (first %))) planets)

 where #(.addItem tree (.toString (first %))) should be replaced with the
 correct java interop for inserting into the tree, and the % becomes one and
 one of the items in the planets vector (that is regarded as a sequence) the
 argument.

 /Linus


 2011/6/27 Antonio Recio amdx6...@gmail.com

 How I can translate this in clojure?

 for (int i=0; iplanets.length; i++) {
   String planet = (String) (planets[i][0]);
   tree.addItem(planet);

 --
 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 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 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

Re: struct sharing same key?

2011-06-26 Thread Ken Wesson
On Mon, Jun 27, 2011 at 1:10 AM, Antonio Recio amdx6...@gmail.com wrote:
 I would like to create an struct with the names of differents nationalities.
 When people are the same nationality I would don't need to repeat again the
 nationality. Is there any way t0 get that. For example, I would like to
 write something like that:
 (defstruct person :nationality :first :last)
 (def people (struct person  english Jim
                                                      Silvester
                                                      Stephen Howards
                                        chinese Chiu Chiu))

You probably want something more like a map like this:

{:english [{:first Jim :last Silvester}
   {:first Stephen :last Howards}]
 :chinese [{:first Chiu :last Chiu}]}

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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