PySide开发MySql远程备份工具

MySql数据库安装在机房,而工作人员日常办公的地方距离机房有段距离,且不在同一楼层。出入机房不是很方便。就想着能否给这些人员开发一个图形化的备份MySql数据库的小工具?
使用组件如下:
(1)Python
(2)PySide
(3)mysqldump
其实mysql已经提供了一个mysqldump.exe来做mysql数据库的备份,也支持远程操作,但因为是命令行形式的,对于普通的工作人员来说使用起来就非常不方便了,这个小工具的原理就是使用PySide对mysqldump.exe做一封装,提供GUI接口。
里面值得注意的是Thread和subprocess的结合,具体详见如下代码:

ContractedBlock.gifExpandedBlockStart.gifView Code
########################################################################
class BackupThread(QThread):
"""备份数据库线程"""
dataReady
= Signal(object)
config
= ApplicationConfig()
#----------------------------------------------------------------------
def run(self):
"""具体执行部分"""
self.dataReady.emit(u
"正在执行,请稍后......")
#加载配置信息
self.config.load()
#组织备份数据库所需要的命令
filestamp= time.strftime("%Y-%m-%d")

filename
= "%s-%s.sql" % (self.config.databasename, filestamp)
filename
= os.path.join(self.config.backupdir, filename)
mysqldumpfile
= os.path.join(os.getcwd(), "mysqldump.exe")
command
= "%s -u %s -p%s -h %s -e --opt -c %s" % (mysqldumpfile, self.config.user, self.config.password, self.config.remoteIp, self.config.databasename)
print command
pipe
= subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
#print pipe.stdout.readlines()
#promptMsg= "".join(pipe.stdout.readlines())
#print "promptMsg is:", promptMsg
fp= open(filename, "w")
item
= None
for line in pipe.stdout:
fp.writelines(line)
self.dataReady.emit(line)
fp.close()
completeMsg
= "";
#取出最后一个item,判断里面的内容是否包含
if item is not None:
text
= item.text()
if text.find("Dump completed") > 0:
print "Completed"
completeMsg
= u"开始压缩,请稍后......"
#计算压缩后的文件名
compressedfilename= os.path.splittext(filename)[0] + ".zip"
if self.compress(filename, compressedfilename):
completeMsg
= u"压缩文件出错,请检查!"
else:
completeMsg
= u"操作已完成,请检查!"
else:
completeMsg
= u"操作过程中出现错误,请检查!"
else:
completeMsg
= u"操作过程中出现错误,请检查!"

self.dataReady.emit(completeMsg)

全部代码如下所示:
(1)ApplicationConfig.py

ContractedBlock.gifExpandedBlockStart.gifView Code
#-*-coding:utf-8-*-

import ConfigParser


########################################################################
class ApplicationConfig:
"""
程序相关配置信息
"""

#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
self.remoteIp
= "127.0.0.1"
self.remotePort
= "3306"
self.user
= "root"
self.password
= ""
self.databasename
= ""
self.backupdir
= "c:\\"
self.config
= ConfigParser.ConfigParser()

#----------------------------------------------------------------------
def load(self):
"""
加载配置信息
"""
try:
self.config.read(r
".\ApplicationConfig.cfg")
self.remoteIp
= self.config.get("mysql", "remoteip")
self.remotePort
= self.config.get("mysql", "remoteport")
self.user
= self.config.get("mysql", "user")
self.password
= self.config.get("mysql", "password")
self.databasename
= self.config.get("mysql", "databasename")
self.backupdir
= self.config.get("mysql", "backupdir")
except Exception as ex:
print "Some exception occured when invoke load(), exception message is ", ex, " please check it !"

#----------------------------------------------------------------------
def save(self):
"""
保存配置信息
"""
self.config.read(r
".\ApplicationConfig.cfg")
if "mysql" not in self.config.sections():
self.config.add_section(
"mysql")
self.config.set(
"mysql", "remoteip", self.remoteIp)
self.config.set(
"mysql", "remoteport", self.remotePort)
self.config.set(
"mysql", "user", self.user)
self.config.set(
"mysql", "password", self.password)
self.config.set(
"mysql", "databasename", self.databasename)
self.config.set(
"mysql", "backupdir", self.backupdir)
fp
= open(r".\ApplicationConfig.cfg", "w")
self.config.write(fp)
#----------------------------------------------------------------------
def __str__(self):
"""
返回相应的字符串表示
"""
description
= "remoteip : \t" + self.remoteIp + "\n" + \
"user : \t" + self.user + "\n" +\
"password : \t"+ self.password+ "\n"+ \
"databasename \t" + self.databasename + "\n" + \
"backupdir : \t" + self.backupdir + "\n"
return description
(2)MainForm.py
ContractedBlock.gifExpandedBlockStart.gifView Code
# -*- coding: utf-8 -*-

