Under-used Keyboard Shortcuts for Text Editing

Most people know about the basic windows shortcuts for Cut, Copy and Paste (right? Smile with tongue out), but there are a few more shortcuts that I consider are invaluable when writing text. And I was surprised that most people don’t really use them. I am talking about the Home and End keys and their respective combinations with Ctrl and/or Shift keys.

  • Home: Takes the cursor to the beginning of the current line.
  • End: Takes the cursor to the end of the current line (after the last character in the line).
  • Ctrl + Home: Takes the cursor to the very beginning of the active text field/document.
  • Ctrl + End: Takes the cursor to the very end of the active text field/document.
  • Shift + Home/End/Right/Left/Up/Down: Selects all the text between the initial cursor position and the final cursor position.
  • Ctrl + A: Selects everything in the active text field.

All coders and pretty much everyone who types a lot of text in your everyday life, for the love of God, drill these shortcuts into your minds! I promise your productivity will increase at least by 30%.  Here are a few examples of usages:

  1. Example 1 (Ctrl + A): Say you want to post a rather long status update in Facebook and twitter. Type out your message, hit Ctrl + A, then Ctrl + C. Then hit the post button in Facebook, go to Twitter, click on the “What’s New” text box, press Ctrl + V and post it.
  2. Example 2 (Shift + Home): Say you’ve written a complex printf() statement in C to display some information and you have to repeat the same output with a few changes about 5 times. Here’s what you do: Type out the first printf() statement. Your cursor will be at the end of the line right. Now press Shift + Home. The cursor will move to the beginning of the line because of the Home key, but it will also select all the text along the way because of the Shift key. Now copy and paste it as many times as you want. You have thus successfully avoided moving your hand to the mouse, moving the cursor and selecting the text by mouse movement. You’ve achieved all that in just 2 keystrokes: Shift + Home, without taking your hand off the keyboard. Note that you can use Shift with the arrow keys to select text letter by letter.

Aside from these shortcuts, I implore you to familiarize yourself with the keyboard shortcuts of the programs you use the most. It will drastically reduce the time needed to perform simple but repetitive actions. Just use Google, because as they say, Google is your friend! And if you don’t listen, then this Smile with tongue out



The odd details of C++

I’m revisiting C++ with the intention of figuring out the details. This post will contain various little things and questions and pretty much anything. I intend this list to be “something that you won’t typically find in most books”, a list of the details of the C++ language. Not to mention, this page will be changing constantly as I add new information or get answers to questions listed.


(?) – Still needs confirmation, some info missing.

And the list begins:

  1. Structured vs. Object oriented programming: Structured programming is task-centric where as object oriented programming is object-centric. For example, in structured approach, when a task is to be performed, we first think of subroutines and then the data structures. In OO approach, we first think of the objects needed to perform the task, then we design the details of the objects and their behaviour. C is a structured language, C++ is an object oriented language.
  2. (?) Default values for data types in C++: When variables are declared and not initialized, what are their values? I believe number types will be set to 0, but it might depend on the compiler. For example, C-Free 4 gave garbage values to int, float and char variables. But when run multiple times, the value for int kept changing but the values for float and char remained the same. Confirm.
  3. (?) String Mutability: Need to explore string mutability, even by using pointers. For example, when I have a char pointer, can I still use it when I change the string length?Also need to explore String class capabilities.
  4. Static variables and functions: Figure out 1.Where static variables can be a.declared b.initialized and experiment on their scope.