Re: bit-wise operators for bigint in Clojure

2020-06-02 Thread Niels van Klaveren
Clojure often leaves implementations to the backing platforms, and 
Clojurescript probably has no difference in the methods of the different 
numerical types.
Java does, so you'd have to fall back on that. Something like:

(defn big-or
  [f & r]
  (reduce (fn [acc v] (.or acc (biginteger v))) (biginteger f) r))

(defn big-and
  [f & r]
  (reduce (fn [acc v] (.and acc (biginteger v))) (biginteger f) r))

(defn big-xor
  [f & r]
  (reduce (fn [acc v] (.xor acc (biginteger v))) (biginteger f) r))

A lot of (mathemathical) operations need falling back to the platform, and 
this is by design for clojure. There are however libraries that are 
intended to abstract away the differences, and one of those for math is 
clojure.math.numeric-tower.

A numeric type independent implementation for bitwise operations would be a 
fitting pull request there.


On Tuesday, May 26, 2020 at 6:39:51 PM UTC+2, Harmon Nine wrote:
>
> Hello.
>
> I noticed a post about this from 2013, so doing a bump.
>
> The bit-wise operators appear to be supported for 'bigint' in 
> ClojureScript, but not in Clojure.  Is support for these operations on 
> 'bigint' in Clojure a future enhancement?
>
> Thanks :)
> -- Harmon
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/e8fe6493-4458-4a60-b9f5-902dbc2abf07%40googlegroups.com.


Re: bit-wise operators for bigint in Clojure

2020-06-02 Thread Niels van Klaveren
Clojure 1.10:

(and 4N 8N (bigint Integer/MAX_VALUE))
=> 2147483647N

(or 4N 8N (bigint Integer/MAX_VALUE))
=> 4N


On Tuesday, May 26, 2020 at 6:39:51 PM UTC+2, Harmon Nine wrote:
>
> Hello.
>
> I noticed a post about this from 2013, so doing a bump.
>
> The bit-wise operators appear to be supported for 'bigint' in 
> ClojureScript, but not in Clojure.  Is support for these operations on 
> 'bigint' in Clojure a future enhancement?
>
> Thanks :)
> -- Harmon
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/746ef4a0-84e4-4372-af98-3bb22bbb44c8%40googlegroups.com.


Re: [ANN] metasoarous/oz 1.5.1 - clojure dataviz updates (jupyter notebooks, markdown extensions, and static export, oh my!)

2019-01-23 Thread Niels van Klaveren
Thanks for this, Christopher. Oz has very rapidly become my go-to 
visualization library due to it's simplicity and exchange capabilities.



