问:
How force IntelliJ to keep showing deleted files?
I have a project that generates some Java files.
When i run a build, such java files are deleted, then regenerated. In the moment when one of such files is deleted, the tab showing it in IntelliJ disappears, so I must re-open it (there is not even a "recent closed files" list that helps me in that!).

So I keep the generated files open in Notepad++ (the best editor in the universe; it also keeps a list of the most recent closed files).
Notepad++ keeps open the files, if they are deleted by another program, when I click on them I get a question, more or less like this: «This file was deleted. Do you want to close or keep displaying it?»

Is possible to have a similar behaviour in IntelliJ instead to see files disappearing?
In the closing policy in settings → Editor → Editor tabs there is nothing similar.

答: It is not possible. There is a request you can vote up and follow for updates: IDEABKL-7092.</p>


来源: stackexchange

问:
Servelt Page doesn't Redirect to second Page using Servlet
I am a beginner of servlet jsp. I am creating a simple login form if the login successful page redirects to the second servlet along with the username. but it doesn't work it shows the error java.lang.IllegalArgumentException: Path second does not start with a "/" character
what I tried so far I attached below.

Form

```<code> <div class="row">
                <form method="POST" action="login">
                <div class="form-group">
                    <label>Username</label>
                    <input type="text" id="uname" name="uname" placeholder="uname" class="form-control">
                </div>

                 <div class="form-group">
                    <label>Password</label>
                    <input type="password" id="pword" name="pword" placeholder="pword" class="form-control">

                </div>

                 <div class="form-group">

                     <input type="submit" value="submit" class="btn btn-success">

                </div>

                </form>

            </div>
</code>```

Login Servlet Page

```<code>@WebServlet("/login")
public class login extends HttpServlet {
  @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {

         String uname = request.getParameter("uname");
         String pass = request.getParameter("pword");

         if(uname.equals("John") && pass.equals("123"))
         {
            PrintWriter out = response.getWriter();
            HttpSession session = request.getSession(true);
            session.putValue("username", uname);

            ServletContext context=getServletContext();
            RequestDispatcher rd=context.getRequestDispatcher("second");

            rd.forward(request, response);

         }

    }
</code>```

Second Servlet Page

```<code>@WebServlet("/second")
public class second extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        PrintWriter out = response.getWriter();
         HttpSession session = request.getSession(true);
       String uname = (String)session.getValue("uname");
        out.println("User Name is " + uname);

    }
</code>```

答:
There are some big differences between redirect and forward . This article will help you to understand better your problem.

Some things to keep in mind from the article :

FORWARD

1) Request and response objects will remain the same object after forwarding. Request-scope objects will be still available (this is why if you try to add the "/" you get the 405 status - it will try to forward you to the "/second" servlet but the only request overridden  is GET)

REDIRECT

1) The request is redirected to a different resource

2) A new request is created

So instead of using rd.forward I would suggest you to use the sendRedirect() method from HttpServletResponse class.

```<code>response.sendRedirect(request.getContextPath() + "/second");
</code>```

AND the correct way to get the session username attribute is this:

```<code>String uname = (String) session.getValue("username");
</code>```

Otherwise it will try to look after uname key which is not set. The uname was only a value mapped to the username key ( session.putValue("username",uname);

ContentLicense: CC BY-SA 4.0

Body:
I am a beginner of servlet jsp. I am creating a simple login form if the login successful page redirects to the second servlet along with the username. but it doesn't work it shows the error java.lang.IllegalArgumentException: Path second does not start with a "/" character
what I tried so far I attached below.

Form

                <form method="POST" action="login">

                    Username
                    <input type="text" id="uname" name="uname" placeholder="uname" class="form-control">

                    Password
                    <input type="password" id="pword" name="pword" placeholder="pword" class="form-control">

                     <input type="submit" value="submit" class="btn btn-success">

                </form>

Login Servlet Page

@WebServlet("/login")
public class login extends HttpServlet {
  @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {

         String uname = request.getParameter("uname");
         String pass = request.getParameter("pword");

         if(uname.equals("John") && pass.equals("123"))
         {
            PrintWriter out = response.getWriter();
            HttpSession session = request.getSession(true);
            session.putValue("username", uname);

            ServletContext context=getServletContext();
            RequestDispatcher rd=context.getRequestDispatcher("second");

            rd.forward(request, response);

         }

    }

Second Servlet Page

@WebServlet("/second")
public class second extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        PrintWriter out = response.getWriter();
         HttpSession session = request.getSession(true);
       String uname = (String)session.getValue("uname");
        out.println("User Name is " + uname);

    }

Body:
There are some big differences between redirect and forward . This article will help you to understand better your problem.

Some things to keep in mind from the article :

FORWARD

1) Request and response objects will remain the same object after forwarding. Request-scope objects will be still available (this is why if you try to add the "/" you get the 405 status - it will try to forward you to the "/second" servlet but the only request overridden  is GET)

REDIRECT

1) The request is redirected to a different resource

2) A new request is created

So instead of using rd.forward I would suggest you to use the sendRedirect() method from HttpServletResponse class.

response.sendRedirect(request.getContextPath() + "/second");

AND the correct way to get the session username attribute is this:

String uname = (String) session.getValue("username");

