Author Archives

Archive of the posts written by author : afish.

Machine Learning Part 1 — Linear regression in MXNet

In this series I assume you do know basics of machine learning. I will provide some source code for different use cases but no extensive explanation. Let’s go. Today we will take a look at linear regression in MXNet. We will predict sepal…

.NET Inside Out Part 9 — Generating Func from a bunch of bytes in C# revisited

This is the ninth 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# We know how to generate delegate from a byte…

Async Wandering Part 5 — Catching exceptions from async void

This is the fifth part of the Async Wandering series. For your convenience you can find other parts in the table of contents in Part 1 – Why creating Form from WinForms in unit tests breaks async? Last time we saw how to…

Custom memory allocation in C# Part 11 — Benchmarking UnsafeList

This is the eleventh 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 I presented some results suggesting that UnsafeList is faster than…

Custom memory allocation in C# Part 10 — Hijacking new in .NET Core

This is the tenth 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 I had .NET Core 2.1.103 x64 installed and I wanted…

Custom memory allocation in C# Part 9 — Hijacking new in x64

This is the ninth 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 hijacked new in C#. Last time we did…

Exception propagation in WinForms

Let’s start with the following code: using System; using System.Windows.Forms; class Program1 { [STAThread] static void Main() { var form = new Form(); form.Load += (sender, e) => throw new Exception(); try { Application.Run(form); } catch(Exception e) { MessageBox.Show(“This doesn’t execute”); } finally…

Random notes from crashing and hanging EMR Spark job

It sometimes happens that your EMR job crashes or hangs indefinitely with no meaningful log. You can try to capture memory dump but it is not very useful when your cluster machines have hundreds gigabytes of memory each. Below are “fixes” which worked…

Investigating AWS SDK conflicts in EMR

When you deploy your package to Amazon Elastic Map Reduce (EMR), you can access the AWS SDK provided by the platform. This gets tricky if you compile your code against different version of SDK because then you may get very cryptic bugs in…

Trivial ScheduledThreadPoolExecutor in C#

Today we are going to implement trivial ScheduledExecutorService in C#. Introduction We want to have a thread pool of fixed size which we can use to execute three types of tasks: One time tasks Tasks with fixed delay between executions Tasks with fixed…

Windows Research Kernel Part 4 — New module

This is the fourth part of the WRK series. For your convenience you can find other parts in the table of contents in Part 1 — Compiling and debugging To create a new module, you need to prepare some directories and a make…

Windows Research Kernel Part 3 — Syscall

This is the third part of the WRK series. For your convenience you can find other parts in the table of contents in Part 1 — Compiling and debugging Today we are going to write a very simple hello world in the kernel…

Windows Research Kernel Part 2 — Monitoring the function invocation

This is the second part of the WRK series. For your convenience you can find other parts in the table of contents in Part 1 — Compiling and debugging In this part we are going to monitor the invocation of QuerySystemInformation system function…

Windows Research Kernel Part 1 — Compiling and debugging

This is the first part of the WRK series. For your convenience you can find other parts using the links below (or by guessing the address): Part 1 – Compiling and debugging Part 2 – Monitoring and function invocation Part 3 — Syscall…

Dynamically loading JAR file in Zeppelin

Imagine that you need to load JAR file dynamically in Zeppelin working on your EMR cluster. One easy way is to deploy the file to the instance and load it from there, however, what can you do if you have almost no access…

Generating class in Zeppelin

If you want to declare a class in Zeppelin and create instance of it, you might be surprised: class K defined class K classOf[K].newInstance() java.lang.InstantiationException: K at java.lang.Class.newInstance(Class.java:427) … 52 elided Caused by: java.lang.NoSuchMethodException: K.() at java.lang.Class.getConstructor0(Class.java:3082) at java.lang.Class.newInstance(Class.java:412) … 52 more What…

ILP Part 50 — MST, vertex cover and edge cover

This is the fiftieth 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 solve three graph problems: vinimum spanning tree, vertex cover and…

Custom memory allocation in C# Part 8 — Unsafe list in .NET Core x64

This is the eighth 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 Today we are going to revisit an Unsafe list example…

Reordered code after compilation

Can one line of code in C# JIT compile into two different blocks of code in the same program? This sounds a little tricky but in fact is very easy and happens pretty often. Consider the following code: using System; namespace Reordering {…

Custom memory allocation in C# Part 7 — Stack allocation once again

This is the seventh 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 know how to allocate object on a stack, however,…