[Haskell-cafe] HXT and xhtml page encoded in cp1251

2011-04-18 Thread Dmitry V'yal
Greetings, I'm writing a small webcrawler. Usually I used tagsoup for such tasks but this time I decided to give hxt a try. Unfortunately, I ran into the troubles with character encodings. The site I'm targeting uses cp1251, which is the one of the most popular among sites in Russian. Pages

Re: [Haskell-cafe] handling multiple versions of a data structure

2010-12-19 Thread Dmitry V'yal
On 17.12.2010 01:09, Jeremy Shaw wrote: Hello, You should use happstack-data for this (you do not need the other happstack components to use happstack-data)*. It was created to solve this exact problem. happstack-data builds on type of the 'binary' library and adds versioned data types and

[Haskell-cafe] handling multiple versions of a data structure

2010-12-16 Thread Dmitry V'yal
Greetings, while developing my neural net simulator I stumbled upon a problem. I have a data type NeuralNet and use Show and Read instances for saving and loading configurations. As time passed, I changed the data type, so the program can no longer load files saved in previous versions. I

[Haskell-cafe] CBRef, a wrapper around IORef with callbacks

2010-12-14 Thread Dmitry V'yal
Hello, while building GUIs using Gtk2HS I always struggled with the following question: how to sync the state of the GUI with the state of the rest application. I usually make several IORefs store the state there. But it's quite easy to forget to update relevant parts of GUI when state

Re: [Haskell-cafe] Re: Does it deserve to be a hackage package?

2010-10-28 Thread Dmitry V'yal
On 27.10.2010 13:16, Andy Stewart wrote: Christopher Donechrisd...@googlemail.com writes: On 27 October 2010 10:13, Dmitry V'yalakam...@gmail.com wrote: While ago I had a question about opening the url in the default browser from haskell program. I didn't get any immediate answers so I

[Haskell-cafe] Does it deserve to be a hackage package?

2010-10-27 Thread Dmitry V'yal
Hello haskellers, While ago I had a question about opening the url in the default browser from haskell program. I didn't get any immediate answers so I wrote my own solution. On Linux it uses xdg-open and on Windows - ShellExecute Api. Later I received a letter saying what similar

[Haskell-cafe] Opening a gtk2hs link in default browser

2010-10-17 Thread Dmitry V'yal
Hello list, I'm trying to make a clickable link in gtk2hs program. Clicking it should open an url in the default browser. Can I hope to find some portable solution in gtk2hs (it should work in linux and windows) or should I start searching platform specific ones, like /usr/bin/xdg-open or

[Haskell-cafe] a couple of cabal related questions

2010-10-12 Thread Dmitry V'yal
Hello, recently I've cabalized my program and it brought some problems. First of all, I made use of 'import Paths_package name' functionality to get the path of installed data files. It works great, but now I can no longer run my program in ghci because this module is auto-generated by

Re: [Haskell-cafe] a couple of cabal related questions

2010-10-12 Thread Dmitry V'yal
On 12.10.2010 13:45, Magnus Therning wrote: On Tue, Oct 12, 2010 at 10:20, Dmitry V'yalakam...@gmail.com wrote: Hello, recently I've cabalized my program and it brought some problems. First of all, I made use of 'import Paths_package name' functionality to get the path of installed data

[Haskell-cafe] Packaging a Gtk2hs based program for Windows

2010-10-07 Thread Dmitry V'yal
Hello, haskellers. Recently I stumbled upon a problem. It may sound quite off-topic for this list, but, I'm sure, almost every haskell programmer runs into it sooner or later. It sounds: How to make a neat Windows installer for a nice Gtk2hs program I wrote last week? How to solve the

[Haskell-cafe] Spiking neural networks in Haskell

2010-07-03 Thread Dmitry V'yal
Greetings anyone, Some time ago I with a friend of mine implemented a toy interactive simulator of neural network activity. It has a totally imperative design and uses Gtk2hs for user interface parts. The darcs repository is available here: http://vyal.ru/code/spiking_neuro Now we decided

[Haskell-cafe] Happstack basic question

2010-03-11 Thread Dmitry V'yal
Hello haskellers, I want to host a simple happstack application behind a reverse proxy. So ideally would be to bind it to localhost only. According to http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf Conf datatyle has only

[Haskell-cafe] GUI and background processing

2009-06-01 Thread Dmitry V'yal
Greetings, fellow haskellers. Currently I'm writing some kind of web crawler in haskell with gtk2hs gui. All network operations are run in separate thread, but sometimes input from user is needed. Afaik, gtk2hs is not thread safe, so I came up with following: I create two mvars, A and B,

[Haskell-cafe] How to get glyph outline from ttf font.

