Add menu entry in ubuntu

Sometimes, you might want to download a program without installing it system wide. Or, you might not have an installer, but still, you would like to have a shortcut in the application menu.

To achieve that, here is what needed to be done:

  1. Create a desktop entry of the application you want to insert
  2. Copy this entry to ~/.local/share/applications.

The second part is pretty simple. but how to create a desktop entry file? Here:

Desktop entries are actually simple text file that follow some guidelines.

  1. The file postfix is "desktop" (same as txt for text file and so on)
  2. The file contains several key-value pairs, most important are Exec, Terminal and probably Icon.
  3. You don't have to create it from scratch. Here is a desktop entry for robomongo I've created. Note that you need to remove the txt postfix part for it to work. You should change the other parameters as well (Name for example or comment).

If you wish to copy a shortcut that  was installed through a debian package to your desktop, these are usually located in /usr/share/applications.

 

 

Downloads:

  1. robomongo.desktop

using mongoDB with C++

While it is very easy to connect to mongo via node.js, I wanted to write an article about using C++  to connect to this great DB. This is done under ubuntu.

Ingredients (using apt-get here will do)

  1. git
  2. scons
  3. build-utils
  4. openssl
  5. libboost1.54-all-dev (or 55, or whatever going to be the version when you read it)
Compile the driver

Don't install from repo; Drivers should be compiled and it's actually pretty easy.

  1. create the directory in which you want the driver to reside.
  2. clone this repository: git clone git@github.com:mongodb/mongo-cxx-driver.git
  3. get into the folder created by git
  4. run scons --prefix=$HOME/mongo-client-install --ssl install  to build the target. (if you are getting scons error, you are not in the folder, or you didn't install the entire list above). Let me clear this command as you run it: it will build and install from wherever you are now, to a new location, which is your home/mongo-client-install. You might wanna change that later on, but for now, this is fine.
  5. You can now use your favorite IDE to create a project to use with mongo. in your IDE, make sure you don't have any residues of old installations. If you do, remove them.
  6. make sure you are using paths to the include folder, path to the library and the library you created.
  7. more libraries you will need (you might need to adjust the names/path, under ubuntu64 this should be fine):

    1. /usr/lib/x86_64-linux-gnu/libcrypto.so
    2. /usr/lib/x86_64-linux-gnu/libssl.so
    3. /usr/lib/x86_64-linux-gnu/libboost_regex.so
  8. That's all! You are now ready to write your first program.

Test program can be found here: https://github.com/talreg/mongoclient

 

Updates:

On ubuntu 1604, you'll have gcc 5.x. the scons command should be :scons –ssl –prefix=/programs/mongocpp –c++11=on CCFLAGS="-Wno-unused-variable -Wno-maybe-uninitialized"

where prefix is where you want to driver files to be.