Re: Why is the start function called -main

2017-09-07 Thread Cecil Westerhof
2017-09-07 7:09 GMT+02:00 Didier :

> Clojure is always launched from Java, there's no way to bootstrap straight
> into Clojure from the JVM. So when you launch the JVM, it always starts in
> a Java main method. What Clojure does normally, is that it creates the Java
> main method for you, and have it call your own main method.
>
> So it goes: JVM -> Java main method -> Clojure main function.
>
> What creates the Java main method for you is the (gen-class) macro. To
> know which of your Clojure function to have the Java main method it'll
> generate call, it uses a convention. This convention by default is that it
> will call the function named "-main". You can choose to change the "-" to
> any other prefix, but it is "-" by default. The convention forces you to
> have it end with "name", but lets you choose whatever prefix you want,
> which is "-" by default. I think you could set the prefix to "" and have
> your Clojure main function be called simply "main" if you want (never tried
> it though).
>
> Why is it prefixed?
>
> Well, the idea of having a prefix is that any Clojure function used for
> interop, in the sense that it is designed to be called from Java, is
> prefixed, so you can easily know its purpose is Java interop. So by
> default, all Clojure function prefixed with "-" can be assumed to be
> interop functions used by Java.
>

​Thanks. That makes sense.

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


Re: Why is the start function called -main

2017-09-06 Thread Cecil Westerhof
2017-09-06 23:42 GMT+02:00 Justin Smith :

> To define a method in gen-class you need to use a prefix on the function
> name, "-" is the default prefix
>
​I have to delve a little deeper into that on a rainy day.
​



> On Wed, Sep 6, 2017, 14:41 Cecil Westerhof  wrote:
>
>> 2017-09-06 23:27 GMT+02:00 Matching Socks :
>>
>>> There is a hint, as to this, in the API doc of gen-class:
>>>
>>> https://clojure.github.io/clojure/clojure.core-api.html#
>>> clojure.core/gen-class
>>>
>>
>> ​That explains what happens, not why. ;-)
>>
>
-- 
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.


Re: Why is the start function called -main

2017-09-06 Thread Cecil Westerhof
2017-09-06 23:27 GMT+02:00 Matching Socks :

> There is a hint, as to this, in the API doc of gen-class:
>
> https://clojure.github.io/clojure/clojure.core-api.html#
> clojure.core/gen-class
>

​That explains what happens, not why. ;-)

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


Why is the start function called -main

2017-09-06 Thread Cecil Westerhof
In C, C++ and Java the start function is called main. Why is it called
-main in Clojure?

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


Re: What am I doing wrong

2017-09-06 Thread Cecil Westerhof
2017-09-06 15:18 GMT+02:00 Cecil Westerhof :

