Python cProfile – A Helpful Guide with Prime Example

Python comes with different profilers. If you’re new to performance optimization, you may ask: what’s a profiler anyway? A performance profiler allows you to monitor your application more closely. If you just run a Python script in your shell, you see nothing but the output produced by your program. But you don’t see how much bytes were consumed by your program. You don’t see how long each function runs. You don’t see the data structures that caused most memory overhead. Without those things, you cannot know what’s the bottleneck of…

Read More

Ahmed Bouchefra: Django 3 Tutorial & CRUD Example with MySQL and Bootstrap

Django 3 is released with full async support! In this tutorial, we’ll see by example how to create a CRUD application from scratch and step by step. We’ll see how to configure a MySQL database, enable the admin interface, and create the django views. We’ll be using Bootstrap 4 for styling. You’ll learn how to: Implement CRUD operations, Configure and access a MySQL database, Create django views, templates and urls, Style the UI with Bootstrap 4 Django 3 Features Django 3 comes with many new features such as: MariaDB support:…

Read More

JavaScript Calculator Example

In this tutorial, I will tell you two ways to make a calculator using basic HTML, CSS and JavaScript. In first way we make functions for all operations and in the second we use some inbuilt global function to make a calculator. In both cases we are going to add some simple math operations like addition, subtraction, multiplication, division in our basic calculator. This project will help you to improve your logical ability and coding skills. JavaScript Calculator Example Method 1: Mainly the functions that we need to work for…

Read More

How to Remove a Key, Value, or Entry from an HashMap in Java 8 – Example Tutorial

In the last article, I have shown how to remove key/value pairs from a map in Java based upon some conditions like remove all entries where values are greater than some values. I have told you that you must use the Iterator's remove() method for removing mapping while iteration to avoid ConcurrentModificationException, but that's not required anymore in Java 8. From JDK 8 onwards, you can selectively remove mapping without iterating over Map. The JDK 8 API has added several new methods to existing interfaces e.g. java.util.Collection, java.util.Map, Comparator etc…

Read More

Retrofit 2 – Service generator example

Though we can easily create Retrofit instances on demand for different client in place, having a dedicated factory method or service generator method is definitely desirable. In this service generator, we can have centralized place to add/modify the authentication, logging and error handling logic. 1. Retrofit service generator A service generator class defines one method […] The post Retrofit 2 – Service generator example appeared first on HowToDoInJava.

Read More

How to Create a Good MCVE (Minimal Complete Verifiable Example)

Reporting a bug takes time, and trust me, every vendor appreciates your reporting of a bug! Your voice counts as many voices, for all the other customers of a product who do not want to or cannot take the time to report the same bug are numerous. So, first off, thanks for taking that time and reaching out to us vendors. We really appreciate your help! Having said so, reporting a bug can be a tedious exercise. For both parties, the one reporting the bug and the one receiving it.…

Read More