Kronometer 1.4.2 released and KF5 port completed

Kronometer 1.4.2 has been released.
It’s a minor release with just a couple of small fixes. The option to hide the statusbar, which was added in the 1.2.1 version, has been removed since it’s already provided by the standard KDE libraries: just go to the Settings menu and then click the Show Statusbar entry.
In the meantime, I have completed the port to KF5, introduced in my previous post. What I still have to do is decide how to release the ported version, since KF5 is not that much spread across distributions, at this time. Probably I’ll wait the other Extragear applications and I’ll see how they will handle the new releases after their ports.
Btw, if you want to have a look at the KF5 port, it’s just a matter of few git commands:

$ git clone git://anongit.kde.org/kronometer
$ cd kronometer
$ git checkout frameworks

Then you compile as always:

$ mkdir build && cd build 
$ cmake ..
$ sudo make install

You’ll find the compiled port installed at /usr/local/bin/kronometer.

Kronometer ported to KDE Frameworks 5

I’m very happy to announce that Kronometer has been ported to KDE Frameworks 5 (KF5), the new generation of KDE libraries provided to build KDE apps.

kronometer-kf5

As you can see in the screenshot, the frameworks version used is the 5.0, which has been released the past 7 July. However the Plasma version is still 4.13 and not the new Plasma 5.0, but I don’t think that will be a problem.
The kronometer version in the screenshot is 2.0.0 but only as a placeholder, I have not yet decided how to release the KF5 port. Currently all the work has been done in the frameworks branch on the git repository.

What’s working

The main use case, of course.You can start/pause/reset the stopwatch and record the lap times.
All the Kronometer Settings are working too.

What’s not working

The stopwatch persistence feature. So, at the moment is not possibile to restore a saved stopwatch or save a running stopwatch.
The motivation is that I was too eager to complete the port and this feature is the most boring to port.
Further, as you can see, the stopwatch digits are awfully “sides-cutted”, I still have to figure out what’s going on and how to fix it.

Kronometer 1.4 brings translations

I’m glad to announce that Kronometer 1.4 is now localized in over 12 languages. This is the first time that Kronometer brings translations to its users.
Thanks to the effort of the KDE translation team, Kronometer is completely localized in:

  • Brazilian Portuguese
  • Czech
  • Dutch
  • Finnish
  • French
  • German
  • Low Saxon
  • Polish
  • Portuguese
  • Spanish
  • Swedish
  • Ukrainian

Bosnian, Hungarian and Slovak translations are not completed, though.
Even the Kronometer Handbook is going to be translated and at the moment is available in Dutch, Swedish and Ukrainian.
The release 1.4 brings also a new feature and an important bugfix. The new feature is the automatic highlighting of the latest lap time recorded. This means that the latest lap time is always visible, while in the older releases it wasn’t. The bug fixed is the bug 336904, which was preventing the reset of the stopwatch under certain circumstances.
Finally, the release 1.4 is the first one hosted on the KDE servers, instead of this server. In this way you can use the KDE mirrors scattered all around the globe.

UPDATE (2014/07/09)

The release 1.4.1 fixes a small bug which was preventing the removal of the old upper toolbar (which was in the releases < 1.3.0) from the Kronometer UI.

Kronometer 1.3 joins KDE Extragear

The release 1.3 of Kronometer has been realized after a review made by the KDE team, which allows Kronometer to join the KDE Extragear repositories (in the Utils sub-module). The KDE Extragear is a collection of KDE applications which are released indipendently from the applications within the well-known KDE Software Compilation (KDE SC).
So, Kronometer is part of the KDE community. First of all, now Kronometer uses the official KDE bucktracking system. If you find a bug or if you want a new feature, feel free to report it here.
The next steps should be the text localization by the KDE guys and the packaging for the major linux distributions.

