Chủ Nhật, 29 tháng 10, 2017

Auto news on Youtube Oct 29 2017

recently I have got a lot of requests to create a video tutorials based about

object-oriented programming so I have decided to create a three part video

series where I'm going to teach you about basics intermediate and advanced

settings based about object-oriented programming so in this first three that

I'm going to talk about the concept of object-oriented programming I will show

how to declare new class helped to create setters and getters what are the

properties and etc so let's do it

hey what's up guys Senaid here from codingpassiveincome.com the place where I help

others to become a web developer much easy and fast and then they will do it

on their own so if that is something that interests you consider subscribing

so now in order to explain the concept of object-oriented programming

let's imagine that you want to create our human population that we have on

this planet so as you can see we have over seven billion people in this world

and the problem is that if we want to do it from the coding side it will be

really challenging because we will need to create the same thing seven billion

plus times so now if we think about this and look each human we can notice some

patterns almost 99% of us have the same functionality the same visual appearance

so let's say that all of us have a head we have eyes we have nose mouth neck

arms somebody 2 legs etc we also have some here and really it's not important

so now if we think as a not only web developers but programmers in general we

will be smart if we create this as something abstract and then we just

multiply this a lot of the times but of course there are some things that are

different between each of us so some of those things are first-name lastname

maybe skin colour the hate debate etc and now with this object-oriented

programming what we are going to do we will just create something that is

almost the same for all of us and then to this class we will just give an

options to modify this class and then on that we create and new objects that are

basically everything the same with just the small difference so let's

say now if we have this class and we want to create a new person we will just

create it very simple we will just create create me new instance of this

class and we will get a new object which in our case of course is a new human ok

so this one will look like this and now all we need to do is just to apply and

call some methods which a procedural programming is function to just create

the difference between those two and now of course we will dust in a few lines of

the code create a lot of those so I know that this at the moment is very hard to

imagine but just remember that with the object-oriented programming what you are

doing we are actually creating one class that will have learning the same and

then in order to create a new object or instance of the this same class we will

just use one or two lines of the code and the calling the methods we will make

difference between each of them so as you can see now the object-oriented

programming is probably at the beginning fun and then you will find it very

frustrating and challenging and later you'll find it will be very cool so with

that being said please stay with me through all those steps and I'm sure

that one day we'll be happy that you took these steps so let me now show you

how to write the code and actually create some classes so now as I

understand the basic concept of object-oriented programming

let's create some class and set some setters and getters to this class so in

order to create some class we need to use the keyword class and after that we

need to give a name to this class so let's say it I will name it the person

and then we just need to open and close the bracket so now after this as you can

see this class doesn't have any method inside it so we can create some

and now before we even create any I want to show how to create a new object from

this class so let's say it will have a name maybe I better say Smith equal and

I will just say new person ok and now let's just try to execute this

I will hit refresh and there is nothing which means that our code is completely

defined but let's say that I'm going to create something that we are calling

construct ok and now you may ask so what is this function construct basically it

is a function that is called every time that we use the keyword new so if we do

not create one construct we won't call any but basically by default it will be

cold if it exists okay so let's try to do this and I will say echo new object

has been great okay and now let's try to refresh and now as you can see inside

our construct class we have got a response ok as you can see I didn't call

any method but just by using the word new this has been cold so let's say that

we will have one variable here so I will maybe say name and by default I will

just say that the name will be used ok and now inside this construct we can

pass some name so let's say name ok and in order for me to change this name

I will need to use the word this which means that we are referencing to the

current object and then I will say name = new name ok and now by default I

can say that this is an empty so I will say here F name is not empty we will

change the name of this person and then let's say I will create a new function

that we usually call getters sows a public function get name ok and I will

just say echo your name is and then he I will does say again this name ok and now

when I create a new person I will say he Senaid->getName okay so let's try to

refresh and now it says your name is user and the reason for that is because

of the construction we didn't specify any name so if I wanted to say Sanae I

was specified here and now if I refresh you can see that I will get your name is

Senaid and now as you can see at the moment we do not have any option to

