“It’s all fun and games until someone divides by zero.”
/Seen on a T-shirt on “CSI: Cyber”
Posts on computer science and the web, rants about OS:es, Window Managers, Platforms for almost publishing content on the web, and the like.
“It’s all fun and games until someone divides by zero.”
/Seen on a T-shirt on “CSI: Cyber”
I know dark mode is all the rage. A must-have for the trend-sensitive software developer. However, the reason to have dark mode is to save people’s eyes in dark rooms… not blast them to pieces.
Take a look at Microsoft Office’s dark mode fail in a dark room, I dare you:

Of course, dark mode done right will have its issues as well… Try to pick out the orange colored comment in Scrivener’s dark mode… if you can:

Yeah, no. Those aren’t the names of the colors 😀 and it’s easy to pick the right one when you have the others for contrast, but wait till you open a document with comments in one color… is it yellow, orange, red? Ummm…
But at least Scrivener won’t leave white spots dancing in front of your eyes for the rest of the evening… so that’s always something…
I for one have learned not to use Mac OS’s Mail app to send customer mail when in dark mode. Those CCed names are pretty much hidden and all of a sudden internal e-mails become external and you find yourself wishing you’d been better at keeping your promise to never say (or write) anything about someone you wouldn’t say to them.
This bug exists in all text editors I tried so far, with the exception of iWorks Pages… (they have their own set of issues anyway…)
To recreate the bug:
I’ve been kicked by this nasty thing so many times. I type something. ADHD kicks in and I change my mind half way through, starts deleting, changes my mind again and presses cmd-Z. And it undoes everything instead of just the deletes.
Word does this, Scrivner does this… every simple text editor does… apparently 99% of text editor users does the index finger waltz?
Consider the following singleton:
public enum MyVeryImportantSingleton {
INSTANCE;
private String a;
private String b;
public void set(String a, String b) {
this.a = Objects.requireNonNull(a);
this.b = Objects.requireNonNull(b);
}
}
If it would be called in the following manner:
try {
MyVeryImportantSingleton.INSTANCE
.set("Hello world", null);
}
catch (Throwable t) {
...all sorts of recovery operations
...leaving the system running
}
MyVeryImportantSingleton‘s a-field is set, but the b-field is left in its previous state. This, of course, could turn into really bad news.
The right way to implement set() would be:
public void set(String a, String b) {
Objects.requireNonNull(a);
Objects.requireNonNull(b);
this.a = a;
this.b = b;
}
This is also a great praxis for all form of input error checking. It should first be finished, and then the object state can be updated once all input is ok.
You never know when your method will be called from inside a catch-block by a programmer that, incorrectly assumes the object state is okay even if an exception was thrown.
In the choice between closed source and open source, my choice will always be working source…
Java(Script) Gripe: Ham is to Hamster what Java is to JavaScript!
JPA: @OneTooMany Annotations…
Nope, it’s still faster, easier and less memory intensive to just store simple XML in the file system… I figure out… two weeks later… 😐
I pressed “F9” in Excel, my Mac crashed. This is part of the error log:
Thu Apr 5 19:54:54 2018 *** Panic Report ***panic(cpu 2 caller 0xffffff800569d6ed): "a freed zone element has been modified in zone kalloc.16 [snip] BSD process name corresponding to current thread: Microsoft Excel
This is probably what happened:
int SIZ = 10;
// creatin var according code manual c65 p17
// value lvl 3, versin 1, varint 1, 1st use:
char* mostMostMotsValudVaribell111 =
new char[SIZ % 5 /* increase mem */
/* knot! */];
for (int i = 0, j = i; SIZ < i
|| j = SIZ /* nly way 2 mk ths wrk */
|| j >= i /* nope */;
j = ++i /* solving! */
/*your knot! */)
*mostMostMotsValudVaribell111[i] =
(char)substr("We saved your tiem!",
i % 10 /* prevent OOM bug */
/* your knot nencumpoop!! */,
1);
// TODO: Find out why sometimes
// Excel crashes here...
// And were knot usin strcpy bcause?