Parallels vs UTM

I’ll compare Parallels 1.9.4 AppStore Edition vs UTM 4.5.4 (100). Time of writing of this blog post: 8. Oct. 2024.

Read More

On thread safety (in JVM)

Many people think they understand thread programming, but unfortunately only a handful of people really do. If you think you can write thread-safe program, you can’t.

Read More

Vaadin Servlet Auto-Loading

When a project defines no @WebServlet, how come that VaadinServlet gets loaded automatically? Without automatic loading of VaadinServlet there would be no servlet to handle requests, and Jetty/Tomcat would simply return 404 NOT FOUND. Let’s take a look, both on standard servlet project and on a Spring-Boot project, how the automatic loading works.

Read More

Vaadin, Kotlin and CRUD database access

There are many JDBC frameworks, both Java and Kotlin. However, some of the frameworks lack certain functionality which prevents them to be used with Vaadin and the traditional way of Vaadin CRUD via the Binder, including the JSR 303 Bean Validation.

Read More

Intellij IDEA on Wayland

Intellij IDEA now runs on Wayland, and it runs surprisingly well! What’s even better, IDEA running on Wayland is now compatible with UTM, meaning that you can finally set up a perfect dev env in Ubuntu running in UTM! IDEA runs buttery-smooth, no hiccups; if I’d have to guess it’s partly because of JVM 21 and partly because of dropping X baggage.

Read More

Ubuntu VPN via Mullvad

I want to avoid installing custom binaries provided by the VPN providers. I usually tend to use the VPN provider which either uses wireguard or openvpn:

Read More

Jenkins Behind Reverse Proxy Nginx

Say you want to expose Jenkins at /jenkins via nginx (which also unwraps https). You try to define the standard proxy_pass http://localhost:8080/; rule, and nothing works.

Read More

Vaadin - Persistent Sessions

To enable session persistence, set the server.servlet.session.persistent=true setting in your Spring Boot application.properties The property value is false by default; however, it is overwritten by spring-devtools, which sets it to true. It’s quite convenient since you remain logged in over redeploys without any special configuration.

Read More

Styling Web Components with Vaadin

Summarizing ways to style both Vaadin and non-Vaadin components here. Important: The @CssImport annotation only works with web components implementing the ThemableMixin (so, in general, only with Vaadin components) AND/OR web components correctly defining parts in their ShadowDOM. @CssImport can not be used with other web components - it will simply get ignored and will do nothing.

Read More

Unifying Mac+Linux keyboard, or making Mac work like Linux

The general advice is to bite the bullet and learn Mac keyboard shortcuts. That doesn’t help in my case though: I’m working with Linux in VM/Parallels on a daily basis, and it’s impossible for me to constantly switch between two very different layouts. Therefore, I’ve decided to try and modify Mac to work as much as Linux. That means that, for example, Ctrl+Q closes app (and not ⌘Q), Ctrl+Home moves the cursor to the top. I’ve also avoided installing all third-party apps on Mac, and only using Input Remapper which is available in official Ubuntu repository for both Ubuntu 22.04 and 24.04, so this method is future-proof.

Read More

New MacBook Setup

I need to setup new machine from time to time, and I always forget all the things that need to be set up. So, here it goes.

Read More

Intellij IDEA in VM

When working for the customer, I’ve found out that the best way is to setup a dedicated VM. That way, it’s easy to install anything that the customer uses, without polluting your main OS. The question is, how does IDEA perform in a VM?

Read More

Vaadin Push Invalid JSON from Server 1 X

If Vaadin is failing with “Invalid JSON from server: 1|X”, read on. The problem is that Vaadin expects an UIDL JSON message over the websocket pipe and can’t parse 1|X. Where did 1|X came from?

Read More

Hibernate Validator HV000030

UnexpectedTypeException: HV000030: No validator could be found for constraint ‘javax.validation.constraints.NotBlank’ validating type ‘java.lang.String’.

Read More

Gradle - Understanding Build Caching

The documentation for Gradle Build Cache is great and goes in depth but it lacks a quick “getting started” examples. Let me therefore explain the difference between UP-TO-DATE and FROM-CACHE, and reach out to the official documentation if you have any further questions.

Read More

Vaadin and ConcurrentModificationException

