Fork me on GitHub
#clojure
<
2015-06-10
>
joelkuiper00:06:26

say I have an atom with a map. now say I would like to purge values from that map after a certain time, what would be the best way of doing that?

joelkuiper00:06:30

meta-data on the values maybe?

joelkuiper00:06:42

the run a job that periodically filters and resets the atom?

erichmond01:06:32

this isn’t exactly what you want, but core.cache has a TTL algorithm that you could look at

erichmond01:06:05

if you can’t use it directly, you could use its implementation as inspiration

mj_langford01:06:21

Intro to Pedestal presentation at tonights Atlanta-clj was :thumbsup:

danielcompton02:06:14

@mj_langford: will it be published?

chadhs03:06:33

how do you guys feel about leiningen installed on production server

chadhs03:06:03

or do you usually build in your dev environment and push the jar

akiva03:06:07

I’d put it on only to do some testing and then remove it when done.

akiva03:06:17

In fact, just had to do that.

chadhs03:06:01

gotcha thanks.

akiva03:06:30

And if you’re a stickler for such things, remove the repository directory as well.

isaac03:06:29

how use local library with leiningen? I do not want to install local jar to maven repository.

danielcompton03:06:46

@alexmiller: crazy thought, would it be possible to do a Clojure 1.6.1 release with just Reader Conditional support?

chadhs03:06:17

@akiva: i was making a short deployment tutorial and using an embedded h2 db; the problem is the db file is separate from the jar

Alex Miller (Clojure team)03:06:50

danielcompton: indeed the backporting issue is a barrier for adoption

akiva03:06:29

@chadhs: Maybe use an in-memory DB?

Alex Miller (Clojure team)03:06:17

danielcompton: although if updating to a 1.6.1 to use, why not update to 1.7? (presuming we get it released soon)

danielcompton03:06:05

@alexmiller: there were some breaking changes from 1.6 to the 1.7 alphas, have all of those been resolved in the RC? It would take away any resistance to porting libraries, because people will have a trivial upgrade path.

chadhs03:06:56

@akiva: derp, i just needed to make sure i had my sample h2 db in the right path where my jar expected it. but throw away in memory is not a bad idea either

akiva03:06:58

I didn’t even of asking if you had it in your resource-paths. Heh.

Alex Miller (Clojure team)03:06:25

danielcompton: no simple answer. I would expect the majority of users, using RC and newer versions of libs, to experience few or no problems with RC1. RC2 will address a couple additional and less common issues.

danielcompton04:06:00

Would be interesting to see adoption stats after a few months

Alex Miller (Clojure team)04:06:26

I can get stats per-version via sonatype nexus downloads

chipf0rk05:06:09

@ul that gives me an idea, thank you!

chipf0rk05:06:45

@mfikes well, I might have to get this book now. Thanks!

txus09:06:43

@martinklepsch: remove needs to realize the whole sequence anyway no? there’s where laziness ends, as far as I can see?

txus09:06:03

lol sorry probably extremely late to the party

martinklepsch09:06:09

@txus: remove is lazy — why would it need to realize the whole seq?

txus09:06:44

oh i didn’t know!

txus09:06:11

it’s the complement of filter duh

txus09:06:13

aah mondays

txus09:06:19

only that it’s wednesday

martinklepsch09:06:08

thanks for the reduced suggestion @mfikes, didn’t know about that one simple_smile

robert-stuttaford10:06:32

has anyone integrated core.memoize with a memcached backend?

robert-stuttaford10:06:25

ah, i see clojurewerk/spyglass has a CacheProtocol implementation. nice

tcrayford11:06:29

@robert-stuttaford: wonder what happens there if memcached dies…

robert-stuttaford11:06:50

pssh. it’ll never go down!

robert-stuttaford11:06:55

100% cache misses, i should think. at worst, 500s errywhur

tcrayford11:06:27

hah. I've seen so many memcached clients that throw exceptions when the hosts die 😕

