Polynomial Fitting in C++ using Boost

A while back I needed to implement an algorithm utilizing an equivalent function of polyfit/polyval in LabView. The original algorithm was created in LabView for research purposes and since we were in the process of creating a commercial version of the device, the algorithm implementation in C++ needed to mirror the LabView implementation. I found that there is no simple and neat implementation of polyfit() polyval() in C++ so through a bit of digging, research, and implementation I came up with my own functions.

Polynomial fitting function returns coefficients of a polynomial representing a given data. MathWorks has a decent explanation of the function. Below is a graph showing 1000 randomly varying points and the polynomial curve in red generated from the given points.
PolyFit
Read more

PictureBox Control Zoom

Recently I needed to implement zooming functionality using the mouse wheel in PictureBox control in C#.

My initial reflex was to reuse existing free code, but I kept on running into controls that were either too bulky or badly implemented. In the end I implemented a relatively simple class which can be used with the standard C# PictureBox.

One of the nicer functionalities of this implementation is that the point being scrolled under the cursor will stay in place during zooming in/out.

The heart of this class is the following function:

Read more

Manipulating CSV Spreadsheet Data – Java

Often times where I have been required to deal with the data stored in a humanly readable format. I have found that the easiest and the most portable way to deal with this data is via CSV files. This way the data can be reviewed or generated using OpenOffice Calc or Excel.

The code I am posting here does not deal with all eventualities of CSV but is a solid base to include into your own projects and expand as you see fit. As a side note I have posted this code on one of my favourite coding sites full of nerdy goodness http://rosettacode.org.
Read more

Manipulating CSV Spreadsheet Data – C#

Often times where I have been required to deal with the data stored in a humanly readable format. I have found that the easiest and the most portable way to deal with this data is via CSV files. This way the data can be reviewed or generated using OpenOffice Calc or Excel.

The code I am posting here does not deal with all eventualities of CSV but is a solid base to include into your own projects and expand as you see fit. As a side note I have posted this code on one of my favourite coding sites full of nerdy goodness http://rosettacode.org.
Read more

Manipulating CSV Spreadsheet Data – C++

Often times where I have been required to deal with the data stored in a humanly readable format. I have found that the easiest and the most portable way to deal with this data is via CSV files. This way the data can be reviewed or generated using OpenOffice Calc or Excel.

The code I am posting here does not deal with all eventualities of CSV but is a solid base to include into your own projects and expand as you see fit. As a side note I have posted this code on one of my favourite coding sites full of nerdy goodness http://rosettacode.org.
Read more