You’re having ConcurrentModificationExceptions that occur randomly and can not be reproduced at will. The stacktrace doesn’t help much since it simply points into VerticalLayout.add() or similar, and everything looks okay. This kind of exception happens when a Vaadin code is accessed from a background thread. But it’s definitely not easy to figure out, exactly who is calling Vaadin code without ui.access().

Read More

Vaadin - Is Push WebSocket connected?

You can call ui.getInternals().getPushConnection().isConnected() to figure out whether Atmosphere websocket pipe is connected. The question is, is the pipe actually alive and healthy?

Read More

Ubuntu Linux VS MacBook

I’ve bought an old 2015 x86 MacBook Air, to get a taste of the Apple experience, and to see whether it might be my daily driver. Currently, I’m quite happy with Ubuntu, but I’m always hesitant to suspend the machine - it never worked properly in the past. Also the Nvidia+Wayland support is just strange; IDEA also had a couple of GNOME Shell-related issues in the past. I wanted to see whether things work better on Apple machines.

Read More

On Java Optional

As Brian Goetz mentioned: Optional is intended to provide a limited mechanism for library method return types where there is a clear need to represent “no result,” and where using null for that is overwhelmingly likely to cause errors.

Read More

Better Growatt Dashboard with Grott

The default Growatt Dashboard is slowly refreshed, often behind the real data by half a hour or more. The mobile Growatt app is horrible, it frequently requires you to re-login, and then shows obsolete data. The solution is to grab the data from Growatt Inverter ourselves and visualize them using Grafana.

Read More

okhttp vs JVM built-in HttpClient

okhttp was my go-to library when writing a http client code for JVM. However, since Java 9 there’s a built-in java.net.http.HttpClient. Feature-wise and API-wise it compares very well against okhttp - it’s really usable, supports async out-of-the-box and is baked-in in JVM by default, as opposed to okhttp (which also brings in additional dependency on okio).

Read More

Java Generators

Python has had a concept of generators for a long time. In short, you generate sequence by calling yield repeatedly in a block, instead of splitting your code into a nasty state machine. Kotlin implemented the generators via coroutines, see Kotlin Sequences: Chunks for more detail. And now that we have virtual threads, we can do the same thing in Java.

Read More

Linux Wireless USB dongles

Pampered by the generally awesome hardware support straight by the vanilla linux kernel, I gave a couple of WiFi WiFi USB dongles a go, unfortunately the result is a bit of a mixed bag. I’m using Ubuntu 23.04 with kernel 6.2.0.

Read More

My personal favourite general programming language

Over the years I’ve come up with a set of rules for any programming language that really suit my programming style. It goes without saying that every person has their own preferences and/or tasks: you may prefer dynamically-typed languages, or you may have to develop a Linux kernel driver, and then you should not follow these rules. I would personally miss the benefits of a statically-typed language such as 100% auto-completion and automatic type checking, however you may not miss those things and instead appreciate other things offered by dynamically-typed languages. Please take this article as a highly subjective personalized rambling of one old man.

Read More

On Dart

When developing a small command-line app, I’ve tried to develop it in Dart, to get the feel of the language and its ecosystem. I liked Dart quite much - it’s very close to Kotlin in focusing on usability and producing readable code, and not bringing every fancy feature just because. The library ecosystem is also very rich, you can find library for anything. The library may be 0.0.2 created by some unknown dude, but it will work.

Read More

Debugging Kubernetes Ingress

If Kubernetes Ingress routing controller is misconfigured, it can provide surprising results. This guide lists all the points to take a look at. Works with Microk8s but should apply to any Kubernetes system.

Read More

NotSerializableException

Sometimes the serialized class suddenly references a completely unexpected class by accident (maybe some class is an inner class or such). However, by default the NotSerializableException prints only the offending class that’s not serializable, but it doesn’t print the ‘field path’ how the serialization got there.

Read More

Playing with Kubernetes - microk8s

microk8s is an excellent way to have a Kubernetes server up-and-running in no time on your Ubuntu machine. In this article we’ll deploy a container with nginx serving a simple static page, and we’ll configure ingress to perform reverse proxy for us.

Read More

Tips on CI

If you’re looking for a self-hosted OSS free CI, this may give you some tips.

Read More

Session-Scoped Routes

DON’T. Session-scoping a route is very dangerous since if the user opens two tabs, that route instance will be shared between the two tabs, leading to unpredictable errors.

Read More

REST server with your Vaadin app

