210 – 17 group student Yuldoshev Ubaydullo’s final control work from web application development


Download 0.83 Mb.
bet2/2
Sana24.06.2020
Hajmi0.83 Mb.
#121332
1   2
Bog'liq
Yakuniy WEB

== operator


The most common way you will see of comparing two strings is simply by using the == operator if the two strings are equal to each other then it returns true

strcasecmp Function



The previous examples will not allow you to compare different case strings, the following function will allow you to compare case insensitive strings.

PHP provides several functions for comparing strings. In addition to case-sensitive comparison of two strings with strcmp, you can also perform case-insensitive comparisons with strcasecmp, natural order comparisons with strnatcmp and strnatcasecmp, and comparison of a specified number of characters at the beginning of strings with strncmp. You can also compare one string with a selected portion of another string using substr_compare. Plus you can use comparison operators to compare strings. We will start there.



2). Permits related to administration “SHUTDOWN”

(Маъмурлаш билан боғлиқ рухсатлар SHUTDOWN)

Each entity registered in a computer system (a process that moves on behalf of a user or a user) is associated with information that identifies it in a sense.

This can be a number or a string of characters that names this subject. This information is called the subject identifier. If a user has an identifier registered in the network, it is considered a legal (legitimate), otherwise a non-legal (illegal) user. Before using computer resources, the user must go through the process of identification and authentication of the computer system. In the example above, we created a child application context, then used the close() method to destroy it.

If we want to close the current context, one solution is to simply call the actuator /shutdown endpoint.

However, we can also create our own custom endpoint:

@RestController

public class ShutdownController implements ApplicationContextAware {

     


    private ApplicationContext context;

     


    @PostMapping("/shutdownContext")

    public void shutdownContext() {

        ((ConfigurableApplicationContext) context).close();

    }

 

    @Override



    public void setApplicationContext(ApplicationContext ctx) throws BeansException {

        this.context = ctx;

         

    }



}

Here, we've added a controller that implements the ApplicationContextAware interface and overrides the setter method to obtain the current application context. Then, in a mapping method, we're simply calling the close() method.

In this quick write-up, we've covered few simple methods that can be used to shut down a running Spring Boot Application.

While it's up to the developer to choose an appropriate a method; all of these methods should be used by design and on purpose.

For example, .exit() is preferred when we need to pass an error code to another environment, say JVM for further actions. Using Application PID gives more flexibility, as we can also start or restart the application with the use of bash script.

Finally, /shutdown is here to make it possible to terminate the applications externally via HTTP. For all the other cases .close() will work perfectly.

Finally, we can also shut down a Spring Boot Application from outside the application by using a bash script. Our first step for this option is to have the application context write it's PID into a file:


SpringApplicationBuilder app = new SpringApplicationBuilder(Application.class)

  .web(WebApplicationType.NONE);



app.build().addListeners(new ApplicationPidFileWriter("./bin/shutdown.pid"));

app.run();

Next, create a shutdown.bat file with the following content:

1

kill $(cat ./bin/shutdown.pid)

The execution of shutdown.bat extracts the Process ID from the shutdown.pid file and uses the kill command to terminate the Boot application.

3). Reworking processing sequential data entry in YII

Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or [ji:]) is an acronym for "Yes It Is!". This is often the accurate, and most concise response to inquires from those new to Yii:

Is it fast? ... Is it secure? ... Is it professional? ... Is it right for my next project? ... Yes, it is!



YII is a universal framework and it can be used for all types of web applications. Thanks to its component structure and excellent support for caching, the framework is mainly useful for large projects such as portals, forums, CMC, online stores or RESTful applications.





Reworking queries in YII



:

namespace app\models;

use yii\base\Model;

class ContactForm extends Model {

public $name;

public $email;

public $subject;

public $body;

}

public function attributeLabels() {



return [

'name' => ‘Исмингиз',

'email' => 'Email манзил',

'subject' => \Yii::t('app', Сарлавҳа'),

'body' => \Yii::t('app', Матн '),

];


}

Creating views:



use yii\helpers\Html;

use yii\widgets\ActiveForm;

$this->title = 'Login'; ?>



title) ?>





field($model, 'username') ?>

field($model, 'password')->passwordInput() ?>



?>
Download 0.83 Mb.

Do'stlaringiz bilan baham:
1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling