Archive for June, 2011

A Backslash is not a Slash

June 26, 2011

I must be playing the crotchety old man today. Maybe it has something to do with not feeling all that well. I’ll get over that, but I might not get over these young’uns who, when I tell ’em to use a slash, ask which one. There is only one. It is used for division. It is used in paths for Internet protocols like HTTP and FTP. It is used as the directory separator on UNIX and UNIX-like systems, which is how it came to be used in Internet protocols. That slash. You know the one.

These young’uns seem to get the slash confused with the backslash. I’m not quite sure why. Try putting in your source code somewhere “a = b \ 2” and I can guarantee that it won’t divide by two unless you have made a conscious effort to do something about that backslash. Try putting backslashes in place of the slashes in the URL bar of your web browser. There is a good chance that the web browser won’t know what you want it to do, and if you get past that, the web server will likely give you a 404.

My best guess is that these young’uns have gotten confused by some Microsoft software allowing both the slash and backslash to be used as directory separators. There was a time when their web browser allowed this and caused some people just learning how to make web sites to make links that were incompatible with anything other than Microsoft software. It seems we have gotten past that bit of confusion from the late 1990’s, yet some software developers get confused when I tell them to use a slash, even though they ought to know them apart to make their division and escape sequences work.

I suppose I might be partly to blame. I regularly use slashes in paths on code that runs on Windows systems because I know that the Windows libraries, like Win32, will interpret the slash as a directory separator. It was a fine decision on Microsoft’s part to assist in porting UNIX software to Windows, and I do use some software at work that started on UNIX and was later ported to Windows. The whole development team does, even if they don’t realize it. So, I use slashes in the paths because they work, and I don’t have to type two characters; using the backslash would start an escape sequence and require another backslash to be interpreted as a single backslash in a string literal.

Still, that doesn’t seem very confusing to me. Software developers need to get this sort of thing straight, so I’m still not clear as to why software developers don’t know what I mean when I say slash. I can understand if they ask about it in the context of a path since not all software on Windows will go both ways, but I get asked outside that context, too. I think when I’m asked which slash to use in the future, I may start answering with use the character for division, or use the character for an escape sequence. If a software developer still doesn’t know what I mean, then they shouldn’t be employed as a software developer. Fortunately, I think it’ll be a while before I find myself working with such an ignorant developer.

Advertisements

Sun386i computer in Tron: Legacy; could Clu live?

June 5, 2011

I took a closer look at the screen of the computer Sam Flynn finds in Tron: Legacy that soon sends him to this grid place. It looks to be identifying itself as a system based on an Intel 386 processor running SunOS 4.0.1. Evidently this is one of Sun’s old Sun386i computers. This is consistent with the 1989 time frame; such systems were available in 1988. It also seems that security was configured to be somewhat lacking. Why would someone make a user account called “backdoor”?

Kevin Flynn appears to be a user of vi, one of the two text editors that have inspired an almost religious devotion. The other is emacs. One of the files previously edited is called last_will_and_testament.txt in Kevin’s home directory. Was he already worried about Clu, or about the health effects of going in and out of the computer?

I think the Sun386i computer was not the one running that grid setup where the Flynn’s existed for a time. The environment depicted is very intricate and detailed with plenty of the program-processes all running at once. (Tron fiction combines programs and processes into a single entity it calls a program.) Some of those program-processes have very complex behavior, and that may require a good sized program with plenty of data. I doubt it could all fit into 16MB of RAM, which is the most a Sun386i can take.

Further, the Sun386i was connected to a network, or the filmmakers made a mistake. Inside a partly obstructed terminal window is what appears to be output from the command top running on a modern Linux or similar system. Solaris, the successor to SunOS, has a different command, prstat, that it seems does the same sort of thing as top, but with a different formatting of the data. SunOS may have had prstat as well, but I don’t recall; I last used a SunOS/Solaris system over ten years ago.

