Category Archives: How to Fix

Solution of CONDA (PIP) bad interpreter

because of the change of server, I moved the conda environment used in the original server directly to the new server. As a result, the “Conda (PIP) bad Interpreter” error appeared when using the conda(PIP) command on the new server. The solution:

  • enter which PIP view PIP path
  • enter which python view python path
  • use vim to open the PIP path (or python path) that you have just obtained. Change the path in the first line of the code to be the same as the PIP path.

Solve the problem that the tray of electron system disappears automatically

on pit

turn on electron, and found that the system tray icon would automatically disappear after a period of time. To solve this problem, I found the reason why the system tray icon would automatically disappear.

Reason

when we declare a variable in Tray, we do not declare it as a global variable, which results in it being recycled by the garbage collection mechanism during operation.

solution

declares the variable of the storage window/system tray as a global variable, that is, it is declared before app.on('ready',fuc) in main.js. In the app. On (' ready 'fuc) internal part to use
code:

//创建系统托盘图标
let iconTary = null
let path = require('path')
let {Tray} = require('electron')
//将iconTary声明为全局变量
let iconTary = null
app.on('ready',() => {

	//将iconTary赋值Tary模块
	iconTary = new Tray(path.join(__dirname,'../static/flag.png'))
	
})

problem solved.

Differences between the assets directory in Android project and the purpose of resource

assets: will not generate the corresponding tag under r.java file, assets folder is not created by default need to create their own folder and resource folder with the same parent directory, using the AssetsManager class to access, stored here when running the packaging of resources will be entered into the program installation package.
resource : the tag will be generated under the r.java file. The resource here will determine what is used when running the packaging operation. The file resources that are not used will not be packaged into the installation package . The file using resource is called by the R class according to the path

Installing the image J plug-in

1. Download the imageJ, https://imagej.net/Fiji/Downloads

2. Unzip the

3. Installing a plug-in
(1) https://imagej.nih.gov/ij/plugins/index.html download plug-in you need. Open Toolsets or tools.

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201013153831165.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTI0MjEyOA==,size_16,color_FFFFFF,t_70#pic_center)


(2) click to open the required plug-in: copy content;

(3) create a.txt file under macros folder;

open image j, click on the top plugins-new-macro,
in the macro interface open. TXT file
copy the TXT content before opening to the open. TXT blank interface

(4)ImageJ菜单栏单击 Plugins-Macros-Install;选择刚刚创建的.txt文件,打开,安装完毕!


Beego method to find memory leak get memprof

turn on debugging function, modify configuration file app.conf:

EnableAdmin = true
AdminAddr = "0.0.0.0"
AdminPort = 8088

access management page: http://your IP :8088/

click on the menu: get memprof, prompt create heap profile mem-948. Memprof means memory information file was successfully generated

execute go tool pprof your_app mem – 948. Memprof, SVG command input, if prompt dot not installed, in https://graphviz.org/download/ download graphviz, execute right can generate profile001. SVG file, use the browser open, where how much memory consumption of the be clear at a glance.

if you click on the menu get cpuprof, you can view the CPU stack information.

Cannot call the same level library solution in pychar

disclaimer in advance: I am a student (xiaobai). If I encounter problems in the course design and solve them, I will send this post to share the method.
this article solve the problem of pycharm call library at the same level, close to measure effective

without further explanation, the above picture is

as shown above, I want to call the function in cookiespool, the importer, but it keeps going red, what is the problem?This is because the copied package is directory, and the library that Pycharm calls is Python Project, so it cannot be recognized. The solution:



as shown in the figure, labeled as sources root.

Removing duplicate lines from Linux shell files

original text file

$ cat test              
jason
jason
jason
fffff
jason

Method 1: sort -u

after removal of repetition

sort -u test
fffff
jason

notice that the order is disrupted

sort test|uniq

after removal of repetition

$sort test |uniq 
fffff
jason

