Re: keyword with slash to string
I'm impressed. Thank you very much! -- 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
keyword with slash to string
Hello, weird, I know, but I have keywords in a map like this: :first/second I want to convert such a keyword to a string and I'm doing this with the "name" function. This doesn't work with a slash: (def x :first/second) (name x) "second" (The reason why I have such keywords at all is that data.json allows me to "keywordize" keys from a json map.) Is there a function that returns the full string "first/second"? Or even better: is there a function that transforms a map with keywords to a map with Strings as keys? The constraint is that keywords can have a slash. Thx. - Finn -- 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: Debugging lazy seqs with log4j
Thanks. I think when I tried it (correct me if I'm wrong) it was not possible to set the debug level dynamic. For instance I usually have a port where I can send messages to (simple UDP datagram packet), the message string is a map which I read-string and eval and upon that event, I reset some internal state like debugging or print the state of some objects or whatever. Maybe I should invent my own simple messaging system based on good old UPD datagram packets :-) -- 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: Debugging lazy seqs with log4j
yes, when starting my project, I was looking at the logging library which resides (resided) in clojure.contrib and I didn't like it at that point in time. I think because it was trying to do too many things at once. If my use case can be solved with some small java wrappers, I try to do it on my own. This is of course not the case for jdbc where I appreciate java.jdbc although I have difficulties using c3p0 with sybase. I will follow up on this maybe later). -- 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: Debugging lazy seqs with log4j
Yes! That's it. With pr-str it works. Thx!! -- 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: Debugging lazy seqs with log4j
Hi Sean no, not yet. I stick with my own simple logging ns which works nice so far. Just have to fix this ...) (but I use clojure.java.jdbc with Sybase ASE 15.0.3. I hope I will find some time soon to contribute some testcases.) Finn -- 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
Debugging lazy seqs with log4j
Hello, I'm using log4j and have some a simple wrappers in clojure that work well so far. Actually, I do (def *logger* (Logger/getRootLogger)) Then I set loglevel, appenders, layout and so on. I have a function (defn debug [msg] (.debug *logger* msg) This works nice as long as I do not try to log a lazy sequence. Instead, the string clojure.lang.LazySeq@hdk73gdf9 gets logged instead of the content. How can I enforce logging of a lazy sequence? I tried to wrap it with doall but it has no effect. Thx. Finn -- 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: Stanford ai-class
Hi Simon I originally thought that I'd be trying to implement things in > Clojure. In hindsight, while it's been interesting to look at the > programming assignments, I wouldn't have had time for something in > that depth. Have you tried? > No. But that was my initial plan as well to do it in clojure. So for the upcoming homeworks, I will do some in clojure if it makes sense and post the stuff on reddit (or maybe here) so I can get a code review. Finn -- 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: problems of a newbie
I second your comment regarding the PGP sig. -- 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
Stanford ai-class
Hi who is taking the Stanford ai-class with Peter Norvig and Sebastian Thrun? I remember there was a thread on this group in august. I'm doing now the advanced track and it is a lot of fun although we have no programming assignments (was dropped because of mass enrollment of 140K students). The campus students have programming assignments like pacman and this has to be done in python. The homework, which is due every week, is the same like the campus students have. Anyway, the lectures are more or less what you will find in Norvig's book AIMA (Artficial Intelligence, a Modern Approach). Interesting stuff like machine learning, bayes networks, and so on ... Finn -- 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: Leiningen: How to remove source code from uberjar
Great. Works! 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
Leiningen: How to remove source code from uberjar
Hello is there a way to tell Leinigen not to include the source code into the uberjar? I just want to ship the class files (AOT compiled). Thx. Finn -- 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
R.I.P. John McCarthy
John McCarthy, the father of Lisp, died last night at the age of 84. -- 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: Problem with insert-values (clojure.contrib.sql)
Yes, if I understand it correctly, instead of db, I just use the pooled-db It would be good to have an example that connects the pooled db stuff with the normal db stuff. (defn db-update-or-insert "Updates or inserts a fruit" [record] (sql/with-connection pooled-db (sql/update-or-insert-values :fruit ["name=?" (:name record)] record))) -- 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: Problem with insert-values (clojure.contrib.sql)
Sean, thx for the hint. But how do I use the connectionpool now from clojure.java.jdbc? (defn db-update-or-insert "Updates or inserts a fruit" [record] (sql/with-connection db (sql/update-or-insert-values :fruit ["name=?" (:name record)] record))) In my scenario, I just have one technical user that writes some data into a table. I just want to keep tha connection open all the time. Thx. - Finn -- 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: Problem with insert-values (clojure.contrib.sql)
oh yes. Now it works. Thanks for the quick response! BTW: Does someone know how I can keep the connection always open? If I understand it right, "with-connection" does a connect and login to the db each time it gets called. Isn't this quite inefficient? - Finn -- 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
Problem with insert-values (clojure.contrib.sql)
Houston, I have a problem: (sql/with-connection db_spec (sql/insert-values "MyTable" ["Number" "Name" "FloatValue"] [5, "A", 2.0] [6 ,"B", 3.0]) This works perfectly fine. Now I'm trying to do the following: (def x [[5, "A", 2.0] [6 ,"B", 3.0]]) (sql/with-connection db_spec (sql/insert-values "MyTable" ["Number" "Name" "FloatValue"] x)) I get the error: There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement How do I have to put x in the insert-values function? I guess it needs to be expaned somehow. I tried a couple of things (doall, doseq,...) No success.. Thanks. - Finn -- 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 in Emacs Seemingly Impossible
> > Also, if I can't get Emacs going, would anyone suggest an alternative > development tool? (I know there are lots, but I don't know which to > try first). > > I use IntelliJ IDEA with La Clojure and Leiningen plugin. I usually create a skeleton project with leiningen on the command line, then create an empty project from scratch in IntelliJ IDE and you're ready to go. It is really neat and IntelliJ has also Emacs keybinding if you want. - Finn -- 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
Land of Lisp music video
Just found this: http://www.youtube.com/watch?v=HM1Zb3xmvMc Awesome ... -- 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
Aw: Re: is there a 4Clojure forum anywhere?
joined the group and posted! Thx for setting it up. - Finn -- 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
Aw: is there a 4Clojure forum anywhere?
Hmm, I got stuck on the "Compress a sequence". I had a look at the clojure/core.clj distinct function and I guess I have to use something similar to define my function. Or is it easier? - finbeu -- 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
uberjar starts a repl
Hello, I have an application written that gets deployed using a uberjar built with leiningen. Works perfectly fine. For training purposes, I want to give a training version of that application that does not start the application (the -main routine) but a REPL so users can interactively use functions from the namespace and can explore it so that they end up with the same function calls like in the production version that has a -main function. How can I build such a uberjar that starts a repl instead of -main? The REPL should have also some nice editing features (I think I have to add jLine or how is it called?) Thx for any advice. - Finn -- 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
Aw: Re: How to import and use an enum enclosed in an java interface?
This works also! thx a lot. -- 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
Aw: Re: How to import and use an enum enclosed in an java interface?
Works! Ken, thx. -- 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
How to import and use an enum enclosed in an java interface?
Hello, how do I have to use an enum in clojure that is enclosed in an java interface? I decomplied it in IDEA and I got something like that: package com.api.test; public interface Foo { . . static final enum BarType { public static final ONE, public static final TWO, public static final THREE, public static final FOUR; } } How do I have to import and use that in clojure? I need to call a java method with such an enum but I can't get it to work although I have already done lots of guesswork. (:import (com.api.test Foo Foo.BarType)) ?? (let [ test (.theMethod myObject BlaBlaType.ONE) ]) Thanks for your help in advance. - Finn -- 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
Aw: Re: Clojure Books
- Practical Clojure (APress) is an excellent reference book. I use it all the time + the clojure cheat sheet. - Programming Clojure is good to start with, but I really didn't like all the Lancet stuff that was included as example. - Joy of clojure: Great. But not easy (was my third book). -Finn -- 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
Aw: clooj, a lightweight IDE for clojure
Arthur hi, that's cool! Just works out of the box! I will recommend it to everyone that wants to try clojure. - Finn -- 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
Aw: Re: How to add jar files to leiningen projects?
Yeah! I downgraded to 1.5.2 and now it works. Thanks a lot. Really nice. -- 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
Aw: Re: How to add jar files to leiningen projects?
Hi Shantanu, thanks a lot for that! Looks great. I just downloaded it, but now lein doesn't work anymore. It fails on windows using lein.bat. Even lein new blabla fails If I remove the plugin, lein works again. Brgds, - Finn C:\Documents and Settings\finn.beutel\My Documents\Clojure\lein>"java" - client -Xbootclasspath/a:"C:\Documents and Settings\finn.beutel\.m2\rep ository\org\clojure\clojure\1.2.1\clojure-1.2.1.jar" -Dleiningen.original.pwd=" C:\Documents and Settings\finn.beutel\My Documents\Clojure\lein" -cp "" "";".;%RSWJ%\Libs\rswa.jar";";C:\Documents and Settings\finn.beutel\.lein \plugins\lein-localrepo-0.1.1.jar";"";test;src;"C:\Documents and Settings\finn. beutel\.lein\self-installs\leiningen-1.6.0-standalone.jar" clojure.main -e "(use 'leiningen.core)(-main)" NUL Exception in thread "main" java.lang.NoClassDefFoundError: and Caused by: java.lang.ClassNotFoundException: and at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: and. Program will exit. -- 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
What's your workflow in IntelliJ IDEA
Hi, I'm using Jetbrains IntelliJ IDEA Community Edition with La Clojure and Leiningen Plug In. I think it is really great, but I have the feeling my workflow is not very efficient, it is a mix of invoking command lines (lein new myproject), then switching to IDEA, running lein commands from the plug in, compile, the running scripts from IDEA directly (Menu -> and Run), sometime I use lein run -m myproject.core to run it. I looks like that I'm not sure what to actually use. So how do you use IDEA with clojure? I think the way I use it is not very efficient ... - Finn -- 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
Aw: Re: How to add jar files to leiningen projects?
Hi Phil, leiningen is really great. I haven't used maven before so I was really scratching my head. Would be great to have an option like this so I don't have to run mvn on the command line. Thanks! - Finn -- 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
Aw: How to add jar files to leiningen projects?
That was fast. Makes sense. Thanks! - Finn -- 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
How to add jar files to leiningen projects?
Hello, I have some external jar libaries that I need to import in my clojure namespace. As I just started to use leinigen, I don't understand how to add them to my project. Let's say the library resides in c:\temp\jars\mylib.jar How do I add this properly to mein leinigen project? (defproject myproject "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.2.1"] [org.clojure/clojure-contrib "1.2.0"] [WHAT TO PUT IN HERE?]]) I assume I have to put that to .m2 repository but how? Thanks. - Finn -- 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
SQL queries on csv-files
Hello, I have a couple of csv files that are actually dumped data from SQL tables. These tables have proper relationships with key, foreign keys so they can be easily joined using SQL. I would like to load them into memory and then appy SQL queries on that data. So in fact, I'm looking for a clojure in-memory SQL database that allows me to slurp the csv files, treat them as tables and run sql queries on them. I already looked into clojure.set and this would work. But is there another library to look into? Maybe a clojure SQL set of macros that allow to issue "real" SQL queries? I don't want to install sqlite and jdbc-drivers and stuff like this. Just load csv file into memory and run SQL queries within clojure. Thx. Finn -- 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: How to create a library for java developers
Hi Ambrose, actually, I want to write this facade to learn how the java interop works. I'm still a beginner but calling java from clojure already works pretty good and I'm able to get things done faster with less code. The next step is then to make this clojure facade available for the java developers in our team. So it is a little be weird I know but it is fun to do it (I hope). Thanks for the links. I already found two intersting blog posts that deal with that stuff: http://blog.objectmentor.com/articles/2009/08/07/java-calling-clojure http://java.dzone.com/articles/java-clojure-interop-calling - Finn On 31 Mai, 11:45, Ambrose Bonnaire-Sergeant wrote: nterface from Java. > Could you elaborate why you are writing this facade? Eliminating > boilerplate? > So it is easier to call from Clojure? > > Ambrose -- 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
How to create a library for java developers
I'm using some legacy inhouse java libraries that are pretty complicated (lots of boilerplate and ugly code bloat to produce something useful). I would like to build a facade in clojure and provide a jar file so that this clojure facade can be easily used by java developers that do not know anything at all about clojure (they're scared to death when I show them clojure code). Is this possible? I mean in clojure we do not have "objects" and methods. So how would the java folks use my classes (the facade) that clojure complier produces? What would be a good design of my clojure code so that it can be used easily by java developers? I'm somehow lost as clojure is not OO. Thx. - Finn -- 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: Compojure: How to process GET query string
Got it! Works. Thx for the quick reply - FB On 18 Mai, 15:46, gaz jones wrote: > query string params appear in the params of the request: > > (GET "/math" {params :params} [] > (get params :a) ;; 1 -- 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
Compojure: How to process GET query string
Hi I don't know how to extract the query string from a route. I guess it is pretty simply but I don't get it. http://localhost:8080/math/add?a=1&b=2&c=3 I quess they can be retrieved somehow with :query-string keyword? But I have no clue how. (GET "/math/:command" [command & more] Thanks for your help. FB -- 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: Loading clojure code during runtime
beautiful! Thx. On 11 Mrz., 10:23, Benny Tsai wrote: > (read-string) converts a string into a Clojure object, which can then be > (eval)ed: -- 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
Loading clojure code during runtime
Hello, I'm still fairly new to Clojure but what I can say so far is that it is awesome :-) I'm currently implementing a cache as an atom that gets updates from an external application. I expose the cache items to clients via a webservice using compojure. Actually I return a list for each request. What I want to do now is to allow the consumers (clients) to apply a function to the list (with map) that my webservice returns. The definition of the function is saved in a file. So at runtime of my application (no restart of the application is allowed) , I want to read a file with the defintion of the function, apply the function with map to the list the clients request from my webservice and return the new list. I think this task is pretty simple to accomplish with clojure. But how would I do that? I think I need to eval the code somehow dynamically and use it. Thanks. - finbeu -- 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
Problem domains for clojure
Hi, are there (problem) domains for which clojure is especially well suited for? As an example, is it a good idea to build a mathematical library with it? I'm planning to do computational extensive stuff with clojure. Looks like that clojure is a good fit as I can leverage on existing java libraries (parallel colt) and so on ... - Finn -- 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: processing a socket stream
James thx. That is what I need for my project: Some coaching when to fall back to java, when to use clojure function and so on. That's cool. Rgds - Finn On 3 Mrz., 15:59, James Reeves wrote: > On 3 March 2011 14:39, finbeu wrote: > > > But I have right now no clue to do this (navigating to the stream > You're better off falling back to Java for this. Clojure doesn't yet -- 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: processing a socket stream
With my limited clojure skills I just managed to get the create-server up and running :-) Now I found out that I don't know how to do the following thing (sorry for my beginner questions): The stream arrives with a sequence of 10 characters. These 10 characters (e.g. 000190) give me the exact size (190 characters) of the next full xml-message. So I have to read 10 characters first, then the subsequent 190 characters which give me the xml-message, and so on and so forth But I have right now no clue to do this (navigating to the stream forth by a fixed number of bytes). Is there a clojure function to do this or do I have to fall back to java? Thanks. On 3 Mrz., 11:25, finbeu wrote: > 1/ I want to write a server in clojure that accepts the connection > from this client application, parses the xml-input stream and builds a > cache with the key/values received from xml-parsing this stream. > -- 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
processing a socket stream
Hello! I'm new to clojure and socket programming in particular and I kindly ask you to help me a little bit in how to design my application (all this is still overwhelming). This is a task I gave me to have something usefull while learning the clojure api: The scenario is as follows: I have a client application that connects to a server on a port, opens a socket stream and pumps in a stream of xml data. This streams never stops, but the protocol is simple, key/value data. That's it. 1/ I want to write a server in clojure that accepts the connection from this client application, parses the xml-input stream and builds a cache with the key/values received from xml-parsing this stream. 2/ I want to start threads within my server that do some work (get notified) each time the cache has new/updated items. My naive approach is as follows: 1) use create-server to build the server that accepts the socket connection 2) use an atom as the cache that gets updated by the input stream handler/thread 3) use futures to start my working threads But how do I notify my working threads that the cache was updated? Are there some (clojure) patterns that I can use? Also some boilerplate or examples would help me a lot to get started! :-) Thanks! - Finn (finbeu) -- 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: Problem establishing jdbc connection in la clojure REPL
Interesting, I can run the code by building it via "Run ..". It works fine within IDEA. But not via Idea's REPL. So no firewall issue (I have no zonealarm or any other local firewall running). Looks like the REPL in IDEA has really a problem establishing a socket connection. - Finn (finbeu) On 27 Feb., 20:20, Ken Wesson wrote: > According to MSDN: > > WSAEPROVIDERFAILEDINIT > 10106 > Service provider failed to initialize. -- 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
Problem establishing jdbc connection in la clojure REPL
Hi! I'm trying to run the code snippet (see at the end) from "la clojure"'s (IntelliJ 10.0.2) REPL but it fails with the error: "java.sql.SQLException: JZ006: Caught IOException: java.net.SocketException: Unrecognized Windows Sockets error: 10106: create (test.clj:3)." The driver's library (jConn3.jar) is in the classpath. To see if it works at all I checked the jdbc connection string using a java program with netbeans and it works perfectly fine. I can do select's and retrieve the rows. I gave it another try and ran the code via the REPL and clojure package that ships with Stuart's "Programming Clojure" and that was success! So I think there is a problem with my "la clojure" REPL. Looks like it does not allow me to establish a tcp/ip connection? Any ideas? - finbeu = (use 'clojure.contrib.sql) (def db {:classname "com.sybase.jdbc3.jdbc.SybDriver" ; must be in classpath :subprotocol "sybase:Tds" :subname "sybsrv01:4100" ; Any additional keys are passed to the driver ; as driver-specific properties. :user "test" :password "test12"}) (with-connection db (with-query-results rs ["select * from external_accounts"] (dorun (map #(println (:portfolio_id %)) rs == -- 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