我的meteor目前正在我的localhost上运行.
我添加了流星电子邮件包
meteor add email
在server/server.js我添加(我的密码有很多特殊字符(@#$%^&),如果这有任何区别):
process.env.MAIL_URL="smtp://myusername%40gmail.com:mypassword@smtp.gmail.com:465/";
Run Code Online (Sandbox Code Playgroud)
然后在我添加的同一个文件中:
Email.send({
from: "meteor.email.2014@gmail.com",
to: "myusername@gmail.com",
subject: "Meteor Can Send Emails via Gmail",
text: "Its pretty easy to send emails via gmail."
});
Run Code Online (Sandbox Code Playgroud)
什么都没发送.我在Meteor控制台中得到了这个:
W20140607-11:37:24.449(8)? (STDERR)
W20140607-11:37:24.452(8)? (STDERR) /home/wdi2p2/.meteor/tools/6f23056589/lib/node_modules/fibers/future.js:206
W20140607-11:37:24.453(8)? (STDERR) throw(ex);
W20140607-11:37:24.459(8)? (STDERR) ^
W20140607-11:37:24.466(8)? (STDERR) Error: getaddrinfo ENOTFOUND
W20140607-11:37:24.468(8)? (STDERR) at Object.Future.wait (/home/wdi2p2/.meteor/tools/6f23056589/lib/node_modules/fibers/future.js:326:15)
W20140607-11:37:24.469(8)? (STDERR) at smtpSend (packages/email/email.js:94)
W20140607-11:37:24.469(8)? (STDERR) at Object.Email.send (packages/email/email.js:155)
W20140607-11:37:24.470(8)? (STDERR) at app/server/server.js:3:7
W20140607-11:37:24.471(8)? (STDERR) at app/server/server.js:10:3
W20140607-11:37:24.474(8)? (STDERR) at /home/wdi2p2/Workspace/WDI/VLP/home-photo-pros/.meteor/local/build/programs/server/boot.js:155:10
W20140607-11:37:24.474(8)? (STDERR) at Array.forEach …Run Code Online (Sandbox Code Playgroud) /lib/collections/images.js
var imageStore = new FS.Store.FileSystem("images", {
// what should the path be if I want to save to /public/assets?
// this does not work
path: "/assets/images/",
maxTries: 1
});
Images = new FS.Collection("images", {
stores: [imageStore]
});
Images.deny({
insert: function() {
return false;
},
update: function() {
return false;
},
remove: function() {
return false;
},
download: function() {
return false;
}
});
Images.allow({
insert: function() {
return true;
},
update: function() {
return true;
},
remove: function() { …Run Code Online (Sandbox Code Playgroud) 我无法想象Javascript如何既可以是单线程又可以在客户端上不阻塞。我一直在想像流水线:
在代码执行开始时,您只有一条装配线,将不同的零件组装到汽车上。
达到完工率的20%时,需要添加引擎,但是尚未组装引擎。
而不是等待引擎组装,组装线被分解成两条组装线-两个螺纹,对吗?
1号线继续组装汽车的其他零件。
2号线开始组装发动机。
2号线完成引擎的组装后,将返回1号线并添加引擎。
根据发动机的组装速度,此时1号线的完工率为30%,完工率为99%,依此类推。
这就是我设想的非阻塞,异步代码的方式。1号线的主线程可以继续前进,而不必等待2号线先完成。但是这种组装线的隐喻需要两条组装线或两个线程,但是JS是单线程的。
所以现在我很困惑。
我在EC2上创建了一个新的Ubuntu T2 Micro实例。
创建一个新的弹性IP并选择“在VPC中使用的EIP”
该地址与我的新EC2 Ubuntu实例相关联。
我现在有一个私有IP和一个公共/弹性IP。没有公共DNS。
我的安全组已打开SSH端口22和HTTP端口80。
我可以通过使用公共IP的SSH很好地连接到实例,但是当我尝试通过浏览器浏览到公共IP时,它显示connection refused。我也无法ping通。
我没主意了。
我知道Highcharts本身可以获取Unix Offset时间,但是传递Date对象更具可读性:
Date.UTC(2003,8,25)
Run Code Online (Sandbox Code Playgroud)
Moment.js有没有办法输出这个确切的对象?
var momentDate = moment.utc([2003, 08, 25]);
var JSDate = momentDate.toDate();
//Not sure where to go to actually output Date.UTC(2003,8,25)
Run Code Online (Sandbox Code Playgroud) 我已经安装了Bootstrap软件包和一个自定义模板,它给了我大约10个其他CSS文件.
当我将所有CSS文件放入client/stylesMeteor捆绑包并缩小所有CSS时,这很好.
但捆绑/加载顺序非常重要.因为,你知道,他们是级联的.
Meteor对CSS文件的捆绑顺序是client什么?
控制它的唯一方法是用数字重命名我的所有样式表文件吗?
100-my_style_that_overwrites_some_bootstrap_defaults.css
110-some_other_styles.css
120-lol.css
Run Code Online (Sandbox Code Playgroud)
然后CSS捆绑的顺序是:
1. bootstrap.css from the bootstrap package
2. 100-my...
3. 110-some...
4. 120-lol...
Run Code Online (Sandbox Code Playgroud)
有没有更优雅的实用方法来做到这一点?
我完全理解为什么如果回调中的逻辑正在外部服务器上执行或获取某些内容,则回调函数无法返回值.
我不太明白的是,如果回调函数中的所有内容都是正常的同步代码,为什么回调函数不返回值:
var myFunc = function(input, callback){
var sum = input + 10;
callback(sum);
};
sum = myFunc(1000, function(input){
console.log(input);
return input + 9000;
});
Run Code Online (Sandbox Code Playgroud)
sum仍然返回undefined,即使console.log记录值为1010.
回调永远不会返回任何东西,这是一条硬性规则吗?
用其他语言做的所有回调也都不会返回任何东西吗?
编辑
这是一个更复杂的例子 - 也没有返回任何东西
discounts = [
{
sku: "126D",
title: "Discount for using 126",
discountCode: "LOVE126",
discountAmount: -2500,
check: function(orderFormContents, callback) {
var discountsApplied = orderFormContents.discountsApplied;
var sqft = orderFormContents.propertyInfo.sqft;
for (var i = discountsApplied.length - 1; i >= 0; i--) {
if (discountsApplied[i].discountCode === this.discountCode) {
if …Run Code Online (Sandbox Code Playgroud) javascript ×3
meteor ×3
amazon-ec2 ×1
asynchronous ×1
callback ×1
collectionfs ×1
conceptual ×1
concurrency ×1
date ×1
highcharts ×1
momentjs ×1