首页
AI
ClaudeCode
OpenClaw
爬虫
爬虫案例
JS逆向技巧
APP逆向
嵌入式开发
C语言入门视频教程
模电数电
51/52单片机
STM32
Linux嵌入式
文学修养
生活哲理
感动和励志文字
随手乱写
IT计算机
QT学习之路
数据库设计
网站搭建
微信开发
Java
Web程序设计
编程语言
计算机知识
NCRE全国计算机等级考试
关于我们
广告招租
表白网页制作
搜索
登录
搜索
RainFly
明确一个目标,这很重要!
累计撰写
228
篇文章
累计收到
4778
条评论
首页
AI
- ClaudeCode
- OpenClaw
爬虫
- 爬虫案例
- JS逆向技巧
- APP逆向
嵌入式开发
- C语言入门视频教程
- 模电数电
- 51/52单片机
- STM32
- Linux嵌入式
文学修养
- 生活哲理
- 感动和励志文字
- 随手乱写
IT计算机
- QT学习之路
- 数据库设计
- 网站搭建
- 微信开发
- Java
- Web程序设计
- 编程语言
- 计算机知识
- NCRE全国计算机等级考试
关于我们
- 广告招租
- 表白网页制作
会声会影X9
会声会影X9
会声会影X9
最新文章
2016-1-21
Vim实现自动缩进换行补全等功能
所有步骤均修改文件 /etc/vim/vimrc 实现自动缩进 在vimrc任意位置加上一下语句实现 1)设置(软)制表符宽度为4: set tabstop=4 set softtabstop=4 2)设置缩进的空格数为4 set shiftwidth=4 3)设置自动缩进:即每行的缩进值与上一行相等;使用 noautoindent 取消设置: set autoindent 4)设置使用 C/C++ 语言的自动缩进方式: set cindent 5)设置C/C++语言的具体缩进方式(以我的windows风格为例): set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s 6)如果想在左侧显示文本的行号,可以用以下语句: set nu 自动换行 自动换行是每行超过 n 个字的时候 vim 自动加上换行符用 类似 :set textwidth=70 来设置 n 自动折行 是把长的一行用多行显示 , 不在文件里加换行符用 :set wrap 设置自动折行 :set nowrap 设置不自动折行 自动补全 在末尾处添加如下代码: inoremap ( ()<ESC>i inoremap <ESC>i inoremap { {}<ESC>i inoremap < <><ESC>i 其余括号仍按照同样方式添加 自动补全代码需要依赖插件安装! 最后,如果没有下列语句,就加上吧: if &term=="xterm" set t_Co=8 set t_Sb=^[[4%dm set t_Sf=^[[3%dm endif 还有中文显示问题, 可以添加: let &termencoding=&encoding set fileencodings=utf-8,gbk,ucs-bom,cp936 上面这两行命令即可
2016年-1月-21日
9444 阅读
1 评论
Linux嵌入式
2016-1-20
Makefile编写注意事项
一个最简单的Makefile编写: #对变量进行赋值 SRC = temp.c OBJ = temp.o EXE = temp CC = gcc CFLAGS = -g LDFLAGS = #显影式规则模式 EXE:$(OBJ) $(CC) $(LDFLAGS) -o $(EXE) $^ OBJ:$(SRC) $(CC) $(CFLAGS) -o $(OBJ) -c $^ #伪目标 是改动文件能得到及时编译更新 .PHONY:clean clean: -$(RM) $(EXE) $(OBJ) //删除掉 .out执行文件 和.o目标文件! 所有的缩进部分全部需要tab键 如果使用空格键 make时就会报错 如下图
2016年-1月-20日
9928 阅读
1 评论
Linux嵌入式
2016-1-17
Emlog完美转伪靜态
网站优化本意是通过修改网站,提高网站用户体验,增加网站用户粘度,最终提升网站排名,但被大多数SEO给误解,误认为改版会增加网站降权K站的风险,所以如果不是不得已的情况下,SEOER都不会随便修改网站代码! 伪 静态已经不是一个新鲜的名词了,尤其是在现今SEO的炒作中。如何实现伪静态这是每个程序员都关心的问题,除非您不搞SEO。大多的伪静态都是以 Htaccess(Apache mod_rewrite)来实现的,但是一个规划不太好的网站要用Htaccess实现,需要写一大堆的代码,而还有某种原因我们不得不放弃 Htaccess,或是由于服务器不支持,或是个人偏好等等。 Emlog 默认不能生成静态文件,不过好像有生成静态页面的相关插件,该插件先不研究,今天李明给大家分享一下Emlog在各种环境下的伪静态规则,大家都知道,通 过伪静态可以让博客文章网址变得对搜索引擎更加友好,据网上的seoer们说,好的伪静态有利于搜索引擎优化,具体有没有博主可自己去探讨。 注:伪静态必须空间支持且在后台-设置中开启伪静态。 我的博客曾经改版过多次,网站排名不但没有下降,均有所上升,相反,那些不敢改版的人,排名却没有想象中的稳定。当然,改版也需要根据用户体验进行! IIS6:(iis6主机请联系主机商修改规则,部分主机支持httpd.ini,请将下列代码保存为httpd.ini上传到博客根目录) # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 RewriteRule /robots.txt(.*) /robots.txt$1 RewriteRule /rss.php(.*) /rss.php$1 RewriteRule /tb.php(.*) /tb.php$1 RewriteRule /favicon.ico /favicon.ico RewriteRule /xmlrpc.php(.*) /xmlrpc.php$1 RewriteRule /wlwmanifest.xml /wlwmanifest.xml RewriteRule /(t|m)$ /$1/ RewriteRule /(admin|content|include|t|m)/(.*) /$1/$2 RewriteRule /install.php(.*) /install.php$1 RewriteRule /emlog_toolkit.php(.*) /emlog_toolkit.php$1 RewriteRule /up(d.d.d)to(d.d.d).php(.*) /up$1to$2.php$3 RewriteRule ^/$ /index.php RewriteRule /(.*) /index.php/$1 支持.htaccess的IIS6服务器规则: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 Emlpg设置伪静态后,访问?post = 还是能查看文章,这样就让一个文章出现好多不同的链接,刚刚折腾好久的代码,所有em用户通用,代码复制粘贴就好了,不需要改。 使用以下代码: 1.非 www 域名跳转 网站解析肯定要有一个1级域名 .com 但是一般都用 www..com 这样的2级域名,用以下代码可以让访问 .com 自动跳转到www开头的(网页参数不变) 注意:跳转的链接是以后台设置的网站首页为准。 if ('http://' . $_SERVER . '/' != BLOG_URL){ header('HTTP/1.1 301 Moved Permanently'); header('Location:' . BLOG_URL . trim(Dispatcher::setPath(), '/')); exit; } 代码粘贴到:header.php 里面 如下图: 2.文章页面301跳转: $the_url = Url::log($logid); if (stristr (BLOG_URL . trim(Dispatcher::setPath(), '/'),$the_url) == false){ header('HTTP/1.1 301 Moved Permanently'); header('Location:'.$the_url); exit; } 代码粘贴到:echo_log.php 里面 如下图: 3.自定义页面301跳转: 自定义页面301跳转和文章页面301跳转代码一样 $the_url = Url::log($logid); if (stristr (BLOG_URL . trim(Dispatcher::setPath(), '/'),$the_url) == false){ header('HTTP/1.1 301 Moved Permanently'); header('Location:'.$the_url); exit; } 代码粘贴到:page.php 里面 如下图: 4.分类301跳转,有时候我们设置了分类别名, $the_url = $_SERVER; $the_url = str_replace("index.php","",$the_url); $the_url = str_replace("sort","",$the_url); $the_url = str_replace("/","",$the_url); //通过URL获取到当前日志ID / 别名,找了半天教程都没有、只能用这种旁门左道 $the_url = Url::sort($the_url); if ($the_url != BLOG_URL . trim(Dispatcher::setPath(), '/')){ header('HTTP/1.1 301 Moved Permanently'); header('Location:'.$the_url); exit; } 代码粘贴到: log_list.php 里面 即可自动301跳转到别名链接,如图所示: 本博客已把动态网址转为伪静态网址了,反正我个人觉得这样有利于seo,小白见解大神勿喷。。。 投稿作者:李明博客 本文地址: http://likinming.com/post-689.html
2016年-1月-17日
12508 阅读
6 评论
网站搭建
2015-12-5
嵌入式开发学习步骤
1)学习 Linux系统安装、 常用命令、应用程序安装。 <br style="color:#454545;font-family:arial, 宋体, sans-serif, tahoma, 'Microsoft YaHei';font-size:14px;line-height:24px;white-space:normal; /> 2) 学习 Linux 下的 C 编程、这本书必学《UNIX 环境高级编程》、《UNIX 网络编程》,Rechard Stevens 写的,C 高手大都学习过 《C 和指针》、《C 缺陷与陷阱》、《高质量C/C++编程指南》、《C 专家编程》、《The C programming Language》 3)程序员大都要学:数据结构,嵌入式程序员数据结构必学! 4)底层开发人员大都要学:微机原理、计算机体系结构,嵌入式开发人员必学! 5)单片机可以让一个从事软件开发的人了解和如何操作硬件,有必要学,因为一开始就从 ARM 入手,不太现实! 6)ARM 体系结构,其中有汇编。 7)数字电路有必要学习,不然你在做底层开发时真的会不知道怎么看原理图,起码也得懂与入门吧。 8)ARM + Linux 应用程序开发(前提是要有开发板) 到此,勉强算是在嵌入式Linux这个行业有了初步入门了, 但遗憾的是这还远远不够,还得继续,因为这上嵌入式,得变成高手。 9)要做底层开发,就必须知道软硬件之间是如何衔接和配合工作的,那么电子技术应该要好好学习了,很多时候会用到模拟电路知识,这是区别好手与菜鸟的不同之处之一。 10)Linux 下的汇编要学,这样你才能真正了解你写的程序是如何在一个特定的硬件上跑的。这是区别好手与菜鸟的不同之处之二。 11)TCP/IP 协议栈要学,所有的嵌入式高手都得掌握的东西,这是区别好手与菜鸟的不同之处之三。 12)有了这些东西,拿下 Linux 驱动 已经不再话下,需要你去学习 Linux 内核源代码和Linux驱动程序设计,这是一个技术升华。 到此, 你已经算是 嵌入式Linux 的中级人物了,继续往下: 13)音频、视频的解码译码技术你得学。 14)各种 IC ,各种 bootloader 你能够参与其开发设计。 15)自行设计开发新产品,新技术。
2015年-12月-5日
6922 阅读
1 评论
Linux嵌入式
2015-11-30
WIFI打不开图标显示红色的叉处理方法
几天修的电脑有几个是WIFI不能开启的问题,在这里分享一下解决方法。. 首先看外部有没有WIFI的开关,确保开关是开启的,键盘组合的软开启是开着的,如果还不能用, 进BIOS,F9 恢复默认、F10保存, 如果问题没解决,可以拆出WIFI卡,找到20脚,用透明胶带粘住20脚就行了,(20脚是WIFI的关闭信号) 只要20脚不和插槽内的20脚触点接触,WIFI就会处于常开状态,而且外部开关和键盘组合都无法关闭WIFI,已经成功修好了数台。; 转载:迅维网
2015年-11月-30日
13624 阅读
1 评论
计算机知识
2015-11-26
QT实例3文本编辑器
QT实例3文本编辑器 第一步, 创建工程添加一个TextEdit 文本编辑框 选中MainWindow然后Ctrl+L垂直布局 输入 文件(&F) 第二步:设置munuBar 中Action的对象名 newAction openAction saveAction saveAsAction separator 分割符rintActiioon exitAction 查找 QAction类中的SIGNAL 信号 选择其中的触发函数 void triggered(bool checked =false); 第三步加上 第三步 查找QFile类的方法 setFileName QTODevice 中的属性 查找QFileDialog 利用静态方法调用Static Public Members getOpenFileName getSaveFileName QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),"/home",tr("Images (*.png*.xpm*.jpg)")); tr("Images (*.png*.xpm*.jpg)") 后续步骤直接看代码 头文件 mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QMessageBox> //对话框头文件 #include <QtDebug> //打印部分调试信息 #include <QFile> //文件处理类库 #include <QFileDialog> //文本对话框 #include <QDir> //文本目录 #include <QTextStream> //文本输出流 #include <QPrintDialog> //文件打印对话框 #include <QFontDialog> //字体对话框 #include <QFont> //字体本身的类 #include <QColor> //颜色的类 #include <QColorDialog> //颜色对话框 #include <QDateTime> //时间类 #include <QUrl> //网页链接的类 #include <QDesktopServices> //用于访问桌面服务的类 #include <about.h> //about Dialog对话框的头文件 #include <QCloseEvent> //当程序需要被关闭所需要处理的内容 所有的事件都是受保护的成员 namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); protected: void closeEvent(QCloseEvent *); private: Ui::MainWindow *ui; QString saveFileName; private slots: void newFileSlot(); void openFileSlot(); //打开一个已经存在的文本文件 void saveAsFileSlot(); void saveFileSlot(); //保存 void printFileSlot(); void setFontSlot(); //设置字体 void setColorSlot(); //设置颜色 void setDateTimeSlot(); //获得当前系统时间,并且打印出来 void aboutWebsiteSlot(); //打开主页 通过QDesktop void aboutSoftwareSlot(); }; #endif // MAINWINDOW_H2 mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->setWindowTitle("文本编辑器"); //文件菜单 QObject::connect(ui->newAction,SIGNAL(triggered()),this,SLOT(newFileSlot())); QObject::connect(ui->openAction,SIGNAL(triggered()),this,SLOT(openFileSlot())); QObject::connect(ui->saveAction,SIGNAL(triggered()),this,SLOT(saveFileSlot())); QObject::connect(ui->saveAsAction,SIGNAL(triggered()),this,SLOT(saveAsFileSlot())); QObject::connect(ui->printAction,SIGNAL(triggered()),this,SLOT(printFileSlot())); QObject::connect(ui->exitAction,SIGNAL(triggered()),this,SLOT(close())); //编辑菜单 QObject::connect(ui->undoAction,SIGNAL(triggered()),ui->textEdit,SLOT(undo())); QObject::connect(ui->redoAction,SIGNAL(triggered()),ui->textEdit,SLOT(redo())); QObject::connect(ui->copyAction,SIGNAL(triggered()),ui->textEdit,SLOT(copy())); QObject::connect(ui->pasteAction,SIGNAL(triggered()),ui->textEdit,SLOT(paste())); QObject::connect(ui->cutAction,SIGNAL(triggered()),ui->textEdit,SLOT(cut())); QObject::connect(ui->selectAction,SIGNAL(triggered()),ui->textEdit,SLOT(selectAll())); QObject::connect(ui->fontAction,SIGNAL(triggered()),this,SLOT(setFontSlot())); QObject::connect(ui->colorAction,SIGNAL(triggered()),this,SLOT(setColorSlot())); QObject::connect(ui->datetimeAction,SIGNAL(triggered()),this,SLOT(setDateTimeSlot())); //帮助 QObject::connect(ui->aboutWebsiteAction,SIGNAL(triggered()),this,SLOT(aboutWebsiteSlot())); QObject::connect(ui->aoubtSoftwareAction,SIGNAL(triggered()),this,SLOT(aboutSoftwareSlot())); } MainWindow::~MainWindow() { delete ui; } void MainWindow::closeEvent(QCloseEvent *event) { //event->ignore(); //event->accept(); if(ui->textEdit->document()->isModified()) { QMessageBox msgBox; //显示的文本 msgBox.setText("文件内容已经被改变了"); //你想要做的操作 msgBox.setInformativeText("是否保存?"); //对话框中的button msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); int ret = msgBox.exec(); //QDialog中继承 exec switch (ret) { case QMessageBox::Save: // Save was clicked this->saveFileSlot(); break; case QMessageBox::Discard: // Don't Save was clicked event->accept(); break; case QMessageBox::Cancel: // Cancel was clicked event->ignore(); break; default: // should never be reached break; } } else { event->accept(); } } void MainWindow::newFileSlot() { //判断当前的文本编辑框中的doucument是否被改变 if(ui->textEdit->document()->isModified()) { //调试 qDebug()<<"current file modified!"; this->saveAsFileSlot(); } else { //调试 qDebug()<<"current flie no modified!"; ui->textEdit->clear(); this->setWindowTitle("无标题-文本编辑器");//设置标题提示新建的文件 } } void MainWindow::openFileSlot() { //获得fileName /* QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "/home",默认打开路径 tr("Images (*.png *.xpm *.jpg)")); */ saveFileName=QFileDialog::getOpenFileName(this,"打开文件",QDir::currentPath(),tr("TEXT (*.txt)")); // qDebug() << fileName; //判断文件选择是否被取消了 if(saveFileName.isEmpty()) { QMessageBox::information(this,"错误信息","请选择一个文件!"); return; } else { //创建一个新的文件对象 QFile * file = new QFile; //设置新建文件对象的文件名 file->setFileName(saveFileName); //打开文件file 已QIODevice方式 只读 返回值bool判断是否打开 bool ok=file->open(QIODevice::ReadOnly); if(ok) { //关联文件与文本流 QTextStream in(file); //in.readAll()将file中的所有的文件全部读进去 然后将所有文件全部setTet到textEdit ui->textEdit->setText(in.readAll()); this->setWindowTitle(saveFileName+"-文本编辑器"); file->close(); delete file; } else { //提示打开错误信息 QMessageBox::information(this,"错误信息","打开文件失败!"); return; } } } void MainWindow::saveFileSlot() { if(saveFileName.isEmpty()) { //qDebug()<<"无文件名"; this->saveAsFileSlot(); } else { //qDebug()<<"有文件名"; QFile *file =new QFile; file->setFileName(saveFileName); bool ok=file->open(QIODevice::WriteOnly); if(ok) { //将file和文本流相关联 QTextStream out(file); //转换成纯文本存入磁盘 out<<ui->textEdit->toPlainText(); file->close(); delete file; } } } void MainWindow::saveAsFileSlot() { QString saveFileName= QFileDialog::getSaveFileName(this,"保存文件",QDir::currentPath(),tr("TEXT (*.txt)")); if(saveFileName.isEmpty()) { QMessageBox::information(this,"错误信息","请选择一个存放位置!"); return; } QFile *file =new QFile; file->setFileName(saveFileName); bool ok=file->open(QIODevice::WriteOnly); if(ok) { //将file和文本流相关联 QTextStream out(file); //转换成纯文本存入磁盘 out<<ui->textEdit->toPlainText(); file->close(); this->setWindowTitle(saveFileName+"-文本编辑器"); delete file; } else { QMessageBox::information(this,"错误信息","保存失败!"); return; } } void MainWindow::printFileSlot() { //QPrintDialog } void MainWindow::setFontSlot() { //获得用户选择的字体 /* bool ok; QFont font = QFontDialog::getFont( &ok, QFont("Helvetica ", 10), this); if (ok) { // the user clicked OK and font is set to the font the user selected } else { // the user canceled the dialog; font is set to the initial // value, in this case Helvetica , 10 } */ bool ok; QFont font =QFontDialog::getFont(&ok,this); if(ok) { ui->textEdit->setFont(font); } else { QMessageBox::information(this,"错误信息","设置字体失败!"); return; } } void MainWindow::setColorSlot() { /* void Dialog::setColor() { QColor color; if (native->isChecked()) color = QColorDialog::getColor(Qt::green, this); else color = QColorDialog::getColor(Qt::green, this, "Select Color", QColorDialog::DontUseNativeDialog); if (color.isValid()) { colorLabel->setText(color.name()); colorLabel->setPalette(QPalette(color)); colorLabel->setAutoFillBackground(true); } } */ QColor color=QColorDialog::getColor(Qt::red,this); if(color.isValid()) { ui->textEdit->setTextColor(color); } else { QMessageBox::information(this,"错误信息","当前设置的颜色不可用"); return; } } void MainWindow::setDateTimeSlot() { //获取当前系统的时间到current对象中 QDateTime current=QDateTime::currentDateTime(); //以一定的时间格式转换成字符 QString time =current.toString("yyyy-M-dd hh::mm::ss"); //在文本框的末尾追加上textEdit ui->textEdit->append(time); } void MainWindow::aboutWebsiteSlot() { QDesktopServices::openUrl(QUrl("http://www.rainfly.cn")); } void MainWindow::aboutSoftwareSlot() { about *dialog=new about; dialog->show(); //显示一个非模态对话框 //dialog.exec() 显示modal dialog } mianwindow.ui about.h #ifndef ABOUT_H #define ABOUT_H #include <QDialog> namespace Ui { class about; } class about : public QDialog { Q_OBJECT public: explicit about(QWidget *parent = 0); ~about(); private slots: void on_pushButton_clicked(); private: Ui::about *ui; }; #endif // ABOUT_H about.cpp #include "about.h" #include "ui_about.h" about::about(QWidget *parent) : QDialog(parent), ui(new Ui::about) { ui->setupUi(this); this->setWindowTitle("关于软件"); } about::~about() { delete ui; } void about::on_pushButton_clicked() { this->close(); } about.ui main.cpp #include "mainwindow.h" #include <QApplication> #include <QTextCodec> int main(int argc, char *argv) { QApplication a(argc, argv); //将QString转换成UTF-8 编码 解决中文乱码问题 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); MainWindow w; w.show(); return a.exec(); }
2015年-11月-26日
11151 阅读
1 评论
QT学习之路
2015-11-26
QT实例2 四则运算器
四则运算器 第一步画好ui 更改控件对象名称 下拉列表框ConBobox选择输入多个Item 后面可以根据Item的index排序 来监测用户选择的项 第二步 完成以下代码 mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include<QMessageboBox> //后面需要使用到对话框操作 namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT //元对象编译器 public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: //元对象编译器自动声明的槽 void on_pushButton_clicked(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } //click()槽实现函数 void MainWindow::on_pushButton_clicked() { //通过QLineEdit的类中方法text()获得单行文本框的String值 //通过QString类的方法toInt();将QString的值转换成对应的Int型整数 int int1=ui->lineEdit->text().toInt(); int int2=ui->lineEdit_2->text().toInt(); int int_result; //获取控件下拉列表框的项 索引值 switch(ui->comboBox->currentIndex()) { case 0: int_result=int1+int2; break; case 1: int_result=int1-int2; break; case 2: int_result=int1*int2; break; case 3: if(int2==0) { QMessageBox::warning(this,"Error Message","Second Can't be Zero!"); return; } int_result=int1/int2; break; //控件只定义了4个Item 所以不会有default default: break; } //通过QString类中number()方法将int型转换成QString类型 然后在文本框输出出来! ui->lineEdit_3->setText(QString::number(int_result)); //弹出对话框窗口 MessageboBox 输出结果 QMessageBox::information(this,"Result:",QString::number(int_result)); } 测试输入 1/0 查询提示结果 12312
2015年-11月-26日
7807 阅读
0 评论
QT学习之路
2015-11-25
QT实例1 打开程序
打开一个程序实例 第一步 画好设计ui 第二步 选择submitPushButton 右击 go to slot 选择clicked() 编写函数 第三步 函数体解析 QTcreator 自动添加槽声明 添加头文件 QProcess QProcess *myProcess = new QProcess(parent); //产生一个myProcess 然后调用start方法 启动此程序! myProcess->start(program, arguments); 在cmdLineEdit 单行文本框中取出文件 头文件查找QLineEdit 获得取文本函数text(); QString::trimmed () const QString str = " lots\t of\nwhitespace\r\n "; str = str.trimmed(); 函数去除字符串后的空格 // str == "lots\t of\nwhitespace" #include "mainwindow.h" #include "ui_mainwindow.h" #include <QProcess> #include <QString> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //初始submitButton 不可以使用 ui->submitPushButton->setEnabled(false); //固定窗口大小 this->setMaximumSize(400,250); this->setMinimumSize(400,250); //LineEdit控件中textEdited的方法获得是否在输入字符! QObject::connect(ui->cmdLineEdit,SIGNAL(textEdited(QString)),this,SLOT(setButtonEnableSlot(QString))); //连接comLinedeit发出的信号监测Enter键是否按下,this对象的槽产生on_pushButton_clicked();操作! QObject::connect(ui->cmdLineEdit,SIGNAL(returnPressed()),this,SLOT(on_pushButton_clicked())); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { //new一个新的进程对象 QProcess *process = new QProcess; //ui上面的LineEdit的text()方法获取QString文本 QString startProgram=ui->cmdLineEdit->text(); //利用trimmed()去除QString startProgarm后面含有的空格 process->start(startProgram.trimmed()); ui->cmdLineEdit->clear(); //清空cmdLineDdit this->close(); //关闭窗体 } void MainWindow::setButtonEnableSlot(QString) { ui->submitPushButton->setEnabled(true); //打开submitButton按钮 }
2015年-11月-25日
11392 阅读
0 评论
QT学习之路
2015-11-23
MySQL command line client 使用命令
1.输入密码:** 2.use mysql;使用Mysql 3.show databases;显示数据库 4.use register;使用数据库名为register 5.show tables;显示register数据库中的表 6.describe user;对表user进行操作: 7.quit;退出 insert into user(username,password) values("xiaoyan","123456");插入数据 insert into user(username,password) values("ff","123456");插入数据 delete from user where username="xiaoyan";删除数据 update user set username="xiaoyan" where username="ff";更新数据 select * from user;查询数据 1、显示当前数据库服务器中的数据库列表: mysql> show databases; 注意:mysql库里面有MYSQL的系统信息,我们改密码和新增用户,实际上就是用这个库进行操作。 2、显示数据库中的数据表: mysql> use 库名; mysql> show tables; 3、显示数据表的结构: mysql> describe 表名; 4、建立数据库: mysql> create database 库名; 5、建立数据表: mysql> use 库名; mysql> create table 表名 (列名 字段类型,学号 int ,姓名 varchar(20), 性别 char(1),列名 text,........); mysql> alter table 表名 add column 列名 字段类型; //已经建立的数据表,添加列项; 6、删除数据库: mysql>drop database 库名; 7、删除数据表: mysql> drop table 表名; 8、将表中记录清空: mysql> delete from 表名; 9、显示数据表中的全部语句: mysql> select * from 表名; 条件显示数据表中部分语句: mysql> select 列名(或者 * 信息全部显示) from 表名 where 列 ="字段名中某个实例"; //*将where选中的实例的全部信息显示出来 或者列 !="字段名中某个实例"; 将不是此列中的实例名 全部列举出来 10A、往表中删除记录: mysql> delete from 表名 where id(项名)=6; //删除所有ID等于6的项 10B、往表中插入记录: mysql> insert into 表名 values(1,”M”); //与第5条建立的表的格式 对应输入 11、更新表中数据: mysql-> update 表名 set 列名1=’a',列名2=’b’ where 列名3=’c'; //where 通过列名选择出来实例然后set赋值修改 12、用文本方式将数据装入数据表中: mysql> load data local infile “D:/mysql.txt” into table 表名; 13、导入.sql文件命令: mysql> use 数据库名; mysql> source d:/mysql.sql; 14、命令行修改root密码: mysql> update mysql.user set password=password('123456') where user='root'; mysql>flush privileges; 15、显示当前正在use的数据库名: mysql> select database(); 16、显示当前的user: mysql> select user(); 以上基本涵盖了应用程序需要用到MySQL数据库的基本操作 增 删 改 查 select 函数多功能 mysql>select 1/0; mysql>select 1>0; mysql>select 1<0; mysql>select current_time; mysql>select current_date; 查询字段的Comment show full columns from 表名 select column_comment from INFORMATION_SCHEMA.Columns where table_name='表名' and column_name='字段明'
2015年-11月-23日
7613 阅读
2 评论
Web程序设计
2015-11-22
自定义槽(QT基础知识)
部件编译快捷 F3 信号槽编辑快捷键 F4 Ctrl + R 编译运行 Shift +Alt +R 模拟运行ui Ctrl + H 水平布局 Ctrl + L 垂直布局 定义和声明之间的切换快捷键 F4 实现自定义槽的两种方法 第一种 1.写好槽的声明(接口)和实现 // coustom slots private slots: void changeTitleSlot(); void MainWindow::changeTitleSlot() { this->setWindowTitle("Hello World!"); } 2.完成conect //链接槽 QObject::connect(ui->changeTitleButton,SIGNAL(clicked()),this,SLOT(changeTitleSlot())); //当前changeTitleButton发送一个SIGNAL(clicked())的信号 至this 要求此类行为SLOT(changeTitleSlot()) 第二种 在button右键选择转到槽(go to slot) 自动添加声明和实现函数 函数体部分直接完成即可 无需链接! 优先选用第一种!
2015年-11月-22日
10588 阅读
1 评论
QT学习之路
2015-11-21
搭建QT编译环境
开始学习QT开发,首先需要搭建QT开发环境,我选择的是QT4.8.5的开发环境 虽然已经有很多新版本了,首先下载 1. qt-win-opensource-4.8.5-mingw.exe 2.qt-creator-windows-opensource-2.8.0.exe 3. MinGW-gcc440_1 下载地址:在最下方网盘内 以下安装默认路径全部全部将C:该为D:,because xxx; 第一步: 安装QT Creator运行qt-creator-windows-opensource-2.8.0.exe 下一步 安装路径D:\Qt\qtcreator-2.8.0 默认安装即可 第二步: 下载MinGW-gcc440_1解压至D:\QT\mingw根目录 (注意下面的QT4.8.5安装MinGW也同样改至D:\QT\mingw) 第三步: 安装qt-win-opensource-4.8.5-mingw.exe同样修改安装路径至D:\Qt\4.8.5 第五步 添加环境变量 (如何添加请百度) Path内容中增加两项 D:\Qt\4.8.5\bin; D:\Qt\qtcreator-2.8.0\bin; 如果舍去此步骤debug产生的.exe文件无法运行 qmake命令将无法找到显示不是内部命令 第六步 链接QTcreator和QT4.8.5 打开QTcreator 选择工具->选项 ->构建和运行->QT版本 ->添加(如图) 打开QTcreator 选择工具->选项 ->构建和运行->编译器 ->添加(如图) 测试是否安装完成 在开始菜单中选择Qt 4.8.5 Command Prompt 程序 在F:\hello\main.cpp 文件中写入以下代码 #include<QApplication> #include<QLabel> int main(int argc,char **argv) { QApplication app(argc,argv); QLabel *label =new QLabel; label ->setText("Hello world"); label ->show(); return app.exec(); } 切换至 f:\hello 盘 在DOS中输入命令 qmake -project //创建一个project qmake //QT编译 mingw32-make //生成Windows 应用程序 在debug文件夹下 hello.exe //运行hello.exe 当出现hello world完成QT开发环境搭建 可以运行但是无法调试错误解决办法 Debugging starts Debugging has failed Debugging has finished 原因:Qt Creator 3.5.1需要更新版本的GDB。从http://qt-project.org/wiki/QtCreatorBuildGdb 下载qtcreator-gdb-7.4-MINGW32_NT-6.1-i686,解压后放到MinGW目录下,让后从Qt Creator中 工具-》选项-》构建和运行-》Debuggers 选项选择MinGW目录中的gdb-i686-pc-mingw32.exe即可 百度网盘:QT 提取码:rs54
2015年-11月-21日
12496 阅读
0 评论
QT学习之路
8
9
10
11
12