Otherwise it will try to look after uname key which is not set. The uname was only a value mapped to the username key ( session.putValue("username",uname);


问:
How to check permission and request permission in (Easy coding & easy to understand)
I search for Run-Time-Permission in android and I find lots of links but I see there is complex code.

Note: I share my simple code here so it's helpful for a new developer or Fraser. Also, I didn't use any third party library here.

答:
please try to  dexter  dependency

step:1

```<code> dependencies{
   implementation 'com.karumi:dexter:6.0.2'
 }
</code>```

step: 2

```<code>     Dexter.withActivity(this)
    .withPermission(Manifest.permission.CAMERA)
    .withListener(new PermissionListener() {
    @Override public void onPermissionGranted(PermissionGrantedResponse response) {/*
    @Override public void onPermissionDenied(PermissionDeniedResponse response) {/*
    @Override public void onPermissionRationaleShouldBeShown(PermissionRequest
    permission, PermissionToken token) {/* ... */}
    }).check();
</code>```

link :
       https://github.com/Karumi/Dexter

Body:
please try to  dexter  dependency

step:1

 dependencies{
   implementation 'com.karumi:dexter:6.0.2'
 }

step: 2

     Dexter.withActivity(this)
    .withPermission(Manifest.permission.CAMERA)
    .withListener(new PermissionListener() {
    @Override public void onPermissionGranted(PermissionGrantedResponse response) {/*
    @Override public void onPermissionDenied(PermissionDeniedResponse response) {/*
    @Override public void onPermissionRationaleShouldBeShown(PermissionRequest
    permission, PermissionToken token) {/* ... */}
    }).check();

link :
       https://github.com/Karumi/Dexter


问:
last item border doesn't work in Owl-Carousel
I am using [Owl Carousel][1] with Bootstrap. but last item border doesn't work in Owl-Carousel.

I want to add border on item hover. but right border is not display in last item.

Example-1

When Owl Carousel wrap in bootstrap Grid
...

```<code><div class="container">
    <div class="row">
       <div class="col-sm-9">
<div id="owl-example1" class="owl-carousel">
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    </div></div></div></div>
</code>```

So, I get this. (Not work fine.)

Example-2

But, When Owl Carousel without wrap in bootstrap Grid
...

```<code><div class="container">
<div id="owl-example" class="owl-carousel">
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    <div class="item"><img class="lazyOwl img-responsive" src="http://tinyurl.com/lwexfpf" alt="Lazy Owl Image"></div>
    </div></div>
</code>```

So, I get this. (work fine.)

Live Demo - http://jsfiddle.net/harnishdesign/zwd9uysg/18/embedded/result/

How can I solve border issue in Example-1 ?

答:
I solved it by setting the border-color to transparent and using an inset box-shadow instead:

.owl-carousel .owl-item .item {
   border: 1px solid transparent;
   box-shadow: inset 0px 0px 0px 1px #000000;
}
```

ContentLicense: CC BY-SA 3.0

Body:
I am using [Owl Carousel][1] with Bootstrap. but last item border doesn't work in Owl-Carousel.

I want to add border on item hover. but right border is not display in last item.

Example-1

When Owl Carousel wrap in bootstrap Grid
...

So, I get this. (Not work fine.)

Example-2

But, When Owl Carousel without wrap in bootstrap Grid
...

So, I get this. (work fine.)

Live Demo - http://jsfiddle.net/harnishdesign/zwd9uysg/18/embedded/result/

How can I solve border issue in Example-1 ?


问:
Setting an element's focus only if user has tabbed to it
I am trying to make some collapsible accordion containers on my website accessible, but I am running into an issue.

The accordions are controlled by link elements on the page - this way, a keyboard-only user can tab to them and access them. The first issue I ran into was that if a user tabbed to one of the links, the page wouldn't always scroll up to show them which one they had tabbed to. I fixed this issue setting the focus using the following code, which scrolls the link to the top of the viewport:

```<code>$(".accordion .accordion-item .accordion-heading a").focus(
    function()
    {
        $('html:not(:animated), body:not(:animated)').animate({
            scrollTop: $(this).offset().top
        }, 250);
    }
    );
</code>```

The problem I am encountering now is that when a mouse-user clicks on the link, it jumps to the top of the page and does not open the container unless the mouse-user clicks the link again.

Is there a way I can set the focus code above to only fire if the link has been tabbed to? Or, is there a better way of handling the focus issue so that it works for both keyboard-only and mouse users?

Thanks!

答:
You can change the event setting: Instead focus() event you will do a click() event: When you click a link, you'll scroll up. This will solve the problem of both keyboard navigation and mouse clicking;And this is also more true in terms of accessibility.

```<code>$(".accordion .accordion-item .accordion-heading a").click(
function(e)
{
    e.preventDefault();
    $('html:not(:animated), body:not(:animated)').animate({
        scrollTop: $(this).offset().top
    }, 250);
}
);
</code>```

Don't forget to change the link setting to a button by adding role=button attribute.
and add aria-expanded attribute.

Body:
I am trying to make some collapsible accordion containers on my website accessible, but I am running into an issue.

The accordions are controlled by link elements on the page - this way, a keyboard-only user can tab to them and access them. The first issue I ran into was that if a user tabbed to one of the links, the page wouldn't always scroll up to show them which one they had tabbed to. I fixed this issue setting the focus using the following code, which scrolls the link to the top of the viewport:

$(".accordion .accordion-item .accordion-heading a").focus(
    function()
    {
        $('html:not(:animated), body:not(:animated)').animate({
            scrollTop: $(this).offset().top
        }, 250);
    }
    );

The problem I am encountering now is that when a mouse-user clicks on the link, it jumps to the top of the page and does not open the container unless the mouse-user clicks the link again.

Is there a way I can set the focus code above to only fire if the link has been tabbed to? Or, is there a better way of handling the focus issue so that it works for both keyboard-only and mouse users?

Thanks!

Body:
You can change the event setting: Instead focus() event you will do a click() event: When you click a link, you'll scroll up. This will solve the problem of both keyboard navigation and mouse clicking;And this is also more true in terms of accessibility.

$(".accordion .accordion-item .accordion-heading a").click(
function(e)
{
    e.preventDefault();
    $('html:not(:animated), body:not(:animated)').animate({
        scrollTop: $(this).offset().top
    }, 250);
}
);

Don't forget to change the link setting to a button by adding role=button attribute.
and add aria-expanded attribute.


问:
How to fix wrong https in browser
my website https://www.startup.taipei under the https URL, there are different errors in the browser.

in IE11, it happens very often and needs to be refreshed several times :

Can’t connect securely to this page. This might be because the site
  uses outdated or unsafe TLS security settings. If this keeps
  happening, try contacting the website’s owner.

Chrome/edge, it happens occasionally and it also needs to be refreshed several times :

This site can't be reached. The connection was reset.
  (ERR_CONNECTION_RESET)

Firefox:good work

As mentioned above, this is a big headache for our users. I have ruled out the browser issue, is there any clue on the web server?

-Windows Server

-PHP 7.2.25

答:
It looks like the site is supporting TLS 1.3:

```<code>$ openssl s_client -connect www.startup.taipei:443
...
    Protocol  : TLSv1.3
    Cipher    : TLS_AES_256_GCM_SHA384
</code>```

But it is not supporting any other TLS protocol version, i.e. no TLS 1.2 etc:

```<code>$ openssl s_client -connect www.startup.taipei:443 -no_tls1_3
...
write:errno=104
...
    Protocol  : TLSv1.2
    Cipher    : 0000
</code>```

The errno=104 means that the server has send a RST, i.e. "Connection reset by peer".

TLS 1.3 is not supported by IE 11 and it might not even be supported by the TLS stack in your unknown Windows version. Since Firefox and Chrome come with their own TLS stack which supports TLS 1.3 the connection with these will be successful.

Title: How to fix wrong https in browser

Body:
It looks like the site is supporting TLS 1.3:

$ openssl s_client -connect www.startup.taipei:443
...
    Protocol  : TLSv1.3
    Cipher    : TLS_AES_256_GCM_SHA384

But it is not supporting any other TLS protocol version, i.e. no TLS 1.2 etc:

$ openssl s_client -connect www.startup.taipei:443 -no_tls1_3
...
write:errno=104
...
    Protocol  : TLSv1.2
    Cipher    : 0000

The errno=104 means that the server has send a RST, i.e. "Connection reset by peer".

TLS 1.3 is not supported by IE 11 and it might not even be supported by the TLS stack in your unknown Windows version. Since Firefox and Chrome come with their own TLS stack which supports TLS 1.3 the connection with these will be successful.


问:
Mongodb update array inside of an object
I can't write a query that would update a value of an array that is inside of an object:

Let's say I have a collection that has document entries with the structure like below (There are 2 entries in the example but actually there are a few thousand that I need to update in my db)

```<code>/* 1 */
{
    "name" : "Bob",
    "info" : {
        "species" : "human",
        "addresses" : [
            "one",
            "two"
        ]
    }
},
/* 2 */
{
    "name" : "John",
    "info" : {
        "species" : "human",
        "addresses" : [
            "two",
            "three"
        ]
    },
}
</code>```

How can I update all documents in this collection so that all addresses in info.addresses array with value one would be changed to have value four?

Examples in mongo db documentation solve such cases when arrays are not inside objects, but I can't make them work with arrays inside objects

Example - this query should update all info.addresses arrays for all documents and change the entry values from one to four

```<code>db.getCollection('test').update({"info.addresses": "one"},{ $set: { "info.addresses.$" : "four" } })
</code>```

答:
replace update to updateMany
for update all info.addresses arrays.

db.getCollection('text').updateMany(
    {'info.addresses':'one'},
    {$set:{'info.addresses.$':'two'}}
  )

Body:
I can't write a query that would update a value of an array that is inside of an object:

Let's say I have a collection that has document entries with the structure like below (There are 2 entries in the example but actually there are a few thousand that I need to update in my db)

/* 1 */
{
    "name" : "Bob",
    "info" : {
        "species" : "human",
        "addresses" : [
            "one",
            "two"
        ]
    }
},
/* 2 */
{
    "name" : "John",
    "info" : {
        "species" : "human",
        "addresses" : [
            "two",
            "three"
        ]
    },
}

How can I update all documents in this collection so that all addresses in info.addresses array with value one would be changed to have value four?

Examples in mongo db documentation solve such cases when arrays are not inside objects, but I can't make them work with arrays inside objects

Example - this query should update all info.addresses arrays for all documents and change the entry values from one to four

db.getCollection('test').update({"info.addresses": "one"},{ $set: { "info.addresses.$" : "four" } })


问:
How to pass variable to later in program / Inputting double to dialog box
I'm trying to create a dialog box at the start of my program that allows the user to input a number that is then used in another function (actually in another C file) much later on in the program.

```<code>void function()
{
double variable;
char buf[256] = "400";
sprintf( buf, "%d", variable);
#ifdef WIN32
edit_dialog(NULL,"Enter variable", "Please enter the variable:", buf,260);
#endif
variable = atof(buf);
}
</code>```

I'd like to pass 'variable' into another function later on in the program. The problem is, I don't need the variable until much later. I don't want to pass it between each and every function until it gets to the right part of the program. How do I do this?

Also when I launch this, I get the dialog box as I'd expect but the number in the box is not 400, as I would expect. Instead it is 2089881670(!) I assume I am handling memory incorrectly but don't understand why.

答: I think sprintf needs &variable as third variable. Try using sprintf( buf, "%lf", &variable);

Body:
I'm trying to create a dialog box at the start of my program that allows the user to input a number that is then used in another function (actually in another C file) much later on in the program.

void function()
{
double variable;
char buf[256] = "400";
sprintf( buf, "%d", variable);
#ifdef WIN32
edit_dialog(NULL,"Enter variable", "Please enter the variable:", buf,260);
#endif
variable = atof(buf);
}

I'd like to pass 'variable' into another function later on in the program. The problem is, I don't need the variable until much later. I don't want to pass it between each and every function until it gets to the right part of the program. How do I do this?

Also when I launch this, I get the dialog box as I'd expect but the number in the box is not 400, as I would expect. Instead it is 2089881670(!) I assume I am handling memory incorrectly but don't understand why.


问:
SQL Anywhere FOR JSON EXPLICIT how to make an encapsulated array
I have this simple query in SQL Anywhere 17, one column two rows:

```<code>SELECT
    1       AS tag,
    null    AS parent,
    row_num AS [enc_obj!1!row_num]
FROM
    sa_rowgenerator(1, 2)
ORDER BY
    3
FOR JSON EXPLICIT;
</code>```

I get this as a result, an array of separate arrays for every row:

```<code>[
    {
        "enc_obj": [
            {
                "row_num": 1
            }
        ]
    },
    {
        "enc_obj": [
            {
                "row_num": 2
            }
        ]
    }
]
</code>```

How do I modify the query to get single array with all rows in it, like this:

```<code>{
    "enc_obj": [
        {
            "row_num": 1
        },
        {
            "row_num": 2
        }
    ]
}
</code>```

Any ideas?

答:
You can simply omit the enc_obj criterium from the json directive:

SELECT
    1       AS tag,
    null    AS parent,
    row_num AS [!1!row_num]    -- NOTE: "enc_obj" is dropped!
FROM
    sa_rowgenerator(1, 2)
ORDER BY
    3
FOR JSON EXPLICIT;
```

<p>As result you'll get an anonymous JSON array <strong>without</strong> an encapsulating object:</p>

```[
  {
    "row_num": 1
  },
  {
    "row_num": 2
  }
]
```

Can you work with that?

Body:
I have this simple query in SQL Anywhere 17, one column two rows:

SELECT
    1       AS tag,
    null    AS parent,
    row_num AS [enc_obj!1!row_num]
FROM
    sa_rowgenerator(1, 2)
ORDER BY
    3
FOR JSON EXPLICIT;

I get this as a result, an array of separate arrays for every row:

[
    {
        "enc_obj": [
            {
                "row_num": 1
            }
        ]
    },
    {
        "enc_obj": [
            {
                "row_num": 2
            }
        ]
    }
]

How do I modify the query to get single array with all rows in it, like this:

{
    "enc_obj": [
        {
            "row_num": 1
        },
        {
            "row_num": 2
        }
    ]
}

Any ideas?

Body:
You can simply omit the enc_obj criterium from the json directive:

SELECT
    1       AS tag,
    null    AS parent,
    row_num AS [!1!row_num]    -- NOTE: "enc_obj" is dropped!
FROM
    sa_rowgenerator(1, 2)
ORDER BY
    3
FOR JSON EXPLICIT;

As result you'll get an anonymous JSON array without an encapsulating object:

[
  {
    "row_num": 1
  },
  {
    "row_num": 2
  }
]

Can you work with that?


问:
Template friendly string to numeric in C++
In C++ standard library there are functions to convert from string to numeric types:

```<code>stoi
stol
stoll
stoul
stoull
stof
stod
stold
</code>```

but I find it tedious to use them in template code. Why there are no template functions something like:

```<code>template<typename T>
T sto(...)
</code>```

to convert strings to numeric types?

I don't see any technical reason to not have them, but maybe I'm missing something. They can be specialised to call the underlying named functions and use enable_if/concepts to disable non numeric types.

Are there any template friendly alternatives in the standard library to convert string to numeric types and the other way around in an efficient way?

答:
On older C++ versions, stringstream is your friend. If I understand correctly, then the following might be interesting to you. It is C++11.

https://wandbox.org/permlink/nUNiUwWWTr7a0NXM

```<code>#include <sstream>
#include <string>
#include <iostream>

template<typename T, typename String>
T sto(const String & str) {
    T val;
    std::stringstream ss(str);
    ss >> val;
    return val;
}

template<typename T, typename String>
void sto(const String & str, T & val) {
    std::stringstream ss(str);
    ss >> val;
}

int main() {
    std::cout << sto<float>("1.1") << ", " << sto<int>(std::string{"2"});

    // An alternative version that infers the type
    double d;
    sto("3.3", d);
    std::cout << ", " << d;
}
</code>```

This method works in C++11 and is pretty general. In my experience, this method is robust, but not the most performant.

Body:
In C++ standard library there are functions to convert from string to numeric types:

stoi
stol
stoll
stoul
stoull
stof
stod
stold

but I find it tedious to use them in template code. Why there are no template functions something like:

template<typename T>
T sto(...)

to convert strings to numeric types?

I don't see any technical reason to not have them, but maybe I'm missing something. They can be specialised to call the underlying named functions and use enable_if/concepts to disable non numeric types.

Are there any template friendly alternatives in the standard library to convert string to numeric types and the other way around in an efficient way?

Body:
On older C++ versions, stringstream is your friend. If I understand correctly, then the following might be interesting to you. It is C++11.

https://wandbox.org/permlink/nUNiUwWWTr7a0NXM

#include <sstream>
#include <string>
#include <iostream>

template<typename T, typename String>
T sto(const String & str) {
    T val;
    std::stringstream ss(str);
    ss >> val;
    return val;
}

template<typename T, typename String>
void sto(const String & str, T & val) {
    std::stringstream ss(str);
    ss >> val;
}

int main() {
    std::cout << sto<float>("1.1") << ", " << sto<int>(std::string{"2"});

    // An alternative version that infers the type
    double d;
    sto("3.3", d);
    std::cout << ", " << d;
}

This method works in C++11 and is pretty general. In my experience, this method is robust, but not the most performant.


问:
IAP tunnel to VM
I’ve a question regarding Compute VM and its associated privileges. I have ‘Owner’ privileges at Project level. I created a VM but was not able to assign an external IP address to it. Upon referring to google cloud docs, it appears that I’ll still be able to connect to this VM using VPN or IAP. Upon clicking the SSH link next to the VM, I see that it uses a Cloud-IAP tunnel but the connection fails.

Here is the error message
External IP address was not found; defaulting to using IAP tunneling.

```<code>ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4003: u'failed to connect to backend'].
ssh_exchange_identification: Connection closed by remote host
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
</code>```

How do I go about connecting to this VM?

Appreciate your help with this

答:
It seems that the GCP CE requires to initialize SSH and other services after its RUNNING status.
I used a workaround by adding a sleep (60 sec) command, after starting the VM and before SSH using the IAP tunnel.</p>

Title: IAP tunnel to VM

Body:
I’ve a question regarding Compute VM and its associated privileges. I have ‘Owner’ privileges at Project level. I created a VM but was not able to assign an external IP address to it. Upon referring to google cloud docs, it appears that I’ll still be able to connect to this VM using VPN or IAP. Upon clicking the SSH link next to the VM, I see that it uses a Cloud-IAP tunnel but the connection fails.

Here is the error message
External IP address was not found; defaulting to using IAP tunneling.

ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4003: u'failed to connect to backend'].
ssh_exchange_identification: Connection closed by remote host
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].

