Experimental IRC log happs-2008-02-27

Available formats: content-negotiated html turtle (see SIOC for the vocabulary)

Back to channel and daily index: content-negotiated html turtle

These logs are provided as an experiment in indexing discussions using IRCHub.py, Irc2RDF.hs, and SIOC.

01:41:15<dufflebunk>happs.com is giving a 502 now. I guess that's better than 2 days ago when I wasn't getting a response at all.
01:41:20<dufflebunk>oops, happs.org
02:13:44<porrifolius>What's the mechanism for getting fields from a request? Is there some way to make FromData instances for use with withData?
02:17:21<porrifolius>fromData doesn't get applied to a FromData instance so it looks like withData is only good for extracting whole types, not arbitrarily named fields.
02:25:28<porrifolius>hmmm, is writing a utility function fieldByName :: String -> RqData String and then using withDataFN (fieldByName "username") (\un -> ...) the right course of action?
02:45:35<mightybyte>The 4th installment of my HAppS tutorial is now available.
02:45:40<mightybyte>http://softwaresimply.blogspot.com/2008/02/finished-happs-application.html
02:56:01<porrifolius>mightybyte: I've had a quick skim. Very timely... looks like it answers my recent questions. Thanks for your efforts.
03:04:39<mightybyte>You're welcome. Thanks for the feedback. Let me know if you spot any mistakes or improvements I could make.
03:07:18<mightybyte>I've gotten all that from reading the source code and grilling Lemmih, so I figured I might be able to save him (and other people) some time. :)
04:31:36<porrifolius>mightybyte: I won't comment on the HAppS stuff, looks good to me! ;)
04:31:55<porrifolius>Otherwise, wearing a HTTP pedant's hat, perhaps responding with 404 or 201 or whatever in appropriate places rather than 200 all the time.
04:32:10<porrifolius>And I'm not sure of the utility of `mplus`ing the passwords, eg you could accidentally sign up with "password2"... ahhh, hang-on, do you do that so that the handler matches and you don't fall through?
04:32:52<porrifolius>Anyway, very minor points that don't reduce the utility of your tutorial at all.
04:40:01<porrifolius>mightybyte: A question on checkAndAdd if I may?
04:41:20<porrifolius>You query IsUser user and then update AddUser. If I understand HAppS transactions correctly these to operations are transactionally distinct, even though they are operating on the same component. So there is a window, albeit small, between the two where another transaction could occur, so there is a chance that the update AddUser will overwrite an existing user. Is that correct?
05:41:43<kristofer>hi.. is happs.org going to be back anytime soon?
11:13:30<mightybyte>@bot
11:15:19<mightybyte>porrifolius: You may be right about the loss of atomicity in checkAndAdd. I hadn't thought about that. Although I don't know enough to say for sure. Anyone else know about this?
17:35:46<mightybyte>Has anyone tried the code in my tutorials with the 0.9.2 release? I can't get it from happs.org right now to try it.
17:39:43<Saizan>it's on hackage
17:42:17<mightybyte>Oh, ok.
18:40:40<dbpatterson>mightybyte: thanks for the (now completed) tutorial - it is awesome - but could you post all the code together ? possibly another blog post, just as text (not literate haskell)? I'm working at adapting it to my needs, but it would be a lot easier to have a concrete full working starting point
19:04:23<mightybyte>dbpatterson: Sure, I could do that. I was thinking about putting a link to a tar with all the code, but I haven't found a way to just upload files to blogger.
19:10:34<perspectivet>mightybyte: yeah, saw the tutorial. excellent stuff.
20:04:59<dbpatterson>mightybyte: sounds great...
20:11:16<Saizan>mmh, where is it?
20:12:29<perspectivet>Saizan: this? http://softwaresimply.blogspot.com/2008/02/finished-happs-application.html
20:13:19<Saizan>yeah
20:14:40<perspectivet>Saizan: what's the deal with happs.org. Seems like a bad time for it to go offline given the 0.9.2 release and a bit of buzz on reddit from mightybyte's happs blog
20:17:22<Saizan>i don't know the details either
20:17:35<Saizan>fortunately the tarballs are on hackage
20:26:48<dbpatterson>mightybyte: another idea - since there are only two files, correct (main and session), you could put them on hpaste...
20:26:57<dbpatterson>that would give syntax highlighting as well...
21:19:42<mightybyte>dbpatterson: Yeah, hpaste would be perfect. (It doesn't look like allows you to upload plain files.)
21:20:22<dbpatterson>mightybyte: I'm hpasting now...
21:20:34<dbpatterson>had to add one thing - there is no reference to the form that posts to newuser...
21:20:41<dbpatterson>(just made a newuser.html...)
21:21:57<mightybyte>Oh, I had them both in the login.html file.
21:22:02<dbpatterson>hmm... the 5k limit is troubling...
21:22:32<mightybyte>Let me see how much it all comes to.
21:22:58<mightybyte>Oh, one other thing. Porrifolius mentioned a possible problem with the checkAndAdd method earlier.
21:23:00<dbpatterson>if Main and Session are seperate it should be fine, I think...
21:23:08<mightybyte>He said...
21:23:32<mightybyte>"You query IsUser user and then update AddUser. If I understand HAppS transactions correctly these to operations are transactionally distinct, even though they are operating on the same component. So there is a window, albeit small, between the two where another transaction could occur, so there is a chance that the update AddUser will overwrite an existing user. Is that correct?"
21:24:03<mightybyte>That sounds right to me. I just wanted to check and make sure before I post a fix.
21:24:43<dbpatterson>that is very possible...
21:25:05<dbpatterson>not a huge deal for me personally (generally I'm working on things with very limited logged in userbase)
21:25:08<mightybyte>Can anyone else verify that?
21:25:29<dbpatterson>does happs have any way to put things into the same transaction?
21:25:34<mightybyte>True, but the point of HAppS is to be very scalable, so I should point it out if it is indeed the case.
21:25:40<dbpatterson>oh, definitely...
21:25:59<mightybyte>The only thing I can assume as that each call to query or update is a transaction.
21:26:05<dbpatterson>hmm.. I'm not sure what is up with hpaste... Main.hs is 2.6k for hme, but it is truncating
21:26:35<dbpatterson>too bad, the highlighting is pretty
21:31:22<dbpatterson>mightybyte: can I ask you, what would the type of length listUsers be?
21:31:39<mightybyte>I've got ~2600 bytes for Main, ~2800 for Session, and ~700 for login.html
21:32:20<mightybyte>istUsers :: (Control.Monad.Reader.Class.MonadReader State m) => m [String]
21:33:17<dbpatterson>yeah, I wanted to get the length , but MonadReader m => m Int isnt valid
21:34:00<mightybyte>Oh, would you have to do "liftM length listUsers"?
21:34:44<mightybyte>Nope, that doesn't seem to work.
21:37:20<mightybyte>You could do it the same way numSessions is done.
21:37:36<dbpatterson>hmm, this compiles
21:37:36<dbpatterson>numUsers :: MonadReader State m => m Int
21:37:40<dbpatterson>numUsers = liftM length listUsers
21:37:44<dbpatterson>so presumably works
21:38:04<mightybyte>Ok. I was doing it in ghci, so that was probably my problem.
21:38:11<dbpatterson>I was doing do users <- listUsers length users
21:38:18<dbpatterson>which doesnt work..
21:40:36<mightybyte>http://hpaste.org/5957 looks like it has Session.hs
21:41:55<mightybyte>http://hpaste.org/5958 for Main.hs
21:42:29<dbpatterson>very nice... putting those on the blog would be awesome
21:43:33<mightybyte>doing that now....
21:47:53<mightybyte>Ok, links are up.
21:49:02<Saizan>mightybyte: yup, each update/query is a distinct transaction
21:49:44<mightybyte>Saizan: Ok, so I need to modify addUser to include the check for an existing user.
21:50:11<mightybyte>Maybe I'll make that a separate post.
21:50:23<mightybyte>More chances for publicity. :)
21:51:32<dbpatterson>can someone briefly explain what exactly mkMethods is doing?
21:51:39<dbpatterson>from what I understand from reading the code
21:51:54<dbpatterson>it creates datatypes that you call with query or update
21:52:05<dbpatterson>instead of using them directly
21:52:16<dbpatterson>is that a functional (as in, valid enough) understanding?
21:52:33<mightybyte>That's about the sum of my understanding.
21:53:14<mightybyte>Lemmih did say something about the function name and arguments being the things that were written to disk for the transaction log.
21:53:38<mightybyte>Don't know if that improves your understanding any. I still don't know all the details.
21:54:26<Lemmih>dbpatterson: Correct.
21:56:27<mightybyte>Is it necessary to understand more about what goes on under the hood?
21:57:16<Lemmih>It shouldn't be.
21:58:57<dbpatterson>okay, sounds good
21:59:08<mightybyte>Lemmih: Have you looked at my tutorial?
21:59:36<dbpatterson>Lemmih: question, I saw another haskell web framework that you had been working on, or wrote - hxweb... does that still exist, or did you bring whatever you did on it and put it into happs?
21:59:42<mightybyte>Lemmih: I have a question about error handling.
22:00:37<Lemmih>dbpatterson: It still exists and is separate from HAppS.
22:01:47<Lemmih>mightybyte: I have now.
22:01:51<dbpatterson>Lemmih: what are the differences / where it, or happs, is more appropriate? I looked around for docs on it but didnt find it
22:02:00<mightybyte>Ok, in the checkAndAdd function in Main.hs
22:02:44<mightybyte>porrifolius suggested that it does not have transactional integrity because of the separate IsUser and AddUser calls.
22:03:08<Lemmih>dbpatterson: It's on hackage and there are no docs.
22:03:31<Lemmih>mightybyte: That's correct.
22:03:42<mightybyte>I modified addUser to be "addUser name u = do exists <- isUser name; if not exists then modUsers $ M.insert name u". Do I need anything else?
22:03:53<mightybyte>...like a fail or mzero if the user does exist?
22:04:49<Lemmih>That 'if' needs an 'else'. Using 'unless' would also work.
22:05:04<mightybyte>Ok, what would the else clause have?
22:05:22<mightybyte>Or does 'unless' automatically do that error handling for me?
22:06:33<Lemmih>dbpatterson: I don't think there is any significant common ground between hxweb and HAppS.
22:06:56<Lemmih>mightybyte: if not exists then add else return ()
22:07:14<mightybyte>Ok, just an empty monad.
22:07:16<Lemmih>mightybyte: 'unless' adds the 'else return ()' for you.
22:09:19<mightybyte>Ahh, then that's what I want.
22:55:03<Saizan>Lemmih: so now intead of having nested records and functions/typeclasses to access some part of them the preferred way is to keep the components as a flat list?
23:02:36<Saizan>mightybyte: is there a reason for which you use Query State instead of MonadReader State m => m in the type of getSession?
23:30:38<mightybyte>Saizan: I believe that came from AllIn.
23:48:56<Saizan>i'm just trying to understand when you do or don't need a proxy, it seems unnecessary for your numSessions given that's monomorphic
23:50:09<Lemmih>Where?
23:52:44<Saizan>http://softwaresimply.blogspot.com/2008/02/using-happs-state.html <-- here
23:54:23<Lemmih>Right, no need for Proxy in that example.
23:59:45<mightybyte>Yeah, that's probably the part that I know the least about.

Back to channel and daily index: content-negotiated html turtle