Software engineering facts, information, and skills categorized as Programming Languages

Cross-Site Request Forgery (CSRF) in simple words

Priya Philip 1 year, 5 months ago

Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.

HttpRequest methods

Priya Philip 1 year, 9 months ago
HttpRequest represents an incoming HTTP request, including all HTTP headers and user-submitted data

HttpRequest attributes

Priya Philip 1 year, 9 months ago

Django uses request and response objects to pass state through the system. When a page is requested, Django creates an HttpRequest object that contains metadata about the request. Then Django loads the appropriate view, passing the HttpRequest as the first argument to the view function. Each view is responsible for returning an HttpResponse object.

Get a file's size with C++17

Priya Philip 1 year, 9 months ago

std:: experimental:: filesystem:: file_size

<filesystem> (added in C++17) makes this straightforward.

The as-if rule

Priya Philip 1 year, 9 months ago

Allows any and all code transformations that do not change the observable behavior of the program.

Infinite iterators in Python

Priya Philip 1 year, 9 months ago

An object representing a stream of data. Repeated calls to the iterator’s __next__() method (or passing it to the built-in functionnext()) return successive items in the stream. When no more data are available a StopIteration exception is raised instead. At this point, the iterator object is exhausted and any further calls to its __next__() method just raise StopIteration again. Iterators are required to have an __iter__() method that returns the iterator object itself so every iterator is also iterable and may be used in most places where other iterables are accepted. One notable exception is code which attempts multiple iteration passes. A container object (such as a list) produces a fresh new iterator each time you pass it to the iter() function or use it in a for loop. Attempting this with an iterator will just return the same exhausted iterator object used in the previous iteration pass, making it appear like an empty container.

Python 3 - Django: ImportError: No module named 'django.core.urlresolvers'

Varghese Chacko 3 years, 1 month ago

Python 3 - Django 2.x: ImportError: No module named 'django.core.urlresolvers' is a common error we get when we migrate from python 2.x to python 3.x and use latest Django > 2.0. the common error message looks like 

What is @permalink and get_absolute_url in Django?

Varghese Chacko 3 years, 2 months ago

What is @permalink and get_absolute_url in Django? When and why to use it?

Get the previous months name

Varghese Chacko 3 years, 2 months ago

Often we need to get previous months name in python, especially, when we have to save report from previous month's name. In python its is pretty simple. 

Let us talk!

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.