In an ansi style keyboard, what is the vk code for the backslash above enter - virtual-keyboard

i can't for the love of me find the vk code for this, i want to make a program which detects if it's been pressed and uses send input to input a < instead of ç
I'm not using autohotkey because it would be half as fun as coding it myself and like using a chainsaw to cut a piece of steak

what is the vk code for the backslash above enter
It really depends on your keyboard.
Per the Virtual Key Codes documentation, it is likely VK_OEM_5:
VK_OEM_5
0xDC
Used for miscellaneous characters; it can vary by keyboard.
For the US standard keyboard, the '\|' key
Which is indeed the \ key above the Enter key on my keyboard.
But, if you don't have a US keyboard, then it may be VK_OEM_102 instead:
VK_OEM_102
0xE2
Either the angle bracket key or the backslash key on the RT 102-key keyboard
So, you will just have to write some code to test which key code is actually reported when pressing the \ key on your keyboard.

Related

How does 95cd 21eb fc from Farbrausch's "fuenf" translate into

In 2001 German scene group Farbrausch released a demo called "fuenf" (in your face). pouet.net It contains a 5 Byte executable which could be rather considered a troll approach than a demo. If you run it your hear a weird sound and it could crash your computer. At least it produces a sound. Whatever.
The hexadecimal content is:
95cd 21eb fc
And the binary representation is:
10010101 11001101 00100001 11101011 11111100
Using xxd I also get the printable chars from the content, which are:
..!..
And that makes me a little confused. Looking up the values in the ASCII table (e.g. here), I get this as a result:
•Í!ëü
At least the exclamation mark is correct.
But how does 95cd21ebfc translate into ..!..?
Side note:
file -bi fuenf.com sais the encoding is not known:
charset=unknown-8bit
And iconv -f ISO-8859-1 -t UTF-8 fuenf.com returns
Í!ëü
Which leads to the assumption, that XXD simply cannot decode the content and therefore just uses default results, like the dot?
First of all, this is not a text file, so looking at it as one makes no sense. It's instructions.
Secondly, even if it could be interpreted as text, you would need to know the encoding. It's definitely not ASCII, because that only defines symbols in the range 0-127 (and the 3rd byte here is the only one in that range, which maps to '!'). The "extended ASCII" table you link to is only one of many possible code pages that give meaning to the value from 128-255, but there are many of those code pages. Calling it "extended ASCII" is misleading, because it suggests that ASCII created an updated standard for this, which they did not. For a while, computer vendors just did whatever they wanted with those additional characters, and some of them became quasi-standards by virtue of being included in DOS, Windows, etc. Or they got standardized by ISO (you tried iso-8859-1, which is one such standard).

Understanding a few iTerm2 default keycode mappings

What are the following used for in iTerm2? For example:
^2 through ^9 and ^- --> Send Hex Code 0x00 .. 0x7f ?
⌥↑ and ⌥↓ --> Send Hex Codes: 0x1b 0x1b 0x5b 0x41...
To put it all into one here are the ones in question in a nicely formatted way:
Short answer: For compatibility with old terminals. Real terminals that were dedicated pieces of hardware, not applications in a window system!
About the ^0...^9 ones: Terminals would typically use 7-bit ASCII codes, with character codes ranging from 0 to 127, inclusive. Codes 32-126 where used for letters, numbers and punctuation (as they still are in Unicode). 127 was usually the DELETE key (though sometimes that key would send code 8, "backspace" instead, leading to problems which persist in FAQ lists to this day. CTRL-A to CTRL-Z would generate the corresponding ASCII code minus 64, i.e. 1-26. The remaining codes could be a bit harder to generate. CTRL-# usually gave you a 0, but sometimes that was on CTRL-space instead. The 27-31 range was usually at CTRL plus the "ASCII minus 64" position, so for example CTRL-] would give you 0x1D, but there were some terminals where those codes were mapped to CTRL-number instead, and those mappings in iTerm2 seem to be there to cater to people used to such terminals.
As for alt-arrow giving 1b 1b 5b 41, that is ESC ESC [ A . Now ESC [ A is a fairly common sequence for the up arrow alone, and prefixing it with an extra escape probably makes Emacs users happy, because it makes the Alt key work as a Meta key for them. I have not looked at the other multi-byte sequences, but I guess they have similar explanations.

Replace-all-occurences keyboard shortcut for Atom under Linux

In Mac OS X Ctrl+Cmd+g replaces a word in the whole file. What's the alternative to that in Linux?
I tried to check the keybindings, but no luck.
You can use Command+. to active the Key Binding Resolver to look for the actual function bound to the shortcut on your Mac and search the function on Linux Atom to figure out what the key combination is.
Alternatively, your can search all your key binding here (see screenshot below) which accept both key combination and command name.
Using ctrl + e when you are on a word will open the find and replace panel for this word.
Then use tab to go into the "replace in current buffer field", type your replacement word.
Finally, hit enter to replace the occurrences one by one, or ctrl + enter to replace all.

How to type the Hash Key?

I've just started programming in R and have discovered you make comments by using #.
I've never been too concerned with this key as I normally program using Matlab or C++.
I'm using Windows 8 on a Macbook Pro so the keyboard doesn't have a designated # key and the shortcut for an apple keyboard for the # key (which is alt+3) doesn't work.
I haven't been about to find a solution for this. Thanks.
On an Apple Keyboard, whilst using a third-party OS such as Windows, you type the # symbol by pressing the 2nd Alt key + 3.
The first (left hand side) Alt key doesn't have a shortcut function.
This applies to all programs (Visual Studio, R, Word etc).
When using Windows the keyboard reverts to a standard Windows keyboard layout, which is different from the Mac layout for some keys. So the hash key is mapped to what is marked as the backslash key \, to the left of the return, and the # key is mapped to the double inverted comma.
I've got an Apple "Magic Keyboard" on UK settings and can get the hash symbol by holding Command and pressing the Backslash key
I'm using Ubuntu Xfce on a Macbook, and none of the above answers helped me at all. Then I found I could type a hash character using SHIFT + RIGHT ALT + = twice. It makes sense, because a hash character looks like two '+' signs.
The RIGHT ALT key is listed in my Settings -> Keyboard -> Layout as the 'Compose Key', so if it doesn't work, check what your Compose Key is and try that.

^[[A character combination

On Unix, when I press up arrow key, it shows this string, but while scanf, it does not take it as input. Please explain how to take it as input. Can we something like compare the character by charater like first ^[ is Esc key and so on?
That's the escape sequence generated by that key. '^[' is CTRL-[ (the ESC character), and the other two characters are '[' and 'A'.
If you want to process them, you'll need to read all three characters and decide that they mean the user pressed the up-arrow key.
Whether or not you can do this with your scanf depends on the format string. I would be using a lower level of character input for this.
I never use [f]scanf in real code since failure results in you not knowing where the input pointer is located. For line-based input, I find it's always better to use fgets and then sscanf the string retrieved.
But, as I said, you should be using getc and its brethren for low-level character I/O. Or find a higher level function such as readline under Linux, or other libraries that know to convert it into special keycodes such as VK_KEY_UP that you can process.

Resources