import sys
reload(sys)
sys.setdefaultencoding(
'utf-8')

from PySide.QtCore import *
from PySide.QtGui import *
import os
import time
import subprocess
import zipfile


from ApplicationConfig import ApplicationConfig

class ConfigurationPage(QWidget):
def __init__(self, parent=None):
super(ConfigurationPage, self).
__init__(parent)
self.configGroup
= QGroupBox(u"相关配置信息")

self.remoteIPLabel
= QLabel(u"数据库所在IP地址:")
self.editRemoteIP
= QLineEdit(u"数据库所在IP地址")
self.remotePortLabel
= QLabel(u"使用端口:")
self.editPort
= QLineEdit(u"使用端口")
self.userLabel
= QLabel(u"用户名:")
self.editUser
= QLineEdit(u"用户名")
self.passwordLabel
= QLabel(u"密码:")
self.editPassword
= QLineEdit(u"密码")
self.dabasenameLabel
= QLabel(u"数据库名:")
self.editDatabaseName
= QLineEdit(u"数据库名")
self.backupdirLabel
= QLabel(u"备份文件存放目录:")
self.editBackupDir
= QLineEdit(u"备份文件存放目录")
self.browseButton
= QPushButton(u"浏览")
self.browseButton.clicked.connect(self.onBrowse)

self.paremeterLayout
= QGridLayout();
self.paremeterLayout.addWidget(self.remoteIPLabel, 0, 0)
self.paremeterLayout.addWidget(self.editRemoteIP, 0,
1, 1, 2)
self.paremeterLayout.addWidget(self.remotePortLabel,
1, 0)
self.paremeterLayout.addWidget(self.editPort,
1, 1, 1, 2)
self.paremeterLayout.addWidget(self.userLabel,
2, 0)
self.paremeterLayout.addWidget(self.editUser,
2, 1, 1, 2)
self.paremeterLayout.addWidget(self.passwordLabel,
3, 0)
self.paremeterLayout.addWidget(self.editPassword,
3, 1, 1, 2)
self.paremeterLayout.addWidget(self.dabasenameLabel,
4, 0)
self.paremeterLayout.addWidget(self.editDatabaseName,
4, 1, 1, 2)
self.paremeterLayout.addWidget(self.backupdirLabel,
5, 0)
self.paremeterLayout.addWidget(self.editBackupDir,
5, 1)
self.paremeterLayout.addWidget(self.browseButton,
5, 2)

self.btnSave
= QPushButton(u"保存")
self.btnSave.setMinimumHeight(
50)
self.btnSave.clicked.connect(self.onSave)

self.configGroup.setLayout(self.paremeterLayout)

self.mainLayout
= QVBoxLayout()
self.mainLayout.addWidget(self.configGroup)
self.mainLayout.addSpacing(
20)
self.mainLayout.addWidget(self.btnSave)
self.mainLayout.addStretch(
1)

self.setLayout(self.mainLayout)

self.config
= ApplicationConfig()
self.doInitialize()
#----------------------------------------------------------------------
def onSave(self):
"""保存处理"""
try:
self.config.remoteIp
= self.editRemoteIP.text()
self.config.remotePort
= self.editPort.text()
self.config.user
= self.editUser.text()
self.config.password
= self.editPassword.text()
self.config.databasename
= self.editDatabaseName.text()
self.config.backupdir
= self.editBackupDir.text()
self.config.save()
except:
print "some exceptions occured when invoke onSave() method, please check it!"
#print unicode(self.config.remoteIp)
#----------------------------------------------------------------------
def onBrowse(self):
"""选择目录"""
directory
= QFileDialog.getExistingDirectory(self, u"查找备份目录",
QDir.currentPath())
if directory:
self.editBackupDir.setText(directory)

