Stackoverflow.com question deleted within 2 minutes.

This question was sighted on stackoverflow.com on Thursday, April 30, 2013.  It was deleted within 2 minutes from being posted, but not before I managed to take a screenshot.


Fixing the AutoCloseable interface of Java

Java 7 introduced the AutoCloseable interface, which is roughly equivalent to the IDisposable interface of C#, to be used in synergy with the new try-with-resources statement, which is equivalent to the using-disposable construct of C#.

The problem with Java's AutoCloseable interface is that its close() method is declared to throw a checked exception: void close() throws Exception. This is a problem if you are one of the many programmers who prefer unchecked exceptions over checked ones, because it forces you to deal with checked exceptions every time you write a try-with-resources statement, despite the fact that none of your classes ever throw any checked exceptions on close().  Simply declaring that your class implements AutoCloseable forces checked exceptions upon you.

Luckily, there is a fix for this.  Here it is:
public interface AutoCloseable2 extends AutoCloseable
    void close();
There, I fixed it for you.

By declaring a new interface which redefines the close() method as not throwing any checked exceptions, the problem goes away.


I just looked at the Oracle documentation for the AutoCloseable interface and found out that this had already been anticipated:

"[...] subclasses of the AutoCloseable interface can override this behavior of the close method to throw specialized exceptions, such as IOException, or no exception at all."


Solved: svchost.exe high CPU and memory

A few days ago one of the svchost.exe processes on my machine (Win7 64) started exhibiting this annoying behavior: it will start with about 30 to 40 megabytes of memory, which stays roughly constant for a while, but then later it begins bloating, slowly but surely, possibly at a slightly exponential rate, until a few hours later it is taking up so many gigabytes that I cannot work on my computer anymore. So, I have to stop what I am doing, save everything, and restart the computer, only to have to go through the same ordeal a few hours later.

On at least two occasions I have witnessed this happening along with unreasonably high CPU utilization, up to a full CPU core.

Obviously, this started happening after I installed or tweaked something, but I did not notice the precise point in time that it started happening, and my machine is a busy machine, so I had no suspects to name.

I looked around the interwebz for a solution, but to no avail.  People give some good troubleshooting hints, but nobody seems to have an actual solution.

The svchost.exe process which causes the problem contains the following services:


A monstrous Visual Studio 2010 intellisense bug

I had this happening on my development machine, (I use C# on VS2010) so I went over to The Code Project and asked if anyone else could reproduce it, and sure enough, it has been confirmed.

Steps to reproduce:

Create a new project, make it a C# console application, use all default settings. Open the generated Program.cs file and replace its contents with the following:

namespace ConsoleApplication1
    public class ParameterAttribute: System.Attribute

    class Program
        [Parameter( name:"foo" )]
        int Field1;

        static void Main( string[] args )

I know, there is an error in the code; please bear with me:


Vintage stuff from my days of 320x200-pixel 256-color VGA

It was the end of 1993. The peak time of the 320x200-pixel, 256-color VGA.  Around that time the world saw some legendary game releases such as Doom and Prince of Persia 2.  The year before that, we had seen Wolfenstein 3D and Indiana Jones and the Fate of Atlantis. Wing Commander and Wing Commander II had already been released as early as 1990 and 1991 respectively. Most of those games were raster-graphics-based. Wolfenstein 3D was a weird thing that we did not quite know whether to call it raster-based or vector-based;  Doom looked rather vector-based, so it was beginning to seem that vector graphics might be the way of the future; but when Lucas Arts released Star Wars: X-Wing, even the slightest doubt went away.

My available time for experimentation with vector graphics was limited, since I was attending classes at the University and holding a full time job, but I managed to put a few demos together. In order to run these demos today one would need a DOS emulator, but I will spare the reader from that hassle, and I will just provide some very short videos of the demos instead. (Each video is only a few seconds long.)

It is worth noting that the following demos are 16-bit DOS applications and they are not making use of any ready-made graphics libraries. A direct BIOS call puts the graphics adapter in 320x200x256 mode, and from that moment on it is just routines entirely written by me in 80386 assembly and C++ directly accessing the video RAM.

Any distortion, jaggedness, and / or fuzziness that you might observe in the following videos is mostly due to the imprecise nature of interpolation via integer arithmetic;  however, many artifacts, and most importantly any skips that you might notice in the movement, are due to the video capturing process and / or video file format conversions.  The actual demos run as smoothly as silk. 

Demo A: Bitmap Rotation and Scaling

The following demo shows rotation and scaling of a bitmap. The underlying algorithm performs line interpolations across the source bitmap to visit the pixels that it copies to the video RAM, so it is essentially bridging the realm of raster graphics and the realm of vector graphics.

On the first run of the demo vsync is enabled, yielding a constant 70 frames per second on my modern Win7 x64 PC. As expected, CPU utilization is so small that it is not even detectable.

Bitmap rotation and scaling with vsync: 20 seconds 


A few samples of my work on Darkfall Online

The development of a game like Darkfall Online in a country like Greece was a rather unlikely thing to happen, so I consider myself very lucky that it happened and that I was part of it. The funding came from a Greek-Libyan family which has made enough money out of oil-related construction to be able to afford the luxury of investing on something fun, rather than on something with a high ROI, or even a guaranteed ROI. Thus Razorwax, a promising team of Norwegians some of whom were already published in the gaming industry, was brought to Greece to build Darkfall. I was the first Greek programmer hired, and I worked primarily on the GUI of the game. I stayed with the company until almost an entire year after the game was released.

Me at Aventurine, in 2004. Click to enlarge.
What follows is a rough diagram of the design of the GUI that I built for Darkfall: The graphics engine (written by a colleague in C++) provided me with just two asynchronous primitives, one for drawing textures, and one for drawing text. The layer we called middleware (written by another colleague, also in C++) provided me with the functionality of the "GetTextExtents" Win32 GDI function, and with an interface to the browser window (encapsulated instances of Microsoft Internet Explorer.) 


Vintage stuff from my days of Visual C++ and MFC

This post shows some screen captures demonstrating work that I did on a Computer-Aided Civil Engineering application called "FESPA for Windows" back in 1996-1998 while working at SENA Ltd. on behalf of "LH Logismiki".

"FESPA for Windows" is now called "Master". SENA Ltd. does not exist anymore, but LH Logismiki does, and their website can be found here: http://www.lhlogismiki.gr/.  I took these screen captures from their web site, and apparently the modules that I built for them back in 1998 have not changed much, 15 years later. Even most of the icons that I designed for them are still the same.

3DV on black background #1. Click to enlarge.
The above is a screen capture of the "3DV" module, designed and written entirely by me. It is from the early black-background days, before we were told to switch to white background to "make it look more like Microsoft Word".  3DV can pan the structure up, down, right and left, zoom it in and out, and rotate it in any way the user likes. Using data produced by the finite-element analysis module, it can also show the distortions that the building undergoes due to static loads, or in the event of an earthquake. It can even animate the distortion of the whole building. (Pretty fancy stuff!)