Re: [Haskell] Finding the length of a String in bytes
On 22/06/06, David House <[EMAIL PROTECTED]> wrote: I recently needed to add a Content-Length header to my HTTP request forged with Network.HTTP [1]. However, this needs to be the length of the body content in bytes, not characters. Without assuming the characters will all be ASCII, is there an easy way of doing this? length seems to have the correct results, but I'm uneasy about relying on this. Is your string a string of unicode characters, or just a string read from somewhere in some encoding (in which case the value of each character is less than 256). In former case length function will fail to give correct result if you use multi-byte encoding like utf-8. You'd need to do the conversion and only then count length of the resulting sequence. In latter case length is always good, because you really have string of bytes that encode your content in some encoding, not characters, in a way. Regards, Piotr Kalinowski -- Intelligence is like a river: the deeper it is, the less noise it makes ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Problem with comboBox
On 14/08/06, L. J. <[EMAIL PROTECTED]> wrote: Hi, i'm making my first graphic interface program with Haskell. I use Glade and Gtk+2.0. I create an empty comboBox with Glade and I want to add items (strings) in run time (by means of the haskell code). I tried with the functions 'comboBoxAppendText' and 'comboBoxInsertText' (http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-MenuComboToolbar-ComboBox.html#t%3AComboBox) but I can not do anything for display the information I want. This functions require to work with a comboBox creates with the constructor comboBoxNewText (and I think this constructor is not the used by Glade). I can create it from Glade? I can do I want by another method? Thanks. You have two options: * In glade insert one-element, empty hbox (or vbox) instead of combobox, and then in runtime create a box with comboBoxNewText and add it into the hbox (or vbox). Now you can use comboBoxAppendText. * In glade insert comboBox as you do it now and in runtime add a model to that box (see attribute comboBoxModel). I am, however, not well versed in haskell interface to gtk+ so I can't help you with a model part (you can see how it is done for TreeView widget though). Regards, Piotr Kalinowski -- Intelligence is like a river: the deeper it is, the less noise it makes ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Re: Haskell web forum
HiPersonally, I prefer e-mail over forums because I never remember to check the latter for new messages. And I do check e-mail quite frequently.Regards,-- Intelligence is like a river: the deeper it is, the less noise it makes ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell