Start

heckmeck!

Nerd content and
cringe since 1999
Alexander Grupe
Losso/AttentionWhore

My IDE seems to think this, it just hates tabs – that is: the tabulator character to indent your code and your text files. Whenever it is restarted, my tabulator settings are reverted from proper tabs to 4 spaces:

Now, as a seasoned pragmatic programmer, I know to refrain from any tedious tabs-vs-spaces debate*. How about you refrain from messing up my formatting settings, IntelliJ? These issues have been around for ages – and yes, I do update my IDE from time to time, and no, I will not resort to editing some hidden configuration options by hand.

*) Because there is no debate. :) Observe the process of adding and removing a tab the correct way, and when poorly emulating tabs with spaces:

When editing code files outside of the IDE (in vim, nano, or in CygnusEd on the Amiga), this becomes even worse. To keep a consistent code format, you now have to type in 4 to 8 spaces like a monkey if you merely want to add a tab.

While consulting various Teletext services to track the latest projections of the European elections, I was reminded how many German TV stations employ advanced Telext features to render graphical station logos. (Teletext Level 2.5, from 1995!)

Well, four, at least… :)

Interesting graphics glitch of ZDF’s logo loading

Here there are, in their full glory, along with their Teletext level 1 fallback renditions.

Ah, the joys of confusing IT concepts and ambiguous names.

When I first read the word “sixels” in the context of Teletext graphics three years ago, that name immediately clicked with me, and I thought it fitting as a catchy combination of “pixel” and “six-element mosaic character”. I mean, it’s obviously exactly what you should call these little guys:

Today I learned that “sixel graphics” is also used in a very different context, describing a special graphics mode of oldschool terminals and dot matrix printers. Here, sixels aren’t the elements of a tiny 2×3 grid, but a vertical row of six dots! Since it can be used to display graphical data in your terminal, it’s widely used even today. You only need a bunch of arcane ESC-sequence incantations:

‹ESC›Pq#0?Ehle_ehlE??BF{{FB?^~__~^?]~```?~~CMzp?nn‹ESC›\

Easy, right? Dump that garbage right into your terminal:

Try it: echo -e -n "\x1bPq#0?Ehle_ehlE??BF{{FB?^~__~^?]~\`\`\`?~~CMzp?nn\x1b\"

Luckily, there’s no room for debate on which concept denotes the true sixels!

  • Teletext went live in 1974
  • That “SIXEL graphics” hack came years after that – around 1983 apparently, with the introduction of the DEC LA-50 printer

So, go have fun with your shenanigangs in those newfangled terminal emulators, but keep your ugly ESC sequences off my TV screen! And maybe invent a better name, while you’re at it. How about “POOP” – pixel obfuscation for obsolete printers? :)

Watching an NDC talk about programming languages I saw this, an implementation of Fizz buzz in APL:

I haven’t ever touched APL, and I know it uses all kinds of weird letters and shapes, but I’m pretty sure it doesn’t use typographical quotes.

Or does it?

Yeah, no, it doesn’t.

Seems to be a case of “copied the code from a web page that performs ‘smart’ quote replacing”. That’s always annoying – not the copying part, but the fact that code on websites gets demolished by brain-dead Wordpress plugins so often. Replacing the hexadecimal 0x prefix with in the text and even in font ligatures plays on the same level…

But this got me thinking: How about a compiler that detects code with typographical “enhancements” copied from a website or a Word document and behaves differently? Like a quirks mode for code. Consider:

public class HelloPasteCode {
  public static void main(String... args) {
    System.out.println(Hello world!);
    System.out.println(Hexadecimal 2A is  + 0×2A);
  }
}

Instead of spewing out ugly error messages:

> java HelloPasteCode.java
HelloPasteCode.java:3: error: ')' expected
    System.out.println(ÔÇ£Hello world!ÔÇ?);
                               ^
HelloPasteCode.java:3: error: not a statement
    System.out.println(ÔÇ£Hello world!ÔÇ?);
                                ^
HelloPasteCode.java:3: error: ';' expected
    System.out.println(ÔÇ£Hello world!ÔÇ?);
                                     ^
HelloPasteCode.java:3: error: illegal character: '\ufffd'
    System.out.println(ÔÇ£Hello world!ÔÇ?);
                                        ^

…it could do the right thing and just run the copy-pasted code and present the result accordingly. In this context, redirecting STDOUT to a browser window seems approriate:

Of course, not without adding a subtle indicator that we are running in “pasted code quirks mode” at the end. 🤓

PS: To be fair, later in this talk an (unused) slide with well-formed code is rushing by, so there seems to be awareness of the problem somewhere:

There are two hard problems in IT: transferring large files and, apparently, drawing circles.

I’m writing a lot of demo prototyping tools in Java and Kotlin. Doing that, an exotic requirement came up: I wanted to draw a filled circle. Outrageous, I know, but how hard can it be?

Since there is no fillCircle, let’s try fillOval. According to the documentation, “fills an oval bounded by the specified rectangle with the current color” – just what we need!

g.fillOval(x, y, size, size)

Weird, the circle was supposed to span the bounding box, but the first column and row are empty. Also, there are ugly jaggies. Hm, why not try to move the circle up and left by 1 pixel and increase the size by 1 to make up for that:

g.fillOval(x-1, y-1, size+1, size+1)

That’s somewhat better, but now we have a single stray pixel outside of the bounding box! fillArc with angles from 0 to 360 gives the same result.

Maybe we can use drawOval instead and fill that? Of course, that method behaves slightly different (“covers an area that is width+1 pixels wide and height+1 pixels tall”), but we keep that in mind.

g.drawOval(x, y, size-1, size-1)

At least the outline fills the bounding box neatly now. But wait… the circles aren’t even symmetrical?! You gotta be kidding me.

At this point, I’m not really in the mood to investigate if this is a problem of the specific JRE* or something, and do the obvious thing: Use the circle equation and plot every pixel by hand.

(x-centerX)² + (y-centerY)² <= r²

Huzzah! That was easy. As a bonus, these circles don’t seem to suffer from ugly jaggies, and they mostly match up with the circles PersonalPaint and DeluxePaint would draw.

White: pixels not drawn by PPaint/DPaint

Why didn’t I do it that way from the start? Stupid me. /s

*) For reference: Amazon Corretto 17.0.10 on Windows 10

previous next close
eie