利用expect一键部署javaweb项目 81C

启动shell脚本,一键发布项目到30台linux服务器中,每台服务器发布项目的时候互不影响,先关闭tomcat,然后将war包拷贝到webapps下,然后启动tomcat,这个过程利用expect实现,然后取ip,同时部署

2个回答

建议使用ansible~~~~~~~~简单粗暴 写成一个python脚本 利用多线程

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
利用Linux的shell脚本sshWindows执行命令不成功
写了一个自动备份数据库的脚本,但每天查看结果都比较麻烦,就想写一个自动提示的脚本,而且是从虚机的linux直接发送提示到物理机的Windows,利用msg弹窗,具体脚本如下: ``` #!/usr/bin/expect set timeout 30 set host "192.168.104.223" set username "administrator" set password "123" spawn ssh $username@$host expect "*password*" {send "$password\r"} expect "*Administrator*" {send "cmd\r"} expect "*Administrator*" {send "msg /server:$host * 已完成昨日MySQL数据库备份\r"} expect "*Administrator*" {send "exit\r"} expect "*Administrator*" {send "exit\r"} expect "*Administrator*" {send "exit\r"} ``` 如果我根据脚本的步骤手动去敲命令,物理机的Windows可以正常出现提示框,但写入到脚本之后就不行了,也不知道具体原因是什么,执行后如下所示: ``` [root@test_server shell]# ./windowspasswd.sh spawn ssh administrator@192.168.104.223 ****USAGE WARNING**** This is a private computer system. This computer system, including all related equipment, networks, and network devices (specifically including Internet access) are provided only for authorized use. This computer system may be monitored for all lawful purposes, including to ensure that its use is authorized, for management of the system, to facilitate protection against unauthorized access, and to verify security procedures, survivability, and operational security. Monitoring includes active attacks by authorized entities to test or verify the security of this system. During monitoring, information may be examined, recorded, copied and used for authorized purposes. All information, including personal information, placed or sent over this system may be monitored. Use of this computer system, authorized or unauthorized, constitutes consent to monitoring of this system. Unauthorized use may subject you to criminal prosecution. Evidence of unauthorized use collected during monitoring may be used for administrative, criminal, or other adverse action. Use of this system constitutes consent to monitoring for these purposes. administrator@192.168.104.223's password: Last login: Tue Dec 31 13:27:54 2019 from 192.168.104.223 Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 D:\OpenSSH\home\Administrator>cmd Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 D:\OpenSSH\home\Administrator>msg /server:192.168.104.223 * 已完成昨日MySQL数据库备份 ``` 按脚本来走的话,最后Windows应该是成功出现弹窗,同时命令行退回到Linux才对啊。但实际到上面哪里就卡住不动了,也没有弹窗,也没有退回Linux。
expect怎么控制键盘下键头
使用expect做命令交互,需要模拟键盘下箭头操作,查到键盘码 ASCII码为:方向键(↓): VK_DOWN (40), 但是使用send "/40"或"0x28"都无效 回车键ASCII码: VK_RETURN (13) 使用send "/13"无效 使用send "/r" 有效 ASCII码有误吗??还有怎么回事。 求解。
本地shell利用expect 执行远程主机脚本启动tomcat失败,无法启动。
本地shell脚本利用expect 执行远程主机脚本,远程脚本中设置了环境变量,使用catalina.sh start启动tomcat,但是无法启动,logs/下只有catalina.out并且无内容,登陆到远程主机执行脚本可以正常启动tomcat,是什么原因?
Balance 编写的实现
Problem Description You are given a set of weight values and asked to measure something with a certain weight. Weight x is measurable with a set y of weight values if and only if you can do the following: Place one weight with value x on either the left or right side of the scale. Then place some combination of weights on the scale with values from the set y so that the left and right sides have the same total value. You may use each value in y zero or more times to achieve this. In order to reach the target, you choose a kind of weight randomly and try to measure with it. If you find it impossible, you choose an additional kind and try again until you can measure with the set of weights you have chosen. Now, please tell me the expect kinds of weight you have to choose. Input For each case, the first line is two integers n and m (1<=n<=15), which n represents the number of weights you have and m is the weight you have to measure. Followed by n positive integers ai (1<=i<=n), indicating the mass of each kind of weight. 0 < m,ai < 2^31. Output For each case, output -1 if you can't measure with all kinds of weight you have or the expect number of kinds you have to choose which rounded to 3 decimal places. Sample Input 1 2 3 3 3 1 2 3 3 5 2 3 4 Sample Output -1 1.333 2.333
Here’s a Product Which Will Make You Tensor
Problem Description Most people are familiar with how to multiply two matrices together. However, an alternate form of multiplication known as tensor multiplication exists as well, and works more like you would expect matrix multiplication should. Let A be a p × q matrix and B be an n × m matrix, where neither A nor B is a 1 × 1 matrix. Then the tensor product is a pn × qm matrix formed by replacing each element aij in A with the matrix (aij) · B. Two examples are shown below, which also demonstrate that, like normal matrix multiplication, tensor multiplication is non-commutative: Note that there is no restriction that the number of columns in the first matrix must equal the number of rows in the second, as there is with normal matrix multiplication. The object of this problem is to determine the number of ways (if any) a given matrix can be formed as a result of a tensor multiplication. Input The first line of input for a test case will contain two positive integers r and c indicating the number of rows and columns in the matrix. After this will follow r lines each containing c positive integers. The values of r and c will be ≤ 500, each entry in the matrix will be no greater than 65,536, and the last test case is followed by a line containing 0 0. Output For each test case, output the number of different ways the matrix could be the tensor product of two positive integer matrices, neither of which is a 1 × 1 matrix. Sample Input 6 6 1 1 1 2 2 2 1 1 1 2 2 2 1 1 2 2 2 4 3 3 3 4 4 4 3 3 3 4 4 4 3 3 6 4 4 8 2 2 3 6 4 9 2 4 15 18 30 36 20 24 40 48 0 0 Sample Output 1 0 4
Decompressing in a GIF 格式问题
Problem Description One well known method to compress image files is the Graphics Interchange Format (GIF) encoding, created by CompuServe in 1987. Here’s a simplified version applied to strings of alphabetic characters. Essential for this compression is a dictionary which assigns numeric encodings (we’ll use base 10 numbers for this problem) to different strings of characters. The dictionary is initialized with mappings for characters or substrings which may appear in the string. For example, if we expect to encounter all 26 letters of the alphabet, the dictionary will initially store the encodings (A, 00), (B, 01), (C, 02), . . . , (Z, 25). If we are compressing DNA data, the dictionary will initially store only 4 entries: (A, 0), (T, 1), (G, 2) and (C, 3). Note that the length of each initial encoding is the same for all entries (2 digits in the first example, and 1 digit in the second). The compression algorithm proceeds as follows: 1. Find the longest prefix of the uncompressed portion of the string which is in the dictionary, and replace it with its numeric encoding. 2. If the end of the string has not been reached, add a new mapping (s, n) to the dictionary, where s = the prefix just compressed plus the next character after it in the string, and n = the smallest number not yet used in the dictionary. For example, assume we started with the string ABABBAABB and a dictionary with just two entries, (A, 0) and (B, 1). The table below shows the steps in compressing the string. The final compressed string is 01234. There is only one other rule: the replacement strings used are always the size of the longest encoding in the dictionary at the time the replacement occurs. Thus, with the dictionary above, if the string to compress is long enough that an entry of the form (s, 10) is added to the dictionary, then from this point on all numerical replacement strings used in the compressed string must be expanded to 2 digits long (i.e., A will now be encoded as 00, B as 01, AB as 02, etc.); if an entry (s′, 100) is added to the dictionary, all replacements from this point forward will increase to 3 digits long, and so on. Thus, the longer string ABABBAABBAABAABAB will be encoded as 01234027301, not 0123402731. Try it! OK, now that you are experts at compressing, it’s time to relax and decompress! Input Each test case will consist of two lines. The first line will contain a string of digits to decompress. The second line will contain the initial dictionary used in the compression. This line will start with a positive integer n indicating the number of entries in the dictionary (1 ≤ n ≤ 100), followed by n alphabetic strings. The first of these will be paired with 0 in the dictionary (or 00 if n > 10), the second with 1, and so on. The last test case will be followed by a line containing a single 0. Output For each test case, output a single line containing the case number (using the format shown below) followed by the decompressed string. All input strings will have been legally compressed. Sample Input 01234 2 A B 01234027301 2 A B 02151120182729 26 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 21104 3 BA A C 01 2 JA VA 0 Sample Output Case 1: ABABBAABB Case 2: ABABBAABBAABAABAB Case 3: CPLUSPLUS Case 4: CAABAAA Case 5: JAVA
SanguoSHA 程序的问题
Problem Description SanguoSHA is a very popular game. The rules of SanguoSHA are too complex for me to describe it in English, so just let me simplify it a lot. ^ ^. In this custom game we have several rules shown below, and you should read carefully: Part I--Identifies: 1): There are at most 8 players while at least 4; 2): There are 4 roles: Lord, Minister, Rebel, and Traitor. 3): The goal of the Lord and Ministers is to kill all of the Rebels and the Traitor. 4): The goal of the Rebel is to kill the Lord. 5): The goal of the Traitor is to make himself alive until the game over. 6): There is only 1 Lord. 7): There is only 1 Traitor. 8): There will be at least 1 Rebel. 9): There will be at least 1 Minister. 10): Every player know the total remain number of Rebel and Minister. Part II--How to determine the game over and who wins: 1): If the Lord is alive, and there is neither alive Rebel nor Traitor, then the game over, and the Lord and Ministers win. 2): When the Lord is killed by someone, the game over, if there is no one but the Traitor alive, then the Traitor wins; otherwise, the Rebels win. Part III--How to play in this custom game: 1): At first, the roles of all players except for the Lord are hidden, they only know their own roles. That means players have to conjecture others' role by analysing their behavior. 2): In each round, all alive players play one by one. The player1 plays first, then player2... 3): In each player's turn, the player can choose one and only one player to attack. The probability of killing the chosen one is P. 4): When a player is killed, his role should be announced. Part IV--How to analysis player's behaviors: 1): The Lord is always be considered as Lord. 2): A player will be considered as Rebel when he attack the Lord. 3): A player will be considered as Rebel when he attack one which considered as Minister before all Rebels are eliminated. 4): A player will be considered as Minister when he attack one which considered as Rebel. 5): A player will be considered as Traitor when he have been considered as Minister and Rebel. 6): The players are not clever enough, they can't analysis other behaviors. Part V--The attack strategy of each role: Eliminated player couldn't do anything. No one will attack eliminated player or himself. For each strategy, all eligible player have equal probability of being attacked. The Rebel will choose one of the following strategies by order: 1)The Lord or Ministers if some players are considered as Minister. 2)The Lord or Traitor if a player is considered as Traitor. 3)The Lord. The Lord and Ministers will choose one of the following strategies by order: 1)The player which be considered as Rebel. 2)The player which be considered as Traitor. 3)If all rebel roles are eliminated, then attack anyone except Lord. 4)The player with unknown role. The Traitor will choose one of the following strategies by order: 1)The player which be considered as Minister if alive Minister number more than alive Rebel number. 2)The player which be considered as Rebel if alive Rebel number not less than alive Minister number. 3)Anyone expect the Lord. 4)The Lord. Such information will be given: 1): The number of players. 2): Each player's identify. 3): The probability of killing the chosen one. For each role, you should calculate the probability of winning within 10 round. Input The first line is a number T(1<=T<=30), represents the number of case. The next T blocks follow each indicates a case. Each case consists of three lines, the first line is an integer N(4<=N<=8), indicating the number of players. The second line contains N integers, player1,player2...playern, indicating the role of each player.(The first player will always be the Lord).(0, 1, 2, 3 indicating Lord, Minister, Rebel, and Traitor respectively.) Then the third line contains a real number P(0<P<1). Output For each case, output the number of case and the win probability of the 4 roles.Answers are rounded to 3 numbers after the decimal point.(as shown in the sample output) Sample Input 2 4 0 1 2 3 0.5 4 0 3 2 1 0.5 Sample Output Case 1: Lord and Minister:0.549 Rebel:0.334 Traitor:0.118 Case 2: Lord and Minister:0.501 Rebel:0.334 Traitor:0.166
It's not a Bug, It's a Feature! 具体实现
Problem Description It is a curious fact that consumers buying a new software product generally do not expect the software to be bug-free. Can you imagine buying a car whose steering wheel only turns to the right? Or a CD-player that plays only CDs with country music on them? Probably not. But for software systems it seems to be acceptable if they do not perform as they should do. In fact, many software companies have adopted the habit of sending out patches to fix bugs every few weeks after a new product is released (and even charging money for the patches). Tinyware Inc. is one of those companies. After releasing a new word processing software this summer, they have been producing patches ever since. Only this weekend they have realized a big problem with the patches they released. While all patches fix some bugs, they often rely on other bugs to be present to be installed. This happens because to fix one bug, the patches exploit the special behavior of the program due to another bug. More formally, the situation looks like this. Tinyware has found a total of n bugs B = {b1, b2, ..., bn} in their software. And they have released m patches p1, p2, ..., pm. To apply patch pi to the software, the bugs Bi+ in B have to be present in the software, and the bugs Bi- in B must be absent (of course Bi+ ∩ Bi- = Φ). The patch then fixes the bugs Fi- in B (if they have been present) and introduces the new bugs Fi+ in B (where, again, Fi+ ∩ Fi- = Φ). Tinyware's problem is a simple one. Given the original version of their software, which contains all the bugs in B, it is possible to apply a sequence of patches to the software which results in a bug- free version of the software? And if so, assuming that every patch takes a certain time to apply, how long does the fastest sequence take? Input The input contains several product descriptions. Each description starts with a line containing two integers n and m, the number of bugs and patches, respectively. These values satisfy 1 <= n <= 20 and 1 <= m <= 100. This is followed by m lines describing the m patches in order. Each line contains an integer, the time in seconds it takes to apply the patch, and two strings of n characters each. The first of these strings describes the bugs that have to be present or absent before the patch can be applied. The i-th position of that string is a ``+'' if bug bi has to be present, a ``-'' if bug bi has to be absent, and a `` 0'' if it doesn't matter whether the bug is present or not. The second string describes which bugs are fixed and introduced by the patch. The i-th position of that string is a ``+'' if bug bi is introduced by the patch, a ``-'' if bug bi is removed by the patch (if it was present), and a ``0'' if bug bi is not affected by the patch (if it was present before, it still is, if it wasn't, is still isn't). The input is terminated by a description starting with n = m = 0. This test case should not be processed. Output For each product description first output the number of the product. Then output whether there is a sequence of patches that removes all bugs from a product that has all n bugs. Note that in such a sequence a patch may be used multiple times. If there is such a sequence, output the time taken by the fastest sequence in the format shown in the sample output. If there is no such sequence, output ``Bugs cannot be fixed.''. Print a blank line after each test case. Sample Input 3 3 1 000 00- 1 00- 0-+ 2 0-- -++ 4 1 7 0-0+ ---- 0 0 Sample Output Product 1 Fastest sequence takes 8 seconds. Product 2 Bugs cannot be fixed.
selenium-java 自动化测试
![图片说明](https://img-ask.csdn.net/upload/201911/27/1574838980_848228.png) selenium-java自动化测试,一运行就会打开两个网页 public class BaiduCase { WebDriver driver=null; @Before public void setUp() throws Exception { // 指定浏览器驱动地址 System.setProperty("webdriver.chrome.driver", "C:\\Users\\14816\\AppData\\Local\\Programs\\Python\\Python37-32\\Scripts\\chromedriver.exe"); // 初始化浏览器 driver = new ChromeDriver(); // 浏览器最大化 driver.manage().window().maximize(); // 打开百度 driver.get("http://www.baidu.com"); } @Test public void test() throws InterruptedException { // 找到输入框并输入内容 driver.findElement(By.id("kw")).sendKeys("selenium的简单使用"); // 点击按钮 driver.findElement(By.id("su")).click(); // 得到当前页面的标题 String title = driver.getTitle(); System.out.println(title); // 预期结果 String expect = "百度一下,你就知道"; if(title.equals(expect)) { System.out.println("测试成功"); }else { System.out.println("测试失败"); } Thread.sleep(3000); } @After public void tearDown() throws Exception { driver.quit(); } }
脚本文件为何总是在where循环指定位置报错?
小弟最近初学shell文件。在CentOS6中写了一个脚本文件对程序进行操作 大概用途就是是向mysql数据库中增加数据 向其中储存用户信息的表中增加用户数据,用户由登录名和密码组成 登录名我准备从100开始,然后每一个用户增加1,而密码我准备都是123456 所以我在sql的插入操作中使用了where循环,但是每次一运行脚本,都会报错:./all.sh: line 4: 2000]: No such file or directory shell文件具体内容如下: ``` #!/bin/bash PassWord=123456 number=100 while [${number} < 2000] do /usr/bin/expect <<-EOF spawn mysql -u root -p expect "*password*" send "$PassWord\r" expect "*>*" send "show databases;\r" expect "*>*" send "use testserver;\r" expect "*>*" send "show tables;\r" expect "*>*" send"INSERT INTO testnum values('${number}',123456);\r" expect "*>*" let "number++" EOF done ``` 求各位大佬帮忙解答一下原因
一个查询语句在navicat中可以执行,但是在mybatis中报错了
#### 报错提示的语句和我写的mybatis中的语句不一样,不知道怎么个回事儿0.0。 **mybatis中sql语句:** ``` SELECT t.m_id as 'id', t.name, t.numbers, t.s_id as 'spId', t.learned, t.learning, t.plan_finish_date as 'planFinishDate', t.plan, t.next_plan as 'nextPlan' FROM( SELECT m.id as 'm_id', m.name, m.createdate, s.numbers, s.id as 's_id', s.learned, s.learning, s.plan_finish_date , s.plan, s.next_plan FROM member AS m LEFT JOIN study_plan AS s ON m.id = s.m_id ORDER BY s.numbers DESC LIMIT 10000 ) t GROUP BY t.name ORDER BY t.createdate ``` **我多粘贴了一些报错信息** ``` Error querying database. Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :' ) tmp_count',expect RPAREN, actual EOF tmp_count : select count(1) from (SELECT t.m_id as 'id', t.name as 'name', t.numbers as 'numbers', t.sp_id as 'spId', t.learned as 'learned', t.learning as 'learning', t.plan_finish_date as 'planFinishDate', t.plan as 'plan', t.createdate as 'createdate', t.next_plan as 'nextPlan' FROM ( SELECT m.id as 'm_id', m.`name`, m.createdate, s.numbers, s.id as 'sp_id', s.learned, s.learning, s.plan_finish_date , s.plan, s.next_plan FROM member AS m LEFT JOIN study_plan AS s ON m.id = s.m_id ) tmp_count ### Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :' ) tmp_count',expect RPAREN, actual EOF tmp_count : select count(1) from (SELECT t.m_id as 'id', t.name as 'name', t.numbers as 'numbers', t.sp_id as 'spId', t.learned as 'learned', t.learning as 'learning', t.plan_finish_date as 'planFinishDate', t.plan as 'plan', t.createdate as 'createdate', t.next_plan as 'nextPlan' FROM ( SELECT m.id as 'm_id', m.`name`, m.createdate, s.numbers, s.id as 'sp_id', s.learned, s.learning, s.plan_finish_date , s.plan, s.next_plan FROM member AS m LEFT JOIN study_plan AS s ON m.id = s.m_id ) tmp_count ; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; sql injection violation, syntax error: syntax error, error in :' ) tmp_count',expect RPAREN, actual EOF tmp_count : select count(1) from (SELECT t.m_id as 'id', t.name as 'name', t.numbers as 'numbers', t.sp_id as 'spId', t.learned as 'learned', t.learning as 'learning', t.plan_finish_date as 'planFinishDate', t.plan as 'plan', t.createdate as 'createdate', t.next_plan as 'nextPlan' FROM ( SELECT m.id as 'm_id', m.`name`, m.createdate, s.numbers, s.id as 'sp_id', s.learned, s.learning, s.plan_finish_date , s.plan, s.next_plan FROM member AS m LEFT JOIN study_plan AS s ON m.id = s.m_id ) tmp_count; nested exception is java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :' ) tmp_count',expect RPAREN, actual EOF tmp_count : select count(1) from (SELECT t.m_id as 'id', t.name as 'name', t.numbers as 'numbers', t.sp_id as 'spId', t.learned as 'learned', t.learning as 'learning', t.plan_finish_date as 'planFinishDate', t.plan as 'plan', t.createdate as 'createdate', t.next_plan as 'nextPlan' FROM ( SELECT m.id as 'm_id', m.`name`, m.createdate, s.numbers, s.id as 'sp_id', s.learned, s.learning, s.plan_finish_date , s.plan, s.next_plan FROM member AS m LEFT JOIN study_plan AS s ON m.id = s.m_id ) tmp_count ``` xml截个图 ![图片说明](https://img-ask.csdn.net/upload/201911/20/1574229873_476553.png)
Druid连接SqlServer报错,为啥都连接了sqlserver还执行SHOW TABLES?
SpringBoot + Guns脚手架改成使用sqlserver,在最后时刻报错了,原因是sqlserver执行了mysql的语句SHOW TABLES,druid内部会执行这一句吗?mysql转sqlserver该如何实现? ``` 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/add]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.add(com.jsnjfz.manage.modular.system.transfer.UserDto,org.springframework.validation.BindingResult) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/delete]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.delete(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/list]}" onto public java.lang.Object com.jsnjfz.manage.modular.system.controller.UserMgrController.list(java.lang.String,java.lang.String,java.lang.String,java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/reset]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.reset(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_info]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.userInfo(org.springframework.ui.Model) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/freeze]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.freeze(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/view/{userId}]}" onto public com.jsnjfz.manage.modular.system.model.User com.jsnjfz.manage.modular.system.controller.UserMgrController.view(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/setRole]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.setRole(java.lang.Integer,java.lang.String) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_chpwd]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.chPwd() 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/changePwd]}" onto public java.lang.Object com.jsnjfz.manage.modular.system.controller.UserMgrController.changePwd(java.lang.String,java.lang.String,java.lang.String) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/edit]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.edit(com.jsnjfz.manage.modular.system.transfer.UserDto,org.springframework.validation.BindingResult) throws javax.naming.NoPermissionException 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/role_assign/{userId}]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.roleAssign(java.lang.Integer,org.springframework.ui.Model) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_add]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.addView() 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_edit/{userId}]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.userEdit(java.lang.Integer,org.springframework.ui.Model) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/upload],methods=[POST]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.upload(org.springframework.web.multipart.MultipartFile) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/unfreeze]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.unfreeze(java.lang.Integer) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/code/generate],methods=[POST]}" onto public java.lang.Object cn.stylefeng.guns.generator.modular.controller.CodeController.generate(cn.stylefeng.guns.generator.executor.model.GenQo) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/code]}" onto public java.lang.String cn.stylefeng.guns.generator.modular.controller.CodeController.blackboard(org.springframework.ui.Model) 2019-12-09 15:04:10.353 INFO 3788 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-12-09 15:04:10.353 INFO 3788 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/static/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-12-09 15:04:10.353 INFO 3788 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/swagger-ui.html] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-12-09 15:04:10.415 INFO 3788 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in globalExceptionHandler 2019-12-09 15:04:10.415 INFO 3788 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in defaultControllerExceptionHandler 2019-12-09 15:04:11.071 INFO 3788 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2019-12-09 15:04:11.114 INFO 3788 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2019-12-09 15:04:11.161 INFO 3788 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8001 (http) with context path '' 2019-12-09 15:04:11.161 INFO 3788 --- [ restartedMain] c.jsnjfz.manage.WebstackGunsApplication : Started WebstackGunsApplication in 71.82 seconds (JVM running for 72.932) JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@7a595887] will not be managed by Spring 2019-12-09 15:08:40.389 ERROR 3788 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed com.baomidou.mybatisplus.exceptions.MybatisPlusException: java.lang.reflect.InvocationTargetException at com.baomidou.mybatisplus.MybatisSqlSessionTemplate$SqlSessionInterceptor.invoke(MybatisSqlSessionTemplate.java:405) at com.sun.proxy.$Proxy86.selectList(Unknown Source) at com.baomidou.mybatisplus.MybatisSqlSessionTemplate.selectList(MybatisSqlSessionTemplate.java:195) at com.baomidou.mybatisplus.mapper.SqlRunner.selectObjs(SqlRunner.java:140) at cn.stylefeng.roses.core.db.DbInitializer.initTable(DbInitializer.java:97) at cn.stylefeng.roses.core.db.DbInitializer.dbInit(DbInitializer.java:71) at cn.stylefeng.roses.core.db.listener.InitTableListener.onApplicationEvent(InitTableListener.java:42) at cn.stylefeng.roses.core.db.listener.InitTableListener.onApplicationEvent(InitTableListener.java:32) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354) at org.springframework.boot.context.event.EventPublishingRunListener.running(EventPublishingRunListener.java:103) at org.springframework.boot.SpringApplicationRunListeners.running(SpringApplicationRunListeners.java:78) at org.springframework.boot.SpringApplication.run(SpringApplication.java:343) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) at com.jsnjfz.manage.WebstackGunsApplication.main(WebstackGunsApplication.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.baomidou.mybatisplus.MybatisSqlSessionTemplate$SqlSessionInterceptor.invoke(MybatisSqlSessionTemplate.java:401) ... 23 common frames omitted Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW : SHOW TABLES ### The error may involve com.baomidou.mybatisplus.mapper.SqlRunner.SelectObjs ### The error occurred while executing a query ### SQL: SHOW TABLES ### Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW : SHOW TABLES at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ... 28 common frames omitted Caused by: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW : SHOW TABLES at com.alibaba.druid.wall.WallFilter.checkInternal(WallFilter.java:798) at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:251) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:568) at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:342) at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:349) at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:87) at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88) at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49) at com.baomidou.mybatisplus.plugins.PaginationInterceptor.intercept(PaginationInterceptor.java:112) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy114.prepare(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49) at cn.stylefeng.roses.core.datascope.DataScopeInterceptor.intercept(DataScopeInterceptor.java:46) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy114.prepare(Unknown Source) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy113.query(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ... 29 common frames omitted Caused by: com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:284) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:426) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:83) at com.alibaba.druid.wall.WallProvider.checkInternal(WallProvider.java:624) at com.alibaba.druid.wall.WallProvider.check(WallProvider.java:578) at com.alibaba.druid.wall.WallFilter.checkInternal(WallFilter.java:785) ... 65 common frames omitted 2019-12-09 15:08:40.394 INFO 3788 --- [ restartedMain] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@e8fcbe7: startup date [Mon Dec 09 15:02:59 CST 2019]; root of context hierarchy 2019-12-09 15:08:40.395 INFO 3788 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2019-12-09 15:08:40.395 INFO 3788 --- [ restartedMain] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed 2019-12-09 15:08:40.395 INFO 3788 --- [ restartedMain] o.s.c.ehcache.EhCacheManagerFactoryBean : Shutting down EhCache CacheManager ```
求问expect脚本怎么设置返回值?
用expect写了一个自动登录FTP和ssh的脚本,求问各路大神,怎么能让这个脚本在可能出错的地方返回一个报错,跳出子进程,或者停止执行,返回一个值,我再判断这个值的也行。 expect脚本内容登录FTP的部分如下, 就比如spawn那,IP找不到的时候,会提示no route,此时我应该怎么处理,使得脚本不在执行并报错?请问我应该怎么修改? 嵌套到shell里也行,我折腾了好几天了没弄好 expect属于tcl语言的一种,语法我不熟悉,真的是好费劲啊 if { $backup_all == "yes" } { spawn ftp $ipaddr expect "Name*" send "root\r" expect "Password:*" send "linuxeryi\r" expect "ftp>*" send "lcd $local_path\r" expect "ftp>*" send "cd $remote_path\r" expect "ftp>*" send "binary\r" send "prompt\r" send "mget $file\r" send "quit\r" expect eof
linux expect脚本问题
1 #!/usr/bin/expect -f 2 spawn ssh root@192.168.1.121 3 expect "*password:" 4 send "test1234\r" 5 expect "*#" 6 send "mkdir ./ts\r" 7 send "file ts\r" 8 interact 实现登录到远端机器然后新建一个目录 查看这个目录的类型 为什么去掉第五行就不能正确执行了呢?而第六行和第七行就可以连续执行? expect和send到底是怎么样的一个关系? spawn mkdir ./test 这样无交互的指令是不是无法用expect编程 我试了下就执行了这句 尽管我指定了 expect “*$“ 也没有继续执行接下去的send 语句 求教!
expect ftp 下载文件文件损坏,写法如下,
#!/bin/expect set timeout 30 set host 10.9.9.145 set login_name zzz set login_pwd zzz set localpath "/home/acc/songt/read" set remotepath "/home/acc/songt/write" spawn -noecho ftp -i $host expect { timeout { exit 1 } "ame" } send "$login_name\r" expect { timeout { exit 1 } "assword:" } send "$login_pwd\r" expect { timeout { exit 1 } "assword:" { exit 1 } "ogin failed" { exit 1 } "ftp>" } send "passive\r" expect "ftp>" send "lcd $localpath\r" expect "ftp>" send "cd $remotepath\r" expect { timeout { exit 1 } "ftp>" } #LJ send "mget LJ*\r" expect { timeout { exit 1 } "ailed to open file" { exit 1 } "ad sequence of command" { exit 1 } "ftp>" } send "mdelete LJ*\r" expect { timeout {exit 1} "ailed to open file" {exit 1} "ad sequence of command" { exit 1 } "ftp>" } send "bye\r" exit 0
执行expect脚本时,生成的日志文件中含有^M,格式不规范
使用a.sh(shell)调用b.sh(expect)时,将输出打印到日志文件c.log:xxx |tee -a ${log_file} 日志文件中,含有^M字符:![图片说明](https://img-ask.csdn.net/upload/201907/30/1564451696_118295.png) 日志文件是在ubuntu系统下生成写入。请教下如何解决
expect output 是什么
下面是一部分代码, 想咨询下 最终echo 到屏幕上的$output 都有什么内容? output=$( expect << EOD log_user 1 spawn ssh $user@$host -p 22 expect "*password:*" send "$pwd \r" expect "*AB-1:~> " send "ls -l $targetDir/*.gz \r" expect "*AB-1:~> *" puts $expect_out(buffer) send "exit \r" expect eof EOD ) log "DEBUG" "$output" pkgList=$(echo "$output" | sed -n '/ls -l/,/^exit/p' | grep -v '^oss_user@AB-1' | grep -v '^exit' | awk '{print $NF}' | awk -F/ '{print $NF}') log "INFO" "pkgList: $pkgList" echo $pkgList
js中处理数组 如何在一个大的数组中提取一个小数组
已经有的数组 ``` arry1[ 0: "id" 1: "hosp_name" 2: "status" 3: "inner_status" 4: "create_user" 5: "manager_id" 6: "type" 7: "engineers" 8: "evaluate_userlist" 9: "saler_flag" 10: "department" 11: "mgrchg_flag" 12: "manager_idlist" 13: "overload_flag"] arry2[ actual_deploy_time: "2017-01-01 00:00:00" aio_qty: "21" area: "上海市 上海市 宝山区" area_list: (3) [1, 2, 9, __ob__: Observer] card4g_qty: "21" create_user: 710 create_username: "张珊" depart_num: "21" department: 1 deploy_engineers: "22,29,30" engineers: "30,29" evaluate_userlist: "30#29#710" execute_userlist: [29, __ob__: Observer] expect_dev_time: "2017-01-01 00:00:00" expect_dev_time2: "2017-01-01 00:00:00" first_flag: 0 fs_aio_type: 1 fs_server_type: 1 hosp_id: 10 hosp_name: "上海市宝山区顾村镇社区卫生服务中心" id: 911 interface_engineers: "30" interface_userlist: [30, __ob__: Observer] manager_id: 10 manager_idlist: "10,27" manager_name: "舒新" memo: "21" mgrchg_flag: 0 old_managerid: 10 overload_flag: 0 pad_qty: "21" pc_qty: "21" receiver_addr: "21" receiver_name: "21" receiver_tel: "21" rel_manager: "李苏" rel_manager_id: 710 route_qty: "21" saler_flag: "0" server_qty: "21" status: 50 tracking_num: "21" type: 1 view_interface_pre: 1 wechat_group: 1 ] ``` ## 需生成的数组 arry3[ 0: id:911 1: hosp_name 上海市宝山区顾村镇社区卫生服务中心 2: status:1 3: inner_status:22 4: create_user:李苏 5: manager_id 12 6: type 1 7: engineers 8: "evaluate_userlist" 9: "saler_flag" 10: "department" 11: "mgrchg_flag" 12: "manager_idlist" 13: "overload_flag"] 等于根据第一个数组的对象名 取第二个数组的对象值
java三元运算符底层boolen类型怎么和int做比较的
public static void main(String[] args) { test(false, true); } public static void test(boolean expect, boolean update) { int e = expect ? 1 : 0; System.out.println(e); }
相见恨晚的超实用网站
相见恨晚的超实用网站 持续更新中。。。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
JavaScript 为什么能活到现在?
作者 | 司徒正美 责编 |郭芮 出品 | CSDN(ID:CSDNnews) JavaScript能发展到现在的程度已经经历不少的坎坷,早产带来的某些缺陷是永久性的,因此浏览器才有禁用JavaScript的选项。甚至在jQuery时代有人问出这样的问题,jQuery与JavaScript哪个快?在Babel.js出来之前,发明一门全新的语言代码代替JavaScript...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
吐血推荐珍藏的Visual Studio Code插件
作为一名Java工程师,由于工作需要,最近一个月一直在写NodeJS,这种经历可以说是一部辛酸史了。好在有神器Visual Studio Code陪伴,让我的这段经历没有更加困难。眼看这段经历要告一段落了,今天就来给大家分享一下我常用的一些VSC的插件。 VSC的插件安装方法很简单,只需要点击左侧最下方的插件栏选项,然后就可以搜索你想要的插件了。 下面我们进入正题 Material Theme ...
实战:如何通过python requests库写一个抓取小网站图片的小爬虫
有点爱好的你,偶尔应该会看点图片文字,最近小网站经常崩溃消失,不如想一个办法本地化吧,把小照片珍藏起来! 首先,准备一个珍藏的小网站,然后就可以开始啦! 第一步 我们先写一个获取网站的url的链接,因为url常常是由page或者,其他元素构成,我们就把他分离出来,我找到的网站主页下有图片区 图片区内有标题页,一个标题里有10张照片大概 所以步骤是: 第一步:进入图片区的标题页 def getH...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
相关热词 c#委托 逆变与协变 c#新建一个项目 c#获取dll文件路径 c#子窗体调用主窗体事件 c# 拷贝目录 c# 调用cef 网页填表c#源代码 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天
立即提问