Binary Keyboard Layout - layout

I've recently informed myself a bit about keyboard layouts and tried things like Dvorak or Neo, but today i asked myself the question wether there is a sort of 'binary' keyboard layout.
It should use 8 keys to key in the binary representation of one character (one byte).
Example:
ASDF and JKL; are used for input.
If want to write an 'A' (65 decimal, 10000001 binary)
you had to press A and ;
Or you wanted to write an 'f' (146 decimal, 10010010 binary)
you had to press A, F and L.
I wondered if there was already something like this or somebody could show me a C/C++ library capable of altering the keaboard layout and supporting combinations like these.

Related

Editing in binary

I've been tinkering with multiple hex editors but nothing really has worked.
What I'm looking for is a way to change a binary in actual binary (not in hex). This is purely for educational purposes and I know it's trivial to convert between both, but I wanted to be able to change the ones and zeroes just like I would do hex.
I've tried using vim with the %!xxd -b but then it won't work with %!xxd -r. I know how to convert the file into binary, but I'm looking for a way to dynamically change it in this format and being able to save it.
Better yet would be if I could find a way to actually create a binary by coding purely in actual binary.
Any help would be appreciated :D
vim or gvim should work for you directly, without the xxd filter.
Open the file in (g)vim. Place your cursor on a character and type ga to see its character code in the status line. To insert character NNN, place your cursor where you want it, go in insert mode and type Ctrl-v and then the three digit decimal code value. Use Ctrl-v x HH to enter the character by its hexadecimal code.
Make sure your terminal is not set to use UTF8, because in UTF8, typing Ctrl-v 128 will in fact insert c280, the utf-8 encoding of character 128, instead of 80.
LC_ALL=C vim binary-file
is the easiest way to make sure you're doing binary character based editing in vim, but that might do weird things if your terminal is utf-8.
LC_ALL=C gvim binary-file
should open a stand-alone window with proper display.
FYI, if you did want to work in utf-8, Ctrl-v u HHHH is how to enter the Unicode character with Hex code point HHHH.
windows
open cmd.exe or notepad++ or whatever editor
enable numlock key
On laptops you need to use the function key or the blue / grey silver numbers above alphabet keys (using the numbers on the top line will not work as they map to different scan code.
press alt key + 255 will correspond to 0xff
press alt key + 254 will correspond to 0xfe
see below for a demo
C:\>copy con rawbin.bin
 ■²ⁿ√·∙⌂~}─^Z
^Z
1 file(s) copied.
C:\>xxd rawbin.bin
0000000: fffe fdfc fbfa f97f 7e7d c41a 0d0a ........~}....
C:\>

How to find which key is pressed, not which character it will be?

