Hello friends, I tried to scrape web pages with beautiful soup and python 3 using the following link.
Category: Daily Diary
In Ubuntu, edit
So you can just open up this file as root and add whatever you want.
For Immediate results, Run (try as normal user and root):
source /etc/environment && export PATH
Or reboot to see the permanent changes.
What is Learning?
Learning rule in Neural Network means machine learning i.e. how a machine learns. It is a mathematical logic to improve the performance of Artificial Neural Network.
Learning rule is one of the most important factors to decide the accuracy of ANN.
Dictionary meaning of synapse is togetherness, conjunction. The purpose of the synapse is to pass the signals from one neuron to target neuron. It is the basis through which neurons interact with each other.
Presynaptic and Postsynaptic Neuron
Information flow is directional. The neuron which fires the chemical called neurotransmitter is presynaptic neuron and the neuron which receives neurotransmitter is postsynaptic neuron.
It is one of the oldest learning algorithms. A synapse(connection) between two neurons is strengthened if the neuron A on either side of the synapse is near enough to excite neuron B, and repeatedly or persistently takes part in firing it. It leads to some growth process or metabolic changes in one or both cells such that A’s efficiency as one of the cells firing B, is increased.
Generalization of Hebbian Rule
The four properties which characterize Hebbian synapse are:-
Time-dependent mechanism:- In it, modification in the Hebbian Synapse depend on the exact time of the occurrence of the presynaptic and postsynaptic activities.
Local mechanism:- Since synapse holds information-bearing signals. This locally available information is used by Hebbian synapse to produce local synaptic modification that is input specific.
Interactive mechanism:- In it change in Hebbian synapse depends upon the activity levels on both sides of the synapse(i.e. presynaptic and postsynaptic activities).
Conjunctional or correlational mechanism:- The co-occurrence of presynaptic and postsynaptic activities is sufficient to produce synaptic modification. That is why it is referred to as a conjunctional synapse. The synaptic change also depends upon the co-relation between presynaptic and postsynaptic activities due to which it is called correlational synapse.
In competitive learning, the output neuron competes among themselves for being fired. Unlike Hebbian Learning, only one neuron can be active at a time. It is the form of unsupervised learning.
It plays an important role in the formation of topographic maps.
The three basic elements to a competitive learning rule:-
- A set of neurons that are same except some neurons and which therefore respond differently to the given input set.
- A limit imposed on the “strength” of each neuron.
- A mechanism that allows a neuron to compete among themselves for a given set of inputs. The winning neuron is called a winner-takes-all-neuron.
The internal activity vj of the winning neuron must be the largest among all the neurons for a specified input pattern x. The output signal vj of the winning neuron is set equal to one; the output signal of all other neurons that lose the competition is set to zero.
The change applied to synaptic weight wji is defined by
Boltzmann learning is statistical in nature. It is derived from the field of thermodynamics. It is similar to an error-correction learning rule. However, in Boltzmann learning, we take a difference between the probability distribution of the system instead of the direct difference between the actual value and desired output.
Boltzmann learning rule is slower than the error-correction learning rule because in it the state of each individual neuron, in addition to the system output is taken into account.
The neurons operate in a binary manner representing +1 for on state and -1 for off state. The machine is characterized by an energy function E
where si is the state of neuron and wji is the synaptic weight between neuron i and j. The fact that means that none of the neurons in the machine has self-loopback.
The probability of flipping the state of neuron j
where is the energy change.
The neurons of Boltzmann machine is divided into two functional groups, visible and hidden. The visible neurons act as an interface between the network and the environment in which it operates, whereas the hidden neurons always act freely.
The Boltzmann machine works on two modes of operation:
Clamped condition:- In this, the visible neurons are clamped onto the specific states. These states are determined by the environment.
Free-running condition:- In this, all the neurons including the visible neurons and hidden neurons are allowed to operate freely.
Boltzmann Learning uses only locally available observations under two modes of operations: clamped and free running.
Are you bored of using standard vim editor?
Do you really want to style and customise your vim editor? Then what you are waiting for.
Just follow the instruction given in the README.md file and impress your friends with it.;-)
After adding and installing plugin “YouCompleteMe” for auto-complete I was getting message while opening any file with vim.
“The ycmd server SHUT DOWN (restart with :YcmRestartServer)”
Even after running command :YcmRestartServer the problem stucked. After searcing on internet, I ran the python script “install.py” under “$HOME/.vim/bundle/YouCompleteMe”
The following table contains some of vim basic commands and the commands run for my vimrc file.
|Type v, yank lines then press Ctrl-c||It will copy lines in visual mode. It will work if you copy this .vimrc file.|
|Tap Esc, then Ctrl -p||It will paste lines in normal mode. It will work if you copy this .vimrc file.|
|:Te filename||It will open that file within the vim editor. You can also select file instead of typing filename. For that type :Te and then open NerdTree(Ctrl +n) and select the exact file.|
|gt||Switch between the files opened with :Te command.|
|Ctrl + ww||Switch between the files opened with :Te command.|
|Ctrl-P||It enables the search within the vim. It uses plugin ctrlp.vim.|
|:sp filename||Split the layout vertically. It means the vim window is divided in two parts upper and lower.|
|:vs filename||Split the layout horizontally. It means the vim window is divided in two parts left and right.|
|:b buffer_number||Switch to that particular buffer.|
|:ls||List all buffers. Buffers are the files open in that vim session.|
|0||To reach the beginning of a line.|
|$||To reach end of a line.|
|*||Move to the next occurrence of the word under cursor.|
|#||Move to the previous occurrence of the word under cursor.|
|gg||To reach beginning of a file.|
|G||To reach end of a file.|
|o||To insert text into a new line.|
|dw||Deletes the first word on the right side of the cursor.|
|.||To repeat the previous command.|
|x||To delete a character.|
|d$||Delete from cursor to the end of current line.|
|5yy||Copy 5 lines.|
|line_no>>G||To go to particular line number.|
|Yank lines,then type :e filename.||Copy-paste from one file to other. Filename is the destination file where you want to paste the lines.|
What is Bitcoin?
Bitcoin is a new currency that was created in 2009 by an unknown person using the alias Satoshi Nakamoto and released as open-source software. It is a cryptocurrency and worldwide payment system. It is the first decentralized digital currency .
Transactions are made with no middle men – meaning, no banks! The price of bitcoin skyrocketed into the thousands in 2017.
With the help of bitcoins, international payments are easy and cheap because they are not tied to any country or subject to regulation.
Some people just buy bitcoins as an investment, hoping that they’ll go up in value.
Why bitcoins in demand?
Future in question
No one knows what will become of bitcoin. It is mostly unregulated, but some countries like Japan, China and Australia have begun weighing regulations. Governments are concerned about taxation and their lack of control over the currency.
After so long, I got a time to publish this draft. They are general things a developer should know.
Command to download the debian file of the package.
sudo apt download <package-name>
Command to see the dependencies of the package.
sudo apt-cache depends <package>
I was not able to install any package with apt.
*** Error in `appstreamcli’: double free or corruption (fasttop): 0x0000000001dedf90 **
$ sudo apt install –reinstall libappstream3
Let’s talk about Git.
What if you want to copy the file from one branch to other in git. Think think…
Congratulations if you know, but still I will explain here in detail.
Let’s say we have two branches A and B. I am currently in branch A and I want to copy one file from branch B to A. Remember, the file you want to copy should be committed. If not, then first go to branch B and commit it using below commands.
git checkout B
git add <filename>
git commit -m “Dear file, you are in demand!”
Now come back to branch A using
git checkout A
Now, using below command copy the file from branch B to A.
git checkout B <filename>
Apart from that, I updated my Firefox using link
I think you learned some new things. Good bye. Stay tuned!
tmux ls //list all tmux sessions
tmux attach -t session_no
Baar Baar Din Yah Aaye, Baar Baar Dil Yah Gaaye
Tu Jiye Hazaaron Saal, Yah Meri Arazu Hai
Happy Birthday To You…
I am sure you are also rhyming this song with me. Moreover you are thinking why I have written over here. So, it’s time to reveal the surprise.
It’s my Hundredth Happy Blog Day. 😉
All thanks to OpenStreetMap, Linux and most import Great Developers Team to be a part of this journey.
Coming to non-technical Stuff, today, I heard news
After Train Departs 20 Seconds Early, Japan Railway Issues ‘Deep Apology’
You might be wondering why I have mentioned especially this news over here.
While reading this news many thoughts came to my mind. Previous year while receiving HVPE lecture my Sir said the main reasons how Japanese has a rapid economic growth.
[His Experience- During the departure of bus, In India people catch it by poking others but in Japan they act like civilized person.]
More precisely, they care for people whether it would be their family, employees, or even a person not belong to them in anyway.
They are dedicated to the work assigned to them.
They have spiritual sense of awareness in their social and economic life.
Overall, The Japanese have a practical outlook and believe in showing results in their work, even if this meant trial and error methods.
Now, it’s to time to have a break. Meet you soon with crispy technical stuff. 🙂
Few days back, I got to know the actual meaning of virtualenv from my friend Amrit.
The above command will create a new directory with <name> which create new python executable path, set up tools like pip, wheel etc through which we can install new python packages even without sudo power and independent of global python packages.
It will activate the virtualenv you have created now. Make sure to activate before you install new package under it.
deactivate //deactivate the virtualenv.
pip freeze //list all the packages installed under that environment.
Before the installation of any package under it, it should output none. But in my it was listing global python packages installed.
On browsing the error, I came to know that there was one file existing named “pip.conf”
Either you can remove the file or move it at other place. This seems to be a small problem but in actual it was destroying the real power of having virtualenv. So, solve it ASAP otherwise it gonna create chaos.
Apart from that, I edited pdf with the online tool https://www.sejda.com/
Seriously it’s too flexible and interest seeking tool because of the features like Add your signature, tick the check box and many more.
Me and my friend Amrit was given a task to make a web app which will allow user to login through facebook, upload images or document and automatically publish it on page.
This blog will cover very small part of the problem i.e. how user can publish post on a page. We used Facebook SDK for Python.
We followed following links to solve it.
Install facebook module of Python as given in https://facebook-sdk.readthedocs.io/en/latest/install.html
Generate Access Token
- Login to facebook account.
- In new tab, browse to https://developers.facebook.com/
- Go to “Tools and Support” and then “Graph API Explorer”.
- Click “Get Token” and then “Get User Access Token”. It will prompt out permission options.
- In order to publish post on your account, Check box “publish actions” permission and then click “Get Access Token”. It will ask for whom should see the post(preferably public). To know more about permissions browse to https://developers.facebook.com/docs/facebook-login/permissions
Congratulations, you have generated your long string of access token.
import facebook graph = facebook.GraphAPI(access_token="your_generated_token", version=2.10)
The above command will create new object “graph” with your own access token.
graph.put_photo(image=open('img.jpg', 'rb'), message='Look at this cool photo!')
This will publish photo on your account. Likewise to publish text or anything follow given links.
Publish Post as a Normal User into a Page.
Now recreate Token with more permissions. This time check box
|Scopes||user_location, user_likes, user_events, user_photos, user_about_me, user_posts, email, publish_actions, manage_pages, pages_show_list, publish_pages, public_profile|
Here “public_profile” means to view your post to public. This permission is must. This is obtain when we click “get access token” it ask for to show the post to [public, friends, only me]. Select Public. It took complete one day to debug the problem.:P
Now check the Page_id of the page in which you want to publish. It is displayed in URL or you also see in the “About” Section of the page.
Create the new object just like “graph” object created with new access token.
graph.put_wall_post(message=’Really Worked!!’, profile_id=’your_page_id’)
Likewise, an admin of the page can also publish the post. Rather an admin can select any option among [public, friends, only me].
Make sure in the General settings of the page there is no bar for a normal user and everything is set to public(if applicable).
Now check post to the page Community section. You will be able to see the post.:)
For any kind of doubt feel free to comment.
This blog is an integration of small small tasks done few days back.
Steps to install Google chrome in Ubuntu.
sudo apt-get install libxss1 libappindicator1 libindicator7
sudo dpkg -i google-chrome*.deb
Following this link I tried to make Github Pages
You can clone the source code from https://github.com/amisha2016/LuvLdh
The actual theme was picked from http://markups.io/demo/eventoz/