#----------------------------------------------------------------------
def doInitialize(self):
"""初始化相关参数"""
self.config.load()
self.editRemoteIP.setText(unicode(self.config.remoteIp))
self.editPort.setText(unicode(self.config.remotePort))
self.editUser.setText(unicode(self.config.user))
self.editPassword.setText(unicode(self.config.password))
self.editDatabaseName.setText(unicode(self.config.databasename))
self.editBackupDir.setText(unicode(self.config.backupdir))


########################################################################
class BackupThread(QThread):
"""备份数据库线程"""
dataReady
= Signal(object)
config
= ApplicationConfig()
#----------------------------------------------------------------------
def run(self):
"""具体执行部分"""
self.dataReady.emit(u
"正在执行,请稍后......")
#加载配置信息
self.config.load()
#组织备份数据库所需要的命令
filestamp= time.strftime("%Y-%m-%d")

filename
= "%s-%s.sql" % (self.config.databasename, filestamp)
filename
= os.path.join(self.config.backupdir, filename)
mysqldumpfile
= os.path.join(os.getcwd(), "mysqldump.exe")
command
= "%s -u %s -p%s -h %s -e --opt -c %s" % (mysqldumpfile, self.config.user, self.config.password, self.config.remoteIp, self.config.databasename)
print command
pipe
= subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
#print pipe.stdout.readlines()
#promptMsg= "".join(pipe.stdout.readlines())
#print "promptMsg is:", promptMsg
fp= open(filename, "w")
item
= None
for line in pipe.stdout:
fp.writelines(line)
self.dataReady.emit(line)
fp.close()
completeMsg
= "";
#取出最后一个item,判断里面的内容是否包含
if item is not None:
text
= item.text()
if text.find("Dump completed") > 0:
print "Completed"
completeMsg
= u"开始压缩,请稍后......"
#计算压缩后的文件名
compressedfilename= os.path.splittext(filename)[0] + ".zip"
if self.compress(filename, compressedfilename):
completeMsg
= u"压缩文件出错,请检查!"
else:
completeMsg
= u"操作已完成,请检查!"
else:
completeMsg
= u"操作过程中出现错误,请检查!"
else:
completeMsg
= u"操作过程中出现错误,请检查!"

self.dataReady.emit(completeMsg)

########################################################################
class BackupPage(QWidget):
""""""

#----------------------------------------------------------------------
def __init__(self, parent=None):
"""Constructor"""
super(BackupPage, self).
__init__(parent)
self.backupButton
= QPushButton(u"备份数据库")
self.backupButton.setMinimumHeight(
50)
self.backupButton.clicked.connect(self.doBackupOperation)
self.labelPrompt
= QLabel(u"提示信息") #执行结果显示
self.listPrompt = QListWidget()
self.labelPrompt.setWordWrap(True)
self.layout
= QVBoxLayout()
self.layout.addStretch()
self.layout.addWidget(self.backupButton)
#self.layout.addSpacing(20)
self.layout.addWidget(self.labelPrompt)
self.layout.addWidget(self.listPrompt)
self.layout.addStretch()
self.config
= ApplicationConfig()
self.thread
= BackupThread() #备份线程
self.thread.dataReady.connect(self.updateUI, Qt.QueuedConnection)
self.setLayout(self.layout)
#----------------------------------------------------------------------
def doBackupOperation(self):
"""执行备份数据库的任务"""
#self.labelPrompt.setText(u"正在执行,请稍后......")
##加载配置信息
#self.config.load()
##组织备份数据库所需要的命令
#filestamp= time.strftime("%Y-%m-%d")