note that the order is disrupted, the principle and method are the same

method three: awk ‘! A [$0] + + ‘

after removal of repetition

$ awk '!a[$0]++' test
jason
fffff

order remains the same, file deduplication example

awk '!a[$0]++' test.txt >test.txt.tmp && mv -f test.txt.tmp test.txt

where awk USES a temporary file to overwrite the result

specific principle is as follows:

awk’s program instructions consist of patterns and actions, in the form of Pattern {Action}. If the Action is omitted, print $0 will be executed by default.

Pattern:

can be used here to remove repetition

!a[$0]++

In awk, for uninitialized array variables, an initial value of 0 is assigned to them during numerical operations, so a[$0]=0, and the ++ operator is characterized by first value and then 1, so Pattern is equivalent to

!0

and 0 is false,! In order to get the reverse, the final result of the whole Pattern is 1, which is equivalent to if(1). The Pattern matching is successful, and the current record is output. For the DUP file, the processing method of the first three records is the same.

when the data “Jason” in line 2 is read, a[$0]=1, and the result after taking the reverse is 0, that is, the Pattern is 0, and the Pattern matching fails, so this record is not output, and the subsequent data is followed by the same, and the duplicate lines in the file are finally removed successfully.

Simple license plate recognition based on Halcon

simple license plate recognition

Graph

  • code
  • results
    • positioning location results
    • recognition results

    original

    code

    dev_close_window ()
    *车牌定位及倾斜旋转
    read_image (Car, 'E:/Halcon_Learn/car.jpg')
    get_image_size (Car, Width, Height)
    dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
    dev_set_color ('green')
    dev_set_line_width (3)
    decompose3 (Car, Image1, Image2, Image3)
    threshold (Image1, Regions, 0, 31)
    connection (Regions, ConnectedRegions)
    select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 4636.72, 5508.59)
    dilation_circle (SelectedRegions, RegionDilation, 3.5)
    erosion_circle (RegionDilation, RegionErosion, 3.5)
    fill_up (RegionErosion, RegionFillUp)
    orientation_region (RegionFillUp, Phi)
    area_center (RegionFillUp, Area, Row, Column)
    vector_angle_to_rigid (Row, Column, Phi, Row, Column, rad(180), HomMat2D)
    affine_trans_image (Car, ImageAffineTrans, HomMat2D, 'constant', 'false')
    affine_trans_region (RegionFillUp, RegionAffineTrans, HomMat2D, 'nearest_neighbor')
    reduce_domain (ImageAffineTrans, RegionAffineTrans, ImageReduced)
    *显示定位车牌
    dev_display (ImageAffineTrans)
    overpaint_region (ImageAffineTrans, RegionAffineTrans, [0,255,0], 'margin')
    dump_window_image (Image_define, WindowHandle)
    write_image (Image_define, 'jpg', 0, 'E:/Halcon_Learn/car_define')
    stop ()
    *字符分割
    rgb1_to_gray (ImageReduced, GrayImage)
    invert_image (GrayImage, ImageInvert)
    threshold (GrayImage, Regions1, 61, 126)
    connection (Regions1, ConnectedRegions1)
    select_shape (ConnectedRegions1, SelectedRegions1, ['area','height'], 'and', [219,31.607], [321.78,40.742])
    sort_region (SelectedRegions1, SortedRegions, 'character', 'true', 'row')
    
    *字符识别
    read_ocr_class_mlp ('Industrial_0-9A-Z_NoRej.omc', OCRHandle)
    do_ocr_multi_class_mlp (SortedRegions, ImageInvert, OCRHandle, Class, Confidence)
    
    *显示
    smallest_rectangle1 (SortedRegions, Row1, Column1, Row2, Column2)
    count_obj (SortedRegions, Number)
    dev_display (Car)
    for i := 1 to Number by 1
       * disp_message (WindowHandle, Class[i-1], 'window', Row2[i-1], Column1[i-1], 'red', 'false')
         set_tposition (WindowHandle, Row2[i-1], Column1[i-1])
         write_string (WindowHandle, Class[i-1])
    endfor
    
    dump_window_image (Image, WindowHandle)
    write_image (Image, 'jpg', 0,'E:/Halcon_Learn/car_result')
    

    Results the

    positioning result

    recognition result

