Wednesday, September 29, 2010

Maven: unmappable character for encoding UTF8

If maven keeps complaining about "unmappable character for encoding UTF8" you are most probably having some special characters within your source code like ä or á. Since your editor is not using UTF-8 as file encoding - like eclipse does not in default settings under windows (it uses platform-specific encoding Cp1252) - this will cause problems with the maven-compiler-plugin.

For quick-fixing this problem you might want to add the following to your pom.xml:

Set the encoding to whatever your source files are using. Anyway I would recommend to remove all the characters causing those problems and also change the default encoding to UTF-8 to be consistent with the maven defaults and not having to set this explicitly.

Generally not using special characters in source code should prevent those problems completely that might occur quickly again introduced by developers who for any reason do not use UTF-8 as default encoding again and the trouble will start anew.

Friday, September 24, 2010

Escaping Strings using org.apache.commons.lang.StringEscapeUtils

You often run into the problem of escaping Strings from certain characters that need to be encoded as entitys in the format you use.

Apache has a great library in its commons-lang repository willing to do all that nasty and time-consuming work for you. Simply add this dependency to your pom.xml and start using it:

The class to go for when wanting to escape Strings is StringEscapeUtils.

Escaping html strings is as easy as

Have fun!

Saturday, July 3, 2010

Obscure Your Searches And Spam Google

I know that it's kind of ironic to use blogspot for posting about being careful with giving data to google but I have the strong hope that others can resist :)

If you are a Firefox user there is a new helpful plugin with the accurate name Track Me Not. That plugin continously sends random search requests to major search engines and thereby hides your personal search requests for Viagra, Penis Enlargements and Porn :)

Enjoy your new anonymity without being worried if the plugin sends search requests like "taliban" or "terror camp" as long as you don't want to travel to the US :)

Thanks for following.

freak

Qooxdoo: Splitting I18N Into Parts

Normally qooxdoo is used as a Widget Toolkit resp. as a framework to build Rich Internet Applications which indicates having a lot of text to be distributed with your - yet too big - JavaScript code. The more languages you support the more text and kilobytes are added to your application code.

Because most of the clients are satisfied by using an application in that one language they halfway understand there is no need to send all that other non-sense to them as well.

Part Loading: Split the I18N load

You might know qooxdoos part loading mechanism yet. This mechanism can be used to split I18N into parts/packages that can be loaded dedicated at runtime. Therefore use the following configuration in your config.json. The important thing is - as you might have expected - the "i18n-with-boot" key.

Specify the languages you support withing the let key LOCALES which takes an array. For every locale a package named ${APPLICATION}-${locale}.js will be created into your build directory.

Load the language package you need with qx.io.PartLoader.require(["en"]).

Completely Remove I18N Information In Low-Level Applications

There might be cases where you use qx as a low-level framework for e.g. DOM manipulation, as Ajax Layer or whatever. In that cases where you do not use any LocalizedString or any qooxdoo widget that needs LocalizedStrings (e.g. the DateField) you can use the above mechanism to save some kBs.

That is because the qooxdoo generator ALWAYS includes the LocalizedStrings for all qooxdoo widgets even if you dont use a single widget and/or your application is via definition a BOM application. To get rid of that unnecessary stuff we "defer" the I18N loading into a package that we will simply never load. That will save about 10kB unzipped.

Add "let" : { "LOCALES" : [] } to your config.json so that only the default language package (${APPLICATION}-C.js) will be created.

Thanks for following.

freak

Eclipse Hot Code Replacement Is Not Working

Why the §$%& hell is Eclipses hot-code replacement not working?!? May be it's just that you are as stupid as me and didn't activate Build Automatically...