#filename = "%s-%s.sql" % (self.config.databasename, filestamp)
#filename = os.path.join(self.config.backupdir, filename)
#mysqldumpfile = os.path.join(os.getcwd(), "mysqldump.exe")
#command= "%s -u %s -p%s -h %s -e --opt -c %s" % (mysqldumpfile, self.config.user, self.config.password, self.config.remoteIp, self.config.databasename)
#print command
#pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
#fp= open(filename, "w")
#item = None
#for line in pipe.stdout:
#fp.writelines(line)
#item = QListWidgetItem(line)
#self.listPrompt.addItem(item)
#if self.listPrompt.count() > 0:
#self.listPrompt.setCurrentRow(self.listPrompt.count() - 1)
#pass
#fp.close()
#self.listPrompt.setFocus()
#completeMsg= "";
##取出最后一个item,判断里面的内容是否包含
#if item is not None:
#text= item.text()
#if text.find("Dump completed") > 0:
#print "Completed"
#completeMsg = u"开始压缩,请稍后......"
##计算压缩后的文件名
#compressedfilename= os.path.splittext(filename)[0] + ".zip"
#if self.compress(filename, compressedfilename):
#completeMsg = u"压缩文件出错,请检查!"
#else:
#completeMsg = u"操作已完成,请检查!"
#else:
#completeMsg = u"操作过程中出现错误,请检查!"
#else:
#completeMsg = u"操作过程中出现错误,请检查!"
#self.labelPrompt.setText(completeMsg)

self.thread.start()
#启动线程
#----------------------------------------------------------------------
def updateUI(self, data):
"""更新UI部分处理"""
item
= QListWidgetItem(data)
self.listPrompt.addItem(data)
self.listPrompt.setFocus()
#----------------------------------------------------------------------
def compress(self, infilename, dstfilename, level = 9):
"""压缩"""
result
= False;
try:
zfile
= zipfile.ZipFile(dstfilename, "w")
zfile.write(infilename, os.path.split(infilename)[
1])
zfile.close()
result
= True
except:
print "some error occured when invoke (), please check it!"
result
= False

return result;


########################################################################
class HelpPage(QWidget):
""""""

#----------------------------------------------------------------------
def __init__(self, parent=None):
"""Constructor"""
super(HelpPage, self).
__init__(parent)
self.helpLabel
= QLabel(u"使用说明:\n\t"
u
"(1)备份数据前请检查相关配置信息是否正确\n\t"
u
"(2)点击备份数据库按钮,等待本分操作完成\n\t"
u
"(3)请留意备份过程中是否有错误信息\n\t")

self.layout
= QVBoxLayout()
self.layout.addSpacing(
10)
self.layout.addWidget(self.helpLabel)
self.layout.addStretch(
1)

self.setLayout(self.layout)

class MainDialog(QDialog):
#----------------------------------------------------------------------
def __init__(self, parent=None):
"""初始化函数
"""
super(MainDialog, self).
__init__(parent)

#Create Widgets

self.contentsWidget
= QListWidget()
self.contentsWidget.setViewMode(QListView.IconMode)
self.contentsWidget.setIconSize(QSize(
96, 84))
self.contentsWidget.setMovement(QListView.Static)
self.contentsWidget.setMaximumWidth(
128 + 10)
self.contentsWidget.setMinimumHeight((
84 + 12 ) * 4)
self.contentsWidget.setSpacing(
12)

self.pagesWidget
= QStackedWidget()
self.pagesWidget.addWidget(ConfigurationPage())
self.pagesWidget.addWidget(BackupPage())
self.pagesWidget.addWidget(HelpPage())

self.closeButton
= QPushButton(u"退出")

self.createIcons()
self.contentsWidget.setCurrentRow(0)

self.closeButton.clicked.connect(self.close)

self.horizontalLayout
= QHBoxLayout()
self.horizontalLayout.addWidget(self.contentsWidget)
self.horizontalLayout.addWidget(self.pagesWidget,
1)

self.buttonsLayout
= QHBoxLayout()
self.buttonsLayout.addStretch(
1)
self.buttonsLayout.addWidget(self.closeButton)

self.mainLayout
= QVBoxLayout()
self.mainLayout.addLayout(self.horizontalLayout)
self.mainLayout.addSpacing(
12)
self.mainLayout.addLayout(self.buttonsLayout)

self.setLayout(self.mainLayout)

#Add button
self.setWindowTitle(u"数据库备份")

def changePage(self, current, previous):
if not current:
current
= previous

self.pagesWidget.setCurrentIndex(self.contentsWidget.row(current))

def createIcons(self):
configButton
= QListWidgetItem(self.contentsWidget)
configButton.setIcon(QIcon(
'./images/config.png'))
configButton.setText(u
"相关配置信息")
configButton.setTextAlignment(Qt.AlignHCenter)
configButton.setFlags(Qt.ItemIsSelectable
| Qt.ItemIsEnabled)

