Multilayer Perceptron

Download Example XORMultilayerPerceptron C# project

Multilayer Perceptron - Creation

Multilayer perceptron is a feed forward neural network that is trained through supervised learning and is used in classification of inputs into appropriate outputs. Multilayer perceptron is best thought of as a network of perceptrons separated into layers with each perceptron connected to all perceptrons in both neighboring layers. Perceptrons in the network, with the exception of input layer, use nonlinear activation function so that the multilayer perceptron can be used to solve problems where data is not linearly separable – for example XOR problem in provided sample code.

Read more

Multiclass Perceptron in C#

Download Multiclass Perceptron C# Project

In order to understand multiclass perceptron prior knowledge of binary perceptron is required.

Multiclass Perceptron is used for classifying input data into linearly separable classes. Each class in a multiclass perceptron has a separate set of input weights. Just like in a simple perceptron the inputs are multiplied by weights and then summed, but instead of score passing through an activation function the class with the highest score is chosen.


Multiclass Perceptron

Read more

WPF Window Size, Position, and Style Persistence

Download the WindowPersistance Source Code

The following article shows a simple way to create window and control persistence in WPF.

For this example user should have already made a WPF window application. Next step is to add settings to the application properties.


Note that WindowSplitter property is optional as it sets the grid splitter position and is application specific for the current example.
Read more

Turn Off Monitor Power in Windows Using DDC/CI (C++)

Download Project Source for MSVC2013
Download Demo Executable

The simplest way in Windows to turn the monitor off is to call SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)2);. Unfortunately this call causes the monitor to gradually fade out and since I needed the monitor to turn off immediately I had to find an alternative way.

In order to power the monitor off immediately I ended up using low level monitor configuration functions that provide access to Display Data Channel Command Interface (DDC/CI). To familiarize yourself with these functions please read Using the Low-Level Monitor Configuration Functions.

NOTE: Not all monitors support the DDC/CI power manipulation

I have created Monitors class that powers off/on all the connected monitors. Below is the sample usage:

Read more

Thread Safe Simple Logger in C++11

This logger is an exercise in C++11 thread safety and a demonstration of Return Value Optimization (RVO)/Copy elision. Even though RVO behavior is not directly prescribed by the standard, most new compilers avoid unnecessary copies and destructor calls.

This code was tested on MSVC 2013 and on MinGW GCC 4.8.1 x64. Since RVO varies between different compilers and may be affected by compiler optimization flags, the code in this post is not guaranteed to work on all systems in its current state.

My ideal logger for small scale C++ projects should have a very simple usage as demonstrated below.

Read more

Adding a parameter to a WPF control style

In this post I will demonstrate how to add a new parameter to a WPF control style without overriding the control parent class.

In particular I have created a custom button style that relies on the CornerRadius parameter to round any of the four corners of the button. Using this button style I have created a sample keypad shown below:

Read more

Thread Safe Event Dispatching in WPF

Recently I have been using a quite a bit of C# WPF on the projects I am developing because it provides for very flexible and quick user interface design and implementation. The learning curve for a traditional (C/C++) software developer may be steep, but once the basics are understood it is pretty easy to use as a development tool.

Since I develop applications that use external hardware (ex. Camera) I have to place some of the logic in threads in order not to block the user interface while an action is performed. After the action completes I need to pass the message back to the user interface. Unfortunately WPF user interface breaks if a user interface event is instantiated from a thread. Because of this I have created a class extender for EventHandler that makes thread instantiated events possible.

Read more

Zipping/Unzipping files in C++

There seems to be very little in the way of simple zip/unzip class for C++. I have always liked the simplicity of Java implementation of ZipOutputStream/ZipInputStream and have made an implementation that is somewhat similar.

The sample project was made using Visual Studio 2010 and zlib-1.2.7. If you are using a different version of a compiler, you may need to recompile the zlib for your specific environment and use the newly compiled lib/dll in with the example project provided. You can find zlib at

Read more