change this name instead of at the time of the construction of the class so it

will be great to have a function that we call a setter which means that you are

able to change something inside this class souse a public function set name

and then I will specify name and say this->name = name okay so now

if we try to use it this way I will hit refresh and since your name

is user okay and here I will say Senaid set name so I will see Senaid so maybe

it will be better if instead of Senaid we use person okay so the name will be

Senaid and then again I want to say get name okay so let's see what we will have

refresh so as you can see it says your name is user and again it says your name

is Sydney which means that by doing this we'll have called the setters with the

name set name and then we have updated this variable okay so now if anytime you

want to get or to just change something you will always have to create setters

and getters now you may ask what if I try to do this so let's say I will touch

the like this and I will say echo person what do you think it will happen now if

i refresh now it says that object of class person could not be converted to

string which means that we are not able to just say echo person but we can do

something like this create a new function to strain which means that now

we are able to call it and to create some string so I can

say that we will return your name is by this okay and now if we refresh you can

see now that it is working but since we have he also get name and basically this

is the same we can change this to the return and here we will does say this

get name okay so what we are doing here basically from the method to string we

are calling the method get name and then this get name will return this message

so let's try refresh and it is the same result and of course if we want to

specify some name we can do it and this will be changed so as you can see now

this is where the real user is we can have different functions and each of

these function will do something really awesome at the moment it's really not

doing anything special but the understanding of those basics is

extremely important so let's now try to improve it even more so let's say that

this get name which by default not by default but this is the best practice is

that when you have the name of the function it should return only that so

if we say here get name then this function should return only the name and

not like we had in the previous example other characters so here now let's say

that we want to also set create a setter and getter for the last name

maybe I'll just duplicate this and I will just say said last name so say he

was named okay and now the same he'll get last name

okay and at the top i will also define variable last name and for the last name

by default it will be empty and now on the construct i will set that we are

also able to provide first and last name okay i will duplicate this

my name okay so now when we create some person we are able to specify the first

name and also the last name and also we have setters and getters for this person

and as you can see now the function to string by default is returning only the

get name so maybe we should improve itself declare a new function and say

identify and then I will say return my name is and then I want to say this name

and this last name we could also here called methods for this but there isn't

any reason for that and then here in the third string I will just say this

identify okay of course we can add some other functions and properties like age

skin color etc but for now let's use it just this way okay and now as you can

see here we have person John and then let's specify some last name let's say B

okay that's person number one okay and then we also want to have person number

two so I will say person and this one will not have any name or last name I

want to set for that person using methods so I'll say person to say

name and I will say his name and then for the person - I've also said last

name I'll say as signals okay so those are just two persons and now let's try

to identify each of these persons I'll say echo person one so let's see what

the result will be so I will fresh and as you can say see it says my name is B

so let's see why is that

Sunday the program is here we made small mistake okay let's try again so for the

first person says my name is don't be okay and now let's say they'll just make

one new light and say echo person to identify so as you can see now I'm

directly calling the method identified instead of doing it this way so let's

try and as you can see now it says my name is Tom B and for this one it says

mine is Bessie note so let's see what is the problem with that okay here should

change this okay and let's try again okay and now as you can see we have

created a functionality where we are able to create two different persons and

now for each person we are able to manipulate in our case the name and last

name and we are able to get those informations on two different ways and

now as you can see this code is completely the same for both persons so

now in order to make our code a lot more readable you just can cut this I will

create a new file so let's say we will name it person dot class.PHP okay

and of course you can specify this dot class it's not a must but it's just a

good practice so that we know that this file contains some class okay and now we

will just include it here so I will say include person dot class.PHP and now

if we refresh the result will be the same

and now our code is really readable we don't have a lot of the functions and we

didn't write all of this code two times we made it only the ones so maybe at the

moment you are not able to see the real use it and how much powerful

object-oriented approach is so for that reason in the next two videos I'm going

to talk about intermediate and advanced it object-oriented programming so guys I

hope that you like this video if you do please like it and share with your friends

and also if you have any questions please ask in the comments below

take care

