discovermeteor / microscope Goto Github PK
View Code? Open in Web Editor NEWThe Discover Meteor book's example app.
License: MIT License
The Discover Meteor book's example app.
License: MIT License
First, I'm about halfway through the book and I've found it to be a good intro to Meteor. Good work.
Second, I would suggest a chapter or sidebar on debugging. It's great to follow along with the book but when things don't work it would be good to get pointers on how to debug/troubleshoot.
I'm on the chapter "Editing Posts". When I click the link to edit a post I just see a page with the header but the rest is blank. I know the page_edit.html template is being run because if I comment out the lines {{#with post}} and {{/with}}, i.e. make it a static template, it renders the form as expected.
So then I'm looking at the post_edit.js and thinking it must be something in
Template.postEdit.helpers({
post: function() {
return Posts.findOne(Session.get('currentPostId'));
}
});
I tried hard-coding the postID instead of using Session.get() but that didn't help. I copied the source from github so I'm pretty sure it's not a typo. I'm not seeing anything in the javascript console.
Can you recommend how to debug this?
Thanks.
If I leave a comment on my own post, say as a reply to another user's comment, I don't need a notification because I already know I made the comment.
I fixed this in collections/notifications.js like so:
createCommentNotification = function(comment) {
var post = Posts.findOne(comment.postId);
if (comment.userId !== post.userId) {
Notifications.insert({
userId: post.userId,
postId: post._id,
commentId: comment._id,
commenterName: comment.author,
read: false
});
}
};
Maybe there's a better way though??
After finishing the animation chapter, I found that there are unwanted animations also happening on paging through the "Best" posts. This is not intentional, right? Anyone have hints on how to stop this?
Hello,
I've followed all steps in the book into Chapter 3 and I am only getting a blank page on my localhost:3000. I am not sure where to go from here. Can you help troubleshoot?
When i review code in browser this is what shows in the body:
body kpm-analyzer="1.2.1"
body
Thanks,
Rob
The last change before commit chapter6-1 doesn't seem to be working.
Adding:
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY'
});
to a new config.js file in client/helpers/config.js does not remove the password form field from the login dropdown. I tested on my own version and an instance based on this commit http://meteor-book-chapter6-1.meteor.com/.
Hi Guys,
I've just tried adding the intecom code to microscope and don't seem to have any connection to the intercom website when I restart my app up to the initial part where its saying its waiting for a connection. I've checked the code against github at commit 15-1 and it all seems to be the same as your code, but no joy at all. Any ideas? I assume the package needs to be in the microscope/package/ directory, that's the only bit I'm not sure about.
extra }); at end of file client/helpers/router.js
Router.before(requireLogin, {only: 'postSubmit'})
}); <<<<
Exception from Deps recompute: TypeError: Object [object Object] has no method 'limit'
at Object.Template.postsList.helpers.hasMorePosts (http://localhost:3000/client/manages/posts/posts_list.coffee.js?e043adfc1e7662180be37ce4a8c08b48f00fc264:12:29)
at apply (http://localhost:3000/packages/handlebars.js?c2b75d49875b4cfcc7544447aad117fd81fccf3b:276:24)
at invoke (http://localhost:3000/packages/handlebars.js?c2b75d49875b4cfcc7544447aad117fd81fccf3b:293:18)
at http://localhost:3000/packages/handlebars.js?c2b75d49875b4cfcc7544447aad117fd81fccf3b:385:27
at Object.Spark.labelBranch (http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1171:14)
at branch (http://localhost:3000/packages/handlebars.js?c2b75d49875b4cfcc7544447aad117fd81fccf3b:355:20)
at http://localhost:3000/packages/handlebars.js?c2b75d49875b4cfcc7544447aad117fd81fccf3b:384:20
at Array.forEach (native)
at Function..each..forEach (http://localhost:3000/packages/underscore.js?13ab483e8a3c795d9991577e65e811cd0b827997:130:11)
at template (http://localhost:3000/packages/handlebars.js?c2b75d49875b4cfcc7544447aad117fd81fccf3b:358:7)
The last comment remains in the textarea after submitting. I used some jQuery in comment_submit.js to clear it.:
Meteor.call('comment', comment, function(error, commentId) {
if (error){
Meteor.Errors.throw(error.reason);
} else {
$(event.target).find('[name=body]').val('');
}
});
Reported by Tim:
If a user placed two comments under one post, the owner of the post has two notifications. But he needs to click both notifications to remove the badge, even though clicking just once let him sees both comments.
Had to do mrt install iron-router
which got everything working again, but the routing syntax is different, and I couldn't figure out how to get the specific post pages to render with the new iron-router.
Maybe I missed it, but I've got all the Intercom stuff working except when I send the user a message or notification via the intercom.io site, it'll never show for the user.
I'm thinking there's a step needed for window.Intercom('update');
?
I created a timer to run update every minute, but I still don't see popups until I refresh:
Template.loggedIn.created = function () {
Meteor.setInterval(function () {
window.Intercom('update');
}, 60000);
};
Thanks for any advice, enjoying the book and premium content.
Exception while invoking method 'getHash' ReferenceError: CryptoJS is not defined
Hi,
In Discover Meteor there is an example about Latency compensation. I'm running Meteor 0.6.4 (but also reproduced on 0.6.3.1) and the example fail. In fact the callback passed to Meteor.call('post'...) is not called by client until the server send the response. The post is well created on client side, the methods is called both on client and on server, but the callback is just waiting for the server response.
I had to add the following code in collections/posts.js to do the client redirection instead of returning the postId :
var postId = Posts.insert(post);
/* START my hack /
if (this.isSimulation) {
Meteor.Router.to('postsList');
}
/ END my hack */
return postId;
@SachaG @tmeasday @DiscoverMeteor
Wanted to let you all know that with your current edit post method in your microscope app, users are able to submit a duplicate link to an already posted item by editing one of their post. The edit post method does not check to see if there are already posts with a duplicate link in the collection. The solution for this is a little more complicated. I'll work some things around and post my solution to it so you can update the code and the book.
Also, this bug can be duplicated in your telescope app demo.
Thanks for all your work on the book. It's a great read!
in "collections/post.js"
should be
future.return();
not
future.ret();
In the voting chapter when I vote in any post, the "load more" disappears, so it's impossible to load the other posts
Hi,
Just upgraded to the premium version of the "Discover Meteor" Book. Im working through the collections section. When I open my "Chrome" browsers console I'm seeing this warning.
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Carl
method calls have "console.log" output in the browser AND the server terminal ?
Meteor.users.find() running in the browser fails.
why are the method calls running in 2 places ?
move the method calls to the "server" directory ?
Do we need to keep that file?
Hi all there,
thanks for todays book update. My question is, is also the PDF Document always updated with latest version of the books online content?
Maybe you could add somewhere on the first pages an update and/or release date for the book.
Thanks for the book, it is a great introduction
Tom
I'm having a problem with "Adding Users".
Personally the ux would be crap i.e. loss of form data, but it really jars that you're sending a 302 and an alert pops up instead.
was following along but after adding the spinner I no longer get data. in console:
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Exception from Deps recompute: Error: No such template 'spinner'
The Sign In / Up box disappears when the browser window is smaller than about 980 pixels. It happens on both Chrome and Safari. Any idea why?
When I tried running the command
mrt add accounts-ui-bootstrap-dropdown
I get the following -
=> Errors while scanning packages:
While building package accounts-ui-bootstrap-dropdown
:
error: no such package: 'accounts-urls'
Hi Guys,
I foolishly upgraded meteor to the latest version (0.6.5) and now, naturally, its not compiling. I did an meteor update and mrt update, then meteor, and got
[[[[[ ~/microscope ]]]]]
router: updating npm dependencies -- connect...
=> Errors prevented startup:
While building package accounts-ui-bootstrap-dropdown
:
error: no such package: 'accounts-urls'
=> Your application has errors. Waiting for file change.
I did wonder if upgrading was a good idea :) Guess it wasn't. Any ideas?
Ta Peter.
Hi Guys,
love the book so far, but, am having issues with the basic routing stuff.
I've checked and re-checked my code and it all looks the same as the git repo, however, as soon as I replace postsList with renderPage I loose all of my books.
I've added some tests to client/helpers/router.js as follows
'/': 'postsList',
'/posts': 'postsList',
'/test': 'test
and added test.html to client/views/posts/ as
This is a test
but, calling localhost:3000/test returns the same thing as / or /posts does which is an empty list.
Any ideas why the routing isn't working, and any other ways to trouble shoot it?
If you have a long list of Posts, and add a new one, then vote on it, it animates, but the target location is outside the visible scrollable area. This may not be an issue, but I had to hunt for the voted post, by scrolling and then finding it.
In Chapter 12, we introduced the "spinner" (chapter12-3), but in the Animations chapter we still have "Loading ..." in the code.
I guess somehow I killed the reset script.
The URL when submitting a post is defaulting to the localhost whether it be on my own local host or under joshtest.meteor.com instead of the url I typed in
Edit - I fixed this issue by editing smart.lock and adding the code from this commit. chapter6-1
I've been successfully following the book up until the section Adding Users. I ran mrt add accounts-ui-bootstrap-dropdown and got a confirmation saying that the package was successfully installed. I also installed accounts-password. I updated the code in main.html and header.html, but when I ran meteor it gave me the error listed above (pkg accounts-ui...etc does not exist).
I installed the package, so how does it not exist? This is really confusing to me and I don't know how to proceed.
An anonymous user can click on the upload button, but doesn't get an error message. Similarly a signed in user can click twice, and the second click is ignored without an error message being displayed.
You have gone to the trouble of generating these error messages on the Meteor Server side method.
It would be nice for the user to see the error messages.
Edit: Never mind, should've read on... Seems that the missing attribute is defined later on. :)
In the Templates chapter under the Meteor Templates heading, the postsData manager defines three attributes for a post: title, author and URL:
var postsData = [
{
title: 'Introducing Telescope',
author: 'Sacha Greif',
url: 'http://sachagreif.com/introducing-telescope/'
},
...
];
Template.postsList.helpers({
posts: postsData
});
But the template that was created earlier references a domain attribute, when it should be referencing the author attribute, I think:
<template name="postItem">
<div class="post">
<div class="post-content">
<h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3>
</div>
</div>
</template>
when I do mrt add router I get
Kodachi:microscope phil$ mrt add router
smart.json changed.. installing from smart.json
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.1
smart.json changed.. installing from smart.json
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.1
smart.json changed.. installing from smart.json
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.1
/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:106
throw('Could not locate package.js within path ' + self.source.packagePa
^
Could not locate package.js within path /Users/phil/.meteorite/packages/router/tmeasday/meteor-router/32e377c7703bb119acccc859fc7296882903cbe7
Any ideas?
I'm not sure this is the best place to put this comment, but here it goes:
Sometimes being really specific helps people that might have gotten lost somewhere along the way.
In the Editing Posts chapter, this sentence is nice and casual, but wouldn't hurt from the addition of some specifics.
Where and how did we get rid of allow()? Was it when we took out autopublish? I'm not sure at the moment and I want to plow ahead with the book without more head-scratching than necessary.
Charlie Magee
I'm getting this error when I do 'mrt run' after cloning the main repository into my computer.
Rodrigos-MacBook-Pro:Microscope rodcisal$ mrt run
fs.js:524
return binding.stat(pathModule.makeLong(path));
^
Error: ENOENT, no such file or directory '/Users/rodcisal/.meteorite/packages/spin/SachaG/meteor-spin/fd3a2871a69442848b4b4e74f5e1ae28fa4a95a4/.meteor/meteorite/packages/spin'
at Object.fs.statSync (fs.js:524:18)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:85:25)
at Array.forEach (native)
at Function..each..forEach (/usr/local/lib/node_modules/meteorite/node_modules/underscore/underscore.js:76:11)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:83:7)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:87:9)
at Array.forEach (native)
at Function..each._.forEach (/usr/local/lib/node_modules/meteorite/node_modules/underscore/underscore.js:76:11)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:83:7)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:87:9)
Any idea???
Thanks!!!
@rodcisal
I'm closely following the book and with the Latency Compensation sidebar the collections/posts.js
source is the first time that the entire file's contents aren't provided, with just the change highlighted. Thus simply copying & pasting the code as I've done up to this point is not adequate. Doing so removes the critical Posts = new Meteor.Collection('posts');
declaration.
I've since found that the excise is even greater with the // .. existing validation code
referring to more than the aforementioned code. This is also the first time a comment referred to code in the original file that must be retained. While the comment reflects '...validation code' it's also referring to the needed assignment code var user = Meteor.user(), postWithSameLink = Posts.findOne({url: postAttributes.url});
.
I suggest either amending the example to include the complete code or describe that only the Meteor.methods({
should be replaced - removing the erroneous comment regarding 'validation code'.
The inconsistencies run rampant in the code samples in the next couple of chapters: Sometimes providing ellipsis where existing code is to be retained, sometimes shading in green, sometimes none of these. Would prefer a consistent presentation be retained.
I've ran into some problems with the third method and node-fibers package.
On ubuntu 13.04 from Digital Ocean I get /home/meteor/bundle/programs/server/node_modules/fibers/bin/linux-x64-v8-3.14/fibers.node
is missing. Try reinstalling node-fibers?` when I try to run the app.
In that location linux-x64-v8-3.11/fibers.node
exists, however linux-x64-v8-3.14/fibers.node
does not.
Which means, I think, that it is only compiled for an older V8 version (and older node?) and not for the latest one.
Is there any way to resolve this? Can I manually compile this for 0.10? Do I need to use node 0.8 instead of 0.10 instead? Current node version is 0.10.17.
how to disable auto logout ?
In the chapter "editing-posts", the post_edit.js code on the page is wrong. It has even been changed in the final repo to the correct code, but not updated in the book.
this is the correct code for currentPostId:
var currentPostId = this._id;
I'm unable to package the error display functionality as a Meteor Package, I get the following error in my browser console:
router.js?6c9f56d1887306c31d2b2bcdf9a15617c5d42c21:23
Meteor.Router.filters.clearErrors router.js?6c9f56d1887306c31d2b2bcdf9a15617c5d42c21:23
Router._applyFilter router_client.js:169
(anonymous function) router_client.js:155
_.reduce._.foldl._.inject underscore.js:114
Router._applyFilters router_client.js:154
(anonymous function) router_client.js:35
_.extend._compute deps.js:129
Deps.Computation deps.js:64
_.extend.autorun deps.js:255
Router._setPageFn router_client.js:24
(anonymous function) index.js:278
next index.js:166
page.dispatch index.js:169
page.replace index.js:148
page.start index.js:103
page index.js:60
Meteor.Router.Route.options router_client.js:180
ready
Funny enough, I can't see the scripts of the error package loaded under packages. What could be the problem, I'm using meteor 0.6.5.
ReferenceError: RSS is not defined
at Object.Meteor.Router.add./feed.xml (app/server/router.js:3:20)
at Router.match (packages/router/lib/router_server.js:61)
at Router._start (packages/router/lib/router_server.js:95)
Chapter 16 - 2
At the book the post_page.html uses {{#with }} tag to display data from current post. If I try the code from book doesn't work.
This tag is omitted in committed code and this version seems correct (at least, it shows the post and comment data)
From reading Stack Overflow answers, it looks like doing border-radius for each side individually is still valid. But it means I can't just copy/paste the css from the book. Maybe fix to work with bootstrap 3? ^_^
commit/sidebar7-5-1
collections/posts.js
line 24: both 'title' and 'message' are removed from _.pick but only title is defined on the next line. Therefore, the message is no longer saved when adding a post. This seems unintended.
"Chapter 14-1 Live Instance" The post re-order animation doesn't seem to be working.
After installation of Meteorite I tried to run "mrt create appname" command on Ubuntu 12 but it gives me error:
And now I even cannot uninstall it with "sudo mrt uninstall", as showing same error again - http://my.jetscreenshot.com/6808/20130716-ijem-55kb
PS: Meteor without Meteorite was running just fine, and now it failing too...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.