Monday, September 27, 2021

Why for me Firefox still rules on desktop in 2021 (and why NOT)

In this article I would like to show you why I think Firefox is still the best browser among the well known desktop browsers today. For those who want to be productive while browsing the web, I do believe there is no better alternative for many years already.

Why this article?

Well, maybe you've heard about diminishing number of users of Firefox recently. The fact is that the decrease in Firefox users has got various reasons, but that's not the topic I would like to go into here. 

Like me, you may also read some articles how the new Firefox with its new, "totally revamped" UI is great, or, from the other camp, a total mess. There is also this popular "privacy & tracking" topic nowadays. But as I will show you below, I honestly think none of these is really an important decisive factor in a long term.

What bothers me is how so many people seem to be blind to see what is really important when choosing the browser "for their life". So this and also the lack of articles that would show the real strong sides of Firefox, where its competitors are a good way behind, led me to writing this post.

What really matters to me?

Most of the time we use a web browser for navigating the web, right? That is to view web pages and to search for them, being it via a search engine like Google, or by finding them in our browsing history, among pages we have bookmarked or among pages (tabs) that we have got currently opened.

And while this may sound new and surprising to some readers, there are IMHO huge gaps in how efficient Firefox versus the other browsers let you be in this area of quickly getting to pages opened either now, just recently or in a more distant past.

A side note: While there are various add-ons that strive to bring you some "core" functionality that is missing in a browser, based on my research mainly with Chrome, due to various technical limitations like restricted browsers' API, those add-ons mostly fail to deliver the desired functionality. Moreover, when you need to use a corporate PC, you might not be allowed to install any add-ons to your preinstalled browser. It's exactly when one realizes, as it happened to me, what a nightmare it is when you are forced to use a different browser, when it lacks all the functionality which you already consider an obvious, basic one.

OK, so let's finally have a look at what I consider the game-changing pros of Firefox.

Intelligent address bar and searching

This is such a superior and time saving feature for so many years, I'm surprised that the other browsers are seemingly only taking the first baby steps in this area. It feels like it is just not promoted enough by Firefox authors or its users.

Let's have a look at what all the address bar in Firefox offers. As in all browsers, you can search using your default search engine, but also at the same time:

  • search in the history of visited pages
    • unlike Chrome or Edge, Firefox does a fully fledged search here. I. e. you can enter unlimited number of words (or their parts), and Firefox still gives you relevant results from history. The very same applies to the 2 following features as well.
  • search in bookmarked pages
    • you can also add tags to your bookmarks or even assign a keyword and later refer to them in the address bar
  • search in the currently opened tabs
    • as in the aforementioned searches, both URL and title of a page can be searched for
  • learn and suggest pages the user visits the most among the top matches

And of course, as most of the stuff in Firefox, the address bar behavior is pretty much customizable.

Switch to the most recently viewed pages easily

Firefox doesn't limit you when it comes to switching to another tab. You can either use the Ctrl+Tab shortcut similarly to Alt+Tab, i. e. to switch to the most recently viewed pages, which many people, including me, naturally prefer. Or you can setup Firefox to switch to the next tab in the tab bar.

And what about the other browsers? They only offer you the latter way of switching, which is quite limiting, moreover when one can always use Ctrl+PageUp and Ctrl+PageDown in order to navigate in this way!

Advanced Find on page possibilities

I guess that this is not critical for most users, but when you press Ctrl+F in Chrome or Edge, you can just search a plain string on the page, with no further options. While in Firefox you get many more options: "Match Case", "Match Diacritics", "Whole Words" and "Highlight All". 

A side note: There was this 17 years old feature request To also highlight matches on the scrollbar that was just implemented this year, a big thank you to the contributors! For me, this was possibly the only bigger missing feature when compared to Chrome. It could have been somewhat mitigated by add-ons, but they could have never reached the quality of a native function.

What matters, but is secondary to me?

