04:41:57 <_MAN_> I need some counseling, badly :)
04:42:07 <_MAN_> would anybody care to answer a question?
04:44:49 <stepkut> _MAN_: happstack related ?
04:45:00 <stepkut> _MAN_: for personal life, you should try #haskell-blah :p
04:45:25 <_MAN_> ha! I thought I should have clarified!
04:45:34 <_MAN_> stepkut: yes, happs related.
04:45:49 <stepkut> _MAN_: what is your question ?
04:46:50 <_MAN_> I've used a simple javascript framework to build a simple webpage. If accessed as a file, the home loads well, and animates... if served through simpleHTTP it doesn't :S
04:47:24 <_MAN_> When using happstack to serve the index.html only the css is loaded, but the js scripts will not fire up...
04:47:26 <stepkut> you are trying to serve .js files using serveDirectory ?
04:47:29 <_MAN_> I'm puzzled
04:47:38 <_MAN_> stepkut: yes...
04:48:08 <stepkut> _MAN_: and the javascript is in separate .js files?
04:48:18 <_MAN_> stepkut: that's right.
04:48:52 <_MAN_> stepkut: I don't wanna write all that code (again). So I thouth of using a javascript framework, and generate the html with blaze.
04:49:04 <stepkut> _MAN_: what happens if you point the browser directly at the .js file? Can you see the contents ?
04:49:14 <_MAN_> let's see.
04:49:42 <_MAN_> stepkut: yes, I can.
04:50:19 <stepkut> so, in the html, what does the <script> tag look like that imports the .js file?
04:51:28 <_MAN_> Like this: <script type="text/javascript" src="js/main.js"></script>
04:52:14 <stepkut> would, src="/js/main.js" be more sensible ?
04:52:33 <stepkut> an absolute path instead of a relative path?
04:52:38 <_MAN_> I just copied the way the framework imports it.
04:52:48 <_MAN_> let's give it a try...
04:53:56 <_MAN_> no luck.
04:54:15 <stepkut> when you accessed main.js directly in the browser, what url did you use?
04:54:39 <_MAN_> The weird thing is: If a capture the html file generated by the blaze code, and feed it to the browser (offline), it loads fine :S
04:55:30 <stepkut> also, what version of happstack are you using?
04:55:41 <_MAN_> stepkut: happstack 0.6.
04:56:04 <stepkut> 6.0
04:56:39 <_MAN_> stepkut: I'm embarrased to say I cannot see the main.js file served. I was mistaken.
04:56:56 <stepkut> oh
04:57:04 <stepkut> so, let's fix that!
04:57:10 <_MAN_> stepkut: If I point to http://localhost:8000/js/main.js I don't see it.
04:57:12 <stepkut> ok
04:57:14 <_MAN_> stepkut: cool! how?
04:57:26 <stepkut> so, where is the code that you think would serve files from the js directory?
04:58:10 <_MAN_> The Main.hs is "." and the .js files in "./js"
04:58:23 <stepkut> k
04:59:23 <stepkut> what is the line of code that calls serveDirectory ?
05:00:28 <_MAN_> stepkut: methodSP GET $ serveDirectory EnableBrowsing ["index.html"] "."
05:00:47 <stepkut> let me check something
05:02:20 <stepkut> ACTION ponders
05:02:34 <stepkut> oh
05:03:44 <stepkut> methodSP GET also checks that there are no remaining path segments
05:04:01 <stepkut> you need, methodOnly GET >> serveDirectory EnableBrowsing ["index.html"] "."
05:04:02 <_MAN_> stepkut: yes... I read about it.
05:04:27 <_MAN_> stepkut: you mean methodSP is killing the js and css directories?
05:04:36 <stepkut> right
05:05:00 <stepkut> it checks and sees that js/main.js has not been 'consumed' yet, so it calls mzero
05:05:12 <_MAN_> hit !
05:05:19 <_MAN_> stepkut: you were right, mate!
05:05:38 <_MAN_> thanks, stepkut. You've been very helpfull.
05:05:50 <stepkut> personally I am not thrill by that behaviour -- but changing it would break things in subtle ways so I am hestintant to change it
05:06:15 <stepkut> wow
05:06:18 <stepkut> butchered that word
05:06:28 <_MAN_> lol
05:06:33 <stepkut> hesitant
05:06:43 <_MAN_> stepkut: I understand. Happstack has come a long way.
05:06:55 <stepkut> thanks!
05:07:04 <_MAN_> stepkut: btw, I heard you're working on an authentication module?
05:07:07 <stepkut> yep
05:07:27 <stepkut> hopefully more quickly now that happstack 6 is wrapping up
05:08:14 <_MAN_> stepkut: I'll be waiting for news, since happstack-auth is not available for 6.0
05:09:26 <stepkut> _MAN_: hmm, you should pester McManiaC(?) about that. I am pretty it already had support for 0.5.1, and not much has changed API wise since that support was added. So 6.0 support should be easy
05:10:34 <_MAN_> stepkut: McManiaC, huh? I'll keep that in mind.
05:11:19 <stepkut> yeah, https://github.com/mcmaniac/happstack-auth
05:12:25 <stepkut> it is possible you just need to bump the version numbers in the .cabal file and it will work
05:12:43 <_MAN_> stepkut: you know, I hadn't try that?!
05:12:46 <stepkut> :p
06:16:49 <_MAN_> stepkut: can you spare a couple more minutes, please?
06:17:19 <_MAN_> stepkut: I've been experimenting with your advice and found myself another problem.
11:27:35 <McManiaC> gah
11:27:42 <McManiaC> I'm a bad package manager :(
11:27:55 <HugoDaniel> hmm
11:29:59 <McManiaC> I'm a bad package manager :(
11:30:01 <McManiaC> ups
11:30:01 <McManiaC> :D
11:31:29 <McManiaC> almost all my haskell hacking is currently related to GHC, so I didn't think about happstack-auth when I read about happstack 6.0 comming out… I'll update that version number asap
11:43:14 <HugoDaniel> related to ghc ?
11:43:49 <McManiaC> working on an extension :)
11:48:34 <McManiaC> http://hackage.haskell.org/trac/ghc/ticket/4370
12:05:50 <McManiaC> stepkut: btw, why did you drop the 0. version number? ^^
12:11:35 <McManiaC> ok, I pushed mtl from 1.* to 2.*, happstack* from 0.5.* to 6.*
12:11:51 <McManiaC> http://hackage.haskell.org/package/happstack-auth <- anything else which is out of date?
13:25:29 <HugoDaniel> McManiaC, stepcut is working on a newer authenticate
13:25:36 <HugoDaniel> something with steroids and a poney i believe
13:43:21 <McManiaC> :O
18:56:31 <MAN> McManiaC: are you available? I'd like to ask you something about happstack-auth's latest update.
18:57:05 <stepkut> MAN: you had some other questions for me ?
18:58:09 <MAN> stepkut: yesterday, yes. Good memory. Right before my system crashed and burned, I could solve the problem.
18:58:31 <stepkut> hehe
18:58:31 <stepkut> nice
18:58:33 <MAN> stepkut: it was about serving the .js files. Simpler than I thought
18:58:40 <stepkut> nice
18:58:51 <stepkut> better than being more complex than you thought
18:59:27 <MAN> stepkut: true. btw, McManiaC did update the happstack-auth library to work with happstack 6.0, today :D
19:00:17 <MAN> I keeps telling me to clear my (unexisting) expired sessions, but now at least I can build my programs.
19:01:06 <stepkut> cool
19:01:34 <MAN> stepkut: Yes, talk about prompt response.
19:02:05 <Entroacceptor> do you really call it 6.0?
19:03:29 <MAN> Entroacceptor: I'm just running along, really :P Saw the 0.6, but was corrected.
19:08:19 <stepkut> Entroacceptor: yes, it is really 6.0. That is because the PVP says that we have to bump to 6.1 if we change the API. So, now we can work on 7.x but still make improvements (bug fixes) to 6.x that break the API.
19:08:38 <stepkut> Entroacceptor: also, happs/happstack has been around since 2004 -- we deserve a bigger version number ;)
19:08:57 <Entroacceptor> :)
19:10:23 <MAN> Got it! I hadn't added the AuthState Dependency to my state data type. Happstack is great!
19:10:49 <stepkut> MAN: ah.. I am hoping we will be able to catch that better in happstack 7 (aka, at compile time)
19:11:57 <stepkut> Entroacceptor: I am also planning to make more frequent releases
19:11:59 <MAN> stepkut: It'd be really cool. I am (as, I suspect, many others) relying more and more in ghc.
19:12:31 <stepkut> Entroacceptor: so, the 7 release might actually come fairly soon, but with more releases in the 7.x line.
19:12:52 <stepkut> MAN: ghc is pretty much all I use :)
19:13:44 <Entroacceptor> stepkut: sounds complicated
19:13:46 <Entroacceptor> :)
19:14:13 <mightybyte> stepkut: You're going to have sharding implemented for a soon release of 7?
19:17:37 <stepkut> mightybyte: not right away.. the main focus at first will be the kdtree replacement for IxSet (similar functionality, but less RAM and CPU usage). Then I am going to look at making versions of update/query which take the handle that 'startSystemState' returns. Ideally this should provide more type safety, and allow you to use multiple independent MACID databases in the same application. Then after that, sharding is a likely candidate
19:22:12 <mightybyte> Ahh, so a series of 7.x releases?
19:23:04 <stepkut> mightybyte: yeah. those features are fairly independent of each other, so no reason to hold them back
19:25:19 <mightybyte> Cool
19:25:39 <mightybyte> I'll be interested to see how the new ixset performs.
19:26:15 <stepkut> so far it does well -- less RAM and CPU than IxSet and scales to multicore queries well
19:26:40 <stepkut> for example, a lookup can use multiple cores
19:27:13 <stepkut> inserts/updates should also be a lot faster
19:27:41 <stepkut> 7 will have more performance testing of MACID with pretty graphs and numbers
19:27:59 <mightybyte> Nice
19:28:05 <stepkut> and sharding
19:28:09 <stepkut> eventually :)
19:28:17 <stepkut> though, sooner is better
19:39:09 <Entroacceptor> what is ixset  btw?
19:40:05 <stepkut> Entroacceptor: IxSet is a set that allows you to look up values using multiple indices.
19:40:27 <stepkut> Entroacceptor: a bit like Data.Map, except you can have more than one key
19:40:43 <stepkut> Entroacceptor: also similar to a table in a SQL database
19:41:36 <Entroacceptor> ah
19:41:55 <stepkut> Entroacceptor: it's a very useful type .. odd that it does not exist anywhere in haskell-land as far as I can tell
19:42:42 <stepkut> Entroacceptor: it is very useful when using MACID
19:42:52 <Entroacceptor> yes, I guess so
19:45:09 <Entroacceptor> and -darcs will be what?
19:45:42 <stepkut> ?
19:45:55 <Entroacceptor> the latest "stable" (6.xx) or dev (7.x)?
19:46:18 <stepkut> darcs is always the dev branch
19:46:26 <stepkut> there is a happstack-stable branch on patch-tag as well
19:46:53 <stepkut> but the version number in darcs will not be bumped to 7.x quite yet I think
19:47:52 <stepkut> the kdtree stuff is happening in a different repo, so I am going to leave the main darcs branch at 6.x for a little bit, because it will make it easier to put out bug fixes for 6.x
19:52:55 <Entroacceptor> *sigh*
19:53:03 <Entroacceptor> and yet again dependency troubles
19:53:16 <stepkut> dependencies suck
19:55:40 <Entroacceptor> cabal needs a "just see if this works" option
19:56:52 <stepkut> heh
20:01:10 <Entroacceptor> or at least an "I give up" option which does rm -rf ~/.ghci automatically
20:01:41 <stepkut> haha
20:17:17 <stepkut> jaspervdj: have you looked into using select with the 'multiple' option (to allow multiple fields to be selected) with digestive-functors ?
20:17:55 <stepkut> jaspervdj: i am going to try to implement inputChoices (plural)
20:21:05 <stepkut> jaspervdj: but I think it is tricky
20:24:01 <stepkut> jaspervdj: in fact, I think inputChoices is broken as well :p
20:29:54 <stepkut> ACTION cries about git some more
21:50:24 <jaspervdj> stepkut: no, haven't tried it, sounds interesting though
22:15:16 <astroboy> stepkut: is there any docs on how to use web-routes with happstack?
22:15:31 <stepcut> astroboy: not yet, on the to-do list
22:16:41 <astroboy> stepcut: uh ok, I'll look into the api then
22:16:52 <astroboy> stepcut: or maybe I'll use simple string urls
22:17:59 <stepcut> yeah.. I need to document web-routes better.. trying to think if there is an example out there thatwould be good to look at
22:38:42 <astroboy> stepcut: that would be great
22:41:31 <astroboy> stepcut: also, how would you keep a template context?
22:41:52 <astroboy> I'm thinking of a reader monad but maybe there is something already
22:42:08 <stepkut> what do you mean by a template context ?
22:42:24 <astroboy> I mean i'm thinking of a "renderTemplate :: Template -> ServerPart Response" that runs the reader monad with the template
22:42:38 <astroboy> stepkut: I need to pass some variable to templates
22:42:58 <astroboy> the thing is that I've got a simple template inheritance
22:44:00 <stepkut> Usually I just make the variables be arguments to the template functions... foo arg1 arg2 = <p><% arg1 %><% arg2 %></p>
22:44:24 <stepkut> I am not sure I understand what you are trying to do though
22:45:00 <astroboy> stepkut: ok right now I've got this: https://github.com/rostayob/hsnews/blob/master/src/Templates.hs
22:45:16 <astroboy> now
22:45:29 <astroboy> I want to pass the User data (if any) to baseTemplate
22:45:32 <astroboy> so a "Maybe User"
22:45:40 <astroboy> but I'm never calling baseTemplate
22:45:55 <astroboy> hence, I was thinking of a reader monad
22:46:24 <stepkut> do different templates have different arguments?
22:47:49 <astroboy> stepkut: well yes
22:48:10 <astroboy> I also tought of baseTemplate having "Maybe User" as last argument
22:48:23 <astroboy> and simply calling it partially
22:48:45 <astroboy> but I don't want to have Maybe User in all the type signatures
22:48:48 <stepkut> if the template have different arguments, then how would you know what type to make the Reader monad contain?
22:49:55 <astroboy> stepkut: no no wait, the context would always be the same
22:50:00 <astroboy> I mean I would have a datatype
22:50:03 <astroboy> with the data
22:50:12 <astroboy> but they could have different arguments
22:50:24 <astroboy> for data relative to just that template
22:51:50 <stepkut> so the reader monad would have some data-type that holds values where are always available to all templates (like the Maybe User), but individual templates would also have normal function arguments for data they need that is specific to that template ?
22:52:18 <astroboy> stepkut: yes
22:52:29 <stepkut> that sounds reasonable -- I do that in my code
22:52:39 <stepkut> using the reader monad
22:53:51 <stepkut> it's too bad that HtmlM is not a monad transformer -- if it was you could do, HtmlM (Reader MyConfig) a, and then you could use 'ask' inline in your templates
22:54:16 <astroboy> stepkut: yes
22:54:25 <astroboy> stepkut: do hsp do that?
22:54:31 <stepkut> yep
22:54:44 <stepkut> well, hsp does it a little weirder
22:55:06 <astroboy> mh then I might consider it. is the "syntax" as nice as blaze?
22:55:21 <stepkut> depends if you like xml or not
22:55:24 <stepkut> one moment
22:55:41 <astroboy> well I'd prefer it to be all hs
22:56:14 <stepkut> depends on what you mean by 'all hs'
22:56:29 <astroboy> I mean all haskell code, no mixed html/haskell or stuff like that
22:56:57 <stepkut> http://patch-tag.com/r/mae/happstack/snapshot/current/content/pretty/happstack/templates/project/src/Pages/GuestBookEntries.hs
22:57:19 <stepkut> that is what it looks like
22:58:01 <astroboy> oh god that's exactly what I don't want
22:58:05 <stepkut> it's real haskell with a syntax extension.., so <div> get transformed to asChild "div" (...)
22:58:28 <stepkut> astroboy: there is also an option to use a blaze-like library with HSP, but I have never used it
22:58:51 <astroboy> yeah but It's always a pain to work with stuff like that... I like blaze because it's haskell in the sense that it looks like it
22:59:00 <stepkut> yep
22:59:16 <astroboy> I think I'll do my rendering funcion
22:59:17 <stepkut> blaze is a fine choice
22:59:22 <astroboy> *function
22:59:34 <astroboy> that gets what it needs from the http request and starts the reader monad
22:59:43 <astroboy> btw
22:59:52 <astroboy> is it bad in some way to call decodeBody multiple times?
23:00:10 <stepkut> so, you want, baseTemplate :: Text -> H.Html -> Reader TemplateData H.Html, i think
23:00:27 <stepkut> not really. Calling it a second time has no effect
23:00:48 <stepkut> only the first call does anything
23:01:04 <astroboy> ok
23:01:16 <astroboy> I mean just to be safe I'm putting it whenever it's needed
23:01:47 <stepkut> the problem with that is it makes it harder to change the quota or tmp file location if you have to update a lot of places
23:02:10 <stepkut> the upside is that you can different quota values for different API calls if you want
23:02:14 <stepkut> that is the tradeoff
23:02:37 <stepkut> hmm
23:02:51 <stepkut> perhaps I should have added a field to Conf that calls decodeBody by default
23:03:01 <astroboy> definitely
23:03:22 <astroboy> I mean, 90% of dynamic websites check a cookie at each request anyway
23:04:17 <stepkut> checking a cookie does not require decoding the request body
23:04:23 <stepkut> only if POST/PUT requestst
23:05:09 <astroboy> oh really?
23:05:23 <astroboy> oh then it's less necessary i guess...
23:05:23 <stepkut> yeah
23:05:31 <stepkut> cookies are in the request headers
23:06:08 <astroboy> oh right
23:07:50 <astroboy> the hacker news clone is going well
23:08:02 <astroboy> i'm still tweaking the user system
23:08:17 <stepkut> moved on from reddit to hackernews already?
23:08:19 <astroboy> I just have to write a user cp to change password and I'm done more or less
23:08:22 <astroboy> ah yes
23:08:37 <astroboy> but I'm afraid is too much for a tutorial
23:08:38 <stepkut> nice
23:08:47 <astroboy> I mean I had to make my own Auth & Session
23:08:50 <stepkut> :)
23:09:00 <stepkut> still, it is something for people to look at
23:09:13 <astroboy> actually I'm quite happy with the user system
23:09:33 <stepkut> tutorials often leave too much out -- people want to see a fully working thing sometimes
23:10:00 <stepkut> my auth/user system is still eeking along
23:10:08 <astroboy> my auth system is really simple
23:10:10 <astroboy> I have ranks
23:10:13 <astroboy> and a function
23:10:23 <astroboy> "requireRank :: UserRank -> ServerPart Response -> ServerPart Response"
23:10:34 <astroboy> if the user is not logged in
23:10:37 <astroboy> it redirects to the login page
23:10:44 <astroboy> and then if the user logs in
23:10:50 <astroboy> redirects back to the requested page
23:10:58 <astroboy> if the user is logged in but he doesn't have the required rank
23:11:00 <astroboy> it gives 403
23:11:06 <stepkut> yeah, I have something similar
23:11:10 <astroboy> otherwise it displays
23:11:23 <astroboy> I could have better permissions easily but I don't need them
23:11:38 <astroboy> In fact I don't think I'll ever have more than three ranks
23:11:45 <stepkut> cool
23:11:47 <astroboy> something like Admin, Moderator, User
23:12:00 <stepkut> yeah, that is what I have :)
23:12:00 <astroboy> anyway back to study, circuits and stuff
23:12:10 <stepkut> V = IR
23:12:16 <astroboy> ehe
23:12:37 <stepkut> I got a really good book on circuits for $0.50 at the library sale :)
23:13:11 <astroboy> stepkut: well actually it's computer architecture
23:13:22 <stepkut> oh, I got a good book on that too
23:13:23 <astroboy> this http://www.amazon.co.uk/Computer-Organization-Design-Hardware-Interface/dp/155860491X
23:13:30 <astroboy> but the new version lol
23:13:46 <astroboy> this: http://www.amazon.com/Computer-Organization-Design-Fourth-Architecture/dp/0123744938
23:13:54 <stepkut> I got the old version
23:14:19 <astroboy> I don't like arch to much anyway
23:14:36 <astroboy> I like the big white book more (:
23:14:37 <stepkut> i have the second edition
23:15:26 <astroboy> of clrs? i have the third eheh
23:15:42 <astroboy> this is cool as well http://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504/ref=sr_1_1?s=books&ie=UTF8&qid=1298416531&sr=1-1
23:16:05 <stepkut> the 2nd edition of computer organization and design
23:16:28 <astroboy> ah