#clojure log - Dec 26 2015

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:02 ben_vulpes: what would be the expedient way to jam a whole bunch of repeating flags for a list of unknown length into a clojure.java.shell/sh command?

0:03 justin_smith: ben_vulpes: like some kind of interleave of the list and the flags?

0:04 devtrope: (apply sh [the arg s])?

0:04 ben_vulpes: pretty much. repeating (sh "the-call" (repeating "-flag" (item of list)))

0:04 hm

9:24 irctc: I have some java classes and I want to use from lein repl how to do it I am not sure how to tell repl about the classpath of the java classes

9:25 justin_smith: you don't

9:25 lein sets up the classpath when it starts the repl

9:26 if the dep is in your project.clj, you are good to go

9:26 irctc: How to include the classpath of my java classes in project.clj

9:27 TimMc: Are they in a jar that is published to the Central Repo or similar?

9:27 justin_smith: usually you would use maven to install the artifact to your local cache

9:27 TimMc: Or a standalone jar o your desktop?

9:27 justin_smith: or point at central

9:27 yeah

9:27 TimMc: Or random classfiles in a folder?

9:27 irctc: random class files in a folder

9:27 TimMc: (in ascending order of "this will suck")

9:28 irctc: This is a good place to start: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj

9:29 irctc: I always have been hearing that you need jar to be published in a cental repo. Do I have any other choice with my only class files

9:30 TimMc: You can use that to point your project at some classfiles, but they'll have to be in a directory structure matching their package names...

9:30 justin_smith: TimMc: did you intend to link to a specific line in the sample project.clj?

9:31 TimMc: nope

9:31 justin_smith: irctc: a jar is a convenient way to bundle class files. You can just add a specific folder to your classpath via project.clj

9:32 TimMc: Hmm... I thought there was a way to add raw classpath entries.

9:32 justin_smith: yes, there is

9:32 TimMc: if nothing else, bot resource-paths and source-paths are just classpath entries

9:33 TimMc: ah, right

9:33 irctc: Now how do I use or refer resource-paths and source-paths

9:33 TimMc: irctc: If this is something you want anyone else to ever use you'll need to get stuff bundled into jars, and probably into a repo.

9:33 justin_smith: irctc: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L281

9:34 TimMc: *a maven repo

9:34 justin_smith: definitely true

9:34 irctc: ok thanks TimMC Justin I will try that

9:46 beaky: hello

9:46 how do i receive mail with clojure

9:46 and connect to a database

9:55 TimMc: beaky: You would use a Java IMAP or POP library to talk to a mail server, and you would (probably) use JDBC to talk to the DB.

9:57 beaky: This small, crappy program I wrote a while back demonstrates connecting to IMAP: https://github.com/timmc/hashflash

10:23 beaky: wow thanks tim

13:33 TimMc: beaky: That should get you started, but be warned -- that code is written to get one job done, and not well. It's very fragile, and is specific to Google Mail.

13:45 devtrope: I think you can add a .lein-classpath file with additional classpaths on it to escape "everything must maven" in Lein.

13:46 I've done that to support plugins that exist only in the project itself.

13:49 Evidence: https://github.com/technomancy/leiningen/blob/054a77af6c24dcf79bffd6348421631599c33a5c/bin/lein-pkg#L58-L62

13:51 Not sure how that works in, say, uberjar situations, so perhaps it's a dead end. Works for plugin stuff anyway.

14:31 beaky: hello

15:24 lokien_: Can we write GUI as easy as C# guys?

15:32 j-pb: lokien_: yeah with cljs ;P

15:33 lokien_: j-pb: darn, didn't think of that. I have to finally learn it

15:36 Anyway, is there anyone using BSD/Windows for development?

15:37 j-pb: BSD/Windows

15:37 bsd as in freebsd?

15:38 lokien_: Yeah

15:39 j-pb: i've seen people use it on it :)

15:39 but not myself

15:39 lokien_: I hate working on Windows, so I'm planning to dual boot something (or buying a cheap laptop)

