This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-13
Channels
- # admin-announcements (6)
- # beginners (51)
- # boot (164)
- # braid-chat (49)
- # cider (10)
- # clara (17)
- # cljs-dev (13)
- # cljsjs (51)
- # cljsrn (10)
- # clojars (42)
- # clojure (195)
- # clojure-bangladesh (102)
- # clojure-berlin (8)
- # clojure-canada (1)
- # clojure-chicago (19)
- # clojure-colombia (4)
- # clojure-denmark (6)
- # clojure-russia (15)
- # clojure-ukraine (7)
- # clojurescript (257)
- # code-reviews (10)
- # community-development (292)
- # core-async (13)
- # datomic (26)
- # dirac (4)
- # dunaj (5)
- # dysphemism (5)
- # events (21)
- # funcool (15)
- # hoplon (115)
- # instaparse (31)
- # ldnclj (15)
- # mori-fork (43)
- # mount (5)
- # off-topic (18)
- # om (195)
- # onyx (13)
- # proton (9)
- # re-frame (11)
- # reagent (44)
- # slack-help (14)
- # slackpocalypse (1)
- # spacemacs (10)
- # yada (23)
I have some kind of unicode problem: some other system has files that look like they were stored improperly w.r.t to unicode: I have a file that contains "If You Don\342\200\231t Know”. Is there some string encoding that will parse that correctly? All variants of UTF-8, ASCII and ISO-85whatever haven’t worked so far
I've had that problem in the past and the only way around it that worked for me was finding the offending characters and replacing them with safe placeholders that indicate what was there...
I think if you have a data source with a lot of raw chat text, crazy stuff shows up that causes reasonable tools to barf or complain
@aaelony: I don’t think it’s a raw chat problem. it’s a user posts valid unicode, some other system handles unicode improperly, and writes it back out as ASCII or something, and now I want to re-parse it as the original unicode
seems like a common enough problem that there should be a library, if I knew what to google for
I think I’m looking for hte clojure version of http://blog.luminoso.com/2012/08/20/fix-unicode-mistakes-with-python/
Is there a way to test if an object can be printed in Clojure and read in ClojureScript? For example, #inst "2016"
can be read in ClojureScript but #error {...}
cannot.
[6[6[6[6[6[6/quit
@arohner: hey allen, looks like that's the octal escape sequence for http://graphemica.com/%E2%80%99.
so replace \ with 0, and get (Integer/parseInt "0342" 😎 -> 226
bytes 226 128 153, in a byte array, passed to (String. "UTF-8") yields the quote
would be a good library
One of the arities of if-let is [bindings then else & oldform]. What is the point of oldform?
it's nice that they thought about error messages at least in this case, but that is one confusing signature
thanks for clearing that up, I've pondered that a few times and couldn't really find anything with basic googling
I'm using boot, yesql and environ, although I suspect boot or lein the issue is the same
So I would like to pull the correct subname or dburl from environ based on the environment
So I have in foo.db
,
(def conn {... (env :dbsubname)})
(defqueries "queries.sql" { :connection conn})
The problem is before environ serves up things, my program evaluates (env :dbsubname) to be nil
So what's the best way to trigger the re-evaluation of conn
and the defqueries
macro?
@jethroksy: I recommend reading the environ code to see what it's doing. It's very little code iirc
It turns out to be a compile vs runtime issue, and there's no easy way to get environ and yesql to work together
@jethroksy: You can pass the connection to yesql when running the query (since yesql 0.5 I think). This might not be documented well though..
@jethroksy: you don't have to pass the connection spec at query definition time.
just pass the spec as the first parameter to the query functions themselves
also, may want to take a look at Component https://github.com/stuartsierra/component or Mount https://github.com/tolitius/mount to help manage runtime lifecycle of resources like database connections
@apviitanen: @jonahbenton just looked at the source and it seems like its possible. thanks!
is there a take-while that takes until and including pred becomes false?
e.g. (take-while neg? [-2 -1 0 1 2 3]) => [-2 -1 0] instead of [-2 -1] ?
I guess I can use split-with
hmm maybe not
I want to keep the laziness of not having to traverse the entire sequence
this’ll do
(defn take-while-and-n-more
[pred n coll]
(lazy-seq
(when-let [s (seq coll)]
(if (pred (first s))
(cons (first s) (take-while-and-n-more pred n (rest s)))
(take n s)))))
The :mirrors
configuration in my :user
profile is not picked up when I use lein war
, can anyone enlighten me why?
I guess I'll need to arrange for clojars to be down and hold that situation hostage to get the solution 😕
@hans: this may be related: https://github.com/technomancy/leiningen/issues/2058
@tcrawley: yes, it seems like that. unfortunately, as there does not seem to be a solution.
you may be able to replace the repos entirely: https://github.com/clojars/clojars-web/wiki/Mirrors
@tcrawley: We have proprietary software in our repository and by the way of setting a mirror, I'm making that software available to projects that need it.
seems like you would want that to be another repository, not a mirror. unless it is also mirroring clojars for you
But if a separate repository would work better for the proprietary stuff, we can move to that.
is this the lein war
task, or lein immutant war
? I know the latter doesn't respect mirrors
it seems odd that replacing the repos fully doesn't work either - what error do you see? just a failure to resolve the jars?
I'd think that the only way fully replacing the repos wouldn't work is if the war task hardcoded a repo
right, you'll get that warning, but can ignore it (at least for purposes of debugging here)
Just the proprietary ones. I've put this in my profiles.clj:
:repositories ^:replace [["central" {:url " "
:repo-manager true}]
["clojars" {:url " "
:repo-manager true}]]
:plugin-repositories ^:replace [["central" {:url " "
:repo-manager true}]
["clojars" {:url " "
:repo-manager true}]]
and also made the same entry for :plugin-repositories
in the project.clj
file in question.does http://nexus.lambdawerk.com/nexus/content/groups/public/lambdawerk/fixtures/0.10.0/fixtures-0.10.0.jar exist?
Could not find artifact lambdawerk:fixtures:jar:0.10.0 in central ( )
Could not find artifact lambdawerk:fixtures:jar:0.10.0 in clojars ( )
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
Compilation failed: Could not resolve dependencies
@hans: I don't know where it's picking up the primary urls then. the war
task doesn't do any dep resolution on its own
@alexmiller: thanks! Just what I was looking for
@tcrawley: thanks for caring. i'm hitting a brick wall with this and will probably have to dig into leiningen and/or lein-ring to fix it 😞
is there a way to check/validate data against a prismatic schema definition that does not throw an exception?
@hans curious- why mirror instead of just having nexus proxy clojars/maven central for you?
@hans: Thanks! should look more closely
@jonahbenton: that is what nexus does for us, and i think that :mirrors is the way to tell leiningen what the proxy would be.
I have an XML Structure, which has nested childrens. I want to differ between childs, which have a children and those who haven't. How could I achive this?
@danielgrosse: do you know http://blog.korny.info/2014/03/08/xml-for-fun-and-profit.html yet?
Yes. I worked through it, but didn't get it. My problem is the depth of the structure.
<data title="Title">
<children hidden="false">
<title><![CDATA[Innenbereiche]]></title>
<file>tui_5852</file>
<children hidden="false">
<title><![CDATA[Service]]></title>
<file>tui_5852</file>
<children hidden="false">
<title><![CDATA[Rezeption / Atrium]]></title>
<type>360</type>
<sound>background.mp3</sound>
<file>tui_5852</file>
<map>map_deck_05_pier</map>
</children>
</children>
</children>
</data>
There could be childrens at any level,
I want to build a edn structure out of it.
@hans did you try :omit-default-repositories?
@jonahbenton: no - how would that help? my workaround right now is that the dependency that lein ring war
cannot load is actually not needed during war construction, so i moved it into the appropriate profile. but the problem will resurface sooner or later, so i'm interested in fixing it.
from my cursory research, :omit-default-repositories
is from before ^:replace
existed and does the same thing (i.e. does not fix the problem)
if i'm dealing with core.async mults, is it more idiomatic to mass around a mult to various functions that need it and tap it within the function, or should i just tap a new chan at a higher level and only deal with actual chans in the lower level functions, or am i just worrying too much about this
I also tried the way of korny, with
(->> reader
parse
:content
(filter...))
But didn't found a way to find the correct children in depth@hans apologies, i was looking at an old project. your problem is that at war packaging time that proprietary dependency can't be found?
@danielgrosse: so you want to create a hierarchy from an arbitrarily nested xml hierarchy? it sounds as if you'll need to walk the structure recursively, constructing the new structure during the traversal. i often use clojure.walk
for such tasks, but there are other ways i guess.
@jonahbenton: correct - for some reason, the :mirrors
declaration in my :user
profile is not picked up during lein ring war
hmm, do you need to use lein ring uberwar?
@hans hmm, see this? https://github.com/weavejester/lein-ring/blob/master/src/leiningen/ring/war.clj#L232 lein with-profile +user ring war
@jonahbenton: i've seen that place in the code, but i could not devise the command line that you gave from it. let me try.
@jonahbenton: no dice, but thanks
any clues from increased verbosity: DEBUG=true lein with-profile +user ring war
one other shot in the dark- does the dep exist in your local fs repo, under .m2?
try lein -o
hi, when using clojure.java.shell/sh, if i read the doc correctly, you can only get the whole output after the command finishes, i'd like to consume the output as the command runs, i found this library: https://github.com/Raynes/conch, it seems to support that, any other suggestions?
hey folks. if i'm defining a new class in a clojure namespace with gen-class, and i want to utilize that class in another namespace... is there a better way than both requiring the clojure namespace AND importing the generated class?
got answer from IRC: only require is strictly necessary, import just allows you to refer to the class unqualified
so if referring to the class fully qualified is acceptable, import is not needed
ztellman: I’m feeling a bit dumb; I’m using manifold streams and deferreds and having trouble getting a thing that uses connect-via
to work. The question I have is: does it make any sense for a function that will only be accessed using connect-via
to return anything? I have a function that does some asynchronous http calls; inside of an manifold.deferred/chain call. I am noticing that unless I deref the result of the http call (in effect making it block), the http call never returns its body. I’m working on a small reproducible test now to help explain the issue.
What is the best way to set a static IP address for a clojure app when using heroku? I need to whitelist my IP address for queries to a database
@jtackett: the Fixie add-on https://elements.heroku.com/addons/fixie
there's also QuotaGuard https://elements.heroku.com/addons/quotaguardstatic and Proximo https://elements.heroku.com/addons/proximo
it does, but differently. promxio is kind... not as good as the others
here are examples in Java https://github.com/kissaten/proxy-examples
i don't think i have any in clojure.
the docs for each add-on might have some
@codefinger: tough to translate OO to clojure
or is there some kind of middleware or wrapper so that it will handle the routing to proxy for you
i wouldn't call my examples OO https://github.com/kissaten/proxy-examples/blob/master/src/main/java/Main.java
they are basically just bits of java code. i think they should translate pretty easily
oh so you basically make the requests with this library rather than a http-kit for example
does http-kit obey socksProxyHost system property?
i think most JVM http clients do
otherwise, set a proxy for the client manually. it probably has a way to do that
no, the addons create a proxy for you
this example uses apache httpclient (just like cli-http), so you'll need something like this https://github.com/kissaten/proxy-examples/blob/master/src/main/java/Main.java#L103-L110
give it a try and ping me if you get stuck. i lurk
Seems like a nice "better assert" tool
Can anyone tell me a good reason to switch from lein to boot? Or vice versa, perhaps?
or where I can find a comparison?
Three key things I see are: * displaying variable values in assertions, * returning value instead of nil for inline use * dynamic binding to add context to exceptions
I'm curious if theres been any thought/discussion about how clojure's assert messages could be improved in these ways.
@macromancer: I'm not sure if I am aware of 1:1 comparison, but this described move from a lein-based project to boot-based project - http://blog.michielborkent.nl/blog/2015/06/06/from-leiningen-to-boot/
looks like i have it bookmarked but have yet to read it.
@jaen thanks for reminding me!
IMO the biggest advantage boot has is when you're doing Clojurescript - it has more streamlined Clojurescript workflow than lein can offer. It's probably less useful for plain Clojure unless you have specific needs of your build process - with boot you can easily script creating multiple artifacts from the same codebase or somesuch, with lein you would probably have to find/write a plugin.
i'm doing a lot of clojurescript/figwheel dev, so that sounds pretty good.
i'm finding lein configuration gets quite large with multiple js targets, though i might be using lein inefficiently..
what i do want is the composability that boot should offer.
@jaen cool, thanks for your thoughts
haha, yeah I filtered that out, assuming you had meant something positive.
This is cool. Clojure executables using shebang notation
Yeah, that is pretty hand indeed, that for simple one-off things you don't even have to create a project, but can load dependencies inline
This also means I can probably get pretty close to one off clojurescript programs, opening directly in a browser..
@rfhayashi: conch works great for streaming. use it extensively in streaming pipelines
@macromancer just want to second jaen, with lein it was difficult to do things like also compile&autoreload sass. it looks like there’s a figwheel-like HUD for boot http://deraen.github.io/boot-cljs-tooling/ , haven’t tried it myself though
@nonrecursive This, aswell, perhaps https://github.com/aJchemist/boot-figwheel
@nonrecursive: not needed, boot-reload has that hud integrated now
no kidding! I am behind the times
@macromancer: boot-reload + boot-cljs-repl replicate most of the functionality of figwheel; there are some corner cases according to https://github.com/adzerk-oss/boot-reload/issues but I didn't really encounter them in practice so far
@joelkuiper: (take-while (complement pos?) [-2 -1 0 1 2 3])
=> (-2 -1 0) ;; aka take-until