historicaldocuments
@historicaldocuments@lemmy.world
- Comment on Why does not a CR (Carriage Return) automatically start a new line on some online text editors? 1 week ago:
You could probably get 80% of that process done by learning some python. If you have a string “s”, then replacing double newlines with a single newline is as easy as
re.sub(“\n\n”, “\n”, s)where “\n” is an LF in many programming languages. A CR is often “\r” in the same vein. Just be aware that regular expressions can be very, very frustrating; and every webpage is going to be a new adventure in how it got formatted. If you use something like spyder it’ll allow you to see what the data looks like inside the python process so you get a chance to iterate.
- Comment on Why does not a CR (Carriage Return) automatically start a new line on some online text editors? 1 week ago:
There is Carriage Return (CR), and also Line Feed (LF, often called New Line). If you think about old mechanical printers with the metal arm sticking out, a CR operation would move the type head to the far left column, and a LF operation would advance the paper by one line. Variously through the years depending on hardware (typewriter, teletype, those early CRTs that you had to refresh the screen, or modern computers) you would get one or both of those if you pressed Return/Enter, and it’s configurable in software, depending on the software. I don’t know what windows does these days with notepad, but at one time the Enter key sent both (CRLF). UNIX style systems tended to use LF, and older Macs as someone else referenced used CR. If you wrote a generic program to handle anything you had to account for all of them. Mostly these days it gets abstracted away which generally works well enough unless a team of people used a random collection of software to edit a text file.
printf "\r\nHexadecimal, like that scene from The Martian.\n" | hexdump -C 00000000 0d 0a 48 65 78 61 64 65 63 69 6d 61 6c 2c 20 6c |..Hexadecimal, l| 00000010 69 6b 65 20 74 68 61 74 20 73 63 65 6e 65 20 66 |ike that scene f| 00000020 72 6f 6d 20 54 68 65 20 4d 61 72 74 69 61 6e 2e |rom The Martian.| 00000030 0a |.| 00000031
The 0a is a Line Feed character, and the 0d is a Carriage Return character. In my terminal without piping it through hexdump you get:
printf "\r\nHexadecimal, like that scene from The Martian.\n" Hexadecimal, like that scene from The Martian.
The LF at the end of the string makes it so that the prompt at the terminal doesn’t appear on the same line as the output, and the blank line before the text is caused by the LF at the beginning. I don’t know/care/have to worry about what eats the CR.
- Comment on A Ripple in Space 2 weeks ago:
johncderrick.com/dinosaur-timeline
The timeline stuff always gets me.
- Comment on A Ripple in Space 2 weeks ago:
Pretty good resource for that kind of thing if you have another interested kid and access to the internet. There’s also this:
- Comment on A little dehydration Never killed nobody 3 weeks ago:
I, too, try to avoid the water fountains on the common wetwall where the water in the pipes is cycled all the time thanks to the constant use of the bathrooms. I usually shoot for the fountain next to the old eyewash station they were forced to put in when the electronics lab used to be the chemical lab–there’s never anyone using that one.
- Comment on This has gotten out of hand and I demand satisfaction. 3 weeks ago:
I know this is a shitpost, but here’s the explanation: you can’t force people to like you.
You may get off on power trips going to businesses where people aren’t allowed to deny you service or return bad attitude in kind, but everywhere else you’re a $1000/hour with a forty hour minimum payment in advance work starts after the check clears kind of guy.
- Comment on What is 3x/4x USB ?? 4 weeks ago:
They’re revisions to the USB standard. USB stands for “Universal Serial Bus.” In the before times there used to be different connectors and formats for sending data over wires for a lot of things. Eventually USB came along and solved a lot of problems all at once: simple.wikipedia.org/wiki/USB
- Comment on Engine auto-off 1 month ago:
A jeep renegade I rented did ok
You must’ve gotten a good one.