#clojure logs

2015-12-21

00:01devthappears that instances of Unbound are also falsey
00:01devth,(if a "yep" "nope")
00:01clojurebot#error {\n :cause "Unable to resolve symbol: a in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: a in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: a in this context"\n ...
00:04justin_smith,(def a)
00:04clojurebot#'sandbox/a
00:04justin_smith,(if a "yep" "nope")
00:04clojurebot"yep"
00:05ridcully_,(def a nil)
00:05clojurebot#'sandbox/a
00:05justin_smithnope!
00:05devthhmm
00:05justin_smithunbound is truthy
00:05justin_smithridcully_: why don't you want a to be unbound?
00:05devthohhh you're right, i had set nil as my default
00:05ridcully_also you wound not be able to detect the difference to bound falsey?
00:06justin_smithridcully_: unbound is truthy
00:06devthyep
01:40ashwink005what caching service do you guys usually use?
01:40ashwink005spyglass memcached?
01:44ashwink005how can I know the size of the data structure I'm caching?
01:53keep_learningHello everyone
01:54keep_learningCould some one please me why this code is getting timeout exception
01:54keep_learninghttp://lpaste.net/147568
01:54keep_learningYesterday night it was working so the only change is wifi
01:58Kneivakeep_learning: try running it with firefox or chrome driver and see what is happening?
01:58keep_learningKneiva, I am running it with firefox
01:59Kneivakeep_learning: ok, at what point is it timing out?
02:00keep_learningNow I am getting some more weird error NoSuchElementException
02:00keep_learningI am not able to understand the behaviour of this code :(
02:00keep_learningIt was running fine yesterday night and quit after loading the page.
02:02keep_learningKneiva, Now I am getting TimeoutException Timed out
02:04Kneivakeep_learning: I can't find .scopedSearchDisplay from the page.
02:05keep_learningclass="scopedSearchDisplay geoScopeDisplay whiteCaret"
02:05keep_learning<div style="position: absolute; left: -999em; top: 27px;" class="scopedSearchDisplay geoScopeDisplay whiteCaret"></div>
02:06keep_learningWhen I am commenting ;(t/wait-until #(= (t/title) (str "The 10 Best " city " Hotels - TripAdvisor")))
02:06keep_learningthis line
02:06keep_learningNow it's running fine
02:06keep_learninguser> (tripadvisor.core/go-to-tripadv "Gurgoan")
02:06keep_learningnil
02:06keep_learningand added (t/implicit-wait 3000)
02:08Kneivaah, maybe one needs to input the city name before that is shown.
02:08Kneivakeep_learning: but yeah, you might need waits when dealing with ajax calls.
02:09keep_learningKneiva, But I wanted to quit when page reloads and title appears
02:09keep_learningfor next page
02:26Kneivakeep_learning: Does it go the 10 best -page after the search click?
02:26keep_learningYes
02:27keep_learningKneiva, I am getting false for
02:27keep_learning(= "The 10 Best Gurgaon Hotels - TripAdvisor" (str "The 10 Best " "Gurgoan" " Hotels - TripAdvisor"))
02:27keep_learninguser> (= "The 10 Best Gurgaon Hotels - TripAdvisor" (str "The 10 Best " "Gurgoan" " Hotels - TripAdvisor"))
02:27keep_learningfalse
02:29keep_learningI think (t/wait-until #(= (t/title) (str "The 10 Best " city " Hotels - TripAdvisor"))
02:29keep_learningis problematic
02:31KneivaStrange, to clojure those strings are different
02:33lambda-11235keep_learning: Gorgoan and Gurgaon are spelled differently. o and a are reversed
02:33Kneivahow I missed that! =)
02:34keep_learninglambda-11235, Thank you. Stupid me :)
02:45visofhi guys
02:46visofthe day has 24 hours, what is the best way to tell specific hour is closer than another one?
02:47visofhour 23 is closer to hour 0 than hour 6 for example
03:13TEttinger,(mod (- 24 0 23) 24)
03:13clojurebot1
03:13TEttinger,(mod (- 24 6 23) 24)
03:13clojurebot19
03:13TEttingerhm
03:13TEttinger,(mod (- (+ 24 6) 23) 24)
03:13clojurebot7
03:13TEttinger,(mod (- (+ 24 0) 23) 24)
03:13clojurebot1
03:14TEttinger,(mod (- (+ 24 20) 23) 24)
03:14clojurebot21
03:14TEttingerhm
03:17TEttinger,(let [hour-a 23 hour-b 20] (mod (- (+ (if (< hour-a (+ 12 hour-b)) 0 24) hour-b) hour-a) 24)
03:17clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
03:17TEttinger,(let [hour-a 23 hour-b 20] (mod (- (+ (if (< hour-a (+ 12 hour-b)) 0 24) hour-b) hour-a) 24))
03:17clojurebot21
03:17TEttingerdammit
03:18TEttinger,(let [hour-a 23 hour-b 20] (mod (- (+ (if (< hour-a (+ 12 hour-b)) 12 24) hour-b) hour-a) 24))
03:18clojurebot9
03:18TEttingerguh
03:19TEttinger,(let [hour-a 23 hour-b 20] (mod (- (+ (if (< hour-a (+ 12 hour-b)) -24 24) hour-b) hour-a) 24))
03:19clojurebot21
03:21amalloyTEttinger: take the minimum, mod 24, of a-b and b-a
03:22TEttinger,(let [hour-a 23 hour-b 6] (rem (- (+ (if (< hour-a (+ 12 hour-b)) 0 24) hour-b) hour-a) 24))
03:22clojurebot7
03:22TEttingerthanks amalloy, I was hoping to get negative answers like
03:22TEttinger,(let [hour-a 23 hour-b 20] (rem (- (+ (if (< hour-a (+ 12 hour-b)) 0 24) hour-b) hour-a) 24))
03:22clojurebot-3
03:23TEttinger,(let [a 23 b 20] (rem (min (- a b) (- b a)) 24))
03:23clojurebot-3
03:23TEttingersweet, amalloy wins
03:24TEttinger,(let [a 23] (doseq [b (range 24)] (print (rem (min (- a b) (- b a)) 24))))
03:24clojurebot-23-22-21-20-19-18-17-16-15-14-13-12-11-10-9-8-7-6-5-4-3-2-10
03:24amalloyuhhh, i don't think that works
03:24TEttingerhm, less good
03:24TEttinger,(let [a 23] (doseq [b (range 24)] (print (mod (min (- a b) (- b a)) 24))))
03:24clojurebot12345678910111213141516171819202122230
03:24amalloyyou can't just rem a negative number usefully
03:25amalloyyou have to work with positive numbers, so add 24 to each first
03:25TEttinger,(let [a (+ 23 24)] (doseq [b (range 24 48)] (print (mod (min (- a b) (- b a)) 24))))
03:25clojurebot12345678910111213141516171819202122230
03:26TEttingerwait that wasn't what you meant was it?
03:26TEttinger,(let [a 23] (doseq [b (range 24)] (print (mod (+ (min (- a b) (- b a)) 24) 24) " ")))
03:26amalloy24 to each subtraction
03:26clojurebot1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 0
03:26TEttingernot to the min?
03:26amalloyno, because you've already made the decision by the time you call min
03:27amalloy(min (rem (+ 24 (- a b) 24)) (rem (+ 24 (- b a)) 24))
03:27TEttinger,(let [a 23] (doseq [b (range 24)] (print (min (rem (+ 24 (- a b) 24)) (rem (+ 24 (- b a)) 24)) " ")))
03:27clojurebot#error {\n :cause "Wrong number of args (1) passed to: core/rem--inliner--4336"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "clojure.lang.ArityException: Wrong number of args (1) passed to: core/rem--inliner--4336, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type clojure.lang.ArityException\n :message "Wrong numb...
03:28TEttinger,(let [a 23] (doseq [b (range 24)] (print (min (rem (+ 24 (- a b)) 24) (rem (+ 24 (- b a)) 24)) " ")))
03:28clojurebot1 2 3 4 5 6 7 8 9 10 11 12 11 10 9 8 7 6 5 4 3 2 1 0
03:28TEttingerperfect
03:28TEttingervisof you still around? :D
03:48user5252Hi. In a lein project, I have listed a java class which includes a public static void main method as a dependency. Inside the repl I can import that class. Can I run the main method of the class inside the repl?
03:49noncomsure
03:50noncom(MyClass/main args) i think
03:50user5252how? :)
03:51noncomiirc the "args" should be a [] of strings. iirc that's the way to call a varargs method..
03:52noncombut if i am mistaken then it could just the strings passed as args, without being united in the []
03:54user5252it strange that it autocompletes "/main" and yet when run I get a compiler exception: no such field main
03:54user5252it should run with or without arguments, I tried both
03:57user5252it is strange*
04:02keep_learning(let [curr-url (t/current-url)]
04:02keep_learning (t/quit)
04:02keep_learning curr-url
04:02keep_learning)
04:03keep_learningHow to make sure that it's executed in sequence.
04:03keep_learningI understand that I can use do keyword but
04:03keep_learningI am wanted to store the current-url before quitting the browser
04:35favetelinguishow can i check the value of a top level def in clojurescript from javascript console in chrome?
04:38user5252So, my problem actually lies on the fact that the main method expects an array of Strings as an argument. (to-array '(new String "")) returns an array of java.lang.Objects. How can I make an array of the sequence without recasting the class?
04:43user5252ok, found it. (into-array java.lang.String '(""))
04:51jweissI've got {:foo-1 {:bar-1 0, :bar-2 1}, :foo-2 {:bar-1 3, :bar-3 4}} and want to turn inside out so that the nested map is keyed by bar first and then foo. eg {:bar-1 {:foo-1 0, foo-2 3}, :bar-2 {:foo-1 1} :bar-3 {:foo-2 4}. Only way i could think of to do this is with an intermediate list of triples and then reduce that to make a new map. maybe there's a more efficient or clear way?
04:56drorbemetHi, currently I am looking for a way to disown a forked shell process using clojure.java.shell/sh or org.clojars.hozumi/clj-commons-exec/sh-pipe. In a linux bash terminal I am using command & disown
05:03Guest96645if i have a function that creates data what would be the best way to use that function to store the results in a vector?
05:03Guest96645for, and reduce seem to be better used after you have data
05:05ridcully_Guest96645: into ?
05:05ridcully_,(into [] (range 10))
05:05clojurebot[0 1 2 3 4 ...]
05:05Guest96645ridcully_: and just mapv the function over that?
05:07Guest96645ridcully_: im starting with an empty vector [] and a function that generates new data to put into that (i guess a good example would be (rand n), i feel like theres a more elegant way
05:07Guest96645i could use repeatedly but that seems to be fore side effects
05:11ashwink005memcached clojure client is giving me stackoverflow
05:11ashwink005any idea why that could be? Its a recursive call to serializing an object
05:15user5252join #eclim
05:15user5252:)
05:19Guest96645what do you do if you want a lazy version of reapetedly?
05:20MJB47repeatedly is lazy?
05:20MJB47https://clojuredocs.org/clojure.core/repeatedly
05:23Guest96645MJB47: yea sorry i was thrown off becaus it said assumably with side-effects
05:24MJB47thats just because if there werent side effects you would rather use repeat
05:24MJB47as it would be more efficient
05:25Guest96645MJB47: really? repeat always returns the same number tho even if you give it a fuction, where as repeatedly calls the function over and over?
05:25MJB47yes, but if there were no side effects, then the function would always return the same value
05:25Guest96645MJB47: ah i see
05:27thinkingslowlyAnyone seen this error with clj-http? "SSL peer shut down incorrectly"?
05:59hamidHi, Does anyone know how can I pass JVM options to "boot" in order to install it? I want use socks proxy so I have to pass socks options. When I manipulate the boot.sh file it says the jar file(probably the boot.sh itself) is corrupted.
08:07mmi(eval :foo)
08:18keep_learningHello everyone
08:18keep_learningI am trying to extract :href from ({:tag :div, :attrs {:class "pageNumbers"}, :content ({:tag :span, :attrs {:onclick "ta.trackEventOnPage('STANDARD_PAGINATION', 'curpage', '1', 0);", :class "pageNum first current", :data-offset "0", :data-page-number "1"}, :content ("1")} {:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'page', '2', 0);", :class "pageNum taLnk", :data-offset "30", :data-
08:18keep_learningpage-number "2", :href "/Hotels-g297684-oa30-Lucknow_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("2")} {:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'last', '3', 0);", :class "pageNum last taLnk", :data-offset "60", :data-page-number "3", :href "/Hotels-g297684-oa60-Lucknow_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("3")})})
08:18keep_learningusing enlive
08:20keep_learningI am trying to extract the list from ( -> html-resource (select [:content]) (select :href))
08:20keep_learningis giving empty list
08:36keep_learningI have filtered the data little bit
08:36keep_learningbut still getting error
08:36keep_learningMy data is
08:36keep_learning({:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'page', '2', 0);", :class "pageNum taLnk", :data-offset "30", :data-page-number "2", :href "/Hotels-g297684-oa30-Lucknow_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("2")} {:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'last', '3', 0);", :class "pageNum last taLnk", :data
08:36keep_learning-offset "60", :data-page-number "3", :href "/Hotels-g297684-oa60-Lucknow_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("3")})
08:37keep_learningI am trying to use map to fetch :href
08:37keep_learning(map :href) on this list
08:37keep_learningbut getting ClassCastException java.lang.String cannot be cast to clojure.lang.IFn user/eval13851 (form-init148529210888258716.clj:1)
08:39ridcully_please provide some complete code+error on refheap/...; also isn't selected used to select items in a form?
08:50benjyz1hi. I'm working on a simple problem
08:50benjyz1selecting from a map
08:50benjyz1,(def x [{:a :foo} {:a :bar}])
08:50clojurebot#'sandbox/x
08:51benjyz1I want => [:foo :bar]
08:51MJB47,(vals x)
08:51clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry>
08:52ridcully_,(map :a x)
08:52MJB47,(apply vals x)
08:52clojurebot(:foo :bar)
08:52clojurebot#error {\n :cause "Wrong number of args (2) passed to: core/vals"\n :via\n [{:type clojure.lang.ArityException\n :message "Wrong number of args (2) passed to: core/vals"\n :at [clojure.lang.AFn throwArity "AFn.java" 429]}]\n :trace\n [[clojure.lang.AFn throwArity "AFn.java" 429]\n [clojure.lang.AFn invoke "AFn.java" 36]\n [clojure.lang.AFn applyToHelper "AFn.java" 156]\n [clojure.lang.AFn a...
08:52MJB47im stupid nvm
08:52MJB47go with ridcully_ method
08:52ridcully_well... OPs intention is not perfectly clear :)
08:53benjyz1that simple, eh... thanks
08:55benjyz1,(def x [{:a {:x :foo}} {:a {:x :bar}}])
08:55clojurebot#'sandbox/x
08:55benjyz1(map :a x)
08:55benjyz1,(map :a x)
08:55clojurebot({:x :foo} {:x :bar})
08:55benjyz1,(map (map :a x) :x)
08:55clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword>
08:55benjyz1,(map :x (map :a x)
08:56clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
08:56benjyz1,(def y [{:a {:x :foo}} {:a {:x :bar}}])
08:56clojurebot#'sandbox/y
08:56benjyz1,(map :x (map :a y)
08:56clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
08:56benjyz1,(map :x (map :a y))
08:56clojurebot(:foo :bar)
08:57MJB47,(map #(get-in % [:a :x]) y)
08:57clojurebot(:foo :bar)
08:57ridcully_,(map (comp :x :a) y)
08:57clojurebot(:foo :bar)
08:58ridcully_if this grows in complexity, also have a look at specter
09:01Idoiw9AxHow can I query all entities satisfying the given predicate from datascript db without counting the same pairs two times?
09:01BRODUSim having trouble mocking one of my dependencies, i think if i adopted style 2 here: http://pastebin.com/M8EeK0Nc mocking would be easier, but im wondering if thats bad style, any advice?
09:01Idoiw9AxSo if (pred x y) is true and (pred y x), I want to return only [x y] or [y x], but not both.
09:03Idoiw9Ax*is true too
09:28drorbemetHi, currently I am looking for a way to disown a forked shell process using clojure.java.shell/sh or org.clojars.hozumi/clj-commons-exec/sh-pipe. In a linux bash terminal I am using command & disown
10:09troydmis there a version of pmap that optionally takes number of processes to use
10:11troydmlike standard version has this Runtime getRuntime availableProcessors + 2 line but this isn't enough for me
10:51keep_learning,(map (comp :href :attrs) '({:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'page', '2', 0);", :class "pageNum taLnk", :data-offset "30", :data-page-number "2", :href "/Hotels-g297685-oa30-Varanasi_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("2")} {:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'last', '3', 0);", :class
10:51keep_learning"pageNum last taLnk", :data-offset "60", :data-page-number "3", :href "/Hotels-g297685-oa60-Varanasi_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("3")}))
10:51clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:53keep_learning,(map (comp :href :attrs) '({:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'page', '2', 0);", :class "pageNum taLnk", :data-offset "30", :data-page-number "2", :href "/Hotels-g297685-oa30-Varanasi_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("2")} {:tag :a, :attrs {:onclick "ta.hac.filters.paging(this, event); ta.trackEventOnPage('STANDARD_PAGINATION', 'last', '3', 0);", :class
10:53keep_learning"pageNum last taLnk", :data-offset "60", :data-page-number "3", :href "/Hotels-g297685-oa60-Varanasi_Uttar_Pradesh-Hotels.html#ACCOM_OVERVIEW"}, :content ("3")}))
10:53clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:57keep_learninghttp://lpaste.net/147584
10:57keep_learningCould some one please tell me why second part is not working
10:58keep_learning(map (comp :href :attirs) '(element from list)) is working fine
10:59keep_learning(-> '(element from list) (map (comp :href :attrs))) is not working
10:59keep_learningI am getting
10:59keep_learningIllegalArgumentException Don't know how to create ISeq from: clojure.core$comp$fn__4495 clojure.lang.RT.seqFrom (RT.java:528)
10:59MJB47use ->>
11:00MJB47-> places the argument as the first argument in the next function
11:00MJB47->> places it as the last
11:00keep_learningMJB47, Thank you
11:00poweredkeep_learning, macroexpand is a useful function to see what is actually getting generated
11:01keep_learningMJB47, so if I write (-> '(element from list) (map (comp :href :attrs) %0)) should work
11:01keep_learningMJB47, I get your point
11:01MJB47no
11:02MJB47it would expand to
11:02MJB47(map '(element from list) (comp ...))
11:02MJB47which is obviously not what you want
11:02imojinflakkhey all
11:03keep_learningMJB47, Thank you
11:09keep_learningMJB47, (->> (-> (java.io.StringReader. page)
11:09keep_learning ehtml/html-resource
11:09keep_learning (ehtml/select [:div.pageNumbers :a]))
11:09keep_learning (map (comp :href :attrs)))
11:09keep_learningI have written it like this
11:09keep_learningis it idiomatic clojure ?
11:11TimMckeep_learning: A little funky. Try using as->, like so: https://www.refheap.com/112979
11:12TimMcThat mixing of -> and ->> can be difficult to read.
11:12ridcully_i'd not use -> and ->> together. you can as well just wrote (map ... (-> ...)) here. or just use a let
11:12keep_learningTimMc, Thank you
11:13ridcully_s/wro/wri/
11:31keep_learning,(str "Hello" "World")
11:31clojurebot"HelloWorld"
11:32keep_learning,(map (fn [x] (str "hello" x)) '("how" "are"))
11:32clojurebot("hellohow" "helloare")
11:33keep_learning,(map (str "hello" %) '("hello", "world"))
11:33clojurebot#error {\n :cause "Unable to resolve symbol: % in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: % in this context"\n ...
11:33TimMckeep_learning: Missing a #
13:04orzHi everyone, I'm writing a server app that accepts photo uploads from mobile phones, and it turns out images uploaded from phones are big (~3mb)
13:04orzCan anyone reccomend a library that will let me reduce the size of these images on disk after the file is uploaded?
13:04orzLike, some kind of jpeg quality reduction
13:05noncomwell agaik java imageio can do
13:05noncomor just zip them
13:05noncombut also there are things like http://fiji.sc/Clojure_Scripting
13:05noncom*afaik
13:06ridcully_zipping jpegs ?
13:06justin_smithyeah, imageio isn't super hard to use
13:06engblomI am trying to use gpio-clj to program my raspberry pi. (def port (open-port 4)) gives CompilerException java.io.FileNotFoundException: /sys/class/gpio/gpio4/value (Permission denied), compiling:(form-init7023382170868619027.clj:1:11)
13:07ridcully_engblom: your current user can not access that file or the directiory to that file
13:07noncomridcully_: well yeah, i assume that if orz needs some more compression, then there is a room for it. if not, then jpeg is not really reducible and the question cannot be really answered positively
13:07justin_smithengblom: sounds like your user doesn't have permission to access the gpio?
13:07engblomI am having permission to write to that file and I have tested it with "echo 1 >/sys/class/gpio/gpio4/value"
13:07justin_smithOK
13:08orzI just want to reduce the quality because my app serves the images over http
13:08orzand when I have 10 images loading at 3mb each that's slow as hell
13:09justin_smithyeah, for that I'd use imageio to reduce the image quality and/or size
13:09noncomyeah, java imageio or fiji (imagej)... there can be others ofcourse
13:09orzCool, I'll look into those, thanks!
13:10justin_smithor hey, you could even make the browser side do the shrinking of the image before uploading
13:10noncombroswer side is better
13:10noncomlet the user computer do the job: )
13:10engblom-rwxrwx--- 1 root gpio 4096 Dec 21 20:05 /sys/class/gpio/gpio4/value
13:11engblomI am in the gpio group, and thus I am able to pipe 1 and 0 to /sys/class/gpio/gpio4/value
13:11orzYou mean with javascript somehow?
13:11justin_smithorz: right
13:11engblomI just do not understand why I am not able to open this file through gpio-clj
13:11orzRight now web uploads happen with a standard form file upload
13:11noncomengblom: are you able to open it at all from your jvm process?
13:11orzwould I have to abandon that pattern and make the upload happen though JS then?
13:11noncomengblom: try with java.io.File. first or slurp/spit
13:12justin_smithengblom: also you could double check that java is running as your user (I know it's weird if it isn't, but it's possible...)
13:15engblomjustin_smith: Yes, the java process is run by me, I checked up with ps.
13:15engblomnoncom: (slurp "/sys/class/gpio/gpio4/value") works well and returns the value from it
13:15noncomengblom: ok, reading works, what about writing
13:17engblomnoncom: Apparently spitting to the file fails with the same message
13:17noncomengblom: then it's the jvm thing
13:17noncomyou could google for this kind of thing with jvms. i remember seeing similar things
13:17ridcully_just to have it asked. have you added yourself to gpio _after_ you have started that jvm process and are you testing your echos in a new terminal?
13:17noncomalso, all kinds of ssh-related weirdnesses are possible
13:18agentmeerkatHi all, work has asked me to look into a change control system. I've looked at some different ones online, but wanted to see if anyone found a change control system that didn't make them want to jump out a window?
13:18engblomReally strange as the file got " -rwxrwx--- 1 root gpio 4096 Dec 21 20:05 /sys/class/gpio/gpio4/value". If I am able to read, I should also be able to write
13:18justin_smithengblom: it could be something else it is trying to do
13:18justin_smitheg. flush
13:18noncomengblom: reading and writing are different permissions ? or no?
13:19justin_smithit could be using some weird system call that works for files but not for /sys/ pseudo-files
13:19justin_smithnoncom: the read and write perms there are identical for all users
13:19noncomalso: https://github.com/peterschwarz/clj-gpio/blob/master/src/main/clojure/gpio/core.clj#L127 - you can try to see what's there and search line-per-line
13:19noncomjustin_smith: oh ok
13:20noncomor, if spit gives the same error, then its just the jvm
13:20noncomalso, ridcully_ said a thing that could be
13:21engblomridcully_: I have alwasys been in the gpio group. I even rebooted the raspberry just to make sure nothing is messed up
13:22ridcully_also didnt the jvm have some security stuff that that restricts the sandbox? well i doubt, that it would be enabled on the pi... also se-linux, systrace, whatthecoolkidsusetoday
13:23ridcully_my pi is rotting in a box... to lazy to check myself ;P
13:28TimMcengblom: What pi are you using, out of curiosity?
13:28TimMcI tried running Java on my B and it took about 4 minutes to start up a lein repl. :-P
13:29justin_smithTimMc: what about just starting clojure.jar?
13:29engblomTimMc: Pi2
13:35engblomjustin_smith: I am running the most recent Raspbian-Lite
14:08rhg135Clojure.jar works splendidly on a piB
14:09rhg135Takes a few seconds to start
14:13TimMcMaybe they have a better JVM for it now...
14:16rhg135That limited ram
15:18TimMcYou mean I actually have to care about JVM heap size settings? This is preposterous! *stalks off*
15:19arrdemseeing as TimMc is still reachable he can't have stalked far
15:20rhg135The default is not too big anyway
15:24{blake}cfleming_: Trying to buy...checkout not working...
15:37arrdemwhy aren't you taking our money dot jpeg
15:41{blake}I might as well just set it on fire.
16:24benjyz1hi. I'm working with channels over TCP and edn
16:24benjyz1anyone working with libraries on TCP? all I've seen is based on netty
16:25justin_smiththere's sente for websockets, which is one way of setting up a tcp socket
16:25justin_smithtransit tends to work nicely for serializing / deserializing edn to go over tcp
16:28cfleming_{blake} That's not good - what's the error you're getting?
16:28cfleming_{blake} It's just declining?
16:29{blake}In most browsers it's just never coming back.
16:29benjyz1jusint_smith: thanks. I mean non HTTP which also has some constructs for the streams used
16:29{blake}One of them gets a "connection refused", I think? Let me chcek.
16:29{blake}Er, Chrome ges "Connection reset"
16:30{blake}"Powered by paddle" in the lower left.
16:30benjyz1not only a data-format but channels on each side e.g.
16:30justin_smithbenjyz1: websockets are non-http
16:30justin_smithI mean they may not be what you want at all, but they are not an http request
16:31benjyz1ok, I'm using plain java sockets
16:31justin_smithbenjyz1: aleph has some nice stuff for raw sockets
16:31benjyz1right. that's the netty library underneath, which has channel and pipeline semantics
16:31justin_smithalso manifold, by the same author
16:31justin_smithOK
16:32benjyz1yes, I like aleph, but I don't know netty etc. and so its hard to understand
16:32benjyz1so I'm experimenting with just java sockets and works well for me. just wondering whether someone has done something like this
16:34justin_smithbenjyz1: where aleph and manifold come in is if you plan on having more than a few client connections, and need high throughput. They deal with things like backpressure and thread management and such that become concerns when you scale up.
16:35benjyz1my concern is not performance, but complex semantics
16:35benjyz1so I need to create a kind of DSL for users which they can use
16:41justin_smithbenjyz1: manifold also gives a simpler semantics, eg. it can tie incoming messages to callbacks or core.async
17:01visofhi guys
17:01visofhow can i split string at n whitespaces?
17:02MJB47https://clojuredocs.org/clojure.string/split
17:02visofi know slipt
17:02visofsplit
17:02visofhow can i split each 200 spaces?
17:02MJB47it takes an optional third argument
17:02MJB47for maximum number of splits
17:05visofMJB47: i mean if i have string which has pattern as each 200 spaces there is word and i want to split at each 200 spaces?
17:05MJB47oh i see
17:05justin_smithvisof: then make a 200 space regex?
17:05visof,(clojure.string/split "hello world", #"\s\s\s")
17:06clojurebot["hello" "world"]
17:06visofjustin_smith: how? write it?
17:06visof,(clojure.string/split "hello world", #"\s\s\s\s\s\s\s\s\s\s")
17:06clojurebot["hello" "world"]
17:06ridcully_,(clojure.string/split "A B C D" #"[ ]{2,}")
17:06clojurebot["A B" "C D"]
17:07visof,(clojure.string/split "hello world" #"[ ]{10,}")
17:07clojurebot["hello" "world"]
17:07visofridcully_: thanks man
17:07visof#"[ ]{10,}" what is refer?
17:07ridcully_that's n and more
17:07ridcully_might not, what you want
17:07justin_smithvisof: heh, I remembered that specifying exactly N repititions could be done in a regex, just forgot the syntax, luckilly ridcully_ remembered
17:08justin_smithridcully_: would {10,10} be exactly 10?
17:08justin_smithor just {10} or?
17:09ridcully_it is, but not sure, what OP wants here
17:09ridcully_(clojure.string/split "A B C D C" #"[ ]{2}")
17:09ridcully_,(clojure.string/split "A B C D C" #"[ ]{2}")
17:09clojurebot["A B" "C D" " C"]
17:09ridcully_see the second C
18:29devth_i want a data structure backed by an edn file where writes are persisted back to disk. (e.g. read/write config files)
18:29devthand it should maintain whitespace and comments :)
18:31devthand the ability to pass around a cursor into a specific part that also allows writes
18:32devthdoes anyone else want that? does it exist? should i build it?
18:41spiedendevth: hmm. why not a database?
18:42spiedendevth: reminds me of tie in perl
18:42devthhmm. well it's configuration for my chat bot
18:42devthpart of which contains db connection info :)
18:43devththe user can tweak settings through interacting with the bot itself, which then need to be written back
18:43spiedenheh, sounds like something your provisioning would generate and write out
18:43spiedenah hrm
18:53justin_smithdevth: persisting changes to data into a file has all the problems that coordinating change across threads has, plus extra probles introduced by the OS / filesystem layer
18:53devthsingle resource / single lock ?
18:54devth,(doc locking)
18:54clojurebot"([x & body]); Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances."
18:55devthversion 2: support cloud-based storage, retries and all that fun :)
18:57devthanyway it's a great place to play with failure. low risk, low impact, mostly for fun
18:57justin_smithdevth: sure, locks work as long as you know you won't get a deadlock (eg. what happens if something that is modifying the file (has the lock) calls something else that wants to modify the file (waits for the lock)) - it's easy to get an infinite stall this way
18:57devthyeah
18:58devthwhat happens if an agent tries to do that? (call another fn that uses that agent?)
18:58justin_smiththe action sent to the agent goes into a queue and cannot be carried out until the other queued actions finish
18:59justin_smithagents are async
18:59justin_smithso you send f to a, a carries out f, mid f you send g to a, a waits until it finishes with f, then starts g
19:01devthnice. so that could be used as a locking mechanism that avoids deadlocks
19:03justin_smithsure, you could use a single agent - but it would be up to you to make sure the file access is always tied to that one agent
19:03justin_smithperhaps a watcher on that agent that does the file writes?
19:04devthyep
19:06justin_smithadd-watch that is
19:26spiedenyeah that sounds good
19:29myogenichey, can anyone help an OO programmer with a breadth first n-ary tree type problem in clojure?
19:34arrdemmyogenic: dunno if I can help but by all means describe the problem more
19:34arrdem"ask to ask" applies
19:34amalloywell, "don't ask to ask"
19:34myogenichah my bad
19:35arrdemall good
19:37myogenicbasically I'm primitively modelling the movement of people from one city to another, so people from city A will move to all the surrounding cities and so on
19:38myogenicso i'm basically creating a breadth first n-ary tree
19:38myogenicbut I'm struggling with passing progressive results on due to immutability
19:38myogenicthen there's accumalating the results at the end
19:39myogenicwould a loop/recur structure be generally the way to go for a problem like this?
19:39justin_smithmyogenic: the general approach is to turn your mutable item into a block local binding - like a loop binding
19:39justin_smithyeah
19:39justin_smithso you pass the new value to each iteration
19:40justin_smiththe same can be done with reduce, if your input is a sequence
19:40TEttingerthere's a bunch of ways to do it, and loop/recur is sometimes the best suited.
19:40TEttingeriterate can somewhat rarely be a good fit.
19:40justin_smithit's definitely the version that translates easiest from the imperative one
19:40justin_smithtrue!
19:41myogeniccan I pastebin what I have so far? feels like im hacking a bit
19:41TEttingersure
19:41TEttingerrefheap is common, but we don't care what pastebin you use
19:42myogenicI've kinda stopped mid-line, it's totally not finished but just wondering if I'm on the right lines at all https://www.refheap.com/45d6a4e3408e377210db2c731
19:44myogenicI think the dotimes is the wrong choice, I need that to iterate through the surrounding counties, which basically act as children nodes to city A
19:44justin_smithanyone else having trouble connecting to refheap right now?
19:45TEttingercalling things that modify in dotimes won't really work
19:45TEttinger(or that modify immutable data)
19:45myogenicyeah I know it was kinda wrong
19:45TEttingeryou may want for
19:46justin_smithbut for won't pass updates to the next iteration either
19:46TEttinger,(for [n (range 5)] (str "thing " n))
19:46clojurebot("thing 0" "thing 1" "thing 2" "thing 3" "thing 4")
19:47justin_smithmyogenic: you can't recur to a loop from inside dotimes, because nothing inside dotimes can be in the loop's tail position
19:48justin_smithmyogenic: the idea with a tail recursion is that it can be replaced with a regular for-loop style goto plus a variable update, without consuming stack
19:48myogenicassign-pop-split will return a structure like ([524 1001] [141 1002]) which is basically ([population-count county-id]), I need to make a recursive call for each tupple
19:49justin_smithmyogenic: if it's not in the tail position you need to do the regular (non optimized) kind of direct recursion
19:49myogenicAhh I see
19:49justin_smithbut, you can usually find a transform that puts more data into the loop bindings, and then allows not consuming stack
19:50myogenicso would a for work in place of that dotimes?
19:50myogenicor do I run into the same issue?
19:50justin_smithmyogenic: also, peek/pop in clojure are not mutations, and peek returns the top of the stack, pop returns everything but the top
19:51justin_smithmyogenic: as long as the stack doesn't go deep enough to cause an error, a for would probably work
19:52myogenicHow would I pass the structure returned from assign-pop-split into the to-move binding since I'm already passing it to (conj res ...)
19:53myogenicdo I have to introduce a let if I want to reference the result of assign-pop-split more than once?
20:02justin_smithmyogenic: let is the straightforward way to do that, yeah
20:02myogenicjustin_smith okay thanks man, I'll keep trying with this then, doesn't look horrible does it?
20:03justin_smithmyogenic: many small errors, typical newcomer mistakes, all should be easy to fix
20:03justin_smithdon't be afraid to ask more questions, and definitely look for a book or at least check out some simple exercises like 4clojure.com
20:04myogenicjustin_smith: thanks a lot, I have the o'reilly book and I've done a couple of questions on 4clojure :D
20:04justin_smithcool, sounds like you are on the right track
20:22slestermyogenic: welcome!
20:25rritochHi, what is the best way to handle the clojure dependency in a publicly released library (clojars) generated with leiningen? I currently have :dependencies [[org.clojure/clojure "1.5.1"]] in my code but I'm thinking that may conflict with other libraries so should I move that to the dev profile, remove it entirely, etc.. so it'll work with any version of clojure and not override higher versions?
20:32rritochLooking at core.async & cljs-time it seems that the way I have it defined is common, it just seems wrong.
20:33futurorritoch: Why?
20:34futuroshouldn't the language handle the dependency graph and only including something once?
20:34rritochfuturo: Because it's common to need to add a clojure exclusion when pulling in libraries when libraries include the clojure dependency that overrides the version the developer requires.
20:35rritochfuturo: Yes, the problem is it doesn't always include the intended version, mostly because of libraries like this one that can cause the wrong decision to be made and 1.5.1 loaded instead of the latest version (for example).
20:35futurorritoch: hmm...I can see what you mean
20:38rritochAnyhow, I'm just prepping a new release of clj-nativedep to include explicit mac detection support.
20:50rritochAre codox & marginalia still the "standard" for documentation?
20:58rritochApparently codox still doesn't work on windows
23:11mindbender1What does a process mean in the context used on the transducers page at http://clojure.org/transducers?