Uncategorized

17
Aug

Python Django

What is Django?

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. When you’re building a website, you always need a similar set of components: a way to handle user authentication (signing up, signing in, signing out), a management panel for your website, forms, a way to upload files, etc. Python Django takes care of the repetitive work for you so that you don’t have to reinvent the wheel all over again.

 

Lets install Django

 

You can install Django using

For other ways of installation, visit this.

 

Let’s get started

Since this is the first time we are using Django there is some  initial setup to do. We need to auto generate some code that establishes  the Django project.

From the command line,

This will create a folder ‘mysite ‘ in your current directory. Do avoid python names of different functionalities as names for the folder. Ex. Django and test are not good choices since they create conflict on calling.

Also, with Django you do not put your code under your web server’s root directory. We always place it outside.

Let’s look at what startproject created:

mysite/

manage.py

mysite/

__init__.py

settings.py

urls.py

wsgi.py

 

These files are:

  • The outer mysite/ root directory is just a container for your project. Its name doesn’t matter to Django; you can rename it to anything you like.
  • py: A command-line utility that lets you interact with this Django project in various ways. You can read all the details about manage.py in django-admin and manage.py.
  • The inner mysite/ directory is the actual Python package for your project. Its name is the Python package name you’ll need to use to import anything inside it (e.g. urls).
  • mysite/__init__.py: An empty file that tells Python that this directory should be considered a Python package. If you’re a Python beginner, read more about packages in the official Python docs.
  • mysite/settings.py: Settings/configuration for this Django project. Django settings will tell you all about how settings work.
  • mysite/urls.py: The URL declarations for this Django project; a “table of contents” of your Django-powered site. You can read more about URLs in URL dispatcher.
  • mysite/wsgi.py: An entry-point for WSGI-compatible web servers to serve your project. See How to deploy with WSGI for more details.

 

Let’s verify whether our Django works.

You can safely ignore the warning for now.

 

Yipppe! We  have started the Django server! Let’s go see how it looks like.

 

Note This is only for studying. When it  comes to production setting, use Apache servers or similar.

By default the port is 8000. But you can change it using the command line. Say you want to change it to 8080

Full docs for the development server can be found in the runserver reference

 

But why Python Django?

  • It’s the best choice for quick web development
  • Transparent and clean code.
  • Fewer lines of code
  • Saves time and money on development
  • works well with high loads

Why not Django?

  1. Doesn’t support real-time applications
  2. Broad knowledge of the system is required
  3. ORM is very monolithic compared to SQLAlchemy.

 

To know how to edit and configure your webpages, check out https://docs.djangoproject.com/en/1.11/intro/tutorial01/

 

For more details visit,

https://www.djangoproject.com/

https://docs.djangoproject.com/en/1.11/#index-first-steps

https://www.djangoproject.com/start/

https://docs.djangoproject.com/en/1.11/

https://tutorial.djangogirls.org/en/django_start_project/

 

 

 

 

13
Aug

Best Python Books

Quora brings up a lot of interesting questions from all around the world. An avid Quora reader myself, I absolutely love reading through the different questions and answers there. One of the questions that interested me was “To learn a programming language is it better to learn from a book or on-line courses on the Internet?”

Well, that answer would totally depend on how you intend to learn. If you just want to learn the syntax then some online classes would be more than fine. If you really want to learn the real power behind the language, then an in-depth online course or better you could grab a good book on it. So to all those Python learners out there, here we have compiled a list of the best python books out there for you to learn.

BEGINNER:

1. Learning Python

Written by Mark Lutz and David Ascher, Learning Python offers a comprehensive in-depth introduction to the core of Python language for any beginner. It covers basic topics of both 2.7.X as well as 3.X in much detail. Some of the topics covered are Types & Operations, statements and Syntax, Functions and Generators, Modules and packages and much more. The beginner chapter, a Q&A session on Python and especially why Python is a major highlight. The end chapter quizzes enable the reader to challenge himself on the topics covered. Therefore leaning Python is one of the best choices to get started in Python.

2.Learn Python the Hard way

