Fork me on GitHub
#clojure
<
2016-03-10
>
swizzard00:03:11

has anyone worked with skyscraper (https://github.com/nathell/skyscraper) before?

smw00:03:46

@seancorfield: Obvious and brilliant, thanks simple_smile

echristopherson01:03:47

@swizzard: woooooOOOOOOOH

swizzard01:03:13

@echristopherson: it’s really cool!

swizzard01:03:24

but also confusing!

swizzard01:03:51

or rather, i’m just not sure what happens at the end

echristopherson02:03:43

I was just attempting to take your mind. But I must bow to the master.

virmundi03:03:55

hello. Has anyone gotten weavejester/crypto-password to produce a stable hash? I'm trying to hash passwords, but each time it kicks out a different hash for the same clear text.

virmundi03:03:16

This seams to make the hashing library useless

weavejester03:03:41

virmundi: It’s not a hashing library, it’s a key derivation function (KDF) library

virmundi03:03:44

I guess I have to pull the whole profile back and then compare the stored hash server side

weavejester03:03:08

It’s supposed to return a different result each time.

weavejester03:03:31

The way you check it is to pull the data from the server, then use the check function.

virmundi03:03:45

ok. Different. Thanks.

weavejester03:03:13

If it returned the same result each time, then it would be at risk from rainbow tables.

weavejester03:03:39

That’s one of the reasons KDFs are used over hashes for passwords.

virmundi03:03:11

@weavejester: learn something new every day.

kingoftheknoll03:03:24

I have a style question 1) is there a good shorthand for a seq of strings. Like instead of substrings use ‘ss’ and 2) when restructuring "first & rest” from that ‘ss’ would my bindings be ss-first & ss-rest? Naming stuff is hard 😩

smw03:03:51

@ccann: I saw this while browsing through debugging lists, maybe does exactly what you’re after? https://github.com/philoskim/debux

tap07:03:52

I’ve just realized Prismatic’s open source projects are moved to be under plumatic https://github.com/plumatic

jan08:03:14

Here's a newbie question for you: If HTTP Kit is Ring-Compliant and *non-blocking*, thus enabling high throughput, why would anybody use Immutant?

juhoteperi08:03:41

@jan: non-blocking doesn't automatically mean higher throughput. But Immutant 2 (and Aleph) are also non-blocking.

jan08:03:09

@juhoteperi thank you for the reference. Are there things one should look out for to really be able to leverage the non-blocking aspect? E.g., should you be using a non-blocking database adapter as well? I'd be curious to know how people deal with this in the clojure world. So far my experience is only in nodeJS (all non-blocking all the time) and ruby-on-rails (all blocking all the time).

juhoteperi08:03:18

Yes, one should use non-blocking db adapter to get the benefits but I think most just write blocking handlers and it is not a problem.

juhoteperi08:03:57

Also, Ring middlewares are not really built for async programming, Pedestal interceptors should work better: https://github.com/pedestal/docs/blob/master/documentation/service-interceptors.md

jan08:03:43

I see. So people rather write blocking code and then scale by running several threads next to each other?

lmergen08:03:44

so, here's a fun problem i have to consider: what would be the best way to implement authorization in Clojure? I was inspired by a recent Datomic video i have seen, where they "transform" the database object into one that only contains the objects that the current user "owns", so you have authorization in the database layer

rauh08:03:55

@jan That depends: For my login that doesn't happen all that often I block even for my ~30ms upload to S3, but I go async on my frequent operations in my main app. (I also use pedestal)

jan09:03:08

@rauh I see, that's an interesting approach

dm309:03:13

there's https://github.com/puniverse/quasar which has an adapter for core.async. Much more efficient way of running lots of "threads" of execution on the JVM

dialelo09:03:25

I'd also like to mention catacumba, an async web toolkit that supports HTTP, websockets and SSE https://github.com/funcool/catacumba

mccraigmccraig09:03:39

@jan: i've gone completely non-blocking with my latest project... using #C0702A7SB for the webserver and alia for an async cassandra client

mccraigmccraig09:03:56

and i've found https://github.com/funcool/cats to be super helpful in making async code easy to write and comprehend - thanks @dialelo simple_smile

dialelo10:03:55

being able to write async code in direct style is really nice indeed

malcolmsparks10:03:03

@jan there's certainly overlap with lots of webserver choices - and async is one part of that. While http-kit is certainly async, other stacks are more mature - such as aleph which is built on netty (proven for demanding workloads at Apple/Google/Facebook/etc.) or something like undertow which is solid NIO-based alternative - http-kit is very lightweight but at scale other factors come in to play, like buffer management.

malcolmsparks10:03:08

