lcx-practical technology

1. How to upload and download files?

File Upload

The essence of file upload is the slave operation of the IO stream; the client:

1. Post must be used , post can carry big data

2. Must set type="file" name="file" must have a name

3. Enctype="multipart/form-data" must be set on the server side: get the byte input stream through request.getInputStream() , read the request body content; get the uploaded content, save it on the server side, and complete the file upload ; Actually use the api in the framework directly, commons-fileupload is a set of file upload tools provided by apache;

There are two ways to download files :

1. Hyperlink download: If the file can be parsed by the browser, click it to open the file. If you want to download, you need to right-click and save as. For a file that cannot be parsed by the browser, click to download;

2. Write back to the browser to download through the server stream; to set MIME , that is, set contentType(String mimeType); directly display what the browser can parse, and download it directly if it can't be parsed;

Get the mimeType of the file: String mimeType=this.getServletContext().getMimeType(filename);

If you set the response header response. setHeader ("content-disposition"," attachment ;filename=downloaded file name"); regardless of whether the browser can parse it,

All are download operations;

2. What are the third-party workflows? How to use it?

Common workflow framework

Activity5.1.3、JBPM4.4、OSWorkFlow、WorkFlow

In the Java field, JBPM and Activity are the two mainstream workflow systems, and the emergence of Activity will undoubtedly replace JBPM (Activity developers come from Jbpm developers).

Basic operations of avtivity:

Design flow chart (various components, such as connections, user tasks, gateways)

Process definition addition, deletion, modification and inspection

Process variables add, delete, modify and check

Start process definition

Task addition, deletion, modification and investigation

mission accomplished

Historical information query

How to use activity in java workflow

Commonly used are: activiti-engine-5.91.jar, activiti-spring-5.9.jar;

Explanation: The above two are only commonly used packages for activiti workflow. They are usually configured with java packages developed by spring and database jar packages, etc., but which packages are used are related to the logic of business development. There is no way to elaborate, so you only need to download the two commonly used first, and the remaining auxiliary packages such as: log package, spring package, database package, hibernate package, struts package, mybatis package, etc. can be added according to actual needs.

3. Know and use activemq, rabbitmq and kafka? How to deal with the message sending failure? How to prevent repeated consumption of messages?

Introduction to ActiveMQ  MQ is a message middleware, a medium through which applications can deliver messages in a distributed system. Commonly used are ActiveMQ, RabbitMQ, and kafka. ActiveMQ is an open source project under Apache, which fully supports the implementation of JMS Provider of JMS1.1 and J2EE1.4 specifications. Features: 1. Support for writing client in multiple languages 2. Support for spring, easy to integrate with spring 3. Support for multiple transmission protocols : TCP, SSL, NIO, UDP, etc. 4. Support AJAX message format: 1. Point-to-point ( queue) 2, one-to-many (topic)

RabbitMQ is a message queue developed by the erlang language and implemented based on the AMQP (Advanced Message Queue Advanced Message Queue Protocol) protocol. It is a communication method between applications . Message queues are widely used in the development of distributed systems.

Kafka is a distributed publish-subscribe messaging system . It was originally developed by LinkedIn and later became part of the Apache project. Kafka is a distributed, partitionable, redundant backup and persistent log service. It is mainly used for Process streaming data .


What to do if the message fails to be sent

Just roll back, catch the exception , delete the preprocessed data , the database will have no data, and the consumer will not have the message to execute. The data of both parties are consistent .

How to prevent repeated consumption of messages?

1. For the data that needs to be saved to the database, we can set a certain value of a certain piece of data , such as the order number, and set a unique index , so that the data will not take effect even if repeated consumption

2. Optimistic locking, that is, every time we insert a piece of data or update, we judge whether a certain version number is the same as expected, if not, then no operation

3. Use redis for storage. Every time you manipulate data, go to redis to make a judgment . If it exists , then this data is repeatedly consumed , and then we can discard it or do other processing .

4. How to resolve the conflict between svn and git?

Pull, update the program, check the conflicting code, manually modify, keep the local latest version, submit the modification, then pull, update manually, merge and update to the latest version commit, submit push

5. How to test your own interface?

Use tools such as postman swagger

6. How to solve if the data overflows when poi is imported into excel?

Can convert excel's xlsx format to easy-to-read csv format for reading

7. What are the commonly used commands in linux?

1.1 pwd command The English interpretation of this command is print working directory. Enter the pwd command, Linux will output the current directory.

1.2 cd command The cd command is used to change the directory.

cd / go to the root directory

cd ~ go to /home/user user directory

1.3 ls command

The ls command is used to view the contents of the directory.

1.4 cat command

The cat command can be used to merge files, and can also be used to display the contents of the entire file on the screen.

8. How to call a third-party interface?

SpringBoot-RestTemplate

public User doGetWith2(String url){

        User user  = restTemplate.getForObject(url, User.class);

      return user;

    }

9. Understanding of distributed, cluster, and microservices?

Distributed refers to distributing different businesses in different places. Each distributed node completes a different business, and if one node goes down, the business becomes inaccessible.

