Lubos Programming Blog

Lubos Blog about Programming (mainly Java) and Computers

HTML5 Programming

Posted by lubosp on March 8, 2012

Posted in java | Leave a Comment »

Generating Java Properties String retrieval class

Posted by lubosp on March 4, 2012

Resource file frequency – Source File

Retrieval Class Package Bundle name Properties file
no package, no retrieval class <source file name> + "ResourceStringManager" source file package from properties file <source file name> <source file name>.properties
package, no retrieval class <source file name> + "ResourceStringManager" package from properties file <source file name> <source file name>.properties
no package, retrieval class retrieval class source file package from properties file <source file name> <source file name>.properties
package, retrieval class retrieval class package from properties file <source file name> <source file name>.properties
Notes
  • Generated Retrieval class use bundle with the name of the source file when generate. If the same retrieval class is used for multiple source classes (row 3 and 4), the retrieval class has to be manually extended to use multiple bundles. The retrieval method has to pass the source file name and the method has to extract the bundle name from it. See how to create multiple resource files bundle below.
  • If no retrieval class is specified (row 1 and 2) the retrieval class is generated for each source file/properties file.

Resource file frequency – Project

Retrieval Class Package Bundle name Properties file
no package, no retrieval class capitalized scan name (spaces removed) + "ResourceStringManager" source file package from properties file specified properties file
package, no retrieval class capitalized scan name (spaces removed) + "ResourceStringManager" package from properties file specified properties file
no package, retrieval class retrieval class source file package from properties file specified properties file
package, retrieval class retrieval class package from properties file specified properties file
Notes
  • If no package is specified (row 1 and 3) the source file package is used, which means that Retrieval class will be created in each package.

Notes

How to create Resource file per package

Use Frequency project, externalize one package at the time and after each package modify package and retrieval class.

If "Do not use Retrieval Class" selected (default)

Uses only String retrieval method (getString(key)). This will always generate Java error if the source class definition does not contain getString(key).

How to create multiple resource files bundle

ResourceBundle.Control() controls the list of files for the ResourceBundle. You can overwrite getCandidateLocales and toBundleName. toBundleName converts locale to the "file name" and the list of locales you can control in getCandidateLocales. For example like (It works only in Java 1.6+):

 final String[] variants = new String[]{"your names"};
ResourceBundle.getBundle(baseName, locale,
            new ResourceBundle.Control() {
                public List<Locale> getCandidateLocales(String baseName, Locale locale) {

                        List<Locale> out = new ArrayList<Locale>();
                        String language = locale.getLanguage();
                        String country = locale.getCountry();

                        for (String variant : variants) {
                            out.add(new Locale(language, country, variant));
                        }
                        out.addAll(super.getCandidateLocales(baseName, locale));
                        return out;
                }

                public String toBundleName(String baseName, Locale locale) {
                        Locale l = new Locale(locale.getLanguage(), locale.getCountry());
                        return locale.getVariant() + "." + super.toBundleName(baseName, l);
                }
            });

Links

Posted in java | Leave a Comment »

Using IzPack Installer

Posted by lubosp on February 8, 2012

IzPack installer

IzPack is the best open source Java installer. Documentation is available here.

Tutorials

Debugging

Following links describe how to debug IzPack installer:

Posted in java | Leave a Comment »

My Google Chrome Extensions

Posted by lubosp on June 2, 2010

Intro

I started using Google Chrome browser (now using 5.0.375.55 beta) about 5 months ago after using Mozilla Firefox for quite a few years. Firefox 3.5+ started hanging (maybe extension?) so I decided to give Chrome a try. Here are the reasons why I decided to switch to Chrome:

  • Each Chrome tab and extension runs in separate process, so rogue web site or extension cannot take down the whole browser. Memory consumption of Chrome and Firefox is about the same, but Chrome is more robust and doesn’t hang.
  • Extensions are still better in Firefox, but Chrome is getting better and has most of the extensions I need, and Google stuff like Gmail, Reader, Voice, Calendar integration is better in Chrome (and I use a lot of Google tools).
  • Speed, javascript rich sites like Gmail are quite faster.
  • Screen real estate management is better in Chrome.
  • Faster development cycle for Chrome, and better chance Chrome will get better faster than Firefox.

List of Extensions I use

General

  • AdBlock – AdBlock for Chrome! Blocks ads all over the web
  • AniWeather – AniWeather = Animated Weather + Any Weather
  • Copy Without Formatting – Provides various ways (customizable keyboard shortcut, floating button, or auto-copy) to copy your selection WITHOUT formatting
  • Docs PDF/PowerPoint Viewer (by Google) – Automatically previews pdfs, powerpoint presentations, and other documents in Google Docs Viewer
  • FastestChrome – Browse Faster – Save time and enhance your productivity! Get quick definitions, auto-load next pages, search faster, and more
  • IE Tab – Display web pages using IE in a tab
  • LastPass – LastPass is a free password manager and form filler. LastPass is also available for Firefox, Internet Explorer and Safari (Mac)
  • MegaUpload DownloadHelper – No More Countdowns – Automatic Downloads
  • Session Manager – Session Manager lets you save sessions of your opened tabs and windows, and to quickly re-open them whenever you like
  • Speed Dial – Speed Dial for Chrome – replace Chrome new tab with your predefined visual bookmarks

Google

Social

  • Facebook for Google Chrome – Extension which lets you read your Facebook news feed and wall. You can also post status updates.
  • Chromed Bird – Chromed Bird is a Twitter extension that allows you to follow your timelines and interact with your Twitter account
  • Diigo Web Highlighter and Bookmark – Highlight webpages with multiple colors as you read online. Also allow tagging and sticky notes
  • Xmarks Bookmarks Sync – Backup and sync your bookmarks and open tabs across computers and browsers. Xmarks is also available for Firefox, Safari and IE

Development

You can set a theme in Options/Personal Stuff/Themes/Get Theme…

You can import data from different browser in Options/Personal Stuff/Browser Data/Import Data from different browser

Posted in web browser | Tagged: | Leave a Comment »

Facebook API notes

Posted by lubosp on May 22, 2010

 

Posted in tools, web | Tagged: | Leave a Comment »

Using Git SCM

Posted by lubosp on May 22, 2010

Following post is just a collection of links I collected while started using Git source control system:

Posted in tools, vcs | Tagged: | Leave a Comment »

Prettier failures using Swing TaskDialog « Schneide Blog

Posted by lubosp on April 6, 2010

Prettier failures using Swing TaskDialog « Schneide Blog

via Prettier failures using Swing TaskDialog « Schneide Blog.

Posted in swing | Tagged: | Leave a Comment »

Promiscuous Integration vs Continuous Integration

Posted by lubosp on February 11, 2010

Excellent article from Martin Fowler about VCS, DVCS and Continuous Integration Promiscuous Integration vs Continuous Integration.

Posted in build, vcs | Tagged: , | Leave a Comment »

Introduction to Quartz Scheduled Jobs

Posted by lubosp on February 5, 2010

 

Excellent introduction to Quartz Scheduled Jobs. Quartz is Java framework for sophisticated jobs scheduling.

Posted in java | Tagged: , | Leave a Comment »

Developing Blackberry application

Posted by lubosp on January 7, 2010

This blog entry has been moved as a page to my Mobile Development blog.

Posted in blackberry, java | Tagged: , | Leave a Comment »