Re: Big Excel (xlsx) file parsing (docjure, incanter...)

2013-12-11 Thread Ragnar Dahlén
Have you tried increasing the heap size of your JVM using the -Xmx and -Xms 
options? 

We're loading some spreadsheets that are 80M in size and have to run with a 
~1.5G heap to handle this...

On Saturday, 7 September 2013 02:22:27 UTC+1, Stanislav Sobolev wrote:
>
> Hello guys. I have excel file with huge columns in there.
> When i used some plugin(docjure, or anything else) it shows 
> me CompilerException java.lang.OutOfMemoryError: Java heap space, compiling
> How can i handle that big file without converting it to csv? 
> Primary problem in xlsx structure, it doesnt have lines or something, 
> unlike csv.
>

-- 
-- 
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: Any libraries for creating Powerpoint and Excel files

2014-01-15 Thread Ragnar Dahlén
Hi Colin,

For Excel, there's docjure (https://github.com/ative/docjure) which 
provides a quite nice interface to Apache POIs (http://poi.apache.org/) 
Excel capabilities.

Apache POI also has support for Power Point, but I don't know to what 
extent.

Ragnar



On Wednesday, 15 January 2014 09:08:09 UTC, Colin Yates wrote:
>
> Hi all,
>
> Any one broken that ground before?
>
> Thanks,
>
> Col
>

-- 
-- 
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: REPL: viewing data structures containing infinite lists

2014-04-02 Thread Ragnar Dahlén
If you're using cider (https://github.com/clojure-emacs/cider), there's a 
convenience function for controlling the value of *print-length*, including 
giving it a default value for new nrepl instances:

https://github.com/clojure-emacs/cider#limiting-printed-output-in-the-repl

/Ragnar

On Tuesday, 1 April 2014 01:49:57 UTC+1, Christopher Howard wrote:
>
> Is there some kind of "safe" function for printing representations of 
> lazy, infinite data structures? I'm finding I like using them inside 
> other data structures here and there. However, when I go to play 
> around with things in the REPL, sooner or later my workflow is 
> interrupted by 3 million characters streaming across the console. 
>
> I don't imagine there would be any way for the REPL to detect that a 
> lazy sequence was infinite. However, if it would simply refuse to 
> evaluate lazy sequence (say, represent them by some special identifier) 
> that 
> would be good enough for me. 
>

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

2014-04-04 Thread Ragnar Dahlén
You may find this thread enlightening:

https://groups.google.com/d/msg/clojure-dev/PuV7XTps9vo/SkkNuiynKfUJ

/Ragnar

On Friday, 4 April 2014 10:44:42 UTC+1, Robin Heggelund Hansen wrote:
>
> Yeah, those were the blog posts I’ve read, but I can’t see that this is 
> actually being worked on for Clojure?
>
> 4. apr. 2014 kl. 11:43 skrev Plínio Balduino 
> >:
>
> Hi, Hansen
>
> Fogus (from here) and Nutter (from JRuby) wrote nice posts about it. 
>
>
> http://blog.fogus.me/2011/10/14/why-clojure-doesnt-need-invokedynamic-but-it-might-be-nice/
>
>
> http://blog.headius.com/2011/10/why-clojure-doesnt-need-invokedynamic.html?m=1
>
> Plinio Balduino
> 11 982 611 487
>
> On 04/04/2014, at 05:42, Robin Heggelund Hansen 
> > 
> wrote:
>
> Hi!
>
> Did someone ever look at supporting InvokeDynamic for Clojure? I've read a 
> couple of blogs and it seemed interesting, would be cool to know if there 
> actually were any advantages in practice.
>
> -- 
> 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 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 a topic in the 
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojure/vNXIfkgRRkI/unsubscribe.
> To unsubscribe from this group and all its topics, 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.


Re: [ANN] clj-kafka 0.3.1

2015-06-12 Thread Ragnar Dahlén
Hi Omri,

There's clj-kafka.zk/set-offset! for exactly that 
purpose: https://pingles.github.io/clj-kafka/clj-kafka.zk.html#var-set-offset.21

Thanks,
Ragnar

On Friday, 12 June 2015 18:23:23 UTC+1, Omri Hurvitz wrote:
>
> Hi Paul.
>
> This looks great - I am looking forward to replace my hacked wrapper for 
> the Java (and Scala...) API with this code.
> One question: if I have a zk consumer stream with auto.commit.enable set 
> to false, how do I manually commit the changes?
>
> Thanks,
>
>   Omri
>
> On Friday, June 12, 2015 at 11:35:44 AM UTC-4, Paul Ingles wrote:
>>
>> Hi all,
>>
>>
>> I'm delighted to say 0.3.1 is released and available on Clojars.
>>
>>
>> It's been a long while since we've made any big changes to clj-kafka so 
>> I'm very happy to say we've caught up over the past couple of days. Most of 
>> the changes were the result of submissions from the community but I have to 
>> give most of the credit to Ragnar Dahlen :)
>>
>>
>> Notable changes:
>>
>>
>> - Refactored Zookeeper consumer to expose underlying streams (transducer 
>> compatible :)
>>
>> - "New Producer" API support
>>
>> - Topic Administration
>>
>> - Updated to Kafka 0.8.2.1
>>
>> - Removed Kafka deps from clj-kafka
>>
>>
>> https://github.com/pingles/clj-kafka/
>>
>> http://pingles.github.io/clj-kafka/
>>
>>
>>
>> Zookeeper Consumer
>>
>> =
>>
>> We've broken the old messages function apart into two pieces: 
>> create-message-stream will connect the consumer to a message stream (topic 
>> + number of threads when consuming more than 1 partition) and stream-seq 
>> (recast the stream as a lazy sequence as with earlier releases).
>>
>>
>> This change addresses a bunch of other requests/changes people had 
>> submitted. Hopefully most stuff that was a little tough to do before is now 
>> easier to integrate- composition with other libs like manifold[1] should be 
>> easier.
>>
>>
>> Transducer Support
>>
>> 
>>
>> This also means that the lib is easier to use with transducers[2] which 
>> should be useful for people doing stream processing.
>>
>>
>>
>> New Producer API
>>
>> ==
>>
>> We have integrated support for the "New Producer" API[3,4]. This is 
>> asynchronous by default but provides both futures and callbacks to return 
>> the offset/error.
>>
>>
>> Topic Administration
>>
>> 
>>
>> A new namespace exists that wraps some of the Kafka admin utils for 
>> checking if topics exist, creating/removing topics and changing per-topic 
>> configuration.
>>
>>
>> No Kafka deps in clj-kafka
>>
>> 
>>
>> I think* this was inherited from back when the Kafka releases had no 
>> dependencies specified and so clj-kafka had to specify them instead. This 
>> is no longer necessary so the project config is substantially tidier. This 
>> is quite a substantial difference so please just check that this doesn't 
>> break anything you were depending on.
>>
>>
>>
>>
>> 1) https://github.com/ztellman/manifold
>>
>> 2) 
>> https://github.com/pingles/clj-kafka/blob/master/README.md#usage-with-transducers
>>
>> 3) 
>> http://blog.confluent.io/2014/12/02/whats-coming-in-apache-kafka-0-8-2/
>>
>> 4) 
>> http://kafka.apache.org/082/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html
>>
>> 5) 
>> https://github.com/pingles/clj-kafka/blob/master/README.md#administration-operations
>>
>

