Change Keyboard Layout on Ubuntu Server Permanently

When working on Ubuntu Servers, sometimes the defined keyboard layout is not aligned with the physical keyboard one’s using.

In order to permanently change it, just execute the following two commands.

First, configure the keyboard:

sudo dpkg-reconfigure keyboard-configuration

Test the keyboard, in particular the characters like slash, asterisk, etc.. If things are not ok, just configure it again with different options.

Next, configure the console:

sudo dpkg-reconfigure console-setup

And that’s it.

If you want to configure the size of your TTY, i. e. the text console resolution, check ChangeTTYResolution.

Debug in R

Development in R usually is performed using JGR, or Tinn-R, editors and the R console.
Since these are no “state of the art” IDEs for R development, this is usually the best one can have.

So, how does one debug a program in R?
The usual answer is classical: with print.
But the correct answer is: using the browser() function.

The browser() function works as a break point marker.
Just write browser() where a break point is needed and run the program.
When browser() is interpreted, the program hang its execution and a new command line prompt will be provided, Browse[1]>.
This command line allows one to interact with the variables available in the scope where the program is temporary hanged.
This debug command line accepts the following debug commands:

  • n: next, advances to the next line, allows step-by-step.
  • c: continue, continues the execution, until the program ends or a new browser() function is found.
  • traceback(), shows the stack trace function call.
  • Q: quit, stop the program execution.

It does not look as cool as using the mouse to insert a break point on a line, but it works.