Fork me on GitHub
#clojure
<
2016-04-28
>
lewix00:04:51

https://github.com/6ewis/guestbook/blob/master/resources/sql/queries.sql what am I doing wrong ; lein repl :connect 7000 then I run (get-messages). note that (save-messages!) work as expected

CompilerException java.lang.RuntimeException: Unable to resolve symbol: get-messages in this context, compiling:(/private/var/folders/nl/3t4zhhzn2yn4clw132q7crhh0000gn/T/form-init3623113136178228423.clj:1:1)

hiredman01:04:33

have you restarted your repl since you added the get-messages query?

hiredman01:04:57

if I clone that repo, and start a lein repl in it, #'guestbook.db.core/get-messages does exist

lewix02:04:24

I did (stop) (start) hired man, I'll try again when I get home. Thanks

crocket02:04:14

@richiardiandrea: timbre is badly coded, and it is maintained by an asshole who is quick to block contributors he doesn't like.

crocket02:04:40

It is also poorly documented.

crocket02:04:28

There are better alternatives.

richiardiandrea02:04:11

@crocket: well I have not seen bad coding, and the doc can always be peer-improved...of course I know nothing about the maintainer (and by the way there is a Code of Conduct here)

crocket02:04:47

You haven't seen bad coding probably because you haven't tried to fix the bugs or investigate undocumented behaviors in timbre.

crocket02:04:39

I tried to improve undocumented behaviors by documenting and providing a patch, but the maintainer blocked me within a day.

richiardiandrea02:04:44

@crocket: it is open source after all, when I see a problem, I try (if I have time) to fix it myself and push upstream

crocket02:04:03

You will probably better fork it.

richiardiandrea02:04:07

@crocket what alternatives do you see then?

crocket02:04:09

On JVM, there is unilog

crocket02:04:17

On javascript, I don't know.

crocket02:04:53

I contributed to unilog, and the maintainer accepted my patch as quickly as humany possible after review.

richiardiandrea02:04:58

on Javascript I like cljs-console by the Adzerk family, but of course it does not provide Clojure+ClojureScript appenders

crocket02:04:39

Its behaviors are more predictable than those of timbre as well.

richiardiandrea02:04:29

I have also the problem that it still contains cljx files and boot-cljs seems to avoid them...

richiardiandrea02:04:38

but ok thanks for the suggestion

richiardiandrea02:04:47

I'll have a look

richiardiandrea02:04:34

I mean in order to support it I would have to downgrade the cljs compiler..maybe...not doable

richiardiandrea02:04:14

or upgrade timbre cljx to cljc, but I am going off topic...

seancorfield04:04:39

I’ve always found the maintainer of Timbre to be very pleasant and welcoming toward contributors. I haven’t used Timbre, but I’ve used several other projects by that author.

danielcompton04:04:54

Yep, Peter is great.

pyr05:04:37

I'm super biased because I wrote unilog

pyr05:04:01

but I think you're better off integrating with the java ecosystem, hence why I target logback and try to have a sensible data-based configuration for it. This allows the following: - Configuring your logs - Configuring logs from other Java/JVM libraries - Still allowing you to provide external configuration for logging if that's your thing

pyr05:04:48

I'm preparing additional docs on the format of the log configuration

pyr05:04:06

There are also facilities for building structured log (or log context in the logback terminology) but you still log with clojure.tools.logging (which everyone else does anyway).

shreyas.n06:04:26

Hello. Im trying to make a call to a RESTful web service using "clojure.java.shell". The call has oAuth token and other authentication data along with the URI. This command works for me from ccommand line "terminal". however when trying through clojure REPL (counterclockwise) it throws an exception : "IOException error=63, File name too long java.lang.UNIXProcess.forkAndExec (UNIXProcess.java:-2)". any pointers on this?

cristobal.garcia06:04:21

hi, why are you using a shell to call a service? Are you trying to span curl or wget from clojure?

cristobal.garcia06:04:37

@shreyas.n: You should try clj-http, or http kit

hiredman07:04:42

shreyas.n: you also should check out the docs for clojure.java.shell/sh and look at some examples, it is likely you are trying to pass the command and arguments as a single string, which is not how that function works

hiredman07:04:07

but, yeah, don't shell out for http

telent08:04:33

hmm, didn't know about fnil. thank you, channel

