Multiple versions of Python

Do you have multiple versions of Python to be installed? Do you have additional python packages that must be used in separate versions of Python installed on the system?

Use Virtual Environments!

Today we will see how to setup 2 different versions of Python environment.

  • Install python

    sudo apt install python

  • Install pip (python’s package management system):

    sudo apt install python-pip

  • Upgrade pip:

    pip install –upgrade pip

  • Install virtualenvwrapper by running this command:

    pip install virtualenvwrapper

  • Before we can create a virtualenv, we need to run the virtualenvwrapper script. We can find the location of virtualenvwrapper script by running the following command:

    which virtualenvwrapper.sh

  • Execute the script as:

    source ~/.local/bin/virtualenvwrapper.sh

  • Make a virtual environment with following command

    mkvirtualenv -p <location of python3.5> <name_of_env>

    For example for creating virtual env for python 3.5 named ‘venv35’, run:

    mkvirtualenv -p python3.5 venv35

    It will take activate the virtualenv for us directly. To deactivate it, enter:

    deactivate

  • Similarly, we can create another environment for python 2.7 named ‘venv27’, run:

    mkvirtualenv -p python2.7 venv27

  • To run, any environment, run the command:

    workon <env name>

    For exaemple, to run venv27, use:

    workon venv27

Enjoy!

Advertisements

VirtualBox on Windows (Host)

Hi there!

In this post, we will setup VirtualBox on Windows with Linux as a Guest OS. Follow the steps to begin:

Downloading and Installing VirtualBox

Download the virtual box setup from here. Under VirtualBox binaries, select package for Windows Hosts. Also, download VirtualBox Extension Pack, we will need it later for when we setup our Guest OS.

Also we need to download our favorite Linux distro. I am using Ubuntu latest version (as of this date), you can get it from here.

We will run VB setup wizard and install VirtualBox on our drive (you can specify the location where you want to install it).

Install Extension Pack

Run VirtualBox for the first time. Go to File > Preferences or use shortcut key (Ctrl + G). In the Preferences dialog box, go to Extensions.

Add the extension pack that we downloaded earlier. We can do so by either Right Click > Add Package or pressing the button (Add New Package) on the right hand side of the window.

Once weagree to the terms of conditions, we’ll able to install the extension pack.

Press Ok to close the Preferences dialog box.

Creating a New Virtual Machine

Click on New button to create a new virtual machine (VM). It will open up a wizard to create a VM. Enter the name for our VM (I’m using ‘Ubuntu 16.04.2’ same as the version of my Ubuntu). Click Next.

Select the amount of RAM we want to assign to this VM. I’ve assigned 8GB as I have 32GB but you can assign as per your preference. Click Next.

It will ask us whether we want to add virtual hard disk to this machine or not. We will make sure to select ‘Create a virtual hard disk now‘ option before we click Create button. Select the size of the hard disk and then we are done.

Installing OS on VM

Right click on the VM we just created and select Settings. In General Settings, go to Advanced tab, change ‘Shared Clipboard‘ and ‘Drag’n’Drop‘ to Bidirectional.

In Storage settings, we can see that under Controller: IDE it shows Empty. Select this Empty option and we will see that Attributes on the right hand side changes. Click on the CD icon next to the Optical Drive option and select the Choose Virtual Optical Disk File option to choose Ubuntu Iso we downloaded.

Check Live CD/DVD option below that as well. And then Press Ok to close the Settings.

Start the VM by right clicking and selecting the Start > Normal Start.

Now we can install Ubuntu on this Machine.

Setting things in Ubuntu (Guest)

Once we have installed Ubuntu on our VM, we will start it. Now go to Devices > Insert Guest Additions CD Image. It will ask to run, then enter your password to install it. Then restart Ubuntu after it is installed.

Go to Devices > Shared Folders > Shared Folders Settings. Right click and then select Add Shared Folder. Select the folder path that we want to share. Make sure you select Auto mount and Make Permanent and press Ok.

Shut down the Ubuntu OS.

