Experimental IRC log happs-2008-04-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:25:00<dufflebunk>Is someone able to help me with some form processing in happs? http://hpaste.org/7199
01:25:47<dufflebunk>I have a form with a bunch of repeating fields, the names are things like rate_0, rate_1, ... and the need to get stuffed into a structure.
01:26:14<dufflebunk>There's also a hidden form element with how many of thinges there are.
01:27:06<dufflebunk>The problem is I'm not sure how to do the monad stuff so that it repeates N times looking at slightly different names each time
03:12:48<dufflebunk>I figured the answer out with help from conol in #haskell. I needed to use forM. Now I have another question, is there an easy way to log the HTTP requests, either to a log file or stdout?
09:38:24<Lemmih>dufflebunk: Usually another server does the logging.
10:50:34<MarcWeber>dufflebunk: There is a nice pacakge called hslogger. And the happs libraries itself do use it I guess. Get it there is nice documentation in source. If you have trouble you can ping me. But don't konw about speed. Also have a look at debugFilter
10:52:48<MarcWeber>While playing a round with STM a bit I've noticed that it's not that easy to implement RDBMS like features, because you need to know about runtime behaviours of your queries to not let simple small update functions make a bigger SELECT retry and retry again (forever eating up resources).. Although this could be solved by try it 5 times if it fails acquire kind of global lock?
12:05:09<Lemmih>MarcWeber: I don't think that's a big problem in practice. The STM paper talks about it some.
13:00:02<MarcWeber>Lemmih: How does making a backup work then? This will take some time if you have 500MB in memory. I will try.
13:29:49<Lemmih>MarcWeber: Copying the state can easily be O(1).
13:34:04<MarcWeber>Lemmih: Sure. But what happens if another STM action finishes before this one long O(1) action -> log contains a read and a write on the same TVar -> retry, correct?
13:35:16<MarcWeber>And on a busy system you can assume that an update will occurs all 30s and writing the state takes a little bit longer? Anyway this case can be easily solved by a global lock.
13:39:02<Saizan_>remember that you don't write the state on disk inside STM, you've to consider the time it takes to read a bunch of TVars
13:40:31<Lemmih>MarcWeber: Getting the state takes a few milliseconds. It doesn't matter how long it takes to write it.
13:43:27<MarcWeber>Have you seen my example on haskellcafe?
13:45:34<Lemmih>Nope, I only subscribe to haskell@
13:48:16<MarcWeber>http://www.haskell.org/pipermail/haskell-cafe/2008-April/042188.html
13:49:11<MarcWeber>If you use myAtomically False in both cases there is no end. (of course show is very expensive here for serializing)
13:50:49<Lemmih>MarcWeber: Why do you want a lock?
13:51:48<MarcWeber>Because this taking state within ms didn't work in this case
13:51:58<MarcWeber>Adding the lock did.
13:52:41<MarcWeber>Compile and try the example (you need to cleanup the file dump after that, same dir as executable)
13:52:56<MarcWeber>And change the myAtomically True to False
13:54:56<MarcWeber>myAtomically False is equal to atomically except that it counts running actions unless you use True once. True aquires a lock by setting counter to -1
13:56:20<Saizan_>have you tried with simply atomically?
13:57:05<Lemmih>You most likely don't want a TVar for each row.
13:58:09<MarcWeber>Saizan_: Sure. I've written myAtomically because atomically didn't work in this case.
13:58:27<MarcWeber>Saizan_: Sure. I've written myAtomically because atomically didn't work in this case.
13:59:22<Lemmih>MarcWeber: You have to block new updates if you want that many TVars.
13:59:36<Saizan_>however a TVar for each row means your dumpTable O(n)
13:59:42<Saizan_>+is
14:03:20<Lemmih>MarcWeber: You should know that ACID guarantees are very expensive and that most databases don't have them.
14:08:02<MarcWeber>My idea was to try out how a row based locking scheme could be implemented in haskell. This was my result. Thaht's why I've used a TVar for each row.
14:09:38<Lemmih>It'll work fine if you sacrifice concurrency.
14:12:12<Lemmih>Also, look at type of myAtomically (:
14:12:42<Lemmih>Showing the result will not take that long.
14:15:01<Lemmih>MarcWeber: Make the lock a Bool and don't allow any new actions if it is True.
14:18:12<MarcWeber>Lemmih: You've been right. reading TVars is more expensive than serializing the data using show.
14:18:29<MarcWeber>I agree now that it's a bad idea to have that many TVars
14:18:32<Lemmih>MarcWeber: (myAtomically returns (), btw)
14:20:01<MarcWeber>You're correct
14:20:15<Lemmih>Concurrency is a hard and unsolved problem. Relational databases sacrifices ACID guarantees and scalability to get performance. Hashtables like SimpleDB and HAppS don't pretend to give you any ACID guarantees in the first place.
14:30:51<MarcWeber>Rewriting the example using one tvar only takes 0.036s. Using one TVar for each row it takes 7s (200 times slower)
15:59:12<izz1>hi guys, noob here. what is the shortest way to display an IO String in happs? i dont understand monads yet. all i want is display something from readfile.
16:04:25<Lemmih>In context: main = simpleHTTP nullConf [ anyRequest $ liftIO $ readFile "file" ]
16:06:16<Lemmih>izz2: Did you get my reply?
16:10:05<izz2>sorry, but i found it in the logs =)
16:10:16<izz2>anyRequest $ ok $ toResponse $ liftIO (readFile "data.csv")
16:10:21<izz2>cant compile
16:10:38<Lemmih>fmap toResponse
16:10:48<Lemmih>Or no 'toResponse' at all.
16:10:57<Lemmih>And no 'ok'.
16:11:13<Lemmih>In context: main = simpleHTTP nullConf [ anyRequest $ liftIO $ readFile "file" ]
16:17:00<izz2>coolness
16:17:06<izz2>thanks Lemmih
16:17:56<izz2>ghc compiler errors are really intimidating
16:18:00<izz2>=)
16:55:16<Lemmih>HAppS is days away from having sharding support.
17:14:37<vegai>2 days or 50 days? :)
17:14:49<Lemmih>7 days.
17:15:00<vegai>btw, am I the only one who has reported problems with the darcs get?
17:16:44<Lemmih>What repo are you having problems with?
17:17:33<Lemmih>They seem to work for me.
17:22:38<izz2>i cant seem to get around mixing monad and monadIO...
17:22:43<izz2>´╗┐ie. ´╗┐simpleHTTP nullConf [ dir "test" [anyRequest $ ok $ toResponse "test"], anyRequest $ liftIO $ readFile "data.csv" ]
17:22:47<izz2>can this work?
17:23:11<izz2>both of them work independently
17:23:16<izz2>=D
17:32:18<izz2>fixed my prob with fmap =)
17:38:24<vegai>Lemmih: http://hpaste.org/7144
17:38:39<vegai>I'll check if it still happens
17:40:57<Lemmih>Urk, I hate darcs bugs.
17:41:45<Lemmih>izz2: Remove the 'toResponse'.
17:42:03<Lemmih>izz2: All actions have to return the same type.
17:42:44<izz2>yup.. got that fixed. thanks.
17:43:27<izz2>is there a way on checking if the protocol used is https?
17:43:44<izz2>lets say i put happs behind apache
17:43:51<izz2>for the http part
17:44:01<izz2>err i mean https requests
17:44:56<Lemmih>Not that I know of.
17:45:02<Lemmih>Some header maybe?
17:46:00<izz2>yup i think apache adds a header for that
17:46:14<izz2>read something like that being done for mongrel
17:47:50<izz2>im thinking on using apache proxying https for login pages and happs for the rest
17:48:53<izz2>or is there going to be native ssl support soon? =)
17:49:41<Lemmih>No, proxying is the official way of handling https requests.
17:50:45<vegai>Lemmih: yeah, still there
17:51:27<izz2>ic, i still have a lot of haskell learning to do before i can get productive
17:51:39<izz2>anyways, gotta split now
17:51:40<izz2>thanks for all the help
17:51:47<izz2>byebye
17:58:07<Lemmih>vegai: Try without the tag.
17:59:01<Lemmih>There has been no interface changes since 0.9.2.
17:59:33<hellige>quick question (i hope):
17:59:50<hellige>does happs run decently on windows?
17:59:56<hellige>(for development, not production)
18:05:11<Lemmih>I hope so.
18:05:34<hellige>i only ask because i'm basically a total noob with haskell on windows
18:05:44<hellige>(i'm much, much more comfortable with unix)
18:06:04<hellige>i tried the quick getting-started instructions on happs.org, but had some strange problems
18:06:11<hellige>and had to kill my whole cygwin shell
18:06:42<hellige>so i'm not really sure what the problems are, whether it's darcs/sp/ghc/happs + cygwin, or what
18:07:10<hellige>i'm happy to just pull the repo and build using cabal, if that's the most reliable way to do things in cygwin...
18:07:21<hellige>unfortunately i just have no real idea... i wish i could just use linux. :(
18:08:09<Lemmih>I don't have access to a Windows box, unfortunately.
18:08:29<hellige>well, fortunately for you. ;)
18:08:39<hellige>anyway knowing that it should work in principle, i will push on!
18:08:53<hellige>so far, my problems are definitely not happs-specific...
18:09:24<hellige>i think it's basically issues of native windows vs cygwin, but this quickly gets out of my depth. hopefully i can figure it out. thanks!
18:17:43<vegai>Lemmih: yeah, works without the tag
18:23:17<Saizan>hellige: going via cabal is probably more reliable
18:23:41<hellige>i'm about to try that route. i think cygwin just confuses things too much otherwise.
18:24:11<hellige>is there a way to grab all of happs at once, or should i get each repos one-by-one?
18:24:23<Saizan>one-by-one
18:24:50<hellige>ok. final question: where does happs-begin live? i've seen reference to it, but it doesn't seem to be a separate repos...
18:24:52<Saizan>i always used runghc Setup.hs directly from cmd.exe on windows, btw
18:25:12<Saizan>happs begin was a demo app that's not really maintained, afaiu
18:25:28<hellige>oh, ok. cool.
18:25:43<Saizan>there are examples in HAppS-Server/Examples
18:25:43<hellige>and thanks for the cmd.exe tip. the windows stuff is very new for me.
18:28:27<vegai>Lemmih: also works without --partial but with --tag=0.9.2
18:28:34<vegai>it's the combination that confuses darcs-2.0
18:41:33<dufflebunk>MarcWeber: Using debugFilter, the way it's described on http://www.haskell.org/haskellwiki/HAppS_tutorial results in:
18:41:36<dufflebunk>src/Main.hs:6:7:
18:41:39<dufflebunk> Couldn't match expected type `ServerPartT IO a'
18:41:41<dufflebunk> against inferred type `[ServerPartT m a1] -> [ServerPartT m a1]'
18:41:44<dufflebunk> In the expression: debugFilter
18:41:46<dufflebunk>src/Main.hs:6:7:
18:41:49<dufflebunk> Couldn't match expected type `ServerPartT IO a'
18:41:51<dufflebunk> against inferred type `[ServerPartT m a1] -> [ServerPartT m a1]'
18:41:54<dufflebunk> In the expression: debugFilter
18:41:56<dufflebunk>oops, only one of those.
18:50:00<Lemmih>How are you using 'debugFilter'?
18:53:28<dufflebunk>The way it is in the examples: main = simpleHTTP nullConf {port=8081} [ debugFilter, ...
18:59:24<MarcWeber>hellige: Yes there is a way to get all at once : Install nix(os) :)
18:59:59<MarcWeber>hellige: About your cygwin trouble - i guess you've read about the other character (not ctrl-c) to exit an happs app on win? If I recall it correct its 'e'
19:55:23<hellige>thanks to all for your help. i just bit the bullet and vpn'ed my way to my linux machine.
19:55:32<hellige>now everything works perfectly as advertised.

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