Tag Archives: java

Visual studio code shortcut

The main command box
The most important function is the Command Panel opened by F1 or Ctrl+Shift+P. In this command box, you can execute any command of VSCode and even close the editor.
Pressing Backspace will take you to Ctrl+P mode
Type> under Ctrl+P; You can go back to Ctrl+Shift+P.
It’s fine under the Ctrl+P window
Type the file name directly and jump to the file
?List the currently executable actions! Errors or Warnings. Or Ctrl+Shift+M: skip to line number, or Ctrl+G to @: skip to Symbol (search for a variable or function), or Ctrl+Shift+O to @: skip to Symbol by category and find an attribute or function, or Ctrl+Shift+O to: enter # find Symbol by name, or Ctrl+T
Common Shortcuts
 
Editor and window management
Open multiple Windows at once (view multiple projects)
Open a new window: Ctrl+Shift+N Close the window: Ctrl+Shift+W
Open multiple editors at the same time (view multiple files)
Create a new file Ctrl+N Toggling Ctrl+Tab between files Cut out a new editor (up to 3) Ctrl+\, or you can hold down the Ctrl mouse and click on the file name in the Explorer Ctrl+1 Ctrl+2 Ctrl+33 editor cycle Ctrl+ ‘editor to change position, Ctrl+ K and then press Left or Right
The code editor
formatting
Lines of code indented Ctrl+[Ctrl+]
Ctrl+C Ctrl+V If unchecked, copy or cut a whole line by default
Copy one line Up or Down: Shift+Alt+Up or Shift+Alt+Down Enter one line below the current line, Ctrl+Shift+Enter
The cursor associated
Move to Start of Line: Home Move to End of Line: End Move to Start of File: Ctrl+End Move to Start of File: Ctrl+Home Move to Definition: F12 Definition Thumnail: Just Look at It and Don’t Skip Forward Alt+F12 Move to End of Bracket Ctrl+Shift+] Select From Ctrl to End of Line Shift+Home Remove all words on the right side of the cursor Ctrl+DeleteShrink/ Expand Selection: Shift+Alt+Left and Shift+Alt+ Rightmulti-cursor: Alt+Click to add Cursor or Ctrl+Alt+Down or Ctrl+Alt+Up to select all matching Ctrl+Shift+L at the same time
Ctrl+D The next match is also selected (I’ve customized it to delete the current line, see Ctrl+Shift+K below).
Back up the previous cursor operation Ctrl+U
Refactor the code
Rename: For example, if you want to change a method name, select it and press F2. Enter the new name. You will see that all the files have been changed. Right-click “Set File to Compare” in the Explorer and select “Compare with ‘file_name_you_chose’ on the file you want to compare.”
To find the replacement
Find Ctrl+F Find Ctrl+H Find Ctrl+Shift+F
:
* To match one or more characters in a path segment?To match on one character in a path segment** to match any number of path segments,including none{} to group conditions (e.g. {**/*.html,**/*.txt} matches all HTML and TXT files)[] to declare a Range of characters to match (e.g., example.[0-9] to match on…
According to the relevant
Full-screen: F11Zoomin/Zoomout: Ctrl+ =/Ctrl + – Sidebar Show/Hidden: Ctrl+B Sidebar Show:
Show Explorer Ctrl+Shift+ ESHOW SearchCtrl+Shift+ FSHOW GitCtrl+Shift+ GSHOW DebugCtrl+Shift+ DSHOW OutputCtrl+Shift+U
other
Auto-save: File ->; AutoSave, or Ctrl+Shift+P, type Auto

java.lang.IllegalArgumentException : URI scheme is not “file” error resolution

Java. Lang. IllegalArgumentException: URI scheme is not “file” error

The code in
Map side setup is as follows

        URI[] uris = context.getCacheFiles();
        File file = new File(uris[0]);
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));

Code cached in the Driver phase

job.addCacheFile(new URI("/MR/job/input/com.txt"));

After thinking about it and looking for some forums on the Internet, I thought it might be what I wanted to do, but I could not do it with File, so I should do it with Stream.
file f = new file (UI)
le f = new file (UI)
file f = new file (UI)
file f = new file (UI); The file protocol
is now the URL(” http://… “) ) it is impossible to document
so will some changes have been made the setup phase of the code

        URI[] cacheFiles = context.getCacheFiles();
        FileSystem fileSystem = FileSystem.get(cacheFiles[0], context.getConfiguration());
        FSDataInputStream inputStream = fileSystem.open(new Path(cacheFiles[0]));
        BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));

Found that after the change was really good

Loading DLL with Java in Windows

Java loads dynamically linked library files in classes.
Class file:
Static {
system.loadLibrary (” DLL file “);
}
The DLL file is under the package path of the project. For example: pro/bin/hell. DLL; (Pro project in the bin directory hello. DLL file)
Can’t find dependent libraries Can’t find dynamically linked libraries
 