Type definition error – one of the causes of type definition errors is WM in Oracle_ Concat function usage

today for code development to meet the Type definition error: [simple Type, class oracle JDBC. OracleConnection]; Nested-exception is… After checking all the data, I finally found that it was caused by the wm_concat() function in Oracle. Wm_concat () will return different field types depending on the oracle version. Clob type will be returned in oracle11g and varchar type will be returned in oracle10g.
the solution is as follows:

select qlrid,to_char(wm_concat(qlr)) as qlr,to_char(wm_concat(qlrzjh)) as qlrzjh from qlr t group by qlrid;

【.Net Core】using declarations‘ is not available in C# 7.3. Please use language version 8.0 or greate

introduction

in.net core3.0, the using declaration is not available in C# 7.3 after it is used in the code. Please use language version 8.0 or higher.” The solution is

error message

CS8370

0

1

2 Feature ‘using declarations is not available in C# 7.3.please use language version 8.0 or greater.

3

4

Severity

Code

Description

Project

File

Line

Suppression State

6

Error

5

6 CNPCApi

7

D:\Project\NetCore\CNPCApi\CNPCApi\Program.cs

14

Active

solution

Add the following property node

to the solution file.csproj (right-click in explorer and edit via vs open) file

<PropertyGroup>
   <LangVersion>preview</LangVersion>
</PropertyGroup>
或
<PropertyGroup>
   <LangVersion>8.0</LangVersion>
</PropertyGroup>

add after save, recompile successfully, oh

Installing GCC reduced version GCC 4.4.6 under Linux

is recorded as follows:

1. Download the appropriate version of GCC from the official website, http://gcc.gnu.org.

2. Unpack the

# sudo tar ZXFV GCC – 4.4.6. Tar. Gz

3. Go to the unzip directory, mine is ~/local/gcc-4.4.6, and I have an executable called configure, with the following configuration:

#./configure — prefix =/usr/bin/GCC – 4.4.6 – enable – language = c, c + +, Java

(where /usr/bin/gcc-4.4.6 is the directory to install GCC, followed by –enable-language=c,c++, Java is set to install compilable language)

Notice that the configure success sign shows that the makefile was successfully generated and that you’ll have an additional makefile in your directory so you can proceed to the next


error: said GMP and MPFR

cannot be found

to download and install dependencies:
ftp://gcc.gnu.org/pub/gcc/infrastructure

GMP – 4.3.2. Tar..bz2

MPFR – 2.4.2. Tar..bz2

unzip installation dependency:

tar -jxvf gmp-4.3.2.tar.bz2

mkdir /usr/local/gmp-4.3.2

cd ./gmp-4.3.2

./configure --prefix=/usr/local/gmp-4.3.2

make

make install



tar -jxvf mpfr-2.4.2.tar.bz2

mkdir /usr/local/mpfr-2.4.2

cd ./mpfr-2.4.2

./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2

make

make install

error: m4

cannot be found
Install GMP under ubuntu

. Configure :error:no usable m4 in$path or /user/5bin solution

is easy, because you don’t have m4, just install it.

sudo apt-get install m4

4.#make

this is the longest step, so long that I couldn’t wait to go back to sleep last night…

note: error may also occur in make. Generally, it is also necessary to configure the environment or missing files. It is OK to install whatever is needed directly

5. # make install

6. After the end, establish the connection of gcc4.4.6 version, command:

# ln -s/usr/bin/GCC – 4.4.6/bin/GCC/usr/bin/GCC
Check out the current version of GCC:

#gcc –version