nativescirpt-canvas with Angular - how to redraw the Canvas? - nativescript-plugin

I want to write a simple "compass" app with NativeScript, a fun project to be submitted to GitHub. The GPS part is done. I am using this: https://market.nativescript.org/plugins/nativescript-canvas, app created with 'tns create --ng'. The canvas is drawn once, it works, great! But I want to constantly redraw it with data from GPS and I have no idea how.
I tried to save the 'canvas' value in an instance variable of my Component, I mean the value that comes with the event to 'draw' -> event: {canvas: Canvas} But reusing the value crushes the whole app, it is actually 'undefined' which I don't understand with my limited knowledge of Angular/TypeScript. Any hint how to get the 'canvas' wherever I like? A git repo with a working example?
I followed the instruction for Angular:
and draw(event: { canvas: Canvas }) { ...
deploying it to android emulator ends with an error (see below) but adding a space anywhere in the code forces redeployment ('change detected') which deploys fine. As such this cannot be deployed to a real device, of course. But first - I need to update the canvas :) thx.
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.HelloWorld/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
System.err: Calling js method onCreate failed
System.err:
System.err: Error: Main entry is missing. App cannot be started. Verify app bootstrap.
System.err: File: "file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js, line: 21886, column: 20
System.err:
System.err: StackTrace:
System.err: Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js', line: 21886, column: 27
System.err: Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js', line: 21731, column: 14
System.err: Frame: function:'push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js', line: 19544, column: 25

The event param also has object property which is the canvasView.
In order to redraw, you can call
event.object.redraw()
Then your draw function will be called again, and you can handle the canvas update.

Related

react-native - [object] is not usable as a native method argument