The easiest way to add REST server to your vaadin app is to use Javalin in the standalone mode. By default, Javalin runs its own Jetty server. However, your Vaadin app is already running in a servlet container. We can simply exclude Jetty from Javalin dependencies and use Javalin via the regular Servlet API.

Read More

Vaadin And The Problem of Blocking Dialogs

A blocking dialog is a dialog which blocks the code execution until an answer is obtained from the user. For example, in Swing, it is possible to write a code block which shows a confirm dialog, waits until the user clicked the “Yes” or “No” button, then resumes its execution on confirmation and finishes afterwards. Something akin to the following:

Read More

OpenTTD (Transport Tycoon DeLuxe)

I love this old DOS/Windows game, and the brilliant OpenTTD project allows you to install and run the game easily, in any major OS. It bundles with a new open music, graphics data and everything, in order for you to run and play the game.

Read More

Custom DNS on your LAN

The DNS Relay functionality on the Arris Cable Modem/Router/whatever is a fucking disaster - it’s slow as hell and randomly stops working. I therefore set up my own DNS relay server on my LAN.

Read More

Vaadin Production/Development mode and flow-build-info.json

Vaadin components are partly build in javascript, to make the components work in the client-side (in the browser). That javascript code needs to be downloaded from somewhere, built, then distributed to the browser. For that we’re using the JavaScript toolchain. Without going into details, think Maven for JavaScript - it’s called npm. There’s also “webpack” which takes stuff downloaded by npm, and creates one huge javascript file out of that. That’s all you need to know about JavaScript part of Vaadin. Now, back to the point.

Read More

Kotlin Native - Lessons Learned

Having excellent language (Kotlin) with a proper full-blown garbage collector (not just reference counting) compiled to native binary which starts up insanely fast is a god-send. That being said, a language is almost useless without a set of libraries; and this is where Kotlin Native lacks severely, especially on ARMs.

Read More

Running Vaadin TestBench or Selenium on Ubuntu

Running TestBench on Ubuntu is a nightmare. The ChromeDriver will block endlessly and won’t work, while FirefoxDriver will either segfault snap or fail with some other crazy error. On top of that, Selenium has problems with Chromium and Firefox installed as snap.

Read More

Vaadin Boot

It came as quite a surprise to me that many people are using Spring Boot just to avoid having to launch their apps as WAR files in Tomcat. But then again, it makes sense: simply running a main() function is far simpler than having to fiddle with WAR and Tomcat deployment in your IDE, hoping that debugging would just work.

Read More

Linux DNS stopped working

The newest Linux/Ubuntu 22.04+ DNS resolve stack is a fucking spaghetti of resolvconf, systemd-resolved, Network Manager and 34724 other cryptic shit. In the good old days you would add nameserver to /etc/resolv.conf and be done with it. Now you can’t even edit the file since it’s a symlink to ../run/resolvconf/resolv.conf with nameserver 127.0.0.53 which is a DNS server running locally on your machine by systemd-resolved.

Read More

Vaadin Lookup VS Vaadin Instantiator

Keywords: Vaadin Initialization. Quoting Javadoc, “Lookup Provides a way to discover services used by Flow (SPI). Dependency injection frameworks can provide an implementation that manages instances according to the conventions of that framework. This is similar to the Instantiator class but a Lookup instance is available even before a VaadinService instance is created (and as a consequence there is no yet an Instantiator instance).”

Read More

Vaadin + Localization/Internationalization (l10n/i18n)

The I18nProvider class handles the duty of performing localization in Vaadin apps. You can invoke it either directly via VaadinService.getCurrent().getInstantiator().getI18NProvider().getTranslation("key", UI.getCurrent().getLocale()); or via Component.getTranslation(). The latter is much shorter, but you may not have a component always around to perform the translation. Therefore, I recommend to create a simple class

Read More

Networking in Lenovo T14s sucks

T14s is a great laptop on paper: powerful AMD processor, portable 14” body, lovely piece of art. A complete garbage underneath. This is literally the worst machine I ever owned.

Read More

Extension Functions

Garbage Collector is a big thing, even though it doesn’t receive much spotlight in the news. Do you remember the feeling of relief when you moved to a language with garbage collector? Suddenly you didn’t had to remember all the time who’s responsible for memory allocation and freeing - is it the caller? Or the callee? This for even the most basic things like strings.

Read More

Force the browser to download the content

