2015-11-26

On International Company Culture in The Netherlands

This was written on 2021-11-26 but it is retro-dated so as to not appear among my recent posts, and thus avoid embarrassing certain unnamed entities.  It is written in past tense even though a few paragraphs down the page it begins describing my current experience, because in the near future I intend this to become my past experience.

In 2015 I decided to leave Greece and its destroyed economy, and to go live and work elsewhere in Europe. I started an international job search, and within a couple of months I had a few offers to choose from. I picked the one from a company called Topdesk, in the nice little university town of Delft, in The Netherlands, mainly because of tax benefits available to expats in that country, but also, and in no small part, because The Netherlands has the reputation of being one of the most foreigner-friendly countries in Europe. The Netherlands achieves this reputation in a number of ways, one of which is the fact that the Dutch rank number one in the world (1) in English-as-a-foreign language proficiency, making it possible to live in The Netherlands without ever having to learn Dutch.

2015-10-21

The Mother of All Bugs

Summary: This is a story about the most elusive and sinister software bug I ever came across in my decades-long career as a programmer.

The Mother of All Bugs

At some point early in my career I was working for a company that was developing a hand-held computer for the area of Home Health Care. It was called InfoTouch™. The job involved daily interaction with the guys in the hardware department, which was actually quite a joy, despite the incessant "It's a software problem!" -- "No, it's a hardware problem!" arguments, because these arguments were being made by well-meant engineers from both camps, who were all in search of the truth, without egoisms, vested interests, or illusions of infallibility. That is, in true engineering tradition.

During the development of the InfoTouch, for more than a year, possibly two, the device would randomly die for no apparent reason. Sometimes it would die once a day, other times weeks would pass without a problem. On some rare occasions it would die while someone was using it, but more often it would die while sleeping, or while charging. So, the problem seemed to be completely random, and no matter how hard we tried we could not find a sequence of steps that would reproduce it.

2015-10-18

Computer telephony in C++ with MFC

Back in 1999-2000 the state of the art in computer telephony was called Interactive Voice Response (IVR).  Nowadays when we speak of "voice" we usually mean voice recognition, but all that those telephony systems did back then was to playback recorded messages and wait for the caller to press digits on their phone. Sometimes, we would ask the caller to speak on the phone, and we would record their voice, for a human operator to listen to later.

The hardware had special filters on it to recognize the DTMF digits, probably because the CPU was thought of as too wimpy to do it by itself.  I experimented writing WAV-file processing filters on my own, and discovered that it took less than 10% of CPU time per phone line to run such filters in software, so it could certainly be done, but then again there existed systems out there in configurations of 30 or even 100 lines per computer, and of course the CPU was not enough in these cases.  We only worked with configurations of four lines per computer, but still, since the filters were made available by the hardware, I made use of them for the work project, and I only re-invented the wheel at home, for fun.

My employer at that time managed to secure a number of computer telephony contracts for a couple of big clients; he gave me a rough description of what the projects were supposed to do, and he had my coworkers slide pizza under my office door for as long as it took me to complete them.  He probably charged his clients the equivalent of a dozen programmers for this, and it was all done by me.  The only external help that went into these projects was messages recorded by a professional at a recording studio.

What follows is some screenshots of the telephony application that I created to run these projects, in Microsoft Visual C++ using MFC and the Dialogic Telephony API.

All applets waiting to start. Click to enlarge.

Crossword Puzzle Compiler

Techniques demonstrated:

  • Solving an intractable problem using a scoring heuristic
  • Super-indexing data structures for ultra-fast domain-specific queries

Summary (just gimme the TL;DR)


This is old-style artificial intelligence in action, solving within seconds a problem that would normally take eons to complete.

You give it a crossword grid, and a long list of words, and it finds ways to mesh words into the grid so as to form a complete crossword puzzle.  The final working version was done in 2003 using C# version 1.2 with a minimalistic UI in WinForms. 

The following 30-second video shows the crossword compiler in action, filling multiple successive crosswords using a word list taken from actual crosswords that have been published on the interwebz by various sources through the years.  The video is in real time, showing that the crossword compiler is, in most cases, extremely fast.


2015-10-04

Portfolio

I added a page where I list posts on this blog that can collectively serve as my portfolio.

It can be found here:

Michael Belivanakis - Portfolio



