2013-02-17
| 00:50 | abp | Protocol extension to instances isn't implemented in Clojure by now, right? |
| 00:50 | abp | Is there some sort of scoped protocol extension? |
| 01:04 | callenbot | Raynes: 11pt - Menlo, Monaco, "Ubuntu Mono", monospace; |
| 01:04 | Raynes | I hate Ubuntu Mono. |
| 01:04 | abp | robert.hooke |
| 01:05 | callenbot | Raynes: can we compromise on something that isn't Deja Vu Mono? |
| 01:05 | callenbot | Raynes: it's horrendous. Also the Menlo/Monaco is so it doesn't look awful on my mac. |
| 01:05 | callenbot | Raynes: at least adding Menlo to the front of the list would improve my sanity. |
| 01:05 | callenbot | Raynes: you should considering using a CSS preprocessor to avoid the CSS rule duplication I saw as well. |
| 01:05 | Raynes | callenbot: The first two are mac fonts, the one after that is an Ubuntu font, and then you drop to whatever is default. |
| 01:06 | Raynes | And no. |
| 01:06 | callenbot | Raynes: Windows users aren't people. |
| 01:06 | Raynes | I don't care about Windows users. |
| 01:06 | Raynes | Other Linux distros. |
| 01:06 | callenbot | what's wrong with using Menlo specifically? It'll look better. |
| 01:06 | clifton | I've spent a decent amount of time with a lot of fixed-width fonts and I got sick of everything except Menlo |
| 01:06 | Raynes | I can evaluate Menlo and see if it is pretty to me (I've always been fond of Monaco), but I'm putting Deja Vu before Ubuntu Mono. |
| 01:06 | callenbot | clifton: *thank* you. |
| 01:07 | Raynes | Can we compromise on that? |
| 01:07 | callenbot | Raynes: sounds great to me. |
| 01:07 | Raynes | Coolio. |
| 01:07 | Raynes | I'm working on some refheap stuff right now, but I'll put this on my todo list. |
| 01:07 | callenbot | Raynes: what about the font size? |
| 01:07 | Raynes | I'll play with that too. |
| 01:08 | callenbot | Raynes: http://i.imgur.com/v268Sbk.png menlo 11px |
| 01:08 | callenbot | Raynes: with that, I'll get back to my new project. Cheers and thanks for considering it :) |
| 01:08 | Raynes | I'll almost certainly do it. I just wanted Deja Vu before Ubuntu Mono. |
| 01:09 | callenbot | Raynes: totally cool with me. I know UM is a polarizing font. |
| 01:09 | Raynes | I know a ton of people who love Deja Vu too, and most of them are not mac users. So I'm pretty sure it is the best option after mac specific fonts. |
| 01:10 | callenbot | they look wide/fat to me. |
| 01:11 | clifton | with deja vu, dotted 0 drives me a little nuts |
| 01:11 | clifton | but i suppose thats more of a personal thing |
| 01:11 | clifton | it's a decent font |
| 01:15 | Raynes | callenbot: FWIW, Deja Vu wasn't the default out of my specific love for it. I asked a bunch of people what they wanted and it turned out to be that. |
| 01:15 | callenbot | Raynes: like any good Commissar, I respect the will of the proletariat. |
| 01:15 | Raynes | Haha |
| 01:17 | callenbot | Everytime I talk to weavejester I learn something new but am also firmer in my belief that we could never review each others' code. |
| 01:18 | abp | callenbot: What are you looking at? :D |
| 01:19 | callenbot | abp: I'm hacking up code. |
| 01:20 | abp | callenbot: Thought you were looking into weavejesters code. |
| 01:21 | callenbot | abp: no, I mean literally when I talk to him in IRC. |
| 01:21 | callenbot | abp: I was reflecting on our last conversation. |
| 01:21 | callenbot | so apparently a constructive blog post these days involves writing two lines in a yaml config to change your database connection pool size |
| 01:21 | callenbot | if I'd known that, I could've written 30 posts about my last week of work. |
| 01:21 | callenbot | maybe 90. |
| 01:22 | callenbot | ooooooh Watsi. Right. |
| 01:28 | abp | callenbot: Hm, at least his "I tend to prefer to keep data constrained, which is why I prefer a *user* over a more general context map" is great. From the guy who stands in front of many people and tells them how a single map for a whole http-request and -response is excellent. :D |
| 01:29 | callenbot | abp: on the one hand, it pleases me greatly that you noticed this too. On the other hand, you are probably nuts and I'm not sure I want to be of like mind as you. |
| 01:29 | abp | callenbot: Watch the latest hickey talks, probably he is sane if I'm no more. |
| 01:30 | callenbot | Clojure programmers invoke Hickey like Catholics and Protestants invoke thegr God. |
| 01:30 | abp | callenbot: That comes from him building things that work. |
| 01:31 | callenbot | Hickey is brilliant but everyone assumes he's saying what they're thinking and that they're right because of it. |
| 01:31 | callenbot | perhaps the phrase should be, "to know the mind of Hickey" instead. |
| 01:31 | callenbot | I assert that the mind of Hickey is unknowable to all mortal men. |
| 01:32 | abp | Hm, difficult. I agree with the things that I think are really valuable. And such are many. |
| 01:33 | callenbot | As do I, but who has the most accurate interpretation of the Hickey's holy words? |
| 01:35 | greywolve | is there a way to get an atom to increment before running lein test in such a way that my tests can see this atom? right now when i try do this it creates a different atom before running the tests ;| |
| 01:35 | abp | callenbot: Uh, let's call Hickey on that. :D Endless spam floods ahead. "He put my state up my ars* just because I didn't split it up." |
| 01:36 | callenbot | greywolve: dafuq |
| 01:37 | abp | greywolve: If you are trying to mock global atoms or whatever; don't. http://vimeo.com/46163090 |
| 01:37 | abp | greywolve: Probably you can even get rid of it. :P |
| 01:37 | callenbot | abp: are you making fun of my put-context? |
| 01:37 | callenbot | abp: you're making fun of put-context aren't you? |
| 01:38 | greywolve | abp: not trying that ;p trying to do this: http://corfield.org/blog/post.cfm/automated-browser-based-testing-with-clojure |
| 01:38 | callenbot | abp: thems fightin' words boy. |
| 01:38 | abp | callenbot: Whoat, never! |
| 01:38 | callenbot | A fine choice. |
| 01:39 | abp | callenbot: Only when I ate your byte :P |
| 01:39 | greywolve | but sadly it's not working like it should . due to the tests not seeing the incremented atom |
| 01:40 | abp | greywolve: Sorry, haven't done any automated browser testing, callenbot could consult on that. :P |
| 01:40 | callenbot | greywolve: you don't want to talk to me about automated browser testing. It drives me to drink and I don't use selenium if I can help it. |
| 01:41 | callenbot | greywolve: I use casperjs usually. |
| 01:41 | greywolve | abp: thanks anyway, sigh, it seems overly complicated just to run some code before and after doing lein test that my tests can reference |
| 01:41 | greywolve | greywolve: i can see why! |
| 01:42 | callenbot | I'm not you, bro. |
| 01:42 | greywolve | callenbot: i can see why! |
| 01:42 | greywolve | haha |
| 01:42 | greywolve | whoops |
| 01:42 | callenbot | I need more sake if I'm going to get this app done this weekend. |
| 01:42 | callenbot | lots more sake. |
| 01:43 | greywolve | clj-webdriver is great though, i just want to have all the tests run in a single browser session |
| 01:44 | callenbot | greywolve: I am githubbing. It looks nice. |
| 01:45 | callenbot | greywolve: https://groups.google.com/forum/#!topic/clj-webdriver/z9hYKR4fOZE |
| 01:45 | callenbot | yogthos: hey chief. |
| 01:46 | greywolve | (def ^:private browser-count (atom 0)) |
| 01:46 | greywolve | (defn browser-up |
| 01:46 | greywolve | "Start up a browser if it's not already started." |
| 01:46 | greywolve | [] |
| 01:46 | greywolve | (when (= 1 (swap! browser-count inc)) |
| 01:46 | greywolve | (set-driver! {:browser :firefox}) |
| 01:46 | greywolve | (implicit-wait 60000))) |
| 01:46 | greywolve | when i run lein test, the atom gets incremented, then it runs each of the test files, but they see the atom as 0 |
| 02:05 | greywolve | is there any way to easily require all the test namespaces into the repl? |
| 02:06 | greywolve | eg if i have testsuite.test1, testsuite.test2 etc and i just want all the testsuite namespaces required? |
| 02:38 | greywolve | seancorfield: does this: http://corfield.org/blog/post.cfm/automated-browser-based-testing-with-clojure work for you in lein 2? selenium opens 2 firefox windows for me |
| 02:55 | seancorfield | greywolve: sorry, just noticed your question... |
| 02:55 | seancorfield | well, we're using lein 2 now and what we are doing works... so let me double check my blog post |
| 02:56 | seancorfield | let me double check our current source code against what's in that blog post |
| 02:56 | greywolve | seancorfield: when i run lein test, and println the browser-test atom, i notice the first atom printed is different from the atoms the tests see |
| 02:57 | greywolve | thanks ;) |
| 02:57 | seancorfield | i run lein with-browser test |
| 02:57 | greywolve | yeah sorry i mean lein with-browser test |
| 02:58 | greywolve | lein with-browser test |
| 02:58 | greywolve | #<Atom@567ba718: 0> |
| 02:58 | greywolve | lein test testsuite.anothertest |
| 02:58 | greywolve | Testing testsuite.anothertest |
| 02:58 | greywolve | #<Atom@7b4da77: 0> |
| 02:59 | seancorfield | did you remember to add :eval-in :leiningen to project.clj? |
| 02:59 | greywolve | yup |
| 02:59 | greywolve | without that it won't run at all |
| 03:00 | seancorfield | the blog post seems to match our current source code |
| 03:00 | seancorfield | clj-webdriver 0.6.0-beta2 ? |
| 03:00 | greywolve | yeah, and clojure 1.5 |
| 03:00 | seancorfield | and we have to have :exclusions [org.clojure/core.cache] but that might not affect you |
| 03:00 | seancorfield | hmm, let me try clojure 1.5 - we're on 1.4 |
| 03:01 | greywolve | i just don't understand why two separate atoms are being created in my case ;p |
| 03:02 | greywolve | i think i've tried with 1.4 aswell but perhaps that is the problem |
| 03:03 | seancorfield | works just fine with 1.5.0-RC16 here - just tried it |
| 03:03 | greywolve | woah, this is strange then |
| 03:04 | greywolve | what os are you running? |
| 03:06 | seancorfield | mac os 10.7.5 |
| 03:07 | seancorfield | and firefox 3.6.12 i believe (had problems with later versions and selenium) |
| 03:07 | greywolve | linux mint 14 here (ubuntu 12.10) |
| 03:08 | greywolve | its almost like lein is first running the with-browser code in a separate environment, before loading all the test files |
| 03:08 | seancorfield | in your tests, are you reloading the ns? |
| 03:08 | greywolve | hence the two different atoms |
| 03:09 | greywolve | each test looks like the example you gave: |
| 03:09 | greywolve | (ns testsuite.test.profile-scripts |
| 03:09 | greywolve | (:require [clj-webdriver.taxi :refer :all] |
| 03:09 | greywolve | [clojure.test :refer :all] |
| 03:09 | greywolve | [testsuite.core :refer :all])) |
| 03:09 | greywolve | (deftest edit-my-profile |
| 03:09 | greywolve | (browser-up) |
| 03:09 | greywolve | (login :eg "testuser" "secret") |
| 03:09 | greywolve | (go-to :eg "/profile/edit") |
| 03:09 | greywolve | (input-text "#aboutme" "I like long walks on the beach and being a snugglebunny.") |
| 03:09 | greywolve | (click "#btnSaveProfile2") |
| 03:09 | greywolve | (is (= "Your profile has been successfully updated." (text ".success p"))) |
| 03:09 | greywolve | (is (= "In order for your profile to appear to other members, please fill out the missing fields identified below." (text ".warning p"))) |
| 03:09 | greywolve | (browser-down)) |
| 03:10 | greywolve | but just with (browser-up) and (to "some url") and (browser-down) |
| 03:10 | seancorfield | hmm, dunno... my brain's not exactly in a good debugging state right now (it's midnight and several beers down :) ) |
| 03:10 | greywolve | hahah thanks for the help anyway, appreciate it ;) |
| 03:11 | greywolve | but yeah, does seem like somewhere the namespace is being reloaded |
| 03:11 | seancorfield | that sounds like a problem i ran into early on but fixed before i blogged about it |
| 03:12 | seancorfield | i'm sure it was something to do with :eval-in :leiningen |
| 03:12 | greywolve | (defproject clj-webdriver-boilerplate "0.1.0-SNAPSHOT" |
| 03:12 | greywolve | :description "clj-web-driver-boilerplate" |
| 03:12 | greywolve | :url "http://www.github.com/greywolve/clj-webdriver-boilerplate" |
| 03:12 | greywolve | :license {:name "MIT License" |
| 03:12 | greywolve | :url ""} |
| 03:12 | greywolve | :dependencies [[org.clojure/clojure "1.5.0-RC16"] |
| 03:12 | greywolve | [clj-webdriver "0.6.0-beta2"]] |
| 03:12 | greywolve | :eval-in :leiningen) |
| 03:12 | greywolve | this is correct? |
| 03:12 | seancorfield | yup |
| 03:13 | seancorfield | and your testsuite.core has the (dissoc project :eval-in) ? |
| 03:13 | greywolve | yeah |
| 03:13 | seancorfield | weird |
| 03:14 | greywolve | in your blog post, for the require |
| 03:15 | greywolve | (ns leiningen.with-browser |
| 03:15 | greywolve | (:require [webdriver.core :refer [browser-up browser-down]] |
| 03:15 | greywolve | [leiningen.core.main :as main])) |
| 03:15 | greywolve | webdriver.core |
| 03:15 | greywolve | that is a mistake right? ;p |
| 03:15 | greywolve | i replaced it with testsuite.core |
| 03:15 | seancorfield | should be testsuite.core, yeah |
| 03:15 | greywolve | ah ok, now i really don't know haha |
| 03:16 | seancorfield | sorry |
| 03:17 | greywolve | what does dissoc project :eval-in do? well i know what it does but what's the reason for it? |
| 03:18 | seancorfield | I no longer remember why that was needed... |
| 03:18 | seancorfield | something to do with how the tests run... |
| 03:21 | greywolve | ah ok , the quirks of lein ;0 |
| 03:21 | seancorfield | Hmm, just tried it without the dissoc and it still works... so maybe that was a workaround for a bug in a preview of lein2? |
| 03:21 | greywolve | hmm yeah could be |
| 03:22 | seancorfield | try passing just project instead of (dissoc project :eval-in) and see if that solves it? |
| 03:24 | greywolve | nope same thing, but it does still run fine, just opens 2 firefox windows ;p good to know its not needed anymore though! |
| 03:26 | greywolve | Leiningen 2.0.0 on Java 1.7.0_07 OpenJDK 64-Bit Server VM |
| 03:26 | greywolve | this may me some kind of lein bug i guess |
| 03:27 | greywolve | for ubuntu ;p |
| 03:32 | greywolve | ohhhhh wait a minute |
| 03:33 | Raynes | dsantiago: Just occurred to me that hickory escaping all text means that it is impossible to run a large piece of stored HTML through hickory-to-html without first parsing the HTML, which can add quite a bit of overhead if done per an http request. Didn't we discuss adding an option at some point? Seems like an option to turn off the automatic escaping of strings would be helpful here. Pretty sure there is no situation where anybody would |
| 03:33 | Raynes | ever want it off for attributes. |
| 03:34 | dsantiago | No idea what you're talking about. |
| 03:34 | arrdem | Raynes: I'm reading your update path from Noir to Lib-noir, what is the "best practice" for structuring route records? one list per file as you do for refheap? |
| 03:34 | Raynes | The reason it occurred to me because refheap uses pygments to generate the highlighted HTML and then stores that highlight html in the db, and it can be fairly large depending on the size of the paste. In order to inject that HTML into a larger document I have to first parse it to hickory nodes. |
| 03:35 | greywolve | lein with-browser test testsuite.test.anothertest testsuite.test.sometest |
| 03:35 | greywolve | works |
| 03:35 | greywolve | what's happening is testsuite.core is being loaded again! |
| 03:35 | Raynes | It works, but it's slow to do on every request and there is no way to just put the string in there, because hickory-to-html always escapes strings. |
| 03:35 | Raynes | dsantiago: ^ Does any of that make sense? |
| 03:36 | Raynes | arrdem: Dunno what everyone else does. That's just the way I do it. |
| 03:36 | dsantiago | Is this because you are using hickory-to-html as the backend for a template system, which I've told you not to do? |
| 03:36 | arrdem | Raynes: mmkay. cheers. |
| 03:36 | Raynes | Meh. |
| 03:39 | seancorfield | greywolve: so are you saying it works if you specify namespaces but if you don't, you get two browsers? or the other way around? |
| 03:39 | Raynes | arrdem: 4clojure is also structured similarly. |
| 03:39 | Raynes | But I guess I did that too... |
| 03:39 | greywolve | it works if i specify the namespaces ;p |
| 03:39 | seancorfield | weird... |
| 03:40 | greywolve | lein with-browser test |
| 03:40 | greywolve | #<Atom@51f28023: 0> |
| 03:40 | greywolve | lein test testsuite.core |
| 03:40 | greywolve | Testing testsuite.core |
| 03:40 | greywolve | lein test testsuite.test.anothertest |
| 03:40 | greywolve | Testing testsuite.test.anothertest |
| 03:40 | greywolve | it makes sense, look at that |
| 03:40 | greywolve | its running testsuite.core as a test |
| 03:40 | greywolve | so its reloading the namespace essentially |
| 03:40 | seancorfield | oh!!!!!! right!!! |
| 03:40 | greywolve | ;p |
| 03:40 | seancorfield | i have testsuite.core in src/ not test/ |
| 03:40 | greywolve | ohhhhhhh |
| 03:40 | seancorfield | that's your problem! |
| 03:40 | greywolve | haha ;) that solves it then! |
| 03:43 | greywolve | seancorfield: thanks so much! do you mind if i setup a clj-webdriver-boilerplate repo with this? |
| 03:43 | seancorfield | sure, knock yourself out!! |
| 03:44 | seancorfield | i've updated the blog post to show testsuite.core lives in src/ and also fixed the webdriver.core typo |
| 03:44 | seancorfield | thanx for spotting the latter and helping me clarify the former! |
| 03:45 | seancorfield | damn, i need to be up in six hours to drive to so. cal. - better go to bed! |
| 03:45 | greywolve | pleasure, ill link to your post in the repo ;) |
| 03:45 | greywolve | nn! |
| 03:53 | arrdem | Raynes: mmkay makes more sense than the "one file of routings" approach I was considering as an alternative |
| 05:46 | samrat | how can I import hiccup templates from outside my project? |
| 05:47 | samrat | here's my attempt using pushbackreader, but it seems to only bring in the first function: https://www.refheap.com/paste/11383 |
| 06:20 | borkdude | yogthos|away tnx for the Luminus website |
| 07:12 | greywolve | https://github.com/greywolve/clj-webdriver-boilerplate |
| 07:13 | greywolve | if anyone is struggling with acceptance testing that will help, all thanks to seanaway |
| 08:04 | michaelr525 | hey |
| 08:15 | augustl | I have a list of functions and a function. How do I turn that into (fn3-from-list (fn2-from-list (fn1-from-list single-fn)))? |
| 08:15 | borkdude | augustl probably with comp |
| 08:16 | augustl | looking it up |
| 08:16 | borkdude | (apply comp (reverse (cons single-fn function-list))) |
| 08:17 | borkdude | ((apply comp (reverse function-list)) single-fn) <-- o wait. |
| 08:18 | borkdude | since you call fn-1 with the single-fn |
| 08:19 | augustl | neat |
| 08:47 | hyperboreean | how can I assert that 2 vectors are equal using clojure.test ? |
| 08:50 | augustl | hyperboreean: = will do that |
| 08:51 | hyPiRion | (is (= vec1 vec2)) |
| 09:00 | hyperboreean | augustl: hyPiRion: I always get this wrong, I always do (is (= (vec1 vec2))) and clojure fails thinking vec1 is a function call |
| 09:00 | hyperboreean | thanks |
| 09:02 | hyPiRion | You're welcome, fellow Clojurian whose name starts with "hyp". |
| 09:02 | hyperboreean | heh :) |
| 10:01 | ToxicFrog | Are there any binary (un)packing libraries more versatile than Gloss? Support for 3-byte ints and fixed point and whatnot? |
| 10:08 | hyperboreean | shouldn't ((fn [[[x y] p]] x) [1 2]) be the same as (let [[x y] [1 2]] x) ? I get an exception for the first one |
| 10:09 | borkdude | hyperboreean I think you have one [ ] too many |
| 10:10 | hyperboreean | borkdude: but then it would mean I should pass 2 arguments to that fn, when I actually want only 1 ... |
| 10:10 | tmciver | hyperboreean: no, but ((fn [[x y]] x) [1 2]) should be the same. |
| 10:10 | borkdude | hyperboreean ((fn [[x y] & p] x) [1 2]) |
| 10:11 | borkdude | hyperboreean dunno what p does here |
| 10:11 | Chousuke | the structure of a destructuring parameter list matches the call |
| 10:11 | Chousuke | so if your data is [x y] and you want to extract x and y, your parameter list must look like [[x y]] |
| 10:12 | Chousuke | [[[x y]]] would match a [[x y]] being passed in |
| 10:12 | hyperboreean | Chousuke: and the same should be true for defn; is the same form, right ? |
| 10:12 | Chousuke | yes |
| 10:13 | Chousuke | defn uses fn internally |
| 10:13 | borkdude | hyperboreean defn is basically (def name (fn [args] …)) |
| 10:14 | Chousuke | (fn name [args] ...), but yeah :P |
| 10:14 | hyperboreean | so, let's say I want to make the following call (my-func [1 2] [3 4]) and destructure 1 2 3 4 in x y z t ... how would I do this in the arguments list, rather than a let form inside the function's body ? |
| 10:15 | Chousuke | [[x y] [z t]] |
| 10:15 | borkdude | (fn [[x y] [p q]] (+ x y p q)) for example |
| 10:15 | borkdude | z t instead of p q of course |
| 10:15 | Chousuke | hyperboreean: basically, write out the call, put the parameters in a vector, and replace literals with variables |
| 10:16 | hyperboreean | huh, ok, that's what I am doing wrong ... I was doing something like [[x y] p1 [z t] p2] |
| 10:16 | hyperboreean | there's no need for p1 and p2 |
| 10:16 | borkdude | hyperboreean nope |
| 10:16 | hyperboreean | alright, got it, thanks Chousuke and borkdude |
| 10:18 | borkdude | hyperboreean for future reference, check this http://clojure.org/special_forms#Special%20Forms--Binding%20Forms%20(Destructuring) |
| 10:20 | hyperboreean | borkdude: I went over the let destructuring chapter from "Clojure Programming", but now I wonder why fn destructuring wasn't more obvious since it's the same thing ... |
| 10:21 | bawr | hyperboreean: it's always obvious - after it clicks. :) |
| 10:22 | antares_ | Langohr 1.0.0-beta11 is released: http://blog.clojurewerkz.org/blog/2013/02/17/langohr-1-dot-0-0-beta11-is-released/ |
| 10:24 | borkdude | hyperboreean this is perhaps what you wanted with the ps: (def f (fn [[a b :as p1] [c d :as p2]] [p1 p2])) |
| 10:25 | hyperboreean | borkdude: it might've been a mixture of that and what Chousuke showed me ... though I don't really need to preserve the initial arguments, so :as wasn't really required |
| 10:26 | borkdude | hyperboreean still it's nice to have ;) |
| 10:27 | hyperboreean | is there any memory overhead in doing [a b :as p]? ideally Clojure would know when to garbage collect p in this form [a b], right ? |
| 10:28 | borkdude | hyperboreean I think not |
| 10:28 | hyperboreean | well, wrong question ... is the original p still around when destructuring as [a b] without retaining the initial p ? |
| 10:30 | borkdude | hyperboreean like this? ((fn [[x y]] x) [(java.util.Date.) (java.util.Date.) (java.util.Date.)]) |
| 10:30 | borkdude | hyperboreean the third date isn't even referenced in the destructuring so it could be gc-ed immediately |
| 10:31 | borkdude | hyperboreean the second date isn't used in the body, so it could be gc-ed in the start of the function |
| 10:31 | borkdude | hyperboreean I don't know how clojure deals with this |
| 10:32 | hyperboreean | borkdude: might be a JVM thing, though, and you might be right ... what you described should be the correct behaviour, I think |
| 10:35 | antares_ | Neocons 1.1.0-beta4 is released: http://blog.clojurewerkz.org/blog/2013/02/17/neocons-1-dot-1-0-beta4-is-released/ |
| 11:46 | ianulus | hi |
| 11:46 | ianulus | anybody awake |
| 11:46 | ianulus | ? |
| 11:49 | yedi | hows #clojure doing this fine monrning |
| 11:50 | pimeys | almost going to sleep, dinner and then down :) |
| 11:51 | ianulus | oh, look, activity! ;) |
| 11:52 | pimeys | I hope I can finish the sicp before that |
| 11:52 | ianulus | can I get some help from you guys? |
| 11:53 | arrdem | that' |
| 11:53 | arrdem | s largely what we're here for... |
| 11:53 | ianulus | cool! |
| 11:54 | ianulus | I've been trying to get the whole emacs+leiningen deal going |
| 11:55 | ianulus | installed emacs24, starterkit & ran leiningen |
| 11:55 | ianulus | but when I try to fire up a repl, it fails with "Exception in thread "main" java.net.BindException: Cannot assign requested address" |
| 11:55 | arrdem | sounds like something else is already running on the standard nrepl port... |
| 11:56 | ianulus | what's the quickest way to check for that? |
| 11:56 | arrdem | on Linux? |
| 11:57 | ianulus | yeah |
| 11:57 | ianulus | (ubuntu 12.04) |
| 11:58 | ivan | lsof | grep portnumber |
| 11:58 | ianulus | what's the standard port? |
| 11:59 | ivan | if no :port in your project.clj, a random available port |
| 12:00 | ivan | assuming lein 2, don't know if it changed |
| 12:02 | ianulus | well, if it's a random port, the chances for it failing with that error twice in a row should be minimal... |
| 12:03 | augustl | ephermeral ports ftw :) |
| 12:03 | augustl | if you bind to port 0, the OS will assign a port for you, and the OS knows what ports that are busy |
| 12:05 | ianulus | of course, I don't know how to do that... |
| 12:06 | ianulus | ah, got it: lein :port port# |
| 12:07 | ianulus | I mean: lein repl :port port# |
| 12:08 | ianulus | ...or not |
| 12:13 | arrdem | ianulus: add :repl-options {:port 90001} to your project.clj |
| 12:13 | arrdem | or :port 0 based on what augustl said. |
| 12:14 | ianulus | sorry, irc app died ... can you repost that last bit please? |
| 12:15 | arrdem | ianulus: your project.clj should have :repl-options {:port 0} |
| 12:18 | ianulus | no luck - same error |
| 12:19 | ivan | maybe all of your ports are bound |
| 12:20 | ivan | look at the lsof output |
| 12:20 | ivan | as root, to see everything |
| 12:22 | ianulus | that gives a huge output |
| 12:23 | ivan | or maybe you lack a 127.0.0.1 address? |
| 12:25 | ianulus | ping 127.0.0.1 works fine |
| 12:41 | ianulus | dammit, It sucks having such an obscure error ... google doesn't have much to say either |
| 12:44 | ivan | can other programs bind ports? |
| 12:45 | ivan | e.g. nc -l 1234 |
| 12:47 | ianulus | seems so, I get this line in netstat: |
| 12:47 | ianulus | tcp 0 0 0.0.0.0:1234 0.0.0.0:* LISTEN |
| 12:48 | ivan | now try nc -l 0 |
| 12:50 | ivan | if your LAN isn't malicious you can try: env LEIN_REPL_HOST=0.0.0.0 LEIN_REPL_PORT=0 lein repl |
| 12:50 | ivan | if you still have problems, maybe you can provide enough information to reproduce everything about your environment |
| 12:57 | ianulus | well, it's a public server, so I wouldn's exactly call the lan "non-malicious" |
| 13:00 | ianulus | nc -l 0 yields: |
| 13:00 | ianulus | tcp 0 0 0.0.0.0:45444 0.0.0.0:* LISTEN |
| 13:05 | ianulus | "everything about my environment" sounds a bit broad ... where to start? |
| 13:07 | ianulus | I dist-upgraded to Ubuntu server 12.04 yesterday and followed this tutorial setting everything up: |
| 13:07 | ianulus | http://ianrumford.github.com/blog/2012/06/22/clojure-emacs-slime-and-swank-on-ubuntu-precise-1204/ |
| 13:08 | ianulus | except i read somewhere that clojure-jack-in has been replaced by nrepl-jack-in |
| 13:10 | ianulus | so emacs.d/init.el contains: |
| 13:10 | ianulus | (defvar my-packages '(starter-kit starter-kit-lisp starter-kit-bindings starter-kit-eshell clojure-mode clojure-test-mode nrepl) |
| 13:13 | ravster | hello all |
| 13:14 | gfredericks | ~hello |
| 13:15 | gfredericks | clojurebot: you disappoint me. |
| 13:16 | ianulus | ivan: can you offer any more suggestions? |
| 13:18 | ianulus | or anybody else? |
| 13:20 | ivan | sunday morning will not be a busy time ;) |
| 13:20 | ivan | do you have weird security products or settings? |
| 13:20 | ianulus | I know |
| 13:20 | ivan | strace -f lein repl might show things |
| 13:21 | ianulus | not that I can remember |
| 13:22 | ianulus | installing ftrace... |
| 13:22 | ianulus | E: Unable to locate package ftrace |
| 13:23 | ianulus | what's ftrace? |
| 13:23 | ianulus | oops |
| 13:23 | ianulus | sorry |
| 13:24 | ianulus | yeah, that shows a whole bunch of things... |
| 13:24 | ivan | what does `lein version` say? |
| 13:25 | ianulus | Leiningen 2.0.0 on Java 1.7.0_13 OpenJDK 64-Bit Server VM |
| 13:29 | ivan | I have no other ideas, but I would guess broken network/security settings somewhere |
| 13:30 | ivan | try making some other program bind to 127.0.0.1:0 |
| 13:30 | ivan | netcat appears to be unable |
| 13:31 | ivan | I would also make sure that lein is really trying port 0 with LEIN_REPL_PORT |
| 13:31 | ivan | though it should already be doing that, so I don't know |
| 13:33 | ianulus | how do I use LEIN_REPL_PORT? |
| 13:34 | borkdude | it would be cool but obviously complicated if you could say during a REPL session: hey grab me clojure.math.combinatorics and put it on the classpath |
| 13:34 | borkdude | I hate trying out things having to make a project especially for this |
| 13:35 | borkdude | ad hoc dependencies |
| 13:35 | borkdude | this would lead to security issues for sure |
| 13:36 | borkdude | wouldn't it? |
| 13:37 | ivan | not any more security issues than already exist |
| 13:38 | ivan | http://www.learningclojure.com/2013/02/runtime-require-downloading-new.html |
| 13:38 | ivan | ianulus: see above line with "env " |
| 13:39 | borkdude | ivan cool |
| 13:43 | ianulus | ther's no "env " on that page |
| 13:44 | Frozenlock | Could someone point me towards an example of implementing ISeq? (I get "IllegalArgumentException Don't know how to create ISeq from.." when trying 'first') |
| 13:45 | gfredericks | Frozenlock: that stuff is usually pretty easy to track down; I'd just check the source of first and go step by step from there |
| 13:49 | gfredericks | Frozenlock: implementing Seqable is sufficient for most purposes actually |
| 13:51 | Frozenlock | gfredericks: I'll try that, thanks! |
| 13:54 | borkdude | ivan cool, I now put pomegranate in my dev dependencies and load a script each time leiningen spins up with some helper functions: (load-math) loads math.combinatorics contrib, etc :-D |
| 13:55 | gfredericks | &(take 5 (reify ISeq (first [_] 42) (next [this] this) (rest [this] this))) |
| 13:55 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: ISeq in this context |
| 13:55 | gfredericks | &(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (rest [this] this))) |
| 13:55 | lazybot | java.lang.IllegalArgumentException: Can't define method not in interfaces: rest |
| 13:56 | gfredericks | &(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (more [this] this))) |
| 13:56 | lazybot | java.lang.AbstractMethodError |
| 13:56 | gfredericks | &(take 5 (reify clojure.lang.ISeq (first [_] 42) (next [this] this) (more [this] this) (seq [this] this))) |
| 13:56 | lazybot | ⇒ (42 42 42 42 42) |
| 13:57 | gfredericks | Frozenlock: ^ there's something also :) |
| 13:57 | gfredericks | a GC-friendly impl of clojure.core/repeat |
| 13:58 | clojure-newb | gfredericks: hi, you helped me out with '(#(->> % (group-by :k1) vals (map first)) col)' the other day, grabs a distinct on a sequence of maps with identical value on key :k1.. can you help me figure out how to select the map with :k3 present instead of just grabbing the first ? |
| 14:01 | yedi | does compojure have an equivalent to django's reverse? |
| 14:02 | gfredericks | clojure-newb: add (map (partial filter :k3)) before the (map first)? |
| 14:03 | gfredericks | that'll have issues with falsy values though, so you could do (map (partial filter #(contains? % :k3))), but you can't nest #() so you'd have to verbosify your outer one |
| 14:03 | clojure-newb | gfredericks: thanks, I will have a go with some of these |
| 14:04 | clojure-newb | gfredericks: oh.. its killing my sequence :-) |
| 14:06 | clojure-newb | I'm hoping to turn : [{:k1 "v1", :k2 "anything"} {:k1 "v1", :k2 "something else"} {:k3 "important", :k1 "v1", :k2 "blurb"} {:k1 "bbb", :k2 "yaa"}] |
| 14:06 | clojure-newb | into : [{:k3 "important", :k1 "v1", :k2 "blurb"} {:k1 "bbb", :k2 "yaa"}] |
| 14:07 | gfredericks | it's killing it? |
| 14:07 | gfredericks | oh because sometimes :k3 isn't present? |
| 14:07 | clojure-newb | gfredericks: sorry… yes |
| 14:07 | gfredericks | in which case you want to fall back on the first thing? |
| 14:07 | clojure-newb | gfredericks: so I lost the second map in the above example |
| 14:08 | clojure-newb | gfredericks: I think I want to pull the candidate with k3 when it exists or fall back to first if not |
| 14:09 | gfredericks | clojure-newb: https://www.refheap.com/paste/11391 |
| 14:10 | clojure-newb | gfredericks: awesome |
| 14:10 | clojure-newb | just trying to understand that now |
| 14:10 | clojure-newb | thanks |
| 14:12 | gfredericks | np |
| 14:13 | yedi | what is the googleable name for ->> |
| 14:13 | yedi | i know -> is the threading macro |
| 14:14 | mpenet | thread first and thread last I think |
| 14:15 | gfredericks | super stabby |
| 14:18 | ianulus | ivan: I'm giving up for now, but thanks for your help :-) |
| 14:18 | borkdude | ivan https://www.evernote.com/shard/s96/sh/00ce724f-2c48-4bf6-b0e9-dc7f61cc8cd0/d7f5c8e8bc886c18240f859b48e13ee2 |
| 14:20 | Frozenlock | gfredericks: your example leaves me thinking I might have started on the wrong path. To make a story short, I'm playing with technomancy's serializable-fn (https://github.com/technomancy/serializable-fn). I would like the returned function to act like a list. For example, with my-fn = (fn [x] (* x x)), (first my-fn) should return fn. |
| 14:21 | gfredericks | Frozenlock: so you're hacking his code? |
| 14:21 | Frozenlock | Yup |
| 14:21 | gfredericks | does he have a custom type? |
| 14:22 | Frozenlock | Not that I can see. He simply add a method. |
| 14:22 | gfredericks | oh I see he just hooks into the :type metadata |
| 14:22 | Frozenlock | oh wait |
| 14:22 | Frozenlock | yes |
| 14:22 | gfredericks | so you probably have to switch to doing your own type |
| 14:22 | gfredericks | and implementing IFn |
| 14:22 | Frozenlock | ::serializable-fn is the type |
| 14:22 | gfredericks | I mean a deftype |
| 14:22 | gfredericks | instead of just the :type metadata |
| 14:23 | gfredericks | (deftype SerializableFn [form func] ISeqable (-seq [_] form) IFn ...call func...) |
| 14:24 | gfredericks | I don't know what the implications are for not being a clojure.lang.Fn, but I'm not sure you have a choice |
| 14:24 | gfredericks | unless you play with inheriting it |
| 14:28 | AtKaaZ | hey, if lib A has dynamic var *graph* and my project uses lib A and lib B(where B uses A also) do my project and lib B see the same *graph* or each gets a different one? like it would be private to the project (even though *graph* only exists in A), what if lib B uses a different version of lib A than my project ? |
| 14:30 | gfredericks | AtKaaZ: same var |
| 14:30 | gfredericks | you'll also be using the same version of lib A, probably the version you specify |
| 14:30 | gfredericks | maven handles that |
| 14:30 | Chousuke | same var, but remember that var bindings are thread-local |
| 14:30 | Chousuke | so they can't conflict |
| 14:30 | AtKaaZ | gfredericks: alright thanks for confirming both these |
| 14:30 | AtKaaZ | Chousuke: but assume lib A changes var-root |
| 14:31 | Chousuke | AtKaaZ: then you might have trouble :P |
| 14:31 | AtKaaZ | ok, that's the case with hermes g/open |
| 14:36 | drorbemet | Hi, I have a question concerning the IDE for Clojure development in production environments. I spend some time with Eclipse and some time with Emacs. Well, which limits do I have to expect with Clojure in Emacs with larger projects? Are there some guidelines on how to structure a larger number of files known? Oncle Bob for instance values the refactoring operations in Eclips. Does any body know how he thinks about that concerning Clojure c |
| 14:36 | borkdude | drorbemet Uncle Bob prefers IntelliJ |
| 14:37 | drorbemet | borkdude Ah ok |
| 14:38 | Frozenlock | gfredericks: thank you so much. I'll need some time to understand it, but thanks :) |
| 14:38 | seangrove | I have a clojurescript app that I've built that I want to get functional testing in on via webdriver/selenium2 - I've setup compojure to serve all the necessary static assets, and I've written some selenium stuff to go through those assets. |
| 14:38 | seangrove | I'd like to tie this into midje/CI |
| 14:38 | seangrove | I think for that, I'll need to have compojure and webdriver running in the same process |
| 14:38 | borkdude | drorbemet lots of people prefer emacs though |
| 14:39 | seangrove | Anyone know if this is possible, or know of of any guides for it? |
| 14:39 | borkdude | drorbemet I'd say, use them side by side and just see where it ends |
| 14:40 | AtKaaZ | is there some way to alter current binding? |
| 14:40 | gfredericks | Frozenlock: sure |
| 14:41 | AtKaaZ | like (binding [*graph* nil] (var-set #'*graph* 1)) or something |
| 14:41 | AtKaaZ | well that actually works:O |
| 14:42 | drorbemet | borkdude Yes that's what I will have to do I think. I just wander how Emacs integrates let's say with a team that uses Eclipse and Java? |
| 14:43 | antares_ | AtKaaZ: (binding [*graph* …]) alters the current binding. |
| 14:43 | borkdude | drorbemet no restrictions there as far as I know - it's just an editor that edits text files |
| 14:43 | AtKaaZ | antares_: yes but I mean inside it, var-set I wanted, works as I expected |
| 14:45 | drorbemet | borkdude Thanks for your encuragement :-) I will just spend some more time with Emacs to get up to speed and then see how it goes. |
| 14:46 | antares_ | drorbemet: IDEA's plugin, La Clojure, is pretty good, has Clojure-to-java and Clojure code navigation and basic refactoring operations. And it has been actively developed again recently. |
| 14:48 | drorbemet | antares: Ok, I'll try that one too, thanks. |
| 14:51 | drorbemet | antares: I remember that Chas Emerick din't like some thing about La Clojure but I did't quite understand it as I was reading it. |
| 14:53 | drorbemet | antares: It was some thing about La Clojure beeing a platform or something |
| 14:56 | schaefer | hi. i'm thinking of developing a forms based app using core.logic. the forms are pretty complex (think tax form complexity). normally, i'd think of using cells or dataflow for an app like this but i like the crazy idea that core.logic could 'reverse' the form calculations to obtain inputs from specified outputs. does anyone know of similar uses for core.logic? is this a bad idea for... |
| 14:56 | schaefer | ...some reason? |
| 14:56 | AtKaaZ | is there an option in (ns ...) to reload the other namespaces only if they changed? as opposed to :reload-all which does it always |
| 14:56 | gfredericks | AtKaaZ: don't think so |
| 14:56 | AtKaaZ | gfredericks: actually, this would have to be supported by the editor i realize ie. ccw/emacs |
| 14:57 | AtKaaZ | gfredericks: ccw has it, auto load on save |
| 14:59 | AtKaaZ | excellent, works as expected (was disabled by me, before) |
| 15:22 | hiredman | clojurebot: ping |
| 16:12 | dnolen | ClojureScript has symbol with metadata suppot now! http://github.com/clojure/clojurescript/commit/b87c940629c5789ece42ab757cc85bf491c25c84 |
| 16:18 | Bodil | dnolen: Ohhh sweet, well done :) |
| 16:19 | TimMc | What made y'all choose to make this switch? |
| 16:19 | TimMc | I assume it has been feasible in the past... |
| 16:25 | bbloom | TimMc: sorry, i wasn't in the channel -- dnolen and i are sitting in brooklyn hacking on cljs |
| 16:25 | bbloom | TimMc: he said you asked "why not" |
| 16:25 | bbloom | er i mean "why now" |
| 16:25 | bbloom | the answer is that we're trying to do the same for Keywords too |
| 16:25 | mpenet | I was about to ask :), nice work |
| 16:25 | bbloom | so then we can eliminate modifications to String.prototype |
| 16:26 | bbloom | keywords are tricker because of interning, so symbols first! |
| 16:26 | TimMc | So, why not earlier for symbols? |
| 16:27 | TimMc | Not enough people complaining about lack of metadata support? |
| 16:27 | TimMc | Anyway, I'm glad to hear that String will soon be unburdened. :-) |
| 16:27 | bbloom | pretty much |
| 16:52 | clojure-newb | hey guys… whats the best/safest way to check if a field is a number… seems number? needs a lot of guards to stop things exploding… like (number? 12a) |
| 16:54 | TimMc | I don't understand the 12a example. |
| 16:54 | clojure-newb | TimMc: just assuming somebody could put just about anything in an input... |
| 16:54 | amalloy | clojure-newb: yes, they can pass in any thing, but 12a is not a thing |
| 16:54 | clojure-newb | and 12a causes LispReader.readNumber to throw a NumberFormatException |
| 16:56 | clojure-newb | amalloy: so how would you recommend I check for sane input from a text input in a web page for example ? |
| 16:56 | amalloy | text input is strings. "12a" is a string |
| 16:56 | amalloy | you can successfully call number? on that |
| 16:57 | amalloy | 12a is not a thing, it is garbage in your source code |
| 16:57 | clojure-newb | amalloy: I see what you mean, thanks for spotting that |
| 16:59 | TimMc | clojure-newb: number? does not parse strings. |
| 17:01 | AtKaaZ | ,(Integer/parseInt "12") |
| 17:01 | clojurebot | 12 |
| 17:01 | AtKaaZ | is it like that ? or a better way? |
| 17:05 | TimMc | Long/parseLong is probably better :-) |
| 17:05 | Raynes | &(Long. "12") |
| 17:05 | lazybot | ⇒ 12 |
| 17:05 | AtKaaZ | yeah but isn't there some clojure way? |
| 17:05 | TimMc | However, that doesn't tell you if a string *can* be successfully parsed as a number. |
| 17:05 | Raynes | weee |
| 17:05 | TimMc | Clojure is a JVM language. That is the Clojure way. |
| 17:06 | Raynes | Sometimes Java stuff is the Clojure way. |
| 17:06 | AtKaaZ | makes sense |
| 17:06 | Raynes | Try to not think of Java interop as a side language. It's a core part of Clojure. |
| 17:06 | AtKaaZ | ,(Long/decode "12") |
| 17:06 | clojurebot | 12 |
| 17:06 | AtKaaZ | ,(Long/decode "12a") |
| 17:06 | clojurebot | #<NumberFormatException java.lang.NumberFormatException: For input string: "12a"> |
| 17:07 | AtKaaZ | TimMc, actually parselong works too, telling me if it can be parsed as number |
| 17:08 | AtKaaZ | ,(Long/parseLong "12a") |
| 17:08 | clojurebot | #<NumberFormatException java.lang.NumberFormatException: For input string: "12a"> |
| 17:08 | AtKaaZ | and the constructor Raynes showed |
| 17:09 | AtKaaZ | TimMc: in other words, I don't understand what you meant |
| 17:10 | TimMc | AtKaaZ: Well, Long is better than Integer, since it has a larger domain. |
| 17:11 | TimMc | Oh, my next comment, I see. |
| 17:11 | AtKaaZ | yep, got it |
| 17:11 | TimMc | Well, it's nice to not have to catch exceptions. |
| 17:12 | TimMc | It seemed as if clojure-newb wanted something that would report whether a string *could* be parsed as an integer, as opposed to actually parsing it. |
| 17:13 | clojure-newb | TimMc: yes |
| 17:13 | clojure-newb | and agreed about the exceptions |
| 17:13 | AtKaaZ | how else could you tell, without parsing it somehow |
| 17:13 | TimMc | And what sorts of number formats do you want to detect? |
| 17:14 | clojure-newb | TimMc: a sequence of digits, including padded with leading zero |
| 17:14 | TimMc | AtKaaZ: Well, re-matches #"[0-9]+" does a mighty fine job of telling you if something can be parsed as a certain type of number. |
| 17:14 | amalloy | i definitely recommend Long/parseLong over the Long constructor |
| 17:15 | TimMc | &(Long. "010") |
| 17:15 | lazybot | ⇒ 10 |
| 17:15 | AtKaaZ | timmc: by parsing you mean attemtpting to convert it to number then? cause it seems that re-matches does parsing also by my definition of parsing |
| 17:17 | AtKaaZ | my definition of parse seems wrong i guess, i equate it with scanning over it :) |
| 17:17 | TimMc | Depends on context. |
| 17:19 | TimMc | Anyway, there are two questions you can ask: "Does this represent a number?" and "This is a number, what is it?" |
| 17:21 | TimMc | The second has a precondition, and if that precondition is violated, it throws. |
| 17:21 | TimMc | (You could make one that returns nil, of course.) |
| 17:23 | AtKaaZ | but I'm guessing parseLong would be faster than the regex thingy? |
| 17:23 | TimMc | I don't see why. |
| 17:23 | AtKaaZ | i guess because regex is like more generic |
| 17:26 | amalloy | TimMc: you could also ask: if this is a number, what is it? |
| 17:26 | amalloy | if there were a function like String -> Maybe Number |
| 17:26 | TimMc | That would be my hypothetical nil-defaulting version. |
| 17:30 | AtKaaZ | ,((fn isnum? [num] (try (Long/parseLong num) true (catch java.lang.NumberFormatException _ false))) "12a") |
| 17:31 | AtKaaZ | did it die? |
| 17:31 | TimMc | From a comment in OpenJDK's Double parsing code: "we saw NO DIGITS AT ALL, not even a crummy 0! this is not allowed." |
| 17:32 | AtKaaZ | btw, do I need a (do ...) there after try ? |
| 17:32 | AtKaaZ | i can't tell from the doc |
| 17:32 | TimMc | nope |
| 17:32 | ToxicFrog | I think I just found a bug in lein droid |
| 17:32 | AtKaaZ | sweet |
| 17:33 | ToxicFrog | I have a project named emufun-rc which crashes instantly when run with ClassNotFoundException: ca.ancilla.emufun_rc.Application |
| 17:33 | ToxicFrog | Looking at the generated class files, everything is in ca/ancilla/emufun_rc/, except Application.class and MainActivity.class, which ended up in ca/ancilla/emufun-rc/ |
| 17:40 | ravster | hello all |
| 17:42 | TimMc | I think I'm missing something about labelled breaks and try-catch blocks in Java. |
| 17:46 | TimMc | Never mind, confusing indentation. |
| 17:49 | ppppaul | hey guys. i need help in figuring out how to preserve reader macros when doing pretty printing |
| 17:49 | ppppaul | https://gist.github.com/boxxxie/4973902 |
| 17:51 | ToxicFrog | Oh, user error - apparently - isn't a legal character in package names |
| 17:52 | TimMc | Oh yeah, I should have noticed that. |
| 17:53 | ToxicFrog | Now I've fixed that and the Dalvik verifier is "arbitrarily rejecting large method" clojure/core__init.load |
| 17:53 | ToxicFrog | Which is kind of important |
| 17:55 | TimMc | Ouch. |
| 17:56 | ToxicFrog | Aha |
| 17:56 | ToxicFrog | Ok, so, versions of clojure 1.3+ contain methods too large for android-8, which is what I'm targeting |
| 17:57 | ToxicFrog | The README for neko mentions this and says that the answer is to use clojure 1.2 on old android versions |
| 17:57 | ToxicFrog | But there don't appear to be any versions of android/clojure earlier than 1.4 |
| 17:58 | TimMc | Totally not surprised that clojure.core upsets Dalvik. |
| 17:59 | AtKaaZ | 6924 lines |
| 18:00 | AtKaaZ | &`'`'`'`'`'() |
| 18:00 | AtKaaZ | Invalid method Code length 68774 in class file |
| 18:01 | ToxicFrog | TimMc: apparently later versions of android are more permissive and 1.4 works fine on Honeycomb (api 11) and ICS (api 14) |
| 18:01 | ToxicFrog | The problem is, targeting that means it'll no longer work on my wife's phone. |
| 18:01 | nightfly | ToxicFrog: Get her a new phone :) |
| 18:04 | ppppaul | hey guys, help me print things so i can be pretty |
| 18:09 | pgmcgee` | i'm trying to write a lazy sequence of vectors to a file per vector, but i keep getting "IOException Stream closed java.io.BufferedReader.ensureOpen (BufferedReader.java:97)" |
| 18:09 | callenbot | TimMc: does that say more about Dalvik or c.c? |
| 18:09 | pgmcgee` | here's the code: https://gist.github.com/pgmcgee/9a35b0be39ba1e45d36b#file-core-clj |
| 18:10 | callenbot | pgmcgee`: have you considered using sqlite instead of writing to raw files? |
| 18:10 | ToxicFrog | callenbot: well, the limit is - as the message says - arbitrary |
| 18:10 | pgmcgee` | im guessing im missing something... i think the different threads that map creates are all trying to use the same writer, but im not sure how to prevent that |
| 18:10 | AtKaaZ | pgmcgee: is map returning a lazy seq within the with-open ? |
| 18:10 | ToxicFrog | Basically, (register count) * (instruction count) needs to be less than 2^21 |
| 18:10 | callenbot | lol, k |
| 18:10 | pgmcgee` | callenbot: certainly considered it, id love to get this working, though |
| 18:11 | callenbot | pgmcgee`: fair, I'm just saying, I've done some work in embedded/mobile data and if you have the resources available you should avoid raw files. |
| 18:11 | amalloy | pgmcgee`: read-population is the problem. map is lazy, and with-open has dynamic scope |
| 18:11 | pgmcgee` | AtKaaZ: no, the with-open is inside the map... |
| 18:11 | AtKaaZ | pgmcgee: https://gist.github.com/pgmcgee/9a35b0be39ba1e45d36b#file-core-clj-L32 |
| 18:12 | pgmcgee` | AtKaaZ: ah, good call |
| 18:17 | gfredericks | AtKaaZ: also ##``````````foo |
| 18:18 | gfredericks | dangit lazybot |
| 18:18 | gfredericks | ,```````````foo |
| 18:18 | AtKaaZ | that gives stack overflow |
| 18:18 | gfredericks | yes |
| 18:18 | AtKaaZ | 3 less and it gives 335835 |
| 18:19 | gfredericks | yeah it's exponential |
| 18:19 | AtKaaZ | but if you replace one with a ' gives like 610047 ``````'`foo |
| 18:19 | gfredericks | hm |
| 18:20 | AtKaaZ | ##``````'`foo |
| 18:20 | AtKaaZ | the bots are dead right? |
| 18:20 | gfredericks | it must be a bot holiday |
| 18:20 | AtKaaZ | rofl |
| 18:20 | gfredericks | what do bots celebrate on Feb 17? |
| 18:20 | gfredericks | or 3rd sunday in february? |
| 18:21 | AtKaaZ | 884259 ``````'''foo |
| 18:21 | AtKaaZ | fix-a-bug day |
| 18:25 | AtKaaZ | lol 3112673 '`''`''`''```'''''a |
| 18:26 | callenbot | ,````````````````````````foo |
| 18:27 | AtKaaZ | ''`'''`''''`''''`'`'`'''''a looks like this is like the max i could get on my: 3250516 |
| 18:27 | AtKaaZ | &''`'''`''''`''''`'`'`'''''a |
| 18:28 | gfredericks | I bet there is some number theory behind this |
| 18:28 | gfredericks | what're those numbers? (comp count flatten)? |
| 18:29 | AtKaaZ | i dno but you can fine tune it by inserting ' betwen `-es |
| 18:29 | gfredericks | you don't know where you're getting the numbers from? |
| 18:29 | AtKaaZ | the code generated? |
| 18:30 | gfredericks | it's a giant s-expression, not a number |
| 18:31 | TimMc | &(map (comp count flatten) [''() '`() `'() ``()]) |
| 18:31 | lazybot | ⇒ (1 1 1 1) |
| 18:31 | AtKaaZ | ah you were asking |
| 18:31 | TimMc | &(map (comp count flatten) [`''() `'`() ``'() ```()]) |
| 18:31 | lazybot | ⇒ (2 2 7 5) |
| 18:31 | AtKaaZ | CompilerException java.lang.ClassFormatError: Invalid method Code length 3250410 in class file proof/of/concept/caveats/macros$eval1521, compiling:(NO_SOURCE_PATH:1:1) |
| 18:32 | gfredericks | &(map (comp count flatten) [`a ``a ```a ````a `````a ``````a ```````a]) |
| 18:32 | TimMc | $ping |
| 18:32 | lazybot | TimMc: Ping completed in 0 seconds. |
| 18:32 | gfredericks | AtKaaZ: ooh I see |
| 18:33 | gfredericks | &((apply comp (repeat 5000 inc)) 42) |
| 18:33 | lazybot | ⇒ 5042 |
| 18:33 | gfredericks | &(map (comp count flatten) [`a ``a ```a ````a `````a ``````a]) |
| 18:33 | lazybot | java.lang.ClassFormatError: Invalid method Code length 75500 in class file sandbox20321$eval24059 |
| 18:33 | pgmcgee` | thanks for all your help, guys! i appreciate it grealy! |
| 18:33 | AtKaaZ | i think over 64k won't let you |
| 18:33 | gfredericks | &(map (comp count flatten) [`a ``a ```a ````a `````a]) |
| 18:33 | lazybot | ⇒ (0 2 8 41 221) |
| 18:33 | gfredericks | finally |
| 18:33 | AtKaaZ | ie. '`'`'`'`'''a Invalid method Code length 68974 in class file |
| 18:35 | AtKaaZ | &(map (comp count flatten) '`''''`'''`'''''`''a) |
| 18:35 | lazybot | ⇒ (0 3205) |
| 18:36 | AtKaaZ | it's capped at 64k the method Code length |
| 18:37 | AtKaaZ | &(println ''`'''`''''`''''`'`'`'''''a) |
| 18:38 | ravster | can I do (ring.util.response/response {:status 201 :body "foo"}), or do I have to do (status (ring.util.response/response "foo") 201)? |
| 18:39 | amalloy | ravster: try it and see |
| 18:39 | weavejester | ravster: (-> (response "foo") (status 201)) |
| 18:39 | weavejester | ravster: Or {:status 201 :headers {} :body "foo"} |
| 18:40 | ravster | weavejester: oh cool. just the map directly. Nice. |
| 18:40 | gfredericks | that why ring cool |
| 18:40 | ravster | sweeeeett. thanks weavejester |
| 18:45 | bbloom | lol, dnolen and i are optimizing... http://jsperf.com/push-array-map-entry fucking javascript.... |
| 18:46 | ppppaul | can someone help me figure out how to pretty print without evaluating reader macros (specifically datomic reader macros)? |
| 18:46 | ppppaul | https://gist.github.com/boxxxie/4973902 |
| 18:47 | gfredericks | mapcat identity is apply concat btw |
| 18:47 | Sgeo_ | ,[+ 1 2] |
| 18:47 | Sgeo_ | :( |
| 18:47 | gfredericks | ppppaul: you want to prevent "evaluating" reader macros? do you mean you don't want the data literal tags to be printed? |
| 18:47 | Sgeo_ | &[+ 1 2] |
| 18:47 | lazybot | ⇒ [#<core$_PLUS_ clojure.core$_PLUS_@1284047> 1 2] |
| 18:48 | ppppaul | my gist sorta explains what i want gfredericks |
| 18:48 | gfredericks | I saw it |
| 18:48 | gfredericks | but not the description :) |
| 18:48 | ppppaul | i want to print out #db/id |
| 18:49 | ppppaul | prn gives me what i want, but i want to pprint for the output |
| 18:49 | gfredericks | I'm not familiar with what pprint uses underneath |
| 18:49 | gfredericks | it might be a lot of special cases |
| 18:50 | ppppaul | it seems to have a lot of reader macro code in it |
| 18:51 | ppppaul | well, in my case, i want to have some control over newlines... so i guess i can do my own hacky pprint |
| 18:52 | ppppaul | pprint code is a bit complicated |
| 18:52 | schaefer | hi. i'm thinking of developing a forms based app using core.logic. the forms are pretty complex (think tax form complexity). normally, i'd think of using cells or dataflow for an app like this but i like the crazy idea that core.logic could 'reverse' the form calculations to obtain inputs from specified outputs. does anyone know of similar uses for core.logic? is this a bad idea for... |
| 18:52 | schaefer | ...some reason? |
| 18:53 | gfredericks | schaefer: might be hard to give specific feedback when the forms are filled out inconsistently? |
| 18:54 | schaefer | not sure... at this point, it's really just an idea i've been toying with. what do you mean, inconsistently? |
| 18:55 | gfredericks | __1__ + __2__ = __7__ |
| 18:56 | schaefer | ah. yes, the forms are used for a lot of "what-if" sorts of analyses |
| 18:56 | gfredericks | in the above case core.logic would simply fail and tell you nothing about what's wrong |
| 18:59 | schaefer | good point. i'm thinking that the UI could designate certain fields as "output-mostly" where an input to those cells would trigger a backwards calculation... not sure how well that would work |
| 18:59 | gfredericks | core.logic has no concept of backwards and forewards |
| 19:03 | schaefer | but it does have a concept of the cells for which the UI would need a calculation... what if the core.logic program described all the relations and computed a new core.logic program that asked for answers for the particular "output" ? |
| 19:10 | amalloy | gfredericks: fork? |
| 19:11 | gfredericks | I don't know if that's what it's normally called |
| 19:11 | gfredericks | (defn fork [f g h] (comp (partial apply f) (juxt g h))) |
| 19:11 | gfredericks | maybe different args order dunno |
| 19:12 | gfredericks | I was about to want it for (fork hash-map key-fn val-fn) |
| 19:12 | amalloy | gfredericks: i think it's close to knit |
| 19:13 | gfredericks | knit seems to want different inputs |
| 19:13 | gfredericks | just one input in this case |
| 19:13 | amalloy | ((knit f g) [a b]) => [(f a) (g b)] |
| 19:14 | gfredericks | (defn fork [f g h] (fn [x] (f (g x) (h x)))) ;; simpler version |
| 19:14 | callenbot | Korma is starting to worry me. Is there a SQL library somebody would recommend as an alternate? |
| 19:14 | gfredericks | come on guys let's build our sql interface thing |
| 19:14 | gfredericks | can we call it rung? |
| 19:14 | amalloy | gfredericks: call it Wrong |
| 19:15 | gfredericks | the readme will explain that the name is in recognition of SQL being yesterday's news |
| 19:15 | gfredericks | "Wrong: for when you can't use mongo for whatever reason." |
| 19:15 | amalloy | "why are you even on this page? clojure is cool, use a cool data layer" |
| 19:16 | callenbot | Seriously - what's the alternative to Korma? |
| 19:16 | gfredericks | c.c.jdbc |
| 19:16 | TimMc | TCP |
| 19:16 | gfredericks | I enjoyed clojureQL but nobody else did |
| 19:26 | gfredericks | alternatives to korma: clutch, congomongo |
| 19:27 | gfredericks | datomic |
| 19:27 | gfredericks | fs |
| 19:27 | gfredericks | clojure.core/atom |
| 19:30 | callenbot | gfredericks: :| |
| 19:32 | warz | couchdb ftw |
| 19:35 | TimMc | I need to get straightened out with c.c.jdbc and transactions. |
| 19:35 | TimMc | It looks like some commands open transactions, but I don't get to decide what kind of transaction it is? |
| 19:35 | TimMc | (isolation level, etc.) |
| 19:38 | pocho | I'm having difficulty solving problems the clojure way. |
| 19:38 | pocho | I want a function that does this: (defn nest_f [f x, coll] (f (f (f x (get coll 0)) (get coll 1)) (get coll 2))) |
| 19:38 | pocho | but works for collections with size not equal to 3. |
| 19:38 | pocho | Is there something like that in clojure.core? If not how would I write it? |
| 19:38 | gfredericks | is that reduce? |
| 19:39 | gfredericks | the parens look funny |
| 19:39 | pocho | each f is called on what the other one returned |
| 19:39 | gfredericks | at this point I'd bet at least $5 that's reduce |
| 19:40 | gfredericks | same argument order and everything |
| 19:40 | pocho | ok |
| 19:40 | pocho | thanks |
| 19:41 | pocho | yeah you were right |
| 19:42 | callenbot | gfredericks: you verbed your noun. |
| 19:42 | callenbot | gfredericks: so you got it backwards. |
| 19:43 | gfredericks | noun: (verb) to use a noun as a verb |
| 19:43 | gfredericks | wait |
| 19:43 | gfredericks | I have no idea what I meant anymore |
| 19:43 | brehaut | dude, thats gerund |
| 19:43 | gfredericks | that's madding |
| 19:43 | callenbot | brehaut: particularly participled. |
| 19:45 | brehaut | wait, its not a gerund, thats the other way round |
| 19:59 | warz | im looking at how to get to keys in nested maps. im looking at the some of ways mentioned in this blog post: http://www.learningclojure.com/2009/09/nested-def-me-name-firstname-john.html |
| 19:59 | warz | is there one that i should prefer? |
| 20:06 | tmciver | warz: I prefer get-in when nested or just (:key my-map) when not. |
| 20:27 | warz | hm ok |
| 21:00 | dnolen | optimizing ClojureScript is always an interesting exercise |
| 21:05 | hiredman | ~ping |
| 21:05 | clojurebot | PONG! |
| 21:05 | hiredman | ,*clojure-version* |
| 21:05 | clojurebot | {:major 1, :minor 5, :incremental 0, :qualifier "RC6"} |
| 21:06 | TimMc | sweet |
| 21:06 | TimMc | ,(read-edn "(+ 1 2)") |
| 21:06 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-edn in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 21:06 | TimMc | Oh, too old. |
| 21:07 | gfredericks | clojurebot: upgrade |
| 21:07 | clojurebot | Excuse me? |
| 21:08 | gfredericks | clojurebot: upgrade is <reply> successfully upgraded to clojure 1.7.0 |
| 21:08 | clojurebot | Roger. |
| 21:08 | dnolen | PersistentArrayMap in CLJS are starting to trounce ObjMap under V8 |
| 21:09 | dnolen | good sign for real keywords & symbols |
| 21:09 | gfredericks | ObjMap is the naive impl? |
| 21:09 | dnolen | gfredericks: ObjMap was written under the assumption that dealing w/ JS objects would be faster for access |
| 21:10 | dnolen | PAMs looks just as good as OMs for lookup now on V8 |
| 21:10 | dnolen | and 10X faster for assoc w/ 1,2,3 unseen keys (small maps) |
| 21:11 | gfredericks | that is wild. I'm jealous. |
| 21:11 | dnolen | https://github.com/clojure/clojurescript/commit/6a26f157d7b678415aa1f610e570adb7af9bdfb7 |
| 21:12 | dnolen | took forever to find the right set of changes that v8 likes |
| 21:12 | dnolen | and these chanes look good in JavaScriptCore too |
| 21:16 | bbloom | dnolen: did the equiv-pred ultimately help? |
| 21:16 | hiredman | I replaced clojurebot's in process evaluator with a little web service, so now I can upgrade it and tinker with it without having to take clojurebot offline, same for the factoids stuff |
| 21:18 | gfredericks | clojurebot is so big that the monolithic app has been replaced with SOA |
| 21:18 | hiredman | pretty much |
| 21:19 | hiredman | I really need to rip the irc bit out as a service, so then the bot will never leave the channel |
| 21:19 | gfredericks | it's the only way to satiate the hoi polloi |
| 21:20 | gfredericks | six nines or something |
| 21:20 | hiredman | then run multiple instances of the evaluator behind an lb |
| 21:20 | hiredman | put them in an autoscale group |
| 21:22 | gfredericks | the product people want this done by next week I assume |
| 21:36 | Frozenlock | do tell |
| 21:36 | gfredericks | generating readable code to be eval'd later |
| 21:37 | gfredericks | it's probably terrible |
| 21:39 | gfredericks | $google github misquote |
| 21:39 | lazybot | [fredericksgary/misquote · GitHub] https://github.com/fredericksgary/misquote |
| 21:40 | bbloom | gfredericks: i had no idea that existed |
| 21:40 | bbloom | compare https://github.com/fredericksgary/misquote/blob/master/src/misquote/core.clj and https://github.com/brandonbloom/backtick/blob/master/src/backtick.clj |
| 21:41 | Raynes | Fancy gfredericks. |
| 21:41 | Raynes | This is why we market our libraries, guys. |
| 21:41 | gfredericks | I did it because hiredman told me it was impossible |
| 21:41 | Raynes | Speaking of which, have you given your heart to Laser lately? hurrhurr |
| 21:41 | gfredericks | which I assume means I didn't properly communicate what I was talking about |
| 21:43 | cemerick | gfredericks: hah, I wrote just this a few weeks ago |
| 21:43 | gfredericks | I'm bad at marketing :( |
| 21:43 | cemerick | gfredericks: hopefully you don't mind me using yours so I can have you fix bugs as they come up ;-P |
| 21:43 | gfredericks | please do |
| 21:43 | bbloom | lol ok if three of us all wrote the same thing maybe it belongs in core lol |
| 21:44 | gfredericks | that is the standard criteria |
| 21:44 | bbloom | let me do some marketing then: backquote also provides a macro for defining macros that have a pluggable symbol resolver! also, it won't choke on records |
| 21:45 | bbloom | it's an almost 1:1 port of the java code from clojure itself |
| 21:45 | cemerick | I'll let you two fight it out and see who's standing in the morning. |
| 21:45 | gfredericks | ah ha, so `template` is like misquote |
| 21:45 | gfredericks | but the mechanism is more general |
| 21:45 | bbloom | yup :-) |
| 21:46 | gfredericks | presumably it comes with gensym built in as well but that doesn't get in your way if you don't want it |
| 21:46 | gfredericks | well I hereby declare yours better than mine |
| 21:46 | bbloom | heh, i'd have helped you if i knew :-) |
| 21:46 | bbloom | cemerick: fights over, no need to wait for the morning :-P |
| 21:46 | gfredericks | that wouldn't be good because your project name is better |
| 21:47 | bbloom | lol! haha thanks |
| 21:47 | gfredericks | it took a lot of effort for me not to use ##(format "lib-%04d" (rand-int 10000)) |
| 21:47 | lazybot | ⇒ "lib-4124" |
| 21:54 | werbitt | Hi, quick question, when I write a wrapper function for a function with optional args I end up having to conditionally dispatch based on whether the optional args were provided to the wrapper. Here's an example: https://www.refheap.com/paste/11400 . I feel like there must be a better way to do this, any ideas? |
| 21:57 | bbloom | werbitt: you can create functions with multiple arities |
| 21:57 | bbloom | (fn ([x] 1) ([x y] 2)) |
| 21:57 | bbloom | ,((fn ([x] 1) ([x y] 2)) :a) |
| 21:57 | clojurebot | 1 |
| 21:57 | bbloom | ,((fn ([x] 1) ([x y] 2)) :a :b) |
| 21:57 | clojurebot | 2 |
| 21:57 | bbloom | same syntax works for defn |
| 21:58 | werbitt | hi bbloom, thanks, but I feel like that still has a lot of duplication |
| 21:58 | werbitt | for a wrapper |
| 21:59 | bbloom | werbitt: duplication? repeating argument names is not the bad kind of duplication |
| 21:59 | bbloom | the repeated information is physically colocated and semanatically irrelevant |
| 21:59 | bbloom | zero-duplication is a silly goal |
| 22:00 | werbitt | its just very verbose, i guess there isn't another way to do it. |
| 22:00 | Frozenlock | nightfly: link? |
| 22:03 | werbitt | also, if the wrapped function is in a let, i think i'm stuck with the conditional |
| 22:03 | bbloom | werbitt: no, you're not, multiple arities work with fn forms |
| 22:03 | nightfly | Frozenlock: http://www.gigamonkeys.com/book/functions.html |
| 22:03 | bbloom | defn expands to fn |
| 22:05 | bbloom | the problem with optional arguments as done in common lisp is that it doesn't allow for elision from the middle |
| 22:06 | bbloom | for example if you want (fn ([x z] ...) ([x y z] ...))) |
| 22:06 | bbloom | if you want to support every possible way you can do that, it's actually impossible to do without a grammar. consider: |
| 22:06 | bbloom | (fn ([y] ...) ([x z] ...)) |
| 22:07 | bbloom | the way clojure does it is 1) easy to understand 2) unambiguous and 3) matches the underlying dispatch-by-arity semantics |
| 22:07 | bbloom | if you need something more complex than that, use [& args] and parse that however you choose |
| 22:08 | bbloom | and if you're OK with the optional arg just being nil, you can do (fn [x & optional] ...) but you don't get arity checking |
| 22:09 | bbloom | or rather i mean (fn [x & [optional]] ...) |
| 22:09 | bbloom | which means 4) consistency with destructuring throughout clojure, not just in function signatures |
| 22:09 | bbloom | much nicer than common lisp's design, IMO |
| 22:10 | TimMc | Hmm, I wonder what havoc we could wreak if Clojure exposed the returnAddress JVM primitive. |
| 22:24 | callenbot | Korma doesn't support PGSQL arrays does it? |
| 22:27 | brehaut | callenbot: java.jdbc has kinda quirky support for them at best current. i understand that improving support for them is coming in a future version |
| 22:28 | clifton | anyone know what '\1' would mean in the context of an anonymous function, e.g. #({\1 %2} % 0) |
| 22:29 | clifton | oh i guess that is just the character 1 |
| 22:29 | brehaut | yes |
| 22:29 | hiredman | TimMc: pretty sure that is not exposed out side of the jvm |
| 22:30 | hiredman | and the jsr (subroutine inside a method stuff) has been deprecated since java 5 |
| 22:30 | callenbot | brehaut: looks like I'm doing more JOINs. Thanks for the warning. |
| 22:31 | TimMc | hiredman: This article I'm reading was discussing it as a primitive that bytecode had access to. |
| 22:31 | hiredman | http://cliffhacks.blogspot.com/2008/02/java-6-tryfinally-compilation-without.html |
| 22:31 | TimMc | Oh heh, the article is about Java 2. |
| 22:32 | brehaut | callenbot: i've been using java.jdbc directly recently. basically i've had to preprocess all my psql array's to ensure the content is actually requested, otherwise you get a handle to a dead 'query' back |
| 22:32 | TimMc | Welp, that answers that. |
| 22:32 | brehaut | callenbot: you might be able to hook into korma's db->clj transform to do that automatically |
| 22:33 | callenbot | brehaut: As much as I want to find an excuse to abuse robert.hooke, I'm trying to avoid unnecessary complexity in this project. |
| 22:33 | hiredman | one of the example bytecode rewriters thatcomes with asm rewrites code that uses jsr to not use them |
| 22:34 | callenbot | brehaut: it's already turning into a database schema that makes me uneasy and makes me think a doc-store would be better if suited if I didn't need a real DB. |
| 22:34 | TimMc | "tail duplication" |
| 22:34 | TimMc | So you're saying I *shouldn't* put 5000 lines in a finally block? |
| 22:34 | brehaut | callenbot: i just ported my site from couch to psql; i spent most of my time going ott with table constraints and views. totally worth it |
| 22:35 | callenbot | brehaut: I need to avoid things that will over-burden inserts. |
| 22:35 | callenbot | brehaut: I'm not using any constraints, FKs, references, etc. |
| 22:36 | brehaut | yikes |
| 22:36 | callenbot | brehaut: it's a simple schema, it doesn't need them mate. |
| 22:36 | callenbot | I'm just using indexes on $(rel-name)_id to JOIN |
| 22:37 | callenbot | brehaut: YANGI |
| 22:37 | callenbot | hrm. YAGNI* |
| 22:39 | Frozenlock | What does the dash mean in a deftype? https://gist.github.com/swannodette/1674971 "-invoke" |
| 22:39 | Frozenlock | (instead of "invoke") |
| 22:45 | brainproxy | thoughts on this code: https://gist.github.com/mchampine/868342 |
| 22:45 | callenbot | brainproxy: don't be an asshole. use bcrypt. |
| 22:45 | callenbot | or scrypt. or pbkdf2. |
| 22:46 | brehaut | to short; want more details? http://codahale.com/how-to-safely-store-a-password/ |
| 22:46 | callenbot | too* |
| 22:46 | brainproxy | callenbot: well.. definitely not trying to be an asshoole :p |
| 22:46 | callenbot | brainproxy: you don't understand cryptography and your fumbling in the unknown and dangerous is like that of two clumsy teenagers in the back of mom's station wagon. |
| 22:46 | brainproxy | callenbot: ummm, hello, that's why I asked |
| 22:47 | brehaut | brainproxy: first rule of crypto: dont write crypto |
| 22:47 | clojurebot | rule one is if your answer to "how should I represent X" is "something that doesn't implement clojure.lang.IFn" then you are probably wrong. |
| 22:47 | brainproxy | also, I understand the basic premise of salts and so on, and googling around for clojure, salt, password turned up that gist |
| 22:47 | callenbot | brainproxy: you have no idea what you're doing |
| 22:47 | callenbot | brainproxy: read the codahale blog post. |
| 22:48 | callenbot | brainproxy: use bcrypt, scrypt, or pbkdf2. |
| 22:50 | brehaut | brainproxy: for clojure imps of stuff, have a look at what is happening around friend (https://github.com/cemerick/friend/) and ask on clojure-sec (https://groups.google.com/forum/?fromgroups#!forum/clojure-sec) |
| 22:50 | brainproxy | alright well i appreciate the tip on the blog post, good info |
| 22:50 | brehaut | top post of which is weavejester releasing the first cut of a password lib (using bcrype, scrypt and pbkdf2) |
| 22:51 | brehaut | https://github.com/weavejester/crypto-password/ |
| 22:51 | brainproxy | yep, looking at that now |
| 22:51 | callenbot | I just use the bcrypt fn in lib-noir. |
| 22:54 | brainproxy | callenbot: blog post was good, got your point |
| 22:58 | brainproxy | i have a small site (small in scope and number of visitors) I'll be building w/ clojure, compojure/liberator, hiccup, et al |
| 22:59 | brainproxy | looking for some direction on how to make it production ready in the context of running it on my own vps |
| 22:59 | brainproxy | is tuning the settings in project.clj, jetty adapter, and then putting varnish in front of it a decent plan? |
| 23:01 | brehaut | brainproxy: jetty is a great little server, and nginx or varnish is great front end to it |
| 23:01 | brainproxy | persistence will be handled using the free edition of datomic, yay |
| 23:01 | brainproxy | brehaut: what I'm wishing for is a TODO list related to moving from dev to production |
| 23:02 | brainproxy | with respect to jetty, leiningen, etc. |
| 23:02 | brehaut | brainproxy: i've only deployed really lightwight stuff with clojure web; blogs, irc bots |
| 23:03 | brehaut | brainproxy: just i just uberjar from git repo on the server, and run from that |
| 23:03 | brehaut | brainproxy: the only difference between my production and dev enviroments is a settings.edn file (with DB settings), and nginx acting as the gateway on teh production |
| 23:04 | brehaut | you really dont need to do much more for a small site |
| 23:05 | brainproxy | i've never actually worked with uberjar, guess I should read up on that |
| 23:05 | brainproxy | well maybe it was touched on in the O'Reilly book |
| 23:13 | brehaut | brainproxy: a lot of people just use lein ring; my code bases predate its existance and i never felt like changing |
| 23:14 | brainproxy | brehaut: ah, yeah I'm a lein-ring user and fan :) |
| 23:14 | brehaut | just roll with that then :) |
| 23:14 | bbloom | Frozenlock: sorry i missed your question. the - is just a convention... a little confusing though |
| 23:15 | bbloom | Frozenlock: in short, (.-foo x) means to access a property, but that's the only special case handling of - |
| 23:15 | bbloom | in -invoke et al, it's more similar to defn- |
| 23:15 | bbloom | it's to symbolize private |
| 23:16 | bbloom | the convention is to do (IFooable (-foo [x])) and then (defn foo [x] (... (-foo ...))) |
| 23:16 | bbloom | so you always have a non dash prefixed free function |
| 23:16 | bbloom | make sense? |
| 23:19 | dnolen | bbloom: thanks for the review on GitHub |
| 23:19 | Frozenlock | bbloom: I will probably make sense once I wrap my head around interfaces and types. I do understand the (.-some-stuff, I've used it quite often in cljs, but never only (-some-other-stuff |
| 23:20 | Frozenlock | *it |
| 23:24 | Frozenlock | Toying again with my early afternoon project... is there a way to have some kind of inheritance with deftype? For example, (deftype my-seq clojure.lang.ISeq (everthing-method-from-vectors)) |
| 23:25 | Frozenlock | Wow the keyboard skills tonight! |
| 23:25 | alex_baranosky | if you have a join on two tables using clojure.java.jdbc, and you want to return a column whose name appears in both tables as part of your result set, is there some way for clojure.java.jdbc to handle this? |
| 23:26 | alex_baranosky | currently what I'm seeing is that the first column name's value gets lost, and only the second one is kept |
| 23:27 | clj_newb_2345 | "Suppose I'm determined to shoot myself in the feet, what is the best way to do so?" I really want something like OCaml/Haskell/Scala's types in Clojure. I want to be able to look at a Var and know what type it is. From this, I want to know what fields it has. I also want to be able to pattern match based on Constructors. Question: what is the best way to approximate this in clojure? |
| 23:28 | clj_newb_2345 | No, I don't want to code vs protocols; I want to code vs Types. |
| 23:28 | amalloy | clj_newb_2345: write a scala interpreter in clojure |
| 23:28 | alex_baranosky | clj_newb_2345: don't use Clojure |
| 23:28 | alex_baranosky | amalloy: good idea |
| 23:28 | clj_newb_2345 | I like Clojure's macros and sexp. |
| 23:28 | clj_newb_2345 | There's typed-racket. Why has it never taken off in the clojure world? |
| 23:29 | alex_baranosky | clj_newb_2345: look at Shen maybe |
| 23:29 | amalloy | use another lisp then, if you want macros and twenty things that clojure hates |
| 23:30 | clj_newb_2345 | alex_baranosky: Shengn does claim to have everything I want. |
| 23:31 | brehaut | clj_newb_2345: re:static clojure, because it's a lot of work and ambrose is only one person |
| 23:31 | amalloy | even multiplied by the power of lisp he's only like eight people |
| 23:31 | clj_newb_2345 | brehaut: so your view is "It's hard" not "it's impossible" ? |
| 23:32 | brehaut | clj_newb_2345: seems like it |
| 23:33 | brehaut | clj_newb_2345: there are of course questions about the practical usefulness of opt in type checkers integrating with unannotated coded, and the value if the annotations needed to handle the semantics established in clojure end up being monsters |
| 23:34 | clj_newb_2345 | brehaut: yeah, I am getting the imprssion that typing is great if you're building a langauge on top of not; but not so nice as a library when many of the language's builtins don't have annotations |
| 23:34 | brehaut | meh. typing is always a trade off |
| 23:34 | alex_baranosky | any clojure.java.jdbc experts around? |
| 23:35 | brehaut | in the case of core.typed (i think thats its name) the plan is for the majority of clojure.core to be annotated |
| 23:35 | alex_baranosky | wondering if there is a way to alias or namespace keys in result sets so that columns from two tables with the same name don't squash each other in the result set |
| 23:37 | brainproxy | clj_newb_2345: or maybe write some kind of bridge so you can develop in Clojure and Frege side by side |
| 23:37 | clj_newb_2345 | brainproxy: I've decided to learn Shen. |
| 23:38 | brainproxy | clj_newb_2345: cool :) |
| 23:40 | dnolen | clj_newb_2345: you do know that core.typed borrows heavily from Typed Racket right? |
| 23:40 | clj_newb_2345 | dnolen: no, I thought it started as someone's type-checking master's thesis project, then became part of core.typed |
| 23:40 | clj_newb_2345 | dnolen: hey, btw, thanks for help with clojurescript bugs months back |
| 23:41 | dnolen | clj_newb_2345: nope. Directly built on the Typed Racket research and pushing it in new directions. |
| 23:41 | clj_newb_2345 | dnolen: there was some project you wanted to pull off earlier (was it for foo camp or some langauge conference?) for clojure -- did it endup working? [I think it had something to do with clojurescript, generated javascript code, and chrome debugger being able to see the lines of clojurescript code] |
| 23:42 | dnolen | clj_newb_2345: source maps, we're still working on it |
| 23:42 | clj_newb_2345 | dnolen: ah |
| 23:42 | clj_newb_2345 | dnolen: Shen looks too cool, I have to understand it. The book (which I dont have acces sto yet) even has a short proof assistant tutorial. |
| 23:42 | clj_newb_2345 | The guy's clearly a genius. |
| 23:43 | dnolen | clj_newb_2345: it's pretty cool, tho there are plenty of things for a Clojurist to not like. |
| 23:43 | clj_newb_2345 | dnolen: how did you learn shen? |
| 23:44 | dnolen | clj_newb_2345: I don't know shen, only played around with it, enough to know it doesn't have enough for me to want to use it. |
| 23:44 | clj_newb_2345 | dnolen: what did it miss for you? |
| 23:45 | dnolen | clj_newb_2345: protocols, concurrency primitives, predictable performance for a specific subset of the language, persistent data structures, etc, et |
| 23:45 | dnolen | c |
| 23:47 | mye | where are the docs on how to translate maven central package info into leiningen dep. info? |
| 23:47 | mye | The tutorial just says "we'll skip this" :-( |
| 23:54 | mye | Oh I see, it's package specific. Got it working :-) |
| 23:56 | squiggly | How do I "live edit" code using Clojure + Leiningen? Apologies if this is a newbie question, but I can't find a simple how-to guide in Google. (I am using Quil as well, if that helps.) |
| 23:59 | smnirven | squiggly: are you using emacs? |
| 23:59 | squiggly | smnirven: Yes |