> 2017-09-06 14:15 GMT+02:00 Gary Trakhman :
>
>> The second to last apply argument doesn't spread args like the last slot.
>>
>
> ​OK, I changed it to:
> (def digits
>  (apply str (map char (inclusive-range (int \0) (int \9)
> (def hex-digits
>  (str digits
>   (apply str (map char (inclusive-range (int \A) (int \F))
> (def alphanumerics
>  (str  digits
>(apply str (map char (inclusive-range (int \A) (int \Z
>(apply str (map char (inclusive-range (int \a) (int \z
>))
>
> That does what it should. I should probably create a function for the
> apply str …
>

​Done:
(defn string-from-range
  [start end]
  (apply str(map char (range (int start) (inc (int end))

(def digits
 (string-from-range \0 \9))
(def hex-digits
 (str digits
  (string-from-range \A \F)))
(def alphanumerics
 (str  digits
   (string-from-range \A \Z)
   (string-from-range \a \z)
   ))

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


Re: What am I doing wrong

2017-09-06 Thread Cecil Westerhof
2017-09-06 14:15 GMT+02:00 Gary Trakhman :

> The second to last apply argument doesn't spread args like the last slot.
>

​OK, I changed it to:
(def digits
 (apply str (map char (inclusive-range (int \0) (int \9)
(def hex-digits
 (str digits
  (apply str (map char (inclusive-range (int \A) (int \F))
(def alphanumerics
 (str  digits
   (apply str (map char (inclusive-range (int \A) (int \Z
   (apply str (map char (inclusive-range (int \a) (int \z
   ))

That does what it should. I should probably create a function for the apply
str …



> On Sep 6, 2017 8:11 AM, "Cecil Westerhof"  wrote:
>
> I have:
> (def digits
>  (apply str
> (map char (inclusive-range (int \0) (int \9)
>
> and this gives:
> "0123456789"
>
> I also have:
> (def hex-digits
>  (apply str
> digits
> (map char (inclusive-range (int \A) (int \F)
> and this gives:
> "0123456789ABCDEF"
>
> So far so good. Then I define:
> (def alphanumerics
>  (apply str
> digits
> (map char (inclusive-range (int \A) (int \Z)))
> (map char (inclusive-range (int \a) (int \z)))
> ))
>
> but this gives:
> "0123456789clojure.lang.LazySeq@4659426eabcdefghijklmnopqrstuvwxyz"
>
> Why does it not give:
> "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
>
> The definition of inclusive-range:
> (defn inclusive-range
>   ([start end] (inclusive-range start end 1))
>   ([start end step]
>   (range start (inc end) step)))
>
>
-- 
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.


What am I doing wrong

2017-09-06 Thread Cecil Westerhof
I have:
(def digits
 (apply str
(map char (inclusive-range (int \0) (int \9)

and this gives:
"0123456789"

I also have:
(def hex-digits
 (apply str
digits
(map char (inclusive-range (int \A) (int \F)
and this gives:
"0123456789ABCDEF"

So far so good. Then I define:
(def alphanumerics
 (apply str
digits
(map char (inclusive-range (int \A) (int \Z)))
(map char (inclusive-range (int \a) (int \z)))
))

but this gives:
"0123456789clojure.lang.LazySeq@4659426eabcdefghijklmnopqrstuvwxyz"

Why does it not give:
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

The definition of inclusive-range:
(defn inclusive-range
  ([start end] (inclusive-range start end 1))
  ([start end step]
      (range start (inc end) step)))


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


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
2017-09-06 12:44 GMT+02:00 Ray Miller :

> By the way does has clojure something like super? Using:
>
>> (defn create-pin-hex
>>   ([] (create-pin-hex 8))
>>
>> is asking for trouble. After copy/pasting from create-pin I almost forgot
>> to change it.
>>
>>
> If your base function takes chars as its first argument, you can use
> partial:
>
>  (defn create-pin-base
>   ([chars]
>
> ​​
> (create-pin chars 8))
>   ([chars n]
>{:pre [(<= 4 n 16)]}
>(apply str (repeatedly n #(rand-nth chars)
>
> (def create-pin (partial create-pin-base digits))
> (def create-pin-hex (partial create-pin-base hex-digits))
>

​Works great, thanks.
​

​By the way it shows why it is important. You had:​
​​(create-pin chars 8))
inste​ad of:
​(create-pin-base chars 8))

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


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
2017-09-06 9:58 GMT+02:00 Cecil Westerhof :

> I want to start using Clojure again. I made the following simple function
> to generate a PIN:
> (defn create-pin
>   ([] (create-pin 8))
>   ([n]
>(let [chars (map char (range (int \0) (inc (int \9]
> (reduce str (repeatedly n #(rand-nth chars))
>
> So far so good. But I want to improve a little.
>
> I think n should at least be four, but not greater as 16. What is the
> Clojure way to do this?
>
> The next step is that I want to use hexadecimal numbers. So I should use
> (range (int \0) (inc (int \9))) combined with (range (int \A) (inc (int
> \F))).
> How would I do that?
>
> Is there anything I should do differently?
>
> Of-course I make a general function that is then called from create-pin
> and create-pin-hex.
>

​With the help of this list I rewrote it to:
(def digits
 (apply str (map char (range (int \0) (inc (int \9))
(def hex-digits
 (apply str digits (map char (range (int \A) (inc (int \F))

(defn create-pin
  ([] (create-pin 8))
  ([n]
   {:pre [(<= n 16)
   (>= n 4)]}
   (reduce str (repeatedly n #(rand-nth digits)

(defn create-pin-hex
  ([] (create-pin-hex 8))
  ([n]
   {:pre [(<= n 16)
   (>= n 4)]}
   (reduce str (repeatedly n #(rand-nth hex-digits)

Indention is not great: I have to find out how to modify emacs for it.
​
By the way does has clojure something like super? Using:
(defn create-pin-hex
  ([] (create-pin-hex 8))

is asking for trouble. After copy/pasting from create-pin I almost forgot
to change it.

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


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
2017-09-06 11:00 GMT+02:00 Ray Miller :

> On 6 September 2017 at 09:50, Cecil Westerhof 
> wrote:
>
>>
>> ​I am trying the following throwaway code:
>> (defn create-pin
>>   ([] (create-pin 8))
>>   ([n]
>>{:pre [(<= n 128)
>>(>= n 4)]}
>>(let [chars (into [] (concat (range (int \0) (inc (int \9))) (range
>> (int \A) (inc (int \F)]
>> (println chars)
>> (reduce str (repeatedly n #(rand-nth chars))
>>
>> When calling:
>> (create-pin 100)
>>
>> I get:
>> [48 49 50 51 52 53 54 55 56 57 65 66 67 68 69 70]
>> "5153676752696854666551674951514949484851566570574951687
>> 067515570654868486554676769517069506651486970706567695467554
>> 866515465547068696955506968516770546849536866694853564951545
>> 266554857545648515454"
>> ​
>> ​So it looks like chars is filled correctly, but it only uses 0-9 and not
>> A-F. So what am I doing wrong?​
>>
>
> The variable you call "chars" is actually a vector of integers, so you are
> selecting random integers and joining them together into a string. You
> could try:
>
> (let [chars (mapv char (concat (range (int \0) (inc (int \9))) (range (int
> \A) (inc (int \F)]
>

​That does work.

​I should have looked more carefully, then I would have understand that it
was concatenating ​integers instead of chars.

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


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
2017-09-06 10:13 GMT+02:00 Cecil Westerhof :

> Answering my own question. ;-)
>
> 2017-09-06 9:58 GMT+02:00 Cecil Westerhof :
>
>> The next step is that I want to use hexadecimal numbers. So I should use
>> (range (int \0) (inc (int \9))) combined with (range (int \A) (inc (int
>> \F))).
>> How would I do that?
>>
>
> ​(concat (range (int \0) (inc (int \9))) (range (int \A) (inc (int
> \F
> ​
>
> ​By the way. I am using a lazy sequence here. Could it be updated with
> using a vector when creating very long strings, or is that not a
> significant performance increase?​
>

​I am trying the following throwaway code:
(defn create-pin
  ([] (create-pin 8))
  ([n]
   {:pre [(<= n 128)
   (>= n 4)]}
   (let [chars (into [] (concat (range (int \0) (inc (int \9))) (range (int
\A) (inc (int \F)]
(println chars)
(reduce str (repeatedly n #(rand-nth chars))

When calling:
(create-pin 100)

I get:
[48 49 50 51 52 53 54 55 56 57 65 66 67 68 69 70]
"5153676752696854666551674951514949484851566570574951687067515570654868486554676769517069506651486970706567695467554866515465547068696955506968516770546849536866694853564951545266554857545648515454"
​
​So it looks like chars is filled correctly, but it only uses 0-9 and not
A-F. So what am I doing wrong?​


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


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
2017-09-06 10:35 GMT+02:00 Mark Engelberg :

> You could do that by calling vec on it.  But you'd want to move the whole
> let clause outside of the defn, so it is only evaluated once, not every
> time the function is called.
>

​Wen the function is finished. ;-)
​



> But best, as I said earlier, is just to let chars be "0123456789ABCDEF".
> You can call nth on strings, so this is the most efficient way to do a
> fixed sequence of specific characters.
>

​The reason I use range is that in the future I am going to use long ranges
and I think then a range is better as a long string. But that is something
to think about.

On Wed, Sep 6, 2017 at 1:13 AM, Cecil Westerhof 
> wrote:
>
>> Answering my own question. ;-)
>>
>> 2017-09-06 9:58 GMT+02:00 Cecil Westerhof :
>>
>>> The next step is that I want to use hexadecimal numbers. So I should use
>>> (range (int \0) (inc (int \9))) combined with (range (int \A) (inc (int
>>> \F))).
>>> How would I do that?
>>>
>>
>> ​(concat (range (int \0) (inc (int \9))) (range (int \A) (inc (int
>> \F
>> ​
>>
>> ​By the way. I am using a lazy sequence here. Could it be updated with
>> using a vector when creating very long strings, or is that not a
>> significant performance increase?​
>>
>
-- 
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.


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
2017-09-06 10:23 GMT+02:00 Colin Yates :

>
> The only way of answering that is with numbers, and I understand
> https://github.com/hugoduncan/criterium/ is excellent for that.
>
> Personally, if I was asking that question I might also be wondering if
> using a mutable data structure might be worth it (https://clojure.org/
> reference/transients).
>

​I am going to look into that. (But first keep experimenting.)
​



> > ​By the way. I am using a lazy sequence here. Could it be updated with
> > using a vector when creating very long strings, or is that not a
> > significant performance increase?​


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


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
2017-09-06 10:13 GMT+02:00 dennis zhuang :

> 1.Maybe you can use :pre metadata:
>
> (defn create-pin
>   ([] (create-pin 8))
>   ([n]
>{:pre [(<= n 16)
>   (>= n 4)]}
>(let [chars (map char (range (int \0) (inc (int \9]
>  (reduce str (repeatedly n #(rand-nth chars))
>
> (create-pin 3)
> AssertionError Assert failed: (>= n 4)  user/create-pin (NO_SOURCE_FILE:27)
>
>
> and clojure.spec is great too.
>

​For the moment I will go for :pre, but I will also look into clojure.spec.

​


> 2. you can use concat
>
> (concat seq1 seq2)
>

​I should have wait a little longer with asking. I already found it. But
thanks anyway.
​

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


Re: Starting Clojure again

2017-09-06 Thread Cecil Westerhof
Answering my own question. ;-)

2017-09-06 9:58 GMT+02:00 Cecil Westerhof :

> The next step is that I want to use hexadecimal numbers. So I should use
> (range (int \0) (inc (int \9))) combined with (range (int \A) (inc (int
> \F))).
> How would I do that?
>

​(concat (range (int \0) (inc (int \9))) (range (int \A) (inc (int
\F
​

​By the way. I am using a lazy sequence here. Could it be updated with
using a vector when creating very long strings, or is that not a
significant performance increase?​

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


Starting Clojure again

2017-09-06 Thread Cecil Westerhof
I want to start using Clojure again. I made the following simple function
to generate a PIN:
(defn create-pin
  ([] (create-pin 8))
  ([n]
   (let [chars (map char (range (int \0) (inc (int \9]
(reduce str (repeatedly n #(rand-nth chars))

So far so good. But I want to improve a little.

I think n should at least be four, but not greater as 16. What is the
Clojure way to do this?

The next step is that I want to use hexadecimal numbers. So I should use
(range (int \0) (inc (int \9))) combined with (range (int \A) (inc (int
\F))).
How would I do that?

Is there anything I should do differently?

Of-course I make a general function that is then called from create-pin and
create-pin-hex.

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


Re: Writing an Android application with Clojure

2017-09-05 Thread Cecil Westerhof
2017-09-03 20:23 GMT+02:00 Didier :

> Kotlin is actually officialy supported on Android, so definitly a good
> choice there.


​I started with Kotlin. I think I first learn to write some applications
for Android and then decide if I want to switch to Clojure(Script).

​


> That said, if you know Java, C#, C++, Pascal, or even ActionScript 3,
> Kotlin brings nothing new to the table conceptually. It does improve on
> convenience over Java though.


​I know Java and C++. A long time ago I worked with Pascal.

What I like about Kotlin is that it is less verbose. And Clojure is
of-course even less verbose. :-D

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


Re: Writing an Android application with Clojure

2017-09-03 Thread Cecil Westerhof
2017-09-02 23:55 GMT+02:00 Didier :

> Well, in the last 2 years I think React Native has grown quite a bit. I
> think if you target Android only, and you need performance, like a game,
> going with Java/C is best, or just Unity.
>

​Another possibility would be Kotlin. I was first thinking about that, but
then I thought that I could use Clojure to get experience with it again.
​



> But ClojureScript with ReactNative is great for iOS + Android
> compatibility for more normal apps.
>

​I have to evaluate it then​



On Saturday, 2 September 2017 00:59:36 UTC-7, Cecil Westerhof wrote:
>
> 2017-08-31 14:46 GMT+02:00 Luke Gessler :
>
>> Check out cljsrn <http://cljsrn.org/>.
>>
>
> ​Thanks, but from https://www.youtube.com/watch?v=mVXTcAEKgF8 I
> understood it is better to go native.​
>
>
>
>
>> On Thursday, August 31, 2017 at 5:45:08 AM UTC-5, Cecil Westerhof wrote:
>>>
>>> It has been a while that I worked with Clojure and I want to pick it up
>>> again. I also want to pick up Android programming. (That is new for me.) I
>>> am thinking about doing those together. Would that be doable?
>>> Also is writing Android applications with Clojure still viable? Because
>>> the Clojure-Android mailing-list is very silent.
>>>
>>
-- 
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.


Re: Writing an Android application with Clojure

2017-09-02 Thread Cecil Westerhof
2017-08-31 14:46 GMT+02:00 Luke Gessler :

> Check out cljsrn <http://cljsrn.org/>.
>

​Thanks, but from https://www.youtube.com/watch?v=mVXTcAEKgF8 I understood
it is better to go native.​




> On Thursday, August 31, 2017 at 5:45:08 AM UTC-5, Cecil Westerhof wrote:
>>
>> It has been a while that I worked with Clojure and I want to pick it up
>> again. I also want to pick up Android programming. (That is new for me.) I
>> am thinking about doing those together. Would that be doable?
>> Also is writing Android applications with Clojure still viable? Because
>> the Clojure-Android mailing-list is very silent.
>>
>
-- 
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.


Writing an Android application with Clojure

2017-08-31 Thread Cecil Westerhof
It has been a while that I worked with Clojure and I want to pick it up
again. I also want to pick up Android programming. (That is new for me.) I
am thinking about doing those together. Would that be doable?
Also is writing Android applications with Clojure still viable? Because the
Clojure-Android mailing-list is very silent.

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


Re: Did something change in future

2017-08-19 Thread Cecil Westerhof
2017-08-20 1:57 GMT+02:00 Sean Corfield :

> And, yes, definitely, you should pick up Clojure again!!
>

​:-D

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


Re: Did something change in future

2017-08-19 Thread Cecil Westerhof
2017-08-20 1:54 GMT+02:00 Sean Corfield :

> I’d hazard a guess that something inside the future --- perhaps the
> search-quotes function call? – is throwing an exception and that’s just
> being “swallowed” because it’s in another thread.
>
>
>
> As a general rule of thumb to debug any issues with futures, replace
> future with identity and see what the code does. My guess is you’ll see an
> exception.
>

​That was the problem. A new H2 server was installed (that was what made
the edit necessary), but the old client was still used. I changed my
project.clj and it works again.

I do get:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

But I think I always got that, but never saw. Something to look after.
​


> *From: *Cecil Westerhof 
> *Sent: *Saturday, August 19, 2017 2:38 PM
> *To: *clojure@googlegroups.com
> *Subject: *Did something change in future
>
>
>
> Quit some time ago I wrote a Clojure program. In it I used future to
> display a swing window like:
> (defn show-search-quotes
>   [search-str]
>   (debug-info "show-search-quotes enter")
>   (future
>(info-table (format "Search Quotes (Case Independent): %s"
> search-str)
>'(:quote "Quote" :author "Author")
>(search-quotes {:search_string search-str}
>
> I added the debug-info to be sure that this function is executed. I see
> that, so this function is called.
>
> The function info-table begins with:
> (defn info-table
>   [title headers records]
>   {:pre [(even? (count headers))]}
>   (debug-info "info-table enter")(
>
> But this debug info is not shown. So info-table is never called, while in
> the past it was. What do I need to change to let the application work again?
>
> My current version is 1.8, but sadly I do not know what the original
> version was.
>
>
>
> And I should pick-up Clojure again also. ;-)
>

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


Did something change in future

2017-08-19 Thread Cecil Westerhof
Quit some time ago I wrote a Clojure program. In it I used future to
display a swing window like:
(defn show-search-quotes
  [search-str]
  (debug-info "show-search-quotes enter")
  (future
   (info-table (format "Search Quotes (Case Independent): %s"
search-str)
   '(:quote "Quote" :author "Author")
   (search-quotes {:search_string search-str}

I added the debug-info to be sure that this function is executed. I see
that, so this function is called.

The function info-table begins with:
(defn info-table
  [title headers records]
  {:pre [(even? (count headers))]}
  (debug-info "info-table enter")(

But this debug info is not shown. So info-table is never called, while in
the past it was. What do I need to change to let the application work again?

My current version is 1.8, but sadly I do not know what the original
version was.


And I should pick-up Clojure again also. ;-)

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


Re: Writing (firstly) simple application for Android with Clojure

2017-03-13 Thread Cecil Westerhof
2017-03-13 10:58 GMT+01:00 Nando Breiter :

> No need to buy iDevices (or a bunch of Android devices from various
> manufacturers). The idea is to use emulators to run your app and test it.
> For instance here is a service from Sauce Labs: https://testobject.com/
> features#manual.
>

​I always understood that those kind of things where only for initial
testing, but that when you wanted to be really sure you needed real
hardware. But I will cross the bridge when I get there. :-D
​
-- 
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.


Re: Writing (firstly) simple application for Android with Clojure

2017-03-12 Thread Cecil Westerhof
2017-03-12 22:32 GMT+01:00 Nando Breiter :

> Seems like the right list to me - at least good enough ... here's a few
> videos from Jordan Leigh, the second one lays out the case for using React
> Native, the first is a walkthrough of building a React Native app from
> scratch.
>
> https://www.youtube.com/watch?v=r5OPRhelEIU
> https://www.youtube.com/watch?v=CAc_PAbJkVU
>
> Jordan doesn't see the value in using ClojureScript for a React Native
> app, but that's simply because to him, they are generally very simple apps.
> But I think it is worthwhile to view these 2 videos to get a sense of the
> React Native landscape.
>

​The first is a bit long, so that I saved for when I have a bit of time.
The second one is certainly interesting: I could easily develop for iOS at
the same time as I develop for Android. The only ‘problem’ is that I should
buy an iPhone​
 ​and an iPad. ;-)

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


Re: Writing (firstly) simple application for Android with Clojure

2017-03-12 Thread Cecil Westerhof
2017-03-12 22:32 GMT+01:00 Nando Breiter :

> Seems like the right list to me - at least good enough ...
>

​Well there is: clojure-andr...@googlegroups.com. And I did mean to post it
there. But luckily no harm done. :-D

​


> here's a few videos from Jordan Leigh, the second one lays out the case
> for using React Native, the first is a walkthrough of building a React
> Native app from scratch.
>
> https://www.youtube.com/watch?v=r5OPRhelEIU
> https://www.youtube.com/watch?v=CAc_PAbJkVU
>

​I will look into those also. Thanks again.
​



> Jordan doesn't see the value in using ClojureScript for a React Native
> app, but that's simply because to him, they are generally very simple apps.
> But I think it is worthwhile to view these 2 videos to get a sense of the
> React Native landscape.
>



> Oops, wrong mailing-list. :'-(
>> Thanks for replying anyway. :-D
>> I am going to evaluate you suggestions.
>>
>
-- 
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.


Re: Writing (firstly) simple application for Android with Clojure

2017-03-12 Thread Cecil Westerhof
Oops, wrong mailing-list. :'-(
Thanks for replying anyway. :-D
I am going to evaluate you suggestions.

2017-03-12 20:38 GMT+01:00 Nando Breiter :

> I'd suggest that React Native is an easier pathway. Take a look here as a
> starting point: http://cljsrn.org/
>
> Note also that re-frame can be used to build native apps via React Native.
>
> https://github.com/mjmeintjes/cljs-react-native-tictactoe
> https://github.com/Day8/re-frame/
>
> For me, a big plus with re-frame is the excellent documentation.
>
>
>
> Aria Media Sagl
> +41 (0)76 303 4477 <+41%2076%20303%2044%2077> cell
> skype: ariamedia
>
> On Sun, Mar 12, 2017 at 7:52 PM, Cecil Westerhof 
> wrote:
>
>> I have little experience with Clojure and none with Android programming.
>> Is it feasible to use Clojure to write applications for Android? Or is it
>> better to start programming in Java and when I have some experience with
>> Android applications to switch to Clojure?
>>
>> --
>> 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.
>>
>
> --
> 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.
>



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


Writing (firstly) simple application for Android with Clojure

2017-03-12 Thread Cecil Westerhof
I have little experience with Clojure and none with Android programming. Is
it feasible to use Clojure to write applications for Android? Or is it
better to start programming in Java and when I have some experience with
Android applications to switch to Clojure?

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


Re: Source Code for Stuart Halloway's ETL Talk

2017-03-10 Thread Cecil Westerhof
2017-03-11 4:00 GMT+01:00 Alex Miller :

> Sorry, I don't have any control over the page - that's the publisher.
>

​I hope they read this list. ;-)
​

​I have a busy weekend. I'll give them a heads-up after the weekend.

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


Re: Source Code for Stuart Halloway's ETL Talk

2017-03-10 Thread Cecil Westerhof
2017-03-10 23:27 GMT+01:00 Alex Miller :

> Hey, the page just appeared today actually... it's alive!
>
> https://pragprog.com/book/shcloj3/programming-clojure
>

​I have default JavaScript disabled. Luckily for pragprog.com I only need
to activate one domain. (There are sites that want you to activate a lot
more. Those I do not use anymore.)
But it directs you to the page ‘no_js’, so a refresh after activating
JavaScript does not work. Personally I find this a design flaw.
If you really want another page, you could include the link to the original
page.

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


Re: Trying to make an uberjar

2017-03-04 Thread Cecil Westerhof
2017-03-04 21:15 GMT+01:00 Jeaye :

> > > > ​That was what was needed. Thanks.
> > > >
> > > > And I could remove the added:
> > > > :profiles {
> > > > :uberjar {:aot :all}
> > > >   }
> > >
> > > For the best performance, you likely want AOT (ahead-of-time)
> compilation.
> > > In general, I'd recommend keeping that uberjar profile with `{:aot
> :all}`.
> > >
> >
> > ​That is why it is smart to communicate small non essential changes:
> people
> > can set you on the right track. :-)
> >
> > I put that back. I now removed the ‘:aot [quotes.core]’, or should I keep
> > that also?
>
> There's no need for `:aot [quotes.core]` if you're using `:aot :all` in
> your uberjar profile. The only other reason you'd want it is to AOT that
> namespace outside of the uberjar profile. That's up to you, but typically
> not a concern.
>

​Thank you. I thought so, but it is better to be sure.

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


Re: Trying to make an uberjar

2017-03-04 Thread Cecil Westerhof
2017-03-04 8:13 GMT+01:00 Jeaye :

> On Sat, Mar 04, 2017 at 08:09:39AM +0100, Cecil Westerhof wrote:
> > 2017-03-04 7:44 GMT+01:00 Jeaye :
> >
> > > Cecil,
> > >
> > > > But when running:
> > > > lein uberjar
> > > > I still get:
> > > > This code is executed when starting Clojure.
> > > > Compiling quotes.core
> > > > Warning: The Main-Class specified does not exist within the jar. It
> may
> > > not
> > > > be executable as expected. A gen-class directive may be missing in
> the
> > > > namespace which contains the main method, or the namespace has not
> been
> > > > AOT-compiled.
> > > > Created /home/cecil/Clojure/Quotes/target/quotes-0.0.1.jar
> > > > Created /home/cecil/Clojure/Quotes/target/quotes-0.0.1-
> standalone.jar
> > > >
> > > > What do I need to change to make an uberjar. (Jars are generated, but
> > > > cannot be used.)
> > >
> > > The warning which lein provided is trying to tell you exactly what you
> > > need to do. In the `ns` form of your quotes.core namespace, you should
> add
> > > a (:gen-class). Example:
> > >
> > > ```clojure
> > > (ns quotes.core
> > >   (:gen-class))
> > > ```
> > >
> >
> > ​That was what was needed. Thanks.
> >
> > And I could remove the added:
> > :profiles {
> > :uberjar {:aot :all}
> >   }
>
> For the best performance, you likely want AOT (ahead-of-time) compilation.
> In general, I'd recommend keeping that uberjar profile with `{:aot :all}`.
>

​That is why it is smart to communicate small non essential changes: people
can set you on the right track. :-)

I put that back. I now removed the ‘:aot [quotes.core]’, or should I keep
that also?

When I first got the error I found two different pieces of advice. One for
both changes. When those did not work I asked here.


I should pick up Clojure again. I only did one little project (long ago) to
try it out. But that is no way to learn a language. Sadly there is no real
use here for it. :'-(

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


Re: Trying to make an uberjar

2017-03-03 Thread Cecil Westerhof
2017-03-04 7:44 GMT+01:00 Jeaye :

> Cecil,
>
> > But when running:
> > lein uberjar
> > I still get:
> > This code is executed when starting Clojure.
> > Compiling quotes.core
> > Warning: The Main-Class specified does not exist within the jar. It may
> not
> > be executable as expected. A gen-class directive may be missing in the
> > namespace which contains the main method, or the namespace has not been
> > AOT-compiled.
> > Created /home/cecil/Clojure/Quotes/target/quotes-0.0.1.jar
> > Created /home/cecil/Clojure/Quotes/target/quotes-0.0.1-standalone.jar
> >
> > What do I need to change to make an uberjar. (Jars are generated, but
> > cannot be used.)
>
> The warning which lein provided is trying to tell you exactly what you
> need to do. In the `ns` form of your quotes.core namespace, you should add
> a (:gen-class). Example:
>
> ```clojure
> (ns quotes.core
>   (:gen-class))
> ```
>

​That was what was needed. Thanks.

And I could remove the added:
:profiles {
:uberjar {:aot :all}
  }

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


Trying to make an uberjar

2017-03-03 Thread Cecil Westerhof
Until now I can run my project without a problem with:
lein trampoline run &

But I was told that I should use an uberjar.

My project.clj was:
(defproject quotes "0.0.1"
  :description "Initial quotes application"
  :url "http://example.com/FIXME";
  :dependencies [[org.clojure/clojure"1.8.0"]
 [clj-time   "0.12.0"]
 [com.h2database/h2  "1.3.176"]
 [instaparse "1.4.2"]
 [org.clojure/math.numeric-tower "0.0.4"]
 [seesaw "1.4.5"]
 [yesql  "0.5.3"]]
  :main quotes.core
  :jvm-opts ["-Xmx320m"]
)

That did not work. So I changed it to:
(defproject quotes "0.0.1"
  :description "Initial quotes application"
  :url "http://example.com/FIXME";
  :dependencies [[org.clojure/clojure"1.8.0"]
 [clj-time   "0.12.0"]
 [com.h2database/h2  "1.3.176"]
 [instaparse "1.4.2"]
 [org.clojure/math.numeric-tower "0.0.4"]
 [seesaw "1.4.5"]
 [yesql  "0.5.3"]]
  :main quotes.core
  :aot [quotes.core]
  :profiles {
:uberjar {:aot :all}
  }
  :jvm-opts ["-Xmx320m"]
)

But when running:
lein uberjar
I still get:
This code is executed when starting Clojure.
Compiling quotes.core
Warning: The Main-Class specified does not exist within the jar. It may not
be executable as expected. A gen-class directive may be missing in the
namespace which contains the main method, or the namespace has not been
AOT-compiled.
Created /home/cecil/Clojure/Quotes/target/quotes-0.0.1.jar
Created /home/cecil/Clojure/Quotes/target/quotes-0.0.1-standalone.jar

What do I need to change to make an uberjar. (Jars are generated, but
cannot be used.)

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


Re: Prgram uses a lot of swap

2017-03-01 Thread Cecil Westerhof
2017-02-26 21:06 GMT+01:00 Thomas Heller :

> To control the memory you can add :jvm-opts ["-Xmx512m"] to your
> project.clj. It will set the max memory of the JVM to 512mb which should be
> enough for your program.
>

​With the help of /proc//status I found out that it can be less. At
the moment it is 320 MB, but it can be probably be even less. But I let it
first run for at least a week to see if it is going to use swap.

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


Re: Prgram uses a lot of swap

2017-02-27 Thread Cecil Westerhof
2017-02-26 21:06 GMT+01:00 Thomas Heller :

> Ideally you would run your program without lein, probably as an uberjar.
>

​Going to look at that in the near future.
​



> But if you insist on lein you can do "lein trampoline run -m your.main/fn"
> which will allow the lein process to exit after setting up your program
> leaving you with only one JVM.
>

​Have this working now.
​



> To control the memory you can add :jvm-opts ["-Xmx512m"] to your
> project.clj. It will set the max memory of the JVM to 512mb which should be
> enough for your program.
>

​What is the best way to determine the right value for this? I remember
that in the past I had a lot of little Java​

​programs running and got a much better performance by limiting memory
usage.

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


Re: Prgram uses a lot of swap

2017-02-27 Thread Cecil Westerhof
2017-02-27 14:37 GMT+01:00 Thomas Heller :

> Last thing I can come up with is your environment variables or something
> in your ~/.lein/* folder. Beyond that I'm out of ideas.
>

​That was the problem. In .lein I had profiles.clj, which contained:
{
:repl {
:dependencies [
^:displace [org.clojure/clojure "LATEST"]
]
}
:user {
:jvm-opts ^:replace ["-Xmx4096M"]
:plugins [[lein-ancient "0.6.10"]]
}
}

I removed the :jvm-opts and problem solved.

Because it was in .lein it was not found with the grep.

And in the project.clj I removed the ^:replace.


By the way why is the value of profiles.clj taken instead of project.clj? I
would expect that the profiles.clj value only would be used when there is
no value in project.clj.

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


Re: Prgram uses a lot of swap

2017-02-27 Thread Cecil Westerhof
2017-02-27 13:57 GMT+01:00 Cecil Westerhof :

> Maybe you have some other conflicting configuration somewhere that sets it
>> explicitly to 4G? Usually no maximum is set and the JVM will automatically
>> adjust it based on your system.
>>
>
> ​Not that I know of, but I will try to find it out.
>

​In the Clojure directory I gave:
grep -r -- '-Xmx' *

And this only gave:
data.int-map/project.clj:  :jvm-opts ^:replace ["-server" "-Xmx1g"]
Quotes/project.clj:  :jvm-opts ^:replace ["-Xmx512m"]
​

​So I would say it is not set. (But in a way it is.)

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


Re: Prgram uses a lot of swap

2017-02-27 Thread Cecil Westerhof
2017-02-27 7:59 GMT+01:00 Thomas Heller :

> Maybe you are running an old version of leiningen?
>

​Yes, I installed it a long time ago. It was 2.6.1. I updated it to 2.7.1
​



> This might work although JVM_OPTS works fine for me as well
>
> :jvm-opts ^:replace ["-Xmx512m"]
>

​My project.clj:
(defproject quotes "0.0.1"
  :description "Initial quotes application"
  :url "http://example.com/FIXME";
  :dependencies [[org.clojure/clojure"1.8.0"]
 [clj-time   "0.12.0"]
 [com.h2database/h2  "1.3.176"]
 [instaparse "1.4.2"]
 [org.clojure/math.numeric-tower "0.0.4"]
 [seesaw "1.4.5"]
 [yesql  "0.5.3"]]
  :main quotes.core
  :jvm-opts ^:replace ["-Xmx512m"]
)

(I also tried without ^:replace.)

But I keep having: -Xmx4096M.

Is there something wrong with my project.clj?​


Maybe you have some other conflicting configuration somewhere that sets it
> explicitly to 4G? Usually no maximum is set and the JVM will automatically
> adjust it based on your system.
>

​Not that I know of, but I will try to find it out.



> On Sunday, February 26, 2017 at 10:14:22 PM UTC+1, Cecil Westerhof wrote:
>>
>> 2017-02-26 21:59 GMT+01:00 Cecil Westerhof :
>>
>>> To control the memory you can add :jvm-opts ["-Xmx512m"] to your
>>>> project.clj. It will set the max memory of the JVM to 512mb which should be
>>>> enough for your program.
>>>>
>>>
>>> ​Did not work either, but at the moment I use:
>>> export JVM_OPTS=-Xmx512m
>>>
>>> For the moment that does the trick.
>>>
>>
>> ​No it does not. :'-( When looking to the commandline parameters I see:
>> -Xmx512m-Xmx4096M
>>
>> I need to invest some time.
>>
>
-- 
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.


Re: Prgram uses a lot of swap

2017-02-26 Thread Cecil Westerhof
2017-02-26 21:59 GMT+01:00 Cecil Westerhof :

> To control the memory you can add :jvm-opts ["-Xmx512m"] to your
>> project.clj. It will set the max memory of the JVM to 512mb which should be
>> enough for your program.
>>
>
> ​Did not work either, but at the moment I use:
> export JVM_OPTS=-Xmx512m
>
> For the moment that does the trick.
>

​No it does not. :'-( When looking to the commandline parameters I see:
    -Xmx512m-Xmx4096M

I need to invest some time.

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


Re: Prgram uses a lot of swap

2017-02-26 Thread Cecil Westerhof
2017-02-26 21:06 GMT+01:00 Thomas Heller :

> Ideally you would run your program without lein, probably as an uberjar.
>

​I have to dive into that. A good excuse to start with Clojure again. ;-)
​



> But if you insist on lein you can do "lein trampoline run -m your.main/fn"
> which will allow the lein process to exit after setting up your program
> leaving you with only one JVM.
>

​I do not insist on it, but that is what I know right now. I have to find
out how to do this also, because it did not work at the moment.

​

> To control the memory you can add :jvm-opts ["-Xmx512m"] to your
> project.clj. It will set the max memory of the JVM to 512mb which should be
> enough for your program.
>

​Did not work either, but at the moment I use:
export JVM_OPTS=-Xmx512m

For the moment that does the trick.


Need to free some time to dive in these things.

​


> On Saturday, February 25, 2017 at 11:41:03 AM UTC+1, Cecil Westerhof wrote:
>
>> 2017-02-24 15:07 GMT+01:00 Timothy Baldridge :
>>
>>> What are the JVM memory settings set at? And how much physical memory
>>> does the box have?
>>>
>>
>> ​My system has 16 GB of memory.
>>
>> I use ‘lein  run’ and this results in the following process:
>> java-Xbootclasspath/a:/home/cecil/.lein/self-installs/leinin
>> gen-2.6.1-standalone.jar-Dfile.encoding=UTF-8-Dmaven.
>> wagon.http.ssl.easy=false-Dmaven.wagon.rto=1-XX:+
>> TieredCompilation-XX:TieredStopAtLevel=1-Dleiningen.
>> original.pwd=/home/cecil/Clojure/Quotes-Dleiningen.
>> script=/home/cecil/bin/lein-classpath.:/home/cecil/scala:/
>> var/lib/h2/jars/h2-current.jar:/home/cecil/Java/jars/
>> sqlite-jdbc.jar:/home/cecil/Java/jars/javax.mail.jar:/
>> home/cecil/Java/qtjambi-linux64-4.7.4-beta-4/qtjambi-
>> 4.7.4-beta-4.jar:/home/cecil/Java/qtjambi-linux64-4.7.4-
>> beta-4/qtjambi-examples-4.7.4-beta-4.jar:/home/cecil/Java/
>> qtjambi-linux64-4.7.4-beta-4/qtjambi-native-linux64-gcc-4.
>> 7.4-beta-4:/home/cecil/Java/ghost4j/ghost4j-0.5.0.jar:/
>> home/cecil/.lein/self-installs/leiningen-2.6.1-
>> standalone.jarclojure.main-mleiningen.core.mainrun
>>
>> The program itself is:
>> java-classpath/home/cecil/Clojure/Quotes/test:/home/cecil/
>> Clojure/Quotes/src:/home/cecil/Clojure/Quotes/dev-resou
>> rces:/home/cecil/Clojure/Quotes/resources:/home/cecil/Clojur
>> e/Quotes/target/classes:/home/cecil/.m2/repository/org/
>> clojure/clojure/1.8.0/clojure-1.8.0.jar:/home/cecil/.m2/
>> repository/com/miglayout/miglayout/3.7.4/miglayout-3.7.4.
>> jar:/home/cecil/.m2/repository/org/clojure/tools.nrepl/0.2.
>> 12/tools.nrepl-0.2.12.jar:/home/cecil/.m2/repository/
>> clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.jar:/home/
>> cecil/.m2/repository/org/clojure/java.jdbc/0.5.8/java.jdbc-
>> 0.5.8.jar:/home/cecil/.m2/repository/org/clojure/math.
>> numeric-tower/0.0.4/math.numeric-tower-0.0.4.jar:/home/cecil
>> /.m2/repository/com/fifesoft/rsyntaxtextarea/2.5.6/
>> rsyntaxtextarea-2.5.6.jar:/home/cecil/.m2/repository/org/swi
>> nglabs/swingx/swingx-autocomplete/1.6.3/swingx-autocomplete-
>> 1.6.3.jar:/home/cecil/.m2/repository/j18n/j18n/1.0.2/
>> j18n-1.0.2.jar:/home/cecil/.m2/repository/clj-time/clj-
>> time/0.12.0/clj-time-0.12.0.jar:/home/cecil/.m2/repository
>> /org/swinglabs/swingx/swingx-plaf/1.6.3/swingx-plaf-1.6.3.
>> jar:/home/cecil/.m2/repository/org/swinglabs/
>> swingx/swingx-painters/1.6.3/swingx-painters-1.6.3.jar:/
>> home/cecil/.m2/repository/com/jgoodies/forms/1.2.1/forms-1.2
>> .1.jar:/home/cecil/.m2/repository/joda-time/joda-time/2.9.3/
>> joda-time-2.9.3.jar:/home/cecil/.m2/repository/com/
>> h2database/h2/1.3.176/h2-1.3.176.jar:/home/cecil/.m2/
>> repository/seesaw/seesaw/1.4.5/seesaw-1.4.5.jar:/home/
>> cecil/.m2/repository/org/swinglabs/swingx/swingx-common
>> /1.6.3/swingx-common-1.6.3.jar:/home/cecil/.m2/repository
>> /org/swinglabs/swingx/swingx-core/1.6.3/swingx-core-1.6.3.
>> jar:/home/cecil/.m2/repository/instaparse/instaparse/1.4.2/instaparse-1.
>> 4.2.jar:/home/cecil/.m2/repository/org/swinglabs/
>> swingx/swingx-action/1.6.3/swingx-action-1.6.3.jar:/home/
>> cecil/.m2/repository/yesql/yesql/0.5.3/yesql-0.5.3.jar-
>> Dfile.encoding=UTF-8-Xmx4096M-Dclojure.compile.path=/home/ce
>> cil/Clojure/Quotes/target/classes-Dquotes.version=0.0.1-Dclo
>> jure.debug=falseclojure.main-i/tmp/form-init417092364626579473.clj
>>
>> ​So maximum memory is set to 4 GB. That could probably be a lot less.​
>> Where can I change that?
>> And can I set the maximum memory for lein?
>>
>

-- 
Cecil Westerhof

-- 
You received this

Re: Prgram uses a lot of swap

2017-02-25 Thread Cecil Westerhof
2017-02-24 15:07 GMT+01:00 Timothy Baldridge :

> What are the JVM memory settings set at? And how much physical memory does
> the box have?
>

​My system has 16 GB of memory.

I use ‘lein  run’ and this results in the following process:

java-Xbootclasspath/a:/home/cecil/.lein/self-installs/leiningen-2.6.1-standalone.jar-Dfile.encoding=UTF-8-Dmaven.wagon.http.ssl.easy=false-Dmaven.wagon.rto=1-XX:+TieredCompilation-XX:TieredStopAtLevel=1-Dleiningen.original.pwd=/home/cecil/Clojure/Quotes-Dleiningen.script=/home/cecil/bin/lein-classpath.:/home/cecil/scala:/var/lib/h2/jars/h2-current.jar:/home/cecil/Java/jars/sqlite-jdbc.jar:/home/cecil/Java/jars/javax.mail.jar:/home/cecil/Java/qtjambi-linux64-4.7.4-beta-4/qtjambi-4.7.4-beta-4.jar:/home/cecil/Java/qtjambi-linux64-4.7.4-beta-4/qtjambi-examples-4.7.4-beta-4.jar:/home/cecil/Java/qtjambi-linux64-4.7.4-beta-4/qtjambi-native-linux64-gcc-4.7.4-beta-4:/home/cecil/Java/ghost4j/ghost4j-0.5.0.jar:/home/cecil/.lein/self-installs/leiningen-2.6.1-standalone.jarclojure.main-mleiningen.core.mainrun

The program itself is:

java-classpath/home/cecil/Clojure/Quotes/test:/home/cecil/Clojure/Quotes/src:/home/cecil/Clojure/Quotes/dev-resources:/home/cecil/Clojure/Quotes/resources:/home/cecil/Clojure/Quotes/target/classes:/home/cecil/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar:/home/cecil/.m2/repository/com/miglayout/miglayout/3.7.4/miglayout-3.7.4.jar:/home/cecil/.m2/repository/org/clojure/tools.nrepl/0.2.12/tools.nrepl-0.2.12.jar:/home/cecil/.m2/repository/clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.jar:/home/cecil/.m2/repository/org/clojure/java.jdbc/0.5.8/java.jdbc-0.5.8.jar:/home/cecil/.m2/repository/org/clojure/math.numeric-tower/0.0.4/math.numeric-tower-0.0.4.jar:/home/cecil/.m2/repository/com/fifesoft/rsyntaxtextarea/2.5.6/rsyntaxtextarea-2.5.6.jar:/home/cecil/.m2/repository/org/swinglabs/swingx/swingx-autocomplete/1.6.3/swingx-autocomplete-1.6.3.jar:/home/cecil/.m2/repository/j18n/j18n/1.0.2/j18n-1.0.2.jar:/home/cecil/.m2/repository/clj-time/clj-time/0.12.0/clj-time-0.12.0.jar:/home/cecil/.m2/repository/org/swinglabs/swingx/swingx-plaf/1.6.3/swingx-plaf-1.6.3.jar:/home/cecil/.m2/repository/org/swinglabs/swingx/swingx-painters/1.6.3/swingx-painters-1.6.3.jar:/home/cecil/.m2/repository/com/jgoodies/forms/1.2.1/forms-1.2.1.jar:/home/cecil/.m2/repository/joda-time/joda-time/2.9.3/joda-time-2.9.3.jar:/home/cecil/.m2/repository/com/h2database/h2/1.3.176/h2-1.3.176.jar:/home/cecil/.m2/repository/seesaw/seesaw/1.4.5/seesaw-1.4.5.jar:/home/cecil/.m2/repository/org/swinglabs/swingx/swingx-common/1.6.3/swingx-common-1.6.3.jar:/home/cecil/.m2/repository/org/swinglabs/swingx/swingx-core/1.6.3/swingx-core-1.6.3.jar:/home/cecil/.m2/repository/instaparse/instaparse/1.4.2/instaparse-1.4.2.jar:/home/cecil/.m2/repository/org/swinglabs/swingx/swingx-action/1.6.3/swingx-action-1.6.3.jar:/home/cecil/.m2/repository/yesql/yesql/0.5.3/yesql-0.5.3.jar-Dfile.encoding=UTF-8-Xmx4096M-Dclojure.compile.path=/home/cecil/Clojure/Quotes/target/classes-Dquotes.version=0.0.1-Dclojure.debug=falseclojure.main-i/tmp/form-init417092364626579473.clj

​So maximum memory is set to 4 GB. That could probably be a lot less.​
Where can I change that?
And can I set the maximum memory for lein?


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


Prgram uses a lot of swap

2017-02-24 Thread Cecil Westerhof
Some time ago a wrote a simple program. It uses the H2 database and seesaw.
It mostly sits idle, but from time to time I use it to fetch info from the
database.
I start it with:
lein run

It uses up quite a bit of swap. It is now running for a little longer as a
week. The lein run process uses 107 MB of swap. And my own program uses 135
MB of swap. I find this a ‘bit’ excessive.

What could be the problem? I am using openSUSE and leiningen 2.6.1.

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


Re: Setting the font size

2016-10-06 Thread Cecil Westerhof
2016-10-06 14:33 GMT+02:00 Sanel Zukan :
> Cecil Westerhof  writes:
>> I saw that I already had:
>> (use 'seesaw.core)
>> and called:
>> (invoke-later
>>
>> So I changed your call also into (invoke-later. Is this OK, or is
>> there a reason to do it your way?
>
> That is fine. It is more idiomatic to use 'require' to avoid namespace
> conflicts, as explained on 
> http://stackoverflow.com/questions/871997/difference-between-use-and-require.

OK, it was a little work, but I use the require variant now. I have:
(ns quotes.core
(:require
 [clj-time.local:asl]
 [clojure.java.jdbc :asjdbc]
 [clojure.pprint:refer [pprint print-table]]
 [clojure.string:refer [lower-case]]
 [seesaw.core   :asseesaw]
 [yesql.core:refer [defquery defqueries]]
 ))

(import '(javax.swing JButton JCheckBox JDialog JFrame JLabel JOptionPane JPanel
  JTextField UIManager plaf.FontUIResource)
    '(java.awtFont GridBagLayout GridBagConstraints))

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


Re: Setting the font size

2016-10-06 Thread Cecil Westerhof
2016-10-06 12:08 GMT+02:00 Sanel Zukan :
> Cecil Westerhof  writes:
>> Two points:
>> When using:
>> (seesaw/invoke-later
>> I get:
>> Exception in thread "main" java.lang.RuntimeException: No such
>> namespace: seesaw
>>
>> What do I need to do to get rid of this?
>
>  (require '[seesaw.core :as seesaw])

I saw that I already had:
(use 'seesaw.core)
and called:
(invoke-later

So I changed your call also into (invoke-later. Is this OK, or is
there a reason to do it your way?


> No; this is OS specific and the only safe option is to manually draw
> frame titlebar and borders, handling all mouse/keyboard/DnD events by
> yourself.
>
> Other option is to go with frameworks that has this feature, like WebLaF
> (http://weblookandfeel.com/).

Well, for the moment I accept it then.

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


Re: Setting the font size

2016-10-06 Thread Cecil Westerhof
2016-10-05 13:22 GMT+02:00 Sanel Zukan :
> Setting fonts under Seesaw isn't the most intuitive option, so you'd
> have to dig into Swing core for this and investigate
> java.swing.UIManager documentation.
>
> Here is a function that I often use in my applications:
>
> (defn set-font
>   "Set default font for the whole Swing application. Make sure
> to call it before UI was shown."
>   [name size]
>   (let [res  (FontUIResource. name Font/PLAIN size)
> what ["Button.font" "ToggleButton.font"
>   "RadioButton.font" "CheckBox.font"
>   "ColorChooser.font" "ComboBox.font"
>   "Label.font" "List.font"
>   "MenuBar.font" "MenuItem.font"
>   "RadioButtonMenuItem.font"
>   "CheckBoxMenuItem.font" "Menu.font"
>   "PopupMenu.font" "OptionPane.font"
>   "Panel.font" "ProgressBar.font"
>   "ScrollPane.font" "Viewport.font"
>   "TabbedPane.font" "Table.font"
>   "TableHeader.font" "TextField.font"
>   "PasswordField.font" "TextArea.font"
>   "TextPane.font" "EditorPane.font"
>   "TitledBorder.font" "ToolBar.font"
>   "ToolTip.font" "Tree.font"]]
> (doseq [key what]
>   (UIManager/put key res
>
> I use it like:
>
> (defn runner []
>   (seesaw/native!)
>   (seesaw/invoke-later
>(set-font "Sans Serif" 11)
>(seesaw/show! )))

Thanks that works. I should put it always on my high-resolution screen then.

Two points:
When using:
(seesaw/invoke-later
I get:
Exception in thread "main" java.lang.RuntimeException: No such
namespace: seesaw

What do I need to do to get rid of this?

Is it possible to increase the font in the title from the window?
Probably not, because I think that is done by the Operating System.
But maybe I am wrong.


> On Wednesday, October 5, 2016 at 10:47:14 AM UTC+2, Cecil Westerhof wrote:
>>
>> I already asked it on Clojure-seesaw, but the last three months there
>> has been no activity there. So I ask it here also.
>>
>> Some time ago I wrote a Clojure program that uses SeeSaw. I just
>> bought a high resolution monitor and now I cannot read the text in my
>> JFrames anymore. How can I increase the default font size?
>>
>> I create the frames like:
>>   (let [
>> ^JFrame
>> other-frm (frame :title "Other"  :on-close
>> :hide:resizable? false)
>>
>> I now generate buttons like:
>> ^JButton
>> all-authors   (button :text "All Authors"
>>   :font {:size 25}
>>   :listen [:action (fn [e] (show-all-authors))])
>>
>> But I have to set the font for every label in this way.
>>
>> At another part I have:
>>   (grid-bag-layout
>>search-panel
>>:fill  :HORIZONTAL
>>:ipadx 8
>>:ipady 4
>>:gridy i
>>:gridx 0 ^JLabel (label description)
>>:gridx 1 ^JTextField
>>    (text  :columns 40
>>   :listen
>>   [:action (fn [e]
>>(let [
>>  search-str (text e)
>>  ]
>>  (when (not (empty? search-str))
>>(function search-str
>>   ]
>>
>> At the moment I do not know how to set the font there.
>>
>> Is there also a way to increase/decrease the fontsize in the whole
>> application. I now have amiddle and high resolution screen. It would
>> be nice if when I put things on the other monitor, the fonts would
>> scale.

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


Setting the font size

2016-10-05 Thread Cecil Westerhof
I already asked it on Clojure-seesaw, but the last three months there
has been no activity there. So I ask it here also.

Some time ago I wrote a Clojure program that uses SeeSaw. I just
bought a high resolution monitor and now I cannot read the text in my
JFrames anymore. How can I increase the default font size?

I create the frames like:
  (let [
^JFrame
other-frm (frame :title "Other"  :on-close
:hide:resizable? false)

I now generate buttons like:
^JButton
all-authors   (button :text "All Authors"
  :font {:size 25}
  :listen [:action (fn [e] (show-all-authors))])

But I have to set the font for every label in this way.

At another part I have:
  (grid-bag-layout
   search-panel
   :fill  :HORIZONTAL
   :ipadx 8
   :ipady 4
   :gridy i
   :gridx 0 ^JLabel (label description)
   :gridx 1 ^JTextField
   (text  :columns 40
  :listen
  [:action (fn [e]
   (let [
 search-str (text e)
 ]
 (when (not (empty? search-str))
   (function search-str
  ]

At the moment I do not know how to set the font there.

Is there also a way to increase/decrease the fontsize in the whole
application. I now have amiddle and high resolution screen. It would
be nice if when I put things on the other monitor, the fonts would
scale.

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


Displaying functions generated for the REPL

2016-07-23 Thread Cecil Westerhof
For a project I define some extra functions if it is started in the REPL. I
like to know which extra functions there are in the REPL, so at the moment
I am doing the following:
   (print (str "Defined REPL functions:\n"
   "- do-show-schemas\n"
   "- do-show-table [table]\n"
   "- do-show-tables\n"
   "- get-h2-version\n"
   "- get-random-quotes <[nr]>\n"
   )
  )

The problem with this is that every time I add or remove a function I need
to change this print. Is there a way to generate this list? I probably lose
the parameters, but for a long list of functions this could be handy.

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


Re: How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 11:19 GMT+02:00 Cecil Westerhof :

> 2016-07-19 10:49 GMT+02:00 Cecil Westerhof :
>
>> 2016-07-19 10:23 GMT+02:00 Miguel Ping :
>>
>>> If you want to learn clojure by image processing, thats fine, but if
>>> your goal is to do the image processing part rather sooner than later, I
>>> recommend using an external lib like imagemagick or sharp (
>>> http://sharp.dimens.io/en/stable/) to do that for you, and hook it via
>>> FFI.
>>>
>>
>> ​I was (in the first instance) planning to use just Image Magick like I
>> do now. The only thing I wanted was to display the picture, move the
>> rectangle around to select the part to crop and then let Image Magick do
>> the cropping. But your link says sharp is 4-5 times as fast, so I probably
>> should switch.​
>>
>
> ​Well I get:
> npm ERR! sharp@0.15.1 install: `node-gyp rebuild`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the sharp@0.15.1 install script 'node-gyp rebuild'.
> npm ERR! This is most likely a problem with the sharp package,
> npm ERR! not with npm itself.
> npm ERR! Tell the author that this fails on your system:
> npm ERR! node-gyp rebuild
> npm ERR! You can get information on how to open an issue for this project
> with:
> npm ERR! npm bugs sharp
> npm ERR! Or if that isn't available, you can get their info via:
> npm ERR!
> npm ERR! npm owner ls sharp
> npm ERR! There is likely additional logging output above.
>
> npm ERR! Please include the following file with any support request:
> npm ERR! /root/npm-debug.log
>

​Problem solved: I needed to install nodejs-devel.​

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


Re: How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 9:26 GMT+02:00 Cecil Westerhof :

>
> My pictures have a dimension of 5,184x3,456 and I need to make a crop of
> 1.080x1.080. This is a little to big for my screen. So I am thinking about
> dividing everything by 8.
>
> I need to know two things:
> - How would I display the picture as a 648x432 picture?
> - How do I draw a square of 135x135 on it? So I can select what to crop.
>

​It looks like SeeSaw is the way to go, so I will ask this at
Clojure-seesaw.​


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


Re: How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 11:31 GMT+02:00 Karl Blomström :

> Hello Cecil!
>
> If you want to work with the instagram API I've put together a library
> that simplifies the retrieval of the necessary oauth2 token. Maybe you will
> find it useful!
>
> Please see https://github.com/blmstrm/loudmoauth
> and here is an example using the library with instagram among other APIs
>
> https://github.com/blmstrm/loudmoauth-examples/blob/master/src/loudmoauth_examples/core.clj
>

​Thank you. I will look into it.

​


> Den 19 juli 2016 4:26 em skrev "Cecil Westerhof" :
>
>> It never hurts to combine things. I just started again with Clojure and I
>> started with taking photos. In doing the latter I found out that I can take
>> nice pictures of insects. But they mostly only take a part of the photo. At
>> the moment I am using Image Magick on the command line with trial and error
>> to crop the right part of the photo. For example:
>> https://www.instagram.com/p/BH7r97NgvFX/
>>
>> But this is a ‘bit’ of work. So I was thinking about writing a Clojure
>> program to do the cropping for me. That would save me a lot of time I think
>> and the best way to learn a language is to use it. I think I could manage
>> most parts, but I need a little help.
>>
>> My pictures have a dimension of 5,184x3,456 and I need to make a crop of
>> 1.080x1.080. This is a little to big for my screen. So I am thinking about
>> dividing everything by 8.
>>
>> I need to know two things:
>> - How would I display the picture as a 648x432 picture?
>> - How do I draw a square of 135x135 on it? So I can select what to crop.
>>
>> There are some other things to find out. But those I can find out for
>> myself I would think. ;-)
>>
>> Would anyone be interested in something like this? Then I could share it
>> on GitHub.
>> If anyone has ideas for other functionalities: let me know.
>> I have myself a few:
>> - Posting the picture on Instagram (and others) from the program.
>> - Putting the pictures into SQLite.
>> - Something to select pictures out of a range.
>> - …
>>
>> How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook,
>> Google+ and Twitter?
>>
>
-- 
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.


Re: How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 10:49 GMT+02:00 Cecil Westerhof :

> 2016-07-19 10:23 GMT+02:00 Miguel Ping :
>
>> If you want to learn clojure by image processing, thats fine, but if your
>> goal is to do the image processing part rather sooner than later, I
>> recommend using an external lib like imagemagick or sharp (
>> http://sharp.dimens.io/en/stable/) to do that for you, and hook it via
>> FFI.
>>
>
> ​I was (in the first instance) planning to use just Image Magick like I do
> now. The only thing I wanted was to display the picture, move the rectangle
> around to select the part to crop and then let Image Magick do the
> cropping. But your link says sharp is 4-5 times as fast, so I probably
> should switch.​
>

​Well I get:
npm ERR! sharp@0.15.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.15.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project
with:
npm ERR! npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls sharp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log


So I think I begin with the Image Magick version and migrate later.

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


Re: How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
2016-07-19 10:23 GMT+02:00 Miguel Ping :

> If you want to learn clojure by image processing, thats fine, but if your
> goal is to do the image processing part rather sooner than later, I
> recommend using an external lib like imagemagick or sharp (
> http://sharp.dimens.io/en/stable/) to do that for you, and hook it via
> FFI.
>

​I was (in the first instance) planning to use just Image Magick like I do
now. The only thing I wanted was to display the picture, move the rectangle
around to select the part to crop and then let Image Magick do the
cropping. But your link says sharp is 4-5 times as fast, so I probably
should switch.​

Maybe I could use sharp to convert from 5.184x3.456 to 648x432 and then
display that. But how can I then draw the outline of a square on it to
select the part to crop?

(And maybe I should display that part separately while selecting. But that
will be phase two.)


​By the way: what is better to use for GUI? JavaFX or S​wing? JavaFX is the
better technology (I understood), but maybe SeeSaw is more mature.


As for interacting with instagram, linkedin, etc - there should be libs out
> there for that. If there are no libs, its easy to consume those service's
> APIs via clojure.
>

​I will look into it. But first my crop program. ;-)



> On Tuesday, July 19, 2016 at 8:26:15 AM UTC+1, Cecil Westerhof wrote:
>>
>> It never hurts to combine things. I just started again with Clojure and I
>> started with taking photos. In doing the latter I found out that I can take
>> nice pictures of insects. But they mostly only take a part of the photo. At
>> the moment I am using Image Magick on the command line with trial and error
>> to crop the right part of the photo. For example:
>> https://www.instagram.com/p/BH7r97NgvFX/
>>
>> But this is a ‘bit’ of work. So I was thinking about writing a Clojure
>> program to do the cropping for me. That would save me a lot of time I think
>> and the best way to learn a language is to use it. I think I could manage
>> most parts, but I need a little help.
>>
>> My pictures have a dimension of 5,184x3,456 and I need to make a crop of
>> 1.080x1.080. This is a little to big for my screen. So I am thinking about
>> dividing everything by 8.
>>
>> I need to know two things:
>> - How would I display the picture as a 648x432 picture?
>> - How do I draw a square of 135x135 on it? So I can select what to crop.
>>
>> There are some other things to find out. But those I can find out for
>> myself I would think. ;-)
>>
>> Would anyone be interested in something like this? Then I could share it
>> on GitHub.
>> If anyone has ideas for other functionalities: let me know.
>> I have myself a few:
>> - Posting the picture on Instagram (and others) from the program.
>> - Putting the pictures into SQLite.
>> - Something to select pictures out of a range.
>> - …
>>
>> How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook,
>> Google+ and Twitter?
>>
>
-- 
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.


How to work with photos in Clojure

2016-07-19 Thread Cecil Westerhof
It never hurts to combine things. I just started again with Clojure and I
started with taking photos. In doing the latter I found out that I can take
nice pictures of insects. But they mostly only take a part of the photo. At
the moment I am using Image Magick on the command line with trial and error
to crop the right part of the photo. For example:
https://www.instagram.com/p/BH7r97NgvFX/

But this is a ‘bit’ of work. So I was thinking about writing a Clojure
program to do the cropping for me. That would save me a lot of time I think
and the best way to learn a language is to use it. I think I could manage
most parts, but I need a little help.

My pictures have a dimension of 5,184x3,456 and I need to make a crop of
1.080x1.080. This is a little to big for my screen. So I am thinking about
dividing everything by 8.

I need to know two things:
- How would I display the picture as a 648x432 picture?
- How do I draw a square of 135x135 on it? So I can select what to crop.

There are some other things to find out. But those I can find out for
myself I would think. ;-)

Would anyone be interested in something like this? Then I could share it on
GitHub.
If anyone has ideas for other functionalities: let me know.
I have myself a few:
- Posting the picture on Instagram (and others) from the program.
- Putting the pictures into SQLite.
- Something to select pictures out of a range.
- …

How easy is it to use Clojure to work with InstaGram, LinkedIn, FaceBook,
Google+ and Twitter?

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


Good Open Source project to learn Clojure

2016-07-15 Thread Cecil Westerhof
I did not work with Clojure for about a year I think. And before that I
only made one little desktop application for myself and played with some
little stuff like Happy Numbers. There is a big chance I will get a Clojure
project soon, so it would be good to get up to speed. Anyone an idea what a
good project would be to contribute to? Difficult enough that I learn a lot
of stuff fast, but simple enough that I can contribute.

I worked with a lot of languages and get proficient with languages fast. So
in the beginning it should help me to get accustomed to Clojure, but after
that it should be challenging enough to continue. I would not like to come,
learn and go away. ;-)

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


Re: Running a certain function of your project

2016-07-15 Thread Cecil Westerhof
2016-07-15 10:54 GMT+02:00 Erik Assum :

> It's coming to Linux as well.
>

​I will keep an eye out then. :-)

​


> > Den 15. jul. 2016 kl. 10.41 skrev Cecil Westerhof <
> cldwester...@gmail.com>:
> >
> > I myself are on Linux, but maybe interesting for someone else.
>

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


Re: Running a certain function of your project

2016-07-15 Thread Cecil Westerhof
2016-07-15 9:12 GMT+02:00 Erik Assum :

> If you're on OSX and not opposed to Clojurescript, Planck[1] starts up in
> no time and is very useful for scripting and playing around.
>
> There is also replete if you have an iOS device.
>
> 1 http://planck-repl.org/
>

​I myself are on Linux, but maybe interesting for someone else.



> Den 14. jul. 2016 kl. 23.15 skrev Cecil Westerhof  >:
>
> In my project I have some functions I use when calling ‘lein repl’ in the
> project directory. Would it be possible to use just that function? So use
> lein to call this function and return?
>
> Maybe not very useful because of the time it takes to start the JVM, but I
> like to experiment. ;-)
>
>
-- 
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.


Re: Error when upgrading yesql from 0.4.2 to 0.5.0

2016-07-15 Thread Cecil Westerhof
2016-07-15 2:19 GMT+02:00 Sean Corfield :

> Google has the Migration Guide cached, if that helps:
>
>
>
>
> https://webcache.googleusercontent.com/search?q=cache:zvoaA9nrTaUJ:https://github.com/krisajenkins/yesql/wiki/Migration+&cd=1&hl=en&ct=clnk&gl=us&client=safari
>
>

>
> And, yes, a LOT of API changes…
>

​It was luckily a simple project. Everything has been updated. :-D

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


Re: Error when upgrading yesql from 0.4.2 to 0.5.0

2016-07-14 Thread Cecil Westerhof
2016-07-15 0:05 GMT+02:00 Sean Corfield :

> The yesql.named-parameters namespace was removed between 0.4.2 and 0.5.0.
>
>
>
> You can see all the changes made between 0.4.2 and 0.5.0 here:
>
>
>
> https://github.com/krisajenkins/yesql/compare/v0.4.2...0.5.0
>
>
>
> It looks like 0.5.0 was a pretty major rewrite with a lot of API changes.
>

​I got it figured out what to do (the link to Migration Guide does not
work), but that makes for a pretty big overhaul of my code. :'-(



> On 7/14/16, 2:47 PM, "Cecil Westerhof"  behalf of cldwester...@gmail.com> wrote:
>
>
>
> When I upgrade yesql in my project from 0.4.2 to 0.5.0, I get the
> following error:
> IllegalStateException Attempting to call unbound fn:
> #'yesql.named-parameters/reassemble-query
> clojure.lang.Var$Unbound.throwArity (Var.java:43)
>
> With 0.4.2 I get just the result I expect.
>
> What could be happening here?
>
>

-- 
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 upgrading yesql from 0.4.2 to 0.5.0

2016-07-14 Thread Cecil Westerhof
When I upgrade yesql in my project from 0.4.2 to 0.5.0, I get the following
error:
IllegalStateException Attempting to call unbound fn:
#'yesql.named-parameters/reassemble-query
clojure.lang.Var$Unbound.throwArity (Var.java:43)


With 0.4.2 I get just the result I expect.

What could be happening here?

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


Re: Running a certain function of your project

2016-07-14 Thread Cecil Westerhof
2016-07-14 23:18 GMT+02:00 Gary Trakhman :

> Boot <https://github.com/boot-clj/boot/wiki/Scripts> and inlein
> <http://inlein.org/> are both more suitable for one-off scripts.
>

​OK, I will look into them.​



> On Thu, Jul 14, 2016 at 5:16 PM Cecil Westerhof 
> wrote:
>
>> In my project I have some functions I use when calling ‘lein repl’ in the
>> project directory. Would it be possible to use just that function? So use
>> lein to call this function and return?
>>
>> Maybe not very useful because of the time it takes to start the JVM, but
>> I like to experiment. ;-)
>>
>
-- 
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.


Running a certain function of your project

2016-07-14 Thread Cecil Westerhof
In my project I have some functions I use when calling ‘lein repl’ in the
project directory. Would it be possible to use just that function? So use
lein to call this function and return?

Maybe not very useful because of the time it takes to start the JVM, but I
like to experiment. ;-)

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


Re: lein repl and own functions

2016-07-14 Thread Cecil Westerhof
2016-07-14 20:06 GMT+02:00 Timothy Baldridge :

> There probably is, since the user.clj file can exist anywhere on the
> classpath. So it should be possible to add an entry to profile.clj and add
> a classpath folder to some global location.
>
> However, I'm not sure I would recommend this approach. IMO, it's better to
> keep all the development tools for a project with the project itself. With
> a local user.clj you can check that into git and have it the next time you
> share/re-download the project
> ​.
>

​It is more for when I am doing lein repl, not for projects. I could make a
dummy project and always do lein repl there, but I find that a bit of a
bother. I will look into it.

> ​
>
> On Thu, Jul 14, 2016 at 11:50 AM, Cecil Westerhof 
> wrote:
>
>>
>> 2016-07-14 18:18 GMT+02:00 Timothy Baldridge :
>>
>>> Anything found in src/user.clj will be automatically loaded when lein
>>> repl starts.
>>>
>>
>> ​That works only for that directory. With my Bash script the functions
>> where always included. Is there no way to do it always?​
>>
>>
>>
>>> On Thu, Jul 14, 2016 at 7:52 AM, Cecil Westerhof >> > wrote:
>>>
>>>> When I first worked with Clojure I used a Bash script with had:
>>>> rlwrap java -cp "${CP}" clojure.main --init "${CLOJURE_INIT}" --repl
>>>>
>>>> In this way I had several of my own functions in the REPL. Now I
>>>> started again with Clojure I understood I should use ‘lein repl’. Is there
>>>> a method to get my own functions also included when using ‘lein repl’?
>>>>
>>>
-- 
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.


Re: Use latest stable

2016-07-14 Thread Cecil Westerhof
2016-07-14 19:58 GMT+02:00 Alan Thompson :

> If you haven't seen it yet, lein-ancient (
> https://github.com/xsc/lein-ancient) provides an easy way of checking
> your project for out of date dependencies.  For example:
>
> > lein ancient
> [criterium "0.4.4"] is available but we use "0.4.3"
> [tupelo "0.9.0"] is available but we use "0.1.60"
> [com.rpl/specter "0.11.2"] is available but we use "0.9.1"
>
>
> I tend to run it every couple of months, or whenever I remember.  Then it
> is easy to update project.clj
>

​Yes, in another tread I was pointed to that. Very handy indeed. I could
write a script that I run every week in crontab that would notify me when
something is to old.

Have to take care of a few things:
- Latest of H2 is 1.4.192, but latest stable is 1.3.176.
- Latest of yesql is 0.5.3 ​, but my application does not work with a
version after 0.4.2.

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


Re: Use latest stable

2016-07-14 Thread Cecil Westerhof
2016-07-14 18:38 GMT+02:00 Sean Corfield :

> Toby gave you a good answer re “LATEST” and “RELEASE” but I’ll comment on
> stability of Clojure Alpha builds in general:
>
>
>
> We first went to production with Clojure in 2011 on 1.3.0 Alpha 7 (or 8, I
> no longer remember which). We’re currently in production with 1.9.0 Alpha
> 10. Prerelease builds of Clojure have been remarkably stable and this
> allows us to leverage new functionality as soon as it becomes available.
>
>
>
> In particular, 1.9.0 Alpha 10 is just 1.8.0 + a handful of new predicates
> in core + clojure.spec.
>
>
>
> The new predicates may cause warnings or errors if you’re using libraries
> that define their own versions but we have already adopted several of them
> so we could simplify our existing code and remove some of our own custom
> predicates.
>
>
>
> Otherwise it’s a purely additive release and you can simply ignore
> clojure.spec if you’re not ready to use it (we’re already developing new
> production code on top of it, although that hasn’t been merged to our
> production branch yet).
>
>
>
> We have had automated testing against Clojure’s master SNAPSHOT for years
> so we always get an early heads up if an upcoming “RELEASE” change would
> break anything. That’s easy to do with Leiningen profiles or Boot pods (and
> tasks like boot-expectations allow you to specify which version of Clojure
> to use, so multi-version testing is pretty much trivial!).
>



​Well, I could put in my profiles.clj LATEST and in all my project.clj
1.8.0​
​.

-- 
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 repl and own functions

2016-07-14 Thread Cecil Westerhof
2016-07-14 18:18 GMT+02:00 Timothy Baldridge :

> Anything found in src/user.clj will be automatically loaded when lein repl
> starts.
>

​That works only for that directory. With my Bash script the functions
where always included. Is there no way to do it always?​



> On Thu, Jul 14, 2016 at 7:52 AM, Cecil Westerhof 
> wrote:
>
>> When I first worked with Clojure I used a Bash script with had:
>> rlwrap java -cp "${CP}" clojure.main --init "${CLOJURE_INIT}" --repl
>>
>> In this way I had several of my own functions in the REPL. Now I started
>> again with Clojure I understood I should use ‘lein repl’. Is there a method
>> to get my own functions also included when using ‘lein repl’?
>>
>
-- 
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.


Re: Notification about newer versions

2016-07-14 Thread Cecil Westerhof
2016-07-14 15:25 GMT+02:00 Yannick Scherer :

> To check your profiles using lein-ancient, run:
>
> lein ancient check-profiles
>
> See the output of
>
> lein help ancient
>
> for  all available tasks.
>

​I try everything immediately of-course. ;-) I find especially
show-versions handy.

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


lein repl and own functions

2016-07-14 Thread Cecil Westerhof
When I first worked with Clojure I used a Bash script with had:
rlwrap java -cp "${CP}" clojure.main --init "${CLOJURE_INIT}" --repl

In this way I had several of my own functions in the REPL. Now I started
again with Clojure I understood I should use ‘lein repl’. Is there a method
to get my own functions also included when using ‘lein repl’?

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


Re: Notification about newer versions

2016-07-14 Thread Cecil Westerhof
2016-07-14 15:00 GMT+02:00 Cecil Westerhof :

> It says you can check your profile also:
> ancientCheck your projects and profiles for outdated
> dependencies/plugins.
>
> But that is not true: if I run it in a not project directory, I get:
> (warn)  not inside of a project.
>

​I should have looked a little further. It can be done with:

lein ancient check-profiles

I would expect that the profiles would be checked when not in a
project, but I can live with this.

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


Re: Notification about newer versions

2016-07-14 Thread Cecil Westerhof
2016-07-14 13:05 GMT+02:00 Toby Crawley :

> You can use lein-ancient periodically to see if there are newer
> versions of your dependencies: https://github.com/xsc/lein-ancient


​I have updated my project. I now use clj-time 0.12.0 instead of 0.8.0.
I partly updated yesql: from 0.4.0 to 0.4.2, but 0.5.0 and higher do not
work. I do not get an error, but it looks like queries are not executed or
give an empty result. I have to look into that.


It says you can check your profile also:
ancientCheck your projects and profiles for outdated
dependencies/plugins.

But that is not true: if I run it in a not project directory, I get:
(warn)  not inside of a project.


On Thu, Jul 14, 2016 at 6:56 AM, Cecil Westerhof 
> wrote:
> > In a project.clj I have:
> >   :dependencies [[org.clojure/clojure"1.8.0"]
> >  [clj-time   "0.8.0"]
> >  [com.h2database/h2  "1.3.176"]
> >  [instaparse "1.4.2"]
> >  [org.clojure/math.numeric-tower "0.0.4"]
> >  [seesaw "1.4.5"]
> >  [yesql  "0.4.0"]]
> >
> > Is there a way to get notified about newer (stable) releases? They say:
> > never change a winning team, but I think it a good idea (most of the
> time)
> > to upgrade to a newer version when that is possible.
>

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


Notification about newer versions

2016-07-14 Thread Cecil Westerhof
In a project.clj I have:
  :dependencies [[org.clojure/clojure"1.8.0"]
 [clj-time   "0.8.0"]
 [com.h2database/h2  "1.3.176"]
 [instaparse "1.4.2"]
 [org.clojure/math.numeric-tower "0.0.4"]
 [seesaw "1.4.5"]
 [yesql  "0.4.0"]]

Is there a way to get notified about newer (stable) releases? They say:
never change a winning team, but I think it a good idea (most of the time)
to upgrade to a newer version when that is possible.

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


Use latest stable

2016-07-14 Thread Cecil Westerhof
Is there a way to signify latest stable version? Because when you use:
  :dependencies [[org.clojure/clojure"LATEST"]
it wants to work with:
clojure-1.9.0-alpha10

I prefer to use clojure-1.8.0. There is a reason it is called alpha. But
when there is a stable 1.9.0 I want to use that one.

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


Re: Use latest Clojure with lein repl

2016-07-13 Thread Cecil Westerhof
2016-07-13 16:28 GMT+02:00 John Szakmeister :

> > I now just installed it again. And that works. But what if I default
> want to
> > work with a newer (or older) version. I understood it could be done with
> > profile.clj, but I did not get it working.
>
> I haven't done it, but perhaps look at:
>
> https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#replacing-default-repl-dependencies


​That solved my ‘problem’. It has to be profiles.clj instead of
profile.clj. (plural)
I have:
{
:repl {
:dependencies [
^:displace [org.clojure/clojure "1.4.0"]
]
}
}

And that worked. I only used 1.4.0 to be sure that it worked. I put i​t
back to 1.8.0.

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


Re: Problem upgrading from 1.6.0 to 1.8.0

2016-07-13 Thread Cecil Westerhof
2016-07-13 16:21 GMT+02:00 James Reeves :

> You'll need to update your version of Instaparse as well.
>

​I added:
[instaparse "1.4.2"]​
and problem solved.

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


Re: Use latest Clojure with lein repl

2016-07-13 Thread Cecil Westerhof
2016-07-13 14:44 GMT+02:00 John Szakmeister :

> On Wed, Jul 13, 2016 at 7:20 AM, Cecil Westerhof 
> wrote:
> > After a long time I want to start with Clojure again. As I understand
> it, it
> > is best to use:
> > lein repl
> >
> > But then I work with 1.5.1. Is there a way to work default with the
> latest
> > stable version of Clojure?
>
> I think you probably want to run "lein upgrade".  My version currently
> provides a REPL for Clojure 1.8.0 without any special options.
>


​I already tried that, but this gives:
WARNING: You're currently running as root; probably by accident.
Press control-C to abort or Enter to continue as root.
Set LEIN_ROOT to disable this warning.

Downloading Leiningen to
/root/.lein/self-installs/leiningen-2.3.4-standalone.jar now...
  % Total% Received % Xferd  Average Speed   TimeTime Time
Current
 Dload  Upload   Total   SpentLeft
Speed
  0 00 00 0  0  0 --:--:-- --:--:--
--:--:-- 0curl: (22) The requested URL returned error: 403 Forbidden
Failed to download
https://leiningen.s3.amazonaws.com/downloads/leiningen-2.3.4-standalone.jar
It's possible your HTTP client's certificate store does not have the
correct certificate authority needed. This is often caused by an
out-of-date version of libssl. Either upgrade it or set HTTP_CLIENT
to turn off certificate checks:
  export HTTP_CLIENT="wget --no-check-certificate -O" # or
  export HTTP_CLIENT="curl --insecure -f -L -o"
It's also possible that you're behind a firewall haven't yet
set HTTP_PROXY and HTTPS_PROXY.

​I now just installed it again. And that works. But what if I default want
to work with a newer (or older) version. I understood it could be done with
profile.clj, but I did not get it working.


​At the moment every user has to install lein, is there a way to install it
globally?

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


Problem upgrading from 1.6.0 to 1.8.0

2016-07-13 Thread Cecil Westerhof
I want to pick up Clojure again. One of the things I wanted to do is to let
a program I have written use 1.8.0 instead of 1.6.0. But when doing this I
get:
WARNING: cat already refers to: #'clojure.core/cat in namespace:
instaparse.combinators-source, being replaced by:
#'instaparse.combinators-source/cat
WARNING: cat already refers to: #'clojure.core/cat in namespace:
instaparse.cfg, being replaced by: #'instaparse.combinators-source/cat
Exception in thread "main" java.lang.ExceptionInInitializerError,
compiling:(/tmp/form-init8045821108216466181.clj:1:90)
at clojure.lang.Compiler.load(Compiler.java:7239)
at clojure.lang.Compiler.loadFile(Compiler.java:7165)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$init_opt.invoke(main.clj:280)
at clojure.main$initialize.invoke(main.clj:308)
at clojure.main$null_opt.invoke(main.clj:343)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at clojure.lang.RT.classForName(RT.java:2154)
at clojure.lang.RT.classForName(RT.java:2163)
at clojure.lang.RT.loadClassForName(RT.java:2182)
at clojure.lang.RT.load(RT.java:436)
at clojure.lang.RT.load(RT.java:412)

What could be the reason for this?


Also: is there a way to signify latest stable version? Because when you use:
  :dependencies [[org.clojure/clojure"LATEST"]
it wants to work with:
clojure-1.9.0-alpha10



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


Use latest Clojure with lein repl

2016-07-13 Thread Cecil Westerhof
After a long time I want to start with Clojure again. As I understand it,
it is best to use:
lein repl

But then I work with 1.5.1. Is there a way to work default with the latest
stable version of Clojure?

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


Re: Better outputs produced by the REPL

2015-03-12 Thread Cecil Westerhof
2015-03-12 13:51 GMT+01:00 Alex Miller :

> Try print-str and println-str.
>

​I am not the OP, but I tried that and it does not work. At the moment the
only thing that I got working is:
(printf "a line and then \n another line")

But the OP does not want to use that. (Do not ask me why.)

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


Re: Adding directory to classpath in leiningen

2015-03-12 Thread Cecil Westerhof
2015-03-12 12:00 GMT+01:00 Hildeberto Mendonça :

> $ cd ~/Clojure
> $ lein repl
>
> Your code in the repl will see the path ~/Clojure as working directory, so
> any file there will be accessible to your code by simply using the name of
> the file. If you have sub-directories then add the relative path:
> "path/to/the/file/the-file.txt"
>

​That is not going to work, because I want to use the files in the project
that resides in:
~/Clojure/quotes

I could move the files to there, but there is a big change that I want to
use them in other projects also.
I could use (soft) links, but I was just wondering if it would be possible
to extend the classpath.

By the way: I moved them to:
~/Clojure/repl
that is a better place I think.



> On Thu, Mar 12, 2015 at 9:10 AM, Cecil Westerhof 
> wrote:
>
>> I have some files in:
>> ~/Clojure
>> that I want to use in a project I start with:
>> lein repl
>>
>> But I do not see how to do this. How can I acomplish this?
>>
>
-- 
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.


Adding directory to classpath in leiningen

2015-03-12 Thread Cecil Westerhof
I have some files in:
~/Clojure
that I want to use in a project I start with:
lein repl

But I do not see how to do this. How can I acomplish this?

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


Would it be better to move future to the called function

2015-03-02 Thread Cecil Westerhof
I have a function info-table to display the output of a query. I have
statements like the following:
(defn show-all-quotes
  []
  (future
   (info-table "All Quotes"
   '(:quote "Quote" :author "Author")
   (all-quotes db-spec

I was wondering if this could be done better? Now every function calling
info-table needs to call future, because the call to generate the sequence
can take some time. The parameters of the different functions to generate
the sequences are not the same.

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


Re: Breaking out of a sequence

2015-03-01 Thread Cecil Westerhof
2015-03-01 11:33 GMT+01:00 Colin Yates :

> I would replace it with loop/recur or a while, with both checking a
> termination flag (probably an atom) which is set by the user.
>
​I was just going to post that I was going to use a loop. You beat me to
it. ;-)
Probably being busy for to long, because I should have thought about that.
:-(
Well​

​I keep updating my Clojure skills.​ :-)

No need for a flag (in this case): the user is shown an adjustment. He can
choose yes, no, or cancel. Cancel is the break out of the loop. With no the
adjustment is not done and the next one is shown. With yes the adjustment
is done and the next one is shown.

An alternative approach would be core.async with a stop channel and then
> use alt! to check them both simultaneously.
>
​Something to dive into later. (Just as some other things that came up in
my avalanche of questions of lately.)

I must say I like Clojure. It is a bit different and I need to get used to
it, but it looks like when I am proficient in it, my productivity will be
quit a bit higher.

​

> On 1 Mar 2015 10:30, "Cecil Westerhof"  wrote:
>
>> I have a program where I change a lot of records based on id's in a
>> sequence. It is a manual process, so I want to give the user an option to
>> terminate the sequence. What would be the correct way to stop (for example)
>> a doseq?
>>
>
-- 
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.


Breaking out of a sequence

2015-03-01 Thread Cecil Westerhof
I have a program where I change a lot of records based on id's in a
sequence. It is a manual process, so I want to give the user an option to
terminate the sequence. What would be the correct way to stop (for example)
a doseq?

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


Re: :reload does not always work correctly in leiningen

2015-02-28 Thread Cecil Westerhof
2015-02-28 17:26 GMT+01:00 Sam Raker :

> "does not always work correctly " in what context?
>

​One time when I did the reload my forms got an empty area around them.
After an exit and a new start everything was OK again. I use it since
today, so I do not know if it is a gremlin or a real problem. I just keep
using it and if I get strange results I just have to remember to exit and
start again. If I need to restart once every four hours, it still is a good
improvement.

I just thought to mention it: if a lot of people would reply with: yes, I
have the same problem, then we would know that something was broken. For
the moment I think it was a gremlin and not a real problem.


On Saturday, February 28, 2015 at 9:25:56 AM UTC-5, Cecil Westerhof wrote:
>
>> I discovered:
>> (require 'project.core :reload)
>>
>> Very handy indeed and a big time saver. But it does not always work
>> correctly. At a certain moment I got strange results. An exit and a new
>> 'lein repl' solved the problems.
>>
>
-- 
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.


Re: Is this the right way to prevent repetitive code

2015-02-28 Thread Cecil Westerhof
2015-02-28 16:51 GMT+01:00 Marc Limotte :

> You might wonder how to get 'i' if you remove the dotimes.  Here is one
> way:
>
> (doall
>   (map-indexed
> (fn [i [description f]]
>   ...)
> search-fields))
>

​Done, see other reply.

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


Re: Is this the right way to prevent repetitive code

2015-02-28 Thread Cecil Westerhof
2015-02-28 16:43 GMT+01:00 Chris Freeman :

> You can pass your functions around directly; you don't need to wrap them
> in #(). That will get rid of most of the rest of the duplication you've
> got.
>

​That did not work in the beginning, but that probably had to do that I was
first using a list instead of a vector. (I spend quite some time getting it
to work. But I learned from it.)



> Also, please consider doseq instead of dotimes.
>
> (doseq [[description function] search-fields]
>   (grid-bag-layout
>search-panel
>:fill  GridBagConstraints/HORIZONTAL
>:ipadx 8 ...))
>

​That does not work because I need the i.​

​But with the comment from Marc I made the following.
In a let I have (not in a def of-course):
search-fields [
   ["Search Quotes (Case Independent)"
show-search-quotes]
   ["Search Quotes Not (Case Independent)"
show-search-quotes-not]
   ["Search Quotes Word Bounderies"
show-search-quotes-word-boundary]
   ["Search Quotes Begin (Case Independent)"
show-search-quotes-begin]
   ["Search Quotes End (Case Independent)"
show-search-quotes-end]
   ["Search Quotes Java Regular Expression"
show-search-quotes-java-regex]
   ["Search Quotes Java Regular Expression Not"
show-search-quotes-java-regex-not]
   [nil nil]
   ["Search Authors (Case Independent)"
show-search-authors]
  ]

The code (it is extended to have also an empty line):
​(doall
 (map-indexed
  (fn [i [description function]]
(if (nil? description)
(grid-bag-layout
 search-panel
 :fill  GridBagConstraints/HORIZONTAL
 :ipadx 8
 :ipady 4
 :gridy i
 :gridx 0 ^JLabel (label " "))
  (grid-bag-layout
   search-panel
   :fill  GridBagConstraints/HORIZONTAL
   :ipadx 8
   :ipady 4
   :gridy i
   :gridx 0 ^JLabel (label description)
   :gridx 1 ^JTextField
   (text  :columns 40
  :listen
  [:action (fn [e]
   (let [
 search-str (text e)
 ]
 (when (not (empty? search-str))
   (function search-str
  ]
  search-fields))

The only 'problem' is that there is a little duplication of code, but I can
live with that I think.

In the attachment is a screendump of the frame as it has become.


You could extract the doseq into a var-args function, then call it with the
> items like so:
>
>  (def-grids
>  ["Search Quotes (Case Independent)"  show-search-quotes]
>  ["Search Quotes Not (Case Independent)"
>  show-search-quotes-not]
>  ["Search Quotes Word Bounderies"
> show-search-quotes-word-boundary]
>  ["Search Quotes Begin (Case Independent)"
>  show-search-quotes-begin]
>  ["Search Quotes End (Case Independent)"
>  show-search-quotes-end]
>  ["Search Quotes Java Regular Expression"
> show-search-quotes-java-regex]
>  ["Search Quotes Java Regular Expression Not"
> show-search-quotes-java-regex])
>

​I do not understand what you mean by this.​




> On Feb 28, 2015 4:50 AM, "Cecil Westerhof"  wrote:
>
>> I need some things that are almost the same. I solved that in this way:
>> (def search-fields
>>  [
>>  ["Search Quotes (Case Independent)"
>> #(show-search-quotes %)]
>>  ["Search Quotes Not (Case Independent)"
>> #(show-search-quotes-not %)]
>>  ["Search Quotes Word Bounderies"
>> #(show-search-quotes-word-boundary %)]
>>  ["Search Quotes Begin (Case Independent)"
>> #(show-search-quotes-begin %)]
>>  ["Search Quotes End (Case Independent)"
>> #(show-search-quotes-end %)]
>>  ["Search Quotes Java Regular Expression"
>> #(show-search-quotes-java-regex %)]
>>  ["Search Quotes Java Regular Expression Not"
>> #(show-search-quotes-java-regex %)]
>>  ])
>>
>> (dotimes
>> [i (count search-fields)]
>> (let [
>>   description (nth (nth search-fields i) 0)
>>   function(nth (nth search-fields i) 1)
>>   ]
>>   (grid-bag-layout
>>

:reload does not always work correctly in leiningen

2015-02-28 Thread Cecil Westerhof
I discovered:
(require 'project.core :reload)

Very handy indeed and a big time saver. But it does not always work
correctly. At a certain moment I got strange results. An exit and a new
'lein repl' solved the problems.

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


Is this the right way to prevent repetitive code

2015-02-28 Thread Cecil Westerhof
I need some things that are almost the same. I solved that in this way:
(def search-fields
 [
 ["Search Quotes (Case Independent)"  #(show-search-quotes
%)]
 ["Search Quotes Not (Case Independent)"
#(show-search-quotes-not %)]
 ["Search Quotes Word Bounderies"
#(show-search-quotes-word-boundary %)]
 ["Search Quotes Begin (Case Independent)"
#(show-search-quotes-begin %)]
 ["Search Quotes End (Case Independent)"
#(show-search-quotes-end %)]
 ["Search Quotes Java Regular Expression"
#(show-search-quotes-java-regex %)]
 ["Search Quotes Java Regular Expression Not"
#(show-search-quotes-java-regex %)]
 ])

(dotimes
[i (count search-fields)]
(let [
  description (nth (nth search-fields i) 0)
  function(nth (nth search-fields i) 1)
  ]
  (grid-bag-layout
   search-panel
   :fill  GridBagConstraints/HORIZONTAL
   :ipadx 8
   :ipady 4
   :gridy i
   :gridx 0 ^JLabel (label description)
   :gridx 1 ^JTextField
   (text  :columns 40
  :listen
  [:action (fn [e]
   (let [
 search-str (text e)
 ]
 (when (not (empty? search-str))
   (function search-str
      ]

Is that the correct way, or can it be done better?

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


Re: printf does not always generate output

2015-02-27 Thread Cecil Westerhof
2015-02-27 22:47 GMT+01:00 Sam Raker :

> I have
> https://jafingerhut.github.io/cheatsheet/grimoire/cheatsheet-tiptip-cdocs-summary.html
> bookmarked and also like basically always open in a tab forever, fwiw.
>

​Also good information.
​

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


Re: printf does not always generate output

2015-02-27 Thread Cecil Westerhof
2015-02-27 20:36 GMT+01:00 Andy Fingerhut :

> Not every function and macro is documented completely or accurately on
> ClojureDocs.org, but I would recommend checking it out when you run across
> something that looks amiss, and see if the examples mention what you are
> seeing.  In this case, it does:
>
> http://clojuredocs.org/clojure.core/printf
>

​That is certainly a place I should look more often. :-) A wealth of
information.


On Fri, Feb 27, 2015 at 11:12 AM, Cecil Westerhof 
> wrote:
>
>> My core.clj ends with:
>> (println (format "Started: %s (println)" (java.util.Date.)))
>> (printf "Started: %s (printf)\n" (java.util.Date.))
>>
>> I do not see the output from the printf when I run 'lein repl'.
>> The funny thing is that when I switch the two statements, both are shown.
>> Also when I do 'lein run' both are shown.
>>
>> What could be happening here?
>>
>> For the moment I changed all my printf to println with format, but it is
>> a little annoying.
>>
>

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


Re: Is it possible to determine that I did a 'lein repl'

2015-02-27 Thread Cecil Westerhof
2015-02-27 21:10 GMT+01:00 Sean Corfield :

> On Feb 27, 2015, at 6:56 AM, Cecil Westerhof 
> wrote:
>
> Caused by: java.lang.RuntimeException: Unable to resolve symbol: jvm-opts
> in this context, compiling:(/home/cecil/Clojure/quotes/project.clj:9:38)
>
>
> Right, as I said:
>

​You are right: I did not read good enough. :-(​




> "jvm-opts is a function in project.clj that returns the default JVM
> options — we do different things on different platforms — it returns a
> vector of JVM options. So :jvm-opts ["-Dlein.profile.repl=true"] might be
> sufficient for you."
> ​​
>

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


printf does not always generate output

2015-02-27 Thread Cecil Westerhof
My core.clj ends with:
(println (format "Started: %s (println)" (java.util.Date.)))
(printf "Started: %s (printf)\n" (java.util.Date.))

I do not see the output from the printf when I run 'lein repl'.
The funny thing is that when I switch the two statements, both are shown.
Also when I do 'lein run' both are shown.

What could be happening here?

For the moment I changed all my printf to println with format, but it is a
little annoying.


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


Re: Reflection warning on setCaretPosition

2015-02-27 Thread Cecil Westerhof
2015-02-27 17:30 GMT+01:00 Dave Ray :

> (let [^JEditorPane html-table (editor-pane ...)] ...)  should fix it. Or
> just set the caret position in the create function:
>

​I have removed all my warnings by using: ^JEditorPane, ^JFrame​

​, …
But I always like to check deeper. On one of the places I have now:
^JLabel (text …

lein check gives no warning, neither does lein compile. And lein run just
runs the application. Is that not strange? I say that a JTextField is a
JLabel, but the application does not choke on it.​

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


Re: Reflection warning on setCaretPosition

2015-02-27 Thread Cecil Westerhof
2015-02-27 17:30 GMT+01:00 Dave Ray :

> (let [^JEditorPane html-table (editor-pane ...)] ...)  should fix it. Or
> just set the caret position in the create function:
>
> (editor-pane :caret-position 0)
>

​This one I find the the best option. You only need to do it after the
:text option.
​


> or use config:
>
> (config! editor-pane :caret-position 0)
>



> On Fri, Feb 27, 2015 at 4:07 AM, Cecil Westerhof 
> wrote:
>
>>
>> 2015-02-27 11:34 GMT+01:00 Gary Verhaegen :
>>
>>> It means the Clojure compiler cannot emit the efficient bytecode
>>> directly, so it emits bytecode that calls the method reflexively.
>>>
>>> This only impacts performance, so if that code is not used much, it is
>>> not a problem.
>>>
>>
>> ​It is not used much, so it should not be a real problem.
>> ​
>>
>>
>>
>>> The underlying problem is that jvm bytecode is typed, so ideally the
>>> bytecode should be able to say "call method M of type T on object O". Here,
>>> the Clojure Compiler cannot infer a type for html-table, so instead the
>>> emitted bytecode is more along the lines of "ask object O to give a list of
>>> all of its types, then look into each of these types to find if one has a
>>> method that matches M in terms of name and number of arguments, and then
>>> look at that method's signature and check if the arguments can be cast to
>>> the types of the formal parameters; if there is a type with such a method,
>>> invoke that method".
>>>
>>> This is not 100% technically accurate (in particular, i have no idea
>>> what reflection does about the arguments and their types in this case), but
>>> it should be roughly correct and you can easily see why that would be much
>>> slower.
>>>
>>> If you want to remove that warning, you can annotate the html-table
>>> variable, but the place where you must do that will depend on a little more
>>> context than what you've given here. It is usually done at the level of var
>>> declaration or in function argument lists.
>>>
>>
>> ​This is the code:
>>(let [html-table (editor-pane
>>  :content-type "text/html"
>>  :text (str html-start
>>     html-records
>> html-end))
>> ]
>> (.setCaretPosition html-table 0)
>>
>> So html-table is a JEditorPane. Should Clojure not be able to determine
>> that?
>>
>>
>> Just to satisfy my curiosity: how can I get rid of the warning?
>> ​
>>
>>
>> On Friday, 27 February 2015, Cecil Westerhof 
>> wrote:
>>
>>> On a editor-pane I use:
>>>> (.setCaretPosition html-table 0)
>>>>
>>>> ​And it does what it should do. But when I run:
>>>> lein check
>>>>
>>>> I get:
>>>> Reflection warning, quotes/core.clj:98:42 - call to method
>>>> setCaretPosition can't be resolved (target class is unknown).
>>>>
>>>> Is that something to worry about?
>>>>
>>>> By the way, I get also some on jdbc and seesaw.​
>>>>
>>>
>> ​Strange enough I only get the warnings on my own code now.
>>
>
-- 
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.


Re: Is it possible to determine that I did a 'lein repl'

2015-02-27 Thread Cecil Westerhof
2015-02-27 15:56 GMT+01:00 Cecil Westerhof :

> 2015-02-27 14:29 GMT+01:00 Sean Corfield :
>
>> On Feb 27, 2015, at 12:09 AM, Cecil Westerhof 
>> wrote:
>>
>> In my application I have a quit button which does:
>> (System/exit 0)
>>
>> But when I used 'lein repl' I do not want to exit, but just close the
>> frame. Can this be done?
>>
>>
>> Here’s how we do it. Add the following to project.clj:
>>
>>   :profiles {:repl {:jvm-opts ~(conj (jvm-opts)
>> "-Dlein.profile.repl=true")}}
>>
>
>
> ​That gives:
> java.lang.Exception: Error loading /home/cecil/Clojure/quotes/project.clj
> at leiningen.core.project$read$fn__3326.invoke(project.clj:696)
> at leiningen.core.project$read.invoke(project.clj:693)
> at leiningen.core.project$read.invoke(project.clj:703)
> at leiningen.core.main$_main$fn__3092.invoke(main.clj:294)
> at leiningen.core.main$_main.doInvoke(main.clj:290)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.lang.Var.invoke(Var.java:415)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.core$apply.invoke(core.clj:617)
> at clojure.main$main_opt.invoke(main.clj:335)
> at clojure.main$main.doInvoke(main.clj:440)
> at clojure.lang.RestFn.invoke(RestFn.java:436)
> at clojure.lang.Var.invoke(Var.java:423)
> at clojure.lang.AFn.applyToHelper(AFn.java:167)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
> Caused by: java.lang.RuntimeException: Unable to resolve symbol: jvm-opts
> in this context, compiling:(/home/cecil/Clojure/quotes/project.clj:9:38)
>

​Bit this works:
:profiles {:repl {:jvm-opts ["-Dlein.profile.repl=true"]}}

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


Re: Is it possible to determine that I did a 'lein repl'

2015-02-27 Thread Cecil Westerhof
2015-02-27 14:29 GMT+01:00 Sean Corfield :

> On Feb 27, 2015, at 12:09 AM, Cecil Westerhof 
> wrote:
>
> In my application I have a quit button which does:
> (System/exit 0)
>
> But when I used 'lein repl' I do not want to exit, but just close the
> frame. Can this be done?
>
>
> Here’s how we do it. Add the following to project.clj:
>
>   :profiles {:repl {:jvm-opts ~(conj (jvm-opts)
> "-Dlein.profile.repl=true")}}
>


​That gives:
java.lang.Exception: Error loading /home/cecil/Clojure/quotes/project.clj
at leiningen.core.project$read$fn__3326.invoke(project.clj:696)
at leiningen.core.project$read.invoke(project.clj:693)
at leiningen.core.project$read.invoke(project.clj:703)
at leiningen.core.main$_main$fn__3092.invoke(main.clj:294)
at leiningen.core.main$_main.doInvoke(main.clj:290)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:415)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.core$apply.invoke(core.clj:617)
at clojure.main$main_opt.invoke(main.clj:335)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at clojure.lang.Var.invoke(Var.java:423)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve symbol: jvm-opts
in this context, compiling:(/home/cecil/Clojure/quotes/project.clj:9:38)

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


Re: Is it possible to determine that I did a 'lein repl'

2015-02-27 Thread Cecil Westerhof
2015-02-27 11:42 GMT+01:00 henry w :

> Well, I dont know if you could. but unless anyone else chimes in with
> another solution... there's no problem using clojure and java together in a
> lein project.
>
> And just to check ... this system/exit call is library code you have no
> control over right? I mean, if not of course you can stick a *when* block
> around it looking for a system property set from the repl or something
> along those lines.
>


​The system/exit call is in my own code. When closing the main frame, the
application should normally terminate, but not when I called it from the
REPL, then I should just close the window. So that if I could see it was
called from the REPL then I could only close and not exit. I could set a
variable before I call -main, but I would prefer it when I did not need to.
;-)
​​

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


Re: Reflection warning on setCaretPosition

2015-02-27 Thread Cecil Westerhof
2015-02-27 11:34 GMT+01:00 Gary Verhaegen :

> It means the Clojure compiler cannot emit the efficient bytecode directly,
> so it emits bytecode that calls the method reflexively.
>
> This only impacts performance, so if that code is not used much, it is not
> a problem.
>

​It is not used much, so it should not be a real problem.
​



> The underlying problem is that jvm bytecode is typed, so ideally the
> bytecode should be able to say "call method M of type T on object O". Here,
> the Clojure Compiler cannot infer a type for html-table, so instead the
> emitted bytecode is more along the lines of "ask object O to give a list of
> all of its types, then look into each of these types to find if one has a
> method that matches M in terms of name and number of arguments, and then
> look at that method's signature and check if the arguments can be cast to
> the types of the formal parameters; if there is a type with such a method,
> invoke that method".
>
> This is not 100% technically accurate (in particular, i have no idea what
> reflection does about the arguments and their types in this case), but it
> should be roughly correct and you can easily see why that would be much
> slower.
>
> If you want to remove that warning, you can annotate the html-table
> variable, but the place where you must do that will depend on a little more
> context than what you've given here. It is usually done at the level of var
> declaration or in function argument lists.
>

​This is the code:
   (let [html-table (editor-pane
 :content-type "text/html"
 :text (str html-start
html-records
html-end))
]
(.setCaretPosition html-table 0)

So html-table is a JEditorPane. Should Clojure not be able to determine
that?


Just to satisfy my curiosity: how can I get rid of the warning?
​


On Friday, 27 February 2015, Cecil Westerhof  wrote:

> On a editor-pane I use:
>> (.setCaretPosition html-table 0)
>>
>> ​And it does what it should do. But when I run:
>> lein check
>>
>> I get:
>> Reflection warning, quotes/core.clj:98:42 - call to method
>> setCaretPosition can't be resolved (target class is unknown).
>>
>> Is that something to worry about?
>>
>> By the way, I get also some on jdbc and seesaw.​
>>
>
​Strange enough I only get the warnings on my own code now.
​

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


Re: Is it possible to determine that I did a 'lein repl'

2015-02-27 Thread Cecil Westerhof
2015-02-27 10:01 GMT+01:00 henry w :

> I had exactly that problem when using an old version of JDAF. The newer
> version makes it configurable.
>
> to get around the problem i used AspectJ like this:
>
> @Aspect
> public class SystemExitEvader {
>
> @Pointcut("call(* java.lang.System.exit(..)) && args(status)")
> public void systemExitCall(int status){}
>
> @Around("systemExitCall(status)")
> public void doNothing(ProceedingJoinPoint thisJoinPoint, int status){
> System.out.println("Call to System.exit() attempted");
> // note: there is no call to proceed()
> }
>
>
> }
>

​How would I implement this in Clojure?

-- 
​​

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.


Reflection warning on setCaretPosition

2015-02-27 Thread Cecil Westerhof
On a editor-pane I use:
(.setCaretPosition html-table 0)

​And it does what it should do. But when I run:
lein check

I get:
Reflection warning, quotes/core.clj:98:42 - call to method
setCaretPosition can't be resolved (target class is unknown).

Is that something to worry about?

By the way, I get also some on jdbc and seesaw.​

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


  1   2   3   >