So the people were forced to come up with the bizarre convention of storing a FE FF at the beginning of every Unicode string; this is called a Unicode Byte Order Mark and if you are swapping your high and low bytes it will look like a FF FE and the person reading your string will know that they have to swap every other byte. Phew. Not every Unicode string in the wild has a byte order mark at the beginning.
Bits of
code point
First
code point
Last
code point
Bytes in
sequence
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
7
U+0000
U+007F
1
0xxxxxxx
11
U+0080
U+07FF
2
110xxxxx
10xxxxxx
16
U+0800
U+FFFF
3
1110xxxx
10xxxxxx
10xxxxxx
21
U+10000
U+1FFFFF
4
11110xxx
10xxxxxx
10xxxxxx
10xxxxxx
The following sequences are not part of the UTF-8 standard, only part of the original proposal
26
U+200000
U+3FFFFFF
5
111110xx
10xxxxxx
10xxxxxx
10xxxxxx
10xxxxxx
31
U+4000000
U+7FFFFFFF
6
1111110x
10xxxxxx
10xxxxxx
10xxxxxx
10xxxxxx
10xxxxxx
Here's a 'C' procedure from magaiti that will tell you how many bytes the next character occupies:
So I've got the program pretty much working, but I thought it might be nice to display the results graphically. Yes, html is glorious, put I don't want to open that can of worms. If I could just find the codes for the old IBM PC box drawing characters, I could cobble something together that would be adequate.
So I went rooting around on the net, and because I am using Linux, whenever I asked for box drawing characters and Linux, I got ncurses, which stands for new curses, which is some kind or proto-windowing system for terminals. I go round and round with this for a while, but never get anywhere because none of the sample programs will compile because I don't have some unspecified library installed. I eventually realized that the C programming language, my text editor and Linux in general all work perfectly well with unicode characters and I don't have any need for ncurses at all.
Stackexchange is useless. It is occupied by gnome-like creatures who know everything there is to know, but are incapable of answering a simple question.
I read a post the other day about Bi Directional printing. The post was on Schneier on Security and is about how malicious code can be inserted into source code. It does this by looking innocent. However when the compiler reads the file, it gets parts of it in different order than what you see on the screen. I think we can presume the compiler gets the raw file and what we see on the screen has been rearranged according to the constraints of the window and the formatting control characters embedded in the file.
Golden Earring - Twilight Zone (Extended Long Version)
Opening Salvo
There was an example posted so I thought I would try it out. The sample, however, did not have the control codes embedded in it, all it gave you were the two examples, one with control codes active and one without. So I thought I would give it a try, I mean it shouldn't be two hard to open up some kind of text editor and insert a couple of control codes, should it? Well, for some reason, man, the find function on my text editor has flat quit working. Do-do-Do-do - are we in the Twilight Zone?
I've been threatening to replace my Linux box with a Chromebox. You can buy them now. A few years ago you couldn't, you had to roll your own, and that was too much trouble. I'd gone through that in setting up my Linux box, but after having been using it for years without having to get back under the hood* I'm not keen to do so now.
I've been threatening to replace my Linux box with a Chromebox. You don't suppose the Linux box was listening in, do you? I mean it's what I use for all my web surfing, surfing for a new Chromebook (drool). Do I get a high power one or do I get a one with a Celeron processor? I think the high power ones also use an Intel processor with some kind of alpha-numeric name. And then there's the question of memory. I think I have a choice of 4, 8 or 16 gigabytes. I think this box, the one I'm using, has 4, but I can't be bothered to check. I guess I'm a little irritated, all that time I spent screwing around, waiting for computers to boot up. Maybe that's why I did it, I was a glutton for punishment, people looked at the job in passing and just passed on by. A smarter me might have done that, but I guess that's just who I am. There is a certain satisfaction in successfully jumping through all the hoops and finally getting the machine to behave.
*Capiche 'under the hood'? To work on an automobile engine, which used to be a very common activity but hardly ever happens any more, you had to open the hood, so all the time you were working on the engine, you were 'under the hood'. For some reason, most people, maybe 95 percent, won't ever engage in it. It might be lack of aptitude, or just simple disinclination, or possibly even a gut level revulsion. I don't know, people are weird. Anyway, 'under the hood' means getting down into the inner workings of of whatever mechanism, virtual or mechanical, is under discussion. That's a weird way to put it, 'under discussion'. The thing is broken and it needs to be fixed, there doesn't need to be any discussion. Aha! But anything worth repairing that breaks down is going to cause a discussion. Is it worth fixing? Can it be fixed? Who can do it? Should we just buy another one, it'd be quicker, etc., etc., etc.
Camera Obscura is Latin for 'dark room'. Let light from a pinhole or a lens into a dark room and it will project an image of the outside world on the opposite wall, so Camera Obscura is simply a fancy name for a very simple device. They have been around for millennia, Aristotle was familiar with the principle. Uniberp pointed out this one at Cliff House. Cliff House is a famous landmark in San Francisco. Those parking spaces out front are free, but there are only a few dozen, and being as this place is famous the odds of finding an open one there when you drive up are astronomical. Are you feeling lucky, punk?
Caption from image: The Camera Obscura, which is seen at many seaside places, is a striking example of how rays of light can be reflected in a different direction by a mirror placed at a slant. In the roof is a mirror at an angle of 45°, and this catches a reflection of the scene outside. The rays are directed upon a magnifying lens, placed in the right position to focus them, and the magnified view is cast upon a white table below. The top containing the mirror can be rotated by means of a handle turning a series of gear wheels, so that an image of the view all round can be reflected upon the table. The Camera Obscura was invented by a Neapolitan physician named Porta who found that by passing light through a double-convex lens he obtained a brighter image
ADDICTED TO LOVE (1997) - Official Movie Trailer
This reminded me of this movie (Addicted to Love) where Sam the jilted uses a Camera Obscura to spy on his ex-girlfriend. The images from the device make a few brief appearances in the trailer starting at the one minute mark. The movie is absurd. It was, however, entertaining. Comedy and stupidity are blood-brothers.
P.S. How to type a degree symbol on Linux: Ctrl + Shift + u (this will show an underlined u) and then the unicode value (in this case B0 ) and follow it by Enter.
Inspiration for a entire generation of video games
I like programming. When I am feeling sharp I like nothing better than horribly complex problems. When I am feeling dull, like I have been for the last couple of weeks, I want simple minded problems. Coding Game has lots of problems. They all start out easy enough but some of them quickly become nasty difficult. Looking for something easy to work on I thought I would try Tron Battle, one of their older multi-player puzzles. I might run out of steam before I master it, but the preliminaries will keep me amused for a couple of hours.
Imagine my surprise when my quick and dirty solution became a contender. It's not in the top rank but it's not down at the bottom with the dross either. Watching it run a few times against other players I thought of a couple of simple modifications. One required a modification to an existing procedure. The other required simple commenting out (removing) one line. Guess which one gave me a bigger improvement?
Update: I just looked at the result and 'export' scrambled the code, so never mind the rest of this post.
I just noticed that Blogger has a new feature: Pages, so I've put a copy of my program over there, in case anyone is interested. The program doesn't do any fancy graphics, it's all logic, and simple minded logic at that. It simple heads in the direction with the largest open space.
P.S. Notepad++ used to have an export function that produced html with color coding. Well, the export function only works with the ANSI version and I somehow had ended up with the Unicode version, so I did a reinstall and now export works, but it doesn't do the colors anymore. Bah. Cut and paste might work just as well. And Blogger's 'Pages' are kind of narrow for code.
Update July 2025 replaced missing video with HD version.