15:42 Seylerius: lokien_: You're not alone in hating Windows.

15:42 j-pb: hey, is there a recommended redis lib out there? I've seen carmine, but that is really off-putting because of all the macros and weird api it has :)

15:43 lokien_: Seylerius: But I hate running things in Wine, so it's a lose-lose for me

15:44 j-pb: If I don't use any java functions, is my program cljs compilable?

15:44 j-pb: lokien_: no

15:44 generally not

15:45 somewhat

15:45 but generally not

15:45 lokien_: you can reuse 99% of all code, but sometimes abstractions leak through on the jvm and on js

15:46 lokien_: j-pb: it's a 160 line program

15:46 j-pb: core protocols between clojure and cljs are somewhat different, because cljs was rewritten from scratch and has a lot of cool new stuff

15:46 lokien_: it might be, however it will have a completely different execution story right

15:46 a program is often more than pure buissnes logic

15:47 lokien_: Clojure is obsolete then? :o

15:47 j-pb: no because it runs on the jvm ^^

15:47 however you can see the influence cljs has on clojure

15:47 lokien_: I've heard that jvm is an old pile of crap

15:47 j-pb: of that domain logic you can probably reuse 99% minus the few percent that are a result of js and java having different datastructures

15:47 for example js has no ints

15:48 only a unified number type which is basically a double

15:48 lokien_: yes and no. Is it a pile of crap and old yeah

15:48 is it the fastes vm around, probably too

15:48 lokien_: And glorious Clojure guarantees no overflows, right? Right?..

15:48 fantazo: jvm is crap. like the whole java story. expendable programmers for the win, that's the story about it.

15:49 lokien_: fantazo: so, you're using arcadia?

15:50 devtrope: Don't confuse corporate java-shop pop-culture with the underlying technology.

15:50 j-pb: lokien_: actually clojure will throw an error I think when an int overflows

15:50 but I think that is a java error actually

15:50 you need to use bignums explicitly

15:50 fantazo: clojure is basically the try to get a decent programming language with some integration running on that mess so that people who aren't braindead can program in it through the mess of what some "managers" (other word for stupid people) created in the first place.

15:51 j-pb: nah

15:51 it's not that bad

15:51 a lot of java is horrid, but I don't think you will see clojure in those shops

15:51 lokien_: I wish Clojure was compilable to binary though

15:51 devtrope: Alas, if you want a job these days, it seems like you end up having to support and extend bad decisions people made 10 years ago: and not complain.

15:52 j-pb: *cough* working clojure full time ;P

15:52 lokien_: Or make a startup in lisp!

15:52 j-pb: lokien_: I don't :D, it's fast enough and binary has it's own problem

15:52 devtrope: There are options, of course. ;)

15:52 lokien_: j-pb: But people are afraid of my jars :(

15:52 fantazo: people will always do bad decisions the point is to make an environment were you fail often and recover from it.

15:53 j-pb: exactly

15:53 devtrope: Somehow java-shop culture and Scrum are made for each other. If you're in that situation, reading blogs about cool Clojure or Haskell will kill you. ;)

15:53 j-pb: which brings me back to: "why is carmine's api so bad?"

15:53 fantazo: I'm totally disillusioned from "just use" lisp bullshit. you get your stuff working with whatever shit you now use.

15:54 lokien_: Good luck writing a game in brainfuck then

15:54 fantazo: and then be haunted by your decisions. this is life, it's supposed to suck.

15:55 lokien_, that's a challenge some people could say that they accept that.

15:55 devtrope: j-pb: Fork this one (https://github.com/mmcgrana/clj-redis) and update it? I bet using interop would work just as well.

15:55 lokien_: fantazo, why you so sad, I bet you're smart and beautiful

15:56 j-pb: devtrope: actually considering it

15:56 devtrope: j-pb: I forked quiescent, updated some stuff, removed some deprecated stuff: it was kinda freeing.

15:57 j-pb: devtrope: quiscent is a 200 lib library that consists mostly of function

15:57 s/lib/line

15:57 fantazo: lokien_, oh nice of you.

15:57 lokien_: fantazo: <3

15:58 devtrope: j-pb: Right. I wanted to use Sablono with it, which required and update to a newer React, etc, etc.

15:58 j-pb: My forks is mainly a hedge against a, uh, quiescent Quiescent. ;)

15:58 j-pb: devtrope: oooooorrrr you could use reagent and live on the happy side of the fence :)

