Ionic 2 Calendar Event - ionic2

I want to ask about calendar event in ionic 2.
I have a script like this :
myscript
This script for getting data event from my storage. But, I got this in my console log :
myconsolelog
And event also displays in my browser:
mydisplay
My question is, why my console logs in addschedule.ts 46 not showing data? Because when I am trying in a real device, I cant retrieve my event from local.

Line number 46 will be executed first before line number 44 because storage.get() will return promise in future (asynchronous operation). For not retrieving data from real device, we have to see the other part of the code. Also please post the code directly without images

Related

Dataflow discarding massive amount of events due to Window object or inner processing

Been recently developing a Dataflow consumer which read from a PubSub subscription and outputs to Parquet files the combination of all those objects grouped within the same window.
While I was doing testing of this without a huge load everything seemed to work fine.
However, after performing some heavy testing I can see that from 1.000.000 events sent to that PubSub queue, only 1000 make it to Parquet!
According to multiple wall times across different stages, the one which parses the events prior applying the window seems to last 58 minutes. The last stage which writes to Parquet files lasts 1h and 32 minutes.
I will show now the most relevant parts of the code within, hope you can shed some light if its due to the logic that comes before the Window object definition or if it's the Window object iself.
pipeline
.apply("Reading PubSub Events",
PubsubIO.readMessagesWithAttributes()
.fromSubscription(options.getSubscription()))
.apply("Map to AvroSchemaRecord (GenericRecord)",
ParDo.of(new PubsubMessageToGenericRecord()))
.setCoder(AvroCoder.of(AVRO_SCHEMA))
.apply("15m window",
Window.<GenericRecord>into(FixedWindows.of(Duration.standardMinutes(15)))
.triggering(AfterProcessingTime
.pastFirstElementInPane()
.plusDelayOf(Duration.standardSeconds(1)))
.withAllowedLateness(Duration.ZERO)
.accumulatingFiredPanes()
)
Also note that I'm running Beam 2.9.0.
Could the logic inside the second stage be too heavy so that messages arrive too late and get discarded in the Window? The logic basically consists reading the payload, parsing into a POJO (reading inner Map attributes, filtering and such)
However, if I sent a million events to PubSub, all those million events make it till the Parquet write to file stage, but then those Parquet files don't contain all those events, just partially. Does that make sense?
I would need the trigger to consume all those events independently of the delay.
Citing from an answer on the Apache Beam mailing list:
This is an unfortunate usability problem with triggers where you can accidentally close the window and drop all data. I think instead, you probably want this trigger:
Repeatedly.forever(
AfterProcessingTime
.pastFirstElementInPane()
.plusDelayOf(Duration.standardSeconds(1)))
The way I recommend to express this trigger is:
AfterWatermark.pastEndOfWindow().withEarlyFirings(
AfterProcessingTime
.pastFirstElementInPane()
.plusDelayOf(Duration.standardSeconds(1)))
In the second case it is impossible to accidentally "close" the window and drop all data.

One way background notification from server to client (Django to tell Angular 4 what to happened at the back)

Been looking at this for quite sometime. First, it is not a two way communication. Just the server have to send 1,2 or 3 to the client whenever something happens at the back.
Full Scenario:
Certain employees are allowed to do something that generates XML/JSON files at the back. The rest of the employees make use of those newly created, updated data. The problem is the client might retain a copy even though it has been updated because I get copy of latest generated files when a user logs in or manually checks for any newly generated data.
Now, I want the backend to notify the front-end that there was a change and fetch new content silently.
Current Solution:
My current solution is to check for changes every hour and notify the user to logout-login or manually fetch data with timers like this:
import 'rxjs/add/observable/timer'
import { Observable } from 'rxjs/Observable';
Observable.timer(0,3600000).subscribe(() => {
this.fileConsumerService.checkNew().subscribe(data=> {
if(data==true){
alert('New data has been generated. Please click on Update button or relogin')
}
})
});
While it is working, I am not really comfortable with the solution. Sometimes, the check happens much later after data was pushed, thus employees work on older data. I lowered it to one minute, which is the finest.
What is the way around this please?

What's the time-out value for the start-up of a Windows service

