What are jQuery selectors and how to cache jQuery selectors to improve performance of your web page

Every time you use a selector the elements in Document Object Model (DOM) are searched to match your query or selector. Doing this kind of works too often or repeatedly will decrease the performance of your web page. If you refer to a specific selector too often or repeatedly you should consider to add it to a cache by assigning to a variable. Before diving into the actual example I am going to first tell you, what are elements and what are selectors?

Continue

Single or Multiple Files Upload Example in Django Framework

In your application or project there is always a requirement for uploading a file data. This file data could be in a specific format depending on your requirement. Here I am going to explain you how you can upload single or multiple files in your python based Django framework. I am assuming you have a basic knowledge on Python and Django framework before you proceed further. I am also going to show you how to implement CSRF token for uploading files.

Continue

MongoDB Aggregation Operations

You are not going to always return records from MongoDB but sometimes you need to perform some computations such as sum, count, average, etc. Here you need the aggregation operations which are used to process data that return the computed results. Therefore aggregation actually groups data from multiple documents and performs a variety of operations on the grouped data to return the single result. Aggregate operations retrieve a single value after performing a calculation on a set of values. Often aggregate functions are accompanied by group clause in the find()…

Continue

MongoDB find() method with Projection

You may not want to fetch a whole bunch of data from the document which is stored in a collection in your MongoDB database. You can restrict the number of records or data using different conditions with the help of WHERE, AND, OR and IN operators, but what if you want to restrict the data you want in your particular row or record or document. So here comes the projection that helps you to selectively choose data from a record or row or document. In MongoDB, projection means selecting only…

Continue

How to query documents – WHERE, AND, OR, IN conditions in MongoDB

MongoDB is one of the most popular NoSQL database where data are stored in the form of documents. You can also create tables in traditional way to put your structured data but the main purpose is to store unstructured data in the form of object which may vary based on a particular requirement. Now when you select data from collection, you may not need all data to be fetched from the database collection and you want to restrict those data based on certain criteria or conditions while fetching from database.…

Continue

How to make output of MongoDB’s find() readable in shell

MongoDB is one of the most popular NoSQL database where your data are stored in a collection. To quickly access your data from MongoDB you can execute commands on MongoDB shell and your results appear based on the given criteria. One of the commands is find() function and using this command you can easily retrieve data from MongoDB collection. When you execute this find() command to retrieve data from a collection, it displays data in one line which makes it ugly and become difficult to read specially when there multiple…

Continue

How to pretty print JSON in Java

Here I am going to show you how to pretty print JSON in Java. I am going to use here JSON, Jackson and Google Gson library to prettify the JSON. I am also going to show you how to read and write JSON file using Java 8 or later version. I am going to show you how to prettify JSON string as well as JSON file data. Why do you need to prettify the JSON data? Because you want to read this JSON data manually when you received this data…

Continue

How to load local JSON File in Angular Application

JSON, i.e., JavaScript Object Notation is a lightweight format for interchanging data. It is based on a subset of JavaScript language. For example, this JSON data format is used in the webservice response. In old days webservices used XML for the primary data format but nowadays JSON, being lightweight, is becoming the preferred data format for exchanging data for most of the webservices. JSON is built on two structures: A collection of name/value pairs. In various languages, the JSON structure is realized as an object, record, struct, dictionary, hash table,…

Continue

How to merge two separate branches using Tortoise Git client

Here I am going to show you how to merge two separate branches into one using tortoise git client. Generally you or development team need to maintain separate line of development in different branches. So at some later point of time you need to merge your changes into another branch. Your team may manage different branches, such as feature branch for developing your features and changes are committed into feature branch and finally merged each feature branch into development branch and development branch to master branch that is generally remain…

Continue

How to clone and create remote Git repository branches using Tortoise Git

Here I will discuss on how to clone and create branch using tortoise git client. I assume here that a master branch already exists in the remote git repository. I will show you here how to clone the master repository in your local system using git client. You can also use the command line tool to clone the remote repository in your local system. Once cloning is done then I will show you how to create a development branch and a feature branch. For this example, I have a master…

Continue