Meteor setInterval on server side - meteor

What have I do, to use Meteor.setInterval on server side?
When I use it, it's work, but I get:
Exception in setInterval callback: Error: Method not found [404]
I20150429-15:47:50.897(2)? at [object Object]._.extend.apply (packages/ddp/livedata_server.js:1502:1)
I20150429-15:47:50.897(2)? at [object Object]._.extend.call
(packages/ddp/livedata_server.js:1472:1)
I20150429-15:47:50.897(2)?
at app/server/cronJob.js:35:43
I20150429-15:47:50.897(2)?
at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20150429-15:47:50.897(2)? at packages/meteor/timers.js:6:1
I20150429-15:47:50.898(2)? at runWithEnvironment
(packages/meteor/dynamics_nodejs.js:108:1)
I get this error even then I try this:
Meteor.setInterval(function(){
console.log("test");
});
Why it happens?

You need to specify a delay for the interval, e.g., 5 seconds:
Meteor.setInterval(function(){
console.log("test");
}, 5000);
It's hard to know what the behavior will be without a specified time interval.

Related

Vue2 is successful in writing like this,but using vue3 will prompt the following questions

Vue2 is successful in writing like this,but using vue3 will prompt the following questions.
TypeError: Cannot read property 'getBanner' of undefined
at _callee$ (Banner.vue?40cf:46)
at tryCatch (runtime.js?96cf:63)
at Generator.invoke [as _invoke] (runtime.js?96cf:293)
at Generator.eval [as next] (runtime.js?96cf:118)
at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
at _next (asyncToGenerator.js?1da1:25)
at eval (asyncToGenerator.js?1da1:32)
at new Promise (<anonymous>)
at eval (asyncToGenerator.js?1da1:21)
at Proxy.getBanner (Banner.vue?40cf:46)

Firebase Deploy Error 'Route.post() requires a callback function but got a [object undefined]?

I am getting this error when Firebase deploy in terminal. I can't find any of my code with Route.post() in. It looks like it s being called from a module ...
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
Error: Route.post() requires a callback function but got a [object Undefined]
at Route.(anonymous function) [as post] (/Users/Desktop/castApp/functions/node_modules/express/lib/router/route.js:202:15)
at Function.app.(anonymous function) [as post] (/Users/Desktop/castApp/functions/node_modules/express/lib/application.js:482:19)
at Object.<anonymous> (/Users/Desktop/castApp/functions/index.js:12:5)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
In my case, this error occurred when I deleted the function in the controller file but didn't update the corresponding place where needs this function as a callback function in the router file - index.js.
index.js:
app.post('/new', addNew);
const { addStandupHost } = require('./APIs/candidates');
candidate.js:
// exports.addNew = (request, response) => {
// ...
// db operation here
// ...
//}
It was solved just by deleting the corresponding code in index.js. To avoid this error, we should keep functions export and import consistent.

angular 2 async route module + entryComponents