In order to debug a Windows service, written here in my company, the main function starts with:
Sleep(3000); // three seconds
This should allow me to do an "Attach to Process" while the service is starting up, but I seem to be too slow, so I decided to modify this value to 30,000 (thirty seconds).
However now, when starting up the service, I get following error message:
Prompt>net start <Service_Application>
The service is not responding to the control function.
What is the maximum value I can put there in order not to fall into such time-out?
You can get the value by accessing the registry key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control key ServicesPipeTimeout .
If this value is not set, its default value is set to 125 s ( see https://msdn.microsoft.com/en-us/library/windows/desktop/ms685149(v=vs.85).aspx to learn more about it ).

How to know if the user block the messenger bot

I want to know if the user blocks the chat bot. Going through the documentation I didn’t find a way to do it, so I had to create a work around.
I send a message to the user and create a flag of sending; then I use the sleep function for 10 seconds. Every time a user receives a message my code change the flag from sending to send. After 10 seconds, if the flag is still on sending means that the receiver didn’t get the message, so I infer that the chat bot is blocked.
There are some flaws with this work around like if the message takes more than 10 seconds to arrive and I don’t know why if I use the sleep function for >15 seconds, I get into a loop, and the Fb API start sending me requests.
Someone has a better solution??
I appreciate your help! (:
Check errors with code “10” subcode “2018108” or code “200” subcode “1545041”. These subcodes mostly define that user have blocked your bot/messenger conversation.
I tested today, with the latest iOS Messenger app, and I found out, that, for each of the following cases
User turns off messages
User taps on 'somethings wrong' -> report -> other / spam / inappropriate (=this is what you probably mean by 'block')
the Facebook Messenger API returns
{"error":{"message":"(#551) This person isn't available right now.","type":"OAuthException","code":551,"error_subcode":1545041,"fbtrace_id":"XXXXX"}}
Thus, the answer to your question is to check for error code 551, subcode 1545041. Be aware that you will get back the 'blocked' users lumped together with those who tapped on 'turn off messages'.
By the way, you are able to see the percentage of users who blocked a Messsenger conversation by going to the associated Facebook Page and tapping on the top row at 'Insights'.
Hope this helps others, it took me a couple of hours of my life, to learn this :)

CFStoredProc Timing Out

I have a very basic app that plugs data into a stored procedure which in turn returns a recordset. I've been experiencing what I thought were 'timeouts'. However, I'm now no longer convinced that this is what is really happening. The reason why is that the DBA and I watched sql server spotlight to see when the stored procedure was finished processing. As soon as the procedure finished processing and returned a recordset, the ColdFusion page returned a 'timeout' error. I'm finding this to be consistent whenever the procedure takes longer than a minute. To prove this, I created a stored procedure with nothing more than this:
BEGIN
WAITFOR DELAY '00:00:45';
SELECT TOP 1000 *
FROM AnyTableName
END
If I run it for 59 seconds I get a result back in ColdFusion. If I change it to one minute:
WAITFOR DELAY '00:01';
I get a cfstoredproc timeout error. I've tried running this in different instances of ColdFusion on the same server, different databases/datasources. Now, what is strange, is that I have other procedures that run longer than a minute and return a result. I've even tried this locally on my desktop with ColdFusion 10 and get the same result. At this point, I'm out of places to look so I'm reaching out for other things to try. I've also increased the timeout in the datasource connections and that didn't help. I even tried ColdFusion 10 with the timeout attribute but no luck there either. What is consistent is that the timeout error is displayed when the query completes.
Also, I tried adding the WAITFOR in cfquery and the same result happened. It worked when set for 59 seconds, but timed out when changed to a minute. I can change the sql to select top 1 and there is no difference in the result.
Per the comments, it looks like your request timeout is set to sixty seconds.
Use cfsetting to extend your timeout to whatever you need.
<cfsetting requesttimeout = "{numberOfSeconds}">
The default timeout for all pages is 60s, you need to change this in the cfadmin if it is not enough, but most pages should not run this long.
Take some time to familiarise yourself with the cfadmin and all its settings to avoid such head scratching.
As stated use cfsetting tag to override for specific pages.