- Local variables must be defined in camelCase starting with lowercase like, without underscores and without numbers:
- Should be used
letinstead ofvar
function getDetails(){
let name = 'React'
let version = 'V1'
...
}| const path = require('path'), | |
| webpack = require('webpack'), | |
| AssetsPlugin = require('assets-webpack-plugin'), | |
| BrotliPlugin = require('brotli-webpack-plugin'), | |
| HtmlWebpackPlugin = require('html-webpack-plugin'), | |
| UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | |
| const isProd = process.env.NODE_ENV === 'production'; | |
| /** |
| deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse | |
| deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse | |
| deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse | |
| deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse | |
| deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse | |
| deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse | |
| deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse |
| #!/bin/sh | |
| # PATH TO YOUR HOSTS FILE | |
| ETC_HOSTS=/etc/hosts | |
| # DEFAULT IP FOR HOSTNAME | |
| IP="127.0.0.1" | |
| # Hostname to add/remove. | |
| HOSTNAME=$1 |
| from threading import Thread,Lock | |
| """ | |
| How ro resolve a Race Conditions in Python | |
| Python is one of programming languages which support multiprocess and multi-threads and this is prety cool. | |
| At the end python is not one of the best for parallel programming but lets see how we can use and resolve a common problem which is : Race Conditions | |
| Before,I show you an example, first we should be familiar with this concept: Mutual Exlusion, Lock, Race Conditions | |
| Mutual Exlusion ?: When tow or more processes/threads wants to access to a shared resources, and after thread has accessed that resource than block all others concurrent | |
| Lock ?: A thread before accesses a shared resource, should graph or acquired a Lock,at this point all other councurrent are waiting for release of tha Lock. |
| from threading import Thread,Lock | |
| import sys | |
| """ | |
| Mutual Exlusion: | |
| When tow concurrent threads or processes want to use a shared resource, | |
| that means one thread block the concurrent since its is using that resource | |
| Process A |
| import json | |
| # Class Name : Contact | |
| class Contact_Old: | |
| #Class Attributes | |
| name = str | |
| subname = str | |
| tel = str | |
| email = str |
| import json | |
| #Class Name : Article | |
| # class Article: | |
| # # Class Attributes | |
| # title=str | |
| # author=str |
| ########################################## | |
| # Check if a range of numbers is sorted # | |
| ########################################## | |
| def isSorted(numbers): | |
| i = 0 | |
| for n in numbers: | |
| if i < len(numbers)-1 and n > numbers[i+1]: | |
| return False | |
| i = i+1 | |
| return True |