Restart your VM, and voila your system is ready with Shared Folder

Note: If you get Permission denied error on accessing the shared folder, just add your username to vboxsf group using command:
sudo adduser <username> vboxsf

Disabling Ads in uTorrent

uTorrent is a lightweight torrent client for Windows, Mac, Android and Linux. The application is awesome but sometimes it annoys you with the the sponsored ads that keep showing on the interface.

ads

Now most of us want a clean interface and not boggled down by the ads. So here is what you can do to disable these ads.

  • Go to Preferences in the Options Menu. Or simply press Ctrl + P. This will open up the Preferences dialog box.
  • Go to Advanced tab (choose from left hand side hierarchy) as shown in the following figure. You will see the list of options available in this.preferences
  • Now, enter “offers” in the Filter Tab without the quotes and you will see the list of options that has ‘offers’ keyword included in them.
  • Scroll down and look for the “offers.left_rail_offer_enabled“. You will see that its value is true. search1
  • We want to disable this option so change its value to false and press OK.
  • Similarly, disable “gui.show_plus_upsell” as well. And if you want to close the top ad bar, disable “offers.sponsored_torrent_offer_enabled“.
  • Restart uTorrent.

And voila you can see that the ad box has disappeared. result

Enjoy! 🙂

Setting Up Development Environment for LMMS: QtCreator

This guide is for the new developers who want to begin developing for LMMS.

This tutorial assumes that you have already built/compiled LMMS on your system(presumed Linux but the steps could be applied for other OS albeit not as it is), and if not please follow the guide: Compiling LMMS

We will work with QtCreator and learn how to setup our Development Environment. Download the QtCreator from the official website.

Once you have installed QtCreator, we are ready to move forward.

  1. Launch QtCreator.
  2. Click on File>Open File or Project.
  3. Now browse to your ‘lmms’ directory and select on the file ‘CMakeLists.txt’, eg: /home/username/lmms/CMakeLists.txt
  4. A dialog box may appear asking you to specify the build directory, in here specify the folder ‘build’ in your ‘lmms’ directory that was created while compiling LMMS, eg: /home/username/lmms/build
  5. The Project will open, and if not it may ask for the executable file which you can specify as written below.
  6. Open ‘Options’ under Tools in the Menu Bar.
  7. In this dialog box, select ‘Build & Run’, where you can specify the build directory once again if you haven’t already done so.
  8. Under CMake tab, browse for the executable. Enter the path for the executable: /home/username/lmms/target/bin/lmms.

Once the project is opened and linked, you can build and run the project as you please.

Happy Development.

OpenSceneGraph on Linux

Welcome to this tutorial for running OpenSceneGraph on Linux (Debian based) machine. I’m currently using Linux Mint 15 but it would be quite easy to follow along on any other Debian based OS. Let’s get started shall we!

Brief Introduction
The OpenSceneGraph is an open source high performance 3D graphics toolkit. It is a real-time graphics middle-ware used by application developers in fields that range from visual simulation (flight, marine, vehicle, space simulator) to virtual and augmented reality, to medical and scientific visualisation, to education and games. Written entirely in Standard C++ and OpenGL it runs on all Windows platforms, OSX, GNU/Linux, IRIX, Solaris, HP-Ux, AIX and FreeBSD operating systems.

You can get more information at the official website: OpenSceneGraph

Downloading Source
You can download the openscenegraph source from one the following:

  1. Stable Release Section
  2. Code Repositories
  3. Developer Releases

Download the .zip file and extract its contents in OpenSceneGraph folder in your home.

Downloading the Dependencies
You need to download the necessary dependencies to be able to compile OpenSceneGraph.

  • Run the following command to download and install the necessary dependencies.

    apt-get build-dep openscenegraph

  • Or you can download .7z file from this page. And merge the files from this to the OpenSceneGraph folder in your home, for example, copy files from bin folder from .7z file to the bin folder in OpenSceneGraph folder. Do this for all the folders in .7z file.