-- 
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 on AWS Lambda?

2015-06-16 Thread Ragnar Dahlén
I gave it a go:
https://github.com/uswitch/lambada

It's just a POC. Needed a Java shim to manage class loaders so the 
interface is not as nice I was hoping.

Might make it into library if there's interest.


On Monday, 15 June 2015 21:07:29 UTC+1, Kyle Sexton wrote:
>
> Curious if anyone is doing anything on AWS Lambda now that it supports 
> running Lambda functions in Java, 
> https://aws.amazon.com/blogs/aws/aws-lambda-update-run-java-code-in-response-to-events/
>  
> ? 
>
>
> Kyle Sexton 
>

-- 
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 on AWS Lambda?

2015-06-17 Thread Ragnar Dahlén
You can get the initial startup time down by AOT compiling. I also believe 
that Lambda will re-use the same runtime and lambda function instance until 
a certain period of inactivity.

For example, in the example below I invoke the function (AOT compiled this 
time) three times. First invocation takes ~7s, the two following ~1.5ms.


START RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
HELLO FROM CLOJURE :)
#object[lambdainternal.api.LambdaClientContext 0x3419866c 
lambdainternal.api.LambdaClientContext@3419866c]
END RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
REPORT RequestId: b555c9c2-14c1-11e5-8a31-03153568534c Duration: 7882.62 ms 
Billed Duration: 7900 ms Memory Size: 512 MB Max Memory Used: 98 MB
START RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
HELLO FROM CLOJURE :)
#object[lambdainternal.api.LambdaClientContext 0x63e31ee 
lambdainternal.api.LambdaClientContext@63e31ee]
END RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
REPORT RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63 Duration: 1.66 ms 
Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB
START RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
HELLO FROM CLOJURE :)
#object[lambdainternal.api.LambdaClientContext 0x68fb2c38 
lambdainternal.api.LambdaClientContext@68fb2c38]
END RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
REPORT RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8 Duration: 1.56 ms 
Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB


