Windows Live Writer is an awesome tool that I use to write all of my blog posts. I am so used to it that I can’t imagine blogging without it, but I have also found ways to shoot myself in the foot with it. Here are two ways in which I managed to lose a […]
Continue reading about How to recover a lost post in Windows Live Writer
As promised at the end of my recent post, I am going to explain how to implement a program that prints itself, in addition to doing other things (like playing Game of Life). A self-printing program – also called a quine – is a program that prints out its own source code. I will describe […]
Conway’s Game of Life has fascinated computer scientists for decades. Even though its rules are ridiculously simple, Conway’s universe gives rise to a variety of gliders, spaceships, oscillators, glider guns, and other forms of “life”. Self-printing programs are similarly curious, and – rather surprisingly – have an important place in the theory of computation. What […]
Did you know that there are numbers that cannot be computed by any computer program? It is weird, but true. And by number, I mean just an ordinary real number. As a perhaps unnecessarily simple example, the result of the division 1/7 looks like this: 0.1428571428571428571428571428571414285714285714285714285714285714… We can easily implement a program that prints […]
SelectMany is a fascinating operator in LINQ to Objects. For one thing, it is not as intuitive as most other LINQ operators. MSDN says that SelectMany “projects each element of a sequence to an IEnumerable(T) and flattens the resulting sequences into one sequence.” I still remember reading this description of SelectMany for the first time, […]
I was discussing the little LINQ puzzle with Stephen Toub, and he brought up an idea which lead to another puzzle. I like this one even more than the previous one. Why does the last line throw StackOverflowException? IEnumerable<int> q = new int[] { 1, 2 }; q = from x in new int[] { […]
Why does the last line hang? IEnumerable<int> empty = Enumerable.Empty<int>(); for (int i = 0; i < 40; i++) { empty = empty.Concat(empty); } int[] emptyArray = empty.ToArray(); Answer in the comments section. For a slightly harder challenge, check out the next puzzle.
This article is the first one in a series titled Data structure zoo. Each article will give you a “working knowledge” of data structures that solve a particular problem. You won’t necessarily know how to implement each one, but you will have a good idea of the main characteristics of each solution and how to […]
Performance of parallel programs is an interesting – but also tricky – issue. I put together an article for our team blog that talks about the most common reasons why a parallel program may not scale as desired: Developers ask why one program shows a parallel speedup but another one does not, or how to […]
Continue reading about Most Common Performance Issues in Parallel Programs
Big-Oh notation is a simple and powerful way to express how running time of a particular algorithm depends on the size of the input. When you say that a particular algorithm runs in O(N2) time, you mean that the number of steps the algorithm takes is proportional to the input size squared. Or, in mathematical […]
Recent Comments