How do I go about connecting to this VM?

Appreciate your help with this


问:
Connect Power BI to Greenplum error "unrecognized configuration parameter ssl_renegotiation_limit"
I've encountered "unrecognized configuration parameter ssl_renegotiation_limit" when im trying to connect Power BI to Greenplum DB (PostgreSQL 8.2.15 and this GP DB using SSL) and I've already add my GP DB SSL certificate to my machine.

in the online documentation suggest to set ssl_renegotiation_limit parameter in postgresql.conf to '0' to avoid this kind of error, but the problem is I can't find any ssl_renegotiation_limit parameter in my postgresql.conf file.

is there any other way to setup the ssl_renegotiation_limit parameter in GP DB or there's another way to avoid the error above?

答:
This Power BI thing seems to be vintage software. ssl_renegotiation_limit has been removed from PostgreSQL years ago. Greenplum, on the other hand, maybe never had the parameter at all, because it is such an old fork.

You should use a version of Power BI that has got hip to the fact that there is no such parameter in PostgreSQL. If there is no such version, report it as a bug.


问:
how to scan line in c program not from file
How to scan total line from user input with c program?

I tried scanf("%99[^\n]",st), but it is not working when I scan something before this scan statment.It worked if this is the first scan statement.

答:
```<code>char str[1024];
char *alline = fgets(str, 1024, stdin);
scanf("%[^'\n']s",alline);
</code>```

I think the correct solution should be like this. It is worked for me.
Hope it helps.

Body:
char str[1024];
char *alline = fgets(str, 1024, stdin);
scanf("%[^'\n']s",alline);

