Fork me on GitHub
#clojure
<
2016-02-10
>
adamfrey00:02:41

If it interests anyone, I wrote a blog post about a couple “little" things in Clojure that I would miss: https://www.adamfrey.me/posts/clojures-little-things.html

mikeb01:02:18

For current_timestamp(), I would say you could set a default column value for the table, or use something to write the insert in plain sql.

cddr05:02:07

Can anyone explain why a clojure program I wrote can print out the classname of a reified interface, but when I pass control to a java framework, it cannot find that class? Does clojure have it's own class-loader? Is there a way to tell the java framework about it?

meow05:02:15

Have you tried to find the answer to that in the Clojure source code?

cddr05:02:15

I see DynamicClassLoader...

meow05:02:56

I can't find the channel for clojure dev like there is for #C07UQ678E but if you can you could ask there as well.

meow05:02:22

I don't know the answer.

cddr05:02:00

Mm, I wonder if the framework is trying to find it in another thread

meow05:02:14

#C06E3HYPR

meow05:02:34

Because your question is pretty advanced.

bronsa09:02:07

@meow: #C06E3HYPR is for discussions regarding the development of clojure itself, not about advanced questions on clojure

bronsa09:02:13

please let's keep it that way

meow09:02:36

Okay, sorry @bronsa.

dominicm11:02:26

Are there any strong opinions on TrapperKeeper? It's error handling seems superior to component, especially as it means you don't need to try/catch everywhere.

nooga13:02:37

Does anyone know a decent (meaning fast and light) 2d graphics library usable from clojure? I’m trying to design an application with cutom GUI and nothing seems to fit very well. seesaw is too desktopy, Quil uses 5% CPU on rendering a black rectangle on white background, Java2D doesn’t look very solid, OpenGL is an overkill...

jaen13:02:36

How about JavaFX? It seems decent-ish and has some seemingly legit wrappers.

nooga13:02:13

had a look, didn’t like it

nooga13:02:13

ideally, I’d just use cljs and reagent to draw SVG but this would bring huge webkit into the scene

jaen13:02:23

Well, some do that with node-webkit or electron; I'm not sure if it's that big of liability. Apps like atom or visual studio code seem to work relatively well.

jaen13:02:39

But if you want to do it with a 2D graphics lib, then maybe look at game libraries like libgdx? It has both OpenGL and 2D graphics APIs, so it might fit your use-case.

jaen13:02:48

@nooga: even has a skinnable UI library it seems - https://github.com/libgdx/libgdx/wiki/Scene2d.ui

nooga13:02:32

thx, I’ll have a look

meow13:02:06

@nooga SVG for clojure/script was discussed in #C0F0V8DT5 but I can't remember the name of the library so check there

gv16:02:56

Hi, I have created a project via "lein new reloaded myproject" when I try to (reset) the tools.namespace/refresh fails with the exception that one of my namespaces can't be found, although it is at the proper place

gv16:02:09

Is there a known tools.namespace bug?

gv16:02:40

For the record: I can do a (require '...) on the repl without a problem

dm316:02:03

can you post the error somewhere?

gv16:02:22

ok, seems to be a problem with AOT. Switched off AOT and did a "lein clean" - now it works as expected

harold16:02:50

clojure.string/trim doesn't seem to work with some space-like characters... e.g., (clojure.string/trim (str "hmm" \o240)) Is there stronger stuff out there?

agile_geek16:02:05

@harold \o240 is not whitespace so trim won't work. You'll probably need to build a regex pattern using replace

harold16:02:16

Makes sense.

solicode16:02:50

Well, this seems to be a Java thing

solicode16:02:59

In ClojureScript it’s considered a space

bruno.bonacci16:02:31

Some browsers match non breaking space as a whitespace, but in Java is not (which I believe is correct)

solicode16:02:06

Oh, it’s browser-specific?

bruno.bonacci16:02:40

sadly, It appears to be…

solicode16:02:47

Interesting

agile_geek16:02:34

BTW in a cljs repl trim does treat it as whitespace (or it did when I just tried in using nREPL to a REPL in Chrome)

solicode16:02:23

Yeah, when I tried it I saw that as well. But I didn’t consider the fact that it could be browser-specific

harold16:02:14

T I L ❤️

roberto18:02:14

is there a way to list all files in resources?

roberto18:02:33

that takes a dir as an argument

roberto18:02:39

which is the problem

roberto18:02:53

so, in test and dev mode, I can pass in the dir

roberto18:02:01

but it won’t work when it is packaged as a jar

roberto18:02:10

because all the files in resources are loaded in the classpath

jethroksy18:02:31

looks like everyone is having this problem..

roberto18:02:40

I want to be able to list all the files in the resources

roberto18:02:43

that is a bummer

roberto18:02:56

means I might need to do some very invasive code changes

jethroksy18:02:19

it's the way the jar is packaged

roberto18:02:37

i hate it when something works in dev/test and when you deploy it doesn’t work the same way

jethroksy18:02:48

it's not the build tools fault

roberto18:02:06

I’m not blaming the build tool

jethroksy18:02:18

no I'm saying it's possible that all three environments work

jethroksy18:02:29

you just need to do some folder rearrangement

roberto18:02:59

yeah, which is not that easy at times

roberto18:02:14

requires some negotiation with the rest of the team in this case

roberto18:02:25

and some modifications to the deployment process

roberto18:02:43

anyway, thanks. At least now I know I shouldn’t be pursuing this further

ghadi18:02:06

can't speak to if this is a good idea roberto, but http://www.uofr.net/~greg/java/get-resource-listing.html

ghadi18:02:44

(classpath-jarfiles) may be useful

roberto18:02:58

thanks, I hadn’t seen that

roberto18:02:07

this is very helpful

roberto18:02:28

awesome, this worked. Thank you @ghadi

profil20:02:43

I am writing a service which fetches some rss feeds, scrapes some sites and formats the data into something I want. I have written a simple ring handler which puts this data into the response and everything is fine.. except, I dont want to fetch and parse the data for each request, one time per hour is sufficient. How do you guys usually handle something like this? core.cache, core.memoize?

jr20:02:34

@profil: I would use ttl in core.memoize

arijun23:02:40

how do I extract information from an error? When I evaluate the error at the repl I see #error{:cause "...", :via ...} but (:cause error) returns nil

arijun23:02:07

as does (ex-data error)

arijun23:02:19

It's of type com.jcraft.jsch.JSchException if that's important

arijun23:02:05

perfect, thank you!

stig23:02:00

I’m struggling to create a kerodon test for a toy app using duct. I’ve got a form with one input field. if I’m running it in the repl / browser then the parameter is passed, but when running in kerodon it arrives as ‘nil’ to the handler. any obvious thing i’ve missed? I’m using the same config, so wrap-param should be present for my test too.

arijun23:02:39

Is there a way I could have figured that out on my own? I didn't know that java errors were "Throwable"s

stig23:02:01

(I am a beginner, so any silly mistake you may think possible (and some that probably aren’t) are fair suggestions.)

stig23:02:33

happy to share my code too, tbh.

Alex Miller (Clojure team)23:02:34

@arijun: not sure - it's new so actually not many people know about it