Fork me on GitHub
#clojure
<
2015-09-19
>
niwinz07:09:03

any one know an more lightweight alternative to slingshot? I know that it exists but I don't remember the name 😞

wqhhust09:09:19

clj-webdriver: why show me the login page even if I have already logined in and let the site remember me? Since I already signed in manually, if I close the web, and reopen the web again manually, it doesn't let me login again. So I hope if I use clj-webdriver, it also doesn't need me login in again. But it actually ask me to sign in. I am using (set-driver! {:browser :firefox} some_url_need_sign_in). Is there any parameter to control whether to used the saved cookie?

pupeno09:09:11

My Clojure app needs to run another program and keep a reference to it and if for some reason it’s not running (crashed or whatever), it needs to restarted. Should I use Runtime.exec and put the result in an atom so that it’s accessible by all threads?

danielcompton09:09:07

@pupeno: does the Clojure program need to do that? The reason I ask is that there are lots of mature tools for monitoring processes and restarting them already

pupeno09:09:35

@danielcompton: I want my library to be as self contained as possible and my library needs to run nodejs. Not running nodejs would be a big abstraction leakage. It’s not the end of the world, but it will make the library much less useful.

pupeno09:09:46

@danielcompton: BTW, I do the devops for my company, I wrote the init script for rails/unicorn, solr, many delayed jobs, I am familiar with that side of things too, I’m not avoiding it because I don’t know it; I think it’d be a poor design for my lib.

danielcompton09:09:44

Ok, no problem. I don't remember the details, but I seem to recall there being dragons with running external processes from the JVM. Someone more knowledgable can speak to that though.

alexmiller09:09:17

the Java APIs for this stuff are pretty bad

alexmiller09:09:53

there are some clojure libs that clean up access though

pupeno09:09:15

I’m looking at clojure.java.shell

alexmiller09:09:32

not sure if that's still maintained

pupeno09:09:22

clojure.java.shell blocks while it’s running, which is not what I want unless I dedicate a thread to it, which… doesn’t sound like a good approach. At least, not an approach I ever took before.

alexmiller10:09:47

dedicating a thread may be inevitable

pupeno10:09:59

This is something I observed in Clojure… some libraries are so small that lack of activity is not lack of maintenance but the fact that the library is pretty much done. Compared to other programming languages, in Clojure, it sometimes harder to know whether to use a library or not.

pupeno10:09:39

alexmiller: conch looks cool, but it’s still blocking.

alexmiller10:09:59

the java apis give you streams that you are expected to read

alexmiller10:09:40

so you will almost definitely have to consume a thread reading that stream

jaen10:09:31

Any way to tell at runtime what multimetod dispatch values are implemented?

jaen10:09:54

@alexmiller: nice, thanks; I've already figured out why the method is not getting registered, but it will come in handy for the future.

beppu10:09:49

@pupeno: I haven't used this myself, but maybe it'll suit your needs. https://github.com/tebeka/popen

beppu10:09:02

It doesn't block, and it gives you access to stdin/stdout/stderr streams.

nberger11:09:20

@pupeno: take a look to the "low level" api of conch. You'll find it in the readme that way. It gives you access to the streams too

niwinz11:09:51

@nberger: yeah! Seems it is! Thanks!

timfield11:09:52

Hi, I'm a newbie and am trying to use the stuartsierra.component framework. I'm confused as to how I use components that I've created. For example. Here we have the function upload-receipt. https://github.com/Moocar/clojure-west-2015/blob/master/src/system.clj#L49 But where would this upload-receipt function be called from / who would be passing the uploader and receipt params here?

nblumoe11:09:45

I am still fighting heavily with using lazy sequences, nested in a large tree and avoiding head retention issues. Maybe some of you would like to have a look at my SO question: http://stackoverflow.com/questions/32667778/removing-elements-from-lazy-sequences-in-a-large-clojure-tree-structure-avoidin Any help is highly appreciated!

pjagielski17:09:08

@timfield: e.g. when you have compojure routes you can get Uploader injected into your context then you can dispatch upload-receipt with this record. I have similar example in my repo https://github.com/pjagielski/modern-clj-web/blob/master/src/modern_clj_web/endpoint/example.clj

pjagielski17:09:24

in clojure/west example that would be:

(defn example-endpoint [{uploader :uploader}]
  (routes
    (POST "/" [receipt]
      (response (upload-receipt uploader receipt))))))

nha18:09:16

Hello, is anyone aware of a boot template for both clojure and clojurescript ?

pupeno18:09:56

bidi seems to think /about and /about? are different routes 😕

ghadi19:09:49

pjagielski: nice job. fills a niche for sure.

ghadi19:09:33

I believe the clojure answer to JPA and korma is Don't: Bad/Antiquated/Broken idea.

ghadi19:09:12

And many clojure answers to java are simply: use the java library.

jaen19:09:22

Hmm, what's the motivation between Spring Data -> system mapping? As far as I understand system that's just a collection of component components and Spring Data seems like some meta-ORM from the description.

arohner20:09:22

how sequential are squuids? If I were to sort a million squuids, would they be perfectly ordered by timestamp?

arohner20:09:59

nvm. turns out I’m using clj-uuid/v1, which includes clj-uuid/get-timestamp

amacdougall20:09:31

I'm developing an API, and realizing that after I log in, I don't know how to test that my identity is on the session without just hitting a resource that requires authentication (or creating a "current-account" route specifically for this purpose).

amacdougall20:09:52

To be more exact: 1. Visit the login route, supplying credentials. 2. Test that response status is 200. 3. Test that response body is a JSON representation of the user who just logged in. 4. Test that the app will remember me on my next request...

amacdougall20:09:25

Number 4 is where I'm getting hung up. For now, I'll just do the most obvious thing, and make a current-account route which returns info on the logged-in user. Nothing wrong with that... it just seems like a very black-box approach. But since sessions live at the request/response level, I don't know how to test them anywhere else.

amacdougall20:09:44

(I have a hazy idea of how to test middlewares, by passing in Ring requests, but I don't know exactly how to craft the lower-level requests that would test this situation. All I really want to do is make sure my login handling code added the right stuff to the session!)

pjagielski20:09:16

@jaen: system provides connectors to both jdbc and nosql datastores, this is what spring-data can be used for. however i consider adding a "notes" column with some additional information

arohner20:09:21

@amacdougall: use https://github.com/xeqi/peridot, and hit request another URL that will only work if you’re logged in?

jaen20:09:47

@pjagielski: I see

amacdougall20:09:23

@arohner: Yep, that's what I'm going to do! I just switched from ring.mock.request to peridot for that reason.

amacdougall20:09:36

I was hoping to test the exact keys added to the session by my login route, but it seems like I might have to test it only implicitly. Which is honestly not a huge deal.

arohner20:09:49

I’m pretty sure you can access the session in peridot

arohner20:09:07

though i guess that depends on which session store you’re using

arohner20:09:24

you can definitely access the cookies

amacdougall20:09:48

Oh, interesting. I'll dig deeper. Thanks!

andrewboltachev23:09:00

Hi. Is there way to maintain own suite of modules, e.g. as common part for series of projects, like [my.organization.module-foo 1.0.0] and have them on some server?

nooga23:09:51

sounds like you need your own maven repository

andrewboltachev23:09:18

thanks, but I believe my task is somehow simpler simple_smile but I don't know how exactly

nooga23:09:40

last time I checked, it wasn’t too complicated

nooga23:09:34

you can always keep them in your local repo, vide lein help install