I think the correct solution should be like this. It is worked for me.
Hope it helps.


问:
How to test a Try[T] in ScalaTest correctly?
I've checked the answers specified in the post
How to test a Try[T] with ScalaTest correctly?

But if I had to do any assertions after the function call or if I have to check the assertions within a for { } yield { } block then I'm following the below given approach:

```<code>  def test(a: Int, b: Int): Try[Int] = Try {
    a / b
  }

  it.should("succeed").in {
    (for {
      res <- test(0, 1)
    } yield {
      assert(res === 0)
      // assume more assertions are to be made
    }) match {
      case Success(value)     => value
      case Failure(exception) => fail(exception)
    }
  }

  it.should("fail").in {
    test(1, 0).failure.exception.getClass.mustBe(classOf[java.lang.ArithmeticException])
  }
</code>```

The problem with above approach is that, for the success case if any issue happens in the unit test logic then it'll show the error pointing to the line case Failure(exception) => fail(exception) and not on the line where the actual error occurred. If the test case is huge then it'll be difficult for the user to find where exactly the error occurred.

So is there a better way to unit test the functions which returns a Try[T] without moving the assertions outside the for { } yield { } block?

答:
The TryValues trait (documented here) is designed to help with this:

```<code>class MyTestSpec extends FlatSpec with Matchers with TryValues {
  "tryTest" should "succeed" in {
    // Normal tests
    test(0, 1).isSuccess shouldBe true
    test(1, 1).isFailure shouldBe true

    // Use TryValues conversions
    test(0, 1).success.value shouldBe 0
    test(1, 1).failure.exception should have message "should be zero"
  }
}
</code>```

Body:
I've checked the answers specified in the post
How to test a Try[T] with ScalaTest correctly?

But if I had to do any assertions after the function call or if I have to check the assertions within a for { } yield { } block then I'm following the below given approach:

  def test(a: Int, b: Int): Try[Int] = Try {
    a / b
  }

  it.should("succeed").in {
    (for {
      res <- test(0, 1)
    } yield {
      assert(res === 0)
      // assume more assertions are to be made
    }) match {
      case Success(value)     => value
      case Failure(exception) => fail(exception)
    }
  }

  it.should("fail").in {
    test(1, 0).failure.exception.getClass.mustBe(classOf[java.lang.ArithmeticException])
  }

The problem with above approach is that, for the success case if any issue happens in the unit test logic then it'll show the error pointing to the line case Failure(exception) => fail(exception) and not on the line where the actual error occurred. If the test case is huge then it'll be difficult for the user to find where exactly the error occurred.

So is there a better way to unit test the functions which returns a Try[T] without moving the assertions outside the for { } yield { } block?

Body:
The TryValues trait (documented here) is designed to help with this:

class MyTestSpec extends FlatSpec with Matchers with TryValues {
  "tryTest" should "succeed" in {
    // Normal tests
    test(0, 1).isSuccess shouldBe true
    test(1, 1).isFailure shouldBe true

    // Use TryValues conversions
    test(0, 1).success.value shouldBe 0
    test(1, 1).failure.exception should have message "should be zero"
  }
}


问:
Publish Test Results tasks in Azure DevOps using NUnit
I'm trying to add a 'Publish Test Results' task into my Azure DevOps release pipeline, however, it looks like when I try to publish the .trx file, it's not looking in the correct folder and tries to parse an invalid file format (I'm assuming this is because it can't find the TestResults folder). I can see my file being created here in the Visual Studio Test task logs:

2020-02-19T21:28:57.6557476Z Vstest.console.exe exited with code 0.

2020-02-19T21:28:57.6557819Z:Completed test execution

2020-02-19T21:28:57.6640479Z Test results files: C:\agents\vm1-1_work_temp\TestResults\vm1$_vm1_2020-02-19_21_28_31.trx

However, in my Publish Test Results task logs, I get this error:

2020-02-19T21:28:59.7249456Z [command]C:\agents\vm1-1_work_tasks\PublishTestResults_0b0f01ed-7dde-43ff-9cbb-e48954daf9b1\2.164.3\modules\TestResultsPublisher.exe @C:\agents\vm1-1_work_temp\d793cb80-535e-11ea-9ab4-8f1d738f183d.txt

2020-02-19T21:29:00.5600855Z ##[warning]Failed to parse result files:  Invalid file format.

This is what my Test Run and Publish Test Results tasks look like....can anyone point out what I am doing wrong here? I've seen people say that I don't need to add this task, but I am unable to see the Test Results tab in the pipeline, I can only see the .trx file attached to the task (see below).

答: TestResultsFormat is an alias for the testRunner input name. It seems you are using VSTest testRunner, so in Publish Test Results task, you should choose VSTest in TestResultsFormat.


问:
Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral on IIS
I started updating some nuget packages and started getting these warnings on build with a conflict for System.Net.Http. As suggested here:

Strange issue with System.Net.Http 4.2.0.0 not found

I replaced all references to System.Net.Http to use the nuget version, instead of the one bundled with Visual Studio. I then changed all redirect bindings (app.configs and web.configs) as suggested everywhere and I got things working locally. But..

When I deploy to our test server I still get the error

```<code>Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
</code>```

I´m using net 4.7.0 and Visual Studio 2017

I searched all my configs for a ref to Version 4.2.0.0 but no hits. Why does the IIS think it needs this one?

My nuget version of the System.Net.Http is 4.3.4 but the actual web.config has these lines

```<code><dependentAssembly>
   <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
   <bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3"/>
</dependentAssembly>
</code>```

Again I can build and run it locally but my server reports the error.

UPDATE: I tried adding this on my servers web.config

```<code> <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.1.1.3" />
  </dependentAssembly>
</code>```

That makes the error go away! But I still dont get why i need to do this? Like why do my server think it needs to use 4.2.0?

答:
```<code><bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</code>```

If you can not installed .net 4.7 so remove this line in web.onfig

Body:
I started updating some nuget packages and started getting these warnings on build with a conflict for System.Net.Http. As suggested here:

Strange issue with System.Net.Http 4.2.0.0 not found

I replaced all references to System.Net.Http to use the nuget version, instead of the one bundled with Visual Studio. I then changed all redirect bindings (app.configs and web.configs) as suggested everywhere and I got things working locally. But..

When I deploy to our test server I still get the error

Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I´m using net 4.7.0 and Visual Studio 2017

I searched all my configs for a ref to Version 4.2.0.0 but no hits. Why does the IIS think it needs this one?

My nuget version of the System.Net.Http is 4.3.4 but the actual web.config has these lines

<dependentAssembly>
   <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
   <bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3"/>
</dependentAssembly>

Again I can build and run it locally but my server reports the error.

UPDATE: I tried adding this on my servers web.config

 <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.1.1.3" />
  </dependentAssembly>

That makes the error go away! But I still dont get why i need to do this? Like why do my server think it needs to use 4.2.0?

Body:
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />

If you can not installed .net 4.7 so remove this line in web.onfig


问:
how can I format this string as the question asks?
I am stumped on a homework problem. I don't need to describe it because its all explained in the image. But I have no clue where to start I'm new to Python and I'm on a time limit so this is my only option, thanks guys.

答:
Code:

```<code>text=input()
line=text.split(',')
for i in line:
    print(' | '.join(i.split(' ')))
</code>```

Summary code:

```<code>for i in input().split(','):
    print(' | '.join(i.split(' ')))
</code>```

Output:

```<code>1 | 2 | 3
2 | 4 | 6
3 | 6 | 9
</code>```

Body:
Code:

text=input()
line=text.split(',')
for i in line:
    print(' | '.join(i.split(' ')))

Summary code:

for i in input().split(','):
    print(' | '.join(i.split(' ')))

Output:

1 | 2 | 3
2 | 4 | 6
3 | 6 | 9


问:
How to create a custom Python exception type in C extension?
I'm writing a Python module in C. I need to report errors that can't be described by built-in Python exceptions. I therefore wish to throw exceptions of my own type. The problem is, that Python policy is to derive all exceptions from BaseException class. I know how to create a derived type object (assigning to tp_base memeber), but I don't know how to obtain a reference to BaseException type object. PyExc_BaseException is a reference to PyObject, representing a class, not a type object.

How do I throw custom Python exceptions from C code?

答:
I managed to set tp_base by using (PyTypeObject*)PyExc_BaseException as the value, which results in my custom exception being properly inherited from BaseException.

There are some good hints in the CPython source code in exceptions.c.


问:
JPA 2.2: which one is its API artifact to add in project?
JPA 2.2 added new feature supporting java8 stream:

```<code> Stream Query.getResultStream();
 Stream<X> TypedQuery.getResultStream();
</code>```

