#clojure logs

2011-12-16

00:00cemerickIt's probably going to include three transport impls itself, just to prove out the interface(s).
00:01technomancywhich three?
00:01cemerickI was thinking socket, jmx, and maybe some mq
00:02cemerickhrm, the mq would have to be external due to deps
00:02technomancyyeah, that's no fun
00:02technomancycemerick: do you use elastic beanstalk for snowtide?
00:02lancepantzrich was a fan of hornetmq, if i remember correctly
00:02cemerickanyway, I want to make sure they're as different as possible
00:03cemericklancepantz: yeah, whichever. I don't have use for an mq transport at the moment, so I'm hoping someone else will write it. :-)
00:03cemericktechnomancy: yeah
00:03technomancycool; seems like a natural fit if you're used to warfile-slinging
00:04cemerickand I get a killer management console for free
00:04cemericki.e. one-click rollback is pretty nifty
00:04technomancyI have actually gotten over my urge to make jokes every time someone mentions war files, but I must confess don't think that will ever happen with ear files.
00:04technomancyseriously, ear files?
00:04cemerickgoodness, are they still used by sane people?
00:05technomancyI have no idea.
00:05cemerickI had to make one once.
00:05wolfjbis there something like file-seq which will only work in the top-level directory ?
00:05wolfjbie I don't want it to recurse through the file system
00:06amalloytechnomancy: ear files are for elves who are tired of racial persecution
00:06amalloy$javadoc java.io.File
00:06lazybothttp://download.oracle.com/javase/6/docs/api/java/io/File.html
00:07technomancyamalloy: took me a minute
00:08cemerickwolfjb: I think file-seq is depth-first, so no.
00:09cemerickIt wouldn't be hard to produce a breadth-first implementation though, and (take-while …) using a predicate that returns false for files below the current dir.
00:09amalloycemerick: that implementation is java.io.File/list
00:10amalloywhich is why i linked to the javadocs
00:10cemerickMmm, I'm losing it already. :-P
00:13technomancycemerick: I was going to email a review of the web deployment chapter, but it essentially boils down to just making a case for containerless deployment. =)
00:13cemerickheh
00:13cemerickThat's fair.
00:13technomancythe only real concrete thing you miss out on going containerless is monitoring
00:14cemerickI'd be interested in a post on the topic. It's absolutely a blind spot for me.
00:14technomancyespecially if your book is targeting the python/ruby crowd, that's absolutely bread-and-butter stuff for them
00:15technomancyruby has been all about "toss an nginx in front of an embedded mongrel or unicorn" since people gave up on fastcgi back in '06 or so
00:15cemerickjava/python/ruby, but yeah
00:16cemerickWell, the problem is that there isn't a defined approach for doing that in Clojure, outside of heroku.
00:16cemerickOr, I can't recommend any of the ones I've seen, anyway.
00:17technomancycemerick: the Play! framework is pushing the containerless approach
00:18technomancyit seems to be pretty popular in java and scala land
00:18cemerickCan't say I've looked at it.
00:19cemerickWeb dev in Java or Scala? Um…
00:19technomancyI hang out in chats with the Java people at work since everyone else is Ruby. =)
00:20lancepantzi'm pro-container
00:20lancepantzmaybe not jetty and war's neccessarily
00:20lancepantzbut it's nice to be able to swap a classloader out for a hot deploy
00:21cemerickThe thing about containerless is that you're necessarily getting caught up in a ton of admin around services and lifecycle stuff that I don't think anyone wants to actually think about.
00:21cemerickAgain, unless you're on a platform that takes care of that for you.
00:22technomancyI dunno; it really wasn't a problem at sonian
00:22technomancywe had an application that was primarily centered around working off queues, and it was trivial to just drop a web server into it.
00:23technomancyif you widen your scope to "general deployment tools" instead of just JVM stuff, everyone is about managing processes; they're the universal unit of deployment abstraction.
00:23cemerickso it already had something in /etc/init.d or whatever, took care of jsvc, and had its lifecycle established
00:24cemerickThat's a hard thing to say to someone that *only* works with JVM stuff :-)
00:24cemericker, not *only*, but 90% perhaps.
00:25technomancyclojars uses upstart for its process management; it's just a very simple config: https://github.com/technomancy/clojars-web/blob/vagrant/config/clojars.conf
00:26cemericksure; not saying it can't be done and done well
00:27technomancysure; and I'm not saying that you should cover containerless deployment in your book, I just don't buy the argument that app servers are the golden path.
00:27cemerickheh
00:27cemerick*nothing* is the golden path in this department.
00:27cemerickAll deployment options suck in roughly equal amounts.
00:27cemerickJust in different vectors.
00:27technomancyall the ruby and python guys are going to have these existing process-centric deployment systems; there's no reason clojure can't fit into those.
00:28technomancyyep, sure.
00:29technomancyprobably not what you want to be thinking out the last night of book editing; sorry =)
00:29cemerickIn that case, it seems this calls for a well-maintained containerless deployment *thing* that made it all dead-nuts easy for Clojure/ring apps.
00:30cemericktechnomancy: nah, it's a marathon 'til tomorrow night, not a sprint :-D
00:31technomancyLEIN_NO_DEV=y lein run -m myapp.web # is actually what I recommend
00:33technomancy(as long as you prepare things up-front so each deployment doesn't need to fetch its own deps)
00:33cemerickman, you could probably run that in screen or something in a snap!
00:33technomancyhehe
00:33lancepantzlol
00:33technomancybasically: have the CI server run "lein tar && s3cmd put myapp-$VERSION.tar s3://sekritbukit/" as its last step
00:33lancepantzi on the other hand like containers, and the ruby and python guys just don't know what they are missing out on imho
00:34technomancythough really there's nothing wrong with an uberjar either
00:34cemerickI dunno if I like containers, but I certainly know them. Especially tomcat, inside and out, for better or worse.
00:35technomancyI'm just saying the "work with existing infrastructure" argument cuts both ways
00:35cemerickyeah, perspective is everything
00:36technomancyoh hang on; that should be "lein trampoline run" in order to avoid the overhead of two JVMs
00:36technomancyanyway
00:36cemerickI did *all* my web stuff in python for ~2 years; that was a long time ago, but the deployment side was the flakiest part of it. *shrug*
00:37cemerickHow much of that was due to my ineptitude with such things…who knows.
00:42technomancycemerick: anyway, very happy with what I've seen of the book so far; best of luck wrapping it up.
00:42cemericktechnomancy: Thanks very much for taking a look at it so late into things. :-)
00:42cemerickAnd hey, now you have a perfect lead into a post.
00:43cemerick"Emerick's a dope with that web deploy madness."
00:43cemerick;-)
00:45technomancyadmittedly I'm not as familiar with app servers, but I'll mention it to the Java team at Heroku tomorrow since they've been on both sides of the fence (and a big part of their job is convincing the Java crowd that they can do without a container)
00:46mindbender1and they need to show us POC with a bigger app
00:46technomancyPOC?
00:46mindbender1Proof Of Concept
00:46technomancymindbender1: for raw Java specifically?
00:47mindbender1yes
00:47cemericktechnomancy: it's a bloody platform, *that's* your container. Is that not an effective argument?
00:47technomancycemerick: well, it's also getting them to use the command-line
00:47cemerickoh
00:48cemerickknock out one of those eclipse plugins and you're in
00:48technomancyit's on the way =)
00:48cemerickamazon has command line tools too, and I avoid them too ;-)
00:48mindbender1technomancy: they should use an app that previuosly ran on jboss or glassfish as an example
00:48technomancymindbender1: sure; I'll mention that
00:49cemerickwell, that's a different conversation though
00:49cemericka lot of teams build apps for jboss or glassfish — the API coupling is often very tight
00:49technomancytrue. asking them to give up both simultaneously is a hard sell I guess.
00:49hiredmantechnomancy: I think our single monolithic codebase at sonian has become similar to an app server, it provides a lot of functionality that can be used easliy just by nature of the code running in the same code base
00:50hiredmanif we had more teams working on more services I could see something where it became the environment where you "deployed" your app into
00:50cemericktechnomancy: maybe give away copies of small pieces loosely joined to spread the message? :-P
00:51technomancyhiredman: yeah, I guess when you factor in the declaring of init namespaces it starts to feel more like that
00:51technomancyhiredman: I was thinking specifically of the ring side being a good argument in favour of embeddability.
00:52hiredmanwell, as are rest api builds out, more and more pieces are sort of discrete units that get rooted in the api somewhere
00:52hiredmanour
00:55hiredmanit's nice, just about anything I want is already available via the 'platform' configured in a good way
01:15devnhttp://clojure-log.n01se.net/date/2008-04-22.html#13:58
01:39amalloydevn: thanks for the link. always fun to see the birth of ideas we take for granted now
01:41amalloyi'm reading along, excited to get to the point where they realize {:strs a b} is not a legal map
01:41Scriptorhmm, how old is #clojure?
01:47amalloybetween 3 and 4 years?
01:47amalloynot sure
01:48amalloyi certainly wasn't here at the time, that's just what i vaguely recall hearing
01:50cemerickWas first made public in late 2007 IIRC.
02:29triyoI get strange behavior when running `lein uberjar` and have my :main set. It starts compiling the namespaces and then it actually fires the :main -main function. In my case -main starts my jetty server so the uberjar process never completes.
02:30amalloydoubtful. more likely, your namespace has some side-effecty stuff in it, like it ends with a call to (-main)
02:31amalloydevn: "* rhickey_ is trying to avoid a destructuring mini-language" - guess he lost that battle against himself
02:33triyoamalloy: well yes only side effect stuff in it is to start the jetty server
02:33amalloyright. that's your problem
02:33amalloydon't cause loading a namespace to have side effects
02:34amalloydefine -main, let someone else call it
02:34triyohmm, I didn't answer that correctly, I mean that namespace has no direct calls to -main itself
02:35amalloyif you gisted your namespace, someone could comment
02:35triyoso I can in repl load that namespace and -main doesn't get called
02:36triyohttps://gist.github.com/1484983
02:37amalloyside effect: you start a server in your very first (let)
02:37triyooh I see the problem :((((
02:37triyo*blind*
02:37triyothe let
02:37triyobit
02:39triyoso best way I guess is to bind the let in the -main itself and pass the arg on to start/stop fn
02:40amalloywhat doesn't make any sense to me is why you're calling start/stop at all
02:40amalloyjust start the server in main, and you're done
02:41triyoReason was because once the ref was defined, I could in REPL do nice start/stop of the server if needed to
02:42triyobut not quite required guess since I;b musing ring middleware `reload`
02:42triyo*i;b =I'm
02:46triyoamalloy: Do you have to use :gen-class in order to be able to call the main from when the jar file is executed?
02:47triyoI get no class def found exception
02:48triyolein run works though
02:52raektriyo: to be able to use -main as a java main function you must have both :main ... in your project.clj and :gen-class in your ns
02:53triyoraek: thanks
02:53raek(ns foo ... (:gen-class))
02:59triyothat worked thanks
03:23lnostdal__is there a way to tell maven, via lein i guess, to not do its "checking for updates" thing?
03:23lnostdal__i found this, http://stackoverflow.com/questions/994857/stop-maven-from-checking-for-updates .. but how do i "forward" that from lein?
03:30raeklnostdal__: maven only performs the "checking for updates" step if you have SNAPSHOT dependencies
03:32lnostdal__yes, and i want that; i work with checkouts from git
03:32lnostdal__, raek
03:32clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: raek in this context, compiling:(NO_SOURCE_PATH:0)>
03:32lnostdal__,(println "silence, bot")
03:32clojurebotsilence, bot
05:29dribnettesting 1,2,3.
05:35wei_does anyone have a good resource on setting up a ClojureScript browser-connected repl?
06:56_ViHow to make Leiningen to also compile *.java sources to class files that are in src/ directory?
06:59_ViFound myself: ':java-source-path "src"'
07:20licenserokay a silly question, could it be that cljs misses list?
07:20licenserso list? not list
08:05tsdh,(list? '(1 2 3))
08:05clojurebottrue
08:05tsdhlicenser: ?
08:06licensertsdh: in clojurescript it does not exist
08:06tsdhlicenser: Ah, cljs is ClojureScript. Makes sense... :-)
08:06licenser^^
08:13licenserI wonder where do I report bugs in cljs?
08:13licenserfound 2 so far
08:15pyrlicenser: http://dev.clojure.org/jira/browse/CLJS#selectedTab=com.atlassian.jira.plugin.system.project%3Aissues-panel
08:15tsdhlicenser: http://dev.clojure.org/jira
08:15licenserthanks thanks :)
08:15tsdhlicenser: There is a "ClojureScript" entry in the Projects listing.
08:39Sunngit seems that clojars.org cannot accept ssh connection now
09:21devnSunng: are you sure you are using the right key? Have you pushed to clojars before?
09:23devnwei_: there is documentation on the browser-connect REPL on github that explains how to set it up. brenton ashworth recorded a screencast which I believe is linked from there.
09:40Sunngdevn: finally, it works now.
09:42Sunngdevn: Maybe it was on maintenance
09:52Saturnationwhat's the best lib for reading json?
09:54Saturnationclojure-json looks decent, but was wondering if anyone had an opinion?
09:54SunngSaturnation: do you mean clj-json ?
09:55Saturnationyep, just saw the note on github that it isn't being maintained and a pointer to Chesire
09:56Saturnationcheshire even :)
09:58SunngSaturnation: cheshire is well maintained
10:00SunngSaturnation: both cheshire and clj-json are based on jackson, also they have similar API :generate-string, parse-string
10:27semperosI used a Java method that returned me something with a class of java.util.Vector$1
10:27semperoswhat is the $1?
10:29semperosreal question is why none of the normal java.util.Vector methods seem to be working on it
10:32TimMcsemperos: What is the method's return type?
10:32OlegYchVector$1 means first anonymous class in Vector
10:32TimMcThe $ usually means "inner class" -- maybe it is an anonymous inner class.
10:32OlegYchwho uses Vector nowadays anyway?
10:32TimMcI guess using a number prevents collisions.
10:34stuartsierraIt's probably an Iterator
10:35TimMcSounds about right.
10:36semperoschecking...
10:37semperosTimMc: the method is getAllAppenders in log4j's Logger class, return val is just specified as an Enumeration
10:38TimMcTHere you go.
10:38TimMcAlso, I shudder to think what you might be doing with direct calls to log4j.
10:38semperos:)
10:39TimMcHopefully writing a superior API. :-P
10:39semperosyesterday I implemented a custom log4j appender, so I could push log files into a JTextArea for a swing app (via daveray's seesaw)
10:39TimMcnvm, the main problem I have with log4j is writing the .properties file.
10:39semperosI've already got things working using (not a properties file) an XML config file
10:40semperosbut my app has both a gui and headless mode, so I want to configure the logger programmatically to use the right appenders in the right context
10:40semperosI was just exploring the Logger class
10:41semperosthanks for the help, as always
10:41erujolcjust output to stdout and let something outside the program handle the log rotation, colorizaton or log shipping to wherever
10:41semperoswhat would that "something" be?
10:41semperos(this is a simple, developer-facing app)
10:42TimMcerujolc: That doesn't help the GUI situation.
10:43erujolcour server apps run under supervisord that can pipe stdout and stderr to log files, swapping the fds when required to handle log rotation, can tail the logs, pipe through sed for colorization, can even ship to one of shitty service like logly by piping to curl
10:43erujolcgranted, missed the GUI part
10:43erujolcthere are others, im sure monit and god does it too
10:43semperoserujolc: cool
10:44erujolci just found these logging library heavyweight, if you need multiple appenders, you have tee etc..
10:44erujolcfor gui yeah its probably makes sense
10:44semperosyep
10:45semperosit was simple enough, just had to implement a simple interface and pass the custom appender class to log4j
10:46semperosall of my Java/JVM knowledge I've learned through Clojure, so I'm frequently in the process of filling in the gaps :)
10:49erujolcsemeros what stack have you came from?
11:12TimMcsemperos: ^
11:14semperosTimMc: ?
11:14semperoswhat in particular
11:16TimMcsemperos: erujolc asked you a question but misspelled your nick. THey're gone, but I'm curious about the answer too.
11:16semperosgotcha
11:16semperosI saw he left, so I left it be
11:18semperosmy background is actually in foreign language and linguistics; got into software development as a hobby, started with a little Java, Python, a little Common Lisp, an unfortunate period of PHP followed by delivernace via Clojure and Ruby
11:18semperosI now do Ruby and Clojure for a living and enjoy language study on the side :)
11:19TimMc"an unfortunate period of PHP" haha!
11:19semperospaid the bills at the time, and gave me plenty of mental room to learn Clojure at the time
11:19TimMcOK, so you've had a small amount of Java before.
11:20semperosenough to know where to start filling in the gaps, I supose
11:20semperos*suppose
11:21semperosI do my Ruby development in JRuby as well, so I have every intention of learning the space well
11:37bhenrywhat differences besides the name are there between durendal-jack-in and clojure-jack-in
12:39technomancybhenry: clojure-jack-in is the one that's maintained
12:40technomancythe rest of the stuff from durendal should probably get moved over to being piggybacked in by swank.
13:42TimMcRaynes: What do you like about Hiccup?
13:42ibdknoxcomposition
13:43ibdknoxit naturally encourages you to make small pieces out of your views and reuse them
13:43TimMchmm
13:43TimMcRaynes: Specifically, things that differentiate it from Enlive.
13:43TimMcibdknox: Enlive does that too, but probably differently.
13:44ibdknoxit does, but doesn't it require you to have bunch of singular html files?
13:44TimMcI'm not too familiar with Hiccup's composition mechanisms. defpartial, right?
13:44ibdknoxI'm not going to create a file and stick one line in it. I'll create a function and stick one line in it.
13:44TimMcibdknox: No, you say (defpartial blah "something.html" [:head] ...)
13:44TimMcso you could have a snippets file.
13:44ibdknoxI see
13:44TimMcand select the bits you want.
13:45ibdknoxMy only complaint is the syntax then :)
13:45ibdknoxwhich is entirely subjective
13:47TimMchmm
13:49ibdknoxAnother aspect is having to look in two places to understand how a view is constructed
13:49TimMcLocality is a good argument for Hiccup.
13:50ibdknoxlook at .html file, look at .clj to see how things are injected into it, look at snippets file, back to .clj, back to .html
13:50technomancyit would be pretty cool if you could do the equivalent of M-. (jump to definition) on a call to io/resource
13:52TimMcibdknox: When I'm coding it isn't a problem, since I keep the HTML buffer in a second window. Someone *reading* the code might have more trouble.
13:53ibdknoxTimMc: yeah, but will you keep 3 open if you have shared snippets?
13:54TimMcNot sure what you mean.
13:54ibdknoxyou mentioned that I could have a snippets file
13:55ibdknoxor maybe I misunderstood what you were saying
13:55ibdknoxso I have my page
13:55ibdknoxwhich is one .html
13:55ibdknoxI have a .clj, which reads that in and then fills in pieces of it.
13:56ibdknoxand I have another file with lots of shared "components", this is the html for a header button and so on
13:56ibdknox.html file that is
13:58cemerickman, is the enlive v. hiccup thing still going on?
13:58cemerickibdknox: howdy, stranger :-)
13:58ibdknoxcemerick: heya :)
13:58ibdknoxcemerick: when are we getting more podcasts?!
13:59cemericknext week
13:59cemerickthe book deadline is today; thus, no 'casts
13:59ibdknoxhaha that sounds reasonable
14:00cemerickI wanted to get one out last Friday, but chaos intervened.
14:00ibdknoxsuch is the way of things, I think
14:00ibdknoxthere's always chaos
14:00cemerickIt's nice that people are looking forward to them :-)
14:01ibdknoxyeah, I want to hear what some of the other guys had to say while we were at the Conj :)
14:03ibdknoxcemerick: so the book is done as of today?
14:03cemerickyup
14:03ibdknoxcongrats!
14:03cemerickwhatever state it's in when I fall on my face tonight is it
14:03ibdknoxhaha
14:03cemerickheh, I've got miles to go before I sleep
14:05tmcivercemerick: congratulations! Looking forward to it.
14:05cemerickthanks :-)
14:06cemericklet's not get ahead of ourselves, lest Murphy strides by
14:06TimMccemerick: No, it's just starting -- there hasn't actually been any discussion until now, just stating of preferences.
14:06cemerickThere goes Sierra. Typical.
14:06cemerick:-D
14:06ibdknoxalways coming to rain on the parade :p
14:06stuartsierraohai
14:07stuartsierrawhat parade did I rain on?
14:07cemerickNothing, oh, nothing.
14:07ibdknoxstuartsierra: today is the deadline for cemerick's book :)
14:07stuartsierraoh yeah, the book
14:08cemerickIs someone here writing a book? Cool!
14:08stuartsierraI'm finishing up my novel titled "I Was a Teenage Were-Hacker"
14:09ibdknoxI'm also finishing one about using food names as the title of various programmatic libraries.
14:13dnolenwoot, rhickey approved CLJS property syntax change.
14:13ibdknoxsweet
14:13ibdknoxnow all we need is a release :p
14:14TimMcAnd gosh it would be nice if I could pull it via maven.
14:14technomancyTimMc: you mean apart from all the unofficially-published artifacts =\
14:15devndnolen: I love you man.
14:15ibdknoxI want my lein cljs plugin. lest I hear otherwise, I'm gonna end up having to push one too :/
14:15devnI was reading cljs commits last night. Thank you for all of the work you've done on it.
14:16technomancyI'm still not sure that the whole "set CLOJURESCRIPT_HOME and run everything from git" mandate isn't there to intentionally create an mindset of "don't expect too much stability"
14:16ibdknoxdnolen: is clojurescript stable? ^
14:18dnolenibdknox: there's a release branch now which includes helpers scripts for producing a CLJS jar, script/release, script/make-jar, done
14:18ibdknox!
14:19technomancywhoa
14:19ibdknoxdnolen: that's fantastic. What needs to happen for an official push of it somewhere? Even if it's "cljs-SUPER-ALPHA-DONT-USE-FOR-REALZ"
14:20dnolenibdknox: I think just bugging core get it on clojure hudson right?
14:20stuartsierraFYI there was a discussion with Rich this morning about making CLJS releases.
14:20technomancystuartsierra: where?
14:21stuartsierraon the phone
14:21amalloyibdknox: did you see Raynes is porting 4clojure to noir?
14:21ibdknoxamalloy: I did :)
14:21stuartsierraIt's not in my hands right now. Once Rich settles on a versioning strategy I'll add it to Hudson.
14:22ibdknoxamalloy: I also noticed you created a new website and didn't use it... such SIN!
14:22ibdknox~guards
14:22clojurebotSEIZE HIM!
14:22ibdknoxstuartsierra: that's great news
14:23ibdknoxI will happily create awesome little tools around it
14:23TimMcDoes CLJS have an API I can call to compile stuff, or do I have to do everything with shell calls?
14:23ibdknoxTimMc: there's an API
14:23TimMcSweet.
14:23TimMcWhat role does the Google Closure thingy play?
14:23TimMcJust compression, runtime libs, or what?
14:24stuartsierraboth
14:24TimMcI'm writing a Try-CLJS with some folks, you see.
14:24ibdknoxoo
14:24TimMcAnd part of the reason is that I don't know CLJS at all. :-P
14:25ibdknoxpinot FTW ;)
14:25TimMchm?
14:25TimMcTell me about pinot.
14:25ibdknoxhttp://github.com/ibdknox/pinot
14:25TimMchrmf
14:26ibdknoxTimMc: includes lots of goodness so you don't have to deal directly with the goog apis
14:26ibdknoxbecause those are painful
14:26TimMcAh, I see.
14:26ibdknoxalso, it has a client-side hiccup ;)
14:26TimMcVery alpha... this will go well with CLJS. :-)
14:26ibdknoxhehe
14:27TimMcInterestingly, I *like* the idea of using Hiccup on the client.
14:27ibdknoxI'm starting to reach the point where I believe that we should just use jquery for dom manipulation stuff :/ It's just that a cljs library of some kind should limit the amount of that you need to do
14:30cemerickstuartsierra: reading cljs near hudson makes me all warm and fuzzy. Thanks for slogging away in the mines.
14:30dnolenibdknox: I think there are some things afoot that might make jQuery moot
14:30stuartsierrayou're welcome
14:30ibdknoxdnolen: ?
14:30stuartsierraI said I would take care of the Hudson bit, "because I sinned"
14:31cemerick"For thy transgressions, say thricely, 'I will not break the build'. Oh, and write a hudson configuration templating system."?!?!
14:32dnolenibdknox: https://github.com/levand/domina
14:32stuartsierrayep
14:33ibdknoxdnolen: oh god... xpath???
14:33lazybotibdknox: Yes, 100% for sure.
14:33technomancyhow can dom manipulation be functional? isn't it one big side-effect?
14:33ibdknoxthat's not ok
14:33dnolenibdknox: look at the bottom
14:33dnolenibdknox: todo, mapping to CSS selectors, this how all the CSS selector engines work. XPath inside, CSS interface.
14:34ibdknoxdnolen: I see
14:34ibdknoxI guess I don't see the value over JS
14:34ibdknoxerr
14:34ibdknoxJQuery
14:35ibdknoxwe'll never get the same level of battle testing with our own solution and I agree with technomancy, dom manipulation isn't functional by nature
14:35stuartsierrasomething written in CLJS has the opportunity to benefit from optimizations in Google Closure
14:36ibdknoxI'm not sure that's a strong argument in reality: as long as you serve jquery from a CDN, it's already cached on a user's machine
14:36stuartsierradunno, never used either
14:37dnolenibdknox: advanced compilation is a big benefit. I wouldn't judge too quickly - a little bird tells me some people are hacking away at some neat stuff w/ this.
14:38cemerickdnolen: any idea if those top-level defs (e.g. the EMPTY values IIRC) are going to eventually not impact optmization?
14:39dnolencemerick: ? how do those impact optimization?
14:39cemerickThey ensure that some amount of the stdlib is always included, ~30k last I saw.
14:40cemerickI was able to hack them away to get clojurescript couch views down to < 1K, but not in a way that left things workable generally.
14:40ibdknoxdnolen: in what way is advanced compilation a benefit? The vast majority of sites never even have to think about performance, as they're doing very, very simple stuff
14:41ibdknoxdnolen: and size is handled by using the google CDN
14:41dnolencemerick: rhickey seems pretty strong on sticking with Google Closure libs. I think CLJS at 30K is a reality for the time being unless people really push for stripping that stuff out. I tried, but I understand the hesitation.
14:41cemerickdnolen: oh, it has nothing to do with gclosure. The code that ends up being included in the output is from core.cljs.
14:43cemerickThis was my point (2) from http://groups.google.com/group/clojure-dev/browse_frm/thread/9da8b9d8ec81d049#.
14:44dnolenibdknox: given the depth, richness of CLJS I don't see websites with 50 lines of JS adopting CLJS. But there's plenty of sites that have 1K LOC of JS, CLJS has something to offer.
14:44cemerickNot a high priority for me, just a psychological tidiness thing. :-)
14:44dnolenibdknox: even so, I think with some of the CLJS frameworks/libs that might appear, and CLJS debugging infrastructure, CLJS could easily smoke other solutions.
14:44ibdknoxdnolen: using JQuery doesn't mean that advanced compilation won't work
14:46dnolenibdknox: have you tried? It seems like I have heard that people have and it hasn't worked out so well.
14:47ibdknoxyou don't advanced compile JQuery, just your own code. As long as you have an externs file, it works fine
14:47dnolencemerick: I think that's pretty low priority. Using CLJS is like using Backbone.js in your CouchDB views.
14:47ibdknoxthere's no value in advanced compiling JQuery, since it's already on people's machines
14:48dnolenibdknox: I don't have anything more to add since I'm not working on this stuff. Wait and see. If I'm doing anything I'm working on debugging infrastructure.
14:48ibdknoxdnolen: which I'm very excited about :)
14:49dnolenibdknox: I think has to potential to be awesome. Node.js/V8, Rhino, and Webkit all have awesome rich debugging APIs.
14:49dnolenhas the potential to be
14:49ibdknoxdefinitely
14:50technomancydoes the locals-clearing problem affect debugging in cljs as well?
14:50dnolentechnomancy: heh
14:52dnolentechnomancy: I don't think CLJS has locals clearing.
14:52technomancyoh, hehe. right.
14:55TimMcLocals-clearing... removing locals that are no longer referenced so they can be GC'd?
14:56technomancyaye
14:56TimMcs/no longer referenced/not referred to later/
15:23technomancy(swap! a empty) is so much better than (reset! a [])
15:25TimMcWhy?
15:25clojurebothttp://clojure.org/rationale
15:25hiredmanI just learned about compare-and-swap! yesterday
15:26kotarako.Ô)
15:27technomancyTimMc: because reset! isn't as functional.
15:27ibdknoxthere's a compare-and-swap! ?
15:27ibdknoxI only know of set
15:27ibdknox,(doc compare-and-set!)
15:27clojurebot"([atom oldval newval]); Atomically sets the value of atom to newval if and only if the current value of the atom is identical to oldval. Returns true if set happened, else false"
15:27ibdknox,(doc compare-and-swap!)
15:27clojurebotHuh?
15:27kotarakTimMc: because it also works with maps, sets, etc
15:27TimMckotarak: That's a good reason.
15:28kotarakTimMc: also specific maps and set => sorted variants, hash variants, etc.
15:28TimMcOne more place you can ignore implementation details.
15:28hiredmanibdknox: ah, yeah, that
15:29hiredmanI was all (swap! a (fn [x] (if (= x :state1) :state2 x)) and sgilardi was all "just use compare-and-set!" and I said "isn't that what I am doing? or do you mean the primitive on atomic reference?" "no, compare-and-set!" "what now?"
15:29TimMcSOunds like it uses identical?, not =.
15:32kotarak,(source compare-and-set!)
15:32clojurebotSource not found
15:32hiredman~def compare-and-set!
15:33hiredmanmy firefox always has a hard time loading core.clj from github
15:33TimMchiredman: I switched to using Chrome for that repo. >_<
15:34TimMcMozilla should add that page to their perf tests.
15:35hiredmanand I guess they changed the format of their anchor tags sometime ago
15:44jkkramerweavejester: following up from yesterday, adding attribute maps to all hiccup tags didn't speed things up, but adding ^String type hints did. Also, it seems attribute maps aren't pre-compiled as thoroughly as they could be. I would offer to submit a patch, but if you're in the middle of a refactoring, I will hold off
15:55pandeiroibdknox: any chance your materials from ClojureWest will show up on the net afterwards?
16:05brett_his there no equivalent to "show" in 1.3 as referenced here: http://stackoverflow.com/questions/4637615/python-dir-equivalent-in-clojure
16:07hiredman1.3 has clojure.reflect, which is not the same as show, but can do give you similar information
16:09brett_hhiredman: thank you
16:21accel_is htere something liek sqlite3, but implemented in java/clojure?
16:21accel_i want to see how a simple db is implemented
16:22VinzentHi. I'm trying to match the following html fragment with enlive: http://pastie.org/3028274 I'm using [:a.search_result_row] and it works, but the :content doesn't contain any tags, just whitespaces: http://pastie.org/3028305 What could be the problem?
16:23devlolhello #clojure, what do you think about this small code ? http://pastebin.com/huL5GZHG
16:23Vinzentaccel_, check out fleetdb, altough it's not sql
16:23accel_Vinzent: in ram is even better
16:23accel_whoa; it's written in clojure
16:23hiredmanhttps://github.com/danlarkin/subrosa has a little in memory relational db
16:23hiredman(it's an irc server)
16:24danlarkinyeah and it's totally sweet!
16:24ibdknoxhaha
16:25pjstadigactually it's totally savory!
16:27hiredmanwhenever I look it, I exclaim "UMAMI!"
16:27danlarkinHmmmmmm umami
16:27danlarkins/Hmmmmmm/Mmmmmm/
16:27pjstadigneeds salt
16:28pjstadigthere now we've covered 'em all
16:28Vinzenthm, i've tried parsing the same page with the xml/zip and it also returns the empty :content... looks very cryptic for me
16:28jkkramerVinzent: the default enlive parser has issues when you use block elements (div) within inline elements (a)
16:30Vinzentjkkramer, ah, and it's tagsoup too, so yeah that's the problem. Can you advice me an alternative one?
16:31jkkramerVinzent: I ran into that and never really came up with a proper solution, besides horrible hacks like regex-replacing all <span> tags with <div> tags
16:36jkkramerVinzent: I tried using various parsers and options, but all broke in various ways when dealing with tag soup in the wild
16:37Vinzentjkkramer, have you tried jsoup? it looks very promising
16:38pandeiroibdknox: i only ask because i am looking for any example code using noir and korma together to see how one would organize models... (assuming you saw my ? above)
16:39ibdknoxpandeiro: There will definitely be some examples of that coming out
16:39ibdknoxbefore ClojureWest
16:39jkkramerVinzent: when I checked it out about a year ago, it had issues. Looks like it's improved a lot since then
16:40pandeirocool, that's great... am i understanding correctly that korma isn't for DDL?
16:41ibdknoxpandeiro: 0.3.0-alpha7 has basic support
16:42ibdknoxit seems like I can actually add it as a completely separate lib
16:42ibdknoxwhich is cool
16:42ibdknoxbut yes, for now
16:42ibdknoxuse something else
16:44pandeiroibdknox: straight SQL is fine for that, just wondering how i automate creating the tables while developing
16:45amalloyso i want a function which, given a map and a key, returns nil (or empty) if the map does not contain the key, and returns [[k v]] if it does (i'm folding the one-key logic into the N-key logic, so i want a seq of entries). i can write (when-let [e (find m k)] [e]), but surely there's something nicer than that?
16:45pandeirocould i ask how you do it?
16:45ibdknoxpandeiro: we had an older system that used django, so we continued to use python's south for it
16:46ibdknoxpandeiro: when I'm just messing around, I either write the SQL or use some visual database creation tool
16:46hiredmanthere is a method on maps that returns map entries
16:46amalloyhiredman: yeah, find. i used that in my example
16:47amalloymy problem is that i want a "singleton list" thing if an entry exists, not just the entry. i can't write [(find m k)], because then i get a non-empty list when it's not in the map
16:48hiredmanhuh?
16:48hiredman,(find {:a 1} :a)
16:48clojurebot[:a 1]
16:48hiredman,(find {:a 1} :b)
16:48clojurebotnil
16:48amalloyhiredman: i want [[:a 1]]
16:49amalloy(and nil in the second case)
16:49hiredman,(#(if % [%] %)(find {:a 1} :b))
16:49clojurebotnil
16:49hiredman,(#(if % [%] %)(find {:a 1} :a))
16:49clojurebot[[:a 1]]
16:49pandeiroibdknox: cool, that's what i wanted to know... i have some other doubts but i will take them to the noir group when they're better organized... thanks
16:50cemerickamalloy: (-?> {:a 1} (find :a) vector) :-P
16:50pjstadigbreaking out the -?>
16:50hiredmanamalloy: have you considered concating your maps (as lists of pairs) and filtering based on key?
16:51cemerickpjstadig: I might whip out the-?>>, who knows.
16:52pjstadiglet's not be hasty
16:53cemerickserendipitous typo
16:54pjstadigwtf-???>>
16:54amalloyhiredman, cemerick: thanks for the suggestions. not sure what winds up being most readable; i'll ponder it
16:54cemerickthreads values at random positions, and may or may not short-circuit nulls. Forces you to program defensively.
16:55pjstadignon-determinism is the new determinism
16:55amalloyit might be. you never know
16:55pjstadighar har
16:58nickmbaileyis it impossible to proxy an interface that defines a function 'get(…)'?
16:58amalloy(a) no, (b) you should probably use reify instead of proxy, for interfaces
16:59hiredmannickmbailey: interfaces don't have functions
16:59nickmbaileyjava.lang.IllegalArgumentException: Method 'get' redefined
16:59nickmbaileyhmm reify you say
17:00hiredmannickmbailey: most likely you are not proying correctly
17:00hiredmanyour method doesn't match the interfaces
17:00nickmbaileywell that isn't surprising
17:00amalloyholy cow the code in core-proxy is intense
17:01nickmbaileyany chance its because the interface overloads the function definition?
17:01nickmbaileyi have to implement get() twice with diff param numbers
17:01amalloyyes, you're probably doing that part wrong
17:03amalloyit's in the docs for proxy: f => (name [params*] body) or (name ([params*] body) ([params+] body) ...)
17:04nickmbaileyaha
17:04nickmbaileyyep doing it wrong
17:06nickmbaileyok, so is it impossible to call one implementation of the overload function in the other implementation
17:06hiredmanyou have the object, right?
17:06nickmbaileyUnable to resolve symbol: get in this context
17:07hiredmanthe first parameter
17:07hiredmanso just call whatever methods you want on it
17:08amalloyhiredman: proxy doesn't have an explicit this
17:08nickmbaileyEach method fn takes an additional implicit
17:08nickmbaileyfirst arg, which is bound to 'this
17:08nickmbaileyaha
17:08nickmbaileyit isn't the first arg its just automatically bound
17:08amalloynickmbailey: this is one of the reasons proxy is on the vile side, if you can avoid it
17:08nickmbaileyabout to look at reify
17:09hiredmanamalloy: sure sure
17:21Vinzentjkkramer, so i finally decided to use http://about.validator.nu/htmlparser/ and xml\zip instead of enlive. Thank you for pointing me to the problem!
18:00Guest43669I could use some help please: How would I "splat" a seq as parameters to a function?
18:01tscheibl(apply fn-name sequence)
18:01tscheiblif I understood your question correctly...
18:02Guest43669i.e. (str "I'd like " (map (fn [fruit] str " a " fruit) ["apple" "pear" "banana"]))
18:02Guest43669I've tried apply & map, but they seem to do the same thing
18:04tscheibl,(apply str "I'd like " (map (fn [fruit] str " a " fruit) ["apple" "pear" "banana"]))
18:04clojurebot"I'd like applepearbanana"
18:04cemerickI think he wants " a " interposed between them.
18:04tscheiblahh
18:04cemerick,(->> ["apple" "pear" "banana"] (interpose " a ") (apply str))
18:04clojurebot"apple a pear a banana"
18:05Guest43669My example is certainly contrived, in a more complex example, suppose the underlying map was not doing something as simple as interposing?
18:06cemerick,(apply str "I'd like " (map (fn [fruit] (str " a " fruit)) ["apple" "pear" "banana"]))
18:06clojurebot"I'd like a apple a pear a banana"
18:07cemerickthe function you were originally passing to map was dropping `str` and `" a "` on the ground, and returning `fruit`.
18:07Guest43669That's terrific, thank you
18:07tscheibl(str "I'd like an " (clojure.string/join " and a " ["apple" "pear" "banana"]))
18:07tscheiblshould also do it :)
19:03cemerickwhat happened to the ring adapter for grizzly?
19:32chessguyi wish clojure stack traces would pipe through "grep -v 'at clojure'" by default
19:33mrevilis there a way to get better stack traces from clojure? I'm writing test code and it's hard to tell whether or not the exception is from the test code or application code
19:33amalloychessguy: clj-stacktrace?
19:33hiredmanmrevil: you should name your test functions better
19:34hiredmanif you name all your functions 'foo' and your stack traces all just say 'foo' is it the fault of the stacktraces you can't figure it out?
19:37pinetreegood afternoon
19:38mrevili know which test, I'm using (testing "some description") for all of my tests, it's just when you get an exception like expected: (= (package/validate {} true))
19:38mrevil actual: java.lang.ClassCastException: java.lang.Character cannot be cast to java.util.Map$Entry
19:38mrevil at clojure.core$key.invoke (core.clj:1465) I have no idea how to track it down
19:38pinetreenewbie here: does anyone have a favorite guide to setting up AquaMacs and SLIME? I've followed a few different tutorials but still haven't found the magic combination. any suggestions?
19:38chessguyamalloy: hmm, looks cool, but installing that plugin doesn't seem to have done anything
19:38pinetreeoh, and I'm using clojure 1.3
19:38chessguyamalloy: i added the snippet to my init.clj too
19:39amalloypinetree: step 1 is uninstall aquamacs and install emacs, usually
19:39pinetreeamalloy: haha
19:39chessguy(+1 amalloy)
19:39pinetreeamalloy: carbon emacs?
19:39ibdknoxbrew install emacs
19:39amalloyi don't use a mac, but i'm told you want cocao
19:39ibdknox(says the vim users)
19:39amalloybrew install emacs --cocao
19:39hiredman,(key \c)
19:39ibdknox-s
19:39clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.util.Map$Entry>
19:41cemerickhttp://emacsformacosx.com/ is the canonical build IIRC.
19:41hiredmanbrew install emacs doesn't seem to work right for the patches it claims to have
19:41pinetreecemerick: ah, yes, I've heard that called "Carbon Emacs" also
19:41pinetreeokay
19:41pinetreeso
19:41hiredmane.g. enabling the fullscreen patch through brew doesn't install it for me
19:41pinetreeonce that's all installed
19:41hiredman(doesn't enable it)
19:42pinetreebest way to get some clojure editing happiness going?
19:42pinetree:)
19:42cemerickpinetree: follow http://dev.clojure.org/display/doc/Getting+Started+with+Emacs if you're using emacs
19:42cemerickand don't google anything, the internet is generally wrong
19:43pinetreehahahaha
19:43chessguywrong, but entertaining
19:43pinetreeI haven't used the emacs link you just sent me in a while
19:44pinetreeIIRC my primary gripe was that I couldn't use the Command key as Meta
19:45cemerickdon't people usually want to swap Command and Control in emacs given the predominance of the latter?
19:45hiredman(which is crazy, alt is meta, cmd is cmd)
19:45pinetreethe primary reason for me is actually just the size of the keys on the keyboard
19:45pinetreeplus, I don't want to remap everything just for the sake of emacs
19:46mrevilwhat do most people use for validations? I'm attempting to validate input to a rest API before committing records to a database.
19:49cemerickmrevil: so there's no form associated with the request? In that case, conditionals are the new hotness. :-P
19:50cemerickIf there is a form that you'd like to decorate with error messages and such, sandbar is the ticket. https://github.com/brentonashworth/sandbar
19:50mrevilcemerick, you are correct there is no form
19:50ibdknoxmrevil: or if you're using noir
19:51ibdknoxmrevil: noir.validation
19:51cemerickIn that case, you just need to check what you need to check, and return an appropriate response code
19:51cemerickibdknox: showoff :-D
19:51ibdknoxI try. ;)
19:54mrevilibdknox: noir.validation looks about right. I wasn't using noir, but maybe I should be.
19:54ibdknoxmrevil: I hear all the cool kids are using it these days.
19:55mrevilit's close to active record validations in rails
20:08cgraysuppose i've got a vector v that i'd like to turn into a map, is there a prettier way to do it than (let [[foo bar] v] {:foo foo :bar bar}) ?
20:09hiredman,(keyword 'foo)
20:09clojurebot:foo
20:09hiredmanI forget if that works
20:10cemerickcgray: maybe you're looking for ##(zipmap [:foo :bar] [5 6])
20:10lazybot⇒ {:bar 6, :foo 5}
20:10cgraycemerick: yep, that's it
20:10hiredman,(let [[foo bar] '(foo bar)] {(keyword foo} foo (keyword bar) bar})
20:10clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }>
20:10hiredman,(let [[foo bar] '(foo bar)] {(keyword foo foo (keyword bar) bar})
20:10clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: }>
20:11hiredman,(let [[foo bar] '(foo bar)] {(keyword foo) foo (keyword bar) bar})
20:11clojurebot{:foo foo, :bar bar}
20:21amalloyi agree zipmap is the way to go, but if you had foo/bar as locals already, you can use https://github.com/flatland/useful/blob/develop/src/useful/map.clj#L8 to write (keyed [foo bar]) - expands to {:foo foo :bar bar}
20:22cgraythat's cool... it's more what i had in mind when i asked the question
20:23cgraybut (zipmap (map keyword '[foo bar]) v) worked just as well
20:30amalloyi just realized that code has a (juxt (comp (partial ...))) in it, if you inline the let. i may need treatment for a point-free disorder
20:42chessguyso...i'm confused. if i (defstruct pair :x y) and i let [foo (struct pair 1 1)], how can i create a new pair from foo with, say, a y value of 2
20:42hiredmandon't use defstruct
20:42chessguyugh, ok
20:42chessguywhat shouuld i be using? records?
20:43gfrederickschessguy: what motivated you to use defstruct?
20:43cemerickor regular maps, yes
20:43chessguyi'm porting common lisp, and that's what it used
20:43cemerickCL structs are not Clojure structs
20:43chessguywell i didn't figure they were identical, but i thought they were close enough
20:44amalloychessguy: echoing cemerick here: you probably just want hashmaps
20:44chessguyamalloy: cemerick: fair enough
20:44amalloyif they all have the same two keys...well, so what, keys are just a cheapo pointer
20:44cemerickchessguy: https://github.com/cemerick/clojure-type-selection-flowchart
20:45chessguywhoah, that url sounds epic
20:45duck1123,(let [foo {:x 1 :y 1}] (assoc foo :y 2))
20:45clojurebot{:y 2, :x 1}
20:45cemerickomnigraffle has that effect :-P
20:46technomancystructs and records don't have nearly as good of a theme song anyway: maps are the besthttp://www.youtube.com/watch?v=oIIxlgcuQRU
20:46technomancyoops
20:48amalloytechnomancy: what the hell, who puts a QR code next to a youtube video? if you want to link to some information from a webpage...link to it
20:49technomancyyoutube isn't really a place where you expect stuff to make sense
20:49tcrayfordman it's been a long time since I heard that song
20:49tcrayfordthanks
20:50hiredmantechnomancy makes a good point
20:50technomancyclojurebot: maps?
20:50clojurebotmaps are *AWESOME*
20:50technomancy^ also a good point.
20:50tcrayfordclojurebot: pointfree?
20:50clojurebotExcuse me?
20:50tcrayfordno points :(
20:51amalloyi can't find a link: anyone know who said "If I can only have one data structure, let it be a hashmap"?
20:51hiredmanobviously not a lisp programmer
20:53technomancywe can probably rule out chuck moore too
20:53gfredericksa pothead of some sort?
20:53cemerickall you need is alists
20:53hiredman~#34
20:53clojurebot34. The string is a stark data structure and everywhere it is passed there is much duplication of process. It is a perfect vehicle for hiding information. -- Alan J. Perlis
20:54gfredericksall you need is finger trees
20:54tcrayfordI'd hazard a guess at Larry Wall :/
20:56cemerickweavejester: do you know what happened to the grizzly ring adapter?
21:16weavejestercemerick: Nope, sorry
21:22cemerickno worries, just taking inventory a bit
21:22cemerickinteresting that someone wrote a mongrel2 adapter
22:03hugodamalloy: a belated (-> {:a 1} (select-keys [:a]) vec)
22:20amalloyhugod: slick
23:58jcromartiehow do I reference a proxy object itself within one of its methods
23:59TimMcUgh, I can't get cljs.compiler/compile-file to write out to file when I run my program, although it works fine from the REPL.
23:59jcromartiesay, (proxy [Foo] [] (someMethod [] (.redraw this)))