#clojure logs

2010-08-29

00:28cansadoi work primarily with web applications. would clojure be at all useful for me to learn?
00:30JamesGeckoI'm having trouble getting started with Clojure in Eclipse with counterclockwise. I keep getting EOF and "unable to resolve symbol" errors.
00:30technomancycansado: definitely; Clojure helped me transition from working with web applications to backend work. =)
00:31technomancycansado: just kidding. there are several good tools for doing web applications with Clojure, but there isn't the same richness of libraries as rails or django yet. depending on what you're doing that may or may not be an issue.
00:33cansadotechnomancy: i'm not really looking to do web development in clojure, i was just wondering if learning it would be helpful... like, maybe there's a distributed hoobajoob or something that's written with clojure in mind, i don't know :)
00:33cansadoi've been trying to understand the problem domain, but it seems (to my ignorant eyes) just to be another general purpose programming language
00:34technomancythe closest thing to a killer app for Clojure is Incanter, for stats
00:34technomancymy favourite web library for Clojure is enlive. fantastic tool, though I found it a bit tricky to get started.
00:35cansadoooo, incanter seems cool
00:40Scriptorcansado: another thing is that you could use it anywhere there's a jvm
00:41cansadoScriptor: right, but i was wondering what differentiated clojure from, say, scala or groovy
00:41cansadoapart from its syntax :)
00:41Scriptorwell, huge difference from scala, especially regarding the type system, as well as scala embraces oop more
00:42Scriptornot sure about the details of the differences from groovy
01:03ihodesi'm playing with Enlive right now. it's freaking awesome. i used it a while back, too; my impression of it has held. the problem is it's kinda been left alone since 1.1
01:04ihodesit also mangles thing like <time datetime="2010-8-29" pubdate> i'm finding
01:34wei_hello, i have a newbie question
01:34ihodesshoot
01:34wei_why doesn't this produce the output I expect?
01:34wei_(do
01:34wei_ (println "start")
01:34wei_ (map #(println (+ % 1)) '(1 2 3))
01:34wei_ (println "done"))
01:35wei_i expected start 1 2 3 done-- but the actual output is start done
01:35hiredman~map
01:35clojurebotmap is *LAZY*
01:36ihodesyou need to wrap map with a (doall
01:36ihodesto force the evaluation, because, as clojurebot helpfully pointed out, map is lazy
01:36wei_so, doall instead of do?
01:36ihodesand so won't compute (evaluate) anything unless it needs to. and it doesn't think it needs to, as you're doing nothing with what it returns (it'd return (nil nil nil) so you don't want to do anything with it
01:37ihodesnah, keep do
01:37ihodesdoall needs to go just around map
01:37wei_ahhh i see
01:37ihodese.g. (doall (map #(println (+ % 1)) '(1 2 3)))
01:37cansadois clojurebot written in clojure?
01:37wei_thank you! and.. how does clojurebot work?
01:38ihodescansado: yes, by hireman
01:38ihodesit's on github
01:38ihodeshiredman*
01:38ihodeshttp://github.com/hiredman/clojurebot
01:38Raynessexpbot is another bot written in Clojure. Just to toot my own horn.
01:38Raynes:>
01:39Raynes$whatis sexpbot
01:39sexpbotsexpbot = http://github.com/Raynes/sexpbot
01:39cansadovery cool. i'll check these bots out
01:40cansadothanks!
01:40wei_cool!
01:40ihodesfor sure :)
03:50LauJensenGood morning all
04:39lenwmorning all
04:39lenwquick moustache question - when defining routes, how do i express the route for "/" ?
04:52LauJensen[""]
04:52LauJensen@ lenw
05:02lenwthanks LauJensen - trying that
05:07LauJensenlenw: Actually Christophe put a lot of work into the README.md on the Github page, so if you want to work seriously with Moustache you should check that out :)
05:10lenwLauJensen: i have the capacity to easily confuse myself so thanks for always being helpful - trying the smallest working solution now
05:10lenwLauJensen: thanks that is working
05:11LauJensennp :)
05:51LauJensenIs there a clever way to get a unique machine ID from within Clojure?
05:55BjeringLauJensen, I installed ubuntu at home, and I learned that for my usage scenario epoll is simply worse than IOCP, both my epoll based C++ version and the "old NIO" jvm version performed much worse than the IOCP based versions on Windows 7 on the same hardware. An unexpected result.
05:55lenwLauJensen.getHardwareAddress() ?
05:55lenwoops lol
05:56lenwNetworkInterface.getHardwareAddress()
05:56LauJensenhehe
05:56LauJensenBjering: Thats surprising
05:56LauJensenlenw: Yea I think that might be good
05:56Bjeringyes, I agree. Makes me question the result, but I should beleive it, its easy enough. I'll chat on #boost about it with the IO gurus there, its their lib too that was better on windows than linux for me.
05:57raekLauJensen: what lenw said... http://en.wikipedia.org/wiki/UUID#Version_1_.28MAC_address.29
05:59raekit would probably be a good idea to run the MAC address though a hash function or something as privacy might be an issue
06:01LauJensenHard to get more unique than this
06:01LauJensen(->> (enumeration-seq (java.net.NetworkInterface/getNetworkInterfaces))
06:01LauJensen (map #(hash (.getHardwareAddress %)))
06:01LauJensen (apply str))
06:01LauJensenThanks for the tip lenw
06:01lenwnp
06:32Bjering_I am sorry to say, but these OS hangs with JDK7/aio on windows together with the x10 memory usage of the jvm version (its a naive impl, doing naive stupid things, but so is the C++ one, and worse visualvm dont tell me what is using the memory, I could optimize blindly) makes my technology choice single-threaded C++. A dead end I know, hopefully I can come back here in 3 years and rewrite version #2 of my engine. As it is I cannot defend not going with the
06:32Bjering_C++ version. Thanks to all helping me in my evaluation, this community is the worst part to leave. (well, that and the STM ;) )
06:33AWizzArdBjering_: thanks for your report
06:33AWizzArdSo, there is a valid reason then why most games are written in C++. You really tried hard to get this working on the jvm.
06:33fliebelBjering_: So… you're going to use java, or C++ for your game?
06:35fliebelBjering_: Ah, read it again, so C++
06:35LauJensenBjering_: One thing. When I said that allocation was important, you said that it was the same in C++, its not. Since Clojures data is immutable, everytime you work on a collection you're allocating a new one, so keeping allocation low 10x as important in Clojure. With that said though, Im sorry you didn't reach an acceptable performance level. I think its possible.
06:35fliebelBjering_: Good luck :)
06:35Bjering_C++, java performed no better than clojure (infact the AIO was only tested with java, never finished the Clojure version) Bottleneck was never Clojure (well atleast not after LauJensen helped me add some type-hints)
06:36LauJensenBjering_: If you're Europe, consider coming to the next Conj Labs in October :)
06:39Bjering_fliebel: Also I hate Java as a language (but I must admit I am impressed with the tools, visualvm was awesome and the codecompletion etc you get with Eclipse is hard to get for a non-reflective language like C++). My C++ style is always one of alot of immutable value-objects, java doesnt really promote that style. Clojure does ofc, in the most extreme (and good way).
06:42Bjering_I thnk I was on the right tack before in C++, I am convinced I am even more so, this short adventure into Clojure (mostly reading, and then som small tests like this one) definly made a better C++ programmer. And in the end reinforced some of my earlier thoughts on things that C++ does much better than Java. (such as easy of value-oriented programmer rather than dabbling with identities all the time)
06:42Bjering_right track
06:43hircusBjering_: I'd recommend exploring the Boost libraries -- there's a lot there to make your C++ programming more functional (including lambda!)
06:45Bjering_hircus, #boost is awesome, its core to all my things. One can get overboard with metaprogramming imho (I much prefere ANTLR to spirit for instance), but for the bsic stuff like expressing iterations they get it right. Even though imho boost::bind is enough 95% of the time, lambda is cool but not really essential.
06:47AWizzArdBjering_: can you summarize your issue to a core problem? Is it the way the JVM is implemented under windows which lets you simply not have more connections open at the same time?
06:48Bjering_AWizzard: Core problems are 2.
06:49Bjering_. To reach CPU peroformance I need AIO, AIO needs JDK7, to me it seems in itself a little bad as much of the goodness of java goes away then, for instance I couldnt profile on CPU udage with visualvm on JDK7, I suspect many tools/libs dont support it yet, and any troulbe I have could be dismissed as "well its not released". One such problem I have is that my Windows machine hangs hard sometimes when I run my tests very hard.
06:50Bjering_that was 1
06:50Bjering_2. Memorywise my Java-version takes x10 of my C++ version.
06:51AWizzArdCan you roughly say how much ram is involved?
06:52AWizzArdI don’t want to talk this away, but for example if the C++ version uses 8 MB and the JVM 100 MB, then this could still be acceptable (as your server could get over 65,000 MB RAM).
06:52Bjering_100 MB in C++, 850 MB for java (when started with -Xmx500M to promote gcing, 1700MB for java when started with -Xmx3000M)
06:52Bjering_AWizzArd, sure but I do expect my server to be RAM constrained.
06:53Bjering_AWizzard: Well i want to balance RAM/CPU/Bandwidth to get the most _game_ I can out of it
06:53AWizzArdYes sure.
06:54AWizzArdI just thought that our perception of what "a lot of ram" means changes constantly.
06:54Bjering_yes
06:54AWizzArdBjering_: have you tried a commercial profiler, such as YourKit?
06:56Bjering_AWizzArd, no I haven't. I guess there is s 3 in there too. My java experience is 2 years from year 2002 writing simple servlets for ecommerce, and 1 month this year making basic Android app. My C++ experience is 10 years, alot of it having todo with computer games. I just happens to know that infrastructure alot better.
06:57LauJensenBjering_: Part of your assessment should probably include an overview of other games written in Java, with similar demands
06:59AWizzArdBjering_: and which JVMs did you try? Suns/Oracles JDK 6 and 7, both on Windows, yes? Did you try the OpenJDK 7? Or IMBs JVM? And/Or did you try to run that code on Linux?
06:59AWizzArdYou could for example rent EC2 instances for some hours and test it on other OSes and different hardware. Both, C++ and Java.
06:59Bjering_LauJensen, its very hard to compare. Basically the kind of game I want to make isnt made. It has some parts from "real" MMOs such as the AAA titles, this is the syncrounous interaction etc. And some parts from the new "web/facebookMMO" that only have async interactions. The first is written by demigods who arent afaid of bending any tech to their will and have budgets way beyond what I can imagine. The latter is almost always writtien with PHP/myswl and me
06:59Bjering_mcache. But then you cant do whhat I want.
07:00LauJensenOk
07:00LauJensenAWizzArd: I don't think you should be pushing OpenJDK for such a project
07:01AWizzArdI am sure Bjering_ knows best what to do, and when he decided to go with C++ after his hard evaluation phase this is a rational descision. I am just curious how other JVMs would have performed, and how it would have run on Linux.
07:02LauJensenThats the one thing I feel thats left out, how the various versions would have performed on a new unix system. As I recall the tests were on an old machine
07:02AWizzArdBjering_: the nice thing is that with some on-demand instances you can try different hardware and OSes for just a few dollars :)
07:04Bjering_Linux run alot abetter with old NIO then windows, but still worse than IOCP on Windows, but so did my C++ on linux, its like my problem is almost designed to be a scenario where IOCP beats epoll. Now that is a larger question and I am not sure I am prepared to go into tat and evaluate, it means understanding things deeper than "using boost::asio" and thats an abstraction barrier I am happy to stay behind.
07:04LauJensenI understand :)
07:05LauJensenAnd I guess if you have the time, writing the heavy IO bits of this program in C++ is not exactly a bad choice. Though maybe you should consider C instead?
07:09Bjering_I think it will be C++, C++ with the help of a domain specific language for gamelogic, and then an ANTLR generator that makes my C++ domain objects for me. It was the approach I had in mind when I decided I needed to give clojure one more serious try before going down such a heavy route.
07:10LauJensenIm curious why you prefer C++ to C, can you elaborate a little?
07:14Bjering_LauJensen, it is a good question. Part of it is heritage of my misguided OO-euphoric youth ;) But even when i try to look beyond that I thnk I prefere C++, its abstractions dont get in the way if you dont let them. Today I would also say boost is a huge reason, that library is full of win. On C it would be a much more diverse set of third-party libraries involved and it would be messier.
07:14LauJensenIsnt there a boost lib for C as well?
07:15Bjering_Nope. Can also be a platform thing. If you write for Windows, you want a layer, Win32 api makes me cry. If I wrote for Linux perhaps I would be happy with the C-api.
07:16LauJensenOk, thanks
07:24Bjering_LauJensen: Just saw your comment re old machine, well, yesterday I went and bough a new harddrive (so to get dualboot without worrying about repartitioning/backuping/reinstalliing windows) and set up a dual boot. The results was not flattering for linux, as the C++ version was better on windows. Thus my thinking my problem much more like IOCP over epoll (atleast the epoll through boost::asio's abstraction)
07:25LauJensenYea I understand
07:31AWizzArdBjering_: so, will your server allow for 50k simultaneous connections and guarantee a fluid game play?
07:32Bjering_AWizzard: It will guarantee a fluid game play, if I have to cut down the 50k I will do that.
07:33LauJensenBjering_: What do you do when your game becomes a huge success and you need to handle 55k ? How will you scale it ?
07:33Bjering_I'll hire some demigods ;)
07:34AWizzArdMost MMO games seem to cap their server capacity at a few thousand sim. players
07:34LauJensenI was thinking something like WoW
07:34Bjering_Nah. True answer. 1 When I cannot scale it vertically more (nitrogen cooling isnt enough) I'll shard it. 2. I might consider trying to build it to distribute and scale horizonatally, with areas and deal with all the complexities of migrations etc.
07:35Bjering_WoW shards at ~10000 concurrent players
07:35AWizzArdYeah, although I am not certain that those run on one physical machine.
07:35Bjering_Biggest shard has Eve Online, ~35k concurrent players iirc. They run stackelss Python.
07:36LauJensenNice
07:36Bjering_AWizz, last I hears they used 3 machines per world. One for each continent and one for instances.
07:36AWizzArdYes, but Eve Online also has 7000 "zones".
07:36Bjering_yes
07:36LauJensenBjering_: Maybe you should consider Python? :)
07:36Bjering_Now my game isn't going to be "walk around in a world"
07:36AWizzArdIn each of such zones only a few players are flying around.
07:37AWizzArdSo, EO can put a few zones on one physical machine and will never have to manage more than a few hundred players
07:37Bjering_My game will be more like a multiplayer slow realtime Civilization if you like (its really hard to decribe it). Abit like those asynchrouous WebStrategy games that are out there, but fun ;)
07:38LauJensenBjering_: You designing the entire game yourself?
07:38AWizzArdThe JVM could still be a nice plattform if you don't insist on managing more than, say, 5k sim. players on one machine.
07:38Bjering_Me and my business partner, a veteran computer artist.
07:38LauJensenBjering_: Hang on, I'll see if I can find some protips for you
07:39LauJensenBjering_: This was insightful: http://www.youtube.com/watch?v=ihUt-163gZI
07:40Bjering_AWizzArd, yes, but it is a pity to do that. Our market is more the async webgames, and they target millions, they scales thanks to beeing async and not needing communication player to player, that restricts their game design alot.
07:42Bjering_LauJensen: Cool, googletalks are usually worth seeing.
07:42LauJensenI think I've enjoyed about 40% of those that I've seen
07:42LauJensenThat one made up for it, as I every sentence taught me something new about design, which I wasn't aware of
07:47AWizzArdBjering_: you can download an early access versoin of YourKit. Maybe that will run fine on JDK 7: http://www.yourkit.com/eap/index.jsp
07:48Bjering_AWizzArd: I like this, you dont want me to give up ;) Well Its sunday, this is spare time. I should try it!
07:49AWizzArdBjering_: if it is not too much trouble for you, because I am really interested in the results, even if your server will be in C++.
07:49AWizzArdWith all your evaluation stuff you produced some really interesting info
07:50Bjering_Its good pricing for it too, in the "startup buyable" range, not like some of those C++ tools AAA gamestudios have that cost 6 or 7 digits...
07:50AWizzArdI think you can evaluate it for free. Seems to be a very advanced tool.
07:51Bjering_EA was free
07:51AWizzArdyess
08:01Bjering_AWizzArd: You know YourKit?
08:02AWizzArdI tried it some time ago. They also have demos online: http://www.yourkit.com/docs/index.jsp
08:02Bjering_Nut sure how to read this, I have java.lang.Thread.run() taking 67%, then my method inside it takes 1%, where did the other 66% go?
08:04AWizzArdBjering_: I can't promise that my idea is right, but it could be this: only when code takes a significant amount of time it will be listed. So, you could have 100 methods taking up 0.5% each. Those will not be listed, and 50% are thus not seen.
08:05AWizzArdIn this case I would interpret it as: this run() thing is doing well. It has no bottleneck worth fixing.
08:05Bjering_ok, putting some serious stres on it now, If I appear offline its my OS that hung...
08:06AWizzArd(:
08:06Bjering_I am defintly abusing the heap I as suspected, but the eden heap shows saw-teeth pattern, it comes back to 0 often enough.
08:07AWizzArdBjering_: really think about renting a EC2 instance. It will cost you max 2.88$ per hour, for a fat Xeon Server with 68 GB RAM.
08:08Bjering_AWizzArd, can I run a Windows image on it?
08:08AWizzArdsure
08:09AWizzArdWindows Server that is.
08:09AWizzArdJust decide which testing machine(s) you want: http://aws.amazon.com/ec2/instance-types/
08:10AWizzArdThe quadruple box is hosted on a Xeon X5550: http://www.cpubenchmark.net/high_end_cpus.html
08:11Bjering_dammit I had made a decision and here is this wondertool showing me my memory is ok, ms Old Gen is about the same as C++ usage, and the other stuff is returned on GC.cpu wise all the time is in java.nio.channels.AsynchrounousSocketChannel.write, this is suspected as I use heap-byte buffer there and it myst copy it to a direct byte buffer. (10 times for 10 users, that is one bad architectural decision of NIO.2 imho, why not have an IMUUTABLE ByteBuffer that
08:11Bjering_ I could share for multiple writes?)
08:13AWizzArdhmm
08:13Bjering_ok, now I'll throttle up from 25k users to 50k and see if I can learn what is happening before my machine hangs.
08:13AWizzArdyes
08:14fliebelBjering_: Does it write to a log, or is everything los when yout hang your computer?
08:15Bjering_good question, I'll check options and google for it
08:17AWizzArdIf you do CPU-sampling, then the profiler will write this data to disk I think.
08:17Bjering_alright lets hops so, cannot find any setting for it. here we go.
08:22AWizzArdBjering_: it should tell you the path to where it saved the .snapshot file.
08:25Bjeringno, dont see any log after the crash.
08:25AWizzArdBjering: did you do a CPU sampling snapshot?
08:25BjeringI have a reproducable "HANG THE OS" bug though probably should contact Microsoft and/or the JDK7 people.
08:26AWizzArdIn principle it should be nearly impossible to hang Windows 7.
08:26BjeringAWizzard no, Ill try that
08:26AWizzArdMaybe a hardware problem.
08:26Bjeringyes, could be the network driver that is the bad guy
08:26Bjeringnetwork card driver
08:26AWizzArdBjering: watch the cpu profiling demo video: http://www.yourkit.com/docs/index.jsp
08:28BjeringBut I wonder if the network card driver is involved as I test on localhost. Maybe.
08:28Bjeringwatching video
08:28AWizzArdBjering: you could rent 2 instances from Amazon. One which runs your code, the other doing requests, internally in Amazons network.
08:29BjeringWell, it is just adding unknowns. I dont want to test the bandwith thing yet, it shouldnt crash first.
08:36LauJensenAWizzArd: How many % do you get, everytime to sell an Amazon instance? :)
08:36Bjeringthe "fun" part is that I have been involved in another project ~2 years ago that also hung windows server. A server written in C# using asynch IO. I then sworde never to use a complex vm solution again as I run into problems I cannot solve, with C++ its more transperant how I have done wrong.
08:38Bjeringnothing in video on how to have it save continously
08:38BjeringActive forum it seems, I'll post there
08:40AWizzArdBjering: do you know +/- the point on which it hangs your system? 25k conns seem to go fine, but for 50k it crashes. Maybe on 35k it still is fine?
08:40BjeringAWizzard: It depends on how fast I add users.
08:41LauJensenBjering: All of those clients are generating a random amount of network activity ?
08:42BjeringWhat I think happens is that it congests, and that the jvm handles badly when it cannot keep up with a channel, ie thu queue with work items grow much faster the threadppol can deal with it. Its odd though, as I get no warning, no visble spike.
08:43Bjeringcould be a tcp buffer becomming full, but that should just close the connedction.
08:43Bjeringyes
08:44Bjeringthing is I can get that scenario with the C++ one too, ie the tcp-connection closes conections on me when their buffers gets full.
08:44LauJensenBjering: You could eliminate some unknowns if you killed all traffic and just opened connections, thinking that it might expose a bad driver?
08:44Bjeringbut it dont hang.
08:45BjeringLauJensen, yet, the C++ use the same driver.
08:45BjeringI suspect
08:45LauJensenTrue
08:45AWizzArdIt still is surprising that a program can do anything to crash the OS.
08:46AWizzArdThe kernel should be stable enough to just end that process instead of crashing.
08:46Bjeringhttp://forums.yourkit.com/viewtopic.php?f=2&amp;t=3348 :(
08:46BjeringIt doesnt _crash_ the OS. It makes it completly unresponsive
08:46BjeringI should nice the jvm process and see if still does.
08:47LauJensenAWizzArd: Not too uncommon for resource issues?
08:50Bjeringnow testing with both jvm and stressbot running on below normal priority
08:52Bjeringit takes time to build up the load, havent found a way to turn of win 7 syn-flood protection so it throttles my connect/accepts to about ~100 per sec.
08:52AWizzArdmaybe this is easier on WS 2008
08:53Bjeringyes, could be. I think Windows 7 share alot with WS 2008 though, but this kind of things are ofc more server specific.
08:54BjeringI will install a WS 2008 and test.
08:54AWizzArdyou could also just test it on EC2 ;)
08:55BjeringWell, I just bought myself a HD yesterday, I could take a partition of it and do WS 2008 and get some value from my MSDN subscription.
08:56AWizzArdoh good
08:56BjeringI view virtualization a bit lite outsourcing, its great, but only do it with things you understand 100%. You dont wnat to track down problems remote.
08:57LauJensenBjering: An instance isn't very 'remote' though. There's not much I can do with a physical linux box that I cant do via ssh
09:00Bjering_nice didnt help....
09:00AWizzArdBjering_: again 50k?
09:01Bjering_~40k actually
09:01clojurebotTitim gan éirí ort.
09:02AWizzArdbtw, will your connections stay open to the client all the time, or is it closed directly after you replied to the request?
09:02Bjering_Oh they are open
09:03Bjering_Its a chat, I write to them
09:07LauJensenI has to be some kind of starvation
09:07Bjering_what I dont get is that the jvm gets to grab that hangs it so hard, I am not even running the jvm as admin.
09:08Bjering_ofc, i am not 100% its the jvm that hangs at all. could be anything really. It just only happens when I run this test with the jvm.
09:09LauJensenBjering_: You might want to spend 10 minutes getting familiar with tweaking the GC, that can sometimes buy you as much as 20% perf and a smoother ride
09:09LauJensenThere's a good chance the GC is helping you crash
09:16Bjering_Yes, GC is very helpful I am sure ;)
09:16AWizzArdBjering_: can you setup your bot so that it will build up the 40k conns slower?
09:17Bjering_AWizzard yes
09:20Bjering_I'll do that, just to test, 50 per sec, means I need 17 minutes to get to 50k, then the next thing should probably be to simplify the scenario, skip the "chat" part and just play with simple request/responses and see If I can reproduce it.
09:21AWizzArdBjering_: and with YourKit you can profile for GC as well.
09:21Bjering_LauJensen, re gc, I know what I do bad, I (almost on purpose) create massive amount of strings and have them gc:ed away. What option would you recommend to handle that?
09:22LauJensenBjering_: Well, first off, String is evil as it takes 2 bytes per char
09:23Bjering_my "parse" is just splitting a string into a vector of strings. This isn't optimal in any way, I just wanted it basic, I use the same horrible approach in C++ (and you really shouldnt hit malloc/free that much in c++ either...)
09:24LauJensenBjering_: http://java.sun.com/performance/reference/whitepapers/tuning.html#section4.2.1
09:25LauJensenThere are some good advice on tweaking the GC. In regards to Java/Clojure performance, just avoid String as a heavy data-type as they consume a ton of memory
09:26Bjering_its abit worrying that the official side describes this process as a trial and error way. I always get bad feelings from gc tweaking. Actually I hate gc... I never ever had a problem with memory in C++, its just silly this... I understand now clojure needs it, but I really miss my stack objects.
09:27LauJensenhehe
09:28LauJensenI've had good results by tweaking the GC in the past. And I remember one heavy processing job, where I cut out Strings an doubled performance
09:29Bjering_sure, but it should HANG if you use them. This is my worry now. I mean I can fix _this_ problem. But I need to know why and when I crash, or I can have no confidence. I can say "well I think I fixed it with this jvm switch..." thats like coding multithreaded C++ and thing good testsuit and sprinkling locks is a good approach. it is just hiding an architectural flaw until some rainy tomorrow...
09:31Bjering_I mean, it _should not_ hang...
09:34lenwdoes anyone know if the enlive tool for htm caches the templates and snippets ? I am changin the underlying html files and still getting way old stuff ?
09:37LauJensenlenw: Yes, it uses its own kind of state machine, which memoizes the html
09:37lenwLauJensen: for dev how do i ask it to refresh ?
09:38LauJensenlenw: protip: Separate all of your templates into their own namespace, and define your moustache app as (def routes (app (wrap-reload '[myns.templates]) [""] ...))
09:38LauJensenIf this is a Moustache project, they will refresh every time you reload the page
09:38LauJensenIf its not moustache... then make some special hack, but be aware, Enlive can leak a little memory when you reload-all on it too often
09:38lenwcool and take the wrap-reload out for prod ?
09:38lenwyes it is moustache
09:38LauJensenBjering_: I agree, but you didn't manage to hang Linux did you ?
09:39LauJensenlenw: yes, or simply make it check of a production? var and only attach itself if its there
09:39lenwLauJensen: thanks
09:39LauJensennp
09:46lenwLauJensen: thats working cheers
09:50Bjering_its interesting how so far EVERYtweak I do to the gc makes me drop connections earlier.
09:52LauJensen"Tweaking - You're doing it wrong"
09:54Bjering_yes, but I am lost, I am applying trial and error. I have a theory, the best gc strategy for my app is to GC all the time everything. Do you know the switch for that?
09:58LauJensensec
10:00LauJensenBjering_: Im reading the docs as though you want the Throughput Collector and a fixed memory size (xms = xmx)
10:01Bjering_the 4.2.1 ?
10:01LauJensenThe 5.2
10:02Bjering_?
10:02LauJensenhttp://www.oracle.com/technetwork/java/gc-tuning-5-138395.html#0.0.0.The%20Throughput%20Collector%7Coutline
10:07AWizzArdBjering_: you can profile the GC at 30k conns. Perhaps it already shows strange behaviour at that point, or it may be very harmless.
10:09Bjering_Here is what I learn, all tweaks that leads to postponing GC, that so far all tweaks do i can see my eden live for a long time in YourKit, they all disconnect stressbots when they do finally do their gc.
10:09Bjering_wow that sentence got garbled
10:11Bjering_All tweaks I have made seems to postpone gc. And all such fail when they eventually DO their gc. Fail as in my stressbots gets their sockets closed.
10:14LauJensenClojure code of Java code?
10:14Bjering_java
10:14LauJensenhehe, OR java code.. I need a new keyboard, AWizzArd when can you deliver?
10:15LauJensenBjering_: This is puzzeling, I wont be able to sleep before you figure out why it hangs.. Could you try to limit the amount of data my ridding the strings?
10:16Bjering_here is a funny fail I get. I did the "NO DONT DO THAT" as a half depserate thing, that is call system.gc all the time. That causes disconnect right away.
10:16Bjering_This is a path I should pursue, shouldnt disconenct just because something takes alittle time
10:18Bjering_Ill see how it feels about a sleep
10:20AWizzArdLauJensen: did you already order one?
10:21LauJensenAWizzArd: No I didn't yet - I cant decide if I should wait for Conj Labs Frankfurt or not :)
10:21AWizzArdbetter not wait
10:21LauJensenYou're probably right
10:23Bjering_Well, I have my app failing in two ways, the nice way with "connections dropped" I can get that by adding a sleep in my completion handlers, or by "tweaking" the gc in such a way that it does few (but long) runs. Then it is the evil way of failing, the hard hang. I do not know what that is from.
10:24LauJensenBjering_: And running that exact code in your Ubuntu box, fails the exact same way ?
10:25Bjering_No on Ubunto it fails the "nice way" but much earlier.
10:25LauJensenok, same memory allocation for the jvm ?
10:27Bjering_well, I havent checked. Actually the ubuntu trials I did wasnt this code, it was all "old NIO" code, not this JDK7/nio.2 code. I suspect I wont see any massive benifit from NIO.2 on linux as its native op is epoll which doesnt map as good to async io.
10:28LauJensenok
10:28LauJensenI think the trick is to determine why GC causes drops
10:29Bjering_Agree, and it doesnt have to be gc, I can get it with a sleep in my completion handler
10:29Bjering_10 ms sleep is enough
10:29LauJensenoh ok
10:29LauJensenAnd no exceptions are being thrown anywhere?
10:34Bjering_LauJensen: I'll keep looking at this. But it will be a backburner/sparetime project, I'll go with C++ I think.
10:35Bjering_if anyone wants a .rar of all my source email me at d e p i c t i v e l o g i c ( at ) g m a i l . c o m (see if that keeps the spam at bay....)
10:37LauJensenI might need a copy just to do a blogpost and demo a 50k client version in Clojure :) Or get ridiculed trying
10:47BahmanHi all!
10:48LauJensenBada-bahman! :)
11:02BahmanYo LauJensen!
11:02BahmanWhat's that 'Bada' LauJensen?
11:07stacktracerwhat's the best way to get "lein repl" to start in the user ns, instead of clojure.core?
11:12slyrusmorning y'all
11:17BahmanMorning slyrus!
11:30LauJensenBahman: I dont remember, some TV show with a scientist who said "BadaBING, BadaBOOM" repeatedly, so I just thought it went alright with Bada-Bahman! :)
11:31BahmanLauJensen: I never ever thought that my name could be source of so many imaginations :-)
11:49slyrusanyone have any examples of non-trivial deftypes (besides defrecord) in the wild?
12:01bobo_i wonder how Bjerings stuff would work out in erlang, or scala+akka. sounds like alot of messaging and so on...
12:13mfexslyrus: there's the priority map proposal on the clojure dev ml, perhaps not in the wild but certainly non-trivial
12:22slyrusok, thanks mfex
12:23lenwwhats does the syntax [:somekey :> something-else] mean - specifically the :> ?
12:24AWizzArdIt is a vector of three keywords.
12:24lenw:> is a keyword !
12:24AWizzArd,(class :>)
12:24clojurebotclojure.lang.Keyword
12:24lenwis that a convention like the underscore
12:25AWizzArddid you try (find-doc ":>")?
12:25lenwduh me - thanks AWizzArd !
12:26AWizzArdI would guess that a function or macro just handles this :> keyword in some special way
12:27lenwyes i see that now - not been at this long and everytime i see a new piece of code i jump to the conclusion that it must be a new keyword that i have not seen yet cause that the way it is in java ...
12:27lenwmy mind is reorganising !
12:49jlf`anyone know of a solution to the conjure/clojure 1.2 incompatibility described at http://groups.google.com/group/clojure-conjure/msg/67547c5c0edd0928 ?
12:50jlf`the error is "java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map (scriptjure.clj:70) " and that line in scriptjure.clj contains "(def infix-operators (set ['+ '- '/ '* '% '== '=== '< '> '<= '>= '!= '<< '>> '<<< '>>> '!== '& '^ '| '&& '||]))"
12:55jlf`seems like the '^ is guilty
12:55LauJensenlenw: :body :> :div means the 'div' tag directly under the body tag
12:55LauJensenIts a CSS selector which ensures that your styles don't leak
12:56LauJensenEnlive always adheres strictly to CSS standards
14:33arnorhsg'day
14:33arnorhsscala?
14:33clojurebotUnfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala
14:42LauJensenlenw: did you catch that ?
14:43lenwLauJensen: yes i did thanks
14:43lenwLauJensen: its starting to make sense !
14:43LauJensenGood, you'll also see that stuff in quality CSS files like div#content > h1 { something }
14:46lenwLauJensen: the thing that I am getting used to is the fluidity of the parameters and how easy it is to map a lisp into the solution domain - i guess thats the dsl idea
14:52lenwThat the syntax is more fluid is prob a better way to say it
15:10bobo_how do i add more to a existing key in the session in ring/compojure?
15:10bobo_ie :session {:tasks (str task)}})
15:11bobo_i want to append task to whatever is in :tasks already
15:17LauJensenbobo_: Decide upon a data format which makes sense, vector, hashmap, set?
15:21LauJensen,(let [session {:task "first task"}] (assoc session :task (if (vector? (:task session)) (conj (:task session) "second task") (vector (:task session) "second task"))))
15:21clojurebot{:task ["first task" "second task"]}
15:22LauJensenAnd then make some kind of function, which appends to it, and run that on your response, so (assoc response :task helper-fn)
15:29RaynesLauJensen: What was it you asked me to whitelist? DateTime?
15:29technomancystacktracer: that's fixed in git for lein
15:29LauJensenRaynes: Yea I sent you a mail
15:29technomancyshould be released in a few days
15:29LauJensena $mail
15:30RaynesLauJensen: Yeah, I was in the middle of a bit of a refactor and it screwed up, but raek told me later on what you said.
15:31LauJensenoh alright - Basically I'll send you a mail everytime something harmless doesn't eval
15:31RaynesSounds good. :>
16:01krlhow do i make a variable binding work across a map-call (or equivalent)?
16:04AWizzArdkrl: can you describe what you want in other words?
16:05LauJensenkrl: also note, that a map call isnt the same as a pmap call in this context
16:07silveenwhere did clojure.contrib.seq-utils/indexed go in 1.2? after updating (to RC2) I get Var unbound errors on it
16:08krlAWizzArd i need an incrementing variable across the map-call. i guess it's a problem in that map might have undefined execution order?
16:09LauJensen,(map #(vector %1 %2) (range) [1 2 3 4 5])
16:09clojurebot([0 1] [1 2] [2 3] [3 4] [4 5])
16:09LauJensenkrl: would that work ? where %1 is the incrementor
16:10chouserthere's now map-indexed and keep-indexed
16:10krlno, the increments are non-regular
16:11LauJensenchouser: map-indexed looks very complex, given that it only does what I did with map above
16:12chouserits implementation or its usage?
16:13LauJensenimplementation
16:13chouseryeah. It's a performance thing.
16:14chouserit is sometimes a bit simpler to use and also a bit faster.
16:14LauJensenchunks :(
16:15chouseryours was chunked too
16:15danlarkinchunks!!!!!!!!!!!1111111
16:15LauJensenchouser: I know - I just dont like them chunks
16:16LauJensenI thought when cells first arrived, that they were going to take away the chunks :[
16:19chouserthey might yet
16:21LauJensenYou'll replace them with fingertrees?
16:21LauJensenHow's that going btw, sorted out that perf problem ?
16:21hiredmanI've been playing with writing clojure to generate a class file with a bunch of static methods as a replacement for c.l.Numbers
16:43fuchsdI'm using Leiningen 1.3.0, and I have a brand new project. When I type 'lein repl' from within my project directory, it seems like my project is not on the classpath. Do I have to do something else to get my project on the classpath?
16:44fuchsd(for example, if my project is called test-project, (ns test-project.core) puts me in an empty namespace)
16:45technomancyfuchsd: that's correct behaviour; nothing to do with leiningen
16:45technomancyyou need to (require 'test-project.core) first
16:45technomancyor (doto 'test-project.core require in-ns) if you're feeling fancy
16:47technomancyand let's be honest: feeling fancy is fine.
16:48fuchsdHeh
16:48fuchsdAwesome, thanks!
17:00fuchsdAhh, I get the fanciness now; thanks for the tip.
17:19LauJensenDoes this mean Im famous now? http://twitter.com/smashingmag/status/22441977953
17:20technomancyInternet Famous!
17:21ska2342Hm, quitting coffee. actually I thought about it just a few days ago. Really worth it?
17:21technomancyhttp://images.google.com/images?q=don%27t%20worry%2C%20I%27m%20from%20the%20internet
17:21LauJensenska2342: Trust me, its the way to go
17:21technomancyska2342: there's a middle ground between three cups a day and swearing off it.
17:22LauJensentechnomancy: its poison- Im convinced now that Im off it, that its incredibly bad for your body and your mind, it just needs to go
17:22ska2342technomancy: on bad days I think I'm at 3 days before and after midday eacht, on normal days it's more like to cups in the morning and one in the afternoon
17:22technomancyanything is deadly if you take enough of it.
17:22LauJensenAnd honestly, Ive been off it for a while now, and I dont think Ive ever been as mentally sharp as I am now, theres still a tangible difference
17:22technomancyeven H2O
17:22chouserI'm pretty sure caffine effects different people in different ways.
17:23seangroveHey all, this blows out the heaps space in clojure: http://paste.lisp.org/display/114032
17:23LauJensenchouser: And Im pretty sure thats its bad for all of them
17:23seangroveSeems like none of it is really calculated until the final line when it's output
17:23LauJensenAnyway, you can drink what you like, Im not concerned about what you guys drink, Im just saying for me it was a very good thing to get rid off
17:24seangroveWhich is actually quite cool, but I'm wondering if I should be doing it in some more efficient way
17:25chouserI've been off caffine for months at a time before and haven't noticed much difference.
17:25chousergetting off sugary sodas has had various benefits.
17:25technomancychouser: same here
17:25LauJensenchouser: How much coffee/caffeine did you usually intake?
17:26ska2342getting off chocolate would have benefits, too :-)
17:26hircusseangrove: filter, and most sequence-processing functions in Clojure, is lazy -- so yes, until you try printing, the final sequence is not computed
17:26seangrovehircus: Thought so
17:26LauJensenhircus: depending on the range
17:27hircusLauJensen: ah. I guess at some point the overhead of storing all the delayed computations is too much, and some of the pending computation is actually computed?
17:27tomojseangrove: remember what I said about holding the head?
17:27LauJensen,(take 1 (map #(print %) (range)))
17:27clojurebot(nil)
17:28LauJensen$(take 1 (map #(print %) (range)))
17:28LauJensenhircus: On my system, that will print up to 31
17:28kotarakchunkiness
17:28LauJensenExactly
17:28seangrovetomoj: Ah, that's right
17:28LauJensenhircus: So like kotarak, Clojure is chunky and will compute in chunks of 32
17:28hircusaha. right. so once a sequence is realized, it's done in blocks
17:29chousersome seqs and chunked, some are not. chunks can be of differing sizes
17:29hircusbut the problem here is that to get 32 results out of the final sequence, you have to get > 32 results out of the previous sequence, and so on
17:29chousers/and/are/
17:29sexpbotsome seqs are chunked, some are not. chunks can be of differing sizes
17:29LauJensenchouser: really? do tell
17:32tomoj,(take 1 (map println (range)))
17:32clojurebot(nil)
17:32tomojhmm, no output?
17:32tomojwell, compare to (take 1 (map println (iterate inc 0)))
17:38chouserLauJensen: https://gist.github.com/ca94967979ba35dcc39d
17:39LauJensenchouser: why 16?
17:39chouserhalf of 32
17:40LauJensenbut why not 32?
17:40chouserfilter took one chunk of 32, filtered just the odd numbers, and returned one chunk.
17:40chouserfilter doesn't combine chunks (though I suppose it could)
17:41LauJensenooh
17:41LauJensenInsightful, thanks Chris
18:13ihodes,(java.util.Calendar.)
18:13clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.util.Calendar
18:14ihodesah protected…
18:14ihodes,(.get (java.util.GregorianCalendar.) GregorianCalendar/MONTH)
18:14clojurebotjava.lang.Exception: No such namespace: GregorianCalendar
18:15raek,(.get (java.util.GregorianCalendar.) java.util.GregorianCalendar/MONTH)
18:15clojurebot7
18:15ihodesgot it. thanks clojurebot :)
18:15ihodesyeah forgot my qualification – moved back to my repl anyway
18:15ihodes:)
18:39tcrayfordHas anybody got a good solution for mocking out functions used inside other functions made using def rather than defn?
18:40hiredmanuh
18:40hiredmandefn is the same thing as def + fn
18:40tcrayfordthere's an interesting weirdness here though
18:41hiredmanI doubt it
18:41tcrayfordif I have a definition: (def foo (comp bar baz bat)), and I want to replace bar using binding, things seem to be weird. Maybe I'm just being dumb though
18:42tcrayford(the tests pass when I define foo as (defn foo [x] (bar (baz (bat x)))), but fail when I use comp
18:43hiredmanbecause come is a function, and it's arguments are evaluated before they are passed in, just like the arguments to any function
18:43hiredmancomp
18:43tcrayfordexactly, was wondering if there was a solution to that
18:44tcrayford(sorry, probably failed at explaining it)
18:45tcrayford(currently I'm just using the defn form, but it feels uglier than using comp)
18:47ihodestcrayford: i think defn is the way to go here. why do you want to use def?
18:47ihodesah, prettiness.
18:47ihodesfair enough
18:48ihodes(defn foo [x] ((comp foo bar bat) x))
18:48ihodesworks?
18:48clojurebothttp://haacked.com/images/haacked_com/WindowsLiveWriter/IConfigMapPathIsInaccessibleDueToItsProt_1446B/works-on-my-machine-starburst.png
18:48tcrayfordworks, but ugly compared to using def with comp
18:49ihodescomp is a functional form, and using a global binding is gonna get you uglies when you try to mix it with the beauty of functionality
18:49ihodes*philosophy*
18:49ihodesi also don't think it's too ugly, myself
18:50RaynesWhy would you defn a comp'd function?
18:50RaynesIt's not as ugly as it is silly.
18:50ihodesread up to see why it's not working for him, Raynes
18:50ihodesthough now that i read up, i may have misunderstood him
18:51tcrayfordI think you understand here
18:51RaynesOh.
18:52ihodesanyway, i've got a question regarding running a swank swank on a remote server, and connecting to it with slime via emacs and ssh. how do i go about doing that?
18:53ihodesswank server* not swank swank...
18:53tcrayfordyou have ssh access?
18:54tcrayfordset up an ssh tunnel and slime-connect through it
18:55ihodesah of course…thanks haha
18:55ihodeswas thinking there was a emacsy way of doing it.
19:58stacktracertechnomancy: thanks!
20:02ihodeslooks like rlwrap isn't working on archlinux/something to do with leiningen? http://cl.ly/2AFA
20:14ihodesfor some reason i'm unable to get slime to bind to the port i have open to my remote swank server… anyone familiar with ssh tunneling and using swank remotely?
20:16rmarianskiihodes: i've never tried it with swank, but i tunnel using ssh -NL <local_port>:localhost:<remote_port> <remote_host>
20:18ihodesi was using ssh -f user@machine -L <local_port>:remotehost:<remote_port> -N
21:00florianjunkerIs there a limit for the number of refs? I'm currently trying to make about 2 million of them and clojure doesn't seem to like it.
21:01florianjunkerAnd, how much memory does one ref consume?
21:02danlarkinflorianjunker: in what sense does something with no emotion not "like" it?
21:02florianjunkerdanlarkin: Slowness.
21:02ssideriseidika sthn teleytaia photo fainetai poly hot
21:02ssiderisoops
21:02ssideriswrong window
21:03florianjunkerI guess there's some philosophy there, but it's 3:00 here, and I'm not going to think about that.
21:05danlarkinjust creating refs does not involve the stm, so it's probably the JVM having memory issues?
21:05florianjunkerdanlarkin: Yeah, going to increase max memory.
21:06danlarkinhow much heap space are you allocating
21:06danlarkinalso, what data structures are you putting into the refs
21:06danlarkinand are you just creating them, or manipulating them as well?
21:07florianjunkerSo, Xmx at 1024m. Just creating right now. And there are maps in there.
21:14florianjunkerSo, one cannot fit 2 million refs into 1GB of RAM. Does anybody know how much overhead one ref has?
21:21seancorfieldbeen playing with lein this afternoon (writing plugins and hooks - just for fun) and wondering whether lein questions are on-topic, given that there's also a #leiningen channel?
21:23florianjunkerseancorfield: Non authorative answer: leiningen is that central to clojure, that discussion about it should be on-topic here.
21:25seancorfieldflorianjunker: thanx :)
21:26ihodesseancorfield: yeah people often ask lein questions here. what's your issue?
21:34seancorfieldi asked it on the clojure list but i'll try to restate succinctly... i'm writing a hook for leiningen and i can get the basic stuff working but i want to wrap compile with a binding of *load-tests* to false (in clojure.test)
21:34seancorfieldbut i can't figure out how to get clojure.test/*load-tests* to resolve
21:35seancorfieldif i add :require or :use, i get an error that Warning: problem requiring hooks: java.lang.NoClassDefFoundError: Could not initialize class clojure.test__init (notests.clj:1)
21:36seancorfieldit's not a big deal... just curious if i can make it work so i can write tests in my regular source files and then have lein omit them when it compiles for production :)
21:38ihodesi can't help you there–lein's tests are pretty foreign to me. you can hang around for technomancy to show up, as he invariably does. he's quite helpful, and the creator of lein
21:40seancorfieldyeah, i'm just scratching an itch right now :) pleased i managed to create a working hook and a working plugin already... leiningen is pretty neat!
21:41seancorfieldreally enjoying learning clojure too... just trying to find some project i can use it on for real!
21:44ihodesi know the feeling :) took me a while to find one
21:45ihodesnow i'm working on the second iteration of my first project, with one big one behind me. love the language :)
21:45cansadoseancorfield: do you do clojure or any other jvm languages from within your cf framework, or do you just work outside of cf entirely?
21:45ihodesalso, should you dig into lein some more,p contributing is a breeze and feels good, too :)
21:47seancorfieldi'm currently using scala with cfml (running on railo, the free open source cfml engine - a jboss community project)
21:47seancorfieldi previously used groovy with cfml (also on railo, back before it went open source)
21:47seancorfieldi like to learn a new language every year so 2008 was groovy, 2009 was scala and 2010 is supposed to be clojure
21:48seancorfieldi like to mix'n'match languages in projects (on the jvm)
21:49cansadoyou're running out of jvm languages. what's slated for 2011? :)
21:49seancorfieldhahaha... don't know yet
21:49seancorfieldi haven't - yet - used more than two languages together so maybe that'll be 2011's challenge ;)
22:04amaevisHi... It seems idiomatic to use agents to update a database upon completion of a dosync. What if you wanted the database updates to be synchronous, i.e. ordered the same way that dosync blocks are ordered (actually being executed)?
22:09seancorfieldthat raises another question in my head: what are most folks using in clojure for basic database access?
22:17Raynescansado: Maybe Ola Bini's new Seph language will be usable in 2011.
22:18RaynesMight be an interesting 2011.
22:23ihodesseancorfield: i think clojure.sql gets some use: but i haven't used it any.
22:25seancorfieldjust looking at it now - it's low level but it'll handle my needs for now i think
22:48bortrebanyone have recommendations for th best way to deal with images? both in terms of speed and also ease of use?
22:50bortrebright now I'm using a hash map with keys like [30 50] for 30 pixles right and 50 pixels down, which map to {:r 255 :g 255 :b 255} to describe colors, it's elegant but far too slow and memory hungry
23:03seancorfieldcool, i just read data from mysql with clojure.contrib.sql - i feel such a sense of achievement!