Tried both artifacts:

```<code>compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.2.0'
compile group: 'javax.persistence', name: 'javax.persistence-api', version: '2.2'
</code>```

But they do not the new stream method.

What is the right JPA 2.2 API artifact to add?

API dependency only, not provider impl.

答:
From functionality point-of-view it does not matter which one is used, because both artifacts do contain these two method with exactly same (default) implementations (as expected, because so it is said in specification).

Query:

```<code>default Stream getResultStream() {
        return this.getResultList().stream();
}
</code>```

TypedQuery:

```<code>default Stream<X> getResultStream() {
        return this.getResultList().stream();
}
</code>```

If these method are not available, reason is most likely some older JPA API on classpath before.

Body:
JPA 2.2 added new feature supporting java8 stream:

 Stream Query.getResultStream();
 Stream<X> TypedQuery.getResultStream();

Tried both artifacts:

compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.2.0'
compile group: 'javax.persistence', name: 'javax.persistence-api', version: '2.2'

But they do not the new stream method.

What is the right JPA 2.2 API artifact to add?

API dependency only, not provider impl.

Body:
From functionality point-of-view it does not matter which one is used, because both artifacts do contain these two method with exactly same (default) implementations (as expected, because so it is said in specification).

Query:

default Stream getResultStream() {
        return this.getResultList().stream();
}

TypedQuery:

default Stream<X> getResultStream() {
        return this.getResultList().stream();
}

If these method are not available, reason is most likely some older JPA API on classpath before.


问:
Delete node.js events, listeners goes away too?
If I delete a node.js event, the listeners go away too right? I don't have to delete anything else?</p>

答:
You mean deleting an EventEmitter instance? (or, equally, an Object that inherits from EventEmitter?)

In this case I think that each listener would be deleted as well when you delete the object instance, they're part of the object instance


问:
Typescript array.map doesn't distribute intersection types properly
I have an array of type object[] & Tree[] but arr.map(child => ...) infers the type of the child as object rather than object & Tree.

Is there any way to avoid this without extra casting?

Notably Tree extends object but typescript doesn't seem to realise this and merge the two parts of the intersection type.

EDIT - Minimal reproducible example:

This is contrived, but based off my other recent question Transform a typescript object type to a mapped type that references itself

```<code>interface BasicInterface {
    name: string;
    children: object[];
}

function getBasic<T extends object>(input: T): BasicInterface {
    return input as BasicInterface;
}

export const basicTree = getBasic({
    name: 'parent',
    children: [{
        name: 'child',
        children: []
    }]
});
</code>```

The point is the code below has access to "basicTree" and its inferred type. For this example I have defined
BasicInterface, but in practice this is generated automatically and I haven't found a way to programatically
generate a recursive interface.

I would like to add the recursive type of children back as the original interface defines.

Rather than completely redefine BasicInterface in the code as this could be a lot of boilerplate, I am trying
to "enhance" the definition of the basicTree's type with the correct recursive definition.

But this falls down when getting the children's type. Perhaps there is a simpler solution?

```<code>type RestoredInterface = typeof basicTree & {
    children: RestoredInterface[]
};

function getTree(basic: BasicInterface): RestoredInterface {
    return basic as RestoredInterface;
}

const restoredTree = getTree(basicTree);

const names = restoredTree.children.map(child => child.name);
</code>```

答:
Based off an observation from jcalz, it is actually possible to simply extend the original interface. I was confused because it is programatically defined, but that's not a problem if you name it first:</p>

```<code>type BasicTreeInterface = typeof basicTree;

interface RestoredInterface extends BasicTreeInterface {
    children: RestoredInterface[]
};

const restoredTree = getTree(basicTree);

const names = restoredTree.children.map(child => {
    // Child is of type RestoredInterface
});
</code>```

Body:
I have an array of type object[] & Tree[] but arr.map(child => ...) infers the type of the child as object rather than object & Tree.

Is there any way to avoid this without extra casting?

Notably Tree extends object but typescript doesn't seem to realise this and merge the two parts of the intersection type.

EDIT - Minimal reproducible example:

This is contrived, but based off my other recent question Transform a typescript object type to a mapped type that references itself

interface BasicInterface {
    name: string;
    children: object[];
}

function getBasic<T extends object>(input: T): BasicInterface {
    return input as BasicInterface;
}

export const basicTree = getBasic({
    name: 'parent',
    children: [{
        name: 'child',
        children: []
    }]
});

The point is the code below has access to "basicTree" and its inferred type. For this example I have defined
BasicInterface, but in practice this is generated automatically and I haven't found a way to programatically
generate a recursive interface.

I would like to add the recursive type of children back as the original interface defines.

Rather than completely redefine BasicInterface in the code as this could be a lot of boilerplate, I am trying
to "enhance" the definition of the basicTree's type with the correct recursive definition.

But this falls down when getting the children's type. Perhaps there is a simpler solution?

type RestoredInterface = typeof basicTree & {
    children: RestoredInterface[]
};

function getTree(basic: BasicInterface): RestoredInterface {
    return basic as RestoredInterface;
}

const restoredTree = getTree(basicTree);

const names = restoredTree.children.map(child => child.name);

Body:
Based off an observation from jcalz, it is actually possible to simply extend the original interface. I was confused because it is programatically defined, but that's not a problem if you name it first:

type BasicTreeInterface = typeof basicTree;

interface RestoredInterface extends BasicTreeInterface {
    children: RestoredInterface[]
};

const restoredTree = getTree(basicTree);

const names = restoredTree.children.map(child => {
    // Child is of type RestoredInterface
});


问:
minifyEnabled true and shrinkResources true in release build retrofit api's are not working
This is my proguard file:

```<code>-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-printmapping mapping.txt

-keepattributes Signature, InnerClasses, EnclosingMethod

-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-dontwarn javax.annotation.**

-dontwarn kotlin.Unit

-dontwarn retrofit2.KotlinExtensions

-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

-dontwarn org.codehaus.mojo.animal_sniffer.*

-dontwarn okhttp3.internal.platform.ConscryptPlatform

-keepattributes Signature

-keepattributes Annotation

-dontwarn sun.misc.**

-keep class com.google.gson.examples.android.model.** { <fields>; }

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
</code>```

This is the log i am getting after running the release app:

```<code> <-- 200 https://api.gobaskt.com/dev-basket/gobaskt/basket (24002ms)
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-type: application/json
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-length: 6769
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: date: Thu, 20 Feb 2020 07:09:57 GMT
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-requestid: 2f52af84-0138-45ab-b403-75e2583e4f90
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-apigw-id: ILyLSGD3CYcFlMg=
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-trace-id: Root=1-5e4e30ae-7893b2e8430ff7b0f0793ae8;Sampled=0
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-cache: Miss from cloudfront
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: via: 1.1 66f5b63f0d6bfa07c6e6afd2b0f672b2.cloudfront.net (CloudFront)
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-pop: BLR50-C1
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-id: 7o44Q_yEkwYDRH0m-aqsmi6V3hPi1R7R8KOQ0mSd5PnpTkDw5j-BvA==
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: {"success":true,"message":"found","statusCode":200,"responseData":[{"id":"b3d06745-f030-40af-9704-3d7d51fe0458","basket_userId":null,"offers":{"offerId":"a0936455-f99a-4693-918e-c49356512d21","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 16:42:04.634","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"9c4eb971-03d3-491d-ab89-cf18c44f6bb3","basket_userId":null,"offers":{"offerId":"bd15effb-36ad-4449-9278-3c37942f7828","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 09:12:24.381","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"$ off","lmofferValue":"10","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"8ebe77cf-bb2d-468d-bb2f-10d76921c06a","basket_userId":null,"offers":{"offerId":"878b1c26-e721-4b51-8dcf-6887493629c5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 05:51:40.891","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"No valid on non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"f762e94a-1652-4d86-a79b-4206e837ad29","basket_userId":null,"offers":{"offerId":"4b2e20d1-7ceb-45d8-bbc7-773d21601370","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 08:24:22.048","redeem_timeStamp":null,"lmname":"Jersey Mike's","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Subs Restaurant","lmid":"LM0001","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Valid on hot subs only","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/1602.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/4.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/jersey_mikes_1_copy_4.png","upccode":null}},{"id":"c7300b66-a9e4-44cb-a6f8-4c1af104fb11","basket_userId":null,"offers":{"offerId":"8
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: f40d7ca-2db7-45bb-a26f-fdcde43abb65","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-17 04:33:05.802","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"5f97c5a3-043a-4b42-bd21-9747ecbdb4af","basket_userId":null,"offers":{"offerId":"6c0dfbb8-b4bc-4db3-98e1-083ea4353bc5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-18 05:38:57.512","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}},{"id":"d4f332d4-b4d9-476d-9d92-b8bfb1a3ae2c","basket_userId":null,"offers":{"offerId":"60deb825-fda9-4087-a2c5-59e95782b6f1","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-11 02:39:22.185","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}}]}
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: <-- END HTTP (6769-byte body)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:39:57.731 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Logging NetworkRequestMetric - https://api.gobaskt.com/dev-basket/gobaskt/basket 6769b 24010ms,
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.734 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving network request sampling rate configuration value.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '1.0' for key: 'fpr_vc_network_request_sampling_rate' from Firebase Remote Config.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.l' is: '1.0'.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-02-20 12:39:57.735 10758-12244/com.gobaskt E/a$a: java.lang.ClassCastException: f.j.c.z.h cannot be cast to f.i.d.b.c.c.a
        at f.i.d.c.i.b.b(SourceFile:26)
        at f.i.d.c.i.b$b.b(Unknown Source:11)
        at l.z.i.a.a.a(SourceFile:33)
        at m.a.s0.run(SourceFile:241)
        at m.a.l2.a.a(SourceFile:594)
        at m.a.l2.a.a(SourceFile:60)
        at m.a.l2.a$b.run(SourceFile:740)
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.760 10758-10758/com.gobaskt V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed
2020-02-20 12:42:00.386 10758-12318/com.gobaskt V/FA: Recording user engagement, ms: 147302
2020-02-20 12:42:00.388 10758-12318/com.gobaskt V/FA: Connecting to remote service
2020-02-20 12:42:00.425 10758-10758/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:42:00.427 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.i' is: 'false'.
2020-02-20 12:42:00.428 10758-10758/com.gobaskt D/FirebasePerformance: CollectionEnabled metadata key unknown or value not found in manifest.
</code>```

