Re: Are there file watchers that can tell me when a file is done uploading?

2016-12-11 Thread James Reeves
Checking whether a file is being written to tends to be very platform
specific. I don't think that there's any Java library that manages it
perfectly, but I could be wrong.

My inclination would be to watch for files in a directory, then poll their
filesize. If it remains static for, say, 30 seconds, they we can assume
they're complete.

Alternatively, you could build a simple web app with a drag and drop file
API. Users open the webpage, drag the Excel files to it, and you can then
control the upload and processing directly, even providing feedback.

- James

On 11 December 2016 at 19:47, larry google groups  wrote:

>
> I'm in a situation where we allow staff to upload Microsoft Excel files to
> our servers, which we then parse and store the data in DynamoDB.
>
> I've only used file watchers once before, to watch for any change in a
> directory. These seemed to trigger when a file was created in a directory
> -- I recall I then tried to read from such files, but I got an error
> because the file was still being written. I'm curious if there are file
> watchers that I can have trigger when a file is fully uploaded, or fully
> copied?
>
> My goal is to avoid the errors that occur when I try to read from a file
> that is still being written to.
>
>
>
> --
> 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 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: Are there file watchers that can tell me when a file is done uploading?

2016-12-11 Thread Torsten Uhlmann
Have a look at https://github.com/derekchiang/Clojure-Watch, it uses the
underlying Java7 WatchEvent API.
It supports :create, :modify and :delete events on watched files.

Would that help?

Torsten.

larry google groups  schrieb am So., 11. Dez.
2016 um 20:47 Uhr:

>
> I'm in a situation where we allow staff to upload Microsoft Excel files to
> our servers, which we then parse and store the data in DynamoDB.
>
> I've only used file watchers once before, to watch for any change in a
> directory. These seemed to trigger when a file was created in a directory
> -- I recall I then tried to read from such files, but I got an error
> because the file was still being written. I'm curious if there are file
> watchers that I can have trigger when a file is fully uploaded, or fully
> copied?
>
> My goal is to avoid the errors that occur when I try to read from a file
> that is still being written to.
>
>
>
> --
> 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.
>
-- 

-- 
AGYNAMIX(R). Passionate Software.
Inh. Torsten Uhlmann | Buchenweg 5 | 09380 Thalheim
Phone: +49 3721 273445
Fax: +49 3721 273446
Mobile:+49 151 12412427
Web:   http://www.agynamix.de

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


Are there file watchers that can tell me when a file is done uploading?

2016-12-11 Thread larry google groups

I'm in a situation where we allow staff to upload Microsoft Excel files to 
our servers, which we then parse and store the data in DynamoDB. 

I've only used file watchers once before, to watch for any change in a 
directory. These seemed to trigger when a file was created in a directory 
-- I recall I then tried to read from such files, but I got an error 
because the file was still being written. I'm curious if there are file 
watchers that I can have trigger when a file is fully uploaded, or fully 
copied? 

My goal is to avoid the errors that occur when I try to read from a file 
that is still being written to. 



-- 
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.spec - Why should you use and when

2016-12-11 Thread Patrick Kristiansen
Hi Rickesh

Take a look at this:

http://clojure.org/about/spec

-Patrick

On Sunday, December 11, 2016 at 5:30:19 PM UTC+1, Rickesh Bedia wrote:
>
> Hello,
>
> I have recently watched Rich Hickeys talk at Cojure Conj 2016 (
> https://www.youtube.com/watch?v=oyLBGkS5ICk - here's the link in case 
> anyone missed it) and although it was very interesting, I didn't really 
> understand the point in Clojure.Spec or when you'd use it. It seemed like 
> most of the ideas, such as conform, valid etc, had similar functions in 
> Clojure already.
>
> I have only been learning clojure for around 3 months now so maybe this is 
> due to lack of programming/Clojure experience.
>
> 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: "lein uberjar" gives me java.lang.OutOfMemoryError:

2016-12-11 Thread larry google groups
Thank you.