2015-09-25

Is my mentor's concern for code quality excessive?

There is this question that was asked on Programmers SE on Jun 12, 2015 which I answered, and as a result I received plenty of reputation, as well as a silver badge. Unfortunately, after a few days the question was closed as primarily opinion-based and then deleted.  Since I now have sufficient reputation to view deleted questions, I was able to find it, and I am posting it here for posterity.

Is my mentor's concern for code quality excessive? [closed]


Score: 75 (79 upvotes, 4 downvotes) Favorites: 28

To tell you a little about myself: I'm a newbie programmer working internships and learning a lot from experienced programmers. I can't believe I used to think I was good in college.

The one I'm doing right now is pretty great due to the amount of time and resources that the company is putting into helping and mentoring me and another intern. I'm learning a whole lot and for the first time, I feel like I get close to being competent.

The only "problem" are the massive code quality concerns of one of my mentors. It's to the point that anything takes a whole lot of time because I have to find the best way to do it or else it's a waste of time. It also feels like my creativity doesn't matter because there is only one right way to do everything. I don't mind any of this at all but I wonder, and this is mainly what I'm asking, if it's normal in the industry.

Also, when I get assigned a little feature and this guy reviews my code, he actually reviews the whole codebase I'm working on, pointing out loads of mistakes, most of them from before I was even hired. I have spent this whole week fixing code (that worked) written by their full-time programmers, even some things that are best practice according to other mentors.

Tags: [] [] [] []

asked Jun 11 2015 at 18:51 by CyborgFish
The question received 14 answers before it was closed.

The highest ranking answer was by Thomas Junk, with 130 points (gold bage is awarded at 100 points.)

The next answer was mine, with 71 points. (silver badge is awarded at 25 points.)

Here it is:

2015-09-14

Why Oracle Sucks

Oracle talks a lot about 11g Express Edition, and how it differs from the full (paid) versions of their database, but it does not say a word about the most important thing:
Is it compatible at the SQL syntax level?
No way to find out other than to try it.  So, let's try it.


2015-07-28

Woohoo! One more of my "Programmers SE" answers has received a score of -5 !

The question is on a controversial topic, and as usual, I take the controversial stance.  So, it is no wonder that people do not agree with me.

Here is the question:

programmers.stackexchange.com: Does it make sense to use “ys” instead of “ies” in identifiers to ease find-and-replace functionality?

2015-07-26

How to: Completely disable "Aero" in Windows 7

So, with Windows 8 sporting these god-awfully ugly opaque square boxes, which are not adorned in any way whatsoever, (not even the decent in all its simplicity gradient of Windows 98,) it seems like a confession on Microsoft's behalf that the spiffy "Aero" look of Windows 7 was nothing but an unnecessary gimmick afterall.

So, are you sticking with Windows 7 but want to disable Aero in order to enjoy considerable gains in performance, memory, power consumption, and GPU temperature? Here is how:
  1. Open up "Services". 
  2. Locate the service "Desktop Window Manager Session Manager". 
  3. Disable it and stop it. 
Enjoy!

2015-07-25

How to: Disable the administrative shares in Windows

To disable the administrative shares in Windows, (default shares like C$, ADMIN$, etc.) follow these steps:

1. Run the Registry Editor and go to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet \Services\LanmanServer\Parameters
2. Create a new DWORD, name it AutoShareWks, and leave the default value of 0.

3. Reboot Windows.

This will disable things like C$ and ADMIN$.

I am not sure how to also delete print$ and IPC$.  ("net share ipc$ /delete" appears to work temporarily, but the share automagically re-appears after the next reboot.)

How to: Enable the Administrator account in Windows

To enable the Administrator account in Windows:

1. Open up an elevated command prompt.  (If you do not know what this is, you should not be even thinking of enabling the Administrator account.)

2. Type the following command:
net user administrator /active:yes

2015-07-20

Solved: Windows: WiFi connect immediately after boot and before logon

In order to have your windows computer connect to your favorite WiFi access point immediately after booting, (without you having to first login to your computer,) follow these simple steps:

1.  First of all, make sure that this computer has connected before to the WiFi spot of interest.  (A so-called wireless profile is created as a result of this manual process.)

2. Run cmd.exe and issue the following command:
netsh wlan show profile
3. In the list of wireless profiles that are displayed, locate the one you want, and copy its name to the clipboard.