The cluster refers to several servers concentrate together to achieve the same business, clusters, there is a resistance organization, a server broke down, the other server can be on top.

Microservice is an architectural style. A large and complex software application is composed of one or more microservices . Each microservice in the system can be deployed independently , and each microservice is loosely coupled . Each microservice only focuses on completing one task and completing that task well . In all cases, each task represents a small business capability.

10. The processing logic of distributed transactions? How did it happen?

These small operations distributed across different servers, distributed transactions need to ensure that these small operations either all succeed , or all fail .

There are many current distributed transaction implementation solutions, some of which have been eliminated, such as XA-based two-stage commit , TCC solutions , local message tables, MQ transaction messages , and some open source transaction middleware, such as LCN , GTS.

11. What are the characteristics of transactions? How does distributed data ensure data consistency?

Characteristics: Atomicity, consistency, isolation, and continuity.

Atomicity: Things are the logical working unit of the database, and all operations included in things are either done or not done.

Consistency: The result of transaction execution must be to make the database change from a consistent state to another consistent state.

Isolation: The execution of a transaction cannot be interfered by other things. That is, the internal operations of a thing and the data used are isolated from other concurrent things, and the various things executed concurrently cannot bother each other.

Persistence: Also known as permanent, once a thing is submitted, its changes to the data in the database should be permanent. The following other operations or failures should not have any impact on the results of its execution

How to ensure data consistency in distribution

When the update operation is completed, any access by multiple subsequent processes or threads will return the latest updated value. This is the most user-friendly, that is, what the user wrote last time, the next time it is guaranteed to be able to read what.

12. What are the common commands of docker?

Basic operation:

1. docker images view mirror information list mirror is static

2. docker ps -a to view all running containers

3. docker pull [images]:[version] pull the specified image from dockerhub

4. docker rm [containerID] delete container

5. .docker rmi [imageID] delete image

13. How to understand and use the template engine?

The template engine (herein specifically refers to the template engine used for Web development) is produced to separate the user interface from the business data (content) . It can generate documents in a specific format, and the template engine used for the website will generate a standard HTML documents.

use

1. Import the file

2. Define the template

3. Prepare the object (data to be filled)

4. Fill the data into the template

   template (template ID, data to fill in the hole)

14. How to write timed tasks in the project?

1. Implemented the Runnable interface. In the run method, first print a current system time, and then execute the sleep method, sleep for 30 seconds

2. Implement the TimerTask interface.

15. How to send email and SMS?

Email: Use 163 or Tencent's smtp service to create a special password for a third-party email client

Fill in the address of the dedicated password SMTP server and the content to be sent and the email address of the sender in the mailbox tool class.

SMS can use Alibaba Cloud's cloud communication service to set an SMS template in the domestic message in the console

Fill in the template code and the accesskey of the personal center into the tool category

16. What would you do to communicate real-time data between two heterogeneous projects?

ESB

17. How to understand and use nginx?

Nginx is a high-performance http server and reverse proxy server developed in C language .

The reverse proxy method is actually a proxy server responsible for forwarding , which seems to function as a real server , but in fact it is not. The proxy server only acts as a forwarder and obtains the returned data from the real server .

use

Unzip after download

Open the cmd command window, switch to the nginx decompression directory, enter the command nginx.exe or start nginx, and press Enter

Directly enter the URL http://localhost:80 in the address bar of the browser, press Enter, the following page appears, indicating that the startup is successful

The configuration file of nginx is nginx.conf in the conf directory. The port that nginx listens to by default is 80. If port 80 is occupied, it can be changed to an unoccupied port.

18. How does maven resolve jar package conflicts?

1. You can use the Dependency Analyzer in the Maven Helper plug-in to analyze the conflicting jar package, and then click execlude on the jar package corresponding to the red version to exclude the jar package

2. Manually exclude  the use of tags in pom.xml to exclude conflicting jar packages

Version locking principle : generally used in the parent project of the inherited project

Normal projects are multi-module projects. For example, if moduleA and moduleB both depend on the dependency of X, then X can be extracted and its version number can be set at the same time, so that when the X dependency is upgraded, there is no need to separate the moduleA and moduleB modules. Depends on X for upgrading, avoiding too many places (moduleC, moduleD...) when referencing X dependencies, forgetting to upgrade and causing jar package conflicts, this is also a relatively common method in actual project development.

19. How is the tree structured table designed?

Left-right algorithm

20. How to realize the function authority management of menu and addition, deletion, modification and checking?

When admin logs in, save the token generated during login to the vue component. Then query the corresponding role information, query the menu permission information associated with the role_permission table according to the role id, and return it to the display of the navigation in the left menu bar of the control management system in vue

The back-end uses custom annotations and AOP to realize the control of adding, deleting, modifying and checking permissions

21. What documents are needed to develop the program?

Feasibility study report, requirement specification, project plan, software test plan , outline design specification, detailed design specification, programming specification, software test case, software test report, user manual, installation manual, project summary report



 

 

 

 

Guess you like

Origin blog.csdn.net/abu1216/article/details/112298988