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:


  • Execute the script as:

    source ~/.local/bin/

  • 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:


  • 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


Powershell Running Scripts (PS1) Error

When running some ps1 file in Powershell and you get some error like:

File <Path-to-some-ps1-file>.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details.

You can solve it by running the following command in Powershell:

Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "RemoteSigned"

To reset the policy setting run:

Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "AllSigned"


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

Statistics – Part 2

In this post, we’ll cover Mean, Median and Mode. We’ll keep them to the point and will not go deep down into them in this series.

There are three different types of means

  • Arithmetic mean
  • Geometric mean
  • Harmonic mean.

For this series we’ll cover arithmetic mean only. I’ll refer to arithmetic mean as mean.

In simple words, mean is average. But average of what?
We’ll get into that but take a look at a following table of Players’ scores:

Players Scores
15 35 85 55 95 65
45 20 25 60 80 20

These are scores of 12 players for some game they played.

So, now if we want to know ‘what is the score that is achieved averagely by the players?’ we can simple get an average of all the observed values. (Remember data set is a set of values)

Average = sum of all observations / total number of observations 

Now, we have
total observations = 12, and
sum of all observations = 15 + 35 + 85 + ….. + 80 +20 =  600

Therefore, Mean = 600 / 12 = 50

This concludes that the average score that players achieve in the game is 50.

But that only tell us about the overall info about that data. What if we want to know much more detail about that? What if we want to know if the game was difficult or easy? How can we deduce that from out data set?

This brings us to our next topic.

Median is the mid point of our data.

To observe the mid point we need to organize our data from low score to high score. Take a look at the following table:

Ordered Players Scores
Player Score Player Score
1 15 7 55
2 20 8 60
3 20 9 65
4 25 10 80
5 35 11 85
6 45 12 95

Median is calculated using the total number of observations. Median is a value which lies in the mid of all the values. We have 12 observations. What is the mid point of these values? Well it is difficult to say, since there is no single value that fulfills this criteria. Now, only if it had been 13 total observations, then we could have said value number 7th value is the median. Then this would have been our expression:

Median = value at (n + 1 ) / 2
where n = Total number of observations

But we have 12 total values, this makes it a problem. If we use the above formula we’ll get 6th value as our median which does not makes sense as 6th value doesn’t lie in the middle of the data.
How can we get the median for this?

If we observe the table again we can see that 6th and 7th values lie in the middle but neither of them are true medians. To solve this dilemma, just take an average of these both values.
6th value = 45
7th value = 55
Their average = (45+55)/2 = 100/2 = 50

So, we can say that in case of even number of observations, our formula is as:

Median = (value at ‘a’ + value at ‘b’)/2
where n = Total number of observations,
a = n/2,
b = (n+1)/2

We got a median value as 50, therefore we can see that the game is neither easy nor difficult.

Now most of the times you see a data set, you can observe that certain data values are repeating. This triggers a question, what value is the most common?
This brings us to our last topic Mode.

Mode is a data point that occurs with high frequency in the data set. To put it simply, the data value that appears most often in the data set is Mode.

Frequency of scores
Score Frequency Score  Frequency
15 1 55  1
20 2 75  1
25 1 80  1
35 1 85  1
45 1 95  1
50 1

We can see that 20 is the score that occurs 2 times in our data set. This is our mode.

Easy. Right?

Yes, but make sure to take care of following points while finding the mode.

  • Mode does not have a minimum frequency;
    • Suppose the following data set is there
      And another data set
      We can observe that in the first data set, 5 occurs twice and in the second data set 5 occurs 4 times. In both cases, the mode is 5.
      However in the second case the 5 is the most common value whereas in first case it could be a ‘by-chance’ situation. Always make a smart observation. Frequency matters for any data set values.
  • Multiple modes can be there for a single data set;
    • Suppose the following data set is there
      We can observe that 4 and 6 occurs three times. Therefore, 4 and 6 both are our modes.

So we have seen how mean, median and mode can help us evaluate our data in different contexts and answer some questions that would have been very difficult to answer. Add in a good representation such as histograms, we get a good idea what is going on with out data.

We’ll study some other concepts that are useful in statistics in future posts.

Statistics – Part 1

Statistics is a study of methods for data collection, analysis, and interpretation, and principles of experimental design.

What is Data?
Data is any set of values. It could be qualitative or quantitative. In a simple words, data is collection of values or numbers or anything that gives some sense of information.

Is data good or bad?
Well to put it simply, data can be both. If we can get some useful information from that data, deduce something by going through it, then data is generally considered good.
But is it really so?
Even the good data can still be further classified as good or bad. Confusing, isn’t it?