Written by Zed Shaw and offered for free as pdfs. Learn python the hard way will give beginners with a perfect insight to the very basics. You can also learn a variety of basic things such as how to use the terminal or the text editor. This book focuses on more on learning by doing than subject theory. therefore for an absolute beginner, Learn Python the hard way is a good choice.

3.A Byte of Python

Targeted for the absolute beginners in programming, author Swaroop C. H has kept it short and brief. With a user-friendly introduction, and focus on scripting simple but meaningful programs. A Byte of Python is the best choice for a beginner to learn Python briefly.

INTERMEDIATE:

1.Python Essential Reference

Written by David M. Beazley, this book is the perfect go to reference book on Python. All the new features such as new style classes, unification of types and classes, xmlrpclip, intertools, bz2 and optparse the new library modules are all covered in the updated edition of this book which makes it the most up-to date book on Python in the market. Written in a clear and organized manner, it gives you a detailed overview and an insight to the real power of programming. For someone with a bit of basics and want to learn Python, Python Essential Reference is a must read.

2.Python CookBook

Written by David Beazley and Brian K. Jones, Python CookBook is for readers with a basic knowledge of Python. Readers who want to learn more on concepts such as data structure, data encoding and processing, functions, algorithms, classes and objects, system administration, modern tools and idioms, generators and iteration methods would find Python CookBook to be the best guide. Each recipe contains code samples written and tested in python 3.3, so that you can get to using them right away. For someone who wants to be good on Python, Python CookBook is a must read.

3. Scientific Computing in Python

Authored by Claus FührerJan Erik SolemOlivier Verdie, Scientic Computing in Python3 demonstrates how to use Python for computing purposes such as in linear algebra, arrays, plotting, iterating, functions, polynomials, and much more. You get to explore numerical computing and mathematical libraries with SciPy and NumPy modules. Covering all major concepts and tools in scientific computing, this book is your go to guide and best reference for the same.

ADVANCED:

1.Black Hat python

Author Justin Seitz has aced how to teach security skills in python in his book Black Hat python. Targeted only for advanced Python users, this book comes as a huge boon for hackers and penetration testers to write better networking sniffers, infect virtual machines and manipulate packets and develop better hacker tools using python. A must have for any wanna be Hacker in Python.

2.Python for Data Analysis

Data Anaysis is all about collecting, cleaning, processing, crunching and studying raw data to bring out better insights on the subject matter. One of the best tools used in Python for the same is the pandas library and Wes Mckinney, one of the main authors of the pandas library has brought out a hands on book packed with practical case studies to guide you through understanding and implementing various tools and libraries used for the same. Easy to read and targeted for advanced Python users, Python for Data Analysis is your comprehensive guide to data analysis in Python.

3.Violent Python: A Cookbook For Hackers, Forensic Analysts, Penetration Testers And Security Engineers

TJ O’Connor in his book Violent Python: A Cookbook For Hackers, Forensic Analysts, Penetration Testers And Security Engineers teaches you concepts in security, hacking, forensics, tool integration for complicated protocols etc in the most simple and easy to understand style. You can also learn how to automate large network attacks, extract meta data, intercept and analyze network traffic, spoof wireless frames to attack wireless and bluetooth devices, data mine social media websites and so on. In terms of language and concepts, TJ O’Connor has aced how to teach the advanced topics in python in simple terms, bringing out the perfect go to book for the same.

Have more books to add-on to this list? Comment them below, we would love to hear from you.

Meanwhile, Have fun with Python!

14
May

Linux SU Command

Linux SU Command


 

Usage of Linux SU Command:

This command is used to become another user in his own session. By default, user without username will login as super-user (i.e. Root).

Syntax:

Example1 : Login as “guest “user.

Example2 : Run specific command with another user privilege say govind.

-c option is used to return back to the command line of former user after execution is completed.

Example3 : Login as root user.

Or

Note: In Linux while giving password it won’t be visible because of security reason.


 






10
May

Linux Introduction

Linux Introduction


 

Some historical fact for Linux:

In 1991, in Helsinki, Linus Torvalds began a project that later became the Linux kernel. He wrote the program specifically for the hardware as he wanted to use the functions of his new PC with an 80386 processor.

