Printing from Vim is not like any other application since it has both console (Vim) and desktop (GVim) versions running off the same backend. On Linux, it does not show a Print Dialog, where I can pick the printer and other print options like number of pages per side, orientation and duplex. So, I print to a PDF file, open it in a PDF viewer and print from there.
To print to a PDF file from Vim:
:hardcopy > out.pdf
To print to a PS file from Vim:
:hardcopy > out.ps
Tried with: Vim 7.4 and Ubuntu 14.04
Redshift is an alternative to F.Lux for Linux. To install the commandline tool and its status icon:
$ sudo add-apt-repository ppa:jonls/redshift-ppa
$ sudo apt-get update
$ sudo apt-get install redshift redshift-gtk
redshift at the commandline. Using the geoclue framework it figures out the latitude-longitude of your location and adjusts the color temperature of your display.
If you prefer having a status icon, then run Redshift from the Dash. Clicking the status icon gives you the options of having Redshift start whenever you login and to temporarily turn it off.
Tried with: Redshift 1.8 and Ubuntu 14.04
One of the programs I loved the most on Windows was F.Lux. It would adjust the whiteness of the display to match the time of the day. Research studies have shown how this type of natural whiteness can help with your energy, mood and sleep.
I was glad to see that there is a F.Lux version for Linux here. However, it does not seem to work on Ubuntu 14.04. The display does not change no matter what longitude-latitude is set and the Preferences option does not open up at all.
Tried with: Ubuntu 14.04
If you are new to programming, then having to write your first OpenCV program, to build it and run it can be intimidating and the process is a literal minefield.
I have created a simple C++ project that helps you get started with OpenCV on Ubuntu. I have used CMake to build the project since that makes it easier to add new source files and libraries. This simple program reads an image file and displays it. Everything you need to get started is included. Get the project at Github here. Remember to read the readme.txt file :-)
C++11 introduced emplace operations on many of the STL containers. For example, vector now has
emplace_back operation along with the old
Emplace operation is provided for convenience, to make writing code in C++ a bit more easier. It should be used when you want to add an object by constructing at the point of calling the emplace operation. For example, you may want to construct the object using its default constructor and then push it into the container. Or you may want to construct it using some parameters on the spot. The older alternative for this involved the construction of a temporary object and then copying it into the container.
The code below shows a simple example of these scenarios:
§184.108.40.206 in The C++ Programming Language book has a handy figure that shows the hierarchy of standard exceptions declared in the
stdexcept header file. For easy reference, I have reproduced it here using a humble ASCII tree:
│ └── bad_array_new_length
│ ├── domain_error
│ ├── future_error
│ ├── invalid_argument
│ ├── length_error
│ └── out_of_range
│ └── ios_base::failure
C++11 has full support for a smart pointer called
std::shared_ptr. Smart pointers keep track of how many references are pointing to a given object. When that reference count goes to zero, the object is destroyed automatically by calling its destructor.
std::shared_ptr is a smart pointer that allows multiple references to be created to the same object.
To quickly understand how to use this smart pointer I created this sample C++ code:
- §12.1: C++ Primer (5th Edition) by Lippman et al.
- §5.2.1, §34.3.2: The C++ Programming Language (4th Edition) by Stroustrup
Tried with: GCC 4.9.1 and Ubuntu 14.04