Programming languages

Computers are very powerful compared to humans – they can compute at a speed much faster than us, they can quickly find the shortest route from Alaska to Antarctica and so on. We talk to computers using programming languages and to humans in natural languages like English and Spanish.

One may wonder, why we cannot communicate with computers using our natural languages. This is because computers require explicit certain, clear and unambiguous instructions from us. Natural languages are ambiguous, the languages and grammar evolve, and they can be unpredictable. All programming languages are formal languages, which means, they have a well-defined grammar, syntax, and semantics easier to be understood by machines.

There are a variety of programming languages

Compiled, Interpreted or Just-In-time compiled

Very fast code, requires compiler to translate to target machine’s native language, may not port well to different os, compilation process may take a while.

Compilers interpreters and assemblers

High or low level

Type system


Supported Paradigm



Relearning C++ : ++Basic Level

I am relearning C++ from the basics. It’s been 5 years when I first wrote my “Hello world” program in C, wasn’t a big fan of C++ back then because Python was more fun to code. Now that I am working at Nvidia, I have realized the importance of writing highly optimized code and how C++ really serves this purpose.

I believe having strong foundations in C++ is essential to make thyself a 10x programmer ūüėõ

This is a journal to my learnings and findings of it or more like revision notes often copying information from the documentation and crediting the sources wherever necessary.

What kind of a programming language is C++?

  • Compiled language – One of the fastest languages in the world because it gets compiled to the machine language(0s and 1s) directly.
  • Strongly, static sometimes dynamic, unsafe type – Strongly typed because it requires explicit conversion to modify to another type, static because types are assigned to variables and not to run time objects, unsafe because it gives us more control with regards to type conversion.
  • Manifest and Inferred typing – Supports both explicitly defined variables and variables whose types need to be inferred.
  • Procedural, generic and Object-oriented – supports procedures and subroutines(functions), specifying types when algorithms are used, able to model objects like in real life.
  • Portable – runs on many platforms
  • Upward compatible with C – All C libraries can be run alongside C++
  • ISO-Standardized language

Structure of a c++ program

Not going into too many details here.

  • #include <iostream> is called a directive that a preprocessor interprets before the compilation of a program begins and includes the iostream header code.
  • using namespace std; some functions are part of the standard c++ code,

namespace – I have always ignored learning more about the namespace keyword, but they are very useful. Links provided helps to understand more about how it can be used. – article1, article2, article3

Variables and types

Variables are a portion of memory to store a value. Whenever a variable is defined in c++, the compiler allocates some memory to it based on the data type with which it is declared.

Identifiers: Contains letters, digits, or underscores. No Spaces, punctuation marks and symbols. Cannot start with digits, cannot match keywords and they are Case sensitive.

Data types: There are three kinds of data types in C++. Primitive, Derived and Abstract or User-defined data types.

2^8 = 256, 2^16 = 65,536, 2^32 ~ 4 billion(4 * 10^9), 2^64 ~ 18 billion billion (18 * 10^18)

Fundamental Data types: Built-in datatypes. These are.

  • Character types: char(1 byte), char16_t(>2 bytes), char32_t(>4 bytes), wchar_t(2 or 4 bytes)
  • Integer types:
    • Signed: signed char(>1 byte), signed short int(>2 bytes), signed int(>4 bytes), signed long int(>4 bytes(32bit machine), 8 bytes(64 bit machine)), signed long long int(> 8 bytes)
    • Unsigned: unsigned char, unsigned short int, unsigned int, unsigned long int, signed long long int (Sizes same as signed)
  • Floating-point types: float(4 bytes), double(8 bytes), long double(16 bytes)
  • Boolean type: bool(1 byte although only one bit is required)
  • Void type: void(no storage)
  • Null pointer: decltype(null)

Derived data types: Derived from fundamental datatypes. These are

  • Function: functionType functionName(parameters) Block of code that defines a well defined task.
  • Array/strings: Collection of items stored at continuous memory locations. Represent many instances in one variable. Dataype ArrayName[sizeofarray]
  • Pointers: symbolic representation of addresses. datatype* dataname
    int var = 20; // Value at var = 20
    int *ptr;
    ptr = &var; // Value at ptr = 0x777f7f(address), Value at ptr = 20
  • References: Alternative name for an existing variable datatype& dataname
    • int var1 = 10;
      int& var2 = var1; // var2 reference to var1
      var1 = 20; // Value of var2 = 20
      var2 = 25; // Value of var1 = 25