I need to find out which key was pressed, not what character it would be.
For example, I want after pressing 'a' a number such (1) create so I can map it to other languages. In common way we can find it is 'a' or we can have it's hash code, but is it possible to have char or hash code in a language and find out what char or hash code it would be in another language?
Attention some language have not the standard keyboard so pressing a key not mean a certain character.
There's no reason to do this in any language i've seen.
(besides the fact that you didn't specify in which language you are trying to achieve this)
All languages allow you to get the character code from a keypress.
If you know which encoding was used (UTF 8, Ascii, you name it), it's trivial to map the code to the actual character.
Assigning a different keyboard layout on OS level means that it no longer matters which keyboard layout you are using.
if you have a QWERTY keyboard, switch it to AZERTY and press the button where the q would be, you get an a, despite the letters on the keyboard still saying QWERTY.
If you are using a chinese keyboard, the characters no longer map to any western set, so the character codes will not match up with UTF8 or ASCII, but CP963 (or another chinese codepage, depending on several factors), which is so different there is no real way to translate it to UTF8 or ASCII.

Arabic: how to conveniently enter dagger-vowels (AKA miniature vowels) and alif-wasla with PC keyboard

I would like to enter dagger-alif, dagger-waw, and dagger-ya
(AKA miniature alif, miniature wow, and miniature ya) as well
as alif-wasla with a PC Arabic keyboard. These marks are used
to help the reader with pronounciation.
The dagger/miniature vowels typically appear over letters in textbooks
and dictionaries to show that a LONG vowel must be pronounced after
a consonant even though such long vowel does not appear after the consonant.
The miniature vowel is omitted from regular script such as in newspapers.
For example the word هٰذَا here appears with a miniature-alif over the
letter ه (and a fatha over the letter ذ) despite in regular script
the same word would be simply written as هذا.
The alif-wasla has a small mim in its initial position over the alif
indicating that the alif is silent and looks as follows: ٱ.
(this must not be confused with alif-madda which indicates
that a hamza followed by a long aa is to be pronounced and
is written with a tilda over an alif as follows: آ).
A picture of the IBM PC arabic keyboard layout can be found here:
http://en.wikipedia.org/wiki/Arabic_keyboard . The following
is a picture of a PC keyboard from DELL which was more or less
the Arabic PC keyboard I could find on the market to also display
arabic language symbols corresponding to shift pressed:
As you can see the sought diacritics are missing from the keyboard inputs.
These symbols are also partially described here:
http://en.wikipedia.org/wiki/Arabic_diacritics
The following link
http://www.fileformat.info/info/unicode/char/671/index.htm
shows that I can type alif-wasla as ALT01649 and
http://www.fileformat.info/info/unicode/char/0670/index.htm
shows that I can for instance type the miniature superscript aliph as ALT01648
but this only seems to work in MS Word.
But I cannot find a way to type these in LibreOffice. If anyone know
of some convenient manner of entering these other than cut and paste, which is what I
used above, then please let me know. Can I use for instance MSKLC or is there some
way of entering the missing symbols with Unicode shortcuts? Thanks.
The daggar alif is part of the Arabic typesetting font symbols. That's a free font which is you can find downloadable. Then you type the letter you want... for example the ha of haadhaa , set the cursor on that letter, and use INSERT.. SYMBOL and you will find that alif with other diacritics --- here's an example.
هٰذا
Peace
Yes, its not available on keyboard on Windows or Mac. It's a symbol to be inserted. If not on MS Word, other quick way is to google using the simple word and copy past the rich text result. HTH.
Update: On Mac, its available by using Alt + H in Arabic keyboard mode
Not all characters are accessible by keyboards (by default). To be able to insert special character conveniently from your keyboard you need to create a custom keyboard layout. Assuming you're on windows, use The Microsoft Keyboard Layout Creator.
In LibreOffice (and Microsoft Word), you can type the Unicode code first then press Alt+X to transform it into the actual character/glyph etc.
For example, writing هٰذَا would be writing ه then typing the superscript alef Unicode code 0670 then press Alt+X and it will become هٰ then type the rest ذَا.
You can just google the unicode code for certain characters, search here or see the full Arabic characters chart from the official PDF.
Ref:
Unicode Input on Wikipedia
Unicode charts

What alternatives are there for easier access to {, [, \ in non-US keyboard mappings?

All my life as a developer I was annoyed that on german keyboards some common programming characters are mapped to very awkward combinations:
[ = AltGr + 8
] = AltGr + 9
{ = AltGr + 7
} = AltGr + 0
\ = AltGr + ß
As I'm touch typing with 10 fingers, I regularly have to leave the standard finger position to type the above characters. While I've somehow got used to it, it still makes me shiver whenever I have to type lengthy combinations of the above symbols.
There are suggestions to use US keyboard layout instead but this again makes it very hard to type the umlauts äöüÄÖÜß.
So i wonder: What smart solutions have other non-english developers come up with to avoid these awkward shortcuts?
I'm primarily interested in workarounds for Windows. But as a vim user I'd also like to hear vim-only solutions.
Not an actual workaround, but an alternative solution that works well for me: use the US keyboard layout for programming.
Vim's choice of keys is closely related to the US keyboard layout. On a US keyboard,
/ is to ? (Shift/) what n is to N;
/ is extremely convenient to reach, and unshifted;
{ and } are in the same place as [ and ], they differ only in shifting;
+ "line down" and - "line up" are adjacent;
: is on the home row;
< and > are neighbours;
all characters commonly used in programming are accessible with Shift, there is never any need for AltGr or CtrlShift etc. combos.
The last point is especially important. Vim's command language is about eliminating modifier keys so having to use only the Shift modifier is good.
At some point I realized how my keyboard layout held me back. I switched to the US keyboard layout for programming only. I have been doing all my programming and terminal hacking in the past few years on a US layout and I'm very happy with it. Whenever I need to write an email or make notes I can just switch back. The keyboard layout is like a representation of the mindset I'm currently in: US for programming, native for other things.
I say, give it a try.
Not only for that reason, but because of the better layout, I learned the dvorak for programmers layout. I don't recommend you to learn the whole layout - it took me monthes to reach my old qwertz-speed.
But the sticking point why this layout is explicitly recommended for programmers is the alignment of the numbers-row. The numbers are in shift-position whereas the symbols are in first position (but in a better alignment as in standard-qwertz and even qwerty). So for example if I hit the qwertz-5 I get ( instead, 8 is ) and so on.
Here you can see the whole layout.
You also have to leave the "normal" keys and reach the numbers-row, but if you train it a bit, it feels really awesome inside vim and while programming.
So one option is to customize your standard-qwertz layout (maybe using the Microsoft Keyboard Layout Creator or any other tool) to get the special keys better positioned, like for example in the dvorak for programmers layout.
Another option is using qwerty and remapping the german umlauts to AltGr+a for ä, AltGr+s for ß and so on. That's what I also did with dvorak.
It's not that handy as on standard qwertz, but those characters don't occure that often, I think.

Key Codes for QWERTY phones j2me

I'm currently doing a j2me project, and I am wondering what key code I will use for the keylistener when I press letters like A, B, C, etc?
I'm deploying the j2me in a QWERTY phone - SAMSUNG CH#T 223.
On Canvas.keyPressed the keyCode parameter will hold the Unicode value of the corresponding character of the pressed key.
Depending on the keyboard mode the value might vary. For example, the same key might generate 'd', 'D' or '4'.
The modes are: normal (lower case letters), shift/caps (high case letters) and alt (numbers and symbols).

Resources