Becoming a KDeveloper

So, I’ve just been accepted into this year’s Summer of Code program. I’ll be working on KDevelop, introducing a system for using and sharing code templates. This includes both project templates (integrating KNewStuff into KAppTemplate) and more specialized templates (for code files,  classes, tests, make and cmake files, etc). The full proposal is online at http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/noughmad/37002.

However, all this is still in the future. I’ve already been doing some work on KDevelop, and so far I’ve enjoyed it very much. Not only do I use it every day, its plugin architecture makes it easy to add small pieces of functionality. Note that because of school getting harder every year, I have little free time and my progress is a bit slow. But anyway, I’ll show you what I wrote the past few moths.

Unit tests

KDevelop currently has no support for unit testing. However, both KDevelop and KDevPlatform have loads of them, so a good system for running tests and reporting their results would find a good use. So I introduced some new interfaces for unit tests, including finding and running them. A toolview was adapted from the old and unmaintained Veritas library, however I took steps to better separate the interfaces and their implementations. Currently supported are tests declared with CMake and those using the PHPUnit framework.

A toolview for listing unit test suites and their test cases

Apart from simply listing tests, the relevant declarations are also extracted and a “show source” action is available. Support for running unit tests and reporting results is also functional, however I have trouble deciding which icons to use. There is a difference between a failed test case and an error, and also between an individual testcase and suite results. As a short-term solution I implemented a mess of different icons.

The toolview showing results of a test run

Finding tests declared in CMake files works reliable, whether they use add_test() directly or some wrapper macro (like kde4_add_test()). Unfortunately, this is not true for php tests cases. The problem with PHPUnit is that a test case must inherit from a certain class, but  doesn’t have to include any special file, so the parser find the right declaration by itself. I managed to fix it by modifying the parser, so that most test cases are found, but unfortunately still not all.

Additionally, when running the test cases, their output is displayed in a separate toolview. For test cases using QtTest or PHPUnit, the output is highlighted appropriately (green for success, red for failure). For Qt-based tests, clicking a line in the output also takes you to the declaration in the code.

An output from a test using the QtTest framework

If you wish to test this, the code is in the “unittest” branches of kdevplatform, kdevelop and kdev-php. Any input is appreciated, especially regarding the presentation to the user.

Code checking

Another valuable resource for KDE developers is the Krazy code checker. Seeing how easy it is to create KDevelop plugins, I wrote another one to run Krazy and report back the results. Any issues found are inserted into the declaration-use chain, so they are visible in the Problems toolview, as well as in the code itself.

An issue found by Krazy displayed in the Problems view and in the code

The code is still in my personal scratch repository at http://quickgit.kde.org/index.php?p=scratch%2Fmihac%2Fkdev-krazy.git&a=summary

When all else fails

I also implemented a different kind of code checking: by humiliation. If you stumple upon a horrible piece of code, either written by you or inherited, you can earn a feeling of superiority by sending it over to The Daily WTF.

A context menu entry for submitting an offending code snippet to The Daily WTF

I haven’t yet submitted any code with it, but I tested the plugin with Alex, the site’s maintainer, and he says it works. So watch out, if you write bad code, even if you fool all the unit tests and code checking tools, someone can still expose you.

Typing with the enemy

I ordered a new keyboard thin week, and today it finally arrived. But even though I’m a firm believer it free software, I bought the Natural Ergonomic 4000, made by Microsoft. It is about half the price of any comparable Logitech product available in Slovenia, despite it costing 50€. In comparison, the American Amazon sells it at 27$. This disparity (which is noticeable everywhere, but especially with tech products) made even more happy about Spark coming out first in Europe.

First thing I noticed, this thing is monstrous. My previous keyboard is rather old, so it’s mechanical and larger than newer keyboards, but in pales in comparison with MS’s product. The desk I use at home has a keyboard drawer, and it fits in perfectly, both in width and height (The keyboard has a large and elevated wrist-rest). My second thought, after trying to type on it, is that it’s going to take some time getting used to it. Having been using the Dvorak layout for several years, I’m used to touch typing, but I’ve never tried a curvy ergonomic keyboard before. It’s quite different, but I haven’t used it enough to formulate any king of informed opinion.

And as to apologize for buying from Microsoft, I feel a comparison between our favourite evil empires is in order. In Slovenia, 50€ will get you this mighty keyboard with split keys, a soft wrist-rest, all kinds of shortcut button and a scroller between the key sets. On the other hand, this costs 75€:

I know that both are cheaper in USA, and even some places in Europe, but the ratio of their official recommended prices is similar. And still I have no doubt many people will claim how typing anything on the Apple product is so much easier and more comfortable. Sorry for turning this post into a rant, but it got me quite angry while shopping.

Ok, writing this post on the new toy went better than expected, now I’ll get back to homework coding. Yes, I have to write code for school as well, but it also involves less interesting parts, like writing sentences. Ugh.

Release Party in Ljubljana, Slovenia