Speaking of the 1.3 release, the main change is a big redesign of the stopwatch display, based on the suggestions by the KDE team. In particular, a serious bug with many exotic fonts has been fixed. If you are interested, try to use an exotic non-monospace font in the display (on one of the previous releases), e.g. the Fontin font, and you will experience a very akward behaviour in the UI. In general the UI is now much more clean than before, as you can see in the following picture, where in the foreground there is the new release while in the background the previous one.

kronometer-comparison

Splitters between time components has been removed, since they were useless and even ambigous. There were the characters . and : used as digits dividers but they were useless too. Finally the upper toolbar has been removed since those actions are always available in the File menu.

What’s next?

Some small new features are in planning, like the system tray support, but of course the next big step in the kronometer development will be the port to KF5 (KDE Frameworks). This should help the porting of kronometer to other platforms, where sometimes the whole kdelibs package (which is required by kronometer) is hard to accept for such a simple application like kronometer.

Kronometer 1.2.2 released

A new bugfix release for kronometer is now available. The release 1.2.2 fixes a small bug that was preventing the compilation with older gcc versions. Since this bug was also well hidden I think that it’s worth a blog post.
The bug consisted in two trailing commas forgotten in two enum definitions.
Well, actually this is a bug only with certain versions of C and C++ and I didn’t know it.
A trailing comma in an enum declaration is a comma after the last enum member:

enum Color {
    RED,
    GREEN,
    BLUE, 
};

Let’s see where this code compiles and where it doesn’t (credits to this stackoverflow answer):

  • C89 doesn’t allow the trailing comma
  • C99 does allow it
  • C++98 and C++03 don’t allow it, since their C compatibility is based on C89
  • C++11 does allow it

The default compiler options used by kronometer are:
-Wall -Wextra -Werror -ansi -pedantic -std=gnu++0x.
Kronometer uses some small features of C++11, like nullptr. That’s why the flag -std=gnu++0x.
Here there was the problem: the flag -pedantic triggers a compilation error when it finds the trailing commas. This warning is ignored if C++11 is enabled, but only on recent enough versions of gcc. Since I use gcc 4.8.1 I didn’t find the bug. By removing those commas, now kronometer should be fully compilable also on older compilers.

Kronometer 1.2.1 is out

Kronometer 1.2.1 is now available. This release introduces the KDE compliant documentation in the DocBook format. To read the kronometer documentation just click the F1 button while kronometer is running. You can also open the Help menu and then click the Kronometer Handbook entry.
A new feature has also been added to kronometer. Now you can choose whether to show the Status Bar in the kronometer window. You can find this option in the Interface settings page in the kronometer settings dialog (Settings -> Configure Kronometer...).
You can see the difference in the following picture. The window in the foreground doesn’t show the status bar, while the one in the background does.

kronometer-statusbar

This option has been added to partially conform to a KDE design guideline. According to KDE, the applications should not provide a status bar to maximize vertical space for content.
While this is a valid general guideline, sometimes a status bar can be still useful and I think that kronometer is one of these exceptions.
The kronometer status bar is meant to tell the user about the current stopwatch state. Kronometer has three possible, self explanatory states,: inactive, running, paused.
The kronometer states can be recognized even without the status bar, thanks to a well designed UI. But I think that the presence of the status bar can help the user to quickly recognize the current state, reducing its effort. For this reason, I think that the decision is up the final user, since this is the KDE way of doing things. By default the status bar is enabled, but it’s a matter of one click to disable it.

Code Browser with KDE or Qt Projects

In my previous post I talked about the Woboq Code Browser.
While the instructions for compilation and usage are quite good, in this post I will try to summarize them for a specific use case: the generation of HTML files for a KDE/Qt application using the cmake build system, on the Linux platform.

Requirements

This post assumes that you are a Qt/KDE developer on a Linux system. This means that you should already have all the needed stuff (git, cmake, etc.). Just make sure to have clang (and llvm-config) installed under /usr/bin. This makes the process easier.

Compilation

First of all, you need to compile the codebrowser.

  1. Clone the codebrowser source files:
    $ git clone https://github.com/woboq/woboq_codebrowser.git
    $ cd woboq_codebrowser/
  2. Start compiling:
    $ mkdir build && cd build
    $ cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config \
    -DCMAKE_BUILD_TYPE=Release
    $ make

