我想在es6中导入jsx文件而不需要.jsx扩展名:
import LoginErrorDialog from './LoginErrorDialogView';
Run Code Online (Sandbox Code Playgroud)
不:
import LoginErrorDialog from './LoginErrorDialogView.jsx';
Run Code Online (Sandbox Code Playgroud)
虽然我已经成功地以这种方式导入webpack:
export default {
entry: './src/ui/js/app.js',
output: {
publicPath: '/',
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.jsx'],
Run Code Online (Sandbox Code Playgroud)
Eslint(esw webpack.config.* ./ --color --ext .js --ext .jsx)仍然是错误的.
Unable to resolve path to module './LoginView' import/no-unresolved
有任何想法吗?
我正在编写我的第一个节点Web服务器(随意给我反馈),使用express和gith进行部署.问题是我在部署后收到以下错误,如果我通过pm2运行脚本,那么该过程似乎被删除了.有任何想法吗?该脚本附在下面.
sudo node server.js
Error: Requested Range Not Satisfiable
at SendStream.error (/home/gareth/node_modules/express/node_modules/send/lib/send.js:145:16)
at SendStream.send (/home/gareth/node_modules/express/node_modules/send/lib/send.js:371:19)
at /home/gareth/node_modules/express/node_modules/send/lib/send.js:323:10
at /home/gareth/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31
at Object.oncomplete (fs.js:107:15)
Completed deployment
Run Code Online (Sandbox Code Playgroud)
Server.js
/*
Webserver
Should use port 80 on production
Mongo DB for database - http://docs.mongodb.org/manual/tutorial/
Use pm2 to ensure it runs forever and load balanced
NPM
https://www.npmjs.org/package/fs
https://www.npmjs.org/package/express
https://www.npmjs.org/package/body-parser
https://www.npmjs.org/package/gith
https://www.npmjs.org/package/nodemailer
*/
// server monitoring
require('newrelic');
var APP = {
// include some scripts
express: require('express'),
fs: require('fs'),
mdb: require('mongodb'),
nodemailer: require('nodemailer'),
gith: require('gith').create(9001),
execFile: require('child_process').execFile, …Run Code Online (Sandbox Code Playgroud) 我试过了
easy_install pyaudio
Run Code Online (Sandbox Code Playgroud)
它不起作用.我得到以下内容:
Searching for pyaudio
Reading http://pypi.python.org/simple/pyaudio/
Reading http://people.csail.mit.edu/hubert/pyaudio/
Best match: pyaudio 0.2.7
Downloading http://people.csail.mit.edu/hubert/pyaudio/packages/pyaudio-0.2.7.tar.gz
Processing pyaudio-0.2.7.tar.gz
Writing /var/folders/vg/98k5hfl52m16wm45ckdx1_5c0000gp/T/easy_install-s1wLkT/PyAudio-0.2.7/setup.cfg
Running PyAudio-0.2.7/setup.py -q bdist_egg --dist-dir /var/folders/vg/98k5hfl52m16wm45ckdx1_5c0000gp/T/easy_install-s1wLkT/PyAudio-0.2.7/egg-dist-tmp-pFDrFR
warning: no files found matching '*.c' under directory 'test'
clang: warning: argument unused during compilation: '-mno-fused-madd'
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1
Run Code Online (Sandbox Code Playgroud) 我使用了一些JavaScript来获取我的Google地图上的路线,但出于某种原因,我一直被重定向到Google地图页面.
问题是当我试图主要是走路时,虽然它也发生在公共交通选择上.
这是一个在PhoneGap中工作的应用程序,虽然我不确定这是PhoneGap的问题.
有没有人见过这个问题,或者任何人都可以看到我的实施问题?
// get drections
directions: function (method) {
// set directions method
method = google.maps.DirectionsTravelMode.WALKING;
if (method === 'public')
method = google.maps.DirectionsTravelMode.TRANSIT;
// current position
var currentPos = new google.maps.LatLng(app.positionCords.latitude, app.positionCords.longitude);
// set the directions options
var request = {
origin: currentPos,
destination: app.venueCords,
travelMode: method
};
// get the directions
app.directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
// set up directions on the map
app.directionsDisplay.setMap(document.getElementById('map'));
app.directionsDisplay.setPanel(document.getElementById('directionsPanel'));
app.directionsDisplay.setDirections(response);
} else {
app.messageBox.alert(app.alertTitle, app.noDirectionsMsg, function(button) …Run Code Online (Sandbox Code Playgroud) 我一直在尝试将SQL和存储桶安装到我的docker WordPress容器中.它似乎成功安装了SQL,但未能安装存储桶.该实例基于这篇文章.
我已经在下面附加了Docker文件和错误,以及我的构建命令.
构建命令:
docker build -t ic/spm .
Dockerfile:
FROM wordpress
MAINTAINER Gareth Williams <gareth@itinerateconsulting.com>
# Move login creds locally
ADD ./creds.json /creds.json
# install sudo, wget and gcsfuse
ENV GCSFUSE_REPO=gcsfuse-jessie
RUN apt-get update && \
apt-get -y install sudo && \
apt-get install -y curl ca-certificates && \
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" > /etc/apt/sources.list.d/gcsfuse.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update && \
apt-get install -y gcsfuse wget && \ …Run Code Online (Sandbox Code Playgroud) google-cloud-storage google-cloud-sql docker google-cloud-platform gcloud
我刚开始学习Angular2,并想知道为什么开发人员决定在html中使用各种不同的包装器?例如:
[(ngModel)]="some.property"
(click)="someMethod()"
[src]="some.property"
Run Code Online (Sandbox Code Playgroud)
我确信它背后有一个很好的逻辑原因,我知道它们被用于不同的目的,但乍一看它似乎不一致,是一个不必要的障碍需要克服.
文艺青年最爱的; 试图让WordPress docker-compose容器与另一个docker-compose容器对话.
在我的Mac上,我有一个WordPress和MySQL容器,我已经构建并配置了一个链接的MySQL服务器.在生产中我计划使用Google Cloud MySQL存储实例,因此计划从docker-compose文件中删除MySQL容器(取消链接),然后将可以在多个docker容器中使用的共享容器分开.
我遇到的问题是我无法将WordPress容器连接到单独的MySQL容器.是否有人能够阐明我将如何解决这个问题?
我尝试创建一个网络并尝试通过/ etc/hosts文件创建一个本地盒引用的固定IP(我的首选配置,因为我可以根据ENV更新文件)
WP:
version: '2'
services:
wordpress:
container_name: spmfrontend
hostname: spmfrontend
domainname: spmfrontend.local
image: wordpress:latest
restart: always
ports:
- 8080:80
# creates an entry in /etc/hosts
extra_hosts:
- "ic-mysql.local:172.20.0.1"
# Sets up the env, passwords etc
environment:
WORDPRESS_DB_HOST: ic-mysql.local:9306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: root
WORDPRESS_DB_NAME: wordpress
WORDPRESS_TABLE_PREFIX: spm
# sets the working directory
working_dir: /var/www/html
# creates a link to the volume local to the file
volumes:
- ./wp-content:/var/www/html/wp-content
# Any networks the container …Run Code Online (Sandbox Code Playgroud) 我正在创建一个cron,它清除除最近两个文件之外的所有指定文件夹的子目录(仅限第一个子目录)但遇到问题.
这些是我的尝试:
find ./ -type d -exec rm -f $(ls -1t ./ | tail -n +4);
find . -maxdepth 2 -type f -printf '%T@ %p\0' | sort -r -z -n | awk 'BEGIN { RS="\0"; ORS="\0"; FS="" } NR > 5 { sub("^[0-9]*(.[0-9]*)? ", ""); print }' | xargs -0 rm -f
Run Code Online (Sandbox Code Playgroud)
我还试图创建一个文件数组,目的是通过总减2,但数组没有填充所有文件:
while read -rd ''; do x+=("${REPLY#* }"); done < <(find . -maxdepth 2 -printf '%T@ %p\0' | sort -r -z -n )
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解释一下他们是怎么做的吗?
我已经尝试了一段时间,但很挣扎。我有两个项目:
到目前为止,我已经尝试过 ffmpeg 和 ffserver、PulseAudio、mjpegstreamer(我可以正常工作,但没有音频)和 IceCast,但运气都不好。虽然我确定这可能是我的错,但我想知道是否还有更多选择?
我花了一段时间尝试使用 Linux 选项,还想知道最近是否有使用 OpenCV 的 Python 选项。
如果有人可以建议更多选项来研究基于 Python 或 Linux 的内容,我将不胜感激,或者向我指出一些很好的教程或我已经使用过的内容的解释,我将不胜感激。
我似乎无法使用Google Maps API循环GIF动画.它第一次播放动画,但之后不再播放.
谁能指出我正确的方向?我在这个文件中有很多代码,所以我拖出了重要的部分,如果需要,我会很高兴地提出更多.
var marker = new google.maps.MarkerImage(
'library/img/gmap_marker.gif',
new google.maps.Size(100, 100),
new google.maps.Point(0, 0),
new google.maps.Point(100, 100)
);
var shadow = new google.maps.MarkerImage(
'library/img/gmap_shadow.png',
new google.maps.Size(100, 100),
new google.maps.Point(0, 0),
new google.maps.Point(100, 100)
);
// set the personmarker
var person = new google.maps.Marker({
position: currentPos,
icon: marker,
draggable: false,
raiseOnDrag: false,
shadow: shadow,
animation: google.maps.Animation.DROP,
map: app.map,
optimized: false
});
Run Code Online (Sandbox Code Playgroud) javascript ×5
docker ×2
linux ×2
macos ×2
python ×2
angular ×1
bash ×1
cordova ×1
deployment ×1
ecmascript-6 ×1
eslint ×1
express ×1
gcloud ×1
google-maps ×1
node.js ×1
pyaudio ×1
streaming ×1
typescript ×1
ubuntu-12.04 ×1
virtualenv ×1
webpack ×1