tcrayford11:06:37

(not saying spymemcached does that, just…)

robert-stuttaford11:06:45

looks like it has a couple options

robert-stuttaford11:06:32

anyone actually used core.memoize with a pluggable backend? docs are pretty thin

samebchase12:06:35

neena, pastafari: o/

micha13:06:57

robert-stuttaford: here's one i've used: https://github.com/strongh/crache

arcdrag13:06:02

Can someone explain that? I'm kind of baffled by it.

arcdrag13:06:59

Especially considering this. ^^

robert-stuttaford13:06:21

thanks micha! it looks solid

dnolen13:06:45

@arcdrag: I don’t see that in a local REPL using 1.7.0-RC1

arcdrag13:06:09

hmm, perhaps a 1.6 bug that has been fixed?

arcdrag14:06:25

Yeah, I see that issue with 1.6, but updating to 1.7 it is resolved. I guess it is time to upgrade simple_smile

arcdrag14:06:22

Yeah, here's the ticket. Interesting issue anyway...and a reason for people to upgrade if they haven't yet. http://dev.clojure.org/jira/browse/CLJ-738

noisesmith14:06:16

@isaac maybe someone answered already and I missed it, but you can use lein install to make your lib available to other projects locally

pataprogramming14:06:11

Our local Clojure group (Clojadelphia, covering the great Philadelphia area) is going to be doing a free all-day intro-to-Clojure workshop soon...we've got material for that. But we've also been asked by a local convention (http://fosscon.us) if we'd like to do a three-hour, hands-on workshop.

pataprogramming14:06:35

Any suggestions for preexisting materials that would be suitable for a beginner-oriented workshop of that length?

Alex Miller (Clojure team)14:06:12

we haven't really publicized it yet but the clojure training materials we used for the pre-clojure/west intro workshop are oss

Alex Miller (Clojure team)14:06:39

that was a 2-day training but you could cut it down to something you like

isaac14:06:48

@noisesmith: I mean that, I have a jar lib, and I want to add it to dependencies of my Clojure project.

Alex Miller (Clojure team)14:06:40

pataprogramming: https://github.com/cognitect/clojure-lab is the repo - it uses Gorilla repl for an interactive experience

martinklepsch14:06:23

@isaac: after you did lein install you should be able to just do that

pataprogramming14:06:47

@alexmiller: Hm, thanks. I'll take a look, and we could try cutting it down . If I can find something battle-tested for a short workshop, that'd be ideal...I want to make sure that the attendees get to leave feeling that they've done something cool, or at least learned something.

Alex Miller (Clojure team)14:06:49

pataprogramming: it includes a mixture of materials and labs for each unit

Alex Miller (Clojure team)14:06:38

clojurebridge also has some intro workshop stuff available of course including their Quil-based project which is kind of fun

noisesmith14:06:21

@isaac if you mean a java jar, maven has a jar install op that does the same

damionjunk14:06:52

@isaac see the “add jar to local maven directory” bit here: http://www.thesoftwaresimpleton.com/blog/2014/12/06/om-local/

isaac14:06:08

Is there any way that do not need install this jar to maven repository?

pataprogramming14:06:12

The clojurebridge materials are what we're looking at for our (non-clojurebridge) all-day workshop, but my co-presented is dubious about whether we'd be able to squeeze into a much shorter slot while still remaining useful.

martinklepsch14:06:40

@damionjunk: isn’t this the same as lein install?

damionjunk14:06:25

@martinklepsch: I don’t think so - he has a non leiningen local jar file from what I can discern from the scrollback.

isaac14:06:23

Sometimes, I want to manager these local jar lib with git

martinklepsch14:06:41

Ahh, I see. Excuse me then simple_smile

Alex Miller (Clojure team)14:06:52

isaac: that's possible - maven repos are just directories

Alex Miller (Clojure team)14:06:33

it's a little tricky to configure (intentionally) but it is possible to create a directory in your project and have lein treat it as a repo

isaac14:06:58

@alexmiller: you mean, just make a repository directory in project directory

Alex Miller (Clojure team)14:06:20

essentially yes, but it's more complicated

isaac14:06:43

@alexmiller: oh, I see, thanks

Alex Miller (Clojure team)14:06:51

you need both to have the proper sub-directory structure (with some of the metadata files) and also configure lein appropriately

Alex Miller (Clojure team)14:06:31

it is not the first or even second thing I would recommend but I have done it in the past

damionjunk14:06:35

maybe it would be easier to install with the normal maven jar installation command, and then copy the relevant subdirectory to your project, and then point leiningen at that.

damionjunk14:06:46

but it’s not super-standard to do this. simple_smile

Alex Miller (Clojure team)14:06:56

yes, that gets you most of the way there

isaac14:06:00

this way have a little complicated

damionjunk14:06:07

@isaac: I think this is what you want, IFF you want to go down this road: https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L119

noisesmith14:06:30

@isaac I hope you understand that a lein or maven "install" simply puts the jar in a special cache folder in your home directory, so other projects can find it. If it is a clojure lib, you can use a checkout via lein to use the code directly. But lein install must be done first or the checkout won't work.

damionjunk14:06:39

so in the end, you’ll still need to “install” the jar with maven, but you can manage the libraries in git in some local subdir.

noisesmith14:06:12

also, if you have collaborators, don't use checkouts or install, it's just too messy. Use a private shared rep instead.

damionjunk14:06:15

@noisesmith: It sounds like @isaac wants to do it this way, or has a requirement to do so. But yeah, not a great way to use jar deps.

isaac14:06:37

@noisesmith: that will be better if there has a plugin of leiningen can do this directly

isaac14:06:22

thus, we do not need install jar manually

wuzhe14:06:36

hihihi!! this is cool!

noisesmith15:06:11

isaac: another option is to put the jar into your resouces dir and add the jar itself to the :resources-path of your project.clj

noisesmith15:06:03

I'm not sure I understand your situation though.

isaac15:06:12

yes, I know this way, but` lein uberjar` can not package these jar correctly

isaac15:06:48

if you run program with lein run, this way is perfect

noisesmith15:06:17

isaac: if the jar is in your resource-path (both it's location, and the jar itself need to each be there I think) then uberjar should handle this properly

noisesmith15:06:19

isaac: but to some degree you are fighting against the package management here, because the overall assumption with lein or maven is that independent artifacts are each available from some repo (and when I switched over and finally started using a private repo at work, everything got much simpler)

isaac15:06:58

@noisesmith: yeah, you are right

jeff.terrell17:06:15

I remember seeing this months ago. https://github.com/juxt/modular

jeff.terrell17:06:49

They seem substantially similar. Anybody have a feel for how they differ?

jeff.terrell17:06:01

One thing is that system is compatible with boot. Other than that, I'm not seeing much difference.

ghadi21:06:44

jeff.terrell: if you look at the source code for either of those components, you'll see that they are pretty trivial to generate yourself. Make a start and stop function, that's it. I like to assert a little bit more control over the components we use.

ghadi21:06:06

Like specific logging when stuff starts up.

ghadi21:06:15

The ability to set a bunch of knobs

ghadi21:06:50

It's not that I specifically have a problem with those libraries, but I have a problem with people telling me what to do 😃

ghadi21:06:20

Another pattern that has proved extremely useful is to have a component's constructor take data and only data to configure itself

ghadi21:06:39

For example, our DB connection pool component has a constructor function that will check args and call the underlying component's map->DBConnection function. (that is provided by a defrecord by default)

ghadi21:06:11

if you have to construct the component, then call functions on it or simply assoc stuff onto it, you're not taking full advantage

wei22:06:47

Hi everyone

jeff.terrell23:06:37

@ghadi Thanks! Don't have enough experience with "Clojure in the large"-type stuff myself to get all the nuance there, but that's really helpful to hear your take on it.