danielcompton08:04:43

As a side note, why doesn't Java.shell let you pass a single string?

telent08:04:30

so that you can pass arguments with spaces in them without descending into shell quoting hell

telent08:04:23

I imagine, anyway. on unix, certainly, the underlying exec* calls take an array of strings

telent08:04:59

if you want parsing compatible with how /bin/sh does it, you could always actually invoke /bin/sh with something like (sh "/bin/sh" "-c" "ls -l my list of files foo bar baz")

jimmy12:04:07

hi guys in lein, how do we ignore :dev deps when running lein ?

yenda12:04:15

is it normal for (clojure.edn/read-string "0something") to throw a number format exception ?

hans12:04:34

yenda: i'd think so.

crankyadmin12:04:26

Hi, whats the best why to continue after catching an exception in Clojure when looping over a collection?

yenda12:04:28

I see why reading the edn-reader code

hans12:04:51

@crankyadmin: Exception handlers in the JVM are executed after the stack has been unwound, so your handler cannot resume to the point where the exception has thrown. You'll have to catch and handle the exception inside of your handler if you want the looping to continue.

pauldelany13:04:34

hey all - anyone use korma? just looking at this for first time and have basic issue - stumped

hans13:04:44

@pauldelany: i thought it was nice but found that you could not use it to join the same table twice. we're now using honeysql which is great.

pauldelany13:04:26

@hans - ah, cool - didn't realise that. Will take a look for comparison, thanks.

thiagofm13:04:14

@pauldelany: also take a look at HugSQL simple_smile

thiagofm13:04:46

embrace SQL

hans13:04:02

embrace s-expressions

hans13:04:12

easier to edit, easier to compose.

pauldelany14:04:33

@hans - any caveats with honeysql you can mention offhand?

hans14:04:44

@pauldelany: Nope, nothing that I could easily think of. Except, of course, that it makes your queries unreadable to people who only know SQL.

pauldelany14:04:18

that's not an issue then, thanks!

entrobe14:04:01

Is there a way to simplify (if x (f y) y)

nonrecursive15:04:49

maybe

(defmacro iff [p f x & [y]]
  `(if ~p
     (~f ~x)
     ~(or y x)))

plexus15:04:53

@pauldelany: when you want to use database specific features that HoneySQL doesn't know about (yet) it takes a good bit of plumbing

plexus15:04:06

it's all built on protocols so it's extensible. I'm using the new PostgreSQL "upsert" syntax. I figured out how to add it in the end, but it wasn't exactly well documented

sveri15:04:06

@entrobe: @nonrecursive Why use a macro here? A simple function would do it too?

jonschoning15:04:20

I'm guessing it depends if you want the arguments to be evaluated in the call to ifff

nonrecursive15:04:40

@sveri yeah the macro is slightly different from what entrobe asked about in that it lets you specify an optional expression for the else clause, and because of that you want a macro so that you don’t to evaluate both x and y . yours is nice and makes sense to me simple_smile

mateus.henrique.brum16:04:58

Hello guys, I am new on Clojure world, but have some experience with Java (~ 9 yrs). Nice to meet you all ... simple_smile

firstclassfunc17:04:49

has anyone implemented a connection-pool in pure Clojure?

odinodin18:04:47

Is is possible to list the files in a directory under resources inside an uberjar?

sorenmacbeth18:04:45

@odinodin: jar -tf <path to jar file>

odinodin19:04:20

@sorenmacbeth: I mean from inside an app

odinodin19:04:30

Something along these lines

(->>
    ( “some-dir-inside-uberjar")
    ()
    (file-seq))

roberto19:04:27

clojure.java.classpath/filenames-in-jar

roberto19:04:56

there are no directories in the classpath tho

hiredman19:04:46

it is not possible to do that, resources are loaded via a classloader, and the classloader api for resources is basically a read only k/v kind of interface

hiredman19:04:02

no concept of directories or listings

hiredman19:04:59

generally, if you want to do something like that you create yourself a file like mystuff.edn in your jar, that contains a list of resources, and load that instead of doing a listing yourself

hiredman19:04:37

keep in mind that will by default return one resource from some default classloader, but you can get resources from a specific classloader, and you can get all t he resources with a given name (there can be multiple)

ghadi20:04:53

food for thought: structure your data to fit your task, not your algorithm to fit your data.