Featured Post

Python Virtual Environments

Python Virtual Environments

If at all you start working on python, you will at some point come across python virtual environment. A virtual environment(venv) creates a silo where whatever version of packages you use will not have impact globally. In some cases you need a venv to install packages even. Below is the steps to setup python venv referenced from freecodecamp-python-venv

In your terminal to install venv to your host python

pip install virtualenv 

else use below command to install venv globally

      sudo apt install python3.11-venv 

 Install virtual environment by cd to the folder then ->

python<version> -m venv <virtual-environment-name>

 To activate the virtual environment, cd to the folder then->

      source twittervenv/bin/activate
 

GIT PULL REQUEST is confusing at first, then it makes sense!

 I have been dabbling with Git since last week and I thought I should write down whatever I have learnt. Earlier I had written an article about HOW TO GIT, this is part two of it. I will be mostly covering how developers mostly use Git and how it works in real world and what is a pull request?! As you know Git is a version control software. But how exactly do you start using it? and what you need to do. If you are a GIT NOOB like me, read on .. 

First of all you need to install git on your machine. That is a prerequisite. Then there are two ways of working with files. Either you have created few files on your laptop and kept it in a folder or you need to download the project files into your folder from git hub. Now, downloading the project files from github is called cloning. To clone, you need to right click in the folder and hit open git bash here. then  you run the command `git clone <url of repository> <your folder name>`  from git bash. And that will download all the files from that repository into you folder. 

What is a repository? It is nothing but a folder system containing all the project related details, folders, files and  branches. Branches? It is similar to branches of a tree. Now by default what ever files you have will be in the master branch. This is the main branch. We will come back to this master branch in a bit..

 Lets say you have a folder with few files in them that you are working on in your laptop and you need to do some version controlling on them. Open git bash in that folder. Then you run command  `git init` This will initialize the folder. Meaning, you tell git bash that - "bhai dekh lo, apna folder h! sambhal k" also you need to check if you have named your machine. git config --global user.name yourname and git config --global user.email youremail. Git config --global list is used to check the configs.  Now when you add the files to the folder in your laptop, these are in untracked condition, means git doesn't know what you are doing in those files. you need to add them to staging area. `git add -A` will add everything to stage. From here on whatever changes you do, git will make note of it.  From there you run `git commit -m "comment"` this will commit the files. This is more or less like "saved". Lets say you need to do some more changes but not sure how it may react. so you can create a new branch say git checkout -b <branchname> and all files will be available in the new branch which is in master. Now you can do any changes in the new branch and not worry about anything. If you wanna go back to master, `git checkout master`. 

So far what ever you did was in local computer local repository. Now what if you would like to save it in git hub. the online drive . Here it is called remote repository. then you need to set the repository URL to your origin. git remote set-url origin https://url.git       Once the url is set, make some token settings. then `git push origin master` this will push whatever changes you have made in the master to the master in the remote repository. this is where the fun begins! 

Now, If there is some changes in the master(remote) already which is not in your master(local) then when you are trying to push, the git will throw error saying changes are there. Here you need to pull the master(remote) into your local then apply your changes to it and then you can push it to master. whereas, if you have a  branch, in remote and local, then you can push your local branch to remote branch and it will work flawlessly. 

Say, now you have made changes to branch in local. then you have pushed the branch to remote. Now you would like to merge the changes in remote branch with the remote master. but here you need to take permission from the owner of the master. lets call him master guy.  this is because if a lot of ppl are working and simpsimply updating things to master, it will get wacked . so the master guy now has to check what changes you have made and then approve it to be merged. But if he has to see your code, he needs to pull the code from your remote branch, inspect it and then merge it with master. This process is called pull request. Where the branch guy pushes code to remote branch and raises a pull request to the master guy. the master guy then pulls the code onto his machine and inspects and then he will pull the code into the master to merge. Hence the name pull request.

Why one should watch Schitt's Creek

 There are a lot of reasons why one watches a TV series. It could be boredom or something one relates to. There has been a lot of TV series that has come over the years and I for one have watched a lot. Family drama, Love n romance, action and saving the world. The list goes on... Probably you are watching one right now too. 

When it comes to TV series, I have noticed that there are certain things that the ppl who make them take into consideration. Mainly the anthropological aspects of human nature. How a certain human behaves when put into certain situation. You can see it in almost all TV series where the main protagonist is put to test. The situation tests the mettle of this guy or him and his people. This can be seen from game of thrones to peaky blinders. Hell even sopranos! But why am i talking about Schitt's Creek.

Few years ago I came across an article that discussed communist - socialist idea of equal distribution of wealth. Personally I am a huge Ayn Rand fan. Now ideological differences aside, it talks about what would really happen when all the nations wealth is taken and then redistributed to all the people of the world. Now a certain class of people would take the new found money and consume it .. some might see an opportunity and start something while some might invest and others may have other vices and other plans for this money. This reminds me of an old tale. It goes something like this...

Once there was a wealthy man with three daughters. Now the wealthy man was old and he was on his deathbed. So he called up his daughters to his side one by one. He then gave them a hand full of rice and said nothing. Few days later he called up all of them and asked what they have done with it. The first one said she cooked it and had it. The second one said she kept it safe in a vase. While the third one had sowed that handful of rice and turned it into a heap of cultivation. The wise man was impressed by this and wrote the will to her name. 

while the above story may seem like a regular old folklore, it is totally related to what I was talking about earlier. The wealth distribution and so on. Even if the gates the rockefellers the buffets distribute the wealth to the world, for a few years it may seem that all are equal and there are no billionares.. But deep down we all know that the way they think and move, the decisions they take have made them what they are. And even if you strip them of everything they have, they will still raise from their ashes and make it big in life. Because they didn't reach where they are because of the money or situation. It is their way of thinking and how they act when put into certain situation. 

Schitt's creek is a tv series about a billionaire family who lost everything due to a fraud and now made to live in a town by the same name which they had bought as joke. The ups and downs they face and the rich people problem become the comedic relief that we see now and then. The whole show has this easy going pace where you start at one episode and go on watching coz it just warms your heart. Right now I am at start of second season and there was a particular scene that made me write this article. Iam not going to discuss the scene and give away spoilers. 

But I'll say this, if you get what I am trying to say. You know what I am talking about. 

How to GIT for dummies!

Recently when I was going through my CS50 course on edX, I was supposed to upload my assignment on github. Although I have been working as a test engineer for 3 years I never had a chance to work with git in a professional capacity. Also I wasn't much into programming. Nevertheless, better late than never right.

First post

 Hi there,

Journey of a thousand miles starts with a single step.