#clojure logs

2014-06-07

13:53arrdemBronsa: config-map branch is up.
13:55bobbrahms1
13:57Bronsaarrdem: looks fine, thanks for the docstrings :3
14:00arrdemBronsa: there's more where that came from :P
14:21FrozenlockIs there a :subdomain field in compojure?
14:21Frozenlock...or do I need to parse it myself from the host?
14:31augustlis it ok for my "app instance" (stuart sierra style) to have atoms, or should I go all in and have my business logic return a new version of the app instance, or something like that?
14:32augustlgiven that my app instance will be called from multiple threads (a servlet) managing that return value seems nasty..
14:39justin_smithaugustl: with concurrency, the only way to have the app instance return a new version of itself is by allowing some coordination of threads, and that is what atoms and refs are for
14:41augustlis there a way to atomically get the value of an atom _and_ set it to a new value?
14:41augustlin this case it's for my app shutdown function, where I want to do stuff with an atom but ensure that no new items are added while I'm shutting down
14:41justin_smith(doc swap!)
14:41clojurebot"([atom f] [atom f x] [atom f x y] [atom f x y & ...]); Atomically swaps the value of atom to be: (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects. Returns the value that was swapped in."
14:42augustlI don't want the value that was swapped in, I want the value that was there before the swap :)
14:42justin_smithaugustl: your shutdown function is the arg to swap!
14:42augustlreset! also returns the new, not the old value
14:42augustljustin_smith: ah, of course :)
14:43augustlswap! won't guarantee that my function is the last one to run, though..
14:44justin_smithyou want something else for proper locking, atoms imply that retries are OK
14:44justin_smiththey are not a locking construct
14:44justin_smith(doc lock)
14:44clojurebotGabh mo leithscéal?
14:44augustljustin_smith: yeah sounds like I want something else :)
14:44justin_smith(doc locking)
14:44clojurebot"([x & body]); Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances."
14:44justin_smith(locking your-atom ...) may be what you want
14:45justin_smithbut then it is up to you to ensure there are no deadlocks, livelocks, etc.
14:45justin_smithit is very low level stuff
14:45augustlwhat I _really_ want is for my system to not modify my app state while it's shuttting down
14:45augustlsay shutdown is called while a thread processes a request, for example
14:45justin_smithalso it only really works if everything that uses that atom in a way you care about uses the locking statement
14:45justin_smithit is brittle
14:45Bronsaaugustl: I mean, you could be a really awful person and do something like user=> (def a (atom 0))
14:46Bronsauser=> (let [p (atom ∅)] (swap! a (ƒ [old p] (reset! p old) (inc old)) p) @p)
14:47justin_smithaugustl: then maybe what you really want is for shutdown to stop all the threads first
14:47augustlI guess ideally I would like to control the executor that invokes my app, so I can poll it until there are no active threads and then shut down
14:47justin_smith(all the other threads that is)
14:47augustljustin_smith: yeah :)
14:47augustlnot sure how to best handle that since this is typically done automatically by jetty/servlets
14:47justin_smithmaybe (shutdown-agents) does the trick? it should not shut down until they are all done
14:48augustlperhaps I should have an additional executor for my own app
14:48augustlsounds like a lot of extra threads though
14:48augustljustin_smith: looking it up!
14:48justin_smithyou can use jvisualvm to look at the threads that exist in your app at runtime, and to see if shutdown-agents really stops all the ones you care about
14:49augustlthere are some operations in my system that I want to make completely serial anyway.. So perhaps taking control of the thread pools makes sense in my case
14:49justin_smithno if ring / jetty is using it's own threadpool that shutdown-agents doesn't know about, then your back in low level land again I think
14:49justin_smith*now
14:49augustlhaving my app support getting invoked by anyone at any time from any thread sounds like a world of coordination hurt
14:50justin_smithaugustl: maybe you want a serialization mechanism, I like java.util.concurrent.SynchronizedQueue
14:50augustlyeah that sounds nice
14:50justin_smithso instead of invoking things directly other code puts events on your queue
14:50augustlI wonder how large a servlet/jetty thread pool typically is
14:51augustl50 or so extra threads won't hurt that much I suppose ;)
14:51justin_smiththen the thread pool you control decides how to handle events, and when to stop handling them, etc.
14:51justin_smithvery narrow and easy to control surface of interaction
14:51augustlyeah this sounds very pleasant :)
14:51augustlexcept from the extra threads of course, but then again that's just a gut feeling, no idea if it's a real problem
14:52justin_smithmaybe you can be more lenient and use a queue with a length other than 0 - synchronizedqueue is very strict - it blocks until the previous contents leave
14:52justin_smithwell you decide how many threads are dispatched from the requests in the queue
14:53justin_smithand you can use for example agents or futures that share clojure's nicely handled thread pool and you can bind the ones you are using and manually control those
14:53justin_smithwill still using the shared pool
14:53justin_smith*while
14:55augustlmaking it a TODO for now, looking forward to implementing this
14:56augustlonwards to the actual business code for now though ;) will use an atom, and solve shutdown by taking control of threads executing my code later
15:01justin_smithaugustl: also, core.async is another paradigm for addressing these same concerns / coordination issues
15:01augustljustin_smith: is core.async good for doing RPC? Or is it more of a queue system?
15:01augustlas in, get a request, return a response
15:02justin_smithaugustl: well, queues are one way to coordinate RPC (among other things they can do)
15:02justin_smithit is about handling and sending messages
15:02augustlhaven't done that before.. But I guess all you need is some kind of request ID
15:03justin_smithright, you would have an intake worker, and then assorted handlers, and the request would have to include the info needed to respond
15:03justin_smithinstead of a request ID you can pass the open socket to the client
15:03justin_smith*the open socket the client is connected to* I mean
15:04augustlah, that makes sense yeah
15:04augustlno need to create an id when one already exists :)
15:04justin_smithgoing with that whole functional passing state to functions idea
15:04justin_smithright
15:11tolstoyDoes om/transact! and om/update! really take a tag, and do they really show up in the tx-listen callback? I'm not seeing them.
15:29tolstoyAh. transact! expects a "korks" argument, even if the path is the root. An arity issue, I suspect.
15:37borkdudedoes anyone happen to know what merge-by is in scala?
15:39pdkhey, when you're writing the LICENSE file for a new project
15:39pdkis it ok to abbreviate your name in the copyright notice
15:43Glenjamini'd err on the side of caution, but you're better off asking a lawyer if its important
15:43pdklike just f.m. last vs. first middle last
15:43clojurebotPardon?
15:49pdkhttp://www.copyright.gov/title17/92chap4.html
15:49pdklooks like a recognizable abbreviation is okj
16:01FrozenlockCopyright Frozenlock 2014
16:05FrozenlockBtw, how does one proves his identity when using 'official' names in a copyright? It's not like there's only one John Smith in the world.
16:05Frozenlock*prove
16:06FrozenlockWe need namespaces for names :-p
16:18arrdemFrozenlock: you can provide a contact method and/or handle to add more bits of information to an otherwise useless name :P
16:18arrdemFrozenlock: most of my stuff is (c) Reid "arrdem" McKenzie
16:18arrdemwhere "arrdem" is unique to me AFAIK
16:19FrozenlockWhich one is the useless one? Reid Mckenzie, or arrdem? :-p
16:20arrdemFrozenlock: your "John Smith" is pretty useless :P
16:20roppongininjalight table v sublime text + sublimerepl?
16:21roppongininjaor any other better alternatives (no time to fvck around with emacs)
16:22Frozenlockbetter alternatives? Emacs... No time to fuck around emacs? Well... use Emacs and don't fuck around!
16:22FrozenlockI'm so funny today...
16:22arrdemthen apparently you have no time to get used to the current top rated Clojure repl...
16:22arrdemLight Table's repl is famous for being a "maybe works" still in development afair.
16:22Bronsaroppongininja: leaving emacs aside, I've heard cursiveclojure is pretty good
16:23Bronsaand should Just Work™
16:23yeoj___but hey it's saturday. thats what saturday is for.
16:24yeoj___actually for me cider just started deciding it didn't understand any of the classpath business going on so i'm trying to figure out what went wonky
16:24yeoj___then i'll get back to work
16:33yeoj___for somereason cider connects to the repl, but gevise me "class not found exceptions" everywhere... i didn't have this problem yesternight. i'm also getting "Cannot decode message" in emacs, something about the nrepl middleware
16:33yeoj___i made something borken.
16:41s_kilkHi all, is anyone here using Clojure web servers with a SQL backend in production? I have a few questions related to handling SQL migrations.
16:45dbushenkos_kilk, try http://flywaydb.org/
16:50s_kilk@dbushenko, thanks, I'll look into that. do you use it?
16:52FrozenlockEh... I wanted to activate a SSL certificate today... but Namecheap email servers are down. :-(
16:53Frozenlock(and they send to SSL stuff to the domain email)
16:53Frozenlock*the
16:56dbushenkos_kilk, yes
16:59s_kilkdbushenko, thanks!
17:06_pr0t0type_Hey Guys, so I know I can use reify to implement an interface. however, how do implement other methods within that reify call? When I try to, I get a "java.lang.IllegalArgumentException: Can't define method not in interfaces"
17:07Glenjamin_pr0t0type_: you can implement multiple interfaces
17:09_pr0t0type_Glenjamin: I see, so there is no way to inline a definition right in reify without another interface
17:09Glenjaminnot as far as i know
17:10_pr0t0type_Glenjamin: thanks
17:40JokerDoomWorkAny recommendations for excellent Lispy/Clojurey books?
17:41bbloom~book
17:41clojurebotbook is http://www.pragprog.com/titles/shcloj/programming-clojure
17:41bbloom~books
17:41clojurebotbooks is programming clojure
17:41bbloom~onlisp
17:41clojurebotexcusez-moi
17:41bbloomclojurebot: onlisp is http://www.paulgraham.com/onlisp.html
17:41clojurebotAck. Ack.
17:42JokerDoomWorkwth just happened
17:42bbloomclojurebot: schemer is http://scottn.us/downloads/The_Little_Schemer.pdf
17:42clojurebotAlles klar
17:42bbloomJokerDoomWork: i'm telling clojurebot some stuff to help answer book related questions here in irc
17:43Jaoodbbloom: isn't that warez?
17:43Jaoodthe little schemer pdf
17:43bbloomJaood: is it?
17:43bbloomit was 2nd link on google
17:43bbloom*shrug*
17:43JokerDoomWorkEh, I'm ok on the Paul Graham, I try to steer clear of demagogues
17:44JokerDoomWorkI'm jk, I'll check it out
17:44Jaoodbbloom: as far as I know there's no official pdf for that book but I may be wrong
17:44bbloomJokerDoomWork: all of pg's other dealings aside, On Lisp is pretty much the definitive Common Lisp book
17:46JokerDoomWorkbbloom, I actually am a fan of his writings, at least his style, but I've always assumed learning lisp from him would turn me into him on lisp, which I don't want...
17:46Glenjamin"with bottom-up programming as the unifying theme"
17:46Glenjaminthis intrigues me
17:46Glenjaminas i'm generally of the opinion that top-down gives better results
17:47Glenjamini may have to buy this
17:47Glenjaminor just download it for free, apparently
17:47HodappIt's not that top-down gives better results, it's that a lot of languages don't provide for the sort of composition of structures that makes bottom-up even possible.
17:56bbloomGlenjamin: Hodapp: is is the case with *any* dichotomy/duality .... the answer lies in the middle
17:56bbloomthere's no correct answer, you need to do a little bit of both
17:57bbloomthe reason for trumpeting the bottom up approach is b/c it is/was was common/supported/encouraged
18:02HodappAs is the case with any dichotomy/duality, the answer may or may not lie in the middle.
18:03HodappClaiming that it is a dichotomy and therefore that the right answer must lie in the middle
18:03Hodapp...can tend to lend some equivalence to a side that may not be appropriate.
18:04Glenjaminwhich side is that? ;)
18:05HodappEither one.
18:07HodappBoth could be wrong. One could be wrong. It's not an automatic "both are correct".
18:08justin_smitha claims that PI is 3.14... b claims it is 3, Some things are not subjective and not helped by compromise
18:11Glenjaminon a continuum from bottom-up to top-down, i'm not sure there's a third way
18:11justin_smithmiddle out?
18:13justin_smitheven Paul Graham talks about the need to alternate between Top Down and Bottom Up in On Lisp IIRC - the significant thing is that in most languages Bottom Up isn't even feasible
18:13JokerDoomWorkI'm so entrenched in Top down decomposition I have trouble even imagining what bottom up even means
18:14justin_smithJokerDoomWork: imagine that you have all your infrastrcuture, all your libraries and data structures implemented. Now write the code that would use that infrastructure.
18:14justin_smithnext, start implementing the stuff that makes that code valid.
18:15justin_smiththis especially makes sense in a syntax-creation-happy lang like common lisp
18:16JokerDoomWorkbut didn't I have to implement all those things first, that seems like I'm starting from the top
18:18justin_smithno, you write the code, then the syntax and libraries that makes it compile
18:18JokerDoomWorkOh I see
18:18justin_smithtdd can get into that kind of thing
18:18JokerDoomWorkI do that quite a bit actually, Hrmmm, I just never thought of it as bottom up, I just consider it, pretending that I have done the hard parts haha
18:18JokerDoomWorktdd?
18:18JokerDoomWorkoh test driven development
18:31GlenjaminInteresting, I think I'll have to read this now
18:32Glenjamin"no, you write the code, then the syntax and libraries that makes it compile" <- i would describe this as top-down
18:33justin_smithGlenjamin: really? so what would you call bottom up?
18:33Glenjaminwriting the syntax and libraries first
18:34justin_smithI think of it is the structure of the implementation vs. what usage looks like - bottom up starts with usage, top down starts with structure
18:34Glenjaminoh, i would have used the terms in the opposite way :D
18:34justin_smithhttp://www.paulgraham.com/progbot.html <- here is where graham describes bottom up
18:35justin_smith"Experienced Lisp programmers divide up their programs differently. As well as top-down design, they follow a principle which could be called bottom-up design-- changing the language to suit the problem."
18:36Glenjamini guess that's a meet-in-the-middle sort of thing
18:36Glenjaminfrom wikipedia, on top-down: "In a top-down approach an overview of the system is formulated, specifying but not detailing any first-level subsystems. Each subsystem is then refined in yet greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements."
18:37Glenjamini would do that, but replace "specify" with "implement"
18:38justin_smith"implementing but not detailing"?
18:38kenrestivobbloom: all generalizations destroy themselves. including that one.
18:39kenrestivo:-P
18:41Glenjaminjustin_smith: doesn't fit that sentence very well, but sort-of, You call code you wish you had
18:42justin_smithGlenjamin: I also sometimes do refactoring this way (though it is easier in a stricter language) - I make the change I want in a few pivotal places, and then just follow the hyperlinks emacs offers to compilation errors until it all makes sense again
18:43platzMy idea of bottom-up is rather than building the control flow first and then implementing the details, you construct primitives that compose in the way that will be able to solve your problem.
18:43platzand then having all your building blocks putting them in the final flow is the last step
18:44platzwhich speaks to the "utilities you wrote for the first program will also be useful in the succeeding ones" idea in the article
18:44justin_smithplatz: well, that is kind of what I meant by writing the code in the way you think it should look before implementing the details - though that is a much better way of putting it because it is more explicit about the extending the language part
18:44GlenjaminThat fits my perception. I prefer to build downwards to discover what building blocks I need
18:44platzjustin_smith: I don't think that's the same, that seems more like tdd
18:46justin_smithplatz: your right, I was thinking sloppily, in my head the thing I was doing that was not yet implemented was language building blocks, but I in no way indicated such a thing
18:46justin_smith*thing I was using
19:36JokerDoomWorkso reflection in Clojure, do I need to use the normal java facilities?
19:36JokerDoomWorkOr is there better support in clojure for reflection as a languauge feature?
19:46AWizzArdAny AI devs around?
19:52justin_smithJokerDoomWork: there is clojure.reflect
19:52justin_smithand there are some other, easier to use libs too
19:52justin_smithsometimes it suffices to just use bean to find what I want
19:52justin_smith,(bean java.io.File)
19:52clojurebot{:enum false, :interfaces #<Class[] [Ljava.lang.Class;@cdd309>, :declaredConstructors #<Constructor[] [Ljava.lang.reflect.Constructor;@133fb54>, :simpleName "File", :package #<Package package java.io, Java Platform API Specification, version 1.6>, ...}
20:27pandeiroany thoughts on the easiest way to create a new lein project /within/ the pwd instead of creating a new directory?
20:34justin_smithpandeiro: why?
20:35justin_smithlein new whatever; mv whatever/* .; rmdir whatever
20:35pandeirojustin_smith: my workflow is: i create a project as a bare remote repo, clone it to a local dir, then do the scaffolding
20:36pandeirosure i guess that is what i thought of wrapping in a script
20:36pandeirothen the complexity came in with not knowing which arg would be the project name
20:36pandeiro`lein new schwa` vs. `lein new ouija schwa`
20:38amalloypandeiro: why clone the bare repo? create a bare repo, then create a project with lein new, then git init; git remote add the bare repo
20:38justin_smithpandeiro: "${@: -1}" in bash
20:38justin_smithand yeah, amalloy's suggestion is what I do
20:40mwelthi there
20:40AWizzArdMoin mwelt.
20:40mweltthe leiningen chan seems dead so maybe here is some one who can help me :)
20:40AWizzArdWorth a try.
20:41mweltgot the latest leiningen version and made up simple dummy project with lein new app someappname
20:41mweltlein run needs 47s to print out hello world
20:41AWizzArdmwelt: even when you do this 2-3 times in a row?
20:42justin_smithyeah, that's mainly clojure's fault
20:42tolstoyDid Clojure 1.6 significantly increase boot time like that?
20:42mweltits 1.5
20:43mwelt1.5.1 to be correct
20:43AWizzArdTho 47s is still a bit high, no?
20:43tolstoyOh, hm.
20:43mweltand leiningen version 2.3.4
20:44mweltAWizzArd: its the same time even 2-3 times in a row ...
20:44mweltthis is a reald dealbreaker for me, but i hoped it did something wrong
20:44mweltits running on jdk 8_5
20:44AWizzArdmwelt: I am using Java 8 too. But why is that a dealbreaker?
20:45mweltAWizzArd: i am not willing to wait nearly one minute to execute a bunch of simple code. I wanted to build up a project on clojure...love the language thou...but 1 minute to run a simple test? no way
20:46Bronsa47s is insanely slow, lein run on a new project takes 3.5s here
20:46mweltBronsa: so maybe my setup ist corrupted
20:46AWizzArdmwelt: typically the idea is that in the morning you run „lein repl” and develop your program. There should be very few startups per day.
20:46tolstoyI just did a "lein new app someapp" and "time lein run" and got:
20:47tolstoyreal 0m2.453s
20:47tolstoyuser 0m3.579s
20:47tolstoysys 0m0.241s
20:47mwelttolstoy: this would be great :)
20:47tolstoyjava version "1.8.0_05"
20:47tolstoyNice fast iMac, though.
20:49tolstoymwelt: Not sure if it'll be of any use, but "DEBUG=1 lein run".
20:49mweltill try
20:50justin_smithmwelt: also, you can do (clojure.test/run-tests) as many times as you like in a repl (after reloading changed namespaces of course)
20:50tolstoyIf you have any deps defined, but they can't be pulled down for some network issue, I wonder if that would make a diff?
20:50AWizzArdWhile a startup time of one minute would be bothersome I still don’t see why it should be a tragic problem in practice in most cases.
20:51justin_smithit can also be caused by large numbers of deps
20:51AWizzArdjustin_smith: how often do you call „lein run”?
20:52justin_smithless than once a week per project usually
20:52justin_smithwith long lived repls, and reloading files as apropriate
20:52AWizzArdCompared to me you are a high-profile user of lein run then (:
20:52justin_smithheh
20:53justin_smithbut mind you, I start my repl with lein run
20:53tolstoyWhen people are just learning, typing code then running "lean run" is the lowest barrier.
20:53justin_smithso that my repl is also the back door into a long running server process
20:53AWizzArdtolstoy: I accept this point.
20:53tolstoyGoing "full repl" is a bit later in the game, no?
20:53justin_smithtolstoy: easier than lein repl really?
20:53justin_smithtolstoy: with my first lisp, the repl was a revelation and made everything in programming make so much more sense
20:54justin_smithI guess some others have different experiences
20:54tolstoyjustin_smith: not ultimately, but when I first learned Common Lisp, repl + emacs + the language: I focussed on the language first.
20:54justin_smithhah, I started with the repl inside xterm
20:55justin_smiththen later started entering stuff directly into files
20:55tolstoyMe, too, kind of. But there was no way to hook up files to the repl, until Emacs. But (for me) that was a WHOLE new thing.
20:55mwelti also started with repl only
20:56zaisteis it possible to dynamically destruct a map ? i.e. https://gist.github.com/zaiste/19f9c4c0cb84bd9e8819
20:56tolstoyI had to learn the difference between the language errors, editor problems, etc, etc. ;)
20:56mwelttried to fix some 4clojures
20:56mweltand this brought the language to me
20:56mweltbut now i want to build up a litte project
20:56AWizzArdmwelt: when the repl is up you can start doing Clojure for several hours. The time spent with startups would even take with your 47s scenario just 3-4 minutes a day.
20:56AWizzArdmwelt: what project you wanna build? (:
20:57justin_smithzaiste: looks like you want :keys
20:57mwelthow can i execute my written code with all dependency and stuff in REPL?
20:57justin_smith,(let [{:keys [a b c d]} {:a 0 :b 2 :c 4 :d 8}] d)
20:57clojurebot8
20:57zaistejustin_smith: yes, perfect, thank you
20:57justin_smithmwelt: (require '[your.ns :as alias] :reload)
20:58mweltits something 4 my plessure language related data mining stuff on a huge amount of textdata
20:58justin_smithsometimes you may also want to do (in-ns 'your.ns)
20:58AWizzArd,(let [{:keys [amount name x] :strs [foo] :or {x 33}} {:amount 14, "foo" 88, :name "Carlos"}] [amount name x foo])
20:58clojurebot[14 "Carlos" 33 88]
20:58justin_smithAWizzArd: nice
20:59justin_smithmwelt: there is also :reload-all to recursively reload the requires of an ns
21:00mweltjustin_smith: and this is always project related?
21:01justin_smithmwelt: well it uses your classpath, which lein sets up based on your project.clj
21:01justin_smithbut you can hypothetically extend your classpath at runtime and fudge things, if that matters to you
21:02justin_smithwith alembic you don't even need a restart to use new deps from clojars or maven central
21:02mweltjustin_smith: seems cool to me, but why does lein need 47s to startup this seems odd
21:03justin_smithmwelt: clojure does a lot of work at load time - it has no tree shaking and very little lazy loading (if any?) in core
21:03justin_smiththis is not just a lein issue
21:03zaistejustin_smith: is it also possible to generate vec for :keys automatically, from symbols ? 3rd snippet: https://gist.github.com/zaiste/19f9c4c0cb84bd9e8819
21:03arrdemjustin_smith: loading is lazy, but there is no tree shaking at all.
21:03tolstoymwelt: Unless your computer is really underpowered, that IS odd.
21:04arrdemfor lazy defined at the level of namespaces
21:04justin_smitharrdem: oh, good to know, thanks
21:04nDuffmwelt, ...I'd expect that kind of timing if, say, lein were downloading a library that wasn't in your local Maven cache.
21:04arrdemnDuff: or if you're running on a free ec2 instance
21:05mwelttolstoy: got i7 with 16GB ram and ssd
21:05mweltseems fine to me
21:05tolstoyYep. Something's odd. ;)
21:05justin_smithzaiste: I am confused about the use case there - you wouldn't know until runtime what symbols are bound in the let, so you would not be able to effectively write code using those symbols
21:06tolstoymwelt: Still 47secs when you "lein run" a brand new project with no deps you've added yourself?
21:06tolstoymwelt: Surely "java -version" doesn't take a long time, right?
21:06mwelttolstoy: mom
21:07mweltjava -version :
21:07mweltreal 0m0.067s
21:07mweltuser 0m0.052s
21:07mweltsys 0m0.007s
21:08tolstoymwelt: The folks on #leiningen woke up.
21:08AWizzArdmwelt: it might be worthwhile to start up a jvm with clojure.jar on the CP.
21:09justin_smithmwelt: what are the deps in the project that takes that long anyway?
21:09mweltno
21:09mweltjustin_smith: no deps just plain ne genrated projekt
21:10mwelttime lein run
21:10mweltHello, World!
21:10mweltreal 0m24.313s
21:10mweltuser 0m4.367s
21:10mweltsys 0m0.289s
21:10AWizzArdjustin_smith: how are your timings for “java -server -version”?
21:11zaistejustin_smith: you're right, i've overcomplicated, thanks
21:11justin_smith0.076
21:14mwelttime java -server -version
21:14mweltjava version "1.8.0_05"
21:14mweltJava(TM) SE Runtime Environment (build 1.8.0_05-b13)
21:14mweltJava HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
21:14mweltreal 0m0.064s
21:14mweltuser 0m0.046s
21:14mweltsys 0m0.019s
21:14AWizzArdmwelt: but try this with java -server -cp clojure.jar
21:15mweltk
21:16mweltwhere does leiningen store clojure.jar?
21:16AWizzArdjava -server -cp clojure-1.6.0.jar clojure.main -e "(println 55)"
21:22tolstoymwelt: ~/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar
21:22arrdemdoes lein's eval-in-project return the eval result as one would expect?
21:24arrdemit doesn't appear to T_T
21:24tolstoyFor me, AWizzArd's suggestion ran in .7s.
21:24AWizzArdtolstoy: that seems pretty okay
21:25tolstoyYep.
21:27AWizzArdmwelt: another test for you and tolstoy could be: just type “lein help” and time that.
21:27AWizzArdOn my not-so-fast system it’s around 8s.
21:27mwelt3 s
21:28AWizzArdlein help actually must load a jvm
21:28tolstoyI *thought* my system was fast, I get around 8s too.
21:28mweltthe plain java run without leinen is also under 3s
21:29AWizzArdSo, it seems Leiningen can start up fast enough with its own code & Clojure.
21:29tolstoyI've got stuff in my .lein/profiles.clj, too.
21:30tolstoyYeah, lein is fast enough for me with the empty project. I was just hoping to establish that mwelt is experiencing a fluke compared to the average.
21:30tolstoylein deps :tree might be interesting.
21:31tolstoy(I have nrepl snapshot, for instance.)
21:31tolstoyfaster: lein with-profile production deps :tree
21:33amalloy`lein help` is a bad thing to time, because it loads all plugins
21:33mwelttolstoy: the problem was the fileshare
21:33tolstoyWoo hoo! ;)
21:33mwelttolstoy: i ran the program in sshfs
21:33mwelttolstoy: without it its under 2s
21:33tolstoyGlad you found it. Phew!
21:33mwelttolstoy: ^^
21:34justin_smithoh wow, yeah, I guess that would affect things
21:34AWizzArdthose 47s were indeed a bit too suspicious, even for some slower system.
21:34justin_smithI guess I have used / developed to many bloated mega-apps for 47 seconds to seem that big a deal :(
21:34tolstoyYeah. Now, add cljsbuild to your hooks, and we're back into the 1 minute start territory. ;)
21:35mwelttolstoy: well ... no :) but thanks a lot for helping
21:35tolstoyHeh.
21:36mweltand yea shame on me for not believing in slow network issues
21:37mweltwhat is cljsbuild?
21:38tolstoyIt's a plugin for compiling (and cleaning) clojurescript clients.
21:38tolstoyWhen you add it to the hooks key in your project, it'll participate in the normal "run" "jar" and "clean" tasks.
21:39justin_smithyeah, clojurescript currently builds kind of slow
21:39tolstoyAt least the incremental build it fast, but, yeah.
21:39justin_smithyeah, auto can be OK
21:50amalloyman, i remember when i tried to run lein over sshfs. what a terrible idea
21:50arrdemamalloy: I tried that once... the .class files made my wifi cry
21:53mweltamalloy: it was not a good idea
21:55arrdemRFC on https://github.com/arrdem/radagast/blob/54844b2d3939d77dba3fd1c36c99829b803ad206/src/leiningen/radagast.clj, I kinda feel like failing test cases should also be a reason for a nonzero return code in addition to incomplete test coverage.
22:29allenj12hey, what is the most recommended full stack framework?
22:29justin_smith,nil
22:29clojurebotnil
22:30tolstoyallenj12: Most Clojure devs and tinkerers compose small frameworks. Since Clojure is not OO, there's no ORM, for instance.
22:31tolstoyBut I think there are fullstack things out there.
22:31justin_smithallenj12: I have worked on one that people who are familiar with django or rails may find familiar in its usage (caribou), but what tolstoy said
22:31tolstoyYeah, caribou. I was trying to remember what that was. ;)
22:32allenj12hmm alright im new to web dev completely just not sure where to start :p
22:32justin_smithcaribou tries to do mvc / orm with clojure maps, kind of. it is overengineered in places, and clunky in places, but has a lot of stuff out of the box
22:33tolstoyallenj12: I'd find an interesting Compojure tutorial somewhere.
22:33allenj12hmm alright sounds good
22:34tolstoycompojure is a routing lib, like sinatra in ruby, so you can get an app running and use CURL to try it out. Then use a JSON lib to convert clojure maps to json, try that out, etc.
22:35tolstoyPut your html, js and css in /resources/public, try that. Hook up mongo or sql or something....
22:36tolstoyAt that point, you'll have something to swap out parts, or at least a general idea of what's good or bad. IMHO. ;)
22:36allenj12haha alright
22:37tolstoyWhere I work (conservative Java shop), someone demo'd a compojure app that read in a SQL file from disk and executed the query, returning the results as json.
22:38tolstoyPeople were amazed at how little code made that work.
22:38tolstoyOh, and you might look up the "lein ring" plugin.
22:40allenj12ring? got it. ill do that
22:42tolstoyThis: https://github.com/weavejester/lein-ring
22:42tolstoyAnd this: https://github.com/weavejester/compojure/wiki/Getting-Started
22:46dbaschthis is kinda nice http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html
22:48tolstoyNice. Hover gives the doc string.
22:49allenj12hmm ok so im looking more at this stuff. Just wanna make sure tho, is it worth building a website in clojure? i assumed it would be best because its pretty much all i have been programming in for a while, but is there something else i should be using?
22:50benkayfor a 'web site' you might consider flat files on disk and a web server like nginx or apache over clojure
22:50benkayif it needs to be interactive, clojure webapps are pretty fun imho
22:50dbaschallenj12: if you mean a web application, yes
22:50justin_smithallenj12: for dynamic content, yeah, clojure is pretty kickass
22:50allenj12maybe i should be more specific
22:51justin_smithalso if you need to integrate with other web APIs etc.
22:51justin_smithclojure makes that stuff very straightforward (thanks to the amount of similarity in edn and json in part)
22:51tolstoyUsing clojure to generate a static site is fun, too.
22:52justin_smithtolstoy: but maybe not the most practical way to do it
22:52allenj12so i am making a gaming platform, i need a website that can make users where they can buy credit etc. i also need my platform to access that information (its going to be a downloadable client).
22:52tolstoyyou mean maybe awk and sed are praps even better?
22:53allenj12does that change anything?
22:53justin_smithallenj12: you should definitely check out friend, and clojure.java.jdbc
22:53justin_smiththat's totally doable in clojure
22:55allenj12hmm ok i am most comfortable in clojure so thats good. and its as practical as other options?
22:55arrdemfor other options defined to be the usual suspects of PHP, nod_js# and dogescript, sure.
22:56arrdemjustin_smith: what was that doge json knockoff you linked?
22:56arrdemhttp://dogeon.org/ gotcha
22:56justin_smithallenj12: practical can mean dev time or cpu time - it's better performing than most mainstream web dev options, and pretty close to the rest, and in terms of dev time it can be very straightforward
22:57justin_smitharrdem: speaking of practical, huh :)
22:57allenj12ok great thats what i wanted to hear :)
22:57arrdemjustin_smith: sssssh nobody needs to know that my databases are really just flat dogeon files
22:57allenj12is there a specific host i should be looking at when i decide to look for one?
22:58justin_smitharrdem: wow, such table, much data, many plaintext passwords
22:58arrdemallenj12: anything that'll let you run a JVM with arbitrary jars...
22:58arrdemallenj12: digitalocian and ec2 get some love around here.
22:58dbaschallenj12: I heard Heroku is putting effort into making clojure easy to deploy
22:58justin_smithallenj12: well the nice thing is that you can just use httpkit and make an uberjar, so any host that has java, which is pretty much any host worth using
22:58arrdemdbasch: yeah but heroku's prices are insane for a nonfree instance of both a database and a server...
22:59arrdemdbasch: you pay a ton for their tooling
22:59justin_smithwell really they should support nginx and varnish too, but that is also not hard to find
22:59dbascharrdem: of course
22:59allenj12yea i heard both af digital ocean and heroku lately when asking around
22:59benkaydoes anyone know how to return a value from deftest? i'd like to compose the output of some kerodon testing from a threaded macro with another test.
22:59allenj12both seemed most recommended
22:59benkayif your budget's constrained, ipxcore's nice
23:00dbascharrdem: I use ec2 directly, but also used Heroku quite a bit for one-off ruby/rack apps years ago
23:00benkayif not terribly performant on the vps side of things.
23:00allenj12heroku seems expensive for now tho... since i need to play around with things like that :)
23:00benkayif you have a budget, servers from aws is the way to go.
23:00arrdemdbasch: I did my first real clojure blog on heroku. their deployment system was nice, but then I realized what their pricing was like.
23:01justin_smithspeaking of deployment, also one of the wins with clojure compared with other backend web server options is you can get more throughput while spending less on hardware
23:01allenj12hmm alright cool. btw is is there a lein template recommeded for this kinda stuff?
23:02dbaschallenj12: the default compojure template is an ok start
23:02arrdemallenj12: there is a lein template for a new ring app, but in general lein templates are few and far between.
23:02justin_smiththe compojure one should be a nice start (though I recommend looking into one of the non-macro-based routers too, being able to make routes from data at runtime is nice)
23:03arrdemallenj12: if you see anything about noir, steer clear of it 'cause it's deprecated.
23:03allenj12hmm gotcha, o really? i atcually just did, thanks for the heads up
23:03arrdemallenj12: lib-noir is OK tho.
23:03justin_smiththere is also (from the project I work on) lein new caribou, which is kind of everything you need and 5 times as many things you don't need, but hell it comes with a semi-usable web cms UI out of the box
23:04justin_smithand a db backend with "data models" all set up and ready to use from the cms
23:04arrdemallenj12: yeah ibdknox did a reasonable job of making all the ring stuff nice to use, but the result wasn't very flexible and he wound up abaindoning it. that happened about 3mo after I finished my noir backed blog :P
23:05allenj12lol :)
23:07allenj12o i guess i should also ask although it might sound really dumb. when does cljs come into the picture
23:07allenj12?
23:08justin_smithwhen you want to make client side js code in clojure
23:08allenj12gotcha
23:08justin_smithyou compile the cljs to js, and send that in a page
23:08justin_smithuseful for single page app kind of stuff
23:10benkaydoes anyone know how to return a value from deftest?
23:10benkayfrom a deftest macro
23:10arrdemwhy would you do such a thing?
23:11benkaycomposing a kerodon test, would like to preserve a session across composed tests.
23:11benkayunless...crazy/stupid.
23:11benkayin which case, what's a really awesome way to test a webapp's session functionality and then compose those tests?
23:12arrdemyou can write tests that require other tests pass, I think the "right way" to do this is just to structure your test such that the test of the composition requires individual tests and then tests the compise.
23:12arrdem*tests the compose of the individual elements.
23:12justin_smithyou can use a fixture that runs once around all tests
23:12justin_smiththat sets up your session
23:13benkayhm write the to-be-composed stuff in regular functions and then call them composedly from inside deftest macros?
23:13justin_smithalso remember that you can call is in functions outside a deftest, and then call said functions in multiple deftests
23:13justin_smithright
23:13benkayman lisp is cool
23:14justin_smithindeed, I do love it as well
23:14justin_smith(inc clojure)
23:14lazybot⇒ 16
23:14justin_smithhaha
23:14justin_smith(inc juxt)
23:14lazybot⇒ 10
23:14benkayanyways, thanks y'all.
23:14allenj12is envlive useful?
23:15benkayrather, allenj12
23:15justin_smithyeah, enlive is great for being able to treat html content in a functional way
23:17allenj12ok cool