May 30, 2010

Beware of the ad-bundled freeware

In the last few years I've recognized that many popular freeware applications have included ad-bundles into their installers. For those who don't know what I'm talking about, these are freeware applications which can be downloaded and used without any restrictions but during the installation process there is a step where an "app-bar" or "browser-addon" for a better user experience is offered for installing and enabled by default. Although, this bar does nothing more than just add a search-bar to your browser or/and redirect the default homepage to an ad-supported page which, most of the time, just redirects its searches just to Google or Bing.

But almost always it is possible to avoid the installation of these ad-addons. Either during some (sometimes not very logical) de-selecting during the installation process or by downloading a different and, most of the time, almost hidden "light"-version from the homepage.

Some candidates from the former category, where you have to disagree or not accept licenses for the ad-supplement during the installation, are for example:

  • Foxit PDF Reader (Ask.com toolbar)
  • Winamp (Winamp Search(r) )

And applications which secretly provide an ad-free version are:

  • SuMo (using the red-stroked R/K-icon on the download-page)
  • CCleaner (using the "slim" version from the builds page)

I completely understand the freeware applications need for some funding, but what I just cannot stand are those sneaky attempts to get the ad-ware placed on the customers computers. I have been called for support to computers, where the Internet Explorer took almost a minute to start up and when finished had almost one third of its screen filled with various search-bars and rating-tools which suggest "interesting" websites.

Instead of having to take care during every installation, I'd rather have a way to encourage users for support like Avira does (small ad-popup, once per virus-definition update). Another clever way is how the DonationCoder.com site uses for its tools (which I already talked about more than four years ago) where you're presented with a small popup once per application start and where you can get a time-limited no-ad license (ie. for six months) for free from the website.

Please dear freeware-developers, consider such alternatives more in the future!

May 27, 2010

Java Tip #5: Use Apache Commons DateUtils when dealing with dates

Tip #5 in my Java Tips series is again focussing around the Apache Commons framework. In the same manner the StringUtils simplifies many common operations on Strings (see also Java Tip #3), DateUtils ease some of the pain when working with Java Date objects.


Advice

Use Commons DateUtils to manipulate and calculate dates.

Code-Example

Before

...
private static Date add(Date date, int field, int amount) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    cal.add(field, amount);
    return cal.getTime();
}
...
public static Date getNextDay() {
    return add(getCurrentDay(), Calendar.DATE, 1);
}
...

After

...
public static Date getNextDay() {
    return DateUtils.addDays(getCurrentDay(), 1);
}
...

Benefit

Huge readability gain. By using DateUtils for calculating and manipulating Dates the code footprint gets smaller and easier to read. Furthermore by using explicit methods like addDays() it is clearer which part of a date is to be modified, compared to the partly ambiguous constants in the Calendar class. DateUtils also contains methods to round or truncate Dates to certain parts of the date, eg. truncate() by Calendar.HOUR sets minutes, seconds and miliseconds to zero.

Remarks

None.

May 21, 2010

Language affinity and my 5cents on the best programming language

Every now and then the well known and never-ending discussion of the "best" programming language comes up. Often this drifts into the direction where people compare specific language capabilities and features and how specific problems can be solved so much easier than in the other language(s).

When I'm caught in such a discussion people often assume that I'm a Java evangelist. But I always try to make clear, that I try to focus on solutions and problems rather than Java features. It's just that when I need to make examples, I use Java because it is currently the language which I know best. This doesn't mean that Java is the best language for the job.

I always try to make clear that I think that different languages always have a specific goal or type of problem which they can handle better than other programming languages. Take for example C/C++ for creating fast and efficient binaries, Perl for excellent handling of large quantities of strings, Shell scripts for quick automation of system management activities, PHP for fast creating dynamic web content, and so on... Of course I know that every of these exercises can be solved with almost every other language as well but the difference is, how fast and understandable the result can be produced. Creating a webserver with shellscripts is possible but I certainly wouldn't try it.

So, once and for all: I think almost any language has its area of excellence and there is no such distinction like a better or worse language. ie. Java is not better than C# nor the other way round.

Of course, if there hast to be a decision made on choosing a language this decision cannot be solely based on which language would be the best for the present problems. One has also to take into account, which languages are known by the developers and how well they know them. Furthermore one has also to be aware that available frameworks for languages often can change the capabilities of languages and how this language can be applied to certain types of problems.

May 18, 2010

Java Tip #4: Use implicit NULL checks on constants

Tip #4 of the Java Tips series is just a quick tip to enhance the codes robustness.


Advice

When comparing constants, always compare the constant to the unknown value.

Code-Example

Before

if(str != null && str.equals("XYZ")) { ... }
if(value != null && value.equals(SomeEnum.ENUM_1)) { ... }

After

if("XYZ".equals(str)) { ... }
if(SomeEnum.ENUM_1.equals(value)) { ... }

Benefit

Safety gain. Minor readability gain. The constant value can be compared to a null value without resulting in a NullPointerException. The check for null can be skipped because when the constant is compared to null the condition simply evaluates to a boolean false.

Remarks

None.

May 15, 2010

Final piece of bathroom ordered

It took quite a long time since the last major progress but now there has been another milestone reached. Yesterday I finally decided, after lots of thinking and measuring, which washing basin combination I'll take to finish off the last missing piece for a 100% functional bathroom.

A sample picture of the combo and how I ordered it (I hope this link lasts):

Pelipal Roulette 09

One catch still, it takes about six weeks until I receive it, the delivery is scheduled for July 5th. But then it'll be great :)

May 13, 2010

Java Tip #3: Use Apache Commons StringUtils for String checks

The next tip in my series of Java Tips deals with the usage of Java frameworks. Some people still have a certain hatred against Java frameworks because many of them have been not easy to deal with in in their past. Nevertheless, while those have either disappeared or evolved in a more usable shape, there have always been some frameworks which were rock-solid and widely accepted as simple and extremely useful. One of those is the Lang package in the library collection of the Apache Commons. In my opinion this one is a must-have for almost every Java project or application. Use it. Period.


Advice

Use Commons StringUtils for checking Strings content for null, emptiness or blankness.

Code-Example

Before

if(str != null && !str.equals("")) { ... }
if(str != null && !str.trim().equals("")) { ... }
if("".equals(str)) { ... }
if(str == null || "".equals(str.trim())) { ... }

After

if(StringUtils.isNotEmpty(str)) { ... }
if(StringUtils.isNotBlank(str)) { ... }
if(StringUtils.isEmpty(str)) { ... }
if(StringUtils.isBlank(str)) { ... }

Benefit

Huge readability gain. Safety gain, as StringUtils methods are null-safe. By using the provided utility methods from StringUtils the intent of a condition is much easier and faster to recognize. Furthermore, since all methods of StringUtils are able to correctly process null Strings, there is no danger of an unexpected NullPointerException anymore because of a forgotten null-check.

Remarks

None.

May 8, 2010

Nasty ankle issues

I'm still having problems using my injured ankle which I hurt now more than a month ago. I have no difficulties with everyday movements but when I try to tilt my foot beyond a certain angle (front-, back- and also sideways) it quickly builds up a pulling and if I continue the motion it begins to hurt. This pretty much rules out most sports activities currently which is more than just a tiny inconvenience for me.

I'm also having some doubts on the diagnosis from the hospital. Don't know why but I'm not sure that a single pulled tendon can cause the exact combination of problems and pains I'm experiencing.

I've picked up the address and number of an orthopedist which got excellent reviews by a few people who already visited him but I also have squeeze this visit into my currently quite tight schedule. Hopefully, I'll manage to organize this quite soon...