Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Reading pcap file (mukesh tiwari) 2. wxHaskell: Make textCtrl logger scroll one line at a time (Paulo Pocinho) 3. Re: wxHaskell: Make textCtrl logger scroll one line at a time (Paulo Pocinho) 4. haskell-src (jean verdier) 5. Re: haskell-src (Brent Yorgey) 6. how to increase the stack size (kolli kolli) 7. Re: how to increase the stack size (Erik de Castro Lopo) 8. Re: haskell-src (jean verdier) ---------------------------------------------------------------------- Message: 1 Date: Sun, 16 Oct 2011 18:21:40 +0530 From: mukesh tiwari <mukeshtiwari.ii...@gmail.com> Subject: [Haskell-beginners] Reading pcap file To: beginners@haskell.org Message-ID: <cafhzve-y8c9g4aohiwp3+frtjbr7uhyojbdspj_u0qn9vug...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Hello everyone I am writing application which reads pcap file like wireshark in pure haskell but there is some thing missing. I read this file http://www.viste.com/Linux/Server/WireShark/libpcapformat.pdf<http://www.google.com/url?sa=D&q=http://www.viste.com/Linux/Server/WireShark/libpcapformat.pdf&usg=AFQjCNFGc3iahpvawk5KhrVxQzqC2grFJQ> and it say that first 24 bytes are global headers , after that every packet contains pcap local header and data. What i am trying to do is , first trying to get the bytes of data in each packet by reading the third field incl_len in local header but my code is not behaving as it suppose . I am not getting the list of parsed packets . My test libcap file is http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&ta...<http://www.google.com/url?sa=D&q=http://wiki.wireshark.org/SampleCaptures%3Faction%3DAttachFile%26do%3Dview%26target%3Dudp_lite_normal_coverage_8-20.pcap&usg=AFQjCNHAd7QbbHa6l55Fwc4MrbbCraMLAQ> --http://www.viste.com/Linux/Server/WireShark/libpcapformat.pdf<http://www.google.com/url?sa=D&q=http://www.viste.com/Linux/Server/WireShark/libpcapformat.pdf&usg=AFQjCNFGc3iahpvawk5KhrVxQzqC2grFJQ> --http://hackage.haskell.org/packages/archive/bytestring/0.9.0.4/doc/<http://www.google.com/url?sa=D&q=http://hackage.haskell.org/packages/archive/bytestring/0.9.0.4/doc/&usg=AFQjCNFQJPNdbFIyyTOW8Bb7N9FLj9lsWw> html/Data-ByteString-Lazy.html import Data.List import qualified Data.ByteString.Lazy as BS import qualified Data.ByteString.Lazy.Char8 as B import Control.Monad import Text.Printf import Data.Word import Data.Char import System.Time import Numeric import System.Environment hexTodec :: BS.ByteString -> Integer hexTodec lst = read $ "0x" ++ ( concatMap ( \x -> showHex x "" ) $ BS.unpack lst ) parseFile :: BS.ByteString -> Bool -> IO [ BS.ByteString ] parseFile xs revflag | BS.null xs = return [] | otherwise = do let ind =if revflag then hexTodec . BS.reverse . BS.take 4 . BS.drop 8 $ xs else hexTodec . BS.take 4 . BS.drop 8 $ xs print ind let ( x , ys ) = BS.splitAt ( fromIntegral ind ) xs --BS.putStrLn $ x tmp <- parseFile ys revflag return $ x : tmp main = do [ file ] <- getArgs contents <- BS.readFile file let ( a , rest ) = BS.splitAt 24 contents --strip global header let revflag = case BS.unpack $ BS.take 4 a of [ 0xd4 , 0xc3 , 0xb2 , 0xa1 ] -> True _ -> False p <- parseFile rest revflag print $ p !! 0 BS.putStr $ p !! 0 Regards Mukesh Tiwari -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20111016/dfb438d3/attachment-0001.htm> ------------------------------ Message: 2 Date: Sun, 16 Oct 2011 15:04:50 +0100 From: Paulo Pocinho <poci...@gmail.com> Subject: [Haskell-beginners] wxHaskell: Make textCtrl logger scroll one line at a time To: beginners@haskell.org, wxhaskell-us...@lists.sourceforge.net Message-ID: <cak4i1qq0_zbxjszsr4sadkxjevuxyfxbi1tfjv308u248km...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Hello. I want to know how to make the textCtrl widget scroll only one line at a time instead the default one page at a time. The usage is the same as the one given by the examples. Text is appended to a textCtrl that serves as a logging window. However, once the appended line reaches the bottom of the scrolled text, the textCtrl automatically "jumps" one page. There is an attribute in wxWidgets called ScrollLine () that makes it only scroll the number of lines we want [1] but I can't find it in wxHaskell. How can I make text scroll one line instead of jumping a screen at a time? ------------------------------ Message: 3 Date: Sun, 16 Oct 2011 15:07:05 +0100 From: Paulo Pocinho <poci...@gmail.com> Subject: Re: [Haskell-beginners] wxHaskell: Make textCtrl logger scroll one line at a time To: beginners@haskell.org, wxhaskell-us...@lists.sourceforge.net Message-ID: <CAK4i1qT5_JObDHBWGpVGXo+GBpm83Y=Z79=nykxoovwky++...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Forgot to include the link to wxTextCtrl page. Here it is: http://wiki.wxwidgets.org/WxTextCtrl On 16 October 2011 15:04, Paulo Pocinho <poci...@gmail.com> wrote: > Hello. I want to know how to make the textCtrl widget scroll only one > line at a time instead the default one page at a time. > > The usage is the same as the one given by the examples. Text is > appended to a textCtrl that serves as a logging window. > > However, once the appended line reaches the bottom of the scrolled > text, the textCtrl automatically "jumps" one page. There is an > attribute in wxWidgets called ScrollLine () that makes it only scroll > the number of lines we want [1] but I can't find it in wxHaskell. > > How can I make text scroll one line instead of jumping a screen at a time? > ------------------------------ Message: 4 Date: Sun, 16 Oct 2011 18:27:47 +0200 From: jean verdier <verdier.j...@gmail.com> Subject: [Haskell-beginners] haskell-src To: beginners@haskell.org Message-ID: <1318782467.2381.20.camel@localhost.localdomain> Content-Type: text/plain; charset="UTF-8" I'm using haskell-src to build a haskell compiler. I've compiled hscolour and haskell-src to java classes and used the result to colorize and report parsing errors in an eclipse editor. I use 1.0.1.3 and it reports unterminated comments on the token before the {- token so it is mildy informative and possibly an error in the implementation. haskell-src serves me well but i would like some better error reporting as "parse error" is quite non informative. I would like to avoid building my own parser and so would like to know what the options are for parsing haskell sources with an improved error reporting. I've no idea how i should share screenshots so i've uploaded to the first site i've found: http://imageshack.us/photo/my-images/853/scr1g.png/ http://imageshack.us/photo/my-images/706/scr2a.png/ ------------------------------ Message: 5 Date: Sun, 16 Oct 2011 12:50:39 -0400 From: Brent Yorgey <byor...@seas.upenn.edu> Subject: Re: [Haskell-beginners] haskell-src To: beginners@haskell.org Message-ID: <20111016165039.ga30...@seas.upenn.edu> Content-Type: text/plain; charset=us-ascii As I understand it, haskell-src-exts is to be preferred to haskell-src since it is more actively maintained and parses more programs (including some GHC extensions). You may want to try switching to haskel-src-exts and see if that solves your problem. -Brent On Sun, Oct 16, 2011 at 06:27:47PM +0200, jean verdier wrote: > I'm using haskell-src to build a haskell compiler. I've compiled > hscolour and haskell-src to java classes and used the result to colorize > and report parsing errors in an eclipse editor. I use 1.0.1.3 and it > reports unterminated comments on the token before the {- token so it is > mildy informative and possibly an error in the implementation. > haskell-src serves me well but i would like some better error reporting > as "parse error" is quite non informative. I would like to avoid > building my own parser and so would like to know what the options are > for parsing haskell sources with an improved error reporting. > > I've no idea how i should share screenshots so i've uploaded to the > first site i've found: > http://imageshack.us/photo/my-images/853/scr1g.png/ > http://imageshack.us/photo/my-images/706/scr2a.png/ > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 6 Date: Sun, 16 Oct 2011 20:39:13 -0600 From: kolli kolli <nammukoll...@gmail.com> Subject: [Haskell-beginners] how to increase the stack size To: beginners@haskell.org Message-ID: <CAE7D9k72Qdmzo8jekATegMo6sz=cqiumgrhsz40oj+n5pxu...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" when I am running the program in my terminal on ubuntu its showing me GHC stack-space overflow: current limit is 536870912 bytes. Use the `-K<size>' option to increase it. how can i increase the stack size????Plz help me out.... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20111016/9d89466c/attachment-0001.htm> ------------------------------ Message: 7 Date: Mon, 17 Oct 2011 14:37:06 +1100 From: Erik de Castro Lopo <mle...@mega-nerd.com> Subject: Re: [Haskell-beginners] how to increase the stack size To: beginners@haskell.org Message-ID: <20111017143706.b7dd6fea9a5d9074acd53...@mega-nerd.com> Content-Type: text/plain; charset=US-ASCII kolli kolli wrote: > when I am running the program in my terminal on ubuntu its showing me > GHC stack-space overflow: current limit is 536870912 bytes. Are you really sure you want to do that? 512Meg is rather a large stack and most sane programs probably shouldn't use that much. I suspect you have a bug in your program, eg a recursion without a termination condition. > Use the `-K<size>' option to increase it. > how can i increase the stack size????Plz help me out.... ./program +RTS -K<size> but its unlikely that will actually help you. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ ------------------------------ Message: 8 Date: Mon, 17 Oct 2011 09:18:10 +0200 From: jean verdier <verdier.j...@gmail.com> Subject: Re: [Haskell-beginners] haskell-src To: Brent Yorgey <byor...@seas.upenn.edu> Cc: beginners@haskell.org Message-ID: <1318835890.2325.11.camel@localhost.localdomain> Content-Type: text/plain; charset="UTF-8" Thanks for your reply. Haskell-src parses enough haskell for my needs so extended haskell parsing is not the problem atm. I am looking for parser that outputs better errors. I have run some quick parsing tests using haskell-src-exts using ghc and the error reporting is not better for me as it outputs the same wrong offset for unterminated comments and the parse errors are not much more informative:"Parse error: ;" but there are no semi in the original text, and some looks like overkill in simple haskell sources:"TemplateHaskell is not enabled" that is output for some unterminated root decl. I will keep haskell src for the time being, hoping that there is some already written parser that i can use but in the worst case i will write one myself. On Sun, 2011-10-16 at 12:50 -0400, Brent Yorgey wrote: > As I understand it, haskell-src-exts is to be preferred to haskell-src > since it is more actively maintained and parses more programs > (including some GHC extensions). You may want to try switching to > haskel-src-exts and see if that solves your problem. > > -Brent > > On Sun, Oct 16, 2011 at 06:27:47PM +0200, jean verdier wrote: > > I'm using haskell-src to build a haskell compiler. I've compiled > > hscolour and haskell-src to java classes and used the result to colorize > > and report parsing errors in an eclipse editor. I use 1.0.1.3 and it > > reports unterminated comments on the token before the {- token so it is > > mildy informative and possibly an error in the implementation. > > haskell-src serves me well but i would like some better error reporting > > as "parse error" is quite non informative. I would like to avoid > > building my own parser and so would like to know what the options are > > for parsing haskell sources with an improved error reporting. > > > > I've no idea how i should share screenshots so i've uploaded to the > > first site i've found: > > http://imageshack.us/photo/my-images/853/scr1g.png/ > > http://imageshack.us/photo/my-images/706/scr2a.png/ > > > > > > > > _______________________________________________ > > Beginners mailing list > > Beginners@haskell.org > > http://www.haskell.org/mailman/listinfo/beginners > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 40, Issue 23 *****************************************