我正在尝试了解如何更新我的Ionic Framework版本.
ionic info
Your system information:
Cordova CLI: 8.0.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.1.0
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS:
Node Version: v6.9.1
Run Code Online (Sandbox Code Playgroud)
所以当前的Ionic Framework版本是"1.1.0"
我更新了我的bower.json:
{
"name": "hello-ionic",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.3.3"
}
}
Run Code Online (Sandbox Code Playgroud)
并运行 bower install
但新文件存储在'bower_components'文件夹中
我的文件夹结构:
我还将'bower_components'中的文件复制到'lib'文件夹,并且ionic info'Ionic Framework Version'仍为'1.1.0'之后
我正在尝试使用新版本的 @aws-sdk/lib-storage 将 JSON 从 MongoDB 流式传输到 S3:
"@aws-sdk/client-s3": "^3.17.0"
"@aws-sdk/lib-storage": "^3.34.0"
"JSONStream": "^1.3.5",
Run Code Online (Sandbox Code Playgroud)
尝试#1:看来我没有正确使用 JSONStream.stringify() :
import { MongoClient } from 'mongodb';
import { S3Client } from '@aws-sdk/client-s3';
import { Upload } from '@aws-sdk/lib-storage';
const s3Client = new S3Client({ region: env.AWS_REGION });
export const uploadMongoStreamToS3 = async (connectionString, collectionName) => {
let client;
try {
client = await MongoClient.connect(connectionString);
const db = client.db();
const readStream = db.collection(collectionName).find('{}').limit(5).stream();
readStream.pipe(JSONStream.stringify());
const upload = new Upload({
client: s3Client,
params: {
Bucket: 'test-bucket', …Run Code Online (Sandbox Code Playgroud) 我想屏蔽以下字符:
(
)
/
>
<
]
[
\
"
,
;
|
Run Code Online (Sandbox Code Playgroud)
我的模式有什么问题?
pattern="[^()/<>[]\,'|\x22]+"
Run Code Online (Sandbox Code Playgroud) 我使用以下buildpack:heroku-buildpack-nodejs
并且默认情况下,它应该缓存和恢复node_modules。
yarn.lock文件与一起位于应用程序的根目录package.json。
我也加入"cacheDirectories": [".cache/yarn"]了package.json
在审阅应用程序构建日志分析期间,我看到:
-----> Restoring cache
Loading 1 from cacheDirectories (package.json):
- .cache/yarn (not cached - skipping)
Run Code Online (Sandbox Code Playgroud)
...
-----> Installing dependencies
Installing node modules (yarn.lock)
Run Code Online (Sandbox Code Playgroud)
...
-----> Caching build
- node_modules
Run Code Online (Sandbox Code Playgroud)
好像这个问题在2016年12月20日被打开了:https : //github.com/heroku/heroku-buildpack-nodejs/issues/359
如何在不对每个构建都安装依赖项的情况下实现缓存机制?
我正在尝试允许我的nodeJs docker镜像与我的redis docker镜像(Mac OS X环境)之间的通信:
nodeJs Dockerfile:
FROM node:4.7.0-slim
EXPOSE 8100
COPY . /nodeExpressDB
CMD ["node", "nodeExpressDB/bin/www"]
Run Code Online (Sandbox Code Playgroud)
redis Dockerfile:
FROM ubuntu:14.04.3
EXPOSE 6379
RUN apt-get update && apt-get install -y redis-server
Run Code Online (Sandbox Code Playgroud)
尝试连接到redis的nodeJs代码是:
var redis = require('redis');
var client = redis.createClient();
Run Code Online (Sandbox Code Playgroud)
docker构建步骤:
docker build -t redis-docker .
docker build -t node-docker .
Run Code Online (Sandbox Code Playgroud)
docker run images步骤流程:
docker run -p 6379:6379 redis-docker
docker run -p 8100:8100 node-docker
Run Code Online (Sandbox Code Playgroud)
错误:
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
at Object.exports._errnoException (util.js:907:11)
at exports._exceptionWithHostPort …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行 Nightwatch 脚本,该脚本将打开一个 url,然后它将从输入中获取值,并在下一页中使用该值。
请看下面的代码:
var conf = require('../../nightwatch.conf.BASIC.js');
module.exports = {
'nightwatch flow': function (browser) {
var first_name;
browser
.url('http://example:3000')
.getValue('input[name="first_name"]', function(result){
first_name = result.value;
})
.setValue('input[name="amount"]', 101)
.click('input[name=continue]')
.clearValue('input[name="first_name"]')
.setValue('input[name="first_name"]', first_name)
.click('button[name=next]')
.end();
}
};
Run Code Online (Sandbox Code Playgroud)
得到setValue('input[name="first_name"]', first_name)
“未定义”
first_name 参数正在回调函数内更新。我需要 setValue 函数使用更新后的值。提前致谢
我正在研究与 React Node.js 的条带集成
在无需试用的情况下创建订阅时,我没有遇到任何问题,并且所有用例都非常简单。
但是,我正在尝试创建免费试用版而不收集信用卡详细信息,稍后当试用期结束时,我想收集信用卡详细信息
服务器端:创建无付款方式的试用订阅:
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [{ price: priceId }],
trial_end: expiredAt.unix(),
expand: ['latest_invoice.payment_intent'],
});
Run Code Online (Sandbox Code Playgroud)
客户端:稍后当试用期满时,我想收集信用卡详细信息( paymentMethod ),检查是否由于故障或 3ds 需要用户操作,并通过更新客户的默认 payment_method 来更新订阅:
const updateCustomerDefaultPaymentMethod = await stripe.customers.update(
customerId,
{
invoice_settings: {
default_payment_method: req.body.paymentMethodId,
},
}
);
Run Code Online (Sandbox Code Playgroud)
如何更新订阅以执行 paymentIntent 或向用户收费,并向客户端返回状态为“in_complete”的相同订阅对象,与创建没有试用期的订阅时相同?目前,在运行我的代码时,我不断收到 status='active',因为第一张发票的状态='paid',价格为'0$'。
使用 AWS 控制台 --> AWS Cost Management --> Cost Explorer 时 - 我得到以下值:
当我使用@aws-sdk/client-cost-explorer“EC2 - 其他”和“Amazon Load Balancer”时,我得到不同的结果。
配置:
import { CostExplorerClient, GetCostAndUsageCommand } from '@aws-sdk/client-cost-explorer';
const client = new CostExplorerClient({
region,
credentials: {
accessKeyId,
secretAccessKey
}
});
const params = {
TimePeriod: {
Start: startDate,
End: endDate
},
Filter: {
Dimensions: {
Key: 'SERVICE',
Values: [
'EC2 - Other', 'Amazon ElastiCache'
]
}
},
GroupBy: [
{
Type: 'DIMENSION',
Key: 'SERVICE',
},
],
Granularity: 'DAILY',
Metrics: [ …Run Code Online (Sandbox Code Playgroud) javascript amazon-web-services node.js aws-sdk-js aws-sdk-js-v3
我正在尝试上传并在ng-repeat中显示图像.
我已成功使用jquery函数上传和显示没有ng-repeat的图像:
<html>
<head>
<script src="jquery.js" type="text/javascript"></script>
</head>
<body>
<input type='file' />
<img id="myImg" ng-src="#" alt="your image" style="width:50px;height:50px"/>
</body>
</html>
...
<script>
$(function () {
$(":file").change(function () {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = imageIsLoaded;
reader.readAsDataURL(this.files[0]);
}
});
});
function imageIsLoaded(e) {
$('#myImg').attr('src', e.target.result);
};
</script>
Run Code Online (Sandbox Code Playgroud)
如果我将代码更改为ng-repeat内部,则jQuery函数可以正常工作:
<div ng-repeat="step in stepsModel">
<input type='file' />
<img id="myImg" ng-src="#" alt="your image" style="width:50px;height:50px"/>
/div>
Run Code Online (Sandbox Code Playgroud)
2个问题:
非常感谢
node.js ×5
javascript ×3
html ×2
android ×1
angular ×1
angularjs ×1
aws-sdk ×1
aws-sdk-js ×1
bower ×1
buildpack ×1
docker ×1
docker-image ×1
forms ×1
hadoop-yarn ×1
heroku ×1
jquery ×1
macos ×1
mongodb ×1
npm ×1
reactjs ×1
redis ×1
regex ×1
validation ×1