java使用SSH方式上传报错:Algorithm negotiation fail

java用jsch实现文件传输(SSH形式),但是好像本地和服务器加密方式不一致,一直报错:
com.jcraft.jsch.JSchException: Algorithm negotiation fail

2个回答

如果是已form表单中的上传。需要改form的属性enctype( 属性规定在发送到服务器之前应该如何对表单数据进行编码。)
改属性默认值:application/x-www-form-urlencoded
如果是要上传文件需要修改为:
multipart/form-data
不对字符编码。在使用包含文件上传控件的表单时,必须使用该值。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
ssh client 报 algorithm negotiation failed 错误,修改sshd_config,重启服务失败
1)window系统打开ssh client 连接centos失败提示 ![图片说明](https://img-ask.csdn.net/upload/201911/19/1574166765_855902.png) 2)报 algorithm negotiation failed错误 3)根据网上查找在centos中修改配置文件/etc/ssh/sshd_config # vi /etc/ssh/sshd_config 添加 Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nis tp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org 保存 4)重启服务 service sshd restart 5)重启失败 : ![图片说明](https://img-ask.csdn.net/upload/201911/19/1574167322_773993.jpg) 应该如何解决
JSCH连接SFTP服务Algorithm negotiation fail
JAVA环境: java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) Server VM (build 20.45-b01, mixed mode) jsch-0.1.42.jar SFTP环境: OpenSSH_6.7p1, OpenSSL 1.0.1j 15 Oct 2014。 现象就是应用程序客户端始终SFTP连接不了服务端,导致很多功能不能使用。 而在一些旧版本的OpenSSL机器上,如0.9.8e版本上是没有问题的,只要一升级OpenSSL就会导致该问题。 尝试思路: 1. **JSCH版本过低,不支持最新版本OpenSSL导致的。** 升级到JSCH 0.1.51版本后依然不行。 2. **JSCH不支持ECDSA算法,是无法使用最新OpenSSL的。** 为JSCH添加支持ECDSA算法的插件--->未测试。 有没有哪位大神指明一下? 3. **使用SSH调试模式连接:** *debug1:no match JSCH-0.1.51 ... debug1:list_hostkey_types:ssh-rsa, ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519[preauth] ... debug1:kex:client->server aes128-ctr hmac-sha1 none [preauth] debug1:kex:server->client aes128-ctr hmac-sha1 none [preauth] debug1:Unable to negotiate a key exchange method [preauth]* ... 然后尝试在sshd_config中添加了 *Ciphers aes128-ctr,aes192-ctr,aes256-ctr* 还是不行。 求哪位大神指教一下,给个思路。
为什么用scp登录linux报错Algorithm negotiation fail,不懂是为什么
``` Scp scp = new Scp("192.168.1.100", "linaro", "linaro"); scp.Connect(); scp.Get("/etc/r2", "packages"); scp.Close(); return true; ```
jsch连接sftp问题 Session.connect: java.security.
公司使用的IBM的jdk,使用jsch做一个sftp连接上传下载文件的工具,当使用jsch 0.1.51版本时 连接报错Algorithm negotiation fail, 然后升级版本到0.1.54 连接报错 Session.connect: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive) 求大神教育
mysql连接报错:ERROR 2002 (HY000):Can't connect to MySQL server on '172.18.0.4' (115)
使用MySQL客户端连接远程amoeba进行远程控制数据库报错: ``` root@uduntu:~# mysql -u root -P8066 -h 172.18.0.4 -p Enter password: ERROR 2002 (HY000): Can't connect to MySQL server on '172.18.0.4' (115) ``` 求解答????在线等,可进行远程协调 下面是amoeba.xml内容: ``` <?xml version="1.0" encoding="gbk"?> <!DOCTYPE amoeba:configuration SYSTEM "amoeba.dtd"> <amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/"> <server> <!-- proxy server绑定的端口 --> <property name="port">8066</property> <!-- proxy server绑定的IP --> <property name="ipAddress">127.0.0.1</property> <!-- proxy server net IO Read thread size --> <property name="readThreadPoolSize">100</property> <!-- proxy server client process thread size --> <property name="clientSideThreadPoolSize">80</property> <!-- mysql server data packet process thread size --> <property name="serverSideThreadPoolSize">100</property> <!-- socket Send and receive BufferSize(unit:K) --> <property name="netBufferSize">100</property> <!-- Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm). --> <property name="tcpNoDelay">false</property> <!-- 对外验证的用户名 --> <property name="user">root</property> <!-- 对外验证的密码 --> <property name="password">redhat</property> </server> <!-- 每个ConnectionManager都将作为一个线程启动。 manager负责Connection IO读写/死亡检测 --> <connectionManagerList> <connectionManager name="defaultManager"> <className>com.meidusa.amoeba.net.AuthingableConnectionManager</className> </connectionManager> </connectionManagerList> <dbServerList> <!-- 一台mysqlServer 需要配置一个pool, 如果多台 平等的mysql需要进行loadBalance, 平台已经提供一个具有负载均衡能力的objectPool:com.meidusa.amoeba.mysql.server.MultipleServerPool 简单的配置是属性加上 virtual="true",该Pool 不允许配置factoryConfig 或者自己写一个ObjectPool。 --> <dbServer name="server1"> <!-- PoolableObjectFactory实现类 --> <factoryConfig> <className>com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory</className> <property name="manager">defaultManager</property> <!-- 真实mysql数据库端口 --> <property name="port">3306</property> <!-- 真实mysql数据库IP --> <property name="ipAddress">172.18.0.2</property> <property name="schema">test</property> <!-- 用于登陆mysql的用户名 --> <property name="user">jia</property> <!-- 用于登陆mysql的密码 --> <property name="password">redhat</property> </factoryConfig> <!-- ObjectPool实现类 --> <poolConfig> <className>com.meidusa.amoeba.net.poolable.PoolableObjectPool</className> <property name="maxActive">200</property> <property name="maxIdle">200</property> <property name="minIdle">10</property> <property name="minEvictableIdleTimeMillis">600000</property> <property name="timeBetweenEvictionRunsMillis">600000</property> <property name="testOnBorrow">true</property> <property name="testWhileIdle">true</property> </poolConfig> </dbServer> <dbServer name="multiPool" virtual="true"> <poolConfig> <className>com.meidusa.amoeba.server.MultipleServerPool</className> <!-- 负载均衡参数 1=ROUNDROBIN , 2=WEIGHTBASED --> <property name="loadbalance">1</property> <!-- 参与该pool负载均衡的poolName列表以逗号分割 --> <property name="poolNames">server1</property> </poolConfig> </dbServer> </dbServerList> <queryRouter> <className>com.meidusa.amoeba.mysql.parser.MysqlQueryRouter</className> <property name="ruleConfig">${amoeba.home}/conf/rule.xml</property> <property name="functionConfig">${amoeba.home}/conf/functionMap.xml</property> <property name="ruleFunctionConfig">${amoeba.home}/conf/ruleFunctionMap.xml</property> <property name="LRUMapSize">1500</property> <property name="defaultPool">server1</property> <!-- <property name="writePool">server1</property> <property name="readPool">server1</property> --> <property name="needParse">true</property> </queryRouter> </amoeba:configuration> ```
sftp用证书文件登录报algorithm negotiation fail
请教各位大神,我要使用sftp传输文件,可以再登录这块出现了问题几天都没找到解决方法 开发语言C# 用的是网上开源的Tamir.SharpSSH.dll 对方提供了host name和user name 用工具PuTTY在本机生成了2个文件 public key和private key public key已传给对方加过白名单了 用工具WinSCP 输入host name 和user name再传入private key file可以登录连上对方 但是用网上开源的Tamir.SharpSSH.dll和代码连击不上 这是登录的代码 private Session m_session; private Channel m_channel; private ChannelSftp m_sftp; //host:sftp地址 user:用户名 pwd:密码 public Helper(string host, string user, string pwd, string privateKey) { string[] arr = host.Split(':'); string ip = arr[0]; int port = 22; if (arr.Length > 1) port = Int32.Parse(arr[1]); JSch jsch = new JSch(); string passphrase = ""; if (privateKey != null && !"".Equals(privateKey)) { if (passphrase != null && !"".Equals(passphrase)) { //设置带口令的密钥 jsch.addIdentity(privateKey, passphrase); } else { //设置不带口令的密钥 jsch.addIdentity(privateKey); } } m_session = jsch.getSession(user, ip, port); MyUserInfo ui = new MyUserInfo(); ui.setPassword(pwd); m_session.setUserInfo(ui); } //登录验证信息 public class MyUserInfo : UserInfo { String passwd; public String getPassword() { return passwd; } public void setPassword(String passwd) { this.passwd = passwd; } public String getPassphrase() { return null; } public bool promptPassphrase(String message) { return true; } public bool promptPassword(String message) { return true; } public bool promptYesNo(String message) { return true; } public void showMessage(String message) { } } //SFTP连接状态 public bool Connected { get { return m_session.isConnected(); } } //连接SFTP public bool Connect() { try { if (!Connected) { m_session.connect(); m_channel = m_session.openChannel("sftp"); m_channel.connect(); m_sftp = (ChannelSftp)m_channel; } return true; } catch { return false; } } private key是个.ppk的文件 登录时会报异常 ![图片说明](https://img-ask.csdn.net/upload/201508/18/1439867038_646861.png) 用PuTTY工具 把.ppa文件转成OpenSSH key 再去执行登录报异常 ![图片说明](https://img-ask.csdn.net/upload/201508/18/1439867114_780724.png) 实在没方向了 不知道怎么去做登录了 求做过C#用文件 在程序中登录大神们指点下
报错:sys.argv[1] IndexError: list index out of range?
运行时报错:firstFolder = sys.argv[1] IndexError: list index out of range 怎么回事? ``` import numpy as np import cv2 import sys from matplotlib import pyplot as plt # img = cv2.imread('logo.png',0) # # Initiate ORB detector # orb = cv2.ORB_create() # # find the keypoints with ORB # kp = orb.detect(img,None) # # compute the descriptors with ORB # kp, des = orb.compute(img, kp) # # draw only keypoints location,not size and orientation # img2 = cv2.drawKeypoints(img, kp, None, color=(0,255,0), flags=0) # plt.imshow(img2), plt.show() from os import listdir from os.path import isfile, join class Application: def __init__(self, extractor, detector): self.extractor = extractor self.detector = detector def train_vocabulary(self, file_list, vocabulary_size): kmeans_trainer = cv2.BOWKMeansTrainer(vocabulary_size) for path_to_image in file_list: img = cv2.imread(path_to_image, 0) kp, des = self.detector.detectAndCompute(img, None) kmeans_trainer.add(des) return kmeans_trainer.cluster() def extract_features_from_image(self, file_name): image = cv2.imread(file_name) return self.extractor.compute(image, self.detector.detect(image)) def extract_train_data(self, file_list, category): train_data, train_responses = [], [] for path_to_file in file_list: train_data.extend(self.extract_features_from_image(path_to_file)) train_responses.append(category) return train_data, train_responses def train_classifier(self, data, responses): n_trees = 200 max_depth = 10 model = cv2.ml.RTrees_create() eps = 1 criteria = (cv2.TERM_CRITERIA_MAX_ITER, n_trees, eps) model.setTermCriteria(criteria) model.setMaxDepth(max_depth) model.train(np.array(data), cv2.ml.ROW_SAMPLE, np.array(responses)) return model def predict(self, file_name): features = self.extract_features_from_image(file_name) return self.classifier.predict(features)[0] def train(self, files_array, vocabulary_size=12): all_categories = [] for category in files_array: all_categories += category vocabulary = self.train_vocabulary(all_categories, vocabulary_size) self.extractor.setVocabulary(vocabulary) data = [] responses = [] for id in range(len(files_array)): data_temp, responses_temp = self.extract_train_data(files_array[id], id) data += data_temp responses += responses_temp self.classifier = self.train_classifier(data, responses) def error(self, file_list, category): responses = np.array([self.predict(file) for file in file_list]) _responses = np.array([category for _ in range(len(responses))]) return 1 - np.sum(responses == _responses) / len(responses) def get_images_from_folder(folder): return ["%s/%s" % (folder, f) for f in listdir(folder) if isfile(join(folder, f))] def start(folders, detector_type, voc_size, train_proportion): if detector_type == "SIFT": # "Scale Invariant Feature Transform" extract = cv2.xfeatures2d.SIFT_create() detector = cv2.xfeatures2d.SIFT_create() else: # "Speeded up Robust Features" extract = cv2.xfeatures2d.SURF_create() detector = cv2.xfeatures2d.SURF_create() flann_params = dict(algorithm=1, trees=5) matcher = cv2.FlannBasedMatcher(flann_params, {}) extractor = cv2.BOWImgDescriptorExtractor(extract, matcher) train = [] test = [] for folder in folders: images = get_images_from_folder(folder) np.random.shuffle(images) slice = int(len(images) * train_proportion) train_images = images[0:slice] test_images = images[slice:] train.append(train_images) test.append(test_images) app = Application(extractor, detector) app.train(train, voc_size) total_error = 0.0 for id in range(len(test)): print(app.error(train[id], id)) test_error = app.error(test[id], id) print(test_error) print("---------") total_error = total_error + test_error total_error = total_error / float(len(test)) print("Total error = %f" % total_error) firstFolder = sys.argv[1] secondFolder = sys.argv[2] detectorType = sys.argv[3] vocSize = int(sys.argv[4]) trainProportion = float(sys.argv[5]) start([firstFolder, secondFolder], detectorType, vocSize, trainProportion) ```
git执行ssh -v git@github.com一直是permission denied.
git执行ssh -v git@github.com一直是permission denied. OpenSSH_7.2p2 Ubuntu-4ubuntu1, OpenSSL 1.0.2g-fips 1 Mar 2016 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to github.com [192.30.253.113] port 22. debug1: Connection established. debug1: identity file /home/johnnyding/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /home/johnnyding/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/johnnyding/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/johnnyding/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/johnnyding/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/johnnyding/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/johnnyding/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/johnnyding/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu1 debug1: Remote protocol version 2.0, remote software version libssh-0.7.0 debug1: no match: libssh-0.7.0 debug1: Authenticating to github.com:22 as 'git' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ssh-rsa debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /home/johnnyding/.ssh/known_hosts:1 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/johnnyding/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /home/johnnyding/.ssh/id_dsa debug1: Trying private key: /home/johnnyding/.ssh/id_ecdsa debug1: Trying private key: /home/johnnyding/.ssh/id_ed25519 debug1: No more authentication methods to try. Permission denied (publickey).
mac上用ssh Permission denied (publickey,password)
日志打印如下 OpenSSH_7.3p1, LibreSSL 2.4.1 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 20: Applying options for * debug1: Connecting to 10.211.55.18 [10.211.55.18] port 22. debug1: Connection established. debug1: identity file /Users/Sebastian/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Sebastian/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.3 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000 debug1: Authenticating to 10.211.55.18:22 as 'Sebastian' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:v5nU1rPqA5E3j5krl8M2xnFco/14XvBqetfcP6qfTtE debug1: Host '10.211.55.18' is known and matches the ECDSA host key. debug1: Found key in /Users/Sebastian/.ssh/known_hosts:2 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/Sebastian/.ssh/id_rsa debug1: Authentications that can continue: publickey,password debug1: Trying private key: /Users/Sebastian/.ssh/id_dsa debug1: Trying private key: /Users/Sebastian/.ssh/id_ecdsa debug1: Trying private key: /Users/Sebastian/.ssh/id_ed25519 debug1: Next authentication method: password Sebastian@10.211.55.18's password: debug1: Authentications that can continue: publickey,password Permission denied, please try again. Sebastian@10.211.55.18's password: debug1: Authentications that can continue: publickey,password Permission denied, please try again. Sebastian@10.211.55.18's password: debug1: Authentications that can continue: publickey,password debug1: No more authentication methods to try. Permission denied (publickey,password). 在网上各种方法都试过啦 请问我该如何解决这一问题
too few arguments for variable template "set"
```#include<iostream> #include<cstdio> #include<algorithm> #include<set> using namespace std; const int maxn=200000+5; int a[maxn],f[maxn],g[maxn]; struct candidate{ int a,g; candidate(int a,int g):a(a),g(g){} bool operator < (const candidate& rhs) const{ return a<rhs.a; } }; set<candidate > s; //以下省略 ``` vs中编译报错:too few arguments for variable template "set" 使用map 《int,int 》m;时也报错:too few arguments for variable template "map" 已经包含了头文件的情况下也报错,且编译运行失败。 请问是什么原因以及如何解决?
python3调用别人的opencv图片匹配程序报错
小白,调用别人python算法进行图片匹配报错。 代码: import cv2 from matplotlib import pyplot as plt import numpy as np import os import math def getMatchNum(matches,ratio): '''返回特征点匹配数量和匹配掩码''' matchesMask=[[0,0] for i in range(len(matches))] matchNum=0 for i,(m,n) in enumerate(matches): if m.distance<ratio*n.distance: #将距离比率小于ratio的匹配点删选出来 matchesMask[i]=[1,0] matchNum+=1 return (matchNum,matchesMask) path='D:/code/' queryPath=path+'yangben/' #图库路径 samplePath=path+'yuanjian/image1.jpg' #样本图片 comparisonImageList=[] #记录比较结果 #创建SIFT特征提取器 sift = cv2.xfeatures2d.SIFT_create() #创建FLANN匹配对象 FLANN_INDEX_KDTREE=0 indexParams=dict(algorithm=FLANN_INDEX_KDTREE,trees=5) searchParams=dict(checks=50) flann=cv2.FlannBasedMatcher(indexParams,searchParams) sampleImage=cv2.imread(samplePath,0) kp1, des1 = sift.detectAndCompute(sampleImage, None) #提取样本图片的特征 for parent,dirnames,filenames in os.walk(queryPath): for p in filenames: p=queryPath+p queryImage=cv2.imread(p,0) kp2, des2 = sift.detectAndCompute(queryImage, None) #提取比对图片的特征 matches=flann.knnMatch(des1,des2,k=2) #匹配特征点,为了删选匹配点,指定k为2,这样对样本图的每个特征点,返回两个匹配 (matchNum,matchesMask)=getMatchNum(matches,0.9) #通过比率条件,计算出匹配程度 matchRatio=matchNum*100/len(matches) drawParams=dict(matchColor=(0,255,0), singlePointColor=(255,0,0), matchesMask=matchesMask, flags=0) comparisonImage=cv2.drawMatchesKnn(sampleImage,kp1,queryImage,kp2,matches,None,**drawParams) comparisonImageList.append((comparisonImage,matchRatio)) #记录下结果 comparisonImageList.sort(key=lambda x:x[1],reverse=True) #按照匹配度排序 count=len(comparisonImageList) column=4 row=math.ceil(count/column) #绘图显示 figure,ax=plt.subplots(row,column) for index,(image,ratio) in enumerate(comparisonImageList): ax[int(index/column)][index%column].set_title('Similiarity %.2f%%' % ratio) ax[int(index/column)][index%column].imshow(image) plt.show() 报错信息: Traceback (most recent call last): File "sift7.py", line 55, in <module> ax[int(index/column)][index%column].set_title('Similiarity %.2f%%' % ratio) TypeError: 'AxesSubplot' object does not support indexing 求大神指点。
.net 因为要上传一些文件到linux上,但是linux没有安装ftp还有什么别的方法组件吗?
因为是初始化的工作,所以不能说安装好了ftp在上传,所以想知道有什么别的方法组件可以实现吗? 之后用一下代码: ``` Scp scp = new Scp("192.168.1.100", "1", "1"); scp.Connect(); scp.Get("/etc/r2000/collision.cfg", "packages"); scp.Close(); return true; ``` 之后在登录的时候报错“Algorithm negotiation fail”
spring整合shiro时报错
项目是我从我同事那里拷贝过来的,在我同事电脑上运行没有问题,在我的电脑上运行就报这个错误,网上能搜到的方法全部都试过了,不能解决问题,求大神指点 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [config/shiro.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [config/shiro.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:235) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:702) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:527) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4792) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [config/shiro.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ... 24 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.web.mgt.DefaultWebSecurityManager]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ... 32 more Caused by: java.lang.IllegalStateException: Unable to acquire AES algorithm. This is required to function. at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:59) at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:43) at org.apache.shiro.mgt.AbstractRememberMeManager.<init>(AbstractRememberMeManager.java:99) at org.apache.shiro.web.mgt.CookieRememberMeManager.<init>(CookieRememberMeManager.java:87) at org.apache.shiro.web.mgt.DefaultWebSecurityManager.<init>(DefaultWebSecurityManager.java:75) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ... 34 more Caused by: java.security.NoSuchAlgorithmException: AES KeyGenerator not available at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:169) at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223) at org.apache.shiro.crypto.AbstractSymmetricCipherService.generateNewKey(AbstractSymmetricCipherService.java:56) ... 43 more
安装CUDA:进行sudo apt-get update时报错
安装完nvidia cuda的仓库安装包,进行sudo apt-get update时报错: W: http://extras.ubuntu.com/ubuntu/dists/trusty/Release.gpg: Signature by key C47415DFF48C09645B78609416126D3A3E5C1192 uses weak digest algorithm (SHA1) 已经修改过好几次源了,只是不知道这个错误需要怎样修改 所以接下来进行sudo apt-get install cuda时也报错: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package cuda
Clumsy Algorithm使用C语言的实现方式
Problem Description   Sorted Lists are thought beautiful while permutations are considered elegant. So what about sequence (1, 2, ... , n) ? It is the oracle from god. Now Coach Pang finds a permutation (p1, p2, ... , pn) over {1, 2, ... , n} which has been shuffled by some evil guys. To show Coach Pang’s best regards to the oracle, Coach Pang decides to rearrange the sequence such that it is the same as (1, 2, 3, ... , n). The time cost of swapping pi and pj is 2|i- j| - 1. Of course, the minimum time cost will be paid since Coach Pang is lazy and busy. Denote the minimum time cost of the task as f(p). But Coach Pang is not good at maths. He finally works out a clumsy algorithm to get f(p) as following:   Coach Pang’s algorithm is clearly wrong. For example, n = 3 and (3, 2, 1) is the permutation. In this case, f(p) = 3 but g(p) = 0 + 0 + 2 = 2. The question is that how many permutations p of {1, 2, ... , n} such that f(p) = g(p). To make the problem more challenge, we also restrict the prefix of p to (a1, a2, ... , ak). To sum up, you need to answer the question that how many permutations p of {1, 2, ... , n} with the fixed prefix p1 = a1, p2 = a2, ... , pk = ak such that f(p) = g(p). Since the answer may be very large, for convenience, you are only asked to output the remainder divided by (109 + 7). Input   The first line contains a positive integer T(1 <= T <= 100), which indicates the number of test cases. T lines follow. Each line contains n, k, a1, a2, a3, ... , ak. (1 <= n <= 100, 0 <= k <= n, 1 <= ai <= n and all ai are distinct.) Output   For each test case, output one line “Case #x: y”, where x is the case number (starting from 1) and y is the answer to each test case. Sample Input 2 3 0 5 2 1 4 Sample Output Case #1: 5 Case #2: 3
在c++中,在流迭代器中使用sort报错
代码如下: std::istream_iterator<int> sii(std::cin),eof; std::ostream_iterator<int> oii(std::cout," "); std::sort(sii,eof);//该行代码报错 //错误如下: 错误 2 error C2784: “'unknown-type' std::operator -(std::move_iterator<_RanIt> &,const std::move_iterator<_RanIt2> &)”: 未能从“std::istream_iterator<_Ty>”为“std::move_iterator<_RanIt> &”推导 模板 参数 e:\vs2012安装\vc\include\algorithm 3702 1 ConsoleApplication3 错误 3 error C2784: “'unknown-type' std::operator -(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)”: 未能从“std::istream_iterator<_Ty>”为“const std::reverse_iterator<_RanIt> &”推导 模板 参数 e:\vs2012安装\vc\include\algorithm 3702 1 ConsoleApplication3 错误 4 error C2784: “'unknown-type' std::operator -(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)”: 未能从“std::istream_iterator<_Ty>”为“const std::_Revranit<_RanIt,_Base> &”推导 模板 参数 e:\vs2012安装\vc\include\algorithm 3702 1 ConsoleApplication3 错误 6 error C2780: “void std::_Sort(_RanIt,_RanIt,_Diff,_Pr)”: 应输入 4 个参数,却提供了 3 个 e:\vs2012安装\vc\include\algorithm 3702 1 ConsoleApplication3 错误 5 error C2676: 二进制“-”:“std::istream_iterator<_Ty>”不定义该运算符或到预定义运算符可接收的类型的转换 e:\vs2012安装\vc\include\algorithm 3702 1 ConsoleApplication3
c++ map<string,int> 用下标访问的时候报错的问题?
``` #include<iostream> #include<string> #include<vector> #include<map> #include<algorithm> using namespace std; map<string,int> m; vector<int> v; int index=1; int main(){ int n,k; cin>>n>>k; for(int i=0;i<k;i++){ int course,m; cin>>course>>m; for(int j=0;j<m;j++){ string s; cin>>s; if(m[s]!=0){ v[m[s]].push_back(course); }else { m[s]=index; index++; v[m[s]].push_back(course); } } } } ``` 报错 22 10 D:\Dev C++\workspace\A1039.cpp [Error] no match for 'operator[]' in 'm[s]' 每一次用下标访问m[s]的时候都会报错
代码调试成功,但是数据却写入不到文件中去,我用的是VS2017,数据文件也已经放入项目中
想请问一下大家,代码运行没有报错,但是数据写入不到文件中去,请问是什么原因? 这是头文件 ``` _****#ifndef _NS_H #include<stdio.h> #include<math.h> #include<time.h> #define imax 100 #define jmax 100 #define maxit 10000 extern double ma0, a0, u0, v0, p0, t0, tr, tw, tratio, visr, xl, gamma, gascon, pr; extern double vis0; extern double cv, cp, r0, rel, e0; extern double kc0; extern double delt, yl, dx, dy; extern double dtime; extern int iter; extern int convergence; extern int t1, t2; extern double dt; extern double u[imax][jmax], v[imax][jmax], p[imax][jmax], r[imax][jmax], rl[imax][jmax], t[imax][jmax], vis[imax][jmax], ma[imax][jmax]; extern double e[imax][jmax], a[imax][jmax], kc[imax][jmax]; void bc(); void conver(); void dynvis(double tr, double tout, double visr, double visout); void mac(); void mdot(); void output(); void qcx(int i, int j, int icase, double qxout); void qcy(int i, int j, int icase, double qyout); void tauxx(int i, int j, int icase, double txx); void tauxy(int i, int j, int icase, double txy); void tauyy(int i, int j, int icase, double tyy); void thermc(double vis0, double cp, double pr, double kcout); void tstep(); #endif**_** ``` 这是主循环 ``` /* A C program of two-dimensional complete Navier-Stokes equations for the supersonic flow over a flat plate based on MacCormack's explicit time-marching technique. Written by ZhouMingming, January, 2019 Based on John D. Anderson, JR., Chapter 10, In Computational Fluid Dynamics, The Basics with Applications, McGraw-Hill, 2002, 4 */ #include"_NS_H.h" int main() { //初始化流场及各种参数 ma0 = 8; a0 = 340.28; u0 = ma0 * a0; v0 = 0; p0 = 1.01325e5; t0 = 288.16; tr = 288.16; tratio = 2; tw = t0 * tratio; visr = 1.7894e-5; xl = 0.00001; gascon = 287; gamma = 1.4; pr = 0.71; dynvis(tr, t0, visr, vis0); cv = gascon / (gamma - 1); cp = cv * gamma; r0 = p0 / (gascon * t0); e0 = cv * t0; rel = r0 * sqrt(u0*u0 + v0 * v0)*xl / vis0; thermc(vis0, cp, pr, kc0); delt = 5 * xl / sqrt(rel); yl = 5 * delt; dx = xl / (imax - 1); dy = yl / (jmax - 1); FILE *fp4; fp4 = fopen("time.txt", "w"); //主循环 t1 = clock(); for (iter = 0; iter < maxit; iter++) { if (iter == 0) { for (int i = 0; i < imax; i++) { for (int j = 0; j < jmax; j++) { u[i][j] = u0; v[i][j] = v0; p[i][j] = p0; t[i][j] = t0; r[i][j] = r0; rl[i][j] = r0; vis[i][j] = vis0; ma[i][j] = ma0; e[i][j] = e0; kc[i][j] = kc0; a[i][j] = a0; } } } //确定推进时间步长 tstep(); //使用MacCormack time marching algorithm求解 mac(); //确定是否收敛 conver(); if (convergence) { mdot(); output(); } } t2 = clock(); dt = (t2 - t1) / CLOCKS_PER_SEC; fprintf(fp4, "%f", dt); fclose(fp4); } ``` 以下是各个cpp文件 ``` #include"_NS_H.h" void bc() { //定义边界条件 //case1: at (0, 0) u[0][0] = 0; v[0][0] = 0; p[0][0] = p0; t[0][0] = t0; e[0][0] = cv * t[0][0]; r[0][0] = p[0][0] / gascon / t[0][0]; dynvis(tr, t[0][0], visr, vis[0][0]); thermc(vis[0][0], cp, pr, kc[0][0]); a[0][0] = a0; ma[0][0] = 0; //case2: at inflow and upper boundary for (int j = 1; j < jmax; j++) { u[0][j] = u0; v[0][j] = v0; p[0][j] = p0; t[0][j] = t0; e[0][j] = cv * t[0][j]; r[0][j] = p[0][j] / gascon / t[0][j]; dynvis(tr, t[0][j], visr, vis[0][j]); thermc(vis[0][j], cp, pr, kc[0][j]); a[0][j] = a0; ma[0][j] = ma0; } for (int i = 1; i < imax; i++) { u[i][jmax - 1] = u0; v[i][jmax - 1] = v0; p[i][jmax-1] = p0; t[i][jmax-1] = t0; e[i][jmax - 1] = cv * t[i][jmax - 1]; r[i][jmax-1] = p[i][jmax-1] / gascon / t[i][jmax-1]; dynvis(tr, t[i][jmax-1], visr, vis[i][jmax-1]); thermc(vis[i][jmax-1], cp, pr, kc[i][jmax-1]); a[i][jmax-1] = a0; ma[i][jmax-1] = ma0; } //case3: at lower surface boundary for (int i = 1; i < imax; i++) { u[i][0] = 0; v[i][0] = 0; p[i][0] = 2 * p[i][1] - p[i][2]; t[i][0] = tw; e[i][0] = cv * t[i][0]; r[i][0] = p[i][0] / gascon / t[i][0]; dynvis(tr, t[i][0], visr, vis[i][0]); thermc(vis[i][0], cp, pr, kc[i][0]); ``` ``` a[i][0] = sqrt(gamma*gascon*t[i][0]); ma[i][0] = sqrt(u[i][0] * u[i][0] + v[i][0] * v[i][0]) / a[i][0]; } //case4: at outflow boundary for (int j = 1; j < jmax - 1; j++) { u[imax - 1][j] = 2 * u[imax - 2][j] - u[imax - 3][j]; v[imax - 1][j] = 2 * v[imax - 2][j] - v[imax - 3][j]; p[imax - 1][j] = 2 * p[imax - 2][j] - p[imax - 3][j]; t[imax - 1][j] = 2 * t[imax - 2][j] - t[imax - 3][j]; e[imax - 1][j] = cv * t[imax - 1][j]; r[imax - 1][j] = p[imax - 1][j] / gascon / t[imax - 1][j]; dynvis(tr, t[imax - 1][j], visr, vis[imax - 1][j]); thermc(vis[imax - 1][j], cp, pr, kc[imax - 1][j]); a[imax - 1][j] = sqrt(gamma*gascon*t[imax - 1][j]); ma[imax - 1][j] = sqrt(u[imax - 1][j] * u[imax - 1][j] + v[imax - 1][j] * v[imax - 1][j]) / a[imax - 1][j]; } } ``` ``` #include"_NS_H.h" void conver() { FILE *fp1; fp1 = fopen("time.txt", "a"); double rcrit = 0; double dr; for (int i = 0; i < imax; i++) { for (int j = 0; j < jmax; j++) { dr = fabs(r[i][j] - rl[i][j]); if (rcrit < dr) { rcrit = dr; } } } if (rcrit <= 2e-6) { printf("Converence is done!"); convergence = 1; } else { fprintf(fp1, "%d ", iter); fprintf(fp1, "%f ", rcrit); fprintf(fp1, "%f ", dtime); fprintf(fp1, "\n"); fclose(fp1); for (int i = 0; i < imax; i++) { for (int j = 0; j < jmax; j++) { rl[i][j] = r[i][j]; } } convergence = 0; } } ``` ``` #include"_NS_H.h" void dynvis(double tr, double tout, double visr, double visout) { visout = visr * pow(tout / tr, 1.5); visout = visout * (tr + 110) / (tout + 110); } ``` ``` #include"_NS_H.h" double s[5][imax][jmax], f[5][imax][jmax], g[5][imax][jmax]; double sb[5][imax][jmax], sl[5][imax][jmax]; double txx[imax][jmax], txy[imax][jmax], tyy[imax][jmax]; double qx[imax][jmax], qy[imax][jmax]; void mac() { double dsdt; //使用MacCormack's algorithm更新流场变量 for (int i = 0; i < imax; i++) { for (int j = 0; j < jmax; j++) { s[0][i][j] = r[i][j]; s[1][i][j] = r[i][j] * u[i][j]; s[2][i][j] = r[i][j] * v[i][j]; s[3][i][j] = 0; s[4][i][j] = r[i][j] * (e[i][j] + 1 / 2 * (u[i][j] * u[i][j] + v[i][j] * v[i][j])); sl[0][i][j] = r[i][j]; sl[1][i][j] = r[i][j] * u[i][j]; sl[2][i][j] = r[i][j] * v[i][j]; sl[3][i][j] = 0; sl[4][i][j] = r[i][j] * (e[i][j] + 1 / 2 * (u[i][j] * u[i][j] + v[i][j] * v[i][j])); tauxx(i, j, 1, txx[i][j]); tauxy(i, j, 1, txy[i][j]); qcx(i, j, 1, qx[i][j]); f[0][i][j] = s[1][i][j]; f[1][i][j] = s[1][i][j] * s[1][i][j] / s[0][i][j] + p[i][j] - txx[i][j]; f[2][i][j] = s[1][i][j] * s[2][i][j] / s[0][i][j] - txy[i][j]; f[3][i][j] = 0; f[4][i][j] = (s[4][i][j] + p[i][j])*s[1][i][j] / s[0][i][j] + qx[i][j] - s[1][i][j] / s[0][i][j] * txx[i][j] - s[2][i][j] / s[0][i][j] * txy[i][j]; tauyy(i, j, 1, tyy[i][j]); tauxy(i, j, 3, txy[i][j]); qcy(i, j, 1, qy[i][j]); g[0][i][j] = s[2][i][j]; g[1][i][j] = s[1][i][j] * s[2][i][j] / s[0][i][j] - txy[i][j]; g[2][i][j] = s[2][i][j] * s[2][i][j] / s[0][i][j] + p[i][j] - tyy[i][j]; g[3][i][j] = 0; g[4][i][j] = (s[4][i][j] + p[i][j])*s[2][i][j] / s[0][i][j] + qy[i][j] - s[1][i][j] / s[0][i][j] * txy[i][j] - s[2][i][j] / s[0][i][j] * tyy[i][j]; } } //预测步 for (int i = 1; i < imax - 1; i++) { for (int j = 1; j < jmax - 1; j++) { for (int k = 0; k < 5; k++) { dsdt = (f[k][i][j] - f[k][i + 1][j]) / dx + (g[k][i][j] - g[k][i][j + 1]) / dy; sb[k][i][j] = s[k][i][j] + dsdt * dtime; } //decode the variables r[i][j] = sb[0][i][j]; u[i][j] = sb[1][i][j] / sb[0][i][j]; v[i][j] = sb[2][i][j] / sb[0][i][j]; e[i][j] = sb[4][i][j] / sb[0][i][j] - 0.5*v[i][j] * v[i][j]; if (e[i][j] < 0) { e[i][j] = 0; } t[i][j] = e[i][j] / cv; p[i][j] = r[i][j] * gascon*t[i][j]; dynvis(tr, t[i][j], visr, vis[i][j]); thermc(vis[i][j], cp, pr, kc[i][j]); a[i][j] = sqrt(gamma*gascon*t[i][j]); ma[i][j] = v[i][j] / a[i][j]; } } //更新边界条件 bc(); //使用MacCormack's algorithm更新流场变量 for (int i = 0; i < imax; i++) { for (int j = 0; j < jmax; j++) { s[0][i][j] = r[i][j]; s[1][i][j] = r[i][j] * u[i][j]; s[2][i][j] = r[i][j] * v[i][j]; s[3][i][j] = 0; s[4][i][j] = r[i][j] * (e[i][j] + 1 / 2 * (u[i][j] * u[i][j] + v[i][j] * v[i][j])); tauxx(i, j, 2, txx[i][j]); tauxy(i, j, 2, txy[i][j]); qcx(i, j, 2, qx[i][j]); f[0][i][j] = s[1][i][j]; f[1][i][j] = s[1][i][j] * s[1][i][j] / s[0][i][j] + p[i][j] - txx[i][j]; f[2][i][j] = s[1][i][j] * s[2][i][j] / s[0][i][j] - txy[i][j]; f[3][i][j] = 0; f[4][i][j] = (s[4][i][j] + p[i][j])*s[1][i][j] / s[0][i][j] + qx[i][j] - s[1][i][j] / s[0][i][j] * txx[i][j] - s[2][i][j] / s[0][i][j] * txy[i][j]; tauyy(i, j, 2, tyy[i][j]); tauxy(i, j, 4, txy[i][j]); qcy(i, j, 2, qy[i][j]); g[0][i][j] = s[2][i][j]; g[1][i][j] = s[1][i][j] * s[2][i][j] / s[0][i][j] - txy[i][j]; g[2][i][j] = s[2][i][j] * s[2][i][j] / s[0][i][j] + p[i][j] - tyy[i][j]; g[3][i][j] = 0; g[4][i][j] = (s[4][i][j] + p[i][j])*s[2][i][j] / s[0][i][j] + qy[i][j] - s[1][i][j] / s[0][i][j] * txy[i][j] - s[2][i][j] / s[0][i][j] * tyy[i][j]; } } //修正步 for (int i = 1; i < imax - 1; i++) { for (int j = 1; j < jmax - 1; j++) { for (int k = 0; k < 5; k++) { dsdt = (f[i - 1][j][k] - f[i][j][k]) / dx + (g[i][j - 1][k] - g[i][j][k]) / dy; s[i][j][k] = 0.5*(sl[i][j][k] + sb[i][j][k] + dtime * dsdt); } //decode the variables r[i][j] = sb[0][i][j]; u[i][j] = sb[1][i][j] / sb[0][i][j]; v[i][j] = sb[2][i][j] / sb[0][i][j]; e[i][j] = sb[4][i][j] / sb[0][i][j] - 0.5*v[i][j] * v[i][j]; if (e[i][j] < 0) { e[i][j] = 0; } t[i][j] = e[i][j] / cv; p[i][j] = r[i][j] * gascon*t[i][j]; dynvis(tr, t[i][j], visr, vis[i][j]); thermc(vis[i][j], cp, pr, kc[i][j]); a[i][j] = sqrt(gamma*gascon*t[i][j]); ma[i][j] = v[i][j] / a[i][j]; } } //更新边界条件 bc(); } ``` ``` #include"_NS_H.h" void mdot() { //检查质量守恒是否成立 FILE *fp3; fp3 = fopen("dmass.txt", "a"); double massin = 0.0, massout = 0.0; double dmass; for (int j = 0; j < jmax; j++) { massin += r[0][j] * u[0][j]; massout += r[imax - 1][j] * u[imax - 1][j]; } dmass = fabs(massout - massin) / massin * 100; if (dmass > 1.0) { fprintf(fp3, "%f ", dmass); fprintf(fp3, "\n"); fclose(fp3); } } ``` ``` #include"_NS_H.h" void output() { double x[imax], y[jmax]; FILE *fp2; fp2 = fopen("output.txt", "a"); for (int i = 0; i < imax; i++) { x[i] = dx * i; } for (int j = 0; j < jmax; j++) { y[j] = dy * j; } for (int i = 0; i < imax; i++) { for (int j = 0; j < jmax; j++) { fprintf(fp2, "%f ", x[i]); fprintf(fp2, "%f ", y[i]); fprintf(fp2, "%f ", u[i][j] / u0); fprintf(fp2, "%f ", v[i][j]); fprintf(fp2, "%f ", p[i][j] / p0); fprintf(fp2, "%f ", t[i][j] / t0); fprintf(fp2, "%f ", r[i][j] / r0); fprintf(fp2, "%f ", a[i][j]); fprintf(fp2, "%f ", ma[i][j]); fprintf(fp2, "\n"); } } fclose(fp2); } ``` ``` #include"_NS_H.h" void qcx(int i, int j, int icase, double qxout) { double dtdx; switch (icase) { //向前差分时 case 1: if (i == 0) { dtdx = (t[1][j] - t[0][j]) / dx; } else { dtdx = (t[i][j] - t[i - 1][j]) / dx; } break; //向后差分时 case 2: if (i == imax - 1) { dtdx = (t[imax - 1][j] - t[imax - 2][j]) / dx; } else { dtdx = (t[i + 1][j] - t[i][j]) / dx; } break; } qxout = -1 * kc[i][j] * dtdx; } ``` ``` #include"_NS_H.h" void qcy(int i, int j, int icase, double qyout) { double dtdy; switch (icase) { //向前差分时 case 1: if (j == 0) { dtdy = (t[i][1] - t[i][0]) / dy; } else { dtdy = (t[i][j] - t[i][j - 1]) / dy; } break; //向后差分时 case 2: if (j == jmax - 1) { dtdy = (t[i][jmax-1] - t[i][jmax-2]) / dy; } else { dtdy = (t[i][j+1] - t[i][j]) / dy; } break; } qyout = -1 * kc[i][j] * dtdy; } ``` ``` #include"_NS_H.h" void tauxx(int i, int j, int icase, double txx) { double dudx, dvdy; switch (icase) { //dF/dX为向前差分 case 1: if (j == 0) { dvdy = (v[i][1] - v[i][0]) / dy; } else if (j == jmax - 1) { dvdy = (v[i][jmax - 1] - v[i][jmax - 2]) / dy; } else { dvdy = (v[i][j + 1] - v[i][j - 1]) / 2 / dy; } if (i == 0) { dudx = (u[1][j] - u[0][j]) / dx; } else { dudx = (u[i][j] - u[i - 1][j]) / dx; } break; //dF/dX为向后差分 case 2: if (j == 0) { dvdy = (v[i][1] - v[i][0]) / dy; } else if (j == jmax - 1) { dvdy = (v[i][jmax - 1] - v[i][jmax - 2]) / dy; } else { dvdy = (v[i][j + 1] - v[i][j - 1]) / 2 / dy; } if (i == imax-1) { dudx = (u[imax - 1][j] - u[imax - 2][j]) / dx; } else { dudx = (u[i + 1][j] - u[i][j]) / dx; } break; } txx = vis[i][j] * (4 / 3 * dudx - 2 / 3 * dvdy); } ``` ``` #include"_NS_H.h" void tauxy(int i, int j, int icase, double txy) { double dudy, dvdx; switch (icase) { //dF/dX为向前差分 case 1: if (j == 0) { dudy = (u[i][1] - u[i][0]) / dy; } else if (j == jmax - 1) { dudy = (u[i][jmax - 1] - u[i][jmax - 2]) / dy; } else { dudy = (u[i][j + 1] - u[i][j - 1]) / 2 / dy; } if (i == 0) { dvdx = (v[1][j] - v[0][j]) / dx; } else { dvdx = (v[i][j] - v[i - 1][j]) / dx; } break; //dF/dX为向后差分 case 2: if (j == 0) { dudy = (u[i][1] - u[i][0]) / dy; } else if (j == jmax - 1) { dudy = (u[i][jmax - 1] - u[i][jmax - 2]) / dy; } else { dudy = (u[i][j + 1] - u[i][j - 1]) / 2 / dy; } if (i == imax - 1) { dvdx = (v[imax - 1][j] - v[imax - 2][j]) / dx; } else { dvdx = (v[i + 1][j] - v[i][j]) / dx; } break; //dG/dy为向前差分 case 3: if (i == 0) { dvdx = (v[1][j] - v[0][j]) / dx; } else if (i == imax - 1) { dvdx = (v[imax - 1][j] - v[imax - 2][j]) / dx; } else { dvdx = (v[i + 1][j] - v[i - 1][j]) / 2 / dx; } if (j == 0) { dudy = (u[i][1] - u[i][0]) / dy; } else { dudy = (u[i][j] - u[i][j - 1]) / dy; } break; //dG/dy为向后差分 case 4: if (i == 0) { dvdx = (v[1][j] - v[0][j]) / dx; } else if (i == imax - 1) { dvdx = (v[imax - 1][j] - v[imax - 2][j]) / dx; } else { dvdx = (v[i + 1][j] - v[i - 1][j]) / 2 / dx; } if (j == jmax-1) { dudy = (u[i][jmax - 1] - u[i][jmax - 2]) / dy; } else { dudy = (u[i][j + 1] - u[i][j]) / dy; } break; } txy = vis[i][j] * (dudy + dvdx); } ``` ``` #include"_NS_H.h" void tauyy(int i, int j, int icase, double tyy) { double dudx, dvdy; switch (icase) { //dG/dy为向前差分 case 1: if (i == 0) { dudx = (u[1][j] - u[0][j]) / dx; } else if (i == imax-1) { dudx = (u[imax - 1][j] - u[imax - 2][j]) / dx; } else { dudx = (u[i + 1][j] - u[i - 1][j]) / 2 / dx; } if (j == 0) { dvdy = (v[i][1] - v[i][0]) / dy; } else { dvdy = (v[i][j] - v[i][j - 1]) / dy; } break; //dG/dy为向后差分 case 2: if (i == 0) { dudx = (u[1][j] - u[0][j]) / dx; } else if (i == imax - 1) { dudx = (u[imax - 1][j] - u[imax - 2][j]) / dx; } else { dudx = (u[i + 1][j] - u[i - 1][j]) / 2 / dx; } if (j == jmax - 1) { dvdy = (v[i][jmax - 1] - v[i][jmax - 2]) / dy; } else { dvdy = (v[i][j + 1] - v[i][j]) / dy; } break; } tyy = vis[i][j] * (4 / 3 * dvdy - 2 / 3 * dudx); } ``` ``` #include"_NS_H.h" void thermc(double vis0, double cp, double pr, double kcout) { kcout = vis0 * cp / pr; } ``` ``` #include"_NS_H.h" double vv[imax][jmax], dtt[imax][jmax]; double rex[imax][jmax], rey[imax][jmax]; void tstep() { double vvmax = 0; double dt1, dt2, dt3; double dtmin = 1; double tf = 0.5; double rexmax = 0, reymax = 0; for (int i = 1; i < imax - 1; i++) { for (int j = 1; j < jmax - 1; j++) { vv[i][j] = 4 / 3*gamma*vis[i][j] * vis[i][j] / pr / r[i][j]; rex[i][j] = r[i][j] * u[i][j] * dx / vis[i][j]; rey[i][j] = r[i][j] * v[i][j] * dy / vis[i][j]; if (rexmax < rex[i][j]) { rexmax = rex[i][j]; } if (reymax < rey[i][j]) { reymax = rey[i][j]; } if (vvmax < vv[i][j]) { vvmax = vv[i][j]; } } } for (int i = 1; i < imax - 1; i++) { for (int j = 1; j < jmax - 1; j++) { dt1 = sqrt(u[i][j]) / dx + sqrt(v[i][j]) / dy; dt2 = dt1 + a[i][j] * sqrt(1 / (dx*dx) + 1 / (dy*dy)); dt3 = dt2 + 2 * vvmax*(1 / dx / dx + 1 / dy / dy); dtt[i][j] = 1 / dt3; if (dtmin > dtt[i][j]) { dtmin = dtt[i][j]; } } } dtime = tf * dtmin; } ```
java中的 DES 加密与解密
DES类 ---------------- package dao; import java.security.Security; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; public class DES { public static String ALGORITHM_DES="DES"; //加密算法的名称 public static KeyGenerator keygen; //密钥生成器 public static SecretKey secretKey; //密钥 public static Cipher cipher; //密码器 public byte[] bytes; static{ Security.addProvider(new com.sun.crypto.provider.SunJCE()); try{ keygen=KeyGenerator.getInstance(ALGORITHM_DES); secretKey=keygen.generateKey(); cipher=Cipher.getInstance(ALGORITHM_DES); }catch(Exception e){ e.printStackTrace(); } } //加密 public byte[] encryptor(String str){ try { cipher.init(Cipher.ENCRYPT_MODE, secretKey); //初始化密码器,用密钥 secretKey 进入加密模式 bytes=cipher.doFinal(str.getBytes()); //加密 } catch (Exception e) { e.printStackTrace(); } return bytes; } //解密 public String decryptor(byte[] buff){ try { cipher.init(Cipher.DECRYPT_MODE, secretKey); //初始化密码器,用密钥 secretKey 进入解密模式 bytes=cipher.doFinal(buff); } catch (Exception e) { e.printStackTrace(); } return (new String(bytes)); } } index.jsp ----------- ![index.jsp](https://img-ask.csdn.net/upload/201602/23/1456203162_827018.png) %> <a href="productAction-query?product_id=<%=des.encryptor(test) %>" target="_blank">Demo</a> Action类 ----------------------- ![Action类](https://img-ask.csdn.net/upload/201602/23/1456203135_614689.png) 我的问题:在 index.jsp 页面里提交的超链接 Demo 提交到 Action ,但是一点击,后台就报错: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:750) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676) at com.sun.crypto.provider.DESCipher.engineDoFinal(DESCipher.java:314) at javax.crypto.Cipher.doFinal(Cipher.java:2087) at dao.DES.decryptor(DES.java:44) at filter.MyFilter.doFilter(MyFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) java.lang.NullPointerException at java.lang.String.<init>(Unknown Source) at dao.DES.decryptor(DES.java:48) at filter.MyFilter.doFilter(MyFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) 解密前:product_id=[B@3242ef 是哪里写的不对,请高手指点,我的目的是从 index.jsp 把值(product_id)进行加密,在 Action 里面取出 加密后的字符串,进行解密,但解密那一块有问题,可能是 DES 类写的有问题,请高手帮忙在原有的代码基础上修改。成分感激!!
相见恨晚的超实用网站
搞学习 知乎:www.zhihu.com 简答题:http://www.jiandati.com/ 网易公开课:https://open.163.com/ted/ 网易云课堂:https://study.163.com/ 中国大学MOOC:www.icourse163.org 网易云课堂:study.163.com 哔哩哔哩弹幕网:www.bilibili.com 我要自学网:www.51zxw
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载    点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量 path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。
字节跳动视频编解码面经
引言 本文主要是记录一下面试字节跳动的经历。 三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时
开源一个功能完整的SpringBoot项目框架
福利来了,给大家带来一个福利。 最近想了解一下有关Spring Boot的开源项目,看了很多开源的框架,大多是一些demo或者是一个未成形的项目,基本功能都不完整,尤其是用户权限和菜单方面几乎没有完整的。 想到我之前做的框架,里面通用模块有:用户模块,权限模块,菜单模块,功能模块也齐全了,每一个功能都是完整的。 打算把这个框架分享出来,供大家使用和学习。 为什么用框架? 框架可以学习整体
源码阅读(19):Java中主要的Map结构——HashMap容器(下1)
(接上文《源码阅读(18):Java中主要的Map结构——HashMap容器(中)》) 3.4.4、HashMap添加K-V键值对(红黑树方式) 上文我们介绍了在HashMap中table数组的某个索引位上,基于单向链表添加新的K-V键值对对象(HashMap.Node&lt;K, V&gt;类的实例),但是我们同时知道在某些的场景下,HashMap中table数据的某个索引位上,数据是按照红黑树
c++制作的植物大战僵尸,开源,一代二代结合游戏
    此游戏全部由本人自己制作完成。游戏大部分的素材来源于原版游戏素材,少部分搜集于网络,以及自己制作。 此游戏为同人游戏而且仅供学习交流使用,任何人未经授权,不得对本游戏进行更改、盗用等,否则后果自负。 目前有六种僵尸和六种植物,植物和僵尸的动画都是本人做的。qq:2117610943 开源代码下载 提取码:3vzm 点击下载--&gt; 11月28日 新增四种植物 统一植物画风,全部修
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Python 基础(一):入门必备知识
目录1 标识符2 关键字3 引号4 编码5 输入输出6 缩进7 多行8 注释9 数据类型10 运算符10.1 常用运算符10.2 运算符优先级 1 标识符 标识符是编程时使用的名字,用于给变量、函数、语句块等命名,Python 中标识符由字母、数字、下划线组成,不能以数字开头,区分大小写。 以下划线开头的标识符有特殊含义,单下划线开头的标识符,如:_xxx ,表示不能直接访问的类属性,需通过类提供
深度学习图像算法在内容安全领域的应用
互联网给人们生活带来便利的同时也隐含了大量不良信息,防范互联网平台有害内容传播引起了多方面的高度关注。本次演讲从技术层面分享网易易盾在内容安全领域的算法实践经验,包括深度学习图
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看
项目中的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是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法,并会持续更新。
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
"狗屁不通文章生成器"登顶GitHub热榜,分分钟写出万字形式主义大作
GitHub 被誉为全球最大的同性交友网站,……,陪伴我们已经走过 10+ 年时间,它托管了大量的软件代码,同时也承载了程序员无尽的欢乐。 万字申请,废话报告,魔幻形式主义大作怎么写?兄dei,狗屁不通文章生成器了解一下。这个富有灵魂的项目名吸引了众人的目光。项目仅仅诞生一周,便冲上了GitHub趋势榜榜首(Js中文网 -前端进阶资源教程)、是榜首哦
推荐几款比较实用的工具,网站
1.盘百度PanDownload 这个云盘工具是免费的,可以进行资源搜索,提速(偶尔会抽风????) 不要去某站买付费的???? PanDownload下载地址 2.BeJSON 这是一款拥有各种在线工具的网站,推荐它的主要原因是网站简洁,功能齐全,广告相比其他广告好太多了 bejson网站 3.二维码美化 这个网站的二维码美化很好看,网站界面也很...
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
相关热词 c# 输入ip c# 乱码 报表 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件
立即提问