Monthly Archives: May 2013

How to Calculate Annual Percentage Rates (APR)

I have had many requests for a Visual Studio solution project with the APR code and unit tests in. I have open sourced the code and put it onto Codeplex to make it easy for you to access.

In this article I want to discuss Annual Percentage Rates (APR) and how you calculate them including some sample code. APR is a term you will see on several different lending products including loans, overdrafts, credit cards and mortgages. It is a legal requirement to show the APR on products where you borrow money, (certainly in the UK). The APR is meant to make it easier to make fairer comparisons of different products. To make things even more confusing there are 2 types of APR, Personal APR and Typical APR.

How to calculate Annual Percentage Rate (APR)

How to calculate Annual Percentage Rate (APR)

The APR is essentially how much your borrowing will cost over the period of an average year, over the term of your debt. It takes into account interest charged as well as any additional fees (such as arrangement fees, or annual fees) you’ll have to pay. It also considers the frequency with which interest is charged on your borrowing, as this as an impact on how much you will pay as well.

Continue reading

Training for Software Developers

In this article I want to discuss different types of training for software developers. Most of what I say here is purely subjective and forms my own view of the best types of training, but I would like to hear what you think on this, including the training resources that work for you..

There are different types of training that as a software developer you can make use of. They are Classroom / Teacher led courses, Online video training, Books (both electronic and dead tree), and writing lots of code and good old experimentation.

Classroom / Instructor Led Courses

Class Room  and Instructor Led Training

Class Room and Instructor Led Training

I have always had a problem with technical courses where you have to learn in a group. I personally don’t find it an effective way to learn a technology. Don’t get me wrong, non-technical courses like leadership training, personal skills etc work very well as an instructor led course as these are all about working with people, but for technical courses I don’t find them very good. Also they are very expensive, you can end up paying thousands of pounds for a 5 day course and that doesn’t even include travel and expenses.

I do think conferences are a good thing though. I have been to a number of these before including Microsoft’s TechED and find these very valuable as you get to see what new technologies are coming along and mix/socialise with other engineers from different companies and industries.

I am sure people will disagree with me on this and prefer instructor led courses to online videos and books, and that is fine as everyone has different learning styles. Personally I find learning a new technology a solitary thing. I just like to sit down by myself, watch some videos, read some articles and then just fire up the compiler and dig in.

Continue reading

Cryptography in .NET : Hybrid Encryption Protocols

This is the 4th and final article in a series on cryptography with .NET. So far in this series we have looked at some of the built in cryptographic primitives build into .NET including, Symmetric Encryption with AES, Asymmetric encryption using RSA, Cryptographic random number generation and hashing.

Cryptography in .NET : Hybrid Encryption Protocols

Cryptography in .NET : Hybrid Encryption Protocols

What I want to do in this final part is talk about using these different cryptographic primitives to do what is called Hybrid Encryption.

What is Hybrid Encryption?

So, what is hybrid encryption? Let’s start off with Wikipedia’s definition.

In cryptography, public-key cryptosystems are convenient in that they do not require the sender and receiver to share a common secret in order to communicate securely (among other useful properties). However, they often rely on complicated mathematical computations and are thus generally much more inefficient than comparable symmetric-key cryptosystems. In many applications, the high cost of encrypting long messages in a public-key cryptosystem can be prohibitive. A hybrid cryptosystem is one which combines the convenience of a public-key cryptosystem with the efficiency of a symmetric-key cryptosystem.

A hybrid cryptosystem can be constructed using any two separate cryptosystems:

  • a key encapsulation scheme, which is a public-key cryptosystem, and
  • a data encapsulation scheme, which is a symmetric-key cryptosystem.

The hybrid cryptosystem is itself a public-key system, who’s public and private keys are the same as in the key encapsulation scheme.

Note that for very long messages the bulk of the work in encryption/decryption is done by the more efficient symmetric-key scheme, while the inefficient public-key scheme is used only to encrypt/decrypt a short key value.

Continue reading

Training : Windows Phone 7 and 8 Development

In this article I thought I would post links to some free training resources for Windows Phone 8 Development. I have started playing around with Windows Phone 8 Development so I thought these resources would be useful for other people too.

I will keep adding to this page as I find other useful, free, resources. If you have any videos or articles that you feel would be useful here then please let me know in the comments and I will add them to the post. I would like it to be an archive of good material.

Developing Applications for Windows 8

Developing Applications for Windows Phone 8 : Charles Sturt University

Developing Applications for Windows Phone 8 : Charles Sturt University

Developing Applications for Windows Phone 8 (Short Course) – Week 1

Developing Applications for Windows Phone 8 (Short Course) – Week 2

Developing Applications for Windows Phone 8 (Short Course) – Week 3

Developing Applications for Windows Phone 8 (Short Course) – Week 4

Continue reading

Cryptography in .NET : Random Numbers and Hashes

This is the 3rd part in a short series on cryptography in .NET. In the previous 2 articles I covered using Symmetric algorithms like AES and Asymmetric algorithms like RSA. In this section I want to cover random number generation and hashing. This will lead into the final article which will be about combining cryptographic primitives to create hybrid encryption protocols.

Cryptography in .NET : Random Numbers

Cryptography in .NET : Random Numbers

The primitive I want to discuss is generating cryptographically strong random numbers. This is useful if you want to generate random session keys for AES for example. To generate a random number you use the RNGCryptoServiceProvider class in .NET. Once you have constructed the object you just call GetBytes() and pass in the length in bytes of the random number you want to generate.

Continue reading