Now you have the two codebrowser components: build/generator/codebrowser_generator and build/indexgenerator/codebrowser_indexgenerator.

Installation

Since clang expects to find the system libraries in ../lib relative to the executable, you have two choice:

  1. Install the codebrowser components. In this way you can use the codebrowser everywhere:
    $ sudo install -m755 generator/codebrowser_generator /usr/bin
    $ sudo install -m755 indexgenerator/codebrowser_indexgenerator /usr/bin
  2. Link the system libraries to the build/ directory:
    $ ln -s /usr/lib .
    I don’t like the latter because you need to type the extended path when using the codebrowser; but it’s up to you.
  3. Finally, you need to copy the data/ directory to the directory that will contain the generated HTML files. The output directory in this example will be ~/public_html:
    $ cp -r data/ ~/public_html

Usage

Now you are ready to generate the HTML for your KDE or Qt foo project. Just make sure that you have a git local repository for foo.

  1. Generate the compile_commands.json. This will tell to the codebrowser what source files has to process:
    $ cd /path/to/foo/local/repo
    $ cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
  2. Generate the source code HTML pages. The output directory in this example will be ~/public_html:
    $ git ls-files | egrep "\.cpp$" | xargs codebrowser_generator -b $PWD \
    -p foo:$PWD:`git describe` -o ~/public_html/foo
    If you are interested, codebrowser_generator -help will explain the meaning of the used options.
  3. (Last step!) Generate the HTML index:
    $ codebrowser_indexgenerator ~/public_html/foo

Done. Simply open in your preferred browser ~/public_html/foo/index.html and enjoy it!

(Optional) Optimization

By default, for (e.g.) a KDE project the codebrowser generates not only the code for the project itself, but also for all the included libraries. This translates in (at least) the whole KDE, the whole Qt and many C++ standard headers. If you want to upload the generated HTML on your webserver, this might be a problem if you have storage concerns, for example if you are on a shared server.
Fortunately, the codebrowser gives you the option to link external generated libraries. Just use the -e option like in this way:

$ git ls-files | egrep "\.cpp$" | xargs codebrowser_generator \
-e include:/usr/include:http://code.woboq.org/kde -b $PWD \
-p foo:$PWD:`git describe` -o ~/public_html/foo

Integrating Woboq Code Browser

Do you like to read source code written by other people? Maybe you already know the awesome Woboq Code Browser. If not, you’ll probably love it.
The Woboq Codebrowser is exactly what you think: a browser for source code. When you read browser generally you think to HTML pages. The codebrowser process the source files of a C/C++ project and generates HTML pages with this code, nicely formatted using CSS. Wait, github, bitbucket and similar sites already do that, don’t they? Yes, they do, but not like Codebrowser does. The really amazing feature of the Codebrowser is the ability to (partially) simulate a real IDE in your browser. Well, a read-only one, at least.
Sometimes pictures explains better than words.
This is an example of semantic highlighting when mouse hovering on a C++ variable:

codebrowser-variable

This is what happens when you hover your mouse on a C++ function call:

codebrowser-function

Of course there is also the sources navigation, which you can find also in simpler tools like LXR. Simply click on a symbol and you’ll go to the source file where it’s defined.
All this magic can happen thanks to clang, which is a modern compiler with a modular architecture. Clang provides an easy to use API and is easy to integrate into other tools, like Codebrowser does. Instead this is far more difficult with older and monolithic compilers like GCC.

I’m happy to integrate the Codebrowser in this website. Codebrowser is released under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. So I will use it for my open source C/C++ projects. At the moment the only available project is kronometer, but I hope they will be more in the future.
If you are interested to browse far bigger projects, check here.

Learn Latex without troubles using online editors