For more infomation >> PHP OOP Tutorial - Object Oriented Programming [Part 1] - Duration: 20:31.

-------------------------------------------

How to update or change PHP version on Ipage - Increase PHP Memory Limit On Ipage - Upload File Size - Duration: 3:43.

In this video , i'm going to show you

How to update PHP version on Ipage

At first Login your Ipage account

Scroll down and go to the Additional Tools Tab

Now click CGI and Scripted Language Support Button

This is the CGI and Scripted Language Support Page

Now click PHP Scripting Button

You can choose any version like 5.6, 7.0 or 7.1

Click Dropdown Menu and Select PHP version

Hit the SET button

Already updated PHP version 7.0

Now you can edit php.ini for increase upload file size, post max size, memory limit, input vars etc

Thanks a lot for watching the video. Please subscribe my channel.

For more infomation >> How to update or change PHP version on Ipage - Increase PHP Memory Limit On Ipage - Upload File Size - Duration: 3:43.

-------------------------------------------

How to Install Linux Nginx, MySQL, PHP (LEMP Stack )In Ubuntu 17 - Duration: 14:45.

Hey guy!

What's going on over there?

This is Kimsea from basicblogtalk.com.

Welcome to the video tutorial.

I hope this your second time so I need to say see you again here.

In this video, I'm going to show you how to install LEMP stack--linux, nginx, MYSQL, and

PHP.

I will use Ubuntu 17.

If you come with the other version of Ubuntu such as version 16, it would be working well

in tutorial.

So, no worry about it if you are using version 16.

Okay guys!

I'm not talking much about that so lets start in deep into the tutorial.

In order to follow this tutorial, you need to at least do the initial setup of your server

such as create the none root user and setup privileges.

and... setup basic firewall.

But in this case, we're not going to go with firewall, but at least you know how to setup

the basic firewall.

you know how to secure your server and connect your server with ssh.

So, I hope you do.

If you don't how to do that, please look down there to the description as I leave the link

to the tutorial over there.

So, hope you enjoy it.

Okay guys! now start connect the server with ssh.

I have saved my connection over here.

I just hit open connection.

And because this is the first time login.

I just setup and restore it from the snapshot so it is the first look login.

Just yes to confirm the risk.

And... start with a... kimseasok--the none root user.

And I give the ssh phrases password.

And if you don't how to create ssh keys for your server, you can watch the previous tutorial.

Look down there in the description.

Hope I'm typing correctly.

Again.

Okay.

This is the first time I log into my server.

As you can see, I have 67 packages need to be update and 41 updates are security updates.

So, I might need to start with a sudo...

sudo apt-get dist-upgrade hope I'm not typing it wrong.

just hit enter.

I just - y to auto-confirm It ask me the... sudo user--the super user's

password So, I just give what it wants

What the hell is going wrong?

sudo apt-get this upgrade.

yeah... it definitely wrong over here.

upgrade.

Okay. hope it's correct.

And it might take a few minutes so I will back after the upgrade process finishes.

Okay.

Guys!

I finished the upgrade process so the step I'm gonna here is I start with command list.

As you know, If I try to type the commands directly on the record time, I don't think

that our tutorial will go smoothly.

So, to save your time as well as to save my time, I need to prepare that command list

as usually we did.

So...

I just start again with sudo apt-get update to update the core environments.

And the next step I'm gonna do here is to install nginx web server.

But lets me show you here.

If I access to the server's ip.

Yeah.

It's not working either I access with domain url.

It should be here.

lets me copy it here.

I cannot lets me type it.

even if I access with the domain url, it's still not working because we not ready install

web server in order to host our website files.

So, it's supposed not to be working so lets me start with install nginx web server.

I just start with sudo apt-get install nginx I hit enter

I type yes and hit enter If you don't want to confirm yes, you need

to add -y fir auto-install Okay.

Once I install nginx.

Lets me refresh this.

And as you see, it's working over here.

Lets me refresh this one again.

Hopefully, it's working Oh.

Yeah.

That's working because It not point to my server ip.

Yeah.

It points to the wrong ip.