User defined datatypes: Class, structure, union, enumeration, typedef defined data type

Initialization of data types: Three ways

int x = 0;
int x (0); // via parantheses
int x {0}; // via curly braces

Type deduction: When a new variable is initialized, compiler can figure out what the type of variable is automatically by the intializer. Variables not initizalized can be declared by type deduction using decltype

int foo = 0;
auto bar = foo; // int bar
int foo1 = 0;
decltype(foo1) bar; // int bar





















Me @ GHCI’18


I am lucky to have the chance of attending GHCI’18 held at Bangalore India with my Outreachy travel fund.


The Grace Hopper Celebration India (GHCI) is the Asia’s largest gathering of women technologists, this year held on 14th, 15th and 16th of November at the Bangalore International Exhibition Center, Bangalore. It is produced by the AnitaB.Org in partnership with ACM India along with the leading sponsors like American Express, Google, Amazon, Microsoft, Adobe, Goldman Sachs, Oracle and the list continues….

GHCI offers technical and career development sessions like poster session, Career Fair, Women Entrepreneur Quest (WEQ), Tech Expo, Speed Mentoring and lots more. And, I am fortunate that I got the chance to be part of these sessions.

So GHCI is a three-day event.

Day-1 – keynote sessions

Day-2 – Microsoft reception, career fair, systers meet.

Day-3 – Mostly career fair


Systers at GHCI
Goodies from GHCI


First keynote speech was given by Lori Beer, the Global CIO of JPMorgan Chase & Co. She shared her story of her success and her struggles between family and work.

The Exciting Career Fair

The Career Fair was something that couldn’t be missed. A hall filled with company booths of the tech Giants, that a Technologist dreams off! It was a unique experience to visit the various booths interact with their representatives, learn new things and solve puzzles to win goodies!

I would like to thank Outreachy for providing me full fund to attend the conference.

I can’t thank enough for the important work Software Freedom Conservancy do for managing Outreachy funds and sending us our stipends smoothly.



Setting up ROUGE

ROUGE or Recall-Oriented Understudy for Gisting Evaluation is a set of metrics and a software package used for evaluating automatic summarization and machine translation software in natural language processing.The metrics compare an automatically produced summary or translation against a reference or a set of references (human-produced) summary or translation.

While working on my Project on Summarisation, in order to compare my generated summary against the reference summary I had to set up ROUGE. In contrast to how there’s a lot of content on every topic available on the internet, well, installing ROUGE only has a few articles. None of them provided the sequence of steps and the requirements to install it. I wished there was some blog written. The content was present but I had to piece it all together from multiple sources to set it up. But, let me make things easy for the future researchers here in this post.


1. Download ROUGE-1.5.5 from here You only need the ROUGE-1.5.5 directory.

git clone
cd pyrouge/tools/ROUGE-1.5.5

2. Check if Perl is installed else install it.

In Ubuntu, do

sudo apt-get install perl

3. For installing XML:DOM(this is a requirement for ROUGE to work) we install synaptic package manager

sudo apt-get update
sudo apt-get install synaptic

4. Once Synaptic Package manager is installed, search for Synaptic package manager in your applications and launch it.

Screenshot from 2018-08-04 21-29-44

Once the package manager is opened search “libxml-dom-perl” Screenshot from 2018-08-04 21-38-44

Click on Mark for Installation and apply changes.

Screenshot from 2018-08-04 22-20-37

5.  An environment variable ROUGE_EVAL_HOME must be set to point to the data directory.

export ROUGE_EVAL_HOME="/home/poojitha/pyrouge/tools/ROUGE-1.5.5/data/"

6. To avoid any WordNet exceptions, run these commands.

cd data/WordNet-2.0-Exceptions/
./ . exc WordNet-2.0.exc.db

cd ../
ln -s WordNet-2.0-Exceptions/WordNet-2.0.exc.db WordNet-2.0.exc.db

ROUGE is now installed, hurray!

Setting up pyrouge

pyrouge is a Python wrapper for the ROUGE summarization evaluation package. Getting ROUGE to work can require quite a bit of time. pyrouge is designed to make getting ROUGE scores easier by automatically converting your summaries into a format ROUGE understands, and automatically generating the ROUGE configuration file.

As of now, pypi version of pyrouge is deprecated, so let’s get the latest version from the repository

git clone
cd pyrouge

