.NET Inside Out Part 11 — Using structs for devirtualization

This is the eleventh part of the .NET Inside Out series. For your convenience you can find other parts in the table of contents in Part 1 – Virtual and non-virtual calls in C# Last time we saw how type markers can result…

Custom memory allocation in C# Part 13 — In-place serialization

This is the thirteenth part of the Custom memory allocation series. For your convenience you can find other parts in the table of contents in Part 1 — Allocating object on a stack Recently Jean-Bernard Pellerin showed nice tricks for binary serialization in…

ILP Part 56 – Factorization benchmarking

This is the fifty sixth part of the ILP series. For your convenience you can find other parts in the table of contents in Part 1 – Boolean algebra Today we are going to benchmark factorization. First, let’s start with the code:

.NET Inside Out Part 10 — Using type markers for low level optimizations

This is the tenth part of the .NET Inside Out series. For your convenience you can find other parts in the table of contents in Part 1 – Virtual and non-virtual calls in C# If you are interested in the topic see the…

Decreasing pain of stolen focus

One of the most irritating thing in Windows is no way to prevent an application from stealing focus. There are multiple questions on Stack Overflow regarding the issue, there are rumors that Microsoft wanted to do something but they cannot detect it reliably.…

Comparing numbers is hard

We know that to compare floating point values we should use epsilon and not just compare bits. We may run into similar issues when comparing BigDecimal in Java:

What is the output? Of course it is false, otherwise I wouldn’t write this…

Custom memory allocation in C# Part 12 — Hiding objects from GC

This is the twelfth part of the Custom memory allocation series. For your convenience you can find other parts in the table of contents in Part 1 — Allocating object on a stack We already know how to allocate memory anywhere on the…

Modifying Android application on a binary level

Recently I had to modify an existing Android application for which I didn’t have a source code, only APK file. This may sound like an impossible task but actually it is pretty easy (very tedious, though). I didn’t want to use any compilers…

Machine Learning Part 8 — Backpropagation in neural net in SQL

This is the eighth part of the ML series. For your convenience you can find other parts in the table of contents in Part 1 – Linear regression in MXNet Last time we saw forward propagation in neural net. Today we are going…

Machine Learning Part 7 — Forward propagation in neural net in SQL

This is the seventh part of the ML series. For your convenience you can find other parts in the table of contents in Part 1 – Linear regression in MXNet Today we are going to create a neural net and calculate forward propagation…

Windowing functions in recursive CTE

Today we will see an interesting case of incompatibility between MS SQL Server 2017 and PostgreSQL 9.6 (and different versions as well). Let’s start with this code:

We emulate a recursive CTE. We have two columns in source dataset, we want to…

Running On Screen Keyboard in Windows 10 in C#

Today something supposedly very simple. How to run On Screen Keyboard from C#? Easy enough you say and type the following code:

And then you compile it as Any CPU, run on Windows 10 x64 and you get the following error: What…

Machine Learning Part 6 — Matrix multiplication in SQL

This is the sixth part of the ML series. For your convenience you can find other parts in the table of contents in Part 1 – Linear regression in MXNet Today we are going to implement a matrix multiplication in Redshift. Let’s go.…

Spark and NegativeArraySizeException

Recently I was debugging the following crash in Spark:

Disabling Kryo solves the issue. To do that just set spark.serializer to org.apache.spark.serializer.JavaSerializer. Other workaround is to change Kryo’s reference management, as explained on Github:

Spark and NullPointerException in UTF8String.contains

Recently I was debugging a NullPointerException in Spark. The stacktrace was indicating this:

After some digging I found out that the following query causes the problem:

If I commented out the line with the comment the NPE was no longer there.…

Playing With args4j Part 5 — Safe setters

This is the fifth part of the Playing With args4j series. For your convenience you can find other parts in the table of contents in Part 1 – Mixins There is one more problem with our setters — they are not type safe.…

Playing With args4j Part 4 — Nicer setters

This is the fourth part of the Playing With args4j series. For your convenience you can find other parts in the table of contents in Part 1 – Mixins Last time we ended with the setter of a form

. What we don’t…

Playing With args4j Part 3 — Nice setters

This is the third part of the Playing With args4j series. For your convenience you can find other parts in the table of contents in Part 1 – Mixins Let’s see how we can implement the setters. Idea is as following: we will…

Playing With args4j Part 2 — Automatic getters

This is the second part of the Playing With args4j series. For your convenience you can find other parts in the table of contents in Part 1 – Mixins Last time we created mixins to be able to compose classes with multiple inherited…

Playing With args4j Part 1 — Mixins

This is the first part of the Playing With args4j series. For your convenience you can find other parts using the links below (or by guessing the address): Part 1 — Mixins Part 2 — Automatic getters Part 3 — Nice setters Part…