@juhoteperi: I would disagree a little with your statement about Ring middlewares not being designed for async programming, that used to be true but no longer is, since Ring 1.2. I use Ring middleware in async contexts a lot - you just don't use the wrap- versions, but instead directly use the underlying -request,*-response functions they compose - I know what you're saying, but I think you do Ring a slight disservice

malcolmsparks10:03:20

@lmergen: authentication and authorization are thoroughly implemented in #C0702A7SB: https://github.com/juxt/yada/blob/master/manuscript/100_security.md

malcolmsparks10:03:44

@lmergen: that's really just a 'btw', not advocacy

malcolmsparks10:03:53

I agree with @mccraigmccraig about the value of an async abstraction - #C0702A7SB uses @ztellman's manifold and I've found that to be a very useful/solid foundation for async work - a somewhat higher-level abstraction than core.async

malcolmsparks10:03:41

checkout manifold's manifold.deferred/chain, loop, reduce and so on

malcolmsparks10:03:23

I think these primitives provide a good alternative to monads, so there a choices, not saying one approach is better

malcolmsparks10:03:14

Ring, however, in copying the synchronous design of CGI/WSGI/Rack/Servlet has made writing async services in Clojure somewhat harder, but today there are a number of options which make this problem go away (pedestal, #C0702A7SB, etc.)

jan10:03:39

cool, I really appreciate all those pointers. I'll definitely explore some of the options mentioned.

nha10:03:32

+1 for #C0702A7SB (I tried most of the alternatives mentioned otherwise)

yenda11:03:38

is there a lib to generate prismatic schema from data ?

jedi12:03:07

@yenda there is experimental form generate in schema that generates schema base on provided variable

yenda12:03:58

@jedi it does the opposite it generates data based on a schema

jedi12:03:03

yes you are right, my mistake

jstaffans12:03:26

@malcolmsparks: are there any benchmarks for yada? Should I assume its performance is more or less the same as aleph's?

urbanslug13:03:31

How can I test for redirects in ring?

urbanslug13:03:11

I guess I could look at the response headers? hmmm

robert-stuttaford13:03:23

look for a Location header, i think

lmergen13:03:13

yeah, ring has a lot of utilities for inspecting requests, not that many for inspecting responses simple_smile

malcolmsparks13:03:47

@urbanslug check the status code is between 300-400

malcolmsparks13:03:19

@jstaffans no, there are not yet. It will be slower than aleph because it does more.

urbanslug14:03:33

Thanks, did it. Check Status Code 302 and also Location <the uri you wish to redirect to>

fasiha14:03:20

Is there a library for nil-aware arithmetic? Such that (+ 1 nil) is nil instead of 1 (since + treats nil as 0)? I'm asking because I'm using nil as no-data, and want that status to propagate through arithmetic. I don't really want to use NaN as no-data since I'd like to not interfere with floating-point semantics (infinity, NaN, etc.).

val_waeselynck14:03:37

@fasiha missing javascript already ? :)

val_waeselynck14:03:04

id be surprised if there was such a library

val_waeselynck14:03:19

i think id just cooerce to 0 using or at the boundaries of whatever logic the arithmetic belongs to.

fasiha14:03:43

@val_waeselynck: ha, is that a known "feature" of Javascript weak typing? No, I've never dealt with surveys or missing data before Clojure/Script. Stats systems like R and Julia have dedicated no-data values (NDV) and I'm sure something like that exists for Clojure/Script, but I'd prefer to not have to buy into a huge stats library just for NDVs.

val_waeselynck14:03:56

@fasiha ah ok interesting. Well, not that i know of :/

fasiha14:03:04

I'll probably wind up overwriting the result of + with nil if any input is nil after the fact, and pray 😄

val_waeselynck14:03:07

oh i see i misunderstood your expectations

fasiha14:03:53

But I see what you mean about Javascript: in planck/cljs:

cljs.user=> (+ :ndv 31)
WARNING: cljs.core/+, all arguments must be numbers, got [cljs.core/Keyword number] instead. at line 1
":ndv31"

danielstockton14:03:04

To those using the reloaded workflow and a user.clj dev namespace, how are you starting your repls?

danielstockton14:03:32

I added :repl-options {:init-ns user} so I can use lein repl but now this messes up lein test

lmergen14:03:02

that shouldn't happen

lmergen14:03:15

did you really only add this in the project/dev ?

danielstockton14:03:30

I added the repl-options outside of the dev profile

danielstockton14:03:55

Is that mistake?

doddenino14:03:35

@fasiha: maybe you can try using something like https://github.com/clojure/algo.generic and extending te operations to handle the :ndv case

fasiha14:03:50

