Archive for August, 2006

  1. [DONE] Finish webstat collecting program
  2. Benchmark Bigloo, Chicken, C, C++ (and maybe Perl, Python and Ruby)
  3. Investigate Smalltalk Seaside
  4. Investigate Scala (added 25th August)

Read Full Post »

Chicken is now working reasonably well for me. I’ve had to pull a fairly recent version directly from the source repository and build it with MinGW / MSYS but that went pretty well. I’m mildly concerned that the version I am working with is probably unique.

In the past, I have developed code using stable C++ compilers or stable versions of Perl that millions of other programmers are using. This gives me a nice secure feeling that if there are any bugs in my programs, it will be down to my code and I’ll be able to fix it myself. Using this bleeding edge chicken, I’ll probably have niggling doubts that there could be problems which are down to the compiler and/or third party libraries.

I have installed a number of chicken libraries, or eggs as they are called and they have mostly worked fine. In particular, I was surprised at how smoothly the sqlite3 install went, although I have yet to test the functionality.  Overall, I’m happy with the chicken module system. I’m still having a number of problems with one useful module though – srfi-19, the date/time scheme extension. I’ll need to look into that a bit further.

Read Full Post »

Blogger corruption part 2

Even Performancing can’t fix my problems with Blogger! When I try to login to my account it complains that the Atom server is not available. I know that many people are using Blogger without any problems but it isn’t working for me. I have decided to move my blog over to WordPress and see how that goes. Performancing was a nice discovery so I’ll keep using that and see how it goes.

Read Full Post »

While I was working on my second post during early July my connection to Blogger was corrupted as I was saving an early draft. This seems to have corrupted my blog, and now when I try and create a new post, there is no title box. Blogger takes the first few lines of the post as the title which does not look good. I wrote to the technical support staff and received some links to frequently asked questions. It does not look like any of them solve my problem.

I recently discovered the Firefox Performancing extension. This tool works very well. I’ve been able to update all of my earlier posts that had mangled titles. Unfortunately, it looks as though they were all published on the same day, but I suppose it is not too important with just four previous posts. I also tried the 13.6MB Bottom Line Blog Poster tool which is written in SmallTalk. I cannot recommend this tool as firstly it will not function correctly on a Windows LUA (i.e. not adminstrator) account and secondly, I could not get the thing to connect to my blogger account. Performancing on the other hand was very easy to set up and works like a charm.

Read Full Post »

I don’t have Visual C++ installed on my home PC and many of the eggs require a C compiler in order to compile and install them. What would be perfect for me needs would be:

  • An easily installable Chicken Scheme (e.g. using .msi)
  • …that was built using MinGW / MSYS
  • …and can use MinGW / MSYS to build and install new eggs
  • …and has a chicken-setup.exe that “just works” with these tools

The chicken mailing list indicates that there are problems with building the current version from the source repository, failing to include srfi-1 amongst other problems. I’ll try to build it myself once I have reinstalled Windows.

Tools required:

Darcs http://abridgegame.org/darcs
Chicken 2.3
Win32 binary
Latest chicken from darcs repository $ darcs get http://galinha.ucpel.tche.br/chicken
MinGW + MSYS http://www.mingw.org

Originally posted: Saturday, July 08, 2006

Read Full Post »

The chicken honeymoon is over

Hmmm… chicken hangs when trying to do anything useful. This is almost certainly down to my system configuration. I’m trying to use the free Microsoft command-line compiler but the fact that it can’t even compile a simple C++ hello world probably isn’t a good sign (it complains about a missing libcpmt.lib). I think the chicken eggs that I need only require a C compiler so I attempted to press on regardless. http.egg compiled and installed, but trying to run chicken-setup htmlprag hangs at the command:

c:\chicken-2.3\csc -feature compiling-extension -s -R syntax-case -O2 -d0 htmlprag.scm


So, what are my options?

1. Move to PLT Scheme

I’ve heard nothing but good things about PLT Scheme, but one of the attractive things about chicken for me is the efficient compile from scheme to C to binary. It seems that you can do this with PLT, but it isn’t the recommended method.

2. Move to Linux

I know that at least the tool-chain is good on Linux 🙂 Additionally, my Windows install seems to be on it’s last legs – it is really slow and probably infested with spyware. On the other hand, part of the reason of choosing chicken scheme is to be able to target Windows binaries easily.

3. Buy VC++ 6

I’m not too keen on buying an obsolete compiler, plus I’m a little cheap!

4. Re-build chicken scheme with MINGW / Visual C++ Express

This would fit in with my goals of being able to produce windows binaries while writing scheme. There isn’t too much documentation on the web about how to go about it though. I really don’t like fighting the tool-chain, but at least if it works it should be a one-off.

Originally posted: Thursday, July 06, 2006

Read Full Post »

I wanted to write a small script to load a webpage and do some analysis. Ordinarily I would fire up perl and use LWP with quick and dirty regexes but this is a good opportunity to use one of the interesting languages.

Now, I haven’t learnt a new language properly for around 10 years although I have spent a little of the intervening time looking at scheme textbooks! I installed chicken scheme and quack.el to support editing with emacs. After a quick look at the chicken website I decided I needed the http and htmlprag eggs (chicken libraries). Installing them using chicken-setup was very easy although I discovered it required a C compiler when I tried it on a number of different boxes :-/

Well, first things first. For some webpages need you to represent yourself as a bonafide browser or else you get a “403 forbidden” message (The way you do this using perl LWP is something like $browser->agent(‘Mozilla/5.0’)). I couldn’t see an easy way to do this in the chicken http library. Fortunately it is easy enough to modify the .scm.

http:send-request is the function I want to modify. It begins like this:

(define (http:send-request req . more)
  (let-optionals more ([in #f]
                       [out #f] )
                 (let* ([req (if (string? req)
                                 (http:make-request 'GET req '(("Connection" . "close")))
                                 req) ]

The (req . more) construction isn’t too complicated. It corresponds more or less to this perl:

my ($req, @more) = @_;

However, I wasn’t at all familiar with (let-optionals …). Fortunately, the chicken scheme documentation is excellent and it looks like it maps to the following pseudo-perl.

my $in = shift @more || #f;
my $out = shift @more || #f;

i.e. local parameters are created and assigned to the values of more in turn or have a default value if there are not sufficient values in the @more array. Hmmm… I think that description is much less clear than the one in the chicken documentation.

The next bit makes a http request ‘object’, passing in a list of dotted pairs to use as attributes. As we never override the default values for in and out, we can use ‘more’ to pass in our own attributes. The modified send-request therefore becomes:

(define (http:my-send-request req . more)
  (let* ((in #f)
         (out #f)
         [req (if (string? req)
                  (http:make-request 'GET req (cons '("Connection" . "close") more))

We need to add the new function name to the export list so it is available outside the library:

    http:my-send-request ;; <-- Here
    http:GET http:POST

Then we add a wrapper for my-send-request in the client code to pass in the attributes we want:

(define (send-request-wrapper url)
  (http:my-send-request url
                        '("User-Agent" . "Mozilla/5.0")
                        '("Content-Type" . "application/x-www-form-urlencoded")))

and finally a wrapper to open a url, return the data as a list of lines and close the ports when we have finished with them:

(define (load-url url)
  (define-values (h a i o) (send-request-wrapper url))
  (let ((data (read-lines i)))
    (close-input-port i)
    (close-output-port o)

Whew! That seemed like a fair amount of effort, at least in comparison to Perl/LWP. Hopefully it will get easier as I become more familiar with chicken.

Originally posted: Wednesday, July 05, 2006

Read Full Post »

Older Posts »