Hey, this is my blog

It is somewhat abandoned.

Project Euler 8 in C#

Discover the largest product of five consecutive digits in the 1000-digit number.

http://projecteuler.net/index.php?section=problems&id=8

Read more...

Introducing Attribute Based Caching

“There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors.”

I am a big fan of postsharp and its creator Gael.  There are a number of examples floating around of doing caching with postsharp.  However, none handled cache invalidation in a nice declarative way.  

Read more...

Project Euler 3 in c#

Problem 3: What is the largest prime factor of the number 600851475143 ?

http://projecteuler.net/index.php?section=problems&id=3

With enough extension methods we can make 3 really simple:

600851475143.LargestPrimeFactor()

Where:

Read more...

Naked Objects MVC - exposing a repository method as a get

If you would like to expose the results of an entity framework call as the index page or any other get based url using naked object mvc, a custom controller is required.

Read more...

Project Euler #9

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

Read more...

Project Euler #5

Here is my solution to the following project Euler Problem:

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

Read more...

Project Euler #6

Ok, this one is stupidly simple:

var squaredsum = Math.Pow(1.To(100).Sum(), 2);
var sumedsquare = 1.To(100).Select(x => x * x).Sum();
Console.WriteLine(squaredsum - sumedsquare);

Tags