Sunday, April 17, 2016

Zipf distribution using .NET / C#

Zipfian distribution, named after American linguist George Zipf, is often used to demonstrate the Pareto principle that states 80% of the effects come from 20% of the causes.

Attached is a small C# class library that demonstrates this principle (Visual Studio 2015, C# 4.6.1).  The class library allows you to provide an IEnumerable collection that will be examined for the 80% / 20% principle.

The class library is easy to use and two (2) examples are provided along with the source code.

Examples:

1) ConsoleWordCount - Reads all words from the book, War and Peace, and reports on the 80% / 20% principle.  This is modeled after a single set of text where each datum (i.e. word) is a single occurrence to be examined.

2) ConsoleStatePopulation - Reads individual records comprised of both a state name and a population, and reports on the 80% / 20% principle.  This demonstrates how specific records (i.e. objects comprised of multiple properties) can also be used by the Zipf class library.

Download source and example code now!

Also, there is a nice video by vsauce on Zipf on youtube.

Enjoy!

Can't RDP? How to enable / disable virtual machine firewall for Azure VM

Oh no!  I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore.  I did ...