--- Log opened Thu Dec 17 00:00:41 2009 10:07 < McManiaC> No instance for (ServerMonad (ErrorT String (ServerPartT IO))) 10:07 < McManiaC> hmm 10:07 < McManiaC> ^^ 10:10 < stepcut`> that does appear to be the case 10:11 < stepcut`> why not use, ServerPartT (ErrorT String IO) ? 10:12 < stepcut`> you could add, instance (ServerMonad m) => ServerMonad (ErrorT String m), but I am not clear that is better than ServerPartT (ErrorT String IO) 10:18 < McManiaC> how would such an instance look like? 10:23 < McManiaC> http://npaste.de/7f/ ^^ 10:25 < McManiaC> thats exactly how I'd like to get it to work... :S 16:22 < stepcut`> instance (Error e, ServerMonad m) => ServerMonad (ErrorT e m) where askRq = lift askRq ; localRq f = mapErrorT (localRq f ) 16:24 < HugoDaniel> hello 16:24 < HugoDaniel> good night 16:24 < stepcut`> ok 16:25 < stepcut`> good_night . hello == id ? 16:25 < HugoDaniel> :) 16:25 < HugoDaniel> im working on a happs web app that needs to be ready in a few hours 16:26 < HugoDaniel> thats why i joined this #, in case any doubt appears 17:00 < burp> lol 17:04 < stepcut`> HugoDaniel: sweet! 17:04 * stepcut` knows lots of stuff about happstack 17:34 < HugoDaniel> how do i use fileServe ? 17:34 < HugoDaniel> i downloaded the happstack tar.gz from hackage 17:34 < HugoDaniel> and i did a grep for fileserve, and only one was found 17:35 < HugoDaniel> templates/project/src/App/Control.hs 17:35 < HugoDaniel> oh, i need the server 17:35 < HugoDaniel> sorry :) 17:37 < McManiaC> stepcut`: awesome! thx 17:39 < McManiaC> stepcut`: what would argue against putting such an errorT instance into the happstack-server? 17:42 < McManiaC> http://npaste.de/7m/ 17:46 < McManiaC> imo thats way prettier than that flatten, unpack stuff etc you pasted some time ago 17:58 < HugoDaniel> hmm 17:58 < HugoDaniel> i need to serve files 17:58 < HugoDaniel> so i did this: serveFile fname = exactdir fname $ fileServeStrict [] fname 17:58 < HugoDaniel> and it doesn't work :P 17:59 < HugoDaniel> why ? 17:59 < McManiaC> exactdir is "old" 17:59 < HugoDaniel> so what should i do ? 17:59 < McManiaC> use dir or the new... wait a second 17:59 < HugoDaniel> nice 17:59 < HugoDaniel> dir works 18:01 < McManiaC> yeh, dir should do it 18:01 < McManiaC> its slightly different from old exactdir tho iirc 18:01 < McManiaC> dir "foo" will match "/foo/bar/moep" wheras exactdir "/foo" only matched "/foo" 18:02 < HugoDaniel> sweet, part 1 of my web app working and loading 18:02 < HugoDaniel> now part 2 is jquery and http requests mangling... let me see... 18:02 < McManiaC> but the guards in Server.SimpleHTTP could help here... maybe nullDir or something 18:03 < McManiaC> dir works for me most of the time, tho 18:03 < McManiaC> :) 18:03 < HugoDaniel> nice 18:03 < HugoDaniel> :) 18:04 < McManiaC> my next step is to convince stepcut` about that errorT stuff 18:04 < McManiaC> :D 18:08 < HugoDaniel> having to reaload ghci everytime i change a thing is quite the pain 18:08 < McManiaC> well thats the downside of having a strong typed, compiled webserver/-application 18:08 < McManiaC> ;) 18:09 < stepcut`> HugoDaniel: reload because the background threads don't get killed 18:09 < stepcut`> ? 18:09 < HugoDaniel> i dont know 18:09 < HugoDaniel> i have read that in the happstack tutorial somewhere 18:09 < HugoDaniel> let me try it without reloading 18:09 < HugoDaniel> :P 18:09 < aavogt> McManiaC: it's less likely to do something when broken somewhere? 18:10 < aavogt> that means more work fixing type errors when you could have a 'working' prototype 18:10 < aavogt> err, less working 18:10 < aavogt> less work 18:10 < stepcut`> HugoDaniel: in my experience, when you do not do a full restart of GHCi, the threads listening in the background from incoming connections do not get restarted, so you get the old behaviour instead of the new behavior 18:11 < HugoDaniel> oh, okey 18:11 < aavogt> I've seen that too 18:11 < HugoDaniel> how do i serve all the files in a directory ? 18:11 < aavogt> it's best to rely on separate compilation 18:11 < stepcut`> in Happstack.Util.Concurrent, there is a 'reset' function that might be usable to prevent having to restart GHCi, but I have never tried 18:12 < stepcut`> HugoDaniel: fileServe [] "directory containing files" will serve all the files. Are you looking something that automatically creates a directory index? 18:12 < HugoDaniel> yes 18:12 < HugoDaniel> no 18:12 < HugoDaniel> sorry 18:12 < HugoDaniel> im using the yahoo user interface (yui) 18:12 < HugoDaniel> for the css 18:12 < McManiaC> aavogt: what exactly do you mean? 18:12 < stepcut`> HugoDaniel: also, you should use fileServe not fileServeStrict 18:12 < HugoDaniel> and these include lots of files, that include lots of files, that include lots of files 18:13 < HugoDaniel> ah ok 18:13 < HugoDaniel> but won't it keep the handles open ? 18:13 < stepcut`> no 18:13 < stepcut`> fileServeLazy will 18:13 < HugoDaniel> okey 18:13 < stepcut`> well, let me back up 18:13 < stepcut`> what version of happstack are you using? 18:13 < McManiaC> the tutorial is pretty outdated 18:13 < aavogt> McManiaC: I mean that a static type system forces you to deal with errors that might not be triggered if the type checking was lazy 18:13 < HugoDaniel> the one from hackage 18:13 < aavogt> depending on what kind of functionality you want to be testing 18:14 < HugoDaniel> ill be runing this on freebsd's servers tonight 18:14 < McManiaC> aavogt: eeeerrrr... to what are you actually responding? that errort stuff? 18:14 < HugoDaniel> will it cause a problem ? 18:14 < stepcut`> HugoDaniel: then, you will need fileServeStrict. But, I would highly recommend happstack from darcs head instead. The only reason it is not on hackage yet is because sendfile support on FreeBSD does not work 18:14 < aavogt> McManiaC | well thats the downside of having a strong typed, compiled webserver/-application 18:15 < HugoDaniel> hmm ok 18:15 < McManiaC> aavogt: ah. then i totally agree with you 18:15 < McManiaC> ;) 18:15 < stepcut`> HugoDaniel: the fileServe in happstack 0.4 uses sendfile() and is faster, and does not leak handles 18:15 < aavogt> in some cases people might not want that ;) 18:15 < HugoDaniel> but ill be runing this on freebsd 18:15 < McManiaC> huh 18:15 < HugoDaniel> in a few hours :P 18:15 < stepcut`> HugoDaniel: hrm 18:15 < McManiaC> aavogt: but thats a general haskell "issue" 18:16 < stepcut`> HugoDaniel: fileServeStrict will not leak file handles, but it does load the entire file into RAM before serving it 18:16 < McManiaC> not directly happstacks fault 18:16 < HugoDaniel> well, i could do it in php, but php is mehhh 18:16 < stepcut`> HugoDaniel: on FreeBSD you could use sendfile in portable mode 18:16 < aavogt> true 18:16 < HugoDaniel> portable mode ? 18:16 < HugoDaniel> what is portable mode ? 18:16 < stepcut`> HugoDaniel: in 'portable' mode haskell-sendfile does not actually use sendfile(), it just emulates the behavior 18:17 < stepcut`> it won't be as fast as sendfile, but it shouldn't leak handles 18:17 < HugoDaniel> so how do i "activate" portable mode ? 18:17 < HugoDaniel> im runing happstack inside a jail in freebsd 18:17 < stepcut`> when you compile haskell-sendfile add the flag, -fportable 18:17 < HugoDaniel> ah, nice 18:17 < stepcut`> anyway, I would get your app working with fileServeStrict and happstack 0.3, and then if you have time, upgrade to happstack 0.4 18:18 < HugoDaniel> yes :) 18:18 < stepcut`> we hardly changed the API, so it should just compile under 0.4... but since you have a deadline :) 18:18 < stepcut`> plus, I just installed FreeBSD in virtual box.. maybe I'll fix sendfile before you are ready ;) 18:18 < HugoDaniel> eheh :) 18:18 < HugoDaniel> cool 18:18 < stepcut`> though I doubt it, because I have to do all my christmas shopping tonight 18:18 < McManiaC> hehe 18:19 < stepcut`> tomorrow maybe 18:19 < HugoDaniel> ahh, i haven't dont mine yet 18:19 < McManiaC> me neither :S 18:19 < McManiaC> stupid christmas 18:19 < HugoDaniel> i always w8 until 24 of december 18:19 < McManiaC> haha 18:19 < HugoDaniel> when everything is empty 18:19 < stepcut`> I am hoping to mail order everything from amazon, and free shipping ends today :) 18:20 < HugoDaniel> are you guys all form the US ? 18:20 < McManiaC> germany 18:20 < HugoDaniel> nice 18:20 < HugoDaniel> wich part of it ? 18:20 < stepcut`> I am in Chicago (USA) 18:20 < McManiaC> south west 18:20 < McManiaC> black forrest :) 18:20 < HugoDaniel> :D 18:21 < HugoDaniel> okey, back to code, ill surelly paste around a few other questions 18:21 < McManiaC> 23:39 McManiaC stepcut`: what would argue against putting such an errorT instance into the happstack-server? 18:22 < stepcut`> McManiaC: I dunno. I would consider it for 0.5.. 18:22 < McManiaC> its just 3 lines... and error handling is kind of a pain in current happstack... 18:22 < stepcut`> McManiaC: there is only one sensible implementation for (Error e, ServerMonad m) => ServerMonad (ErrorT e m).. so I can't really think of a downside 18:24 < HugoDaniel> hmm 18:24 < HugoDaniel> doing a fileServeStrict [] "images/" wont serve the images :( 18:24 < McManiaC> stepcut`: mind if I send a patch? :) 18:24 < HugoDaniel> i probably need to create a function to list all the files in the dir, and then do a "dir" for each of these files 18:24 < stepcut`> McManiaC: go for it! But I won't apply it until after 0.4 is out I think.. 18:25 < McManiaC> ok 18:25 < stepcut`> McManiaC: but maybe it I will ;) 18:25 < McManiaC> ^^ 18:25 < stepcut`> HugoDaniel: no. 18:25 < stepcut`> HugoDaniel: it should work. Is your applications CWD the directory which contains the "images" directory? 18:26 < HugoDaniel> no 18:26 < HugoDaniel> :P 18:26 < stepcut`> :) 18:26 < HugoDaniel> the images directory is ../bin/templates/images 18:26 < HugoDaniel> i dont like mixing code with "content" 18:26 < HugoDaniel> okey, ill just pass it over my src folder 18:26 < stepcut`> the second argument to fileServe* is the filepath to the directory on the disk which contains the images 18:27 < HugoDaniel> and the first one ? 18:27 < HugoDaniel> im just calling it with an empty list 18:27 < McManiaC> index files iirc 18:27 < HugoDaniel> what are "index files" ? 18:27 < McManiaC> index.html 18:27 < McManiaC> etc 18:28 < HugoDaniel> why are these different ? 18:28 < McManiaC> what it'll look for if no specific filename was given in the url 18:28 < stepcut`> the first one is a list of index files.. if you have, dir "foo" $ fileServe ["index.html"] "bar", and someone goes to http://host/foo/, if "index.html" exists then they will be served http://host/foo/index.html automatically 18:28 < HugoDaniel> ah 18:28 < HugoDaniel> okey 18:28 < HugoDaniel> thanks 18:29 < stepcut`> anyway, for your problem now, you only care about the second argument. It can either be an relative path from the CWD of the running process, or an absolute path 18:29 < HugoDaniel> but then 18:29 < HugoDaniel> well 18:29 < stepcut`> though, I am not sure if 0.3 (and even 0.4) allows ../ 18:29 < stepcut`> but then? 18:30 < HugoDaniel> in my index.html i have this: 18:30 < stepcut`> yes 18:30 < McManiaC> cabal: cannot configure happstack-server-0.4. It requires sendfile ==0.6.* 18:30 < McManiaC> hmmm haddock only got 0.5? 18:30 < HugoDaniel> how does it know that if i go to localhost:8080/yui/build/cssreset/reset.css it must search in /home/hugo/server/bin/templates/yui ... 18:30 < HugoDaniel> ? 18:31 < HugoDaniel> without a "dir" function 18:31 < stepcut`> McManiaC: try cabal update? 18:31 < McManiaC> i did... 18:31 < stepcut`> McManiaC: oh, sorry got confused by syb-with-class 18:31 < stepcut`> McManiaC: you need sendfile from darcs at the moment, until I fix this FreeBSD bug 18:33 < McManiaC> ok 18:34 < stepcut`> HugoDaniel: you will have, impl = [ fileServe [] "/home/hugo/server/bin/templates/" , ... ], the incoming request will look like, http://host/yui/build/cssreset/reset.css, the path "yui/build/cssreset/reset.css" will be passed to fileServe. fileServe will do, /home/hugo/server/bin/templates/ yui/build/cssreset/reset.css, and see if that file exists. If it does it will serve it. 18:36 < stepcut`> HugoDaniel: there is one issue though .. if the fileServe part does not find the file, it does not call mzero and let the Request fall-through to the next handler, instead it will return a 404 18:36 < stepcut`> HugoDaniel: so, you would need to actually make it the last handler in the list 18:37 < stepcut`> or, you could do, dir "static" $ fileServe [] "/home/hugo/server/bin/templates/", and change your href to, 18:37 < McManiaC> stepcut`: patch sent 18:37 < stepcut`> I think that is a better way to go since you know for sure that if a request starts with '/static' and the file is not found that is really a bad request and no other handlers need to be checked 18:38 < stepcut`> McManiaC: thanks 18:38 < McManiaC> total number of 4 lines 18:38 * McManiaC is proud 18:38 < McManiaC> :P 18:38 < HugoDaniel> HTTP request failed with: : hLookAhead: resource vanished (Connection reset by peer) 18:38 < stepcut`> HugoDaniel: fun! 18:38 < HugoDaniel> something tells me this was not supposed to happen 18:38 < HugoDaniel> :) 18:38 < McManiaC> lol 18:38 < stepcut`> HugoDaniel: maybe.. did the right thing seem to happen in the browser? 18:39 < HugoDaniel> yes 18:39 < HugoDaniel> everything works fine now 18:39 < McManiaC> and finally, http://npaste.de/7m/ becomes http://npaste.de/7n/ \o/ 18:41 < stepcut`> HugoDaniel: yay! 18:41 < stepcut`> McManiaC: yay! 18:41 < McManiaC> yays for everyone! 18:41 < McManiaC> ;D 18:42 < stepcut`> HugoDaniel: I don't know what that happens. We lazily read the incoming network stream -- so perhaps we don't bother to read the end of the stream when we don't need it, and then the remote client closes the handle on us ? 18:43 < HugoDaniel> i dont know 18:43 < stepcut`> HugoDaniel: I have seen it too -- it bothers me, but it has never seemed to cause a real problem yet, so I have not looked into it 18:43 < HugoDaniel> but ill definetly look at this after im done with with the first version of this webapp 18:45 < stepcut`> k 18:45 < stepcut`> once I fix sendfile FreeBSD, I highly recommend upgrading and using plain old fileServe 18:50 < HugoDaniel> yes 19:06 < HugoDaniel> how do i serve all the subdirs except one ? (the one with the templates :P ) 19:06 < HugoDaniel> hmm 19:06 < HugoDaniel> ok 19:07 < stepcut`> one moment 19:08 < McManiaC> stepcut`: is there a directory listing function? 19:10 < stepcut`> McManiaC: no 19:10 < McManiaC> k 19:10 < stepcut`> McManiaC: it is going to be a bug for 0.5 though 19:10 < stepcut`> for someone looking for something easy to do 19:10 < McManiaC> when do you plan to release 0.5? ^^ 19:12 < stepcut`> when it's done 19:12 < McManiaC> ok 19:12 < HugoDaniel> :) 19:13 < McManiaC> because you always keep of talking about 0.5 I thought there might be something like a "release date" 19:13 < McManiaC> :) 19:13 < stepcut`> no, it's just that there is a release date for 0.4... hopefully tomorrow 19:14 < McManiaC> oh 0.4 isnt released yet? 19:14 < stepcut`> no 19:14 < McManiaC> i thought it was 19:14 < McManiaC> ok then it makes sense 19:14 < stepcut`> 0.4 is in RC1 status 19:14 < McManiaC> ah okay 19:15 < stepcut`> the sendfile+FreeBSD bug is the only blocker 19:15 < McManiaC> ok 19:15 < HugoDaniel> i can try to patch it over the weekend 19:15 < HugoDaniel> if there is nobody onto it already 19:19 < HugoDaniel> allright, i got the random session IDs workingggg :) 19:19 < stepcut`> I am trying to install ghc in FreeBSD in virtualbox right now 19:20 < stepcut`> my virtual disk might be too small though 19:20 < HugoDaniel> cd /usr/ports/lang/ghc 19:20 < HugoDaniel> make 19:20 < HugoDaniel> hmm 19:20 < HugoDaniel> pkg_add -r ghc 19:20 < stepcut`> yeah, I started that a while ago, it's still going 19:20 < HugoDaniel> oh, yes, it takes ages :( 19:20 < stepcut`> oh yeah, I probably should have done that :) 19:21 < stepcut`> fortunately, my desktop has 8-cores, so I don't even notice it going on in the background :p 19:21 < HugoDaniel> uau! 19:22 < HugoDaniel> you have 2 quad-cores ? 19:37 < stepcut`> yeah, macpro 19:51 < stepcut`> oh ... ghc built, now onto haskell platform 19:55 < HugoDaniel> ah 19:55 < HugoDaniel> haskell platform is ugly on servers 19:56 < HugoDaniel> it depends on too many stuff 20:01 < stepcut`> well, I disabled opengl 20:01 < stepcut`> I really just need cabal 20:01 < stepcut`> rather, cabal-install 20:05 < HugoDaniel> :) 20:06 < HugoDaniel> i find myself often installing the stuff i need "by hand" on the freebsd machines 20:11 < stepcut`> I often find myself not using FreeBSD :) 20:12 < gwern> I only use FreeBSD to patch KDE2 20:12 < stepcut`> I only use FreeBSD to patch sendfile :) 20:13 * McManiaC wants 2 quadcores too =( 20:13 < stepcut`> though my web host uses FreeBSD... but I am switching to an ubuntu based VPS so... 20:13 < McManiaC> my vserver has a double i7 975 cpu... its freakin fast 20:13 < stepcut`> McManiaC: spend all your money and you can have one too! 20:14 < McManiaC> stepcut`: need that money :) 20:14 < McManiaC> <- poor student 20:14 < McManiaC> and I wanna go to oslo/norway next year... gonna be expensiv :) 20:16 < McManiaC> (for one year...) 20:19 < HugoDaniel> ahh 20:19 < HugoDaniel> :) 20:19 < HugoDaniel> next year i want to go to 3 demoparties and CCC in december 20:20 < McManiaC> where were you from? 20:20 < HugoDaniel> im from portugal 20:21 < McManiaC> ah okay 20:21 < HugoDaniel> i recently found out about 3 other haskell coders in lisbon (the city im living at) 20:21 < HugoDaniel> it made me happy to know there are people coding in haskell here 20:22 < McManiaC> i got offered a student job at my university 20:22 < McManiaC> with haskell/ruby 20:22 < HugoDaniel> then go for it :) 20:22 < McManiaC> but had to turn it down since I already got a job and not sooo much spare time :) 20:22 < HugoDaniel> ah 20:49 < HugoDaniel> how do i check the POST from http ? 20:55 < stepcut`> HugoDaniel: what do you mean by 'check the POST' ? 20:56 < HugoDaniel> i have this form 20:56 < HugoDaniel> with some datra 20:56 < HugoDaniel> data 20:56 < HugoDaniel> in the html 20:56 < HugoDaniel> and it calls an action "/action" 20:57 < HugoDaniel> i want to be able to work out with it in happstack 20:58 < stepcut`> use withDataFn and the look* functions? 20:58 < HugoDaniel> allright :D 21:00 < HugoDaniel> too much coffee in my veins 21:04 < McManiaC> stepcut`: the new errorT instance is <3 21:06 < stepcut`> :) 21:06 < McManiaC> gonna post an old vs new compare 21:06 < McManiaC> gimme a minute *g* 21:09 < HugoDaniel> :) 21:13 < McManiaC> http://npaste.de/7o/ old 21:13 < McManiaC> http://npaste.de/7p/ new 21:13 < McManiaC> its not finished ("undefined") but I gotta go 21:13 < McManiaC> and I guess the point should be made :) 21:19 < McManiaC> and yes, thats the sourcecode of npaste.de :) 21:28 < McManiaC> well, ill call it a night, cya 21:28 < HugoDaniel> hasta McManiaC 21:28 < HugoDaniel> :) 21:28 < HugoDaniel> what about getData' ? 21:29 < HugoDaniel> like the happstack uses... 21:31 < HugoDaniel> happstack-tutorial (sorry) 21:36 < stepcut`> I couldn't remember if getData was in happstack 0.3 21:37 < HugoDaniel> it is 21:39 < HugoDaniel> http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=5365#a5365 21:40 < HugoDaniel> im using getData now 21:44 < HugoDaniel> i really dont understand this stuff 21:44 < HugoDaniel> :/ 21:45 < HugoDaniel> why isn't it part of ServerMonad IO ? 21:48 < HugoDaniel> fixed 21:48 < HugoDaniel> :) 21:49 < HugoDaniel> now im going to rock it! :D 21:55 < stepcut`> ServerMonad IO doesn't exist :) 21:56 < stepcut`> we should try to get oleg's html library on hackage so we can use it with happstack :) 21:56 < stepcut`> it actually looks quite usuable 21:56 < stepcut`> nice syntax 21:56 < HugoDaniel> oh, sweet 21:56 < HugoDaniel> :) 21:58 < HugoDaniel> im really enjoying happstack 21:58 < HugoDaniel> im thinking on maybe starting a package that builds on top of it 21:58 < stepcut`> what would the package do ? 21:59 < HugoDaniel> read a configuration file, and build simple modular websites 22:00 < stepcut`> neat 22:00 < HugoDaniel> also abstracting hdbc.mysql, .posgresql and macid seems atractive 22:00 < vowyer> is html generation still relevant today with ajax for frontend? I mean, I think of a webapp server as a json/xml interface to a dynamically generated frontend 22:00 < stepcut`> macid is nice because it doesn't require to install any database servers, etc. 22:00 < HugoDaniel> yes :) 22:01 < HugoDaniel> stepcut`: but sometimes sql is really necessary 22:01 < stepcut`> HugoDaniel: right 22:01 < HugoDaniel> i like happstack because it doesn't exclude sql 22:01 < stepcut`> HugoDaniel: right, and it never will 22:01 < HugoDaniel> ...zope, on the other hand, excludes sql, which is quite a pain 22:01 < stepcut`> vowyer: json/xml is useful too.. I am trying to figure out if there is a formlets like way to deal with ajaxy stuff 22:02 < stepcut`> cd 22:02 < HugoDaniel> i also would like the ability that happstack has to be on top of itself 22:02 < stepcut`> doh, was expecting focus-follows-mouse ;) 22:02 < HugoDaniel> because ServerPartT's are monoids 22:02 < stepcut`> :) 22:02 < HugoDaniel> so its really easy to build a happstack app on top of another happstack app 22:03 < HugoDaniel> which can really simplify tasks like the python "deliverance" project 22:03 < stepcut`> yes, though you still have other web issues to work about, like URL namespaces, CSS namespaces, combining html+css fragments together, etc. 22:03 < HugoDaniel> yes 22:04 < HugoDaniel> i see 22:04 < stepcut`> though a lot of that is policy stuff, or things not directly tied into happstack 22:04 < stepcut`> after all, happstack does not natively deal with CSS/HTML at all 22:05 < HugoDaniel> :) 22:05 < HugoDaniel> and that is nice 22:05 < stepcut`> though it does deal with URLs 22:05 < stepcut`> but, for handling URLs I actually use a third party URL library, so... 22:05 < vowyer> something like weblocks would be nice 22:05 < stepcut`> what is weblocks? 22:05 < vowyer> http://common-lisp.net/project/cl-weblocks/ 22:06 < stepcut`> ah 22:07 < vowyer> or like the google toolkit for java, that generates widgets... or wt for c++ 22:07 < stepcut`> continuation based web apps sound good, but I have not seen a good implementation in haskell yet :-/ 22:09 < vowyer> how space efficient is macid, or more generally haskell? 22:09 < stepcut`> space efficient in what sense? 22:10 < vowyer> storing data in memory 22:10 < stepcut`> it depends on your data structures. The data stored in memory by macid is just an arbitrary Haskell value 22:11 < stepcut`> some haskell datatypes are very compact, others are not 22:11 < vowyer> so it makes sense to use only bytestrings instead of strings? 22:11 < stepcut`> vowyer: well, you should use Text instead of Strings 22:12 < vowyer> haven't heard of it until now :S 22:12 < stepcut`> Text is somewhat new -- it is real unicode strings, but compact like bytestring 22:12 < HugoDaniel> :) 22:13 < stepcut`> you need some syb-with-class instances to use it with happstack. I will be adding those to happstack-data after 0.4 is out 22:13 < stepcut`> or maybe I should add them for 0.4.. they are quite useful and shouldn't not destabilize anything. 22:15 < HugoDaniel> :) 22:15 < HugoDaniel> are there any benchmarks of happstack ? 22:15 < HugoDaniel> comparing it with other appservers and apache ? 22:25 < vowyer> how can you group a set of related updates, like in a transaction? 22:27 < stepcut`> vowyer: you put them all in the same update function 22:27 < stepcut`> HugoDaniel: no 22:27 < HugoDaniel> HTTP request failed with: : hLookAhead: resource vanished (Connection reset by peer) 22:27 < HugoDaniel> Segmentation fault 22:27 < vowyer> thanks, I suspected it, but wasn't sure 22:27 < HugoDaniel> now thats... something odd... 22:27 < stepcut`> HugoDaniel: the segfault is no good :) 22:28 < HugoDaniel> all because i changed the template while making some requests to the page :P 22:28 < stepcut`> HugoDaniel: :-/ 22:28 < stepcut`> HugoDaniel: what template library? 22:28 < HugoDaniel> hstringtemplate 22:28 < stepcut`> ok... do you think it is a bug in hstringtemplate then? 22:28 < HugoDaniel> im not sure :/ 22:28 < HugoDaniel> i wish i had a core dump for this 22:29 < HugoDaniel> anyway the segfault was in ghci 22:29 < stepcut`> the happstack libraries themselves do not segfault as far as I know.. so I am suspecting it is hstringtemplate or something else you imported. Or bad RAM in your computer :) 22:29 < HugoDaniel> im not sure why was this 22:30 < HugoDaniel> ...i was making changes to the css and to the template, and refreshing it 22:30 < HugoDaniel> then i suddenly lost the css, because the page happstack was displaying showed up without any style 22:30 < stepcut`> I don't use hstringtemplate, so I am not sure if that would cause a problem like that 22:30 < HugoDaniel> ...then i changed the template 22:30 < HugoDaniel> ...and it segfaulted 22:30 < HugoDaniel> on the next refresh 22:30 < stepcut`> hmm 22:31 < HugoDaniel> im not able to replicate it 22:31 < stepcut`> are you still on 0.3? 22:31 < HugoDaniel> yes 22:31 < stepcut`> ok, I won't be concerned until you can duplicate it in 0.4 22:31 < HugoDaniel> yes 22:31 < HugoDaniel> ill not try it now, because im short on time 22:31 < vowyer> what's new for 0.4? 22:31 < stepcut`> I have used 0.4 extensively and not had issues 22:32 < stepcut`> vowyer: the biggest thing is sendfile() support in fileServe. But tons of other improvements as well 22:32 < stepcut`> vowyer: I will know more when I write some release notes :) 22:33 < stepcut`> vowyer: but I think there were more than 100 darcs commits since 0.3 22:33 < vowyer> stepcut`: any industrial class app being developed you know of? 22:38 < HugoDaniel> how do i work with sessions in happstack ? 22:38 < stepcut`> HugoDaniel: however you want 22:38 < HugoDaniel> hmm, whats the "prefered way" ? 22:39 < stepcut`> HugoDaniel: happstack does not provide any session support, the 'prefered way' has not been established yet 22:39 < stepcut`> HugoDaniel: depends on whether you want 'stateless' sessions among other things 22:39 < HugoDaniel> hmm 22:39 < HugoDaniel> right now i need state 22:39 < stepcut`> HugoDaniel: what do you need a session to do ? 22:40 < HugoDaniel> store a session id, and some other databases id's 22:40 < HugoDaniel> hmm 22:40 < stepcut`> can you just give the user a cookie with a sessionid in it ? 22:40 < HugoDaniel> yes 22:40 < HugoDaniel> that would be fine 22:41 < stepcut`> look at addCookie and mkCookie 22:41 < HugoDaniel> okey, nice 22:43 < stepcut`> and lookCookie 22:43 < stepcut`> basically, 22:43 < HugoDaniel> thats all ill need 22:43 < stepcut`> addCookie (-1) (mkCookie "sessionId" sessionId) 22:43 < HugoDaniel> if there is no cookie support ill just try to pass session state in the html source code that is generated 22:43 < HugoDaniel> im not sure if that'll raise a security issue, but its way too late for me to think about that :) 22:43 < stepcut`> and in your withData/getData thing do, lookCookieValue "sessionId" (or readCookieValue "sessionId" if it is an instance of Read) 22:43 < HugoDaniel> nice nice 22:44 < HugoDaniel> if you stick around for the next one and half hour, ill show you what ive been working on 22:44 < HugoDaniel> its a simple form 22:44 < stepcut`> I forget the trick for expiring a cookie. There is no way to delete it, but you can replace it with empty data basically. 22:44 < HugoDaniel> yes 22:44 < stepcut`> I think there is possibly something slight unobvious you have to do though 22:45 < stepcut`> I am getting in bed now, but I'll take a look at it in the morning 22:45 < HugoDaniel> okey 22:45 < HugoDaniel> thanks for all the help 22:46 < stepcut`> I have to wonder if a lot of the 'session' stuff in PHP is to get around the fact that it is a pain to query the database, so they want to cache the values in an easier to access environment ? 22:46 < HugoDaniel> probably yes 22:47 < HugoDaniel> its easier to have the values in a distance of an array access 22:47 < stepcut`> though, there are other useful things like make the data temporary, and making sessions expire 22:47 < HugoDaniel> yes 22:47 < HugoDaniel> my sessions expire 22:48 < HugoDaniel> i always do the database interface in stored procedures 22:48 < HugoDaniel> and the user that the webapp runs only has permission to "execute", it has no "read" or "write" permission 22:48 < HugoDaniel> it can only execute stored procedures 22:48 < stepcut`> yeah 22:48 < HugoDaniel> ...it lets me sleep better at night 22:48 < stepcut`> :) 22:48 < HugoDaniel> so, i just keep a timestamp for each session in the table 22:49 < HugoDaniel> that gets updated on every action 22:49 < stepcut`> yeah 22:49 < stepcut`> I have been experimenting with a stateless method where you store things like that in the cookies 22:50 < HugoDaniel> stateless is the way to go 22:50 < stepcut`> one of the cookie values is a signature. If the user tries to change the values, the signature will fail. 22:51 < stepcut`> basically I concat all the values, plus a secret value they don't know, and then take the SHA1 sum. 22:52 < stepcut`> not sure it is truely cryptographically sound, but something to that effect should work 22:52 < HugoDaniel> seems like a smart thing to do 22:53 < HugoDaniel> digitally sign all the cookies 22:53 < HugoDaniel> yes 22:57 < stepcut`> I can also add an ?authkey=...., value to a restricted access url. By just looking at the cookies, the authkey, and the signature, I can tell if I generated that URL for them or not, with out having to look in the database and check if they have access. 23:03 < stepcut`> ok, time for cake and sleep! 23:14 < HugoDaniel> hasta, thanks :) --- Log closed Fri Dec 18 00:00:43 2009