QuickBlox history returns only first messages [duplicate] - chat

This question already has answers here:
Quickblox messaging fetch last n messages
(2 answers)
Closed 8 years ago.
QuickBlox returns only 50 chat messages and I know this is a known limit if I don't specify the extendedRequest LIMIT and SKIP, but my problem is I want the LAST 50 messages and not the first 50 messages. I tried the extendedRequest[#"sort_desc"] = #"last_message_date_sent" but QB is returning random messages, not the last and not the first.
This issue occurs in Q-Municate also. I created a chat with a friend and sent him N messages, and only first few messages are returned.
So, is there a way to return only the last 50 messages?

I found an answer from Igor Khomenko in this topic: Quickblox messaging fetch last n messages
and applied. It was correct and I improved inverting the Array with the messages, to show correctly to the user:
NSMutableDictionary *extendedRequest = [NSMutableDictionary new];
NSDate *now = [NSDate date];
extendedRequest[#"date_sent[lte]"]= #([now timeIntervalSince1970]);
extendedRequest[#"sort_desc"]= #"date_sent";
//get the most recent 50 messages
extendedRequest[#"limit"] = #(100);
and when I have the Array populated, I just invert it with:
[[self.messages reverseObjectEnumerator] allObjects];
and everything was fine!
Igor, the same issue occurs in Q-Municate, and thanks for the help.

Related

How to ask NetSuite saved search to return client records, when a related record does not exist, within a date range

I have client records that may have related-records indicating they attended a conference. I want to tag client records that have not attended a conference in the last 3 years. They may have conference records prior to 3 years past, but will have none onward from that.
I'm asking Netsuite to search from 3 years ago, and return client records where conference records do not exist.
My question is, how can I get NetSuite to work with a system date range, today-3 years and out into the future, in a saved search?
The first criteria is, for example, 'conference record ID is NULL.'
The date criteria something like, 'after today -1095 days.'
I got this to work by adding a 'Formula (Date)' filter as a criteria in the saved search. Then, in the description, 'after 3 years ago (relative), and the field typed-in as {today}. This worked to filter the other criteria within the date range.

MongoDB storing one day before than actual date [duplicate]

This question already has an answer here:
Mongodb saves one day less - Time Zone Issue
(1 answer)
Closed 4 years ago.
I am facing one issue to store the actual date(01/08/2018) that what I passed from model. My document is stored successfully but MongoDB store the one day before than what I passed in model.
Here I am passing the date(dd/MM/yyyy) is 01/08/2018
For more detail please check the below snaps.
After successfully saved the record, I checked in Robo 3T(MongoDB) and I show that it stored the one day before than actual value. Stored date is 2018-07-31. For more detail please see the below snap.
I hope so might be issue with timezone or offset but I don't know what is the solution.
By using Moment Library https://momentjs.com/ your issue can be solved. you have to just passed a date like below and follow the format.
var myDate = new Date(moment("2018-07-04").format("YYYY-MM-DD"))
save this to you DB it will work

How to get only the first 6 months action of all my records

I'm pretty new in Tableau. I have looked at the forum already and the answered suggested. But I'm not quite sure it match my question.
I have a bunch of records. This is about registration for a sport lesson depending on time. All of them have a start date and and some of them a finish date. The other never finish (They continue until date T with T = now).
My goal is to compare only the first 6 months of all my records, I think there are 50 of them, like the evolution during this period of time. So, for some the start date would be in January 2009, for some other, it would be in May 2016, etc.
As field provided, I have the start date and the number of person that have subscribed those lesson through time.
So, do you if there is any to achieve this goal? Is there enough detail for you to understand what I am saying ?
Thx to you guys !!
EDIT
You can find enclosed a screenshot of the result that I already have.
number of registration for all lesson through time
I'm not sure to be clear, what I try to do is to compare the first 6 months only of each courses. So the evolution of the first 6 months of this course compare to the evolution of the first 6 months of this other course and so on :)
If I understand your question correctly you are wanting to show only the first six months of your data but you want this by each category.
I am assumuming that by definition this means 6 months from the first record in your data for each category.
In order to achieve this I would create a true/false flag using a level of detail expression. As you are new to tableau I would suggest you do some reading on this but basically you can force a calculation to be at a certain level of the data rather than at the row level. You use this to find the minimum date in the table and then use a date diff to return true if the actual date field is within 6 months of this.
Create a calculated field as follows:
[date] <= DATEADD('month', 6, { FIXED [category] :min([date])})
Then drag this onto your filters pane and select "TRUE". This should give you only the first six months of records for each category.
Let me know if you need anything else.

Finding the difference in time between two NSDates Swift [duplicate]

This question already has answers here:
Getting the difference between two Dates (months/days/hours/minutes/seconds) in Swift
(20 answers)
Closed 7 years ago.
I have two NSDate objects: startDate and endDate, both are NSDate objects. I want to find the difference between these two dates. I know there is a resolved question about this already (Getting the difference between two NSDates in (months/days/hours/minutes/seconds)), but I want to know if there is a quicker way to do this (less execution code). Is that possible?
Yes if you look at the second answer to your linked question you can do this:
let interval = laterDate.timeIntervalSinceDate(earlierDate)

Insights FQL returns empty when end_time is current date

I have this query:
SELECT metric,value FROM insights WHERE object_id=200829446624786 AND
metric IN("page_story_adds_unique","page_impressions_unique",
"page_impressions_organic_unique","page_impressions_paid_unique",
"page_impressions_viral_unique") AND (end_time=end_time_date('2013-03-06')) AND
period=period("days_28")
but for some reason the query returns an empty array. I changed the date to last month (2013-02-06) and it returned an array with values for the metrics I asked for.
Can anyone please explain why there were no values when I put in the current month while putting in previous months gives me sufficient values? Thanks :)
Want to improve this post? Add citations from reputable sources by editing the post. Posts with unsourced content may be edited or deleted.
Because the most recent data is always a couple of days old. On my page it is 4 days old.