vim: avoid selecting and copying line number
You can display line numbers in vi using the command :set nu :set number Before enabling mouse option But this creates problems when you use mouse to select text and copy it. This problem can be...
View ArticleC++: Initializing parent class member variables in derived class constructor
Usually we initialize member variables in constructor using initialization list. class Base { public: int i; explicit Base(int _i) : i(_i) { //other initialization code } }; But we cannot initialize...
View ArticleC++: shared_ptr implementation for fun
Here is the code for custom shared_ptr like class. It is neither correct nor performs well. I just wrote it for fun and educational purpose. Note: Feel free to let me know if you think it should be...
View ArticleGolang: Cast array/slice of a type to array/slice of interface
Suppose you have this struct: type ( Type struct { X int } ) You want to convert this to an interface: type ( Interface interface { } ) You would do that in go in the following way: t := Type{5} var i...
View ArticleDart: Getting elements to accept drops using HTML5 DnD
Using HTML5 Drag-n-Drop could be little bit tricky, because it doesn’t work out of the box. If you want to listen to on-mouse-down or on-key-down events on an element, you would do it like this:...
View ArticleRecord memory and processor usage of a particular process using top
This small snippet of code will help you monitor the memory and processor usage of a process over time in the background and redirect the output to a file. You can later use the file to analyze its...
View ArticleC: declaring multipe pointer variables in same declaration statement
First thing first, never declare multiple pointer variables in same declaration statement. Don’t mix declaration of pointer and non-pointer variables in same line. Following this will save you a lot of...
View ArticleC: Initialize multiple variables in same declaration statement
First thing first, never initialize nor declare multiple variables on the same line. It makes things very difficult to understand. But if you have to, this post will help you. Initializing multiple...
View Articleboot2docker: Add volume from windows host to the docker container
boot2docker is great. It allows us to develop using docker even on Windows PCs. One feature that is totally awesome is its ability to share folders on windows host with boot2docker virtual box image....
View ArticleQt Creator error: Cannot retrieve debugging output
Qt Creator allows you to open and run multiple instances of Qt Creator at the same time. But there is a small glitch. If you are running multiple instances of Qt Creator, only the first instance...
View Article
More Pages to Explore .....