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.

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!

Miserable excuse for a User Interface

Simple test:

If you double click something in the user interface, the interface redraws and rearranges controls at the exact same moment causing your double click to end up on something else, then you know you’re dealing with a miserable excuse for a user interface… (Apple? Microsoft? If you’re interested… No? Why am I not surprised?)

My first (and last?) attempt at security programming

My first, and probably last, attempt at security programming was back in the 80ies, on a Spectravideo. I remember spending some hours on the program, and I had an if-clause to check for a password, and if the password was wrong, obviously the program needed to be protected… so I deleted it from memory…

Some BASIC along the line of:

1820 IF password <> "******" THEN NEW

…of course, after some hours of programming I’d forgotten the password… and forgotten that I didn’t knew it so I typed in the wrong one and off my program went…

…did I save it to cassette before I tested it. Nope. Did I learn the cassette equivalent of the “ctrl-s”-reflex. Yup!

Does this in any way resemble modern security programming? In my experience? It is as if nothing has happened since the 80ies. In fact, I’m fairly certain there are systems out there that will format c: if you fail to type in the right password too many times.

Or like moron Azure DevOps. What happens if you try to view a page you don’t have access to? Yup, you get a 404 error (as in page does not exist, not a 403=you don’t have access). They’re even helpful enough to tell you so. You know, so no one will know that the page do in fact exist. If they don’t have access. How many people spend how many hours bug hunting that one? Do we bill Microsoft? Ah, no, they’re billing us, right…

format azuredevops:

It seems that if it’s about security and doing the wrong thing makes something explode and burn, some security manager somewhere will have mental, or not so mental, orgasms… But I guess usable security systems will be hacked because the users will be too comfortable using them… right…?

Header image by MKFI – Own work, Public Domain, Link

A Go Fuck yourself User Fucker Function

“…and the customer support section has a… quote-unquote user contact function… or as we like to call it in the business: a go fuck yourself user fucker function. Needless to say, you will not be disturbed by your customers…”
“Good, we have neither the time nor the personnel for that shit! They should just buy the products and be happy… and have no problems!”