Quantcast
Channel: GeekWentFreak
Browsing all 10 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

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 Article



C++: 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 Article

C++: 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 Article

Golang: 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 Article

Dart: 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 Article


Record 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 Article

C: 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 Article

C: 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 Article


boot2docker: 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 Article


Qt 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
Browsing all 10 articles
Browse latest View live




Latest Images