2009-04-04 Thread Dmitry V'yal
Greetings. I'm trying to render some glyphs from ttf font to svg image using gtk2hs cairo binding. Since I can find nothing appropriate in gtk2hs API, I decided to draw outlines with bezier curves myself. But how to get them out of font? As far as I know, freetype library is capable of

Re: [Haskell-cafe] what GUI library should i select?

2006-11-14 Thread Dmitry V'yal
Iván Pérez Domínguez wrote: I'm using Gentoo Linux. We obviously don't use prebuilt packaged versions, but installing it is just doing emerge wxhaskell and 'playing the... waiting game'. Gtk2hs support under Gentoo is mostly missing (the package is included, but doesn't work at all). Hmm,

Re: [Haskell-cafe] what GUI library should i select?

2006-11-14 Thread Dmitry V'yal
Bulat Ziganshin wrote: it is what i say about. threaded RTS + multipls threads that does computations + one thread that interfaces with Gtk2Hs. afaiu, the only problem is that i need to manage both Gtk events and periodically check queue of commands from other threads, but using timer + Chan

Re: [Haskell-cafe] what GUI library should i select?

2006-11-14 Thread Dmitry V'yal
Duncan Coutts wrote: The problem at the moment with GUIs and GHC's threaded RTS is that there is now way to specify that all the Haskell threads that want to do GUI stuff must run on a single OS thread. It's not impossible to solve but it requires either more support from the RTS or it needs

[Haskell-cafe] Profiling Gtk2HS applications

2006-06-07 Thread Dmitry V'yal
Hello. How can one profile a program which uses gtk2hs? I get this: $ ghc --make MainGui.hs -prof Chasing modules from: MainGui.hs Could not find module `Graphics.UI.Gtk.Mogul': use -v to see a list of the files searched for (imported from ./TreeViewHelpers.hs) I tried to specify gtk2hs

[Haskell-cafe] UTF-8 Strings and GHC

2006-05-25 Thread Dmitry V'yal
Hi, all. I'm writing a GUI app using Haskell and Gtk2HS. All goes well besides one thing. I need to display some messages in russian and I can't figure out, how to handle that. Gtk uses UTF-8 internally, so i have to pass UTF-8 strings to it somehow. But how to define them in source file? I get

[Haskell-cafe] Re: [Haskell] reading binary files

2006-04-07 Thread Dmitry V'yal
Hello, Bulat I'm currently working on some kind of program for analysing FAT partitions. Don't ask why did I chose to implement it in Haskell :) Just for fun. My program needs to read scattered chunks of binary data from a huge file and to do a good amount of deserialisation. I implemented

Re: [Haskell-cafe] GUI-Woes

2006-03-14 Thread Dmitry V'yal
Duncan Coutts wrote: You didn't do anything wrong. By default that's what happens with large libs built with ghc. However, the current development version (and so the next release version) of Gtk2Hs has support for ghc's split objects feature. With this, a simple Gtk2Hs Hello world program

Re: [Haskell-cafe] GUI-Woes

2006-03-13 Thread Dmitry V'yal
Christophe Poucet wrote: I have to concur with Duncan. I started using Gtk2Hs for a small project and literally within a couple hours I had a good understanding upon which to build a nice gui as well as the gui itself. I haven't tried out wxhaskell, but trying gtk2hs and it's cairo

Re: [Haskell-cafe] Lists of Lists

2006-03-09 Thread Dmitry V'yal
zell_ffhut ?: Last attempt, as its due in a couple of hours Here's what i have so far.. charToGrid :: Char - Position - Grid - Grid charToGrid c [] (row,col) xs = xs charToGrid c (row,col) xs = (changeValue c (concat xs (row*9 + col))) Using changeValue - changeValue x 0 (y:ys)

Re: [Haskell-cafe] Infinite loop?

2006-02-19 Thread Dmitry V'yal
Barbier de Reuille Pierre wrote: And how can you, in Haskell, detect symbolic links ? One can use System.Posix.Files.isSymbolicLink function for that purpose. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Concurrency question

2005-09-07 Thread Dmitry V'yal
Donald Bruce Stewart wrote: Can I ask if just using a `seq` works as well? That was enough (now I recall) for the watchdog code I posted earlier. -- Don In my case this doesn't work timeout :: DeepSeq a = Int - IO a - IO (Maybe a) timeout n t = do res - par_io timer thr --timer

Re: [Haskell-cafe] Concurrency question

2005-09-06 Thread Dmitry V'yal
I believe you're just observing lazy evaluation at work. The IO computation that you're forking is (return $ resolve cnf). `resolve` is a pure function. Hence the forked computation succeeds immediately--and the thread terminates (successfully)--without evaluating (resolve cnf). It isn't