workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
the point-in-time is the key part there
2017-10-24T16:39:52.000433
Rebeca
clojurians
clojure
Yep that sounds familiar <@Fritz>
2017-10-24T16:39:56.000179
Shira
clojurians
clojure
<@Rebeca> got it, thanks <@Virgil> I just didn't want to follow through the talk and not understand this :slightly_smiling_face: I'll keep it simple this will be an introductory talk
2017-10-24T16:40:52.000719
Carline
clojurians
clojure
As discussed in <https://www.youtube.com/watch?v=9N7xM40fio0&amp;list=PLZdCLR02grLqCR8EKuil8NrffZuTl0kwL&amp;index=32> "nobody" ever uses agents :slightly_smiling_face:
2017-10-24T16:41:12.000231
Virgil
clojurians
clojure
A talk very much worth watching though.
2017-10-24T16:41:36.000236
Virgil
clojurians
clojure
I think a more interesting thing, if you want to contrast actors with the clojure eco-system, is to contrast them to core.async.
2017-10-24T16:42:14.000687
Virgil
clojurians
clojure
Ah! Haven't seen that one yet, it's definitely on my list.
2017-10-24T16:42:18.000431
Carline
clojurians
clojure
<@Fritz> <https://github.com/technomancy/leiningen/commit/809c7d33ea5ef2ffefa1dc31ace839155955600d>
2017-10-24T16:43:13.000149
Shira
clojurians
clojure
Sure, I know for a fact that I'll have a few actors fans in the audience so...
2017-10-24T16:43:23.000370
Carline
clojurians
clojure
<http://www.dalnefre.com/wp/2010/06/actors-in-clojure-why-not/>
2017-10-24T16:44:32.000235
Virgil
clojurians
clojure
<@Shira> kinda arse when its a 100% internal repo tho
2017-10-24T16:45:48.000290
Fritz
clojurians
clojure
I remember reading this one a few months back and not understanding every bits of the follow up discussion in comments with "Jeff Rose" is really interesting.
2017-10-24T16:46:29.000606
Carline
clojurians
clojure
Well there is a workaround, in the FAQ. What's the alternative if you want to help people avoid talking to HTTP repos in the general case?
2017-10-24T17:00:06.000731
Shira
clojurians
clojure
<@Carline> <http://Clojure.org|Clojure.org> has a rather good overview on actors and "why not"
2017-10-24T17:05:48.000315
Sandy
clojurians
clojure
<https://clojure.org/about/state#actors>
2017-10-24T17:06:05.000593
Sandy
clojurians
clojure
And btw, <http://dalnefre.com|dalnefre.com> is a fantastic site, some really mind-blowing stuff on there. Not stuff I'd use at work everyday, but cool from a geek perspective
2017-10-24T17:08:18.000214
Sandy
clojurians
clojure
I've read that page on <http://clojure.org|clojure.org> a few times already and must admit I haven't fully made my mind up about this... :sweat_smile:
2017-10-24T17:13:50.000218
Carline
clojurians
clojure
I just don't use there concepts enough to get a good picture that is based on experience and not on theory and acquiescence bias
2017-10-24T17:15:55.000364
Carline
clojurians
clojure
I suppose you could run a local HTTPS proxy..
2017-10-24T17:18:03.000298
Fritz
clojurians
clojure
hi! I’m having problems with ring/compojure since upgrading leiningen. If I create a new app with &gt; Lein new compojure testapp it creates the app like it should. But if I try to run it with &gt; lein ring server I get this error “java.lang.RuntimeException: No reader function for tag object”
2017-10-24T17:36:19.000278
Leota
clojurians
clojure
any idea how to fix this?
2017-10-24T17:36:24.000051
Leota
clojurians
clojure
Is there a built-in "`split-around`" function? Sort of the opposite of `split-at`...I'm trying to say "keep the closest X values around Y in the given seq"
2017-10-24T18:25:24.000229
Daniele
clojurians
clojure
hey all, i ran into an issue with this foor loop ```(for [gender performer-genders name performer-names instrument instrument-names mood moods] (do stuff))```
2017-10-24T18:57:26.000001
Kathie
clojurians
clojure
basically, if any of those lists are empty, then the loop won't iterate over anything, which is expected behavior
2017-10-24T18:58:03.000110
Kathie
clojurians
clojure
the looping behavior im looking for is if one of the list are empty, instead of not looping over anything, do the iteration over the other 3 lists, just ignoring the empty list (binding the value in each iteration to `nil` or something)
2017-10-24T18:58:51.000023
Kathie
clojurians
clojure
does anyone know of a good way to accomplish that
2017-10-24T18:59:07.000396
Kathie
clojurians
clojure
oh wait
2017-10-24T18:59:40.000178
Kathie
clojurians
clojure
i guess i could just check to see if those lists are empty, and if so just bind the variables to `[nil]` seems like that should work
2017-10-24T19:00:09.000189
Kathie
clojurians
clojure
for isn't a loop, it's a list comprehension
2017-10-24T19:01:08.000175
Margaret
clojurians
clojure
if you want a loop, use loop
2017-10-24T19:01:13.000065
Margaret
clojurians
clojure
in particular where you say `(do stuff)` - if your intention is to do anything with a side effect rather than generating data, for is the wrong construct
2017-10-24T19:02:26.000167
Margaret
clojurians
clojure
nah that's just aggregating data within a reduce function
2017-10-24T19:03:08.000126
Kathie
clojurians
clojure
i guess `loop` would be better though since it'd have more explicit semantics then `for`
2017-10-24T19:03:28.000050
Kathie
clojurians
clojure
can someone help me. I'm trying to generate csv file on the fly. using `<http://ring.util.io/piped-input-stream|ring.util.io/piped-input-stream>`. and it works when I'm doing it with `get` request. In my case though I have to do it with post request (because data gets composed via om.next/parser). So this, kinda works: ``` (defn download-csv [req] (let [result (run-om-query (:body req) (:user req)) query-k (-&gt; req :body ffirst) data (get-in result [query-k :data])] {:status 200 :headers {"Content-Type" "text/csv" "Content-disposition" "attachment; filename=filename.csv"} :body (ring-io/piped-input-stream (fn [out] (let [columns (-&gt; data first keys)] (with-open [wtr (io/writer out)] (csv/write-csv wtr [columns]) (doseq [row data] (csv/write-csv wtr [(map row columns)]))))))})) ``` but browser doesn't "recognize it". no "dowload to" popup comes up, etc.
2017-10-24T20:28:35.000044
Clementina
clojurians
clojure
what's missing?
2017-10-24T20:29:08.000055
Clementina
clojurians
clojure
I have a feeling that this might be not possible in the same request ;(
2017-10-24T20:32:22.000281
Clementina
clojurians
clojure
if it's "post"
2017-10-24T20:32:27.000175
Clementina
clojurians
clojure
If you just drop a valid csv string in there does it work?
2017-10-24T20:32:37.000192
Shavonda
clojurians
clojure
the content it returns from server is fine - it is correct csv. but browser doesn't recognize it as "file download"
2017-10-24T20:33:16.000007
Clementina
clojurians
clojure
as I said - if I ignore the om.parser part, and generate just random csv and use `get`, instead of `post` it works just fine - I don't even have to set the correct content-type and other headers
2017-10-24T20:34:51.000015
Clementina
clojurians
clojure
but I need to use post
2017-10-24T20:34:57.000220
Clementina
clojurians
clojure
<@Clementina> have you tried setting the content-type to application/download
2017-10-24T21:08:31.000037
Blair
clojurians
clojure
I did. it's still didn't work
2017-10-24T21:34:49.000076
Clementina
clojurians
clojure
i use <https://github.com/eligrey/FileSaver.js> but that is browser side, don't know if that helps
2017-10-24T23:49:18.000140
Donella
clojurians
clojure
has a cljsjs wrapper
2017-10-24T23:49:23.000061
Donella
clojurians
clojure
I like using emacs for clojure, is there a way to do code autocompletion, i'm using inferior-clojure module
2017-10-25T05:01:10.000011
Corazon
clojurians
clojure
yes, by using CIDER :wink:
2017-10-25T05:11:12.000046
Danuta
clojurians
clojure
ok, cool. Will check
2017-10-25T05:26:34.000176
Corazon
clojurians
clojure
How about treating vars like ns alias so we can use shorthand for creating keywords associated with a fn like ::myfn/props
2017-10-25T06:19:42.000363
Wendi
clojurians
clojure
does anyone have any experience with hugsql (<https://www.hugsql.org/>)? i'm trying to debug some tricky sql statements and i'd like to see what sql statement hugsql is generating under the hood.
2017-10-25T06:38:00.000078
Zola
clojurians
clojure
``` ;; For most HugSQL usage, you will not need the sqlvec functions. ;; However, sqlvec versions are useful during development and ;; for advanced usage with database functions. (hugsql/def-sqlvec-fns "princess_bride/db/sql/characters.sql") ``` take a look at def-sqlvec-fns
2017-10-25T06:39:42.000054
Efrain
clojurians
clojure
For myself I found it very useful
2017-10-25T06:40:05.000387
Efrain
clojurians
clojure
cheers!
2017-10-25T06:42:58.000275
Zola
clojurians
clojure
did you end up resolving this?
2017-10-25T07:36:54.000141
Candace
clojurians
clojure
I ran into this issue the other day and I think I had to downgrade back to 2.6.* to fix it
2017-10-25T07:37:07.000120
Candace
clojurians
clojure
<@Zola> the best option would be to check your DB logs. Configure your database to log all the queries into a file. Or you may run the database not as a service but as process. So you’ll see all the queries in the console. For postgres, start it with `postgres -E -D /usr/local/var/postgres` (on Mac)
2017-10-25T08:09:05.000230
Verna
clojurians
clojure
elegant solution! thanks
2017-10-25T08:11:39.000144
Zola
clojurians
clojure
what is the clojure equiv of C's __FILE__ ?
2017-10-25T09:21:45.000199
Berry
clojurians
clojure
I want some debug msgs to dump __FILE__ so it's easy to figure out where they are coming from
2017-10-25T09:21:58.000485
Berry
clojurians
clojure
You can use `(meta #'any-function-or-variable) ;; =&gt; {:line 13, :column 1, :file "path/to/file.clj", :name var-name, :ns #namespace[namespace-where-var-defined]}` :file is related to your classpath
2017-10-25T09:44:30.000383
Efrain
clojurians
clojure
<https://clojure.org/reference/metadata> there are more information about this
2017-10-25T09:45:04.000230
Efrain
clojurians
clojure
<@Berry> you mean like how tools.logging does?
2017-10-25T10:25:14.000898
Jodie
clojurians
clojure
<@Jodie>: not quite tools.logging: it's ... I'm looking at this cljs app, I see this div, whose body says "todo" -- I want to kow where this "todo" is coming from -- so I grep for "todo" in my source tree -- and I get many matches, so I'd really prefer is that div said "todo: foobart.clj: line 74" instead of just "todo"
2017-10-25T11:31:52.000164
Berry
clojurians
clojure
<@Berry> you need a macro which looks at `*ns*`, which is how this is done in tools logging
2017-10-25T11:32:30.000144
Jodie
clojurians
clojure
<@Jodie>, <@Efrain>: going with <@Efrain>’s meta solution :slightly_smiling_face:
2017-10-25T11:37:47.000375
Berry
clojurians
clojure
That means they need a reference to the function they are in, no?
2017-10-25T11:45:05.000913
Jodie
clojurians
clojure
I know what I ca ndo (io/copy in out) -- however, is there a nice way to inject a "gunzip" in the middle of it?
2017-10-25T14:19:47.000231
Berry
clojurians
clojure
so the input is a *.gz stream, and for the output, I want an uncompressed stream
2017-10-25T14:19:59.000523
Berry
clojurians
clojure
<@Berry> GZIPInputStream <https://docs.oracle.com/javase/7/docs/api/java/util/zip/GZIPInputStream.html>
2017-10-25T14:24:15.000837
Margaret
clojurians
clojure
very easy to use in my experience
2017-10-25T14:25:11.000319
Margaret
clojurians
clojure
I was just doing this and found a cookbook recipe: <https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-21_read-write-gzip.asciidoc>
2017-10-25T14:25:45.000130
Marx
clojurians
clojure
nice, I did not reailze you could just 'wrap' java.util.zip.GZIPInputStream. and have it take care of the rest
2017-10-25T14:40:26.000472
Berry
clojurians
clojure
I am looking for advice to connect to a Mysql Database. I am using jbdc and mysql/mysql-connector-java plugin to run a simple query to my database. however, the connection does not seem to connect (to a my local environment) and not able to pull any data. Does anyone know any helpful tutoriasl or walk-throughs to help me connect to a db. error messages: 1. {user=******, password=******}, propertyCycle -&gt; 0, testConnectionOnCheckin -&gt; false, testConnectionOnCheckout -&gt; false, unreturnedConnectionTimeout -&gt; 0, usesTraditionalReflectiveProxies -&gt; false ] 2. Cannot JSON encode object of class: class [B: [B@2466ff66
2017-10-25T15:26:58.000486
Lisha
clojurians
clojure
I would look at the stacktrace for 2, my bet is you have other library loaded that globally extends jdbc to automatically json encode things
2017-10-25T15:46:06.000054
Rebeca
clojurians
clojure
1 looks like something from a connection pooling library, which again leads me to believe you are dealing with a much larger pile of code then your question suggests
2017-10-25T15:46:40.000352
Rebeca
clojurians
clojure
Does anyone know if there's a 'Storm' channel? Specifically using Clojure spouts/bolts with Storm.
2017-10-25T16:47:03.000116
Bibi
clojurians
clojure
There is not. You might as well ask questions here and see if anyone responds...
2017-10-25T17:18:52.000053
Daniell
clojurians
clojure
Hey guys, I’m looking for some resources/examples of speccing and unit testing database transactions in Clojure w/ clojure.java.jdbc (for now). Does anyone have a project or resource they can point me to for testing functions for reads, writes, and deletes?
2017-10-25T18:41:31.000030
Sharlene
clojurians
clojure
<@Sharlene> Perhaps start with `clojure.java.jdbc`'s own test suite? Your question is a bit vague so I'm not sure what you're really asking.
2017-10-25T18:42:30.000151
Daniell
clojurians
clojure
(I would also say that "unit testing" and "database transactions" don't really go together -- that's more of an "integration test")
2017-10-25T18:43:19.000062
Daniell
clojurians
clojure
So I have a bunch of functions like `(fetch-from-db ...)`, `(insert-into-db! ...)`, `(delete-from-db! ...), and `(update-in-db!)` that I need to test in order to pass my companies ‘code coverage’ standards and I’m not quite sure how to go about it. Like you said, ‘unit testing’ and ‘database transactions’ don’t really go together. I’m absolutely open to another approach given I’m very new to unit/integration testing as long as they’re automated. The automation is non-negotiable as per company standards.
2017-10-25T18:45:40.000233
Sharlene
clojurians
clojure
if you separate all logic into functional data to data transforms without side effects, the part where you talk to the db can be a very small stub that should already be tested by the library you are using
2017-10-25T18:50:40.000212
Margaret
clojurians
clojure
if they ask you to test interaction with the db lib, then you need integration testing instead of unit testing, and someone needs to hook up a db for that testing environment
2017-10-25T18:51:31.000239
Margaret
clojurians
clojure
This also highlights the disadvantage of writing wrappers for things that `clojure.java.jdbc` already does since you are now creating extra code that you need to "test" to pass an arbitrary code coverage rule :slightly_smiling_face:
2017-10-25T18:52:03.000128
Daniell
clojurians
clojure
(as well as actually creating a layer of logic where regressions can occur)
2017-10-25T18:52:47.000253
Margaret
clojurians
clojure
In order to test that `insert-into-db!` "does the right thing" you'd need to read the data back in and assert it matches your expectations -- which means that your tests rely on `fetch-from-db` which is a bit circular. And how would you test that `fetch-from-db` is doing the right thing? (would you `insert-into-db!` and then `fetch-from-db` and compare the result? Again, circular)
2017-10-25T18:54:17.000042
Daniell
clojurians
clojure
Woah, alright, that’s a lot to take in and process, haha! Thanks for all the input guys! I think I know how I’m going to approach the testing/refactoring for this!
2017-10-25T20:41:54.000213
Sharlene
clojurians
clojure
what's the right way of dealing with clojure.edn/read-string reading strings as symbols? e.g.: ``` (type (clojure.edn/read-string "f8f2b6b3-39b8-4e76-a9f0-fa4a65ee225a")) -&gt; clojure.lang.Symbol ; and I want it to be read as a string ```
2017-10-25T21:11:16.000023
Clementina
clojurians
clojure
it is a string
2017-10-25T21:12:15.000183
Rebeca
clojurians
clojure
you passed it as a string in to read-string
2017-10-25T21:12:38.000085
Rebeca
clojurians
clojure
no, because this works differently `(type (clojure.edn/read-string "\"foo\""))`
2017-10-25T21:13:55.000229
Clementina
clojurians
clojure
sure
2017-10-25T21:14:02.000132
Rebeca
clojurians
clojure
this time it's `java.lang.string`
2017-10-25T21:14:20.000154
Clementina
clojurians
clojure
because in edn notation a `"foo"` is a string, but `foo` is a symbol
2017-10-25T21:14:24.000094
Rebeca
clojurians
clojure
reading `foo` as a string is not edn, so trying to get a library for parsing edn to do it is a fools errand
2017-10-25T21:15:07.000208
Rebeca
clojurians
clojure
so that's what I'm saying, I have no way to know that this "{}" is a map until until it's "read"
2017-10-25T21:16:13.000217
Clementina
clojurians
clojure
I want: "{}" to be read as map; "[]" to be read as vector; "foo" to be read as "foo" -&gt; string
2017-10-25T21:16:53.000098
Clementina
clojurians
clojure
you will have other problem as well, because not all uuids are going to be valid symbols
2017-10-25T21:17:35.000097
Rebeca
clojurians
clojure
likely whatever file you are trying to read is invalid edn
2017-10-25T21:17:46.000178
Rebeca
clojurians
clojure
my guess would be whoever produced it used println instead of prn
2017-10-25T21:18:19.000081
Rebeca