On Sunday, December 11, 2016 at 6:32:50 AM UTC-5, Matching Socks wrote:
>
> An answer from "noisesmith" here
>
> http://stackoverflow.com/questions/32288195/why-lein-uberjar-evaluates-variables-defined-with-def
> says, "In order to compile your namespace for the uberjar (if you have AOT 
> turned on), the clojure compiler must load your namespace. This will always 
> invoke all top-level side effects."
>

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


Clojure.spec - Why should you use and when

2016-12-11 Thread 'Rickesh Bedia' via Clojure
Hello,

I have recently watched Rich Hickeys talk at Cojure Conj 2016 
(https://www.youtube.com/watch?v=oyLBGkS5ICk - here's the link in case 
anyone missed it) and although it was very interesting, I didn't really 
understand the point in Clojure.Spec or when you'd use it. It seemed like 
most of the ideas, such as conform, valid etc, had similar functions in 
Clojure already.

I have only been learning clojure for around 3 months now so maybe this is 
due to lack of programming/Clojure experience.

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: ava.lang.SecurityException: class "org.apache.poi.POIXMLDocumentPart"'s signer information does not match signer information of other classes in the same package

2016-12-11 Thread larry google groups
Thank you. That is a bit frustrating but I guess that is the route I will go


On Sunday, December 11, 2016 at 6:26:04 AM UTC-5, Matching Socks wrote:
>
> Did you find
>
> http://stackoverflow.com/questions/2877262/java-securityexception-signer-information-does-not-match
> and the linked
>
> http://stackoverflow.com/questions/8878068/signer-information-does-not-match
>

-- 
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] edn-java 0.5.0 released

2016-12-11 Thread Ben Smith-Mannschott
edn-java [1] is a parser and printer for edn [2].

This release:

* Can read namespaced maps as per CLJ-1910 [47]
* Throws an exception when asked to read a map or set with duplicates [49]

It should be appearing on Maven Central shortly.

// Ben

[1] http://edn-java.bpsm.us

[2] https://github.com/edn-format/edn

[47] https://github.com/bpsm/edn-java/issues/47

[49] https://github.com/bpsm/edn-java/issues/49

-- 
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: Closure for object pattern? A good idea?

2016-12-11 Thread paul
Let me add a couple of comments, both from a clojure perspective and from 
other languages.

First, I have used this pattern in clojure and similar languages. I find it 
is often useful when I need to deal with multiple functions mutating the 
same state. In clojure, I used this to make little sloppy UI objects that 
all reference the same paintable thing, for instance. That ((:reset-state 
drawable-thingy) 13) was a quick and casual thing.

