#master

# -*- coding: utf-8 -*-
import sys
#reload(sys)
sys.setdefaultencoding("utf-8") import pymongo import random, time, Queue
from multiprocessing import freeze_support
from multiprocessing.managers import BaseManager global connetion
connetion=pymongo.MongoClient('192.168.30.79',27017)
#connection=pymongo.MongoClient('mongodb://10.10.5.216:27017')
dbs=connetion.database_names()
for i in dbs:
print("mongdb connect successful")
print (i+"\n")
db=connetion.get_database('5wdomian_0519')
table11=db.get_collection('DeviceData')
table12=db.get_collection('DeviceDataSource')
table13=db.get_collection('Device')
# ####################################################################
# 发送任务的队列:
task_queue = Queue.Queue(maxsize=100)
# 接收结果的队列:
result_queue = Queue.Queue() # 从BaseManager继承的QueueManager:
class QueueManager(BaseManager):
pass def return_task_queue():
global task_queue
return task_queue def return_result_queue():
global result_queue
return result_queue def test():
# 把两个Queue都注册到网络上, callable参数关联了Queue对象:
# QueueManager.register('get_task_queue', callable=lambda: task_queue)
# QueueManager.register('get_result_queue', callable=lambda: result_queue)
QueueManager.register('get_task_queue', callable=return_task_queue)
QueueManager.register('get_result_queue', callable=return_result_queue) # 绑定端口5000, 设置验证码'abc':
manager = QueueManager(address=('192.168.30.72', 5001), authkey=b'abc')
# 启动Queue:
manager.start()
# 获得通过网络访问的Queue对象:
task = manager.get_task_queue()
result = manager.get_result_queue()
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
type='type'
sourceId='sourceId'
devId='devId'
content='content'
fileId='fileId'
subName='subName'
name='name'
aa=[]
bb=[]
cc=[]
#aa=list(type1[:])
config='config'
cdpTable='cdpTable'
routeTable='routeTable'
showCommand='showCommand'
arpTable='arpTable'
stpTable='stpTable'
macTable='macTable'
commonTable='commonTable'
nctTable='nctTable'
bgpNbrTable='bgpNbrTable'
dis_benchID='0d537ee8-ecec-4f45-9d52-e5660300d92d'
k=0
type1=table11.find({sourceId:dis_benchID},{type:1,sourceId:1,devId:1,content:1,fileId:1,subName:1,name:1},no_cursor_timeout=True)
type2=[]
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# 放几个任务进去:
try:
for i in type1: type2.append(i)
if len(type2)==5:
print (len(type2))
task.put(type2)
type2=[]
#print (i)
k+=5
print (k)
print ('queue size is'+str(task.qsize()))
if len(type2)!=0:
task.put(type2)
except Exception as e:
print (e)
# 从result队列读取结果:
type1.close()
print('Try get results...')
#for i in range(100):
r=result.get()
#print (r)
# print('Result: %s' % r)
# 关闭:
while r=='done':
manager.shutdown()
print('master exit.') if __name__ == '__main__':
freeze_support()
test() #worker
# -*- coding : utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import os
import pymongo
import datetime
from gridfs import GridFS import time, sys, Queue
from multiprocessing.managers import BaseManager
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global connetion
connetion=pymongo.MongoClient('192.168.30.79',27017)
path='C:\\soft'
#connection=pymongo.MongoClient('mongodb://10.10.5.216:27017')
dbs=connetion.database_names()
for i in dbs:
print("mongdb connect successful")
print (i+"\n")
db=connetion.get_database('5wdomian_0519')
#table11=db.get_collection('DeviceData')
table12=db.get_collection('DeviceDataSource')
table13=db.get_collection('Device')
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% class QueueManager(BaseManager):
pass QueueManager.register('get_task_queue')
QueueManager.register('get_result_queue')
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
type='type'
sourceId='sourceId'
devId='devId'
content='content'
fileId='fileId'
subName='subName'
name='name'
aa=[]
bb=[]
cc=[]
#aa=list(type1[:])
config='config'
cdpTable='cdpTable'
routeTable='routeTable'
showCommand='showCommand'
arpTable='arpTable'
stpTable='stpTable'
macTable='macTable'
commonTable='commonTable'
nctTable='nctTable'
bgpNbrTable='bgpNbrTable'
dis_benchID='79aa8379-5bf4-42a7-9682-c71cf95f9873' #type1=table11.find({},{type:1,sourceId:1,devId:1,content:1,fileId:1,subName:1,name:1},no_cursor_timeout=True)
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% server_addr = '192.168.30.72'
print('Connect to server %s...' % server_addr) m = QueueManager(address=(server_addr, 5001), authkey=b'abc') try:
m.connect()
except :
print('please start task_master.py!')
sys.exit("sorry, goodbye!"); task = m.get_task_queue()
result = m.get_result_queue() try:
while True:
if not task.empty():
b=task.get()
for a in b:
print (a)
key1=a.keys()
if fileId not in key1:
if sourceId not in key1:
if not os.path.exists(path+"\\errdata"):
os.mkdir(path+"\\errdata")
else:
with open(path+"\\errdata\\errdata.txt",'a') as fe:
fe.write(str(a)+"\n")
else: #bb=list(table22[:]) #cc=list(table33[:])
table22=table12.find({},{'startTime':'True','srcType':'True'},no_cursor_timeout=True)
table33=table13.find({},{'name':'True','mip':'True'},no_cursor_timeout=True)
for b in table22:
if(a[u'sourceId']==b[u'_id']):
b1=(str(b[u'startTime'])+str(b[u'srcType'])).replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
path1=path+"\\"+b1
if not os.path.exists(path1):
os.mkdir(path1)
ty=str(a[u'type']) l1=len(str(ty))
if (ty[(l1-4):]=='Orig'):
if(ty[0:(l1-4)]==arpTable):
typename='ArpTable'
elif(ty[0:(l1-4)]==cdpTable):
typename='CdpTable'
elif(ty[0:(l1-4)]==bgpNbrTable):
typename='BGPAdRoutingTable'
elif(ty[0:(l1-4)]==routeTable):
typename='RoutingTable'
elif(ty[0:(l1-4)]==config):
typename='ConfigFile'
elif(ty[0:(l1-4)]==showCommand):
typename='ShowCommand'
elif(ty[0:(l1-4)]==stpTable):
typename='StpTable'
elif(ty[0:(l1-4)]==macTable):
typename='MacTable'
elif(ty[0:(l1-4)]==nctTable):
typename='CommonTable'
else:typename='unkown'+ty
path2=path1+"\\"+typename
if not os.path.exists(path2):
os.mkdir(path2) for c in table33:
if (a[u'devId']==c[u'_id']):
if(ty[0:(l1-4)]==arpTable):
if "subName" in key1:
hostname1=str(c[u'name']+"$management.txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname1
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
else:
hostname1=str(c[u'name']+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname1
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
elif(ty[0:(l1-4)]==cdpTable):
hostname1=str(c[u'name']+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname1
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
elif(ty[0:(l1-4)]==routeTable):
hostname1=str(c[u'name'])
if "subName" in key1:
hostname_file=str(hostname1+"$"+a[u'subName']['vrf']+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname_file
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
else:
hostname_file=str(hostname1+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname_file
with open(hostname2,'w') as f1:
f1.write(a[u'content']) elif(ty[0:(l1-4)]==showCommand):
hostname1=str(c[u'name']+"$0$"+a[u'name']+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname1
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
elif(ty[0:(l1-4)]==config):
hostname1=str(c[u'name']+".config").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname1
with open(hostname2,'wb') as f1:
f1.write(a[u'content'])
elif(ty[0:(l1-4)]==macTable):
hostname1=str(c[u'name']+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname1
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
elif(ty[0:(l1-4)]==stpTable):
hostname1=str(c[u'name']+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname1
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
elif(ty[0:(l1-4)]==bgpNbrTable):
if "subName" in key1:
hostname1=str(c[u'name'])
hostname_ip=a[u'subName']['peIp']
key2=a[u'subName'].keys()
if "vrf" in a[u'subName'].keys():
hostname_vrf=a[u'subName']['vrf']
hostname_file=str(hostname1+"$"+hostname_ip+"$"+hostname_vrf+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname_file
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
else:
hostname_file=str(hostname1+"$"+hostname_ip+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname_file
with open(hostname2,'w') as f1:
f1.write(a[u'content']) else:
hostname1=str(c[u'name'])
hostname_ip=c[u'mip']
hostname_file=str(hostname1+"$"+hostname_ip+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname_file
with open(hostname2,'w') as f1:
f1.write(a[u'content'])
elif(ty[0:(l1-4)]==nctTable): hostname1=str(c[u'name'])
hostname_name=a[u'name'] hostname_file=str(hostname1+"$$"+hostname_name+".txt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname2=path2+"\\"+hostname_file
with open(hostname2,'w') as f1:
f1.write(a[u'content']) else:
if(ty==arpTable):
typename='ArpTable'
elif(ty==cdpTable):
typename='CdpTable'
elif(ty==bgpNbrTable):
typename='BGPAdRoutingTable'
elif(ty==routeTable):
typename='RoutingTable'
elif(ty==config):
typename='ConfigFile'
elif(ty==showCommand):
typename='ShowCommand'
elif(ty==stpTable):
typename='StpTable'
elif(ty==macTable):
typename='MacTable'
elif(ty==nctTable):
typename='CommonTable'
else:typename='unkown'+ty
path2=path1+"\\"+typename
if not os.path.exists(path2):
os.mkdir(path2)
for c in table33:
if (a[u'devId']==c[u'_id']):
if(ty==arpTable):
hostname=str(c[u'name'])
if "subName" in key1:
hostname_vrf=a[u'subName']['vrf']
filename=str(hostname+"$"+hostname_vrf+"$"+"default-live.oat").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
else:
filename=str(hostname+"$$"+"default-live.oat").replace("*","XD").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
elif(ty==cdpTable):
hostname=str(c[u'name'])
if "subName" in key1:
hostname_vrf=a[u'subName']['vrf']
filename=str(hostname+"$"+hostname_vrf+"$"+"default-live.cdp").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
else:
filename=str(hostname+"$$"+"default-live.cdp").replace("*","XD").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
elif(ty==routeTable):
hostname=str(c[u'name'])
if "subName" in key1:
hostname_vrf=a[u'subName']['vrf']
filename=str(hostname+"$"+hostname_vrf+"$"+"default-live.ort").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
else:
filename=str(hostname+"$$"+"default-live.ort").replace("*","XD").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
elif(ty==showCommand):
hostname=str(c[u'name'])
hostname_vrf=str(a[u'name'])
filename=str(hostname+"$0$"+hostname_vrf+".txt").replace("*","XD").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
elif(ty==config):
hostname=str(c[u'name']).replace("*","XD").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF') filename=hostname+".config"
hostname4=path2+"\\"+filename
with open(hostname4,'wb') as f2:
f2.write(a[u'content'].decode('utf8'))
elif(ty==macTable):
hostname=str(c[u'name'])
if "subName" in key1:
hostname_vrf=a[u'subName']['vrf']
filename=str(hostname+"$"+hostname_vrf+"$"+"default-live.omt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
else:
filename=str(hostname+"$$"+"default-live.omt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
elif(ty==stpTable):
hostname=str(c[u'name'])
if "subName" in key1:
hostname_vrf=a[u'subName']['vrf']
filename=str(hostname+"$"+hostname_vrf+"$"+"default-live.stp").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
else:
filename=str(hostname+"$$"+"default-live.stp").replace("*","XD").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
elif(ty==bgpNbrTable):
hostname=str(c[u'name'])
if "subName" in key1:
hostname_ip=a[u'subName']['peIp']
if "vrf" in a[u'subName'].keys():
hostname_vrf=a[u'subName'][u'vrf']
filename=str(hostname+"$"+hostname_ip+"$"+"default-live"+"$"+hostname_vrf+".obgprt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
else:
filename=str(hostname+"$"+hostname_ip+"$"+"default-live.obgprt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content']) else:
hostname_ip=c[u'mip'] filename=str(hostname+"$"+hostname_ip+"$"+"default-live.obgprt").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
elif(ty==nctTable):
hostname=str(c[u'name']) hostname_name=a[u'name'] filename=str(hostname+"$$"+hostname_name+".csv").replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
hostname4=path2+"\\"+filename
with open(hostname4,'w') as f2:
f2.write(a[u'content'])
table33.close()
table22.close()
else:
if a[u'fileId']!=None:
fs=GridFS(db)
table22=table12.find({},{'startTime':'True'})
bb=list(table22[:])
table33=table13.find({},{'name':'True'})
cc=list(table33[:])
for b in bb:
if(a[u'sourceId']==b[u'_id']):
b1=str(b[u'startTime']).replace("X","XX").replace("*","XD").replace("/","XA").replace(":","XC").replace("<","XG").replace(">","XH").replace("|","XI").replace("\\","XB").replace("?","XE").replace('"','XF')
path1=path+"\\"+b1
if not os.path.exists(path1):
os.mkdir(path1)
fileid=a[u'fileId']
print (fileid)
path2=path1+"\\"+str(fileid)+'.big'
f=fs.get(fileid).read()
with open(path2,'w') as f3:
f3.write(f)
#time.sleep(1)
else:
break
except Queue.Empty:
print('task queue is empty.')
#result.put('done') time.sleep(10)
print('worker exit...') if __name__ == '__main__':
pass

python+rabbitmq实现分布式的更多相关文章

  1. Python RabbitMQ消息队列

    python内的队列queue 线程 queue:不同线程交互,不能夸进程 进程 queue:只能用于父进程与子进程,或者同一父进程下的多个子进程,进行交互 注:不同的两个独立进程是不能交互的.   ...

  2. python—Celery异步分布式

    python—Celery异步分布式 Celery  是一个python开发的异步分布式任务调度模块,是一个消息传输的中间件,可以理解为一个邮箱,每当应用程序调用celery的异步任务时,会向brok ...

  3. Python之路-python(rabbitmq、redis)

    一.RabbitMQ队列 安装python rabbitMQ module pip install pika or easy_install pika or 源码 https://pypi.pytho ...

  4. python RabbitMQ队列/redis

    RabbitMQ队列 rabbitMQ是消息队列:想想之前的我们学过队列queue:threading queue(线程queue,多个线程之间进行数据交互).进程queue(父进程与子进程进行交互或 ...

  5. python RabbitMQ队列使用(入门篇)

    ---恢复内容开始--- python RabbitMQ队列使用 关于python的queue介绍 关于python的队列,内置的有两种,一种是线程queue,另一种是进程queue,但是这两种que ...

  6. python RabbitMQ队列使用

    python RabbitMQ队列使用 关于python的queue介绍 关于python的队列,内置的有两种,一种是线程queue,另一种是进程queue,但是这两种queue都是只能在同一个进程下 ...

  7. RabbitMQ解决分布式事务

    案例:经典案例,以目前流行点外卖的案例,用户下单后,调用订单服务,让后订单服务调用派单系统通知送外卖人员送单,这时候订单系统与派单系统采用MQ异步通讯. RabbitMQ解决分布式事务原理: 采用最终 ...

  8. RabbitMq解决分布式事物

    一.RabbitMQ解决分布式事务思路: 案例: 经典案例,以目前流行点外卖的案例,用户下单后,调用订单服务,让后订单服务调用派单系统通知送外卖人员送单,这时候订单系统与派单系统采用MQ异步通讯. 二 ...

  9. 使用RabbitMQ实现分布式事务

    RabbitMQ解决分布式事务思路: 案例: 经典案例,以目前流行点外卖的案例,用户下单后,调用订单服务,让后订单服务调用派单系统通知送外卖人员送单,这时候订单系统与派单系统采用MQ异步通讯. Rab ...

随机推荐

  1. 转:CWebBrowser2去除边框、滚动条、右键菜单

    http://blog.csdn.net/tangyin025/article/details/8675513 添加CWebBrowser2类 右键项目-〉Add-〉Class...-〉MFC-〉MF ...

  2. python 课堂笔记-if语句

    # Author:zyl _username = 'zyl' _password = 'zyl123' username = input("username:") password ...

  3. dll和lib

    lib:里面包含了很多源代码,工程会将这些源代码加入自己的项目中编译: dll:动态编译库,允许可执行文件在运行中加载里面的资源. 使用lib需注意两个文件:(1).h头文件,包含lib中说明输出的类 ...

  4. MySQL实验1: 新建一个名为 library 的数据库,包含 book、reader 两张表,根据自己的理解安排表的内容并插入数据。

    数据表(table)简称表,它是数据库最重要的组成部分之一.数据库只是一个框架,表才是实质内容. 实验: 新建一个名为 library的数据库,包含 book.reader两张表,根据自己的理解安排表 ...

  5. 有些 where 条件会导致索引无效

    在查询中,WHERE 条件也是一个比较重要的因素,尽量少并且是合理的 where条件是徆重要的,尽量在多个条件的时候,把会提取尽量少数据量的条件放在前面,减少后一个 where 条件的查询时间.有些 ...

  6. java.lang.NullPointerException报错的几种情况

    java.lang.NullPointerException报错的几种情况: 1.字符串变量未初始化: 2.接口类型的对象没有用具体的类初始化,比如: List stuList :这种情况就会报空指针 ...

  7. Struts的url-pattern配置问题

    一,servlet容器对url的匹配过程: 当一个请求发送到servlet容器的时候,容器先会将请求的url减去当前应用上下文的路径作为servlet的映射url,比如我访问的是http://loca ...

  8. EF Code-First 学习之旅

    什么是Code-First 基本工作流: 写好应用程序的领域类和上下文类→配置领域类的额外映射→运行程序→Code-First API创建新的数据库或与现有数据库对应→添加种子数据到数据库中测试

  9. MAC 系列 之XCode7.1 + HBuilder MUI 离线打包 ipa 上次application leader 问题:ERROR ITMS - 90534

    解决方法:这个原因 网上说法是 beta 测试版本:不过的确是beta版本(7.3 beta)打包的,所以我有下载了一个正式版本 7.1版本. 再次进行测试打包!

  10. ML 神经网络 NeuralNetworks

    神经网络 Neural Networks 1 为什么要用神经网络? 既然前面降了逻辑回归,为什么还需要神经网络呢?前面我们制定在非线性分类问题中,也可以使用逻辑回归进行分类,不过我们的特征变量就变成了 ...