15:59 devtrope: I thought about it.

16:00 j-pb: doit, do it naow

16:00 a re-frame style architecture is super awesome

16:01 devtrope: Too late for this app.

16:01 j-pb: it's never too late

16:01 I'm currently porting 20000 lines of rather horrid om to reagent

16:01 devtrope: Yeah, single atom, messages update state, view is re-computed: I've done that before Om and in all things after. It is great.

16:02 I'm not scared of a port, I just need to do other things, like finish the app.

16:02 j-pb: well, as we discovered you can actually put a reagent atom into an om cursor

16:02 so you can rework everything component by component

16:03 devtrope: With Quiescent, you have a single atom at the top, but all components re-render only if their first parameter changes, and that first parameter is a regular value.

16:04 I'm not sure it translates well to either Om or Reagent.

16:04 j-pb: yeah I know, I've used it before reagent

16:04 as long as it can render react it can render a reagent component

16:04 devtrope: And there's Brutha. ;)

16:06 I'll have to dedicate an hour to parse through the witty re-frame doc.

16:07 j-pb: yeah but it's an eye opener

16:08 devtrope: It just describes the basic model I've always used, I think. Even with Om.

16:08 j-pb: the re-frame doc is more like a blog post describing a architecture

18:15 kenrestivo: aha! at last someone figured out the cause of that maddening bug i was wrestling with: http://yogthos.net/posts/2015-12-26-AOTGotchas.html

18:28 justin_smith: if he'd used a shim, instead of :aot, none of this would have happened

22:00 kenrestivo: that's a great idea. hmm...

22:01 * justin_smith is writing C code and just waiting for it to start sucking.

22:07 kenrestivo: a java shim not a c one

22:07 justin_smith: right, right

22:07 the C thing was a non sequitor actually

22:07 kenrestivo: i like writing c, for some things. embedded microcontrollers, device drivers

22:13 hlolli: hi justin, mery christmas

22:16 As shamefully bad amatur in version contorling, git and releasing. I made an experiment on my library, it's at [org.clojars.hlolli/panaeolus "0.2.0-RELEASE"] I bumped into few obvious pitfalls. Which is global user settings, and relative resource paths, in the generated .jar files. But the latter later. Is it possible to have global constants in defproject that can be seen and used by other .clj files under the source file-tree?

22:18 justin_smith: hlolli: project.clj is for lein, and for dev/compilation, not for run time concerns

22:20 hlolli: ok, where should I put user settings regarding audio card sample rate etc?

22:25 justin_smith: have them put an edn file on the classpath, and have your own as a fallback in the jar that you can merge their settings into.

22:25 or perhaps they could specify the location of the edn file in the args

22:26 hlolli: also, you could check out environ, it allows loading settings from the environment or system properties, but I think it has a thing where it can load a settings file too

22:30 hlolli: ok, two new concepts that I will look into. Good, my christmas holidays consist of staring at computer screen, more to learn the better.

22:32 hlolli`: ah fak, lost internet and reconnected

22:32 but I assume I missed on nothing.

22:39 devtrope: hlolli`: I really like the "resources/config.edn" file plan justin_smith mentioned. Easy to slurp and edn/read-string in.

22:39 hlolli`: You can even use a prismatic schema to validate it.

22:57 hlolli`: yes, Im actually reading now http://www.compoundtheory.com/clojure-edn-walkthrough/ prismatic schema, noted for study.

Logging service provided by n01se.net