Mar 26, 2015

Git and Github

Git/Github is a helpful documentation technique when u are changing a file frequently, mostly in the programming language code and you may need to toggle and compare between the various edits. Also, it really helps when multiple users are working on the same file and we want to trace the update by various users.

First thing first,

One needs to get a account in www.github.com. You need to get a username and password for a registered email id. After having the github account we need to install git in our computer.

For linux, we install it as:

sudo apt-get update
sudo apt-get install git

Then we need to setup Git:

git config --global user.name "our_username"
git config --global user.email  "our_emailid"

we can see our configuration later as

git config --list

Having set up the git, we need to have a folder where we will work or say assign a git work-space folder. For that:
First create a folder and change directory to that folder
$ mkdir ~/git/userfolder_name       
$ cd ~/git/userfolder_name

We may create a sample file
~/git/userfolder_name $ touch file_name

Next convert it to the workspace environment
~/git/userfolder_name $ git init

To add the files in the folder to the git repository, we use
~/git/userfolder_name $ git add .

Whenever we make a change to our repository we need to make a commit message
~/git/userfolder_name $git commit -m "My_commit" -a
~/git/userfolder_name $git commit -m "My_commit" file_name


Upto now, we have worked with out local server.
~/git/userfolder_name $git remote add origin ssh://git@github.com:user_name/repository_name.git
~/git/userfolder_name $git remote -v

Mar 13, 2015

GNU Octave

GNU octave is a high level language for numerical computation. It is pretty much similar to Matlab, but it is free. From the version 3.8 onward, the octave supports GUI as well.

To install Octave in Linux Environment, do following in terminal:

$ sudo add-apt-repository ppa:octave/stable
$ sudo apt-get update
$ sudo apt install octave

or 

$ sudo apt-get install octave

(I used the 2nd one, so not sure about the first one, but it should work)

After installing octave, you can find the octave in search bar or under menu-> Science & Engineering-> GNU Octave or, from terminal as:

$ octave

Following octave command prompt will appear:


We can start Octave in GUI mode by forcing the GUI mode by following command:
At terminal:

$ octave --force-gui

Then, GUI appears as follow:



The programming construct are pretty much similar. Code are likely to be compatible with matlab. It has plot functions and array pretty similar with matlab. 

Here is a sample of octave script - test.m

#! bin/octave -qf
clear;
clc;

N=[2,4,5,6,7,4,3,6]
lengthN = length(N);
sum=0.0;
for i = N
  sum += i;
  endfor
meanN=sum/lengthN;
printf("The mean  = %f \n", meanN);
printf("The median  = %f \n", median(N));
printf("The variance = %f \n", var(N));
printf("The standard deviation = %f \n", std(N));

bar(N)
axis([0,10,0,10]);
title("The traffic load");
xlabel("Time Slot");
ylabel("Number of customer")
grid on;

Enjoy!