Tag: meteor

热推网站代码alameteor

在meteorwww.meteor.com中 ,每当您保存您的HTML / Javascript / CSS时,它都会将更改推送到浏览器,因此您不需要手动刷新浏览器。 有没有一种方法,我可以做到这一点在标准node.js环境中,而不使用meteor? 在PHP / Java环境中呢?

为什么将数据加载到Meteor Collection需要很长时间?

我正在尝试使用Meteor构build一个数据可视化应用程序来可视化大型数据集。 数据目前存储在CSV格式的数据文件中,大约为64MB。 我正在使用node-csv插件将此数据文件加载到Meteor集合(下面的代码)中。 但是,每10万条logging需要大约1分钟的时间,以这个速度大约需要1.5个小时才能将整个文件加载到集合中。 在此期间,Meteor服务器对Web请求没有响应。 这对我来说看起来exception缓慢。 这是正常的吗? meteor的目的不是为了处理大量的数据吗? 还是有更好的方式来做这个数据导入过程比我发现的方式? var csv = Meteor.require('CSV'); var fs = Meteor.require('fs'); var path = Npm.require('path'); function loadData() { var basepath = path.resolve('.').split('.meteor')[0]; console.log('Loading data into Meteor…'); csv().from.stream( fs.createReadStream(basepath+'server/data/enron_data.csv'), {'escape': '\\'}) .on('record', Meteor.bindEnvironment(function(row, index) { if ((index % 10000) == 0) { console.log('Processing:', index, row); } Emails.insert({ 'sender_id': row[0], 'recipient_id': […]

谷歌的结果显示Meteor.js网站为“正在加载…”

我向Google提交了一个Meteor.js网站(基于望远镜 ),并且在search结果中,Google将网站页面抓取为拥有Loading…并且只有静态内容(而不是dynamic加载的内容)在Google的描述中网站。 mrt list –using显示spiderable已被使用。 是否有可能让谷歌检索页面的实际标题?

meteorTwilio MRT包

快速的问题(我希望) – 我正在尝试使用Meteor Twilio软件包(“mrt add twilio”)从我的应用程序发送短信。 一切都设置正确(我预先安装Moment正如在文档中提到的),我认为…但是,当我的代码在事件处理程序中运行时,我得到“Twilio未定义”错误。 据推测,这是与包“需要”的NPM包代码的方式? 有没有其他人面对这个? Template.registration.events({ 'click #registerButton': function (e) { e.preventDefault(); var accountSid = 'AC758eaf30370ee2ba8b64f64ce19769c8'; var authToken = 'f8a0ee4560d3368a461e1f751b98fd90'; twilio = Twilio(accountSid, authToken); //this appears to be the issue twilio.sendSms({ to:'+966533444837', from: '+18654072438', body: 'Hi this is a test from Twilio.' }, function(err, responseData) { if (!err) { console.log(err) } […]

meteor模板中的“this”关键字

我正在通过Discover Meteor工作,并且遇到了一些我不太清楚的代码。 这是我的模板和相关的JS <template name="postItem"> <div class="post"> <div class="post-content"> <h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3> <p> submitted by {{author}} {{#if ownPost}}<a href="{{postEditPath this}}">Edit</a>{{/if}} </p> </div> <a href="{{postPagePath this}}" class="discuss btn">Discuss</a> </div> </template> Template.postItem.helpers({ ownPost: function(){ return this.userId == Meteor.userId(); }, domain: function() { var a = document.createElement('a'); a.href = this.url; return a.hostname; } }); 总的来说,我不太清楚“这个”是如何在这个js的背景下工作的。 我理解“this”是我们正在执行的函数的“所有者”,或者更确切地说,函数是quirksmode文章中的一个方法,但是我并不真正理解这个链。meteor如何实现它。 只看代码,我期望this.userId为空。 有人可以帮助我,或者指出一些解释“this”在Meteor中的作用的文档吗?

meteor不能访问个人资料图片

我是新来的meteor,我试图得到当前login用户的照片。 我尝试了很多方法,但是这个感觉就像应该工作: 这是在索引的js: Template.user_loggedout.events({ "click #login" : function(e, t){ Meteor.loginWithFacebook({ }) } }) 所以它基本上只是用facebooklogin。 authentication到此为止是成功的。 现在在服务器端,我创build用户时尝试了很多方法来获取图片,但是这个看起来是最干净和最简单的: Accounts.onCreateUser(function(options, user) { if (options.profile) { options.profile.picture = "http://graph.facebook.com/" + user.services.facebook.id + "/picture/?type=large"; user.profile = options.profile; } return user; }); 我也尝试过谷歌(完全实施谷歌login): user.profile.profile_picture = user.services.google.picture; 在我看来,我只是这么称呼它: <img src="currentUser.profile.picture" 事情是不pipe我尝试哪种方式,我打电话给这个破碎的链接图像: 我敢肯定,我是一个明显的举措,但我真的不知道我的电话有什么问题。 难道我做错了什么?

创build新的Mongodb文档与推送到文档的数组

温度logging器每1秒logging一次温度,使用Meteor.js实时图表显示最近5秒内的平均温度。 将每个温度读数保存为一个新的Mongodb文档是否是最佳实践? 或者把新读数推到对应于特定温度logging器的文件中的数组中? 对于第二种情况,当使用cursor.observeChanges时,Meteor.js客户端绘制图表是否会收到整个文档? 如果是这样,那么这可能是一个巨大的文件,客户端每秒下载数月的温度数据?

meteor方法不起作用

假设我有一个叫Tasks的Collection ,它里面几乎没有任务。 我调用一个方法来返回一个任务数组给用户,但由于某种原因,它不会返回任何东西。 这里是一个代码例如: if (Meteor.isClient) { // This code only runs on the client Template.body.helpers({ tasks: function () { // Show newest tasks first Meteor.call("getTasks", function(error, result) { return result; // Doesn't do anything.. }); } }); } Meteor.methods({ getTasks: function() { return Tasks.find({}, {sort: {createdAt: -1}}); } }); 任何想法,为什么当我打电话的方法,它不会返回任何东西?

Meteor JS没有方法“parsing”

我已经在meteorjs中试过这个代码,但是它会显示错误“TypeError:Object#Object> has no method'parse'” path = Npm.require('path') filename = path.parse('/home/user/dir/file.txt') 但是在节点js中的文档parsing方法应该存在于path库http://nodejs.org/api/path.html#path_path_parse_pathstring 有小费吗?

如何让蒙哥在浏览器中工作?

好吧,所以我安装了蒙古插件,它还没有出现在我的浏览器中。 我如何做到这一点? 在安装控制台build议我删除autopublish包,我做了,但没有帮助,但它确实阻止我的应用程序在浏览器中更新,所以我重新添加它。