--- Log opened Sun Mar 29 00:00:04 2009
00:15 < xplo45> ok now My Flex front end is communication with Happs using HTTP Response Requests. All I have to do now is deploy the front end as an Desktop App using Adobe Air. This way I'll have a Desktop app built with web technology. Plus (we are using happstackl so there is a plus) no external server, no browser, and  no external DB  unlike the Google Gears solution (although Gears intergrates SQLite). In fact its hard to tell that this desktop app is built with web t
00:15 < xplo45> echnolgy at all.
00:18 < xplo45> Maybe I add some fancy animated buttons I can get for free from some Adobe Flash art site and wow people. They'll think it took me days to make this little app.
00:19 < xplo45> Thanks Happstack
00:20 < xplo45> Oh, and talk about decoupling a gui from program logic.
09:49 < mae> xplo45: grreat
10:38 < cocon> Is the encoding format of Data.Binary documented somewhere?
10:40 < MarcWeber> cocon: source ?
10:41 < MarcWeber> cocon: Why are you asking?
12:49 < gwern> maybe he corrupted a binary file
13:43 < h_buildbot> Build for ghc-6.8.3 OK. Test suite ran. 16/77 test cases failed. Check http://buildbot.happstack.com/ for details.
13:49 < h_buildbot> Build for ghc-6.10.1 OK. Test suite ran. 15/77 test cases failed. Check http://buildbot.happstack.com/ for details.
14:37 < cocon> hi
14:37 < cocon> is there a wa to look into a request's body when writing a FromData
14:37 < cocon> 	instance?
14:41 < stepcut> cocon: yes
14:41 < stepcut> cocon: what are you hoping to find in the body?
14:54 < cocon> stepcut: some information I want to send to the server
14:54 < cocon> stepcut: am I forced to put into GET/POST fields?
14:57 < stepcut> cocon: you can put it in tho POST fields, or you can use askRq and rqBody
14:58 < stepcut> cocon: you could also treat it as a file upload and use lookInput
14:58 < stepcut> cocon: but, that seems pretty hackish, with little benefit
14:58 < cocon> stepcut: how can I access askRq from a FromData instance definition?
14:59 < stepcut> cocon: you probably can't use askRq in FromData
14:59 < cocon> ok, thanks
15:03 < stepcut> withData looks in the body, but only if the body has the content type application/x-www-form-urlencoded or multipart/form-data
15:03 < stepcut> (and the method type was POST)
16:30 < patch-tag> can someone clue me in on Text.XHtml tables?   http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3061#a3061     ... is that even  valid html?
16:44 < patch-tag> It seems to me that the "beside" function has a bug
16:45 < patch-tag> unless I am misunderstanding how tables are supposed to work in xhtml
16:57 < cocon> what's the best way to send binary data from the client to the server?
16:57 < cocon> encoding it in the URL seems a bit awkward
16:57 < cocon> POST?
17:02 < patch-tag> cocon: haskell tutorial has an example of uploading an img file to server (post of course)
17:08 < cocon> patch-tag: POST with argument/value pairs, or just raw data? what's the mime type?
17:09 < cocon> why not PUT?
17:12 < patch-tag> cocon: I can't remember how I did it, it was a while ago. but the source is online.
17:12 < patch-tag> It's a cabal-installable demo.
17:13 < stepcut> cocon: when you POST data, you are supposed to supply a content type. form data is either application/x-www-form-urlencoded or multipart/form-data (which is the key/value pairs in the pair). But, if you uploaded an mp3, you would want audio/mp3 or something.
17:13 < stepcut>  
17:13 < stepcut>  
17:13 < stepcut> cocon: though, for a file upload, PUT would probably be more correct (and fully supported, AFAIK)
17:14 < patch-tag> cocon: http://tutorial.happstack.com/tutorial/file-uploads
17:20 < cocon> thanks, it links to http://tutorial.happstack.com/projectroot/src/ControllerPostActions.hs
17:20 < cocon> sorry, but I can't locate the place in the code that deals with uploads / MIME types
17:24 < cocon> ok, I set Content-Type to application/octet-stream and on the server I use rqBody directly
17:24 < cocon> it returns an empty bytestring
17:30 < stepcut> cocon: can you put some code on hpaste perhaps?
17:31 < cocon> ok
17:34 < cocon> http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3067
17:37 < stepcut> what does length say? 0?
17:38 < cocon> yes
17:38 < cocon> test (length)  : 0
17:38 < cocon> test (BS)  : Empty
17:38 < cocon> test (UTF8):
17:38 < cocon>  
17:38 < stepcut> I suspect it is the javascript code that is broken. One moment.
17:39 < stepcut> try, curl -d "foo" http://localhost:8000/test
17:39 < stepcut> or something to that effect
17:41 < cocon> it works, for "foo" even from JavaScript
17:42 < cocon> only if "exotic" bytes come in it breaks
17:42 < cocon> (exotic=non-alphanumeric or sth like that)
17:42 < stepcut> exotic in what way?
17:42 < stepcut> do exotic bytes work from curl?
17:43 < cocon> how can I use curl with them?
17:43 < cocon> exotic = arbitrary from 0..255
17:45 < stepcut> curl -d $'\230' http://localhost:8000/test
17:45 < stepcut> at least in bash that is how you do it
17:46 < cocon> test (length)  : 1
17:46 < cocon> test (BS)  : Chunk "\152" Empty
17:46 < cocon> test (UTF8): ?
17:46 < cocon>  
17:46 < cocon> it translates 230 to 152
17:46 < cocon> hmmm
17:47 < cocon> I'll try the same value from the javascript
17:48 < cocon> ok, sending the single byte 230 from JavaScript results in
17:48 < cocon> test (length)  : 2
17:48 < cocon> test (BS)  : Chunk "\195\166" Empty
17:48 < cocon> test (UTF8): ?
17:48 < cocon>  
17:49 < stepcut> that is probably the utf-8 encoding of \230
17:50 < cocon> yes, is it Firefox or happstack that does the translation?
17:50 < stepcut> firefox
17:50 < stepcut> BS is showing you the octets that were sent by the browser
17:50 < cocon> so curl does a translation, too?
17:51 < stepcut> I can't explain why 230 gets turned into 152. Either curl or bash is doing that.
17:51 < stepcut> oh,
17:52 < stepcut> try, curl --data-binary $'\230'
17:52 < cocon> same result :(
17:57 < stepcut> oh!
17:57 < BMeph> ?
17:57 < stepcut> \230  is octol not decimal.
17:57 < stepcut> 0o230 = 0d152 :)
17:57 < cocon> :D
17:57 < cocon> you are the man
17:58 < BMeph> stepcut: Mesterfully done, sir!  o7
17:58 < stepcut> cocon: if I read the manpage more carefully the first time, I would be extra manly
17:58 < BMeph> *Masterfully
17:58 < cocon> so JavaScript is to blame
17:59 < stepcut> so, curl --data-binary $'\xff' http://localhost:8000/, should result in Chunk "\255" Empty
17:59  * stepcut always blames javascript
18:00 < cocon> yes, it's as you predicted
18:35 < cocon> http://code.google.com/support/bin/answer.py?answer=79663&topic=11366
18:35 < cocon> explains how to write the appropriate JavaScript
18:35 < cocon> kind of awkward
18:36 < stepcut> cocon: have you looked at jQuery at all?
18:36 < cocon> no
18:36 < cocon> should I?
18:37 < cocon> yes, maybe I should...
18:37 < cocon> thanks
18:37 < stepcut> cocon: probably...
18:37 < stepcut> cocon: I am not an jQuery / javascript guru, but it seems to make a lot of javascript things as simple as they ought to be. And helps with crossbrowser compatibility.
18:38 < stepcut> cocon: not sure if it will help with this exact problem, but it may
18:38 < cocon> I'm actually using haxe
18:38 < cocon> it's strongly typed
18:39 < stepcut> ah
18:40 < stepcut> I have not used that, though I do know of it
18:41 < cocon> works well so far, I'm trying to make it talk to happstack
18:41 < stepcut> the jQuery ajax stuff seems to only support sending key/value pairs, so..
18:42 < cocon> yeah, I'm trying with JavaScript (haxe doesn't add functionality, it just types things)
19:34 < xplo45> programmatically, what would be the best way to shutdown a happstack server. Once simpleHttp starts how can I stop it without sending a process signal
19:35 < xplo45> I need to start adding questionmarks
19:38 < xplo45> Is there some type of hook or calback that provides me with a way to stop the server?
19:38 < stepcut> xplo45: checkout the main function here, http://src.seereason.com/happstack-extra/src/Happstack/Server/Main.hs
19:39 < stepcut> xplo45: normally, we just send it a kill signal, which it catches, and then shutdown gracefull
19:40 < stepcut> xplo45: you can probably adapt that somehow
19:44 < xplo45> thank you stepcut
23:22 < mae> stepcut:
23:22 < mae> stepcut: hi you around ? :)
23:24 < stepcut> mae: yep
23:25 < mae> stepcut: what is the proper way to append (HSP XML) types
23:27 < stepcut> mae: oh man, I had a several hour long debate on #haskell-blah about this with Philippa
23:27 < stepcut> XML is not a monoid, therefore it does not make sense to append XML types
23:28 < mae> http://hpaste.org/fastcgi/hpaste.fcgi/view?id=3082#a3083
23:29 < mae> maybe my head isn't in the right place
23:29 < mae> i don't want to use the XMLGenerator method that the guestbook uses
23:29 < mae> i just want a function that takes a type and spits out HSP XML
23:30 < stepcut> mae: an XML document is always exactly one element, how do you turn <p>foo</p><p>bar</p> into exactly one element?
23:31 < mae> i see.
23:32 < mae> so how do i achieve the behavior i am going for :)
23:32 < stepcut> you can wrap the list in a useless div, renderIPNs ipns = <div><% map renderIPN ipns %></div>
23:32 < mae> ah ok
23:32 < stepcut> or, you can change renderIPNS to return a list of [HSP XML]
23:32 < mae> so map works in the xml syntax
23:32 < stepcut> renderIPNs :: [IPN] -> [HSP XML]
23:32 < stepcut> and when you use it, somewhere later, <div><% renderIPNs ipns %></div>
23:33 < mae> btw, this is a Paypal Component I am working on, which keeps a running log of Instant Payment Notifications, and provides a meager admin interface so you can see what is flowing in should the need arise
23:33 < stepcut> its not that map works in the XML syntax, just about all valid Haskell works inside <% %>
23:34 < mae> ic
23:34 < mae> so children is literally [HSP XML] ?
23:34 < stepcut> it's more than the XMLGenerator monad knows how to embed [HSP XML] as a child inside an XML element (such as div)
23:34 < stepcut> no
23:35 < stepcut> there is a type classe, EmbedAsChild which has a function, asChild, which knows how to turn things into children of an element
23:35 < mae> whee you rock
23:35 < mae> so simple, yet beyond me in this moment of slight-buzziness (some beer and tequila)
23:35 < stepcut> there are instances for lots of things like, String, Int, etc. And also for HSP XML and [HSP XML] (well, the instances are more general than that, but same effect)
23:36 < stepcut> mae: yes... the use of associated types does not make it any easier for people to grasp :)
23:38 < mae> stepcut: btw, do you use xmonad? I recently spent a day taking that plunge.. its pretty neat! i've got my gnome integrated, yet I can't get cut/paste to work right with xterm
23:38 < stepcut> mae: yep, I have been using it since it was only a few weeks old
23:38 < mae> also, xterm seems to crap out every so often
23:38 < stepcut> though, these days I am mostly working on OS X and ssh'ing into my  linux box
23:39 < mae> where i can't type into it, like its got a dead stdin
23:39 < stepcut> I use gnome-terminal
23:39 < mae> quite annoying
23:39 < stepcut> haven't seen that problem
23:39 < mae> hmm
23:39 < mae> its all xterm related.
23:39 < mae> xterm is supposed to be solid and lightweight
23:39 < stepcut> try gnome-terminal ;)
23:39 < mae> but alas i guess i will switch to gnome-terminal
23:40 < mae> even though it has a larger memory footprint
23:40 < mae> you know, with 2GB of memory, one can't afford to be wasteful >:]
23:40 < stepcut> xterm should work fine with xmonad, because that is what dons and other core developers use
23:41 < mae> ah ok
23:41 < mae> i didn't apt-get install it
23:41 < mae> it was the crusty version that comes wrapped with x
23:41 < mae> hopefully this new one should be better :)
23:42 < stepcut> ;)
23:50 < mae> thx!
--- Log closed Mon Mar 30 00:00:04 2009