Re: ANN: Zürich Clojure User Group
Hi Nando, Sure, it's in HG E 33.3. More details and a map can be found at the event page: http://www.meetup.com/zh-clj-Zurich-Clojure-User-Group/events/87505462/ We're looking forward to seeing you there! Thomas On Tuesday, October 23, 2012 12:17:04 PM UTC+2, Nando Breiter wrote: Thomas, Can you be more specific about the room, if it is already known? On Mon, Oct 22, 2012 at 8:00 PM, Thomas G. Kristensen thomas.g@gmail.com javascript: wrote: Hi Nando, The first meeting will be Monday 12 of November at 7 PM (more information at http://www.meetup.com/zh-clj-Zurich-Clojure-User-Group/events/87505462/). It will be held at ETH, but we are looking for new rooms, since our contact there is changing to a new firm. It will be in English - many people around here seem to be expats, and my German isn't good enough to perform technical discussions! Well met, Thomas On Monday, October 22, 2012 6:50:50 PM UTC+2, Nando Breiter wrote: Thomas, Have you organized location and time yet? Or is the meetup to be online? Will it be in German, Swiss-German, English? -- Nando Breiter *Aria Media via Rompada 40 6987 Caslano Switzerland* On Mon, Oct 22, 2012 at 10:37 AM, Thomas G. Kristensen thomas.g@gmail.com** wrote: Hi all, I'm happy to announce the Zürich Clojure User Group! http://www.meetup.com/zh-clj-**Zurich-Clojure-User-Group/http://www.meetup.com/zh-clj-Zurich-Clojure-User-Group/ Our first meetup will be Monday the 12th of November, and we're very excited about seeing as many Clojurians from Switzerland (and the surrounding countries) as possible. I have tried to add the group to http://dev.clojure.org/** display/community/Clojure+**User+Groupshttp://dev.clojure.org/display/community/Clojure+User+Groups-- but I have been unable to gain editing rights to the page. If anybody are able to help me in that, please get in touch. Well met! Thomas -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://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 clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Nando Breiter *Aria Media via Rompada 40 6987 Caslano Switzerland * -- 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
Adding user groups to community page
Hi all, I asked in the announcement thread of the Zürich user group if it was possible to get it listed on the Clojure communities site: http://dev.clojure.org/display/community/Clojure+User+Groups There doesn't seem to be any contact information on the site mentioned above. Does anyone know who to contact (and how) to fix this? Thomas -- 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: Adding user groups to community page
You can't edit the page when you're signed in? On Wed, Oct 24, 2012 at 10:02 AM, Thomas G. Kristensen thomas.g.kristen...@gmail.com wrote: Hi all, I asked in the announcement thread of the Zürich user group if it was possible to get it listed on the Clojure communities site: http://dev.clojure.org/display/community/Clojure+User+Groups There doesn't seem to be any contact information on the site mentioned above. Does anyone know who to contact (and how) to fix this? Thomas -- 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 -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you 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: Adding user groups to community page
Anyway, here's a list of users who could edit it and their contact... http://dev.clojure.org/pages/viewpreviousversions.action?pageId=1572956 On Wed, Oct 24, 2012 at 10:02 AM, Thomas G. Kristensen thomas.g.kristen...@gmail.com wrote: Hi all, I asked in the announcement thread of the Zürich user group if it was possible to get it listed on the Clojure communities site: http://dev.clojure.org/display/community/Clojure+User+Groups There doesn't seem to be any contact information on the site mentioned above. Does anyone know who to contact (and how) to fix this? Thomas -- 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 -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you 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
ANN Monger 1.3.0 is released
Monger (http://clojuremongodb.info) is an idiomatic Clojure MongoDB driver for a more civilized age. `1.3.0` is a minor *100% backwards-compatible* release that includes an important bug fix in the updated MongoDB Java driver. We recommend all users to upgrade to it as soon as possible. ## Changes in 1.3.0 ### monger.core/disconnect! `monger.core/disconnect!` is a new function that closes the default database connection. ### Ragtime 0.3.0 Ragtime dependency has been updated to 0.3.0. ### MongoDB Java Driver Update MongoDB Java driver dependency has been updated to 2.9.2 [1]. This includes *an important bug fix*: JAVA-660 [2]. ### Cheshire Support `monger.json` and `monger.joda-time` will now use Cheshire [3] if it is available. clojure.data.json is no longer a hard dependency (but `0.1.x` versions are still supported if available). Recently released `clojure.data.json` version `0.2.0` completely breaks public API and is not supported in this release. ### ClojureWerkz Support 0.7.0 ClojureWerkz Support library is upgraded to `0.7`. ## Change Log We recommend all users to upgrade to 1.3.0 [5] as soon as possible. Full Monger change log [6] is available on GitHub. 1. https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10006version=11891 2. https://jira.mongodb.org/browse/JAVA-660 3. https://github.com/dakrone/cheshire 4. https://github.com/clojure/data.json 5. https://clojars.org/com.novemberain/monger/versions/1.3.0 6. https://github.com/michaelklishin/monger/blob/master/ChangeLog.md -- MK -- 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: Some Friend documentation and regarding documentation in general
On Wednesday, October 24, 2012 3:10:52 AM UTC+1, David Della Costa wrote: Patrik, Pierre, have you folks checked out the mock app that Chas created in the test directory? It's not going to give you everything you're looking for but make it can help. There is an implementation of the OpenID workflow in there, including a credential-fn example: https://github.com/cemerick/friend/blob/master/test/test_friend/mock_app.clj Been digesting that and reading the OpenID workflow + the openid2java docs to work out what inputs mean what. I'm not quite there yet but starting to have some idea, will experiment today to get auth with Google Account up and running. This may also help, regarding credential functions: https://github.com/cemerick/friend/blob/master/test/test_friend/credentials.clj I also highly recommend looking at the bcrypt-credential-fn in the credentials.clj lib, in the src of the project itself: https://github.com/cemerick/friend/blob/master/src/cemerick/friend/credentials.clj The credentials I grok more easily than the workflow - or more specifically the openid workflow. The form based auth workflow is a lot easier for me to follow, no probs there. That I find the openid workflow more obtuse probably means I don't get OpenID quite yet so will do some standard reading there as well. This is the default credentials function used in the mock app above, so it should help illustrate some of the concepts. I've spent a lot of time poring over the code too, so feel free to ping me with questions too, I may be able to help. IMHO the doc is really lacking and I have to say I was expecting more guidance in the code itself. Yes, it's still hard to wrap your head around the docs. Friend scratches an itch I have, and I think it's going to be rather important if people are trying to web apps quickly in Clojure, so I'm going to keep working on it and see how much I can clean things up and make concepts more clear. And I know Chas is interested in this as well, from his past comments. Any help and pull requests are welcome. ;-) I'm working on some updates to everything I've been working on, I'll post updates to the list shortly (later this week probably, maybe even today). Agreed. Happy to contribute a working google acc openid auth once I get there. Patrik DD 2012/10/24 Pierre R p.rade...@gmail.com javascript:: Thanks David for the extra doc. I have had a try with OpenID. Everything works kind of expected. I had a question about 302 redirection prior to authentication that I posted on github. Another question is how to link the concept of roles with the openid credentials. IMHO the doc is really lacking and I have to say I was expecting more guidance in the code itself. I guess a lot of stuff obvious to an experienced clojure developers are still dark magic to me. In particular it is rather difficult to understand how to write a crendential-fn and this link won't help you ;-) https://github.com/cemerick/friend/blob/master/docs/credentials.md For OpenId I have blindly used the identity function without much understanding ... I am using Friend to scratch a little auth server. Not sure it is the best fit for that purpose. I will see. I hope Friend is going to be reviewed by an extended community of people much more qualified than myself to talk about such matter. Still docs could be improved and I believe helps could come from pull requests to suggest the addition of code comments there and there. If I dig far enough in the code, I would be pleased to help. Thanks for the hard work. Cheers, Le mardi 23 octobre 2012 17:50:25 UTC+2, Patrik Sundberg a écrit : These are great tutorials. Thanks for publishing. Right now I'm looking for something similar using the OpenID workflow. I see it's there but how I use to for example create a sign in with google setup is less clear to me. Has anyone got a good OpenID example out there somewhere? On Saturday, October 6, 2012 4:50:05 PM UTC+1, David Della Costa wrote: Hi folks, I've been pretty slack in communicating via the mailing list, but I realized today that there is a lot of important dialogue going on here so I have to make more of an effort to take part--I want to be a part of this community! In any case, I've been using Friend a lot lately, since I come from Ruby-on-Rails-land, and it addresses a lot of the pain points that Devise does for me. But (as has been mentioned in other threads quite recently), documentation is definitely the Clojure community's week point: it's inconsistent, formatted inconsistently (Ring and Compojure, for example, are wonderful exceptions), and updated erratically. When it's good, it's great; but when it's not, it puts me off from using a
Troubles working with nl.bitwalker.useragentutils
Hi all, I'm having troubles trying to make nl.bitwalker.useragentutils to work with my small project. The problem with this package starts from the beginning -- since the latest version (1.6) is not in Maven Central or Clojars repo, I had to install it manually, using following command: $ mvn install:install-file -Dfile=UserAgentUtils-1.6.jar -DgroupId=nl.bitwalker -DartifactId=UserAgentUtils -Dpackaging=jar -Dversion=1.6 -DgeneratePom=true -DcreateChecksum=true after that I've updated project.clj to look like this (I'm using lein2, btw).: (defproject helloworld 0.1.0-SNAPSHOT :main helloworld.core :dependencies [[org.clojure/clojure 1.4.0] [nl.bitwalker/useragentutils 1.6]]) lein deps runs just fine, but trying to import the package in the namespace fails with the following exception: java.lang.ClassNotFoundException: nl.bitwalker.useragentutils.UserAgent. Here's the complete helloworld/core.clj listing: (ns helloworld.core (:import [nl.bitwalker.useragentutils UserAgent]) (:gen-class :main true)) (defn -main [ args] (println Hello World!)) Now, changing the import to look like (:import [nl.bitwalker.useragentutils.UserAgent]) actually makes the compile succeed, but then I have no idea how to access UserAgent class, since neither (UserAgent. ) nor (nl.bitwalker.useragentutils/UserAgent. ) works when trying to compile the project. I'm completely lost here. Any tips? Maybe somebody has experience working with other UA parsing libraries? Thanks. P.S. I have 0 experience with Java, so I might be doing something horrendously stupid. -- 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: friend-oauth2 0.0.2
Hi folks, for those with interest: friend-oauth2 is an oauth2 workflow for Chas Emerick's Friend library. https://github.com/ddellacosta/friend-oauth2 (Examples were also updated to conform to changes: https://github.com/ddellacosta/friend-oauth2-examples) Changelog 0.0.1 - 0.0.2 * Added tests! Refactored! * A helper function has been added (format-config-uri) to configure the redirect url in the config. * :redirect-uri in the uri-config has been renamed to :authentication-uri, as it more closely matches the RFC (and it actually makes sense) * The access-token-parsefn functionality has been tweaked. If the access-token is returned as defined in the spec (http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-5.1, as application/json), then it will automatically handle that. Otherwise you can still pass in the access-token-parsefn to override, and it will use that. See the Facebook and Github examples for reference. Note that this function also now takes the entire response, rather than just the body. Cheers, Dave -- 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: [ANN] nrepl.el 0.1.5 released
Thanks so much for working on nREPL.el, Tim. -S -- 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
pst shows the cause instead of the last thrown ex thus it doesn't show the chain
Here, (pst) doesn't see the thrown exception which is a, it's seeing only it's cause: = *(try (throw (Exception. a (Exception. cause))) (catch Exception e (throw e)))* *(pst 123912031)* Exception cause datest1.core/eval3129 (NO_SOURCE_FILE:1) Exception cause datest1.core/eval3129 (NO_SOURCE_FILE:1) clojure.lang.Compiler.eval (Compiler.java:6603) clojure.lang.Compiler.eval (Compiler.java:6566) clojure.core/eval (core.clj:2836) clojure.main/repl/read-eval-print--6667 (main.clj:245) clojure.main/repl/fn--6672/fn--6673 (main.clj:266) clojure.main/repl/fn--6672 (main.clj:266) clojure.main/repl (main.clj:264) clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn--938 (interruptible_eval.clj:58) clojure.core/apply (core.clj:614) clojure.core/with-bindings* (core.clj:1785) clojure.tools.nrepl.middleware.interruptible-eval/evaluate (interruptible_eval.clj:43) clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn--979/fn--982 (interruptible_eval.clj:173) clojure.core/comp/fn--4092 (core.clj:2314) clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn--972 (interruptible_eval.clj:140) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603) java.lang.Thread.run (Thread.java:722) nil ;or, the same thing with this: = *(throw (Exception. a (Exception. cause)))* Exception cause datest1.core/eval3133 (NO_SOURCE_FILE:1) = *(pst 21872912)* Exception cause datest1.core/eval3133 (NO_SOURCE_FILE:1) clojure.lang.Compiler.eval (Compiler.java:6603) clojure.lang.Compiler.eval (Compiler.java:6566) clojure.core/eval (core.clj:2836) clojure.main/repl/read-eval-print--6667 (main.clj:245) clojure.main/repl/fn--6672/fn--6673 (main.clj:266) clojure.main/repl/fn--6672 (main.clj:266) clojure.main/repl (main.clj:264) clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn--938 (interruptible_eval.clj:58) clojure.core/apply (core.clj:614) clojure.core/with-bindings* (core.clj:1785) clojure.tools.nrepl.middleware.interruptible-eval/evaluate (interruptible_eval.clj:43) clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn--979/fn--982 (interruptible_eval.clj:173) clojure.core/comp/fn--4092 (core.clj:2314) clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn--972 (interruptible_eval.clj:140) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603) java.lang.Thread.run (Thread.java:722) nil But here, (pst) shows the exceptions correctly (chained) shows the last thrown exception which is a and it's cause: = *(pst (try (throw (Exception. a (Exception. cause))) (catch Exception e e)))* Exception a datest1.core/eval3125/fn--3126 (NO_SOURCE_FILE:1) datest1.core/eval3125 (NO_SOURCE_FILE:1) clojure.lang.Compiler.eval (Compiler.java:6603) clojure.lang.Compiler.eval (Compiler.java:6566) clojure.core/eval (core.clj:2836) clojure.main/repl/read-eval-print--6667 (main.clj:245) clojure.main/repl/fn--6672/fn--6673 (main.clj:266) clojure.main/repl/fn--6672 (main.clj:266) clojure.main/repl (main.clj:264) clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn--938 (interruptible_eval.clj:58) clojure.core/apply (core.clj:614) clojure.core/with-bindings* (core.clj:1785) Caused by: Exception cause datest1.core/eval3125/fn--3126 (NO_SOURCE_FILE:1) datest1.core/eval3125 (NO_SOURCE_FILE:1) nil So what is going on here? Bug ? = *clojure-version* {:major 1, :minor 5, :incremental 0, :qualifier alpha6} I also just tested with alpha7, same thing. -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you 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: Troubles working with nl.bitwalker.useragentutils
wow I can't believe that worked, I mean look: (ns helloworld.core * (:import nl.bitwalker.useragentutils.UserAgent)* (:gen-class :main true)) (defn -main [ args] * (println (UserAgent/parseUserAgentString uas))* ) this works, but replace the import line with either this: *(:import [nl.bitwalker.useragentutils.UserAgent])* or this: *(:import (nl.bitwalker.useragentutils.UserAgent))* and you get this error: c:\1\helloworldlein compile Compiling helloworld.core Exception in thread main java.lang.RuntimeException: No such namespace: UserAgent, compiling:(helloworld/core.clj:7) at clojure.lang.Compiler.analyze(Compiler.java:6281) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3497) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6457) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3548) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6457) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5618) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5054) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3674) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler.compile1(Compiler.java:7030) at clojure.lang.Compiler.compile(Compiler.java:7097) at clojure.lang.RT.compile(RT.java:387) at clojure.lang.RT.load(RT.java:427) at clojure.lang.RT.load(RT.java:400) at clojure.core$load$fn__4890.invoke(core.clj:5415) at clojure.core$load.doInvoke(core.clj:5414) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5227) at clojure.core$compile$fn__4895.invoke(core.clj:5426) at clojure.core$compile.invoke(core.clj:5425) at user$eval31.invoke(NO_SOURCE_FILE:1) at clojure.lang.Compiler.eval(Compiler.java:6511) at clojure.lang.Compiler.eval(Compiler.java:6501) at clojure.lang.Compiler.eval(Compiler.java:6477) at clojure.core$eval.invoke(core.clj:2797) at clojure.main$eval_opt.invoke(main.clj:297) at clojure.main$initialize.invoke(main.clj:316) at clojure.main$null_opt.invoke(main.clj:349) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:419) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) Caused by: java.lang.RuntimeException: No such namespace: UserAgent at clojure.lang.Util.runtimeException(Util.java:170) at clojure.lang.Compiler.resolveIn(Compiler.java:6736) at clojure.lang.Compiler.resolve(Compiler.java:6710) at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6671) at clojure.lang.Compiler.analyze(Compiler.java:6244) ... 46 more Compilation failed. The error doesn't help you solve the problem... which is: don't pass a seq to :import Thank you HH. On Wed, Oct 24, 2012 at 2:58 PM, Herwig Hochleitner hhochleit...@gmail.comwrote: 2012/10/24 Andrii V. Mishkovskyi misho...@gmail.com lein deps runs just fine, but trying to import the package in the namespace fails with the following exception: java.lang.ClassNotFoundException: nl.bitwalker.useragentutils.UserAgent. Here's the complete helloworld/core.clj listing: (ns helloworld.core (:import [nl.bitwalker.useragentutils UserAgent]) (:gen-class :main true)) Not sure why that doesn't work. The idimatic form, however, is either: (ns ... (:import pgk.ClassName)) or the prefix list form with round parens (ns ... (:import (pkg ClassNameA ClassNameB ...))) Now, changing the import to look like (:import [nl.bitwalker.useragentutils.UserAgent]) actually makes the compile succeed, but then I have no idea how to access UserAgent class, since neither (UserAgent. ) nor (nl.bitwalker.useragentutils/UserAgent. ) works when trying to compile the project. The constructor takes a String argument. There is also a static factory, which is IMO preferrable:
Re: Troubles working with nl.bitwalker.useragentutils
On 24/10/12 14:41, AtKaaZ wrote: The error doesn't help you solve the problem... which is: don't pass a seq to :import You can easily pass seqs to :import...this works fine for me (importing 3 classes from the same package): (:import [encog_java.customGA CustomNeuralGeneticAlgorithm CustomGeneticScoreAdapter Referee]) you just need a space after the package-name... try *(:import [nl.bitwalker.useragentutils UserAgent]) *hope that helps Jim -- 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: Troubles working with nl.bitwalker.useragentutils
aaa sorry I can see from a previous post that you already tried that! this is strange! Jim On 24/10/12 14:48, Jim foo.bar wrote: On 24/10/12 14:41, AtKaaZ wrote: The error doesn't help you solve the problem... which is: don't pass a seq to :import You can easily pass seqs to :import...this works fine for me (importing 3 classes from the same package): (:import [encog_java.customGA CustomNeuralGeneticAlgorithm CustomGeneticScoreAdapter Referee]) you just need a space after the package-name... try *(:import [nl.bitwalker.useragentutils UserAgent]) *hope that helps Jim -- 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: Troubles working with nl.bitwalker.useragentutils
no no I didn't try that, you are right, it works with space and I understand why now(avoid repeating the pkg) * (:import [nl.bitwalker.useragentutils UserAgent])* I guess what I was trying to say is that, it's too easy to make the mistake and the error wouldn't help you. Thanks. On Wed, Oct 24, 2012 at 3:49 PM, Jim foo.bar jimpil1...@gmail.com wrote: aaa sorry I can see from a previous post that you already tried that! this is strange! Jim On 24/10/12 14:48, Jim foo.bar wrote: On 24/10/12 14:41, AtKaaZ wrote: The error doesn't help you solve the problem... which is: don't pass a seq to :import You can easily pass seqs to :import...this works fine for me (importing 3 classes from the same package): (:import [encog_java.customGA CustomNeuralGeneticAlgorithm CustomGeneticScoreAdapter Referee]) you just need a space after the package-name... try *(:import [nl.bitwalker.useragentutils UserAgent]) *hope that helps Jim -- 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 -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you 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: Troubles working with nl.bitwalker.useragentutils
I'm completely lost here. Any tips? Maybe somebody has experience working with other UA parsing libraries? Hi Andrii, I have used the same library you are attempting to use in the past and it has worked well. My needs were simple and I found the bitwalker lib to be a great library for those needs. Here is working code showing how I used it (note, you can get more data from it but I was only interested in a subset): (ns rbl.feature-extraction.user-agent (:use [clojure.core.memoize :only [memo]]) (:require [clojure.tools.logging :as log]) (:import [nl.bitwalker.useragentutils UserAgent DeviceType Browser OperatingSystem])) (defn str-features [string] (try (let [user-agent (UserAgent. (or string ))] {:browser_group (- user-agent .getBrowser .getGroup .getName) :os_group (- user-agent .getOperatingSystem .getGroup .getName) :device_type (- user-agent .getOperatingSystem .getDeviceType .getName)}) (catch Exception e (log/error (str Could not derive the user-agent from string) e) (str-features nil (def possible-features (memo (fn [] {:os_group (set (map #(- % .getGroup .getName) (OperatingSystem/values))) :browser_group (set (map #(- % .getGroup .getName) (Browser/values))) :device_type (set (map #(.getName %) (DeviceType/values)))}))) In gist form along with some midje facts: https://gist.github.com/3946906 Hope that helps, Ben -- 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: ANN Monger 1.3.0 is released
If I upgrade right now I can remove clojure.data.json from my dependencies and still use monger.joda-time without any problem ? Or I have to put chesire in the dependency ? On Wednesday, October 24, 2012 10:58:21 AM UTC+2, Michael Klishin wrote: Monger (http://clojuremongodb.info) is an idiomatic Clojure MongoDB driver for a more civilized age. `1.3.0` is a minor *100% backwards-compatible* release that includes an important bug fix in the updated MongoDB Java driver. We recommend all users to upgrade to it as soon as possible. ## Changes in 1.3.0 ### monger.core/disconnect! `monger.core/disconnect!` is a new function that closes the default database connection. ### Ragtime 0.3.0 Ragtime dependency has been updated to 0.3.0. ### MongoDB Java Driver Update MongoDB Java driver dependency has been updated to 2.9.2 [1]. This includes *an important bug fix*: JAVA-660 [2]. ### Cheshire Support `monger.json` and `monger.joda-time` will now use Cheshire [3] if it is available. clojure.data.json is no longer a hard dependency (but `0.1.x` versions are still supported if available). Recently released `clojure.data.json` version `0.2.0` completely breaks public API and is not supported in this release. ### ClojureWerkz Support 0.7.0 ClojureWerkz Support library is upgraded to `0.7`. ## Change Log We recommend all users to upgrade to 1.3.0 [5] as soon as possible. Full Monger change log [6] is available on GitHub. 1. https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10006version=11891 2. https://jira.mongodb.org/browse/JAVA-660 3. https://github.com/dakrone/cheshire 4. https://github.com/clojure/data.json 5. https://clojars.org/com.novemberain/monger/versions/1.3.0 6. https://github.com/michaelklishin/monger/blob/master/ChangeLog.md -- MK -- 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: after a few days, my app dies -- how should I diagnose?
I would be happy to run it in screen but I don't understand what the advantage is. I can redirect the output to a log, without using screen, and I can automate restarts with something like Puppet or Supervisor. What do I need screen for? On Tuesday, October 23, 2012 7:37:03 AM UTC-4, Hubert Iwaniuk wrote: Not sure if that is a case but could your run your software in some long running shell like tmux or screen. You redirected all standard file descriptors, so it should not be a problem, but it is worth a try. HTH, Hubert. AtKaaZ wrote: You could save the std out and err to some .log and can inspect it later, I'd expect you'd see some exceptions if any were thrown. who-is-logged-in-1.0.1-standalone.jar 4 /dev/null stdouterr.log On Tue, Oct 23, 2012 at 12:12 AM, Michael Klishin michael@gmail.comjavascript: wrote: 2012/10/23 larry google groups lawrenc...@gmail.com javascript: If memory is not the problem, what other problems should I look for? Unhandled exceptions, although in the case of a Web app, Jetty and similar should cover last resort exception handling that will prevent main JVM thread from terminating. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you do ;) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: 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: after a few days, my app dies -- how should I diagnose?
If you run your process in screen/tmux it will be attached to active TTY, it will not receive HUP signal. Also if there would be important (any?) output from process you will see it in tmux/screen. So either nohup it or run it in session that doesn't terminate after you exit. HTH, Hubert. larry google groups wrote: I would be happy to run it in screen but I don't understand what the advantage is. I can redirect the output to a log, without using screen, and I can automate restarts with something like Puppet or Supervisor. What do I need screen for? On Tuesday, October 23, 2012 7:37:03 AM UTC-4, Hubert Iwaniuk wrote: Not sure if that is a case but could your run your software in some long running shell like tmux or screen. You redirected all standard file descriptors, so it should not be a problem, but it is worth a try. HTH, Hubert. AtKaaZ wrote: You could save the std out and err to some .log and can inspect it later, I'd expect you'd see some exceptions if any were thrown. who-is-logged-in-1.0.1-standalone.jar 4 /dev/null stdouterr.log On Tue, Oct 23, 2012 at 12:12 AM, Michael Klishin michael@gmail.com javascript: wrote: 2012/10/23 larry google groups lawrenc...@gmail.com javascript: If memory is not the problem, what other problems should I look for? Unhandled exceptions, although in the case of a Web app, Jetty and similar should cover last resort exception handling that will prevent main JVM thread from terminating. -- MK http://github.com/michaelklishin http://github.com/michaelklishin http://twitter.com/michaelklishin http://twitter.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en http://groups.google.com/group/clojure?hl=en -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you do ;) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en 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: after a few days, my app dies -- how should I diagnose?
This is a very ignorant question on my part, but if I use screen to capture the output, then isn't the output being held in memory? I guess I don't know much about how the server manages terminal memory. I suppose if the terminal is set to only keep 10,000 lines (which I think is true on my server), then I would never have to worry about more than 10,000 lines being held in memory, which is not too much trouble. Or I could run this inside of a shell inside of emacs inside of shell (which I often do) and then rely on emacs to be sure that the shell doesn't use up the server's memory? Actually, this is a good idea. I'll do this. On Wednesday, October 24, 2012 2:11:19 PM UTC-4, Hubert Iwaniuk wrote: If you run your process in screen/tmux it will be attached to active TTY, it will not receive HUP signal. Also if there would be important (any?) output from process you will see it in tmux/screen. So either nohup it or run it in session that doesn't terminate after you exit. HTH, Hubert. larry google groups wrote: I would be happy to run it in screen but I don't understand what the advantage is. I can redirect the output to a log, without using screen, and I can automate restarts with something like Puppet or Supervisor. What do I need screen for? On Tuesday, October 23, 2012 7:37:03 AM UTC-4, Hubert Iwaniuk wrote: Not sure if that is a case but could your run your software in some long running shell like tmux or screen. You redirected all standard file descriptors, so it should not be a problem, but it is worth a try. HTH, Hubert. AtKaaZ wrote: You could save the std out and err to some .log and can inspect it later, I'd expect you'd see some exceptions if any were thrown. who-is-logged-in-1.0.1-standalone.jar 4 /dev/null stdouterr.log On Tue, Oct 23, 2012 at 12:12 AM, Michael Klishin michael@gmail.comwrote: 2012/10/23 larry google groups lawrenc...@gmail.com If memory is not the problem, what other problems should I look for? Unhandled exceptions, although in the case of a Web app, Jetty and similar should cover last resort exception handling that will prevent main JVM thread from terminating. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you do ;) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@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 clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: 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: after a few days, my app dies -- how should I diagnose?
(into {} (filter #(- % val is-current?) map-of-all-user-maps) I tested this and it works. I admit it is a bit of magic Clojure-fu wizardry that is a bit over my head. I am again impressed with how concise Clojure can be. On Monday, October 22, 2012 3:09:39 PM UTC-4, Aaron Cohen wrote: On Mon, Oct 22, 2012 at 2:54 PM, Aaron Cohen aa...@assonance.orgjavascript: wrote: On Mon, Oct 22, 2012 at 2:51 PM, Aaron Cohen aa...@assonance.orgjavascript: wrote: I think that what you are doing here is something like the following?: (into {} (keep #(is-current? %2) map-of-all-user-maps) Bah, used the wrong function, since keep works on nil/not-nil this should be: (into {} (filter #(is-current? %2) map-of-all-user-maps) Or maybe my mental compiler is a little broken and that should be: (into {} (filter #(- % val is-current?) map-of-all-user-maps) As to why your app dies after a couple of days. It may because of continually re-def'ing updated-registry, but it may not be. What do your ring routes look like, and what are you using to serve your web app? -- 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-mongodb] Re: ANN Monger 1.3.0 is released
2012/10/24 Jeremy W. Sherman jeremyw.sher...@gmail.com I'm getting a compiler error on changing the dependency to 1.3.0, Exception in thread main java.lang.ClassNotFoundException: clojure.data.json, compiling:(clojurewerkz/support/json.clj:24) It looks like that line ( https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L24) is: (extend-protocol clojure.data.json/Write-JSON clojure.data.json is no longer a Monger (technically, clojurewerkz/support) dependency, it is mentioned in the change log: https://github.com/michaelklishin/monger/blob/master/ChangeLog.md Suggestions? In the meantime, I'm dropping back to 1.2.0. If you use monger.json without direct clojure.data.json usage, just add Cheshire to your dependencies. clojure.data.json 0.2 is NOT supported as it completely breaks public API. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- 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
Check that a protocol exists
Is there a way to check if a protocol exists? For example, if I want to extend clojure.data.json protocols but only if it is available, how would I go about it? This way does not work at least some of the time (referenced namespace causes a ClassNotFound exception during compilation): https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33 Any better solutions? I'd like to avoid adding any new dependencies, if possible. Thank you in advance. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- 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: Check that a protocol exists
What about the technique Clojure uses in the reducers library? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L37 -BG On Wed, Oct 24, 2012 at 12:20 PM, Michael Klishin michael.s.klis...@gmail.com wrote: Is there a way to check if a protocol exists? For example, if I want to extend clojure.data.json protocols but only if it is available, how would I go about it? This way does not work at least some of the time (referenced namespace causes a ClassNotFound exception during compilation): https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33 Any better solutions? I'd like to avoid adding any new dependencies, if possible. Thank you in advance. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- 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 -- Baishampayan Ghose b.ghose at gmail.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: Check that a protocol exists
you can check for the existence of the protocol's var just like you would for any var. not sure what B. Ghose is getting at, but I would recommend not checking for the existence of the interface. http://clojure.org/vars On Wed, Oct 24, 2012 at 12:23 PM, Baishampayan Ghose b.gh...@gmail.com wrote: What about the technique Clojure uses in the reducers library? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L37 -BG On Wed, Oct 24, 2012 at 12:20 PM, Michael Klishin michael.s.klis...@gmail.com wrote: Is there a way to check if a protocol exists? For example, if I want to extend clojure.data.json protocols but only if it is available, how would I go about it? This way does not work at least some of the time (referenced namespace causes a ClassNotFound exception during compilation): https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33 Any better solutions? I'd like to avoid adding any new dependencies, if possible. Thank you in advance. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- 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 -- Baishampayan Ghose b.ghose at gmail.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 -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- 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: Check that a protocol exists
I take it it's not possible via this? = (doc find-protocol-impl) - clojure.core/find-protocol-impl ([protocol x]) nil nil (implying I've no idea what protocols are) But I'm currently trying to do something similar in a way, I need to return a map from a macro to which I pass a symbol which may or may not be defined... (that compile-if won't work for me) On Wed, Oct 24, 2012 at 9:20 PM, Michael Klishin michael.s.klis...@gmail.com wrote: Is there a way to check if a protocol exists? For example, if I want to extend clojure.data.json protocols but only if it is available, how would I go about it? This way does not work at least some of the time (referenced namespace causes a ClassNotFound exception during compilation): https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33 Any better solutions? I'd like to avoid adding any new dependencies, if possible. Thank you in advance. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- 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 -- I may be wrong or incomplete. Please express any corrections / additions, they are encouraged and appreciated. At least one entity is bound to be transformed if you 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
ANN expectations-mode 0.0.3
Hi, expectations-mode is an Emacs mode for running tests written using the expectations library: https://github.com/jaycfields/expectations. I have just released expectations-mode 0.0.3 which now runs under nrepl (no longer supports swank-clojure). It is in marmalade: http://marmalade-repo.org/packages/expectations-mode, and the repo lives here: https://github.com/gar3thjon3s/expectations-mode. If you use swank-clojure, stick with 0.0.2! Congrats to the maintainers of nrepl.el, it was very easy to convert over to use it :) Thanks, Gareth -- 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
core.logic for constraint logic programming
I'm looking into rewriting Storm's resource scheduler using core.logic. I want to be able to say constraints like: 1. Topology A's slots should be = 10 and as close to 10 as possible (minimize the delta between assigned slots and 10) 2. All topologies should use less than 200 CPU's and less than 600 GB of memory 3. Topology B should run at most 2 workers on each host 4. Each worker for topology C should run at most one task for component X and one task for component Y 5. Should minimize the amount of reassignment to running topologies in order to satisfy constraints 6. Should only be allowed to reassign workers for an individual topology whose individual constraints are satisfied once every 10 minutes And so on. I have two questions: 1. How good is core.logic at culling the search space using arithmetic logic? For example, if it knows that x + y = 5, x=0, and y=0, it should never bother with areas of the search space where x or y are =5. 2. Can core.logic do things like search the space for which my evaulation criteria are minimized? Or is what we're trying to do a better fit for different techniques like linear programming? -- 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: core.logic for constraint logic programming
On Wed, Oct 24, 2012 at 4:56 PM, nathanmarz nathan.m...@gmail.com wrote: I'm looking into rewriting Storm's resource scheduler using core.logic. I want to be able to say constraints like: 1. Topology A's slots should be = 10 and as close to 10 as possible (minimize the delta between assigned slots and 10) The minimization bit is not in core.logic yet. But basically anything in Mozart/OZ's Finite Domain Constraint Programming feature set is on the table for core.logic :) 2. All topologies should use less than 200 CPU's and less than 600 GB of memory 3. Topology B should run at most 2 workers on each host 4. Each worker for topology C should run at most one task for component X and one task for component Y 5. Should minimize the amount of reassignment to running topologies in order to satisfy constraints 6. Should only be allowed to reassign workers for an individual topology whose individual constraints are satisfied once every 10 minutes Yep definitely sounds like the kind of thing I'd like core.logic to be used for. And so on. I have two questions: 1. How good is core.logic at culling the search space using arithmetic logic? For example, if it knows that x + y = 5, x=0, and y=0, it should never bother with areas of the search space where x or y are =5. While there's always room to improve it already does this well. 2. Can core.logic do things like search the space for which my evaulation criteria are minimized? Or is what we're trying to do a better fit for different techniques like linear programming? It can, but I need to sit down and figure out how to make that work. If I recall the Mozart/OZ work is pretty clear about their approach and I think it can easily be adapted. I'll try to find some time and get back to you on that. David -- 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: ANN: data.json 0.2.0
I've filed an issue about adding a compatibility layer with 0.1.x: http://dev.clojure.org/jira/browse/DJSON-5?focusedCommentId=29796#comment-29796 According to ClojureSphere, clojure.data.json is relied on by just 340+ open source projects: http://www.clojuresphere.com/org.clojure/data.json Not asking the community about such extensive changes (at least some of which are basically cosmetics) first was a mistake. MK -- 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
[java interop] downcast
Hello Group, the Java API I'm currently working with expects that an Interface is downcasted to a concrete class. As a quick test I toyed with this: (cast Integer (cast Number 1)) ClassCastException Cannot cast java.lang.Long to java.lang.Integer java.lang.Class.cast (Class.java:3007) It seems the clojure cast does not work like the java cast. Is there a way to do this Clojure? A not so nice alternative is to write the cast stuff in java. TIA Steffen -- 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: core.logic for constraint logic programming
Cool, thanks for the quick response. We'll be looking into this pretty soon. I ultimately want the logic engine itself being exposed to users so they can add their own company-specific constraints to resource scheduling – which will be totally badass. If you're interested in tracking this, I opened up an issue on Storm: https://github.com/nathanmarz/storm/issues/383 On Oct 24, 2:07 pm, David Nolen dnolen.li...@gmail.com wrote: On Wed, Oct 24, 2012 at 4:56 PM, nathanmarz nathan.m...@gmail.com wrote: I'm looking into rewriting Storm's resource scheduler using core.logic. I want to be able to say constraints like: 1. Topology A's slots should be = 10 and as close to 10 as possible (minimize the delta between assigned slots and 10) The minimization bit is not in core.logic yet. But basically anything in Mozart/OZ's Finite Domain Constraint Programming feature set is on the table for core.logic :) 2. All topologies should use less than 200 CPU's and less than 600 GB of memory 3. Topology B should run at most 2 workers on each host 4. Each worker for topology C should run at most one task for component X and one task for component Y 5. Should minimize the amount of reassignment to running topologies in order to satisfy constraints 6. Should only be allowed to reassign workers for an individual topology whose individual constraints are satisfied once every 10 minutes Yep definitely sounds like the kind of thing I'd like core.logic to be used for. And so on. I have two questions: 1. How good is core.logic at culling the search space using arithmetic logic? For example, if it knows that x + y = 5, x=0, and y=0, it should never bother with areas of the search space where x or y are =5. While there's always room to improve it already does this well. 2. Can core.logic do things like search the space for which my evaulation criteria are minimized? Or is what we're trying to do a better fit for different techniques like linear programming? It can, but I need to sit down and figure out how to make that work. If I recall the Mozart/OZ work is pretty clear about their approach and I think it can easily be adapted. I'll try to find some time and get back to you on that. David -- 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: core.logic for constraint logic programming
On 10/24/12 2:56 PM, nathanmarz wrote: I'm looking into rewriting Storm's resource scheduler using core.logic. I want to be able to say constraints like: 1. Topology A's slots should be = 10 and as close to 10 as possible (minimize the delta between assigned slots and 10) 2. All topologies should use less than 200 CPU's and less than 600 GB of memory 3. Topology B should run at most 2 workers on each host 4. Each worker for topology C should run at most one task for component X and one task for component Y 5. Should minimize the amount of reassignment to running topologies in order to satisfy constraints 6. Should only be allowed to reassign workers for an individual topology whose individual constraints are satisfied once every 10 minutes And so on. I have two questions: 1. How good is core.logic at culling the search space using arithmetic logic? For example, if it knows that x + y = 5, x=0, and y=0, it should never bother with areas of the search space where x or y are =5. 2. Can core.logic do things like search the space for which my evaulation criteria are minimized? Or is what we're trying to do a better fit for different techniques like linear programming? I don't know enough about core.logic to comment on that, but my first impression upon reading your problem description is that integer programming would solve the problem (core.logic may be a better fit though). However, I'm not sure how you would model in your last requirement (but I don't have too much experience with LP/IP modelling). In the past I've used GLPK[1] for these types of problems which has java bindings [2]. This (older) paper[3] discusses the difference between mathematical programming (LP/IP) and constraint programming. If you jump to the summary it provides some guidelines on when each approach makes more sense than the other. I just reread the summary and it seems like constraint-based or perhaps a hybrid solution would be best. So, in my unqualified opinion, if you can make core.logic work that may be the best fit and may simplify your life (GLPK is a big dep). -Ben 1. http://www.gnu.org/software/glpk/ 2. http://glpk-java.sourceforge.net/ 3. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.153.6862 -- 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: core.logic for constraint logic programming
On Wed, Oct 24, 2012 at 5:17 PM, nathanmarz nathan.m...@gmail.com wrote: Cool, thanks for the quick response. We'll be looking into this pretty soon. I ultimately want the logic engine itself being exposed to users so they can add their own company-specific constraints to resource scheduling – which will be totally badass. If you're interested in tracking this, I opened up an issue on Storm: https://github.com/nathanmarz/storm/issues/383 Interesting, in what form will you expose this functionality to users? As some kind of DSL? I actually thought about minimization for a few more minutes. Minimization is not hard, it's really just about which values in a domain should be tried first. These are called distribution strategies in Mozart/Oz and I already sketched out how this might work in core.logic. I will add that JaCoP http://www.jacop.eu looks pretty mature / performant. I'm not sure how much interoperability with existing Clojure data structures comes into play for your particular use case. David -- 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: core.logic for constraint logic programming
Nathan: I don't know core.logic's capabilities, and I haven't looked at the kinds of constraints you describe in enough detail to say for sure, but my initial reaction is that linear/integer programming might be a better fit. It has been about 5-10 years, but in the past I've had success with relatively small to medium scale problems using an open source package called lp_solve for such things. I haven't tried it with more than a few hundred variables and constraints to see how well it performs there. http://sourceforge.net/projects/lpsolve/ Besides SourceForge, it is also available as a MacPorts package called lp_solve, or an Ubuntu 12.04 package lp-solve (probably Debian and other Ubuntu versions, too, but I only checked that one). Andy On Oct 24, 2012, at 2:17 PM, nathanmarz wrote: Cool, thanks for the quick response. We'll be looking into this pretty soon. I ultimately want the logic engine itself being exposed to users so they can add their own company-specific constraints to resource scheduling – which will be totally badass. If you're interested in tracking this, I opened up an issue on Storm: https://github.com/nathanmarz/storm/issues/383 On Oct 24, 2:07 pm, David Nolen dnolen.li...@gmail.com wrote: On Wed, Oct 24, 2012 at 4:56 PM, nathanmarz nathan.m...@gmail.com wrote: I'm looking into rewriting Storm's resource scheduler using core.logic. I want to be able to say constraints like: 1. Topology A's slots should be = 10 and as close to 10 as possible (minimize the delta between assigned slots and 10) The minimization bit is not in core.logic yet. But basically anything in Mozart/OZ's Finite Domain Constraint Programming feature set is on the table for core.logic :) 2. All topologies should use less than 200 CPU's and less than 600 GB of memory 3. Topology B should run at most 2 workers on each host 4. Each worker for topology C should run at most one task for component X and one task for component Y 5. Should minimize the amount of reassignment to running topologies in order to satisfy constraints 6. Should only be allowed to reassign workers for an individual topology whose individual constraints are satisfied once every 10 minutes Yep definitely sounds like the kind of thing I'd like core.logic to be used for. And so on. I have two questions: 1. How good is core.logic at culling the search space using arithmetic logic? For example, if it knows that x + y = 5, x=0, and y=0, it should never bother with areas of the search space where x or y are =5. While there's always room to improve it already does this well. 2. Can core.logic do things like search the space for which my evaulation criteria are minimized? Or is what we're trying to do a better fit for different techniques like linear programming? It can, but I need to sit down and figure out how to make that work. If I recall the Mozart/OZ work is pretty clear about their approach and I think it can easily be adapted. I'll try to find some time and get back to you on that. David -- 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: core.logic for constraint logic programming
On Wed, Oct 24, 2012 at 5:35 PM, Andy Fingerhut andy.finger...@gmail.comwrote: Nathan: I don't know core.logic's capabilities, and I haven't looked at the kinds of constraints you describe in enough detail to say for sure, but my initial reaction is that linear/integer programming might be a better fit. I'm not sure if this is true if you want non-expert users to easily customize it. Constraint Logic Programming tends to allow descriptions closer to the domain - I may be offbase here but I found this comparison of the techniques highly illuminating - Constraint Logic Programming and Integer Programming approaches and their collaboration in solving an assignment scheduling problem - http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.57.1461 David -- 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: [java interop] downcast
user= (class (int (cast Number 1))) java.lang.Integer is this what you want? Jim On 24/10/12 22:12, Steffen Panning wrote: Hello Group, the Java API I'm currently working with expects that an Interface is downcasted to a concrete class. As a quick test I toyed with this: (cast Integer (cast Number 1)) ClassCastException Cannot cast java.lang.Long to java.lang.Integer java.lang.Class.cast (Class.java:3007) It seems the clojure cast does not work like the java cast. Is there a way to do this Clojure? A not so nice alternative is to write the cast stuff in java. TIA Steffen -- 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: downcast
Clojure doesn't care about casting, so you can ignore this issue entirely. But also, it's not an issue: the same code would fail in Java, because Clojure's integer literals are Long, not Integer. (cast Long (cast Number 1)) would work fine. On Oct 24, 2:12 pm, Steffen Panning steffen.pann...@gmail.com wrote: Hello Group, the Java API I'm currently working with expects that an Interface is downcasted to a concrete class. As a quick test I toyed with this: (cast Integer (cast Number 1)) ClassCastException Cannot cast java.lang.Long to java.lang.Integer java.lang.Class.cast (Class.java:3007) It seems the clojure cast does not work like the java cast. Is there a way to do this Clojure? A not so nice alternative is to write the cast stuff in java. TIA Steffen -- 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: core.logic for constraint logic programming
It sounds like something that would benefit from good constraint propagation. If I remember correctly, core.logic only support propagating equality/inequality constraints which can be pretty slow for exploring large domains. Something like gecode (http://www.gecode.org) might be a better fit if you want to use large integer domains. Where core.logic lvars can only be assigned or fresh, gecode explicitly represents the domain of each variable and can efficiently propagate constraints across them. In your example, x and y would both have domain [0,5]. If you added the constraint x =3, after propagation you would have x: [3,5] y:[0,2] Gecode also has support for custom search strategies which would allow writing heuristics for minimisation. I'm not sure if gecode would ever be as fast as a linear programming solution but it's certainly more flexible. I wrote a constraint solver in clojoure based on the same ideas - https://github.com/jamii/mist/tree/master/src/shackles . It's only a toy and it could do with some macro love to hide the state threading but it demonstrates the basic ideas. -- 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: core.logic for constraint logic programming
On Wed, Oct 24, 2012 at 6:07 PM, Jamie Brandon ja...@scattered-thoughts.net wrote: It sounds like something that would benefit from good constraint propagation. If I remember correctly, core.logic only support propagating equality/inequality constraints which can be pretty slow for exploring large domains. Something like gecode (http://www.gecode.org) might be a better fit if you want to use large integer domains. Where core.logic lvars can only be assigned or fresh, gecode explicitly represents the domain of each variable and can efficiently propagate constraints across them. In your example, x and y would both have domain [0,5]. If you added the constraint x =3, after propagation you would have x: [3,5] y:[0,2] Not true anymore - we have interval propagation and we actually leverage it unlike the Scheme cKanren implementation. There's still plenty of room for improvement. Gecode also has support for custom search strategies which would allow writing heuristics for minimisation. I'm not sure if gecode would ever be as fast as a linear programming solution but it's certainly more flexible. Yes this what I was talking about when I referred to the Mozart/Oz distribute facility. This is pretty simple to add to core.logic as far as I can tell as I've stated earlier. -- 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: core.logic for constraint logic programming
Ok, clearly I've not been keeping up, sorry :) On 24 October 2012 18:17, David Nolen dnolen.li...@gmail.com wrote: On Wed, Oct 24, 2012 at 6:07 PM, Jamie Brandon ja...@scattered-thoughts.net wrote: It sounds like something that would benefit from good constraint propagation. If I remember correctly, core.logic only support propagating equality/inequality constraints which can be pretty slow for exploring large domains. Something like gecode (http://www.gecode.org) might be a better fit if you want to use large integer domains. Where core.logic lvars can only be assigned or fresh, gecode explicitly represents the domain of each variable and can efficiently propagate constraints across them. In your example, x and y would both have domain [0,5]. If you added the constraint x =3, after propagation you would have x: [3,5] y:[0,2] Not true anymore - we have interval propagation and we actually leverage it unlike the Scheme cKanren implementation. There's still plenty of room for improvement. Gecode also has support for custom search strategies which would allow writing heuristics for minimisation. I'm not sure if gecode would ever be as fast as a linear programming solution but it's certainly more flexible. Yes this what I was talking about when I referred to the Mozart/Oz distribute facility. This is pretty simple to add to core.logic as far as I can tell as I've stated earlier. -- 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: roundtripping using data.xml?
Thanks Ryan! This stuff is hugely helpful. One other thing you might consider around design discussions: it would be very useful to read XML both into clojure.xml-style structures and also Hiccup-style structures (you already do it the other way in sexp- as-element). Hiccup is a lot more compact and readable, and if your project uses both XML and HTML (which I imagine most would) it would be nice to share the same abstraction. David Santiago's Hickory project does this for HTML, but isn't appropriate for XML. -Nick. On Oct 22, 7:07 pm, Ryan Senior senior.r...@gmail.com wrote: This is related to the (lack of) support for namespaces. I removed the prefixes from the attributes below and it roundtripped fine for me. As far as I know, there is no work around for this kind of thing. The fix is for data.xml to support namespaces. I'll get some more design discussions going around namespaces this week. -Ryan On Mon, Oct 22, 2012 at 8:41 PM, nchurch nchubr...@gmail.com wrote: Am I making a mistake, or is this a bug? (use 'clojure.data.xml) (def p (parse (reader ../../small.xml))) where small.xml is ?xml version=1.0 encoding=utf-8? Keyboard xmlns:android=http://schemas.android.com/apk/res/android; android:keyWidth=10%p android:horizontalGap=0px android:verticalGap=0px android:keyHeight=@dimen/key_height /Keyboard And happens to be taken from an Android UI-defining XML file. But: (emit-str p) -- XMLStreamException Prefix cannot be null com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeAttribute (XMLStreamWriterImpl.java:564) If this has to do with the lack of namespace support, are there any workarounds? Thanks, Nick. -- 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: after a few days, my app dies -- how should I diagnose?
For our long-running clojure server app, I found that adding `:jvm-opts [-server]` to the project.clj increased performance a bit. It's too much info for this post, but hers'a good description from SO: http://stackoverflow.com/questions/198577/real-differences-between-java-server-and-java-client. On Monday, October 22, 2012 2:30:48 PM UTC-4, larry google groups wrote: I am fairly new to Clojure, and new to the JVM, so I do not know how to diagnose a dying app. I have a very simple app that tries to keep track (in memory) of who is logged in. I'll show the code below. I compiled this app and uploaded it to my server and launched it like this: who-is-logged-in-1.0.1-standalone.jar 4 /dev/null /dev/null 21 This ran for a day or two, and then it died. I restarted it, and it ran another day or 2, and then it died. I just restarted it so you might be able to see its output here: http://www.tailormadeanswers.com:4/ What you see is from some Javascript, which works when people log into a site like this: http://www.wpquestions.com/ On that site, the Javascript sends an Ajax ping every 10 seconds. The Clojure app remembers everyone who has sent a ping during the last 15 seconds. I don't think this has ever been more than 30 people, so I doubt that I am at risk of exhausting the memory. If the app is running, you can see some usage stats here: http://www.tailormadeanswers.com:4/show-resources I have not yet added any security to the app, so there is a chance that someone is shutting it down with spam. (I just got this app up last week, and was planning to add security checks this week). I do not know much about programming for the JVM, so I am curious, how do I diagnose this? I could add some logging, but what should I log? What should I be looking for? My project.clj looks like this: (defproject who-is-logged-in 1.0.1 :description When users arrive at a site like wpquestions.com, and then log in, the Javascript on that site should do 2 things: ping this software to let us know that user has logged in, and also ping this software to get some info about who else is logged in. The Javascript on the site should be able to take the data this software sends and turn it into a meaningful list of logged in users. Version: 1.0.1: since the output needs to be consumed by Javascript as JSON, I'm making some changes in the way the registry outputs. :dependencies [[org.clojure/clojure 1.3.0] [net.cgrand/moustache 1.1.0] [ring 1.1.5] [ring/ring-jetty-adapter 1.1.5] [org.clojure/data.json 0.2.0]] :main who-is-logged-in.core :jvm-opts [-Xmx4000m]) And the core.clj looks like this: (ns who-is-logged-in.core (:gen-class) (:import (java.util Date)) (:require clojure.string clojure.java.io who-is-logged-in.memory_display [clojure.data.json :as json]) (:use [net.cgrand.moustache :only [app delegate]] [ring.util.response] [ring.middleware.params] [ring.adapter.jetty :only [run-jetty]])) (def registry (atom {})) (defn add-to-logged-in-registry [this-users-params] We assume some user is looking at a site such as wpquestions.com and the Javascript on that site is sending an Ajax request to this app, every 10 seconds, with a map of information about the user, which we need to store in the registry. (let [right-now (. (Date.) getTime) new-user-entry (conj this-users-params { updated right-now })] (if-not (nil? (get new-user-entry username)) (swap! registry assoc (get new-user-entry username) new-user-entry (defn is-current? [this-users-map] If we have not received an Ajax request from a user during the last 15 seconds then we can assume they have left the site. We need to remove them from registry. (let [most-recent-ping (get this-users-map updated) allowed-cutoff (- (. (Date.) getTime) 15000)] (if ( most-recent-ping allowed-cutoff) true false))) (defn remove-old-registrants [] The registry should only show people who have pinged this app during the last 15 seconds. We rebuild the registry with only those users whose maps return true from is-current? (def updated-registry {}) (swap! registry (fn [map-of-all-user-maps] (into {} (doall (for [[username-as-key each-user-map] map-of-all-user-maps :when (is-current? each-user-map)] (conj updated-registry {(get each-user-map username) each-user-map}))) (defn current-users [request] The default action of this app. Add new users to the registry, and delete the ones that are more than 15 seconds old (let [this-users-params (:params request)] (add-to-logged-in-registry this-users-params) (remove-old-registrants) (response
what is the modern equivalent of clojure.contrib.java-utils/file?
I want to use clojure.contrib.java-utils/file. I am using Clojure 1.3 and leinengen. What is the modern equivalent of clojure.contrib.java-utils/file? -- 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: what is the modern equivalent of clojure.contrib.java-utils/file?
clojure.java.io/file On Thu, Oct 25, 2012 at 11:08 AM, larry google groups lawrencecloj...@gmail.com wrote: I want to use clojure.contrib.java-utils/file. I am using Clojure 1.3 and leinengen. What is the modern equivalent of clojure.contrib.java-utils/file? -- 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
A Practical Optional Type System for Clojure
Hi, I have submitted my honours dissertation for marking, for those interested: https://github.com/downloads/frenchy64/papers/paper.pdf Corrections welcome! Thanks, 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
Re: core.logic for constraint logic programming
Wow, thanks for the great information everyone. David – I don't know how we'll make it pluggable, I was thinking users could provide functions that return a set of constraints. And there would probably be a cost function that users could override as well. On Oct 24, 3:26 pm, Jamie Brandon ja...@scattered-thoughts.net wrote: Ok, clearly I've not been keeping up, sorry :) On 24 October 2012 18:17, David Nolen dnolen.li...@gmail.com wrote: On Wed, Oct 24, 2012 at 6:07 PM, Jamie Brandon ja...@scattered-thoughts.net wrote: It sounds like something that would benefit from good constraint propagation. If I remember correctly, core.logic only support propagating equality/inequality constraints which can be pretty slow for exploring large domains. Something like gecode (http://www.gecode.org) might be a better fit if you want to use large integer domains. Where core.logic lvars can only be assigned or fresh, gecode explicitly represents the domain of each variable and can efficiently propagate constraints across them. In your example, x and y would both have domain [0,5]. If you added the constraint x =3, after propagation you would have x: [3,5] y:[0,2] Not true anymore - we have interval propagation and we actually leverage it unlike the Scheme cKanren implementation. There's still plenty of room for improvement. Gecode also has support for custom search strategies which would allow writing heuristics for minimisation. I'm not sure if gecode would ever be as fast as a linear programming solution but it's certainly more flexible. Yes this what I was talking about when I referred to the Mozart/Oz distribute facility. This is pretty simple to add to core.logic as far as I can tell as I've stated earlier. -- 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