Tag Archives: ProgrammerAH

In the XML configuration file of spring jdbc.properties The connection to the database failed due to garbled code

An unusual problem we encountered today was that getting the configured properties in jdbc.properties failed to connect to the database.
Without further ado, go straight to the code.
Exception in thread “main” org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; Nested exception is java.sql. SQLExeption: Access denied for user ‘e £e £’@’localhost’ (using password: YES)
Spring has resolved the value of ${username to the value of my computer’s username. Simply change the username of the jdbc.properties and XML to name.
${JDBC. Username} is not the same as ${JDBC. Username}. Yes, you don’t get that weird question by just writing it like this, but it does.
Invalid bean definition with name ‘dataSource’ defined in class path resource [applicationContext.xml]:
Could not resolve placeholder ‘jdbc.driverClassName’ in value “${jdbc.driverClassName}”;
${JDBC. Username} is not resolved by Spring.

1143 Lowest Common Ancestor

Two points timeout, there is no choice to build the tree first, may lead to too much recursion, so timeout, code:

#include<iostream>
#include<set>
#include<vector>
using namespace std;
set<int> se;
int a[10010];
int b[10010];
int n1,n2;
set<int> father;
vector<int> v;
bool f1=false,f2=false;
void func1(int l1,int r1,int l2,int r2,int aim,int t2){
    int t=l2;
    for(t;t<=r2&&b[t]!=a[l1];t++);
    if(aim<b[t]){
        if(b[t]==t2){f1=true;return;}
        father.insert(b[t]);
        func1(l1+1,t-l2+l1,l2,t-1,aim,t2);
    }
    else if(aim>b[t]){
        if(b[t]==t2){f1=true;return;}
        father.insert(b[t]);
        func1(l1+t-l2+1,r1,t+1,r2,aim,t2);
    }
    return;
}
void func2(int l1,int r1,int l2,int r2,int aim,int t1){
    int t=l2;
    for(t;t<=r2&&b[t]!=a[l1];t++);
    if(aim<b[t]){
        if(b[t]==t1){f2=true;return;}
        v.push_back(b[t]);
        func2(l1+1,t-l2+l1,l2,t-1,aim,t1);
    }
    else if(aim>b[t]){
        if(b[t]==t1){f2=true;return;}
        v.push_back(b[t]);
        func2(l1+t-l2+1,r1,t+1,r2,aim,t1);
    }
    return;
}
int main(){
    cin>>n1>>n2;
    for(int i=0;i<n2;i++){
        cin>>a[i];
        se.insert(a[i]);
    }
    auto it=se.begin();
    for(int i=0;i<n2;i++){
        b[i]=*it;
        it++;
    }
    for(int i=0;i<n1;i++){
        f1=false;f2=false;
        int t1,t2;
        cin>>t1>>t2;
        
        if(se.find(t1)==se.end()&&se.find(t2)==se.end()){
            cout<<"ERROR: "<<t1<<" and "<<t2<<" are not found."<<endl;
            continue;
        }
        else if(se.find(t1)==se.end()&&se.find(t2)!=se.end()){
            cout<<"ERROR: "<<t1<<" is not found."<<endl;
            continue;
        }
        else if(se.find(t1)!=se.end()&&se.find(t2)==se.end()){
            cout<<"ERROR: "<<t2<<" is not found."<<endl;
            continue;
        }
        if(t1==t2){
            cout<<t1<<" is an ancestor of "<<t1<<"."<<endl;
            continue;
        }
        father.clear();
        v.clear();
        father.insert(a[0]);
        v.push_back(a[0]);
        func1(0,n2-1,0,n2-1,t1,t2);
        if(f1){
            cout<<t2<<" is an ancestor of "<<t1<<"."<<endl;
            continue;
        }
        func2(0,n2-1,0,n2-1,t2,t1);
        if(f2){
            cout<<t1<<" is an ancestor of "<<t2<<"."<<endl;
            continue;
        }
        for(int i=v.size()-1;i>=0;i--){
            if(father.find(v[i])!=father.end()){
                cout<<"LCA of "<<t1<<" and "<<t2<<" is "<<v[i]<<"."<<endl;
                break;
            }
        }
    }
    return 0;
}

Python-OSError: [Errno 22]

Record the bugs you encounter. The method refers to the network
Problem description:
Problems encountered while reading and writing files

OSError: [Errno 22] Invalid argument: '\u202aC://Users//huawei//Desktop//a.txt'

Solution:
Enter the file path manually

Error lnk2038: detected “0”_ ITERATOR_ DEBUG_ The reason and solution of the unmatched item of “level”

https://blog.csdn.net/wzsy/article/details/70599654
① The value “0” does not match the value “2”. Debug uses the library files under Release.
② The value “2” does not match the value “0”. Release uses the library file under Debug.
In both cases, you just need to set its value in the preprocessing definition to match the program you want to call. In VS2010, the default value is 2 in Debug mode and 0 in Release mode.
For case one, just in the project ->; Property – & gt; Configure properties ->; C/C++-> Preprocessor ->; Add “_ITERATOR_DEBUG_LEVEL=0” to the preprocessing definition.
Or modify the run to use Release mode, corresponding to: Project ->; Property – & gt; Configure properties ->; C/C++-> Code generation ->; MD
For case two, just in the project ->; Property – & gt; Configure properties ->; C/C++-> Preprocessor ->; Add “_ITERATOR_DEBUG_LEVEL=2” to the preprocessing definition.
Or modify the run using Debug mode, corresponding to: project ->; Property – & gt; Configure properties ->; C/C++-> Code generation ->; MDd

Failed to execute goal org.apache.tomcat . maven:tomcat7-maven-plugin : 2.2: run solution

I had a problem these two days, and it was a disgusting problem. Wasted me two days time, maven starts, the Failed to execute goal. Org. Apache tomcat. Maven: tomcat7 — maven plugin: 2.2: run, or can’t find the tomcat plug-in, finally really is no way, to guide so the pom bag screening out, one at a time, found that two packages caused the error.


Hope I can help you.

Initialization order of Java objects

The order in which Java objects are initialized

    static block of the parent class, static properties of the parent (tied for priority, according to the code in order to perform)
    (only in class load for the first time to perform a) subclasses of static code block, a subclass of static properties (tied for priority, according to the code in order to perform)
    (only in class load for the first time to perform a) code blocks in the construction of the parent class of the parent class non-static properties (tied for priority,
    every new object is executed) p>t constructor
    (every new o>t is executed) subclass constru> block, the non-static properties of the subclass (tie precedence, According to the code in order to perform)
    (once every new object will perform a) subclass constructor
    (once every new object will perform a)

How to convert iconfont to PNG transparent image

1. Enter the IconFont icon library and log in. http://www.iconfont.cn/
2. Select the desired icon and add it to the shopping cart.
3. Select the download icon as PNG format.
https://blog.csdn.net/weixin_30788619/article/details/95338105
Selected state: download after changing the color, and then rename all activated items to complete the matching effect