Emil’s Chronicle - The journal of Emil A Eklund

Updated Spell Checker

Done some minor modifications to the spell checker over the weekend, the most notable ones:

  • Should work in the 64 bit edition of Internet Explorer (thanks Erik).
  • Uses a curly underline, instead of a dashed one.
  • Fixed a bug in the Mozilla implementation that resulted in a few extra calls to the server while a word was being typed.

Other than that I’ve also created a C++ implementation of the server side component that uses FastCGI and is quite a bit more efficient than the old Perl CGI one. Other than being faster it’s also easier to use under Windows.

Updated demo
Updated spellchecker.js
C++ FastCGI Serverside component

Unix users should install FastCGI, mod_fastcgi and Aspell and then use the Makefile to build it.

Windows users should download the FastCGI dll and place it in their apache2/modules directory. Then download libfcgi.dll and place it in the windows/systems32 directory. Then proceed to download and install the win32 version of Aspell and at least one dictionary.

Finally download either the Visual C++ project or the compiled spellchecker application.

Once everything is set up enter add the following lines to httpd.conf:

LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
FastCgiServer /var/web/emil.eae.net/spellchecker
	-initial-env ASPELL_LANG=en_US
	-initial-env ASPELL_DICT_DIR=/usr/local/share/aspell
	-initial-env ASPELL_DATA_DIR=/usr/local/share/aspell
ScriptAlias /spellchecker /var/web/emil.eae.net/spellchecker

for unix or

LoadModule fastcgi_module modules/mod_fastcgi-2.4.2.dll
FastCgiServer W:/Projects/spellchecker/Debug/spellchecker.exe
	-initial-env ASPELL_LANG=en_US
	-initial-env ASPELL_DICT_DIR=C:/Progra~1/Aspell/dict
	-initial-env ASPELL_DATA_DIR=C:/Progra~1/Aspell/data
ScriptAlias /spellchecker W:/Projects/spellchecker/spellchecker.exe

for windows. The FastCgiServer directive should be on one line.

I’m assuming you’re using Apache 2 here, see the FastCGI documentation for information about your webserver should it not be Apache.


I really do appreciate all the feedback I’ve received so far, thanks guys! Please keep it coming.

11 Responses to 'Updated Spell Checker'

  1. zz85 Says:

    Hi there!

    Like to say thanks for your very cool spellchecker and now I have my server side script in PHP and you can see me trying to integrate it in a wordpress plugin at http://www.lab4games.net/zz85/blog/2005/06/11/ajax-spell-checks/

    However 1 problem i have on Firefox is that after I try clicking on a suggestion, the textarea loses it focus for typing.

  2. Emil Says:

    Thats great, let me know how it works out for you.

    I just updated the script with a fix for the problem you described. Thanks.

  3. zz85 Says:

    Emil.Thanks for the update.
    Opps, i tried http://me.eae.net/stuff/spellchecker/spellchecker.js but it was the same. however it did work with my firefox 1.0 so i decide to use js in the source ;)

    One issue is that when you try to load a textarea when text already in it, (eg. editing a post) activating the spell check would give you a clean textarea.

    Another problem is that if you type too fast sometimes, some characters seems to get eaten up. Same for highighting or making a selection too quickly, the selection just bounces off.

    A small issue is that Firefox would get a extra back history after spellcheck init.

    Did any of your old version worked with the same element of the textarea rather than replacing it? I guess that would work better for me. “)

  4. Emil Says:

    Try again, perhaps you got a cached copy?

    Populating the control with the text already in the textarea should be fairly simple to add (the
    fromForm method pretty much does that).

    The extra back history entry issue is something I fail to reproduce, care to explain it?
    As for using the textelement instead of a content editable container that would prevent the underlining, as markup cannot be applied to text inside a textbox.

    The problem with selection I am aware of but missing keypresses? That I’ve never seen so some more information would be appreciated.

    Thanks.

  5. Enry Says:

    Good job.

    I will build a COM version of the server-side component (provided I can find a suitably built version of Aspell for windows).  This will make it possible to use under “swiss-cheese” windows/iis without resorting to dangerous things such as enabling file execute access.  I’ll email you the project if you are interested?

    Thanks

  6. Enry Says:

    Update on the above comment, I have completed an ASP (COM) version, and it works well.

  7. Emil Says:

    Impressive, would you mind sharing it?

  8. Matt Says:

    Hi Emil,

    I cant get mod_fastcgi-2.4.2-AP20.dll to load with apache2. I keep getting the following error -

    Parent: Received restart signal — Restarting the server.
    httpd.exe: Syntax error on line 117 of C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load C:/Program Files/Apache Software Foundation/Apache2.2/modules/mod_fastcgi-2.4.2-AP20.dll into server: The specified module could not be found.
    [Tue May 30 08:00:39 2006] [warn] (OS 995)The I/O operation has been aborted because of either a thread exit or an application request. : winnt_accept: Asynchronous AcceptEx failed.

    Any help would be greatly appreciated.

    Thanks

  9. Emil Says:

    Matt > Looks like you’re trying to use it with Apache 2.2, the mod_fastcgi module provided is for apache 2.0, it’s not compatible with version 2.2

    As of right now there is no official version of mod_fastcgi with support for Apache 2.2; either get the latest version of Apache 2.0 or build your own version of mod_fastcgi, with the patch following patch applied:

    http://www.fastcgi.com/archives/fastcgi-developers/2005-December/004060.html

  10. Emil Says:

    You might also be interested in http://mproxyfcgi.sourceforge.net/, I haven’t tried it myself yet but it looks promising.

  11. DLL Files Dude Says:

    Im having similar errors with mod_fastcgi-2.4.2-AP20.dll not working with apache? Whats the fix on that if you don’t mind?

Leave a Reply

(required)
(required, will not be published)