middle-statured


安装 activemq-admin

  1. apt-get update 更新包
  2. apt-get install activemq 安装activemq
  3. ln -s /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main
    将instances-enabled/main复制快捷方式至/etc/activemq/instances-available/main
  4. 如果想开放远程:进入/etc/activemq/instances-enabled/main/activemq.xml
    修改为

    <transportConnectors>
    <transportConnector name="openwire"uri="tcp:/127.0.0.1:61616"/>
    </transportConnectors>

    默认为本地访问

  5. 打开程序 service activemq start 或 /etc/init.d/activemq start
  6. ps –ef | grep activemq 查看打开状态

修复 activemq-admin

ln -s /usr/share/activemq/bin/run.jar /usr/bin/run.jar




937-510-2311


USB虚拟串口设备无法使用、驱动载入异常(39)

  1. USB虚拟串口突然出现黄色感叹号,更新驱动时提示“Windows 无法加载这个硬件的设备驱动程序。驱动程序可能已损坏或不见了。 (代码 39)”
  2. 根据下面的常用硬件设备GUID找到串口的GUID,描述为Serial and parallel ports,得到GUID值4d36e978-e325-11ce-bfc1-08002be10318。
  3. 找到注册表中对应的位置:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e978-e325-11ce-bfc1-08002be10318}
  4. 删除键UPPERFILTERS
  5. 从端口(COM和LPT)中删除有黄色感叹号的端口
  6. 操作(A)->扫描检测硬件改动(A)重新加载端口

常用硬件设备GUID
ClassGUIDDevice Description
CDROM4D36E965-E325-11CE-BFC1-08002BE10318CD/DVD/Blu-ray drives
DiskDrive4D36E967-E325-11CE-BFC1-08002BE10318Hard drives
Display4D36E968-E325-11CE-BFC1-08002BE10318Video adapters
FDC4D36E969-E325-11CE-BFC1-08002BE10318Floppy controllers
FloppyDisk4D36E980-E325-11CE-BFC1-08002BE10318Floppy drives
HDC4D36E96A-E325-11CE-BFC1-08002BE10318Hard drive controllers
HIDClass745A17A0-74D3-11D0-B6FE-00A0C90F57DASome USB devices
13946BDD1FC1-810F-11D0-BEC7-08002BE2092FIEEE 1394 host controller
Image6BDD1FC6-810F-11D0-BEC7-08002BE2092FCameras and scanners
Keyboard4D36E96B-E325-11CE-BFC1-08002BE10318Keyboards
Modem4D36E96D-E325-11CE-BFC1-08002BE10318Modems
Mouse4D36E96F-E325-11CE-BFC1-08002BE10318Mice and pointing devices
Media4D36E96C-E325-11CE-BFC1-08002BE10318Audio and video devices
Net4D36E972-E325-11CE-BFC1-08002BE10318Network adapters
Ports4D36E978-E325-11CE-BFC1-08002BE10318Serial and parallel ports
SCSIAdapter4D36E97B-E325-11CE-BFC1-08002BE10318SCSI and RAID controllers
System4D36E97D-E325-11CE-BFC1-08002BE10318System buses, bridges, etc.
USB36FC9E60-C465-11CF-8056-444553540000USB host controllers and hubs


Flask-SocketIO 实例


Flask-SocketIO 项目地址:/github.com/miguelgrinberg/Flask-SocketIO/


服务器端程序

from flask import Flask, render_template
from flask_socketio import SocketIO, emit
    
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)

@app.route('/')
def index():
    return render_template('index.html')

@socketio.on('my event', namespace='/test'))
def test_message(message):
    emit('my response', {'data': 'got it!'})

@socketio.on('my broadcast event', namespace='/test')
def test_message(message):
    emit('my response', {'data': message['data']}, broadcast=True)

@socketio.on('connect', namespace='/test')
def test_connect():
    emit('my response', {'data': 'Connected'})

@socketio.on('disconnect', namespace='/test')
def test_disconnect():
    print('Client disconnected')

if __name__ == '__main__':
    socketio.run(app)

客户端程序

$(document).ready(function(){
    let namespace = '/test';
    let socket = io.connect(location.protocol + '/' + document.domain + ':' + location.port + namespace);
    socket.on('my response', function(msg) {
        console.debug('data receive', msg);
        $('#log').append('<p>Received: ' + msg.data + '</p>');
    });
    $('form#emit').submit(function(event) {
        console.debug('my event');
        socket.emit('my event', {data: $('#emit_data').val()});
        return false;
    });
    $('form#broadcast').submit(function(event) {
        console.debug('my broadcast event');
        socket.emit('my broadcast event', {data: $('#broadcast_data').val()});
        return false;
    });
});


设置NPM镜像源


临时设置镜像源:

npm --registry /registry.npm.taobao.org install express

永久设置镜像源:

npm config set registry /registry.npm.taobao.org

查看镜像源设置状态

npm config get registry
npm info express

使用CNPM替代:

npm install -g cnpm --registry=/registry.npm.taobao.org

NPM镜像源:

淘宝:/npm.taobao.org/