What is Linux?

Linux is an Operating System.

What is Operating System?

Low level software that supports a computer’s primitive function such as scheduling tasks and controlling peripherals.

Types of Operating System:

  1. System Software: System software are those software which incorporate the programs that are dedicated to manage the computer itself, such as the operating system, file management utilities, and disk operating system.For instance : Linux , Windows etc
  1. Application Software: Application software or simply applications, are often called productivity programs or end-user programs because they enable the user to complete. Specific examples of application software incorporate Microsoft Office, Excel and Outlook, Google Chrome, Mozilla Firefox and Skype.
  1. Utilized Software: Utilized Software or a business application is any software or set of computer programs used by business users to perform variety of business functions.  For instance: Antivirus, McAfee etc.

Finally we conclude: Linux is Open Source Operating System. Specifically Linux is System Software providing an interface between user and computer.

Advantages of Linux:

  • Linux is very durable.
  • Linux is less susceptible to computer malware.
  • Linux as compared to other OS is fast and does not slow down over time.
  • Old desktop/Laptops can be given new life using Linux OS
  • Linux has variety of distributors so we have many varieties in Linux.
  • Because there are many distributors you can freely access this software.
  • It’s a superior method of upgrading software

Disadvantages of Linux:

  • Many windows programs will not run in Linux thus requires a change.
  • There is a smaller selection of peripheral hardware drivers for Linux.
  • People who are new to Linux requires to learn this skill thoroughly in order to use the Operating System.

Features of Linux OS:

  • There are two prompts in Linux
    • $ -> Local user prompt
    • # -> Admin user prompt or Root Prompt
  • Commands are followed by switches but it does not matter in which order we are using switch.
    Example: ls –lrt is same as ls –rtl same as ls -l -r -t
  • Linux is case sensitive so using upper case will give different output and lower case different.
  • Linux is Open source operating system.
  • Several program are running at same time.
  • Several users on same machine at same time

Wild characters in Linux

S. No. Wild Characters Description
1 * Asterisk find any number of characters in a filename, including none.
2 ? Question mark find any single character.
3 [] Square brackets enclose a set of characters, any one of which may match single character at that position.
4 Hyphen used within [ ] denotes a range of characters
5 ~ Tilde at the beginning of a word expands to the name of home directory.

 






12
Jun

Endorsement Framework

Endorsement Framework


 

Endorsement Framework:

  • Validation by a second user of an action taken on a “static data entity” (e.g. Bank) by a first user.
  • Provides functionality to generate endorsement events when a User performs an action on an endorsable entity.
  • Manages endorsement events while they await approval by a User.
  • Examples of static data entities for which endorsement can be setup:
    • Bank
    • Bank User Role
    • Business Calendar
    • Participant
    • Exchange condition
    • Products
  • Endorsement activation depends on a configuration file setup:
    • Either all entities or no entities require endorsement
    • Setup is done on the level of Bank Group
  • Actions that trigger the creation of an endorsement event are:
    • Creation of an entity
    • Update to an entity
    • Activation of an entity
    • Suspension of an entity
    • Deletion of an entity
  • For each endorsement audit records, capturing the modifications made by the User, are created.
  • The default behaviour for endorsement is to hide the modified details from the user until endorsement is done successfully.
  • Each instance of an endorse-able entity has an endorsement status:.
    • Pending endorsement for Modification
    • Pending endorsement for Deletion
    • Pending endorsement for Creation
    • Pending endorsement for Suspension
    • Pending endorsement for Activation
    • No Endorsement outstanding
  • Only a single active endorsement event can be pending against an entity.


 



 





12
Jun

Warehouse

Warehouse


 

Warehouse:

  • The processing of some transactions must be split in two steps.
  • This typically applies to Transactions that are received before the day they are executed.
    • Some validations are performed the day the Transaction is received, to make sure it is valid.
    • Extra validations are performed the day the Transaction is executed, for instance, to make sure the account still exists, or funds are available.
  • Based on the Exchange Timings computed by the router, and on the type of Transaction, the system determines if the Transaction must be held or not.