When I upload videos on my youtube channel, I always post it on this blog. But this blog's main focus is to provide more information on programming tutorials which comes in the category of EDUCATION. But the gaming is different, it is mostly an ENTERTAINMENT. So instead of promoting gaming videos on blog, I decided to open an instagram account where gaming videos are more suited.
1. In main.dart file, need to add new column called action, which will contain an EDIT button for each entry. For that, replace the “getDynamicTable” function with following code.
Table getDynamicTable() {
List<TableRow> rows = [];
rows.add(TableRow(children: [
Text("Id"),
Text("Name "),
Text("Address "),
Text("Actions"),
]));
if(employeeFinalList!=null)
{
for (int i = 0; i < this.employeeFinalList.length; ++i) {
2. Create a new dart file at the place where the main.dart file is present. Give it a name as “addEditPage.dart” and paste the following code inside it.
--------------------
3.
Observe that the function “insertPage” will be highlighted as an
error. We have to call create a new dart page which will have
“insertPage” as a class name.
So
create a new dart file, give it any random name.
Then
copy-paste the following code in that newly created file.
import
'package:flutter/material.dart';
class
insertPage
extends
StatelessWidget
{ //
This widget is the root of your application. @override Widget
build(BuildContext
context) {
Hey guys, we shall create a code to force browser to add slash at the end of URL using HTACCESS and PHP.
Make sure to use INCOGNITO mode while implementing this because sometimes the HTACCESS code remains in a cookies which won’t help to run the updated code of HTACCESS.
Currently in folder, we have some PHP files, each file contains some text.
And we have the REWRITE RULE in HTACCESS file which will allow you to run the file without using the “.php” extension. And the rule contains an ending slash in first parameter.
So if you enter the URL without extension and end with slash, it will run that page.
But if you remove the ending slash, it will give you a 404 error. The best solution is to forcefully add ending slash in URL using the code.
So in HTACCESS, write the following code, code link is given in the description.
Notice that this file is inside the “tutorial” folder which is inside HTDOCS folder of xampp.
You have to add the URL accordingly.
So I have already created an error.php page which will forcefully add slash. Code is given in the description.
Our strategy is to send the current URL as a request parameter when error occurs.
And as you can see, it redirects and ends with slash.
So that is it, thanks for watching. Like share and subscribe.
In
this video, we shall make a connection between private github
repository and live cpanel.
First
you must have a domain with
cpanel and a
github account.
I
purchased a
domain+cpanel
from godaddy. You can choose your own hosting providers but make sure
that the SSH access is enabled. For godaddy users, here is the path
to find and enable SSH access.
Next,
open github, login into your account, or create account if you don’t
have one.
Click
on plus icon which is before your profile pic, click on new
repository.
Give
any random name.
You
can make repository as private from here or
if you forgot to
make it private, you can make it afterward.
Just
go to settings tab, scroll
down, you will see, “Change repository visibility”, click
on a button in front of it and can click on private and
save it.
Now,
login into your domain’s cpanel.
Then
open PUTTY. If you don’t have it, download link is given in the
description. Install
it.
Now
copy the IP address from cpanel dashboard.
Paste
it in HOST NAME textbox, make sure that the SSH radio button is
selected, then click on OPEN.
It
will open a command prompt.
Type
the username which you use for login into cpanel.
Hit
enter.
Now
type the cpanel’s login password.
When
you type the password, it will not show anything
on command prompt, but whatever
you are typing is
getting stored in the background.
Once
you logged in, you will see something like this.
Once
connected, you will have to type the command to create public and
private key.
Now,
go to cpanel and SSH ACCESS : MANAGE SSH KEYS.
You
will see the newly created keys there.
Click
on MANAGE of the public key, AUTHORIZE it.
Let’s
jump to github, open your repository and click on settings tab, then
DEPLOY KEYS. Then ADD DEPLOY KEY.
Give
any key name.
For
public key, go to cpanel, and click on VIEW/DOWNLOAD link in front of
public key.
Copy
it from start to end and paste it in github’s key textarea.
Check
the ALLOW WRITE ACCESS, Of course we already can download files from
github to cpanel by default. But giving the WRITE ACCESS means, you
can upload changes from cpanel to github.
Once
done, open the putty command prompt, type
the following command to check if the
domain can
be connected to github or not.
Now
we are successfully authenticated.
From
github, lets create a new file. Type
anything there. Give
it any random name.
Scroll
down and commit the change.
You
will have a new file in
your repository.
Go
to cpanel dashboard, click
on git version
control, then
CREATE.
Now
open github, click
on code, then click on SSH tab, copy
the text from the textbox.
Paste
it in CLONE URL
textbox of cpanel.
For
repository path, you can not add those folders which not empty.
For
example if I add public_html folder which already has so many files
and try to clone
it, it will give me an error.
So
you can either
empty the
public_html folder or create
a new empty folder which is what I am going to do.
Now
you can create a clone of private github repository.
You
will be redirected to GIT repository listing. Click
on the MANAGE button.
And
click on PULL OR DEPLOY.
You
will see that those UPDATE AND DEPLOY buttons are disabled.
First,
lets check if our original file is copied to our
website’s
directory by going to the FILE MANAGER.
The
file is there and it contains the text that we typed.
Let’s
do some changes in github file and try to reflect it to our live
site.
To
synchronize or pull the changes, lets
go to CPANEL’s dashboard : Git version control : MANAGE
: PULL OR DEPLOY
and click on UPDATE FROM REMOTE.
Lets
again go to file manager, and view
the file.
Changes
are reflected there.
So
that is it, thanks for watching. Like share and subscribe.
6.
If you want data to be displayed as soon as the app is loaded, then
add the following code inside the curly bracket of “Widget
build(BuildContext
context)”
In
my last flutter database tutorial, I displayed data from table but in
columns rather than rows.
This
tutorial is a continuation of the previous tutorial.
In
this video, we
shall display data
in
flutter table. This
tutorial is divided into
2 phases.
Phase
1 is where we are converting data from separate columns into map.
In
phase 2, we are displaying
those map values
in table rows.
If
you already have the map
structure ready, then skip to
phase 2.
Also,
I provided the code link in the description, you just have to
copy-paste the code as
per the instructions.
1st
point says, we have to copy-paste
the line just after the declaration of a class which is extending the
STATE.
2nd
point is to copy-paste the whole code just
before the ending
curly bracket of the
same class which is extending the State.
3rd
point is to, paste
this
line after the for loop inside the function which we created to get
table data. In my
case, the function name
is DBConDisplay.
Now,
lets refresh the project and see if there map is displaying the data
or not.
If
the map is displaying in a proper format, it means that our first
phase is complete.
In
second phase, we shall
be adding that map inside flutter table.
So
according to the 4th
point, remove the
CENTER function completely and add the code given in the 4th
point. Make
sure to add comma at the end of the
code where you pasted
that function.
As
you can see,
android studio shows an error at getDyanamicTable function because
we haven’t created that
function yet.
From
5th
point, copy the code and paste it just after
the ending curly bracket of widget build function.
Save
it.
Now
if you have HOT RELOAD enabled, you will see the table appeared on
ANDROID SIMULATOR screen. If
not, don’t worry. Just
go to
the 6th
point.
From
6th
point, copy the code and paste it inside
widget build’s curly bracket.
Now,
refresh the app, it will display the data as soon as the app loads.
I
added some unnecessary
texts here, I shall remove it from the document.
So
that is it, thanks for watching. Like share and subscribe.