updateButton
= QListWidgetItem(self.contentsWidget)
updateButton.setIcon(QIcon(
'./images/update.png'))
updateButton.setText(u
"备份")
updateButton.setTextAlignment(Qt.AlignHCenter)
updateButton.setFlags(Qt.ItemIsSelectable
| Qt.ItemIsEnabled)

queryButton
= QListWidgetItem(self.contentsWidget)
queryButton.setIcon(QIcon(
'./images/query.png'))
queryButton.setText(u
"使用说明")
queryButton.setTextAlignment(Qt.AlignHCenter)
queryButton.setFlags(Qt.ItemIsSelectable
| Qt.ItemIsEnabled)

self.contentsWidget.currentItemChanged.connect(self.changePage)

if __name__ == "__main__":
app
= QApplication(sys.argv)
form
= MainDialog()
form.show()
sys.exit(app.exec_())
(3)配置文件ApplicationConfig.cfg
ContractedBlock.gifExpandedBlockStart.gifView Code
[mysql]
remoteport
= 3306
remoteip
= 10.88.81.96
databasename
= test
password
= root
backupdir
= E:/Study/Python/MySqlAssistant
user
= root
执行MainForm.py即可
如果要编译成exe,可采用py2exe,或者cx_freeze进行编译

转载于:https://www.cnblogs.com/Jerryshome/archive/2011/05/10/2042136.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/378440.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

HadoopSourceAnalyse --- Nodemanager Container request handler

Overview Container 是Hadoop中运行任务的地方,当Resourcemanager收到一任务请求后,会向nodemanager 请求一个Container 来运行ApplicationMaster, ApplicationMaster运行起来之后,会继续向Resourcemanager请求新的container来运行…

数据结构 二叉树的存储结构_线程二叉树| 数据结构

数据结构 二叉树的存储结构线程二叉树 (Threaded Binary Tree ) A binary tree can be represented by using array representation or linked list representation. When a binary tree is represented using linked list representation. If any node is not having a child …

七、有机硅柔软剂在不同发展阶段分子结构特征及主要解决的问题?

有机硅柔软剂在不同发展阶段分子结构特征及主要解决的问题? 收集资料阶段 聚有机硅氧烷具有低表面能、优良的润滑性、热稳定性和疏水性。从分子层面分析,经聚有机硅氧烷处理的织物,其柔软性来自硅氧烷骨架中 Si—O—Si键的 360自由旋转及甲基之间的低相互作用。因此,聚有机…

【智能车Code review】——拐点的寻找

博主联系方式: QQ:1540984562 QQ交流群:892023501 群里会有往届的smarters和电赛选手,群里也会不时分享一些有用的资料,有问题可以在群里多问问。 系列文章 【智能车Code review】—曲率计算、最小二乘法拟合 【智能车Code review】——坡道图像与控制处理 【智能车Code re…

linux 单例模式改密码,Java 利用枚举实现单例模式

引言单例模式比较常见的实现方法有懒汉模式,DCL模式公有静态成员等,从Java 1.5版本起,单元素枚举实现单例模式成为最佳的方法。Java枚举基本用法枚举的用法比较多,本文主要旨在介绍利用枚举实现单例模式的原理,所以这里…

编码简介

编码简介最近被字符集搞得头大,基于为自己扫盲的目的,索性收集资料研究一下,现将各方资料归纳成本文。这里并不想把复杂的规则说明一大通。如有需要,请参照其他资料或本文给出的参考资料。 如有错误,欢迎指正。…

2013年5月7日---JS中的正则