Think about these questions:
How much of that data is useful?
Is it valuable?
What is the quality of data?
Is the data biased? 

You got the gist, right? When we ask these questions we slowly begin to understand whether data is good or not.

How is data collected?
The data is collected through observations and measurements.

What type of data is there?
Data can be broadly divided into 2 parts:

  • Primary data (collected by us)
  • Secondary data (collected by others)

What is importance of organised data?
Organised data help us to understand it more easily. We save time and money. It allows us to make good decision. It helps us work with precision.

How do we represent data?
There are many ways that data can be represented. The most common of them all are:

  • Tables
  • Charts
  • Graphs

There are several other ways to plot our data such as dot plot, histogram, pie charts, etc. We’ll go through these in upcoming posts.

Blender Modeling: Low Poly Water

Hello Blender Folks,

In this tutorial we are going to create Low Poly Water and render it in Cycles Rendering Engine inside Blender. This is what we are going to achieve today:render_result

Open up a new Blender File, i.e the Default Scene with a cube, lamp and a camera as shown below.default_scene

Change to Cycles Render:

Go to the top Menu and change to Cycles Render from the Blender Render.cycles_render_option

Delete the default cube:

Select the Cube and press X or Del key to delete it. You can also delete it from the Outliner Panel. Right click on the cube and select delete option.


Create a Plane:

Press Shift + A and select Mesh<Plane to add a plane or you can add it from the T Panel’s Create Tab. Rename this plane to “WaterLayer” in the Outliner. It is a good practice to rename your objects in the scene.

Scale the Plane:

Now scale this plane up-to the size of the Grid.


Subdivide the Plane:

Press Tab key to go into the Edit Mode and then Press W to open up Specials menu and select Subdivide. Now increase the number of cuts to 30 as shown.


You’d have achieved the following result.


Press Tab key once again to exit Edit Mode.

Create a Cloud Texture:

Go to the Texture Tab in the Properties Panel and create a New Texture and change it to Clouds and leave rest of the settings as default.


Add a Displace Modifier:

Go to the Modifier Tab in the Properties Panel and add a Displace Modifier and then select the Texture that we have just created. Change the Strength value to 0.100.


You can play around the settings till you are satisfied and get the result something as below.


Duplicate the Water Plane:

Press Shift+D to duplicate the water plane and then press Z and then move it down and scale it a bit till you get something like this.


Also don’t forget to rename this new plane to “WaterBed”.

[Optional: Subdivide the WaterLayer plane one more time to get a good view.]

Add Materials to both Planes:

Select WaterLayer plane and go to the Materials Tab. Add a new material. Rename this material to “WaterMaterial”.

Then select WaterBed plane and add a new material for this as well and rename it “BedMaterial”.

Change the setting of both the materials as following.



Change World Settings:

Go to the World Tab and change the color to very light grey or close to white. Make sure  Ambient Occlusion is unchecked.



Now just press F12 key or go to Render Tab and hit Render button. And we will get the following result.


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.


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! 🙂

Blender Tip: Render Border!

Hello Blender Users,

The more experienced Blender users might already be familiar with this tip but the new users would definitely benefit from this tutorial. It is always important to check your materials, textures and lighting while working on your complex scene. And some of the new users would just render the whole scene to check their progress which could be quite taxing for your system (if you are like me and don’t have a high-end beast of a workstation). Nevertheless, it doesn’t hurt if you can save on some processing.

For the sake of this tutorial, I’m using the default scene of Blender.

What we are going to do is use Blender’s inbuilt feature called ‘Render Border‘. To use it follow these steps:

  • Press N on your keyboard to make your N-Panel visible, where you can set the object’s properties and such.n_panel
  • Now tick the Render Border checkbox, (just above the 3D Cursor) as shown in the picture. You can see that after you have marked it, the Viewport got a red dotted border. This enclosed area tells the Blender to render it. But we want to adjust that area, which we will adjust in the next step.n_panel_marked
  • Press Ctrl+B to enable the custom selection to adjust the border. Now you can select the area you desire. I’ve selected the area as shown below. If you want to change your selection again use Ctrl+B.select_border_area
  • Next you need to change the display of the objects in the Viewport Shading from the menu that you can see just below your actual viewport. Select ‘Rendered‘ from the menu as shown.render_mode
  • Now you can observe that only are enclosed in the render border is rendered leaving the rest of the viewport as it is. Even if you rotate your scene or anything it will remain undisturbed.result

Go on now, save some processing and time while improving your productivity. Hope you find this useful.

Till next time!

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.

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

cd OpenSceneGraph
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

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!