Category Archives: Computers and Internet

Posts on computer science and the web, rants about OS:es, Window Managers, Platforms for almost publishing content on the web, and the like.

When pressing enter, move the selection… upwards?!

At first, I thought this was a sign of a Microsoft programmer with too much time on their hands, but then I realized that of course, in Australia, where they are upside down, they need the selection to move upwards when pressing enter!

And left/right is for places where everything is politicized… “No communist/fascist selections in my home!”

Pointless Arithmetic or Incompetent Communicator?

@SuppressWarnings("PointlessArithmeticExpression")

You don’t say? Well, let me counter that with an…

@SuppressFeature("IncompetentCommunicatorErrors")

Let me explain. I’m creating a unit test where I need to do some calculations in order to create an expected value (i.e. do the same computation as the function I’m testing but differently… or usually more manually…)

So this is my test (high lighted was marked as “pointless”):

final MinMaxAverage mma = new MinMaxAverage();
		
mma.add(1d, 1d);
mma.add(2d, 2d);
mma.add(4d, 4d);
		
final double min = mma.min();
final double max = mma.max();
final double sum = mma.sum();
final double average = mma.average();
final int count = mma.count();
		
assertEquals(1d, min);
assertEquals(4d, max);
assertEquals(1d*1d + 2d*2d + 4d*4d, sum);
assertEquals((1d*1d + 2d*2d + 4d*4d) / (1d + 2d + 4d), average);
assertEquals(3, count);

Sure, this test could have used another weight, but I wanted to test with a weight of 1. And regardless… is this pointless arithmetic in a test? Or for that matter in a complex program that might actually benefit from more simple code?

Programming isn’t just coding and numbers… it’s also communicating with other programmers and yourself in a year. Some IDE simplifications aren’t necessarily simplifications at all. Sure, you can make the code look lean and nice, but you probably should think twice about that if it’s a fringe case, something you use very seldom, or in this case the attempt to make the inner workings of a function in a test more transparent.

Ah well, regardless… I fear I’m expecting the IDE to understand my thoughts and feelings… I guess our relationship is in choppy waters then? đŸ˜€

Giraffes don’t have fins

Why mankind is going to hell via internet:

A: This is a picture of a fish, it clearly have fins!
B: Giraffes don’t have fins!
A: It’s a picture of a fish!
B: What’s fishes got to do with anything?
A: They have fins.
B: Giraffes don’t.
A: We’re talking about fish.
B: Giraffes don’t have fins!
A: Right Giraffes don’t have fins.
B: See, I’m right…
A: Yes with regards to giraffes…
B: …fishes don’t have fins.
A: I give up.
B: I’m so cool! I’m so right! I’m so hot! I’m so bright! I’m so yeah oh yeah!