In the Linux world installing and using Latex is generally very simple. You need only to install a Latex IDE: Kile (if you use KDE) or Latexila (if you use Gnome) or whatever Latex IDE you prefer. The package manager of your distro does the hard work for you, installing all the needed Latex dependencies. I have never used Latex on Windows, but I suppose that projects like miktex should provide an easy installation too.
An easy installation doesn’t mean a small installation. Latex is very powerful but it’s also very big and you’ll probably need to install a few hundred megabytes of software (depending on the optional latex packages). If you have a pc with limited disk space (e.g. a SSD-powered laptop) this can be a problem.
An easy installation also doesn’t mean that you won’t have problems. You might want to use a Latex package that won’t work or that is not in your distro repository.

These are just two concrete motivations for using an online Latex editor. Yes, you write Latex code in your browser and you download the resulting pdf from your browser. Done. You don’t need to install any software on your pc. There are also many other motivations. You might be a Latex beginner and you want only to give it a try. You might be a Latex export and you want to use a real-time collaborative editor with your colleagues. You might want to edit your projects from many different computers without install Latex on each of them. You can do many cool things with these tools. For example I absolutely love the large amount of free available latex templates (CV, resumes, etc.). You choose a template and you edit it, nothing more. Instead if you wish to use a latex template on your local latex installation, sometimes this can be a real pain.

Let’s see where you can find these editors. The two main competitors seem to be Sharelatex and Writelatex. They are quite similar but there are differences, of course.
For example, sharelatex is open source, while writelatex is not. Both of them offer free plans, but also paid plans with advanced features like dropbox syncronization and revision control. The following table shows a quick comparison between features which you might be looking for.

Feature Sharelatex Writelatex
Commands auto-completion Free Only Paid
Auto-compile No Yes, optional
Free collaborators 1 Unlimited

As you can see, the choice depends on what you are more interested in. If you are a Latex beginner, probably you should consider the auto-completion of the Latex commands and then sharelatex. Instead if you are a Latex expert and you need free real-time editing with more than one collaborator, writelatex is the right choice for you.

What about privacy? Well, they are cloud services. Although they both offer private projects, you probably can’t trust them for the protection of really sensitive data.
If you really need an online Latex editor over a trusted web storage, you can host an editor on your own server. Sharelatex can be freely self-hosted. Another open source alternative is FlyLatex, although I don’t know much about it.

P.S.
If you want to give a try to sharelatex or writelatex, please consider to signup through these official referral links:

In this way you will help me to upgrade my sharelatex and writelatex accounts. Thank you!

Introducing Kronometer (1.1.2)

A while ago, as a programmer who had never used Qt and as a happy KDE user, I was very interested to introduce myself to the Qt/KDE programming. Since I was also interested to become an open source developer, I decided to join the two things and to create a small open source project for KDE. The result is kronometer, a stopwatch application that I’m pleased to introduce here. Well, kronometer is not an alpha software, since it’s definitely stable and the latest release is the version 1.1.2. Unfortunately I decided to create this website only after kronometer, so I’ve missed many cool new feature posts. Of course you can see all the available feature in the kronometer gallery page (screenshot and video).

The latest minor version (1.1.x) introduces the ability to export the lap times on a file. Currently it’s possibile to export them to the CSV and XML format. There are also a couple of bug fixes. If you are interested, there is the complete kronometer changelog.

Why a stopwatch application?
Because I missed an application like kronometer when I was preparing my BSc thesis dissertation. I needed a stopwatch on my KDE distro to practice my times, because my speech could not exceed 15 minutes. I didn’t find a KDE stopwatch. I found only a small plasmoid. Yes, this stopwatch runs, but nothing more.
Of course in the web you can find tons of free stopwatch websites and use one of them (indeed, it’s what I did), but the question is: Why? Why I have to: (i) open a browser (ii) enter online stopwatch in a search engine (iii) filter the good results from the bad ones, only because I need a simple stopwatch? I think that a Desktop software compilation (like KDE is) should provide a set of essential applications (which KDE does), including a stopwatch (which KDE doesn’t).
Now with Kronometer KDE can provide a much more powerful and customizable stopwatch to its users. Enjoy it!