mongodb – Query doesn’t return data that’s written recently

I have two micro services where one write to DB and another read from DB.

The first micro service is written in C++ while the other is written in NodeJS.

When querying for data say for a IP the MongoDB return older data or no data at all (In case if the client is new) but If I query like say after 5 min it returns the recent data.

I don’t think this has to do with concurrency at all because C++ is performant enough to write to DB faster

unity – Is using events a good way to have the option to return out of a method or alter its normal execution?

Let’s say I have a script that calls a method frequently, and when doing so wants to allow other objects to know about it and potentially alter what happens in that method. This is fairly simple to do using C# events:

public class PassByReference 
{
    public bool foo;

    public PassByReference(bool foo)
    {
        this.foo = foo;
    }
}

public class Example : MonoBehaviour
{
    public event Action<bool> OnSomethingHappened;

    private void DoSomething()
    {
        var returnOut = false;

        // Do some stuff

        var passByReference = new PassByReference(returnOut);
        OnSomethingHappened?.Invoke(passByReference); // Some other object can read and alter this

        if (returnOut)
            return;

       // Do some more stuff
    }
}

Is this a good way to do things if one anticipates that, based on a combination of the information given by the event, and their own properties, other objects may want to stop the second half of the Example method from running (or maybe alter what happens)? I guess what I’m trying to do is prevent the Example class from having to store references to many other classes that will interact with it only occasionally, and clog up the method with many if statements. My main concern, though, is that frequently creating new classes to pass data via reference in the event(s) can lead to performance issues, especially if many objects in my game are using the Example script.

amazon web services – aws ecs describe-task-definition doesn’t return EFS file system specification

I tried with

aws ecs describe-task-definition --task-definition task1

but only get the volume names

...,
"volumes": [{
     "name": "test1"
}], ... 

According to spec I should receive an efsVolumeConfiguration object inside each volume, too. Does anyone know why I can’t see the information or how I otherwise can retrieve it? Thanks in advance!

If your phone was compromised by a government body, how would you return it to it’s original state?

Say your phone was confiscated and consequently compromised, how would you ensure that it is no longer bugged?

complex – Why does Abs return negative values?

According to the documentation Abs(z) gives the absolute value of the real or complex number z and is also known as the modulus. As far as I’m aware for any definition of the absolute value, norm or modulus the range of the function is supposed to be the positive real numbers but it seems that Mathematica’s Abs function also returns negative numbers:

r = Root( -1 - 9 # -15 #^2 + #^3&, 3, 1 );

N(r)
(* 15.5817 *)

r > 0
(* True *)

N(Abs(r))
(* -15.5817 *)

Abs(N(r))
(* 15.5817 *)

I know that Simplify, reduce and others show similar behaviour when working with powers of complex numbers, whose numerical value may change due multivaluedness of complex powers, but here I did not ask for a symbolic simplification and even if I did, there should be no change in numerical value since the Abs function is inherently single valued.

So I wondered whether this is a design choice or an actual bug and
if it is a design choice, then how am I supposed to e.g. sort eigenvalues on magnitude and return a list positive magnitudes?

design – To return or not – redundant data from method arguments

Which code should I prefere and why? Is there some general rule?

Code 1:

var apiLicenseInfo = GetLicenseFromApi(string userId, string deviceId);
var localLicenseInfo = MapToLocalLicense(apiLicense);

Code 2:

var apiLicenseInfo = GetLicenseFromApi(string userId, string deviceId);
var localLicenseInfo = MapToLocalLicense(apiLicense, userId, deviceId);

In Code 1 arguments (userId and deviceId) passed to method GetLicenseFromApi are returned in result of method. Then the result is translated to another object using only the result of previous method.

In Code 2 arguments (userId and deviceId) are not returned in result of GetLicenseFromApi method and must be passed to second method.

In my opinion the Code 1 is more consistent, but sends unnecessary data.

Does leaving behind a business and child count as proof of intention to return for UK Visa?

I know this has been done many times before but I’m seeking advice on my situation.

I’m a professional British citizen living in Asia. I have been with my Filipino Girlfriend for around a decade. I provide for her financially. She has a small food and beverage business in the Philippines which is in her name. She has all the paperwork to prove this, including business permits etc. Unfortunately, as it’s basically a cash in hand business not much of the takings are deposited in a bank, although she does have an account.

She has a 14 year old Daughter from a previous relationship and we have an 18-month old Son together who has my surname and I am named on the birth certificate.

I would like to take my Girlfriend and Son to the UK for 2 weeks this
year to visit my parents/my sons grandparents who are elderly and
would find a long journey difficult. I have the following questions
surrounding her being able to prove that she intends to return:

  • Would the fact that her Daughter, who lives with her and is reliant
    on her, will be staying behind in the Philippines be enough to show
    she intends to return?
  • Would the fact that she owns her own small business (and has all the
    documentation to prove this) be proof that she intends to return,
    despite not having accounts etc to show it is profitable?

Does the fact that I am my sons Father and I want him to see his elderly grandparents and meet his wider family members count for anything? Obviously an 18-month old baby is too young to spend 10 to 14 days away from his Mother.

For the record I will be sponsoring her trip/paying for flights/paying for private medical insurance for the both etc.

Edited to add from comments: My girlfriends mother will be taking care of the daughter and has provided a letter to state this. I can prove that I support my girlfriend, although I work and live in Singapore.

Concerning Covid-19 quarantine on return to Japan as a non-citizen resident

As part of its efforts to prevent the spread of Covid-19 and infections with SARS-CoV-2, the Japanese government has closed its borders for most forms of international travel. However, as a non-citizen resident it is permitted to travel abroad as long as certain restrictions are followed. Most importantly, even after testing negative for the virus at the airport upon arrival a foreign national must quarantine themselves for 14 days ‘at a location designated by the quarantine station chief’. The linked document does not mention it but other Japanese government sources such as the Japanese embassy in Germany indicate that this location may be one’s place of residence. It is not permitted to use public transportation (including taxis) to reach the designated location.

This raises two questions:

  • assuming my designated location is my place of residence, by what means am I permitted to reach it?

    My trip to the closest international airport (KIX) is about two hours by train. I do not own a car but I do have a driving licence. I do not have any friends or family who could pick me up at the airport. Specifically for me: would renting a car to drive to my apartment be a permitted way of getting there?

  • How strict are the actual quarantine requirements and how strictly are they enforced?

    e.g. would I be permitted to buy groceries at the local supermarket or must I order deliveries?

(I am aware that agreements have been reached with a number of countries facilitating travel arrangements between Japan and these countries, especially for business travel. However, the country I would visit is not on this list as of 14/10, so the more relaxed restrictions are not applicable to my case.)

command line – on the password prompt, the shell automatically adds a return after entering a character and displays authentication failed

logging in to an ubuntu 16.04 server via ssh. This has never happened before. The other user I asked seems unaffected by this. What could have happened? Also, when I try to enter my git credentials and press return, the shell replaces it with ^M, backspace with a ^?. When I open a tmux session, things work as they should.

Excel Formula: Return range of True and False Values

I have a named range, returning values of 0 and >0.

I need to substitute the values in this range as follows:
0 = FALSE, more than 0 = TRUE

Say my range is A1:A10, with values:

  • 0, 0, 0.25, 0.5, 0.5, 0, 0, 0.36, 0, 0

What I need returned:

  • FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE

I’ve tried wrapping the indirect function inside the AND() function to perform the logical test, but this did not work.