Guidelines for building a secure Web application/Mobile application – Part 1 Front-end

Security is the biggest concern while building web applications. Most of the web applications handle a lot of sensitive data and it is necessary to provide adequate security to protect this data from perpetrators. This series of articles discuss various security issues, types of attacks and guidelines to be followed for building a  secure application. Front-end    The basic security features that should be implemented in every web application front-end are as follows. Request Method – All sensitive data should be sent to the server via a POST request only. All form submissions should be via POST method. GET method sends the data to the server in the URL whereas the POST method sends the data in the body of the request. Thus sending the form submission data via the POST method makes the data less exposed.GET method should be used to fetch data only. While doing data pagination, the page number or limit can be sent to the server via GET request. Sensitive data should only be sent via a POST request. Examples for sensitive data are passwords, usernames, customer details, OTP, Bank account numbers, etc. Validations must be performed on every input Validations – Validations should be ensured on all inputs…

Binary Tree,Max Heap, Priority Queue and implementation using Javascript
Javascript , programming concepts / June 9, 2018

Binary tree is a tree in which every node can have maximum of 2 children.In a binary tree data structure , every parent node can have at most two child nodes.Below is an example of a binary tree. The node with value 100 is the root node.The value 50 and 20 are leaves. A max-heap is a complete binary tree (every node has two children apart from leaves) in which the value in each  node is greater than or equal to the values in the children of that node. It means that the value of the root node will be the maximum.For a min heap the value at the root node should be the minimum. Below you can find example of a max-heap. The array representation of the above binary heap is given below.We start indexing from 1 and leave the 0th index.

  As you can understand, for every node with index i ,the left child is having index 2i and the right child is having index 2i+1.The children are filled in from the left  . If we add another number 50 ,then it will be the child  of  14( 4th index).

So while on insertion , heap is…

Implementing priority queue in PHP
PHP , programming concepts / June 2, 2018

Queue is a First In First Out(FIFO) Data Structure.In a priority queue, an element with high priority is served before an element with low priority.The Standard PHP Library has the SplPriorityQueue class which can be used to implement priority queue.The insert(‘item’,priority) method is used to insert item and the corresponding priority in to the queue.See the below example to see mail sending to different mail id’s that have different priorities.You can use while to iterate thorough the queue and process each one or the results. SplPriorityQueue A priority queue can be implemented using many of the data structures that we’ve already studied (array, inked list, binary search tree). However, those data structures do not provide the most efficient operations. To make all of the operations  efficient, heap can be used . SplPriorityQueue is implemented using Max Heap

     

Share this page in social media platforms