More Than Nothing

“You mean you can't take less; it's very easy to take more than nothing.”

Archive for the ‘Programming’ Category

FizzBuzz Golf

Posted on September 10, 2011 by [ICR] under C#, golf, Programming

Someone linked to http://golf.shinh.org/p.rb?FizzBuzz today and I couldn’t help but have a go. Currently I’m ranked 20 in the C# solutions, but I just can’t seem to shave off those last few characters. [The following code is obviously unminified] class X { static void Main() { for (int i=0; i 0 ? null : “Buzz”; [...]

No Comments | Read the rest of this entry »

Tabs vs. whitespace

Posted on January 11, 2011 by [ICR] under Programming

I was so very tempted to post a response to this question on tabs vs. spaces on SO today. (I did actually write one, but deleted it and voted to close for being too subjective) I thought it would be better to post my response here instead. The question is which is better for formatting [...]

No Comments | Read the rest of this entry »

cmd-notify: Push notifications for long tasks

Posted on July 27, 2010 by [ICR] under Programming, Python

I just started a new job, and as part of the induction we had to do a lot of complete builds, both for an application server and for a pretty substantial database. Needless to say, these took quite a long time. I found myself wishing there was a way for the computer to notify me [...]

1 Comment | Read the rest of this entry »

Value Types vs. Reference Types vs. Passing by Value vs. Passing by Reference

Posted on May 26, 2010 by [ICR] under Programming

I’ve seen a lot of people getting confused about value/reference types, and passing by value/reference, so I thought I’d write a post to explain it. These are two different phenomena with confusingly similar names. Value/reference types are to do with how values are copied when assigning from one variable to another. Passing by value/reference is [...]

No Comments | Read the rest of this entry »

Languages May Be Turing Complete – Execution Rarely Is

Posted on January 29, 2010 by [ICR] under Programming, Turing Complete

Just because a language is Turing Complete, it doesn’t necessarily mean that the execution is. This is because, while languages rarely bother about details like the size of memory, a particular implementation and execution environment place restrictions on things like the amount of memory available. Take, for example, the problem of adding natural numbers in [...]

No Comments | Read the rest of this entry »

Introduction to the mini-series on Turing Completeness

Posted on January 27, 2010 by [ICR] under Programming, Turing Complete

I meant to write this post sometime last year, in response to some things said by some colleagues on my course but never got around to it. It turns out that they still don’t seem to full understand, so I guess I’ll write it now I decided to split it up a bit, so without [...]

1 Comment | Read the rest of this entry »

Placeholder Text in HTML5 – A js fallback

Posted on January 19, 2010 by [ICR] under Javascript, Programming

A while back I wrote a post including some Javascript to add what I called “hints” to fields in HTML. Since then, HTML5 has added the same thing, under the name “placeholder text”. All you have to do is add “placeholder=’Some Text’” and ‘Some Text’ will appear as a placeholder, disappearing when you focus the [...]

8 Comments | Read the rest of this entry »

Optimising isn’t a sin – but do it effectively

Posted on January 17, 2010 by [ICR] under Programming

We all know we shouldn’t optimise prematurely our code or try and guess where code needs optimising. Optimisations should only be done as the result of consideration of performance measurements. But sometimes we can go too far the other way – rarely optimising and instead living with inefficient algorithms and code. If your algorithm iterates [...]

No Comments | Read the rest of this entry »

Mono 2.6

Posted on December 16, 2009 by [ICR] under .NET, C#, Programming

Mono 2.6 has just been released and can be downloaded from their website. I’ve been using Mono for several months now on my MacBook, and it’s been surprisingly useful. Not only is it an implementation of the C# compiler, .NET runtime and Base Class Libraries, they also have a collection of their own utility libraries. [...]

1 Comment | Read the rest of this entry »

Random Subsets

Posted on December 8, 2009 by [ICR] under C#, Programming, Uncategorized

I was reading about permutation algorithms to try and solve a completely unrelated problem when I came across this. It’s an algorithm to generate a random subset of size s from n elements. I’ve needed something like this in the past, and so no doubt I’ll need something like it again in the future. private [...]

No Comments | Read the rest of this entry »