Programming

Tips and tricks
Maybe you will find the answers to your questions on this page...

Sherlock translation channel, accents and special characters
I like Apple's Sherlock translation channel (powered by Systran) which I consider more convenient than the automatic translator offered by Google. However, when I recently wanted to translate a text from French into English, say it was the following snippet, simply copy-pasted into Sherlock

Voici un petit texte qu’on devrait pouvoir traduire aisément. Cependant, les guillemets français (souvent utilisés pour «  isoler, citer, etc. ») sont problématiques. De même, certains éditeurs de textes “intelligents” remplacent les guillemets "droits" par des guillemets anglais ouvrants et fermants. Hélas, ceux-ci ne sont pas reconnus par certains traducteurs automatiques, tout comme les points de suspension… Méfiez-vous aussi des tirets cadratins—dont certains abusent—et demi-cadratins pour indiquer des intervalles de pages (12–17). L’apostrophe est bien souvent remplacée par une apostrophe fermante. Les ligatures qui vous tiennent à cœur sont aussi sources d’erreurs.

Sherlock displayed this curious text:

Here a small text quâon should be able to translate aisément. However, the quotation marks français (often utilisiés for Â" to insulate, quote, etc. Â") are problématic. Of mÃae, certain éditeurs of texts âoeintelligentsâ replace the "right" quotation marks by opening and closing English quotation marks. Hélas, those are not recognized by certain automatic translators, just like the points of suspension⦠Méfiez you also of the dashes cadratinsâ"dont some abusentâ"et en spaces to indicate intervals of pages (12â"17). Lâapostrophe is very often remplacée by a closing apostrophe. The bindings which hold you à ciÂ"ur are also dâerreurs sources.

Although the accented letters are garbled and seem to be the culprit, they are not causing any problem! Rather, watch out for the following symbols and replace them by translator-proof equivalents.

Three points ... instead of the ellipsis …
Double quote " instead of the left double-quote “
Double quote " instead of the right double-quote ”
Dash - instead of En dash –
Dash - instead of Em dash —
Less than < instead of the left single angle quote ‹
Less than < instead of the left angle quote «
Greater than > instead of the right single angle quote ›
Greater than > instead of the right angle quote »
Single quote ' instead of the left single quote ‘
Single quote ' instead of the right single quote ’
Be heartless, change cœur to coeur.

The modified text now looks like this (note that the accented letters remain unchanged!):

Voici un petit texte qu'on devrait pouvoir traduire aisément. Cependant, les guillemets français (souvent utilisés pour <  isoler, citer, etc. >) sont problématiques. De même, certains éditeurs de textes "intelligents" remplacent les guillemets "droits" par des guillemets anglais ouvrants et fermants. Hélas, ceux-ci ne sont pas reconnus par certains traducteurs automatiques, tout comme les points de suspension... Méfiez-vous aussi des tirets cadratins - dont certains abusent - et demi-cadratins pour indiquer des intervalles de pages (12 - 17). L'apostrophe est bien souvent remplacée par une apostrophe fermante. Les ligatures qui vous tiennent à coeur sont aussi sources d'erreurs.

which gives you a (slightly) better translation:

Here a small text which one should be able to translate easily. However, French quotation marks (often used for < to insulate, quote, etc >) are problematic. In the same way, certain "intelligent" text editors replace the "right" quotation marks by opening and closing English quotation marks. Alas, those are not recognized by certain automatic translators, just like the points of suspension... Be also wary of the dashes em quadrats - of which some misuse - and en spaces to indicate intervals of pages (12 - 17). The apostrophe is very often replaced by a closing apostrophe. The bindings which hold you with heart are also sources of errors.

Note that Google can do a little better: it still recognizes the accented words even when special characters are present. MLg—16.12.2003

Duplicate the current Finder window in Mac OS X (Applescript)
Below is a small applescript that duplicates the current Finder window.

 tell application "Finder"
     activate
     set current_window to (the target of the front window)
     set this_window to make new Finder window
     set the target of this_window to (the current_window)
 end tell


Download (24K): windupli.sit

Matlab vs. IDL
Are you an experienced Matlab user and need to write (quickly!) a few lines of code using the Interactive Data Language (IDL)? You know the commands in Matlab but can't find their counterpart in IDL? Or is it just the contrary? If yes, then have a look at this comparison between Matlab and IDL commands:

pdf iconmatlabvsidl.pdf



Warning: because your browser doesn't conform to current web standards, you are viewing a simplified version of this website! Note however, that apart from the layout, its content is unaltered.