Re:Getting the ^D
by eru on Sunday April 09, 2023 @09:57PM
(#35508403)
> Tech is very male dominated and the more inclusive we are the more ideas we bring to the table.
Tech has been bending over backwards for quite a while, but to no avail.
In contrast, marketing, law, medicine etc used to be very male dominated a few decades ago, made almost no attempt at welcoming women, and still got many of them.
It's almost as if women make their own choices, and it's not really down to how welcoming specific fields are? It's almost as if women have preferences of their own? Who would have guessed?
Re:Getting the ^D
by zephyrnh on Sunday April 09, 2023 @10:29PM
(#35508572)
> Tech has been bending over backwards for quite a while, but to no avail.
You're applying a false equivalence here. Some things are positive changes and make sense, and some are not. Grouping everything together isn't helpful.
I am male, and my first thought on reading the title was that it was juvenile to a point that I was surprised to see it as a title on HN. Hearing someone else echo that feedback is helpful and will hopefully help the author in their growth.
This is not a "bend over backwards" request, it's a dumb sexual joke on HN, and your response comes across as very condescending.
Re:Getting the ^D
by eru on Monday April 10, 2023 @10:28PM
(#35520008)
For what it's worth, I even partially agree with you.
I went back and noticed that the original comment is dead and flagged now. So I 'vouched' for it: I don't entirely agree with the contents, but I think it is part of a good debate.
Re:Getting the ^D
by ayknfsefb on Monday April 10, 2023 @09:03AM
(#35511773)
If they can't handle a double entendre about penises on the Internet, they're going to have a rough time when they figure out that half the population have actual, flesh and blood penises attached to them every second of the day. Penises. Everywhere! Poor ladies, they'd never go outside again!
Or maybe they're not as pathetic as you're making out. Yeah, that.
Re:Getting the ^D
by ars on Sunday April 09, 2023 @10:25PM
(#35508551)
I googled ^D and didn't find any other meaning other than ctrl-D?
Some places said a D is short for Dick, but I don't see why that would be especially offensive to abuse victims because it seems to be used in a flirtatious way, not an abusive way.
To give context, it's a reference to "getting the D" or "giving the D" which is slang for getting/giving someone 'dick' which is inappropriate considering this is a post about terminals.
I initially didn't get either of you, all I can think of was a half-face emoticon. It turns out that "getting the D" means something (I'll refrain from explaining this), and with this context "take a joke" is really unacceptable---it means you know the joke and you think it's fine, which isn't.
Re:Getting the ^D
by xoac on Monday April 10, 2023 @03:47AM
(#35510066)
I don’t really get why this is so offensive. It’s some guy’s webpage, where we are just visitors, on which he has shared some knowledge with a title that plays on a double entendre. It’s not about taking a joke as it’s not something addressed to you at all. People need to stop being hall monitors on the internet. Just close the page, move on.
Re:Getting the ^D
by mdp2021 on Monday April 10, 2023 @04:07AM
(#35510178)
The title makes some absolute sense, so it is per se acceptable. You may take this case as a reminder to remain focused and disregard unnecessary potential lateral reads.
I didn't take offense to the title; it is not even clear whether the author intended that joke (I didn't know that phrase so could the author). I merely pointed out that, if you think the author intended this particular joke, then it is inappropriate to say "take [the] joke".
Re:Getting the ^D
by shrubble on Sunday April 09, 2023 @09:53PM
(#35508372)
The author takes the long way round and misses the point by a little bit.
ANSI C defines EOF, the 2nd edition by Kernighan and Ritchie page 151 states 'getchar returns the next input character each time it is called, or EOF when it encounters end of file. The symbolic constant EOF is defined in <stdio.h>.
The value is typically -1, bit tests should be written in terms of EOF so as to be independent of the specific value.'
Re:Getting the ^D
by ksherlock on Sunday April 09, 2023 @10:52PM
(#35508713)
The discussion is about how terminals and pseudo terminals handle control characters, specifically ^D / EOF / termios.c_cc[VEOF] which is a few layers below getchar(). man stty(1) or termios(5) for more information.
When a program reads from a pseudo-terminal device in "cooked mode"[0], ^D is the default control character to indicate "no more input will be made available."
A program reading from a file handle other than a pseudo-terminal or a pseudo-terminal set to be in "raw mode" will behave as you describe.
Yes but the expectation still is to interpret it as "end of input", even for interactive programs. One that doesn't (unfortunately) is zsh where ^D makes autosuggest prompt "do you wish to see all n possibilities?"
I like how he references Linus' TTY Demystified article (a popular repost here on HN too) --- that has almost become a de-facto source of information on the details of how the TTY subsystem works.
Re:Getting the ^D
by donatj on Monday April 10, 2023 @01:40AM
(#35509492)
Hmm, my assumption up to now had honestly been that ^D was just the shortcut for a NULL byte, 0x0 and everything just assumed it’d reached the end of the stream.
Sending a special EOT 0x4 that gets special terminal handling feels just a little less… elegant… than what I had imagined.
"I am curious now, would it be possible to make the keyboard generate a NULL byte either by existing keyboard shortcut or custom hardware - and how would the system handle it?"
Not sure I understand the point of the experiment, but in NetBSD kernel one can remap the keyboard, e.g., set a key to 0x00. How to do this in Linux kernel is a question for reader.
Re:Getting the ^D
by layer8 on Monday April 10, 2023 @08:13AM
(#35511389)
The NUL byte has no special meaning in file I/O, or the terminal. (Historically, the only special meaning was as a no-op character that does nothing.) The convention of using NUL as a termination character only exists for in-memory strings in C, and has no connection to file I/O.
Re:Getting the ^D
by jwilk on Monday April 10, 2023 @03:15AM
(#35509925)
> the process has to be programmed to stop if read returns no bytes. A process could carry on regardless, or not read stdin at all. In Bash, if you type half a command and press ^D repeatedly, nothing happens.
It's not a good example, because bash disables the canonical mode. When you type ^D this happens:
Re:Getting the ^D
by jeffrallen on Monday April 10, 2023 @04:30AM
(#35510293)
See also the evil interview question, "how does a keyboard type characters into an Emacs buffer?"
You could spend 8 hours describing it from power, to USB descriptors, to debouncing, to keymapping, to matrix scanning, to ptys, to editor string management algorithms to Lisp. And passing by this article as well!
Re:Getting the ^D
by jeffrallen on Monday April 10, 2023 @05:13AM
(#35510494)
Nah it's just an interesting interview question if you are looking for a generalist. There's also "what happens when you type into the address bar of your browser and hit return?" Can cover DNS, wifi, BGP, servers, DOM layout, TLS, etc.
Tech has been bending over backwards for quite a while, but to no avail.
In contrast, marketing, law, medicine etc used to be very male dominated a few decades ago, made almost no attempt at welcoming women, and still got many of them.
It's almost as if women make their own choices, and it's not really down to how welcoming specific fields are? It's almost as if women have preferences of their own? Who would have guessed?
See https://slatestarcodex.com/2017/08/01/gender-imbalances-are-... and https://slatestarcodex.com/2017/08/07/contra-grant-on-exagge...
You're applying a false equivalence here. Some things are positive changes and make sense, and some are not. Grouping everything together isn't helpful.
I am male, and my first thought on reading the title was that it was juvenile to a point that I was surprised to see it as a title on HN. Hearing someone else echo that feedback is helpful and will hopefully help the author in their growth.
This is not a "bend over backwards" request, it's a dumb sexual joke on HN, and your response comes across as very condescending.
> help the author in their growth
> your response comes across as very condescending
Lack of self-awareness and pathetic childish pearl-clutching go so well together.
Go cry to mommy about swearing on the internet if you can't handle it, maybe she can install a filter.
I went back and noticed that the original comment is dead and flagged now. So I 'vouched' for it: I don't entirely agree with the contents, but I think it is part of a good debate.
Have a look at the slatestarcodex essays for more detail. Scott Alexander writes better than me.
Or maybe they're not as pathetic as you're making out. Yeah, that.
Some places said a D is short for Dick, but I don't see why that would be especially offensive to abuse victims because it seems to be used in a flirtatious way, not an abusive way.
Because one person on the Internet interpreted a title as a double entendre and said so?
There's so many ways to phrase the title, but the author has to use https://www.urbandictionary.com/define.php?term=Getting%20th....
Ok, guessed: if your mind has filthy lenses, sniper, do not ask us to join you in your avoidable traits.
ANSI C defines EOF, the 2nd edition by Kernighan and Ritchie page 151 states 'getchar returns the next input character each time it is called, or EOF when it encounters end of file. The symbolic constant EOF is defined in <stdio.h>.
The value is typically -1, bit tests should be written in terms of EOF so as to be independent of the specific value.'
Its value is platform dependent. As per the C++ standard[0]:
0 - https://cplusplus.com/reference/cstdio/EOF/Is this particular citation, "wrong, out of date, or just missing things"?
A program reading from a file handle other than a pseudo-terminal or a pseudo-terminal set to be in "raw mode" will behave as you describe.
0 - https://en.wikipedia.org/wiki/Terminal_mode
Sending a special EOT 0x4 that gets special terminal handling feels just a little less… elegant… than what I had imagined.
^@ produces the NUL character.
Not sure I understand the point of the experiment, but in NetBSD kernel one can remap the keyboard, e.g., set a key to 0x00. How to do this in Linux kernel is a question for reader.
https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/dev...
It's not a good example, because bash disables the canonical mode. When you type ^D this happens:
(And then bash ignores the read EOT character.)You could spend 8 hours describing it from power, to USB descriptors, to debouncing, to keymapping, to matrix scanning, to ptys, to editor string management algorithms to Lisp. And passing by this article as well!
To override the character for "EOF," change ^D to something else in the following command and run it: