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.
Note : Watch the video if you are confused to you want to see the practical approach of instructions which are given below.
########## START ##########
1. In “pubspec.yaml” file, inside “dependencies”, after
“flutter”, paste the following code (make sure that following
code should be at the same level as “flutter”):
sqflite: any #stable
version at the time of publishing this article
path_provider: any
#stable version at the time of publishing this article
intl: ^0.15.7
--------------------------
2. Create
“database_connector.dart” file at the level of "main.dart" (or
at any place which contains dart files )
Then paste the
following code in “database_connector.dart” file:
Hey
guys, now we shall
be connecting the flutter app with database and Insert data. Also we
shall display a data but only in console as our main aim is to
connect database
on SQFLITE.
Now,
I created a blog which contains steps & code. Link
is given in the description. Then you just have to follow my steps as
per the video.
First,
we shall create a new flutter application. I am using Android studio.
Observe
that in project explorer, there is a “lib” folder and inside it
is a dart file.
Now,
the first step is
to copy code from 1st
point and open “pubspec.yaml” and paste code inside dependencies
but at the same
level as
flutter text.
Then
a bulb symbol will appear. Click on “pub get”. It shall download
dependencies.
Or
you can click on the link which appeared at the top side of window.
Lets
run an ANDROID SIMULATOR and RUN the project. It will take several
minutes to run the
project first
time.
Once
ran,
click on the bottom button which increases the CLICK COUNT and
displays on screen.
In
second step, we have to create a dart file with any name. I would
prefer database_connector.dart. Make sure that it should be created
inside “LIB” folder.
If
you so desire, you can create a package folder and add that file
inside it just like I am
doing in this
video.
Copy-paste
the whole code from point 2 and paste it in database_connector.dart
file.
In
third step, you have to import that file &
other libraries.
So
paste the code at the top of main.dart file.
Then
you need to give specific location of database_connector file. That
is, your project name which
in my case is “”tutorial1, then
/, then
package name if
you database
connector file is inside it,
then /, then
database connector file name.
Copy
the code from 4th
point,
Go
to the ending
curly bracket of class which is extending STATE class.
Paste
the code just above the ending
curly bracket.
5th
point
is to call a simple function called JustPrint on press of a button.
SAVE
all files, Refresh
the app. Or enable the HOT RELOAD.
The
navigator for RUN Console is available at the bottom of android
studio. As you can see that this function is only printing the text
in RUN CONSOLE.
6th
point is just that.
Now
in 7th
point, we have to call DBConInsert on button’s press event. That
function will create a database, an employee table and insert one
row.
SAVE
IT and DO REFRESH if you don’t have HOT RELOAD.
Once
clicked on button, it will display a
new ID’s value
in console.
Sometimes
you may get this error. Just simply close SIMULATOR and ANDROID
STUDIO OR VISUAL STUDIO CODE and restart them. And do this step
again.
Now,,
if you get an ID on click of button, go to 8th and last
step. And copy DBCONDISPLAY function and paste it at on press event
of button.
Click
on button and you will get all the data in console. Lets insert new
row. And display them again to confirm.
Now
you can play around with code and you can figure out how the code
works.
So
that is it, thanks for watching. Like share and subscribe.
------------------------------- Hey
guys, in this video, we are going to download some free effects in
WONDERSHARE Filmora X. Before I start, one thing to let you know is
that this video is only for those who purchased a license for this
product. Means it is not for CRACKED VERSION.
I
have 1 clip and there are some effects already present however you
can download some extras legally.
Open
the browser and search filmstock wondershare.
Go
to filmstock.wondershare.com link.
Now
click on JOIN FREE.
Click
on “CREATE ACCOUNT” on free column.
You
can register and you may get verification email.
However
I already created one account so I shall click on login.
I
don’t know why they ask you to login twice but any ways.
Login
and then click on effects menu.
You
can see the green circle which means that effect is free.
I
shall find other one because I already downloaded it.
Here
is one called 2D Business Pack.
You
will see FREE DOWNLOAD button. Click on it.
Then
click on OPEN of popup button. Some browsers may show different text
instead of OPEN, so click on button other than CLOSE.
It
will open filmora’s window and it will start downloading.
It
says there are 9 title, 20 elements, 3transitions and 5 overlays.
After
that, close this window.
Now
if you check EFFECTS tab, you will see a new menu called 2D Business
pack.
You
can drag-and-drop those effects.
Also
in TITLES tab, click on newly downloaded menu, and put any one on
video.
> SELECT *,greatest(maturity,death) as insurance_date FROM `insurance` order by insurance_date DESC
> SELECT *,least(maturity,if(death='0000-00-00 00:00:00',maturity,death)) as insurance_date FROM `insurance` order by insurance_date DESC
In MYSQL, GREATEST and LEAST are the functions which compares columns columns rather than rows. Best example is an Insurance company’s data where admins want to figure out the day a customer gets his/her money by comparing which date comes first, a maturity date or death date.
Hey guys, in this video I am going to sort the table by comparing multiple columns.
For example, I have an insurance table, and two columns, maturity and death have the date-time as data-type.
First we shall sort it by the maximum date among maturity and death, so we shall use the GREATEST function and add columns which will be compared.
We give that value of function as “insurance_date” and then use the ORDER BY clause.
Now as you can see, it gives the output based on which date is maximum and sort accordingly.
However in insurance, the lowest date matters because company has to give money based on which date occurs first.
So for that we are going to use LEAST function.
But the problem is, if a person is not died then, of course the date field will be empty so the output is incorrect.
To fix that, we have to overwrite the the death date. We are going to use the IF condition inside LEAST function, and if death date is zero, we overwrite it with a maturity date. Also, Maturity Date shouldn’t be empty in any case.
And now we got the output we wanted.
Query link is given in the description.
Don’t forget to like, share and subscribe.Thanks for watching.