In this article I enumerate reasons why typical approach to painting in AWT / Swing can result in substantial visual lags, provide examples that demonstrate the problem and propose methods to significantly reduce the drawing latency.
Despite the focus on Java platform, the key ideas can be extended to most modern operation systems and GUI frameworks.
All key points are accompanied by short, shelf contained, compilable examples that clearly demonstrate the theoretical concepts in practice. The code is also accessible as a GitHub repository. Continue reading →
At first, the idea of installing a full-fledged, contemporary IDE on Raspberry Pi may seem unrealizable. Raspberry Pi boards are incredibly small, so it’s hard to believe that those devices are apt for such a task. Nevertheless, in reality, Rasperry Pi can do much, much more than blinking a LED.
After trying out Scala on Raspberry Pi for some time, I configured my Rasperry Pi to run IDEA & Scala plugin for the recent ScalaDays conference. While it was initially intended to be just a “proof of concept”, it turned out that we were able to open the Scala plugin project itself (which is pretty large, and includes all IDEA CE sources) and to comfortably use this setup for most feature demonstrations. Obviously, it’s unreasonable to expect desktop-like performance from such a device, however I happen to successfully use a similar environment on EEE PC which was hardly faster.
The instructions rely on the following keystones that make the undertaking possible (and even practical):
Raspberry Pi 2 Model B, which offers a 900MHz quad-core CPU and 1GB of RAM (this one is for the “practical” part, yet you may try to use Rasperry Pi 1 as well).
This article shows how to install and use Scala programming language on Raspberry Pi.
Traditionally, the programming language of choice for Raspberry Pi was Python, while JVM-based languages were set aside. That was reasonable, because JVM platform is rather resource-intensive, especially in interpreted mode, and the first version of Raspberry Pi was hardly apt for such a task.
However, things have changed: on the one hand, Raspberry Pi 2 now offers a 900MHz quad-core CPU and 1GB of RAM, on the other hand, Oracle released JDK 8 for ARM (with HardFP, JIT and server VM), which provides >10X performance boost (comparing to Zero VM from OpenJDK), so Scala runs nicely even on Raspberry Pi 1 (and, RPi 2 can run IntelliJ IDEA, if you wish).
Solving these puzzles (and comparing your solutions with solutions of others) is a good way to “get a feel” for programing language and to explore idiomatic approaches to particular kind of problems.
Today we can easily find solutions to the problems in almost any wide-spread programming language. However most of the attempts use a single programing language and provide only one solution to each problem.
By providing multiple types of solutions we can enrich our programming “toolbox” and learn pros and cons of various methods. By using several programming languages simultaneously we can easily correlate different programming paradigms and explore limits of language expressive power.