doddenino: very fancy, thanks for the pointer!

jpmonettas17:03:36

hi! does anyone have done mutually recusive schemas with the schema library?

jpmonettas17:03:25

I'm trying that and getting a StackOverflowError

ccann17:03:47

@smw thanks for the tip w/r/t debux — at first glance I don’t think it does exactly what I want but I’ll look deeper. I think rolling my own solution or making a feature request is my best bet at this point! thanks again!

virmundi18:03:58

hello. I'm trying to invoke as part of a Component work flow that's calling a custom made Ragtime extension an fn defined in an edn. The Ragtime extension works fine. It's loading the end properly. Component is loading the ns that contains the fn. Unfortunately when I try to execute the symbol, I get a resolve failure. Any ideas/

hiredman18:03:16

what do you mean execute the symbol?

hiredman18:03:26

can you pastebin the stacktrace you get somewhere?

virmundi18:03:04

yea. one sec

virmundi18:03:48

If I resolve and then invoke the resolve in the repl, everything works fine.

hiredman18:03:33

is your symbol namespace qualified?

hiredman18:03:01

oh, I see it is

hiredman18:03:24

how do you know that namespace has been loaded?

virmundi18:03:17

As part of Component, the reset function prints this: :reloading (travesedo.common travesedo.graph travesedo.database travesedo.core-test travesedo.collection travesedo.document travesedo.graph-test hms-api.routes.util hms-api.data.core waller.core travesedo.query travesedo.index waller.files waller.ragtime waller.ragtime-test waller.core-test hms-api.data.arango.core hms-api.domain.accounts hms-api.data.accounts travesedo.integration-test hms-api.routes.util-test hms-api.routes.accounts hms-api.handler hms-api.handler-test hms-api.data.migration hms-api.components hms-api.data.arango.by-example hms-api.data.arango.by-example-test hms-api.data.arango-test travesedo.transaction user travesedo.index-test hms-api.core travesedo.job)

virmundi18:03:52

The namespace is there

hiredman18:03:41

are you sure the symbol? assert isn't failing?

virmundi18:03:16

I think so, here's what the console shows Attempting to run fn {:action :modify, :fn 'hms-api.data.migration/add-web-user!} Exception Cannot find the fn you want to migrate 'hms-api.data.migration/add-web-user! waller.files/eval23899/fn--23900 (files.clj:206)

hiredman18:03:45

you have the symbol quoted, which result in (quote symbol) unless the contents of the file were evaluated

virmundi18:03:24

neat. removing the quote looks like it resolved it properly. I thought I had to quote a fqfn in edn

hiredman18:03:39

I don't think quote actually exists in "edn"

hiredman18:03:16

as a data serialization format, edn doesn't have evaluation semantics, which is what quote effects

hiredman18:03:09

edn is a data focused subset of clojure's syntax

virmundi18:03:07

thanks. I'll try to track down the issue now.

virmundi18:03:15

Thank you. That worked like a charm. I figured this was due to my inexperience

carebear19:03:35

Could someone direct me to where I may find a tutor?

rcanepa19:03:45

Hey! I have some doubts about setting up a configuration file for a production env. In particular, I am not sure where should I specify a route/path to a configuration file for and application built using lein uberjar. Can I use the uberjar profile entry from the projects.clj for that purpose?

rcanepa19:03:59

Right now, I have something like this:

inhortte19:03:43

'm trying to write a websocket client / server using httpkit. The client side is using goog.net.WebSocket. Has anyone run into the following problem using httpkit? Chrome: WebSocket connection to '<ws://localhost:3871/ws>' failed: Invalid frame header Firefox: The connection to <ws://localhost:3871/ws> was interrupted while the page was loading. this.webSocket_ = new WebSocket(this.url_); Thanks...

rcanepa19:03:28

I couldn’t find information on the leiningen website for this case.

ag19:03:47

Is it possible to require multiple namespaces as one symbol e.g.

:require [foo-tests :as t] [test-helpers :as t]
 
I thought this would work, as long names in those namespaces won’t clash, but it seems to be not working

tmtwd19:03:37

is there something like honeysql in ruby or other languages?

donaldball19:03:58

arel and sequel are ruby libs that have some similarity

val_waeselynck20:03:01

> is there something like honeysql in ruby or other languages? You can tell Clojure is growing when you read stuff like this :)

firstclassfunc21:03:30

I asked this before but has anyone been doing any work with Clojure an a Karaf/OSGI container?

tmtwd22:03:49

@val_waeselynck: sorta simple_smile but I am more curious about honeysql itself

tmtwd22:03:01

like what influenced it for example

tmtwd22:03:14

ruby was just an example