Tuesday, July 9, 2019

My first Django app

 
localhost:8000/polls/
localhost:8000/polls/about

DIRECTORY STRUCTURE

D:\mywebsite\Djwebsite
Djwabsite has following files and folders in it:
       folder: Djwebsite ( nested Djwebsite)
       folder: polls (this is the name of the 'app' created in the project   'Djwebsite'

     file: manage.py
   
The 'polls' folder has following files and folders:
       files: apps.py
                views.py
                urls.py
                models.py
                admin.py
                tests.py

---------------------------------------------------------------------------------------
 'apps.py' file:

from django.apps import AppConfig


class PollsConfig(AppConfig):
    name = 'polls'
-----------------------------------------------------------------
'D:\mywebsite\Djwebsite\polls\urls.py' file:

from django.urls import path

from . import views

urlpatterns = [
    path('', views.index, name='index'),
    path('about', views.about, name='about')
]
--------------------------------------------------------------------
'views.py' file:

from django.shortcuts import render

# Create your views here.
from django.http import HttpResponse
site = '''<!DOCTYPE html>
<html>
<head>
<title>butube</title>
</head>
<body>
<font color=green size=10><h1=lightgreen>butube</h1></font><hr color=lightgrey></body></html>
<a href="/polls/about">about</a>
'''
def index(request):
    return HttpResponse(site)
   
def about(request):
    title = 'butube'
    author = 'Aksingh'
    html = '''<!DOCTYPE html>
    <html>
    <head>
      <title>''' + title + '''</title>
    </head>
    <body>
        <a href="/polls">home</a>
        <h1>Welcome to ''' + title + '''</h1>
        <p>This Website was developed by ''' + author + '''.</p>
       
    </body>
    </html>'''
    return HttpResponse(html)

---------------------------------------------------------------------------------
'D:\mywebsite\Djwebsite\Djwebsite\urls.py' file:

"""Djwebsite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include,path

urlpatterns = [
    path('polls/', include('polls.urls')),

    path('admin/', admin.site.urls),
]

-----------------------------------------------------------------------------------


Thursday, July 4, 2019

Interview Tips

"A good company understands that problem solving ability and the ability to learn new things are far more important than knowledge of a specific programming language or web framework and that smart students can pick-up any new skill in almost no time."

"With the rise of the tech startup ecosystem in India, the number of tech jobs and internships are at the peak. Today, a large number of companies hire fresh graduates from college because college freshers bring fresh thinking, they are quite agile and they can easily be moulded into any domain."

"There are many Backend Development frameworks in multiple programming languages. The choice of the Backend framework usually is driven by your proficiency in the underlying programming language.
  1. Java: Spring
  2. Python: Django
  3. JavaScript: NodeJS
  4. Ruby: Ruby-on-Rails (RoR)
  5. PHP: Codeigniter
So, if you are proficient in say JavaScript, you can start with NodeJS or any other related JavaScript framework. Other than the underlying programming language, the differences between these frameworks aren’t really significant at the beginner level. Note that for advanced features, the frameworks may differ completely. However, for beginners, either is fine."

"If you are aiming for say, Android app developer internship, you should certainly try and get some projects on your resume. Many students worry about the “certification” of the project. The fact is that the interviewer doesn’t really care about the “certification”. The fact that you took an initiative to learn Android app development and you implemented a project, in itself tells the interviewer about your enthusiasm and learning capabilities. If they want to further verify it, they will question you about the details of the project which will make it clear to them if you are bluffing."

"Obviously, a good GPA/CPI also helps a lot. However, don’t worry if your GPA is low. You can always make up for it through some great projects that align well with what the company wants."

"Machine Learning, the most acknowledged skill in today's tech world."

 "Machine Learning is 65% maths, 25% Algorithms designing and 10% data preprocessing , therefore you should be a champion of 

1.Linear Algebra
2.Calculus
3.Probability  and Statistics


next important things are

4.Programming
5. Algorithms"


 "Why Maths? Maths is needed to understand the machine Learning algorithms/models or to implement new ones. There is a large number of models(algorithms) which are already built. Even when you are using existing models you need to understand the internal working of the algorithm so that the hyperparameters can be tuned

A single model may not give the best results for all the problems. Identifying which model to use for a given problem is very important and to choose the right model, you need to understand the internal working/maths."

Data Structure & Algorithms (non-ml): Though this part will not help you directly rather it enhances your thinking and logic designing which is helpful in designing new ML algorithms and in understanding concepts like:
1.Time Complexity
2.Space Complexity
3.Sorting and Searching
4.Shortest Path between two Points
5. Problem Solving approaches like Greedy, Dynamic, etc.
For Data structure follow mycodeschool playlist on Youtube.
You can implement the teachings in python by following Nptel videos.

For  Algorithms part, you can go through Algorithms playlist on Youtube (This is a really cool playlist on youtube, covering almost all topics) and for advanced algorithms you can refer : Algorithms 1 and Algorithms 2  playlists by Stanford Algorithms (I would suggest you to go through both the playlists).
Machine Learning (Algorithms and Implementation) (about 5-6 months): Now here comes the most awaited part, so let's start to get into actual ML. Machine Learning course by Coursera is highly recommended worldwide for ML learners (Most fundamental and comprehensive course anyone ever came across).

Machine Learning Future Scope (Higher Studies and Research):
Today, with a high demand for ML skills, many post-graduate programs, diplomas and research programs have been introduced all over the world which promises a successful career in this field. Some of the diploma courses  which are highly anticipated by many people are:
PG program in Machine Learning and AI from IIIT-B by UpGrad: This course focuses on statistics essentials such as using statistics to describe data and infer insights, building machine learning models using supervised, unsupervised learning, natural language processing, neural networks, deep learning, graphical models, reinforcement learning etc. In addition to these, students get a chance to work on cutting-edge projects such as predicting customer churn in the telecom industry, building a chatbot engine, disease prediction using medical imaging, among several others. You can check it out by clicking here.
Foundations of Machine Learning and AI from IIIT-H by TalentSprint: The program is delivered using five different components — classroom lectures, where they learn concepts; labs which are done on the cloud; mentors; industry workshops and hackathons. As a part of industry workshop, senior technical heads from top tech companies share their experience and insights on using and implementing AI. Some of them are Ranga Pothula (President, HYSEA; VP and Centre Head Infor), Dr Anbumani Subramanian (Lead Architect, Intel Corporation), Dr Shailesh Kumar (Vice President and Distinguished Scientist, Ola), Mithun Das Gupta (Principal Applied Researcher, Microsoft), Sundar Srinivasan (General Manager, Microsoft AI and Research), and others. The curriculum is designed keeping in mind working professionals. You can find more details by clicking here.
Post Graduate Program in Machine Learning and AI by Great Learning: This 12-month blended program builds a solid foundation by covering areas like computer vision, NLP and intelligent virtual agents, among others. This comprehensive program covers a range of topics from traditional supervised and unsupervised learning methods to ensembles. It focuses more on labs, projects and Capstone project building, a robust e-portfolio of work. It has 9 hands-on projects, GPU based lab environment to build deep learning models, guidance from industry experts through workshop session, among others. You can check it out at Greatlearning.
Also, you can check out the post-graduate and Doctorate programs in some renowned institutes of India like IISc Bangalore, IIT Bombay, IIT Delhi, IIT Madras, ISI Kolkata where you can select the programs in Machine Learning and Statistics, you can check the enrollment procedure at their home site with just a simple google search with name of Institute, you can find some of the renowned professors in this field to complete your research under them at Analytics India.

In a nutshell Machine Learning is the new electricity in today's world, it is not limited to what you have learned, rather it's about Development, Improvisation and Application.

Machine Learning (Algorithms and Implementation) (about 5-6 months): Now here comes the most awaited part, so let's start to get into actual ML. Machine Learning course by Coursera is highly recommended worldwide for ML learners (Most fundamental and comprehensive course anyone ever came across).
On completing this course you will be familiar with:
1.Decision Trees
2.Naive Bayes
3.Linear Regression
4.Logistic Regression
5.Support Vector Machines
6.KNN
7.Ensembling
8.Unsupervised Learning
9.Gradient Descent
Disclaimer: This course is taught in Octave/Matlab which might lower your interest, you can implement the course teachings using  numpy, pandas and matplotlib or seaborn (python libraries).




Sunday, June 16, 2019

Gateways Vs Routers

User Mode Vs Kernel Mode: In Windows

Netmask

A netmask is a 32-bit binary mask used to divide an IP address into subnets and specify the network's available hosts.

Netmask primarily provides a method to create small subnetworks from a large range of IP addresses. Generally, netmask length is defined in up to 24-bit format for all types of IP classes. The division or creation of networks into subnetworks depends on the class of IP address in use along with their available netmasks. For example, the netmasks for the three IP classes are:

  • 255.0.0.0 for Class A with an 8-bit netmask
  • 255.255.0.0 for Class B with a 16-bit netmask
  • 255.255.255.0 for Class C with a 24-bit netmask
The greater the length of netmask the more networks it can accommodate. Therefore, the number of hosts decreases from Class A to Class C, whereas the number of available networks or subnetworks increases.
In a netmask, two of the possible addresses, represented as the final byte, are always pre-assigned and unavailable for custom assignment. For example, in 255.255.225.0, "0" is the assigned network address. In 255.255.255.255, the final "255" is the assigned broadcast address. These two values cannot be used for IP address assignment.

Below is an example of a netmask and an example of its binary conversion.
Netmask: 255. 255. 255. 255
Binary: 11111111 11111111 11111111 11111111
Netmask length 8 16 24 32
Counting out the bits in the binary conversion allows you to determine the netmask length. Above is an example of a 32-bit address. However, this address is a broadcast address and does not allow any hosts (computers or other network devices) to be connected to it.
A commonly used netmask is a 24-bit netmask, as seen below.
Netmask: 255. 255. 255. 0
Binary: 11111111 11111111 11111111 00000000
Netmask length 8 16 24 --
Using a 24-bit netmask, the network would be capable of 2,097,150 networks or 254 different hosts with an IP range of 192.0.1.x to 223.255.254.x, which is usually more than enough addresses for one network.
A simple formula can be used to determine the capable amount of networks a netmask can support.
2^(netmask length - # of used segments) - 2
For example, if we used a netmask length of 24, having a netmask of 255.255.255.0 with three used segments, subtract three from the netmask length, e.g., 24-3 = 21. With this number determined, plug it into the above formula to get 2^21 - 2 = 2,097,150 total number of networks. You are subtracting two from this number because of the broadcast and network addresses that are already being used.
Another example is a netmask length of 16, having a netmask of 255.255.0.0 with two used segments. Using the above formula, you would get 2^14 - 2 = 16,382 total number of networks.
To determine the number of hosts a netmask is capable of supporting, use the following formula.
2^(# of zeroes) - 2
For example, with a netmask length of 24, as shown in the above chart, there are eight zeroes. Therefore, using the formula above, this would be 2^8 - 2 = 254 total number of hosts. Again, two is subtracted from this number to account for the broadcast and network addresses.
Again, another example of a netmask length of 16, there would be 16 zeroes. The formula, in this case, would be 2^16 - 2 = 65,534 total number of hosts.
Below is a breakdown of each of the commonly used network classes.
Class Netmask length # of networks # of hosts Netmask
Class A 8 126 16,777,214 255.0.0.0
Class B 16 16,382 65,534 255.255.0.0
Class C 24 2,097,150 254 255.255.255.0

Mounting Filesystems in Linux

On Linux and UNIX operating systems you can use the mount command to attach (mount) file systems and removable devices such as USB flash drives at a particular mount point in the directory tree.
The umount command detaches (unmounts) the mounted file system from the directory tree.
In this tutorial, we will go over the basics of attaching and detaching various file systems using the mount and umount commands.


For more linuxize.com/post/how-to-mount-and-unmount-file-systems-in-linux

Routing Tables


A routing table is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables.
A routing table contains the information necessary to forward a packet along the best path toward its destination. Each packet contains information about its origin and destination. When a packet is received, a network device examines the packet and matches it to the routing table entry providing the best match for its destination. The table then provides the device with instructions for sending the packet to the next hop on its route across the network.
A basic routing table includes the following information:
  • Destination: The IP address of the packet's final destination
  • Next hop: The IP address to which the packet is forwarded
  • Interface: The outgoing network interface the device should use when forwarding the packet to the next hop or final destination
  • Metric: Assigns a cost to each available route so that the most cost-effective path can be chosen
  • Routes: Includes directly-attached subnets, indirect subnets that are not attached to the device but can be accessed through one or more hops, and default routes to use for certain types of traffic or when information is lacking. Routing tables can be maintained manually or dynamically. Tables for static network devices do not change unless a network administrator manually changes them. In dynamic routing, devices build and maintain their routing tables automatically by using routing protocols to exchange information about the surrounding network topology. Dynamic routing tables allow devices to "listen" to the network and respond to occurrences like device failures and network congestion.

    Example:
  • source: https://searchnetworking.techtarget.com/definition/routing-table

Ampere's circuital law

  Ampere's circuital law states that the line integral of a magnetic field around any closed loop is equal to the permeability of free s...