Set the ROUGE path with the command

pyrouge_set_rouge_path /home/poojitha/pyrouge/tools/ROUGE-1.5.5/

Command usage Рpyrouge_set_rouge_path  /absolute/path/to/ROUGE-1.5.5/

Install pyrouge using

sudo python install

Test if everything’s installed by running


If the above command outputs “OK” , everything has been installed properly.





SSH Hacks

Jupyter Notebooks

The Jupyter Notebook App is a server-client application that allows editing and running notebook documents via a web browser.

You’re starting to experiment an unknown library and you write a big chunk of code, there are too many errors, so you start debugging but in the end you give up hope. Sad story, eh?

But what if you can write small chunks, check if it’s running fine and proceed to the next? That’d be so great. This is what Notebooks achieve and why I love it.

Remote port forwarding / Reverse ssh tunneling for jupyter notebooks

My laptop’s too slow to even run a hello world program and I try to run it on my friend’s powerful machine. I want to run not just any code, but a jupyter notebook.¬† This is how I do it.

I ssh into my friend’s machine first. Now, the

  • Current machine is my friend’s powerful machine – let it be C,
  • Remote machine is the local machine, my very slow laptop¬† – R

Start a jupyter notebook on C in a new session, using

jupyter-notebook --no-browser --port 8080

In another session on C, do this

ssh -N -f -R <portR>:localhost:<portC>  <user_name>@<local_machine_ip(R's ip)>

<portR> is R’s port we wish to use.

<portC> is C’s port that’s currently used, in this case it’s 8080

<user_name>@<local_machine_ip> is my slow laptop’s address.(R)

Now, I will be able to access the jupyter notebook on my laptop(R) and perform expensive operations using C’s resources.

Using bind address 

Syntax for the argument -R from the man pages of ssh

-R [bind_address:]port:host:hostport

My friend now wants to access my jupyter notebook on my machine and when I send the address <R's ip>:portR , my friend wouldn’t able to access it.

To allow nonlocal users to be able to connect R:portR through localhost:portC, follow these few steps.

R$ grep GatewayPorts /etc/ssh/sshd_config
#GatewayPorts no

In the R’s /etc/ssh/sshd_config file¬† add

GatewayPorts clientspecified

Restart sshd using

R$ sudo service sshd restart

and run in C,

ssh -N -f -R<portR>:localhost:<portC>  <user_name>@<local_machine_ip>


ssh -N -f -R \*:<portR>:localhost:<portC>  <user_name>@<local_machine_ip>


ssh -N -f -R "[::]:<portR>:localhost:<portC>"  <user_name>@<local_

If you do this very often, set up a special host in ~/.ssh/config on C:

 Host laptop
 HostName <R's ip>
 User <user_name>
 RemoteForward portR localhost:portC


  • -N¬† says that you want an SSH connection, but you don’t actually want to run any remote commands. If all you’re creating is a tunnel, then including this option saves resources.
  • -R¬† Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.
  • -f¬† Requests ssh to go to background just before command execution



Some hacks

Share buttons

1. Sharing buttons – default.

&lt;script type="text/javascript" src=""> 
<p> Share on </p>
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet'></span>
<span class='st_googleplus_large' displayText='Google +'></span>
<span class='st_linkedin_large' displayText='LinkedIn'></span>

2. Sharing custom text/image/url

Use properties like

st_url Specifies URL (can be shortened URL) that you would like shared
st_title Specifies title that you would like shared
st_image Specifies link to image you would like displayed in the shared content
st_summary Specifies summary text/description you wish to share

The above code would change into something like this,

&lt;script type="text/javascript" src=""></script>
<p> Share on </p>
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet' st_title="This is custom text #Blog #tweet @systers_org"></span>
<span class='st_googleplus_large' displayText='Google +'></span>
<span class='st_linkedin_large' displayText='LinkedIn'></span>

3. Sharing custom text dynamically. (Django)

&lt;script type="text/javascript" src=""></script>
<p> Share on </p>
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet' st_title="{{ share_message }}"></span>
<span class='st_googleplus_large' displayText='Google +'></span>
<span class='st_linkedin_large' displayText='LinkedIn'></span>

In the corresponding view add share message into the context, looks something like this.

def get_context_data(self, **kwargs):
     context = super(ExampleView, self).get_context_data(**kwargs)
     context['share_message'] = self.object.title " @systers_org " 
     return context


References : Custom Buttons