Death to Carriage Returns and Linefeeds
130 years later and the typewriter is still slowing me down. When you type on a typewriter (for those of you under 25(?) who've never seen one) and reach the end of a line you grasp the "carriage return bar" which would return the carriage to the home position while simultaneously rotating the platen to feed the paper.
Aside: I spent the better part of the summer 1985 manually typing up the screenplay to Ghostbusters (as a reference material) on a manual Smith-Corona Typewriter.
Fast-forward to Teletype machines and now the carriage return/line feed combination is encoded into the wire protocol, then baked into ASCII text encoding itself in the 60s.
Fast-forward to lunchtime today when I was trying to commit some user-submitted changes to DasBlog via TortoiseSVN and got this fantastic error message "Commit failed: file has inconsistent newlines." What application would be so clever as to patch a file with consistent CR/LF pairs with a band-aid of just LFs? Why TortoiseMerge of course! But I'm not bitter.
How do you fix something like this? Well, a number of ways.
- Sometimes if you open the file in Visual Studio it will detect the inconsistencies and offer to fix them.
- You can use some of the dos2unix or unix2dos tools at the command line.
- You can use Notepad++ or Notepad2 (or Scite) - for this I prefer the cleaner Notepad2 status-bar implementation.
Here's screenshots of the same file opened in Notepad++ and Notepad2.
Notepad2 shows the the CR/LF status in the status bar and also optionally at the end of each line. It also lets you switch line endings by simply double clicking on the status bar indicator. Slick. Anyway, crisis averted and changes successfully committed.
Will we ever be rid of this problem?
No, just like Intel will always been little-endian while the rest of the world will be big-endian. As an unrelated aside from Alex McLellan:
The terms big-endian and little-endian were taken from the Big-Endians and Little-Endians of Gulliver’s Travels, when Lilliput and Blefuscu Gulliver finds two factions fighting over which end of a boiled egg should be cracked open.
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
"INTEL always little -endian" : Itanium can be either big or little.
ia64l - Intel Itanium little endian
ia64b - Intel Itanium big endian (IA64 line)
Or maybe I wouldn't - maybe knowing that I could download the screenplay from somewhere would have stopped me from carrying out this monumental task. Seeing the speed Scott types he'd obviously have had it finished before me (especially if he had CodeRush installed on his Smith-Corona typewriter) and I'd have been able to download it from him.
I often worry how kids today will get into programming. In my youth it was from typing out (and debugging) programs from the back of computing magazines so that I would have a game to play. Now that the average game take several man years of effort from incredibly skilled multidisciplinary people what is going to hook the kids in?
Wow - that's an off topic comment. Better go get myself a nice cup of tea and get back to work.
Comments are closed.