我的Debian 7 armel嵌入式系统目前有g ++ 4.6,我想升级到g ++ 4.9以使用新的C++ 11功能.我怎么做?
我目前的sources.list内容是:
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
deb http://ftp.us.debian.org/debian wheezy main non-free
deb-src http://ftp.us.debian.org/debian wheezy main non-free
一个简单的apt-get安装包不起作用:
root@arm:~# apt-get install g++-4.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package g++-4.9
E: Couldn't find any package by regex 'g++-4.9'
所有,
我试图安装Python Couchbase的lib在我的Linux服务器,但它与"libcouchbase/couchbase.h:没有这样的文件或目录"失败.我也找不到哪个包包含couchbase.h文件.我怎样才能解决这个问题?
ubuntu@ip-172-31-17-167:~$ sudo easy_install couchbase
Searching for couchbase
Reading https://pypi.python.org/simple/couchbase/
Best match: couchbase 1.2.4
Downloading https://pypi.python.org/packages/source/c/couchbase/couchbase-1.2.4.tar.gz#md5=4a51bf3ac1fa26bcb9433d53ac4ba34b
Processing couchbase-1.2.4.tar.gz
Writing /tmp/easy_install-ZF8OtY/couchbase-1.2.4/setup.cfg
Running couchbase-1.2.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZF8OtY/couchbase-1.2.4/egg-dist-tmp-Az4Noq
In file included from src/exceptions.c:17:0:
src/pycbc.h:25:36: fatal error: libcouchbase/couchbase.h: No such file or directory
#include
^
compilation terminated.
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
ubuntu@ip-172-31-17-167:~$ apt-file search couchbase.h
python-celery-doc: /usr/share/doc/python-celery-doc/html/_modules/celery/backends/couchbase.html
python-celery-doc: /usr/share/doc/python-celery-doc/html/internals/reference/celery.backends.couchbase.html
我试图在我的EC2上运行一个简单的Python TCP服务器,监听端口6666.我已经创建了一个入站TCP防火墙规则来打开端口6666,并且对传出端口没有限制.
我无法从外部世界连接到我的实例,但是使用telnet或netcat进行测试永远无法建立连接.如果我从localhost建立连接,事情确实有效.
关于什么可能是错的任何想法?
#!/usr/bin/env python
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 6666
BUFFER_SIZE = 20 # Normally 1024, but we want fast response
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connection address:', addr
while 1:
data = conn.recv(BUFFER_SIZE)
if not data: break
print "received data:", data
conn.send(data) # echo
conn.close()
我正在尝试使用cqlsh在Cassandra上创建一个简单的表.语法是:
CREATE TABLE TEST(
timestamp timestamp,
system_id text,
hostname text,
cpu_pct float,
memory_used bigint,
PRIMARY_KEY(system_id, timestamp)
);
当我运行这个时,我得到了这个错误.怎么修?
ErrorMessage code=2000 [Syntax error in CQL query] message="line 8:0 missing EOF at ')' (...,PRIMARY_KEY(system_id, timestamp)[)];)"
我正在使用C++ 11,我想知道处理现有C++字符串最优雅的是什么,它只包含下面这些有效字符.效率也是一个问题,但最重要的是寻找优雅.
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
谢谢你,维吉尔.
我正在使用Pika 0.98测试RabbitMQ的生产者消费者示例.我的生产者在我的本地PC上运行,消费者在亚马逊的EC2实例上运行.
我的生产者坐在循环中,每秒发送一些系统属性.问题是我只看到消费者阅读每一条第二条消息,就好像每条第二条消息都没有被阅读.例如,我的生产者打印出这个(时间戳,使用的cpu pct,使用的RAM):
2014-08-16 14:36:17.576000 -0700,16.0,8050806784
2014-08-16 14:36:18.578000 -0700,15.5,8064458752
2014-08-16 14:36:19.579000 -0700,15.0,8075313152
2014-08-16 14:36:20.580000 -0700,12.1,8074121216
2014-08-16 14:36:21.581000 -0700,16.0,8077778944
2014-08-16 14:36:22.582000 -0700,14.2,8075038720
但我的消费者正在打印出这个:
Received '2014-08-16 14:36:17.576000 -0700,16.0,8050806784'
Received '2014-08-16 14:36:19.579000 -0700,15.0,8075313152'
Received '2014-08-16 14:36:21.581000 -0700,16.0,8077778944'
生产者的代码是:
import pika
import psutil
import time
import datetime
from dateutil.tz import tzlocal
import logging
logging.getLogger('pika').setLevel(logging.DEBUG)
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='54.191.161.213'))
channel = connection.channel()
channel.queue_declare(queue='ems.data')
while True:
now = datetime.datetime.now(tzlocal())
timestamp = now.strftime('%Y-%m-%d %H:%M:%S.%f %z')
msg="%s,%.1f,%d" % (timestamp, psutil.cpu_percent(),psutil.virtual_memory().used)
channel.basic_publish(exchange='',
routing_key='ems.data',
body=msg)
print msg
time.sleep(1)
connection.close() …Run Code Online (Sandbox Code Playgroud) 我有一个现有的Python系统,它使用Rabbit MQ接收消息.使用Python使用WebSockets将这些事件推送到浏览器的绝对最简单的方法是什么?如果解决方案也适用于所有主流浏览器,则可获得奖励
谢谢,维吉尔