#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. ReactNative学习一

    ReactNative   主要学习来源于RN官方文档https://reactnative.cn/docs/0.51/getting-started.html 不过除了这个RN官方文档,其他RN中文 ...

  2. cookie的路径和域

    1.Cookie的路径介绍 我们知道Cookie 的属性有很多,其中有一个属性是路径path.有些人认为Cookie 的路径指的是Cookie 在客户端的保存路径,其实并不是.Cookie 的路径是相 ...

  3. 【Head First Servlets and JSP】笔记9:属性的作用域、线程安全

    什么是属性? 属性和参数 属性的3个作用域 属性API 属性不好的一面 1.到底什么是属性(Attribute)? 属性就是一个对象,可以被设置(bound,也可以叫绑定)到另外三个servlet A ...

  4. cocos2dx打飞机项目笔记五:CCSpriteBatchNode 的使用

    在上一节里,在头文件看到 定义了一个 CCSpriteBatchNode* batchNode;,在addEnemy方法里看到 batchNode->addChild(enemy); 新建的敌机 ...

  5. linux 虚拟机在线添加新磁盘

    在线添加磁盘,扩展LVM卷案例   一.添加硬盘,在线扫描出来 首先到虚拟机那里添加一块硬盘,注意必须是SCSI类型的硬盘. 扫描硬盘,不用重启操作系统的. echo "- - -" ...

  6. ML 感知机(Perceptrons)

    感知机 Perceptrons 学习Hinton神经网络公开课的学习笔记 https://class.coursera.org/neuralnets-2012-001 1 感知机历史 在19世纪60年 ...

  7. javascript(jquery)_匿名函数

    一.什么是匿名函数 匿名函数:就是没有函数名的函数 二.为什么使用匿名函数 1.最大的用处就是创建闭包 三.匿名函数定义(怎么使用匿名函数) 1.这种方法使用了Function构造函数,把参数列表和函 ...

  8. Codeforces Round #283 (Div. 2) A ,B ,C 暴力,暴力,暴力

    A. Minimum Difficulty time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  9. 云服务器pip下载老失败怎么办?

    pip install -i https://pypi.douban.com/simple django==1.9

  10. 天地图OGC WMTS服务规则

    图层名称 服务地址 投影类型 矢量底图 http://t0.tianditu.gov.cn/vec_c/wmts?tk=您的密钥 经纬度投影 http://t0.tianditu.gov.cn/vec ...