I recently started to get this error for both iOS and Android. I don't know what is causing this problem. In all the other instances of this error, there is probably a NaN value or some other unexpected value but in my case, everything is a valid value. For iOS, this is happening when I am callind the PushNotificationIOS.scheduleNotification. For Android, it happens, when I called a native react method.
This is only happening when I am running in dev mode. Please let me know what could be the problem here or how can I debug this problem.
2019-10-18 21:27:16.745 10843-11080/com.myapp E/ReactNativeJS: [{"fireDate":"2019-11-01T16:30:00.000Z","repeat":"2","repeatType":"weeks","creatorTimezone":"Asia/Kolkata","alarmId":"-LrU_OrkWvoCU-W8VY-A","alarmName":"Personal Reminder","type":"alarm","alarmType":"Personal","alarmDate":"2019-11-01T16:30:00.000Z","alarmAlert":"Personal Reminder - It's time.","shortAlarmAlert":"It's time.","cascadingAlarmInterval":900000,"recipientAlarmInterval":0,"alarmRingtone":{"label":"Hollywood Adventure","type":"inbuilt","value":"hollywood_adventure"},"vibrate":"true","volume":80,"version":2,"ringtoneDuration":60000,"uid":"-LrTbAdkCtVoFBfDKBwk","username":"udi","ringtonePath":"android.resource://com.myapp/raw/hollywood_adventure"}] is not usable as a native method argument
2019-10-18 21:27:16.766 10843-11080/com.myapp I/ReactNativeJS: 'Failed to print error: ', 'Exception in HostFunction: Malformed calls from JS: field sizes are different.\n\n[[34,45],[4,2],[["[{\\"fireDate\\":\\"2019-11-01T16:30:00.000Z\\",\\"repeat\\":\\"2\\",\\"repeatType\\":\\"weeks\\",\\"creatorTimezone\\":\\"Asia/Kolkata\\",\\"alarmId\\":\\"-LrU_OrkWvoCU-W8VY-A\\",\\"alarmName\\":\\"Personal Reminder\\",\\"type\\":\\"alarm\\",\\"alarmType\\":\\"Personal\\",\\"alarmDate\\":\\"2019-11-01T16:30:00.000Z\\",\\"alarmAlert\\":\\"Personal Reminder - It\'s time.\\",\\"shortAlarmAlert\\":\\"It\'s time.\\",\\"cascadingAlarmInterval\\":900000,\\"recipientAlarmInterval\\":0,\\"alarmRingtone\\":{\\"label\\":\\"Hollywood Adventure\\",\\"type\\":\\"inbuilt\\",\\"value\\":\\"hollywood_adventure\\"},\\"vibrate\\":\\"true\\",\\"volume\\":80,\\"version\\":2,\\"ringtoneDuration\\":60000,\\"uid\\":\\"-LrTbAdkCtVoFBfDKBwk\\",\\"username\\":\\"udi\\",\\"ringtonePath\\":\\"android.resource://com.myapp/raw/hollywood_adventure\\"}] is not usable as a native method argument",[{"column":20,"lineNumber":4382,"arguments":[],"methodName":"enqueueNativeCall","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":42,"lineNumber":4000,"arguments":[],"methodName":"fn","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":41,"lineNumber":284071,"arguments":[],"methodName":"scheduleNotification","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":53,"lineNumber":213975,"arguments":[],"methodName":"cancelOrRescheduleNotificationForAlarm","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":53,"lineNumber":213917,"arguments":[],"methodName":"markAlarmAsAcknowledged","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":17,"lineNumber":197088,"arguments":[],"methodName":"withConnectAndAuthenticationOptional","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":67,"lineNumber":213997,"arguments":[],"methodName":"onIAmUp","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":47,"lineNumber":53662,"arguments":[],"methodName":"touchableHandlePress","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":null,"lineNumber":null,"arguments":[],"methodName":"touchableHandlePress","file":"[native code]"},{"column":36,"lineNumber":53205,"arguments":[],"methodName":"_performSideEffectsForTransition","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":null,"lineNumber":null,"arguments":[],"methodName":"_performSideEffectsForTransition","file":"[native code]"},{"column":46,"lineNumber":53131,"arguments":[],"methodName":"_receiveSignal","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":null,"lineNumber":null,"arguments":[],"methodName":"_receiveSignal","file":"[native code]"},{"column":26,"lineNumber":53010,"arguments":[],"methodName":"touchableHandleResponderRelease","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":null,"lineNumber":null,"arguments":[],"methodName":"touchableHandleResponderRelease","file":"[native code]"},{"column":21,"lineNumber":14049,"arguments":[],"methodName":"invokeGuardedCallbackImpl","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":42,"lineNumber":14145,"arguments":[],"methodName":"invokeGuardedCallback","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":36,"lineNumber":14149,"arguments":[],"methodName":"invokeGuardedCallbackAndCatchFirstError","file":"http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&minify=false"},{"column":48,"lineNumber":14256,"arguments":[],"methodName":"executeDispatch","file":"http://10.0.2.2:8081/in
2019-10-18 21:27:16.770 10843-11080/com.myapp E/unknown:ReactNative: Exception in native call
java.lang.RuntimeException: Error calling RCTEventEmitter.receiveTouches
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:193)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:764)
Caused by: com.facebook.jni.CppException: [{"fireDate":"2019-11-01T16:30:00.000Z","repeat":"2","repeatType":"weeks","creatorTimezone":"Asia/Kolkata","alarmId":"-LrU_OrkWvoCU-W8VY-A","alarmName":"Personal Reminder","type":"alarm","alarmType":"Personal","alarmDate":"2019-11-01T16:30:00.000Z","alarmAlert":"Personal Reminder - It's time.","shortAlarmAlert":"It's time.","cascadingAlarmInterval":900000,"recipientAlarmInterval":0,"alarmRingtone":{"label":"Hollywood Adventure","type":"inbuilt","value":"hollywood_adventure"},"vibrate":"true","volume":80,"version":2,"ringtoneDuration":60000,"uid":"-LrTbAdkCtVoFBfDKBwk","username":"udi","ringtonePath":"android.resource://com.myapp/raw/hollywood_adventure"}] is not usable as a native method argument

Angular7 + XHook gives ERROR TypeError: Illegal invocation

I have a chrome plugin runnin Xhook which intercepts xhr requests.
This used to work with angular js. Now I am using an Angular 7 application And I am getting an error when I make following request
this.http.get('someurl').subscribe((data: any) => {
});
Which triggers xhr.send(reqBody); in the angular http.js library. The error is on the subscribe part, if I remove this the error is gone.
The error is the following:
core.js:15724 ERROR TypeError: Illegal invocation
at ZoneTask.scheduleTask [as scheduleFn] (zone.js:3238)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask (zone.js:410)
at Object.onScheduleTask (zone.js:301)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask (zone.js:404)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask (zone.js:238)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask (zone.js:261)
at scheduleMacroTaskWithCurrentZone (zone.js:1245)
at zone.js:3276
at _global.<computed>.proto.<computed> [as send] (zone.js:1569)
at Observable._subscribe (http.js:1726)
I am using this library: https://github.com/jpillora/xhook and the error is caused by line 478 facade.send = function(body) https://github.com/jpillora/xhook/blob/gh-pages/dist/xhook.js
I am thinking that: either angular tries to run the overridden function but something is not accessible because of zone.js, or I am missing certain properties, function in the object that overrides xhr?
If anyone has any information or solution on the subject that would be dearly appreciated.

