[image of digits] Borland C++ Builder - Text & Web Applications

Some AnsiString Text Manipulation Methods

The Web Component used in these is not compatible with Borland Studio 2006.
Some modification will be required...

A Recursive Babel Fish Translator

Still a bit buggy. It needs more code to detect errors. Work needs to be done to trap the variety of errors resulting from complex sentences. The "Go" portion of the application requires you to choose a pair of languages. If you don't, the app will crash. The "Lost in Translation" portion of the application will translate your text through several languages and back to English. Try using short, single-line sentences. Currently, the translations are to Italian, German, French, Spanish and back to English (perhaps not in that order).
These short sentences produce interesting results:

When do you want to go there?
Don't you love me any more?
We must move forward with great vigor.
Life, liberty and the pursuit of happiness.
Liberty, equality and fraternity.
A stitch in time saves nine.
And the signifieds butt heads with the signifiers.
Have you used it much?
Peaches float in mercury.
The sun rises at the break of dawn.

An Experiment to Discover How to Talk to Babel Fish Translator

The textToTranslate is submitted to Babel Fish through the "GET Method," commands appended to the URL after the question mark "?".
The Post method should also work but I have not explored it successfully.
Both the textToTranslate and the translatedText are recovered from the body of the returned HTML document.

I first ran an experiment to see where, in the body of the HTML document, the textToTranslate and translatedText are located.
On their website, I entered "cryptology" and requested a translation to German. I then viewed the HTML source and searched it for those two words (see the highlighted screen-shot below). This information provides key target strings to look for from which to measure the offset and length of the textToTranslate and translatedText.

I then modified the NMHTTP1 component demonstration code to submit the word "cryptology" and find it and its translation in the returned HTML document. That demonstration is what you see in 3/4 of the application illustrated above. It allows you to submit the default GET command or to modify it by hand.

The bottom-right 1/4 of the screen, the light blue GroupBox, is a demonstration of a generalized function which will submit words or sentences to Babel Fish and receive their translations. It is set to translate English-to-German (the code "lp=en_de"). This little demonstration should enable you to write more elaborate, "lost-in-translation"-type software...

The next step will be to search for identifying strings which precede both the text-to-translate and the translated-text. The text-to-translate is always preceded by the same string. However, the translated-text may be preceded by several different strings. This will require some experimentation.

The language codes in the form of "lp=en_de" are listed below:

zh_en = Chinese-simp to English
zt_en = Chinese-trad to English
en_zh = English to Chinese-simp
en_zt = English to Chinese-trad
en_nl = English to Dutch
en_fr = English to French
en_de = English to German
en_el = English to Greek
en_it = English to Italian
en_ja = English to Japanese
en_ko = English to Korean
en_pt = English to Portuguese
en_ru = English to Russian
en_es = English to Spanish
nl_en = Dutch to English
nl_fr = Dutch to French
fr_en = French to English
fr_de = French to German
fr_el = French to Greek
fr_it = French to Italian
fr_pt = French to Portuguese
fr_nl = French to Dutch
fr_es = French to Spanish
de_en = German to English
de_fr = German to French
el_en = Greek to English
el_fr = Greek to French
it_en = Italian to English
it_fr = Italian to French
ja_en = Japanese to English
ko_en = Korean to English
pt_en = Portuguese to English
pt_fr = Portuguese to French
ru_en = Russian to English
es_en = Spanish to English
es_fr = Spanish to French

KeyDown, KeyPress and KeyUp Events
This application allows you to experiment with the behavior of the KeyDown, KeyPress and KeyUp events as well the behaviors of the keys and Edit boxes.

"Key" in the KeyPress event handler is a character and will distinguish shifted from unshifted keys.

"Key" in the KeyDown and KeyUp event handlers is an integer and provides the key number without any direct information on the shift state. However, when the "Key" resulting from KeyDown is displayed in an Edit box, it displays both the shift-differentiated character and the shift-undifferentiated key. This does not happen when the "Key" resulting from KeyUp is displayed in an Edit box. Strange indeed...

Web Harvest - FastNet
This application was built from the code used in the application below. It imports the body of a Website into an AnsiString variable and then uses AnsiString methods to search for specific information. The general purpose routine (tan background) allows searching the larger text. The special purpose
routine (gold background) seeks out CMI's Gold & Silver Spot Prices and extracts the current price of gold. That extraction procedes in two stages: the first to identify diagnostic text which appears close to the price; the second to find the price by searching a smaller subtext for the dollar sign "$." (The NMHTTP1 event handlers can be omitted - see the code of the application directly below.)

Borland's FastNet Component Example
This application accompanies Borland C++ Builder 6 and demonstrates how your application can access the HTML content on a Website. It will need to be modified to suit your programming needs, but everything you need is in there. You will have to compose your own interface and program your own text processing in order to extract and deal with the information that you want.

Sonnet
A randomly created sonnet in the style of heads-bodies-legs flip books.

Oulipo Links:

Source
"100,000,000,000,000 Poems" by Raymond Queneau. In OULIPO COMPENDIUM - ATLAS ARKHIVE SIX - DOCUMENTS OF THE AVANT-GARD compiled by Harry Mathews & Alastair Brotchie. Atlas Press, London (1998) pages 14-33).
Amazon.com

Clarisse Lispector's Poem
Original reversible sonnet in Portuguese by Clarisse Lispector. Visualized by Adriana de Souza e Silva.

Jacquard
An example of a timed presentation of text and graphics resembling an automatic PowerPoint application.

Bugs
The moving image flickers, a problem which can be eliminated by using alternative coding techniques. Below are some hints on how to fix the flicker received from the on-line help from other programmers:

Falling Text
An example of moving text across the screen. "Disintegration" enables individual letters to fall at random accelerating to the bottom of the Window by the force of gravity. It is inspired by Rob Jagnow's "The Disintegrating Internet Infrastructure" which was once posted on Web.