The output of top shows a process called Xorg, which is very similar to X.Org, the name of a common X server. An X server runs the basic parts of a graphical console on most Unix-like systems. X client programs send commands to the server to draw things on the screen, and the server sends the clients user input. SunOS 4.0.1 has an X server, but it wasn’t X.Org. X.Org is a modern X server that was first released in 2004. I doubt anyone has bothered to port it to an old Sun system from 1988 that is mostly forgotten now. There are other processes on the list, like hald, that also suggest modern software.

The old Sun’s hardware includes an Ethernet interface, and SunOS supports IPv4. With a working Sun386i today, it should be possible to connect it to almost any Ethernet LAN, configure it manually with an IP address, subnet mask, default route, and DNS, and then be able to communicate with the modern Internet that uses IPv4, which is still almost all of it, if the LAN includes an Internet connection. Then telnet could be used to log into a remote machine, such as a modern Linux machine, and run top.

They seemed to give a lot of attention to the details of the Sun computer, so I’m not sure this was a mistake. If it isn’t, then the uptime of a little more than eight and a half days shown by top makes more sense. But that would mean that someone, or some process with access to the Sun386i, connected to and ran top on the remote machine sometime within eight and a half days before Sam Flynn began his adventure on a grid. Might Clu have access to the Sun system? Even if the Sun system isn’t running the grid environment, it likely is in contact with that system. But if Clu can contact the Sun386i, then the system running Clu likely has its own Ethernet interface and IPv4 stack. In that case, Clu wouldn’t need to go trough the Sun system to communicate with the remote Linux system, so maybe this is a mistake.

Maybe the Sun system has been modified by ENCOM so that it can run the grid place. Maybe it runs on a special board plugged into the Sun386i. In that case, Clu might have to go through the Sun system to communicate with the outside world. It does seem like the system would need some modification to have managed to run without hardware or power issues or even maintenance for a couple of decades. Even NASA’s deep space probes that have lasted at least that long have had hardware issues and were given software updates to work around the issues, but those probes were designed knowing that maintenance after launch would not be possible. A Sun computer, however, was made to sit in someone’s office or server farm where maintenance could be regularly administered. It still amazes me NASA made three (?) probes that functioned for over thirty years, and two of them still work and are still providing data about our solar system. I doubt any computer made for high-reliability by the likes of Sun, or HP, or IBM, could last that long without maintenance.

So, anyway, Sam Flynn finds an old Sun386i running SunOS 4.0.1 that could have been bought in 1988, using an unconventional display with touch input, although that was seen in the first Tron movie (1982), and that computer is in contact with a modern Linux system. That could open the possibility that a sequel movie could involve a copy of Clu. Such a movie could also have Rinzler/Tron; the program-process’s luminescent markings changed color as he sunk, but did not go dark.

Microsoft macros, please see Stroustrup

June 4, 2011

This past week at work, I looked into why I could use a member variable called “interface” just fine in some source files but not others. Preprocessor output showed the name interface was being changed to “struct” in the files that had errors, and sometimes not where I defined the data structure that contained the interface field, but somewhere else later in the file. I eventually tracked down the culprit to objbase.h, a Microsoft supplied header file used by Direct3D 9 and maybe some other stuff. It has this wonderful gem:

#define interface  struct

No C or C++ developer should ever do that. There is no good or justifiable reason to name a macro something that, in many naming conventions, is a perfectly fine name to use for something other than a macro. Most naming conventions use all capital letters only for macro names in order to avoid such confusion.

Bjarne Stroustrup also sees this as a problem. He recommends avoiding macros whenever possible, and I can see why. This is easier to do in C++ with the help of such things as templates that are not in C, but adhering to a good naming convention can eliminate a lot of troubles when macros must be used.

In short, I find it inexcusable for any developer to do something like what I found in objbase.h. Whoever is responsible should be slapped. I can only hope that has already happened.


False Steps

The Space Race as it might have been

keithlugcom.wordpress.com/

You Control The Action!

High Frontier

the space colony simulation game

Simple Climate

Straightforwardly explaining climate change, so you can read, react and then get on with your life.