After a one-year break, the KDE release party tradition in Slovenia is back. As usual, it will take place in Kiberpipa on Tuesday, January 31. Apart from a display of KDE’s latest features, we will also discuss ways of contributing to KDE, especially by programming and translations.

There will be not one but three presentations:

  • Jure Repinc will show what’s new in the KDE Software Compilation, with a focus on Plasma and Plasma Active
  • Andrej Vernekar, the Slovenian translation coordinator and Linux user group president, will have a presentation about translating KDE.
  • Miha Čančula (myself) will talk about programming for KDE, my experience with the mentorship programs, and how KDE makes a programmer’s life easier.

More info is available on the community wiki or in the Slovene version.

Zabava ob izidu KDE 4.8

Po enoletnem premoru se tradicionalno druženje ob izidu proste programske opreme skupnosti KDE spet vrača. Ob izidu različice 4.8 si bomo najprej ogledali, kaj se je v zadnjih dveh letih dogajalo v drugi največji odprtokodni skupnosti in predstavili nekaj največjih novosti namizja Plasma in ostalih programov. Sem spada tudi posebno novo okolje Plasma Active, ki bo letos na voljo na tabličnih računalnikih. Predstavili bomo tudi nekaj izmed načinov, kako se lahko svojimi prispevki in izkušnjami pridružite skupnosti KDE. Osredotočili se bomo predvsem na prevajanje in programiranje.
Po predstavitvah sledi druženje s pijačo in kakim prigrizkom. Po načelu »kdor prvi pride, prvi melje« bomo razdelili tudi nekaj daril.

Predavatelji:

  • Jure Repinc je študent računalništva, ki v svojem času poskuša čimveč prispevati k raznim odprto-kodnim projektom, v največji meri pri KDE.
  • Andrej Vernekar je zaposlen kot vodja pisanja tehnične dokumentacije, v prostem času pa prevaja KDE-jevo programsko opremo in je koordinator slovenjenja KDE ter predsednik društva LUGOS.
  • Miha Čančula sem študent fizike, ki pri projektu KDE razvijam šahovski program Knights in Cantor, ki je vmesnik za matematične programe

Lokacija:

Kiberpipa (zemljevid)

Povezave:


http://community.kde.org/Promo/Events/Release_Parties/4.8#Ljubljana

English version

Knights 2.4.1 Released

Today Knights has reached the stage where some exciting new features are completed and usable. The new release includes saving and loading PGN files, setting the difficulty, and supporting the UCI engine communication protocol. I also added a move history widget, which can display the moves so far in three different notations.

Playing against Stockfish, a strong chess engine using UCI

A handful of new themes appeared on kde-look which can be downloaded from the Knights configuration dialog.

St. George theme by Dave Kaye, with visible history and clock widgets.

Move history can be save quickly from the history widget, or from the dialog which appears after a game is over.

Knights can be downloaded from their usual site at kde-apps:

Ice Cream Sandwich on my Galaxy Ace

Today, I installed the first beta of CyanogenMod 9 (based on ICS) on my phone, beating the official distribution channels for an unknown but long and possibly infinite amount of time.

Why

The coolness factor, of course. I’m quite sure I’m the first of all my friends to have ICS. Also, it looks very slick. It is also heavily hyped, so I had to try it out.

CM9 welcome screen, still fresh and empty

The user interface is about as responsive as with 2.3, which is not perfect, but good enough. It’s actually quite fast, but the animations are not smooth, damaging the polished feel of the UX.

There is also the fact that the app development API has got many additions since Android 3.0, so it’s easier and more portable to write apps for ICS than for 2.3 that was installed by default.

CM9 app drawer.

How

There is a thread on the XDA-developers forum with news and releases. I downloaded the zip and installed it from ClockWorkMod recovery. A complete data wipe is needed, so make sure that your Google account is fully integrated and synced before trying the installation, or backup everything.

As the first post warns, if you don’t know how to install it, you probably shouldn’t. So I won’t post complete instructions here, but feel free to ask in the comments.

What now

The camera still doesn’t work. If this is something important to you, don’t use CM9 on your phone. For me, it’s an inconvenience, but the development possibilities are more important for me.

What you may or may not notice on the previous picture is that the icons are quite small on SGA’s 3.5-inch screen. The same is true for text in menus, fortunately there is an option to enlarge it in Settings > Accessibility.

ICS accessibility config, with the Large Text option checked

In general, it shows in a couple of places that my phone is somewhat too small and the screen resolution too low. Icons are too small, while text in some applications is too large. Other than that, web browsing and email is usable, and I don’t really need anything else from a phone. It also makes calls and messages, I tested it myself.

Free (harvested) energy

As a Physics student, I have to prepare a seminar for my classmates regarding some topic broadly connected with Physics. I chose Energy harvesting, as suggested by a professor, without knowing much about the field or the commercial offerings. However, aften collecting many sources and writing the article, I have come to have a much better opinion of our future than before. Namely, I discovered things like this: Continue reading

Follow

Get every new post delivered to your Inbox.