Windows Subsystem for Linux 与 GPS 的串行通信。
Adafruit GPS 连接到 Arduino Nano,后者连接到COM10. 在Windows Subsystem for Linux这相当于/dev/ttyS10
要求: pyserial
我写了一个简单的脚本来从 GPS 模块读取信息:
import serial
def select_sentence():
""" This function sends serial data to the GPS module to display only GPGGA and GPRMC"""
def read_gps():
ser = serial.Serial("/dev/ttyS10", 9600)
while True:
print(ser.readline().decode('utf-8'))
if __name__ == "__main__":
select_sentence()
read_gps()
Run Code Online (Sandbox Code Playgroud)
在我选择的 virtualenv 中Python3,当我执行它时,我得到Permission Error了串行端口,/ttyS10所以我选择sudo chmod 666 /dev/ttyS10在virtualenv.
但是,是否有替代上述方法 …
我webpack在打字稿项目中使用。我正在学习创建 3 个文件的教程webpack:
webpack.common.jswebpack.production.jswebpack.development.js在本教程中package.json,"scripts"秒数如下:
"build": "webpack --config webpack.$NODE_ENV.js"
Run Code Online (Sandbox Code Playgroud)
我一直在研究以下 SE 查询来设置NODE_ENVWindows 10。
我在 PowerShell 中执行的位置:
$env:NODE_ENV="development"
Run Code Online (Sandbox Code Playgroud)
但是,一旦我执行npm run build脚本仍然采用$NODE_ENV字符串并且不替换值。
cross-env如果这对我不起作用,我可能会转向稍后,但我想在 PowerShell 中尝试环境变量。
什么应该是等效的命令:
NODE_ENV=development npm run build
NODE_ENV=production npm run build
Run Code Online (Sandbox Code Playgroud)
在Windows和我应该如何改变scripts,我package.json即 $NODE_ENV接受变量?
cross-envcross-env通过执行以下操作可以实现类似的使用:
npm i --save-dev cross-env内"scripts"添加:
"build-dev": "cross-env NODE_ENV=development webpack --config webpack.%NODE_ENV%.js"
"build-prod": "cross-env NODE_ENV=production webpack …Run Code Online (Sandbox Code Playgroud)javascript environment-variables node.js webpack npm-scripts
我有一个简单的python应用程序,它可以:
包装要求:
certifi==2018.4.16
chardet==3.0.4
idna==2.6
influxdb==5.0.0
pynmea2==1.12.0
pyserial==3.4
python-dateutil==2.7.3
pytz==2018.4
requests==2.18.4
six==1.11.0
urllib3==1.22
Run Code Online (Sandbox Code Playgroud)
上面是通过使用以下命令生成的:
pip3 install pynmea2 pyserial influxdb
在OpenEmbedded Layers Index我已经找到pyserial的Python3包中。这暗示着我可能需要做的事情pip3 install pynmea2 influxdb。
在考虑所有上述pip依赖关系的情况下,如何继续编写应用程序的配方?
我没有找到有关编写python应用程序食谱的任何教程。(相反,Node应用程序确实在yocto的Wiki页面上有一些指导。
在检查meta-python层中的一些配方后,我发现了一些.inc文件,但不确定如何处理
.patch使用编辑器编辑 a 是标准做法吗?
我.patch在 Yocto 应用程序中使用,我想对我希望移植到我的嵌入式设备的存储库进行一些小的更改。
其中一个补丁如下(为酿造删除了一些细节):
From 85987c659762939241e4bdd4223e63eb5997b181 Mon Sep 17 00:00:00 2001
OE ships php5 as php
---
airmar/airmar.php | 2 +-
n2kd/n2kd_monitor | 2 +-
send-message/format-message | 2 +-
util/list-product-information | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/airmar/airmar.php b/airmar/airmar.php
index ccd4b4d..46ed49d 100755
--- a/airmar/airmar.php
+++ b/airmar/airmar.php
@@ -1,4 +1,4 @@
-#!/usr/bin/php5
+#!/usr/bin/env php
<?php
if (!is_array($argv))
{
diff --git a/n2kd/n2kd_monitor b/n2kd/n2kd_monitor
index f8cfd42..4cb4766 100755
--- a/n2kd/n2kd_monitor
+++ b/n2kd/n2kd_monitor …Run Code Online (Sandbox Code Playgroud) 我很好奇是否可以在Nest.js 的Request Body 中获取XML 数据。
"dependencies": {
"@nestjs/common": "^7.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/platform-express": "^7.0.0",
Run Code Online (Sandbox Code Playgroud)
我希望调用一个 HTTP POST API/EPCIS/capture来获取 XML 文档,如下所示:
"dependencies": {
"@nestjs/common": "^7.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/platform-express": "^7.0.0",
Run Code Online (Sandbox Code Playgroud)
在我的控制器中:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epcis:EPCISDocument
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:epcis="urn:epcglobal:epcis:xsd:1"
xmlns:epcglobal="urn:epcglobal:xsd:1"
xsi:schemaLocation="urn:epcglobal:epcis:xsd:1 EPCglobal-epcis-1_0.xsd"
creationDate="2008-03-16T22:13:16.397+01:00"
schemaVersion="1.0">
<EPCISBody>
<EventList>
<ObjectEvent>
<eventTime>2008-03-16T22:13:16.397+01:00</eventTime>
<eventTimeZoneOffset>+01:00</eventTimeZoneOffset>
<epcList>
<epc>urn:epc:id:sgtin:0614141.107346.2017</epc>
<epc>urn:epc:id:sgtin:0614141.107346.2018</epc>
</epcList>
<action>OBSERVE</action>
<bizStep>urn:epcglobal:epcis:bizstep:fmcg:shipped</bizStep>
<disposition>urn:epcglobal:epcis:disp:fmcg:unknown</disposition>
<readPoint>
<id>urn:epc:id:sgln:0614141.07346.1234</id>
</readPoint>
<bizLocation>
<id>urn:epcglobal:fmcg:loc:0614141073467.A23-49</id>
</bizLocation>
<bizTransactionList>
<bizTransaction type="urn:epcglobal:fmcg:btt:po">
http://transaction.acme.com/po/12345678
</bizTransaction>
</bizTransactionList>
</ObjectEvent>
</EventList>
</EPCISBody>
</epcis:EPCISDocument>
Run Code Online (Sandbox Code Playgroud)
但我得到的只是{}在记录传入的请求正文时。我的邮递员设置已经提到:
Content-Type: application/xml
并在Body我粘贴了上面提到的 …
我有以下功能:
#!/bin/bash
get_instance{
dbname=$(sqlplus -s / as sysdba<<EOF
set pages 0
set feedback off
select name from v\$database;
exit;
EOF)
echo $dbname
}
get_instance
Run Code Online (Sandbox Code Playgroud)
它似乎工作。在错误消息的中间,我得到了我的dbname,但仍然返回一个语法错误。
oracle@testdb01:db01:/home/oracle/
> ./test.sh
./test.sh: line 3: get_instance{: command not found
DB01
./test.sh: line 11: syntax error near unexpected token `}'
./test.sh: line 11: `}'
Run Code Online (Sandbox Code Playgroud)
如果我完全删除函数调用,我会得到没有错误的结果:
dbname=$(sqlplus -s / as sysdba<<EOF
set pages 0
set feedback off
select name from v\$database;
exit;
EOF)
echo $dbname
oracle@testdb01:db01:/home/oracle
> ./test.sh
DB01
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能让它在函数中工作?
以下建议在 EOF 标签后放置括号并添加 …
我有一个用户界面,我正在使用它ngb-tabset并ngb-tab呈现以下内容:
用户在表单上方输入一些内容,并在Graph NavigationTab下获得图形可视化,如下所示:
用户现在可以单击Semantic Query选项卡并从子组件获取信息。
但是,当用户重新单击Graph Navigation选项卡时,我收到以下错误:
myDiagram is undefined
Run Code Online (Sandbox Code Playgroud)
wheremyDiagram是go.Diagram从父组件获取信息并呈现图表的实例。(GoJS)
parent.component.html
<ngb-tabset>
<ngb-tab title="Graph Navigation">
<template ngbTabContent>
<explore-search-details [config]="visData" [lang]="language"></explore-search-details>
</template>
</ngb-tab>
<ngb-tab title="Semantic Query">
<template ngbTabContent>
<explore-search-semantic></explore-search-semantic>
</template>
</ngb-tab>
</ngb-tabset>
Run Code Online (Sandbox Code Playgroud)
explore-search-details是一个子组件,它采用visData和language作为来自父组件的输入变量。
在explore-search-details.component.html里面有一个div如下负责渲染
<div #myDiagramDiv></div>
Run Code Online (Sandbox Code Playgroud)
angular 2.4.0, ng-bootstrap 1.0.0-alpha.21
我的地址中有一个错误myDiagram是一个go.Diagram类型变量,它在ngOnChanges()和ngAfterViewInit()生命周期钩子中使用,在选项卡切换回后未定义。
我编写了一个简单的脚本来在我的主板上使用 3G UMTS 适配器。
bash脚本如下:
#!/bin/bash
sleep 1;
/usr/bin/tmux new-session -d -s Cloud
/usr/bin/tmux set-option set-remain-on-exit on
/usr/bin/tmux new-window -d -n 'usb_modeswitch' -t Cloud:2 '/usr/sbin/usb_modeswitch --default-vendor 12d1 --default-product 1446 -J';
/usr/bin/tmux new-window -d -n 'wvdial' -t Cloud:1 'sleep 10; /usr/bin/wvdialconf; /usr/bin/wvdial';
Run Code Online (Sandbox Code Playgroud)
其对应的systemd脚本如下:
[Unit]
Description=Enable UMTS Dongle for Cloud Connectivity
[Service]
Type=oneshot
ExecStart=/usr/umts.sh
RemainAfterExit=true
[Install]
WantedBy=default.target
Run Code Online (Sandbox Code Playgroud)
我还有其他此类systemd文件用于某些应用程序文件,我目前已直接在板上编写这些文件,但希望它们可用于我为新板制作的每个图像。
我应该如何在食谱方面解决这个问题?
我想创建自己的 Yocto 层:
meta-custom
------ recipes-custom/
------------- files / all such scripts here
------------ custom_1.0.bb
Run Code Online (Sandbox Code Playgroud)
我应该只执行食谱do_install() …
我在D3.js V.4.12中使用了Angular Typescript,尤其是在使用Tidy Radial Tree表示产品时。
与一起ng-cli,我安装npm install --save d3并创建了一个组件来显示信息。
可视化效果如下所示:
各个组件如下:
treediag.component.ts
import { Component, OnInit, ViewEncapsulation} from '@angular/core';
import * as d3 from 'd3';
import { ont, ont_highchair } from '../fd-ontology/ontology';
import { recursionParse, ontNode } from './model/recursion';
export class leaf {
name: string;
url: string;
color: string;
children: leaf[] = [];
}
@Component({
selector: 'app-treediag',
templateUrl: './treediag.component.html',
styleUrls: ['./treediag.component.css'],
encapsulation: ViewEncapsulation.None
})
export class TreediagComponent implements OnInit …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用JSON调整产品的本体及其属性。下面提到的JSON结构是什么,我想。
每个产品(概念)都有两种类型的属性:1.数据属性2.对象属性
使用Protege时,这些属性的典型定义如下SO Thread:
在Protégé中,有用于创建对象属性和数据类型属性的不同选项卡。如果属性应将个人与个人相关联,则它必须是对象属性,而如果将个人与文字相关联,则它必须是数据类型属性。
我认为每个属性都具有以下属性:
name: string
url: string
type: dataprop or objprop
objPropSource: available only for Objproperties
Run Code Online (Sandbox Code Playgroud)
我已经绘制了一个小的递归JSON,如下所示:
{
"name": "chair",
"url": "http://namespace.org#chair",
"type": "main",
"properties": [
{
"name": "height",
"url": "http://namespace.org#height",
"type": "dataprop"
},
{
"name": "width",
"url": "http://namespace.org#width",
"type": "dataprop"
},
{
"name": "horizontalsurface",
"url": "http://namespace.org#horizontalsurface",
"type": "objprop",
"objPropSource": "http://namespace.org#hasHorizontalSurface",
"properties": [
{
"name": "Legislation",
"url": "http://namespace.org#legislation",
"type": "objprop",
"objPropSource": "http://namespace.org#compliesWithLegislation",
"properties": [
{
"name": "hasLegislationName",
"url": "http://namespace.org#hasLegislationName",
"type": "dataprop"
}
]
}
] …Run Code Online (Sandbox Code Playgroud) typescript ×3
yocto ×3
angular ×2
bash ×2
python-3.x ×2
d3.js ×1
git ×1
gojs ×1
heredoc ×1
http-post ×1
javascript ×1
json ×1
linux ×1
nestjs ×1
ng-bootstrap ×1
node.js ×1
npm-scripts ×1
ontology ×1
patch ×1
python ×1
recursion ×1
solaris-10 ×1
sqlplus ×1
variables ×1
virtualenv ×1
webpack ×1
xml ×1