But it encourages you to use one of the functional programming 
anti-patterns (which is very common in OO languages): A function of no 
arguments with no return value. If you want your functions to be pure and 
side-effect free, then you know that a function with no return value does 
nothing. (Or more concisely, if it does something it does it through a side 
effect, so it isn't pure and side effect free). And pure and side effect 
free functions are useful for a variety of reasons. And one of the things 
clojure has worked hard to do (and one of my favorite features of the 
language) is to embrace this by having immutable structures everywhere. 
This then allows the STM implementation and a bunch of good stuff. 

So I'd say your pattern isn't very idiomatic, or perhaps is only idiomatic 
if you want to encapsulate mutable state with a set of cooperating 
functions without declaring a protocol.

Instead what you could do, as Logan points out, is separate your state 
(which is returned by a no-arg constructing function) from your 'modifiers' 
(which really clone and return a modified version.

But there's one problem you run into in the client code you posted.

Rather than the full stopwatch version, here's a very similar counter 
pattern.

(defn counter []
  {:count 0}
  )
(defn icount [counter]
  (update counter :count inc))
(defn dcount [counter]
  (update counter :count dec))
(def getcount :count)

(-> (counter) (icount) (icount) (dcount) (icount) (getcount))

OK so that returns 2 as we would expect. But if you want to use this inside 
your code, you need to 'stow away' the counters somewhere. Lets say you 
have something like (* (inc 2) 4) and you want to intersperse those counts. 
I end up with something that looks like this

(let [ct (counter)
  a 2
  ct (icount ct)
  b (inc a)
  ct (icount ct)
  d (* 4 b)
  ]
  [ d (getcount ct) ]
  )

And in your original example, where you are calling start and stop in what 
is basically procedural code that gets a bit nasty.

Where to put that counter is actually a problem which is section 2.3 of a very 
famous pape r, 
and it seems those ideas are kicking around the clojure community too, 
unsurprisingly.

But if you don't want to dive into that, you can still end up making your 
program easier by keeping your state and count in a map and then having an 
operator to count the functions.


(defn value-counter [ivalue]
  {:count 0 :value ivalue}
  )
(defn icount [counter]
  (update counter :count inc))
(defn dcount [counter]
  (update counter :count dec))
(def getcount :count)


(defn count-ops [c f & arguments ]
  (let [cn (icount c)
nv (apply f (:value cn) arguments)
]
(assoc cn :value nv)
)
  )

(-> (value-counter 2)
(count-ops inc)
(count-ops * 4)
)

Which returns { :count 2 :value 12 } as you'd hope.

Hope that helps!

On Sunday, December 11, 2016 at 2:41:14 AM UTC-5, Didier wrote:
>
> Logan's point about being able to add new functions on a stopwatch is 
> valid. That's often the argument to why protocols are better then classic 
> OO. Though I still feel like in some scenarios, I think this is a good 
> pattern, and can serve us better, the stopwatch being one good example.
>
> Nothing in the pattern necessitate this to be mutable either, though I 
> guess this pattern does seem to have some of its advantages from when you 
> need mutability for some reason. Then I like how it isolates the mutable 
> data behind the functionality.
>
> It feels like a lighter weight version of both OO and protocols/records. 
> I'm curious to benchmark it against records, which is what I would have 
> used before for something like a stopwatch.
>
> I think this could come in handy when doing libraries with options. My 
> current pattern was to have a function create an options, and then the user 
> would need to manage the options map, and pass it to all my library 
> functions. Or I would use a var instead the library to store the options 
> map, and offer it as a binding so users could rebind their own options. The 
> problem with the latter is that you can't run the library with two 
> different option set at the same time, while the former forces you to have 
> to manage an options map and pass it around everywhere. So I feel there's 
> something I could do here, with wrapping everything in this pattern, and 
> having the options be captured in the closure.
>
> On Friday, 9 December 2016 23:47:34 UTC-8, Didier 

Re: "lein uberjar" gives me java.lang.OutOfMemoryError:

2016-12-11 Thread Matching Socks
An answer from "noisesmith" here
http://stackoverflow.com/questions/32288195/why-lein-uberjar-evaluates-variables-defined-with-def
says, "In order to compile your namespace for the uberjar (if you have AOT 
turned on), the clojure compiler must load your namespace. This will always 
invoke all top-level side effects."

-- 
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: ava.lang.SecurityException: class "org.apache.poi.POIXMLDocumentPart"'s signer information does not match signer information of other classes in the same package

2016-12-11 Thread Matching Socks
Did you find
http://stackoverflow.com/questions/2877262/java-securityexception-signer-information-does-not-match
and the linked
http://stackoverflow.com/questions/8878068/signer-information-does-not-match

-- 
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: ava.lang.SecurityException: class "org.apache.poi.POIXMLDocumentPart"'s signer information does not match signer information of other classes in the same package

2016-12-11 Thread Dusan
Looks like poi-ooxml is a signed jar, so you can't include it in uberjar. 
Just add the :uberjar-exclusions[#"^org.apache.poi"] in your project.clj 
and add the required poi jar files to the classpath when running the app

On Sunday, December 11, 2016 at 9:15:47 AM UTC+4, larry google groups wrote:
>
> I've never worked much with Java, so dealing with stuff like Maven is the 
> stuff I understand least about Clojure. 
>
> I've added these 3 items to the dependencies that I list in project.clj
>
>
>  [org.apache.poi/poi "3.9"]   
>  [org.apache.poi/poi-ooxml "3.9"]
>  [org.eclipse.birt.runtime/org.eclipse.birt.runtime 
> "4.2.2"]
>
> When I run "lein uberjar" I get this: 
>
> java.lang.SecurityException: class "org.apache.poi.POIXMLDocumentPart"'s 
> signer information does not match signer information of other classes in 
> the same package
>
> How do I get around 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.