Solution:
Winpcap can be installed to solve the problem. Download path: http://ftp-idc.pconline.com.cn/32017d10a844534eecd94d13ce732091/pub/download/201010/WinPcap_4_1_3.exe
 

Reproduced in: https://www.cnblogs.com/zhaofeng555/p/3433441.html

@Autowired injection * * required a single bean, but 2 were found**

why
The StringRedistemplate object is injected into the project as follows:

@Autowired
private StringRedisTemplate redisTemplate;

Then it says an error:

Field redisTemplate in com.xxx.api.controller.XxxController required a single bean, but 2 were found:
  - getRedisTemplate: defined by method 'getRedisTemplate' in class path resource [com/xxx/config/RedisConfig.class]
  - stringRedisTemplate: defined by method 'stringRedisTemplate' in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration$RedisConfiguration.class]

@Autowired is either injected by type or declared @Qualifier(” beanID “), which has nothing to do with the field name I defined as redisTemplate. Other
but the project is so written, nor the @ the Qualifier is not an error (and I didn’t complain before use), the only difference is the field name is different, other places are stringRedisTemplate, I changed, really good. This is clearly a metaphysical operation, if you follow the previous interpretation of @Autowired.
why

@Autowired annotation injection rule:

after some code tests, the Autowired default by Type, if the same Type to find multiple beans, then, and according to the Name way comparison, if there are more than one, then an exception is reported.

According to the error prompt: StringRedisTemplate this type of bean in container pool has two redisTemplate, StringRedisTemplate (our own projects, configured with a spring boot automatically configure also give I added a)
I defined the field name is redisTemplate: no, just the StringRedisTemplate is some, so there is no problem!
To solve
There are many solutions:

    field is modified for StringRedistemPlate to specify the injected bean using @Qualifier. In some cases, add @primary [not recommended]
the conflicting bean
END
I had memorized the infusion process deeply until I came across it. Some items in the notes didn’t impress me as being important, and I kept a summary in mind, yet I couldn’t discover its significance until I encountered the problem.

Configuring common environment variables in Windows

The article directories
1, JDK 2, Maven 3, Gradle 4

A, the JDK
Two environment variables JAVA_HOME and CLASSPATH need to be configured:

va_home =D:\programs\jdk1.8 p>
%java_home % \>; %JAVA_HOME%\jre\bin; add classpath:
code> c>path =.; %JAVA_HOME%\lib\dt.jar; %JAVA_HOME% lib\tools.jar
Use java-version and javac-version determine if the creation was successful
Second, the maven
Increase MAVEN_HOME:
MAVEN_HOME = D: \ apache maven - 3.3.9
in the Path to increase again:
% MAVEN_HOME % \ bin
mvn-v
Third, gradle
Increase the GRADLE_HOME = D: \ gradle - 6.7.1
in the path to increase again:
% GRADLE_HOME % \ bin
gradle-v / code>
Four,

Java back end receives localdatetime type parameter

//QTO layer

    @ApiModelProperty("Billing start time")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime billStartTime;
    
    @ApiModelProperty("Billing end time")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime billEndTime;

@requestBody
@apiOperation (” list”)
stMapping (“/list”)
p>c responseData< PageData< TradeSettlementVO.ListVO> > list(@RequestBody TradeSettlementQTO.PcQTO qto){
return ResponseData.data(ipcMarketSettlementRpc.settlementPageData(qto));
}

How to receive localdatetime type in background

First, we need to introduce it in the Maven parent POM

<dependency>
     <groupId>com.fasterxml.jackson.datatype</groupId>
     <artifactId>jackson-datatype-jsr310</artifactId>
     <version>2.9.7</version>
</dependency>

Add relevant annotations to the entity class definition, as shown below

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;


@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // To parse the form data (form/data) data
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") //To parse json data
private LocalDateTime startTime;

SQL injection for ASP + access website

SQL injection is used for ASP + Access website

ASP is Active Server Pages, which is a server-side script environment developed by Microsoft Corporation. It can be used to create dynamic interactive web Pages and establish powerful web applications. When the server receives a request for an ASP file, it processes server-side script code that is included in the HTML (Hyper Text Markup Language) Web page file that is built to be sent to the browser. In addition to server-side script code, an ASP file can also contain text, HTML (including related client-side scripts), and COM component calls.
Microsoft Office Access is a relational database management system released by Microsoft. There’s only the concept of tables.
There are many scanning tools for Web applications: AWVS, AppScan, OWASP ZAP, etc. The following is probed using OWASP-ZAP.

3. Vulnerability Analysis
Analyze the contents marked red in the scan results.

4. SQL injection point using
using SQLMap test. Note: Access only has the concept of a table.

Servlet page Jump error 500

Idea to deploy the servlet submit page jump, error 500 page report
error message jar package not add
in fact has been added to the project required jars
solution: in the tomcat lib folder under the required jars are added