/*(1)RegExp对象的test方法------------------C#中的isMatchvar num1d23; //一个字符串var regnew RegExp(^\\d$); //准备正则alert(reg.test(num)); //开始匹配并弹出--false*//*(2)ReExp对象的test方法var num123;var regnew RegExp(/^\d$/);ale…

八、关于防水透湿整理

1,防水透湿整理加工技术的类型? 收集资料阶段 按照加工方式分类 防水透湿织物按照加工方式可分为高密织物、涂层织物和层压织物。不同加工方式所对应的织物各有特色。高密织物产生于 20 世纪 80 年代,它的密度可达到普通织物的 20 倍。在晴朗天气时,纱线孔隙大约为 10 μm…

linux qt 音频文件怎么打开,Qt:获取Linux中可用音频设备的列表

我想要获取我的Linux系统上可用的所有音频设备的列表。然后我会将这个列表显示在一个组合框中,用户将从中选择用于录制/播放的设备。根据用户的选择,我将构建QAudioInput和QAudioOutput进行录制/播放。Qt:获取Linux中可用音频设备的列表根据Q…

c# uri.host_C#| Uri.GetLeftPart()方法与示例

c# uri.hostUri.GetLeftPart()方法 (Uri.GetLeftPart() Method) Uri.GetLeftPart() method is an instance method that is used to get a specified part from the given URI based on passed UriPartial enum. Uri.GetLeftPart()方法是一个实例方法,用于基于传递的…

求质数算法的N种境界 (N 10) zz

★引子 前天,俺在《俺的招聘经验[4]:通过笔试答题能看出啥?》一文,以"求质数"作为例子,介绍了一些考察应聘者的经验。由于本文没有政治敏感内容,顺便就转贴到俺在CSDN的镜像博客。   昨天&…

【智能车Code review】——小S与中S道路判断

博主联系方式: QQ:1540984562 QQ交流群:892023501 群里会有往届的smarters和电赛选手,群里也会不时分享一些有用的资料,有问题可以在群里多问问。 系列文章 【智能车Code review】—曲率计算、最小二乘法拟合 【智能车Code review】——坡道图像与控制处理 【智能车Code re…

Python匿名函数---排序

一、列表的排序 nums [1,2,3,5,4,7,87,4,9,56,44,7,5] nums.sort()#默认从小到大排序 nums#结果为:[1, 2, 3, 4, 4, 5, 5, 7, 7, 9, 44, 56, 87]nums [1,2,3,5,4,7,87,4,9,56,44,7,5] nums.sort(reverseTrue)#从大到小排序 nums#结果为:[87, 56, 44, …

linux 内核编译需要多大空间,编译2.6.28内核出错。。。。空间不足。而/tmp/还有好几G...

编译2.6.28内核出错。。。。空间不足。而/tmp/还有好几G发布时间:2009-01-02 16:56:47来源:红联作者:weixq316今天闲来无事,就去下载了最新的内核--2.6.28来编译安装。。。:0)1放在/usr/src/2.6.28/中编译。。。。。我的/usr还有1G多的空间。…

如何用vi 复制第5行到第10行并粘贴到第12行之后

方法一: 光标放到第五行,输入:y6y光标放到第12行,输入:p方法二:命令行模式下输入:5,10 co 12方法三:延伸一下, 有时候不想费劲看多少行或复制大量行时,可以使用标签来替代光标移到起…

go zap去除程序名称_适用于Zip,Zap和Zoom游戏的Python程序

go zap去除程序名称Write a python program that displays a message as follows for a given number: 编写一个python程序,显示给定数字的消息如下: If it is a multiple of three, display "Zip". 如果是三的倍数,则显示“ Zip…

【智能车Code review】——环岛的判定与补线操作

博主联系方式: QQ:1540984562 QQ交流群:892023501 群里会有往届的smarters和电赛选手,群里也会不时分享一些有用的资料,有问题可以在群里多问问。 视频讲解 这里是对于代码的讲解视频,大约一个小时,需要的同学可以看看:B站:meeting_01 系列文章 【智能车Code review】…

Python交换两个变量的三种方法

一、借助于第三个变量(很常用) a 5 b 6c 0 c a a b b c print("a%d,b%d"%(a,b))#结果为:a6,b5二、如何不借助第三个变量实现两个变量交换数据呢? a 5 b 6a ab b a-b a a-b print("a%d,b%d"%(a,b))#结果为:a…

linux下怎么查kill某个进程,Linux下查询进程PS或者杀死进程kill的小技巧

假设我们要kill掉tomcat:那么我们首先需要tomcat的进程号pid:ps -aux | grep tomcat记下tomcat的PID后,执行:kill PID(tomcat)好了,就到这里....路人甲:小的们,灭了这个欺骗人民情感的家伙&…

【笔记】VB控件MSComm功能介绍

VB中的MSComm 控件通过串行端口传输和接收数据,为应用程序提供串行通讯功能。MSComm控件在串口编程时非常方便,程序员不必去花时间去了解较为复杂的API函数,而且在VC、VB、Delphi等语言中均可使用。 Microsoft Communications Control&#x…