Below is the build type :

```<code>release {
        manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        minifyEnabled true   // Obfuscate and minify codes
        shrinkResources true // Remove unused resources
        useProguard true     // Remove unused codes
        debuggable true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-rules.pro'
    }
</code>```

I have also added a screen shot of message that i am getting on api call.
Everything is working fine is debug build. I am facing issue in release build only.
I have already used serializedName for my model.
Tried so many answer from stackoverflow from last two days.
If anyone have any idea please let me know.

答: Look into your mapping file what f.i.d.b.c.c.a refers to, if it refers to Model/Pojo then you have to handle proguard rules for GSON or you can add @Keep on top of model class as well.

Body:
This is my proguard file:

-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-printmapping mapping.txt

-keepattributes Signature, InnerClasses, EnclosingMethod

-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}

-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-dontwarn javax.annotation.**

-dontwarn kotlin.Unit

-dontwarn retrofit2.KotlinExtensions

-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

-dontwarn org.codehaus.mojo.animal_sniffer.*

-dontwarn okhttp3.internal.platform.ConscryptPlatform

-keepattributes Signature

-keepattributes Annotation

-dontwarn sun.misc.**

-keep class com.google.gson.examples.android.model.** { <fields>; }

-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;

This is the log i am getting after running the release app:

 <-- 200 https://api.gobaskt.com/dev-basket/gobaskt/basket (24002ms)
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-type: application/json
2020-02-20 12:39:57.729 10758-12256/com.gobaskt D/OkHttp: content-length: 6769
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: date: Thu, 20 Feb 2020 07:09:57 GMT
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-requestid: 2f52af84-0138-45ab-b403-75e2583e4f90
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-apigw-id: ILyLSGD3CYcFlMg=
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amzn-trace-id: Root=1-5e4e30ae-7893b2e8430ff7b0f0793ae8;Sampled=0
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-cache: Miss from cloudfront
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: via: 1.1 66f5b63f0d6bfa07c6e6afd2b0f672b2.cloudfront.net (CloudFront)
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-pop: BLR50-C1
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: x-amz-cf-id: 7o44Q_yEkwYDRH0m-aqsmi6V3hPi1R7R8KOQ0mSd5PnpTkDw5j-BvA==
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: {"success":true,"message":"found","statusCode":200,"responseData":[{"id":"b3d06745-f030-40af-9704-3d7d51fe0458","basket_userId":null,"offers":{"offerId":"a0936455-f99a-4693-918e-c49356512d21","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 16:42:04.634","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"9c4eb971-03d3-491d-ab89-cf18c44f6bb3","basket_userId":null,"offers":{"offerId":"bd15effb-36ad-4449-9278-3c37942f7828","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 09:12:24.381","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"$ off","lmofferValue":"10","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"8ebe77cf-bb2d-468d-bb2f-10d76921c06a","basket_userId":null,"offers":{"offerId":"878b1c26-e721-4b51-8dcf-6887493629c5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-10 05:51:40.891","redeem_timeStamp":null,"lmname":"Amelia's Pizzeria & Restaurant","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Pizza Restautant","lmid":"LM0002","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"No valid on non pizza items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/PKs_bar_grill+(1).png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/5.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/pk_s_logo_01.png","upccode":null}},{"id":"f762e94a-1652-4d86-a79b-4206e837ad29","basket_userId":null,"offers":{"offerId":"4b2e20d1-7ceb-45d8-bbc7-773d21601370","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-05 08:24:22.048","redeem_timeStamp":null,"lmname":"Jersey Mike's","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Subs Restaurant","lmid":"LM0001","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Valid on hot subs only","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/1602.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/4.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/jersey_mikes_1_copy_4.png","upccode":null}},{"id":"c7300b66-a9e4-44cb-a6f8-4c1af104fb11","basket_userId":null,"offers":{"offerId":"8
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: f40d7ca-2db7-45bb-a26f-fdcde43abb65","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-17 04:33:05.802","redeem_timeStamp":null,"lmname":"PK's bar & grill","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Bar & Grill Restaurant","lmid":"LM0003","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"20","offerCurrency":"USD","offerExpiryDate":"12/31/2019","offerExpiryTime":"9 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/1/2019","offerStartTime":"11 am EST","offerTermsandConditions":"Excludes non dip items","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/Jursey_mikes_image.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/2.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/logo_petco_copy.png","upccode":null}},{"id":"5f97c5a3-043a-4b42-bd21-9747ecbdb4af","basket_userId":null,"offers":{"offerId":"6c0dfbb8-b4bc-4db3-98e1-083ea4353bc5","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-18 05:38:57.512","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}},{"id":"d4f332d4-b4d9-476d-9d92-b8bfb1a3ae2c","basket_userId":null,"offers":{"offerId":"60deb825-fda9-4087-a2c5-59e95782b6f1","productName":null,"offerStatus":"saved","save_timeStamp":"2020-02-11 02:39:22.185","redeem_timeStamp":null,"lmname":"Real life dental","lmlocation":null,"applicableProducts":null,"eancode":null,"lmdescription":"Dentist","lmid":"LM0005","lmofferSubType":null,"lmofferTitle":null,"lmofferType":"% off","lmofferValue":"15","offerCurrency":"USD","offerExpiryDate":"1/1/2020","offerExpiryTime":"10 pm EST","offerRegion":"Montgomerry VA","offerStartDate":"12/2/2019","offerStartTime":"12 am EST","offerTermsandConditions":"Applicable only once per customer","webOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/webImages/354.png","webOfferImage2":"string","mobileOfferImage1":"https://d1141hp6d00bvx.cloudfront.net/1.png","mobileOfferImage2":"https://d1141hp6d00bvx.cloudfront.net/1200_px_rite_aid_svg.png","upccode":null}}]}
2020-02-20 12:39:57.730 10758-12256/com.gobaskt D/OkHttp: <-- END HTTP (6769-byte body)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.731 10758-12256/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:39:57.731 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:39:57.732 10758-12256/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.732 10758-12264/com.gobaskt D/FirebasePerformance: Logging NetworkRequestMetric - https://api.gobaskt.com/dev-basket/gobaskt/basket 6769b 24010ms,
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving master flag for Firebase Performance SDK enabled configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: 'true' for key: 'fpr_enabled' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.q' is: 'true'.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving Firebase Performance SDK disabled versions configuration value.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '' for key: 'fpr_disabled_android_versions' from Firebase Remote Config.
2020-02-20 12:39:57.733 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.n' is: ''. Resolving value as 'false'
2020-02-20 12:39:57.734 10758-12264/com.gobaskt D/FirebasePerformance: Retrieving network request sampling rate configuration value.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Fetched value: '1.0' for key: 'fpr_vc_network_request_sampling_rate' from Firebase Remote Config.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.l' is: '1.0'.
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-02-20 12:39:57.735 10758-12244/com.gobaskt E/a$a: java.lang.ClassCastException: f.j.c.z.h cannot be cast to f.i.d.b.c.c.a
        at f.i.d.c.i.b.b(SourceFile:26)
        at f.i.d.c.i.b$b.b(Unknown Source:11)
        at l.z.i.a.a.a(SourceFile:33)
        at m.a.s0.run(SourceFile:241)
        at m.a.l2.a.a(SourceFile:594)
        at m.a.l2.a.a(SourceFile:60)
        at m.a.l2.a$b.run(SourceFile:740)
2020-02-20 12:39:57.735 10758-12264/com.gobaskt W/com.gobaskt: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-02-20 12:39:57.760 10758-10758/com.gobaskt V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed
2020-02-20 12:42:00.386 10758-12318/com.gobaskt V/FA: Recording user engagement, ms: 147302
2020-02-20 12:42:00.388 10758-12318/com.gobaskt V/FA: Connecting to remote service
2020-02-20 12:42:00.425 10758-10758/com.gobaskt D/FirebasePerformance: Retrieving Max Duration (in minutes) of single Session configuration value.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt W/FirebaseRemoteConfig: No value of type 'FirebaseRemoteConfigValue' exists for parameter key 'fpr_session_max_duration_min'.
2020-02-20 12:42:00.426 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.r' is: '240'.
2020-02-20 12:42:00.427 10758-10758/com.gobaskt D/FirebasePerformance: Config resolver result for flag: 'f.j.a.b.i.g.i' is: 'false'.
2020-02-20 12:42:00.428 10758-10758/com.gobaskt D/FirebasePerformance: CollectionEnabled metadata key unknown or value not found in manifest.

Below is the build type :

release {
        manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
        minifyEnabled true   // Obfuscate and minify codes
        shrinkResources true // Remove unused resources
        useProguard true     // Remove unused codes
        debuggable true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '../proguard-rules.pro'
    }

I have also added a screen shot of message that i am getting on api call.
Everything is working fine is debug build. I am facing issue in release build only.
I have already used serializedName for my model.
Tried so many answer from stackoverflow from last two days.
If anyone have any idea please let me know.


问:
i have 3 text boxes for Day , Month and Year .From this need to calculate a date
I have 3 textboxes for Day, Month and Year. From this need to calculate a date. And need subtraction functionality also ( Calculation on Current date)

Eg: Current date = 20-02-2020 , Day -1 and Month - 1 and Year = 1 then the result = 21-03-2021

答:
Using AddDays and AddMonths.

```<code>DateTime now = DateTime.Now;
DateTime yesterday = now.AddDays( -1 );
DateTime aMonthBefore = now.AddMonths( -1 );
</code>```

According to msdn, AddMonths will handle leap year.
If you just want to subtract 30 days, use subtract.

```<code>DateTime thirtyDaysBefore = now.Subtract( new TimeSpan( 30, 0, 0 ) );
</code>```

Body:
Using AddDays and AddMonths.

DateTime now = DateTime.Now;
DateTime yesterday = now.AddDays( -1 );
DateTime aMonthBefore = now.AddMonths( -1 );

According to msdn, AddMonths will handle leap year.
If you just want to subtract 30 days, use subtract.

DateTime thirtyDaysBefore = now.Subtract( new TimeSpan( 30, 0, 0 ) );


问:
Unable to use .find() to get value from table/form
Trying to wrap my head around this for a while now. Some guru needs to help me out, it would be greatly appreciated. I don't know why it is not working.

$(".form").on('submit', function(event) {
  event.preventDefault(); //prevent the forms default action
  var surname = $(this).find(".surname");
  console.log(surname);
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
  <form class="form" method="post" action="nextpage.php">
    <tr>
      <td class="name">john</td>
      <td class="surname">smith</td>
      <td>british</td>
      <td><button type="submit" class="btn btn-info btn-sm">Submit</button></td>
    </tr>

  </form>

  <form class="form" method="post" action="nextpage.php">
    <tr>
      <td class="name">bob</td>
      <td class="surname">doe</td>
      <td>american</td>
      <td><button type="submit" class="btn btn-info btn-sm">Submit</button></td>
    </tr>
  </form>
</table></code>```

So if i click on the first submit button i should see john, and the second, bob.

答:
As statet in the comments your HTML semantics is wrong. That's the first reason why it doesn't work. The second thing is you might want to use jQuerys .text() to get the "value" of a HTML element.

To make it work, see the example
 element is now moved inside the <form> element. Depending on your needs this is one possible solution.

$(".form").on('submit', function(event) {
  event.preventDefault(); //prevent the forms default action
  var surname = $(this).find(".surname");
  console.log(surname.text()); // here .text() is the only change in your js code
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <form class="form" method="post" action="nextpage.php">
  <table>
    <tr>
      <td class="name">john</td>
      <td class="surname">smith</td>
      <td>british</td>
      <td><button type="submit" class="btn btn-info btn-sm">Submit</button></td>
    </tr>
</table>
  </form>

  <form class="form" method="post" action="nextpage.php">
  <table>
    <tr>
      <td class="name">bob</td>
      <td class="surname">doe</td>
      <td>american</td>
      <td><button type="submit" class="btn btn-info btn-sm">Submit</button></td>
    </tr>
    </table>
  </form></code>```

Read more about permitted elements inside the
 element here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table

Read more about permitted elements inside <form> tag here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form

Body:
Trying to wrap my head around this for a while now. Some guru needs to help me out, it would be greatly appreciated. I don't know why it is not working.

$(".form").on('submit', function(event) {
  event.preventDefault(); //prevent the forms default action
  var surname = $(this).find(".surname");
  console.log(surname);
});

  <form class="form" method="post" action="nextpage.php">

      john
      smith
      british
      <button type="submit" class="btn btn-info btn-sm">Submit</button>

  </form>

  <form class="form" method="post" action="nextpage.php">

      bob
      doe
      american
      <button type="submit" class="btn btn-info btn-sm">Submit</button>

  </form>

So if i click on the first submit button i should see john, and the second, bob.

Body:
As statet in the comments your HTML semantics is wrong. That's the first reason why it doesn't work. The second thing is you might want to use jQuerys .text() to get the "value" of a HTML element.

To make it work, see the example <table> element is now moved inside the <form> element. Depending on your needs this is one possible solution.

$(".form").on('submit', function(event) {
  event.preventDefault(); //prevent the forms default action
  var surname = $(this).find(".surname");
  console.log(surname.text()); // here .text() is the only change in your js code
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <form class="form" method="post" action="nextpage.php">
  <table>
    <tr>
      <td class="name">john</td>
      <td class="surname">smith</td>
      <td>british</td>
      <td><button type="submit" class="btn btn-info btn-sm">Submit</button></td>
    </tr>
</table>
  </form>

  <form class="form" method="post" action="nextpage.php">
  <table>
    <tr>
      <td class="name">bob</td>
      <td class="surname">doe</td>
      <td>american</td>
      <td><button type="submit" class="btn btn-info btn-sm">Submit</button></td>
    </tr>
    </table>
  </form>

Read more about permitted elements inside the <table> element here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table

Read more about permitted elements inside <form> tag here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form


问:
Change default icons in BlazorApp
Friends,

I need help changing the default icons in Blazor.

答:
Inside your project go to: Pages-> Shared -> NavMenu.razor and look for the following code:

```<code><NavLink class="nav-link" href="" Match="NavLinkMatch.All">
    <span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
</code>```

Change the span class value to replace the icons.

Title: Change default icons in BlazorApp

Body:
Inside your project go to: Pages-> Shared -> NavMenu.razor and look for the following code:

<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
    <span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>

Change the span class value to replace the icons.


问:
Single Cloud Function to call 100+ local functions
Hi have 100+ cloud functions and a completed app, control panel and marketing website. When testing, my client said that the site was slow. This was because of the cold start times on all these functions.

I’m not really interested in having a cron job that hits each function every minute as there are a lot, and as other posts suggest, they are not always going to work.

Last night I had an idea. I know it is slightly gross, but I want to know what the consequences (other than not being able to release individual functions) would be of having a single cloud function end point, that switches a parameter with the function name, that then calls the other local functions that are imported. This would mean that the single function would be slow the first time for some users, but then every other function would be fast, as the function would already be warm.

Unfortunately I need to do one of the above to improve performance until firebase release a feature like aws to allow paying to keep functions warm.

答:
It's not possible to entirely eliminate cold start times.  They will always exist in serverless environments - that's a matter of fact.  The best you can do is organize your code to minimize the cold start times.  Without seeing all your code and your specific benchmarks, there is no specific advice we can geive.

The only thing that's in your control is to make sure that each function only loads the minimum amount of code at the global scope to run correctly.  So, if your functions all load some code at the global scope that's unused, all those functions will pay an unnecessary cold start cost to load and run the code they don't use.

There are resources out there that will help you do that.  Watch this video for more detail.


问:
How to turn a list of dicts into deterministic order?
I have an arbitrary (JSON-serializeable) structure which contains lists of dicts which I don't know anything about in advance (e.g.size or keys).

Is there a way to bring this list of dicts into a deterministic order (in order to compare them)?

I could think of turning a list of dicts into a list of 2-tuples which I can compare but I'm looking for a 'pythonic' solution..

Please note: I don't want to sort a list of dicts by any key I have to know in advance but I want to sort generic (JSON-serializeable) lists of dicts.

Another note: I don't just want to compare the dicts but I want to be able to serialize them. So I'm looking for a function reorder which makes sure

```<code>json.dumps(reorder([{'a': 1}, {'b': 2}])) == json.dumps(reorder([{'b': 2}, {'a': 1}]))
</code>```

答:
A reorder() function as mentioned in the question could be implemented like this:

def reorder(data):
    def comparable(uncomparable):
        if isinstance(uncomparable, dict):
            return tuple((k, comparable(v)) for k, v in uncomparable.items())
        if isinstance(uncomparable, (list, tuple)):
            return tuple(comparable(d) for d in uncomparable)
        return data
    if isinstance(data, (list, tuple)):
        return sorted([reorder(d) for d in data], key=lambda e: comparable(e))
    if isinstance(data, dict):
        return {k: reorder(v) for k, v in data.items()}
    return data
```

Note that this function implicitly converts tuple to list which results in the same outcome when serialized to JSON.

Body:
I have an arbitrary (JSON-serializeable) structure which contains lists of dicts which I don't know anything about in advance (e.g.size or keys).

Is there a way to bring this list of dicts into a deterministic order (in order to compare them)?

I could think of turning a list of dicts into a list of 2-tuples which I can compare but I'm looking for a 'pythonic' solution..

Please note: I don't want to sort a list of dicts by any key I have to know in advance but I want to sort generic (JSON-serializeable) lists of dicts.

Another note: I don't just want to compare the dicts but I want to be able to serialize them. So I'm looking for a function reorder which makes sure

json.dumps(reorder([{'a': 1}, {'b': 2}])) == json.dumps(reorder([{'b': 2}, {'a': 1}]))

Body:
A reorder() function as mentioned in the question could be implemented like this:

def reorder(data):
    def comparable(uncomparable):
        if isinstance(uncomparable, dict):
            return tuple((k, comparable(v)) for k, v in uncomparable.items())
        if isinstance(uncomparable, (list, tuple)):
            return tuple(comparable(d) for d in uncomparable)
        return data
    if isinstance(data, (list, tuple)):
        return sorted([reorder(d) for d in data], key=lambda e: comparable(e))
    if isinstance(data, dict):
        return {k: reorder(v) for k, v in data.items()}
    return data

Note that this function implicitly converts tuple to list which results in the same outcome when serialized to JSON.


问:
use Type at DynamoDB Output
I want to use a type with DynamoDB like this.

```<code>interface Custom {
  id: string,
  token: string,
}

const { Item }:GetItemOutput & { Item: Custom } = await DYNAMO_DB.get(params).promise();
</code>```

My IDE spits this alert.

Type 'PromiseResult' is not assignable to type 'GetItemOutput & { Item: Custom; }'.
    Type 'PromiseResult' is not assignable to type '{ Item: Custom; }'.
      Types of property 'Item' are incompatible.
        Type 'AttributeMap' is missing the following properties from type 'Custom': id, tokents(2322)

How can I use typescript with Dynamodb?

答:
The actual object type you are receiving is PromiseResult, so the following will work

```<code>const result:PromiseResult = await DYNAMO_DB.get(params).promise();
</code>```

but you don't gain great benefit so I would keep it to

```<code>const result = await DYNAMO_DB.get(params).promise();
</code>```

using TypeScript doesn't mean you have to use types everywhere

Title: use Type at DynamoDB Output

Body:
I want to use a type with DynamoDB like this.

interface Custom {
  id: string,
  token: string,
}

const { Item }:GetItemOutput & { Item: Custom } = await DYNAMO_DB.get(params).promise();

My IDE spits this alert.

Type 'PromiseResult' is not assignable to type 'GetItemOutput & { Item: Custom; }'.
    Type 'PromiseResult' is not assignable to type '{ Item: Custom; }'.
      Types of property 'Item' are incompatible.
        Type 'AttributeMap' is missing the following properties from type 'Custom': id, tokents(2322)

How can I use typescript with Dynamodb?

Body:
The actual object type you are receiving is PromiseResult, so the following will work

const result:PromiseResult = await DYNAMO_DB.get(params).promise();

but you don't gain great benefit so I would keep it to

const result = await DYNAMO_DB.get(params).promise();

using TypeScript doesn't mean you have to use types everywhere


问:
can't make locale work on Linux
I am writing an PHP application and using the gettext module to translate to different languages.

The code is working as I expect on my local computer (Windows running WAMP), but i can't make it work on the server (Unix + apache2)

```<code>{
        $locale_folder = dirname(dirname(dirname(__FILE__))).'/locale/';
        $locale = 'he_IL';

        $domain = 'myapp';
        $autoreload = true;

        // activate the locale setting
        setlocale(LC_ALL, $locale);
        setlocale(LC_TIME, $locale);

        putenv("LANG=$locale");
        putenv("LANGUAGE=$locale");
        putenv("LC_ALL=$locale");
        putenv("LC_MESSAGES=$locale");

        if ($autoreload) {
            // path to the .MO file that we should monitor
            $filename = "$locale_folder/$locale/LC_MESSAGES/$domain.mo";
            $mtime = filemtime($filename); // check its modification time
            // our new unique .MO file
            $filename_new = "$locale_folder/$locale/LC_MESSAGES/{$domain}_{$mtime}.mo";

            if (!file_exists($filename_new)) {  // check if we have created it before
                  // if not, create it now, by copying the original
                  copy($filename,$filename_new);
            }

            // compute the new domain name
            $domain_new = "{$domain}_{$mtime}";
        } else {
                $domain_new = $domain;
        }

        // bind it
        bindtextdomain($domain_new,$locale_folder);
        // then activate it
        textdomain($domain_new);

        bind_textdomain_codeset($domain_new, "UTF-8");
}
</code>```

I had run "sudo locale-get he_IL" and "sudo locale-get he_IL.UTF-8" previously to install the language component.

The translation is working on the local (Windows) computer but displays the original strings (not translated) on the server...

Do I have to configure anything else?

答: Try to run locale -a on your Linux machine to check if the locale is installed correctly</p>

Title: can't make locale work on Linux

Body:
I am writing an PHP application and using the gettext module to translate to different languages.

The code is working as I expect on my local computer (Windows running WAMP), but i can't make it work on the server (Unix + apache2)

{
        $locale_folder = dirname(dirname(dirname(__FILE__))).'/locale/';
        $locale = 'he_IL';

        $domain = 'myapp';
        $autoreload = true;

        // activate the locale setting
        setlocale(LC_ALL, $locale);
        setlocale(LC_TIME, $locale);

        putenv("LANG=$locale");
        putenv("LANGUAGE=$locale");
        putenv("LC_ALL=$locale");
        putenv("LC_MESSAGES=$locale");

        if ($autoreload) {
            // path to the .MO file that we should monitor
            $filename = "$locale_folder/$locale/LC_MESSAGES/$domain.mo";
            $mtime = filemtime($filename); // check its modification time
            // our new unique .MO file
            $filename_new = "$locale_folder/$locale/LC_MESSAGES/{$domain}_{$mtime}.mo";

            if (!file_exists($filename_new)) {  // check if we have created it before
                  // if not, create it now, by copying the original
                  copy($filename,$filename_new);
            }

            // compute the new domain name
            $domain_new = "{$domain}_{$mtime}";
        } else {
                $domain_new = $domain;
        }

        // bind it
        bindtextdomain($domain_new,$locale_folder);
        // then activate it
        textdomain($domain_new);

        bind_textdomain_codeset($domain_new, "UTF-8");
}

I had run "sudo locale-get he_IL" and "sudo locale-get he_IL.UTF-8" previously to install the language component.

The translation is working on the local (Windows) computer but displays the original strings (not translated) on the server...

Do I have to configure anything else?