The best way to achieve that is to use the Vaadin Anchor component, setting href to appropriate StreamResource. That way, the browser will correctly open the download dialog by default, working as expected. Tags: FileDownloader.

Read More

Building Vaadin 14+ apps offline

This could be tricky: not only you need a Maven repository proxy/cache which will allow Maven to access and download Vaadin jars (and transitive dependency jars), you also need a (p)npm proxy/cache which will allow (p)npm to access and download JavaScript client-side stuff used by Vaadin.

Read More

Java will die

A bit of a clickbait title there; sure, there has been countless articles in this regard (die/won’t die/blah). I’m not interested in when or how; here I’ll talk about the why. In my Java Is Not Dead, Java Is Obsolete article I touched the subject from an evolutionary point of view (think of Java as a meme - it is alive only when there are Java practitioners around. Since the stream of new practitioners shrinks every year because there are more lively memes, the “Java” meme will shrink and die as the pool of its hosts will shrink). Here, I’ll touch other topics.

Read More

Extend WiFi range with multiple Access Points

Covering large area with a reliable WiFi signal may be tricky. The idea is to simply add more access points to different parts of your house, essentially creating a network which together covers the entire house. All of the APs (acronym for Access Point) share the same SSID; the client (your laptop or mobile phone) then knows that it can connect to any of those APs to obtain the access to the internet. As you move the device within your house, the device will eventually lose connection to the original AP and needs to reconnect to a different AP. The promise here is that the device is free to reconnect (this is called “Roaming”) to any other AP without having to obtain a new IP or reconfigure its networking much - this way the device can keep the TCP/IP connections open and continue communication. In order to keep this promise, all APs must be connected to the same LAN network, sharing the same netmask and gateway.

Read More

What to do when Vaadin Grid behaves slowly?

Grid is the most complex component in Vaadin, and it’s not easy to figure out what to do when it starts behaving slow. However, here are couple of tips to try. Try these tips out regardless of whether you’re using Vaadin 8 or Vaadin 14.

Read More

Vaadin and IE11

Vaadin 14 kinda supports IE11, but there are limitations. The performance hit is substantial, for example vaadin-grid may perform 5x-10x slower in IE11 than in Chrome or Firefox, on the same machine. This performance hit will not be fixed (it can not be fixed) - if you need a performant site for IE11 then Vaadin 8 is the best choice.

Read More

Cached Vaadin Routes (UI-scoped Routes)

If you need to preserve the state of certain route during the duration of user’s session (e.g. to preserve a half-filled form so that the user can return to the form and fill it afterwards, or to create a multi-route wizard with a back+forward navigation), you may use the following code to cache the route components in your session.

Read More

Best cheap tablet for Netflix

So apparently the tablet needs to support something called Widevine in order to play Netflix/Amazon Prime Video in Full HD. At first I thought it’s not such a big issue to watch movies in 720p, but there’s a big but:

Read More

Eat Your Own Dogfood

The only way humans really learn is by their own mistakes. Make a programming mistake, live with it, maintain it, fix it, then move on. That is the only way to grow as a developer. That implies that if you’re not also the maintainer of your own code, you can not grow as a developer: there is no other way to learn from one’s mistakes than by becoming a maintainer of your own code.

Read More

Component-Oriented Programming

If you ever used a component-oriented framework such as Java’s Swing or Vaadin, then you’re familiar with components such as buttons and checkboxes. It goes like this:

Read More

Java Anti-Patterns

Have you ever found yourself using certain library or approach, but instead of feeling empowered by it, you constantly have to fight back, go against the flow and bend the rules in order to achieve things? Congratulations, you’ve found your personal anti-pattern.

Read More

MVC/MVP/MVVM? No Thanks.

The Model-View-Controller, Model-View-Presenter and related patterns are very popular with page-oriented frameworks such as Ruby on Rails, Groovy on Grails and Python Django. There is typically a lot of things going on in the page, and the MVC pattern helps keeping the code separated into smaller, more easily digestable packages.

Read More

On Complexity

I hate complexity. I can’t stand it, I can’t handle it, and most importantly: I don’t want to handle it. I hate frameworks that expose me to great complexity just in order to achieve something simple, ultimately producing stacktraces 200 lines deep into some dynamic proxy crap I’m not possible to understand in a day. And why should I? If the library is not simple, then clearly the authors have not done their homework, haven’t found the right approach or abstraction, or they don’t care about simplicity, and thus it’s not worth my limited Earth time.