I have an async loaded module with async route functionallity in angular 2. In the main module I have an implementation which uses the component factory to instantiate the component I added to the async module with entryComponents.
When I now try to instantiate it, I get the following error:
Error: No component factory found for InEntryComponentsComponent. Did you add it to #NgModule.entryComponents?
at NoComponentFactoryError.ZoneAwareError (http://localhost:3000/polyfills.dll.js:4731:33)
at NoComponentFactoryError.BaseError [as constructor] (http://localhost:3000/vendor.dll.js:28595:16)
at new NoComponentFactoryError (http://localhost:3000/vendor.dll.js:28716:16)
at _NullComponentFactoryResolver.resolveComponentFactory (http://localhost:3000/vendor.dll.js:28733:15)
at AppModuleInjector.CodegenComponentFactoryResolver.resolveComponentFactory (http://localhost:3000/vendor.dll.js:28777:35)
at SwapComponentDirective.set [as swapCmp] (http://localhost:3000/main.bundle.js:2959:66)
at Wrapper_SwapComponentDirective.check_swapCmp (/ModalModule/SwapComponentDirective/wrapper.ngfactory.js:50:26)
at View_ModalOverlay2.detectChangesInternal (/ModalModule/ModalOverlay/component.ngfactory.js:83:36)
at View_ModalOverlay2.AppView.detectChanges (http://localhost:3000/vendor.dll.js:79810:14)
at View_ModalOverlay2.DebugAppView.detectChanges (http://localhost:3000/vendor.dll.js:80005:44)
at ViewContainer.detectChangesInNestedViews (http://localhost:3000/vendor.dll.js:80143:37)
at CompiledTemplate.proxyViewClass.View_ModalOverlay_Host0.detectChangesInternal (/ModalModule/ModalOverlay/host.ngfactory.js:32:14)
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:3000/vendor.dll.js:79810:14)
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:3000/vendor.dll.js:80005:44)
at ViewContainer.detectChangesInNestedViews (http://localhost:3000/vendor.dll.js:80143:37)
at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.detectChangesInternal (/AppModule/AppComponent/host.ngfactory.js:31:14)
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:3000/vendor.dll.js:79810:14)
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:3000/vendor.dll.js:80005:44)
at ViewRef_.detectChanges (http://localhost:3000/vendor.dll.js:59572:20)
at http://localhost:3000/vendor.dll.js:40308:67
at Array.forEach (native)
at ApplicationRef_.tick (http://localhost:3000/vendor.dll.js:40308:25)
at http://localhost:3000/vendor.dll.js:40227:105
at ZoneDelegate.invoke (http://localhost:3000/polyfills.dll.js:4162:26)
at Object.onInvoke (http://localhost:3000/vendor.dll.js:30260:37)
at ZoneDelegate.invoke (http://localhost:3000/polyfills.dll.js:4161:32)
at Zone.run (http://localhost:3000/polyfills.dll.js:4033:43)
at NgZone.run (http://localhost:3000/vendor.dll.js:30129:62)
at Object.next (http://localhost:3000/vendor.dll.js:40227:81)
at SafeSubscriber.schedulerFn [as _next] (http://localhost:3000/vendor.dll.js:42094:52)
at SafeSubscriber.__tryOrUnsub (http://localhost:3000/vendor.dll.js:591:16)
at SafeSubscriber.next (http://localhost:3000/vendor.dll.js:540:22)
at Subscriber._next (http://localhost:3000/vendor.dll.js:493:26)
at Subscriber.next (http://localhost:3000/vendor.dll.js:457:18)
at EventEmitter.Subject.next (http://localhost:3000/vendor.dll.js:4237:25)
at EventEmitter.emit (http://localhost:3000/vendor.dll.js:42080:76)
at NgZone.checkStable (http://localhost:3000/vendor.dll.js:30225:40)
at NgZone.onLeave (http://localhost:3000/vendor.dll.js:30301:14)
at Object.onInvokeTask (http://localhost:3000/vendor.dll.js:30254:27)
at ZoneDelegate.invokeTask (http://localhost:3000/polyfills.dll.js:4194:40)
at Zone.runTask (http://localhost:3000/polyfills.dll.js:4071:47)
at HTMLButtonElement.ZoneTask.invoke (http://localhost:3000/polyfills.dll.js:4265:33)
Anyone an idea how to get this running? When I move the component to a module which is not async loaded, then all is fine.
As a base I'm using the angular2-webpack-starter.

Meteor 0.8.3 updated to 0.9.3 cannot start "TypeError: Cannot read property 'name' of undefined"

I did
meteor update
All packages are manually added via meteor add
Here is the log:
=> Started proxy.
=> Started MongoDB.
=> Starting your app...
/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
throw(ex);
^
TypeError: Cannot read property 'name' of undefined
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/compiler.js:378:34
at Function._.each._.forEach (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:87:22)
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/compiler.js:371:7
at Array.forEach (native)
at Function._.each._.forEach (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at compileUnibuild (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/compiler.js:370:5)
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/compiler.js:888:27
at Array.forEach (native)
at Function._.each._.forEach (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at Object.compiler.compile (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/compiler.js:887:5)
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/bundler.js:1794:26
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/buildmessage.js:247:13
at [object Object]._.extend.withValue (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/fiber-helpers.js:112:14)
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/buildmessage.js:240:29
at [object Object]._.extend.withValue (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/fiber-helpers.js:112:14)
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/buildmessage.js:238:18
at [object Object]._.extend.withValue (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/fiber-helpers.js:112:14)
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/buildmessage.js:229:23
at [object Object]._.extend.withValue (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/fiber-helpers.js:112:14)
at Object.capture (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/buildmessage.js:228:19)
at Object.exports.bundle (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/bundler.js:1716:31)
at bundleApp (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-app.js:481:28)
at [object Object]._.extend._runOnce (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-app.js:499:24)
at [object Object]._.extend._fiber (/Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-app.js:685:28)
at /Users/test/.meteor/packages/meteor-tool/.1.0.33.1b5lzqo++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-app.js:360:12
OK the error is gone if I delete all the symlinks in /packages/ folder.
See discover meteor's blog post for why you can delete that folder.

Why would bytesTotal increase in a AS3 preloader?

I'm creating a custom preloader for a Flex app and have noticed the following behavior: when loading, the progress bar goes to 100%, then down then back up, and so on until the app is finished loading.
When I put a trace in the dowloadprogress listener, I see that while the app is loading, both bytesLoaded and bytesTotal increase, but not necessarily at the same time.
Code:
private function onDownloadProgress(event:ProgressEvent):void {
var loaded:int = event.bytesLoaded;
var total:int = event.bytesTotal;
trace(event.target,loaded,total);
_starfield.progress = loaded/total;
}
Output:
[object Preloader] 134276 134276
[object Preloader] 265348 285007
[object Preloader] 285007 285007
[object Preloader] 678223 1322116
[object Preloader] 809295 1322116
[object Preloader] 1322116 1322116
[object Preloader] 1322116 1322116
[object Preloader] 1387652 1584342
[object Preloader] 1791882 1791882
[object Preloader] 2293133 2293133
[object Preloader] 2362938 2362938
[object Preloader] 2362938 2362938
[object Preloader] 2362938 2362938
Why does bytesTotal change during load?
As runtime shared libraries are started to be downloaded, the total can increase. You can learn a little more about it by reading the Preloader source code.
sdk\frameworks\projects\framework\src\mx\preloaders\Preloader.as
Here are some links to custom preloader samples that handle RSL's better than the default.
http://coding.bhirschmann.de/2008/03/20/preloader-for-flex-with-rsl-support/
http://www.leavethatthingalone.com/blog/index.cfm/2009/11/11/Flex4CustomPreloader
or another way would be to break a preloader into 6 stages, with a preloader loading each component and running from 0 to 100%, then incrementing a number or "parts" loaded and displaying that on screen too

Resources