Free for all: Comma Delimited files, Excel Transpose, Programmer Calculator with a Hex thrown in

 

In this blog you will find out about what happens when you create a comma delimited file from Excel, what a carriage return/line feed is and where they are used, get a little musing on how data used to be entered finally a short discussion of calculator to find out more about different number systems.  Knowing how to manipulate data is important for testing your code and for displaying it’s functionality to customers.

If you make up a list in a column and then save it as comma delimited.  When I opened it in notepad, I had a list with each word on a new line.  Logical, but you might have a question: “Shouldn’t there be a comma after each word, then a carriage return, line feed or combination of  both?”

I then used the Excel process of copy and paste—transpose, and that gave me one line of comma delimited characters.

When I try to save a file as comma delimited from Excel, it saves it with line returns if it the list is in a column,.but works like I expected if the data is in a row.  I had noticed this in the past, which means that a carriage return is added to each line when the Excel spreadsheet translates image the excel spreadsheet to a comma delimited file.  Is leaving out a comma on each line when there is only one item correct?

After thinking about this for a few minutes, it does make sense, when you look at the line from the transposed list (that is: converted from column to row), if you have more than one row, there has to be a carriage return and a line feed.  In the old days, which the ASCII printer code is based on, you had to push the button for carriage return and then line feed, some telecommunication systems required two carriage returns and a line feed.  If you didn’t press the line feed, then the printer on the other end would type over the last line, this would require that the receiver operator to read and copy the tape, stop it at the point of missing line feed then add the line feed.

How did all of this Carriage Return/Line Feed get started, and why comma delimited and not another character?

When UNIX came out, the problem of carriage return and not having a line feed was unacceptable, so UNIX only requires the carriage return which in hexadecimal is represented as 0a (zero followed by an ‘a’ which is decimal 10 and in this case a lowercase ‘a’).  Windows uses both carriage return 0a and line feed 0d (zero followed by a d which is decimal 13).  Apple uses line feed 0d.

In Windows you can use the calculator examine this idea by changing the view to “Programmer” and use the Hex and Decimal selection.

image

 

 

 

 

The programmer calculator is a useful tool for people who are thinking about hexadecimal, Octal and Binary, in this case I typed in 13 and then changed from Dec to Hex, D now appears, representing number 13 decimal in hexadecimal.

The programmer view of the Windows Calculator can also be used to experiment with logical operations.  For example: let’s say you want to find out what happens when you perform the logical AND function between 11000011 and 11111111.

Why Comma Delimited?

Don’t know exactly, but the initial number of ASCII characters were quite limited in number and some of them like carriage return/line feeds did not print (there was alert or bell for instances it rang a little bell on the teletype machine but didn’t print).  A period could be confusing, and the exclamation mark wouldn’t make sense.  So by some lengthy logic the board that created the ASCII tables

So from this blog you should have learned:

  •  
    • How to save a file as a comma delimited file in Excel
    • History of the carriage/line feed.
    • What a carriage return/line feed is and how they differ between UNIX/Windows/Apple

How to use the Windows Calculator to translate between hexadecimal and decimal as well as how to use the calculator to examine logical operation.

Hope this helped out