Read More

Safe JavaScript Keyboard Shortcuts

Having e.g. Alt+Z bound to certain functionality in your webapp helps users to control the app quickly. However, certain browsers may reserve certain key combinations (e.g. Ctrl+W to close a tab) and will not pass those combinations to your app.

Read More

TCP-IP Sucks

TCP/IP was established as a means to have a bi-directional pipe where random packet reordering can not happen and where the information is reliably delivered to the other party. It succeeded with the “reordering” part, and failed miserably with the “reliably” part. Read on.

Read More

Multi-Stage Docker builds

In the past I have written an article regarding Launching your Vaadin apps in Docker and Running WAR apps in Docker with Jib. However, what if you don’t have Java installed at all on the machine (e.g. it’s a CI server) and therefore can’t run Gradle build? Or what if you don’t want to have an unfamiliar Gradle script running on your machine (e.g. could be a virus)? The solution is to perform the build itself in Docker as well, by using Docker multi-stage builds.

Read More

Vaadin 8 Freezing with Push disabled

In case the push is not used, the XhrConnection class is used to send requests. It doesn’t matter whether it’s a Poll request or a “regular” request stemming from e.g. pushing a button - in this case they are equal. The code at XhrConnection:193 suggests there is really no timeout set, and so Vaadin client will happily sit there for 10 hours, awaiting a response to the message it had sent:

Read More

Vaadin 8 Push issues

Vaadin Push is a tricky complicated beast, based on a complicated push stack. A lot of things can go wrong, causing the Vaadin client to freeze endlessly. Let’s discuss how exactly push works, and what can be done to prevent the freeze.

Read More

Vaadin 8 Communication Explained

Vaadin’s synchronization protocol is based on UIDL (UI Diffing Language?). Basically it’s a JSON file, listing what have been changed since the last UIDL update. For example, if you set a new caption to a TextField with connector ID 42, you will be able to observe this information in the UIDL sent from the server to the client.

Read More

No Magic!

I’ve read an amazing article Who Needs Lombok Anyhow, which discusses Lombok and its quirks. I personally feel no need for Lombok since Kotlin contains all the features offered by Lombok, but there was something else that caught my eye.

Read More

SATA SSD USB Enclosure

You need to be careful when picking an USB enclosure for your SATA SSD drive: the problem is that not every USB enclosure supports the SATA TRIM / USB UNMAP command, which is a must for keeping your SSD healthy.

Read More

Vaadin - Troubleshooting the Browser

Sometimes Vaadin 14 fails mysteriously, which is very unfortunate: it now uses LOTS of JavaScript code, frameworks and tools. Those things are unfamiliar to server-side guys, and it’s really hard to tell what to do, should one of JavaScript toolchain fail.

Read More

Vaadin 14 - Troubleshooting

Sometimes Vaadin 14 fails mysteriously, which is very unfortunate: it now uses LOTS of JavaScript code, frameworks and tools. Those things are unfamiliar to server-side guys, and it’s really hard to tell what to do, should one of JavaScript toolchain fail.

Read More

Vaadin 14 - The missing guide

The Vaadin documentation is a good source of initial info for Vaadin, but unfortunately in certain cases it simply doesn’t go deep enough. This is especially true with respect of the toolchain Vaadin uses, and the files it relies on. Therefore, this blog post.

Read More

Vaadin 8 - Who Steals My Focus? Where did my focus go?

Imagine typing something into your application’s TextField, and suddenly bam: the TextField loses the focus or something else gets focused instead, for no apparent reason. This article will summarize a list of items to review, to find out which pesky component or code steals your focus.

Read More

Debugging Your Widgetset Components With SuperDevMode For Dummies

When trying to fix some browser-side issue in your GWT components, it is often useful to modify those component sources while your app is running, then refresh your browser with F5 and immediately see the changes done in Vaadin Button. This blogpost describes how to configure Intellij to do just that.

Read More

Why Is My JVM Server So Slow?

If your server-side JVM app chokes up when serving 20 concurrent users, then there is something very wrong. Luckily, it’s usually very easy to find out the initial hint as to where the problem may lie.

Read More

Deploying Vaadin app on Karaf

