matlab拿别人的程序跑时出现Attempt to reference field of non-structure array.

最近在做一个手写数字的程序,拿了别人的程序跑时发现在鼠标左键写完字后会点击右键会出现如下错误:

MouseDraw
MouseDraw right button down!
Attempt to reference field of non-structure array.
Error in MouseDraw (line 56)
axes(FigHandle.Children),cla;%删除坐标图像
Error while evaluating figure WindowButtonDownFcn

源代码如下,请各位大神帮忙看看谢谢!
function MouseDraw(action)
%以Handle Graphics来设定滑鼠事件
%鼠标左键按下不放进行写字,右键进行识别
%(MouseDraw Events)的反应指令(Callbacks)
% global不能传矩阵
%global用于定义全局变量,定义之后全局变量可作用于其他函数
global InitialX InitialY FigHandle %定义了三个变量
imSizex = 90; %定义图片的长度
imSizey = 120; %定义图片的宽度
%如果函数没有输入值的话,把action定义为start
if nargin == 0
action = 'start';

end

%进行判断actio是什么
switch(action)
%%开启图形视窗
case 'start',
FigHandle = figure('WindowButtonDownFcn','MouseDraw down');%figure函数用于新建一个窗口,此处获得它的句柄,第一个参数是在figure中点击时的回调函数
set(FigHandle,'position',[200,200,360,410] ); %设定图窗大小来适应识别的图片大小,设置的是中心坐标为200,横竖长度分别为360和410(或是各边离框的距离)
%set(gca,'position',[0.1,0.1,0.5,0.8] ); %定
axis([1 imSizex 1 imSizey]); % 设定图轴范围
grid on; %添加网格线
box on; % 将图轴加上图框
title('手写体输入窗(左键写字 右键识别)');
dlmwrite('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IXT1.txt', -10, 'delimiter', '\t', 'precision', 6);
dlmwrite('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IYT1.txt', -10, 'delimiter', '\t', 'precision', 6);

    %%滑鼠按钮被按下时的反应指令
case 'down',
    if strcmp(get(FigHandle, 'SelectionType'), 'normal')    %如果是左键
        set(FigHandle,'pointer','hand');      
        CurPiont = get(gca, 'CurrentPoint');
        InitialX = CurPiont(1,1);%得到该点的两个数据并写入
        InitialY = CurPiont(1,2);
        dlmwrite('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IXT1.txt', InitialX, '-append', 'delimiter', '\t', 'precision', 6);
        dlmwrite('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IYT1.txt', InitialY, '-append', 'delimiter', '\t', 'precision', 6);
        set(gcf, 'WindowButtonMotionFcn', 'MouseDraw move');%保存完数据后进行的某种设置
        set(gcf, 'WindowButtonUpFcn', 'MouseDraw up');%按下后是起还是
    elseif strcmp(get(FigHandle, 'SelectionType'), 'alt')   % 如果是右键
        set(FigHandle, 'Pointer', 'arrow');
        set( FigHandle, 'WindowButtonMotionFcn', '')
        set(FigHandle, 'WindowButtonUpFcn', '')
        fprintf('MouseDraw right button down!\n');
        ImageX = importdata('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IXT1.txt');
        ImageY = importdata('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IYT1.txt');
        InputImage = ones(imSizex,imSizey);
        roundX = round(ImageX);
        roundY = round(ImageY);
        for k = 1:size(ImageX,1)
            if 0<roundX(k) && roundX(k)<imSizex && 0<roundY(k) && roundY(k)<imSizey
                InputImage(roundX(k)-1:roundX(k)+2, roundY(k)-1:roundY(k)+2) = 0;
            end
        end
        InputImage = imrotate(InputImage,90);       % 图像旋转90
        axes(FigHandle.Children),cla;%删除坐标图像
        delete('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IXT1.txt');%每次识别完要先删除,否则是根据上面的'-append'写入
        delete('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IYT1.txt');
        bayesBinaryTest(InputImage); %调用手写体识别函数
        imwrite(InputImage,'C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\图片.bmp');
    end
%%滑鼠移动时的反应指令
case 'move',
    CurPiont = get(gca, 'CurrentPoint');
    X = CurPiont(1,1);
    Y = CurPiont(1,2);
    % 当鼠标移动较快时,不会出现离散点。
    % 利用y=kx+b直线方程实现。
    x_gap = 0.1;    % 定义x方向增量
    y_gap = 0.1;    % 定义y方向增量
    if X > InitialX
        step_x = x_gap;
    else
        step_x = -x_gap;
    end
    if Y > InitialY
        step_y = y_gap;
    else
        step_y = -y_gap;
    end  
    % 定义x,y的变化范围和步长
    if abs(X-InitialX) < 0.01        % 线平行于y轴,即斜率不存在时
        iy = InitialY:step_y:Y;
        ix = X.*ones(1,size(iy,2));
    else
        ix = InitialX:step_x:X ;    % 定义x的变化范围和步长
        % 当斜率存在,即k = (Y-InitialY)/(X-InitialX) ~= 0
        iy = (Y-InitialY)/(X-InitialX).*(ix-InitialX)+InitialY;   
    end
    ImageX = [ix, X]; 
    ImageY = cat(2, iy, Y);
    line(ImageX,ImageY, 'marker', '.', 'markerSize',18, ...
        'LineStyle', '-', 'LineWidth', 2, 'Color', 'Black');
    dlmwrite('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IXT1.txt', ImageX, '-append', 'delimiter', '\t', 'precision', 6);
    dlmwrite('C:\Users\Administrator\Desktop\贝叶斯手写汉字识别\程序\IYT1.txt', ImageY, '-append', 'delimiter', '\t', 'precision', 6);
    InitialX = X;       %记住当前点坐标
    InitialY = Y;       %记住当前点坐标
%%滑鼠按钮被释放时的反应指令
case 'up',
    % 清除滑鼠移动时的反应指令
    set(gcf, 'WindowButtonMotionFcn', '');
    % 清除滑鼠按钮被释放时的反应指令
    set(gcf, 'WindowButtonUpFcn', '');