Of course, there are plenty of other criteria you can also take into consideration when choosing your favorite browser. Yet, even though being important, for me the following features and traits of the top browsers are mostly quite similar and therefore not the primary decision factors.

  1. Performance and system resources. It is already many years back when Firefox was apparently slower than Chrome (and when Firefox was even missing native developer tools). If you watch this topic, you know that in some areas like memory consumption it might be even vice versa today. BTW we are still waiting whether Chrome will ever implement lazy loading of tabs on browser's start.
  2. Add-ons. Historically there were much more add-ons for Firefox. I admit I'm not sure how it is now and how strong are the communities of add-ons authors. As a user I can't see any dramatic differences now.
  3. Web pages functionality. Yes, there are some unfortunate exceptions when developers test or even target their page / app just at some browser, typically (and logically) at the wide-spread Chrome (while Edge uses the same engine beneath). That's something I can live with though.
  4. Security, blocking trackers. I consider this as a nice bonus of using Firefox. But having this as the main criteria to choose a browser? I'm not that paranoid and this area is also quite dynamic, so definitely not.
  5. License. Well, sure, Firefox being open source is great and promising, but do users generally really bother?
  6. Synchronization among devices, auto-play blocking, etc. etc. While once again Firefox beats for example Chrome in some aspects (see Mozilla's comparison), I find that browsers are mostly on par here.

What shouldn't matter at all?

Here come the 2 main topics that I've come across recently in articles which either promoted or reproved Firefox...

"Modern design / looks"

Firefox has got this new UI called "Proton" recently. While some promote this nearly as revolutionary, the only practical differences I can see are:

  • The new UI eats some extra vertical pixels "just for fun" of some crazy designer, but I can surely live with that, moreover when it may get changed soon.
  • I hope that they will bring back a page icon in the tab bar while there is a video / audio playing on that page.

All the other changes won't get into my view most of the time. Call me design ignorant if you want, but Firefox is basically still the same browser, with the same controls and UI layout that in principle cannot even be much different from the other browsers!

History

What happened happened, right? It's good to know how the various browsers evolved, so that we can better guess their future, but it is the present functionality that we should mainly talk about.

Summary

In short, I don't choose a browser because it is preinstalled, out of nostalgia or because it has a "modern UI" (whatever that means). I do choose a browser because of its functionality and because it makes me more productive than the other browsers. And I believe everyone should do the same and not to judge a browser if they haven't really actually checked it out and its full potential. Of course, your point of view may vary, but please try to be kind and as much as objective as possible. :)

Sunday, April 18, 2021

Localizing Pentaho reports - The missing pieces

Maybe you have already read the official documentation page Localize a report or the Hitachi's blog post Internationalization and localization of Pentaho Report Designer. Yet, you may still be unsure about the real possibilities of how to localize your Pentaho Reporting Designer reports. You can take this article as an addendum to the linked resources that will hopefully spare you some time on investigating the missing pieces of this functionality, including possible gotchas of the Designer.

Note: The localization functions were tested with version 9.1 of the Pentaho Report Designer and Pentaho Server.

The basic principles

Firstly, let me shortly recapitulate how localization is done in the Designer:

  1. The localization is based on the Java's well-known "Resource bundles" mechanism, where you store your translated texts in one or more .properties files. Every such file basically holds a list of "key-value" string pairs. Designer authors call them "resources" in general. In the case of Designer, these files may also be stored as a part of your report (.prpt ZIP file) - I reference them as "inner resources" below.
  2. When you want to have a text localized, i. e. automatically translated into the language used by the user of your report, you need to add one of these fields into your report: Resource Message, Resource Label, or Resource Field. Then, in the field's attribute called value, you enter the "key" matching a key from one of your resources. You can also, but do not have to, specify the resource-identifier attribute in order to use a concrete resource - we'll get to this in detail later on.

How can I name my resources within a report?

Well, while Designer lets you name your inner resources whatever you like, naming your resource other than "<resource-name>.properties" will just not work. This is caused by the fact that every resource is stored as a file and it is expected that it will have the .properties extension - but Designer doesn't automatically append this extension for you when storing an inner resource!

Be careful that even when you import a resource from an external file, Designer expects you to fill in the correct name of your new inner resource all by yourself. Moreover, renaming an inner resource is not supported.

As you can see, using inner resources can be quite tricky.

Is there a default resource for a report?