Karaf is an OSGi container rather than a WAR container. Hence it is not as easy to deploy your WAR into Karaf as opposed to, say, Tomcat. You basically have three options:

  • Split your WAR into separate jars, add OSGi descriptors to all of those so that Karaf recognizes them as OSGi bundles, then plug your servlets into Karaf’s pax-web something. That’s a lot of work.
  • Repackage your WAR as JAR with JARs, add OSGi descriptor so that Karaf recognizes that as a big bundle, then plug your servlets into Karaf’s Pax-Web. That’s still a lot of work.
  • Use WAR Deployer and just copy your WAR to the deploy/ folder. Ta-daa! This is the easiest way of deploying WAR to Karaf, the one that doesn’t require you to add OSGi manifests to your WAR and/or tackle the XML bundle configurations. Let’s go.
Read More

Using Vaadin-on-Kotlin with Spring

While I don’t recommend using Spring because of simplicity reasons, there are valid reasons to have Spring support. For example when building UI for an already existing Spring-based backend, or when gradually converting a legacy application to VoK.

Read More

Real-world experience with CouchBase Lite Android

I’d like to write something positive, but I can’t - my experiences with CouchBase had been highly negative. I’d even dare to say it’s an unfinished piece of junk; if you need to setup a syncing platform from your Android app, avoid CouchBase like a plague.

Read More

How Software Begins to Rot

Proper building construction is to have a proper design which includes all latest state-of-the-art components and follow all safety precautions. The building won’t collapse and it will be great. If you however use this approach with software, you will fail.

Read More

Vaadin 10 server-side layouting for Vaadin 8 and Android developers

The client-side in Vaadin 10 is completely different than the one in Vaadin 8 and the layouting manager from Vaadin 8 is completely gone. Vaadin 10 layouting is therefore something completely different to Vaadin 8 layouting. Naturally, it is something completely different to Android layouting. Here we will focus on layouting completely configured from server-side, and not from a CSS file.

Read More

Using self-signed OpenSSL pem with Docker Tomcat

It is possible to use pem-style certificates with Tomcat Docker image, without any need to store them first into the Java keystore. This is excellent since not only it is easier to generate self-signed certificate with the openssl command, this can also be used with certificates produced by Let’s Encrypt.

Read More

Back To Base (Make SQL Great Again)

I have to admit upfront that my brain is somehow incompatible with JPA. Every time I try to use JPA, I will somehow wind up fighting weird issues, be it LazyInitializationException with Hibernate, or weird sequence generator preallocation issues with EclipseLink. I don’t know what to use merge() for; I lack the means to reattach a bean and overwrite its values from the database.

Read More

You can't make a living selling Android Apps

I’m sure that Thomas Kriebernegg, the CEO of App Radar will be happy to persuade you that you can make a living by selling Android Apps. He needs to - his way of making a living is to sell services to Android devs so he better make sure there are lots of Android devs; discouraging devs from becoming Android devs would be a financial suicide. But why not trying out your luck? After all, Flappy Birds was making $50,000 a day in ads; Clash of Clans makes millions of dollars. Let me tell you a fucking secret: you are not going to be the author of Flappy Birds and Clash of Clans, and let me tell you why.

Read More

Try out TeamCity quickly with Docker

Teamcity is quite a nice continuous integration server from Jetbrains. The set up is not that easy though since you typically need to install the TeamCity server itself, and at least one agent which will perform the building itself.

Read More

Vaadin And Kotlin Coroutines

When Kotlin 1.1 brought in Coroutines, at first I wasn’t impressed. I thought coroutines to be just a bit more lightweight threads: a lighter version of the OS threads we already have, perhaps easier on memory and a bit lighter on the CPU. Of course, this alone can actually make a ground-breaking difference: for example, Docker is just a light version of a VM, but it’s quite a difference. It’s just that I failed to see the consequences of this ground-breaking difference; also, performance-wise in Vaadin apps, it seems that there is little need to switch away from threads (read Are Threads Obsolete With Vaadin Apps? for more info).

Read More

Are Threads Obsolete With Vaadin Apps?

Let me start by saying that threading model (or, rather, single thread model) provides the most simplistic programming paradigm - the imperative synchronous sequential programming. It is easy to see what the code is doing, it is easy to debug, and it is easy to reason about (unless you throw in dynamic proxies, injected interfaces with runtime implementation lookup strategy and other “goodies” of the DI) - that’s why having such paradigm is generally desirable. Of course that holds only when you have one thread. Adding threads with no defined communication restrictions overthrows this simplicity and creates the most complex programming paradigm.

