--- Log opened Mon Jan 04 00:00:06 2010
09:01 < koeien37> happstack.com is semi-down?
09:01 < koeien37> (documentation won't load for me)
09:02 < mightybyte> Looks like it: http://downforeveryoneorjustme.com/happstack.com
09:02 < koeien37> oh. happstack.com loaded for me, probably cached then
09:03 < koeien37> then I'll have to make do with the source for now
09:03 < mightybyte> I hate it when that happens.
09:07 < koeien37> oh but SimpleHTTP contains enough comments to get started I think
09:07 < koeien37> I won't be using -state anyway for this
09:08 < koeien37> (I'm just exposing a pure function to the web)
09:24 < stepcut> I'm trying to move happstack.com to a more reliable server, but I need to alter the DNS for that to happen, and I still don't have access
09:40 < sm> ack
09:40 < sm> waiting on mae ?
09:50 < koeien37> what will happen if some exception is thrown inside my response handler?
10:00 < stepcut> sm: yeah, I sent another email with more detailed instructions :)
10:01 < stepcut> koeien37: if you do not catch it, that thread will die, but the server will live on
10:01 < koeien37> "that thread will die". so that has no consequences, except that the client doesn't get a reply?
10:01 < stepcut> koeien37: yeah, the client will get a 'server dropped the connection' error or something
10:02 < koeien37> stepcut: hmm, ok, thanks. I'll catch it then and give a 400 or 500
10:02 < stepcut> koeien37: yeah
10:02 < koeien37> I don't expect it, so probably a 500
10:03 < stepcut> perhaps we should add something like that to SimpleHTTP
10:04 < koeien37> but I think that my proxy might give an error too
10:04 < koeien37> that's okay for me as well
10:25 < koeien37> cool, my app is finished :) It's fairly small, so it may be used as a tutorial if somebody/you is/are interested
10:30 < McManiaC> stepcut: where exactly do you have to catch that?
10:35 < McManiaC> wtf stepcut
10:36 < McManiaC> my pastebin lost about 200 of a total number of 700 pastes
10:41 < McManiaC> stepcut: how do you reset the state?
10:41 < McManiaC> to one of the checkpoints
10:41 < koeien37> make a backup of your state first. (I don't know how to answer your question)
10:43 < McManiaC> already did
10:44 < stepcut> McManiaC: dunno
10:44 < McManiaC> :O
10:47 < McManiaC> who wrote that macid monad??
10:48 < stepcut> several people I believe
10:48 < stepcut> lemmih wrote a lot I think
10:48 < McManiaC> Lemmih: ping
10:49 < stepcut> McManiaC: what do you want to know about it?
10:50 < McManiaC> I want the state before the data losses began
10:50 < stepcut> ?
10:51 < stepcut> oh you want to reset to a checkpoint
10:51 < McManiaC> well I lost a *lot* of data
10:51 < McManiaC> yes
10:51 < stepcut> that is not actually a supported operation -- you should just restore an old backup
10:51 < stepcut> but people do do it anyway :)
10:51 < stepcut> first backup the current data
10:51 < stepcut> then remove all the events and checkpoints after the one you want to restore to
10:52 < stepcut> and then hexedit the current-0000000 file so that it points to the checkpoint file
10:52 < stepcut> or something like that
10:52 < stepcut> mightbyte has done it before
10:53 < mightybyte> I heard my name
10:53 < stepcut> mightybyte: just trying to remember the steps to rollback to an older checkpoint file
10:54 < mightybyte> McManiaC: Do you have a checkpoint file with all your data?
10:54 < koeien37> cool - ha, happstack is lightning fast compared to the same in an interpreted language
10:54 < McManiaC> mightybyte: yes
10:54 < mightybyte> Yeah, I think you can just delete all but the checkpoint file you want and subsequent events files
10:54 < mightybyte> Then hexedit current-... and put in the right number corresponding to the number of the checkpoint file you want.
10:55 < stepcut> McManiaC: how did you lose pastes though? There are no know bugs of that type in happstack-state
10:55 < mightybyte> Yeah, I'm curious about that too.
10:59 < McManiaC> I have absolutly no idea
11:00 < mightybyte> What has changed between now and before the data loss?
11:01 < McManiaC> what hexeditor can you recommend? ^^
11:01 < mightybyte> hexedit
11:02 < stepcut> McManiaC: in emacs you can do M-x hexl-mode
11:03 < McManiaC> 16:54  mightybyte Then hexedit current-... and put in the right number corresponding to the number of the checkpoint file you want.
11:03 < McManiaC> where do you put that number?
11:03 < McManiaC> I only have a current-00000000 with basicly nothing in it
11:05 < mightybyte> You need to carefully examine the bytes in that file and reverse engineer the byte order.
11:05 < mightybyte> It should represent an integer corresponding to one of the most recent checkpoint files.
11:06 < McManiaC> e4 ?
11:06 < McManiaC> ah okay
11:06 < mightybyte> Are you familiar with 2s complement integer representation?
11:10 < McManiaC> not really
11:10 < McManiaC> 0xe4 = 228 so 8xd4 = 212 <- correct?
11:11 < mightybyte> What are the exact bytes in the file?
11:11 < mightybyte> Those bytes are correct.  What is your highest numbered checkpoint file?
11:12 < McManiaC> it was 228 and is supposed to be 212
11:13 < McManiaC> do I remove only the checkpoints? or the events too?
11:13 < mightybyte> Ok.  I'd copy everything to a clean directory and do a test.
11:13 < McManiaC> already did :)
11:13 < mightybyte> Remove everything except checkpoint-212
11:15 < McManiaC> oh wow it seems to work
11:15 < mightybyte> :)
11:15 < McManiaC> and I didnt even loose recent pastes
11:15 < mightybyte> Yep
11:15 < McManiaC> <3
11:15 < mightybyte> I had a similar experience.
11:15 < McManiaC> thx mightybyte
11:16 < McManiaC> kinda hacky but...
11:16 < McManiaC> :D
11:16 < mightybyte> Definitely
11:16 < McManiaC> need to start doing some backups...
11:16 < mightybyte> Uh huh
11:16 < McManiaC> :D
11:16 < mightybyte> That's why I keep my state in a git repository.
11:17 < McManiaC> hmmm
11:17 < mightybyte> Might seem like overkill, but it works quite well.
11:17 < McManiaC> hehe
11:17 < mightybyte> It essentially automates what you just did by hand.
11:17 < McManiaC> yeh
11:17 < mightybyte> (at the cost of a little extra storage space)
11:17 < McManiaC> how big is your .git compare to the _local ?
11:17 < McManiaC> compared
11:17 < mightybyte> Let me seee
11:18 < mightybyte> Hahaha
11:18 < mightybyte> _local is 648 megs
11:18 < mightybyte> .git is 627 megs
11:19 < HugoDaniel> hi everyone
11:19 < HugoDaniel> back from vacations
11:19 < mightybyte> Hello
11:22 < McManiaC> oh I think I got the bug
11:22 < McManiaC> :D
11:22 < McManiaC> messing with Ord instance in a Data.Set :S
11:22 < McManiaC> never gonna do this again :O
11:32 < Lemmih> McManiaC: pong.
11:33 < McManiaC> Lemmih: thx, got it sorted
12:33 < McManiaC> IxSet is annoying :S
12:33 < mightybyte> What about it?
12:39 < McManiaC> it doesnt typecheck :S
12:39 < McManiaC> and one of my queries fails somewhere and I cant figure out why...
12:43 < mightybyte> Compile time?
12:45 < McManiaC> yes
12:46 < mightybyte> What's the error? (if it's not too specific to your unique code)
12:47 < McManiaC> no error
12:47 < McManiaC> return . getOne $ ixDb @= (PUser user) @= (PHash hash)
12:47 < McManiaC> always returns Nothing
12:47 < McManiaC> =(
12:48 < mightybyte> Oh, then that's not compile time.
12:48 < mightybyte> That's run time
12:48 < McManiaC> did I say compile time? my bad
12:48 < McManiaC> ^^
12:48 < McManiaC> yeh, runtime
12:48 < mightybyte> Well, the expression after the $ is either empty or more than one.
12:49 < McManiaC> thats why I use getOne
12:49 < McManiaC>     return . Just . last . toList $ db @= (PHash md)
12:49 < McManiaC> HTTP request failed with: Prelude.last: empty list
12:50 < mightybyte> Does your data contain more than one item of type PHash?
12:51 < McManiaC> no
12:51 < McManiaC> I've set up all those newtypes, remember?
12:51 < mightybyte> Yeah, I thought so.
12:51 < mightybyte> Just checking.
12:52 < McManiaC>     return . Just . last . toList $ db @= (PUser u)
12:52 < mightybyte> That's usually what bites me when working with IxSet.
12:53 < McManiaC> jup
12:53 < mightybyte> How big is db?
12:54 < McManiaC> 750 paste atm
12:54 < mightybyte> Try something like this
12:54 < mightybyte> let hashes = map getHash $ toList db
12:55 < mightybyte> Then "(PHash md) `elem` hashes"
12:58 < McManiaC> nothing... this is weird
12:59 < McManiaC> but the hash is there!
12:59 < koeien37> is your Eq instance correct?
12:59 < mightybyte> lol
12:59 < mightybyte> But good point.
12:59 < koeien37> yeah, i'm just tossing in a wild guess
13:00 < mightybyte> A reasonable one given the last Ord problem. :)
13:00 < McManiaC> :D
13:00 < McManiaC> true
13:01 < McManiaC> but since I'm comparing the bytestrings and not the PHash data I guess theres nothing I could do
13:01 < McManiaC>     return . Just . head . filter isHash . toList $ db
13:01 < McManiaC>   where isHash PasteEntry { md5hash = (PHash m) } = m == md
13:04 < McManiaC> md5hash = PHash {unPHash = "\211\176s\132\209\DC3\237\236I\234\166#\138\213\255\NUL"},
13:04 < McManiaC> its definitly there :S
13:06 < mightybyte> How about a modification
13:07 < mightybyte> let hashes = map (\e -> (getUser e,getHash e)) $ toList db
13:11 < mightybyte> In short.  Throw out all your assumptions.  The assumption that the hash is actually in db, that the user is in db, etc.
13:13 < McManiaC> hmmmm maybe the stack is still broken :S
13:14 < mightybyte> Possibly
13:14 < McManiaC> it seems to work with an empty stack
13:14 < mightybyte> Empty stack?
13:14 < McManiaC> new
13:14 < McManiaC> removed everything etc
13:14 < McManiaC> ^^
13:16 < McManiaC> this sucks :S
13:29 < McManiaC> http://ix.io/D2
13:29 < McManiaC> the data *is* there
13:30 < mightybyte> ix.io...nice
13:33 < McManiaC> huh
13:33 < mightybyte> nice domain
13:34 < McManiaC> if I add a "\n" to the string that I hash it works
13:34 < mightybyte> Aha
13:34 < McManiaC> but why :O
13:34 < McManiaC> md5string :: String -> BS.ByteString
13:34 < McManiaC> md5string = BS.concat . BS8.toChunks . md5 . BS8.pack
13:45 < McManiaC> yay fixed
13:50 < mightybyte> Excellent.  What was it?
13:51 < McManiaC> I have to strip white space characters from the end of every line
13:51 < McManiaC> that function did behave weird
13:51 < mightybyte> Ahh
13:52 < McManiaC> but actually, since it always used the same function at the same position in the code I wonder why this didnt work anyway...
13:52 < McManiaC> it definitly did before...
13:52 < McManiaC> ^^
13:56 < McManiaC> :S
14:00 < McManiaC> nope it doesnt work at all...
14:00 < McManiaC> fuck
14:00 < mightybyte> What doesn't work?
14:03 < McManiaC> this is *totally* weird
14:03 < McManiaC> currently it works again
14:03 < McManiaC> I wonder how long
14:03 < McManiaC> :O
14:03 < McManiaC> I didn't change a thing
14:50 < stepcut> I hate IxSet too, just haven't had time to finish my alternative :p
14:53 < stepcut> ok. I am upgrade happstack to QuickCheck 2 now ;)
14:53 < stepcut> I mean, :)
14:59 < mightybyte> stepcut: Any more progress on formlets?
14:59 < stepcut> mightybyte: no, been busy upgrading our development environment to 6.13 :(
15:00 < stepcut> mightybyte: but now that Chris wrote back I should be able to finish it up. Tomorrow hopefully.
15:00 < mightybyte> Ok, great.  Yeah, I guess that was code that we wrote while working on massInput.
15:01 < stepcut> yeah
16:53 < koeien37> cool, my first small happstack app is up & running :)
16:53 < mightybyte> congrats
16:53 < stepcut> koeien37: yay!
17:17 < McManiaC> =)
17:17 < McManiaC> stepcut: what alternative are you working on?
17:20 < stepcut> McManiaC: a variation of Data.Map which supports multiple keys
17:20 < stepcut> very hacked up demo, http://src.seereason.com/haskell-kdmap/
17:20 < stepcut> http://src.seereason.com/haskell-kdmap/examples.hs
17:23 < McManiaC> what type is fromList?
17:24 < koeien37> "multiple keys", this only seems to support two keys?
17:24 < koeien37> aw. i should read. never mind
17:24 < McManiaC> yeh
17:25 < McManiaC> ok
17:26 < McManiaC> but the idea is nice
17:38 < stepcut> koeien37: yes, ultimately it will support more. I think some template haskell will be involved
17:38 < koeien37> yeah i thought so :)
17:38 < koeien37> if you'd do that, it's nice to have the concrete version of 2 and maybe 3
17:38 < stepcut> should be statically typed, and also not require the keys to all have different types
17:39 < stepcut> I need to read the paper that inspired Data.Map first, finish an example with some fixed number of keys, and then figure out what the TH version shoulddo
--- Log opened Mon Jan 04 18:05:37 2010
23:00 < pham_> stepcut: why do you hate IxSet other than inability to have multiple keys?
--- Log closed Tue Jan 05 00:00:37 2010