Framework

How to Install Yii2 Advanced via Composer

The main reason for migrating to Yii2 Advanced Template is for the implementation of user management features such as listing, login, exit, and...

[Yii2] How to create and use Functions on Yii2

A function is an organized and reusable block of code that is used to perform one related action or achieve a specific result. In creating...

How to disable Directory Listing using .htaccess

Directory Listing allows your website visitors to get a complete list of all the files and folders that live on your site. The browser will display...
How to Use VoidCallback and Function(x) Callbacks to Communicate Between Widgets in Flutter

How to Use VoidCallback and Function(x) Callbacks to Communicate Between Widgets in Flutter

In Flutter, communication between widgets can use VoidCallback and Function Callback. VoidCallbacks are callbacks that don't return a value to the Parent Widget. This is useful if we only want to notify the Parent Widget of events that occurred on the Child Widget. The Function Callback is a callback that notifies the Parent Widget of an event that occurs in the Child Widget and also returns a value to the Parent Widget. typedef VoidCallback = void Function(); VoidCallbacks and Function Callbacks are both functions. The only difference is that VoidCallback has no arguments and returns no data. In this article, Bardimin will give a simple example of using VoidCallback and Function Callback in a simple application 1. Create a new Flutter project As a first step, create a new Flutter project with Android Studio. You can check out the Flutter and Android Studio integration in the article How to Easily Install Flutter on Android Studio and Windows. Once the new project is created, we will...

How to Change Minsdkversion in Flutter

How to Change Minsdkversion in Flutter

When working with Flutter and using external packages, you often have to change Minsdkversion according to the package you are using. There are several ways to change Minsdkversion in Flutter, for more details, follow the following article. Flutter Before Version 2.8 Open the file “ build.gradle ” in “ Project > android > app > build.gradle ”.In " defaultConfig " change the value " Minsdkversion ".Run " flutter clean ". Flutter After Version 2.8 Open the file “ local.properties ” in “ Project > android > local.properties ”.On the last line add: flutter.minSdkVersion=21 flutter.targetSdkVersion=30 flutter.compileSdkVersion=30 Then on " build.gradle " change it to . minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger() targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger() Run " flutter clean ".

Easy Ways to Install Flutter on Android Studio and Windows

Easy Ways to Install Flutter on Android Studio and Windows

Flutter is an open-source framework developed by Google for building beautiful, natively compiled, multi-platform applications from a single codebase. As a mobile app SDK, Flutter enables developers to develop high-quality native interfaces for iOS, Android, Web, macOS, and Linux devices using a single codebase. This allows developers to write code once and use it on different software. In this article, Bardimin will provide a guide to installing Flutter on Android Studio and Windows. Minimum System Requirements To be able to use Flutter on Windows, you must ensure that the system you are using meets the following requirements: Minimum operating system Windows 7Storage space: 1.64 GBWindows PowerShell 5.0 or later (pre-installed on Windows 10)Git for Windows 2.x. Install Flutter SDK Download the latest version of Flutter SDK Stable Channel.Extract the downloaded zip file to " C:\flutter ".Update Path on " Environment Variables " Windows. You can open it via “ System Properties >...

How to Enable HTTP/2 in Apache XAMPP

How to Enable HTTP/2 in Apache XAMPP

The HTTP/2 protocol is faster than HTTP/1.1 because it can handle resource queues and handle them simultaneously. HTTP/2 uses a single TCP connection to send multiple streams of data at once so that one resource does not block another resource. HTTP/2 does this by splitting the data into binary coded messages and numbering these messages so the client knows which stream each binary message belongs to. Whereas HTTP/1.1 loads resource one by one, so if one resource can't be loaded it will block all other resources behind it. Therefore HTTP/2 has better performance and speed than HTTP/1.1 If you want to enable HTTP/2 on the Apache Web server, you can follow the guide that Bardimin made below. 1. Enabling Apache HTTP/2 Module As a first step, you need to enable the HTTP/2 module on Apache. Open the file “ httpd.conf ” which is the main configuration file of Apache. If you are using XAMPP, you can find it in “ C:\ xampp \apache\conf\ httpd.conf ”. Look for " mod_http2.so " and uncomment...

