Re: after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread AtKaaZ
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 stdouterr.log & On Tue, Oct 23, 2012 at 12:12 AM, Michael Klishin < michael.s.klis...@gmail.com> wrote: > 2012/10/23 larry

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread AtKaaZ
Just gonna note that I'll have to use *:source-paths* instead of :extra-classpath-dirs since the latter is gone in lein2, since lein 2.0.0-preview1 sources: [1] https://github.com/emezeske/lein-cljsbuild/issues/123#issuecomment-7962308 [2] https://github.com/technomancy/leiningen/blob/master/NEWS.

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread AtKaaZ
This here [1] is relevant to what you said. Also this makes me realize that potentially someone using eclipse+ccw can use :extra-classpath-dirs to have two projects where one depends on another without having to *lein uberjar* on every change (and *lein install* or similar the .jar into some repo)

Re: Meta data access

2012-10-22 Thread Carlo Zancanaro
Hey Mamun, Your problem is that your ^{:test true} metadata isn't being applied to your functions, as you might expect, but rather to the var that is pointing to the function. You can see this in the following (#' is a shorthand to get the var rather than the thing it contains). user=> (meta f1)

Re: roundtripping using data.xml?

2012-10-22 Thread Ryan Senior
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

roundtripping using data.xml?

2012-10-22 Thread nchurch
Am I making a mistake, or is this a bug? (use 'clojure.data.xml) (def p (parse (reader "<../../>small.xml"))) where "small.xml" is http://schemas.android.com/apk/res/android"; android:keyWidth="10%p" android:horizontalGap="0px" android:verticalGap="0px" android:keyHeight="@dime

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Michael Fogus
> And thank you Mr. Fogus. Don't thank me, Sean did all the hard work. :-) -- 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 patien

Re: [ANN] nrepl.el 0.1.5 released

2012-10-22 Thread Erlis Vidal
Quick question, After follow the installation instructions it looks like version 0.1.4 was installed instead version 0.1.5 do you know why ? Thanks for the tool, Erlis On Mon, Oct 22, 2012 at 8:30 PM, Erlis Vidal wrote: > Thanks This is working perfect! > > > On Mon, Oct 22, 2012 at 4:

Re: [ANN] nrepl.el 0.1.5 released

2012-10-22 Thread Erlis Vidal
Thanks This is working perfect! On Mon, Oct 22, 2012 at 4:33 PM, Anthony Grimes wrote: > All hail the king of kings! > > > On Monday, October 22, 2012 10:31:16 AM UTC-5, Tim King wrote: >> >> I am pleased to announce the release of nrepl.el v0.1.5, an Emacs client >> for nREPL. >> >> nrep

Re: Meta data access

2012-10-22 Thread Jim - FooBar();
Direct copy-paste from my repl: user=> (defn ^{:test true} f1 [] #_=> (println "call f1 fn")) #'user/f1 user=> user=> (defn ^{:test false} f2 [] #_=> (println "call f2 fn")) #'user/f2 user=> (:test (meta (var f1))) true user=> (:test (meta (var f2))) false user=> (println (:test (meta

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
Thank you, I understand it :) And thank you Mr. Fogus. What a great pleasure! On Tuesday, October 23, 2012 1:42:28 AM UTC+3, Sean Corfield wrote: > > On Mon, Oct 22, 2012 at 3:30 PM, Hussein B. > > wrote: > > So we need to call evict explicitly if we want to remove an entry? no > > automatic de

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
On Mon, Oct 22, 2012 at 3:30 PM, Hussein B. wrote: > So we need to call evict explicitly if we want to remove an entry? no > automatic deletion after expiring? The cache is immutable. When you call hit / miss, you get a new instance of the cache with the expired entries removed, and the hit entr

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
I see, it works now. So we need to call evict explicitly if we want to remove an entry? no automatic deletion after expiring? On Tuesday, October 23, 2012 1:21:54 AM UTC+3, Sean Corfield wrote: > > On Mon, Oct 22, 2012 at 3:08 PM, Hussein B. > > wrote: > > I tried this: > > > > (defn hit-or-

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
On Mon, Oct 22, 2012 at 3:08 PM, Hussein B. wrote: > I tried this: > > (defn hit-or-miss > [a k v] > (if (c/has? @a k) > (c/hit @a k) > (c/miss @a k v))) My bad... got a bit carried away with the derefs based on code I was playing around with in the REPL. Try this: (defn hit-or-miss

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
I tried this: (defn hit-or-miss [a k v] (if (c/has? @a k) (c/hit @a k) (c/miss @a k v))) (def acu (atom (c/ttl-cache-factory {} :ttl 2))) (swap! acu hit-or-miss :e 55) But I got: ClassCastException clojure.core.cache.TTLCache cannot be cast to clojure.lang.IDeref clojur

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
Just to clarify, hit does nothing for TTL (since items timeout based solely on when they were added, not when they were last touched), so swap! on the hit really makes no difference here. It would, however, be required for some of the other types of cache. Also, exactly how you use has? / hit / mi

Re: after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread larry google groups
Well, here is the beginning of some primitive logging. I set up the app on one server and then, on a different server, I started calling this URL and logging the results: http://www.tailormadeanswers.com:4/show-resources The cron script was only calling once every 5 minutes, so maybe it mis

Re: Meta data access

2012-10-22 Thread Mamun
Hi Jim Thank for your ans. But this does not work. When I run code I got "Unable to resolve var" error. Please find in bellow: CompilerException java.lang.RuntimeException: Unable to resolve var: form in this context, compiling:(NO_SOURCE_PATH:4) Source code- (defn ^{:test true} f1 [] (p

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
On Mon, Oct 22, 2012 at 1:50 PM, Hussein B. wrote: > c3 holds a map containing {:a 1} that will lives for two minutes. In the code I provided, c3 is an atom that holds a cache (which is the map). > After two minutes, requesting :a is generating false since it reached its > TTL but it will still

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
I see. But I didn't really grasp the whole concept firmly . c3 holds a map containing {:a 1} that will lives for two minutes. After two minutes, requesting :a is generating false since it reached its TTL but it will still live in map until it is removed explicitly by invoking evict. Correct? Als

Re: [ANN] nrepl.el 0.1.5 released

2012-10-22 Thread Anthony Grimes
All hail the king of kings! On Monday, October 22, 2012 10:31:16 AM UTC-5, Tim King wrote: > > I am pleased to announce the release of nrepl.el v0.1.5, an Emacs client > for nREPL. > > nrepl.el v0.1.5 is now available on Marmalade. > Preview versions of the next release are available on Melpa. >

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Sean Corfield
On Mon, Oct 22, 2012 at 12:05 PM, Michael Fogus wrote: > First, thanks for trying c.c.cache! The answer to your question is > that the TTL cache implementation is non-destructive. The `evict` > call returns the cache without the element, but does not remove it > from the original cache. In other

Re: after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread larry google groups
Thank you much for your help. My Clojure code is clumsy, for sure. Your version of much better. The server is Jetty. There are only 2 routes in the whole app, at the 2 URLs I posted above. I will start logging OutOfMemory errors. If memory is not the problem, what other problems should I l

Re: after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread Michael Klishin
2012/10/22 larry google groups > 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

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread Shantanu Kumar
On Oct 23, 12:20 am, Shantanu Kumar wrote: > On Oct 23, 12:11 am, David Nolen wrote: > > > On Mon, Oct 22, 2012 at 3:08 PM, Shantanu Kumar > > wrote: > > > > 19afb31a52504293ba2182c584b1867917316662 > > > Do you have top level lets in your code? > > > (let [foo ...] > >    (defn bar ...)) > >

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread David Nolen
On Mon, Oct 22, 2012 at 3:20 PM, Shantanu Kumar wrote: > > > On Oct 23, 12:11 am, David Nolen wrote: > > On Mon, Oct 22, 2012 at 3:08 PM, Shantanu Kumar < > kumar.shant...@gmail.com>wrote: > > > > > 19afb31a52504293ba2182c584b1867917316662 > > > > Do you have top level lets in your code? > > > >

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread Shantanu Kumar
On Oct 23, 12:11 am, David Nolen wrote: > On Mon, Oct 22, 2012 at 3:08 PM, Shantanu Kumar > wrote: > > > 19afb31a52504293ba2182c584b1867917316662 > > Do you have top level lets in your code? > > (let [foo ...] >    (defn bar ...)) I have top-level let in a macro file, which is never referenced

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread David Nolen
On Mon, Oct 22, 2012 at 3:08 PM, Shantanu Kumar wrote: > 19afb31a52504293ba2182c584b1867917316662 > Do you have top level lets in your code? (let [foo ...] (defn bar ...)) David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread Aaron Cohen
On Mon, Oct 22, 2012 at 2:54 PM, Aaron Cohen wrote: > On Mon, Oct 22, 2012 at 2:51 PM, Aaron Cohen 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 ni

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
Wow, What an honor to get a reply from my idol and mentor !! Thanks a lot. I really appreciate to hear your opinion regarding this: http://stackoverflow.com/questions/13015906/is-it-safe-to-use-a-clojure-core-cache-guarded-by-ref-type Every thing started with this issue. Appreciate your precious ti

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread Shantanu Kumar
> Switch into your project. Create a directory called checkouts. Checkout a > fresh copy of ClojureScript in this directory. Add the following to your > own project.clj: > > :extra-classpath-dirs ["checkouts/clojurescript/src/clj" >                        "checkouts/clojurescript/src/cljs"] > > Now

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Michael Fogus
> What I'm missing? First, thanks for trying c.c.cache! The answer to your question is that the TTL cache implementation is non-destructive. The `evict` call returns the cache without the element, but does not remove it from the original cache. -- You received this message because you are subsc

Re: after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread Aaron Cohen
On Mon, Oct 22, 2012 at 2:51 PM, Aaron Cohen 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)

Re: after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread Aaron Cohen
On Mon, Oct 22, 2012 at 2:30 PM, larry google groups wrote: > > > 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])

after a few days, my app dies -- how should I diagnose?

2012-10-22 Thread larry google groups
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-

Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
Hi, I created this: (def c3 (cache/ttl-cache-factory {:a 1} :ttl 2)) user=> c3 {:a 1} user=> (cache/has? c3 :a) true user=> (cache/has? c3 :a) false user=> c3 {:a 1} user=> (cache/evict c3 :a) {} user=> c3 {:a 1} After TTL, cache doesn't has :a entry but printing the var shows the map conta

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread David Nolen
On Mon, Oct 22, 2012 at 1:56 PM, Shantanu Kumar wrote: > > > On Oct 21, 11:21 pm, David Nolen wrote: > > Please isolate the commit by using the lein checkouts feature - you can > use > > the ClojureScript repo directly then and use git bisect to determine the > > exact commit that broke your buil

Re: ANN: Zürich Clojure User Group

2012-10-22 Thread Thomas G. Kristensen
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 -

Re: ANN: ClojureScript release 0.0-1513

2012-10-22 Thread Shantanu Kumar
On Oct 21, 11:21 pm, David Nolen wrote: > Please isolate the commit by using the lein checkouts feature - you can use > the ClojureScript repo directly then and use git bisect to determine the > exact commit that broke your build. Thanks. I'm afraid I didn't follow the first part -- can you ple

Re: Bug in jayq clj->js function ?

2012-10-22 Thread Max Penet
Good point, I forgot about this case. On Monday, October 22, 2012 7:02:41 PM UTC+2, David Nolen wrote: > > On Mon, Oct 22, 2012 at 12:52 PM, Max Penet >wrote: > >> This reminds me, maybe having something like this function, probably with >> its protocol in core would be nice. Thoughts? > > > ma

Re: Bug in jayq clj->js function ?

2012-10-22 Thread David Nolen
On Mon, Oct 22, 2012 at 12:52 PM, Max Penet wrote: > This reminds me, maybe having something like this function, probably with > its protocol in core would be nice. Thoughts? map->js in core? There's no good conversion for arbitrary keys. David -- You received this message because you are su

Re: Bug in jayq clj->js function ?

2012-10-22 Thread Max Penet
You can get a fix from my fork cc.qbits/jayq "0.1.0-alpha4-SNAPSHOT" or just use your own: https://github.com/mpenet/jayq/commit/d26615f26f012093e02bd89df893fb6e993830e6 On Monday, October 22, 2012 5:44:11 PM UTC+2, Pierre Allix wrote: > > Hello everybody, > > I'm having a bug with the followi

Re: Bug in jayq clj->js function ?

2012-10-22 Thread Max Penet
This reminds me, maybe having something like this function, probably with its protocol in core would be nice. Thoughts? On Monday, October 22, 2012 6:46:41 PM UTC+2, Max Penet wrote: > > Hi, > > jayq relies on .-str-obj to serialize maps, which doesn't exist on > PersistantHashMaps (it turns int

Re: ANN: Zürich Clojure User Group

2012-10-22 Thread Nando
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.kristen...@gmail.com> wrote: >

Re: Bug in jayq clj->js function ?

2012-10-22 Thread Max Penet
Hi, jayq relies on .-str-obj to serialize maps, which doesn't exist on PersistantHashMaps (it turns into one once you insert the 33rd element). It should use aset instead I guess. By the way there is a map->js function you can use in the meantime. On Monday, October 22, 2012 5:44:11 PM UTC+2,

Re: ANN: Zürich Clojure User Group

2012-10-22 Thread Nick Zbinden
Hi, If im in Switzerland then I will defentily come. There was a lisp usergroupe for a time but the company that hosted it kind of stopped. Am Montag, 22. Oktober 2012 10:37:40 UTC+2 schrieb Thomas G. Kristensen: > > Hi all, > > I'm happy to announce the Zürich Clojure User Group! > > http://ww

Re: Calling name on a keyword gives nil??

2012-10-22 Thread Jim foo.bar
On 22/10/12 16:45, JvJ wrote: The reason it starts with def (and ends in -fn) is because it is a function used by a macro, which has a global effect. well, if you mean that the macro (which you've not shown) is the one that creates the top-level form, then macro's name should be the one start

Re: Calling name on a keyword gives nil??

2012-10-22 Thread JvJ
The reason it starts with def (and ends in -fn) is because it is a function used by a macro, which has a global effect. On Monday, 22 October 2012 11:17:12 UTC-4, Jim foo.bar wrote: > > A couple of issues: > > 1) 'name' is a fn in core so it's almost never a good idea to shadow it > like this..

Re: Meta data access

2012-10-22 Thread Jim foo.bar
well not quite! you need (-> form var meta :test) or the same thing written differently (:test (meta (var form))) Hope that helps, Jim ps: basically the meta-data sit with the var not the function On 22/10/12 16:33, Jim fo

Bug in jayq clj->js function ?

2012-10-22 Thread Pierre Allix
Hello everybody, I'm having a bug with the following code: https://gist.github.com/3932130 The test-merge-convert function returns undefined instead of returning an object but even more strangely the code works if I remove the data with the key :sct_comparison_desc inside the first map. I'm u

Re: Calling name on a keyword gives nil??

2012-10-22 Thread JvJ
HAHAHA DERP! Wow that was stupid. But thanks. On Monday, 22 October 2012 10:58:45 UTC-4, JvJ wrote: > > I'm getting a REALLY weird error. I'm trying to check if a set of > keywords are all uppercase. > When binding a value to 'res' in the let statement, I traverse a list of > keywords. Howev

Re: Meta data access

2012-10-22 Thread Jim foo.bar
If I've understood correctly all you need is (meta form)... Jim On 22/10/12 15:30, Mamun wrote: Hi All, I've a application with following structure. Now I would like to access meta data of f1 and f2 within process function. (defn ^{:test true} f1 [] (println "call f1 fn")) (defn ^{:tes

[ANN] nrepl.el 0.1.5 released

2012-10-22 Thread Tim King
I am pleased to announce the release of nrepl.el v0.1.5, an Emacs client for nREPL. nrepl.el v0.1.5 is now available on Marmalade. Preview versions of the next release are available on Melpa. See the Readme on github (https://github.com/kingtim/nrepl.el) for installation and usage instructions. N

Re: ANN: Spyscope, a trace/println-oriented debugging tool for Clojure

2012-10-22 Thread Nils Grunwald
Seems very promising, especially the async trace feature. I'll check it out. Thanks! On Sunday, October 21, 2012 1:02:01 AM UTC+2, dgrnbrg wrote: > > Spyscope is a better println, inspired by some of the recent postings > on the Clojure mailing list about using reader macros for debugging. > >

Meta data access

2012-10-22 Thread Mamun
Hi All, I've a application with following structure. Now I would like to access meta data of f1 and f2 within process function. (defn ^{:test true} f1 [] (println "call f1 fn")) (defn ^{:test false} f2 [] (println "call f2 fn")) (def f* (list f1 f2)) (defn process [form] (do *

Re: Calling name on a keyword gives nil??

2012-10-22 Thread Jim foo.bar
a pre-condition attached to your fn would be a nice and clean way to check for upper/lower case without 'polluting' the fn itself with if statements...just a thought ... :-) Jim On 22/10/12 16:16, Jim foo.bar wrote: A couple of issues: 1) 'name' is a fn in core so it's almost never a good i

Re: Calling name on a keyword gives nil??

2012-10-22 Thread Jim foo.bar
A couple of issues: 1) 'name' is a fn in core so it's almost never a good idea to shadow it like this... 2) also it is not a good idea for a fn to start with 'def' unless it actually defines a top-level form inside it like in macros 3)If you need all your keys in capital I think it would be fas

Re: Calling name on a keyword gives nil??

2012-10-22 Thread Bronsa
I've had this happening to me too. Couldn't figure out wtf was going on. Until somebody understands what's the problem is, you can(let [s (.sym ^clojure.lang.Keyword k)] ..) and call name on s 2012/10/22 JvJ > I'm getting a REALLY weird error. I'm trying to check if a set of > keywords are all

Re: Calling name on a keyword gives nil??

2012-10-22 Thread Dave Ray
The name parameter of your function is shadowing clojure.core/name. On Mon, Oct 22, 2012 at 7:58 AM, JvJ wrote: > I'm getting a REALLY weird error. I'm trying to check if a set of keywords > are all uppercase. > When binding a value to 'res' in the let statement, I traverse a list of > keywords.

Calling name on a keyword gives nil??

2012-10-22 Thread JvJ
I'm getting a REALLY weird error. I'm trying to check if a set of keywords are all uppercase. When binding a value to 'res' in the let statement, I traverse a list of keywords. However, the calls to the name function on those keywords give nil. The debug print statement clearly shows that the

ANN: Late October London Clojure Dojo at Thoughtworks on 30 October 2012

2012-10-22 Thread Bruce Durling
Roll up! Roll up! On Tuesday 30 October we'll be having another clojure dojo, this time hosted by ThoughtWorks. Details and sign up here: http://late-october-2012-ldnclj-dojo.eventbrite.co.uk/ I hope to see you all there! The dojo is a fun and welcoming place for beginners and experienced cloju

ANN: Zürich Clojure User Group

2012-10-22 Thread Thomas G. Kristensen
Hi all, I'm happy to announce the Zürich 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 hav

ANN Elastisch 1.0.2 is released

2012-10-22 Thread Michael Klishin
Elastisch is a small but feature rich and well documented Clojure client for ElasticSearch [1]. `1.0.2` is a bug fix release. We recommend all users to upgrade to it. ## Changes in 1.0.2 * Count API now uses GET for requests without the query part [2] * Count API No Longer Ignores Mapping Typ

Clojure documentation site (CDS) progress report, week 2

2012-10-22 Thread Michael Klishin
## TL;DR The Clojure documentation project (http://clojure-doc.org) continues to progress nicely. Several guides now have more than 2/3rds of the content written and the team begins to tackle harder guides such as Concurrency and Parallelism in Clojure [1]. ## CDS Progress Report Not so long we