4. Run regedit.exe and navigate to this key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
5. Add a string value to this registry key.  Name it anything you like, and give it the following value:
%comspec% /c netsh wlan connect name="<profile name>"
Voila, next time you restart, your computer will immediately connect to this WiFi spot if it is in range.

Many thanks to user Soumya of superuser.com for posting this:http://superuser.com/a/133935/111757

2015-07-14

Solved: cannot eject USB device: "This device is currently in use."

Millions of people all over the planet continuously have this problem: they try to eject their USB drive so as to avoid data loss, but windows does not allow them.  Which is very frustrating, because whatever reasons windows thinks it has for not allowing the removal should have lower priority than the user's explicitly stated direct wish to remove the damned thing!

Anyway, suggestions for solutions abound on the interwebz.  Here are some that I found with a quick search:

1.  Put your computer to sleep.  When going to sleep, Windows flushes all buffers to all devices, so while the computer is asleep, it is safe to remove the device.  The problem with this approach is that I don't want to have to put my bloody computer to sleep each time I want to take a USB device out.

2. Use SysInternals Process Explorer to search for the drive name, find which process has a handle open on the drive, and terminate it.  The problem is that drive names are only one a letter and a colon, a search for "D:" may yield thousands of handles from several dozen processes, all of which are unrelated to your drive "D".  Unfortunately, Process Explorer does not offer any option to search for a whole word only.  Another problem is that this approach hardly ever works.  Apparently, there are ways in which devices can be locked which do not show in Process Explorer.  Even if you remember to launch it as Administrator.

3. Select "Quick removal" policy as opposed to "Better performance" policy in the drive properties. The problem with this is that it is not really a solution: we generally do specifically want the better performance, and we are willing to sacrifice quick removal for it, accepting slow removal instead. But this issue is not one of slow vs. fast removal, it is about not being allowed to remove your device at all, ever!

Here is the solution which worked for me, after the above failed:

4. Make sure that the drive, or any folders in it, are not shared on the network!  (Use "NET SHARE" on the command prompt to quickly find out what you are sharing.)

Solved: The network folder specified is currently mapped using a different user name and password

So, I am on computer A, trying to map a local drive to a shared folder of computer B, and Windows gives me this message: "The network folder specified is currently mapped using a different user name and password".  

Microsoft supposedly addresses this issue here: https://support.microsoft.com/en-us/kb/938120 and concludes that it is so by design.

Bullshit.  They are missing the point.  The error message is wrong.  The network folder specified is not currently mapped using a different user name and password. Instead, what is happening, is that another folder of the same computer B is already mapped on computer A using a different user name and password. 

So, apparently, with windows, if you connect from computer A to any share of computer B, then all subsequent attempts to connect from computer A to other shares of computer B must be done using the same credentials.  Go figure.

2015-07-13

The GWX (Get Windows 10) KB3035583 trojan horse

So, Microsoft has pushed this trojan horse to every single user of Windows on the planet.  It displays a Windows 10 logo on the taskbar, and it is basically telling you that not only you will get Windows 10 as soon as it comes out, but you should right now begin acting as if you are looking forward to it. Because, you know, you are their biatch.

So, let's see:  a) GWX installs on your machine without your consent; b) once installed, you cannot "quit" it or "exit" it; and c) you cannot find it anywhere to uninstall it.  So, it fits squarely within the definition of malware.

