workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
Have better debugging tools? I need parse multi-layer json object, it’s very easy wrong, I use Idea IntelliJ tool.
2017-12-05T21:29:09.000103
Lisabeth
clojurians
clojure
<@Lisabeth> Can you be a bit more specific about what you're stuck on? Are you using Cheshire to parse the JSON?
2017-12-05T22:25:37.000012
Daniell
clojurians
clojure
what's `form`?
2017-12-05T23:14:10.000043
Kristy
clojurians
clojure
in the source I can see it serves some internal `Specize` protocol. still confused
2017-12-05T23:14:39.000181
Kristy
clojurians
clojure
it’s a literal form to use when reporting failures in lieu of the normal form of the spec
2017-12-05T23:23:24.000076
Sonny
clojurians
clojure
typically would not be something you would use as a user (which is why it’s not doc’ed I think)
2017-12-05T23:23:49.000056
Sonny
clojurians
clojure
I think it may actually be vestigial at this point
2017-12-05T23:27:33.000021
Sonny
clojurians
clojure
I don’t think it’s either called or does anything useful now?
2017-12-05T23:31:45.000007
Sonny
clojurians
clojure
thanks for the input <@Sonny>! funny, I was implementing something similar right now, a `check-with-explanation-value` helper
2017-12-05T23:34:15.000059
Kristy
clojurians
clojure
use case: `{:post [(check-with-explanation-value some? % coll)]}`
2017-12-05T23:34:44.000102
Kristy
clojurians
clojure
because `some? nil` cannot give useful information, so we use `coll` (a defn argument) as the explanation value
2017-12-05T23:35:27.000039
Kristy
clojurians
clojure
there’s a ticket with a patch for something like that if it’s useful to you
2017-12-05T23:52:10.000095
Sonny
clojurians
clojure
actually, I guess it isn’t what you want, nvm
2017-12-05T23:53:54.000153
Sonny
clojurians
clojure
<@Lisabeth> &gt;Have better debugging tools? I need parse multi-layer json object, it’s very easy wrong, I use Idea IntelliJ tool. Why current Intellij tools are not enough? I use CIDER debug and it's good enough so far (it shows values of all expressions starting from inside ones).
2017-12-06T01:39:46.000145
Heriberto
clojurians
clojure
Hi, I have a problem with my clojure backend project. When my project starts `jetty` server, the whole nginx on this linux, including static resources which are out of the clojure project, starts to slows down for accessing. It shows a long orange `Initial connection` time in Chrome. What can this kind of problem be? Thanks!
2017-12-06T03:09:53.000032
Tari
clojurians
clojure
<@Tari> do you see some high resource usage on your system (CPU, RAM, IO) ?
2017-12-06T03:34:33.000213
Jami
clojurians
clojure
no
2017-12-06T03:34:49.000316
Tari
clojurians
clojure
I used `# netstat -anpl | wc -l` to see tcp connections. some 300-500 counts.
2017-12-06T03:35:33.000028
Tari
clojurians
clojure
``` # uptime 16:36:34 up 474 days, 1:13, 7 users, load average: 2.71, 1.92, 2.17 ```
2017-12-06T03:36:48.000138
Tari
clojurians
clojure
and something like this: ``` # top PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 11450 works 20 0 1627m 498m 14m R 98.9 3.1 2:14.78 grunt 4035 works 20 0 6748m 1.7g 16m S 88.3 11.2 13:44.59 java ``` but it seems natural in my server. we have 4 cpu cores.
2017-12-06T03:37:56.000138
Tari
clojurians
clojure
is is a shared or a dedicated server ?
2017-12-06T03:38:50.000270
Jami
clojurians
clojure
It is a cloud server. <https://www.aliyun.com/>
2017-12-06T03:39:37.000017
Tari
clojurians
clojure
can you run sudo iotop -a on your server ?
2017-12-06T03:44:19.000218
Jami
clojurians
clojure
yep
2017-12-06T03:44:35.000192
Tari
clojurians
clojure
maybe the two processes compete for the IO resources, otherwise I don't see why they would slow down each other
2017-12-06T03:45:03.000300
Jami
clojurians
clojure
you can also do a curl from the server (localhost) to see if it is slow as well
2017-12-06T03:45:49.000243
Jami
clojurians
clojure
we run ssh between cloud servers and it is fast. Only when we do remote ssh, or access https service in browsers, it is slow.
2017-12-06T03:47:02.000175
Tari
clojurians
clojure
and if we stop the clojure(java) process that runs `jetty`, it recovers.
2017-12-06T03:47:46.000003
Tari
clojurians
clojure
Does that mean `jetty` do a lot of io that slows down the server?
2017-12-06T03:48:48.000142
Tari
clojurians
clojure
it can be jetty or the JVM. One of them can take too much memory/IO and exceed your cloud provider quotas
2017-12-06T03:57:15.000002
Jami
clojurians
clojure
try to use an alternative to see if it changes something: <https://github.com/ztellman/aleph> <http://www.http-kit.org/>
2017-12-06T03:57:58.000462
Jami
clojurians
clojure
if you use ring/compojure, they can be used as drop-out replacements
2017-12-06T03:58:13.000224
Jami
clojurians
clojure
<@Jami> Thank you very much.
2017-12-06T04:08:37.000054
Tari
clojurians
clojure
In my project `ring-middleware-format:jar:0.7.2` imports `org.clojure:tools.reader:jar:1.0.5` And `immutant:jar:2.1.9`'s dependency tries to import `org.clojure:tools.reader:jar:0.10.0` which is omitted for conflict What to do in such situation? Can bad things happen due to omit of this dependency?
2017-12-06T06:22:32.000365
Marcos
clojurians
clojure
<@Marcos> There's very little you can do. The bad thing that can happen, will only happen is tools.reader changes it's API between 0.10 and 1.0.5. Rich has firmly committed to not breaking APIs, ever. And I suspect org.clojure/tools.reader will follow this pattern.
2017-12-06T06:43:05.000183
Jodie
clojurians
clojure
<@Jodie>, thanks!
2017-12-06T06:44:42.000391
Marcos
clojurians
clojure
Okay, also. In project I have dependency `[clj-time "0.14.2"]` and `ring:ring:jar:1.6.3` want `clj-time:clj-time:jar:0.11.0`. what to do here? I should use `clj-time 0.11.0`?
2017-12-06T06:54:27.000331
Marcos
clojurians
clojure
<@Marcos> I _personally_ tend to use latest as much as possible. I've not had an issue doing this.
2017-12-06T07:04:19.000157
Jodie
clojurians
clojure
<@Marcos> whatever works - i tend to try the later dependency first and exclude the earlier on the presumption that the later version will have bugfixes, but occasionally you have to do it the other way around and occasionally you are stuffed and have to go make PRs for some of your dependencies
2017-12-06T07:04:26.000131
Shameka
clojurians
clojure
But I think, what there maybe api changes between 0.14.2 and 0.11.0 versions.
2017-12-06T07:05:49.000268
Marcos
clojurians
clojure
Here is clj-time changelog <https://github.com/clj-time/clj-time/blob/master/ChangeLog.md> I didnt see any api change mentions
2017-12-06T07:06:46.000295
Marcos
clojurians
clojure
So Ill use 0.14.2
2017-12-06T07:06:58.000105
Marcos
clojurians
clojure
Thanks, <@Shameka> <@Jodie>
2017-12-06T07:08:10.000160
Marcos
clojurians
clojure
I need process it, eg:add avg etc... Probably because I have just started. Thanks for you’re help, I have solved the problem, and I known the Cheshire project.:+1:
2017-12-06T07:22:14.000075
Lisabeth
clojurians
clojure
hello, does anybody here is aware of a currently maintained libray like prismatic.plumbing (specially its graph related facilities) ?
2017-12-06T07:36:13.000030
Isabell
clojurians
clojure
<@Isabell> you have <https://github.com/aysylu/loom> and <https://github.com/Engelberg/ubergraph>
2017-12-06T07:41:29.000277
Jami
clojurians
clojure
<@Jami> thank you! i will look at those
2017-12-06T07:42:12.000312
Isabell
clojurians
clojure
Can anyone recommend a Clojure library for calling into an external C library?
2017-12-06T08:47:54.000499
Jone
clojurians
clojure
Clojure can use Java JNI to call native code
2017-12-06T09:31:02.000075
Sonny
clojurians
clojure
So there are quite a few a ways to approach writing more reliable, evolvable software. * specifications: schema, spec * doc enhancers like literate programming (marginalia) and interactive viewers (klipse, Dynadoc) I think each has a set of trade offs. Has anyone written about this subject at a meta level. I think spec does a great job of allowing a user to add more reliability as it becomes more important. But i think growing software has to do with building a human narrative about a system, which, i think is worth creating non code documentation to create. I would like to see a tool which creates a narrative about a system, and can leverage existing ways of communicating: spec, unit tests, doc strings… and also grow and be viewed in different ways as the system evolves. Does anyone know of anyone interested in this, or any works on this subject?
2017-12-06T09:55:37.000558
Glory
clojurians
clojure
<@Jone> I'd recommend JNA, it's super seamless with Clojure
2017-12-06T10:12:13.000486
Sandy
clojurians
clojure
(.invoke (Library/getFunction "libc" "sin") [0.42])
2017-12-06T10:12:55.000381
Sandy
clojurians
clojure
That's about the extent of the psudeocode you need with JNA
2017-12-06T10:13:06.000335
Sandy
clojurians
clojure
jni is much faster tho (last time I used it, few years back)
2017-12-06T10:14:01.000233
Weston
clojurians
clojure
<@Weston> define "much faster" :slightly_smiling_face:
2017-12-06T10:15:39.000432
Sandy
clojurians
clojure
in my case it was an order of magnitude faster
2017-12-06T10:16:00.000230
Weston
clojurians
clojure
I was interacting with a lib related to rf cavity simulation, so quite fast internally
2017-12-06T10:16:41.000476
Weston
clojurians
clojure
As always the problem is: * JNA gives you almost instant access to C libs a a slight perf cost (we're talking about 10x slower over the cost of a function call, that's not much) * JNI gives you near native function call speeds, but you have to write/generate/maintain a wrapper and all the associated build code
2017-12-06T10:18:19.000363
Sandy
clojurians
clojure
but jni requires more ceremony for sure, I had to write some java on the side and then call from clojure
2017-12-06T10:18:21.000019
Weston
clojurians
clojure
exactly as you said
2017-12-06T10:18:37.000023
Weston
clojurians
clojure
not sure what you mean about the build code, a simple lein file was good enough, I had the java wrapper and the clojure code living in the same project, with the .dll (windows... *sigh*) in question (I guess it works the same with .so files)
2017-12-06T10:21:50.000876
Weston
clojurians
clojure
<@Sonny> Thank you. I was hoping for a more painless way though as I am going to use a C/C++ library with a lot of functions. I already started wrapping it in C, Java and Clojure but it is not much fun. <@Sandy> Thank you for the suggestion. I guess that is as good as it gets right now in the general case. Could not find any maintained pure Clojure libraries. I am actually the author of clj-native and the bits in Leiningen that link native libraries into projects. But I abandoned that years ago because I stopped doing Clojure development and now I don’t like that declarative approach any more so I am not going to revive it. For my particular need though (LLVM) I did find this, which seems to work out of the box with Clojure. Very nice! <https://github.com/bytedeco/javacpp-presets/tree/master/llvm>
2017-12-06T10:26:09.000780
Jone
clojurians
clojure
I've used JNR successfully, and it claims to be close to JNI, but still high-level.
2017-12-06T10:50:58.000125
Guillermo
clojurians
clojure
When using the new `clojure` cli tool, is there a way to pick a clojure version from the command line?
2017-12-06T11:04:00.000392
Fe
clojurians
clojure
Using a `deps.edn` with `{:deps {org.clojure/clojure {:mvn/version "1.9.0-RC2"}}}` works, but I'm wondering if there's a cli switch
2017-12-06T11:04:25.000542
Fe
clojurians
clojure
you can use aliases in deps.edn and then pick which clj version to use by picking a different alias
2017-12-06T11:05:12.000617
Kareen
clojurians
clojure
<@Kareen> but no way to pick the clojure version from the command line *without* a deps.edn?
2017-12-06T11:32:41.000224
Fe
clojurians
clojure
what do you mean?
2017-12-06T11:32:56.000657
Kareen
clojurians
clojure
no
2017-12-06T11:32:57.000612
Kareen
clojurians
clojure
sorry
2017-12-06T11:32:58.000843
Fe
clojurians
clojure
not without
2017-12-06T11:33:00.000025
Kareen
clojurians
clojure
afaik
2017-12-06T11:33:04.000042
Kareen
clojurians
clojure
I think that would be a useful feature (boot can do it)
2017-12-06T11:33:15.000115
Fe
clojurians
clojure
especially given the intended use case of playing around with code from the repl
2017-12-06T11:33:37.000278
Fe
clojurians
clojure
which version does it pick anyway - is it hardcoded to 1.8.0?
2017-12-06T11:33:57.000285
Fe
clojurians
clojure
yes
2017-12-06T11:34:42.000675
Kareen
clojurians
clojure
no
2017-12-06T11:36:27.000422
Sonny
clojurians
clojure
nothing is hardcoded
2017-12-06T11:36:35.000389
Sonny
clojurians
clojure
please see the reference page for more details <https://clojure.org/reference/deps_and_cli>
2017-12-06T11:36:57.000069
Sonny
clojurians
clojure
there are a series of configuration files that are combined - the default is defined in the installation deps.edn
2017-12-06T11:37:18.000202
Sonny
clojurians
clojure
if you wanted to, you could define a set of aliases in your config-level deps.edn (usually in ~/.clojure/deps.edn) - then you could use them from anywhere by specifying them at the command line
2017-12-06T11:39:31.000221
Sonny
clojurians
clojure
```{:aliases { :1.7 {:override-deps {org.clojure/clojure "1.7.0"}} :1.8 {:override-deps {org.clojure/clojure "1.8.0"}} :1.9 {:override-deps {org.clojure/clojure "1.9.0-RC2"}} }}```
2017-12-06T11:40:33.000503
Sonny
clojurians
clojure
then do `clj -R:1.7` / `clj -R:1.8` / `clj -R:1.9`
2017-12-06T11:41:00.000469
Sonny
clojurians
clojure
or I guess, nothing is hardcoded *in the tool*. The installation files do hardcode the default version.
2017-12-06T11:41:59.000907
Sonny
clojurians
clojure
also btw, there is a <#C6QH853H8|tools-deps> room where I watch for questions on this stuff
2017-12-06T11:42:24.000373
Sonny
clojurians
clojure
<@Sonny> cool, I'll move it over there then
2017-12-06T11:42:56.000015
Fe
clojurians
clojure
<http://clojurians-log.clojureverse.org|clojurians-log.clojureverse.org> seems to have stopped logging about a month (2017-11-16) ago. Is this expected?
2017-12-06T12:58:02.000110
Domingo
clojurians
clojure
<@Jasmine> is the person to ask about that I believe?
2017-12-06T14:12:52.000671
Daniell
clojurians
clojure
<@Crystal> instrument's argument needs backtick not single quote
2017-12-06T14:18:08.000373
Guillermo
clojurians
clojure
That way you are instrumenting user/myinc not myinc
2017-12-06T14:19:15.000629
Guillermo
clojurians
clojure
``` `myinc not 'myinc ```
2017-12-06T14:20:05.000458
Guillermo
clojurians
clojure
oh, didn't know that. But tried now by reloading the whole code in the REPL with backtick, still no instrumentation...
2017-12-06T14:25:22.000026
Crystal
clojurians
clojure
(st/instrument `myinc)
2017-12-06T14:25:34.000509
Crystal
clojurians
clojure
I must be doing some silly basic mistake, since I'm the only one having this problem :slightly_smiling_face:
2017-12-06T14:26:14.000205
Crystal
clojurians
clojure
The return value from instrument is `[]`, is that correct?
2017-12-06T14:27:48.000390
Crystal
clojurians
clojure
I think I figured it out now, the backtick was the solution, I just had some issues referencing vars correctly in repl ns. Thanks so much, <@Guillermo>!
2017-12-06T15:01:56.000143
Crystal
clojurians
clojure
Wow, that is troubling. Does anyone know who maintains that?
2017-12-06T16:29:09.000243
Cecile
clojurians
clojure
this seems true in practice, but is it guaranteed that the `name` function, when applied to a qualified keyword, always strips off the namespace, so that (name ::foo/bar) is always equiv to (name :bar) and always equiv to "bar" ?
2017-12-06T16:34:37.000381
Berry
clojurians
clojure
<@Berry> Given the docstrings for `name` and `keyword`, I'd say yes...
2017-12-06T16:36:40.000559
Daniell
clojurians
clojure
```clojure.core/name ([x]) Returns the name String of a string, symbol or keyword. clojure.core/keyword ([name] [ns name]) Returns a Keyword with the given namespace and name. Do not use : in the keyword strings, it will be added automatically.```
2017-12-06T16:37:09.000413
Daniell