The answer is YES, the default resource is named translations. This means that when you don't fill in the resource-identifier attribute of a resource field, Designer looks for a text in the resource file named "translations.properties" (or in whatever language variant of that file, of course).

Oddly enough, there is not a single word on this in the official documentation, but it is mentioned in the blog post linked above. Finally, it looks like there is no way of how to change this default resource name on any level.

Where can I store my resources?

There are quite a few locations where Designer looks for the resource files. The files are looked up in the following locations, in order:

  1. Inner resources stored within the report.
  2. The same directory where the report file is stored. (Strangely enough, this doesn't seem to be documented.)
  3. Directory "[Designer Install]/resources", or "pentaho/WEB-INF/classes" in the case of deploying reports to a Pentaho Server. This is told to be a good location for resources shared among reports. I cannot quite imagine though that common report makers will get access to this Pentaho system folder.

We may say that the closer the resource file is to the report, the higher priority it gets.

What if I've got accents in my texts?

Whenever there is a character in your text that is outside the Latin-1 (ISO-8859-1) charset, it must be entered by using a Unicode escape sequence, e. g. "\u00A0" for the gold old non-breaking space character. There is no built-in support for easily editing these characters within the Designer's Resource Editor, which might be another reason for keeping your resources rather as external files.

We may expect there will be a support for storing texts in UTF-8 in the future, so that editing resources gets easier.

Conclusion

As you can see, Pentaho Report Designer offers quite a lot of possibilities when it comes to localizing reports. But there is also some undocumented stuff and some gotchas that I tried to make you aware of, hopefully successfully. :) I will be glad if you share your own experience and findings in the comments. Are they the same, or do you find some differences? I think it would also be cool to have a comparison with how localization is done in the competitive JasperReports solution...

Saturday, December 19, 2020

CopyQ - Quick diff texts

TL;DR

In short, you can use the power of CopyQ commands in order to quickly compare any two pieces of text - just copy the texts into the clipboard and run the Diff Latest Items command on them. As always, simply follow the installation instructions in order to install the command into your CopyQ instance.

As mentioned in the documentation page, you will also need a compare tool that can be invoked by the CopyQ command in order to do the actual comparison. The last step is, possibly, to modify a part of the command's code. This part looks like the following at the time of writing:

// Choose your favorite diff tool (leave just one execute(...) uncommented):

// === Beyond Compare ===
// reference: https://www.scootersoftware.com/v4help/command_line_reference.html
execute('bcompare', name1, name2)

// === WinMerge ===
// reference: https://manual.winmerge.org/en/Command_line.html
// execute('winmergeu', '/e', '/x', '/u', '/fl', '/dl', 'item1', '/dr', 'item2', name1, name2)

Note: In order to work, the program passed to the execute() command must be on the system PATH, otherwise a full path to the program needs to be specified.

Story of the Diff Latest Items command

I don't know how you, but I pretty much hate doing something that a computer can do for me instead. In regards of this post, it is finding out differences in texts. It might be the case of comparing similarly looking methods in a source code, or for example similar paragraphs found on different web pages.

Of course, one can use many different tools to do the comparison, but they usually require you to firstly have files created that are going to be compared.1 So, I was looking for a quick and universal solution. And once you get familiar with CopyQ, creating a simple CopyQ command just for that is the next logical step, and that is how the Diff Latest Items command got created. Well, I'm not the original author of it though. :)

I was playing with this idea in my head for several weeks and just on the weekend when I started with implementation, I searched for an example of how to create a temporary file from CopyQ (so that it can be fed to an external comparison tool). And instead of an example, I found this ready-to-use script that was created just a few days before! So at least I improved its documentation and also added support for my favorite tool WinMerge, job done. :)

Conclusion

And what about you? Do you have some other tricks of how to compare text chunks? Or have you also found this CopyQ's command useful? Don't hesitate to let all know in the comments. :)


1 If you use Eclipse IDE, for example, and you are lucky enough to come across the AnyEdit Tools plugin, you can e. g. compare a part of an opened file with clipboard contents pretty easily. Yet, this still requires some clicking "here and there" and we also know that startup times of IDEs like Eclipse are not the best. ;)