[Haskell-cafe] Trouble with readProcess
Hi -cafe, I'm using readProcess and I don't know how to handle this issue: readProcess cmd [opt1,opt2] seems to execute the following: $ cmd opt1 opt2 That is usually fine, but I'm using an external program that doesn't understand the quotes, so I need to execute instead: $ cmd opt1 opt2 How should I do that? -- Cp ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Trouble with readProcess
I've found my mistake: I was calling readProcess cmd [-p -t] instead of readProcess cmd [-p,-t] Not sure what are the semantics of quotation in this case, though. And I'm pretty sure my analysis is wrong because of that :) -- Cp On Thu, Aug 11, 2011 at 16:05, Donn Cave d...@avvanta.com wrote: Quoth Charles-Pierre Astolfi c...@crans.org, readProcess cmd [opt1,opt2] seems to execute the following: $ cmd opt1 opt2 That is usually fine, but I'm using an external program that doesn't understand the quotes, so I need to execute instead: $ cmd opt1 opt2 How should I do that? I think your analysis is wrong. I don't know what to suggest, though if you follow up you probably should mention what platform you're running on. Maybe you could devise a simple test program that illustrates the problem? Donn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Server hosting
I'm using tilaa.nl. It starts at ~10€/month and they are quite friendly and competent. -- Cp On Sat, May 7, 2011 at 13:53, Nicolas Wu nicolas...@gmail.com wrote: On 7 May 2011 13:52, Nicolas Wu nicolas...@gmail.com wrote: Then again, I haven't found many companies that list prices in GBP.) I use rackhost.co.uk Oops, I mean rackspace.co.uk, who I believe are the people behind slicehost.com which comes highly recommended. Nick ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Can't install haskellnet with ghc7
I tried to install haskellnet with mime-mail-0.2.x and an older version of the text library but it still fails with the same error. Btw, what is the best way to uninstall a package that has been installed via cabal? (or to downgrade it, fwiw) -- Cp On Tue, Apr 26, 2011 at 23:31, Vincent Hanquez t...@snarc.org wrote: On 04/26/2011 10:17 PM, Charles-Pierre Astolfi wrote: Hi -cafe, Did anybody managed to install haskellnet from hackage with ghc7? I tried on windows and mac and I get the following type error: [ 4 of 11] Compiling Network.HaskellNet.SMTP ( Network/HaskellNet/SMTP.hs, dist/build/Network/HaskellNet/SMTP.o ) Network/HaskellNet/SMTP.hs:269:25: Couldn't match expected type `Data.Text.Internal.Text' with actual type `[Char]' Expected type: Data.Text.Internal.Text Actual type: String In the first argument of `simpleMail', namely `to' In a stmt of a 'do' expression: myMail- simpleMail to from subject plainBody htmlBody attachments Am I missing something? your mime-mail library is too recent. the upper version in the cabal file of haskellnet is not limited, so it's picking up the 0.3.0 version which is incompatible with the 0.2.x. Otherwise it was working for me with the previous version for both ghc6 and ghc7. -- Vincent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Can't install haskellnet with ghc7
Hi -cafe, Did anybody managed to install haskellnet from hackage with ghc7? I tried on windows and mac and I get the following type error: [ 4 of 11] Compiling Network.HaskellNet.SMTP ( Network/HaskellNet/SMTP.hs, dist/build/Network/HaskellNet/SMTP.o ) Network/HaskellNet/SMTP.hs:269:25: Couldn't match expected type `Data.Text.Internal.Text' with actual type `[Char]' Expected type: Data.Text.Internal.Text Actual type: String In the first argument of `simpleMail', namely `to' In a stmt of a 'do' expression: myMail - simpleMail to from subject plainBody htmlBody attachments Am I missing something? -- Cp ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] OpenSSL question
Hi -cafe, I'm using the OpenSSL package, and I don't see any way to forge my own keys. (http://hackage.haskell.org/packages/archive/HsOpenSSL/0.9/doc/html/OpenSSL-RSA.html) For example, in the case of RSA, I'm given the exponent and modulus and I would like to create a public key from that, of type RSAPubKey. Is it possible ? How should I do? I'm not particularly tied to OpenSSL, anything that let me use RSA and DSA would be fine. Regards, -- Cp ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Codec.Crypto.RSA question
Thanks Mat, it works, but I still have a problem: I'm heavily using Data.Binary.encode for various types (Int32, Int8, String, Bool...) and I don't know how I should manage this using Data.ByteString.Lazy.Char8. -- Cp On Sat, Nov 20, 2010 at 22:35, Mathias Weber mat_we...@t-online.de wrote: The problem in this example is the use of Data.Binary. When using Data.ByteString.Lazy.Char8 instead, the problem does not exist. import qualified Codec.Crypto.RSA as Crypto import System.Random (mkStdGen) import Data.ByteString.Lazy.UTF8 (toString) import qualified Data.ByteString.Lazy.Char8 as C8 import qualified Data.ByteString.Lazy n = 1024 (pubKey,privKey,_) = Crypto.generateKeyPair (mkStdGen n) n encrypt :: String - Data.ByteString.Lazy.ByteString encrypt str = fst $ Crypto.encrypt (mkStdGen n) pubKey (C8.pack str) decrypt :: Data.ByteString.Lazy.ByteString - String decrypt = toString . Crypto.decrypt privKey decrypt $ encrypt haskell = haskell Regards, Mathias Am 20.11.2010 13:15, schrieb Charles-Pierre Astolfi: Here's a working example: import qualified Codec.Crypto.RSA as Crypto import System.Random (mkStdGen) import Data.Binary (encode) import Data.ByteString.Lazy.UTF8 (toString) n = 1024 (pubKey,privKey,_) = Crypto.generateKeyPair (mkStdGen n) n encrypt :: (Data.Binary.Binary a) = a - Data.ByteString.Lazy.Internal.ByteString encrypt str = fst $ Crypto.encrypt (mkStdGen n) pubKey (encode str) decrypt :: Data.ByteString.Lazy.Internal.ByteString - String decrypt = toString . Crypto.decrypt privKey Thus, decrypt $ encrypt haskell = \NUL\NUL\NUL\NUL\NUL\NUL\NUL\ahaskell I'm using Codec.Crypto.RSA and you're quoting Codec.Encryption.RSA, which is not the same thing; unfortunately I need to use RSAES-OAEP (SHA1) so I guess I have to stick with Codec.Crypto.RSA. Any ideas? -- Cp On Sat, Nov 20, 2010 at 12:50, Dominic Steinitz domi...@steinitz.org wrote: Charles-Pierre Astolfi cpa at crans.org writes: Hi -cafe, I have a question about Codec.Crypto.RSA: how to enforce that (informally) decrypt . encrypt = id Consider this code: That's certainly what I would expect and one of the unit tests that comes with http://hackage.haskell.org/packages/archive/Crypto/4.2.2/doc/html/Codec-Encryption-RSA.html checks for this. I wasn't able to get you code to compile so I couldn't investigate further. Maybe you could post a fully compiling example? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Codec.Crypto.RSA question
Here's a working example: import qualified Codec.Crypto.RSA as Crypto import System.Random (mkStdGen) import Data.Binary (encode) import Data.ByteString.Lazy.UTF8 (toString) n = 1024 (pubKey,privKey,_) = Crypto.generateKeyPair (mkStdGen n) n encrypt :: (Data.Binary.Binary a) = a - Data.ByteString.Lazy.Internal.ByteString encrypt str = fst $ Crypto.encrypt (mkStdGen n) pubKey (encode str) decrypt :: Data.ByteString.Lazy.Internal.ByteString - String decrypt = toString . Crypto.decrypt privKey Thus, decrypt $ encrypt haskell = \NUL\NUL\NUL\NUL\NUL\NUL\NUL\ahaskell I'm using Codec.Crypto.RSA and you're quoting Codec.Encryption.RSA, which is not the same thing; unfortunately I need to use RSAES-OAEP (SHA1) so I guess I have to stick with Codec.Crypto.RSA. Any ideas? -- Cp On Sat, Nov 20, 2010 at 12:50, Dominic Steinitz domi...@steinitz.org wrote: Charles-Pierre Astolfi cpa at crans.org writes: Hi -cafe, I have a question about Codec.Crypto.RSA: how to enforce that (informally) decrypt . encrypt = id Consider this code: That's certainly what I would expect and one of the unit tests that comes with http://hackage.haskell.org/packages/archive/Crypto/4.2.2/doc/html/Codec-Encryption-RSA.html checks for this. I wasn't able to get you code to compile so I couldn't investigate further. Maybe you could post a fully compiling example? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Codec.Crypto.RSA question
Hi -cafe, I have a question about Codec.Crypto.RSA: how to enforce that (informally) decrypt . encrypt = id Consider this code: encrypt2 :: String - ByteString encrypt2 = fst . encrypt (mkStdGen n) pubKey encode decrypt2 :: ByteString - String decrypt2 = toString . decrypt privKey Since decrypt2 takes a bytestring which size is a multiple of the modulus, I've guessed that the encrypted bytestring is padded with '\NUL' characters. But then some strange stuff shows up: decrypt2 $ encrypt2 haskell returns \NUL\NUL\NUL\NUL\EOThaskell decrypt2 $ encrypt2 foobar returns \NUL\NUL\NUL\NUL\65533foobar I may use dropWhile to get rid of the NUL-padding, but can I assume that I'll always get a random character between my string and the padding? I tried to pad myself with NUL characters but I got almost the same results (the random char went to the head of the string) -- Cp ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Heterogenous network stream
Hi cafe, I'd like to implement a toy-protocol and I'm looking for the sanest way (for me) to do so. Here's what it looks like: The server receives, in that order: - Ascii string (4 bytes) - 16 bits int (2 bytes) - 8 bits int (1 byte) - UTF8 string (128 bytes) I tried to use hGetBuf, but I don't know if it's the way to go and I did not understood what to do with the buf::Ptr a argument. I'm not very concerned about efficiency. I don't know how I should convert my 16 and 8 bits int (read as Chars, I guess) to an Int. Is there something for that in the standard library? As I also write the client, I'm looking for a conversion in both ways. Thanks, -- Charles-Pierre ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Software architecture
Hey there, I'm searching for software designs in Haskell ; for example, I have a pretty good ideo of how I would arrange my modules/classes (in ocaml/(java/c++)) and how they would all fit together to create, say, a website aspirator. But I don't have any clue of the right way to do it with Haskell. I don't need a solution for this example, I'd just like to see how to manage non-trivial code. I haven't found any pointers on the interwebs. On an unrelated note, what is the simplest way to get the llvm bitcode? I understand I can compile myself ghc but it there an easier way? Thanks a lot! -- Cp ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe