对于.INI文件的加密问题?

我安装了一个用VB编写的小程序,安装后产生了两个INI文件,我想把这两个文件加密,软件运行还能读取的那种加密。求个大牛。

3个回答

自己写个简单的加密算法,或使用开源的加密算法也行。
你的小程序去读取加密后的 INI 文件,然后在程序中解密得到实际的数据。

u011055524
Junyov 你好,这个加密代码是在安装前写还是安装后写的,安装后已经没有没有写VB程序的文件了怎么办。
大约 5 年之前 回复

你可以把INI文件的值部分加密,KEY部分还是保留
加密要求不高的话,就用DES等简单的对称加解密算法,写入的时候加密后写入,读出的时候读出再解密

oyljerry
oyljerry 回复u011055524: 那你就在拷贝文件前写
大约 5 年之前 回复
u011055524
Junyov 你好,这个加密代码是在安装前写还是安装后写的,安装后已经没有没有写VB程序的文件了怎么办。
大约 5 年之前 回复

用MSXML2吧,INI文件加密后还必须解密成明文文件才能用,xml直接在内存中解密后载入就行了,
毕竟xml灵活性比ini要好很多,推荐使用RtlCompressBuffer+RtlDecompressBuffer+RtlGetCompressionWorkSpaceSize
用法就自己百度一下

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
关于MFC中对ini文件的加密
以下是我使用的加密函数, 对ini中的文本进行了加密和解密 但是解密函数调用后解密的文字有的文本会成功,有的解密一部分就乱码了 然后工程是使用的多字节文本 请各位大神帮忙看看 !感激不尽 CString Encrypt(CString S, WORD Key) //加密函数 { CString Result, str; int i, j; Result = S; //初始化结果字符串 for (i = 0; i < S.GetLength(); i++) //依次对字符串中各字符进行操作 { Result.SetAt(i, S.GetAt(i) ^ (Key >> 8)); //将密钥移位后与字符异或 Key = ((BYTE)Result.GetAt(i) + Key)*C1 + C2; //产生下一个密钥 } S = Result; //保存结果 Result.Empty(); //清除结果 for ( i = 0; i < S.GetLength(); i++) //对加密结果进行转换 { j = (BYTE)S.GetAt(i);//提取字符 str = "12"; //设置str长度为2 str.SetAt(0, 100+ j / 26); //65可以改的更大 变乱码 str.SetAt(1, 100+ j % 26); Result += str; } return Result; } CString Decrypt(CString S, WORD Key) //解密函数 { CString Result, str; int i, j; Result.Empty(); //清除结果 for (i = 0; i < S.GetLength() / 2; i++) //将字符串俩个一组 { j = (((BYTE)S.GetAt(2 * i) - 100) * 26); //必须与加密一致 j += (BYTE)S.GetAt(2 * i + 1) - 100; str = "1";//设置str长度为1 str.SetAt(0,j); Result += str; } S = Result;//保存中间结果 for (i = 0; i <S.GetLength(); i++) { Result.SetAt(i, (BYTE)S.GetAt(i) ^ (Key >> 8)); //将密钥 Key = ((BYTE)S.GetAt(i) + Key)*C1 + C2; } return Result; } 以下是提取文本的函数 CString text1, text2, text3, text4, text5, text6; GetPrivateProfileString("01", "text", NULL, text1.GetBuffer(10000), 10000, "ini\\content.ini"); GetPrivateProfileString("02", "text", NULL, text2.GetBuffer(10000), 10000, "ini\\content.ini"); GetPrivateProfileString("03", "text", NULL, text3.GetBuffer(10000), 10000, "ini\\content.ini"); GetPrivateProfileString("04", "text", NULL, text4.GetBuffer(10000), 10000, "ini\\content.ini"); GetPrivateProfileString("05", "text", NULL, text5.GetBuffer(10000), 10000, "ini\\content.ini"); GetPrivateProfileString("06", "text", NULL, text6.GetBuffer(10000), 10000, "ini\\content.ini"); text1.ReleaseBuffer(); text2.ReleaseBuffer(); text3.ReleaseBuffer(); text4.ReleaseBuffer(); text5.ReleaseBuffer(); text6.ReleaseBuffer(); CString AddKeyStr = Encrypt(text1, key); WritePrivateProfileString("01", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Encrypt(text2, key); WritePrivateProfileString("02", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Encrypt(text3, key); WritePrivateProfileString("03", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Encrypt(text4, key); WritePrivateProfileString("04", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Encrypt(text5, key); WritePrivateProfileString("05", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Encrypt(text6, key); WritePrivateProfileString("06", "text", AddKeyStr, "ini\\content1.ini"); //加密 CString text1, text2, text3, text4, text5, text6; GetPrivateProfileString("01", "text", NULL, text1.GetBuffer(10000), 10000, "ini\\content1.ini"); GetPrivateProfileString("02", "text", NULL, text2.GetBuffer(10000), 10000, "ini\\content1.ini"); GetPrivateProfileString("03", "text", NULL, text3.GetBuffer(10000), 10000, "ini\\content1.ini"); GetPrivateProfileString("04", "text", NULL, text4.GetBuffer(10000), 10000, "ini\\content1.ini"); GetPrivateProfileString("05", "text", NULL, text5.GetBuffer(10000), 10000, "ini\\content1.ini"); GetPrivateProfileString("06", "text", NULL, text6.GetBuffer(10000), 10000, "ini\\content1.ini"); text1.ReleaseBuffer(); text2.ReleaseBuffer(); text3.ReleaseBuffer(); text4.ReleaseBuffer(); text5.ReleaseBuffer(); text6.ReleaseBuffer(); CString AddKeyStr = Decrypt(text1, key); WritePrivateProfileString("01", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Decrypt(text2, key); WritePrivateProfileString("02", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Decrypt(text3, key); WritePrivateProfileString("03", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Decrypt(text4, key); WritePrivateProfileString("04", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Decrypt(text5, key); WritePrivateProfileString("05", "text", AddKeyStr, "ini\\content1.ini"); AddKeyStr = ""; AddKeyStr = Decrypt(text6, key); WritePrivateProfileString("06", "text", AddKeyStr, "ini\\content1.ini"); //解密
关于winform把密码文件保存到本地 明文加密的问题
File.WriteAllText("setting.ini", textBox1.Text + "," + textBox2.Text); 这句代码是把文本框中的 密码 以明文的方式保存在程序目录下 怎么样 在保存的时候给它加密 在使用正确密码的时候 从setting.ini中读取出来 再解密 加密方式用md5 或者AES 其他的 都可以 请指教!
INI配置文件加密成MRD文件,用什么第三方工具可以解密?
INI配置文件加密成MRD文件,用什么第三方工具可以解密? BCB开发的App中遇到这个问题,想修改一下相应的配置文件,但是MRD文件无法直接修改,想借助第三方工具来解密,修改后再加密。原App没有相关交接资料。
端游客户端登录器,读取列表文件,加密求助!
有个客户端,每次打开登录器,主动读取,loginserver.ini文件获取列表,我通过OD,获取了该文件的明文数据,但是现在修改成我自己的列表以后,登录器不读取,判断,登录器需要读取加密方式的内容,求教给位大神,这个文件是什么方式加密的! 文件下载地址:http://www.ztfeng.net/loginserver.rar
问一个关于虚幻3的问题
就是虚幻3的目录下Config文件夹里的ini文件是加密的,应该是压缩加密的,我有一个未加密前的是910KB,被加密后的只有75KB左右,目前还不知道加密的算法是什么,有大神能通过对比破解吗?
Submitted credentials for token did not match the expected credentials.
在做shiro+sqlserver时,碰到的不知道什么问题,百度说是密码不对,可是我也试过md5加密,也没能解决 java方法 ``` package skt; import org.apache.shiro.config.IniSecurityManagerFactory; import org.apache.shiro.util.Factory; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.subject.Subject; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.UsernamePasswordToken; public class ShiroSqlTest { public static void main(String[] args) { Factory<SecurityManager> factory= new IniSecurityManagerFactory("classpath:shiro-sql.ini"); SecurityManager securityManager=factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); Subject subject=SecurityUtils.getSubject(); UsernamePasswordToken token=new UsernamePasswordToken("admin@shiro.com","admin"); try{ subject.login(token); System.out.println("登录成功"); if(subject.hasRole("admin")){ System.out.println("有admin角色"); } else{ System.out.println("没有admin角色"); } if(subject.isPermitted("search")){ System.out.println("有search权限"); } else{ System.out.println("没有search权限"); } if(subject.isPermittedAll("del","update")){ System.out.println("有del,update权限"); } else{ System.out.println("没有del,update权限"); } }catch(AuthenticationException e){ e.printStackTrace(); System.out.println("登录失败"); } } } ``` ini文件配置 [main] dataSource=org.springframework.jdbc.datasource.DriverManagerDataSource dataSource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver dataSource.url=jdbc:sqlserver://localhost:1433;DatabaseName=Rol dataSource.username=sa dataSource.password=************ jdbcRealm=org.apache.shiro.realm.jdbc.JdbcRealm jdbcRealm.permissionsLookupEnabled=true jdbcRealm.dataSource=$dataSource jdbcRealm.authenticationQuery=select Password from Users where Username=? jdbcRealm.userRolesQuery=select Userrole from Role where Username=? jdbcRealm.permissionsQuery=select Permname from Permission where Rolename=? securityManager.realms=$jdbcRealm 报错信息 ``` SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 六月 15, 2019 11:15:06 上午 org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName 信息: Loaded JDBC driver: com.microsoft.sqlserver.jdbc.SQLServerDriver org.apache.shiro.authc.IncorrectCredentialsException: Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - admin@shiro.com, rememberMe=false] did not match the expected credentials. at org.apache.shiro.realm.AuthenticatingRealm.assertCredentialsMatch(AuthenticatingRealm.java:600) at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:578) at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180) at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267) at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198) at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106) at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270) at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256) at skt.ShiroSqlTest.main(ShiroSqlTest.java:22) 登录失败 ```
qt 运行出来的框图有残缺
# cpp文件 ``` #include "vsbak.h" #include "ui_vsbak.h" #include <QSettings> #include <QFileDialog> #include<QTime> #include<QtDebug> #include <QMessageBox> #define CONFIG_FILE "config.ini" const QString EXCLUDE_FILE = "/home/hu/project2";// 這個文件沒啥用 Vsbak::Vsbak(QWidget *parent) : QWidget(parent) , ui(new Ui::Vsbak) { ui->setupUi(this); QSettings *configIniRead = new QSettings(CONFIG_FILE, QSettings::IniFormat); dir_src = configIniRead->value("/main/bak_src").toString(); dir_dest = configIniRead->value("/main/bak_dest").toString(); // 配置文件里面有目标地址 gpg_key = configIniRead->value("/main/gpg_key").toString(); exclude_from = configIniRead->value("exclude/exclude").toString(); delete configIniRead; // init bash terminal //QProcess可以用于启动外部程序 cmd = new QProcess(this);// 因为与父类直接释放内存 // Sets the working directory to dir. QProcess will start the process in this directory. //The default behavior is to start the process in the working directory of the calling process. cmd->setWorkingDirectory(dir_src); //This signal is emitted when the process has made new data available //through its standard output channel (stdout). It is emitted regardless of the current read channel. connect(cmd, &QProcess::readyReadStandardOutput, this, &Vsbak::on_readyReadStandardOutput); connect(cmd, &QProcess::readyReadStandardError, this, &Vsbak::on_readyReadStandardError); ui->lineEdit->setText(dir_src); ui->lineEdit_2->setText(dir_dest); // 在ui里直接设置这个地址 // init comboBox init_comboBox(); // init radiobutton: choice full ui->radioButton->setChecked(true); ui->checkBox->setChecked(false); ui->checkBox_2->setEnabled(false); ui->checkBox_3->setEnabled(false); } /* * 设置最大可见数目为5,是不是不合理? */ void Vsbak::init_comboBox() // 找压缩好的文件 Combobox 下拉菜单 { /* * 1. 用一个对象进入dir-dest目录下 * 2. 过滤掉包含后追的文件 * 3. 获取被过滤的文件理解 */ // find all backup.tar.gz files //The QDir class provides access to directory structures and their contents. 不仅能看到结构,还可以看到目录 QDir *curDir = new QDir(dir_dest); //The QStringList class provides a list of strings. //可以让你提取一个新的列表只包含这些字符串包含一个特定的字符串(或匹配特定正则表达式) QStringList filter; // 过渡成一个目录 filter << "*.tar.gz" << "*.tar.gz.gpg"; curDir->setNameFilters(filter); // 过滤掉特定的目录下的文件 //Returns a list of QFileInfo objects for all the files and directories in the directory //QDir::entryInfoList()会获取该目录下所有目录和文件的QFileInfo对象的列表 QList<QFileInfo> *tarFileInfo = new QList<QFileInfo>(curDir->entryInfoList(filter)); /* * dir_dest 里面存放的其实都是被压缩的文件,所以用上面的后缀直接进行过滤 * 1. 设置最大的可见数目为5 * 2. 看目录里面有多少,然后放入这个comboBox * 3. 获取被过滤的文件 * 4. 按照顺序放入到combobox中 */ ui->comboBox->clear(); ui->comboBox->setMaxVisibleItems(5); // 最大可见数目 5 //The string will be inserted as the first item in the combobox. ui->comboBox->setInsertPolicy(QComboBox::InsertAtTop); for (int i=0; i< tarFileInfo->count(); i++)// count()只是计算里面的数量,tarFileinfo实际上是一个文件列表 ui->comboBox->addItem(tarFileInfo->at(i).fileName()); } Vsbak::~Vsbak() { delete ui; // 有何作用 if(cmd->state() == QProcess::Running){ cmd->terminate(); cmd->waitForFinished(); } } void Vsbak::on_readyReadStandardOutput() { // QString out = QString::fromLocal8Bit(cmd->readAllStandardOutput()); // ui->label_4->setText(out); } void Vsbak::on_readyReadStandardError() { QMessageBox::information(0, "Error", cmd->readAllStandardError()); } // change dir_src void Vsbak::on_toolButton_clicked() { /* * 1. 或许dir_src的文件目录名称 * 2. 将dir_src的文件目录名写到lineEdit上面 * 3. 更新配置文件里面的信息 * 4. 设置工作目录 * */ QString dirname; dirname = QFileDialog::getExistingDirectory(this, tr("Open Directory"), dir_src, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(dirname.isEmpty()) return; else { dir_src = dirname; ui->lineEdit->setText(dir_src); QSettings *configIniWrite = new QSettings(CONFIG_FILE, QSettings::IniFormat); configIniWrite->setValue("/main/bak_src", dir_src); delete configIniWrite; cmd->setWorkingDirectory(dir_src); ui->label_4->setText("change source dir sucess!"); } } // change dir_dest void Vsbak::on_toolButton_2_clicked() { QString dirname; // getExistingDirectory 只获取文件夹 dirname = QFileDialog::getExistingDirectory(this, tr("Open Directory"), dir_dest, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(dirname.isEmpty()) return; else { dir_dest = dirname; ui->lineEdit_2->setText(dir_dest); QSettings *configIniWrite = new QSettings(CONFIG_FILE, QSettings::IniFormat); configIniWrite->setValue("/main/bak_dest", dir_dest); delete configIniWrite; ui->label_4->setText("change dest dir sucess!"); } } int Vsbak::get_min(QDateTime curTime) { QSettings *configIniReadWrite = new QSettings(CONFIG_FILE, QSettings::IniFormat); int lastTime = configIniReadWrite->value("/main/last_time").toInt();// 将值转化成整形 configIniReadWrite->setValue("/main/last_time", curTime.toTime_t()); delete configIniReadWrite; int minDiff = (curTime.toTime_t()-lastTime) / 60 + 1; return minDiff; } void Vsbak::on_checkBox_clicked() { if(ui->checkBox->isChecked()){ ui->checkBox_2->setEnabled(true); ui->checkBox_3->setEnabled(true); } else{ ui->checkBox_2->setEnabled(false); ui->checkBox_3->setEnabled(false); } } /* * 3 个 String类型 * targz:time + full.tar.gz * cmd_find:find ./ -type f | grep -v \'Permission denied\' > TEPLIST * cmd_tar *目录列表 * * * */ void Vsbak::on_pushButton_clicked(){ // The QDateTime class provides date and time functions. // 调用QDatetime里面的一个函数,赋给另一个QDatetime的类型 QDateTime current_date_time = QDateTime::currentDateTime(); // 初始化三个String类型 QString targz, cmd_find, cmd_tar; //RadioButton presents an option button that can be toggled on (checked) or off (unchecked). //Radio buttons are typically used to select one option from a set of options. //Use isChecked() to see if a particular button is selected. if(ui->radioButton->isChecked()){ // 如果radiobutton 被选择了,那么就进行备份,如果没有就只输出时间 // Linux find命令用来在指定目录下查找文件。 // 将目前目录其其下子目录中所有一般文件列出 # find . -type f // Linux grep 命令用于查找文件里符合条件的字符串。 // -v 或 --revert-match : 显示不包含匹配文本的所有行。 // 反向查找。前面各个例子是查找并打印出符合条件的行,通过"-v"参数可以打印出不符合条件行的内容。 // ./ 表示当前目录的全路径 当前目录的全路径 没有这个 \'Permission denied\'???? //linux的命令,查找文件然后设置权限 // 这个是不管修改不修改,全部列出来 cmd_find = "find ./ -type f | grep -v \'Permission denied\' > TEPLIST";// 这个功能是什么呢 targz = current_date_time.toString("yyyy-MM-dd_hh.mm.ss") + ".full.tar.gz"; }else{ // 会替换掉前面的百分之1,替换规则是从小到大 //get_min是一个函数,看它具体怎么实现的,应该是循环遍历了current_date_time,找到最小???? int minDiff = get_min(current_date_time); // 获得是最小的查值 // 完成命令,把距离最新一次全部修改的文件单独列出来 cmd_find = QString("find ./ -mmin -%1 -type f | grep -v \'Permission denied\' > TEPLIST").arg(minDiff); targz = current_date_time.toString("yyyy-MM-dd_hh.mm.ss") + ".inc.tar.gz"; } // exclude from 是一个配置目录 // tar命令 //-v或--verbose 显示指令执行过程 // --totals 备份文件建立后,列出文件大小 //cmd_tar这是压缩tar的linux命令,将exclude里面的文件全部列出来,进行压缩 cmd_tar = QString("tar --verbose --totals --exclude-vcs %1 --files-from=TEPLIST -czf %2/%3").arg(exclude_from).arg(dir_dest).arg(targz);//?5 // 向调试器输出命令的执行结果,方便调试排错 qDebug()<< cmd_find << endl << cmd_tar<< endl; // 下面整个过程就是执行这个命令 QStringList cmd_pipe;// 初始化了一个String目录 cmd_pipe << "-c" << cmd_find; // 说明这个cmd-pipe已经变成了一个linux的cmd命令了 cmd->start("/bin/bash",cmd_pipe); // 开始一个程序 cmd->waitForFinished(); cmd->close(); cmd->start(cmd_tar);// cmd_tar 也变成了一个程序 cmd->waitForFinished(); cmd->close(); cmd->start("rm -f TEPLIST");// 强制删除teplist, teplist 就是临时文件 cmd->waitForFinished(); /*********** Encrypting*************/ // gpg-k 增加公共钥匙 if(ui->checkBox->isChecked()){ QString cmd_enc; QString cmd_isKey = "gpg -k " + gpg_key; cmd->start(cmd_isKey); cmd->waitForFinished(); QString out = QString::fromLocal8Bit(cmd->readAllStandardOutput());// 这个输出就不是很理解为什么 if(out.isEmpty()) // -o, --output FILE write output to FILE // c 说是使用对称加密,看起来很奇怪 cmd_enc = QString("gpg -c -o %1/%2.gpg %1/%2").arg(dir_dest).arg(targz); else // e 是加密数据 , 针对 用户 id 进行加密 cmd_enc = QString("gpg -e -r %1 -o %2/%3.gpg %2/%3").arg(gpg_key).arg(dir_dest).arg(targz); cmd->start(cmd_enc); cmd->waitForFinished(); if(false == ui->checkBox_2->isChecked()){ QString cmd_rm = QString("rm %1/%2.gpg").arg(dir_dest).arg(targz); cmd->start(cmd_rm); cmd->waitForFinished(); } if(false == ui->checkBox_3->isChecked()){ QString cmd_rm = QString("rm %1/%2").arg(dir_dest).arg(targz); cmd->start(cmd_rm); cmd->waitForFinished(); } /* * /home/hu/桌面/vsbak/backup/2019-11-13_19.38.57.full.tar.gz * */ // ui->comboBox->addItem(targz); init_comboBox(); } } void Vsbak::on_pushButton_2_clicked(){ QString targz = ui->comboBox->currentText(); if (targz.endsWith(".tar.gz.gpg")){ targz = targz.remove(".gpg"); QString cmd_enc; QString cmd_isKey = "gpg -k " + gpg_key; cmd->start(cmd_isKey); cmd->waitForFinished(); QString out = QString::fromLocal8Bit(cmd->readAllStandardOutput()); if(out.isEmpty()) cmd_enc = QString("gpg -d -o %1/%2 %1/%2.gpg").arg(dir_dest).arg(targz); else cmd_enc = QString("gpg -d -r %1 -o %2/%3 %2/%3.gpg").arg(gpg_key).arg(dir_dest).arg(targz); cmd->start(cmd_enc); cmd->waitForFinished(); } QString cmd_str = QString("tar -xvf %1/%2").arg(dir_dest).arg(targz); qDebug() << cmd_str; cmd->start(cmd_str); cmd->waitForFinished(); } ``` 上面是cpp文件 下面是 # h文件 #ifndef VSBAK_H #define VSBAK_H #include <QWidget> #include<QProcess> QT_BEGIN_NAMESPACE namespace Ui { class Vsbak; } QT_END_NAMESPACE class Vsbak : public QWidget { Q_OBJECT public: Vsbak(QWidget *parent = nullptr); ~Vsbak(); private slots: void on_readyReadStandardOutput(); void on_readyReadStandardError(); void on_toolButton_clicked(); void on_toolButton_2_clicked(); void on_pushButton_clicked(); void on_pushButton_2_clicked(); void on_checkBox_clicked(); private: Ui::Vsbak *ui; QProcess *cmd; QString dir_dest; QString dir_src; QString gpg_key; QString exclude_from; void init_comboBox(); int get_min(QDateTime curTime);// 获得整形 }; #endif // VSBAK_H 我运行之后出来的qt界面,原本是可以下拉选择的,但是都没有反映,这是为啥
PHP如何连接加密码的ACCESS数据库?
_PHP如何连接加密码的ACCESS数据库? <?php //php.ini去掉php_pdo.dll与php_pdo_odbc.dll前的分号 2016-4-4测试连接无密码的access数据库成功 a1.mdb是 access文件名 //请问如果把a1.mdb文件加上密码123456,连接语句如何写?非常感谢! $db = new PDO("odbc:driver={microsoft access driver (*.mdb)};dbq=".realpath("a1.mdb")) or die("Connect Error"); $rs = $db->query('select * from wenben'); print "<pre>"; print_r($rs->fetchAll()); print "</pre>"; ?> _
急!!!使用shiro+ssm时自定义Realm项目运行报错
``` 报错信息: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [spring-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 [spring-shiro.xml]: Cannot resolve reference to bean 'iniRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:755) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5157) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5680) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1017) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:993) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2039) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [spring-shiro.xml]: Cannot resolve reference to bean 'iniRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 27 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:298) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1148) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 37 more Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:531) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:295) ... 45 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:997) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:867) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:779) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:503) ... 47 more - (2701 ms) - 2019-1-11 11:37:39[ INFO](DefaultSingletonBeanRegistry.java:444) Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@684724b0: defining beans [applyServiceImpl,businessTripServiceImpl,contractServiceImpl,customerPriceListServiceImpl,employeeServiceImpl,hospitalServiceImpl,invoiceServiceImpl,leaveServiceImpl,rbrcServiceImpl,reimbursementServiceImpl,reportServiceImpl,roleServiceImpl,salerPerformanceServiceImpl,sampleLedgerServiceImpl,sampleSummaryServiceImpl,statementOfAccountServiceImpl,userGroupServiceImpl,userServiceImpl,workloadServiceImpl,workPlanServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.support.PropertySourcesPlaceholderConfigurer#0,dataSource,transactionManager,sqlSessionFactory,org.springframework.aop.config.internalAutoProxyCreator,transService,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,txAdvice,org.mybatis.spring.mapper.MapperScannerConfigurer#0,multipartResolver,iniRealm,securityManager,cacheManager,shiroFilter,lifecycleBeanPostProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,applyMapper,businessTripMapper,contractMapper,customerPriceListMapper,employeeMapper,hospitalMapper,invoiceMapper,leaveMapper,rbrcMapper,reimbursementMapper,reportMapper,roleMapper,salerPerformanceMapper,sampleLedgerMapper,sampleSummaryMapper,statementOfAccountMapper,userGroupMapper,userMapper,workloadMapper,workPlanMapper]; root of factory hierarchy - (2701 ms) - 2019-1-11 11:37:39[DEBUG](DefaultSingletonBeanRegistry.java:500) Retrieved dependent beans for bean '(inner bean)#3d3e97d3': [txAdvice] - (2702 ms) - 2019-1-11 11:37:39[DEBUG](DisposableBeanAdapter.java:303) Invoking destroy method 'close' on bean with name 'dataSource' - (2703 ms) - 2019-1-11 11:37:39[ERROR](ContextLoader.java:331) Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [spring-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 [spring-shiro.xml]: Cannot resolve reference to bean 'iniRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:755) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5157) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5680) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1017) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:993) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2039) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [spring-shiro.xml]: Cannot resolve reference to bean 'iniRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 27 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:298) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1148) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 37 more Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:531) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:295) ... 45 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:997) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:867) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:779) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:503) ... 47 more 一月 11, 2019 11:37:39 上午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [spring-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 [spring-shiro.xml]: Cannot resolve reference to bean 'iniRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:755) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5157) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5680) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1017) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:993) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2039) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [spring-shiro.xml]: Cannot resolve reference to bean 'iniRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 27 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'iniRealm': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:298) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1148) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBea nFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 37 more Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.rn.pojo.User com.rn.Realm.UserRealm.us; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:531) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:295) ... 45 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rn.pojo.User] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:997) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:867) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:779) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:503) ... 47 more ``` ``` **web.xml** <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:applicationContext-*.xml, classpath:spring-shiro.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <filter-name>encodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- shiro过滤器 --> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:springmvc-servlet.xml, classpath:spring-shiro.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpeg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.mp4</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.eot</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.svg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.ttf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.woff</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.woff2</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.otf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.png</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.psd</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.xls</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.pdf</url-pattern> </servlet-mapping> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.properties</param-value> </context-param> <context-param> <param-name>webAppRootKey</param-name> <param-value>SMBMS_C12_12.root</param-value> </context-param> <listener> <listener-class> org.springframework.web.util.Log4jConfigListener </listener-class> </listener> <welcome-file-list> <welcome-file>/WEB-INF/jsp/back/customerprice.jsp</welcome-file> </welcome-file-list> ``` ``` ``` **spring-shiro.xml** <bean id="iniRealm" class="com.rn.Realm.UserRealm"> <!-- 配置缓存管理器--> <property name="cacheManager" ref="cacheManager" /> <!-- 配置加密器 --> <property name="credentialsMatcher"> <bean class="org.apache.shiro.authc.credential.HashedCredentialsMatcher"> <property name="hashAlgorithmName" value="MD5"></property> <!-- 加密算法的名称 --> <property name="hashIterations" value="1024"></property> <!-- 配置加密的次数 --> </bean> </property> </bean> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="iniRealm"></property> </bean> <!-- 用户授权信息Cache --> <bean id="cacheManager" class="org.apache.shiro.cache.MemoryConstrainedCacheManager" /> <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property name="securityManager" ref="securityManager"></property> <property name="loginUrl" value="/gologin.html"></property> <property name="successUrl" value="/index.html"></property> <property name="unauthorizedUrl" value="/error.html"></property> <property name="filterChainDefinitions"> <value> /login.html=anon /gologin.html=anon /index.html=authc /role.html=authc,roles[admin] /menu/**=authc,roles[admin],perms[menu:*] </value> </property> </bean> <!-- 配置Shiro在Spring中的生命周期的控制操作 --> <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/> ``` **springMvc-servlet.xml** <mvc:annotation-driven> <mvc:message-converters> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>application/json;charset=UTF-8</value> </list> </property> </bean> <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> <value>application/json</value> </list> </property> <property name="features"> <list> <!-- Date的日期转换器 --> <value>WriteDateUseDateFormat</value> </list> </property> </bean> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> <property name="objectMapper" ref="customObjectMapper"></property> </bean> </mvc:message-converters> </mvc:annotation-driven> <context:component-scan base-package="com.rn.controller,com.rn.dao,com.rn.service,com.rn.service.impl"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <bean id="customObjectMapper" class="com.rn.demo.CustomObjectMapper"></bean> <mvc:resources location="/statics/" mapping="/statics/**"></mvc:resources> <!-- 配置多视图解析器:允许同样的内容数据呈现不同的view --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" > <property name="prefix" value="/WEB-INF/jsp"/> <property name="suffix" value=".jsp"/> </bean> <!-- <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/user/sys/**"/> <bean class="cn.smbms.interceptor.SysInterceptor"/> </mvc:interceptor> </mvc:interceptors> --> <!-- 配置MultipartResolver,用于上传文件,使用spring的CommonsMultipartResolver --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="5000000"/> <property name="defaultEncoding" value="UTF-8"/> </bean> <!-- 配置启用Shiro的注解功能 --> <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"> <property name="proxyTargetClass" value="true"></property> </bean> <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"> <property name="securityManager" ref="securityManager"/> </bean> ``` Realm.java package com.rn.Realm; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.annotation.Resource; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.LockedAccountException; import org.apache.shiro.authc.SimpleAuthenticationInfo; import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.util.ByteSource; import org.springframework.beans.factory.annotation.Autowired; import com.rn.pojo.User; import com.rn.service.UserService; public class UserRealm extends AuthorizingRealm { @Autowired private UserService userSer; @Autowired private User us; @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principal) { return null; } @Override protected AuthenticationInfo doGetAuthenticationInfo( AuthenticationToken token) throws AuthenticationException { //1.将token转换为UsernamePasswordToken UsernamePasswordToken userToken = (UsernamePasswordToken)token; //2.获取token中的登录账户 String user_Name = userToken.getUsername(); //3.查询数据库,是否存在指定的用户名和密码的用户(主键/账户/密码/账户状态/盐) us = null; us = userSer.getpassword(user_Name); //4.1 如果没有查询到,抛出异常 if( us == null ) { throw new UnknownAccountException("账户"+user_Name+"不存在!"); } if( us.getLock() == "1"){ throw new LockedAccountException(us.getUser_Name()+"被锁定!"); } //4.2 如果查询到了,封装查询结果, Object principal = us.getUser_Code(); Object credentials = us.getPassword(); String realmName = this.getName(); //获取盐,用于对密码在加密算法(MD5)的基础上二次加密ֵ SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(principal, credentials, realmName); //5. 返回给调用login(token)方法 return info; } } ``` ``` 使用ini文件不报错,使用自定义realm就报这个错误 我是个新手,公司又只有我一个java开发,第一次使用shiro,工期比较紧,拜托各位大神帮帮忙。百度了好多解决办法都不行 拜托各位大神,拜托拜托
爬虫福利二 之 妹子图网MM批量下载
爬虫福利一:27报网MM批量下载 点击 看了本文,相信大家对爬虫一定会产生强烈的兴趣,激励自己去学习爬虫,在这里提前祝:大家学有所成! 目标网站:妹子图网 环境:Python3.x 相关第三方模块:requests、beautifulsoup4 Re:各位在测试时只需要将代码里的变量path 指定为你当前系统要保存的路径,使用 python xxx.py 或IDE运行即可。 ...
字节跳动视频编解码面经
三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时想着能进去就不错了,管他哪个岗呢,就同意了面试...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
Python 基础(一):入门必备知识
Python 入门必备知识,你都掌握了吗?
兼职程序员一般可以从什么平台接私活?
这个问题我进行了系统性的总结,以下将进行言简意赅的说明和渠道提供,希望对各位小猿/小媛们有帮助~ 根据我们的经验,程序员兼职主要分为三种:兼职职位众包、项目整包和自由职业者驻场。 所谓的兼职职位众包,指的是需求方这边有自有工程师配合,只需要某个职位的工程师开发某个模块的项目。比如开发一个 app,后端接口有人开发,但是缺少 iOS 前端开发工程师,那么他们就会发布一个职位招聘前端,来配合公司一...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
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...
写了很久,这是一份最适合/贴切普通大众/科班/非科班的『学习路线』
说实话,对于学习路线这种文章我一般是不写的,大家看我的文章也知道,我是很少写建议别人怎么样怎么样的文章,更多的是,写自己的真实经历,然后供大家去参考,这样子,我内心也比较踏实,也不怕误导他人。 但是,最近好多人问我学习路线,而且很多大一大二的,说自己很迷茫,看到我那篇 普普通通,我的三年大学 之后很受激励,觉得自己也能行,(是的,别太浪,你一定能行)希望我能给他个学习路线,说...
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的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 初学者走出困境、快速成长。希望我的经验能真正帮到你
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
碎片化的时代,如何学习
今天周末,和大家聊聊学习这件事情。 在如今这个社会,我们的时间被各类 APP 撕的粉碎。 刷知乎、刷微博、刷朋友圈; 看论坛、看博客、看公号; 等等形形色色的信息和知识获取方式一个都不错过。 貌似学了很多,但是却感觉没什么用。 要解决上面这些问题,首先要分清楚一点,什么是信息,什么是知识。 那什么是信息呢? 你一切听到的、看到的,都是信息,比如微博上的明星出轨、微信中的表情大战、抖音上的...
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。 背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法 不过,当我看了源代码之后 这程序不到50行 尽管我有多年的Python经验,但我竟然一时也没有看懂 当然啦,原作者也说了,这个代码也是在无聊中诞生的,平时撸码是不写中文变量名的, 中文...
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的回答,对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalking,作者吴晟、刘浩杨 等等 仓库地址: apache/skywalking 更...
基础拾遗:除了&和&&的区别,你还要知道位运算的这5个运算符
&和&&都可作逻辑与的运算符,表示逻辑与(and),&是位运算符,你还需要知道这5个位运算符,基础很重要,云运算其实很骚!
MySQL数据库总结
一、数据库简介 数据库(Database,DB)是按照数据结构来组织,存储和管理数据的仓库。 典型特征:数据的结构化、数据间的共享、减少数据的冗余度,数据的独立性。 关系型数据库:使用关系模型把数据组织到数据表(table)中。现实世界可以用数据来描述。 主流的关系型数据库产品:Oracle(Oracle)、DB2(IBM)、SQL Server(MS)、MySQL(Oracle)。 数据表:数...
20行Python代码爬取王者荣耀全英雄皮肤
引言 王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了。我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成。 准备工作 爬取皮肤本身并不难,难点在于分析,我们首先得得到皮肤图片的url地址,话不多说,我们马上来到王者荣耀的官网: 我们点击英雄资料,然后随意地选择一位英雄,接着F12打开调试台,找到英雄原皮肤的图片...
张小龙-年薪近3亿的微信之父,他是如何做到的?
张小龙生于湖南邵东魏家桥镇, 家庭主要特点:穷。 不仅自己穷,亲戚也都很穷,可以说穷以类聚。爷爷做过铜匠,总的来说,标准的劳动阶级出身。 家有兄弟两人, 一个小龙,一个小虎。 小虎好动,与邻里打成一片, 小龙好静,喜好读书。 “文静的像个妹子。”张小龙的表哥如是说。 穷文富武,做个读书郎是个不错的选择。 87年至94年, 华中科技大学本硕连读。 本科就读电信系, 不喜欢上课...
阿里靠什么武功秘籍渡过“双十一“的天量冲击
双十一大概会产生多大的数据量呢,可能大家没概念,举个例子央视拍了这么多年电视新闻节目,几十年下来他存了大概80P的数据。而今年双11一天,阿里要处理970P的数据,做为一个IT人,笔者认为今年”双十一“阿里最大的技术看点有有以下两个: 阿里的数据库,也就是刚刚拿下TPC冠军的OcceanBase,处理峰值也达到了骇人听闻的6100万次/秒, 阿里核心系统百分百上云了。 如果把信息系统比做一个武...
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给袈...
iOS Bug 太多,苹果终于坐不住了!
开源的 Android 和闭源的 iOS,作为用户的你,更偏向哪一个呢? 整理 | 屠敏 出品 | CSDN(ID:CSDNnews) 毋庸置疑,当前移动设备操作系统市场中,Android 和 iOS 作为两大阵营,在相互竞争的同时不断演进。不过一直以来,开源的 Android 吸引了无数的手机厂商涌入其中,为其生态带来了百花齐放的盛景,但和神秘且闭源的 iOS 系统相比,不少网友...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
(经验分享)作为一名普通本科计算机专业学生,我大学四年到底走了多少弯路
今年正式步入了大四,离毕业也只剩半年多的时间,回想一下大学四年,感觉自己走了不少弯路,今天就来分享一下自己大学的学习经历,也希望其他人能不要走我走错的路。 (一)初进校园 刚进入大学的时候自己完全就相信了高中老师的话:“进入大学你们就轻松了”。因此在大一的时候自己学习的激情早就被抛地一干二净,每天不是在寝室里玩游戏就是出门游玩,不过好在自己大学时买的第一台笔记本性能并不是很好,也没让我彻底沉...
相关热词 如何提升c#开发能力 矩阵乘法c# c#调用谷歌浏览器 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天
立即提问