Unhandled rejection Error: Chrome still being created

When I use { insertDefaultUI: false } to create a video I get an "Unhandled rejection Error: Chrome still being created" when trying to cleanup after I'm done with session.disconnect().
Any ideas...?
I'm on the TokBox dev team.
The error is not something you should be concerned with, it's something internal to the SDK.
The bug is that the error is appearing at all. I have created a bug report and this error should disappear in a future release. Until then you can safely ignore it.
Thanks for the report.
I'm having the very same problem when trying to unpublish my publisher
Could you guys provide a solution?
Unhandled rejection Error: Chrome still being created
at Object.chromeMixin.reset (https://static.opentok.com/v2/js/opentok.js:41755:16)
at reset (https://static.opentok.com/v2/js/opentok.js:42837:19)
at Publisher.destroy (https://static.opentok.com/v2/js/opentok.js:43211:7)
at defaultAction (https://static.opentok.com/v2/js/opentok.js:43524:20)
at executeDefaultAction (https://static.opentok.com/v2/js/opentok.js:25584:19)
at Object.api.dispatchEvent (https://static.opentok.com/v2/js/opentok.js:25735:7)
at Publisher.self.dispatchEvent (https://static.opentok.com/v2/js/opentok.js:25427:19)
at Object.streamDestroyed (https://static.opentok.com/v2/js/opentok.js:43527:16)
at Object.unpublishFromSession (https://static.opentok.com/v2/js/opentok.js:43507:16)
at Session.unpublish (https://static.opentok.com/v2/js/opentok.js:47031:19)
at Object.me.stop (https://x/rt.js:498:17)
at b.$scope.callBreak (https://x/ler.js:16:24)
at fn (eval at compile (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:239:266), <anonymous>:4:165)
From previous event:
at createChromeMixin (https://static.opentok.com/v2/js/opentok.js:41672:21)
at new Publisher (https://static.opentok.com/v2/js/opentok.js:42826:23)
at Object.initPublisher (https://static.opentok.com/v2/js/opentok.js:44275:21)
at Object.me.start (https://x/rt.js:457:27)
at b.$scope.start (https://x/ler.js:6:24)
at fn (eval at compile (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:239:266), <anonymous>:4:161)
at e (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:284:187)
at b.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:148:347)
at b.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:149:52)
at HTMLButtonElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:284:239)
at HTMLButtonElement.dispatch (https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:4:8549)
at HTMLButtonElement.r.handle (https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:4:5252)
I might be a bit late, but I'll share my findings. When using a custom UI on your publisher, use the following event:
publisher.on('streamDestroyed',function(event){ event.preventDefault();});
This disallows opentok calling widget destroying events which causes the exception related to this question, however now I don't know how to stop the stream lol, since if I call event.target.destroy() will generate the same exception, lol ... so I'm trying to figure that out.

I try to solve the error (%matplotlib inline). The error message is as follows.

UnknownBackend: No event loop integration for inline. Supported event loops are : qt,qt4,qt5,.......
What's wrong with my Ipython?

exception when finishing a custom "new file wizard" in a RCP project

I am working with a custom "new file wizard". when i press the finish button i am expecting the eclipse to add a new file and show it correctly, but instead an exception occurs and i can't open the created file. But if i use this wizard for a second time, the exception doesn't occur and the file opens correctly. why?
the exception occurs when this line getContainer().run(true, false, op) executes.
and it is a part of the exception:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-07-28 16:15:01.239
!MESSAGE Unable to create class 'org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor' from bundle '33'
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.IllegalArgumentException: can't find IDfind.ext
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:837)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:318)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:889)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:623)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:725)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:696)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:690)
.
.
.
So the problem is that one of plugins that you have in your app requires a marker named find.ext. The error log shows IDfind.ext because the error message is concatenated without a space.
The happens if you have a custom application. Solution is quite easy:
Locate your WindowActionBarAdvisor that extends ActionBarAdvisor and defines your application initial menus and toolbars like File, Help, etc. etc.
Add this line:
menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
f.e. to the method
createEditMenu.
or to any other menu entry.