On Tuesday, 16 June 2015 16:46:36 UTC+1, Kyle Sexton wrote:
>
> Answering my own question about performance, it looks like almost 14 
> seconds for the Lambda function to run. Doing the math1 
> <#m2mvzzr704.fsf@mocker.org_fn.1> if I were to run this 300 times in 
> a month bill would be about $342.56. Probably not the ideal solution for 
> clojure in the cloud just yet. :)
>  
> START RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
> HELLO FROM CLOJURE :)
> #object[lambdainternal.api.LambdaClientContext 0x26a7b76d 
> lambdainternal.api.LambdaClientContext@26a7b76d]
> END RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
> REPORT RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2ebDuration: 
> 13680.53 ms   Billed Duration: 13700 ms   Memory Size: 512 MB Max 
> Memory Used: 104 MB
>
>  Kyle Sexton
>  
> Footnotes:
>  Footnotes: 
> 1 <#m2mvzzr704.fsf@mocker.org_fnr.1> 
>
> Used http://aws.amazon.com/lambda/pricing/ and came up with (* (* (* 13.7 
> 300) (/ 512 1024.0)) 0.1667) where 300 is number of times run 
> per month, 13.7 is seconds of billable time, 512 is MB of RAM allocated to 
> the function.
>  

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


[ANN] lambada - using clojure with AWS Lambda

2015-06-17 Thread Ragnar Dahlén
Hi,

I've just released lambada, a tiny library that provides a way to write AWS 
Lambda [1] functions in clojure:

https://github.com/uswitch/lambada

The slightly tricky part with using clojure on Lambda was getting the 
clojure runtime to load classes using the correct class loader and this 
library solves that problem, and provides a simple macro to generate named 
classes that can be used as Lambda handlers.

Cheers,

Ragnar 


[1]: http://docs.aws.amazon.com/lambda/latest/dg/welcome.html

-- 
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: problem using boot-clj to build uberjar that starts up a component based system

2015-07-13 Thread Ragnar Dahlén
Hi Matthias,

I encountered similar symptoms (basically a corrupt uberjar) which I 
eventually tracked down to file handle leaks and fixed 
in: https://github.com/boot-clj/boot/pull/228

This PR has been merged but not been released yet, so I'd give boot master 
a go and see if that fixes your problem.




