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问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
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
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
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
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.
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
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)
Carrying Out A Task
Problem Description During the process of the military exercise, there is a ship on the sea level .The ship will go to certain place to carry out a task. For every action, the ship has two ways to sail. They are normal sailing and accelerated sailing. The normal speed of the ship is certain, when the ship sails normally, it can only move 1 step to the adjacent normal sea level. The ship can also accelerate. There are 2 kinds of accelerated sailings, one is moving forward d steps (d <= 5) in a straight line, and it must move forward d steps exactly every time it accelerates, The d steps must be on the normal sea level, otherwise, it can not accelerate. The other is accelerating while getting through the undercurrent. There are a lot of undercurrents on the sea, and entering the undercurrent area needs to accelerate when the ship is 1 step to the undercurrent. However, the ship itself will be damaged more or less by the undercurrent, After entering the undercurrent, the speed of the ship will become normal immediately. Every time it accelerates, the ship has to consume a certain B energy, and when it starts up ,it carries certain B energy. While the ship is sailing on the sea, it needs to consume a certain A energy. One unit of distance will consume one unit of A energy, and when the ship starts up, it carries enough A energy. There are many reefs on the sea, and the ship can not get through. Now the ship is required to sail to the certain place, of course, to minimize the damage to the ship itself is a priority because the cost of ships is very expensive. The damage is, of course, the smaller, the better. At the same time, an attempt should be made to control the consumption of A energy to the smallest amount during the whole process because the cost of A energy is much more expensive than that of B energy, and you can use B energy which the ship carried when it started up as you wish. Now the question is to work out the minimal times of action from the departure point to the destination under the condition that to minimize the damage to the ship is a priority and then the consumption of A energy to the smallest degree. Input The input file contains several test cases, the first line contains an integer T, indicates the number of test cases. In each case the first line includes two integers n, m (5 <= n, m <= 20), which indicate the size of the sea level for military exercises, and n rows and m columns are the current state of the sea level ('S' indicates the ship's initial position, 'E' indicates the destination place, '#' indicates the reefs, '*' indicates the undercurrent , ' ' the normal sea level), followed a line with a number d in it, it indicates the distance of the first kind of acceleration, then another line includes two integers, indicate that the initial value of the B energy and the value of the B energy needed while accelerating every time. Output Output an integer to indicate the smallest times of action, and if can not reach the task place, then output "can not reach!" Sample Input 2 5 10 ########## #E # #*###### # #S # ########## 5 10 2 6 10 ########## #E # #*######*# #*######*# #S # ########## 5 3 2 Sample Output 8 can not reach!
请问下各位大佬们,我在用ksoap2-Android调用web service服务时出现了stream closed的报错
小弟仿照网上的一个例子想用web service服务写一个查询天气的安卓应用。 但是在该服务的第三个方法时出现了stream closed的错误,百度没有找到结果, 麻烦各位大神帮我看下,以下是我的代码,在根据城市获取城市具体天气情况这个 方法时报了错 提供服务的URL是http://ws.webxml.com.cn/WebServices/WeatherWS.asmx ``` public class WebServicerUtil { // 定义Web Service的命名空间 static final String SERVICE_NS = "http://WebXml.com.cn/"; // 定义Web Service提供服务的URL static final String SERVICE_URL = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx"; // 调用远程 Web Service获取省份列表 public static List<String> getProvinceList() { /** * 调用远程Web Service的getRegionProvince方法: 获得中国省份、直辖市、地区和与之对应的ID * <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>黑龙江,3113</string> <string>吉林,3114</string> <string>辽宁,3115</string> <string>内蒙古,3116</string> <string>河北,3117</string> <string>河南,3118</string> <string>山东,3119</string> <string>山西,31110</string> <string>江苏,31111</string> <string>安徽,31112</string> <string>陕西,31113</string> <string>宁夏,31114</string> <string>甘肃,31115</string> <string>青海,31116</string> <string>湖北,31117</string> <string>湖南,31118</string> <string>浙江,31119</string> <string>江西,31120</string> <string>福建,31121</string> <string>贵州,31122</string> <string>四川,31123</string> <string>广东,31124</string> <string>广西,31125</string> <string>云南,31126</string> <string>海南,31127</string> <string>新疆,31128</string> <string>西藏,31129</string> <string>台湾,31130</string> <string>北京,311101</string> <string>上海,311102</string> <string>天津,311103</string> <string>重庆,311104</string> <string>香港,311201</string> <string>澳门,311202</string> <string>钓鱼岛,311203</string> </ArrayOfString> */ String methodName = "getRegionProvince"; //获得中国省份、直辖市、地区和与之对应的ID // 创建HttpTransportSE传输对象,该对象用于调用Web Service操作 HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; // 使用SOAP1.1协议创建Envelop对象 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); // 实例化SoapObject对象,传入所要调用的Web Service的命名空间,Web Service方法名 SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); //将 soapObject对象设置为SoapSerializationEnvelope对象的传出SOAP消息 envelope.bodyOut = soapObject; /** * 因为什么这个网站是通过.NET对外提供Web Service的, * 因此设置与.Net提供的Web Service保持较好的兼容性 */ envelope.dotNet = true; try { // 调用Web Service ht.call(SERVICE_NS + methodName, envelope); if (envelope.getResponse() != null) { // 获取服务器响应返回的SOAP消息 SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); // 解析服务器响应的SOAP消息。 return parseProvinceOrCity(detail); } } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } // 根据省份获取城市列表 public static List<String> getCityListByProvince(String province) { /** * 调用的方法 * 获得支持的城市/地区名称和与之对应的ID 输入参数:theRegionCode = 省市、国家ID或名称,返回数据:一维字符串数组。 如:输入北京的theRegionCode:311101得到的返回结果为: <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>北京,792</string> <string>昌平,785</string> <string>大兴,826</string> <string>房山,827</string> <string>怀柔,752</string> <string>门头沟,788</string> <string>密云,751</string> <string>平谷,756</string> <string>顺义,741</string> <string>通州,3409</string> <string>延庆,746</string> <string>海淀,742</string> <string>朝阳,3408</string> <string>丰台,795</string> <string>石景山,794</string> </ArrayOfString> */ String methodName = "getSupportCityString"; // 创建HttpTransportSE传输对象 HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; // 实例化SoapObject对象 SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); // 添加一个请求参数 soapObject.addProperty("theRegionCode", province); // 使用SOAP1.1协议创建Envelop对象 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.bodyOut = soapObject; // 设置与.Net提供的Web Service保持较好的兼容性 envelope.dotNet = true; try { // 调用Web Service ht.call(SERVICE_NS + methodName, envelope); if (envelope.getResponse() != null) { // 获取服务器响应返回的SOAP消息 SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); // 解析服务器响应的SOAP消息。 return parseProvinceOrCity(detail); } } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } // 解析服务器响应的SOAP消息。 private static List<String> parseProvinceOrCity(SoapObject detail) { List<String> result = new ArrayList<String>(); for (int i = 0; i < detail.getPropertyCount(); i++) { // 解析出每个省份 result.add(detail.getProperty(i).toString().split(",")[0]); } return result; } // 根据城市获取城市具体天气情况 public static SoapObject getWeatherByCity(String cityName) { String methodName = "getWeather"; HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); soapObject.addProperty("theCityCode", cityName); envelope.bodyOut = soapObject; // 设置与.Net提供的Web Service保持较好的兼容性 envelope.dotNet = true; try { ht.call(SERVICE_NS + methodName, envelope); SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); return detail; } catch (Exception e) { e.printStackTrace(); } return null; } } ``` 下边是报错内容 ``` 2019-12-22 15:35:47.617 29228-29259/? W/System.err: java.io.IOException: Stream closed 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:151) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:334) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.readDebug(HttpTransportSE.java:299) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:261) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.WebServicerUtil.getWeatherByCity(WebServicerUtil.java:205) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather.showWeather(MyWeather.java:147) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather.access$200(MyWeather.java:21) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather$3$1.run(MyWeather.java:125) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at java.lang.Thread.run(Thread.java:761) 2019-12-22 15:35:47.619 29228-29259/? E/AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: com.example.weather, PID: 29228 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object org.ksoap2.serialization.SoapObject.getProperty(int)' on a null object reference at com.example.weather.MyWeather.showWeather(MyWeather.java:150) at com.example.weather.MyWeather.access$200(MyWeather.java:21) at com.example.weather.MyWeather$3$1.run(MyWeather.java:125) at java.lang.Thread.run(Thread.java:761) 2019-12-22 15:35:47.684 29228-29251/? D/EGL_emulation: eglMakeCurrent: 0xa26a6a60: ver 3 0 (tinfo 0xa461a8d0) ```
java tomcat dubbo服务关闭失败
25-Dec-2019 13:10:35.326 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance. 25-Dec-2019 13:10:35.328 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8050"] 25-Dec-2019 13:10:35.332 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8059"] 25-Dec-2019 13:10:35.333 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina] 25-Dec-2019 13:10:35.384 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [DubboRegistryFailedRetryTimer-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 25-Dec-2019 13:10:45.373 INFO [localhost-startStop-1-SendThread(172.30.1.172:2181)] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.core.status.WarnStatus]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.core.status.WarnStatus]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1328) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1316) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1175) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1136) at ch.qos.logback.classic.LoggerContext.noAppenderDefinedWarning(LoggerContext.java:186) at ch.qos.logback.classic.Logger.callAppenders(Logger.java:264) at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421) at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383) at ch.qos.logback.classic.Logger.debug(Logger.java:482) at org.apache.zookeeper.ClientCnxn$SendThread.readResponse(ClientCnxn.java:742) at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:94) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) 25-Dec-2019 13:10:45.377 INFO [localhost-startStop-1-SendThread(172.30.1.172:2181)] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.classic.spi.ThrowableProxy]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.classic.spi.ThrowableProxy]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1328) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1316) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1175) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1136) at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119) at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419) at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383) at ch.qos.logback.classic.Logger.warn(Logger.java:692) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1162)
Roll-call in Woop Woop High
Problem Description The new principal of Woop Woop High is not satisfied with her pupils performance.She introduced a new roll-call process to get a daily measure of the pupils' learning, which proceeds as follows:At the beginning of the daily roll-call period each pupil is handed a question, which they must attempt to answer, before proceeding to their classes. A pupil stops after the question is answered correctly. Each pupil is allowed up to five attempts to answer the question correctly. Pupils who answer correctly on the first attempt are marked present. Pupils who answer correctly after more than one attempt are encouraged to work at home. Pupils who fail to develop a correct answer within five attempts are given remedial classes after school. Pupils who do not give any answer are marked as abscent. Your task is to write a program that reads the pupils' assessments and generates performance reports for the principal to proceed with appropriate actions. Input The input starts with an integer K (1 <= K <= 100) indicating the number of classes. Each class starts with an integer N (1 <= N <= 50) indicating the number of pupils in the class. Each of the following N lines starts with a pupil's name followed by up-to five assessments of his/her answers. An assessment of 'yes' or 'y' indicates a correct answer and an assessment of 'n' or 'no' indicates a wrong answer. A pupil's name consists of a single string with no white spaces. Output The attendance report for each class consists of five lines. The first line consists of the sentence: "Roll-call: X", where X indicates the class number starting with the value of one. The second line consists of the sentence: ''Present: Y1 out of N'', where Y1 is the number of pupils who did not submit a wrong answer. The third line consists of the sentence: ''Needs to study at home: Y2 out of N'', where Y2 is the number of pupils who submitted a number of wrong answers before submitting the correct answer. The fourth line consists of the sentence: ''Needs remedial work after school: Y3 out of N'', where Y3 indicates the number of pupils whose submitted five wrong answers. The fifth line consists of the sentence: ''Absent: Y4 out of N'', where Y4 indicates the number of absent pupils. Sample Input 2 5 Doc n y sneezy n n no yes princecharming no n no no n goofy yes grumpy n y 5 evilemperor n y princesslia r2d2 no no y obeyonecanopy n no y darthvedar y Sample Output Roll-call: 1 Present: 1 out of 5 Needs to study at home: 3 out of 5 Needs remedial work after school: 1 out of 5 Absent: 0 out of 5 Roll-call: 2 Present: 1 out of 5 Needs to study at home: 3 out of 5 Needs remedial work after school: 0 out of 5 Absent: 1 out of 5
急急急!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'. 怎么解决这一问题
Crazy Basketball Fan 具体的实现
Problem Description Alex is a big fan of basketball and he enjoys watching NBA matches. But as he always has classes in the morning when the game is on, he has to read literal living broadcast with his cellphone instead of TV live. The living broadcast gives messages about who scores or who gets the rebound, etc. After watching a few games with his cellphone, Alex finds a problem. After each game, he wants to know the status of the players (score, rebound…) but the system always fails to give. So Alex decides to calculate himself. Can you help him? If one of your teammates is a crazy basketball fan, you should make him solve this problem because he will find it interesting while working on this problem. Input The first line of input contains an integer t (t<=10) indicate the number of cases. In each case, the first line contains the names of the two teams in the form of "A vs B", where A stands for the name of home team and B stands for the name of away team. The following 12 lines contain the name of the players play for the home team and another 12 lines contain the name of the players play for the away team. The first five players of each team will be the starters meaning they are on court when the game starts. All the names only contain letters from 'a' to 'z' and 'A' to 'Z' and ''' without space and the length of each name is no more than 20. All the players' names in one case will be different. Then a line contains an integer n (2<=n<=500) indicates the number of the messages given by the broadcast. The next n lines contain the messages, one message per line. The first line will always contain "Begin" and the last line will always contain "End". The game won't end during a shot or free throw, but may end at any other time. A message in other lines may be one of the following (x, x1 and x2 stand for players from the teams, m and M stand for numbers): Jump Ball x1 vs x2: this message will only be given on the second line right after "Begin". This means two players from different teams are jumping for the ball. This message will always be followed by "x Hold Ball" and x could be anyone. x Hold Ball: this message will be given if the ball is currently in no one's hand, which means: after jump ball or after a shot was made (including the last free throw) or after a shot was blocked or after timeout. x1 Pass to x2: this means the ball is passed from x1 to x2. x1 is deferent from x2 and they are from the same team. Layup/Slam Dunk/Hook Shot/Jump Shot/3pt Shot: the first four messages stand for an attempt for 2-point shot while the last message stand for an attempt for 3-point shot. These messages will only be given when someone is currently holding the ball. These messages may be followed by "Made"/"Missed"/"Blocked by x"/"x Foul". Made/Missed: If a shot was made and scored, "Made" will be given, otherwise "Missed". These two messages will be given right after a shot was attempted if the shot was not fouled or blocked. If the shot was fouled, these two messages will still be given right after "x Foul" to indicate whether the shot was made even with the foul. But if a shot was blocked, these messages will not be given since the shot is definitely missed. x Rebound: If a shot was missed, this message will be given to indicate who get the rebound (could be anyone from both teams). If someone gets the rebound, he holds the ball. Blocked by x: If a shot is blocked, this message will be given right after the message which indicates the shot. This message will always be followed by "x Hold Ball" and x could be anyone. A shot will only be blocked by a player from the opposite team with the shooter. x Foul: this message will be given when a player commit a foul to another player from the opposite team. There are two kind of foul. If this message is given right after the shot attempt, then this foul will lead to free throws. Otherwise this message will be followed by "x Hold Ball". Free Throw m of M: If a shot is fouled, the shooter will make free throws. If the fouled shot is made, then the shooter will only make one free throw. If it's missed and it's a 2-point shot, the shooter will make two free throws. If it's missed and it's a 3-point shot, the shooter will make three free throws. Each made free throw earns one point. In this message, m indicates the number of this free throw (start from 1) and M indicates the number of total free throws this player is going to attempt. Both m and M will be no bigger than 3 and m is no bigger than M. After each free throw there will be a message says "Made" or "Missed" to indicate whether the free throw is made or missed. If the last free throw is missed, just like normal shot, someone will get the rebound and if it's made, a player from the opposite team will hold the ball. No block could be made during the free throws. x Steal: If a player is now holding the ball, a player from the opposite team could steal the ball away. If someone steals the ball, he will hold it. x1 Substitution replaced by x2: this message means x1 is off court and replaced by x2. x1 and x2 are from the same team. This could only happen during timeout or before free throw or after a foul which doesn't lead to free throw. The player who is going to make a free throw won't be replaced. Before free throw means before any "Free Throw m of M" despite of m and M. Timeout: timeout could be called when someone is holding the ball. During timeout, substitution could be made. Timeout is ended with the message "x Hold Ball". It is guaranteed that all the messages are valid and follow the rules. The names of the players will not be the same with words like "rebound" and "block", etc. Actually all the names will be familiar to you if you watch NBA a lot. Output The first output line for each case will be "x1 n1-n2 x2", where x1 and x2 stand for the name of home team and away team and n1 and n2 stand for their total points. Then for each player from each team, calculate the number of his points, rebounds (including offensive and defensive), assists, steals, blocks and fouls. An assist is made when player x1 passes to player x2 and x2 makes a shot (2-pt or 3-pt) and then x1 gets the assist. A rebound is an offensive rebound when the shoot and the player who gets the rebound are from the same team (even the same player); otherwise it's a defensive rebound. Also you have to calculate the number of a player's made field goals (including 2-pt and 3-pt), attempted field goals (including 2-pt and 3-pt), made 3-pt shots, attempted 3-pt shots, made free throws and attempted free throws. Notice: if a shot is fouled and it's missed, it won't be counted as an attempt, but if it's fouled and made, it will be counted as an attempt and a made. The output form is shown in the sample output (PTS - points, OFF - offensive rebound, DEF - defensive rebound, REB - total rebound, AST - assist, STL - steal, BLK - block, PF - personal foul, FGM-A - field goal made and attempted, 3PM-A - 3-pt made and attempted, FTM-A - free throw made and attempted). There are 14 spaces before the word "PLAYER" and exact one space between each column. All the names and numbers are under their column and right alignment. The order of the players is the same with input. Home team first, then comes the away team. If a player didn't play at all (never on court), then you should print "DNP - Coach's Decision" 10 spaces after their names. Print a single line after each case. Sample Input 1 Lakers vs Celtics DerekFisher KobeBryant RonArtest PauGasol AndrewBynum LamarOdom MattBarnes SteveBlake ShannonBrown LukeWalton DerrickCaracter DevinEbanks RajonRondo RayAllen PaulPierce KevinGarnett ShaquilleO'Neal JeffGreen VonWafer GlenDavis JermaineO'Neal TroyMurphy NenadKrstic CarlosArroyo 17 Begin Jump Ball KevinGarnett vs PauGasol KobeBryant Hold Ball KobeBryant Pass to PauGasol Slam Dunk Made RajonRondo Hold Ball RajonRondo Pass to PaulPierce Jump Shot RonArtest Foul Missed Free Throw 1 of 2 Made Free Throw 2 of 2 Missed PauGasol Rebound End Sample Output Lakers 2-1 Celtics Lakers PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A DerekFisher 0 0 0 0 0 0 0 0 0-0 0-0 0-0 KobeBryant 0 0 0 0 1 0 0 0 0-0 0-0 0-0 RonArtest 0 0 0 0 0 0 0 1 0-0 0-0 0-0 PauGasol 2 0 1 1 0 0 0 0 1-1 0-0 0-0 AndrewBynum 0 0 0 0 0 0 0 0 0-0 0-0 0-0 LamarOdom DNP - Coach's Decision MattBarnes DNP - Coach's Decision SteveBlake DNP - Coach's Decision ShannonBrown DNP - Coach's Decision LukeWalton DNP - Coach's Decision DerrickCaracter DNP - Coach's Decision DevinEbanks DNP - Coach's Decision Celtics PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A RajonRondo 0 0 0 0 0 0 0 0 0-0 0-0 0-0 RayAllen 0 0 0 0 0 0 0 0 0-0 0-0 0-0 PaulPierce 1 0 0 0 0 0 0 0 0-0 0-0 1-2 KevinGarnett 0 0 0 0 0 0 0 0 0-0 0-0 0-0 ShaquilleO'Neal 0 0 0 0 0 0 0 0 0-0 0-0 0-0 JeffGreen DNP - Coach's Decision VonWafer DNP - Coach's Decision GlenDavis DNP - Coach's Decision JermaineO'Neal DNP - Coach's Decision TroyMurphy DNP - Coach's Decision NenadKrstic DNP - Coach's Decision CarlosArroyo DNP - Coach's Decision
hive启动之后,查询语句执行特别慢,之后发现日志中zookeeper报错
hive启动之后,输入查询语句如:show databases; 执行特别慢,之后发现日志中zookeeper报错: ``` 2019-12-30T09:51:20,816 INFO [151e439b-e32e-47fb-9535-baa6b617f672 main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 2019-12-30T09:51:20,817 WARN [151e439b-e32e-47fb-9535-baa6b617f672 main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_231] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[?:1.8.0_231] at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) ~[zookeeper-3.4.6.jar:3.4.6-1569965] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) ~[zookeeper-3.4.6.jar:3.4.6-1569965] ``` 求帮助!
Crazy Basketball Fan 问题
Problem Description Alex is a big fan of basketball and he enjoys watching NBA matches. But as he always has classes in the morning when the game is on, he has to read literal living broadcast with his cellphone instead of TV live. The living broadcast gives messages about who scores or who gets the rebound, etc. After watching a few games with his cellphone, Alex finds a problem. After each game, he wants to know the status of the players (score, rebound…) but the system always fails to give. So Alex decides to calculate himself. Can you help him? If one of your teammates is a crazy basketball fan, you should make him solve this problem because he will find it interesting while working on this problem. Input The first line of input contains an integer t (t<=10) indicate the number of cases. In each case, the first line contains the names of the two teams in the form of "A vs B", where A stands for the name of home team and B stands for the name of away team. The following 12 lines contain the name of the players play for the home team and another 12 lines contain the name of the players play for the away team. The first five players of each team will be the starters meaning they are on court when the game starts. All the names only contain letters from 'a' to 'z' and 'A' to 'Z' and ''' without space and the length of each name is no more than 20. All the players' names in one case will be different. Then a line contains an integer n (2<=n<=500) indicates the number of the messages given by the broadcast. The next n lines contain the messages, one message per line. The first line will always contain "Begin" and the last line will always contain "End". The game won't end during a shot or free throw, but may end at any other time. A message in other lines may be one of the following (x, x1 and x2 stand for players from the teams, m and M stand for numbers): Jump Ball x1 vs x2: this message will only be given on the second line right after "Begin". This means two players from different teams are jumping for the ball. This message will always be followed by "x Hold Ball" and x could be anyone. x Hold Ball: this message will be given if the ball is currently in no one's hand, which means: after jump ball or after a shot was made (including the last free throw) or after a shot was blocked or after timeout. x1 Pass to x2: this means the ball is passed from x1 to x2. x1 is deferent from x2 and they are from the same team. Layup/Slam Dunk/Hook Shot/Jump Shot/3pt Shot: the first four messages stand for an attempt for 2-point shot while the last message stand for an attempt for 3-point shot. These messages will only be given when someone is currently holding the ball. These messages may be followed by "Made"/"Missed"/"Blocked by x"/"x Foul". Made/Missed: If a shot was made and scored, "Made" will be given, otherwise "Missed". These two messages will be given right after a shot was attempted if the shot was not fouled or blocked. If the shot was fouled, these two messages will still be given right after "x Foul" to indicate whether the shot was made even with the foul. But if a shot was blocked, these messages will not be given since the shot is definitely missed. x Rebound: If a shot was missed, this message will be given to indicate who get the rebound (could be anyone from both teams). If someone gets the rebound, he holds the ball. Blocked by x: If a shot is blocked, this message will be given right after the message which indicates the shot. This message will always be followed by "x Hold Ball" and x could be anyone. A shot will only be blocked by a player from the opposite team with the shooter. x Foul: this message will be given when a player commit a foul to another player from the opposite team. There are two kind of foul. If this message is given right after the shot attempt, then this foul will lead to free throws. Otherwise this message will be followed by "x Hold Ball". Free Throw m of M: If a shot is fouled, the shooter will make free throws. If the fouled shot is made, then the shooter will only make one free throw. If it's missed and it's a 2-point shot, the shooter will make two free throws. If it's missed and it's a 3-point shot, the shooter will make three free throws. Each made free throw earns one point. In this message, m indicates the number of this free throw (start from 1) and M indicates the number of total free throws this player is going to attempt. Both m and M will be no bigger than 3 and m is no bigger than M. After each free throw there will be a message says "Made" or "Missed" to indicate whether the free throw is made or missed. If the last free throw is missed, just like normal shot, someone will get the rebound and if it's made, a player from the opposite team will hold the ball. No block could be made during the free throws. x Steal: If a player is now holding the ball, a player from the opposite team could steal the ball away. If someone steals the ball, he will hold it. x1 Substitution replaced by x2: this message means x1 is off court and replaced by x2. x1 and x2 are from the same team. This could only happen during timeout or before free throw or after a foul which doesn't lead to free throw. The player who is going to make a free throw won't be replaced. Before free throw means before any "Free Throw m of M" despite of m and M. Timeout: timeout could be called when someone is holding the ball. During timeout, substitution could be made. Timeout is ended with the message "x Hold Ball". It is guaranteed that all the messages are valid and follow the rules. The names of the players will not be the same with words like "rebound" and "block", etc. Actually all the names will be familiar to you if you watch NBA a lot. Output The first output line for each case will be "x1 n1-n2 x2", where x1 and x2 stand for the name of home team and away team and n1 and n2 stand for their total points. Then for each player from each team, calculate the number of his points, rebounds (including offensive and defensive), assists, steals, blocks and fouls. An assist is made when player x1 passes to player x2 and x2 makes a shot (2-pt or 3-pt) and then x1 gets the assist. A rebound is an offensive rebound when the shoot and the player who gets the rebound are from the same team (even the same player); otherwise it's a defensive rebound. Also you have to calculate the number of a player's made field goals (including 2-pt and 3-pt), attempted field goals (including 2-pt and 3-pt), made 3-pt shots, attempted 3-pt shots, made free throws and attempted free throws. Notice: if a shot is fouled and it's missed, it won't be counted as an attempt, but if it's fouled and made, it will be counted as an attempt and a made. The output form is shown in the sample output (PTS - points, OFF - offensive rebound, DEF - defensive rebound, REB - total rebound, AST - assist, STL - steal, BLK - block, PF - personal foul, FGM-A - field goal made and attempted, 3PM-A - 3-pt made and attempted, FTM-A - free throw made and attempted). There are 14 spaces before the word "PLAYER" and exact one space between each column. All the names and numbers are under their column and right alignment. The order of the players is the same with input. Home team first, then comes the away team. If a player didn't play at all (never on court), then you should print "DNP - Coach's Decision" 10 spaces after their names. Print a single line after each case. Sample Input 1 Lakers vs Celtics DerekFisher KobeBryant RonArtest PauGasol AndrewBynum LamarOdom MattBarnes SteveBlake ShannonBrown LukeWalton DerrickCaracter DevinEbanks RajonRondo RayAllen PaulPierce KevinGarnett ShaquilleO'Neal JeffGreen VonWafer GlenDavis JermaineO'Neal TroyMurphy NenadKrstic CarlosArroyo 17 Begin Jump Ball KevinGarnett vs PauGasol KobeBryant Hold Ball KobeBryant Pass to PauGasol Slam Dunk Made RajonRondo Hold Ball RajonRondo Pass to PaulPierce Jump Shot RonArtest Foul Missed Free Throw 1 of 2 Made Free Throw 2 of 2 Missed PauGasol Rebound End Sample Output Lakers 2-1 Celtics Lakers PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A DerekFisher 0 0 0 0 0 0 0 0 0-0 0-0 0-0 KobeBryant 0 0 0 0 1 0 0 0 0-0 0-0 0-0 RonArtest 0 0 0 0 0 0 0 1 0-0 0-0 0-0 PauGasol 2 0 1 1 0 0 0 0 1-1 0-0 0-0 AndrewBynum 0 0 0 0 0 0 0 0 0-0 0-0 0-0 LamarOdom DNP - Coach's Decision MattBarnes DNP - Coach's Decision SteveBlake DNP - Coach's Decision ShannonBrown DNP - Coach's Decision LukeWalton DNP - Coach's Decision DerrickCaracter DNP - Coach's Decision DevinEbanks DNP - Coach's Decision Celtics PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A RajonRondo 0 0 0 0 0 0 0 0 0-0 0-0 0-0 RayAllen 0 0 0 0 0 0 0 0 0-0 0-0 0-0 PaulPierce 1 0 0 0 0 0 0 0 0-0 0-0 1-2 KevinGarnett 0 0 0 0 0 0 0 0 0-0 0-0 0-0 ShaquilleO'Neal 0 0 0 0 0 0 0 0 0-0 0-0 0-0 JeffGreen DNP - Coach's Decision VonWafer DNP - Coach's Decision GlenDavis DNP - Coach's Decision JermaineO'Neal DNP - Coach's Decision TroyMurphy DNP - Coach's Decision NenadKrstic DNP - Coach's Decision CarlosArroyo DNP - Coach's Decision
130 个相见恨晚的超实用网站,一次性分享出来
相见恨晚的超实用网站 持续更新中。。。
字节跳动视频编解码面经
三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时想着能进去就不错了,管他哪个岗呢,就同意了面试...
win10系统安装教程(U盘PE+UEFI安装)
一、准备工作 u盘,电脑一台,win10原版镜像(msdn官网) 二、下载wepe工具箱 极力推荐微pe(微pe官方下载) 下载64位的win10 pe,使用工具箱制作启动U盘打开软件, 选择安装到U盘(按照操作无需更改) 三、重启进入pe系统 1、关机后,将U盘插入电脑 2、按下电源后,按住F12进入启动项选择(技嘉主板是F12) 选择需要启...
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch, ...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Java描述设计模式(19):模板方法模式
本文源码:GitHub·点这里 || GitEE·点这里 一、生活场景 通常一款互联网应用的开发流程如下:业务需求,规划产品,程序开发,测试交付。现在基于模板方法模式进行该过程描述。 public class C01_InScene { public static void main(String[] args) { DevelopApp developApp = n...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n...
第三个java程序(表白小卡片)
前言: &nbsp;向女神表白啦,作为一个程序员,当然也有爱情啦。只不过,虽然前面两个程序都只是学习了基础的语法结构和向量哈希表。这里涉及的是Swing,awt图形用户界面和一点文件输入输出流的知识。 &nbsp; 表白代码如下: 另附:里面的音乐和图片可以放在一个自己创建的包里面,也可以放在src里面,或者使用绝对路径。至于布局,我自己的使用的是简单的排班,简单的继承。后面的程序会慢慢实现。 ...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的回答,对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalking,作者吴晟、刘浩杨 等等 仓库地址: apache/skywalking 更...
化繁为简 - 腾讯计费高一致TDXA的实践之路
导语:腾讯计费是孵化于支撑腾讯内部业务千亿级营收的互联网计费平台,在如此庞大的业务体量下,腾讯计费要支撑业务的快速增长,同时还要保证每笔交易不错账。采用最终一致性或离线补...
Linux网络服务-----实验---PXE和Kickstart的无人值守装机
目录 一.PXE的原理 二.kickstart的原理 三.PXE与kickstart的结合使用自动装机 一.PXE的原理 PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由支持通过网络启动操作系统,再启动过程中,终端要求服务器分配IP地址...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
A*搜索算法概述
编者按:本文作者奇舞团前端开发工程师魏川凯。A*搜索算法(A-star search algorithm)是一种常见且应用广泛的图搜索和寻径算法。A*搜索算法是通过使用启...
程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
从顶级黑客到上市公司老板
一看标题,很多老读者就知道我在写什么了。今天Ucloud成功上市,季昕华成为我所熟悉的朋友里又双叒叕一个成功上市的案例。我们认识大概是十五年多吧,如果没记错,第一次见面应该是2004年,...
蓝桥杯知识点汇总:基础知识和常用算法
文章目录基础语法部分:算法竞赛常用API:算法部分数据结构部分 此系列包含蓝桥杯绝大部分所考察的知识点,以及真题题解~ 基础语法部分: 备战蓝桥杯java(一):一般输入输出 和 快速输入输(BufferedReader&amp;BufferedWrite) 备战蓝桥杯java(二):java编程规范和常用数据类型 备战蓝桥杯java(三):常用功能符以及循环结构和分支结构 备战蓝桥杯java(四...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
强烈推荐10本程序员在家读的书
很遗憾,这个春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终将会...
Linux自学篇——linux命令英文全称及解释
man: Manual 意思是手册,可以用这个命令查询其他命令的用法。 pwd:Print working directory 意思是密码。 su:Swith user 切换用户,切换到root用户 cd:Change directory 切换目录 ls:List files 列出目录下的文件 ps:Process Status 进程状态 mkdir:Make directory ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
疫情数据接口api
返回json示例 { "errcode":0,//0标识接口正常 "data":{ "date":"2020-01-30 07:47:23",//实时更新时间 "diagnosed":7736,//确诊人数 "suspect":12167,//疑是病例人数 "death":170,//死亡人数 "cur...
智力题(程序员面试经典)
NO.1  有20瓶药丸,其中19瓶装有1克/粒的药丸,余下一瓶装有1.1克/粒的药丸。给你一台称重精准的天平,怎么找出比较重的那瓶药丸?天平只能用一次。 解法 有时候,严格的限制条件有可能反倒是解题的线索。在这个问题中,限制条件是天平只能用一次。 因为天平只能用一次,我们也得以知道一个有趣的事实:一次必须同时称很多药丸,其实更准确地说,是必须从19瓶拿出药丸进行称重。否则,如果跳过两瓶或更多瓶药...
相关热词 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数 c#日期精确到分钟 c#自定义异常必须继承 c#查表并返回值 c# 动态 表达式树 c# 监控方法耗时 c# listbox c#chart显示滚动条
立即提问