Author Archives: Robins

Altium designer 18: failed to export

Problem description:

use AD18 in PCB with export has been unable to export the 3 d step, prompt unable to export.


Cause of the problem:
It is due to 3D packaging model error, here is the terminal 3D error caused


Solution:
Simple solution to
select export PCB selected to export the selected 3 d models,

although can’t see all of the components but can you give export board shape and hole to thoroughly solve the
click on the 3 d assembly model to check 3 d properties, 3 d model will be deleted only keep screen printing


Remember a mybatis error org.apache.ibatis . session.defaults.DefaultSqlSession

Today, MyBatis was used to insert a hop record into the database, and the error was reported as follows:
SqlSession [org. Apache. Ibatis. Session. Defaults. DefaultSqlSession @ 74794994] was not registered for synchronization because synchronization is not active
The error is due to the fact that one of my fields is NULL, but the database design, this field cannot be NULL, so the error is to change the input field not NULL, to solve the error.
Welcome to pay attention to my public number, learn together, exchange.

 

[solved] closingontransa ctionalSqlSessionorg.apache.ibatis . session.defaults.DefaultSqlSession @20] No information after that.

Today in learning to follow the teacher learning Mybatis – plus technology found god in the use of the test class testing to add and delete operation, display Closing non transactional SqlSession [org. Apache. Ibatis. Session. Defaults. DefaultSqlSession @ 656922 a0] after no information feedback, no results after searching for some information.

The solution
Eventually find the main class does not start: @ MapperScan (com. Kuang. "mapper")
pay attention to the point, we need to start class up to scan our mapper package of all interface

to add @ MapperScan (" com. Kuang. Mapper ") scans we mapper under UserMapper interface inheritance parent class BaseMapper< User> . In order to identify all methods in the parent class.

import org.mybatis.spring.annotation.MapperScan;
@MapperScan("com.kuang.mapper")

Then test the class again and find that the data is present and the information is fed back.

Build your own resnet18 network and load torch vision’s own weight

import torch
import torchvision
import cv2 as cv
from utils.utils import letter_box
from model.backbone import ResNet18


model1 = ResNet18(1)
model2 = torchvision.models.resnet18(progress=False)
fc = model2.fc
model2.fc = torch.nn.Linear(512, 1)
# print(model)
model_dict1 = model1.state_dict()
model_dict2 = torch.load('resnet18.pth')
model_list1 = list(model_dict1.keys())
model_list2 = list(model_dict2.keys())
len1 = len(model_list1)
len2 = len(model_list2)
minlen = min(len1, len2)
for n in range(minlen):
    if model_dict1[model_list1[n]].shape != model_dict2[model_list2[n]].shape:
        continue
    model_dict1[model_list1[n]] = model_dict2[model_list2[n]]

model1.load_state_dict(model_dict1)
missing, unspected = model2.load_state_dict(model_dict2)
image = cv.imread('zhn1.jpg')
image = letter_box(image, 224)
image = image[:, :, ::-1].transpose(2, 0, 1)
print('Network loading complete.')
model1.eval()
model2.eval()
with torch.no_grad():
    image = torch.tensor(image/256, dtype=torch.float32).unsqueeze(0)
    predict1 = model1(image)
    predict2 = model2(image)
print('finished')
# torch.save(model.state_dict(), 'resnet18.pth')

Property ‘style’ does not exist on type ‘element‘

Property ‘style’ does not exist on type ‘element’ property does not exist on type ‘element’
Reason: This is caused by TypeScript type checking, which requires a type assertion in front of the querySelector method.

let frameContainObj = document.getElementById("model_view_container")
let iframeObj= <HTMLElement>frameContainObj.querySelector("#modelView");
iframeObj.style.height = document.documentElement.clientHeight* 0.65 + "px";

Extensions: When using QuerySelectorAll, the following scenario can be used:

let block = document.querySelectorAll(".block") as NodeListOf<HTMLElement>;

Tells the TypeScript compiler to pass this code by setting assertions

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

Modify the custom keyboard shortcut of visual studio code

Many IDEs, such as Eclipse and Visual Studio Code’s Auto Completion Intellisense shortcut key, use Ctrl + Space, which conflicts with Chinese developers’ cases of switching Chinese and English input methods, which is very annoying.
How to toggle IntelliSense shortcut key definitions in Visual Studio Code:
File-> Preferences-> Settings Enter the Settings menu:

Go to the Trigger Suggest’s original button Settings: Ctrl + Space

I changed it to a different combination: Ctrl + L

Now press Ctrl + L to trigger the autocomplete function, which will no longer interfere with the Chinese/English input method.

For more Jerry’s original articles, please follow the official account Wang Zixi :

Successfully solved the problem that visual studio code could not go to the definition, and there was no mouse prompt

Visual Studio Code does not prompt the definition I can not solve

Today suddenly found my vscode without prompt, not even to the definition of function, it was like a TXT text reader, then I have been to install a plug-in, even put vscode uninstall reinstall is useless, I finally in a prompt window to set the configuration file that I have a set of changes over the
I C_Cpp.
the picture intelliSenseEngine was transformed to Disable, lead to code doesn’t provide context awareness, Then change to Default according to the selection prompt

Encapsulation of Ajax JSON / fromdata request in native JS

ajaxPost

function ajaxPost(url,json,cb){
	var xhr = new XMLHttpRequest();
	xhr.open('post',url);
	xhr.setRequestHeader("content-type","application/json");
	xhr.send(JSON.stringify(json));
	xhr.onload = function(){
		cb(JSON.parse(xhr.responseText));
	}
}

Posting pictures

function ajaxPic(formObj,url,cb){
	var formData = new FormData(formObj);
	console.log(formData);
	var xhr = new XMLHttpRequest();
	xhr.open('post',url);
	xhr.send(formData);
	xhr.onload = function(formData){
		cb(JSON.parse(xhr.responseText));
	}
}

java.lang.IllegalArgumentException : URI is not absolute error

Problem phenomena:
After the framework uses SSO (Spring Security OAuth2.0), the Token has been produced. When using the Token to call the interface in Postman, the console appears URI is not absolute error
Analysis of the problem:
Use breakpoints to discover that the URI received in createRequest is empty when the request is created. The first reaction is that there is a problem with the configuration. After checking the YML file, no problem is found

 
In this file, see

@Bean
protected JwtAccessTokenConverter jwtTokenConverter() {
   JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
   converter.setSigningKey("test");
   return converter;
}

After the new step is commented out, add a symmetric key to the corresponding resource service, and use the PostMan call to succeed magically.
Actual reasons for follow-up research…

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