-
Greetings! I am Torleif Berger, 24 years old, a Seventh-Day Adventist and currently working as a software developer. Otherwise, not much to tell. Although I do juggle a bit...
-
Async Best practices Big Int Blogging Books C# Collatz conjecture Command line Embedded Resources Events Factorization Fibonacci Genders Hashing Java Latex Mac Math Media Men MySql Nerd Null NUnit Palindromes Plugins Primes Pythagorean triplets Python Sieve of Atkin Sieve of Eratosthenes Snippet Sorting Sql Subversion TDD Threading Tools Triangle Numbers Tutorial Unit-Testing Unix WinForms WordPress YouTube
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Tag Archives: C#
How to test asynchronous events
The other day I had to test that an event was raised after some asynchronous work had been done. And since I currently am a total test newbie, this was a new thing for me. Say we have this simple shell of a class:
public class Worker
{
public event EventHandler<eventargs> Done;
public void Start()
[...]
Generics and checking for null
When writing C#, in Visual Studio, using generics… have you ever tried checking for null? I have always found that a bit of a hassle.
Say we have this method which returns the subject if it is not null, and the result of a createNew() function if it is null.
public static T NewIfNull<t>(this T subject, [...]
Project Euler: Problem 25
The Fibonacci sequence is defined by the recurrence relation:
, where and .
Hence the first 12 terms will be:
…
The 12th term, , is the first term to contain three digits.
What is the first term in the Fibonacci sequence to contain 1000 digits?
Project Euler: Problem 16
and the sum of its digits is.
What is the sum of the digits of the number ?
The Art of Unit Testing
Have you gone through three years of computer science bachelor degree fun (or anything similar) and pretty much not heard a word about testing? Or have you heard from all your teachers that testing is extremely important, but never learned how to even write one? That has been the case for me. Testing is important, [...]
The Sieve of Atkin in C#
I have previously written about the Sieve of Eratosthenes, which is an algorithm for finding primes. This algorithm worked very well for most of the prime related Euler Problems. However, for one of them it just didn’t do it. Well, it did it, but it did it kind of slow. The problem was to calculate [...]


















How to check for duplicates