The 2nd method is recommended for building.

CMake Tool
Make sure you have cmake tool installed on your system in order to compile OpenSceneGraph. If not, follow steps on their website.

Downloading the Data Resources
OpenSceneGraph standard dataset is required for use the with openscenegraph-examples. You can download it from this page.
Extract the contents of .zip file in the OpenSceneGraph-Data folder in your home.

Compiling
Now it’s time to compile. Run these commands in your terminal:

cd OpenSceneGraph
./configure
make
sudo make install

Running the Examples
Now our OpenSceneGraph has been built/compiled, its time to check it by running examples. But before we do that we need to place the location where it was installed on the system paths environmental variables. Edit your .bashrc file, add following lines in it:

export PATH=${PATH}:/home/myaccount/OpenSceneGraph/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/myaccount/OpenSceneGraph/lib
export OSG_FILE_PATH=/home/myaccount/OpenSceneGraph-Data:/home/myaccount/OpenSceneGraph-Data/Images

Replace myaccount with your useraccount name.

Now we need to build the examples. Use following commands for building:

cd OpenSceneGraph
cmake -DBUILD_OSG_EXAMPLES=1

After the examples has been built you can run them, still in OpenSceneGraph folder, use following command:

sh ./runexamples.bat

Press Escape key to move to the next example.

That’s it! Enjoy OSG!

Connect to Wi-Fi Network through Ubuntu Terminal

Lot many people end up in a situation where they want to use internet while in console mode. It’s not that difficult task to connect to the Wi-Fi from the terminal.
There are some simple steps that you need to follow.

  1. Open the terminal.
  2. Type ifconfig wlan0 and press Enter. You will not see any output in the terminal, as this command just turns your wireless card on. Most wireless cards are designated wlan0. If yours has a different designation, use that instead.
  3. Type iwconfig wlan0 essid name key password and press Enter. Replace name with the actual network name, and replace password with the actual security key for the network. If your wireless network does not require a security key, do not enter key password.
    Note: If you want to type the ASCII password, you would use iwconfig wlan0 essid name key s:password.
  4. Type dhclient wlan0 and press Enter to obtain an IP address and connect to the WiFi network.

Enjoy!

Get LMMS on Ubuntu

Lmms_logo

LMMS is a free cross-platform software which allows you to produce music with your computer. A great DAW compose your own piece of music.
It covers creating melodies and beats, synthesizing and mixing sounds and arranging samples. You can have fun with your MIDI keyboard and much more – all in a user-friendly and modern interface. Furthermore LMMS comes with many ready-to-use instrument and effect plugins, presets and samples.

Downloading from Ubuntu Software Center:

  • Open your Ubuntu Software Center.
  • Search for LMMS in the search box.
  • Select the Linux MultiMedia Software(LMMS).
  • Click on Install option.

Compiling from source:

  • Download the source package from here.
  • Extract the file where you want to install LMMS.
  • Open your terminal and traverse(using ‘cd’ command) to the location where you extracted in the previous step.
  • Run the following commands:

sudo apt-get build-dep lmms
mkdir build
cd build
cmake ../
make
sudo make install

Note: Make sure you have latest cmake installed.

If even after installing the LMMS, you can’t find the menu item then do as following:

  • Create an new text file in home folder and name it ‘lmms.desktop’.
  • Run in terminal

gedit ~/lmms.desktop

  • Copy and paste the following content in the file and save it:

[Desktop Entry]
Name=Linux MultiMedia Studio
GenericName=music production suite
GenericName[ca]=Programari de producció musical
GenericName[de]=Software zur Musik-Produktion
Comment=easy music production for everyone!
Comment[ca]=Producció fàcil de música per a tothom!
Icon=/usr/share/lmms/themes/default/icon.png
Exec=/usr/bin/lmms
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Application;AudioVideo;Qt
MimeType=application/x-lmms-project

  • cp ~/lmms.desktop ~/.local/share/applications/

Check out the documentation here.
Enjoy making music. \m/