On Wednesday, January 23, 2019 at 9:26:00 AM UTC+1, Christopher Small wrote:
>
>
> Greetings
>
>
> I'm excited to announce the release of oz 1.5.1.
>
> https://github.com/metasoarous/oz
>
> Oz is a simple data visualization library built around Vega & Vega-Lite.
>
> In Vega & Vega-Lite, data visualizations are specified as pure data 
> descriptions about how to map properties of your data and interactions to 
> aesthetics of a visualization.  To find out more about Vega & Oz please 
> visit https://github.com/metasoarous/oz.
>
> This release specifically adds some major new features:
>
> * Jupyter notebook support via the Clojupyter & IClojure kernels
> * Export of visualizations and scientific documents to live/interactive 
> html files via the `export!` function
> * Load markdown files, with a notation for embedding visualizations as 
> code blocks
> * Cljdoc API documentation (https://cljdoc.org/d/metasoarous/oz)
>
> These features, together with those already built into oz (REPL based 
> workflow, hiccup support, Reagent components & publishing/sharing API), 
> make oz a powerful tool for working with data visualizations and scientific 
> documents from within Clojure, no matter the workflow.  I hope you find it 
> useful.
>
>
> *## Markdown support*
>
> I'd like to specifically illustrate the markdown support feature, as its 
> the one I'm most excited to start using myself, as well as the one which 
> demands the most explanation.
>
> How many times have you been working on a simple markdown document, and 
> realized you wanted to add a data visualization to illustrate a point?  
> What did you have to do to get it done?  My guess is you had fire up 
> another tool, like R's `ggplot`, or Python's `matplotlib`, export a static 
> figure, and awkwardly embed it into your markdown document, hoping to God 
> you don't have to update it, and go through the ordeal again.
>
> With oz, you can simply embed vega-lite or vega visualizations like this:
>
> # Some markown file
>
> A data visualization:
>
> ```edn vega-lite
> {:data {:values [{:a 2 :b 3 :c "T"} {:a 5 :b 2 :c "T"} {:a 7 :b 4 :c 
> "Q"} {:a 3 :b 3 :c "Q"}]}
>  :mark :point
>  :width 400
>  :encoding {:x {:field "a"}
> :y {:field "b"}
> :color {:field "c"}}}
> ```
>
> The `load` function parses the markdown file, and uses the `edn vega-lite` 
> code block class to determine that the block should be interpreted as a 
> Vega-Lite visualization.  The fact that `edn` is one of the classes here 
> means that your text editor and other markdown processors (if you push to 
> GitHub or whatever) will recognize what kind of data it is and highlight it 
> appropriately.  (Thanks to GH users mpcarolin and yogthos for promptly 
> updating their markdown processing libraries to allow for the specification 
> of multiple code classes.)
>
> Once loaded, the corresponding document can be immediately viewed with the 
> `view!` function, exported to a self-contained html file via `export!`, or 
> published online with a shareable link via `publish!`.
>
> This notation allows you to embed as either `json` or `yaml` in lieu of 
> `edn`, or `vega` in lieu of `vega-lite`.  Moreover, `hiccup` can be 
> embedded (possibly with `[:vega ...]` or `[:vega-lite ...]` nodes), for 
> when you want more power than Markdown affords, but don't want to resort to 
> manually writing html in your beautiful Markdown.
>
>
> *## Jupyter notebook support*
>
> While I personally prefer creating scientific documents from the comfort 
> of my favorite text editor & REPL setup, I understand the value of the 
> notebook environment.  In fact, my first programming language was 
> Mathematica, and there's a part of me that holds warm reverie for the 
> model.  Thus, it is with great pleasure that I announce that Oz can now be 
> used as a go-to for those who enjoy using these environments and wish to be 
> able to create powerful and interactive data visualizations therein.
>
> This feature would not have been possible without GH users mikeyford, 
> keesterbrugge, jtcbrule, cgrand.
> Thank you all for your help initiating and piecing together a solution to 
> the problem(s)!
>
> For usage details can be found in the README.
>
>
> *## In closing*
>
> I hope that you find this nexus of features and ideas useful, and that you 
> help me make Vega, Vega-Lite & Oz a standard part of the Clojure toolkit 
> for data science.
>
> Thanks for your time
>
> Christopher Small
>
>

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

Re: [HEADS-UP] CFP for Dutch Clojure Day 2018 closes in 9 days

2018-02-19 Thread Niels van Klaveren
Eventbrite says "Sale ended". Did tickets go that fast or is it some hickup 
?

On Monday, February 19, 2018 at 9:47:00 AM UTC+1, Vijay Kiran wrote:
>
> Hello All,
>
> Just wanted to give you a heads-up for Dutch Clojure Day - a free one day 
> Clojure conference in Amsterdam. This is a conference run by community 
> volunteers, with sponsorship from amazing Clojure companies across Europe. 
> Our CFP will be open until Feb 28th and we welcome all levels of talks 
> about Clojure/ClojureScript ecosystem. If you have a talk in mind feel free 
> to submit at  https://www.papercall.io/dcd18 or spread the word :)
>
> Check out our website for http://clojuredays.org to register for the 
> event! 
>
> We look forward to seeing some of you here in Amsterdam on 21st April 2018
>
> Cheers,
> Vijay
> DCD Organiser Team
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: what does future do after fn finish ?

2018-02-02 Thread Niels van Klaveren
+1 for Claypoole, it removed the needs of using agents or futures in 95% of 
the cases in my code.

On Thursday, February 1, 2018 at 9:54:36 PM UTC+1, Alan Thompson wrote:
>
> You may find that using the Claypoole library is the easiest way to handle 
> threadpools:   https://github.com/TheClimateCorporation/claypoole
> Alan
>
> On Thu, Feb 1, 2018 at 11:16 AM, Justin Smith  > wrote:
>
>> yes, that's the idea exactly
>>
>> also, you might want more fine grained control of how much parallelism 
>> occurs (eg. if every thread is writing to the same physical device, you can 
>> often get better throughput by not parallelizing at all, or keeping the 
>> parallelism quite limited - it's worth experimenting) - there are good ways 
>> to control that using ThreadPoolExecutor directly, or using 
>> clojure.lang.PersistentQueue/EMPTY as a control construct, or core.async 
>> channels, or ztellman's manifold library, or the claypoole threading library
>>
>> On Thu, Feb 1, 2018, 03:44 Jacek Grzebyta > > wrote:
>>
>>> Thanks folks. I see now! It should be a list of agents not list of 
>>> futures within agent.  Also any task sent to a agent is processed 
>>> within a thread anyway so I do not need to add future...
>>>
>>> On 1 February 2018 at 02:17, John Newman >> > wrote:
>>>
 Ah, he's using one agent, I see.

 On Jan 31, 2018 9:15 PM, "John Newman"  
 wrote:

> Multiple sen-doffs to one agent will serialize it's calls, but 
> spawning agents on each new task will spawn threads on a bounded thread 
> pool, I believe.
>
> On Jan 31, 2018 8:32 PM, "Justin Smith"  > wrote:
>
>> Doing all the actions via one agent means that the actions are 
>> serialized though - you end up with no performance improvement over 
>> doing 
>> them all in a doseq in one future - the right way to do this tends to be 
>> trickier than it looks at first glance, and depends on your 
>> requirements. 
>> agents, the claypoole library, and reducers are all potentially useful. 
>> If 
>> parallelization leads to complex coordination needs, core.async can help 
>> too.
>>
>> On Wed, Jan 31, 2018 at 5:18 PM John Newman > > wrote:
>>
>>> Agents manage a pool of threads for you. Try doing it without the 
>>> future call and see if that works (unless you're trying to do something 
>>> else).
>>>
>>> John
>>>
>>> On Wed, Jan 31, 2018 at 7:31 PM, Jacek Grzebyta >> > wrote:
>>>
 Thanks a lot. I will check it tomorrow. 

 J

 On 1 Feb 2018 12:12 a.m., "Justin Smith"  wrote:

> this is exactly the kind of problem code I was describing - 
> there's no backpressure on existing future tasks to hold up the 
> launching 
> of more futures - the work done by the agent calling conj is 
> negligible. 
> You need to control the size of the pool of threads used, and you 
> need to 
> impose back-pressure.
>
> On Wed, Jan 31, 2018 at 3:46 PM Jacek Grzebyta <
> grzeby...@gmail.com > wrote:
>
>> On 31 January 2018 at 18:08, James Reeves > > wrote:
>>
>>> On 31 January 2018 at 17:59, Jacek Grzebyta >> > wrote:
>>>
 I have application with quite intense tripe store populating 
 ~30/40 k records per chunk (139 portions). The data are wrapped 
 within the 
 future:

 (conj agent (future (apply task args)))

  and that all together is send-off into (agent []). 

>>>
>>> What is "agent"? The first line of code indicates that it's a 
>>> local collection shadowing the code function, while the second code 
>>> snippet 
>>> indicates that you're using the core agent function.
>>>
>>> Also why are you sending off to an agent?
>>>
>>  
>> I have ~8sec computing task for each input dataset which 
>> generates those records. After that I write it into disk (in 
>> software-specific transaction). I just wanted to separate hard 
>> computing 
>> and io operations. I created a side-effect method which is injected 
>> together with the dataset into a future. The futures are async 
>> collected 
>> within a list wrapped in agent. After the computing the main thread 
>> is 
>> waiting until all io tasks will be finished. 
>>  
>>
>>>
>>> At the end of the main thread function I just use await-for and 
 after that:


Re: Get Lein to run 32-bit JVM on Windows

2016-07-06 Thread Niels van Klaveren
If system/getProperty "os.arch" says it's 64 bits, it means the processor 
is a 64 bits compatible processor, not that the Java process is 64 or 32 
bits.
If you want to see what the JVM data model is you need to use 
(System/getPropery  "sun.arch.data.model") and see what it returns (either 
"32" or "64").

On Tuesday, July 5, 2016 at 9:17:02 PM UTC+2, JvJ wrote:
>
> I think when I wrote LEIN_CMD, I meant LEIN_JAVA_CMD.  I've already set it 
> to the x86 JVM path, with no luck so far.
>
> (System/getProperty "os.arch") still returns "amd64", and overtone still 
> doesn't work right.
>
> On Tuesday, 5 July 2016 02:02:53 UTC-7, David Powell wrote:
>>
>> I think you need to set LEIN_JAVA_CMD to affect the jvm actually used to 
>> start leiningen itself.
>>
>> On Tue, Jul 5, 2016 at 9:35 AM, JvJ  wrote:
>>
>>> Is it possible to configure Leiningen to run a 32-bit JVM by default?  
>>> I've already tried changing the LEIN_CMD and JAVA_HOME to the x86 
>>> executable paths, but it still runs the amd64 JVM.
>>>
>>> Any tips?  I'm doing this for overtone, since it doesn't support amd64 
>>> on Windows.
>>>
>>> --
>>> 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 unsubscribe from this group and stop receiving emails from it, send 
>>> an email to clojure+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


which GC optimizations work better with Clojure?

2016-04-30 Thread Niels van Klaveren
GC parameters used by a lot of projects are handed down like traditions for 
years, even spreading to others. They're almost never re-evaluated, which means 
they might actually lose out on new performance improvements, or worse, might 
even cause performance regressions.

Most parameters in the Overtone lib for instance have been the default for 
quite some time (ParNew GC, TLAB). Where restricting New Gen might be a good 
idea to reduce new gen GC latency, it can cause unwanted promotions, longer 
tenured GC's and in the end heap fragmentation resulting in a full defrag gc 
that can take 10s of seconds.

Defaults are there for a reason, to take care of most situations. Any settings 
other than the three default Garbage Collectors (Default for shortest time to 
finish, CMS for shortest pause , G1 for short pauses but long running times) 
and at most a pause hint for their heuristics means you're entering 
case-specific  territory and should be treating it so.

This means realistic benchmarking, profiling and comparisons between different 
settings. I'd treat any JVM product or library with more than 2 GC parameters 
with care, because if they need so much tweaking as their default, you can be 
sure to need both a good understanding of their inner workings and JVM memory 
managent as well to keep them performing in your specific case.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Porting Clojure to Native Platforms

2016-04-26 Thread Niels van Klaveren
The only conclusion I can draw from these benchmarks over the years is that 
the speed of Clojure is inversely proportional to it's idiomaticity

On Tuesday, April 26, 2016 at 7:23:48 AM UTC+2, Mars0i wrote:
>
> On Tuesday, April 26, 2016 at 12:19:23 AM UTC-5, Mars0i wrote:
>>
>> I was going to say that I'd be surprised if Clojure were as fast as SBCL 
>> (overall, on average, depends on your application, depends on how you code 
>> it, ymmv, etc. ...).  Then I stopped back to check the little benchmarks on 
>> the Computer Language Benchmarks Game 
>> 
>>  
>> .  Whatever it is that those comparisons do, or don't prove, I would no 
>> longer be surprised.
>>
>
> I forgot how much faster Clojure got in 1.7 and 1.8.  I remember Java 
> wiping the floor with Clojure on most of those benchmarks a couple of years 
> ago, but now it's just a little bit faster on average 
>  on those 
> benchmarks.
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice getting started with concurrency and parallelism in Clojure

2016-04-07 Thread Niels van Klaveren
The biggest problem with pmap I have is ordering, ie. it will process in 
batches of (+ 2 (.. Runtime getRuntime availableProcessors)), and only take 
a new batch when the slowest of the old batch has been evaluated. With 
functions dependent on IO, parallel gains are only a fraction of what they 
could be. I used to solve this by creating my own code to process in 
futures and delays, but when I found the claypoole library, especially it's 
unordered pmap and for, I never had to touch these again.

On Wednesday, April 6, 2016 at 3:11:52 PM UTC+2, Mars0i wrote:
>
> Maybe people forget about pmap , 
> pcalls , and pvalues 
>  because they're just too 
> easy.
>
> On Tuesday, April 5, 2016 at 8:51:59 PM UTC-5, tbc++ wrote:
>>
>> If it all seems confusing, do not despair, there's two things that will 
>> handle the vast majority of the use cases you may have: 
>>
>> 1) `future` - spawns a thread that runs the body of the future (
>> https://clojuredocs.org/clojure.core/future)
>> 2) `atom` and `swap!` - Used to store data that needs to be shared 
>> between threads and updated concurrently (
>> https://clojuredocs.org/clojure.core/atom) these are built on top of 
>> CAS, which itself is foundation upon which most of concurrent programming 
>> is built. (https://en.wikipedia.org/wiki/Compare-and-swap)
>>
>> Those two primitives alone will handle 90% of the use cases you will run 
>> into as a new clojure developer. The rest of the stuff (agents, thread 
>> pools, refs, vars, cps/core.async) can all come in time, but you will use 
>> them much less often than threads and atoms. So read up on those two and 
>> feel free to come back with any questions you may have. 
>>
>> Timothy
>>
>>
>> On Tue, Apr 5, 2016 at 7:24 PM, Chris White  wrote:
>>
>>> I was doing some reading of code recently to help me get up to speed 
>>> with Clojure. One of the libraries I randomly came across dealt with 
>>> parallelism and I had a hard time following along with it. To try and wrap 
>>> my head around things I did a quick search and found this article:
>>>
>>>
>>> http://www.thattommyhall.com/2014/02/24/concurrency-and-parallelism-in-clojure/
>>>
>>> I'm not sure how authoritative this is based on my current experience, 
>>> but needless to say I was a bit overwhelmed. That said is there any sort of 
>>> introductory material that list members have used to help get them into how 
>>> Clojure deals with concurrency and parallelism? I also don't mind anything 
>>> that's not specifically using Clojure but will at least help me understand 
>>> the concepts behind how Clojure does it. Thanks again for any and all help!
>>>
>>> - Chris White (@cwgem)
>>>
>>> -- 
>>> 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 unsubscribe from this group and stop receiving emails from it, send 
>>> an email to clojure+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> “One of the main causes of the fall of the Roman Empire was that–lacking 
>> zero–they had no way to indicate successful termination of their C 
>> programs.”
>> (Robert Firth) 
>>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Protocols in another namespace, retract-type possible ?

2016-04-04 Thread Niels van Klaveren
Hey Derek,

You're right, I just redefined the Associative implementation to identity, 
making it a no-op and then added an IPersistentMap implementation.
It seemed a bit hacky, but in this case performance doesn't matter too 
much, so it probably works out OK. It might be that the no-op gets 
optimized away by the JVM.



On Thursday, March 24, 2016 at 10:14:11 AM UTC+1, Niels van Klaveren wrote:
>
> In a project using clojure.java.jmx, I was extending it's Destract protocol 
> object->data function  to transform more of the JMX data structures 
> returned from calls or metadata queries into plain clojure data structures. 
> When I was done with the individual data structures, it should have been 
> possible to do a (walk/prewalk jmx/objects->data (jmx/operations 
> "java.lang:type=Threading")).
>
> However, in the Destract protocol there's an implementation of the 
> objects->data function for the type clojure.lang.Associative that would 
> mean maps would be processed incorrectly. I could add an implementation for 
> clojure.lang.IPersistentMap in my namespace, but since 
> clojure.lang.Associative is also an interface for maps this would not 
> work, and I ended up having to fork clojure.java.jmx because of it. If 
> there would be  a way to retract a protocol for a type within another 
> namespace I wouldn't have had to. Is there such a way, or would it even be 
> feasible to implement something like it?
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reworking :pre condition to add an error message

2016-03-30 Thread Niels van Klaveren
Truss also has good support for :pre 
and :post conditions 


On Monday, July 11, 2011 at 7:40:48 PM UTC+2, frye wrote:
>
> Note: This message was originally posted by ' Shantanu' on the "*Re: 
> Clojure for large programs*" thread. 
>
> I took a look at  Shantanu's macros, and I like the concept a lot. But I 
> would prefer something baked into the :pre condition itself. The reason is 
> that it just removes a layer of indirection. If you dig into '
> *clj/clojure/core.clj*', you can see that the 'fn' macro is using 
> 'assert' to test these conditions. Assert allows error messages to be 
> applied, ie: 
>
> *user => (assert false) *
>
> *user => (assert false "fubar") *
>
>
>
> However, (defmacro fn ...) assumes that just the boolean condition is 
> being passed in, A). But I'd like to have the option to pass in a message 
> B). 
>
>
> *A) *
>
> *(def fubar *
>
> *  (fn []*
>
> *{:pre [ (true? false) ] }*
>
> *(println "Hello World")))*
>
> *(fubar)*
>
>
> *B) *
>
> *(def thing *
>
> *  (fn []*
>
> *{:pre [ [(true? false) "A false message"] ] }*
>
> *(println "Hello World")))*
>
> *(thing)*
>
>
>
> I reworked the 'fn' macro, only for the :pre condition, as a demonstration 
> (see here ). The calling semantics don't 
> change that much. Is there any interest in putting this into core? I'd 
> use Shantanu's workaround otherwise, or in the interim. 
>
> Thanks 
>
> Tim Washington 
> twas...@gmail.com  
> 416.843.9060 
>
>
>
> On Sun, Jul 3, 2011 at 11:42 AM, Shantanu Kumar  > wrote:
>
>>
>>
>> On Jul 3, 7:39 pm, Timothy Washington  wrote:
>> > I'm using pre / post assertions quite a bit in a project I'm building. 
>> And I
>> > too would love to see better or custom error messages for each 
>> assertion.
>>
>> That should be possible with a macro. For example, I use this:
>>
>> https://bitbucket.org/kumarshantanu/clj-miscutil/src/acfb97c662d9/src/main/clj/org/bituf/clj_miscutil.clj#cl-1009
>>
>> Maybe you need something like this(?):
>>
>> (defmacro verify-my-arg
>>  "Like assert, except for the following differences:
>>  1. does not check for *assert* flag
>>  2. throws IllegalArgumentException"
>>  [err-msg arg]
>>  `(if ~arg true
>> (throw (IllegalArgumentException. ~err-msg
>>
>> Then use it thus:
>>
>> (defn foo [m]
>>  {:pre [(verify-my-arg "m must be a map" (map? m))]}
>>  (println m))
>>
>> Regards,
>> Shantanu
>>
>> --
>> 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 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: flowchart for choosing the right Clojure parallel primitives?

2016-03-30 Thread Niels van Klaveren
Thanks, that's a really nice overview for the possible parallel processing 
options in clojure.

On Tuesday, March 29, 2016 at 9:53:32 PM UTC+2, David Della Costa wrote:
>
> Hi Sergey, I don't have a direct answer for you but this talk at 
> Clojure/West 2015 by Leon Barrett went over the various options for 
> parallelism in Clojure, and I found it pretty educational myself:
>
>
> https://www.youtube.com/watch?v=BzKjIk0vgzE=PLZdCLR02grLrKAOj8FJ1GGmNM5l7Okz0a=2
>
> Hope that is useful!
>
> DD
>
>
> 2016-03-29 9:56 GMT-04:00 Sergey Didenko  >:
>
>> Hi,
>>
>> Is there a flowchart for choosing the right Clojure parallel primitives?
>>
>> So that you can decide when to just use reducers/fork and when to choose 
>> core.async and etc.
>>
>> For example like the flowchart for data types from Chas Emerick - 
>> http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
>>
>>
>> -- 
>> 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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Protocols in another namespace, retract-type possible ?

2016-03-24 Thread Niels van Klaveren
In a project using clojure.java.jmx, I was extending it's Destract protocol 
object->data function  to transform more of the JMX data structures 
returned from calls or metadata queries into plain clojure data structures. 
When I was done with the individual data structures, it should have been 
possible to do a (walk/prewalk jmx/objects->data (jmx/operations 
"java.lang:type=Threading")).

However, in the Destract protocol there's an implementation of the 
objects->data function for the type clojure.lang.Associative that would 
mean maps would be processed incorrectly. I could add an implementation for 
clojure.lang.IPersistentMap in my namespace, but since 
clojure.lang.Associative is also an interface for maps this would not work, 
and I ended up having to fork clojure.java.jmx because of it. If there 
would be  a way to retract a protocol for a type within another namespace I 
wouldn't have had to. Is there such a way, or would it even be feasible to 
implement something like it?

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Poor parallelization performance across 18 cores (but not 4)

2015-11-17 Thread Niels van Klaveren
Could you also show how you are running these functions in parallel and 
time them ? The way you start the functions can have as much impact as the 
functions themselves.

Regards,
Niels

On Tuesday, November 17, 2015 at 6:38:39 AM UTC+1, David Iba wrote:
>
> I have functions f1 and f2 below, and let's say they run in T1 and T2 
> amount of time when running a single instance/thread.  The issue I'm facing 
> is that parallelizing f2 across 18 cores takes anywhere from 2-5X T2, and 
> for more complex funcs takes absurdly long.
>
>
>1. (defn f1 []
>2.   (apply + (range 2e9)))
>3.  
>4. ;; Note: each call to (f2) makes its own x* atom, so the 'swap!' 
>should never retry.
>5. (defn f2 []
>6.   (let [x* (atom {})]
>7. (loop [i 1e9]
>8.   (when-not (zero? i)
>9. (swap! x* assoc :k i)
>10. (recur (dec i))
>
>
> Of note:
> - On a 4-core machine, both f1 and f2 parallelize well (roungly T1 and T2 
> for 4 runs in parallel)
> - running 18 f1's in parallel on the 18-core machine also parallelizes 
> well.
> - Disabling hyperthreading doesn't help.
> - Based on jvisualvm monitoring, doesn't seem to be GC-related
> - also tried on dedicated 18-core ec2 instance with same issues, so not 
> shared-tenancy-related
> - if I make a jar that runs a single f2 and launch 18 in parallel, it 
> parallelizes well (so I don't think it's machine/aws-related)
>
> Could it be that the 18 f2's in parallel on a single JVM instance is 
> overworking the STM with all the swap's?  Any other theories?
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.java.jdbc prepared select statement

2015-11-09 Thread Niels van Klaveren
Performance wise the conclusion is batch queries done this way are around 
60% faster than doing separate queries for even very simple queries.

On Monday, November 9, 2015 at 11:45:48 AM UTC+1, Niels van Klaveren wrote:
>
> While answering this question 
> <http://stackoverflow.com/questions/33600132/checking-if-uuid-exists-in-postgresql-table-using-clojure-java-jdbc-db-do-prepar/33605673#33605673>
>  
> on stackoverflow about do-prepared I wanted to show the way to do 
> multiple queries with the same prepared statement (batch select). I thought 
> this is possible in Java, but in clojure.java.sql I ran into several 
> problems. Granted that given a properly parameterized query the database 
> should be able to optimize this automatically by using the execution plan 
> from the cache, it might give an extra bit of performance by stating it up 
> front.
> So I set out to test if that was true, but without much success
>
> Here's my first attempt:
>
> (j/with-db-connection[c datasource]
>  (let [ps (j/prepare-statement c "SELECT count(*) from person 
> where left(name,1)=?")]
>(doall (map #(j/query c [ps %]) ["a" "b"]
> ClassCastException clojure.lang.PersistentHashMap cannot be cast to 
> java.sql.Connection  clojure.java.jdbc/prepare-statement (jdbc.clj:454)
>
>
> This is because prepare-statement seems to expect a true connection, not 
> the datasource map. All other attempts to wrangle a connection into 
> with-db-connection ended up in other errors.
>
> (j/with-db-transaction [c (j/get-connection datasource)]
>  (let [ps (j/prepare-statement c "SELECT count(*) from person 
> where left(name,1)=?")]
>(doall (map #(j/query c [ps %]) ["a" "b"]
> IllegalArgumentException No implementation of method: :get-level of protocol: 
> #'clojure.java.jdbc/Connectable found for class: 
> com.microsoft.sqlserver.jdbc.SQLServerConnection  
> clojure.core/-cache-protocol-fn (core_deftype.clj:544)
>
>
> Since query accepts a prepared statement instead of a string, I thought 
> this should be possible without having to implement a query equivalent of 
> do-prepared.
>
> Is there something I overlooked ?
>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.java.jdbc prepared select statement

2015-11-09 Thread Niels van Klaveren
OK, so after some more experimentation I found out I needed to do the 
get-connection in the prepare-statement instead of the with-db-connection 
binding. A bit counter-intuitive, and I hope it will still work when a 
connection pool is used.

(j/with-db-connection [c datasource]
  (let [ps (j/prepare-statement (j/get-connection c)
"SELECT count(*) from 
person where left(name,1)=?")]
(doall (map #(j/query c [ps %])
["a" "b" "c" "d" "e" "f"]



On Monday, November 9, 2015 at 11:45:48 AM UTC+1, Niels van Klaveren wrote:
>
> While answering this question 
> <http://stackoverflow.com/questions/33600132/checking-if-uuid-exists-in-postgresql-table-using-clojure-java-jdbc-db-do-prepar/33605673#33605673>
>  
> on stackoverflow about do-prepared I wanted to show the way to do 
> multiple queries with the same prepared statement (batch select). I thought 
> this is possible in Java, but in clojure.java.sql I ran into several 
> problems. Granted that given a properly parameterized query the database 
> should be able to optimize this automatically by using the execution plan 
> from the cache, it might give an extra bit of performance by stating it up 
> front.
> So I set out to test if that was true, but without much success
>
> Here's my first attempt:
>
> (j/with-db-connection[c datasource]
>  (let [ps (j/prepare-statement c "SELECT count(*) from person 
> where left(name,1)=?")]
>(doall (map #(j/query c [ps %]) ["a" "b"]
> ClassCastException clojure.lang.PersistentHashMap cannot be cast to 
> java.sql.Connection  clojure.java.jdbc/prepare-statement (jdbc.clj:454)
>
>
> This is because prepare-statement seems to expect a true connection, not 
> the datasource map. All other attempts to wrangle a connection into 
> with-db-connection ended up in other errors.
>
> (j/with-db-transaction [c (j/get-connection datasource)]
>  (let [ps (j/prepare-statement c "SELECT count(*) from person 
> where left(name,1)=?")]
>(doall (map #(j/query c [ps %]) ["a" "b"]
> IllegalArgumentException No implementation of method: :get-level of protocol: 
> #'clojure.java.jdbc/Connectable found for class: 
> com.microsoft.sqlserver.jdbc.SQLServerConnection  
> clojure.core/-cache-protocol-fn (core_deftype.clj:544)
>
>
> Since query accepts a prepared statement instead of a string, I thought 
> this should be possible without having to implement a query equivalent of 
> do-prepared.
>
> Is there something I overlooked ?
>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.java.jdbc prepared select statement

2015-11-09 Thread Niels van Klaveren
Thanks for the explanation Sean, that makes a whole lot more sense to me 
now. I knew I had to miss something when I saw query would also accept 
prepared statements!
In no way did I want to criticize your awesome library, and I'll see if I 
can expand on the documentation.

The use of prepared statements in queries was pretty academic to me, since 
most queries I generate do not use much repetition. After all, working in 
sets is the forte of SQL, and repeating queries is something of an 
anti-pattern. However, I was very surprised seeing the performance 
differences in queries. On selecting 100K of separate unids on SQL server 
it was 55 seconds vs. 33 seconds using query vs. reused prepared query, and 
only 360ms of these 55s were spent in prepare-statement. The result set 
processing was identical. I had always assumed normal execution plan 
caching for parametrized queries would be almost just as effective, but 60% 
is no small difference.

I'll definitely keep this in mind whenever I do need to repeat queries and 
transactions.

Monday, November 9, 2015 at 7:11:48 PM UTC+1, Sean Corfield wrote:
>
> Niels van Klaveren wrote on Monday, November 9, 2015 at 7:20 AM:
>
> OK, so after some more experimentation I found out I needed to do the 
> get-connection in the prepare-statement instead of the with-db-connection 
> binding. A bit counter-intuitive, and I hope it will still work when a 
> connection pool is used.
>
>
> Yes, with-db-connection gives you a db-spec with a DB connection added which 
> is specifically what let’s you use get-connection on it to retrieve the 
> existing connection. Prepare-statement accepts a connection, not a 
> db-spec.
>
> Suggestions to improve docstrings are welcomed, as are Pull Requests to 
> improve the community-maintained documentation here:
>
> http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
>
> Sean
>
>
>
> (j/with-db-connection [c datasource]
>   (let [ps (j/prepare-statement (j/get-connection c)
> "SELECT count(*) from 
> person where left(name,1)=?")]
> (doall (map #(j/query c [ps %])
>     ["a" "b" "c" "d" "e" "f"]
>
>
>
> On Monday, November 9, 2015 at 11:45:48 AM UTC+1, Niels van Klaveren wrote:
>>
>> While answering this question 
>> <http://stackoverflow.com/questions/33600132/checking-if-uuid-exists-in-postgresql-table-using-clojure-java-jdbc-db-do-prepar/33605673#33605673>
>>  
>> on stackoverflow about do-prepared I wanted to show the way to do 
>> multiple queries with the same prepared statement (batch select). I thought 
>> this is possible in Java, but in clojure.java.sql I ran into several 
>> problems. Granted that given a properly parameterized query the database 
>> should be able to optimize this automatically by using the execution plan 
>> from the cache, it might give an extra bit of performance by stating it up 
>> front.
>> So I set out to test if that was true, but without much success
>>
>> Here's my first attempt:
>>
>> (j/with-db-connection[c datasource]
>>  (let [ps (j/prepare-statement c "SELECT count(*) from 
>> person where left(name,1)=?")]
>>(doall (map #(j/query c [ps %]) ["a" "b"]
>> ClassCastException clojure.lang.PersistentHashMap cannot be cast to 
>> java.sql.Connection  clojure.java.jdbc/prepare-statement (jdbc.clj:454)
>>
>>
>> This is because prepare-statement seems to expect a true connection, not 
>> the datasource map. All other attempts to wrangle a connection into 
>> with-db-connection ended up in other errors.
>>
>> (j/with-db-transaction [c (j/get-connection datasource)]
>>  (let [ps (j/prepare-statement c "SELECT count(*) from 
>> person where left(name,1)=?")]
>>(doall (map #(j/query c [ps %]) ["a" "b"]
>> IllegalArgumentException No implementation of method: :get-level of 
>> protocol: #'clojure.java.jdbc/Connectable found for class: 
>> com.microsoft.sqlserver.jdbc.SQLServerConnection  
>> clojure.core/-cache-protocol-fn (core_deftype.clj:544)
>>
>>
>> Since query accepts a prepared statement instead of a string, I thought 
>> this should be possible without having to implement a query equivalent of 
>> do-prepared.
>>
>> Is there something I overlooked ?
>>
>> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To pos

clojure.java.jdbc prepared select statement

2015-11-09 Thread Niels van Klaveren
While answering this question 

 
on stackoverflow about do-prepared I wanted to show the way to do multiple 
queries with the same prepared statement (batch select). I thought this is 
possible in Java, but in clojure.java.sql I ran into several problems. 
Granted that given a properly parameterized query the database should be 
able to optimize this automatically by using the execution plan from the 
cache, it might give an extra bit of performance by stating it up front.
So I set out to test if that was true, but without much success

Here's my first attempt:

(j/with-db-connection[c datasource]
 (let [ps (j/prepare-statement c "SELECT count(*) from person 
where left(name,1)=?")]
   (doall (map #(j/query c [ps %]) ["a" "b"]
ClassCastException clojure.lang.PersistentHashMap cannot be cast to 
java.sql.Connection  clojure.java.jdbc/prepare-statement (jdbc.clj:454)


This is because prepare-statement seems to expect a true connection, not 
the datasource map. All other attempts to wrangle a connection into 
with-db-connection ended up in other errors.

(j/with-db-transaction [c (j/get-connection datasource)]
 (let [ps (j/prepare-statement c "SELECT count(*) from person 
where left(name,1)=?")]
   (doall (map #(j/query c [ps %]) ["a" "b"]
IllegalArgumentException No implementation of method: :get-level of protocol: 
#'clojure.java.jdbc/Connectable found for class: 
com.microsoft.sqlserver.jdbc.SQLServerConnection  
clojure.core/-cache-protocol-fn (core_deftype.clj:544)


Since query accepts a prepared statement instead of a string, I thought 
this should be possible without having to implement a query equivalent of 
do-prepared.

Is there something I overlooked ?

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cursive and gen-class

2015-08-25 Thread Niels van Klaveren
If you had read more attentively, he uninstalled Cursive because he 
suspected a reinstall might fix an error. However, the error was caused 
because in Cursive, an extra step is necessary configuring the project to 
make gen-class work in certain situations, so the unistall was unnecessary.

When reinstalling, he added the wrong update site version when installing 
the plugin, which is why Cursive didn't work. Fixing the update link fixed 
Cursive.

So no problems were caused by Cursive or IntelliJ, just two 
misconfigurations.


On Tuesday, August 25, 2015 at 8:08:16 PM UTC+2, Fluid Dynamics wrote:

 On Tuesday, August 25, 2015 at 1:05:30 PM UTC-4, Colin Fleming wrote:

 On 25 August 2015 at 18:22, Fluid Dynamics a209...@trbvm.com wrote:

 I seem to recall criticizing a piece of Clojure-relevant *technology* 
 that had the rather remarkable property that it could be working, be 
 deleted and reinstalled (exact same version), and suddenly be *not* working.


 Except that's not actually what happened. The sequence of events is 
 difficult to work out from the email chain, but William was trying to 
 install a version of Cursive into a version of IntelliJ it didn't support. 
 That never works, and I'm 100% sure that it hadn't worked for him 
 previously.


 I'm pretty sure he said he uninstalled Cursive, then reinstalled the exact 
 same version of Cursive that he had just uninstalled, and it didn't work. 
 That clearly is broken behavior. If it was there and working fine before, 
 then scrozzled itself, and then reinstalling it made things *worse* instead 
 of getting it back into the pre-scrozzled state, then that's broken.
  


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: awful performance on Windows 7 compared to anything else

2015-07-08 Thread Niels van Klaveren
SLF4J / Logback is a fine system for logging, including reduced log line 
work done when not logging (instead of the normal filtering system), and 
also features an optional asynchronous appender. Even without it, it can 
perfectly handle the load when configured correctly.

However, when run through the Tanuki for Windows Java executable/service 
wrapper, any loglines written to stdout will be redirected by the service 
wrapper to not only being logged to the intended logfiles, but also to the 
console and the Tanuki logs. This splitting / redirection creates a 
blocking bottleneck that reduced log throughput between 1000x and 1x. 
No amount of buffering could alleviate that.

That's why I suggested performance should be checked with and without 
wrapper to see if there is a difference there.

In the last case I hinted at, a developer config ended up in a production 
environment, causing logs not going through their specialized channels to 
the logfiles but through stdout, and therefore through the wrapper 
bottleneck. This caused end user actions which would normally be sub 
second, to take up to 10-100 seconds.

On Wednesday, July 8, 2015 at 12:37:36 PM UTC+2, Fluid Dynamics wrote:

 On Wednesday, July 8, 2015 at 5:41:47 AM UTC-4, Niels van Klaveren wrote:

 Colin, be aware that running through service wrappers can introduce a lot 
 of overhead / blocking on logging due to stdout redirects.
 Our application had to switch to SLF4J / Logback, since logging with JUL, 
 Log4J or to console / stdout and incorrectly configuring the wrapper could 
 lead to 100 ms pauses caused by log blocking.
 Even then, as I all too recently noticed, a simple configuration error 
 could bring these problems back even when using SLF4J / Logback.

 That's something you might look into when there's no problem running as a 
 jar, but occurring solely when run through a service wrapper.


 What about putting some type of async construct between the generation of 
 log events and the actual logging?

 If thorough logging trumps throughput, maybe an async channel with a large 
 buffer size. If logging activity is heavy enough backpressure will 
 eventually reach and slow the producer.

 If throughput trumps thorough logging, send-off log messages to an agent 
 that does something like (swap! queue-atom #(conj (take queue-max %1) msg)) 
 and calls .notify on a latch. Elsewhere a thread polls the queue, consumes 
 the last item from it and outputs it to the log it if it's nonempty and 
 .waits the latch otherwise, and loops. Now log items pile up up to 
 queue-max if the producer overruns the consumer, but instead of 
 backpressure you get older items from the queue being dropped on the floor 
 if the log-writer can't keep up with the main system's generation of log 
 notifications. (Consumer now looks something like (loop [] (swap! 
 queue-atom #(do (reset! holder (last %)) (butlast %))) (if @holder (do (log 
 @holder) (reset! @holder nil)) (.wait latch)) (recur)).)



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: awful performance on Windows 7 compared to anything else

2015-07-08 Thread Niels van Klaveren
Colin, be aware that running through service wrappers can introduce a lot 
of overhead / blocking on logging due to stdout redirects.
Our application had to switch to SLF4J / Logback, since logging with JUL, 
Log4J or to console / stdout and incorrectly configuring the wrapper could 
lead to 100 ms pauses caused by log blocking.
Even then, as I all too recently noticed, a simple configuration error 
could bring these problems back even when using SLF4J / Logback.

That's something you might look into when there's no problem running as a 
jar, but occurring solely when run through a service wrapper.

Regards,
Niels

On Tuesday, July 7, 2015 at 6:37:05 PM UTC+2, Colin Yates wrote:

 Hi Alan, 

 Interesting point about the memory, they are defaults everywhere though. I 
 am going to deploy on Windows 7 as a service rather than running java -jar 
 in a command window; it does produce a bunch of debugging and maybe Windows 
 7 console compared to Windows XP console (for example) is the 
 differentiator. Straws, grasping etc. 

 No, the app never gets to respectable performance. 

  On 7 Jul 2015, at 16:37, Alan Moore kahun...@coopsource.org 
 javascript: wrote: 
  
  Maybe the JDK default memory/heap settings are different on Windows 7. 
 What is the memory pressure like on your Windows 7 system? 
  
  You might need to give your app more memory or at least a larger initial 
 heap allocation. 
  
  Does the app perform ok once it is up and running? 
  
  Alan 
  
  -- 
  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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/d/optout. 



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why aren't libraries like clojure/(data.csv, ...) on clojars.org?

2015-05-11 Thread Niels van Klaveren
Code that does consume artifacts would never be complete with just adding maven 
central or having libraries duplicated on clojars. It should use the repo info 
from lein or maven to include local, snapshot and other external repositories, 
like lein ancient does.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Extend java class to participate in sequence operations

2015-03-17 Thread Niels van Klaveren
If a java class implements Iterable, it automatically supports seq.

On Tuesday, March 17, 2015 at 11:34:17 AM UTC+1, juvenn wrote:

  Dear all,

 Given a node type from singly linked list:

 class Node {
 int val;
 Node next;
 }

 How do I extend it so `(seq node)` will return a sequence of values? And 
 generally first, rest, and next will work on node too.

 While in Java, we could define the class to implement Iterable to achieve 
 this. In Clojure we do have `extend-type`, but it seems not accepting 
 interfaces to extend, nor do I find protocol for seqable.

 So generally, given a class defined in Java, assuming it is not available 
 for rewrite, how shall we extend the class to participate in sequence 
 operations in Clojure?

 Thanks in advance!
  
 —
 Sent from Mailbox https://www.dropbox.com/mailbox 
  

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Niels van Klaveren
I've done a fair bit of complex SQL with honeysql, and must say it rocks. 
It could use a bit more documentation where extending it with new clauses 
is concerned, though.

For my latest project being able to manipulate the datastructures that are 
rendered to SQL was crucial, and honeysql was the only one that fitted that 
bill. Basically, it generates SQL scripts to relink foreign key references 
to clean up duplicates in a database. It takes a honeysql select query with 
(at least) a from table, a group-by and an order-by clause as a base 
definition what are to be considered doubles, and in which order records 
should be preserved. In combination with JDBC metadata that query 
effectively gets rewritten to generate:

A temporary replacement table
Queries to unify unique indexes, to prevent clashes when foreign key 
references are updated
Queries to update all foreign key references
Delete statements to remove all duplicates

To create the best performing, but still database independent SQL, I had to 
extend honeysql with extra clauses like OVER and PARTITION BY. I wouldn't 
say it was a breeze, but seemed to work very well.
Compared to the previous version I wrote in Ruby (without these clauses), 
the SQL now only scales with the amount of unique / foreign key 
constraints, instead of the amount of doubled sets.

That cut down SQL to (sometimes) GB's of script to around a few 100 lines 
of SQL, and on one occasion, a runtime from 19 hours to 1.5 minutes.

All in all, pretty impressed with Clojure and HoneySQL.


On Tuesday, February 24, 2015 at 3:04:36 PM UTC+1, Colin Yates wrote:

 Hi all,

 What are you all using for interacting with an RDBMS? In the past I looked 
 at clojure.java.jdbc, honeysql and korma (and for querying, honeysql just 
 rocks). I have lost touch a bit - any recommendations?

 Thanks.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Niels van Klaveren
Perhaps I'm missing something, but I don't really see the advantages of yesql 
over standard parametrized clojure.java.jdbc queries ?

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hi I am a new user of clojure ,I am not being able to use lein

2015-01-27 Thread Niels van Klaveren
There are some problems with the lein MSI and Chocolaty installs, because 
of wget/curl certificate handling on Windows. If you use lein.bat without 
wget or curl (you can remove wget or curl exes from the lein.bat 
directory), lein will default to Powershell for downloading which works as 
intended.

Regards,

Niels 

On Monday, January 26, 2015 at 10:48:07 AM UTC+1, Bis wrote:

 I am trying from some time but cant install lein.

 Tried with the MSI installer and it finishes properly but no repl is 
 created neither lein
 tried with lein.bat ,getting errors everytime ,
 Exception calling Downloadfile with two arguement.the remote server 
 returned an error 403 forbidden.(set http client to wget and tried also 
 ,btw lein.bat is taken from the official site so not sure if the official 
 version of the bat file is trying to get some unstable release or not )
 tried with chocolatey but chocolatey tries to install JDK 7 and its 
 failing ,although I have JDK8 in my system 
 Please some one help to debug ,I am getting frustrated 


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Open html file in Clojure

2014-12-08 Thread Niels van Klaveren
Perhaps it could be as simple as browse-url 
http://clojuredocs.org/clojure.java.browse/browse-url ..

On Monday, December 8, 2014 5:44:10 PM UTC+1, daveray wrote:

 Nope. It barely renders HTML3. JavaFX, I think, has a real embedded 
 browser component. And, of course, it's always easy to just launch a 
 browser: 
 http://docs.oracle.com/javase/6/docs/api/java/awt/Desktop.html#browse%28java.net.URI%29

 Dave

 On Mon, Dec 8, 2014 at 4:23 AM, Gary Verhaegen gary.ve...@gmail.com 
 javascript: wrote:

 This seems to be what Fluid is talking about:

 https://docs.oracle.com/javase/tutorial/uiswing/components/html.html

 I wiuld be a bit wary, however: I doubt this is a complete implementation 
 of an HTML5-compatible browser with state of the art JavaScript 
 interpreter. It's worth trying, but I would not really bet on that being 
 able to display a Google Maps widget.

 On Monday, 8 December 2014, Fluid Dynamics a209...@trbvm.com 
 javascript: wrote:

 On Sunday, December 7, 2014 6:50:54 PM UTC-5, juan.facorro wrote:

 Hi Priyanka,

 I don't think there's enough information for someone to be able to help 
 you. When you say .html do you mean JavaScript or ClojureScript code? It 
 will be a lot easier to help you, if you share the code from the desktop 
 app and the code you are using to get the location information.


 It sounds like he just wants to display a web page in his app, and has 
 its URL. I think there may be Java Swing components that can do that. 

 -- 
 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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  -- 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Nightcode problem

2014-12-07 Thread Niels van Klaveren
Nightcode is starting a 32 bits version of the JVM which only supports a max of 
2 Gb continuos memory. Install a 64 bits JVM or lower the Xmx to 1500m.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting sick and tired of [trace missing]

2014-12-04 Thread Niels van Klaveren


On Wednesday, December 3, 2014 11:53:02 PM UTC+1, Laurent PETIT wrote:


 Hello Niels, 

 that's interesting. Would it deserve that CCW adds this option 
 automatically when asked to start a REPL ? I could probably easily do this 
 in both cases : when the REPL start is delegated to Leiningen, or when the 
 REPL is created by ccw by using whatever is in the project's java build 
 path.

 Do you know if there would be e.g. performance impacts that would be 
 annoying for certain kinds of projects?
  

Hello Laurent,

I would have no idea if the performance is impacted or not by using that 
flag permanently. If you always have access to the first time the same 
exception was thrown at the same place, it's no problem and wouldn't be 
worth the hassle. I think if you want to put it somewhere, it would be in a 
lein profile so you'd have it in development, but not in production.

Regards,

Niels  


 -- 
 Laurent Petit
  

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting sick and tired of [trace missing]

2014-12-03 Thread Niels van Klaveren
This isn't a CCW exclusive issue, but the Oracle JVM 'optimizing away' 
stacktraces.

It can be remedied by adding the '-XX:-OmitStackTraceInFastThrow' flag to 
the JVM startup parameters of the process you're starting.
If Leiningen is used to start the JVM, add the following setting to your 
lein project.clj map:


:jvm-opts ^:replace [-XX:-OmitStackTraceInFastThrow]

Oh, and you're welcome..



On Wednesday, December 3, 2014 6:29:23 PM UTC+1, Fluid Dynamics wrote:

 It's a giant pain to debug exceptions without stack traces. This seems to 
 be a problem specific to CCW, as I don't encounter it using other 
 development environments.

 Is this going to be fixed anytime soon?


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting sick and tired of [trace missing]

2014-12-03 Thread Niels van Klaveren
I'm sure first thing in the morning there'll be someone at Larry Ellison's 
door clamoring for removal of hotspot optimization from the JVM..

On Wednesday, December 3, 2014 10:41:34 PM UTC+1, Sam Ritchie wrote:

 The first result of googling

 jvm [trace missing]

 is really helpful here.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: is any work done to draw sequence diagrams with drcode/vijual ?

2014-12-02 Thread Niels van Klaveren
AFAIK there's several libraries for interfacing with graphviz, all coming 
from a slightly different angle
 
   
   - drcode/vijual https://github.com/drcode/vijual
  - Emphasis on ascii graphics, alternately output to graphviz
  - daveray/dorothy https://github.com/daveray/dorothy
  - Generating graphviz graphs using hiccup like syntax
   - ztellman/rhizome https://github.com/ztellman/rhizome
  - Graphviz rendering through transformation functions on Clojure data 
  structures 
  - aysylu/loom/io.clj 
   https://github.com/aysylu/loom/blob/master/src/loom/io.clj
  - Visualizing loom graphs through Graphviz, very limited output 
  options
  
Aside from Graphviz integration, there's also numerous other Java graph 
visualization libraries that could be used.

What parts of Vijual or the other libraries have your interest ?

On Monday, December 1, 2014 6:03:51 PM UTC+1, JUAN ANTONIO Ruz wrote:

 Hi guys,

 I'm trying to guess in which state is drcode/vijual 
 https://github.com/drcode/vijual or which would be the better fork to 
 start working on this drawing sequence diagrams feature...
 It's a really shame that this so cool tool seems to not be maintained any 
 more :(

 Any advises or any references to start with?

 thanks in advance
 Juan


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Core.async unordered pipeline-blocking ?

2014-11-28 Thread Niels van Klaveren
Thanks so much for sharing, Francis ! It might be simple to some, but I 
haven't had an opportunity yet to get acquainted well enough with 
core.async. Clojure has so much useful libraries, but some force you to get 
your head around (for me) completely new paradigms which can take time. 
Reading your code did provide me a with lot of new insights, as well as 
having a very useful tool I can use.

All time I can devote to learning Clojure have been in projects at work I 
have to do by myself, often needing to be put together on short notice. 
There's a snowball's chance in hell of collaboration with my colleagues 
from the firmly Java entrenched development department. I need to have a 
solid idea how I can get from start to finish in a very short time, for 
which Clojure has been quite awesome in some ways, but quite hard in 
others. The awesome community is often just the push in the back to get 
over these hurdles though.

Now I have all parts in hand I can start improving some more mature 
projects by introducing core.async into them. Wiring up existing pieces 
will get me more experience and confidence to dive deeper into async 
libraries. Thanks again for the last part of the puzzle, I'm pretty sure I 
will be able to finish putting it together now !

On Friday, November 28, 2014 6:10:05 PM UTC+1, Francis Avila wrote:

 I had a need for this too some time ago. It's not very hard to write 
 yourself. Whatever trickiness there is in these functions is in handling 
 exceptions and orchestrating shutdown.

 I put my version up in a gist with some other async utility functions I 
 wrote: https://gist.github.com/favila/8e7ad6ea5b01bd7466ff
 You are looking for fast-pipeline-blocking.

 On Thursday, November 27, 2014 3:32:43 PM UTC-6, Niels van Klaveren wrote:

 Recently in creating load testing I've been in need of throttling certain 
 mixed IO/CPU bound processes and have been using claypoole.core/upmap 
 for those situations

 (require '[com.climate.claypoole :as cp])

 (defn wait-and-return
   [w]
   (Thread/sleep (* 1000 w))
   w)

 (def to-sort
   [38 20 22 24 36 2 30 18 32 0 4 34 14 28 6 16 12 26 8 10])

 (def timesorted
   (time (doall (cp/upmap 20 wait-and-return to-sort

 timesorted
 Elapsed time: 38004.512729 msecs
 = (var clay.core/timesorted)
 = (0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)


 This is just an example to show blocking processes returning in a 
 different order, while being restricted to a certain number of threads. I 
 know this won't work with a threadpool smaller than to-sort.

 Other parts of these tests would benefit from core.async techniques, but 
 I haven't found a satisfactory combination of the two. What I'm really 
 looking for is a way to use core.async pipeline-blocking syntax, which 
 takes a fixed number of parallel processes, a from channel, a transducer 
 and a to channel, but returns the results from the transducers unordered 
 (ie. fasted delivered first. Something like this, but with an ordered 
 outcome.

 (require '[clojure.core.async :as a])

 (def to-sort
   (a/to-chan [38 20 22 24 36 2 30 18 32 0 4 34 14 28 6 16 12 26 8 10]))

 (defn wait-and-return
   [w]
   (Thread/sleep (* 1000 w))
   w)

 (def sorted
   (a/chan))

 (def xwait
   (map wait-and-return))

 (def sorter
   (a/pipeline-blocking 20 sorted xwait to-sort))

 (time (a/!! (a/into [] sorted)))


 Is there a function like that, or would there be a recommended way to do 
 something like this in core.async ?

 Regards,

 Niels



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Core.async unordered pipeline-blocking ?

2014-11-27 Thread Niels van Klaveren
Recently in creating load testing I've been in need of throttling certain 
mixed IO/CPU bound processes and have been using claypoole.core/upmap for 
those situations

(require '[com.climate.claypoole :as cp])

(defn wait-and-return
  [w]
  (Thread/sleep (* 1000 w))
  w)

(def to-sort
  [38 20 22 24 36 2 30 18 32 0 4 34 14 28 6 16 12 26 8 10])

(def timesorted
  (time (doall (cp/upmap 20 wait-and-return to-sort

timesorted
Elapsed time: 38004.512729 msecs
= (var clay.core/timesorted)
= (0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38)


This is just an example to show blocking processes returning in a different 
order, while being restricted to a certain number of threads. I know this 
won't work with a threadpool smaller than to-sort.

Other parts of these tests would benefit from core.async techniques, but I 
haven't found a satisfactory combination of the two. What I'm really 
looking for is a way to use core.async pipeline-blocking syntax, which 
takes a fixed number of parallel processes, a from channel, a transducer 
and a to channel, but returns the results from the transducers unordered 
(ie. fasted delivered first. Something like this, but with an ordered 
outcome.

(require '[clojure.core.async :as a])

(def to-sort
  (a/to-chan [38 20 22 24 36 2 30 18 32 0 4 34 14 28 6 16 12 26 8 10]))

(defn wait-and-return
  [w]
  (Thread/sleep (* 1000 w))
  w)

(def sorted
  (a/chan))

(def xwait
  (map wait-and-return))

(def sorter
  (a/pipeline-blocking 20 sorted xwait to-sort))

(time (a/!! (a/into [] sorted)))


Is there a function like that, or would there be a recommended way to do 
something like this in core.async ?

Regards,

Niels

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Why doe floor and ceil accept clojure.lang.Ratio but round not

2014-11-24 Thread Niels van Klaveren
If you want math operations that are guaranteed to  work with all clojure 
numeric types, be sure to use clojure.math.numeric-tower

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] freactive - high performance, pure Clojurescript, declarative DOM library

2014-11-20 Thread Niels van Klaveren
This looks pretty impressive, both in already implemented features and 
performance.

I can't help but wonder though if the example chosen to compare performance 
with React/ Reagent isn't stacked a bit because effectively all nodes are 
rerendered all the time ? Wouldn't this effectively nullify performance 
gains from different diffing behavior ? I know it's in the cards, but how 
is the performance difference now while only needing to rerender parts of 
the dom ?

On Monday, November 17, 2014 10:03:08 PM UTC+1, Aaron wrote:



 On Monday, November 17, 2014 2:42:38 PM UTC-5, Aaron wrote:

 On Monday, November 17, 2014 2:27:17 PM UTC-5, Ruslan Prokopchuk wrote: 
  I've played a little bit with freactive today, and investigated this 
 idea with using polymer components — it works! I'm unsure of right usage of 
 rx, especially on conditional rendering — (rx (if @state ... does 
 autorerendering, but (rx (if (:key @state) ... does not. And there are some 
 questions about how to structure app properly. I'm too tired to formulate 
 them today, but bigger than performance demo examples and more 
 documentation are welcome, because I'm very enthusiastic to use freactive 
 in real projects! 
  

 Hope I can make the intended usage and specifics about 
 update/invalidation behavior more clear - but probably another day as well. 
 Structuring large apps is something we're figuring out as we go...


 Okay, this is what I want to say about structuring an app - I think the 
 ideal way would be to have a single (rx (dispatch-state @state)) at the 
 root of the app where dispatch-state is something like a multi-method.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: assert inside an if-let

2014-11-19 Thread Niels van Klaveren
From the docs If test is true, evaluates then with binding-form bound to 
the value of  test, if not, yields else. So a is NEVER bound within the 
else block, and can't compile.

On Wednesday, November 19, 2014 3:34:13 PM UTC+1, Las wrote:

 Hi,

 the following form doesn't compile and I see no reason why it shouldn't:

 (if-let [a a] a (assert a))

 IMHO it is a bug.

 If anyone is of a different opinion please share.

 Thanks,

 -- 
 László Török

 

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: OJ - A friendly way to talk to your database using Clojure.

2014-11-04 Thread Niels van Klaveren
Looks cool, any design decisions that made you create this instead of using 
honeysql https://github.com/jkk/honeysql ?

On Tuesday, November 4, 2014 3:45:35 AM UTC+1, Taylor Lapeyre wrote:



 GitHub project link:
 https://github.com/taylorlapeyre/oj

 The idea is to lay a solid foundation for talking to databases in Clojure 
 using regular Clojure data structures to represent queries. My goal is to 
 let this library become established enough that is becomes the foundation 
 for larger frameworks that abstract away the ideas found in SQL.

 Looking for feedback and for others to help me on this project! I hope you 
 find this useful, it has been very useful for me so far.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure terminology

2014-09-12 Thread Niels van Klaveren
http://aphyr.com/posts/301-clojure-from-the-ground-up-welcome.

Kyle Kingsbury's Clojure from the ground up has an excellent introduction about 
symbols, vars and quoting where he introduces them in the beginning of the 
course which makes things pretty clear and which makes the steo up to macro's 
less complicated than any of the Clojure books I've read.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Transducers are Coming

2014-08-31 Thread Niels van Klaveren
Great to see that it's on the cards. Really looking forward to be able to 
use this when stable. Also, wouldn't transducers also open up the way to 
define the chunking size of transduced lazy operations ? Something like 
(with-chunk-size 1 (xform data)) ? Or would this make chunking a non-issue 
anyway ?

On Thursday, August 7, 2014 2:05:33 PM UTC+2, Rich Hickey wrote:

 The integration with reducers is still todo. 

 On Aug 7, 2014, at 7:03 AM, Niels van Klaveren niels.va...@gmail.com 
 javascript: wrote: 

  Will the new transducer abstraction also (partly) replace / incorporate 
 the reducer library ? 
  So we could do something like (def xform (comp (fold +) (map inc) 
 (filter even?)))  to leverage parallelism ? 
  
  On Wednesday, August 6, 2014 8:01:24 PM UTC+2, Rich Hickey wrote: 
  I pushed today the initial work on transducers. I describe transducers 
 briefly in this blog post: 
  
  http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming 
  
  This work builds on the work done for reducers, bringing 
 context-independent mapping, filtering etc to other areas, such as 
 core.async. 
  
  This is work in progress. We will be cutting alpha releases to help make 
 it easier to start using core's transducers together with core.async's new 
 support for them. 
  
  I am very excited about this powerful technique and how we all might use 
 it. 
  
  Please have a look. 
  
  Feedback welcome, 
  
  Rich 
  
  
  -- 
  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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/d/optout. 



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Prismatic Schema: Unclear exception in subsequence validation

2014-08-13 Thread Niels van Klaveren


(def field-order
  [(s/one s/Keyword field)
   (s/one (s/enum :asc :desc) order)])

(s/validate field-order
[:name :dexc])

ExceptionInfo Value does not match schema: [nil (named (not (#{:desc :asc} 
:dexc)) order)]  schema.core/validate (core.clj:165)

This is a pretty clear error message indicating the second keyword is neither 
:asc nor :desc.
However, when I use this validation in a vector that can contain either 
keywords or field-order vectors, things get a lot less clear.

(s/validate
  [(s/either s/Keyword
 field-order)]
  [:age [:name :dexc]])

ExceptionInfo Value does not match schema: [nil (not (some (check % [:name 
:dexc]) schemas))]  schema.core/validate (core.clj:165)

So, some check over the [:name :dexc] pair goes wrong, but the detail what 
exactly is lost.
Is there any way I can improve on this by changing the validate functions ?

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Prismatic Schema: Unclear exception in subsequence validation

2014-08-13 Thread Niels van Klaveren
Thanks much Francois, since the validation works, I'll leave it at that and 
will follow the plumbing mailing list to see what happens.

Regards,

Niels

On Wednesday, August 13, 2014 3:20:02 PM UTC+2, François Rey wrote:

  The resulting message is generated by the walk method of the s/Either 
 record, see this line:

 https://github.com/Prismatic/schema/blob/ce582d1602abde47143a618745cdd079e0cdaf44/src/cljx/schema/core.cljx#L437

 Perhaps removing the quote before 'schemas would make the message clearer:

 (list 'some (list 'check '% (utils/value-name x)) schemas))


 That would be a quick fix to avoid a strange message, and may have been 
 what was intended originally (typo bug?).
 Otherwise one would have to change the logic, perhaps by accumulating the 
 result of walking each contained schema and combine them perhaps like this:

 (conj 'or res)


 the idea being to display a list of test for each schema or'ed together.

 I'm copying this in the prismatic mailing list for the record, perhaps 
 Jason has further comments on this.

 François
  

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Transducers are Coming

2014-08-07 Thread Niels van Klaveren
Will the new transducer abstraction also (partly) replace / incorporate the 
reducer library ?
So we could do something like (def xform (comp (fold +) (map inc) (filter 
even?)))  to leverage parallelism ?

On Wednesday, August 6, 2014 8:01:24 PM UTC+2, Rich Hickey wrote:

 I pushed today the initial work on transducers. I describe transducers 
 briefly in this blog post: 

 http://blog.cognitect.com/blog/2014/8/6/transducers-are-coming 

 This work builds on the work done for reducers, bringing 
 context-independent mapping, filtering etc to other areas, such as 
 core.async. 

 This is work in progress. We will be cutting alpha releases to help make 
 it easier to start using core's transducers together with core.async's new 
 support for them. 

 I am very excited about this powerful technique and how we all might use 
 it. 

 Please have a look. 

 Feedback welcome, 

 Rich 



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best tools for profiling Clojure programs?

2014-07-03 Thread Niels van Klaveren
No, also for Oracle JVM on Linux, and 64 bit Mac OS X

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best tools for profiling Clojure programs?

2014-07-02 Thread Niels van Klaveren
Oops, forgot to state Java Mission Control flight recording is for Oracle 
JVM only.

On Tuesday, July 1, 2014 1:10:42 PM UTC+2, Niels van Klaveren wrote:

 A new option for test purposes is included in JDK 1.7.0_40 and up and is 
 called Java Mission Control. It is located in the JDK as /bin/jmc.exe.

 With it you can connect to a local java process, or remotely through RMI, 
 and record all kinds of performance characteristics in a Flight Recording. 
 Such a flight recording can be a defined for a limited time, or it can 
 buffer the recording to record only the latest x minutes. Overhead depends 
 on the monitoring template used, but is typically around 2%. These 
 recordings can then be browsed, analyzed and queried in a pretty good 
 interface after the recording has been saved.

 To do so, you need to have the following options in your project.clj, and 
 run your project on a JDK  1.7.0_40

 :jvm-opts [
 ; add Flight Recording options
 -XX:+UnlockCommercialFeatures
 -XX:+FlightRecorder
 ; add RMI connection (to connect to process remotely or 
 running as service/daemon)
 ; this example has NO authentication enabled through the 
 RMI port
 -Dcom.sun.management.jmxremote
 -Dcom.sun.management.jmxremote.port=
 -Dcom.sun.management.jmxremote.authenticate=false
 -Dcom.sun.management.jmxremote.ssl=false]


 On Friday, June 20, 2014 3:05:05 PM UTC+2, ru wrote:

 Hi all,

 What performance profiling instrument somebody can recommend for Clojure 
 programs and corresponding documents, articles or tutorials. Thanks in 
 advance.

 Sincerely,
   Ru



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best tools for profiling Clojure programs?

2014-07-01 Thread Niels van Klaveren
A new option for test purposes is included in JDK 1.7.0_40 and up and is 
called Java Mission Control. It is located in the JDK as /bin/jmc.exe.

With it you can connect to a local java process, or remotely through RMI, 
and record all kinds of performance characteristics in a Flight Recording. 
Such a flight recording can be a defined for a limited time, or it can 
buffer the recording to record only the latest x minutes. Overhead depends 
on the monitoring template used, but is typically around 2%. These 
recordings can then be browsed, analyzed and queried in a pretty good 
interface after the recording has been saved.

To do so, you need to have the following options in your project.clj, and 
run your project on a JDK  1.7.0_40

:jvm-opts [
; add Flight Recording options
-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder
; add RMI connection (to connect to process remotely or 
running as service/daemon)
; this example has NO authentication enabled through the 
RMI port
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false]


On Friday, June 20, 2014 3:05:05 PM UTC+2, ru wrote:

 Hi all,

 What performance profiling instrument somebody can recommend for Clojure 
 programs and corresponding documents, articles or tutorials. Thanks in 
 advance.

 Sincerely,
   Ru


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Elementary question about displaying images in an app

2014-04-24 Thread Niels van Klaveren
The best way to use Swing from Clojure is the seesaw 
library.https://github.com/daveray/seesawIt managed to clojurize Swing 
remarkably well, and is trying it's hardest 
to get all glaring inconsistencies out of swing use.
Simple example to set a background for a frame:

(frame
:title Hello
:content (label :icon (clojure.java.io/file image)))

On Thursday, April 24, 2014 8:39:12 PM UTC+2, Christopher Howard wrote:

 This is, I think, as much of a Java question as a Clojure question 
 (I'm learning both at the same time). I'm writing a small desktop 
 application, and I need to paint a few images in one part of the 
 window (contained in PNGs). I'm looking through AWT/Swing/Graphics2D 
 documentation, but I am a little unclear about the correct/modern way 
 of doing this. 

 Is Canvas the component I need? If so, how do I subclass it and 
 override the paint method (from within Clojure). Or is there a better 
 way to approach this? 


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: is there a way I can learn clojure with a lot of exercises

2014-04-16 Thread Niels van Klaveren
I suggest read up on Clojure for the Brave and 
Truehttp://www.braveclojure.comand Clojure 
from the Ground 
Uphttp://aphyr.com/posts/301-clojure-from-the-ground-up-welcome, then start 
on 4clojure's 
exercises http://www.4clojure.com. I'd recommend it over sites with euler 
problems, since those are more about finding good algorithms for generic 
puzzles, while 4clojure gives more insight into Clojure's inner workings 
and pitfalls.

As references use clojure-doc.org for tutorials and clojuredocs.org for 
core function examples.

On Wednesday, April 16, 2014 9:53:06 AM UTC+2, Roelof Wobben wrote:



 Thanks, 

 Can this site also be good : http://www.braveclojure.com/

 Roelof


 Op woensdag 16 april 2014 09:07:36 UTC+2 schreef Bruce Wang:

 Try 4clojure.com


 On Wed, Apr 16, 2014 at 4:56 PM, Roelof Wobben rwo...@hotmail.comwrote:

 Hello, 

 I like to try clojure.
 I have little or none programming background but I know I learn the best 
 by reading a piece of text
 and then do exercises about it so I can check if I really understand it.

 What is then the best way to proceed ?

 Roelof

  -- 
 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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 simple is good
 http://brucewang.net
 http://twitter.com/number5
  


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to work with variables that need to change

2014-04-12 Thread Niels van Klaveren
For storing timing results of expressions, I make use of an agent to store 
them in, and a modified time macro.

(def timings (agent []))

(defmacro send-timing
  Evaluates expr and prints the time it took.  Returns the value of
 expr.
  {:added 1.0}
  [agnt expr]
  `(let [start# (System/currentTimeMillis)
 ret# ~expr
 end# (System/currentTimeMillis)]
 (send ~agnt conj {:expression '~expr
   :start start#
   :end end#
   :duration (- end# start#)})
 ret#))

(send-timing timings (Thread/sleep 3000))

@timings
= [{:expression (Thread/sleep 3000), :duration 3000, :start 1397313034715, 
:end 1397313037715}]

On Saturday, April 12, 2014 2:13:44 PM UTC+2, Cecil Westerhof wrote:

 At the moment I have the following:
 (def numbers '(4 6 8 10))

 (doseq [number numbers]
(foo number))

 The call foo generates some output, but I also want to save the time it
 took for the call to complete. At the moment I am thinking about
 something like:
 (def numbers '(4 6 8 10))

 (def ^:dynamic needed-times ())
 (doseq [number numbers]
(let [start (now)]
 (foo number)
 (def ^:dynamic needed-times
(cons (- (.getTimeInMillis (now)) 
 (.getTimeInMillis start))
  needed-times

 But it looks a ‘little’ cumbersome. Is there a better way to do this?

 Also if I need to use several points in time, do I keep nesting ‘let’,
 or is there a better way?

 -- 
 Cecil Westerhof 


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Error when starting REPL

2014-03-28 Thread Niels van Klaveren
Its a problem with writing to a temp folder. Run Ccw as admin, or take a look 
at the counterclockwise group for a solution that doesn't need that.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Source code reloading with leiningen checkouts

2014-02-26 Thread Niels van Klaveren
Windows (7) has different versions of linking. For checkouts to work on 
Windows 7 you need to have a *junction* to the directory, not a symbolic 
link.
I make mine with Link Shell Extension for Windows 
Explorerhttp://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html, 
and have no problems.

On Monday, February 24, 2014 6:46:20 AM UTC+1, Sven Richter wrote:

 Hi,

 I already posted this on SO, but as I got no answer there yet I will try 
 here too.

 I have two clojure projects, one a luminus project (main) with http-kit 
 and a second (sub) plain clojure project with a single dependency to 
 datomic.
 Now I added the checkouts folder to main and inside made a link to sub.
 When I start main with lein run -dev sub is recognized and put on 
 the classpath, however, every change I do to sub source files are not 
 recognized until I restart my server.

 I am working on W7 with Oracle JDK7 and created the link with windows 
 mklink tool. Any Ideas what might be wrong here?

 Best Regards,
 Sven


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 'Reduced' and logic functions

2014-02-20 Thread Niels van Klaveren



 The definitions of alt-or and alt-and are swapped:

 (alt-or false true) and (alt-or true false) both return false, (but (and) 
 is true, and both (alt-and) and (alt-or) are false).

 (alt-and true false) and (alt-and false true) both return true.


That's some serious CP errors there indeed, thanks Ben. For completeness 
sake, here's what they should be:

(defn alt-or
  ([] nil)
  ([ args] (reduce (fn [_ s] (if s (reduced s) s)) (alt-or) args)))

(defn alt-and
  ([] true)
  ([ args] (reduce (fn [_ s] (if s s (reduced s))) (alt-and) args)))

(defn alt-every?
  [pred coll]
  (reduce (fn [_ s] (let [t (boolean (pred s))] (if t t (reduced t true 
coll))

(defn alt-some
  [pred coll]
  (reduce (fn [_ s] (let [t (pred s)] (if t (reduced t) t))) nil coll))

 

  


 Another idea was that this way I could also make core.reducers based 
 versions. Of course this would mean that sometimes you would evaluate too 
 much tests, but since this would happen in parallel, in general the result 
 would return faster. *Am I right in presuming that, or am I overlooking 
 some very basic argument against them (I'm pretty good at that) ?*


 The result wouldn't return faster if the input is an infinite list.


I don't think normal *every?* and *some *would do that better, would they ? 
In any case, reducers don't work on lazy sequences, so that shouldn't be a 
problem.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 'Reduced' and logic functions

2014-02-20 Thread Niels van Klaveren



 The result wouldn't return faster if the input is an infinite list.

 Ah, I see the gotcha now. If you don't implement *or *as a macro, all 
arguments will be evaluated before *or *is invoked. Macro-expansion won't 
evaluate later arguments if a former one short-circuits, of course.
I'd only tested this with lazy-sequences, not functions over them..

(or true (apply + (range)))= true

(alt-or true (apply + (range)))

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


'Reduced' and logic functions

2014-02-19 Thread Niels van Klaveren
Currently, *and* and *or *are implemented as macro's, and cannot be used in 
*apply 
*or as function parameters. Related functions like *every?* and *some* are 
implemented either on the basis of *or* or recursion over lazy sequences. 
These choices were made because they all need to be able to short-circuit, 
which could be hard in previous clojure versions.

From 1.5 we have the *reduced* function though, which enables 
short-circuiting *reduce *functions. Since I couldn't find much examples of 
*reduced*, I started experimenting a bit to find out it's usages. One of 
the things I found was that it was pretty easy to create reduced based 
functions for the above, so they could be used with *apply *and as function 
parameters. I came up with the following:

(defn alt-or
  ([] nil)
  ([ args] (reduce (fn [_ s] (if s s (reduced s))) nil args)))

(defn alt-and
  ([] nil)
  ([ args] (reduce (fn [_ s] (if s (reduced s) s)) nil args)))

(defn alt-every?
  [pred coll]
  (reduce (fn [_ s] (let [t (boolean (pred s))] (if t t (reduced t true 
coll))

(defn alt-some
  [pred coll]
  (reduce (fn [_ s] (let [t (pred s)] (if t (reduced t) t))) nil coll))


Some quick further testing also showed they were pretty quick, with the 
alternate *every?* and *some *being twice as fast as current versions. Of 
course usually these are held back by the complexity of their predicates, 
but every bit counts. Testing the *or *and *and *functions on large 
collections proved a bit harder, since you can't *apply* the default ones, 
and evalling large lists prepended with *or *and *and* blew the permgen 
pretty quickly. *Anyone have an idea how to compare such scenario's?* With 
repeating a lot of small evaluations both were on par.

Another idea was that this way I could also make core.reducers based 
versions. Of course this would mean that sometimes you would evaluate too 
much tests, but since this would happen in parallel, in general the result 
would return faster. 
*Am I right in presuming that, or am I overlooking some very basic argument 
against them (I'm pretty good at that) ?*




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: how to use the G1 garbage collector

2014-02-07 Thread Niels van Klaveren
Both G1 and ConcurrentMarkSweep GC are meant to lower pauses (increase 
responsiveness), but generally increase total running time. So I don't know 
if it's ideal for the scenario you describe.

On Friday, February 7, 2014 5:38:09 PM UTC+1, Lee wrote:


 On Feb 7, 2014, at 11:35 AM, Gary Trakhman wrote: 

  I do it like this: 
  
  in my .bashrc 
  
  export JVM_OPTS=-XX:+UseG1GC 
  export LEIN_JVM_OPTS=-XX:+UseG1GC 
  
  
  You can verify that it's working by checking jvisualvm's view of the 
 jvm-opts on the relevant processes.  Running it system-wide has given me 
 reduced memory-pressure on my lappie with no downside. 

 Interesting, but this is for processes that I'll be running on remote 
 machines and I'd like all of the configuration to be in the Clojure project 
 (ideally) or on the command line. 

  -Lee 



-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: need help reading blob column from oracle

2014-01-30 Thread Niels van Klaveren
(jdbc/query db [select blob_contents from ce_blob where event_id in 
(?,?,?)  [10024279,10024280,10024281]]
:row-fn (fn [r]
  (some- r
  :blob_contents
  .getBinaryStream
  io/input-stream))
:result-set-fn (fn [rs]
 (with-open [o (io/output-stream 
d:/temp/testconc.txt)]
   (doseq [r rs]
 (when r
   (io/copy r o))

:row-fn is done over every row in the resultset to make an input-stream 
from the blob field
:result-set-fn is done over all results of :row-fn, and concatenates all 
input-streams into an output stream of a file.
doseq is used instead of map, because the main objective of the function is 
to perform side-effects.

Sorry for spamming you, bww00, I was wondering where my replies went, but 
only noticed later I was responding to you personally only blush

On Wednesday, January 29, 2014 6:48:58 PM UTC+1, bww00...@yahoo.com wrote:

 here is where I have gotten:
 query seems to be getting the blob

 I am at a loss on how to get to the blob to say write it to a file, or 
 ultimately construct a blob of multiple blobs

 AS usual any help is greatly appreciated

  (jdbc/query db[select blob_contents from ce_blob where event_id 
 =? 10024279] 
 :row-fn(fn[r](some- r
   :blob_contents
   .getBinaryStream
   io/reader
  
  (print r

 ..returns
 #Namespace bww_pnote.core
 #BufferedReader java.io.BufferedReader@eb059d {:blob_contents #BLOB 
 oracle.sql.BLOB@10d697c}
 (nil)




 On Sunday, January 26, 2014 10:21:18 PM UTC-6, bww00...@yahoo.com wrote:

 ANyone have some examples reading a blob column from an oracle db.

 We have a database with a blob column.
 A entity can be split acroos multiple rows.
 If there are multiple rows we need to read anc concatenate the rows into 
 a single buffer
 There may be multiple rows that we need to read to concatnate the blobs 
 in this row set 

 any help would be appreciated

 Thanks
 bryan



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: need help reading blob column from oracle

2014-01-27 Thread Niels van Klaveren
For reading a single blob you need to get the field's characterstream, make 
it a reader and then process it further.

(jdbc/query c  [select field from table parameters]
 :row-fn (fn [r] (some- r
 :fieldidentifier
 .getCharacterStream
  io/reader
  (further processing 
fns)

The some- is needed because row-fn is done on all rows, and if the field 
is null this would throw a NPE.

Regards,

Niels

On Monday, January 27, 2014 5:21:18 AM UTC+1, bww00...@yahoo.com wrote:

 ANyone have some examples reading a blob column from an oracle db.

 We have a database with a blob column.
 A entity can be split acroos multiple rows.
 If there are multiple rows we need to read anc concatenate the rows into a 
 single buffer
 There may be multiple rows that we need to read to concatnate the blobs in 
 this row set 

 any help would be appreciated

 Thanks
 bryan


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: need help reading blob column from oracle

2014-01-27 Thread Niels van Klaveren
Oops, above example is for a clob, change .getCharacterStream to 
.getBinaryStream for a true blob.

On Monday, January 27, 2014 9:08:30 AM UTC+1, Niels van Klaveren wrote:

 For reading a single blob you need to get the field's characterstream, 
 make it a reader and then process it further.

 (jdbc/query c  [select field from table parameters]
  :row-fn (fn [r] (some- r
  :fieldidentifier
  .getCharacterStream
   io/reader
   (further processing 
 fns)

 The some- is needed because row-fn is done on all rows, and if the field 
 is null this would throw a NPE.

 Regards,

 Niels

 On Monday, January 27, 2014 5:21:18 AM UTC+1, bww00...@yahoo.com wrote:

 ANyone have some examples reading a blob column from an oracle db.

 We have a database with a blob column.
 A entity can be split acroos multiple rows.
 If there are multiple rows we need to read anc concatenate the rows into 
 a single buffer
 There may be multiple rows that we need to read to concatnate the blobs 
 in this row set 

 any help would be appreciated

 Thanks
 bryan



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Finding available methods or docs for a value type

2013-12-27 Thread Niels van Klaveren
Anthony Grimes made a find-fn https://github.com/Raynes/findfn that finds 
functions based on input parameters and output functions.

So something like (find-fn clojure.core [1 2] {:a 1 :b 2}) would return 
vals and (find-fn clojure.core [:a :b] {:a 1 :b 2}) would return keys.

It would be great if we would have an online version that could do that. 
The biggest problem would be how to specify which namespaces (from clojars 
available libraries ?) you'd want to have searched.


On Tuesday, December 24, 2013 2:58:29 PM UTC+1, John Kida wrote:

 So i am very new to Clojure and I am wondering if there are any good 
 techniques to finding available methods that will take a particular value. 
 I understand this is probably very hard to do or even impossible being 
 Clojure is a dynamic language and a lisp but for example.

 Lets say i have a simple map data structure. Being new to Clojure i just 
 start fiddling with the REPL, and try:
 (keys my-hmap)
 cool, got the keys from my map back. 

 Now how about values
 (values my-hmap)

 nope. wrong method name..  I was able to quickly find it in the Clojure 
 Data Structures documentation, where it had a few method names for 
 examining a Map, and linked me to the Clojure Core API, is this something I 
 should probably go through start to finish, so I have a good idea of what 
 is available.

 Or is there some technique I can use in the repl to tell me what methods 
 are available to work with this particular datastructure.. that sounds not 
 possible due to the dynamic lisp nature of clojure, but I wanted to ask the 
 community to see if there were some good strategies to learning and finding 
 available methods to work with a particular value.


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Caribou admin page: No template by the name login.html

2013-12-14 Thread Niels van Klaveren
Following the steps in the 
tutorialhttp://caribou.github.io/caribou/docs/tutorial.html, clicking on the 
admin login link on the homepage of the running caribou 
app results in the following message:
No template by the name login.html

What could be the problem ?

Windows 7 x64, Leiningen 2.3.4 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit 
Server VM

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Caribou admin page: No template by the name login.html

2013-12-14 Thread Niels van Klaveren
Could it have something to do with the caribou lein template ending up in 
\.m2\repository\caribou\lein-template ?

All other dependencies end up in my local repository, which is set in both
.m2\settings.xml localRepository 
and
lein\profiles.cls  {:user (:local-repo))

No idea why it's the only dependency not respecting either of those 
settings.

On Saturday, December 14, 2013 5:36:54 PM UTC+1, Niels van Klaveren wrote:

 Following the steps in the 
 tutorialhttp://caribou.github.io/caribou/docs/tutorial.html, clicking on 
 the admin login link on the homepage of the running caribou 
 app results in the following message:
 No template by the name login.html

 What could be the problem ?

 Windows 7 x64, Leiningen 2.3.4 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit 
 Server VM


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Caribou admin page: No template by the name login.html

2013-12-14 Thread Niels van Klaveren
Thanks Justin, got it working with a local build like instructed.

Looks good so far !

On Saturday, December 14, 2013 6:08:19 PM UTC+1, Justin Smith wrote:

 This is a known issue 
 https://github.com/caribou/caribou-frontend/issues/3with 
 caribou under Windows, with a potential fix 
 upcominghttps://github.com/caribou/caribou-core/pull/20
 .

 On Saturday, December 14, 2013 8:45:01 AM UTC-8, Niels van Klaveren wrote:

 Could it have something to do with the caribou lein template ending up in 
 \.m2\repository\caribou\lein-template ?

 All other dependencies end up in my local repository, which is set in both
 .m2\settings.xml localRepository 
 and
 lein\profiles.cls  {:user (:local-repo))

 No idea why it's the only dependency not respecting either of those 
 settings.

 On Saturday, December 14, 2013 5:36:54 PM UTC+1, Niels van Klaveren wrote:

 Following the steps in the 
 tutorialhttp://caribou.github.io/caribou/docs/tutorial.html, clicking on 
 the admin login link on the homepage of the running caribou 
 app results in the following message:
 No template by the name login.html

 What could be the problem ?

 Windows 7 x64, Leiningen 2.3.4 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit 
 Server VM



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] clojure.java.jdbc 0.3.0 RC1 released

2013-12-13 Thread Niels van Klaveren
Thanks very much Sean. After hesitating a long time about the jump to 0.3.0,  
today I migrated all my projects without a hitch !

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


clojure.java.jdbc 3.0 reusing connections

2013-12-10 Thread Niels van Klaveren
Do I understand correctly that to prevent creating a collection per query I 
have to wrap multiple consecutive queries inside a `db-transaction` binding 
instead of the old `with-connection` bindings ?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.java.jdbc 3.0 reusing connections

2013-12-10 Thread Niels van Klaveren
Oops, should be 'connection' instead of 'collection', of course.

On Tuesday, December 10, 2013 5:24:23 PM UTC+1, Niels van Klaveren wrote:

 Do I understand correctly that to prevent creating a collection per query 
 I have to wrap multiple consecutive queries inside a `db-transaction` 
 binding instead of the old `with-connection` bindings ?


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure java.jdbc db-do-prepared and dynamic parameters

2013-12-09 Thread Niels van Klaveren
I think the OP just meant to ask how to do a PreparedStatement batch update 
in clojure.jdbc.

The simplest answer is, just give in multiple parameter vectors to 
db-do-prepared

 (sql/db-do-prepared db
 INSERT INTO fruit2 ( name, appearance, cost, grade ) 
VALUES ( ?, ?, ?, ? )
 [banana yellow 1 1.0]
 [apple green 2 1.0]
 [orange orange 3 1.0])

And as usual, if you have what should be separate parameters already in a 
collection, use the apply function

  (apply sql/db-do-prepared db
  INSERT INTO fruit2 ( name, appearance, cost, grade ) VALUES ( ?, ?, ?, ? 
)
   [[banana yellow 1 1.0]
[apple green 2 1.0]
[orange orange 3 1.0]])

On Sunday, December 8, 2013 11:56:40 PM UTC+1, Sean Corfield wrote:

 Do you want that specific piece of (procedural) Java converted to 
 Clojure or do you have a real use case in the context of a real 
 problem that you're trying to solve? 

 I suspect just showing you what that piece of Java would look like in 
 Clojure isn't going to teach you how to do this in general... and 
 there are multiple approaches that would each be more suitable to 
 particular real world problems. 

 Sean 

 On Sun, Dec 8, 2013 at 9:44 AM, Avinash Dongre 
 dongre@gmail.comjavascript: 
 wrote: 
  I see following example in Clojure.java.jdbc 
  
  (sql/db-do-prepared db INSERT INTO fruit2 ( name, appearance, cost, 
 grade ) 
  VALUES ( ?, ?, ?, ? ) [test test 1 1.0]) 
  
  But how do i convert following java code into clojure. I am new to 
 clojure 
  and not sure how to i pass multiple vector 
  
  final int numRows = 1; 
  PreparedStatement pstmt = conn 
  .prepareStatement(insert into new_order values (?, ?, ?)); 
  for (int id = 1; id = numRows; id++) { 
pstmt.setInt(1, id % 98); 
pstmt.setInt(2, id % 98); 
pstmt.setInt(3, id); 
int count; 
if ((count = pstmt.executeUpdate()) != 1) { 
  System.err.println(unexpected update count for a single insert 
  + 
  count); 
  System.exit(2); 
} 
if ((id % 500) == 0) { 
  System.out.println(Completed  + id +  inserts ...); 
} 
  } 
  
  -- 
  -- 
  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 
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  Clojure group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 



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

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


-- 
-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Autocomplete for new dependency - counterclockwise

2013-11-12 Thread Niels van Klaveren
You only need to restart the REPL since the new library needs to be on the 
classpath.

On Tuesday, November 12, 2013 2:48:21 PM UTC+1, Josh Kamau wrote:

 Hi there ;

 I have a counterclockwise project on eclipse.  I have just added a new 
 library dependency to project.clj.  What do i need to do so that the the 
 namespaces provided by the new library are available during autocomplet.. 
 especially on the repl.

 Regards.
 Josh


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Autocomplete for new dependency - counterclockwise

2013-11-12 Thread Niels van Klaveren
After saving the edited project.clj, the dependencies should be downloaded, 
placed in the local repository, and linked inside the Leiningen 
Dependencies section of your project.

Be sure to check if the jar is inside the Leiningen Dependencies before 
starting the REPL anew.

On Tuesday, November 12, 2013 3:25:35 PM UTC+1, Josh Kamau wrote:

 Thanks. I had tried that. I guess i was doing something wrong. 
 Let me try again. 

 Josh


 On Tue, Nov 12, 2013 at 4:53 PM, Niels van Klaveren 
 niels.va...@gmail.comjavascript:
  wrote:

 You only need to restart the REPL since the new library needs to be on 
 the classpath.


 On Tuesday, November 12, 2013 2:48:21 PM UTC+1, Josh Kamau wrote:

 Hi there ;

 I have a counterclockwise project on eclipse.  I have just added a new 
 library dependency to project.clj.  What do i need to do so that the the 
 namespaces provided by the new library are available during autocomplet.. 
 especially on the repl.

 Regards.
 Josh

  -- 
 -- 
 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
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Cursive IntelliJ working on multiple Leiningen projects require - refer :as not working

2013-11-06 Thread Niels van Klaveren
Thanks for looking into this, highly appreciated.

On Wednesday, November 6, 2013 7:49:59 AM UTC+1, Colin Fleming wrote:

 Right, I had a chance to take a look at this - the classpath for the REPL 
 unfortunately doesn't include the source directories of dependent modules. 
 I'll fix that in the next build.

 There is a workaround. In Settings-Compiler-Clojure Compiler, enable 
 Copy Clojure source files to output path. In Settings-Compiler, if you 
 have Use external build selected then change the resource pattern for 
 Clojure from !?*.clj to ?*.clj. Then you can build your dependent module 
 manually (for example, by right clicking on it in the project tree and 
 selecting Make Module 'your module'. That will copy your Clojure files to 
 the output path and they'll be picked up by the REPL then.



 On 6 November 2013 10:50, Colin Fleming colin.ma...@gmail.comjavascript:
  wrote:

 Hmm, there may be some problem with the classpath there - I'll take a 
 look.


 On 5 November 2013 23:53, Niels van Klaveren 
 niels.va...@gmail.comjavascript:
  wrote:

 The namepace resolution issue vanished after upgrading Cursive and 
 re-opening the project after deleting the IntelliJ artifacts in it.
 Checkouts namespacing is recognized as well, and checkouts src 
 directories are nicely marked as such.

 However, when loading the file in the REPL I get a Could not locate 
 menthy/utils_java/jdbc__init.class or menthy/utils_java/jdbc.clj on 
 classpath exception for calls to the checkout project(s).


 On Tuesday, November 5, 2013 7:51:00 AM UTC+1, Colin Fleming wrote:

 Hi Niels,

 I've just released Cursive 0.1.05 which fixes this issue. Documentation 
 for the Leiningen support is 
 herehttp://cursiveclojure.com/userguide/leiningen.html. 
 Basically you should be able to just import your project wholesale and it 
 will automatically work out all the dependencies. Checkout dependencies 
 are 
 also transparently supported for interop with other tools. 

 Let me know if it works for you, and I'd be interested to know more 
 about your namespace resolution problems too. Feel free to drop me a mail 
 at cur...@cursiveclojure.com if you'd rather send it off-list.

 Thanks,
 Colin


 On 2 November 2013 04:44, Niels van Klaveren niels.va...@gmail.comwrote:

 The release notes mention that working on multiple Leiningen projects 
 has been improved, but how to get it working ?
 I wondered if there's a preferred way to work on multiple Leiningen 
 projects, so changes in one are reflected in the other.

 - Leiningen has the option to work with the checkouts directory 
 containing a simlink (linux) / junction link (windows) to the directories 
 in question
 - CounterClockWise has the option to add the other project to the 
 project build path

 I got things working by using the checkout directory / junction link 
 method, and in Cursive marking the checkout source directory as a Source 
 Root.
 Is this the intended way to do it, or is there another way ?

 Another thing I noticed is that require :as alias and require :refer 
 aren't picked up, and all aliased / referred function calls are marked as 
 cannot resolved be resolved warnings.
 Any way I can get rid of those ?

 -- 
 -- 
 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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


  -- 
 -- 
 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
 --- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.





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

Re: Cursive IntelliJ working on multiple Leiningen projects require - refer :as not working

2013-11-05 Thread Niels van Klaveren
The namepace resolution issue vanished after upgrading Cursive and 
re-opening the project after deleting the IntelliJ artifacts in it.
Checkouts namespacing is recognized as well, and checkouts src directories 
are nicely marked as such.

However, when loading the file in the REPL I get a Could not locate 
menthy/utils_java/jdbc__init.class or menthy/utils_java/jdbc.clj on 
classpath exception for calls to the checkout project(s).

On Tuesday, November 5, 2013 7:51:00 AM UTC+1, Colin Fleming wrote:

 Hi Niels,

 I've just released Cursive 0.1.05 which fixes this issue. Documentation 
 for the Leiningen support is 
 herehttp://cursiveclojure.com/userguide/leiningen.html. 
 Basically you should be able to just import your project wholesale and it 
 will automatically work out all the dependencies. Checkout dependencies are 
 also transparently supported for interop with other tools. 

 Let me know if it works for you, and I'd be interested to know more about 
 your namespace resolution problems too. Feel free to drop me a mail at 
 cur...@cursiveclojure.com javascript: if you'd rather send it off-list.

 Thanks,
 Colin


 On 2 November 2013 04:44, Niels van Klaveren 
 niels.va...@gmail.comjavascript:
  wrote:

 The release notes mention that working on multiple Leiningen projects has 
 been improved, but how to get it working ?
 I wondered if there's a preferred way to work on multiple Leiningen 
 projects, so changes in one are reflected in the other.

 - Leiningen has the option to work with the checkouts directory 
 containing a simlink (linux) / junction link (windows) to the directories 
 in question
 - CounterClockWise has the option to add the other project to the project 
 build path

 I got things working by using the checkout directory / junction link 
 method, and in Cursive marking the checkout source directory as a Source 
 Root.
 Is this the intended way to do it, or is there another way ?

 Another thing I noticed is that require :as alias and require :refer 
 aren't picked up, and all aliased / referred function calls are marked as 
 cannot resolved be resolved warnings.
 Any way I can get rid of those ?

 -- 
 -- 
 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
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Cursive IntelliJ working on multiple Leiningen projects require - refer :as not working

2013-11-01 Thread Niels van Klaveren
The release notes mention that working on multiple Leiningen projects has 
been improved, but how to get it working ?
I wondered if there's a preferred way to work on multiple Leiningen 
projects, so changes in one are reflected in the other.

- Leiningen has the option to work with the checkouts directory containing 
a simlink (linux) / junction link (windows) to the directories in question
- CounterClockWise has the option to add the other project to the project 
build path

I got things working by using the checkout directory / junction link 
method, and in Cursive marking the checkout source directory as a Source 
Root.
Is this the intended way to do it, or is there another way ?

Another thing I noticed is that require :as alias and require :refer aren't 
picked up, and all aliased / referred function calls are marked as cannot 
resolved be resolved warnings.
Any way I can get rid of those ?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Cursive IntelliJ working on multiple Leiningen projects require - refer :as not working

2013-11-01 Thread Niels van Klaveren
I don't think it's the way to do it, because the checkouts /src directory 
gets unmarked when the project is loaded anew after an IntelliJ restart.

On Friday, November 1, 2013 4:44:49 PM UTC+1, Niels van Klaveren wrote:

 The release notes mention that working on multiple Leiningen projects has 
 been improved, but how to get it working ?
 I wondered if there's a preferred way to work on multiple Leiningen 
 projects, so changes in one are reflected in the other.

 - Leiningen has the option to work with the checkouts directory containing 
 a simlink (linux) / junction link (windows) to the directories in question
 - CounterClockWise has the option to add the other project to the project 
 build path

 I got things working by using the checkout directory / junction link 
 method, and in Cursive marking the checkout source directory as a Source 
 Root.
 Is this the intended way to do it, or is there another way ?

 Another thing I noticed is that require :as alias and require :refer 
 aren't picked up, and all aliased / referred function calls are marked as 
 cannot resolved be resolved warnings.
 Any way I can get rid of those ?


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Compulsive over-optimization

2013-10-22 Thread Niels van Klaveren
I can imagine this behavior. Unlike premature performance optimization, 
readability / terseness are well worth optimizing for when learning 
Clojure, as long as you value readability over terseness to keep well away 
from code golf territory. 

With Clojure, I always have the idea that things could be done in a simpler 
way, and usually it can. A lot of what I consider 'draft' code that works 
can be cleaned up drastically, and sometimes after cleaning I still have 
some niggles.  However, with time my 'draft' code tends to get cleaner and 
cleaner, and I also see up front where algorithms and function input / 
output can be changed to prevent code getting needlessly complex, and 
having to handle more exceptions than rules.

While doing 4clojure problems, some of my first attempts were 4 or 5  
lines. While this is considered next nothing in Javaland, getting them down 
to 1 line, and comparing them to some of the Clojure vets you get a good 
feel for what's the idiomatic Clojure way to solve certain problems. So I 
guess it's all part of the learning process. I would not worry about it too 
much, you can only clean up for readability / terseness up to a point.

Be sure to stay away from performance optimization unless absolutely 
necessary. There's way too many options, and it needs a really good insight 
into Clojure's implementation details to do effectively. Most idiomatic 
Clojure code performs on par or better compared to other dynamic languages 
like Python and Ruby.

On Saturday, October 19, 2013 1:20:33 AM UTC+2, queshaw wrote:

 With clojure in particular, I am having trouble not rearranging my code 
 to be what I think is more optimal in ways that seem probably not 
 practical. I've noticed myself doing that when I'm newish to languages 
 and apis. But, I go bonkers with clojure. 

 Do you have any thoughts about how to avoid that, other than Bob 
 Newhart's advice: 

 http://www.youtube.com/watch?v=Ow0lr63y4Mw 

 Kendall 



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] Counterclockwise - Clojure plugin for Eclipse

2013-10-17 Thread Niels van Klaveren
Window  Preferences  General  Editors  Text Editor Displayed Tab Width 
 change 4 to 2

On Saturday, October 12, 2013 7:21:39 PM UTC+2, Gary Zhao wrote:

 Great. But I have one thing confusing.
 Auto indent uses two spaces, but tab uses four spaces. How can I make them 
 consistent? Either 2 or 4 spaces for both. I tried some settings but didn't 
 seem to work.

 Thanks.

 On Thursday, October 10, 2013 6:36:01 AM UTC-7, Laurent PETIT wrote:

 Hi, a new version of Counterclockwise, the Clojure plugin for the 
 Eclipse IDE, has just been released. 

 Hot new features 
  
 - auto indentation as you type 
 - available as a Standalone Product: Download, Unzip, Code! 
 - many bug fixes including (hopefully) stability improvements 

 Install 
 = 
 - Software update site for installing into an existing Eclipse: 
 http://updatesite.ccw-ide.org/stable/ 

 Standalone product for: 
 - Windows 64 bits: 

 http://updatesite.ccw-ide.org/branch/master/master-0.20.0.STABLE001/products/ccw-win32.win32.x86_64.zip
  
 - Windows 32 bits: 

 http://updatesite.ccw-ide.org/branch/master/master-0.20.0.STABLE001/products/ccw-win32.win32.x86.zip
  
 - Linux 64 bits: 

 http://updatesite.ccw-ide.org/branch/master/master-0.20.0.STABLE001/products/ccw-linux.gtk.x86_64.zip
  
 - Linux 32 bits: 

 http://updatesite.ccw-ide.org/branch/master/master-0.20.0.STABLE001/products/ccw-linux.gtk.x86.zip
  
 - OS X 64 bits: 

 http://updatesite.ccw-ide.org/branch/master/master-0.20.0.STABLE001/products/ccw-macosx.cocoa.x86_64.zip
  

 Create a folder, unzip the product inside this folder, and double 
 click on the Counterclockwise executable! (only pre-requisite: Java 
 7 in your path) 

 Release Note 
 == 

 https://code.google.com/p/counterclockwise/wiki/ReleaseNotes#Version_0.20.0 


 Cheers, 


 -- 
 Laurent Petit 



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Who uses HtmlUnit?

2013-10-07 Thread Niels van Klaveren
Didn't see this was posted in the general Clojure group, and thought this 
had been posted in another group.
So if you want to do any automated web testing be sure to check out 
clj-webdriver https://github.com/semperos/clj-webdriver, the clojure 
library for Selenium Webdriver and it's Google 
Grouphttps://groups.google.com/forum/#%21forum/clj-webdriver
.
Selenium is the java platform for browser automation, supporting most 
browsers as well as headless browsers like HTMLunit and PhantomJS.

On Sunday, October 6, 2013 1:23:22 PM UTC+2, Magomimmo wrote:

 Hi all, 
 did anyone give a try to this java based HTMLUnit headless browser for 
 cljs unit test to be used of phantomjs? 

 http://htmlunit.sourceforge.net/ 

 Thanks 

 Mimmo 



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Who uses HtmlUnit?

2013-10-06 Thread Niels van Klaveren
I've used HTMLunit, but the Javascript implementation used is rather slow 
compared to regular JS in browsers.
Since the webframework I need to test is rather JS heavy, this is a pretty 
big problem.
I had hopes that they would switch from Rhino to Nashorn, but there 
currently aren't plans for that.

Also, it has it's own idiosynchrasies browserwise, and I couldn't convince 
our developers to work around those by supporting yet another browser, just 
for testing.

It would be marvellous to have a headless browser that uses less resources 
than a regular, but for my uses HTMLunit just didn't cut it.
I should take a look at the PhantomJS browser and Ghostscript (and it's 
Webdriver support) one of these days.
 

On Sunday, October 6, 2013 1:23:22 PM UTC+2, Magomimmo wrote:

 Hi all, 
 did anyone give a try to this java based HTMLUnit headless browser for 
 cljs unit test to be used of phantomjs? 

 http://htmlunit.sourceforge.net/ 

 Thanks 

 Mimmo 



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: is intellij idea a good ide for clojure development?

2013-07-26 Thread Niels van Klaveren
Live-editing OpenGL under Quill (Processing) worked very well in CCW last 
time I toyed with it.

On Thursday, July 25, 2013 7:27:37 PM UTC+2, Chris Gill wrote:

 I find this interesting. I've been using light table mostly, but recently 
 I tried my hand at socket programming and light table flopped on this type 
 of a project. I ended up using lein repl for most of my work which became a 
 pain and now I'm looking at emacs with a slight kink in my lips. I'll have 
 to try eclipse for clojure out, I've only ever done android in eclipse. Do 
 you think something like an openGL project in clojure in eclipse with 
 live-editing is a possibility? I've mostly seen this kind of stuff in emacs 
 but I feel like it has less to do with emacs and more with nrepl and 
 evaling..

 -c

 On Tuesday, January 29, 2013 1:40:33 PM UTC-5, Timo Mihaljov wrote:

 On 29.01.2013 16:32, Jay Fields wrote: 
  On Tue, Jan 29, 2013 at 9:28 AM, Feng Shen she...@gmail.com wrote: 
  I have programming Clojure for almost 2 years, for a living. 
  
  
  This is probably an important part of what answer the OP is looking 
  for. When I was doing Clojure for about 10% of my job IntelliJ was 
  fine. Now that it's 90% of my job, I wouldn't be able to give up emacs 
  go back to IntelliJ. 
  
  If you're just looking at Clojure as a hobby and you already know 
  IntelliJ, I wouldn't recommend switching. However, if you're going to 
  be programming Clojure almost all of the time, I think emacs is the 
  superior choice. 
  

 For what it's worth, I switched from Emacs to Eclipse and 
 Counterclockwise for Clojure programming. Laurent's done an excellent 
 job with it, and I even prefer his take on paredit over Emacs's 
 original. I still use Emacs for everything else, but for Clojure I find 
 Counterclockwise to be the superior choice. 


 -- 
 Timo 



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: is it possible to join on lazy seqs?

2013-07-17 Thread Niels van Klaveren
Perhaps you could post a minimal example of the two datasets you're trying 
to join ?

To do multiple types of joins (left, right, inner, natural  cross) on 
collections of maps/records, I use Sean Devlin's table-utils library. 
There's no jar, but there's instructions on how to make a version without 
dependencies other than Clojure in this stackoverflow 
questionhttp://stackoverflow.com/questions/13009939/outer-join-in-clojure/13032032#13032032
.

On Tuesday, July 16, 2013 4:43:21 PM UTC+2, mond wrote:

 Sorry if this is a RTFM style question ... this is what I have in terms of 
 types and was wondering if there is another form of join or another library 
 / collection combination that can achieve the same relational join?

 Thanks in advance,

 Ray

 check-delta-feeds.core= (def changed-records (map find-changed-records 
 (set/select #(= (:entity %) (entity-names :project))  query-parts)))   
 
 #'check-delta-feeds.core/changed-records
 check-delta-feeds.core=check-delta-feeds.core= 
 check-delta-feeds.core= (def feed-entries (obtain-feed-entries 
 (fetch-atom-feed-until tgb-feed-url until-datetime)))
 #'check-delta-feeds.core/feed-entries
 check-delta-feeds.core= (type changed-records )
 clojure.lang.LazySeq
 check-delta-feeds.core= (type feed-entries)
 clojure.lang.LazySeq
 check-delta-feeds.core= (set/join changed-records feed-entries {:ID 
 :dh-uuid})
 ClassCastException clojure.lang.LazySeq cannot be cast to java.util.Map 
  clojure.lang.RT.find (RT.java:733)





-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is this idiomatic for a recurring function?

2013-07-09 Thread Niels van Klaveren
For comparison's sake, here's a version made with higher order functions.
HOF based functions are usually considered more idiomatic 
Clojurehttp://www.ehrdclj.org/files/27-March-2013-cgrand-YAGNI.pdfthan 
(loop-)recur ones.
However, I've found that performance wise loop-recur ones often win.

 (defn length-index
   [coll target-length]
   (-
 coll
 (map-indexed (fn [idx, word] [idx (count word)]))
 (reductions (fn [[acc_idx acc_len] [idx len]] [idx (+ acc_len len)]) 
[0 0] )
 (filterv (fn [[idx cum_len]] (= cum_len target-length)) )
 ffirst))

On Tuesday, July 9, 2013 11:18:29 PM UTC+2, Denis Papathanasiou wrote:

 Hi, and thanks for your reply.

 On Tuesday, July 9, 2013 4:41:36 PM UTC-4, puzzler wrote


 What you're looking for is:
 (defn get-length-match [my-list target-length]
(loop [my-list my-list, counted-length 0, ind -1]
   ...))

 In your recur, you can now omit target-length, but the rest of the code 
 stays the same.


 So I should use loop together with recur?

 Does the recur at that point recursively call the function, or does it 
 refer to the loop?

 Based on the docs, I think it's the latter, but it's not entirely clear.

 Also, in clojure is loop preferable to iteration by recursion as I had it 
 originally?


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is this idiomatic for a recurring function?

2013-07-09 Thread Niels van Klaveren



 So I should use loop together with recur?

 Does the recur at that point recursively call the function, or does it 
 refer to the loop?


Yes, it refers to the loop. The loop form is usually used to 'hide away' 
additional parameters that are needed in the loop itself, but not in the 
function call itself.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: multiline strings and multiline comments ?

2013-07-05 Thread Niels van Klaveren


 Right, but what should be done, then? The command is a toggle, but 
 there are both commented and uncommented lines: should it comment all 
 lines, or uncomment all lines? 


I fully understand there's no right solution for this, just wanted to 
assure the OP that the function should work normally in CCW, and in which 
case it (rightly) might not.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: multiline strings and multiline comments ?

2013-07-05 Thread Niels van Klaveren


 Right, but what should be done, then? The command is a toggle, but 
 there are both commented and uncommented lines: should it comment all 
 lines, or uncomment all lines? 


I understand why the function works like it does, and there's no 'right' 
solution to this problem.
I just posted this to inform Zmitro that multiline commenting should work 
normally in CCW, except in this specific case. 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: multiline strings and multiline comments ?

2013-06-29 Thread Niels van Klaveren
In my version of CCW CTRL-/ multiline (un)commenting just works (under 
Windows).
Perhaps it's a keyboard shortcut problem ?

Only problem there is when multiple lines are selected, and some are 
uncommented, uncommenting the whole block doesn't work.

On Wednesday, August 18, 2010 10:40:39 AM UTC+2, Zmitro Lapcjonak wrote:

 On Aug 17, 12:14 am, Lee Spector lspec...@hampshire.edu wrote: 
  On Aug 16, 2010, at 4:13 PM, Meikel Brandmeyer wrote: 
  
   Every descent editor should provide a comment-selected-text 
 functionality. 

  I've worked in several editors that have comment-selected-text, but I 
 don't see it in Eclipse/Counterclockwise 

 I've created issue: comment multiple lines by pressing Ctrl+/ 
 http://code.google.com/p/counterclockwise/issues/detail?id=61 

 Still under development. 

 -- 
 Zmi La 


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Graph API

2013-06-18 Thread Niels van Klaveren
As a user of the old version of Loom (thanks for the link to aysylu's fork 
!)  it'd be great if there was a well maintained pure Clojure graph library.
The ideas and improvements on Loom you put forward are pretty sensible, and 
I hope you and Aysylu can find a way to collaborate !

On Tuesday, June 18, 2013 9:10:23 AM UTC+2, Stephen Kockentiedt wrote:

 My bad. I did only find the original repository of loom and thought it was 
 abandoned. I should have taken more care while looking at it. My approach 
 was apparently the same in abstracting multiple graph implementations under 
 one API. However, I see some problems with Loom's API, namely:

 1. The specifications of the protocol functions are very sparse. E.g., 
 which nodes shall a directed graph return from neighbors? Successors, 
 predecessors or both?
 2. How do I know if the graph implementation works by mutating the given 
 object or returning a new one?
 3. Loom assumes that every graph is editable. That is definitely not the 
 case.
 4. I think a protocol should be as easy to implement as possible. The 
 additional functionality can be given by functions relying on the protocol 
 functions. E.g., in the user API of my code, there is a function 
 direct-predecessors which provides this functionality (albeit slow) for 
 graph implementations which did not implement the corresponding protocol 
 function:

 (defn direct-predecessors
   Returns a set or sequence of all nodes n2 for which
(has-edge? g n2 n) returns true. May not contain
duplicates.
   [g n]
   (if (satisfies? p/PPredecessorGraph g)
 (p/direct-predecessors g n)
 (filter #(p/has-edge? g % n) (p/nodes g

 E.g., implementations of Loom's API need to provide two implementations of 
 neighbors and need to implement add-nodes* instead of only add-node*. 
 This may not be much more work to do. However, the easier the API, the more 
 implementations there will be.

 Please, don't get me wrong. I think that Loom is a great project, has the 
 same goals and, in terms of functionality, is way ahead of my efforts.

 Said all that, I definitely don't want there to be two competing graph 
 APIs. That would be counterproductive. I see the following possible 
 solutions:

 1. I keep the code to myself and let loom be the sole graph API.
 2. We transfer the advantages of my proposal to Loom and change its API. 
 Do you know of any implementations of the API outside Loom itself? If there 
 are none, this should be possible without much trouble. Also, the README 
 states that the API is alpha-stage.
 3. I publish my code and each API can be implemented in terms of the other 
 one. I'm not sure that this is possible in a simple way. Maybe each 
 protocol could be extended to java.lang.Object, which calls the protocols 
 of the other API, but I don't know if that is feasible.

 Please tell me what you think. I will also send Aysylu an email so that 
 she can chime in on the conversation.


 Am Dienstag, 18. Juni 2013 07:02:52 UTC+2 schrieb Rob Lachlan:

 Loom was indeed working on this, and it's a very nice library.  One thing 
 that I particularly liked about Justin's design, was the ability to run a 
 graph algorithm without worrying about conforming to a particular graph 
 representation.  See for example the bread first search function, here:

 https://github.com/jkk/loom/blob/master/src/loom/alg_generic.clj#L110

 All the bfs function requires is a neighbors function and and a start 
 vertex.  Simple and easy to use.

 Justin had said that he won't be actively developing loom for the 
 forseeable future; I was hoping to develop it further, but I only got as 
 far as implementing a max flow algorithm before the rest of my life got 
 in the way of my plans.  I know that Aysylu was doing a fair amount of work 
 on loom, so I'd guess that her repo is the most advanced one.

 Stephen:
 I think the set of protocols above is good, better than Loom's in fact; 
 notably, the decision to make direct-predecessors optional is the correct 
 one, and a lot of graph libraries get that wrong.  

 If you want to compare how loom did it:
 https://github.com/jkk/loom/blob/master/src/loom/graph.clj





 On Monday, June 17, 2013 1:14:34 PM UTC-7, dgrnbrg wrote:

 I think that there's already a project working on this called Loom. The 
 furthest-developed fork is here: https://github.com/aysylu/loom which 
 appears to have protocols for graphs, bindings to Titanium (the 
 Clojurewerkz graph DB library), visualization support, and implementations 
 of several algorithms.

 Maybe there's a way to incorporate these projects?

 On Monday, June 17, 2013 3:38:45 PM UTC-4, Stephen Kockentiedt wrote:

 Hello,

 I want to create a graph API similar to what core.matrix is for 
 matrices. I have created some protocols which every graph implementation 
 has to satisfy and a prototype implementation. Now I want your feedback on 
 these protocols. Which functions do you want to see which aren't there? 
 Which 

Re: feeding leiningen a local JAR file

2013-06-08 Thread Niels van Klaveren
Leiningen uses the pomegranate 
libraryhttps://github.com/cemerick/pomegranateto manage dependencies and 
classpath. You can use this library from your 
project (or even the REPL) to load jars or put extra directories on the 
classpath, if you don't want to put them in your local repo.

Something like:

(require 'cemerick.pomegranate :as pom)
 (pom/add-classpath /path/to/lib/dir/)

should do the trick.





On Wednesday, November 21, 2012 2:45:14 PM UTC+1, Dick Davies wrote:

 Thanks, that's helpful to know (I was a java dev a long time ago, 
 before Maven took over 
 the world), but really I wanted to isolate this hack to a specific 
 project directory, rather 
 than globallly. 

 On 21 November 2012 12:00, Jim foo.bar jimpi...@gmail.com javascript: 
 wrote: 
  On 21/11/12 11:47, Dick Davies wrote: 
  
  Also, is it possible to 'override' a given dependency to favour a local 
  JAR 
  over the 'official' maven one? 
  
  
  just install the jar into your local maven repo (~/.m2/) (with 
 identifiable 
  name)  and then pull it from whatever project you want. I think 
 Leiningen 
  will look first in your .m2 dir and only if it cannot find the jar it 
 will 
  ask maven, clojars etc etc...am I right? 
  
  Jim 
  
  -- 
  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 


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: creating maps out of sql

2013-05-24 Thread Niels van Klaveren
If you need to do join like operations on database tables from different 
sources that you can't join through SQL, there's a nice library called 
table-utilshttp://stackoverflow.com/questions/13009939/outer-join-in-clojurethat
 you can use. Since it's not released on clojars there's some steps 
you'd need to take to use it, but it's all explained in the link.

After you've put it in your project, you can use it by putting the result 
sets in a map by just putting a doall over the result set, and join them 
like you would in SQL. It has support for inner, outer and full joins.

(let [db2 (sql/with-connection db
   (sql/with-query-results rs [select fields from table]
  (doall rs)))
   sql (sql/with-connection db
  (sql/with-query-results rs [select fields from table]
 (doall rs)))]
   (left-outer-join db2 sql :db2field :sqlfield))

 
On Friday, May 24, 2013 4:55:17 PM UTC+2, Mond Ray wrote:

 I am starting out to use Clojure to combine and verify data between DB2 on 
 a Mainframe, SQL Server and an Atom Feed. Yes, it's such fun working in a 
 start-up ;-)

 Database wise, all is connecting OK after some Leiningen shenanigans and I 
 am now stuck on the mapping part ;-)

 The code is below.  I want to generate a set of maps that show the 
 following:

 #({:a2pid 269, :uuid nil}
 {:a2pid 270, :uuid nil}
 {:a2pid 258, :uuid nil}
 {:a2pid 261, :uuid nil}
 {:a2pid 251, :uuid E7D4262C-62B3-4129-9CE4-B342DC1C39FC})

 The idea is to have a list of maps that can show where there are gaps 
 between the two DBs and, coming next, the Atom feed.

 It is essentially a join operation - and maybe that's what I need but I 
 cannot figure out where to plonk the magic words.

 (defn a2p-records-by-date [query from-date to-date dh-sub-query]
   (sql/with-connection db2
   (sql/with-query-results rs [query from-date to-date]
 (doseq [row rs] (println (str   (:project_id row) (dh-sub-query 
 (:project_id row

 (defn dh-records-by-a2p-id [query a2p-id]
   (sql/with-connection mssql
   (sql/with-query-results rs [query a2p-id]
 (dorun (map #(print (:project_uuid %)) rs)

 (defn dh-sub-query [a2p-id] (dh-records-by-a2p-id select PROJECT_UUID 
 from PROJECT where A2P_PROJECT_ID = ? a2p-id))

 (a2p-records-by-date select project_id from PROJECT where timestamp  ? 
 and timestamp  ? 2012-03-02 2012-03-07 dh-sub-query)

 The output looks like this, so I am close!

  269
  270
  258
  261
 E7D4262C-62B3-4129-9CE4-B342DC1C39FC 251

 Can anyone help me out about how to generate the maps?

 This is just the start as I have many queries to run for many entities, so 
 doubtless I will be back again ;-)

 Thanks in advance

 Ray


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Real-world Clojure application

2013-05-23 Thread Niels van Klaveren
One of the applications that might be comparable are web apps / frameworks.
They can be configured relatively easily to give deterministic results 
(html /json) on arguably comparable input (http request).
There's already an existing benchmark 
sitehttp://www.techempower.com/benchmarks/#section=data-r5d=2, 
including sources.

On Thursday, May 23, 2013 11:25:44 AM UTC+2, bekon wrote:

 Hello, can anyone give a hint on real-world Clojure application? I would 
 like to compare applications written in different dynamic  JVM languages 
 with respect to different JVM characteristics. Usually this kind of things 
 are done by means of benchmarking, however, no benchmarking suite exists 
 for scripting languages. Available ones are for Java and Scala. There is 
 also a Programming Languages Shootout Project (
 http://benchmarksgame.alioth.debian.org/), but the applications there are 
 relatively small and CPU-intensive. Ideally, I would like to have a 
 real-world applications (but not interactive ones, since it's not trivial 
 to make it deterministic and will require automatization of the user 
 behavior) that consume some input and produce some output. In this way I 
 can profile the underlying JVM and collect metrics of interest. I've tried 
 to search on GitHub, but failed. If you read a research paper comparing 
 different JVM languages, what kind of applications you expect to be 
 compared? I'm looking exactly for those ones. One candidate can be Clojure 
 itself, since it's written in Clojure (am I right?), but then the question 
 is what does it mean to run Clojure on the JVM? I don't understand how to 
 run it and how to use the javaagent and collect the metrics of the 
 underlying JVM. 

 Any 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: link for clojure programs

2013-05-06 Thread Niels van Klaveren
+1 to Clinton's advice. If anything, SICP et al teach the wrong habits fo 
working with Clojure.

Christophe Grand, one of the authors of the aforementioned Clojure 
Programming http://www.clojurebook.com/book, held a great presentation 
called You aren't gonna need 
ithttp://www.ehrdclj.org/files/27-March-2013-cgrand-YAGNI.pdf 
at the first meetup of the The Hague/Rotterdam Clojure group. In it he gave 
some solid advice what you should concentrate on (and what not) when 
learning Clojure.

Learning the core (higher order) functions of Clojure is paramount, and I 
found working through the 4clojure problems http://www.4clojure.com/ a 
great way to the rationale behind and working with them.  

If you need practical help with setting up your Clojure development 
environment, or other indepth tutorials for specific parts of the language, 
clojure-doc.org is great. It lacks a bit in overview, and hasn't got the 
narrative qualities of a book for guiding you from one subject to another 
though, so I'd recommend one of 
themhttp://clojure-doc.org/articles/ecosystem/books.htmlas well.

 Clojuredocs.org is great as cheat-sheet and for short examples.

my experience, being inculcated with Scheme will make your Clojure 
 code look insane, as idiomatic Clojure (insomuch as there is such a 
 thing) doesn't have functions nested with a butt-load of anonymous 
 functions. 

 http://clojure-doc.org is great and you should go there first. Don't 
 freak out about your environment just yet. Use whatever you use now, 
 and if you're lucky enough to use Vim or Emacs, it'll work for the 
 future, too. 

 Clojure Programming is, in my opinion, the best book out there right 
 now for Clojure. Check it out if you get the chance. 

 Do not rush into refs, atoms, agents, or any of that stuff. Just right 
 some simple code, learn it, and then expand. I've been writing Clojure 
 code for about 15 or so months, with the last six being every day 
 professionally and I still have never created a protocol. 

 Good luck! Clojure is no harder than Python, C#, or whatever you come 
 from, and is totally rewarding. Learning it will be a pleasure. 

 Best, 
 Clinton 


 On Mon, May 6, 2013 at 6:11 AM, Catonano cato...@gmail.com javascript: 
 wrote: 
  2013/5/4 nre...@yahoo.com javascript: nre...@yahoo.com javascript: 

  
  Can anybody give me a link/websites of codes for BEGINNERS FOR CLOJURE? 
  thanks a lot... 
  
  
  There are tons of resources on line. 
  
  But in my experience, the famous MIT course  with Abelsson and Sussman 
 is a 
  must. It´s about Scheme, not Clojure, but it´s important anyway. 
  
  There is also a course on youtube on Scheme by another professor, from 
  Stanford. That can be important too. 
  
  Then, you have to set up an enviroinment. That´s not a subtlety, it´s a 
 main 
  concern. 
  
  As for that, I strongly suggest the Peepcode footage about Emacs and 
 then 
  live-emacs ( https://github.com/overtone/emacs-live ) 
  
  On my shameful github account I have a little watered down game life 
 with a 
  little visual layer made with Quilt. So you can see your bot filling 
 square 
  tiles according to your strategy. 
  
  It was an exercise from the lambda-next clojure training event. I´m not 
 sure 
  about its license but I don´t think the guys are gonna object ;-) 
  
  It uses refs and can be a good first step in learning. The 
 multithreading 
  stuff is specific to Clojure on the Jvm, I think. It has no readme file 
 but 
  I could give you a couple of directions in order to have it up and 
 running. 
  
  That´s all comes to m mind at the moment ;-) 
  
  Bye 
  Catonano 
  
  -- 
  -- 
  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 
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  Clojure group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to clojure+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  


-- 
-- 
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 unsubscribe from this group and stop receiving emails from 

Re: Something goofy you can do in Clojure.

2013-04-09 Thread Niels van Klaveren
In Clojure 1.5.1:

= (+ .3 1.7)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: .3 
in this context, compiling:(NO_SOURCE_PATH:1:1) 

So the only way you can do this is if you def'd .3 before

= (def .3 0.4)
= (+ .3 1.7)
2.1

On Tuesday, April 9, 2013 10:53:06 AM UTC+2, Cedric Greevey wrote:

 This may look mildly surprising, and suggests one more thing *not* to ever 
 do in production code:

 user= (+ .3 1.7)
 2.1
 user=

 :)

 Shouldn't be hard to figure out how to put a repl in a state where that 
 expression will evaluate to that result. I'm sure mathematicians everywhere 
 are deeply offended by the clojure reader now. :)



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Niels van Klaveren
Perhaps for inspiration have a look at Christophe Grand's implementation of 
Tarjan's 
algorithmhttp://clj-me.cgrand.net/2013/03/18/tarjans-strongly-connected-components-algorithm/(which
 is a more efficient version of Kosaraju's).

On Thursday, March 28, 2013 12:06:45 PM UTC+1, Balint Erdi wrote:

 Yes, that's definitely a good idea. I tried a few other things (including 
 that, I think) after I posted that but nothing really worked and it turned 
 out that the tail-recursive version even had a bug.

 I couldn't find a way to really keep the amount of copying of the data 
 structures (stack, finished above) very low and thus my algorithm was slow. 
 I know that the data structures are persistent and share structure but it 
 still was slow for that many elements.

 I finally solved the problem by implementing an imperative solution with 
 Java arrays and type hints. It ran in ~20-30 seconds.

 On Thursday, March 28, 2013 2:22:44 AM UTC+1, Stephen Compall wrote:

 On Mon, 2013-03-11 at 10:37 -0700, Balint Erdi wrote: 
(let [neighbors (persistent! 
 (reduce 
  (fn [c u] (if (explored u) c (conj! c u))) 
  (transient []) 
  (G v)))] 

 What happens if you do ^^^ *after* vvv? 

   (explored v) (recur vs explored lhalf rhalf (inc 
 iter-cnt)) 

 -- 
 Stephen Compall 
 ^aCollection allSatisfy: [:each | aCondition]: less is better than 




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Niels van Klaveren
That's quoting far out of context Alan. All Christophe says in his blog is 
he dislikes the statefulness of most implementations of Tarjan, and shows 
how this isn't needed, and can be done in a functional way.

You could have stated the arguments why you think your version is superior, 
and it might very well be, but don't picture it like Christophe said he 
doesn't like his own implementation.

On Thursday, March 28, 2013 7:38:41 PM UTC+1, Alan Malloy wrote:

 Have you looked at https://github.com/jordanlewis/data.union-find ? 
 Personally, I'd prefer it to Christophe's implementation, since his blog 
 post seems to start with I dislike this algorithm; I also helped out a 
 bit in writing this version.

 On Monday, March 11, 2013 10:37:39 AM UTC-7, Balint Erdi wrote:

 Hey,


 I got an assignment to implement an algorithm to calculate strongly 
 connected components in a graph (
 http://en.wikipedia.org/wiki/Kosaraju's_algorithm). The graph is rather 
 big, it has ~900.000 vertices.


 In its first pass, it needs to do a depth-first search on the graph and 
 calculate the finishing time for each node (the finishing time for a node 
 is a number from 0…V-1 where V is the number of vertices). Potentially 
 several depth-first search need to be launched (done in the finishing-times 
 function below) to discover all components.


 The version I pasted below is the most performant. It discovers ~600.000 
 vertices (2/3 of all vertices). However, on subsequent 
 dfs-by-finishing-times it becomes extremely slow (exploring a handful of 
 additional nodes/second) and I'm not sure why.


 Here are a few things I tried to speed up the algorithm:


 * rewrite to a recursive function (not tail-recursive) and use lazy-seqs

 * define dfs-by-finishing-times in finishing-times so that the whole 
 graph (G) does not have to be passed at each call.

 * use persistent data structures everywhere instead of transients (I know 
 this would only slow things down but it did not hurt to try)

 * use a profiler (VisualVM) to learn where the bottlenecks are. I'm not 
 very proficient with profilers but I could not extract any valuable 
 information


 Here are the code snippets in question:

 (I also pasted it here: 
 https://www.refheap.com/paste/3840cc772cc3a5b1d9c4f1db3 for better 
 readability)

 (defn dfs-by-finishing-times

   ([G u]

  (dfs-by-finishing-times G u #{}))

   ([G u explored]

  (loop [[v  vs :as stack] (list u), explored (transient explored), 
 lhalf [], rhalf [],  iter-cnt 0]

  (if (seq stack)

   (let [neighbors (persistent!

(reduce

 (fn [c u] (if (explored u) c (conj! c u)))

 (transient [])

 (G v)))]

 (cond

  (explored v) (recur vs explored lhalf rhalf (inc iter-cnt))

  (empty? neighbors) (recur vs (conj! explored v) (conj lhalf 
 v) rhalf (inc iter-cnt))

  :else (recur (reduce (fn [stack e] (cons e stack)) vs 
 neighbors)

(conj! explored v)

lhalf

(cons v rhalf)

(inc iter-cnt

   (concat lhalf rhalf)))

  ))


 (defn finishing-times [G vertices]

   The first pass of Kosaraju's algorithm.

Scan the transpose graph of G, and mark the finishing time for each.

G should already be the transposed graph

   (loop [[u  vs :as stack] (seq vertices)

   explored #{},

   finished []]

  (if (nil? u)

finished

(let [path (dfs-by-finishing-times G u explored)

  new-explored (into explored path)]

  (recur (remove new-explored vs)

 new-explored

 (into finished path))

 Do you have any insights into what technique I could use to speed up my 
 algorithm? I'm pretty sure I'm missing a key point but I'm not sure 
 what. Presumably the whole algorithm runs under 10 seconds in C# on the 
 same graph so this is rather embarrassing :)

 Appreciate your help,

 Balint



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Coding while running the program

2013-03-23 Thread Niels van Klaveren
Doing stuff like you describe was one of Cris Granger's inspirations for 
making Light Table.
See http://www.chris-granger.com/2012/02/26/connecting-to-your-creation/

However, most of this is doable with a REPL, as Mikera already noted. For 
Clojure/Clojurescript, redefining functions in running code is not a 
feature, it's part of the language.

On Saturday, March 23, 2013 10:06:34 PM UTC+1, Oskar Kvist wrote:

 John: I don't really understand why you say it's a waste of time. Speeding 
 up the feedback cycle seems great to me.

 Thanks to everyone who has contributed to this thread so far!

 On Saturday, March 23, 2013 7:48:28 PM UTC+1, John Smith wrote:

 Yes, but are you saving time with this?  What types of games do you want 
 to make?
 RTS?  FPS?  RPG?  What's the platform that you're targeting?  No offense, 
 but I've
 seen a lot of people like this (me including :) ), who want to learn 
 technology X for...
 wait for it... to make games or something else that's fun.

 Look, I'm not trying to be mean, but unless you have a specific goal in 
 mind, then
 this new feature is a waste of time :) .

 On Sat, Mar 23, 2013 at 12:20 PM, Oskar Kvist oskar...@gmail.com wrote:

 It's not about looking cool, it's about saving time.

 Den lördagen den 23:e mars 2013 kl. 16:03:19 UTC+1 skrev John Smith:

 If you want to make a game, then make a game.  Don't worry about looking
 cool about it.  You don't need to have some feature to make something
 entertaining :) .

 I'm making a game with a tool called GameMaker.  Not as full-featured or
 powerful as with a programming language?  Sure, but then I want to first
 have a game under my belt, then I'll worry about looking cool in the 
 process
 :) .

 On Sat, Mar 23, 2013 at 10:22 AM, Oskar Kvist oskar...@gmail.comwrote:

 Hi!

 I saw this video 
 http://www.youtube.com/**watch?v=BES9EKK4Aw4http://www.youtube.com/watch?v=BES9EKK4Aw4of
  Notch coding on Minecraft while the game was running, and of course 
 seeing the changes in the running program. He used some kind of debug 
 mode 
 in his IDE (I don't really know which IDE). I want to make a game, and I 
 want to to also be able to code while the program is running. I know this 
 sort of thing is common in Lisps, so even without that IDE's debug mode 
 it 
 should be possible. Is there anything in particular that I need to do or 
 look out for in order to make it work? Are there some JVM settings I 
 should 
 use? Does anyone know how that debug mode works? I kind of understand how 
 it can be done with a plain repl, but I don't wanna miss out on anything 
 that would make it easier. Any kind of insight is very appreciated.

 -- 
 -- 
 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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .
  
  


  -- 
 -- 
 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 unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: what are some stack sizes that people use?

2013-03-19 Thread Niels van Klaveren
That's hilarious :)
As I said, there's usually not much need to increase stack sizes.. 

On Tuesday, March 19, 2013 4:09:37 PM UTC+1, larry google groups wrote:

 Ah, I figured out at least part of what was happening. I have a web app, 
 with Ring and Jetty and Compojure, and I have a form where people can 
 upload images. The Ring has middleware that lets the uploaded images appear 
 as a map with a pointer to a File:

 {:size 3874, :tempfile #File 
 /var/folders/kr/pgx6tzks6kg48hgdnj1f7dt8gn/T/ring-multipart-6398198897870847417.tmp,
  
 :content-type image/png, :filename sponsored_by_pink.png}{:size 0, 
 :tempfile #File 
 /var/folders/kr/pgx6tzks6kg48hgdnj1f7dt8gn/T/ring-multipart-1255729774892979983.tmp,
  
 :content-type application/octet-stream, :filename }

 The map is then stored in a var called interactions. I had another page 
 where I took everything in interactions and gave it to cli-yaml and 
 dumped that to the screen. Up till now I've been dealing with plain text 
 that gets input via HTML forms, and there were no problems. But now, when I 
 upload a file, and cli-yaml tries to serialize that, it runs into some 
 understandable problems. 




 On Monday, March 18, 2013 3:03:32 PM UTC-4, larry google groups wrote:


  Default stack size is 512kB for 32bit JVMs on Solaris, 320kB for 32bit 
 JVMs on 
  Linux (and Windows), and 1024kB for 64bit JVMs.

 Thank you for that. So I guess I could double those numbers and see if 
 that helps? -ss: 2048kb ?






 On Monday, March 18, 2013 3:02:22 PM UTC-4, larry google groups wrote:

  However, stack overflows are usually a good indication of problematic 
 / faulty 
  recursive algorithms. Increasing the stacksize usually only alleviates 
 some symptoms for 
  a bit. Increasing the stacksize is something that only rarely needs to 
 be done, usually 
  when relying on an external library that has problems with stacksize. 
 Always try 
  to troubleshoot code you can alter first.


 I appreciate that. Nothing change in my code except the amount of data 
 in the var that was being given to clj-yaml. Possibly clj-yaml recurses too 
 much. 





 On Monday, March 18, 2013 1:05:00 PM UTC-4, Niels van Klaveren wrote:

 Default stack size is 512kB for 32bit JVMs on Solaris, 320kB for 32bit 
 JVMs on Linux (and Windows), and 1024kB for 64bit JVMs.

 However, stack overflows are usually a good indication of problematic / 
 faulty recursive algorithms. Increasing the stacksize usually only 
 alleviates some symptoms for a bit. Increasing the stacksize is something 
 that only rarely needs to be done, usually when relying on an external 
 library that has problems with stacksize. Always try to troubleshoot code 
 you can alter first.

 On Monday, March 18, 2013 4:15:00 PM UTC+1, larry google groups wrote:


 I am a noob when it comes to the JVM, and actually I find the JVM to 
 be the hardest thing to learn about Clojure. 

 Problem: I was trying to serialize some data to YAML. I had this 
 working for awhile, but then I added more data and I started getting 
 StackOverflow as an error. I then decided to just take a subset of my 
 data, 
 but even the subset will some day grow too large. I did some searches on 
 Google and apparently I need to increase the stack size of my JVM. 
 However, 
 I have no idea what values are considered large or too-large. 

 I have a project built with Leiningen. I have been reading up on jvm 
 options, and so far, in my project.clj file, I have: 

   :jvm-opts [-Xms256m -Xmx1000m -XX:-UseCompressedOops])

 The stack size option is -ss? A large value would be... uh, what? 
 2000? 5000? 1? Should I do: 

   :jvm-opts [-Xms256m -Xmx1000m -XX:-UseCompressedOops -ss: 
 5000])

 ?






-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: what are some stack sizes that people use?

2013-03-18 Thread Niels van Klaveren
Default stack size is 512kB for 32bit JVMs on Solaris, 320kB for 32bit JVMs 
on Linux (and Windows), and 1024kB for 64bit JVMs.

However, stack overflows are usually a good indication of problematic / 
faulty recursive algorithms. Increasing the stacksize usually only 
alleviates some symptoms for a bit. Increasing the stacksize is something 
that only rarely needs to be done, usually when relying on an external 
library that has problems with stacksize. Always try to troubleshoot code 
you can alter first.

On Monday, March 18, 2013 4:15:00 PM UTC+1, larry google groups wrote:


 I am a noob when it comes to the JVM, and actually I find the JVM to be 
 the hardest thing to learn about Clojure. 

 Problem: I was trying to serialize some data to YAML. I had this working 
 for awhile, but then I added more data and I started getting StackOverflow 
 as an error. I then decided to just take a subset of my data, but even the 
 subset will some day grow too large. I did some searches on Google and 
 apparently I need to increase the stack size of my JVM. However, I have no 
 idea what values are considered large or too-large. 

 I have a project built with Leiningen. I have been reading up on jvm 
 options, and so far, in my project.clj file, I have: 

   :jvm-opts [-Xms256m -Xmx1000m -XX:-UseCompressedOops])

 The stack size option is -ss? A large value would be... uh, what? 2000? 
 5000? 1? Should I do: 

   :jvm-opts [-Xms256m -Xmx1000m -XX:-UseCompressedOops -ss: 5000])

 ?






-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: what are some stack sizes that people use?

2013-03-18 Thread Niels van Klaveren
Another Caveat is that stack size is allocated per thread. If you use a 
highly threaded application (f.i. webservers) a small stacksize increase 
can add up quite a bit.

On Monday, March 18, 2013 4:15:00 PM UTC+1, larry google groups wrote:


 I am a noob when it comes to the JVM, and actually I find the JVM to be 
 the hardest thing to learn about Clojure. 

 Problem: I was trying to serialize some data to YAML. I had this working 
 for awhile, but then I added more data and I started getting StackOverflow 
 as an error. I then decided to just take a subset of my data, but even the 
 subset will some day grow too large. I did some searches on Google and 
 apparently I need to increase the stack size of my JVM. However, I have no 
 idea what values are considered large or too-large. 

 I have a project built with Leiningen. I have been reading up on jvm 
 options, and so far, in my project.clj file, I have: 

   :jvm-opts [-Xms256m -Xmx1000m -XX:-UseCompressedOops])

 The stack size option is -ss? A large value would be... uh, what? 2000? 
 5000? 1? Should I do: 

   :jvm-opts [-Xms256m -Xmx1000m -XX:-UseCompressedOops -ss: 5000])

 ?






-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: is intellij idea a good ide for clojure development?

2013-01-31 Thread Niels van Klaveren
Another vote for Eclipse/CCW over Netbeans and IntelliJ. I used all three, 
and CCW's development has proven to be consistently better than plugins for 
the other IDE's. Both CCW's excellent Leiningen and REPL support, as the 
option to link projects when working on multiple sources at the same time 
have proven to be indispensable.

As for Emacs, in my opinion you'd best get a good grip on Clojure 
development before taking on the whole new learning curve Emacs will pose. 
CCW's `strict` mode is almost on par with Emacs paredit, and will be when 
Barf/Slurp are introduced in the not too distant future.

On Monday, January 28, 2013 12:37:54 PM UTC+1, HamsterofDeath wrote:

 the only ides i have used so far for clojure are intellij idea and 
 netbeans. is there one that is a lot better? if yes, why?
 i am not interested in details or single features, i just want to know if 
 there is some magic editor out there that i should look into because it is 
 *obviously a lot* better - like in you should use an ide for java 
 development instead of notepad
  

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure Full Syntactical Reference

2012-12-18 Thread Niels van Klaveren
It's a feature of the REPLy NREPL client. See 
https://github.com/trptcolin/reply/blob/master/src/clj/reply/initialization.clj 
how it works so you can emulate it.

On Tuesday, December 18, 2012 5:10:00 AM UTC+1, Karim A. Nassar wrote:

 When using nrepl in emacs (cdoc fn) emits: 

 CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
 cdoc in this context, compiling:(NO_SOURCE_PATH:1) 

 However, in lein repl I see:

 Loading clojuredocs-client...

 How do I make nrepl as smart as lein repl?



 On Fri, Dec 14, 2012 at 10:08 PM, Andy Fingerhut 
 andy.fi...@gmail.comjavascript:
  wrote:

 I would recommend checking out

 http://clojuredocs.org

 If you use Leiningen version 2, you can get similar output with these two 
 commands:

 lein repl
 user= (doc first)
 user= (cdoc first)

 doc gives the doc string built into Clojure.  cdoc gives the examples 
 from ClojureDocs.org for that symbol, as long as you have an Internet 
 connection.

 Andy

 On Dec 14, 2012, at 3:40 PM, lin...@redhandgaming.net javascript:wrote:

  I'm learning Clojure, and I learn best by jumping in. I'm interested in 
 using Noir. Noir has a full API reference, so when I'm reading other 
 people's Noir code, I can just look up the exact function and see what it 
 does.
 
  I can't find a similar thing for Clojure. I'm looking through other 
 people's Clojure code. I see something like (keyword (or (first m) :dev)) 
 and I don't really know where to start understanding this. I know enough to 
 know that keyword, or, and first are all functions - and with a google 
 search or two, I can figure out what 'first' does. But I can't easily find 
 out what 'or' and 'keyword' do, because when I google those things, I get 
 all kinds of screwy results, completely unrelated to what I'm trying to 
 find out.
 
  Where can I find, or does there exist, a place where I can view all 
 Clojure's built in functions with a short description of their arguments 
 and what they 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.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




-- 
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 Full Syntactical Reference

2012-12-18 Thread Niels van Klaveren
I wonder if this couldn't have been better implemented as nrepl middleware.

On Tuesday, December 18, 2012 10:34:01 AM UTC+1, Niels van Klaveren wrote:

 It's a feature of the REPLy NREPL client. See 
 https://github.com/trptcolin/reply/blob/master/src/clj/reply/initialization.cljhow
  it works so you can emulate it.

 On Tuesday, December 18, 2012 5:10:00 AM UTC+1, Karim A. Nassar wrote:

 When using nrepl in emacs (cdoc fn) emits: 

 CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
 cdoc in this context, compiling:(NO_SOURCE_PATH:1) 

 However, in lein repl I see:

 Loading clojuredocs-client...

 How do I make nrepl as smart as lein repl?



 On Fri, Dec 14, 2012 at 10:08 PM, Andy Fingerhut andy.fi...@gmail.comwrote:

 I would recommend checking out

 http://clojuredocs.org

 If you use Leiningen version 2, you can get similar output with these 
 two commands:

 lein repl
 user= (doc first)
 user= (cdoc first)

 doc gives the doc string built into Clojure.  cdoc gives the examples 
 from ClojureDocs.org for that symbol, as long as you have an Internet 
 connection.

 Andy

 On Dec 14, 2012, at 3:40 PM, lin...@redhandgaming.net wrote:

  I'm learning Clojure, and I learn best by jumping in. I'm interested 
 in using Noir. Noir has a full API reference, so when I'm reading other 
 people's Noir code, I can just look up the exact function and see what it 
 does.
 
  I can't find a similar thing for Clojure. I'm looking through other 
 people's Clojure code. I see something like (keyword (or (first m) :dev)) 
 and I don't really know where to start understanding this. I know enough to 
 know that keyword, or, and first are all functions - and with a google 
 search or two, I can figure out what 'first' does. But I can't easily find 
 out what 'or' and 'keyword' do, because when I google those things, I get 
 all kinds of screwy results, completely unrelated to what I'm trying to 
 find out.
 
  Where can I find, or does there exist, a place where I can view all 
 Clojure's built in functions with a short description of their arguments 
 and what they 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 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: (def some? (comp not nil? some))

2012-12-03 Thread Niels van Klaveren
That's why Jim mentions if-let and when-let in combination with some, they 
both detect if results are nil.

On Sunday, December 2, 2012 10:11:24 PM UTC+1, Ben wrote:

 On Sun, Dec 2, 2012 at 12:48 PM, Jim - FooBar(); 
 jimpi...@gmail.comjavascript: 
 wrote: 
  Its perfectly fine to use some as a predicate as far as I know...works 
  excellent with if-let/when-let - what is the problem? 

 There might be cases in which it matters whether something returns nil 
 (as 'some' does) or false (as 'some?' would). ('keep', for instance, 
 unlike 'filter', discriminates between nil and false.) 

 -- 
 Ben Wolfson 
 Human kind has used its intelligence to vary the flavour of drinks, 
 which may be sweet, aromatic, fermented or spirit-based. ... Family 
 and social life also offer numerous other occasions to consume drinks 
 for pleasure. [Larousse, Drink entry] 


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

2012-10-17 Thread Niels van Klaveren
(take 5 (range))

Many happy return values, Rich !


On Wednesday, October 17, 2012 3:53:55 AM UTC+2, Rich Hickey wrote:

 I released Clojure 5 years ago today. It's been a terrific ride so far. 

 Thanks to everyone who contributes to making Clojure, and its community, 
 great. 

 Rich

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

  1   2   >