how to correctly use Firebase.Firestore.FieldValue.ServerTimestamp in unity? - unity3d

Currently, I was working on a Unity project and using Firestone as my database.
now i facing a problem is when i create a document in firestone i want to add the time of creation also.
i was using the code
db.Collection("Challenges").Document(addedDocRef.Id).UpdateAsync("TimeCreated", Firebase.Firestore.FieldValue.ServerTimestamp);
but it always update the same time in firestone.
every document get same timestemp, can anyone teach me how to solve this issue?

The FieldValue properties are sentinel values in this case to be understood as dummy values that are supposed to be filled in by "someone".
I don't know how Firebase works exactly and who is supposed to fill this in but what you get basically equals DateTime.UnixEpoch the default uninitialized system time (+ 7:30 timeszone shift). It might have to be configured accordingly somewhere before it works correctly.
You could instead simply pass in your own timestamp using e.g. DateTime.Now

Related

Using regex to only return some of the Loki Label values

I am setting a Variable in Grafana.
I want to create a Query, that only returns a subset of the labels with value app the ones I want to return are those ending in dev
My Query so far, returns all of the labels with value app successfully. However, I have been unable to successfully filter the values so that only a-dev b-dev and c-dev are returned.
How do I successfully apply regex (or alternative) to this query so that I can see the desired values?
Any help on this would be greatly appreciated!
I eventually figured out what I needed to do. Originally I was trying to use | to run regex on the results from label_values.
However, this format worked:
label_values({app=~".*-dev$"}, app)
and returned only a-dev b-dev c-dev as expected.

Movesense, setting the system time

I am trying to set the system time in Movesense. I couldn't find an example of that, but based on the documentation I think that this should do:
asyncPut(WB_RES::LOCAL::TIME(),
AsyncRequestOptions::Empty,
(int64_t)0);
In this case, I'm just trying to reset the epoch to zero but onPutResults gives me
HTTP_CODE_BAD_REQUEST
So what is the right way?
Minimum timestamp seems to be 1483228800000000 us which corresponds to 1.1.2017. So you can't set the time to 70's as zero would set it to.
This should be documented in the yaml api but currently is not. We will add that to the list of tasks to make sure it's documented in the next release of device-lib.

Zabbix Trigger Expression = NULL

i´ve a quick question regarding a zabbix trigger expression. Our script finds out the certification lifetime while returning a number into a file. I already created some triggers for specific time spans (like 10 days or 44 days).
For example:
{Certificate Lifetime:vfs.file.contents[C:\Zabbix_scripts\cert.txt].prev()}<=30 and {Certificate Lifetime:vfs.file.contents[C:\Zabbix_scripts\cert.txt].prev()}>10
I now want to have a trigger which will cause an "Disaster" when the value in the .txt file is unavailable, like the txt file is empty.
I´ve tried
{Certificate Lifetime:vfs.file.contents[C:\Zabbix_scripts\cert.txt].prev()}=0
But this was not the right sulution. Any ideas?
Moreover we have some machines which are equal to others but doesn´t show any value. Any ideas at this point?
Regards
You should be able to detect empty item value with something like this:
strlen()=0

Inserting different map object to CartoType map

I can add one mapobject by using:
m_framework.InsertPointMapObject(m_framework.GetMemoryMapHandle(),"amenity",
32.791576, 39.909264,
CartoType.CoordType.Degree,
"AHMET YILMAZ\n06DY1998\n",
CartoType.Util.IntAttribute("fue",1),ref id,false);
But adding another with same code to another location is impossible. It is not drawing the second one. I have tried changing id but not worked.
Can I only add one map point?
Thanks.
Muzaffer, I'm sorry I didn't notice this question. As the CTO of CartoType I ought to have done. Yes, you can insert as many points as you like.
The problem you're having is caused by a conflict in object IDs. The first call sets the ID to one assigned by CartoType. If you leave that ID as it is, and use it in a new call, it will conflict with the ID of the object you just inserted.
The best way fix this problem is to change the ID to zero each time, just before you call InsertPointMapObject. Then CartoType will assign an ID and return it to you in 'ref id'.
If that doesn't work, please post a small repeatable example with all the code needed to reproduce the problem, and I'll look into it further.

Setting default in entity model for Type Time

I've tried a few values but nothing works. I could randomly try values (I did a few) and try searching (yep nothing after about 30 minutes of looking) or ask the SO folks.
So trying to set the default Time to 5:30:00 PM (17:30:00) when I create a new record. I thought all I needed to do was set it in the properties, and it seems correct, but doesn't like the value I put in. 17:00:00.0000000 and 17:00:00 and 17:00:00.0 all failed.
See image
Try setting your time to:
17:30:00.0000000z
17:30:00.0000000Z
That works for me with a database column having type Time(7). Mark Oreta's also worked. I received the same error when I omited the z or Z. Is there an issue in your table mappings?