目前我有这本字典,印刷使用pprint:
{'AlarmExTempHum': '\x00\x00\x00\x00\x00\x00\x00\x00',
'AlarmIn': 0,
'AlarmOut': '\x00\x00',
'AlarmRain': 0,
'AlarmSoilLeaf': '\x00\x00\x00\x00',
'BarTrend': 60,
'BatteryStatus': 0,
'BatteryVolts': 4.751953125,
'CRC': 55003,
'EOL': '\n\r',
'ETDay': 0,
'ETMonth': 0,
'ETYear': 0,
'ExtraHum1': None,
'ExtraHum2': None,
'ExtraHum3': None,
'ExtraHum4': None,
'ExtraHum5': None,
'ExtraHum6': None,
'ExtraHum7': None,
'ExtraTemp1': None,
'ExtraTemp2': None,
'ExtraTemp3': None,
'ExtraTemp4': None,
'ExtraTemp5': None,
'ExtraTemp6': None,
'ExtraTemp7': None,
'ForecastIcon': 2,
'ForecastRuleNo': 122,
'HumIn': 31,
'HumOut': 94,
'LOO': 'LOO',
'LeafTemps': '\xff\xff\xff\xff',
'LeafWetness': '\xff\xff\xff\x00',
'NextRec': 37,
'PacketType': 0,
'Pressure': 995.9363359295631,
'RainDay': 0.0,
'RainMonth': …Run Code Online (Sandbox Code Playgroud) 我需要从mysql表中检索具有唯一值的最新行.简单的表格布局是时间戳(now())和用户名列.该表每秒获取几次新数据,我需要用户名唯一的最新行.
SELECT MAX(timestamp) as timestamp, username
FROM bla
WHERE timestamp < (now() - interval 30 minute)
GROUP BY username
ORDER BY timestamp DESC
Run Code Online (Sandbox Code Playgroud)
看来这个查询没有返回最新值,可能是因为该组正在做一些我不想要的事情......
我似乎无法弄清楚如何正确设置我的刻度间隔.
需要在X轴上按小时计时.
数据是基于分钟的.
使用Javascript:
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'spline'
},
title: {
text: 'Temperature Today'
},
xAxis: {
type: "datetime",
categories: time,
dateTimeLabelFormats: {
day: '%h'
},
minTickInterval: 24 * 36000000 * 1000,
},
yAxis: {
title: {
text: 'Temperature'
},
minorGridLineWidth: 0,
gridLineWidth: 0,
alternateGridColor: null
},
tooltip: {
formatter: function() {
return ''+
Highcharts.dateFormat('%e. %b %Y, %H:00', this.x) +': '+ this.y;
}
},
plotOptions: {
spline: …Run Code Online (Sandbox Code Playgroud) 我正在寻找一个函数来在 $PATH 中可用的所有文件夹中查找二进制文件。
我知道我可以使用 os.Getenv("PATH") 但它返回:
path: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin
Run Code Online (Sandbox Code Playgroud)
哪个需要处理。
理想情况下,函数如下:FindBinary("ntpq"),它将返回路径+二进制名称,如果在路径中找不到,则返回 false。
有人有现成的功能吗?
上传文件后,我需要直接检索公共对象URL,以便能够将其存储在数据库中。这是我的上传代码:
s3 = boto3.resource('s3')
s3bucket.upload_file(filepath, objectname, ExtraArgs={'StorageClass': 'STANDARD_IA'})
Run Code Online (Sandbox Code Playgroud)
我不是在寻找预先签名的URL,而只是希望始终可以通过https公开访问的URL。
任何帮助表示赞赏。
我正在对天气数据库进行SQL查询,我需要wind_direction和windspeed.
这是我目前的查询:
SELECT wind_direction,
windspeed
FROM weather
WHERE time >= curdate() and
time < (curdate() + interval 1 day) AND
windspeed > 0
ORDER BY wind_direction ASC
Run Code Online (Sandbox Code Playgroud)
这将删除windspeed = 0的所有值,并仅显示今天的数据.
查询输出:
wind_direction windspeed
0 10.1
0 11.2
23 7.6
23 1.4
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我得到的重复值是可以理解的,但我的图形系统不支持这一点,它不知道使用哪个值.
我需要的是一个独特的wind_direction和avg()为这个方向的风速.
我有一个天气数据库,每70秒获取一次数据集(取决于气象站何时提供数据).
我想用Pchart绘图,但我的样本太多,所以X轴搞砸了.
所以我想要大约每5分钟一次的数据.(或每30分钟)
我目前的查询是这样的:
SELECT time, temp_out FROM wmr200 WHERE date(time) = curdate()
Run Code Online (Sandbox Code Playgroud)
这样可以获得过去24小时的样本,但有太多样本.
我和Jquery一起使用Jconfirm来制作一个确认框.
问题是.submit不起作用
$('#delete').submit(function(e) {
e.preventDefault();
jConfirm("Are you sure you want to delete this link?", "Confirmation", function(r) {
if (r) { $('#delete').submit(); }
});
Run Code Online (Sandbox Code Playgroud)
$('#delete').submit(); 好像死了.
<form action="bla.php" method="post" accept-charset="utf-8" id="delete">
<table>
<tr>
<td><label for="category">Category:</label></td><td><select name="category_id" id="categories">
<option value="1">test</option>
<option value="#" selected="selected">Please select</option>
</select></td>
</tr>
<tr>
<td><label for="links">Link:</label></td><td width="400"><select name="link_id" id="links">
<option value="#" selected="selected">Please select</option>
</select></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Delete" ></td>
</tr>
</table>
</form>
Run Code Online (Sandbox Code Playgroud) I have a script that logs a bit of data to disk:
logging.basicConfig(filename='davis-debug.log',level=logging.DEBUG)
logging.basicConfig(filename='davis-error.log',level=logging.ERROR)
logging.basicConfig(filename='davis-error.log',level=logging.WARNING)
logging.basicConfig(filename='davis-error.log',level=logging.CRITICAL)
当我像这样使用 python-daemon 时,日志记录停止。
try:
with daemon.DaemonContext():
station = VantageProStation()
station.run()
except KeyboardInterrupt:
logging.critical('Stopping user aborted with CTRL+C')
pass
Run Code Online (Sandbox Code Playgroud)
我尝试过 file_preserve,但 logging.basicConfig 不返回流。
我也不能使用files_preserve 传递多个流..?
我当然希望我的日志记录继续,我试图将日志定义放在我的类init 中,但也没有帮助。
有人有在 2 个不同的 s3 提供商之间同步存储桶的解决方案吗?
例如,一个是 Amazon S3,第二个是 Wasabi S3?
这涉及 2 个不同的端点和 2 组不同的凭据。
最好不先在本地存储数据,大约1+百万个文件。
mysql ×3
python ×3
amazon-s3 ×2
javascript ×2
pchart ×2
python-2.7 ×2
sql ×2
boto3 ×1
go ×1
highcharts ×1
html ×1
jquery ×1
python-3.6 ×1