The iPhone and the iPad (as also the Motorola Droid and all the other Smartphones with their fancy virtual keyboards on the touch screen) do not support all possible keys in their virtual keyboards. A case in point is the backtick character. This makes it a problem when you need to enter the character in a text entry field of some app or web-site.
A simple but annoying way to deal with this is to do a web search for that character by name, find the character on some web-site and copy and paste it in to whatever text entry field that needs it. For your convenience I’ve provided this character on a separate line at the top of this post (to help work with the limitations of cut-n-paste on the iPhone/iPad).
Note that some of the virtual keys bring up a pop-up with additional keys supported when you keep you finger pressed on it.
Though in general it is true that you should simply leave C code optimization to the compiler, it sometimes is useful to provide hints to the compiler. This is because when optimizing the compiler has to make a few basic global assumptions so as to generate correct code in all situations, but these assumptions may not be true in your specific code.
A case in point is providing aliasing hints through the use of the C99 restrict keyword or the GCC extension __restrict__. See this excellent article with an easy example that will help you understand aliasing and how to deal with it.
Something from the New York Times…
I’d finally managed to exile the voices in my head that told me my
personal happiness was only as good as my outward success, rooted in
things that were often outside my control.
I use the excellent ConnectBot SSH client on my Motorola Droid to SSH into Linux/Unix boxen. Subsequently, I make the mistake of using Vim. Once I enter insert mode in Vim, I realize that the Droid keyboard (and probably every other smartphone keyboard) doesn’t have any key representing the Escape key (that is used in Vim to exit insert mode). There isn’t even a key, AFAIK, representing Control. After being stumped by this multiple times, I now do the following every time before I start editing with Vim when connected in via my Droid:
:imap qq <Esc>
Note that you have to do this *before* you enter insert mode (remember you want a key-sequence to be able to exit insert mode). Once set, I can enter ‘q’ two times in succession to simulate the Escape key action.
- In normal mode, press the key sequence q followed by a. This starts the recording mode (and you should see the word “recording” on the mode-line at the bottom).
- Then enter or exit the insert-mode as many times as you wish, editing text using the keyboard. All the time, vim will keep recording all your keystrokes.
- Finally exit insert-mode (get into normal mode) and then press q. This will stop recording your keystrokes.
- Playback the recorded macro in normal mode, anytime, using the key-sequence @ followed by a. This will playback all the edits you made earlier. Once you’ve referred to a the first time, you can subsequently use @ followed by @ (a double @) to repeat the operation.
Instead of the key a following q when starting recording mode, you can really use any one of the keys 0 to 9 or a to z. The second key is basically a reference to a ‘register’ that sort of names your macro. You can record multiple different macros and play them back by recording to each one of these ‘registers’. The key you use on playback after the @ refers to the appropriate macro recorded.
Recording and playback of keystrokes in Emacs is explained here.
- Use C-x ( to start the macro (start recording keystrokes)
- …Perform whatever keyboard actions…
- Use C-x ) to stop the macro (stop recording keystrokes)
- Playback the recorded macro anytime using C-x e
You can also assign different hot-keys for convenience:
(global-set-key [f1] 'start-kbd-macro)
(global-set-key [f2] 'end-kbd-macro)
(global-set-key [f3] 'call-last-kbd-macro)
Check out the KeyboardMacros Emacs Wiki page for more in-depth info on Emacs Keyboard Macros.
Text files created on Microsoft Windows usually use a combination of Carriage-Return and New-Line (CR-LF or \r\n) to separate lines.
When such text files are opened in Windows using Vim (usually in the Unix mode), the Carriage-Return’s will show up in the file as ^M (CTRL-M) and can be annoying specially when you are going through long text files. Note that though the ^M has two characters, Vim treats them as a single visible control character.
You can delete the ^M’s by moving the cursor over the caret and pressing ‘x’ in the command mode. Alternately, you can use Vim’s substitute command (used for search and replace) to remove all the ^M (CTRL-M) characters in one fell swoop.
To do the substitute action, in command mode, press “:” (colon, without the quotes) to start entering text on the mode-line at the bottom of the window.
Then, enter “1,$s/^M//g” (without the double-quotes) on the mode-line and press Enter. Presto, all your ^M’s are gone.
Do not enter the ^M in the above as a ‘^’ (caret) followed by an ‘M’. Instead, when it is time to enter this character, first press CTRL-Q to enter a mode where control characters can be keyed in and then press CTRL-M. This will actually insert the ^M (CTRL-M) as a special control character with the caret and the M (and which is treated like a single character though visibly it’s two characters).
To summarize, in command mode, type in the following
“How much did you have to drink?”…”More than a little, less than enough”. Dialogue on Psych on USA. Nice. Either that or I am sleepy. It’s 11.22pm.
Read this blog post by David Wong. Fantastic insight –you may not agree entirely, it might seem like link-bait to market his book, etc. but fantastic insight nevertheless. Makes you think.
Recently I was trying to figure out if I could connect my old laptop which has VGA output to an Apple Cinema Display from a couple of years back that has a DVI-D connector/cable and I found out that you really cannot unless you buy a VGA-to-DVI-D converter.
Such a converter is not a simple adapter. Instead it is an analog-to-digital signal converter. Something like this.
Also from what I found on the Internet — you really want a very good converter since the digital signal requirements are very stringent. Unfortunately such converters are expensive $300 and up — for that price you can simply buy a new LCD monitor compatible with your laptop.