How to disable Directory Listing using .htaccess

How to disable Directory Listing using .htaccess

Directory Listing allows your website visitors to get a complete list of all the files and folders that live on your site. The browser will display all the contents of the directory if you do not create an “index.html” file in that directory. Protecting your directory by preventing or disabling Directory Listing from your website visitors will increase the security of your website. At least it will make it difficult for people who intend to find security holes on your website. If you do not protect the directory that you create when someone accesses the directory, it will appear as follows. You can see all the contents of the directory will appear in the browser. To protect it, you can add an empty " index.html " file in each directory you create. Another way is to add the file “ .htaccess ” to the root of your website. You can create the file with Notepad and add the following code to the “.htaccess ". Options All –Indexes Internal Server Error message will appear in the browser, as...

[Yii2] Cache Speed Comparison

[Yii2] Cache Speed Comparison

Most website developers tend to ignore caching without realizing that it can harm their applications. A one-second delay in access time can mean you're losing customers or users to competitors. Yii2 supports caching in a variety of methods. Supports fragment caching, data caching, page caching, and dynamic content. Cache storage components can be exchanged without having to change the code that uses the cache. In this article, we will make a comparison of cache speeds in several methods. Without using cacheFileCacheDbCacheRedis Steps to make a cache speed comparison on yii2 Set up a table by using MySQL CREATE TABLE 'test_cache' ( 'id' INTEGER(11) NOT NULL AUTO_INCREMENT, 'data' VARCHAR(20) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY USING BTREE ('id') ) ENGINE=InnoDB AUTO_INCREMENT=1 ROW_FORMAT=DYNAMIC CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci'; Create a simple table with id and data columns. Then create a record for the table. In this trial, we added a data...

[yii2] Gii CRUD Template for One Page Ajax

[yii2] Gii CRUD Template for One Page Ajax

Gii is an extension, which provides a web-based code generator to generate models, forms, modules, CRUDs, and so on. By default, the following generators are available Generator Model - Generates an ActiveRecord class for a specified database table.CRUD Generator - Generates controllers and displays that implement CRUD operations (Create, Read, Update, Delete) for the specified model.Controller Generator - Generates a new class of controllers with one or more controller actions and a corresponding display.Form Generator - Generates a display script file that displays the form to collect input for the specified model class.Module Generator - Generates the outline code required by the Yii module.Extension Generator - Generates the files required by the Yii extension. By using Gii, writing code becomes faster and easier. When we want to make CRUD operations happen on one page, without switching pages, the default template from Gii can not do that yet. In this article, we will learn to...

Real-Time Application Dashboard with Yii2, Node.js, MySQL and Chart.js

Real-Time Application Dashboard with Yii2, Node.js, MySQL and Chart.js

In this article we will create a dashboard that can display graphics from data in real-time. The data we use as simulations is the population of a city. If you update your resident data, add or delete it, the graphic will change in real-time without the need to refresh from the page. Before we begin, we need to prepare: Webserver is installed, see How to Configure Virtual Host XAMPP in Windows 10.Yii2 is installed, see How to Install Yii2 Advanced via Composer.Node.js is already installed, see Create real-time applications with Nodes.js.Chart.js. Steps to Create a Real Time Application Dashboard with Yii2, Node.js, MySQL and Chart.js A. Create a table with MySQL Create tables with the name "city", and columns with the names "id" and "population". Or it's easier to run the following sql scripts. CREATE TABLE 'city' ( 'id' CHAR(16) NOT NULL PRIMARY KEY, 'population' INT(11) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; B. Create a Node server.js Set up a Node server.js as...