15:58:09 <Lemmih> st3pcut, stepkut: createCheckpointAndClose added to the repository.
15:58:18 <stepkut> Lemmih: epic!
16:00:15 <stepkut> is see you decided to depend on SafeCopy ?
16:00:21 <Lemmih> Yep.
16:00:32 <Lemmih> SafeCopy <3
16:01:14 <stepkut> for simplicity that is probably best..
16:01:39 <stepkut> would be kind of neat if you could plug in different serializers.. so you could use thats that stored XML, etc.
16:02:21 <Lemmih> Can't you do that now?
16:02:30 <Lemmih> SafeCopy doesn't care how you serialize stuff.
16:02:39 <stepkut> hmm. true
16:06:07 <stepkut> is the acid-state stuff now on par with the happstack-state stuff in terms of features (excluding the experimental multimaster support)
16:06:41 <Lemmih> Yes.
16:07:07 <stepkut> cool. Should I send a patch to safecopy for 'text' and 'time' ?
16:07:18 <stepkut> adding the extra SafeCopy instances
16:07:18 <Lemmih> Yes, please. (:
16:07:26 <stepkut> k. I'll do that now.
16:08:08 <stepkut> Also, I would like to make a post to the happstack blog (which will show up on planet haskell) about acid-state / safecopy. But I don't want to steal your thunder if you were planning to make a larger announcement of some sorts
16:09:20 <stepkut> I will make both  the text and time instances versioned
16:09:53 <Lemmih> No large announcements planned. I will announce acid-state-0.4.0 to the mailinglist soon but it won't be anything big.
16:10:09 <stepkut> k
16:11:14 <stepkut> here is a list of MACID related tasks that were planned for 7. Many are fixed already in acid-state :) http://code.google.com/p/happstack/issues/list?can=2&q=milestone=7&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary
16:11:22 <Lemmih> You might want to wait for 0.4.0 if you plan on including examples, though.
16:11:35 <stepkut> yeah
16:11:50 <stepkut> In the blog post I will probably just talk about the improvements and future plans
16:12:06 <stepkut> and link to the wiki pages you wrote that have some examples
16:12:27 <stepkut> once acid-state / safecopy have stabalized I will start adding sections to the happstack crash course documenting them in detail
16:15:04 <Lemmih> The performance entry is interesting.
16:15:39 <stepkut> Lemmih: in happstack-state there were some functions like getTime and getRandom that did not require IO (but added some overhead to every transaction). do you plan to include functions like those in acid-state ?
16:16:51 <Lemmih> Nope. I plan to never include such things.
16:16:55 <stepkut> ok
16:17:14 <stepkut> I've have used them, but i think most people have no idea they were even there :)
16:18:40 <stepkut> also, i like to automatically create checkpoints now and then.. but right now I just do it on a time basis (every 24 hours, etc). It seems like it would be more sensible to do it based on the number of events that have happened (create a checkpoint every 1000 update events or something).. but there was no obvious way to do that..
16:19:31 <stepkut> regarding the performance related bugs -- my plan was to first create a benchmark suite (using criterion(?)) to get some idea of baseline performance
16:19:57 <Lemmih> Restoring the state from the journal is very fast. Is it worth creating that many checkpoints?
16:19:57 <stepkut> also to be clear if bugs were related to MACID vs IxSet
16:20:16 <stepkut> Lemmih: in the past people have had cases where it took minutes to restore from a journal..
16:20:35 <stepkut> but 'that many' is relative. Maybe it should be every 10000, etc..
16:20:53 <stepkut> depends how CPU intensive the updates are I guess
16:20:59 <Lemmih> Yeah.
16:21:55 <stepkut> the problem now is that there doesn't seem to be any method to checkpoint based on the number of transactions.. or from a debugging / monitoring standpoint, get any statistics on what is happening..
16:22:19 <Lemmih> I'm not convinced there should be.
16:22:27 <stepkut> me neither :)
16:24:42 <rostayob> one thing
16:24:57 <rostayob> what happens if the server crashes and the happstack server is killed badly?
16:25:01 <Lemmih> Acid-state can rerun events at a rate of several hundred thousand per second. Creating events is much slower at tens of thousands per second.
16:25:28 <stepkut> any idea what happens in acid-state if you call 'fail' inside an update method ? I believe in the old code the event would get written and the server would keep going, but when you try to reply the events later, it would crash on the event that calls fail..
16:25:42 <Lemmih> rostayob: You restart your application and everything continues as normal with no lost data (:
16:26:04 <rostayob> Lemmih: even if you're in the middle of an update? cool
16:26:36 <stepkut> rostayob: that is why it is MACID and not MACI
16:26:59 <Lemmih> stepkut: Much a transaction won't be written to disk by acid-state.
16:27:19 <rostayob> yeah eheh
16:27:39 <stepkut> Lemmih: ok. But it would have been in happstack-state ?
16:27:45 <Lemmih> A guy contacted me when I announced acid-state and told that 'fail' and 'error' were huge problems for them with happstack-state.
16:27:59 <stepkut> Lemmih: thomas hartman ?
16:28:01 <Lemmih> Yeah, happstack-state dealt badly with exceptions.
16:28:25 <stepkut> cool
16:28:26 <Lemmih> stepkut: Nope. Some other guy. They run this site using happstack-state: http://skrivapa.se/
16:28:47 <stepkut> nice
16:28:54 <stepkut> except the bad exception handling part ;)
16:29:57 <Lemmih> I'd be too afraid to build a business using happstack-state.
16:31:22 <Lemmih> What would be a good/decent benchmark for acid-state?
16:31:57 <stepkut> Lemmih: the trick is to build a business that grows at a rate that allows you to update happstack-state as your app demands it
16:32:48 <Lemmih> heh (:
16:33:13 <stepkut> Lemmih: or put another way.. I would love to have the problem that my site is so popular MACID is the botteneck :)
16:33:31 <stepkut> Lemmih: makes it easier to justify working on it.. so far getting users in the bigger issue :p
16:34:29 <stepkut> Lemmih: I think the first two benchmarks should be ones that do almost no work and just show the maximum queries and updates per second. So, perhaps your state is just () and you just read () from the state or stick () in the state ?
16:35:02 <Lemmih> Oh, shit. I think I've made a mistake.
16:35:08 <stepkut> :-/
16:35:55 <Lemmih> Oops, queries are way too optimistic.
16:36:10 <Lemmih> Dirty reads are possible right now.
16:36:15 <stepkut> :(
16:36:36 <Lemmih> re-benchmarks: I have an example which just increments a counter.
16:36:47 <stepkut> I wonder how feasible it would be to model MACID in coq or something
16:37:29 <stepkut> Lemmih: yeah, incrementing a counter is reasonable as well
16:38:17 <stepkut> Lemmih: once you start doing things like looking up key/value pairs, then you are measuring the speed of the underlying datatype as well (Map, IxSet, etc). That is useful, of course, but in a different way
16:39:24 <Lemmih> Yeah.
16:42:22 <stepkut> Do you think the best approach to serializing Text is to convert it to a utf-8 encoded ByteString and then just serialize that ?
16:43:36 <Lemmih> That seems fine.
16:43:59 <Lemmih> I guess people can use newtype if they want utf-16 or something.
16:45:02 <stepkut> yeah
16:45:16 <stepkut> i think internally Text currently uses utf-16.. but there is talk of switching to utf-8. But that would only affect serialization speed
16:45:36 <stepkut> since encodeUtf8 / decodeUtf8 would be 'id' instead of having to do some actual work
16:46:57 <Lemmih> Could you save it as (format, data) perhaps?
16:47:36 <stepkut> yes.. but the putCopy would have to pick a format..
16:47:38 <Lemmih> Well, it doesn't really matter. We can always add more efficient versions afterwards.
16:48:36 <stepkut> if utf8 is the most compact encoding for your particular text, then it could be the fastest because it would result in less IO (especially if the values are going over the network)
16:49:26 <stepkut> sending mostly ascii text as utf16 over the network (in a multi-server setup) would essentially double your network traffic for those values
16:50:22 <stepkut> anyway, this is why I am not making Text a primitive :)
16:54:24 <Lemmih> Fix pushed to repository. I wonder how to test for the absence of dirty reads.
16:55:15 <stepkut> the dirty read only occurs as a race condition ?
16:57:15 <Lemmih> Kinda. I forgot to make them wait for the journal to be serialized.
16:57:38 <stepkut> maybe this is where Coq comes in :p
16:57:59 <Lemmih> Yeah. /-:
16:58:24 <stepkut> but, I have proved only the most basic of things in Coq.. and forgotten how already
16:59:24 <Lemmih> Running 100k transactions: 3.9 seconds.
16:59:27 <stepkut> in Data.SafeCopy.Instances your imports are not in alphabetical order.. is there some method to the ordering?
16:59:42 <Lemmih> Re-running 100k transactions: 0.245 seconds.
17:00:00 <stepkut> nice
17:00:08 <Lemmih> stepkut: Haha. No. Feel free to rearrange them if you feel like it.
17:00:49 <stepkut> also, for the instances, sometimes you have blank lines between instances, and other times you don't..
17:03:02 <Lemmih> Average log entry length: 44 bytes. Buffer allocated per log entry: 98304 bytes.
17:03:35 <Lemmih> Overhead: 223418%
17:03:58 <Lemmih> So... there's still room for improvements.
17:04:09 <stepkut> Lemmih: in happstack-state it seemed like there were a lot of event files that didn't actually contain anything.. as if query events were creating empty events or something
17:04:28 <Lemmih> stepkut: Oh, that's odd.
17:06:05 <stepkut> yeah.. in this one directory probably 80% of the event files are 0 bytes
17:06:16 <Lemmih> Oh that.
17:06:17 <Lemmih> Heh.
17:06:28 <stepkut> my random guess is that it is related to the Queue saver
17:06:48 <Lemmih> Yeah, happstack-state had a thing for opening new files (:
17:07:19 <stepkut> heh
17:07:25 <Lemmih> acid-state will never do that.
17:07:31 <stepkut> k
17:07:37 <Lemmih> It can't by design.
17:07:46 <stepkut> in acid-state is it still easy to log to non-local storage (like S3?)
17:07:55 <stepkut> perhaps even easier?
17:08:56 <Lemmih> Yeah, it can be added on top of the library without messing with the internals.
17:09:01 <stepkut> spiffy
17:11:35 <stepkut> I heard acid-state is so awesome that after building it, the buildbot on hackage lost the will to live..
17:12:17 <Lemmih> It's really funny that GHC has become so fast that allocating 100kb to serialize 44 bytes is actually workable.
17:12:25 <Lemmih> hahaha
17:12:37 <stepkut> heh
17:14:11 <stepkut> One reassuring thing about using MACID is that you can read the entire source and understand how it works in less than a day..
17:14:27 <stepkut> so even if there is a bug.. it's not some giant code base that you have no hope of understanding
17:15:17 <Lemmih> yeah. Not like happstack-state which had a race condition hidden for years (:
17:15:49 <stepkut> Lemmih: and a test case that showed it had a race condition for years ;)
17:16:19 <Lemmih> Oh, really? I didn't know.
17:16:41 <stepkut> Lemmih: yeah.. it just took years before someone actually decided to find out why the test case was failing :)
17:17:42 <stepkut> should be easy to port those tests to acid-state .. though they did rely on the memsaver to avoid creating files on the disk
17:18:18 <stepkut> someone actually had a case where they wanted to use memsaver in production code.. though I can't remember why now
17:18:51 <stepkut> oh.. I think it was for creating their own test suites
17:19:55 <Lemmih> Memsaver in production code? Doesn't that counter the entire purpose of MACID?
17:20:35 <Lemmih> MVars are MACI (:
17:20:39 <stepkut> yeah.. I think it was actually just for test suite code ... they wanted an easy way to load sample states into MACID and then run tests on them
17:20:52 <Lemmih> Ah.
17:21:09 <Lemmih> Right. I should add a memory backend to acid-state.
17:21:13 <stepkut> that was hard to do in happstack-state, because initialValue was part of a type class. Now that it is an argument to openAcidState it should be easier
17:21:44 <Lemmih> Hah, components were so silly in happstack-state (:
17:21:49 <stepkut> :)
17:21:58 <stepkut> yes.. they promised power but delivered nothing
17:22:25 <stepkut> like many things in happs.. they were introduced by never finished
17:22:38 <Lemmih> They delivered inconvenience and odd type errors. :)
17:22:52 <stepkut> yeah
17:23:17 <Lemmih> I gotta go. Looking forward to that patch. TTYL.
17:23:21 <stepkut> and the Dependencies didn't actually ensure that all the components were actually loaded at compile time
17:23:26 <stepkut> patch is half done
17:23:28 <stepkut> did text
17:23:30 <stepkut> looking at time now
17:23:36 <stepkut> well, it will be two patches
17:23:40 <stepkut> first one done but not sent
18:31:46 <etarasov> hello there
18:32:26 <etarasov> how to render blaze-html Html properly?
18:33:22 <stepkut> etarasov: properly?
18:33:24 <stepkut> toResponse ?
18:34:22 <etarasov> stepkut: I'm using happstack 5
18:34:40 <stepkut> upgrade :)
18:34:45 <stepkut> one moment ..
18:34:55 <etarasov> stepkut: it's todoed =)
18:35:30 <stepkut> instance ToMessage Blaze.Html where
18:35:30 <stepkut>     toContentType _ = B.pack "text/html; charset=UTF-8"
18:35:31 <stepkut>     toMessage       = Blaze.renderHtml
18:35:35 <stepkut> add an instance like that
18:35:44 <stepkut> import qualified Text.Blaze                      as Blaze
18:35:44 <stepkut> import qualified Text.Blaze.Renderer.Utf8        as Blaze
18:36:07 <stepkut> when you upgrade to 6, you will get a duplicate instance error.. when that happens, just delete your local copy of the instance
18:36:11 <etarasov> stepkut: I'll try, thanks
18:38:58 <etarasov> hm, it renders into bytecode
18:39:22 <stepkut> yes
18:39:58 <stepkut> it renders to a ut8 encodeding ByteString..
18:40:00 <etarasov> I have pretty auxillary functions that work with String only
18:40:16 <stepkut> oh..
18:40:35 <etarasov> there are two renders to String for blaze
18:40:47 <stepkut> yeah, use renderHtml from Text.Blaze.Render.String
18:41:06 <etarasov> but both don't work exactly I want
18:41:09 <stepkut> oh ?
18:41:33 <etarasov> Text.Blaze.Renderer.String renders without new lines
18:41:41 <stepkut> so
18:42:04 <etarasov> Text.Blaze.Renderer.Pretty builds to many extra spaces
18:42:11 <stepkut> yes
18:42:17 <stepkut> it's only for human consumption
18:43:08 <etarasov> so, is it fine to give unreadable string to browsers?
18:43:16 <etarasov> *human unreadable
18:44:54 <stepkut> the browser can read it fine
18:45:43 <etarasov> ok
18:45:59 <stepkut> less \n means less bytes to download too :)
18:46:10 <TaMeR1> Hi, just installed, need some help
18:46:23 <stepkut> TaMeR1: yay!
18:46:34 <TaMeR1> What do I put here:
18:46:35 <TaMeR1> -- NOTE: You need to change this file name such that it reflects the name of
18:46:35 <TaMeR1> -- your project in the .cabal file, because it is auto-generated by cabal.
18:46:35 <TaMeR1> import guestbook (version)
18:46:48 <stepkut> whatever you want to name your project
18:47:12 <stepkut> for example, facebookkiller
18:47:40 <TaMeR1> I already named my project PzzAzz. So just pzzazz or pzzazz_guestbook or what?
18:47:51 <stepkut> PzzAzz probably
18:48:02 <stepkut> the capitilazion is significant
18:48:06 <TaMeR1> let me try, I'll be back
18:48:31 <stepkut> your other option is to just comment out the 'version' stuff entirely -- which is easier
18:48:45 <stepkut> it just allows your application to report its version number
18:48:52 <TaMeR1> I get "Could not find module `PzzAzz':"
18:49:06 <stepkut> just comment out that import and the lines that use version
18:49:09 <stepkut> it is not really that important
18:49:18 <TaMeR1> ok, let's try
18:49:32 <stepkut> it's 'cute' but it just makes things more annoying most of the time
18:50:34 <TaMeR1> Hmm, now I get "trhsx"
18:50:52 <TaMeR1> I mean "ghc: could not execute: trhsx"
18:51:10 <stepkut> it is probably installed in ~/.cabal/bin
18:51:19 <stepkut> but you probably do not have ~/.cabal/bin in your $PATH
18:51:39 <TaMeR1> thats right, I fix that thanx
18:57:00 <TaMeR1> Added path, still had error, checked .cable/bin/, only files in there are cabal and happstack What am I missing
18:57:40 <TaMeR1> ./cabal not cable
18:57:50 <etarasov> TaMeR1: try to cabal install trhsx
18:58:05 <TaMeR1> ok
18:58:15 <etarasov> after cabal update
18:58:16 <stepkut> Lemmih: sent
18:58:27 <stepkut> etarasov: no
18:58:39 <stepkut> TaMeR1: comes from the hsx package
18:58:49 <stepkut> TaMeR1: have you installed happstack-hsp ?
18:59:36 <etarasov> =|
19:00:00 <etarasov> my mistake
19:00:39 <stepkut> there is a trhsx package on hackage I think.. but it is not what you want :-/
19:02:25 <TaMeR1> Yeah got an error on that anyway, let me try hsp thing
19:03:51 <stepkut> :-/
19:03:58 <stepkut> how did you install?
19:04:20 <stepkut> cabal install happstack ? or cabal install happstack --global?
19:04:26 <TaMeR1> It's installing. I think once I get this, I'll have to make a howto, for other dumies like me
19:04:35 <TaMeR1> first one
19:04:47 <stepkut> :-/
19:04:47 <TaMeR1> no global
19:05:15 <TaMeR1> is that what I did wrong?
19:05:30 <stepkut> no
19:05:38 <TaMeR1> can I still do that, or should I start from scratch
19:05:43 <stepkut> if you had done --global, then trhsx would be in /usr/local/bin
19:05:57 <stepkut> not sure how you could have hsx installed but not trhsx
19:06:35 <stepkut> it definitely comes from the hsx package
19:07:04 <TaMeR1> Now I got a new error
19:07:04 <TaMeR1> setup: happy version >=1.17 is required but it could not be found.
19:07:05 <TaMeR1> cabal: Error: some packages failed to install:
19:07:33 <TaMeR1> I think, I better start from scratch, ha? with the global thing
19:07:34 <stepkut> what distro ?
19:07:41 <stepkut> no, don't do the --global thing
19:07:43 <TaMeR1> debian testing
19:07:53 <stepkut> apt-get install happy should probably work
19:08:02 <TaMeR1> ok
19:08:13 <stepkut> and then cabal install happstack-hsp (note the -hsp at the end..)
19:10:12 <TaMeR1> it's compiling now, thanx
19:14:33 <TaMeR1> Look like I got more stuff missing:
19:14:33 <TaMeR1>               Could not find module `Happstack.Server.HStringTemplate
19:14:57 <stepkut> you need happstack-hstringtemplate as well
19:15:07 <stepkut> if you built using, cabal configure, it would tell you that..
19:16:01 <TaMeR1> explain please
19:17:28 <TaMeR1> got it, thanx
19:18:14 <stepkut> happstack-hsp and happstack-hstringtemplate should be listed as build depends on the .cabal. So when you do cabal configure (or runhaskell Setup configure) it will tell you that you are missing build dependencies
19:19:31 <TaMeR1> Yeah, I figured that out, while you wore typing. Nice future
19:19:41 <stepkut> :)
19:22:00 <TaMeR1> I think it didn't like me commenting that line out, check it out:
19:22:00 <TaMeR1> src/Main.hs:83:65: Not in scope: `version'
19:22:00 <TaMeR1> Failed, modules loaded: State, Logger, Routes, State.GuestBook, Types.GuestBook, Pages, Pages.Readme, Pages.GuestBookEntries, Pages.PostEntry, Pages.AppTemplate, Pages.Common.
19:22:00 <TaMeR1> *State>
19:23:48 <stepkut> yeah, you have to comment out the lines that use version as well
19:42:49 <TaMeR1> stepkut: I can't figure this out. Following is my setup. What do I place in to the import line
19:42:49 <TaMeR1> mkdir ~/www
19:42:49 <TaMeR1> cd ~/www
19:42:49 <TaMeR1> export PATH=~/.cabal/bin:$PATH
19:42:49 <TaMeR1> happstack new project PzzAzz
19:42:49 <TaMeR1> cd PzzAzz/bin/
19:42:50 <TaMeR1> rm *.bat
19:42:50 <TaMeR1> chmod 775 *
19:42:51 <TaMeR1> cd ..
19:42:51 <TaMeR1> cabal install happstack-hsp
19:42:52 <TaMeR1> cabal configure
19:42:52 <TaMeR1> cabal install happstack-hstringtemplate
19:42:53 <TaMeR1> edit Main.hs
19:42:53 <TaMeR1> -- and edited import line to look like this:
19:42:54 <TaMeR1> import PzzAzz (version)
19:42:54 <TaMeR1> ./bin/run-interactive.sh
19:44:45 <stepkut> TaMeR1: personally I would just comment out the import version line, and then change the versionInfo line to, [ fullName ++ " (" ++ progName ++ ")"
19:44:46 <TaMeR1> The error is: Could not find module `PzzAzz':
19:45:26 <stepkut> if you want the version stuff to work, then you need to rename the module in src-interactive-only
19:45:34 <stepkut> from Paths_guestbook.hs to Paths_PzzAzz.hs
19:45:59 <stepkut> and then do s/guestbook/PzzAzz in that file
19:46:55 <stepkut> also the import should be, import Paths_PzzAzz (version)
19:47:02 <stepkut> not just 'import PzzAzz'
19:47:39 <stepkut> that file (Paths_PzzAzz) is normally autogenerated when you use cabal to build the application. But when you run interactively cabal is not there to generate it for you
19:47:56 <stepkut> so you have to have a static version around somewhere that you can use instead
19:49:33 <stepkut> commenting it out is really a better idea IMO
19:54:01 <TaMeR1> OK got it working by commenting it out, thank you very much stepkut.
19:54:09 <stepkut> no problem!
19:54:33 <stepkut> thanks for toughing it out!
19:54:40 <TaMeR1> Seam I got a lot to learn, go to do some reading
19:54:51 <stepkut> the crash course is pretty up to date
19:54:54 <TaMeR1> Where should I post the howto?
19:55:03 <stepkut> the wiki maybe?
19:55:13 <TaMeR1> ok, you got it
20:09:05 <stepkut> jaspervdj: wouldn't it be better if the defaultInput was, Maybe a, so that you are not forced to have a defaultInput?
20:10:09 <jaspervdj> stepkut: for what? It's usually a Maybe a?
20:10:40 <stepkut> jaspervdj: sorry, inputChocie
20:10:56 <stepkut> jaspervdj: clearly I have been programming too long.. should probably eat some lunch
20:11:00 <jaspervdj> :-)
20:11:26 <jaspervdj> it makes sense for inputchoice imo
20:11:42 <jaspervdj> since you have to select an item
20:12:36 <stepkut> what about checkboxes?
20:12:42 <stepkut> you don't have to select any, right ?
20:13:24 <stepkut> also, imagine you are talking a multiple choice test.. if all the questions default to 'c' to start with.. it is hard to see which ones you have answered already ?
20:14:22 <stepkut> or, just because a 'text input' field is required doesn't mean that we always put dummy text in the input field..
20:15:20 <stepkut> (in fact, not being able to leave all the checkboxes empty is an issue that formlets could not handle correctly)
20:15:46 <stepkut> (because it did not distinguished between NoEnvironment and an environment that was missing values)
20:16:37 <TaMeR1> Sorry for the invasion, just a note: posted guestbook update to http://groups.google.com/group/happs don't have access to wiki. Thank again!
20:16:43 <stepkut> no worries
20:16:57 <stepkut> why don't you have wiki access? No google account?
20:17:09 <TaMeR1> yes I do, but no access
20:17:18 <stepkut> :-/
20:17:35 <TaMeR1> even groups is moderated
20:18:40 <stepkut> yeah
20:18:54 <stepkut> the group moderation is a good idea I think (you are now permanently white listed)
20:19:06 <stepkut> would be nice if the wiki had a similar moderating feature
20:21:53 <TaMeR1> thanks
21:53:54 <Lemmih> stepkut: Awesome. I'll apply when I'm less drunk.
21:54:04 <stepkut> :)