How do I check the key "~" in LWJGL? I tried typeing "Keyboard.KEY_WAVE" but that didn't work. Any ideas? Also I'm using Slick2D with it, does that have support for the key?
As seen in this link, The key you are looking for is called "Keyboard.KEY_GRAVE", so yes, it does indeed have support for that key.
Related
Is it possible to pass a longer caption through the camera or is it limited to one word?
I've seen this example:
instagram://camera?caption=hello
But could I use something like this?
instagram://camera?caption=hello%20world
Yes this should work fine for you.
The documentation hasn't really been published very well but you can see here for people URL encoding
I recently understood that if I write characters inside /dev/tty it will simulate key presses with a keyboard.
I was wondering if I can simulate holding a key or a key combination.
What I'm looking for is to simulate the Alt + Tab to switch between open applications.
I'm not looking for alternatives. I am practising to learn how can I simulate a physical key press on a keyboard.
Is it possible to simulate key combinations (like Alt + Tab)?
Also, how can I press the Enter key?
It seems it's not '\n' or '\r' or "\r\n" or "\n\r".
The reason I'm looking for the Enter key is that I want do a "sudo" command in the terminal and when it prompts for a password, I use the /dev/tty to answer that, but it seems standard input or standard output (using "-S" option with sudo) don't work.
Is there anything I'm doing wrong?
Are there some libraries I should be looking for (like Expect)? Or is what I'm trying to do impossible?
I am using C++. All I want to do is to try to simulate a physical key press on my keyboard. The OS is Ubuntu 13.04 (Raring Ringtail). (Just as a practise)
But I have two goals:
To create a program which switches between applications using Alt + Tab.
interact with a Linux terminal.
I've found two solutions:
Write characters/codeASCII s of the corresponding keys to /dev/tty
Write characters/codeASCII s of the corresponding keys to standard output and/or standard input
But none of them worked. Is what I'm doing correct or not?
X does not read keystrokes from /dev/tty. If you want to simulate keystrokes in X, you’ll need to send them another way. If you’re writing a shell script, xdotool is your friend; if you’re writing C, though, you’ll probably want to use libxdo, the library underlying xdotool. If you’re looking for something a bit more low-level, you might be interested in the XCB Test API, on which both xdotool and libxdo rely.
Unless you can provide more information about your experience with sudo, I don’t think anybody will be able to answer your second question. sudo -S is definitely the intended mechanism for programmatically providing a password to sudo.
In the Getting Started page, we're promised kittenish goodness from Flickr. Putting the extension together according to the instructions, no kittenish goodness materializes. Instead, the popup window shows a small blank rectangular bar, devoid of anything fuzzy or cute.
Why?
(I'm asking this question with the intent to answer it, because I couldn't find any other way to report the mistake.)
As on 18-Jun-2014, the fix mentioned by Emerson seems to be taken care of in the sample downloads.
If you are still not able to see the images in the popup, you should consider applying for a Flickr API Key
And replace the existing key with the key that you generated in line number 25 of poupup.js file.
There's a bug in the popup.js file on line 40. The reference to kittensOnFlickr_ should be searchOnFlickr_ instead. Fix and reload, and tada, kitteh.
8/1/2014 - The code on line has indeed been fixed, but this tutorial still wouldn't work for me until I pasted my own API key.
HOWEVER
Make sure you don't remove the trailing ampersand (the &) at the end of the pasted api key. The ampersand needs to be there or your code still won't work!
I'm writing a game in assembly, and I need to check if a key was pressed.
So, how is kbhit implemented in Linux?
Thanks.
Google turned up a kbhit implementation for Linux in C: http://cboard.cprogramming.com/c-programming/63166-kbhit-linux.html
You could either compile this as is and call it from your assembly code, or if you really want to you could convert it to assembly.
I assume that you want also key releases. I also assume you are on the console (for X, XKeyEvent has enough info).
First, you have to put your terminal (i.e: console) in non-canonical or in raw mode. If you don't do this, you won't see any input until there is a line delimiter or EOF on input. See my answer to your previous question.
Then, to get key releases, you want to set the keyboard to RAW or MEDIUMRAW mode (this has nothing to do with terminal raw mode, this is very Linux and console specific, see console_ioctl(4)). Don't forget to set the keyboard back to its original mode before exiting.
There's a nice article about this here.
after doing
$ cat /dev/input/by-path/pci-0000:00:02.0-usb-0:2:1.0-event-kbd > ~/test_kbd
as root, I got a bunch of binary codes (which was expected). Now, I wanted to know how can I interpret this binary code to figure out what key has been pressed? What format is the output in? and is there a reference I could look at that would tell me what key each binary code stands for?
Thanks
I would guess that they are scan codes. This page lists the make and break codes of keys used by modern keyboards. For more information on PS/2 keyboard programming, see Adam Chapweske's resources.
This file provides keyboard events (in binary format).
Use
evtest /dev/input/by-path/pci-0000:00:02.0-usb-0:2:1.0-event-kbd
to get some information.