end

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Think I’ll Buy Me a Football Team 状态切换问题
Problem Description Falling Stocks. Bankrupted companies. Banks with no Cash. Seems like the best time to invest: ``Think I'll buy me a football team!" No seriously, I think I have the solution to at least the problem of cash in banks. Banks nowadays are all owing each other great amounts of money and no bank has enough cash to pay other banks' debts even though, on paper at least, they should have enough money to do so. Take for example the inter-bank loans shown in figure (a). The graph shows the amounts owed between four banks (A ...D). For example, A owes B 50M while, at the same time, B owes A 150M. (It is quite common for two banks to owe each other at the same time.) A total amount of 380M in cash is needed to settle all debts between the banks. In an attempt to decrease the need for cash, and after studying the example carefully, I concluded that there's a lot of cash being transferred unnecessarily. Take a look: 1. C owes D the same amount as D owes A, so we can say that C owes A an amount of 30M and get D out of the picture. 2. But since A already owes C 100M, we can say that A owes C an amount of 70M. 3. Similarly, B owes A 100M only, (since A already owes B 50M.) This reduces the above graph to the one shown in figure (b) which reduces the needed cash amount to 190M (A reduction of 200M, or 53%.) 4. I can still do better. Rather than B paying A 100M and A paying 70M to C, B can pay 70M (out of A's 100M) directly to C. This reduces the graph to the one shown in figure (c). Banks can settle all their debts with only 120M in cash. A total reduction of 260M or 68%. Amazing! I have data about inter-bank debts but I can't seem to be able to process it to obtain the minimum amount of cash needed to settle all the debts. Could you please write a program to do that? Input Your program will be tested on one or more test cases. Each test case is specified on N + 1 lines where N < 1, 000 is the number of banks and is specified on the first line. The remaining N lines specifies the inter-bank debts using an N×N adjacency matrix (with zero diagonal) specified in row-major order. The ith row specifies the amounts owed by the ith bank. Amounts are separated by one or more spaces. All amounts are less than 1000. The last line of the input file has a single 0. Output For each test case, print the result using the following format: k . B A where k is the test case number (starting at 1,) is a space character, B is the amount of cash needed before reduction and A is the amount of cash after reduction. Sample Input 4 0 50 100 0 150 0 20 0 0 0 0 30 30 0 0 0 0 Sample Output 1. 380 120
Musical Chairs 音乐链条的问题
Problem Description In the traditional game of Musical Chairs, N + 1 children run around N chairs (placed in a circle) as long as music is playing. The moment the music stops, children run and try to sit on an available chair. The child still standing leaves the game, a chair is removed, and the game continues with N children. The last child to sit is the winner. In an attempt to create a similar game on these days' game consoles, you modify the game in the following manner: N Children are seated on N chairs arranged around a circle. The chairs are numbered from 1 to N . Your program pre-selects a positive number D . The program starts going in circles counting the children starting with the first chair. Once the count reaches D , that child leaves the game, removing his/her chair. The program starts counting again, beginning with the next chair in the circle. The last child remaining in the circle is the winner. For example, consider the game illustrated in the figure above for N = 5 and D = 3 . In the figure, the dot indicates where counting starts and × indicates the child leaving. Starting off, child #3 leaves the game, and counting restarts with child #4. Child #1 is the second child to leave and counting restart with child #2 resulting in child #5 leaving. Child #2 is the last to leave, and child #4 is the winner. Write a program to determine the winning child given both N and D . Input Your program will be tested on one or more test cases. Each test case specifies two positive integers N and D on a single line, separated by one or more spaces, where N, D < 1, 000, 000 . The last line of the input file contains two 0's and is not part of the test cases. Output For each test case, write the winner using the following format: N D W Where N and D are as above, is a space character, and W is the winner of that game. Sample Input 5 3 7 4 0 0 Sample Output 5 3 4 7 4 2
Cattle 的程序的编写
Description A group of more or less domesticated bovine animals (hereafter to be referred to as cattle) are to be loaded into railway freight cars of certain train. The train consists of K freight cars (and a locomotive, which is kind of irrelevant to this problem), which can be loaded with at most M animals each. A number from 1 to N is painted on each animal (all numbers are used and no two animals carries the same number so by easy induction on N one concludes that there are exactly N animals). The animals are patiently waiting to be loaded in a queue sorted by their numbers in ascending order (1 is the first to be loaded etc.). One freight car is loaded at a time by arbitrary number of animals (not exceeding M, of course) from the beginning of the queue and then locked so no subsequent load of animals to that freight car is possible. The process of loading is continued until all freight cars are locked. It is known that some clashing pairs of animals dislikes each other and if loaded in the same freight car then the stronger one will attempt to kill the other. It is also known that there are friendly pairs of animals where the stronger animal will always successfully protect the weaker one from attack of any other animal. If no alive friendly protecting animal is present, the attack of stronger animal of a clashing pair is always successfull. All attacks in a freight car starts when it is locked. The transportation lasts long enough for all attacks to finish. Write a program that will suggest the loading of animals to the freight cars so that the number of alive animals at the end of transportation will be as large as possible. Input The first line of the input contains three integers N, K, M; 1 <= N,K <= 1000, 1 <= M <= 20. The second line contains integer D – the number of clashing pairs among the animals. Each of the following D lines contains three mutually different integers A, B, C. The pair (A, B) represents a clashing pair, and the pair (C, B) represents a friendly pair of animals. The second animal in each pair is always the weaker one. A stronger animal of a clashing pair cannot be a weaker animal in any other pair (the first number A cannot occur as a second number anywhere). A weaker animal of a clashing pair has exactly one friendly protecting animal (the third number C is uniquely determined by the first two numbers A and B). Output The first and only line of the output consists of an integer – the maximal number of alive animals at the end of transportation. Sample Input 5 2 3 2 1 2 3 1 3 2 Sample Output 5
Crash and Go(relians) 代码的写法
Problem Description The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation. Generally, their space battles are fairly one-sided, but occasionally even the Gorelians get the worst of an encounter. During one such losing battle, the Gorelians’ space ship became so damaged that the Gorelians had to evacuate to the planet below. Because of the chaos (and because escape pods are not very accurate) the Gorelians were scattered across a large area of the planet (yet a small enough area that we can model the relevant planetary surface as planar, not spherical). Your job is to track their efforts to regroup. Fortunately, each escape pod was equipped with a locator that can tell the Gorelian his current coordinates on the planet, as well as with a radio that can be used to communicate with other Gorelians. Unfortunately, the range on the radios is fairly limited according to how much power one has. When a Gorelian lands on the alien planet, the first thing he does is check the radio to see if he can communicate with any other Gorelians. If he can, then he arranges a meeting point with them, and then they converge on that point. Once together, they are able to combine the power sources from their radios, which gives them a larger radio range. They then repeat the process—see who they can reach, arrange a meeting point, combine their radios—until they finally cannot contact any more Gorelians. Gorelian technology allows two-way communication as long as at least one of them has a radio with enough range to cover the distance between them. For example, suppose Alice has a radio with a range of 40 km, and Bob has a range of 30 km, but they are 45 km apart (Figure 1). Since neither has a radio with enough range to reach the other, they cannot talk. However, suppose they were only 35 km apart (Figure 2). Bob’s radio still does not have enough range to reach Alice, but that does not matter—they can still talk because Alice’s radio has enough range to reach Bob. If a Gorelian successfully contacts other Gorelians, they will meet at the point that is the average of all their locations. In the case of Alice and Bob, this would simply be the midpoint of A and B (Figure 3). Note that the Gorelians turn off their radios while traveling; they will not attempt to communicate with anyone else until they have all gathered at the meeting point. Once the Gorelians meet, they combine their radios to make a new radio with a larger range. In particular, the area covered by the new radio is equal to the sum of the areas covered by the old radio. In our example, Alice had a range of 40 km, so her radio covered an area of 1600π km. Bob’s radio covered an area of 900π km. So when they combine their radios they can cover 2500π km—meaning they have a range of 50 km. At this point they will try again to contact other Gorelians. This process continues until no more Gorelians can be contacted. As an example, suppose the following Gorelians have all landed and all have a radio range of 30 km: Alice (100, 100), Bob (130, 80), Cathy (80, 60), and Dave (120, 150). At this point, none of the Gorelians can contact anyone else (Figure 5). Now Eddy lands at position (90, 80) (Figure 6). Eddy can contact Alice and Cathy, so they arrange to meet at (90, 80), which is the average of their locations. Combining their radios gives them a range of √2700 ≈ 51.96 km (Figure 7). Now they check again with their new improved range and find that they can reach Bob. So they meet Bob at (110, 80) and combine their radios to get a new radio with a range of 60 (Figure 8). Unfortunately, this is not far enough to be able to reach Dave, so Dave remains isolated. Input The input will consist of one or more data sets. Each data set will begin with an integer N representing the number of Gorelians for this dataset (1 ≤ N ≤ 100). A value of N = 0 will signify the end of the input. Next will come N lines each containing three integers X, Y, and R representing the x- and y-coordinate where the Gorelian lands and the range of the radio (0 ≤ X ≤ 1000, 0 ≤ Y ≤ 1000, and 1 ≤ R ≤ 1000). Note that only the Gorelians' initial coordinates/range will be integral; after merging with other Gorelians they may no longer be integral. You should use double-precision arithmetic for all computations. The Gorelians land in the order in which they appear in the input file. When a Gorelian lands, he merges with any Gorelians he can contact, and the process keeps repeating until no further merges can be made. The next Gorelian does not land until all previous merges have been completed. Output The output will be one line per data set, reporting the number of independent groups of Gorelians that remain at the end of the process. Sample Input 5 100 100 30 130 80 30 80 60 30 120 150 30 90 80 30 6 100 100 50 145 125 10 60 140 15 160 145 20 130 135 25 80 80 30 0 Sample Output 2 3
Think I’ll Buy Me a Football Team 球队问题
Problem Description Falling Stocks. Bankrupted companies. Banks with no Cash. Seems like the best time to invest: ``Think I'll buy me a football team!" No seriously, I think I have the solution to at least the problem of cash in banks. Banks nowadays are all owing each other great amounts of money and no bank has enough cash to pay other banks' debts even though, on paper at least, they should have enough money to do so. Take for example the inter-bank loans shown in figure (a). The graph shows the amounts owed between four banks (A ...D). For example, A owes B 50M while, at the same time, B owes A 150M. (It is quite common for two banks to owe each other at the same time.) A total amount of 380M in cash is needed to settle all debts between the banks. In an attempt to decrease the need for cash, and after studying the example carefully, I concluded that there's a lot of cash being transferred unnecessarily. Take a look: 1. C owes D the same amount as D owes A, so we can say that C owes A an amount of 30M and get D out of the picture. 2. But since A already owes C 100M, we can say that A owes C an amount of 70M. 3. Similarly, B owes A 100M only, (since A already owes B 50M.) This reduces the above graph to the one shown in figure (b) which reduces the needed cash amount to 190M (A reduction of 200M, or 53%.) 4. I can still do better. Rather than B paying A 100M and A paying 70M to C, B can pay 70M (out of A's 100M) directly to C. This reduces the graph to the one shown in figure (c). Banks can settle all their debts with only 120M in cash. A total reduction of 260M or 68%. Amazing! I have data about inter-bank debts but I can't seem to be able to process it to obtain the minimum amount of cash needed to settle all the debts. Could you please write a program to do that? Input Your program will be tested on one or more test cases. Each test case is specified on N + 1 lines where N < 1, 000 is the number of banks and is specified on the first line. The remaining N lines specifies the inter-bank debts using an N×N adjacency matrix (with zero diagonal) specified in row-major order. The ith row specifies the amounts owed by the ith bank. Amounts are separated by one or more spaces. All amounts are less than 1000. The last line of the input file has a single 0. Output For each test case, print the result using the following format: k . B A where k is the test case number (starting at 1,) is a space character, B is the amount of cash needed before reduction and A is the amount of cash after reduction. Sample Input 4 0 50 100 0 150 0 20 0 0 0 0 30 30 0 0 0 0 Sample Output 1. 380 120
浏览器无法解析Ubuntu服务器中的php文件,只能自动下载
如题,环境Ubuntu16.04+nginx+php7.0 网站www.zxc233.top。 当访问www.zxc233.top/index.html时,一切正常, 但当访问[www.zxc233.top/_h5ai/public/index.php](www.zxc233.top/_h5ai/public/index.php "www.zxc233.top/_h5ai/public/index.php")时,即不可浏览和解析该文件,只能下载到本地,求解!请各位大佬帮我看一下吧,谢谢了!!! 下面是sites-available中的default文件 ``` ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # http://wiki.nginx.org/Pitfalls # http://wiki.nginx.org/QuickStart # http://wiki.nginx.org/Configuration # # Generally, you will want to move this file somewhere, and start with a clean # file but keep this around for reference. Or just disable in sites-enabled. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name _; location / { if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } root /var/www/html; index index.php; } location ~ \.php$ { root /var/www/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # # # With php7.0-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # With php7.0-fpm: # fastcgi_pass unix:/run/php/php7.0-fpm.sock; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # Virtual Host configuration for example.com # # You can move that to a different file under sites-available/ and symlink that # to sites-enabled/ to enable it. # #server { # listen 80; # listen [::]:80; # # server_name example.com; # # root /var/www/example.com; # index index.html; # # location / { # try_files $uri $uri/ =404; # } #} ```
The Embarrassed Cryptographer 的程序的设计
Problem Description The young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptographic keys are created from the product of two primes, and are believed to be secure because there is no known method for factoring such a product effectively. What Odd Even did not think of, was that both factors in a key should be large, not just their product. It is now possible that some of the users of the system have weak keys. In a desperate attempt not to be fired, Odd Even secretly goes through all the users keys, to check if they are strong enough. He uses his very poweful Atari, and is especially careful when checking his boss' key. Input The input consists of no more than 20 test cases. Each test case is a line with the integers 4 <= K <= 10100 and 2 <= L <= 106. K is the key itself, a product of two primes. L is the wanted minimum size of the factors in the key. The input set is terminated by a case where K = 0 and L = 0. Output For each number K, if one of its factors are strictly less than the required L, your program should output "BAD p", where p is the smallest factor in K. Otherwise, it should output "GOOD". Cases should be separated by a line-break. Sample Input 143 10 143 20 667 20 667 30 2573 30 2573 40 0 0 Sample Output GOOD BAD 11 GOOD BAD 23 GOOD BAD 31
Snooker Referee 裁判的问题
Problem Description Snooker is a cue sport that is played on a large baize-covered table with pockets in each of the four corners and in the middle of each of the long side cushions. It is played using a cue and snooker balls: one white cue ball, 15 red balls worth one point each, and six balls of different colors: yellow (2 points), green (3), brown (4), blue (5), pink (6) and black (7). A player (or team) wins a frame (individual game) of snooker by scoring more points than the opponent(s), using the cue ball to pot the red and colored balls. In this problem, your job is the referee of snooker. You should score both players, ask the correct player to play next, as well as place some of the balls back to the table if necessary. The rules of snooker needed for this problem are following. (We ignore some fouls about incorrectly hitting the cue ball here. We assume that the cue ball is never snookered after a foul, so free ball will never occur. We also assume that both players will make their best attempts to hit the ball on, so you do not need to declare a miss when they do not hit the ball on first.) At the beginning of each frame the balls are set up by the referee as illustrated above. This will be followed by a break-off shot, the white cue ball can be placed anywhere inside the D (it is called in-hand, which also happens when the cue ball is potted). Players take turns in visiting the table. A break is the number of points scored by a player in one single visit to the table. A player's turn and break end when he fails to pot a ball, when he does something against the rules of the game, which is called a foul, or when a frame has ended. The ball or balls that can be hit first by the white are called the ball(s) "on" for that particular stroke. The ball(s) "on" differ from shot to shot: a red ball, if potted, must be followed by a color, and so on until a break ends; if a red is not potted, any red ball remains the ball "on". Only a ball or balls "on" may be potted legally by a player. If a ball not "on" is potted, this is a foul. The game of snooker generally consists of two phases. The first phase is the situation in which there are still red balls on the table. In the first phase, at the beginning of a player's turn, the balls "on" are all remaining red balls. The player must therefore attempt to first hit and pot one or more red balls. For every red ball potted, the player will receive 1 point. When a red has been potted, it will stay off the table and the player can continue his break. If no red has been potted or a foul has been made, the other player will come into play. In case one or more red balls have been potted, the player can continue his break. This time one of the six colors (yellow, green, brown, blue, pink and black) is the ball "on". Only one of these can be the ball "on" and the rules of the game state that a player must nominate his desired color to the referee, although it is often clear which ball the striker is playing and it is not necessary to nominate. When the nominated color is potted, the player will be awarded the correct number of points (yellow, 2; green, 3; brown, 4; blue, 5; pink, 6; black, 7). The color is then taken out of the pocket by the referee and placed on its original spot. Because only one of the colors is the ball "on", it is a foul to first hit multiple colors at the same time, or pot more than one color. If a player fails to pot a ball "on", it being a red or nominated color, the other player will come into play and the balls "on" are always the reds, as long as there are still reds on the table. The alternation between red balls and colors ends when all reds have been potted and a color is potted after the last red, or a failed attempt to do so is made. Then the second phase begins. All six colors have to be potted in ascending order of their points value (yellow, green, brown, blue, pink, black). Each becomes the ball "on" in that order. During this phase, when potted, the colors stay down and are not replaced on the table, unless a foul is made when potting the color, in which case the color is respotted. When only the black is left, the first score or foul ends the frame, and the player who has scored most points has won it. However, if the score is tied after that, the black is respotted, the players draw lots for choice of playing, the next player plays from in-hand, and the next score or foul ends the frame. When a foul is made during a shot, the player's turn is ended and he will receive no points for the foul shot. The other player will receive penalty points. Colors illegally potted are respotted (while reds are not), and if the cue ball is potted, the next player will play from in-hand. Fouls concerned in this problem are: 。failing to hit any other ball with the cue ball 。first hitting a ball "not-on" with the cue ball 。potting a ball "not-on" 。potting the white (in-off) Penalty points are at least 4 points and at most 7 points. The number of penalty points is the value of the ball "on", or any of the "foul" balls, whichever is highest. When more than one foul is made, the penalty is not the added total - only the most highly valued foul is counted. As players usually do not nominate a color explicitly when hitting the colors, please be tolerant and assume that he always nominate the ball with the lowest score when it cannot be deduced from the ball first hit (i.e. when the cue ball does not hit any ball or hit a red first). If a player commits a foul, and his opponent considers that the position left is unattractive, he may request that the offender play again from the resulting position. Input The input file contains multiple test cases. The first line of the input file is a single integer T (T ≤ 200), the number of test cases. For each test case (frame), the first line contains the names of the two players separated by a whitespace. The first player will take the break-off shot. Each name is made up of no more than 20 English letters, and the two names are different. After that, the input mainly consists of lines that describe a stroke each (with two exceptions stated later). A stroke is described by the color of the ball first hit by the cue ball (or "None" if the cue ball does not hit any ball), followed by zero or more colors of the balls potted, all separated by whitespaces. For example, a line "Red Red White Red" means the cue ball first hit a red ball, and 2 reds are potted as well as the cue ball itself; and a line "None" means the cue ball does not hit any ball thus no ball is potted. You can assume that all strokes are legal according to the balls remain on the table, and the cue ball will not hit two or more ball first simultaneously. A line "Play again" may appear if and only if the last stroke is a foul. It means the other player request that the offender play again from the resulting position. If a score or foul occurs when only the black is left, and the score is tied after that, a line with either player's name will follow. That means the player will play next as a result of the lot. The case end when the frame ends. There is a blank line before every test case. Output For each frame, print a line in the format "Frame K" first, where K is the index of this case starts from 1. Then use the output to indicate the referee's behaviors: 。When a frame begins, print a line in the format "PlayerName's turn, in-hand", where PlayerName is the name of the player who take the break-off shot. 。After each stroke, print a line "Foul!" first if it is a foul. Then print a line with current score in the format "ScoreA : ScoreB", where ScoreA is the score of the player who take the break-off shot, and ScoreB is the other player's score. After that, if the frame continue fairly (i.e. not only black is left before the stroke, or it is not a score or foul when only black is left), and some ball(s) should be respotted. Print a line with the word "Respot" following by the color(s) of the ball(s), all separated by whitespace. If more than one ball should be respotted, print their colors in ascending order of their values. Do not print anything if no ball needed to be respotted. At last (when the frame continue fairly and any necessary ball has been respotted), if the last player's break ends, print a line in the format "PlayerName's turn" to ask the other player to play next, where PlayerName is the next player's name. If the next player should play from in-hand, print "PlayerName's turn, in-hand" instead. 。After a foul, if the other player request that the offender play again, just print a line "PlayerName's turn" or "PlayerName's turn, in-hand" according to whether the cue ball is in-hand, where PlayerName is the offender's name. Note that the requester is actually requesting in his turn, after you asked him to play next. 。If a score or foul occurs when only the black is left, and the score is tied after that, print a line "Tie" after the score. Then print two lines "Respot Black" and "PlayerName's turn, in-hand" to respot the black and play from in-hand, where PlayerName is the next player's name (determined by the lot). 。When the frame ends, print a line "PlayerName wins" after the score, where PlayerName is the winner's name. Print a blank line between every two successive cases. Sample Input 1 Zero Maxbreak Red White Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Sample Output Frame 1 Zero's turn, in-hand Foul! 0 : 4 Maxbreak's turn, in-hand 0 : 5 0 : 12 Respot Black 0 : 13 0 : 20 Respot Black 0 : 21 0 : 28 Respot Black 0 : 29 0 : 36 Respot Black 0 : 37 0 : 44 Respot Black 0 : 45 0 : 52 Respot Black 0 : 53 0 : 60 Respot Black 0 : 61 0 : 68
求助sprinboot整合 elasticsearch-rest-high-level-client-5.6.4报错
以下是报错信息: Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientConfigurations$RestHighLevelClientConfiguration.elasticsearchRestHighLevelClient(RestClientConfigurations.java:75) The following method did not exist: org.elasticsearch.client.RestHighLevelClient.<init>(Lorg/elasticsearch/client/RestClientBuilder;)V The method's class, org.elasticsearch.client.RestHighLevelClient, is available from the following locations: jar:file:/Users/jianxiaowen/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.4/elasticsearch-rest-high-level-client-5.6.4.jar!/org/elasticsearch/client/RestHighLevelClient.class It was loaded from the following location: file:/Users/jianxiaowen/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.4/elasticsearch-rest-high-level-client-5.6.4.jar Action: Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.RestHighLevelClient 以下是pom文件,是springboot版本和这个es不兼容吗,原来用的es6.x是可以的,换成5.x就不行了,但是公司环境就要求5.x: ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.xxx</groupId> <artifactId>repservice</artifactId> <version>1.0</version> <modules> <module>kg-business</module> </modules> <packaging>pom</packaging> <name>repservice</name> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.7.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <elasticsearch.version>5.6.4</elasticsearch.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>com.x x x.datanlp</groupId> <artifactId>graph-db-sdk</artifactId> <version>1.1-SNAPSHOT</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.13</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-commons</artifactId> <version>2.1.10.RELEASE</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.restdocs</groupId> <artifactId>spring-restdocs-mockmvc</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.0</version> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter-test</artifactId> <version>2.1.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-core</artifactId> <version>5.2.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.3</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.12</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.10</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> <version>4.5.10</version> </dependency> <dependency> <groupId>io.reactivex.rxjava2</groupId> <artifactId>rxjava</artifactId> <version>2.2.9</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.6</version> </dependency> <!-- 引入 redis 依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.solr/solr-solrj --> <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</artifactId> <version>8.2.0</version> </dependency> <!-- 解压rar --> <dependency> <groupId>com.github.junrar</groupId> <artifactId>junrar</artifactId> <version>4.0.0</version> </dependency> <!-- 解压zip --> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant</artifactId> <version>1.10.7</version> </dependency> <!--结果验证--> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <version>2.4.0</version> </dependency> <!-- 临时--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.51</version> </dependency> <dependency> <groupId>com.arangodb</groupId> <artifactId>arangodb-java-driver</artifactId> <version>5.0.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-web --> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-web</artifactId> <version>2.7</version> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>5.6.4</version> </dependency> <!-- Java Low Level REST Client --> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-client</artifactId> <version>5.6.4</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>5.6.4</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> ```
Getting Driving License 程序的设计问题
Problem Description Have you got a driving license? Acquiring a driving license brings you a lot of benefits. You will regret for not passing the driving test or getting a driving license in your campus life. Why?College life is filled with much spare time,which you can use to improve yourself in many fields such as driving. During the time of taking driving lessons,Samuel met a lot of classmates whose time are occupied by their own work. The fact that they have little time to practice makes getting driving license increasingly difficult. Passing the driving test as soon as possible is suggested by these mates to the our college students who cannot drive. Know something about the driving test you can read the information in the background section,however,it is not related with this problem firmly. Surely,you can go to the problem section directly. Here is the background information on owning driving licenses in China mainland: To get a driving license successfully,you need to take about 4 tests at least. The first part is the theory exam which helps you know clearly about the transportation law in China mainland and other driving theory. The second is to test you whether you can drive a car forward out and backward in the garage at a very low speed(like aunts moving),move the car from one garage to another and drive out. The third section you need to pass is a little difficult than the second test. In this section,you should be able to drive to avoid the obstacles on the road,manage your car pass S formed way(your car's wheels can not be moved onto one of the tracks which leads your way out),after that you may have to make your car pass the 90 degree angle track,then pass the course equipped with very low bridge using one side of your car's wheel and so on. The forth part which is test the same day with the third test is called road driving test(but in the problem I designed the time between Part 3 and Part 4 is 1 month,just want to make the problem much easier).As you can refer from the word,it tests the ability of driving on the road,it is more practical and of more importance. If you seems not very lucky,you will have fifth section(The problem does not include the 5th part,you can ignore it in solving the problem).In this part you are required to driving at night which involves changing lights in addition . Teachers never taught how to drive at night unless your group is asked to take part in this test. But on the contrary,taught how to driving at night,of course,is necessary. Samuel had an experience of taking the fifth test to get the driving license in the summer of 2008. Tell you a secret,next time you meet a car comes from an opposite direction and the driver of that car does not change his front lights ,it probably means he/she needs special training on how to drive at night. To get a driving license,you should pass the 4 parts one by one. For example,if you failed in the section 2,you have to retry for a second time,third time...before you pass. After that you have the opportunity to enter Part 3. Here is the problem section you need read patiently: Some details you need to know: 1.The time between the two tests is generally about 1 month(If you fail in the test on your first attempt,you can try it a second time. Fail again the second time he have to go home and retry after 1 month). 2.And the time from you take the first test to your owning a license is within 2 years. 3.What's more,the passing score in Part 1 test is 90(that is to say if you get 89 or even lower at your first attempt,a second attempt is needed. You will pass until you get 90 or higher at the second time)and each of the rest parts the passing score is 80 at least. Input The input consists 2 major sections as usual, the test cases t,each of the test case involves an integer n and n scores one gets in the test and with n scores he passed the test or he failed to pass in the 2 years(of course here n>=4). All the number here are integers. Output Output is simple. Just output the time one needs to get a driving license (if time is within 2 years)using the format “It takes about m months to get a driving license.”If time is beyond 2 years please output the sentence “He failed to get a driving license within 2 years! ” Sample Input 3 5 89 90 95 84 80 7 80 90 70 80 75 85 80 7 80 90 70 70 80 85 85 Sample Output It takes about 3 months to get a driving license. It takes about 3 months to get a driving license. It takes about 4 months to get a driving license.
用main方法启动成功,但是用外置tomacat启动spring boot项目报错
用main方法启动成功,但是用外置tomacat启动spring boot项目报xia'm错: 2020-02-11 19:33:30.588 INFO 12292 --- [on(2)-127.0.0.1] com.wisezone.docker.api.TestDemo : No active profile set, falling back to default profiles: default 2020-02-11 19:33:30.983 WARN 12292 --- [on(2)-127.0.0.1] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.wisezone.docker.api.TestDemo]; nested exception is java.io.FileNotFoundException: class path resource [common/controller/BaseController.class] cannot be opened because it does not exist 2020-02-11 19:33:31.090 ERROR 12292 --- [on(2)-127.0.0.1] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.wisezone.docker.api.TestDemo]; nested exception is java.io.FileNotFoundException: class path resource [common/controller/BaseController.class] cannot be opened because it does not exist at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172) [spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135) [catalina.jar:9.0.24] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.24] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717) [catalina.jar:9.0.24] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) [catalina.jar:9.0.24] 11-Feb-2020 19:33:31.092 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method [manageApp] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) [catalina.jar:9.0.24] java.lang.IllegalStateException: Error starting child at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1728) [catalina.jar:9.0.24] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:720) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91] at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1728) at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) [tomcat-coyote.jar:9.0.24] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [na:1.8.0_91] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [na:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457) [catalina.jar:9.0.24] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406) [catalina.jar:9.0.24] at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91] at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91] at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91] at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) [tomcat-coyote.jar:9.0.24] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [na:1.8.0_91] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [na:1.8.0_91] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) [na:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) [na:1.8.0_91] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) [na:1.8.0_91] at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) [na:1.8.0_91] at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_91] at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408) [na:1.8.0_91] at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) [na:1.8.0_91] at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91] at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91] at java.security.AccessController.doPrivileged(Native Method) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91] at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408) at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91] at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324) [na:1.8.0_91] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.rmi.transport.Transport$1.run(Transport.java:200) [na:1.8.0_91] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.rmi.transport.Transport$1.run(Transport.java:197) [na:1.8.0_91] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_91] at sun.rmi.transport.Transport.serviceCall(Transport.java:196) [na:1.8.0_91] at java.lang.reflect.Method.invoke(Method.java:498) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) [na:1.8.0_91] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) [na:1.8.0_91] at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) [na:1.8.0_91] at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_91] at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) [na:1.8.0_91] at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_91] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_91] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_91] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) Caused by: java.io.FileNotFoundException: class path resource [common/controller/BaseController.class] cannot be opened because it does not exist at java.security.AccessController.doPrivileged(Native Method) at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:56) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE] at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/docker_api_war_exploded]] at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717) at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:686) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] ... 43 more at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:994) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.wisezone.docker.api.TestDemo]; nested exception is java.io.FileNotFoundException: class path resource [common/controller/BaseController.class] cannot be opened because it does not exist at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:335) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:194) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:298) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE] ... 60 common frames omitted at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 44 more Caused by: java.io.FileNotFoundException: class path resource [common/controller/BaseController.class] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:56) at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86) at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:686) at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getSuperClass(ConfigurationClassParser.java:994) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:335) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:194) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:298) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170) ... 60 more
Snooker Referee 比赛裁判的算法
Problem Description Snooker is a cue sport that is played on a large baize-covered table with pockets in each of the four corners and in the middle of each of the long side cushions. It is played using a cue and snooker balls: one white cue ball, 15 red balls worth one point each, and six balls of different colors: yellow (2 points), green (3), brown (4), blue (5), pink (6) and black (7). A player (or team) wins a frame (individual game) of snooker by scoring more points than the opponent(s), using the cue ball to pot the red and colored balls. In this problem, your job is the referee of snooker. You should score both players, ask the correct player to play next, as well as place some of the balls back to the table if necessary. The rules of snooker needed for this problem are following. (We ignore some fouls about incorrectly hitting the cue ball here. We assume that the cue ball is never snookered after a foul, so free ball will never occur. We also assume that both players will make their best attempts to hit the ball on, so you do not need to declare a miss when they do not hit the ball on first.) At the beginning of each frame the balls are set up by the referee as illustrated above. This will be followed by a break-off shot, the white cue ball can be placed anywhere inside the D (it is called in-hand, which also happens when the cue ball is potted). Players take turns in visiting the table. A break is the number of points scored by a player in one single visit to the table. A player's turn and break end when he fails to pot a ball, when he does something against the rules of the game, which is called a foul, or when a frame has ended. The ball or balls that can be hit first by the white are called the ball(s) "on" for that particular stroke. The ball(s) "on" differ from shot to shot: a red ball, if potted, must be followed by a color, and so on until a break ends; if a red is not potted, any red ball remains the ball "on". Only a ball or balls "on" may be potted legally by a player. If a ball not "on" is potted, this is a foul. The game of snooker generally consists of two phases. The first phase is the situation in which there are still red balls on the table. In the first phase, at the beginning of a player's turn, the balls "on" are all remaining red balls. The player must therefore attempt to first hit and pot one or more red balls. For every red ball potted, the player will receive 1 point. When a red has been potted, it will stay off the table and the player can continue his break. If no red has been potted or a foul has been made, the other player will come into play. In case one or more red balls have been potted, the player can continue his break. This time one of the six colors (yellow, green, brown, blue, pink and black) is the ball "on". Only one of these can be the ball "on" and the rules of the game state that a player must nominate his desired color to the referee, although it is often clear which ball the striker is playing and it is not necessary to nominate. When the nominated color is potted, the player will be awarded the correct number of points (yellow, 2; green, 3; brown, 4; blue, 5; pink, 6; black, 7). The color is then taken out of the pocket by the referee and placed on its original spot. Because only one of the colors is the ball "on", it is a foul to first hit multiple colors at the same time, or pot more than one color. If a player fails to pot a ball "on", it being a red or nominated color, the other player will come into play and the balls "on" are always the reds, as long as there are still reds on the table. The alternation between red balls and colors ends when all reds have been potted and a color is potted after the last red, or a failed attempt to do so is made. Then the second phase begins. All six colors have to be potted in ascending order of their points value (yellow, green, brown, blue, pink, black). Each becomes the ball "on" in that order. During this phase, when potted, the colors stay down and are not replaced on the table, unless a foul is made when potting the color, in which case the color is respotted. When only the black is left, the first score or foul ends the frame, and the player who has scored most points has won it. However, if the score is tied after that, the black is respotted, the players draw lots for choice of playing, the next player plays from in-hand, and the next score or foul ends the frame. When a foul is made during a shot, the player's turn is ended and he will receive no points for the foul shot. The other player will receive penalty points. Colors illegally potted are respotted (while reds are not), and if the cue ball is potted, the next player will play from in-hand. Fouls concerned in this problem are: 。failing to hit any other ball with the cue ball 。first hitting a ball "not-on" with the cue ball 。potting a ball "not-on" 。potting the white (in-off) Penalty points are at least 4 points and at most 7 points. The number of penalty points is the value of the ball "on", or any of the "foul" balls, whichever is highest. When more than one foul is made, the penalty is not the added total - only the most highly valued foul is counted. As players usually do not nominate a color explicitly when hitting the colors, please be tolerant and assume that he always nominate the ball with the lowest score when it cannot be deduced from the ball first hit (i.e. when the cue ball does not hit any ball or hit a red first). If a player commits a foul, and his opponent considers that the position left is unattractive, he may request that the offender play again from the resulting position. Input The input file contains multiple test cases. The first line of the input file is a single integer T (T ≤ 200), the number of test cases. For each test case (frame), the first line contains the names of the two players separated by a whitespace. The first player will take the break-off shot. Each name is made up of no more than 20 English letters, and the two names are different. After that, the input mainly consists of lines that describe a stroke each (with two exceptions stated later). A stroke is described by the color of the ball first hit by the cue ball (or "None" if the cue ball does not hit any ball), followed by zero or more colors of the balls potted, all separated by whitespaces. For example, a line "Red Red White Red" means the cue ball first hit a red ball, and 2 reds are potted as well as the cue ball itself; and a line "None" means the cue ball does not hit any ball thus no ball is potted. You can assume that all strokes are legal according to the balls remain on the table, and the cue ball will not hit two or more ball first simultaneously. A line "Play again" may appear if and only if the last stroke is a foul. It means the other player request that the offender play again from the resulting position. If a score or foul occurs when only the black is left, and the score is tied after that, a line with either player's name will follow. That means the player will play next as a result of the lot. The case end when the frame ends. There is a blank line before every test case. Output For each frame, print a line in the format "Frame K" first, where K is the index of this case starts from 1. Then use the output to indicate the referee's behaviors: 。When a frame begins, print a line in the format "PlayerName's turn, in-hand", where PlayerName is the name of the player who take the break-off shot. 。After each stroke, print a line "Foul!" first if it is a foul. Then print a line with current score in the format "ScoreA : ScoreB", where ScoreA is the score of the player who take the break-off shot, and ScoreB is the other player's score. After that, if the frame continue fairly (i.e. not only black is left before the stroke, or it is not a score or foul when only black is left), and some ball(s) should be respotted. Print a line with the word "Respot" following by the color(s) of the ball(s), all separated by whitespace. If more than one ball should be respotted, print their colors in ascending order of their values. Do not print anything if no ball needed to be respotted. At last (when the frame continue fairly and any necessary ball has been respotted), if the last player's break ends, print a line in the format "PlayerName's turn" to ask the other player to play next, where PlayerName is the next player's name. If the next player should play from in-hand, print "PlayerName's turn, in-hand" instead. 。After a foul, if the other player request that the offender play again, just print a line "PlayerName's turn" or "PlayerName's turn, in-hand" according to whether the cue ball is in-hand, where PlayerName is the offender's name. Note that the requester is actually requesting in his turn, after you asked him to play next. 。If a score or foul occurs when only the black is left, and the score is tied after that, print a line "Tie" after the score. Then print two lines "Respot Black" and "PlayerName's turn, in-hand" to respot the black and play from in-hand, where PlayerName is the next player's name (determined by the lot). 。When the frame ends, print a line "PlayerName wins" after the score, where PlayerName is the winner's name. Print a blank line between every two successive cases. Sample Input 1 Zero Maxbreak Red White Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Red Red Black Black Sample Output Frame 1 Zero's turn, in-hand Foul! 0 : 4 Maxbreak's turn, in-hand 0 : 5 0 : 12 Respot Black 0 : 13 0 : 20 Respot Black 0 : 21 0 : 28 Respot Black 0 : 29 0 : 36 Respot Black 0 : 37 0 : 44 Respot Black 0 : 45 0 : 52 Respot Black 0 : 53 0 : 60 Respot Black 0 : 61 0 : 68
第一次数据库查询成功,第二次查询去失败了?
我编写一个Android应用,A页面拥有一个选项菜单,点击菜单中的选项,跳转到B页面,B页面接收从A页面传递的数据后,进行数据库查询,在本页面中显示相关内容。 B页面中通过动态添加View的方法,添加了按钮,点击按钮,可进行数据库查询,获取相关值在页面显示。 不过我不想每次返回A页面,选择选项菜单的另一项再进入B页面,于是我在B页面同样放置了选项菜单,让我点击B页面上的选项菜单时,直接在B页面上显示,不过却出现“java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.Cursor android.database.sqlite.SQLiteDatabase.rawQuery(java.lang.String, java.lang.String[])' on a null object reference”的错误。 请问,要怎样做呢? 相关数据库查询的函数 public ArrayList<JapInfo> query_stylecolumn(String style_column, String alp_style) { String sql = String.format("SELECT hiragana,katakana,sound_path FROM Jap_Info AS j " + "LEFT JOIN Alp_style AS a " + "ON j.alpha_style_id = a.id " + "WHERE j.style_column = '%s' and a.style_name = '%s';",style_column,alp_style); ArrayList<JapInfo> japIf = new ArrayList<JapInfo>(); Cursor cursor = mDB.rawQuery(sql,null); while (cursor.moveToNext()){ JapInfo japIfo = new JapInfo(); japIfo.hiragana = cursor.getString(0); japIfo.katakana = cursor.getString(1); japIfo.sound_path = cursor.getString(2); japIf.add(japIfo); } cursor.close(); return japIf; }
debian10.2安装phpstorm2019.3.1时出现了问题,求大佬解答
debian 10.2 phpstorm 2019.3.1 在设置完环境变量后,运行phpstorm与直接进入文件目录执行./phpstorm.sh出现的都是这个问题,求各位大佬给个解决方法,万分感谢 另外我实在是莫得币子了,知识无价,学海无涯,有任何解决办法我都会去尝试,谢谢大家了 OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. No protocol specified 2020-01-19 23:59:09,363 [ 2351] WARN - #com.intellij.idea.Main - java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable. java.util.concurrent.ExecutionException: java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable. at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395) at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999) at com.intellij.idea.StartupUtil.runInEdtAndWait(StartupUtil.java:678) at com.intellij.idea.StartupUtil.lambda$showUserAgreementAndConsentsIfNeeded$15(StartupUtil.java:673) at com.intellij.ui.AppUIUtil.showConsentsAgreementIfNeeded(AppUIUtil.java:332) at com.intellij.idea.StartupUtil.showUserAgreementAndConsentsIfNeeded(StartupUtil.java:673) at com.intellij.idea.StartupUtil.startApp(StartupUtil.java:231) at com.intellij.idea.StartupUtil.prepareApp(StartupUtil.java:213) at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:39) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable. at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:315) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83) at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129) at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:232) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:315) at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588) at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582) at java.desktop/java.awt.Toolkit.getEventQueue(Toolkit.java:1499) at java.desktop/java.awt.EventQueue.invokeLater(EventQueue.java:1318) at com.intellij.idea.StartupUtil.lambda$scheduleInitUi$9(StartupUtil.java:265) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ... 1 more 2020-01-19 23:59:10,475 [ 3463] ERROR - tellij.diagnostic.LoadingState - Should be called at least in the state LAF_INITIALIZED, the current state is: BOOTSTRAP Current violators count: 1 java.lang.Throwable at com.intellij.diagnostic.LoadingState.logStateError(LoadingState.java:55) at com.intellij.diagnostic.LoadingState.checkOccurred(LoadingState.java:51) at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:83) at com.intellij.ide.a.c.a.a(a.java:182) at com.intellij.ide.a.d.n.a(n.java:544) at com.intellij.ide.a.d.n.c(n.java:222) at com.intellij.ide.a.d.n.a(n.java:117) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intellij.idea.MainImpl.start(MainImpl.java:94) at com.intellij.idea.StartupUtil.lambda$startApp$5(StartupUtil.java:246) at com.intellij.util.ui.EdtInvocationManager.executeWithCustomManager(EdtInvocationManager.java:73) at com.intellij.idea.StartupUtil.startApp(StartupUtil.java:241) at com.intellij.idea.StartupUtil.prepareApp(StartupUtil.java:213) at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:39) at java.base/java.lang.Thread.run(Thread.java:834) 2020-01-19 23:59:10,475 [ 3463] ERROR - tellij.diagnostic.LoadingState - PhpStorm 2019.3.1 Build #PS-193.5662.63 2020-01-19 23:59:10,476 [ 3464] ERROR - tellij.diagnostic.LoadingState - JDK: 11.0.5; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 2020-01-19 23:59:10,476 [ 3464] ERROR - tellij.diagnostic.LoadingState - OS: Linux 2020-01-19 23:59:10,485 [ 3473] ERROR - tellij.diagnostic.LoadingState - Should be called at least in the state LAF_INITIALIZED, the current state is: BOOTSTRAP Current violators count: 2 java.lang.Throwable at com.intellij.diagnostic.LoadingState.logStateError(LoadingState.java:55) at com.intellij.diagnostic.LoadingState.checkOccurred(LoadingState.java:51) at com.intellij.openapi.util.registry.Registry.is(Registry.java:52) at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:90) at com.intellij.ide.a.c.a.a(a.java:182) at com.intellij.ide.a.d.n.a(n.java:544) at com.intellij.ide.a.d.n.c(n.java:222) at com.intellij.ide.a.d.n.a(n.java:117) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intellij.idea.MainImpl.start(MainImpl.java:94) at com.intellij.idea.StartupUtil.lambda$startApp$5(StartupUtil.java:246) at com.intellij.util.ui.EdtInvocationManager.executeWithCustomManager(EdtInvocationManager.java:73) at com.intellij.idea.StartupUtil.startApp(StartupUtil.java:241) at com.intellij.idea.StartupUtil.prepareApp(StartupUtil.java:213) at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:39) at java.base/java.lang.Thread.run(Thread.java:834) 2020-01-19 23:59:10,486 [ 3474] ERROR - tellij.diagnostic.LoadingState - PhpStorm 2019.3.1 Build #PS-193.5662.63 2020-01-19 23:59:10,486 [ 3474] ERROR - tellij.diagnostic.LoadingState - JDK: 11.0.5; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 2020-01-19 23:59:10,486 [ 3474] ERROR - tellij.diagnostic.LoadingState - OS: Linux 2020-01-19 23:59:10,540 [ 3528] ERROR - llij.ide.plugins.PluginManager - Could not initialize class sun.awt.X11.XToolkit java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:315) at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588) at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582) at java.desktop/sun.swing.SwingUtilities2.getSystemMnemonicKeyMask(SwingUtilities2.java:2210) at java.desktop/javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults(BasicLookAndFeel.java:1096) at java.desktop/javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:440) at java.desktop/javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:150) at java.desktop/javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1560) at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:592) at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:634) at java.desktop/javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1409) at java.desktop/javax.swing.UIManager.initialize(UIManager.java:1522) at java.desktop/javax.swing.UIManager.maybeInitialize(UIManager.java:1488) at java.desktop/javax.swing.UIManager.getDefaults(UIManager.java:714) at java.desktop/javax.swing.UIManager.getFont(UIManager.java:727) at com.intellij.ui.scale.JBUIScale.lambda$static$0(JBUIScale.java:47) at com.intellij.openapi.util.AtomicNotNullLazyValue$1.compute(AtomicNotNullLazyValue.java:59) at com.intellij.openapi.util.AtomicNotNullLazyValue.getValue(AtomicNotNullLazyValue.java:37) at com.intellij.ui.scale.JBUIScale.lambda$static$1(JBUIScale.java:152) at com.intellij.util.LazyInitializer$MutableNotNullValue.initialize(LazyInitializer.java:113) at com.intellij.util.LazyInitializer$NullableValue.get(LazyInitializer.java:41) at com.intellij.util.LazyInitializer$MutableNotNullValue.get(LazyInitializer.java:102) at com.intellij.ui.scale.JBUIScale.lambda$static$2(JBUIScale.java:170) at com.intellij.util.LazyInitializer$MutableNotNullValue.initialize(LazyInitializer.java:113) at com.intellij.util.LazyInitializer$NullableValue.get(LazyInitializer.java:41) at com.intellij.util.LazyInitializer$MutableNotNullValue.get(LazyInitializer.java:102) at com.intellij.ui.scale.JBUIScale.scale(JBUIScale.java:294) at com.intellij.util.ui.JBInsets.create(JBInsets.java:41) at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:457) at com.intellij.ide.a.c.a.a(a.java:182) at com.intellij.ide.a.d.n.a(n.java:544) at com.intellij.ide.a.d.n.c(n.java:222) at com.intellij.ide.a.d.n.a(n.java:117) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intellij.idea.MainImpl.start(MainImpl.java:94) at com.intellij.idea.StartupUtil.lambda$startApp$5(StartupUtil.java:246) at com.intellij.util.ui.EdtInvocationManager.executeWithCustomManager(EdtInvocationManager.java:73) at com.intellij.idea.StartupUtil.startApp(StartupUtil.java:241) at com.intellij.idea.StartupUtil.prepareApp(StartupUtil.java:213) at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:39) at java.base/java.lang.Thread.run(Thread.java:834) 2020-01-19 23:59:10,542 [ 3530] ERROR - llij.ide.plugins.PluginManager - PhpStorm 2019.3.1 Build #PS-193.5662.63 2020-01-19 23:59:10,543 [ 3531] ERROR - llij.ide.plugins.PluginManager - JDK: 11.0.5; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 2020-01-19 23:59:10,543 [ 3531] ERROR - llij.ide.plugins.PluginManager - OS: Linux Start Failed: Internal error. Please refer to http://jb.gg/ide/critical-startup-errors java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:315) at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588) at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582) at java.desktop/sun.swing.SwingUtilities2.getSystemMnemonicKeyMask(SwingUtilities2.java:2210) at java.desktop/javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults(BasicLookAndFeel.java:1096) at java.desktop/javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:440) at java.desktop/javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:150) at java.desktop/javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1560) at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:592) at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:634) at java.desktop/javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1409) at java.desktop/javax.swing.UIManager.initialize(UIManager.java:1522) at java.desktop/javax.swing.UIManager.maybeInitialize(UIManager.java:1488) at java.desktop/javax.swing.UIManager.getDefaults(UIManager.java:714) at java.desktop/javax.swing.UIManager.getFont(UIManager.java:727) at com.intellij.ui.scale.JBUIScale.lambda$static$0(JBUIScale.java:47) at com.intellij.openapi.util.AtomicNotNullLazyValue$1.compute(AtomicNotNullLazyValue.java:59) at com.intellij.openapi.util.AtomicNotNullLazyValue.getValue(AtomicNotNullLazyValue.java:37) at com.intellij.ui.scale.JBUIScale.lambda$static$1(JBUIScale.java:152) at com.intellij.util.LazyInitializer$MutableNotNullValue.initialize(LazyInitializer.java:113) at com.intellij.util.LazyInitializer$NullableValue.get(LazyInitializer.java:41) at com.intellij.util.LazyInitializer$MutableNotNullValue.get(LazyInitializer.java:102) at com.intellij.ui.scale.JBUIScale.lambda$static$2(JBUIScale.java:170) at com.intellij.util.LazyInitializer$MutableNotNullValue.initialize(LazyInitializer.java:113) at com.intellij.util.LazyInitializer$NullableValue.get(LazyInitializer.java:41) at com.intellij.util.LazyInitializer$MutableNotNullValue.get(LazyInitializer.java:102) at com.intellij.ui.scale.JBUIScale.scale(JBUIScale.java:294) at com.intellij.util.ui.JBInsets.create(JBInsets.java:41) at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:457) at com.intellij.ide.a.c.a.a(a.java:182) at com.intellij.ide.a.d.n.a(n.java:544) at com.intellij.ide.a.d.n.c(n.java:222) at com.intellij.ide.a.d.n.a(n.java:117) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.intellij.idea.MainImpl.start(MainImpl.java:94) at com.intellij.idea.StartupUtil.lambda$startApp$5(StartupUtil.java:246) at com.intellij.util.ui.EdtInvocationManager.executeWithCustomManager(EdtInvocationManager.java:73) at com.intellij.idea.StartupUtil.startApp(StartupUtil.java:241) at com.intellij.idea.StartupUtil.prepareApp(StartupUtil.java:213) at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:39) at java.base/java.lang.Thread.run(Thread.java:834) ----- JRE 11.0.5+10-b520.17 amd64 by JetBrains s.r.o /home/PhpStorm-193.5662.63/jbr Also, a UI exception occurred on an attempt to show the above message: java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129) at java.desktop/javax.swing.RepaintManager.<clinit>(RepaintManager.java:243) at java.desktop/javax.swing.JComponent.repaint(JComponent.java:4835) at java.desktop/java.awt.Component.repaint(Component.java:3412) at java.desktop/javax.swing.text.JTextComponent.setEditable(JTextComponent.java:1818) at java.desktop/javax.swing.text.JTextComponent.<init>(JTextComponent.java:323) at java.desktop/javax.swing.JEditorPane.<init>(JEditorPane.java:198) at java.desktop/javax.swing.JTextPane.<init>(JTextPane.java:87) at com.intellij.idea.Main.showMessage(Main.java:212) at com.intellij.idea.Main.showMessage(Main.java:188) at com.intellij.ide.plugins.StartupAbortedException.processException(StartupAbortedException.java:78) at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:42) at java.base/java.lang.Thread.run(Thread.java:834)
Crash and Go(relians) 怎么实现的
Problem Description The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation. Generally, their space battles are fairly one-sided, but occasionally even the Gorelians get the worst of an encounter. During one such losing battle, the Gorelians’ space ship became so damaged that the Gorelians had to evacuate to the planet below. Because of the chaos (and because escape pods are not very accurate) the Gorelians were scattered across a large area of the planet (yet a small enough area that we can model the relevant planetary surface as planar, not spherical). Your job is to track their efforts to regroup. Fortunately, each escape pod was equipped with a locator that can tell the Gorelian his current coordinates on the planet, as well as with a radio that can be used to communicate with other Gorelians. Unfortunately, the range on the radios is fairly limited according to how much power one has. When a Gorelian lands on the alien planet, the first thing he does is check the radio to see if he can communicate with any other Gorelians. If he can, then he arranges a meeting point with them, and then they converge on that point. Once together, they are able to combine the power sources from their radios, which gives them a larger radio range. They then repeat the process—see who they can reach, arrange a meeting point, combine their radios—until they finally cannot contact any more Gorelians. Gorelian technology allows two-way communication as long as at least one of them has a radio with enough range to cover the distance between them. For example, suppose Alice has a radio with a range of 40 km, and Bob has a range of 30 km, but they are 45 km apart (Figure 1). Since neither has a radio with enough range to reach the other, they cannot talk. However, suppose they were only 35 km apart (Figure 2). Bob’s radio still does not have enough range to reach Alice, but that does not matter—they can still talk because Alice’s radio has enough range to reach Bob. If a Gorelian successfully contacts other Gorelians, they will meet at the point that is the average of all their locations. In the case of Alice and Bob, this would simply be the midpoint of A and B (Figure 3). Note that the Gorelians turn off their radios while traveling; they will not attempt to communicate with anyone else until they have all gathered at the meeting point. Once the Gorelians meet, they combine their radios to make a new radio with a larger range. In particular, the area covered by the new radio is equal to the sum of the areas covered by the old radio. In our example, Alice had a range of 40 km, so her radio covered an area of 1600π km. Bob’s radio covered an area of 900π km. So when they combine their radios they can cover 2500π km—meaning they have a range of 50 km. At this point they will try again to contact other Gorelians. This process continues until no more Gorelians can be contacted. As an example, suppose the following Gorelians have all landed and all have a radio range of 30 km: Alice (100, 100), Bob (130, 80), Cathy (80, 60), and Dave (120, 150). At this point, none of the Gorelians can contact anyone else (Figure 5). Now Eddy lands at position (90, 80) (Figure 6). Eddy can contact Alice and Cathy, so they arrange to meet at (90, 80), which is the average of their locations. Combining their radios gives them a range of √2700 ≈ 51.96 km (Figure 7). Now they check again with their new improved range and find that they can reach Bob. So they meet Bob at (110, 80) and combine their radios to get a new radio with a range of 60 (Figure 8). Unfortunately, this is not far enough to be able to reach Dave, so Dave remains isolated. Input The input will consist of one or more data sets. Each data set will begin with an integer N representing the number of Gorelians for this dataset (1 ≤ N ≤ 100). A value of N = 0 will signify the end of the input. Next will come N lines each containing three integers X, Y, and R representing the x- and y-coordinate where the Gorelian lands and the range of the radio (0 ≤ X ≤ 1000, 0 ≤ Y ≤ 1000, and 1 ≤ R ≤ 1000). Note that only the Gorelians' initial coordinates/range will be integral; after merging with other Gorelians they may no longer be integral. You should use double-precision arithmetic for all computations. The Gorelians land in the order in which they appear in the input file. When a Gorelian lands, he merges with any Gorelians he can contact, and the process keeps repeating until no further merges can be made. The next Gorelian does not land until all previous merges have been completed. Output The output will be one line per data set, reporting the number of independent groups of Gorelians that remain at the end of the process. Sample Input 5 100 100 30 130 80 30 80 60 30 120 150 30 90 80 30 6 100 100 50 145 125 10 60 140 15 160 145 20 130 135 25 80 80 30 0 Sample Output 2 3
急急急!matlab R2010a的启动出现问题
我是matlab新手,安装了matlab R2010a。安装好后启动的主界面出现Attempt to execute SCRIPT pathdef as a function: E:\matlab2010\toolbox\local\pathdef.m Warning: MATLAB did not appear to successfully set the search path. To avoid this warning the next time you start MATLAB, use http://www.mathworks.com/access/helpdesk/help/techdoc/ref/pathdef.shtml to help troubleshoot the "pathdef.m" file. To recover for this session of MATLAB, type "restoredefaultpath;matlabrc". Warning: Duplicate directory name: E:\matlab2010\toolbox\local. Warning: Initializing Handle Graphics failed in matlabrc. This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was: MATLAB:UndefinedFunction Undefined function or method 'colordef' for input arguments of type 'double'. > In matlabrc at 102 Warning: Initializing Java preferences failed in matlabrc. This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was: MATLAB:UndefinedFunction Undefined function or method 'usejava' for input arguments of type 'char'. > In matlabrc at 125 Warning: Failed to add default profiler filters. > In matlabrc at 181 并且我输入指令后报错说Undefined function or method '指令名' for input arguments of type 'char'.如 mbuild -setup ??? Undefined function or method 'mbuild' for input arguments of type 'char'. 怎么解决这一问题
datanode 初始化失败:attempt to
java.io.IOException: BlockPoolSliceStorage.recoverTransitionRead: attempt to load an used block storage:
Android中使用Camera2开发聚焦,前后摄像头切换的拍照功能
使用Camera2开发照相机功能,可以进行重复拍照,刚开始拍照是好的,但是重复拍照的时候就会报错如下,有时候第一次拍照就报错,有时候拍了几十张后报错,报错就是闪退 E/AndroidRuntime: FATAL EXCEPTION: LegacyCameraCallback     Process: com.ajmd.hais.mobile, PID: 24711     java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Surface android.hardware.camera2.params.OutputConfiguration.getSurface()' on a null object reference         at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.onCaptureErrorLocked(CameraDeviceImpl.java:1925)         at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.onDeviceError(CameraDeviceImpl.java:1693)         at android.hardware.camera2.legacy.CameraDeviceUserShim$CameraCallbackThread$CallbackHandler.handleMessage(CameraDeviceUserShim.java:299)         at android.os.Handler.dispatchMessage(Handler.java:102)         at android.os.Looper.loop(Looper.java:154)         at android.os.HandlerThread.run(HandlerThread.java:61)
Android开发时遇到Attempt to invoke virtual method···错误
![图片说明](https://img-ask.csdn.net/upload/201711/30/1512040109_344420.jpg) Android编程出现图示错误,按照网上的一些说法和我出现的问题好像并不相似,TextView是定义了的 ## ## 这是TextView的定义代码 ![图片说明](https://img-ask.csdn.net/upload/201711/30/1512040380_959579.jpg) ## 这是遇到问题的地方,在这里我通过Log日志打印出来的tv就变成了空了 ![图片说明](https://img-ask.csdn.net/upload/201711/30/1512040373_428555.jpg) ## 在初始化时可以更新,也就是可以找到这个TextView的 ![图片说明](https://img-ask.csdn.net/upload/201711/30/1512040365_324985.jpg) Activity是绑定了布局的 ## 希望大神能帮我看看具体是什么问题,感激不尽
动态规划入门到熟悉,看不懂来打我啊
持续更新。。。。。。 2.1斐波那契系列问题 2.2矩阵系列问题 2.3跳跃系列问题 3.1 01背包 3.2 完全背包 3.3多重背包 3.4 一些变形选讲 2.1斐波那契系列问题 在数学上,斐波纳契数列以如下被以递归的方法定义:F(0)=0,F(1)=1, F(n)=F(n-1)+F(n-2)(n&gt;=2,n∈N*)根据定义,前十项为1, 1, 2, 3...
程序员,职场上请远离这种人!
对有些职场人来讲,甩锅就是一种生存手段。01.从大学打篮球说起上大学的时候喜欢打篮球,然后我又特别喜欢抢篮板,经常是跳起来的时候没事,落下来的时候偶尔会踩到别人的脚上,于...
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
对计算机专业来说学历真的重要吗?
我本科学校是渣渣二本,研究生学校是985,现在毕业五年,校招笔试、面试,社招面试参加了两年了,就我个人的经历来说下这个问题。 这篇文章很长,但绝对是精华,相信我,读完以后,你会知道学历不好的解决方案,记得帮我点赞哦。 先说结论,无论赞不赞同,它本质就是这样:对于技术类工作而言,学历五年以内非常重要,但有办法弥补。五年以后,不重要。 目录: 张雪峰讲述的事实 我看到的事实 为什么会这样 ...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch, ...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
一个读研让我损失了一百万的真实故事
关注我!只要10分钟,包你学会数据分析 毕业后,应该就业还是考研? 我刚出国留学那会儿,就惊讶的发现,外国local95%都不会选择读研 他们说,硕士学费很贵,时间宝贵,老板不认,所以很费 当几乎所有人都是本科学历时,硕士学历反而像个异类 在老板眼里,三年硕士远远不如3年的工作经验实用 他们甚至专门为拒绝高学历者发明了一个词,叫overoccupie...
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
shell脚本:备份数据库、代码上线
备份MySQL数据库 场景: 一台MySQL服务器,跑着5个数据库,在没有做主从的情况下,需要对这5个库进行备份 需求: 1)每天备份一次,需要备份所有的库 2)把备份数据存放到/data/backup/下 3)备份文件名称格式示例:dbname-2019-11-23.sql 4)需要对1天以前的所有sql文件压缩,格式为gzip 5)本地数据保留1周 6)需要把备份的数据同步到远程备份中心,假如...
聊聊C语言和指针的本质
坐着绿皮车上海到杭州,24块钱,很宽敞,在火车上非正式地聊几句。 很多编程语言都以 “没有指针” 作为自己的优势来宣传,然而,对于C语言,指针却是与生俱来的。 那么,什么是指针,为什么大家都想避开指针。 很简单, 指针就是地址,当一个地址作为一个变量存在时,它就被叫做指针,该变量的类型,自然就是指针类型。 指针的作用就是,给出一个指针,取出该指针指向地址处的值。为了理解本质,我们从计算机模型说起...
为什么你学不过动态规划?告别动态规划,谈谈我的经验
动态规划难吗?说实话,我觉得很难,特别是对于初学者来说,我当时入门动态规划的时候,是看 0-1 背包问题,当时真的是一脸懵逼。后来,我遇到动态规划的题,看的懂答案,但就是自己不会做,不知道怎么下手。就像做递归的题,看的懂答案,但下不了手,关于递归的,我之前也写过一篇套路的文章,如果对递归不大懂的,强烈建议看一看:为什么你学不会递归,告别递归,谈谈我的经验 对于动态规划,春招秋招时好多题都会用到动态...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
如何安装 IntelliJ IDEA 最新版本——详细教程
IntelliJ IDEA 简称 IDEA,被业界公认为最好的 Java 集成开发工具,尤其在智能代码助手、代码自动提示、代码重构、代码版本管理(Git、SVN、Maven)、单元测试、代码分析等方面有着亮眼的发挥。IDEA 产于捷克,开发人员以严谨著称的东欧程序员为主。IDEA 分为社区版和付费版两个版本。 我呢,一直是 Eclipse 的忠实粉丝,差不多十年的老用户了。很早就接触到了 IDEA...
面试还搞不懂redis,快看看这40道面试题(含答案和思维导图)
Redis 面试题 1、什么是 Redis?. 2、Redis 的数据类型? 3、使用 Redis 有哪些好处? 4、Redis 相比 Memcached 有哪些优势? 5、Memcache 与 Redis 的区别都有哪些? 6、Redis 是单进程单线程的? 7、一个字符串类型的值能存储最大容量是多少? 8、Redis 的持久化机制是什么?各自的优缺点? 9、Redis 常见性...
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
为什么要推荐大家学习字节码?
配套视频: 为什么推荐大家学习Java字节码 https://www.bilibili.com/video/av77600176/ 一、背景 本文主要探讨:为什么要学习 JVM 字节码? 可能很多人会觉得没必要,因为平时开发用不到,而且不学这个也没耽误学习。 但是这里分享一点感悟,即人总是根据自己已经掌握的知识和技能来解决问题的。 这里有个悖论,有时候你觉得有些技术没用恰恰是...
【超详细分析】关于三次握手与四次挥手面试官想考我们什么?
在面试中,三次握手和四次挥手可以说是问的最频繁的一个知识点了,我相信大家也都看过很多关于三次握手与四次挥手的文章,今天的这篇文章,重点是围绕着面试,我们应该掌握哪些比较重要的点,哪些是比较被面试官给问到的,我觉得如果你能把我下面列举的一些点都记住、理解,我想就差不多了。 三次握手 当面试官问你为什么需要有三次握手、三次握手的作用、讲讲三次三次握手的时候,我想很多人会这样回答: 首先很多人会先讲下握...
压测学习总结(1)——高并发性能指标:QPS、TPS、RT、吞吐量详解
一、QPS,每秒查询 QPS:Queries Per Second意思是“每秒查询率”,是一台服务器每秒能够相应的查询次数,是对一个特定的查询服务器在规定时间内所处理流量多少的衡量标准。互联网中,作为域名系统服务器的机器的性能经常用每秒查询率来衡量。 二、TPS,每秒事务 TPS:是TransactionsPerSecond的缩写,也就是事务数/秒。它是软件测试结果的测量单位。一个事务是指一...
新程序员七宗罪
当我发表这篇文章《为什么每个工程师都应该开始考虑开发中的分析和编程技能呢?》时,我从未想到它会对读者产生如此积极的影响。那些想要开始探索编程和数据科学领域的人向我寻求建议;还有一些人问我下一篇文章的发布日期;还有许多人询问如何顺利过渡到这个职业。我非常鼓励大家继续分享我在这个旅程的经验,学习,成功和失败,以帮助尽可能多的人过渡到一个充满无数好处和机会的职业生涯。亲爱的读者,谢谢你。 -罗伯特。 ...
2019年Spring Boot面试都问了什么?快看看这22道面试题!
Spring Boot 面试题 1、什么是 Spring Boot? 2、Spring Boot 有哪些优点? 3、什么是 JavaConfig? 4、如何重新加载 Spring Boot 上的更改,而无需重新启动服务器? 5、Spring Boot 中的监视器是什么? 6、如何在 Spring Boot 中禁用 Actuator 端点安全性? 7、如何在自定义端口上运行 Sprin...
【图解】记一次手撕算法面试:字节跳动的面试官把我四连击了
字节跳动这家公司,应该是所有秋招的公司中,对算法最重视的一个了,每次面试基本都会让你手撕算法,今天这篇文章就记录下当时被问到的几个算法题,并且每个算法题我都详细着给出了最优解,下面再现当时的面试场景。看完一定让你有所收获 一、小牛试刀:有效括号 大部分情况下,面试官都会问一个不怎么难的问题,不过你千万别太开心,因为这道题往往可以拓展出更多有难度的问题,或者一道题看起来很简单,但是给出最优解,确实很...
面试官:关于Java性能优化,你有什么技巧
通过使用一些辅助性工具来找到程序中的瓶颈,然后就可以对瓶颈部分的代码进行优化。 一般有两种方案:即优化代码或更改设计方法。我们一般会选择后者,因为不去调用以下代码要比调用一些优化的代码更能提高程序的性能。而一个设计良好的程序能够精简代码,从而提高性能。 下面将提供一些在JAVA程序的设计和编码中,为了能够提高JAVA程序的性能,而经常采用的一些方法和技巧。 1.对象的生成和大小的调整。 J...
【图解算法面试】记一次面试:说说游戏中的敏感词过滤是如何实现的?
版权声明:本文为苦逼的码农原创。未经同意禁止任何形式转载,特别是那些复制粘贴到别的平台的,否则,必定追究。欢迎大家多多转发,谢谢。 小秋今天去面试了,面试官问了一个与敏感词过滤算法相关的问题,然而小秋对敏感词过滤算法一点也没听说过。于是,有了下下事情的发生… 面试官开怼 面试官:玩过王者荣耀吧?了解过敏感词过滤吗?,例如在游戏里,如果我们发送“你在干嘛?麻痹演员啊你?”,由于“麻痹”是一个敏感词,...
GitHub 标星 1.6w+,我发现了一个宝藏项目,作为编程新手有福了!
大家好,我是 Rocky0429,一个最近老在 GitHub 上闲逛的蒟蒻… 特别惭愧的是,虽然我很早就知道 GitHub,但是学会逛 GitHub 的时间特别晚。当时一方面是因为菜,看着这种全是英文的东西难受,不知道该怎么去玩,另一方面是一直在搞 ACM,没有做一些工程类的项目,所以想当然的以为和 GitHub 也没什么关系(当然这种想法是错误的)。 后来自己花了一个星期看完了 Pyt...
杭漂程序员2019的心路历程,还不起助学贷款,交不起房租,披荆斩棘终雨过天晴
一个杭漂2019的心酸历程,一路披荆斩棘终于还是雨过天晴。
我采访了同事,让他掏出了每天都会浏览的干货网站
前言只有光头才能变强。文本已收录至我的GitHub精选文章,欢迎Star:https://github.com/ZhongFuCheng3y/3y在周六的晚上,我日常去到公司写文章。想写...
相关热词 c# 时间比天数 c# oracle查询 c# 主动推送 事件 c# java 属性 c# 控制台 窗体 c# 静态类存值 c#矢量作图 c#窗体调用外部程式 c# enum是否合法 c# 如何卸载引用
立即提问