So, do that latter when we install WordPress.

So, I close this.

Okay.

Now I ready install nginx web server so now I can access to my server using the ip address.

And... it show this page.

So, the next step I'm gonna do is to install mysql server

And some guys called it mysql so you can call it whatever you want.

So in this case I called it mysql I just hit enter.

And y to confirm the installation It prompt me for the password for the root

user So I give what it wants

I just confirm the password Okay.

After I install mysql server on my server, I need to secure mysql installation.

mysql installation So I start with sudo mysql secure installation

just hit enter It prompt you the password of the root user

of mysql sever.

In this case, I just give it what it wants And... it asks you about the validate password

plugin So would you like to use it?

In this case, I just type yes and hit enter There are three options for you

0 for low security 1 for medium

2 for strong In this case, I will go with 2--the strong

password validation And hit enter

And as you can on this line, the estimated strength of the password is 100.

It means that my password is completely strong so I just hit enter to ignore the change

And... it asks me to remove anonymous user.

In this case, just yes And disable root login remotely

just yes.

It's a idea to do that remove test database

just yes And reload database previllage

Just yes Okay.

We now finish the mysql server installation so the next step we're gonna is to install

php on our server So...

I just copy the line.

We start with sudo apt-get install php-fpm and php-mysql

Guys!

It's a little bit different from Apache server --from the LAMP stack since we php-fpm.

You can learn more about fpm.

It stands for...

I don't know what is that I just forget it.

It just tell nginx to work with php So I just hit enter

And yes to confirm the installation

And the next step after you installed php, you need to php.ini

lets set a bit tricky work to make php more secure by change this line

Just copy it from here And I hit control w on my keyborad.

On the terminal, I right click on to past the line and hit enter

And here is the line And just delete the comment

the line is provides the real path for php translate for CGI

So it means that we're not going to allow php to execute everything it found.

It's not recommend for security So you just delete the line and change value

from 1 to 0 And control x, and y, and enter to finish

editing And after that, you need to restart fpm

Just restart it I start with sudo systemctrl restart php-fpm

Okay.

Here we go So now we ready finish install php, and the

next step is to configure nginx to use php So in this case, you will need to edit on

the default host file on the site available.

How can I pronounce that?

Sites available So I start with sudo nano

etc/nginx/sites-available/default just hit enter

we need to scroll down there And if you prefer to use ssl, you just uncomment

this 2 lines But in this case, I'm not going to it.

So lets scroll down there You need to tell nginx to load php.

No to load index.php first So just add index.php on the index search

On the server, just delete the underscore and past your server ip in there.

So I just copy my server ip from here Just right click over here

And...

Yeah.

this one is okay.

Okay.

I need to delete this line.

Just delete the hashtags sign I don't know how to pronounce that, by the

way.

Okay.

This line and also this line all of those.

Also this line And except this

But this ... And lets me make it clean

So I just delete this line also And also this line

And I make a comment over here Yeah.

That..

That's nice And I need to denied the htaccess file for

security reason So I just delete the comment over here

Also here It's supposed to be all.

Okay.

I just control x Y and hit enter

And then I need to test nginx.

Make sure it's working Okay.

The test is successful and we finish the configuration for nginx.

So now lets restart the nginx service hit enter

Okay.

So...

Guys.

Thanks for watching this video.

I'll finish this video from here.

The next video I will come with how to install wordpress on nginx.

Hope you subscribe for upcoming video.

And also, combine this 2 videos into a full tutorial.

And...

It would be great if you watch a long tutorial, but if on the short tutorial of the video,

just find the link down there for the upcoming tutorial.

Guys.

Thanks for watching.

And I have nothing to say now.

Just don't forget to hit thump up.

Share the video to your friends, your girlfriend, your not girlfriend.

And just do whatever as usually watch the tutorial.

Just hit and share it. and if you have question, complaint, or suggestion

about the tutorial, lets me know in the comment bellow.

And I will try respond to you as soon as possible.

Okay, guys! see you in next video bye.

Không có nhận xét nào:

Đăng nhận xét