#clojure logs

2016-12-08

09:04chouserHello, friends.
09:05hyPiRionhi there
09:09RovanionAbout the named keys/associative arguments discussion yesterday: Ended up converting my named args to an options map being passed in to the function which I then destructured in the declaration of the function. Became much easier to proxy functions after that so thank you all!
09:10RovanionSo for todays question: Is there a function like map but which maps f to on all the leaves of a nested map?
09:11RovanionSo that (leafmap inc {:a 5 :b {:c 3}} would return {:a 6 :b {:c 4}}.
09:13RovanionWhat I want to do is to truncate all numbers in: http://paste.debian.net/901209/ so that they're just integers.
09:13ridcully_postwalk?
09:14ridcully_,(clojure.walk/postwalk #(if (number? %) (inc %) %) {:a 5 :b {:c 3}})
09:14clojurebot{:a 6, :b {:c 4}}
09:15chouserridcully_: That's exactly what's in my repl. I mean _exactly_.
09:15RovanionHahaha you're all adorable!
09:15ridcully_chouser: it was in my repl too. magic ;)
09:16chouserHm, I mean -- I wrote the same thing at the same time.
09:16chouserBut maybe you understood that already, hence the ";)"
09:16ridcully_yeah. i meant, that it wrote it out in my repl first (too) and not just here
09:17ridcully_s/it/i/
09:17chouserah, yes, of course.
09:17chouserThe thing before it in my repl is the docs for postwalk :-)
09:17RovanionSo if % is a number return %+1, else return %. Cool!
09:18chouserRovanion: Note that operates on keys as well as values.
09:18chouser...and will descend into vectors, as well, etc.
09:18RovanionHence the need to check if the arg is a number.
09:18ridcully_was using that way to often recently - so i had it memorized
09:20chouser,(clojure.walk/postwalk #(if (number? %) (inc %) %) {[1 1] :a, :b {1 1, 2 [2 2]}})
09:20clojurebot{[2 2] :a, :b {2 2, 3 [3 3]}}
09:21chouserThus even with the 'number?' check, it may do more than you want in some cases. Depends on what you want of course.
09:21RovanionYeah, will screw up any map with numbers for keys.
09:21RovanionUnless that's what you want.
09:24chouser,((fn inc-leaf [m] (if (map? m) (zipmap (keys m) (map inc-leaf (vals m))) (inc m))) {:a 5 :b {2 3}})
09:25clojurebot{:a 6, :b {2 4}}
10:50neoncont_Trying to find a recipe to attach a watch to a js variable, is there a way?
10:51dysfunMutationObserver ?
10:52dysfunoh no, that only does DOM
10:53neoncont_d'oh
10:53neoncont_I suppose I could attach it, but I was hoping I could bind to localstorage
10:55dysfunit does awful things with state
11:26dysfunhello
11:26dysfunare you stealth osfameron?
11:27osfabibisiI'm work osfameron, yeah
11:27dysfunwelcome to our beautiful channel
11:28osfabibisiI love what you've done with the place ;-)
11:29dysfunso you're having a good look at clojure now?
11:30osfabibisiwe're deploying a sample microservice with it, to see if we want to use it as a team
11:30osfabibisiinstead of our current Python stuff
11:30dysfunah
11:30osfabibisithe other serious alternative would be Scala, which $boss hates ;-)
11:30dysfunmust say, i'm quite fond of clojure
11:31osfabibisiI'm quite enjoying so far, I have to say
11:31dysfuni'm not at all fond of scala though, despite liking haskell
11:31osfabibisiscala looks like "a better Java"
11:31dysfunpretty much
11:31osfabibisi(ah yes, the *other* serious option is Java itself, which I'm not very keen on)
11:31dysfunif you want to use java, clojure is the best language to do it from
11:32dysfunbut while you're here, we have a bunch of nice libraries too
11:33dysfunand if you're using postgres, we have some very nice things
11:33osfabibisinope, no postgres
11:34dysfunpity, i work on several postgres projects
11:34osfabibisiHTTP calls, Kafka, Consul
11:34osfabibisi(and MarkLogic as DB, but we interact with that via http)
11:34dysfunif you want a high performing http client, i recommend aleph (has a pool)
11:35osfabibisiah, we just went for the popular one, clj-http or some such
11:35dysfunyeah, clj-http is slightly more featureful at the minute
11:36dysfunthe main blocker aleph has for client use is multipart post at the minute
11:39deadghostdysfun, I've been thinking of making my project more cljs heavy
11:40deadghostmake my pages static
11:40deadghostkeep clojure on the backend for api calls from the pages
11:41dysfunclient i'm working on today has a clojure site, one page template rendered through selmer and the backend is a single page rum app with server side rendering
11:43deadghostdysfun, I don't see too many arguments against rendering clientside
11:43dysfunwell it's not strictly necessary in this case
11:43ridcully_is it intentional, that clojure.inspector/inspect-tree show the same element in a vector only once and leaves gaps for the dups before?
11:43dysfunbut i do want to understand how to do fully progressive react apps with rum
11:43deadghostnot really necessary in my case either
11:44deadghostit's just easier/nicer for me
11:44dysfunbut this is just an admin panel
11:44dysfunfuture things i do want it to work for
11:44deadghostI guess clientside rendering might slow load times
11:44deadghostand that might impact seo or whatever
11:44dysfunand my client hasn't complained too loudly about my slackness in doing it, so i get to try things
11:45dysfunif i can't browse your website in elinks, it's broken
11:45deadghostwhat is an elink even
11:45dysfunelinks is a terminal browser
11:45TimMcdeadghost: If your site won't display anything without JS, I often just won't come back.
11:45deadghostI'm not catering to nerds though
11:45TimMcI don't see why I have to run arbitrary programs from you in a VM in order to see your FAQ.
11:46dysfunare you catering to people who work in banks stuck on ie8 with scripting restrictions?
11:47deadghostno
11:47dysfunhow about people on slow connections?
11:47TimMcor when your JS breaks because a shitware browser extension installed by one of your non-nerd clientele screws with the page
11:47deadghostfor now, no
11:47TimMcYou see the most amazing thigns in CSP reports.
11:47deadghosthmm TimMc does that happen?
11:48TimMchahahaha yes
11:48dysfuni got banned from skyscanner for using ghostery this week
11:48scriptorhow often
11:48deadghostI use pentadactyl and it messes with stuff sometimes
11:48TimMcSometimes the malware will even try to mess with the CSP headers to make itself allowed
11:48scriptordeadghost: what kind of app is this
11:48TimMcor heck, even antivirus software will do these things
11:48TimMcJS is *fragile*, don't put all your eggs in one basket.
11:49dysfunanyway, i think we've established that i don't want to use whatever site deadghost is building
11:49deadghostscriptor, makes websites for franchisees of a specific franchise
11:49scriptordeadghost: what are the pros to clientside rendering
11:50TimMcAs long as you use static pages for the basics, I'd still use it. :-)
11:50deadghosthmmm
11:50justin_smithI make an application, for the most part the fact that it runs in a web browser is an implementation detail - we have no "basics"
11:50TimMcThere's a chat site I frequent that is all built in React and whatnot, but the home page and etc. are all static.
11:50justin_smithI mean there's a home page in wordpress or somesuch, but that's not something I ever touch
11:51scriptorI'm fine with actual applications using js rendering. Chat apps, editors, etc.
11:51TimMcright
11:51scriptorbut I'm sick of sites that are just supposed to display text pretending they're an SPA
11:52dysfunTimMc: i'm trying to make a react app that decomposes to a useful static stie
11:52TimMcbut I get the impression these are currently static pages, not an app
11:52TimMcdysfun: Yeah, I feel like we're continually just 1-2 years away from websites that can fluently render both clietn and server side.
11:53dysfunwell, the react team has pulled off server side rendering now
11:53TimMcA coworker pointed out that the hard part is the intermediate states of user interactions.
11:53dysfuni get it for free through rum
11:53dysfunTimMc: yeah, animations and such
11:53scriptorit's kind of funny that "server side rendering" is a thing now
11:53TimMcheh
11:53scriptorlike, that was the default 10 years ago
11:53dysfunyeah, but it's improved
11:53dysfuncause i can build it with reusable components
11:54justin_smith"the whole page is a gif, just send the next frame of the animation from the server"
11:54scriptorI thought it was more about reusing the front-end code to also generate html on the backend
11:54TimMcdeadghost: I don't have numbers on how often browser-invading monsters from another world muck with the page, sorry. It's not super uncommon, though.
11:54scriptorhence react
11:54TimMcjustin_smith: oh shit
11:54TimMcand make it an imagemap
11:54justin_smithexactly!
11:54justin_smithtotal freedom
11:54ystaelcongratulations you have built runescape
11:54deadghostI've seen a few sites that display text as gif
11:54TimMcplease someone make this and then shoot it
11:55TimMcystael: Run, escape!
11:55dysfunscriptor: well the point to me is that i just want to write the code once and use it from both contexts. the name is just an artifact of the way react was born in the frontend imo
11:55ridcully_justin_smith: and pixel accurate layouts!
11:56TimMc(I can't read it any other way.)
11:56TimMcdysfun: If rendering react on the server means less XSS, I'm all for it just for that.
11:56Bronsasi`
11:56Bronsa(welp, wrong window)
11:57justin_smithsi`
11:57dysfunah yes, and it caught some bad input because it forced me to "do it properly" instead of essentially concatenating strings with a template language
11:58dysfunoverall, quite happy with "server side rendering"
11:58dysfunalthough that said, i'm using the rum 'static' render, not the react copy the data over one
12:01deadghosthmm yeah I think I'll eventually move stuff that can be rendered serverside to the back
12:01deadghostI really can't come up with convincing reasons for me to render simple pages clientside
12:01deadghostother than it's already written + lazy
12:02lok[m]Who can spare 2 hours to settle my tablet?
12:06TimMclazy is good
12:06deadghostarguments against clientside rendering isn't strong enough for me to immediately get to it
12:06MJB47pretty sure he means lazy as in "cant be bothered to set up server side rendering"
12:07dysfuni'd get server side rendering set up early if you want to use the integrated stuff
12:07dysfunbecause it's impossible to debug when it goes wrong
12:07deadghostdysfun, integrated?
12:08dysfunthe native react server side rendering
12:08deadghostand you're using node for your server yeah?
12:08dysfunit embeds a checksum and such
12:08dysfuni'm not using it because something went wrong and i didn't do it early enough i can just mess around in git
12:08dysfunso i changed to rum's static rendering instead and the only difference i notice is that react stops barking at me
12:09deadghostdysfun, I also get things for free via reagent yeah?
12:09dysfundon't think reagent has server side rendering support
12:10MJB47it kind of does
12:10dysfunand the react server side rendering support is js
12:10MJB47https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/reagent-server-rendering
12:10dysfunoh ok
12:10MJB47in the same way that react does
12:10dysfunoh, nashorn
12:10dysfunfuck that
12:10MJB47well, this is one way to do it
12:10Bronsawas gonna say that
12:10Bronsausing nashonrn to do server side rendering is a terrible idea
12:11dysfunrum can do it without nashorn
12:12deadghostehh maybe I'll think about porting to rum
12:12deadghostreally my app can be architected much better
12:12deadghostbut you know
12:12deadghostwhatever works
12:12dysfungotta say, i was pretty anti-react, but rum swayed me
12:13MJB47you dont need to use nashorn for reagent
12:13dysfun"you can use rhino too"?
12:13Frozenlockdysfun: FYI, some people are looking to replace React in Reagent https://github.com/reagent-project/reagent/issues/271#issuecomment-265795936
12:14MJB47https://yogthos.net/posts/2015-11-24-Serverside-Reagent.html
12:14dysfunoooh
12:14MJB47heres a guide compiling to hiccup
12:14MJB47but you can also use node or w/e
12:14deadghostwhat's preact
12:14deadghostI can't keep up with all this js
12:14deadghostchanges every half week
12:15dysfun"Fast 3kB alternative to React with the same ES6 API."
12:15deadghostwhat's wrong with react
12:15dysfunit's big
12:15MJB47its react without all the stuff that makes react usable for production code
12:15MJB47so its smaller
12:15dysfunwhat do they remove?
12:15osfabibisidysfun: eeek, HTML in code :-(
12:16MJB47i dont remember, i just remember looking into it last month or so
12:16dysfunosfabibisi: html as data!
12:16MJB47and thinking "well yeah if react dropped support for ie10 it would be smaller too"
12:16BronsaMJB47: that approach won't work for components using react.core/create-class
12:17osfabibisidysfun: as data that your designers can't read! yay!
12:17MJB47idk about you but ive never had a designer go in and edit an html template
12:17MJB47css rarely
12:17dysfunosfabibisi: i've concluded that it doesn't matter
12:17FrozenlockBronsa: that's a bummer, I've used that quite often. :-/
12:17deadghostosfabibisi, I'd like to believe designers can understand <p>text</p> == [:p "text"]
12:18justin_smithTFW the designer breaks the code with smartquotes
12:18TimMcD-:
12:18dysfunif you're doing something where react makes sense, you've already jumped the complexity shark and your designer won't keep up anyway
12:18justin_smithTimMc: the worst thing is my console font at the time didn't really display the smartquotes differently than normal '"
12:18TimMcI want a complexity shark.
12:19osfabibisidysfun: hmm, that's an interesting perspective. I still thought that a more "template animation" approach (like HTML::Zoom) would work with React or similar though
12:19justin_smithTimMc: with fricken O(1) lasers
12:19osfabibisiI was more interested in cycle.js, but again the devs seem to focus on programmatic code, and I can't get over the strong gag reflex
12:19osfabibisier, programmatic *html*
12:19dysfunHTML::Zoom would be utterly trivial to port to clojure. i was doing the work necessary for it the other week
12:19deadghostwe like composable data yes
12:20justin_smithmaybe O(n^n) lasers are better
12:20dysfunhowever, i've long since thought of it as the right answer
12:20TimMchttp://www.bluebird-electric.net/artificial_intelligence_autonomous_robotics/insectronics_robotics_pictures_animatronic_soldiers/shark-robot-drawings.jpg
12:20dysfunrum is very very nice
12:20osfabibisiyeah, I keep meaning to port it to Haskell, as I haven't found a templating library I like there
12:20dysfunif the cost of that is we need to teach html people a little, so be it
12:20deadghostdysfun, how do you have your server set up?
12:21dysfunno, i haven't found a haskell templating library i like either
12:21osfabibisiyou need to teach them to build and run clojure code ... that's arguably not "a little"
12:21deadghostdo you have nginx reverse proxy to your node server or what?
12:21dysfuni haven't deployed any nodejs yet
12:21deadghostI've never significantly worked with node servers
12:21dysfunthe site is currently clojure deployed as an uberjar with aleph behind nginx
12:22dysfunor i might have switched it over to apache, i forget
12:22justin_smithosfabibisi: if you do it right it should be your version control, plus lein, plus maybe 2 or 3 lein commands
12:23dysfunosfabibisi: have you seen figwheel in action? it's super sweet
12:23dysfunand you get that with one command from a git checkout
12:23deadghostdysfun, when/how do you render your rum stuff?
12:23justin_smithtrufax
12:23dysfundeadghost: i use render-static-html on the server and mount it on the client over the top
12:24deadghostis render-static-html a rum fn?
12:24deadghostoh rum is clj too
12:24deadghostthat's neat
12:24dysfunyes, rum is very neat
12:25deadghostso you're actually using rum from clj
12:25dysfunyes
12:25dysfuntemporarily
12:25deadghosthmm?
12:25dysfuni'm going to take the clojure out back and shoot it next week to replace it with nodejs
12:25deadghostwhat's the upside
12:26justin_smithdysfun: deploy it to a great big server out in the country with lots and lots of ram
12:26dysfunhaha
12:26dysfundeadghost: memory. it's a one page site, the jvm is a little overkill
12:27deadghosthmm yeah that's been a great annoyance
12:27deadghostwhen would the jvm > nodejs server
12:27dysfundepends what you're doing
12:28dysfunif all you are is a frontend to a database, quite possibly never
12:28dysfunif you're doing actual transactional logic, then the jvm is a good candidate
12:29deadghostdysfun, is that another way of saying heavy computing
12:29dysfunsure
12:30dysfunin general, "heavyweight" = jvm, "lightweight" = not jvm
12:30osfabibisijustin_smith: dysfun: "plus lein" isn't free. It took a pair of devs here a half-day to get `boot repl` running this week...
12:30justin_smiththat's boot not lein though
12:30dysfunalso wut?
12:30dysfunboot just works here
12:31justin_smithI've never had issues getting lein running (unless the project itself is broken, and that's up to the devs)
12:31osfabibisiwe have a corporate proxy, + installing the right version of java, I think were the issues
12:31TimMcouch
12:31dysfun"right version of java"
12:32dysfunthat should be whatever your distro offers you
12:32osfabibisiworkaround for proxy was connecting to a different network, which then required reconfiguring email, irc, ssh proxies, etc. (so you can imagine how long we spent trying to configure whatever Java needed to speak to outside world before we gave up ;-)
12:33sobelWelp, i just grepped a couple codebases for 'raynes' to be sure. Yup, I'd call that a legacy.
12:33osfabibisiyeah, that was fine on my new mac, but caused some fun on $colleague's linux machine
12:34TimMcSo this is a proxy that you have to configure software for to talk to the outside world?
12:34osfabibisianyway, that busywork is all fine if you're actually writing clojure, skeptical about adding to an HTML designer's workload (+ a dev to handhold them)
12:35deadghostdysfun, I'm also considering a migration to cljs only but it sounds like I'd get most of the benefits if I just port my reagent code over to rum
12:35dysfunpretty much
12:35dysfunand a seamless upgrade path
12:35osfabibisiTimMc: it's just a corporate socks proxy. We have e.g. .curlrc and browsers configured to speak to it as part of our onboarding setup. But couldn't figure out getting boot to talk to it
12:35dysfunosfabibisi: i've never had to deal with it behind a corporate network, i think this is the difficulty
12:36deadghostdysfun, I'm concerned about stuff not quite working cljs only
12:36deadghostlike datomic
12:37dysfunwell no, datomic won't work without something clojure
12:37osfabibisidysfun: I guess if we were a JVM dev team already we'd have had the local knowledge too
12:37dysfunthey have a new model where you can proxy, but you'd still need something to run that
12:38dysfunosfabibisi: hrm, i'd say there's a distinct skew in people in here towards people moving from java
12:38dysfunperhaps this explains why - only java people pass the jumping through hoops test
12:38sobeli used to use squid as a transparent proxy, just redirecting port 80 through it. it was only a slightly special squid config to make it work in transparent mode rather than regular proxy mode, IIRC.
12:39sobelif you're building in a container, you might be an iptables statement away from doing the same
12:39technomancydysfun: you mean moving from java-the-language or moving off java-the-platform?
12:40dysfunjava the language
12:40sobeli find it's not that i want to be off java the language or the platform, so much as i want to be able to use other platforms or at least their languages
12:40TimMctechnomancy: It's nice to see you around here again!
12:41sobelclojure has done a pretty interesting job of bridging language gaps and interoperability needs
12:41technomancyTimMc: thanks; likewise =)
12:41sobelimo
12:41technomancysobel: you mean bridging different languages on the same runtime or bridging different runtimes?
12:42sobeltechnomancy: yes to both
12:43technomancyI dunno; whenever I read anything about cljs it's completely baffling to me
12:43technomancyIMO it's much easier to change languages than to change runtimes
12:44dysfuntechnomancy: dunno about that, i'm moving over to nodejs pretty easily at the minute
12:44TimMcLangauges are easy to learn, ecosystems are hard.
12:44TimMc(libraries, build tools, etc.)
12:44dysfunand nodejs is vastly improved by the addition of the clojurescript compiler
12:44sobelruntimes/ecosystems are an investment. i like being able to harnes those investments under programming languages.
12:45sobeli like that the language is flexible enough handle this case without me developing a rich abstraction over my problem space
12:46dysfunjava and javascript both have libraries for everything you could ever need
12:46dysfunand you never know all the libraries you need for a project anyway
12:46dysfunand even if you did you'd have to go check the docs to make sure
12:46justin_smiththere's a few rough edges, like the package/dependency/namespace triad
12:48sobelthere'll always be things keeping real programmers in work
12:48sobelbut there's a solid opportunity to share healthy amounts of server code with your client that wasn't there before, and that's kinda cool to me
12:50TimMcCertainly if it means not having to reimplement e.g. URL parsing I am so down with that.
12:55sobeltalking with a peer earlier, we id'd a number of basic data structure transforms that were easily applicable on the server as the client. stuff like menu pruning, message templating/localization/i18n, its entire data edit/cache layer
12:56sobeli'd love to sell my team on isolating the server from the database the same way we isolate the client from the database (REST) and that we could do it using the exact same code
13:02TimMcsobel: Hmm, time for a business logic layer? :-)
13:03tdammersmicroservices are clearly more webscale than plain old REST
13:03sobelhttps://pbs.twimg.com/media/BNELF1GCUAExynU.png
13:05justin_smithhaha
13:05sobelrealistically, we have a decade of technical debt and it's not that crazy to refactor it as microservices. there's a concurrent business case that makes it more attractive than it might seem from what i've mentioned so far.
13:06sobelnamely, opportunities to make smaller sales with relatively more focused products
13:07sobelthe sad part is i think selling clojure here would be the deal killer. "we'll never get our team using a functional language, we'll never be able to hire that skillset"
13:08dysfunso call it an enterprise language then
13:08sobeli'm backdooring it through the star engineers (civil engineers, we're not overtly a software co)
13:09sobelhehe
13:09dysfun"you might think that but i couldn't possibly comment"
13:13TimMcsobel: "We'll never be able to hire any of those people who are incredibly eager to get a job using a functional programming language."
13:15TimMc(OK, OK, a lot of said people are pretty junior, but when has that stopped people from hiring anyhow...)
13:15TimMcAnyway, just call it a Java library. ;-)
13:15justin_smithTimMc: framework, surely
13:15xemdetiaabstract framework factory, surely
13:15TimMcThat might sell it better, yes.
13:16TimMca list processing framework, if you will
13:16justin_smith"it's a framework that injects code dependencies via static data files describing algorithms and updates the classloader to access new native code generated at runtime - cutting edge stuff"
13:17tdammersa framework is a library that has forgotten what it set out to do in the first place
13:17TimMcA framework is a library with control issues.
13:18sobelTimMc: funny, i didn't even ask to use clojure the first time, i just added it to the maven deps and started committing code.
13:18sobelbecause it is exactly a java library
13:18sobeli think i'm just going to start saying it's a Thneed
13:18sobel(which is a wonderful thing which everyone needs)
13:19sobelTimMc: can i quote you on that re: frameworks? :)
13:19justin_smiths/clojure/monorail/g
13:20tdammersTIL angular insists on having a module system of its own that is both mandatory and incompatible with the existing JS module systems that everyone else uses
13:20xemdetiamaybe I can get around clojure as a dep if I just call it a JCL
13:22TimMcsobel: Sure, but I probably stole it from someone else. :-P
13:23sobelfair!
13:32tdammerssneaking in technologies behind your stakeholders' back can backfire badly
13:33tdammersif you have to do it, start with a small low-stakes project with a very limited scope
13:33tdammersuse that to show what you can do with this tech
13:33tdammersmakes it much easier to get management buy-in
13:33technomancyor be content to find a new job if it backfires; handy in a last-ditch situation where you already want to leave =)
13:33tdammersor that, yes
13:35tdammersbut assuming that you actually want to keep your job, the ideal situation would be that you build a prototype in, say, clojure, and make it such that you finish it way ahead of the deadline, exceed the expectations, and go crazy on maintainability & readability
13:35sobeltdammers: it went through code review by all the eyes who might care. they aren't entirely cutoff from the world of other languages on the jvm; we already have jython and groovy in the mix.
13:35sobelit was a small, low-stakes project of limited scope. in fact.
13:35tdammersin that case, ignore what I said
13:36sobeli mean, i didn't run it up to the director for permission, but i can't operate in a vacuum even if i try
13:36sobelthe 'sneaking' is that 98% of the other code is java and there's no official line about language use, except the obvious one of getting pushback if it's not in the JVM ecosystem
13:45pepijndevos:'(
13:47TimMcpepijndevos: ?
13:48pepijndevosRaynes. TBH it hit me harder than a friend of my parents passing away last week.
13:49sobelpepijndevos: same, it's made me reconsider who my real community is.
13:51pepijndevosOn really awkward question from a non-native speaker though: What is meant with "bringing him home"?
13:52deadghostpepijndevos, they're shipping his body back to his home state
13:55pepijndevosOh ok
13:59TimMcI was really happy to see how quickly people raised the money for that.
13:59TimMcand more
15:58{blake}bringing
15:59{blake}Deployment! How does it work? Is there any particular issue with using ring?
15:59technomancynah, ring is great
16:00justin_smithif you use 'lein ring server' to run during dev, 'lein ring uberwar' will make a war file you can run in a container and 'lein ring uberjar' will make a standalone jar you can run with a jvm and nothing else
16:01justin_smithif you don't use lein ring, 'lein uberjar' will make a standalone you can run with a jvm
16:18jonathanjwhat is a war?
16:19justin_smithweb archive
16:19justin_smithsomething a servlet container can run
16:19jonathanjhow do you use it?
16:19justin_smithby giving it to tomcat
16:19technomancyif you don't already know, you probably don't want to =)
16:19jonathanjokay
16:19justin_smithor jetty, or wildfly, or whatever
16:19jonathanjtechnomancy: that's more or less what i figured
16:20justin_smithjonathanj: the most common way to have it come up is that beanstalk from amazone is pretty easy to use and deploy, and it needs wars (it uses beanstalk)
16:20jonathanjjustin_smith: thanks!
16:20justin_smitherr, tomcat
16:20jonathanji'm too poor to deploy stuff on aws
16:21justin_smithheh, well, beanstalk spins up easily once it's set up, which is nice, and it needs war files. But just using java with an uberjar is easy enough usually.
16:22jonathanjthe latter is how i've deployed my ring apps in the past
16:22jonathanjwhat's the advantage of using beanstalk though
16:23justin_smithbeanstalk is good for like "OK I only need one server but if I get on HN I'll have two minutes notice to have 20 servers running"
16:23justin_smithit just generally makes it easy to point-and-click spin up as much as you need, and shut them all down when you're done
16:25jonathanjhmm, seems pretty interesting, i don't have any spare money to burn on an experiment but i have a few random uberjar deployments lying around on various machines, i wonder how much it would cost to run them on beanstalk
16:25justin_smithalong with being able to see all your logs from one place and auto-restart if things crash and easy rolling upgrades and nice things like that
16:25justin_smithjonathanj: also, one beanstalk can run more than one app from different routes on one host
16:26justin_smith(which is one reason people like the whole container thing)
16:26jonathanjwhat does the word "route" mean in this context?
16:26justin_smithjonathanj: http://foo/bar is one route, http://foo/baz is another route
16:26jonathanjokay
16:27justin_smitheach one can be served by a different jar (each one things it is serving /)
16:27jonathanjthat's prett cool
16:27jonathanjhow do you configure your applications?
16:27justin_smithit's a nice workaround for the heaviness of the vm (as long as the box can handle it all of course)
16:27justin_smiththere's container level config that decides how routes map to war files (aka jars but with some special config)
16:28justin_smiththe config for the war tells it how to handle things from inside a container
16:28jonathanjhow do you configure your application's settings though?
16:28justin_smithand then there's some classloader stuff that keeps the apps segregated
16:28jonathanji guess if they're containers there's some way to set up the external environment or something?
16:28justin_smiththat's also set up in the war and the container (different settings go on each side)
16:29jonathanjdo you use elastic beanstalk?
16:29justin_smithideally to run in a container you should not be relying on external environment much, and if you do need environment / os tooling then beanstalk might not be a good pick
16:29justin_smithI used it extensively in the past
16:29justin_smithbut not with my current app
16:30jonathanji was mostly wondering how you'd work command line arguments or config files
16:30justin_smithoh, yeah, that stuff is all set up by the container
16:31justin_smithbut really it isn't a "command line argument" any more, rather it's the strings passed to -main (with a well designed app that difference should not matter of course)
16:32justin_smithit becomes much easier to rely on resource files on the classpath and jvm system properties, all else being equal
16:36justin_smiththat's part of what makes environ useful actually, it makes switching the source of that config easy
16:45{blake}technomancy, justin_smith thanks
16:45{blake}I'm actually deploying to Amazon.
16:46{blake}I've got an EC2 but I suspect they'll push me into Beanstalk.
16:57{blake}Is there a "search in sorted list" for Clojure?
16:58justin_smith{blake}: there's sorted-set and contains?
17:00{blake}Sure, but don't those manipulate the existing structure?
17:00{blake}Well, I mean, "sorted-set".
17:01justin_smithsorted-set is a data type, it's sorted and supports contains?
17:01justin_smithit's the closest thing I know of to what you asked about (for clojure built in things at least)
17:04{blake}OK, so if I have a list '("apples", "bananas", "cherries", "dates") and want to get back '(2) when I search for "cherries", but exploiting the sorted nature of the list, I think I build my own?
17:04{blake}And if I have '("apples", "bananas", "cherries", "cherries", "dates") and want to get back '(2 3)--
17:04{blake}Those are the two situations.
17:05justin_smithyeah, I don't think clojure has anything built in that would do that
17:05technomancyhow does sorting a list help if access is still O(n)?
17:06justin_smithtechnomancy: yeah, I would assume it would have to be both sorted and associative (so more of a sorted vector I guess)
17:08{blake}The list is already sorted.
17:08justin_smith{blake}: the point is that in clojure lists are not associative, getting the nth item takes n steps
17:08hiredmanbut clojure lists don't have random access
17:09{blake}Oh, I see. Well, that's what I'm trying to get around. =)
17:09{blake}So I should just stay away from lists.
17:10{blake}What I really have is an array.
17:10{blake}And I'm just trying to get to it from Clojure. I thought I might be able to use lazy-sequences to optimize.
17:11justin_smith{blake}: with an array, you can use Arrays/binarySearch
17:12justin_smith,(java.util.Arrays/binarySearch (into-array [:a :b :c :d]) :b)
17:12clojurebot1
17:12justin_smithif it's actually an array, at least
17:12justin_smith,(java.util.Arrays/binarySearch (into-array [:a :c :d :b]) :b) ; fails if the array is not sorted
17:12clojurebot-2
17:45neoncontrailsAny suggestions for a sexy, real-world example of Specter in action?
17:46ridcully_the author did a nice example with ballancing bank accounts on a conference. thats you yt
17:46neoncontrailsThe impression I'm getting from the docs is that a certain map structure is required in order to get optimal use out of it
17:49justin_smithhow so?
17:53neoncontrailsI could be wrong. Lots of the examples involve numerical predicates on indices, and nested arrays
18:00neoncontrailsjustin_smith: say you have a somewhat nested collection of components whose values and sequence doesn't really change, but accessing the appropriate datum is awfully longwinded in the base cljs syntax. Is Specter a good fit? Is Om/cursors possibly a better fit?
18:02neoncontrailsI do see that Specter has primitives for declaring paths, but it seems like this is mainly for mapping functions and operations over trees
18:12markmarkmarkneoncontrails: it looks like you can use the select family of functions/macros to just get things from a collection using a path
18:39libertytraderhola
18:40markmarkmarko/
20:43tianshuHey, guys, it's possible to have some sounds when grep command have any output?
20:44tianshuis it possible? or easy to implement?
22:17danneuyou could pipe grep into a script that does it
22:35KenaiHey folks. Is there a UI builder out there for Reagent?