GWX is delivered by means of an innocent looking optional update, KB3035583.  The update is designated as "Recommended", and its description says "Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information."  (I am not making this up, that's exactly what it says, I suppose English is not their forte at Microsoft.)

Of course, with dozens upon dozens of updates each time you check, which give you no clue as to what they are about, and instead each one of them refers you to some web page for more information, you don't bother checking, and so you passively consent to this trojan horse being downloaded and installed on your computer.  If you click on "More information", you are taken to a web page which admits that update KB3035583 is nothing but an incredibly lame and stupid publicity stunt about the upcoming Windows 10.

And so, as it turns out, that bit about resolving issues in Windows was a fucking lie.

How to get rid of the KB3035583 trojan horse:

1. In Windows Update select Change settings, and make sure that "Give me recommended updates the same way I receive important updates" is unchecked.  This way, the fact that this is a "Recommended" update will not cause it to jump from the "Optional" updates list to the "Important" updates list.

2. In Windows Update select View update history, find KB3035583, and uninstall it.

3. In Windows Update click on "Check for updates".

4. In Windows Update go to Optional Updates, find KB3035583, and specify that you want it to be hidden.


And then in 2017 there is this:
betanews.com: Microsoft will never again sneakily force Windows downloads on users
(Though it is unclear to me whether this is about Germany only or the whole world.)

2015-07-09

Remote Desktop Connection quits without a word

So, I am firing up a remote desktop (RDP) connection, and the little box appears saying that it is trying to connect:


And then the box just disappears, without an error message or any other hint as to what might have gone wrong.

The interwebz abound with reports of this happening, and people asking how to fix it, and various solutions being offered that range from the complex to the hopelessly complex.

Luckily, every time I have encountered this problem, the solution for me was very simple: just wait and try again later.  The remote computer is probably busy booting, or perhaps booting and installing updates.

Now, I will tell you a little secret: when something goes wrong, software can ALWAYS give a meaningful error message.  If it does not, then someone, somewhere, is being either EVIL or INCOMPETENT.

If it could not find the server, it would have said that the server was not found.

If the server was not responding, it would have said that the server is not responding.

In this case, the server was actively refusing the connections, and someone at Microsoft was either so evil that they decided that in this specific case the software should not say anything, or, more likely, someone at Microsoft was so incompetent that they could not simply write their world-class software to give a meaningful error message in a very frequently occurring usage scenario.

Intel NUC5CPYH incompatible with Windows 7 Ulitmate 64 bit?

Intel advertises NUC5CPYH - (Celeron N3050) as being compatible with Windows 7.  It is not.  All my attempts to install Windows 7 Ultimate 64 bit on it failed.  The installation would start, and when it would reach the first interactive screen (language selection) the keyboard and mouse would be dead, (not even NumLock would work on the keyboard,) even though both keyboard and mouse work fine on the BIOS screens of the NUC.  On other occasions I managed to overcome this problem, (I don remember how,) and the installation would proceed to 99%, only to fail in the end with some error about not being able to update my computer's boot configuration or something.

Edit: be sure to read nucblog's comment below for a link to an article with instructions that might bring you more luck than I had.

In general, my overall experience of interacting with the BIOS of the NUC5CPYH was not pleasant at all.  The spiffy looking BIOS screens were not welcome by me, as they were not structured in the perfect logical order that I would expect of them, and certain parts of them were clunky.  Attempts to introduce an aesthetic upgrade which result in something technically more flawed than its ugly predecessor generally make a very bad impression, at least to me.

Perhaps the most annoying thing is that the initial screen with the prompts to press F2 to enter setup, F10 to enter the boot menu, etc. appears as if it requires not one, but two key-presses.  It probably requires only one, but there is an initial period of time during which if you press a key, that key is ignored, and that's extremely annoying.  Hey you, Intel BIOS programmers, I have a hint for you: if you are not ready to accept key-presses, do not display a prompt for them!

2015-04-30

On dogma in engineering

I once had a colleague who had a higher rank than me, and who was not only unconvinced by my rational and articulate arguments for doing a certain thing in a certain way, but he concluded the discussion by stating that --and I am not paraphrasing here, this is what he actually said-- the way he wanted it done was mentioned in a book, so unless I could find a book backing up my proposal, it was to be done his way.

I did not argue with him at that time, (how can you argue with that?), but I would now like to quickly jot down my thoughts on why saying such a thing is incredibly stupid:

Wow, 5 upvotes, 10 downvotes and counting

I have this answer on programmers.stackexchange.com which, at the time of writing these words, has 5 upvotes and 10 downvotes, and in all likelihood it will continue collecting downvotes, while I adamantly refuse to remove it, standing 100% by my ideas. I am dumbfounded, as such a thing has never happened before.

Here is the programmers.stackexchange.com question:

Is it okay to have objects that cast themselves, even if it pollutes the API of their subclasses?


I have a base class, Base. It has two subclasses, Sub1 and Sub2. Each subclass has some additional methods. For example, Sub1 has Sandwich makeASandwich(Ingredients... ingredients), and Sub2 has boolean contactAliens(Frequency onFrequency).

Since these methods take different parameters and do entirely different things, they're completely incompatible, and I can't just use polymorphism to solve this problem.

Base provides most of the functionality, and I have a large collection of Base objects. However, all Base objects are either a Sub1 or a Sub2, and sometimes I need to know which they are.

It seems like a bad idea to do the following:

for (Base base : bases) {
    if (base instanceof Sub1) {
        ((Sub1) base).makeASandwich(getRandomIngredients());
        // ... etc.
    } else { // must be Sub2
        ((Sub2) base).contactAliens(getFrequency());
        // ... etc.
    }
}

So I came up with a strategy to avoid this without casting. Base now has these methods:

boolean isSub1();
Sub1 asSub1();
Sub2 asSub2();

And of course, Sub1 implements these methods as

boolean isSub1() { return true; }
Sub1 asSub1();   { return this; }
Sub2 asSub2();   { throw new IllegalStateException(); }

And Sub2 implements them in the opposite way.

Unfortunately, now Sub1 and Sub2 have these methods in their own API. So I can do this, for example, on Sub1.

/** no need to use this if object is known to be Sub1 */
@Deprecated
boolean isSub1() { return true; }

/** no need to use this if object is known to be Sub1 */
@Deprecated
Sub1 asSub1();   { return this; }

/** no need to use this if object is known to be Sub1 */
@Deprecated
Sub2 asSub2();   { throw new IllegalStateException(); }

This way, if the object is known to be only a Base, these methods are un-deprecated, and can be used to "cast" itself to a different type so I can invoke the subclass's methods on it. This seems elegant to me in a way, but on the other hand, I'm kind of abusing Deprecated annotations as a way to "remove" methods from a class.

Since a Sub1 instance really is a Base, it does make sense to use inheritance rather than encapsulation. Is what I'm doing good? Is there a better way to solve this problem?

Tags: java, inheritance, type-casting
asked by codebreaker


2015-03-20

Mandatory disposal vs. the "Dispose-disposing" abomination

This article started as a stackoverflow answer, and then I copied it over here to expand on it.

For a discussion of the same issue but in java-oriented terms, see this stackoverflow answer of mine: Is overriding Object.finalize() really bad? http://programmers.stackexchange.com/a/288724/41811

There is this practice which is unfortunately very prevalent in the C# world, of implementing object disposal using the ugly, clunky, inelegant, ill-conceived, and error prone idiom known as IDisposable-disposing. MSDN describes it in length, and lots of people swear by it, follow it religiously, write walls of text discussing precisely how it should be done and precisely how it works, and precisely how they arrived at this particular way of doing it, etc.

(Please note that what I am calling ugly here is not the object disposal pattern itself; what I am calling ugly is the particular idiom of implementing an extra Dispose method with a bool disposing parameter.)

This idiom was invented under the assumption that the invocation of IDisposable.Dispose() is something optional, or in any case something which might be OK to forget, in combination with the fact that it is impossible to guarantee that our objects' destructor will always be invoked by the garbage collector to clean up resources.  So, people tend to make their best effort to invoke their IDisposable.Dispose() methods, and in case they forget, they also give it one more try from within the destructor. You know, just in case.

2015-03-13

Solid State For The Win!

These two screen captures are from CrystalDiskMark measuring the performance of my brand new Samsung 850 PRO 256GB Solid State Drive (C:) versus the performance of my old Seagate Barracuda 1TB 7200 RPM 32MB Cache Hard Disk Drive (D:).  Higher numbers are better.


Both devices are capable of SATA III, but my machine only has SATA II.  Under SATA III I would expect the HDD to perform somewhat faster, but the SSD to perform a lot faster.  I will update this post when I upgrade to SATA III.

SSD, where had you been all my life?

2015-03-03

Minimal MySQL Memory Footprint

The following image shows the mind-boggling amount of memory occupied by MySQL 5.6 server on Windows 7 64-bit.


(This is despite the fact that during installation I explicitly specified that this MySQL server is going to be used for development, not for production.)

A quick search on the web shows that this preposterous amount of memory can be reduced to something less preposterous by editing my.ini (usually found in some place like ProgramData\MySQL\MySQL Server 5.6\) and replacing the following line:
table_definition_cache=1400

with this line:
table_definition_cache=400
Unfortunately, even though the savings are huge, the memory footprint of mysql is still nothing short of gargantuan: