APL DICT Client
for Windows

    The Dictionary Server Protocol (RFC 2229) defines a standard for TCP access to lexical and informational databases in the public domain. DICT servers provide a variety of dictionary databases, such as common and specialized word definitions, language-pair translations, thesaurus, geographic places, and atomic elements, to mention a few. Although several Web/browser-based DICT clients exist (see resources at dict.org), there are advantages to using a direct TCP client, including faster operational speed, easier means for saving and utilizing results, and greater flexibility in creating custom engines or interfaces that fit within other applications. The example workspace described below demonstrates a simple DICT client developed in APL. A complete, self-installing runtime version also is available.

Previous users please note: Since Microsoft has removed the DHTML control from Windows Vista, the default display for this application has been changed to a Microsoft WebBrowser control. Vista users still can use the DHTML display if desired by installing the DHTML Editing Control for Applications Redistributable Package (x86) from Microsoft and changing the .ini configuration as discussed below.

APL DICT Client 2.0
1,061,475 bytes
27 Dec 2006
includes APL+Win® 4 runtime interpreter
for APLers:
APLDICTCLIENT.w3
124,618 bytes
requires APL+Win® 4+ development interpreter

    This APL+Win workspace offers an example of a DICT client with the GUI shown below. It features essentially the same functionality as typical Web-based clients, with the following exceptions:

APL Dict Client

Runtime Users: The technical discussion below applies mostly to the development version. The runtime version operates the same way, however all the configuration options mentioned are accessible via the ini file.

    To operate the example, load the workspace and execute function "RunADC" in the APL+Win session manager. Selecting a DICT server from the list automatically attempts to connect and request its database list (SHOW DB command) and strategy list (SHOW STRAT command) which are then placed in the designated combo boxes. (DICT servers not on the default list can be typed in or added to the [DICTservers] section of the ini file.) Select a DICT command from the dropdown list, select or enter any parameters required by that particular command, then click the Submit button. Text results are displayed in the response window. Coded server responses (such as "552 no match") are displayed on the status bar at the bottom of the window. The most relevant user commands are:

DEFINE database word
Enter a word or words to look-up; optionally select a specific database.
Returns definitions or other information from databases where the word is found.
MATCH database strategy word
Enter a word or words to look-up; optionally select a specific database and/or search strategy.
Returns names of databases where the word is found; use results to select a specific database for the DEFINE command.
SHOW INFO database
Retrieves information about the selected database.

    While connected to a DICT server, the server dropdown list is disabled and the QUIT command must be sent before another server can be selected. If the DICT server times out and disconnects due to inactivity, the client should re-connect automatically when the next command is sent. If not, submit the "connect" command to re-connect to the same or another server. In the runtime version, the last-used DICT server, database and strategy are saved in the ini file and automatically connected the next time the program is run. To prevent this behavior, leave the server blank before closing the program, or, to disable it entirely, set AutoConnect=0 in the ini file.

    The example is coded to allow use of an Edit, DHTML, RichEdit (RTF) or Microsoft WebBrowser control to display server text responses. With the DHTML, RichEdit and WebBrowser controls, responses are appended to the existing text; with the Edit control, each response replaces the previous. The default for this example is the WebBrowser control, since it can display Unicode characters (and the DHTML control will not be available in Windows Vista.) To use one of the other controls, open the function InitADC (or ini file) and change the "Display" variable assignment to 'dhtml', 'edit' or 'richedit'. Be aware that HTML character-entity codes for Unicode characters are lost when text is copied from the Microsoft DHTML or WebBrowser controls. If you want to see these codes, operate the client with the Edit or RichEdit display.

    Prior to IE 7, the DHTML control would not display some Unicode characters if standard Windows fonts were used. This example is coded to use Microsoft's "Courier New" as the default font. Alternate fonts can be specified (see functions InitADC and adcHTML, or the ini file). "Gentium" is a free Unicode serif typeface available from SIL International. Another good one is the Bitstream Vera open-source font set which contains serif, sans-serif and monospace faces.

    Additional notes:

    With some modifications, the techniques demonstrated in this example should be adaptable for APL applications where online access to dictionary information would be useful.


APL+Win® is a product of APL2000, Inc.
made with ParkeNet Editor
ParkeNet.com