Read More

Gather Your Code Together

Nicolas Frankel put some of my feelings into an excellent article Is Object-Oriented Programming compatible with an enteprise context?. During the development of Aedict Online (still as a Java-based JavaEE/JPA app back then, now it’s Vaadin-on-Kotlin-based), when trying to find rows from JPA+DB I often tried to find the necessary functionality on the JPA entity itself. Wouldn’t it be great if, upon user’s log in, we could find the user and verify his password using the following code?

Read More

Browserless Web Testing

Traditionally, the testing of a web portal is done from the browser, by a tool which typically using Selenium under the hood. This type of testing is closest to the user experience - it tests the web page itself. Unfortunately, it has several major drawbacks:

Read More

Java VS Kotlin

In his blog about comparing Kotlin and Java features, Simon was IMHO too kind. Creating a prototype of some app in Kotlin, then converting the code painfully to Java (simply because Java is company’s lingua franca) and watching it inflate and obfuscate itself is quite an eye-opening experience.

Read More

Code Locality and the Ability To Navigate

Once a project leaves the rapid development phase and enters the calm waters of maintanenance mode, the programming paradigm changes. Fancy hyped frameworks favored by project creators no longer play important role. What matters most now is the code readability and understandability. The code is already written - now it is going to be read, understood and fixed. After all, that’s usually what happens to the code - it is written once but read by many. This is true both for open-source, but also for closed-source: people in the team come and go, and new team members need to read the code, to familiarize themselves with it.

Read More

Debugging Built-in Vaadin 8 Components With SuperDevMode For Dummies

When trying to fix some browser-side issue in Vaadin built-in components, it is often useful to modify those component sources while your app is running. This way, you can modify e.g. VButton.java, refresh your browser with F5 and immediately see the changes done in Vaadin Button. This blogpost describes how to configure Intellij to do just that.

Read More

Open Your Dev Site On Tablet

When doing mobile development with Vaadin, you often develop the app on your dev machine and view the page on a tablet or a phone. Yet, entering your dev machine IP into the phone browser may be tedious and error-prone. There is a way though, to enter an URL to your phone. Via a camera, as a QR Code.

Read More

Tutorial - Writing Vaadin apps in Kotlin Part 4

Now if there was some way to get rid of that pesky em -> which needs to be written every time one calls the db {} function. If only there was a way we could tell a block to “know” some variables implicitly… Maybe we could throw those “variables” into a class and tell the block to run as some kind of an extension method in that class? That could work - extension methods have direct access to the receiver object methods and variables. Remember our findAll() method?

Read More

Tutorial - Writing Vaadin apps in Kotlin Part 3

I’ll get to the forms right away. But first, I want to talk extension methods. They are immensely helpful in adding functionality to objects. Note that Kotlin is not a dynamic language - the methods will not really be added to target classes, it is just a syntactic sugar. Quite delicious, though. So, EntityManager misses the findAll method - let’s fix that. Open the DB.kt file and add this to the end:

Read More

Tutorial - Writing Vaadin apps in Kotlin Part 2

Let’s add some database to our hello-world. I’ll use the pure-Java embedded database called H2 which will run as a part of our application, so there is no need for you to install any database engine. Open the pom.xml file and add the following lines at the end of the dependencies element:

Read More

Tutorial - Writing Vaadin apps in Kotlin Part 1

Kotlin provides some very interesting language features which are immensely helpful when writing Vaadin apps. Let us start from scratch, building necessary functionality as we progress. The result of this exercise will be a Kotlin-based simple web app, built with Gradle, using Hibernate+JPA o store entities into the database. I will not use Spring nor JavaEE here - the whole thing will run in a pure Servlet environment like Tomcat or Jetty. The complete exercise may take some 60 minutes. I will be using Intellij IDEA Community which you can download for free here: Download IDEA. When installing, just press the “Skip remaining” button to install Intellij with the default settings.

Read More

Using JPAContainer with Vaadin 8's v7 compatibility Grid

When one tries to migrate her project to a newer version of a framework, it usually helps if the transition is smooth and the original code works without any modifications. This way, you can convert the code to the new API gradually, and never encounter this OMG-shit-doesn’t-compile-everybody-blocked period for a long time.

Read More