On Monday, 13 July 2015 14:53:22 UTC+1, Matthias Sattel wrote:
>
> I am currently using the component library from Stuart Sierra to build up 
> a system. So far it works on the repl and in my tests, but somehow when I 
> build the uberjar using boot.clj and execute it, the system doesn't start.
>
> (defn -main
>   "Startup the embedded http server and the other components."
>   [& args] 
>   ;(start-server)
>   (let [system (system/my-system {})]
> (do
>   (info "Try to start my system " system)
>   (component/start system
>
> And my-system is build as follows:
>
> (defn my-system [config-options]
>   (do 
> (info "Building my system")
> (-> (component/system-map
>  :my-storage (my-storage-test-component/new-storage)
>  :http (http-component/new-http-server (http-port (:http-port 
> config-options)) (wrap-handler)))
> (component/system-using {:http {:storage :my-storage}}))
> ))
>
> I added those log outputs because I am new to clojure and have not 
> debugged clj code yet.
> On the repl I can call the -main function and it startsup the system as 
> expected, but when I build an uberjar with boot and start it, then it just 
> logs the two info messages on the command line, then it seems to do nothing 
> for some seconds and then it stops.
>
> Any help would be great, maybe you guys can tell me how I can find the 
> problem. Can I somehow debug into that when I run the jar file??? Could it 
> be a problem with aot?
>
> This is my boot config:
> (task-options!
> pom {
> :project 'my-project
> :version "0.1.0-SNAPSHOT" }
> aot {:namespace '#{myproject.embedded-main}}
> jar {
> :manifest {"description" "Testing boot"}
> :main 'myproject.embedded-main })
>
> (deftask build
>  "Building the project"
>  []
>  (comp
> (aot)
> (pom)
> (uber)
> (jar)
> (install)))
>
>

-- 
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: newbie question on agent/transaction

2015-07-15 Thread Ragnar Dahlén
Hi Bill,

You are correct in that this involves close integration with the STM. The 
agent implementation is aware of transactions and if a transaction is 
running when dispatching an action, it will be enqneued in a special agent 
action queue that STM implementation respects.

AFAIK there is no public API for checking if a transaction is currently 
running.

See:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L249
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LockingTransaction.java#L106






On Wednesday, 15 July 2015 13:26:11 UTC+1, William la Forge wrote:
>
> On this page http://clojure.org/agents I read the following:
>  "Agents are integrated with the STM - any dispatches made in a 
> transaction are held until it commits, and are discarded if it is retried 
> or aborted."
>
> So there must be a way to tell if a dispatch is made from within a 
> transaction. Yet I am looking here http://clojure.org/refs and can not 
> find any such function.
>
> What then is the means of determining if you are processing a transaction, 
> or is this something that involves close integration with STM?
>
> thanks! --Bill
>

-- 
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: newbie question on agent/transaction

2015-07-15 Thread Ragnar Dahlén
You can check with `(clojure.lang.LockingTransaction/isRunning)` (the io! 
macro does this) but I'm not sure if it's considered a public API.

https://github.com/clojure/clojure/blob/f6a90ff2931cec35cca0ca7cf7afe90ab99e3161/src/clj/clojure/core.clj#L2390

On Wednesday, 15 July 2015 13:53:11 UTC+1, Ragnar Dahlén wrote:
>
> Hi Bill,
>
> You are correct in that this involves close integration with the STM. The 
> agent implementation is aware of transactions and if a transaction is 
> running when dispatching an action, it will be enqneued in a special agent 
> action queue that STM implementation respects.
>
> AFAIK there is no public API for checking if a transaction is currently 
> running.
>
> See:
>
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Agent.java#L249
>
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LockingTransaction.java#L106
>
>
>
>
>
>
> On Wednesday, 15 July 2015 13:26:11 UTC+1, William la Forge wrote:
>>
>> On this page http://clojure.org/agents I read the following:
>>  "Agents are integrated with the STM - any dispatches made in a 
>> transaction are held until it commits, and are discarded if it is retried 
>> or aborted."
>>
>> So there must be a way to tell if a dispatch is made from within a 
>> transaction. Yet I am looking here http://clojure.org/refs and can not 
>> find any such function.
>>
>> What then is the means of determining if you are processing a 
>> transaction, or is this something that involves close integration with STM?
>>
>> thanks! --Bill
>>
>

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


[ANN] clj-squash 0.1.0

2013-01-19 Thread Ragnar Dahlén
Hi,

I did some work to enable Clojure applications to use Squash, an exception 
reporting and bug analysis tool recently released by Square (see 
http://www.square.io).

This resulted in clj-squash (apologies for the lack of fantasy), which I 
think is now usable enough to warrant an offical 0.1.0 release in the hope 
that others might find it useful.

A release has been pushed to Clojars, and the code is available at:
https://github.com/ragnard/clj-squash

Feedback and/or contributions are most welcome and appreciated.

Best regards,

Ragnar Dahlén

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

Re: [ANN] clj-squash 0.1.0

2013-01-22 Thread Ragnar Dahlén
Hi Jeroen,

You're entirely correct about the url, thanks!

We're using Airbrake too, and like you (and Square, apparently), I'm not 
too impressed.

As for using Squash for Clojure applications, it was quite straight forward 
to create a client library and Squash has been written with not only Ruby 
in mind. There are client libraries for a number of platforms/languages, 
including Java, which Square are heavy users of.

I pushed a 0.1.1 version of clj-squash a few days ago, which adds a few 
improvements to the Ring middleware, most notably capturing the request 
map. With this, I would say you have the same information available in 
Squash as in Airbrake. I still have to look into how source file paths are 
to be treated to enable you to see the actual code where the exception 
occurred.

Let me know if you have any questions or suggestions, and be sure to use 
the latest version in Clojars if you try it out.

Cheers,
Ragnar


On Tuesday, 22 January 2013 10:49:08 UTC, Jeroen van Dijk wrote:
>
> Hi Ragnar,
>
> This looks interesting. It looks like the url to the Squash app should be 
> http://www.squash.io instead.
>
> I'm currenty (ab)using Airbrake as an exception notifier for my Clojure 
> apps (which is really unsatisfactory for many reasons). Since it seems 
> Squash has been built from a Ruby a background as well, could you say 
> something about how it works for a Clojure environment?
>
> I hope to try it out soon.
>
> Cheers,
> Jeroen
>
>
> On Sat, Jan 19, 2013 at 7:02 PM, Ragnar Dahlén 
> > wrote:
>
>> Hi,
>>
>> I did some work to enable Clojure applications to use Squash, an 
>> exception reporting and bug analysis tool recently released by Square (see 
>> http://www.square.io).
>>
>> This resulted in clj-squash (apologies for the lack of fantasy), which I 
>> think is now usable enough to warrant an offical 0.1.0 release in the hope 
>> that others might find it useful.
>>
>> A release has been pushed to Clojars, and the code is available at:
>> https://github.com/ragnard/clj-squash
>>
>> Feedback and/or contributions are most welcome and appreciated.
>>
>> Best regards,
>>
>> Ragnar Dahlén
>>
>> -- 
>> 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: [ANN] Kern 0.5.0 -- A text-parsing library

2013-02-07 Thread Ragnar Dahlén
Hi Armando,

Thank you for your great work with this library! I don't have much previous 
experience with parser combinators, but with your implementation, and the 
wonderful documentation, I've had a lot of fun playing and learning.

I've been hacking on a small project for implementing a subset of HAML for 
Clojure, with the goal of using HAML instead of HTML for enlive templates. 
It is very early days, but if you're interested, I'd be very happy for any 
feedback on the parser, which uses kern. I've probably done a lot of stupid 
stuff.

Project:
https://github.com/ragnard/hamelito

Parser:
https://github.com/ragnard/hamelito/blob/master/src/hamelito/parsing.clj

Best regards,

Ragnar


On Monday, 21 January 2013 18:27:07 UTC, Armando Blancas wrote:
>
> Kern is a text-parsing library based on Parsec, the Haskell monadic 
> combinators library. It is useful for parsing all kinds of text: data, 
> program input, configuration files, DSLs, or a full-blown programming 
> language.
>
> My main goal is, like the Self folks, the power of simplicity. In the 
> ideal case the grammar is the implementation, but I'm OK with something 
> close. Next comes performance, which appears to be fine with hot code but 
> not great otherwise. Let me know and will see what I can do.
>
> https://github.com/blancas/kern
>
> The wiki has a user's guide, tutorials, and links to several samples; will 
> be adding some more topics there. There's also a Codox API zip file 
> available for download. Feedback, suggestions, requests, bug reports are 
> all very welcome; please use the project wiki.
>
>

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




Surprising behaviour related to records, protocols and AOT

2013-04-16 Thread Ragnar Dahlén
Hi,

Today I encountered a, to me, slightly surprising behaviour seemingly
related clojure records. 

The setup is as follows:

1. One namespace defines a record type:

(ns defrecordissue.arecord)

(defrecord ARecord [])


2. Another namespace defines a protocol, and extends it to the record
   type defined in 1:

(ns defrecordissue.aprotocol
  (:require [defrecordissue.arecord])
  (:import [defrecordissue.arecord ARecord]))
 
(defprotocol AProtocol
  (afn [this]))
 
(extend-protocol AProtocol
  ARecord
  (afn [this] 42))

3. A third namespace constructs an instance of the record and invokes
   the protocol function on the record:

(ns defrecordissue.aot1
  (:require [defrecordissue.aprotocol]
[defrecordissue.arecord]))
 
(defrecordissue.aprotocol/afn (defrecordissue.arecord/->ARecord))


When the defrecordissue.aot1 namespace is compiled, in my case using
`lein compile defrecordissue.aot1`, compilation fails with the
following exception:

Exception in thread "main" java.lang.IllegalArgumentException: No 
implementation of method: :afn of protocol: 
#'defrecordissue.aprotocol/AProtocol found for class: 
defrecordissue.arecord.ARecord, compiling:(aot1.clj:5:1)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463)
at clojure.lang.Compiler.compile1(Compiler.java:7153)
at clojure.lang.Compiler.compile(Compiler.java:7219)
at clojure.lang.RT.compile(RT.java:398)
at clojure.lang.RT.load(RT.java:438)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$compile$fn__5023.invoke(core.clj:5541)
at clojure.core$compile.invoke(core.clj:5540)
at user$eval7.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6609)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$eval_opt.invoke(main.clj:308)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: No implementation of method: 
:afn of protocol: #'defrecordissue.aprotocol/AProtocol found for class: 
defrecordissue.arecord.ARecord
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:541)
at defrecordissue.aprotocol$fn__40$G__35__45.invoke(aprotocol.clj:5)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3458)
... 25 more 

If I change 3) to construct the record class directly, like so:

   (ns defrecordissue.aot2
 (:require [defrecordissue.aprotocol]
   [defrecordissue.arecord]))

   (defrecordissue.aprotocol/afn (defrecordissue.arecord.ARecord.))

Compilation succeeds.

My suspicion is that this is somehow related to
http://dev.clojure.org/jira/browse/CLJ-371, but I don't understant
exactly what is happening. 

I should also add that without the `lein clean`, compilation succeeds
the second time, since a class for the record is now available on the
classpath. Therefore, I can get around this problem by AOT-compiling
the namespace defining the record type.

I created a simple leiningen project on GitHub that illustrates the
issue, see README for usage:
https://github.com/ragnard/defrecordissue

Any enlightenment is much appreciated.

Cheers,

Ragnar

-- 
-- 
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: Surprising behaviour related to records, protocols and AOT

2013-04-17 Thread Ragnar Dahlén
Changing 3) to also import the record class:

(ns defrecordissue.aot1
  (:require [defrecordissue.aprotocol]
[defrecordissue.arecord])
  (:import [defrecordissue.arecord ARecord]))

makes no difference. Compilation still fails with the same exception.

This is obviously a contrived example. When I encountered this in the
wild, the consumer of the equivalent of the defrecord.aprotocol
namespace did not construct a record instance directly. It has no
awareness of the record type, and should not need to have so.


On Wednesday, 17 April 2013 20:13:36 UTC+1, Andrew Sernyak wrote:
>
> I guess you have to import defrecord generated class before you want to 
> use it, check the sample from clojuredocs about defrecord
>
> ; If you define a defrecord in one namespace and want to use it
>> ; from another, first require the namespace and then import
>> ; the record as a regular class.
>> ; The require+import order makes sense if you consider that first
>> ; the namespace has to be compiled--which generates a class for
>> ; the record--and then the generated class must be imported.
>> ; (Thanks to raek in #clojure for the explanations!)
>>
>> ; Namespace 1 in "my/data.clj", where a defrecord is declared
>> (ns my.data)
>>
>> (defrecord Employee [name surname])
>>
>>
>> ; Namescape 2 in "my/queries.clj", where a defrecord is used
>> (ns my.queries
>>   (:require my.data)
>>   (:import [my.data Employee]))
>>
>> (println
>>   "Employees named Albert:"
>>   (filter #(= "Albert" (.name %))
>> [(Employee. "Albert" "Smith")
>>  (Employee. "John" "Maynard")
>>  (Employee. "Albert" "Cheng")]))
>>   
>>
>>

-- 
-- 
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: Surprising behaviour related to records, protocols and AOT

2013-04-18 Thread Ragnar Dahlén
Thank you for your explanation. I also suspect there is some subtle
issue with the class file being used by the different constructors.

However, I would be surprised if this behaviour is intended, and that 
the 'hackery' you proposed is the only, and prefered way of solving this.

To better illustrate the core issue, I updated the example slightly
as follows:

Premise: 
defrecordissue.arecord and defrecordissue.protocol constitute some
library.

1. defrecordissue.arecord defines a record type, and a function that
   will return an instance of the record:

(ns defrecordissue.arecord)

(defrecord ARecord [])

(defn make-record
  []
  (->ARecord))

2. defrecordissue.protocol defines a protocol, and extends it to the
   record type defined in 1. It also defines a public function
   intended to be used by libraries:

(ns defrecordissue.aprotocol
  (:require [defrecordissue.arecord])
  (:import [defrecordissue.arecord ARecord]))
 
(defprotocol AProtocol
  (afn [this]))
 
(extend-protocol AProtocol
  ARecord
  (afn [this] 42))

(defn some-public-fn
  []
  (afn (defrecordissue.arecord/make-record)))

3. defrecordissue.consumer is a consumer of the library, knows
   nothing of any protocols or records, but only wants to call a
   function thats part of the public api:

(ns defrecordissue.consumer
  (:require [defrecordissue.aprotocol]))
 
(defrecordissue.aprotocol/some-public-fn)

This fails with the same root cause.

I've created a new branch for this in the GitHub repo.

https://github.com/ragnard/defrecordissue/tree/more-realistic

/Ragge

On Thursday, 18 April 2013 12:19:35 UTC+1, Andrew Sernyak wrote:
>
> I guess extend-type does changes only to generated java class and the var 
> defrecordissue.arecord->ARecord 
> contains the 'old' version of ARecord constructor. Obviously it would be 
> weird for defprotocol to change the variable in another namespace. 
> Especially when you can extend a record from anywhere.
>
> So If you want to create a record that implements your protocol via var 
> from record namespace, you should do some hackery to update that variable. 
> I've done a pull-request for you, but using direct constructor will be more 
> idiomatic
>
> ;
>> ; this won't work unless you update manualy a variable ->ARecord in the 
>> namespace
>> ;
>> ;(defrecordissue.aprotocol/afn (defrecordissue.arecord/->ARecord))
>> ; 
>> ; like
>> (defmacro from-ns[nmsps & body] 
>>   "launches body from namespace"
>>   `(binding 
>>  [*ns* (find-ns ~nmsps)] 
>>(eval
>>   (quote (do ~@body)
>> (from-ns 'defrecordissue.arecord 
>>  (import '(defrecordissue.arecord.ARecord))
>>  (alter-var-root 
>>('->ARecord (ns-publics 'defrecordissue.arecord)) 
>>(fn[x] (fn[] (new ARecord)
>> (println  (defrecordissue.aprotocol/afn 
>> (defrecordissue.arecord/->ARecord)))
>> ; 42
>
>
> ndrw 
>

-- 
-- 
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] hamelito - bringing haml to enlive

2013-04-26 Thread Ragnar Dahlén
Hello,

I'd like to announce the availability of hamelito, a clojure library
allowing you to use a subset of haml (http://www.haml.info) with
enlive (http://github.com/cgrand/enlive).

The source code is available under the EPL and is hosted at:
http://github.com/ragnard/hamelito

Artifacts are published to clojars:
https://clojars.org/com.github.ragnard/hamelito

Please see the readme for the latest available release, and updates
on the project.

We've been using hamelito at uSwitch for one of our internal clojure
applications for a while and it's been working quite well. That said,
I expect it to crash and burn for some more (or maybe less) exotic
haml input. Any feedback, bug reports and/or code contributions are
much appreciated.

I've also started writing a few blog posts on my experience using
enlive, one on hamelito in particular, which you might find relevant:
http://ragnard.github.io/2013/04/19/exploring-enlive-haml.html

Cheers,

Ragnar

-- 
-- 
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: Insane stack trace with no reference to my code

2016-09-27 Thread Ragnar Dahlén
Hi Colin,

I think you're correct in that something is calling print on a largish data 
structure (possibly due to "loops" like Thomas points out), and due to the 
recursive nature of print you're running out of stack space. The JVM 
(hotspot anyway) will by default only keep the top 1024 stack frames which 
is likely why you're not seeing your code anywhere:

$ java -XX:+PrintFlagsFinal -version | grep MaxJavaStackTraceDepth
 intx MaxJavaStackTraceDepth= 1024 
   {product}

You could try increasing that value, or increasing the stack size (-Xss), 
or possibly binding *print-length* to something small to troubleshoot this 
problem.

/Ragnar

On Tuesday, 27 September 2016 11:16:15 UTC+1, Colin Yates wrote:
>
> Thanks Thomas. The NREPL is a red herring as that is a printout from my 
> local machine - the production error doesn't reference any REPLs - I should 
> have stated that. Unfortunately I can't get it from production as it is a 
> very locked down environment (no copy and paste, no internet connection 
> etc.).
>
> To be clear, I get this behaviour from a web request.
>
> I might be doing something stupid with components referencing themselves 
> but I don't think so - good call though and somewhere to reference. Still 
> mystified as to why there is no reference to my code though.
>
> Thanks Thomas.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
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.


New library 'redis-clojure': Feedback and questions

2009-06-05 Thread Ragnar Dahlén

Hello everyone,

I have spent a few days implementing a client library for Redis
(http://code.google.com/p/redis/), a key value storage system, that
is slightly more than 'just' a key value storage system.

My Lisp experience before Clojure is basically limited to a couple of
hundred lines of ELISP code for my Emacs setup, so the Lisp way of
thinking, and associated concepts, patterns and so on, is really new
to me.

This is my first real Clojure project and I would be very grateful for
feedback on everything from overall design, style and nomenclature to
misspelled comments.

Some things are not yet implemented, most notably the "SORT"
command. I felt I needed som feedback before proceeding any further.

The source code can be found on github at:

http://github.com/ragnard/redis-clojure


Also, I have two questions (actually, I have many, these two came to
my mind):

I decided I wanted the functions that perform Redis commands to have
the same name as the command. For example, the command to check if a
key exists is:

"EXISTS key"

Therefore, I wanted the corresponding clojure function to be:

(exists "key")

This turned out to be problematic since a couple of the commands have
the same names as some clojure.core functions, most notably get and
set.

I solved this by checking if *ns* already contained a mapping for the
name, and if so, ns-unmap:ing it.

To use the functions, you would then have to (require 'redis), ie. not
:use, and call them namespace qualified, ie.

(redis/get "key")
(redis/set "key" "value")

First question: Is this a bad idea? How should you generally solve
function name clashes? In this case, I really wanted to have the same
name, not "redis-get" or something similar.

Second question: I tried AOT compiling my library, and packaging the
class files into a JAR (check build.xml, jar target). However, when I
try to use JAR file and (require 'redis) I get the following
exception:

Caused by: java.lang.IllegalStateException: keys already refers to:
#'redis/keys in namespace: redis
at clojure.lang.Namespace.reference(Namespace.java:86)
at clojure.lang.Namespace.refer(Namespace.java:109)
at clojure.core$refer__4345.doInvoke(core.clj:2433)
at clojure.lang.RestFn.invoke(RestFn.java:415)
at redis$loading__5572__auto1.invoke(redis.clj:3)
at redis__init.load(Unknown Source)
at redis__init.(Unknown Source)

If I only package the clj files (not class files), it works. This is
what build.xml currently does.

Best regards,

Ragnar Dahlén

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