Skip to main content

Posts

Showing posts from October, 2019

What's New in PHP 7

The following are some of the new features PHP 7 1 - Scalar type declarations : if you use the declare(strict_types=1); then the parameter would be strict, i.e folat means float only if you pass anything else it will through the error, declare(strict_types=1); function returnsum(float $a, float $b)  { return $a + $b; } returnsum(3.1, 2.1); // output float(5.2) returnsum(3, "2 days"); // Fatal error 2 - Return type declaration : same as scaler type declaration, we can use the return with in a function with strictly. declare(strict_types=1); function add($a, $b): int { return $a + $b; } var_dump(add(1, 2)); var_dump(add(1, 2.5)); // output will be // int(3) // Fatal error 3 - Null Coalescing Operator : if the value is exists and not null, then it returns the first operand, otherwise it returns the second operand. $username = $_GET['username'] ?? 'not define'; // Fetches the value of $_GET['username'] and returns 'not def...

Web Application Security

Application security : Some of the following Application security is exist in web development, These are in the order of most attacked at the level 1, 1 - Cross site scripting 2 - SQL Injection 3 - File Upload 4 - Cross site request forgery 5 - Local file inclusion 6 - Remote code execution 7 - Full path disclosure 8 - Remote file inclusion 9 - Authentication Bypass 10 - General bypass 11 - Open direct 12 - XML external entity 13 - Denial of services 1 - Cross site scripting (also known as XSS):   XSS vulnerabilities target scripts embedded in a page that are executed on the client-side (in the user’s web browser) rather than on the server-side. Let suppose end user fill the form and put the script tag in the textfield, this script is stored in the database field.  When this field shows in the web then this script would be executed and harm the web , Some common attacks are like , change the image source , fire any event, or steal the cookies. C...

Drupal 8 Themings

Why Create Subtheme in drupal 8 , If you directly change on main theme and update the new version then all the changes would be lost. YAML file structure 1 - Tabs are NOT allowed. Use spaces ONLY. 2 - Properties and lists MUST be indented by two (2) spaces let theme name is fullfillness What are the files needed to create a theme 1 - .info.yml 2 - .libraries.yml 3 - .breakpoints.yml 4 - .theme  - create fullfillness.info.yml   - if theme has space then, replace the underscore with space in file name and folder name  - minimum required properties (name, type, and core)  key value pair in the info.yml file libraries (optional) A list of libraries (which can contain both CSS and JavaScript assets) to add to all pages where the theme is active. Read more about themes and asset libraries. libraries:   - fluffiness/global-styling libraries-override (optional) A collection of libraries and assets to override. Read more at Overridi...

MYSQL index

Introduction to index MySQL uses indexes to quickly find rows with specific column values. Without an index, MySQL must scan the whole table to locate the relevant rows. The larger table, the slower it searches. Creating indexes An index is a data structure such as B-Tree that improves the speed of data retrieval on a table at the cost of additional writes and storage to maintain it. When you  create a table  with a  primary key  or  unique key , MySQL automatically creates a special index named  PRIMARY . This index is called the  clustered index . The  PRIMARY  index is special because the index itself is stored together with the data in the same table. The clustered index enforces the order of rows in the table. Other indexes other than the  PRIMARY  index are called secondary indexes or non-clustered indexes CREATE TABLE t ( c1 INT PRIMARY KEY , c2 INT NOT NULL , c3 INT NOT NULL , c4 VARC...

Typescript Tutorial 1

What is TypeScript? typeScript is an open-source pure object-oriented programing language. It is a strongly typed superset of JavaScript which compiles to plain JavaScript. It contains all elements of the JavaScript. It is a language designed for large-scale JavaScript application development, which can be executed on any browser, any Host, and any Operating System. TypeScript cannot run directly on the browser. It needs a compiler to compile the file and generate it in JavaScript file, which can run directly on the browser. The TypeScript source file is in ".ts" extension. We can use any valid ".js" file by renaming it to ".ts" file. TypeScript uses TSC (TypeScript Compiler) compiler, which convert Typescript code (.ts file) to JavaScript (.js file). What is ES6 :   ES6 refers to version 6 of the ECMA Script programming language. ECMA Script is the standardized name for  JavaScript , and version 6 is the next version after version ...