问:
Access the method of another class in python
Let's say i have two classes in such a way:

```<code>class Class1(ParentClass1):
    def __init__(self):
        super(Class1, self).__init__()
        c2 = Class2()

    def foo(self):
        pass

class Class2(ParentClass2):
    def __init__(self):
        super(Class2, self).__init__()

    def bar(self):
        foo() # from Class1
</code>```

how to access foo() from Class2 if instance of Class2 is created in Class1, while Class1 itself is initiated in another class?

In other words, the dialog box(Class2) must update the list from Class1.

UPDATE

Initially, I had an instance of Class0 in __name__ == '__main__'. Class0 creates the instance of Class1 then I could access the instance of Class1 through Class2, but I need to create an instance of Class0 on some main() function, which disallows me access the Class1 methods.

答:
Proper terminology helps... You don't want to access "method of Class1", but "method of an instance of Class1" - which means you need to pass an instance of Class1 to your instance of Class2:</p>

```<code>class Class1(ParentClass1):
    def __init__(self):
        super(Class1, self).__init__()
        self.c2 = Class2(self)
        self.c2.bar()

    def foo(self):
        print("foo")

class Class2(ParentClass2):
    def __init__(self, c1):
        super(Class2, self).__init__()
        self.c1 = c1

    def bar(self):
        self.c1.foo()
</code>```

Body:
Let's say i have two classes in such a way:

class Class1(ParentClass1):
    def __init__(self):
        super(Class1, self).__init__()
        c2 = Class2()

    def foo(self):
        pass

class Class2(ParentClass2):
    def __init__(self):
        super(Class2, self).__init__()

    def bar(self):
        foo() # from Class1

how to access foo() from Class2 if instance of Class2 is created in Class1, while Class1 itself is initiated in another class?

In other words, the dialog box(Class2) must update the list from Class1.

UPDATE

Initially, I had an instance of Class0 in __name__ == '__main__'. Class0 creates the instance of Class1 then I could access the instance of Class1 through Class2, but I need to create an instance of Class0 on some main() function, which disallows me access the Class1 methods.

Body:
Proper terminology helps... You don't want to access "method of Class1", but "method of an instance of Class1" - which means you need to pass an instance of Class1 to your instance of Class2:

class Class1(ParentClass1):
    def __init__(self):
        super(Class1, self).__init__()
        self.c2 = Class2(self)
        self.c2.bar()

    def foo(self):
        print("foo")

class Class2(ParentClass2):
    def __init__(self, c1):
        super(Class2, self).__init__()
        self.c1 = c1

    def bar(self):
        self.c1.foo()


来源: stackexchange

问:
How to load the specified columns of text file in DolphinDB?
There are 15 columns in my text file: symbol, permno, datetime, price1, ... , price6, qty1, ..., qty6. I would like to load the following columns into DolphinDB: symbol, permno, datetime, price1, qty1. Now I just load all columns into DolphinDB and then select the columns what I need, but the text file is large and it will out of memory.

Here is my code:

```<code>stock=loadText("/home/summer/data/trades_20180912.csv")
t=select symbol, permno, datetime, price1, qty1 from stock
</code>```

答:
One can use a schema table to specify which column to import. Below is the full code</p>

```<code>schemaTBL = extractTextSchema("/home/summer/data/trades_20180912.csv")
update schemaTBL set col = rowNo(name)
schemaTBL = select * from schemaTBL where col in `symbol`permno`datetime`price1`qty1
stock = loadText("/home/summer/data/trades_20180912.csv",,schemaTBL)
</code>```

ContentLicense: CC BY-SA 4.0

Body:
There are 15 columns in my text file: symbol, permno, datetime, price1, ... , price6, qty1, ..., qty6. I would like to load the following columns into DolphinDB: symbol, permno, datetime, price1, qty1. Now I just load all columns into DolphinDB and then select the columns what I need, but the text file is large and it will out of memory.

Here is my code:

stock=loadText("/home/summer/data/trades_20180912.csv")
t=select symbol, permno, datetime, price1, qty1 from stock

Body:
One can use a schema table to specify which column to import. Below is the full code

schemaTBL = extractTextSchema("/home/summer/data/trades_20180912.csv")
update schemaTBL set col = rowNo(name)
schemaTBL = select * from schemaTBL where col in `symbol`permno`datetime`price1`qty1
stock = loadText("/home/summer/data/trades_20180912.csv",,schemaTBL)


问:
Using observable with sort data alphabetical
i am using angular 8 with asp.net core so i want to display the customer's name in the dropdown list  as alphabetical order from the api service, i found out the only solution to use the observable. is there other way to implement that? and how i can use alphabetical sort in the observable?

```<code>getAllcustomer() {
    return this._http.get<any>(this.myAppUrl + '/api/users/getcustomer', {responseType: 'json'} )
      .catch(this.errorHandler);
}
</code>```

Thanks

答:
You can map the response:

```<code>getAllcustomer() {
    return this._http.get<any>(this.myAppUrl + '/api/users/getcustomer', {responseType: 'json'} ).pipe(
  // assuming this API call gives you all the customers as an array of strings.
  map((response: any) => response.sort()),
)
      .catch(this.errorHandler);
}
</code>```

To put this sorting in the service is optional, you can also do the sorting in the component itself.

Body:
i am using angular 8 with asp.net core so i want to display the customer's name in the dropdown list  as alphabetical order from the api service, i found out the only solution to use the observable. is there other way to implement that? and how i can use alphabetical sort in the observable?

getAllcustomer() {
    return this._http.get<any>(this.myAppUrl + '/api/users/getcustomer', {responseType: 'json'} )
      .catch(this.errorHandler);
}

Thanks

Body:
You can map the response:

getAllcustomer() {
    return this._http.get<any>(this.myAppUrl + '/api/users/getcustomer', {responseType: 'json'} ).pipe(
  // assuming this API call gives you all the customers as an array of strings.
  map((response: any) => response.sort()),
)
      .catch(this.errorHandler);
}

To put this sorting in the service is optional, you can also do the sorting in the component itself.


问:
NPE hard to spot from the logcat it seems to be the Arraylist but each item should be set
GitHub Repo app building for learning purposes I've become stuck in this world of NullPointerException.

So it says on line 119 the ArrayList is null it's a simple Callback via Retrofit
where I try to get the data and then set they data further on. I'm unsure of where exactly in the process it fails as it just points to the initialization of the array on line 119 but I'm iterating over that array and then adding each item to a collection.

Someone with more knowhow would be able to spot something that I can't.

Any advice welcome.

```<code>Call<GitHubRepo> call = gitHubClient.getRepos(searchTerm, pageNumber, resultsPerPage);
call.enqueue(new Callback<GitHubRepo>() {
    @Override
    public void onResponse(Call<GitHubRepo> call, Response<GitHubRepo> response) {
        ArrayList<Item> itemsList = response.body().getItems();
        for(int i = 0; i < itemsList.size(); i++) {
            ModelCachedGitHubProject currentProject = new ModelCachedGitHubProject();
            Item responseItem = itemsList.get(i);
            currentProject.setOwnerName(responseItem.getOwner().getLogin());
            currentProject.setRepoName(responseItem.getName());
            currentProject.setRepoSize(responseItem.getSize());
            currentProject.setHasWiki(responseItem.isHas_wiki());
            currentProject.setCreatedAt(responseItem.getCreated_at());
            currentProject.setPushedAt(responseItem.getPushed_at());
            currentProject.setUpdatedAt(responseItem.getUpdated_at());
            currentProject.setHtmlUrl(responseItem.getHtml_url());
            currentProject.setAvatarUrl(responseItem.getOwner().getAvatar_url());
            currentProject.setLanguage(responseItem.getLanguage());
            currentProject.setForksCount(responseItem.getForks_count());
            currentProject.setScore(responseItem.getScore());
            currentProject.setDescription(responseItem.getDescription());
            gitHubProjectsList.add(currentProject);
        }
</code>```

Any other classes that are needed just ask. Thanks.

StackTrace :

```<code>E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.benmohammad.repoapp, PID: 2325
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList com.benmohammad.repoapp.data.webservice.apiresponse.GitHubRepo.getItems()' on a null object reference
        at com.benmohammad.repoapp.data.DataRepository$1.onResponse(DataRepository.java:119)
        at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda
</code>```

GitHub Repo Repo

Thanks

```<code>public void updateFromWebservice(final String searchTerm, final int pageNumber, int resultsPerPage) {
        webServiceMessageCallStatus.setValue(WebServiceMessage.UPDATING_STATUS);
        final List<ModelCachedGitHubProject> gitHubProjectsList =  new ArrayList<>();
        if(retrofit == null || gitHubClient == null) {
            retrofit = new Retrofit.Builder().baseUrl(GitHubClientService.BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
            gitHubClient = retrofit.create(GitHubClientService.class);
        }
        Call<GitHubRepo> call = gitHubClient.getRepos(searchTerm, pageNumber, resultsPerPage);
        call.enqueue(new Callback<GitHubRepo>() {
            @Override
            public void onResponse(Call<GitHubRepo> call, Response<GitHubRepo> response) {
                ArrayList<Item> itemsList = response.body().getItems();
                for(int i = 0; i < itemsList.size(); i++) {
                    ModelCachedGitHubProject currentProject = new ModelCachedGitHubProject();
                    Item responseItem = itemsList.get(i);
                    currentProject.setOwnerName(responseItem.getOwner().getLogin());
                    currentProject.setRepoName(responseItem.getName());
                    currentProject.setRepoSize(responseItem.getSize());
                    currentProject.setHasWiki(responseItem.isHas_wiki());
                    currentProject.setCreatedAt(responseItem.getCreated_at());
                    currentProject.setPushedAt(responseItem.getPushed_at());
                    currentProject.setUpdatedAt(responseItem.getUpdated_at());
                    currentProject.setHtmlUrl(responseItem.getHtml_url());
                    currentProject.setAvatarUrl(responseItem.getOwner().getAvatar_url());
                    currentProject.setLanguage(responseItem.getLanguage());
                    currentProject.setForksCount(responseItem.getForks_count());
                    currentProject.setScore(responseItem.getScore());
                    currentProject.setDescription(responseItem.getDescription());
                    gitHubProjectsList.add(currentProject);
                }

                if(!gitHubProjectsList.isEmpty()) {
                    boolean clearPreviousCache;
                    if(pageNumber == 1) {
                        clearPreviousCache = true;
                        saveLastSearchTerm(searchTerm);

                    } else clearPreviousCache = false;
                    cacheProjectsList(gitHubProjectsList, clearPreviousCache);
                    setLastRefreshDate(new Date());
                    webServiceMessageCallStatus.postValue(WebServiceMessage.ON_RESPONSE_SUCCESS);
                } else {
                    if(pageNumber == 1)
                        webServiceMessageCallStatus.postValue(WebServiceMessage.ON_RESPONSE_NOTHING_FOUND);
                    else {
                        webServiceMessageCallStatus.postValue(WebServiceMessage.ON_RESPONSE_NO_MORE_RESULTS);
                    }
                }
            }

            @Override
            public void onFailure(Call<GitHubRepo> call, Throwable t) {
                webServiceMessageCallStatus.postValue(WebServiceMessage.ON_FAILURE);
            }
        });
    }
</code>```

答: Response is null, assuming you are talking about ArrayList itemsList line.. We can't see line numbers. If you look at the stack trace, it says .getItems()' on a null object reference. That means response.getBody() is null. So you need to check where that response is being initialized (being sent) and make sure there isn't a problem in that class/service.

Body:
GitHub Repo app building for learning purposes I've become stuck in this world of NullPointerException.

So it says on line 119 the ArrayList is null it's a simple Callback via Retrofit
where I try to get the data and then set they data further on. I'm unsure of where exactly in the process it fails as it just points to the initialization of the array on line 119 but I'm iterating over that array and then adding each item to a collection.

Someone with more knowhow would be able to spot something that I can't.

Any advice welcome.

Call<GitHubRepo> call = gitHubClient.getRepos(searchTerm, pageNumber, resultsPerPage);
call.enqueue(new Callback<GitHubRepo>() {
    @Override
    public void onResponse(Call<GitHubRepo> call, Response<GitHubRepo> response) {
        ArrayList<Item> itemsList = response.body().getItems();
        for(int i = 0; i < itemsList.size(); i++) {
            ModelCachedGitHubProject currentProject = new ModelCachedGitHubProject();
            Item responseItem = itemsList.get(i);
            currentProject.setOwnerName(responseItem.getOwner().getLogin());
            currentProject.setRepoName(responseItem.getName());
            currentProject.setRepoSize(responseItem.getSize());
            currentProject.setHasWiki(responseItem.isHas_wiki());
            currentProject.setCreatedAt(responseItem.getCreated_at());
            currentProject.setPushedAt(responseItem.getPushed_at());
            currentProject.setUpdatedAt(responseItem.getUpdated_at());
            currentProject.setHtmlUrl(responseItem.getHtml_url());
            currentProject.setAvatarUrl(responseItem.getOwner().getAvatar_url());
            currentProject.setLanguage(responseItem.getLanguage());
            currentProject.setForksCount(responseItem.getForks_count());
            currentProject.setScore(responseItem.getScore());
            currentProject.setDescription(responseItem.getDescription());
            gitHubProjectsList.add(currentProject);
        }

Any other classes that are needed just ask. Thanks.

StackTrace :

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.benmohammad.repoapp, PID: 2325
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList com.benmohammad.repoapp.data.webservice.apiresponse.GitHubRepo.getItems()' on a null object reference
        at com.benmohammad.repoapp.data.DataRepository$1.onResponse(DataRepository.java:119)
        at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda

GitHub Repo Repo

Thanks

public void updateFromWebservice(final String searchTerm, final int pageNumber, int resultsPerPage) {
        webServiceMessageCallStatus.setValue(WebServiceMessage.UPDATING_STATUS);
        final List<ModelCachedGitHubProject> gitHubProjectsList =  new ArrayList<>();
        if(retrofit == null || gitHubClient == null) {
            retrofit = new Retrofit.Builder().baseUrl(GitHubClientService.BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
            gitHubClient = retrofit.create(GitHubClientService.class);
        }
        Call<GitHubRepo> call = gitHubClient.getRepos(searchTerm, pageNumber, resultsPerPage);
        call.enqueue(new Callback<GitHubRepo>() {
            @Override
            public void onResponse(Call<GitHubRepo> call, Response<GitHubRepo> response) {
                ArrayList<Item> itemsList = response.body().getItems();
                for(int i = 0; i < itemsList.size(); i++) {
                    ModelCachedGitHubProject currentProject = new ModelCachedGitHubProject();
                    Item responseItem = itemsList.get(i);
                    currentProject.setOwnerName(responseItem.getOwner().getLogin());
                    currentProject.setRepoName(responseItem.getName());
                    currentProject.setRepoSize(responseItem.getSize());
                    currentProject.setHasWiki(responseItem.isHas_wiki());
                    currentProject.setCreatedAt(responseItem.getCreated_at());
                    currentProject.setPushedAt(responseItem.getPushed_at());
                    currentProject.setUpdatedAt(responseItem.getUpdated_at());
                    currentProject.setHtmlUrl(responseItem.getHtml_url());
                    currentProject.setAvatarUrl(responseItem.getOwner().getAvatar_url());
                    currentProject.setLanguage(responseItem.getLanguage());
                    currentProject.setForksCount(responseItem.getForks_count());
                    currentProject.setScore(responseItem.getScore());
                    currentProject.setDescription(responseItem.getDescription());
                    gitHubProjectsList.add(currentProject);
                }

                if(!gitHubProjectsList.isEmpty()) {
                    boolean clearPreviousCache;
                    if(pageNumber == 1) {
                        clearPreviousCache = true;
                        saveLastSearchTerm(searchTerm);

                    } else clearPreviousCache = false;
                    cacheProjectsList(gitHubProjectsList, clearPreviousCache);
                    setLastRefreshDate(new Date());
                    webServiceMessageCallStatus.postValue(WebServiceMessage.ON_RESPONSE_SUCCESS);
                } else {
                    if(pageNumber == 1)
                        webServiceMessageCallStatus.postValue(WebServiceMessage.ON_RESPONSE_NOTHING_FOUND);
                    else {
                        webServiceMessageCallStatus.postValue(WebServiceMessage.ON_RESPONSE_NO_MORE_RESULTS);
                    }
                }
            }

            @Override
            public void onFailure(Call<GitHubRepo> call, Throwable t) {
                webServiceMessageCallStatus.postValue(WebServiceMessage.ON_FAILURE);
            }
        });
    }


问:
How can I load and use jsgrid lib in React?
I have problem with jsgrid lib. I try to load it to React project. I included libraries to project, like in instructions on npmjs.

My code loooks:

index.html

<!DOCTYPE html>

    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.css" />
    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid-theme.min.css" />
    <title>React App</title>

    You need to enable JavaScript to run this app.

```

<p>app.js</p>

<pre class="lang-js prettyprint-override"><code>import React from 'react';
import logo from './logo.svg';
import './App.css';
import * as JSGRID from 'jsgrid'

export default class App extends React.Component {
  componentDidMount() {

    window.$("#jsGrid").JSGRID.jsGrid({
      width: "100%",
      height: "400px",

      filtering: true,
      editing: true,
      sorting: true,
      paging: true,

      fields: [
          { name: "Name", type: "text", width: 150 },
          { name: "Age", type: "number", width: 50 },
          { name: "Address", type: "text", width: 200 },
          { name: "Country", type: "select", items: 0, valueField: "Id", textField: "Name" },
          { name: "Married", type: "checkbox", title: "Is Married", sorting: false },
          { type: "control" }
      ]
  });
  }

  render() {
    return (
      <div id="jsGrid">

      </div>
    );
    }
}
</code>```

Still have some errors:

I wasted some time on it, Is any instructions how include jquery projects like this to React? Or maybe somebody faced with problem like this and know how to fix it.

答:
You need to remove JSGRID from the jQuery and should create a ref to reference the node instead of querying it.

// change to require
require("jsgrid");

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.gridRef = React.createRef();
  }
  componentDidMount() {
// remove JSGRID and use a ref
    window.jQuery(this.gridRef.current).jsGrid({
      width: "100%",
      height: "400px",

      filtering: true,
      editing: true,
      sorting: true,
      paging: true,

      fields: [
        { name: "Name", type: "text", width: 150 },
        { name: "Age", type: "number", width: 50 },
        { name: "Address", type: "text", width: 200 },
        {
          name: "Country",
          type: "select",
          items: 0,
          valueField: "Id",
          textField: "Name"
        },
        {
          name: "Married",
          type: "checkbox",
          title: "Is Married",
          sorting: false
        },
        { type: "control" }
      ]
    });
  }
  render() {
    return
;
  }
}```

Body:
I have problem with jsgrid lib. I try to load it to React project. I included libraries to project, like in instructions on npmjs.

My code loooks:

index.html

<!DOCTYPE html>

    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.css" />
    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid-theme.min.css" />
    <title>React App</title>

    You need to enable JavaScript to run this app.

app.js

import React from 'react';
import logo from './logo.svg';
import './App.css';
import * as JSGRID from 'jsgrid'

export default class App extends React.Component {
  componentDidMount() {

    window.$("#jsGrid").JSGRID.jsGrid({
      width: "100%",
      height: "400px",

      filtering: true,
      editing: true,
      sorting: true,
      paging: true,

      fields: [
          { name: "Name", type: "text", width: 150 },
          { name: "Age", type: "number", width: 50 },
          { name: "Address", type: "text", width: 200 },
          { name: "Country", type: "select", items: 0, valueField: "Id", textField: "Name" },
          { name: "Married", type: "checkbox", title: "Is Married", sorting: false },
          { type: "control" }
      ]
  });
  }

  render() {
    return (

    );
    }
}

Still have some errors:

I wasted some time on it, Is any instructions how include jquery projects like this to React? Or maybe somebody faced with problem like this and know how to fix it.

Body:
You need to remove JSGRID from the jQuery and should create a ref to reference the node instead of querying it.

// change to require
require("jsgrid");

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.gridRef = React.createRef();
  }
  componentDidMount() {
// remove JSGRID and use a ref
    window.jQuery(this.gridRef.current).jsGrid({
      width: "100%",
      height: "400px",

      filtering: true,
      editing: true,
      sorting: true,
      paging: true,

      fields: [
        { name: "Name", type: "text", width: 150 },
        { name: "Age", type: "number", width: 50 },
        { name: "Address", type: "text", width: 200 },
        {
          name: "Country",
          type: "select",
          items: 0,
          valueField: "Id",
          textField: "Name"
        },
        {
          name: "Married",
          type: "checkbox",
          title: "Is Married",
          sorting: false
        },
        { type: "control" }
      ]
    });
  }
  render() {
    return <div id="jsGrid" ref={this.gridRef} />;
  }
}


问:
Using bootstrap cards as a hyperlink
I have a bootstrap card Which is used as a link.

Trying to wrap it with  changes all of the styling of the card.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">

Normal card

Some quick example text to build on the card title and make up the bulk of the card's content.

Wrapped with a tag

Some quick example text to build on the card title and make up the bulk of the card's content.

```

How should I wrap the card in order to preserve its looks and use it as a link?

答:
I had the same problem. I fixed it with this trick. You can specify the  color whatever you like and put a 00 at the end of the color code to make it transparent this way you make the  style invisible. e.g.</p>

```<code><a href="" style="color: #83577500; ">
</code>```

ContentLicense: CC BY-SA 3.0

Title: Using bootstrap cards as a hyperlink

Body:
I have a bootstrap card Which is used as a link.

Trying to wrap it with  changes all of the styling of the card.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">

Normal card

Some quick example text to build on the card title and make up the bulk of the card's content.

Wrapped with a tag

Some quick example text to build on the card title and make up the bulk of the card's content.

How should I wrap the card in order to preserve its looks and use it as a link?

Body:
I had the same problem. I fixed it with this trick. You can specify the  color whatever you like and put a 00 at the end of the color code to make it transparent this way you make the  style invisible. e.g.

<a href="" style="color: #83577500; ">


答:
You can do it using sort() method. Quoting from the MDN reference on sort():

The sort() method sorts the elements of an array in place and returns the sorted array. The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.

Try with this:

Add map method to your imports:

```<code>import { map, catchError } from 'rxjs/operators';
// ...
</code>```

Use pipe for concatenate rxjs methods

```<code>getAllcustomer() {
  return this._http.get<any>(this.myAppUrl + '/api/users/getsuppliers', {responseType: 'json'} ).pipe(
    map(response => response.sort(),
    catchError(this.errorHandler));
}
</code>```

Assuming that response structure is like this:

['ccc', 'aba', 'aaa']

Title: Using observable with sort data alphabetical

Body:
You can do it using sort() method. Quoting from the MDN reference on sort():

The sort() method sorts the elements of an array in place and returns the sorted array. The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.

Try with this:

Add map method to your imports:

import { map, catchError } from 'rxjs/operators';
// ...

Use pipe for concatenate rxjs methods

getAllcustomer() {
  return this._http.get<any>(this.myAppUrl + '/api/users/getsuppliers', {responseType: 'json'} ).pipe(
    map(response => response.sort(),
    catchError(this.errorHandler));
}

Assuming that response structure is like this:

['ccc', 'aba', 'aaa']


问:
Align navigation bootstrap center
I want to center align the navigation links from Bootstrap but since I'm not using the list structure, all solutions don't work.

```<code>    <section id="menuNavigation">
        <div class="container-fluid">
            <nav class="navbar navbar-expand-lg">

                <button class="navbar-toggler" type="´button" data-toggle="collapse" data-target="#navbarHeader">
                    <span class="navbar-toggler-icon"></span>
                </button>

                <div class="collapse navbar-collapse" id="navbarHeader">
                    <ul class="navbar-nav">
                        <a href="index.php" class="nav-item nav-link">Uniongs</a>
                        <a href="sobre.php" class="nav-item nav-link">Sobre</a>
                        <a href="seja-um-doador.php" class="nav-item nav-link">Seja Assinante</a>
                        <a href="blog.php" class="nav-item nav-link">Blog</a>
                        <a href="seja-assinante.php" class="nav-item nav-link">Publicidade</a>
                    </ul>
                </div>

            </nav>
        </div>
    </section>
</code>```

I tried everything: text-center, text-align: center, justify-content-center and nothing works.

答:
Your HTML is invalid. ul can only have li as children. Try using a div instead.

Then use the flexbox helper classes available to you in BS4.

```<code><div class="navbar-nav d-flex justify-content-center">
</code>```

Then we just make the menu full width by adding flex:1. The reason the list items wouldn't center is because the menu was not full width and itself, left aligned.

View in Full Page mode.

.navbar-nav {
  flex: 1;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<section id="menuNavigation">
  <div class="container-fluid">
    <nav class="navbar navbar-expand-lg">

      <button class="navbar-toggler" type="´button" data-toggle="collapse" data-target="#navbarHeader">
                    <span class="navbar-toggler-icon">Toggle</span>
                </button>

      <div class="collapse navbar-collapse " id="navbarHeader">
        <div class="navbar-nav d-flex justify-content-center">
          Uniongs
          Sobre
          Seja Assinante
          Blog
          Publicidade
        </div>
      </div>

    </nav>
  </div>
</section></code>```

Title: Align navigation bootstrap center

Body:
I want to center align the navigation links from Bootstrap but since I'm not using the list structure, all solutions don't work.

                <button class="navbar-toggler" type="´button" data-toggle="collapse" data-target="#navbarHeader">

                </button>

                        Uniongs
                        Sobre
                        Seja Assinante
                        Blog
                        Publicidade

I tried everything: text-center, text-align: center, justify-content-center and nothing works.

Body:
Your HTML is invalid. ul can only have li as children. Try using a div instead.

Then use the flexbox helper classes available to you in BS4.

<div class="navbar-nav d-flex justify-content-center">

Then we just make the menu full width by adding flex:1. The reason the list items wouldn't center is because the menu was not full width and itself, left aligned.

View in Full Page mode.

.navbar-nav {
  flex: 1;
}

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<section id="menuNavigation">
  <div class="container-fluid">
    <nav class="navbar navbar-expand-lg">

      <button class="navbar-toggler" type="´button" data-toggle="collapse" data-target="#navbarHeader">
                    <span class="navbar-toggler-icon">Toggle</span>
                </button>

      <div class="collapse navbar-collapse " id="navbarHeader">
        <div class="navbar-nav d-flex justify-content-center">
          <a href="index.php" class="nav-item nav-link">Uniongs</a>
          <a href="sobre.php" class="nav-item nav-link">Sobre</a>
          <a href="seja-um-doador.php" class="nav-item nav-link">Seja Assinante</a>
          <a href="blog.php" class="nav-item nav-link">Blog</a>
          <a href="seja-assinante.php" class="nav-item nav-link">Publicidade</a>
        </div>
      </div>

    </nav>
  </div>
</section>


问:
MYSQL: delete empty cells
I have a table, for example, "mytable". It has several columns: col1, col2, col3. There is some data in it, placed like that:

```
id  col1    col2    col3
1   aasdas
2           acxvxc
3                   dgdgdff
4   hfgdgh
5           jmjkh
6                   dfgdfgd
7   bcbxcb
```

For some reason I need table, formatted like that:

```
id  col1    col2    col3
1   aasdas  acxvxc  dgdgdff
2   hfgdgh  jmjkh   dfgdfgd
3   bcbxcb
```

I thought I could do something like INSERT INTO "mytable" ("col1") VALUES (SELECT "col1" FROM "mytable" WHERE "col1"<>'')
and etc, but of course it doesn't work.

Any ideas? =)

答:
In order to delete empty cells give this simple query :

```<code>delete from [table_name] where [col1] and [col2] and [col3] = ' ';
</code>```

Where this will delete all the empty cells in the three columns. Make sure before performing this operation set auto commit = 0;

ContentLicense: CC BY-SA 2.5

Title: MYSQL: delete empty cells

Body:
I have a table, for example, "mytable". It has several columns: col1, col2, col3. There is some data in it, placed like that:

id  col1    col2    col3
1   aasdas
2           acxvxc
3                   dgdgdff
4   hfgdgh
5           jmjkh
6                   dfgdfgd
7   bcbxcb

For some reason I need table, formatted like that:

id  col1    col2    col3
1   aasdas  acxvxc  dgdgdff
2   hfgdgh  jmjkh   dfgdfgd
3   bcbxcb

I thought I could do something like INSERT INTO "mytable" ("col1") VALUES (SELECT "col1" FROM "mytable" WHERE "col1"<>'')
and etc, but of course it doesn't work.

Any ideas? =)

Body:
In order to delete empty cells give this simple query :

delete from [table_name] where [col1] and [col2] and [col3] = ' ';

Where this will delete all the empty cells in the three columns. Make sure before performing this operation set auto commit = 0;


问:
How to download a file (JPG) from Firebase to PC with javascript?
This code snippet runs when I push the download button.

What I want it to do:
Stay on the same page and download the JPG file to my downloads folder

What it does now:
Opens a new tab (chrome) and shows the JPG

How do I fix this?

```<code>const storageRef = firebase.storage().ref()
const imageRef = storageRef.child('photos/DSC_0305.JPG')
imageRef.getDownloadURL().then(function(url) {
  var a = document.createElement("a")
  document.body.appendChild(a)
  a.style = "display: none"
  a.href = url
  a.download = 'file'
  a.click()
</code>```

答:
The method you are using "getDownloadURL()" retrieves the url to a archive stored in your firestore. To download something you need the raw data of the image, not a reference to the image stored in your database. To do so, you can transform it to a Blob like this:</p>

```<code>imageRef.getDownloadURL().then(function(url) {
  const blob = new Blob([url]);
  const object = window.URL.createObjectURL(blob);
  const fileLink = document.createElement('a');
  fileLink.setAttribute('download', `name you want to your file`);
  fileLink.setAttribute('href', object);
  fileLink.href = object;
  document.body.appendChild(fileLink);
  fileLink.click();
})
</code>```

Body:
This code snippet runs when I push the download button.

What I want it to do:
Stay on the same page and download the JPG file to my downloads folder

What it does now:
Opens a new tab (chrome) and shows the JPG

How do I fix this?

const storageRef = firebase.storage().ref()
const imageRef = storageRef.child('photos/DSC_0305.JPG')
imageRef.getDownloadURL().then(function(url) {
  var a = document.createElement("a")
  document.body.appendChild(a)
  a.style = "display: none"
  a.href = url
  a.download = 'file'
  a.click()

Body:
The method you are using "getDownloadURL()" retrieves the url to a archive stored in your firestore. To download something you need the raw data of the image, not a reference to the image stored in your database. To do so, you can transform it to a Blob like this:

imageRef.getDownloadURL().then(function(url) {
  const blob = new Blob([url]);
  const object = window.URL.createObjectURL(blob);
  const fileLink = document.createElement('a');
  fileLink.setAttribute('download', `name you want to your file`);
  fileLink.setAttribute('href', object);
  fileLink.href = object;
  document.body.appendChild(fileLink);
  fileLink.click();
})


问:
Array Formula to Automatically Calculate
I want an array formula to use with Google Forms data to automatically calculate running metrics on my data.

In this case, in column BF I want it to auto-calculate whenever new responses come in.

I'm trying to use this formula below but isn't working for all column, just for the first line.

=ArrayFormula(If(isblank($BF$3:$BF);"";(INDEX($C$1:$BD$1;0;MATCH(MAX($C3:$BD3);$C3:$BD3;0)))))

What I'm doing wrong?

My Google Sheet:

https://docs.google.com/spreadsheets/d/1iD75djqdY8qtClEHpKUEvAS55bP0ARv9AnDUz9mFBuc/edit?usp=sharing

答:
delete range BE:BF

paste this in BE1:

```<code>={"MAX"; ""; ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(C3:BD);
 "select "&TEXTJOIN(","; 1; IF(A3:A<>"";
 "max(Col"&ROW(A3:A)-ROW(A3)+1&")"; ))&""));
 "select Col2"; 0))}
</code>```

paste this in BF1:

```<code>={"TIPO"; ""; ARRAYFORMULA(IF(A3:A="";;TRIM(TRANSPOSE(QUERY(TRANSPOSE(
 IF(C3:BD=QUERY(TRANSPOSE(QUERY(TRANSPOSE(C3:BD);
 "select "&TEXTJOIN(","; 1; IF(A3:A<>"";
 "max(Col"&ROW(A3:A)-ROW(A3)+1&")"; ))&""));
 "select Col2"; 0); C1:1; ));;99^99)))))}
</code>```

Body:
delete range BE:BF

paste this in BE1:

={"MAX"; ""; ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(C3:BD);
 "select "&TEXTJOIN(","; 1; IF(A3:A<>"";
 "max(Col"&ROW(A3:A)-ROW(A3)+1&")"; ))&""));
 "select Col2"; 0))}

paste this in BF1:

={"TIPO"; ""; ARRAYFORMULA(IF(A3:A="";;TRIM(TRANSPOSE(QUERY(TRANSPOSE(
 IF(C3:BD=QUERY(TRANSPOSE(QUERY(TRANSPOSE(C3:BD);
 "select "&TEXTJOIN(","; 1; IF(A3:A<>"";
 "max(Col"&ROW(A3:A)-ROW(A3)+1&")"; ))&""));
 "select Col2"; 0); C1:1; ));;99^99)))))}


问:
Reshaping a pandas correlation matrix
I have the following correlation matrix which was created using pandas: df.corr()

```<code>symbol       aaa       bbb       ccc       ddd       eee
symbol
aaa     1.000000  0.346099  0.131874 -0.150910  0.177589
bbb     0.346099  1.000000  0.177308 -0.384893  0.301150
ccc     0.131874  0.177308  1.000000 -0.176995  0.258812
ddd    -0.150910 -0.384893 -0.176995  1.000000 -0.310137
eee     0.177589  0.301150  0.258812 -0.310137  1.000000
</code>```

From the above dataframe, I need to transform it into a 3 column dataframe as follows:

```<code>aaa     aaa       1.000000
aaa     bbb       0.346099
aaa     ccc       0.131874
aaa     ddd      -0.150910
aaa     eee       0.177589
bbb     aaa       0.346099
bbb     bbb       1.000000
bbb     ccc       0.177308
bbb     ddd      -0.384893
bbb     eee       0.301150
ccc     aaa       0.131874
ccc     bbb       0.177308
ccc     ccc       1.000000
ccc     ddd      -0.176995
ccc     eee       0.258812
ddd     aaa      -0.150910
ddd     bbb      -0.384893
ddd     ccc      -0.176995
ddd     ddd       1.000000
ddd     eee      -0.310137
eee     aaa       0.177589
eee     bbb       0.301150
eee     ccc       0.258812
eee     ddd      -0.310137
eee     eee       1.000000
</code>```

As shown, it is the same data, just presented differently. Each column/row pair from the original dataframe is simply grouped together into it's own row in the new dataframe.

Unfortunately I can't figure out how to get this done with the result being a dataframe. I have tried doing df.stack() but the the result of this is a Series. I need it to be a dataframe so that I can work with the columns. The other problem with df.stack() is that it does not fill in every row, here is a small sample of the issue:

```<code>aaa     aaa       1.000000
        bbb       0.346099
        ccc       0.131874
        ddd      -0.150910
        eee       0.177589
bbb     aaa       0.346099
        bbb       1.000000
        ccc       0.177308
        ddd      -0.384893
        eee       0.301150
etc...
</code>```

答:
Use the code below to (a) reshape the correlation matrix, (b) remove duplicate rows (e.g., {aaa, bbb} and {bbb, aaa}), and (c) remove rows that contain the same variable in the first two columns (e.g., {aaa, aaa}):

```<code># calculate the correlation matrix and reshape
df_corr = df.corr().stack().reset_index()

# rename the columns
df_corr.columns = ['FEATURE_1', 'FEATURE_2', 'CORRELATION']

# create a mask to identify rows with duplicate features as mentioned above
mask_dups = (df_corr[['FEATURE_1', 'FEATURE_2']].apply(frozenset, axis=1).duplicated()) | (df_corr['FEATURE_1']==df_corr['FEATURE_2'])

# apply the mask to clean the correlation dataframe
df_corr = df_corr[~mask_dups]
</code>```

This will generate an output like this:

```<code>    FEATURE_1  FEATURE_2  CORRELATION
0         aaa        bbb     0.346099
1         aaa        ccc     0.131874
2         aaa        ddd    -0.150910
3         aaa        eee     0.177589
4         bbb        ccc     0.177308
5         bbb        ddd    -0.384893
6         bbb        eee     0.301150
7         ccc        ddd    -0.176995
8         ccc        eee     0.258812
9         ddd        eee    -0.310137
</code>```

Title: Reshaping a pandas correlation matrix

Body:
I have the following correlation matrix which was created using pandas: df.corr()

symbol       aaa       bbb       ccc       ddd       eee
symbol
aaa     1.000000  0.346099  0.131874 -0.150910  0.177589
bbb     0.346099  1.000000  0.177308 -0.384893  0.301150
ccc     0.131874  0.177308  1.000000 -0.176995  0.258812
ddd    -0.150910 -0.384893 -0.176995  1.000000 -0.310137
eee     0.177589  0.301150  0.258812 -0.310137  1.000000

From the above dataframe, I need to transform it into a 3 column dataframe as follows:

aaa     aaa       1.000000
aaa     bbb       0.346099
aaa     ccc       0.131874
aaa     ddd      -0.150910
aaa     eee       0.177589
bbb     aaa       0.346099
bbb     bbb       1.000000
bbb     ccc       0.177308
bbb     ddd      -0.384893
bbb     eee       0.301150
ccc     aaa       0.131874
ccc     bbb       0.177308
ccc     ccc       1.000000
ccc     ddd      -0.176995
ccc     eee       0.258812
ddd     aaa      -0.150910
ddd     bbb      -0.384893
ddd     ccc      -0.176995
ddd     ddd       1.000000
ddd     eee      -0.310137
eee     aaa       0.177589
eee     bbb       0.301150
eee     ccc       0.258812
eee     ddd      -0.310137
eee     eee       1.000000

As shown, it is the same data, just presented differently. Each column/row pair from the original dataframe is simply grouped together into it's own row in the new dataframe.

Unfortunately I can't figure out how to get this done with the result being a dataframe. I have tried doing df.stack() but the the result of this is a Series. I need it to be a dataframe so that I can work with the columns. The other problem with df.stack() is that it does not fill in every row, here is a small sample of the issue:

aaa     aaa       1.000000
        bbb       0.346099
        ccc       0.131874
        ddd      -0.150910
        eee       0.177589
bbb     aaa       0.346099
        bbb       1.000000
        ccc       0.177308
        ddd      -0.384893
        eee       0.301150
etc...

Body:
Use the code below to (a) reshape the correlation matrix, (b) remove duplicate rows (e.g., {aaa, bbb} and {bbb, aaa}), and (c) remove rows that contain the same variable in the first two columns (e.g., {aaa, aaa}):

# calculate the correlation matrix and reshape
df_corr = df.corr().stack().reset_index()

# rename the columns
df_corr.columns = ['FEATURE_1', 'FEATURE_2', 'CORRELATION']

# create a mask to identify rows with duplicate features as mentioned above
mask_dups = (df_corr[['FEATURE_1', 'FEATURE_2']].apply(frozenset, axis=1).duplicated()) | (df_corr['FEATURE_1']==df_corr['FEATURE_2'])

# apply the mask to clean the correlation dataframe
df_corr = df_corr[~mask_dups]

This will generate an output like this:

    FEATURE_1  FEATURE_2  CORRELATION
0         aaa        bbb     0.346099
1         aaa        ccc     0.131874
2         aaa        ddd    -0.150910
3         aaa        eee     0.177589
4         bbb        ccc     0.177308
5         bbb        ddd    -0.384893
6         bbb        eee     0.301150
7         ccc        ddd    -0.176995
8         ccc        eee     0.258812
9         ddd        eee    -0.310137


问:
How to filter records in sql server?
I have a table called "Status" as shown below in sql server.

How can I filter the records where the timestamp is less then 5 minutes for the same Level and same Status?

Eg: For the above records my output should be like

答:
Use lag():

```<code>select s.*
from (select s.*, lag(date) over (partition by level, status order by date) as prev_date
      from status s
     ) s
where prev_date is null or
      prev_date > dateadd(minute, -5, date);
</code>```

Title: How to filter records in sql server?

Body:
Use lag():

select s.*
from (select s.*, lag(date) over (partition by level, status order by date) as prev_date
      from status s
     ) s
where prev_date is null or
      prev_date > dateadd(minute, -5, date);


问:
avoid spaces when concatenating variables in bash under macos
I am having a strange issue with bash under macos. When I concatenate two variables, it adds an extra space between them which I cannot get rid of.

```<code>~/testdrive/dir1 $ curd=$(pwd)
~/testdrive/dir1 $ echo $curd
/xx/xx/testdrive/dir1
~/testdrive/dir1 $ fcount=$(ls -l | wc -l)
~/testdrive/dir1 $ echo $fcount
5          # notice no space in front of the 5
~/testdrive/dir1 $ echo $curd$fcount
/xx/xx/testdrive/dir1 5 # space between directory name and 5
</code>```

I am using GNU bash, Version 5.0.16(1)-release (x86_64-apple-darwin19.3.0). I tried newd="$curd$fcount" and newd=${curd}${fcount} with the same result. In some directories it adds 5 or more spaces between the variables.

However,

```<code>~/testdrive/dir1 $ var1=abc
~/testdrive/dir1 $ var2=def
~/testdrive/dir1 $ echo $var1$var2
abcdef   # expected behavior
</code>```

Then, again,

```<code>~/testdrive/dir1 $ echo $var1$fcount
abc 5  # space between
</code>```

I've seen many tips how to remove whitespace from strings, however I do not understand why it is there in the first place. I am assuming it has to do with fcount=$(ls -l | wc -l) but how?  Any ideas?

答:
Bash variables are untyped. Try this:

```<code>fcount=$(ls | wc -l)

echo $fcount          # check it
469                   # it looks ok, but...

echo "$fcount"        # ... when quoted properly
     469              # it has leading spaces! UGH!
</code>```

Try again, but this time tell bash it's an integer:

```<code>declare -i fcount     # Tell bash it's an integer
fcount=$(ls | wc -l)  # set it
echo "$fcount"        # check value with correct quoting
469                   # and it's correct
</code>```

Or, if you don't like that method, you can tell bash to replace all spaces with nothing/emptiness.

```<code>string="   abc  |"

echo "$string"           # display string as is
   abc  |

echo "${string// /}"     # delete all spaces in string
abc|
</code>```

Body:
I am having a strange issue with bash under macos. When I concatenate two variables, it adds an extra space between them which I cannot get rid of.

~/testdrive/dir1 $ curd=$(pwd)
~/testdrive/dir1 $ echo $curd
/xx/xx/testdrive/dir1
~/testdrive/dir1 $ fcount=$(ls -l | wc -l)
~/testdrive/dir1 $ echo $fcount
5          # notice no space in front of the 5
~/testdrive/dir1 $ echo $curd$fcount
/xx/xx/testdrive/dir1 5 # space between directory name and 5

I am using GNU bash, Version 5.0.16(1)-release (x86_64-apple-darwin19.3.0). I tried newd="$curd$fcount" and newd=${curd}${fcount} with the same result. In some directories it adds 5 or more spaces between the variables.

However,

~/testdrive/dir1 $ var1=abc
~/testdrive/dir1 $ var2=def
~/testdrive/dir1 $ echo $var1$var2
abcdef   # expected behavior

Then, again,

~/testdrive/dir1 $ echo $var1$fcount
abc 5  # space between

I've seen many tips how to remove whitespace from strings, however I do not understand why it is there in the first place. I am assuming it has to do with fcount=$(ls -l | wc -l) but how?  Any ideas?

Body:
Bash variables are untyped. Try this:

fcount=$(ls | wc -l)

echo $fcount          # check it
469                   # it looks ok, but...

echo "$fcount"        # ... when quoted properly
     469              # it has leading spaces! UGH!

Try again, but this time tell bash it's an integer:

declare -i fcount     # Tell bash it's an integer
fcount=$(ls | wc -l)  # set it
echo "$fcount"        # check value with correct quoting
469                   # and it's correct

Or, if you don't like that method, you can tell bash to replace all spaces with nothing/emptiness.

string="   abc  |"

echo "$string"           # display string as is
   abc  |

echo "${string// /}"     # delete all spaces in string
abc|


问:
IBM CDC AS400 w/ Encryption
I would like to confirm whether it is possible to have encrypted data transfer from AS400 to the target as Apache Kafka on a cloud.  As far as I know, there is no such option for IBM Series-i but available on Linux and Windows.

So, it is not possible to configure IBM data replication (CDC) with:

AS400 (Journal) -> Access Server / Apply Agent -> Kafka on AWS

There is a big concerns for the security for MQ w/o encryption.  Even there is a secured tunnel, but it is not allowed to have un-encrypted message (only the VPN is secure).  Actually, I am still thinking of any possible workaround for this case.

答:
I'm a developer with the IBM CDC team.

Regarding AS400 encrypted data transfer, there is no such option available at the moment. However, we do have a Request for Feature Enhancement (RFE) to enable this scenario: https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=45264. The development team will prioritize this feature enhancement based on customer interest.

Regarding security concerns, one option could be keeping all of the CDC components in the datacenter, behind a firewall and secured, and apply to Kafka using remote TLS connection.

CDC uses Kafka 1.1.1 client library to write to Kafka. If Kafka on AWS supports this jar as a producer, then CDC can write to it.

Title: IBM CDC AS400 w/ Encryption


问:
@RequestParam with any value
I have the following metod in my @Restcontroller:

```<code>@GetMapping
public List<User> getByParameterOrAll(
        @RequestParam(value = "email", required = false) String email,
        @RequestParam(value = "phone", required = false) String phone) {

    List<User> userList;
    if ((email != null && !email.isEmpty()) && (phone == null || phone.isEmpty())) {
        userList = super.getByEmail(email);
    } else if ((email == null || email.isEmpty()) && (phone != null)) {
        userList = super.getByPhone(phone);
    } else {
        userList = super.getAll();
    }
    return userList;
}
</code>```

This method allows to handle following GET-requests:

```<code>GET:   /customers/
GET:   /customers?email=emai@email.com
GET:   /customers?phone=8-812-872-23-34
</code>```

But if necessary to add some more parameters for request. If it will be 10 or... 20 params,body of above method arrise outrageously!
If there any way to pass value of @RequestParam to the method-body, I could realize, for example:

```<code>@GetMapping
public List<User> getByParameterOrAll(
        @RequestParam(value = "any", required = false) String any) {

    if (value=="email") {
        userList = super.getByEmail(email);
    } else if (value=="email") {
        userList = super.getByPhone(email);
    } else if .....
}
</code>```

Is there any way to use @RequestParam-value in method-body?

答:
@RequestParam

When an @RequestParam annotation is declared as a Map
  or MultiValueMap, without a parameter name specified
  in the annotation, then the map is populated with the request
  parameter values for each given parameter name.

```<code>@GetMapping
public List<User> getByParameterOrAll(@RequestParam Map<String, String> parameters){
....
}
</code>```

will get you all the parameters and values as a map.

Title: @RequestParam with any value

Body:
I have the following metod in my @Restcontroller:

@GetMapping
public List<User> getByParameterOrAll(
        @RequestParam(value = "email", required = false) String email,
        @RequestParam(value = "phone", required = false) String phone) {

    List<User> userList;
    if ((email != null && !email.isEmpty()) && (phone == null || phone.isEmpty())) {
        userList = super.getByEmail(email);
    } else if ((email == null || email.isEmpty()) && (phone != null)) {
        userList = super.getByPhone(phone);
    } else {
        userList = super.getAll();
    }
    return userList;
}

This method allows to handle following GET-requests:

GET:   /customers/
GET:   /customers?email=emai@email.com
GET:   /customers?phone=8-812-872-23-34

But if necessary to add some more parameters for request. If it will be 10 or... 20 params,body of above method arrise outrageously!
If there any way to pass value of @RequestParam to the method-body, I could realize, for example:

@GetMapping
public List<User> getByParameterOrAll(
        @RequestParam(value = "any", required = false) String any) {

    if (value=="email") {
        userList = super.getByEmail(email);
    } else if (value=="email") {
        userList = super.getByPhone(email);
    } else if .....
}

Is there any way to use @RequestParam-value in method-body?

Body:
@RequestParam

When an @RequestParam annotation is declared as a Map
  or MultiValueMap, without a parameter name specified
  in the annotation, then the map is populated with the request
  parameter values for each given parameter name.

@GetMapping
public List<User> getByParameterOrAll(@RequestParam Map<String, String> parameters){
....
}

will get you all the parameters and values as a map.


问:
Drag an drop with array of objects
I have two arrays of objects, an A and a B.

I have a kind of list of each one and I intend to drag the objects from A to B and from B to A.

My problem is that when I drag all objects from A to B or from B to A, when trying to pass an object to the empty list, it stops working.

```<code>drop(event: CdkDragDrop<string[]>) {
    if (event.previousContainer === event.container) {
      moveItemInArray(
        event.container.data,
        event.previousIndex,
        event.currentIndex
      );
    } else {
      transferArrayItem(
        event.previousContainer.data,
        event.container.data,
        event.previousIndex,
        event.currentIndex
      );
    }
  }
</code>```

答:
If the box-list get empty the height will be 0px of the div where the event is attached:

The solution is to add a height property with 100% :

```<code>style="height:100%"
</code>```

Try this :

```<code><div class="six" style=" height: 75%;">
  <div class="card-deck cardsZone">
    <div class="card myCards">
      <div class="card-body" style="overflow-y: auto;"  #activeList="cdkDropList"
      class="box-list" style="height:100%"
      cdkDropList
      cdkDropListOrientation="vertical"
      [cdkDropListData]="A"
      [cdkDropListConnectedTo]="[inactiveList]"
      (cdkDropListDropped)="drop($event)">
        <div *ngFor="let nw of A" cdkDrag>
        <div class="card mysmallCcards">
          <div class="card-body">
                   <span>{{nw.name}}</span>
          </div>
        </div>
        </div>
      </div>
    </div>
    <div class="card myCards">
      <div class="card-body" style="overflow-y: auto;" #inactiveList="cdkDropList"
      class="box-list" style="height:100%"
      cdkDropList
      cdkDropListOrientation="vertical"
      [cdkDropListData]="B"
      [cdkDropListConnectedTo]="[activeList]"
      (cdkDropListDropped)="drop($event)">
        <div *ngFor="let pr of B" cdkDrag>
        <div class="card mysmallCcards">
          <div class="card-body">
           <span>{{pr.name}}</span>
          </div>
        </div>
        </div>
      </div>
    </div>
  </div>
</div>
</code>```

Title: Drag an drop with array of objects

Body:
I have two arrays of objects, an A and a B.

I have a kind of list of each one and I intend to drag the objects from A to B and from B to A.

My problem is that when I drag all objects from A to B or from B to A, when trying to pass an object to the empty list, it stops working.

drop(event: CdkDragDrop<string[]>) {
    if (event.previousContainer === event.container) {
      moveItemInArray(
        event.container.data,
        event.previousIndex,
        event.currentIndex
      );
    } else {
      transferArrayItem(
        event.previousContainer.data,
        event.container.data,
        event.previousIndex,
        event.currentIndex
      );
    }
  }

Body:
If the box-list get empty the height will be 0px of the div where the event is attached:

The solution is to add a height property with 100% :

style="height:100%"

Try this :

<div class="six" style=" height: 75%;">
  <div class="card-deck cardsZone">
    <div class="card myCards">
      <div class="card-body" style="overflow-y: auto;"  #activeList="cdkDropList"
      class="box-list" style="height:100%"
      cdkDropList
      cdkDropListOrientation="vertical"
      [cdkDropListData]="A"
      [cdkDropListConnectedTo]="[inactiveList]"
      (cdkDropListDropped)="drop($event)">
        <div *ngFor="let nw of A" cdkDrag>
        <div class="card mysmallCcards">
          <div class="card-body">
                   <span>{{nw.name}}</span>
          </div>
        </div>
        </div>
      </div>
    </div>
    <div class="card myCards">
      <div class="card-body" style="overflow-y: auto;" #inactiveList="cdkDropList"
      class="box-list" style="height:100%"
      cdkDropList
      cdkDropListOrientation="vertical"
      [cdkDropListData]="B"
      [cdkDropListConnectedTo]="[activeList]"
      (cdkDropListDropped)="drop($event)">
        <div *ngFor="let pr of B" cdkDrag>
        <div class="card mysmallCcards">
          <div class="card-body">
           <span>{{pr.name}}</span>
          </div>
        </div>
        </div>
      </div>
    </div>
  </div>
</div>


答:
It works for me :

```<code> $ name='john'
 $ age='5'
 $ echo "${name}${age}"
john5
</code>```

I am using :

```<code>GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
</code>```

Please try to replicate this in your version. Otherwise this might work too :

```<code>$ newvalue=$( printf "%s%s\n" $name $age )
$ echo "$newvalue"
john5
</code>```

Title: avoid spaces when concatenating variables in bash under macos

Body:
It works for me :

 $ name='john'
 $ age='5'
 $ echo "${name}${age}"
john5

I am using :

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.

Please try to replicate this in your version. Otherwise this might work too :

$ newvalue=$( printf "%s%s\n" $name $age )
$ echo "$newvalue"
john5


问:
How can I use SetEnvIf based on matches in the query string?
The URL I'm using is, let's say, example.com/subdir/index.php?foo=bar

index.php contains this: <?php echo getenv("testenvvar"); ?>

I'm setting an enviroment variable in .htaccess like so:

SetEnvIf Request_URI (index) TestEnv=Worked

This prints "Worked".

If I change it to SetEnvIf Request_URI (bar) TestEnv=Worked, it does not.

How can I do this?

答:
Let me explain more detailed how I applied it.

Assume we want to add a X-Robots-Tag header when the following URL is being requested:
https://example.com/?whatever=true

This can be achieved by adding the following rules to the .htaccess file:

```<code>RewriteEngine On
RewriteCond %{QUERY_STRING} /?whatever=true$ [NC]
RewriteRule ^ - [E=NOINDEXFOLLOW:true]
Header set X-Robots-Tag "noindex, follow" env=NOINDEXFOLLOW
</code>```

Body:
Let me explain more detailed how I applied it.

Assume we want to add a X-Robots-Tag header when the following URL is being requested:
https://example.com/?whatever=true

This can be achieved by adding the following rules to the .htaccess file:

RewriteEngine On
RewriteCond %{QUERY_STRING} /?whatever=true$ [NC]
RewriteRule ^ - [E=NOINDEXFOLLOW:true]
Header set X-Robots-Tag "noindex, follow" env=NOINDEXFOLLOW


问:
Access front camera in android devices using flex-android
There are samples to show how to aceess front camera of android devices using android sdk.Is there any way to do the same using flex hero sdk</p>

答:
Yes, although I'm not sure which version of the AIR SDK that was added to.  Some method somewhere returns an array, and the first item is the back camera and the second item is the front camera.

If I were to guess, I'd say that you use the Camera class..  This blog post should give you more information.


问:
adb -s 192.168.1.6:5555 ..... error: more than one device/emulator
I am working with react native, and would like to switch adb to wifi for easier debugging.

I connect my device using usb, then type these commands.

```<code>adb tcpip 5555
</code>```

Then I disconnect my usb cable and enter this command

```<code>adb connect 192.168.1.6
connected to 192.168.1.6:5555
</code>```

adb devices result in the following

```<code>adb devices
List of devices attached
192.168.1.6:5555        device
</code>```

So it only shows one device connected.
However trying this command

```<code>adb reverse tcp:8081 tcp:8081
</code>```

gives me the following error even though only one device is shown with adb devices command as shown above

```<code>error: more than one device/emulator
</code>```

So I tried this command but I also get the same error

```<code>adb -s 192.168.1.6:5555 reverse tcp:8081 tcp:8081
error: more than one device/emulator
</code>```

Trying the following gives me the same error

```<code>adb -s "192.168.1.6:5555" reverse tcp:8081 tcp:8081
adb -s "192.168.1.6" reverse tcp:8081 tcp:8081
adb -s 192.168.1.6 reverse tcp:8081 tcp:8081
</code>```

even trying to use the device id which I copied when it was connected to usb resulted in the same error

```<code>adb -s deviceid reverse tcp:8081 tcp:8081
</code>```

Is there a way to make adb reverse work when adb is connected wireless?

Thanks for advance.

答:
I made two changes to the steps to get this working.

1) BEFORE disconnecting the wire from my phone, I ran adb reverse tcp:8081 tcp:5555 (note the 5555 port number for the phone) and adb connectMY.PHONE.IP.ADDRESS:5555` (with port number).

Only now did I disconnect the wire.

Then I installed the app, although it probably would work if the app was already installed.

2) After the app was installed and I was getting errors "Unable to load Script” and “Could not connect to development server”,

opened the developer menu (shake the phone with the React Native app open) and selected “Dev Settings”. Selected “Debug server host & port for device” from the menu.

In the window on my phone I entered MY.COMPUTER.IP.ADDRESS:8081

Now I could open/close the app for a reload, and shake -> debug JS remotely.

Body:
I am working with react native, and would like to switch adb to wifi for easier debugging.

I connect my device using usb, then type these commands.

adb tcpip 5555

Then I disconnect my usb cable and enter this command

adb connect 192.168.1.6
connected to 192.168.1.6:5555

adb devices result in the following

adb devices
List of devices attached
192.168.1.6:5555        device

So it only shows one device connected.
However trying this command

adb reverse tcp:8081 tcp:8081

gives me the following error even though only one device is shown with adb devices command as shown above

error: more than one device/emulator

So I tried this command but I also get the same error

adb -s 192.168.1.6:5555 reverse tcp:8081 tcp:8081
error: more than one device/emulator

Trying the following gives me the same error

adb -s "192.168.1.6:5555" reverse tcp:8081 tcp:8081
adb -s "192.168.1.6" reverse tcp:8081 tcp:8081
adb -s 192.168.1.6 reverse tcp:8081 tcp:8081

even trying to use the device id which I copied when it was connected to usb resulted in the same error

adb -s deviceid reverse tcp:8081 tcp:8081

Is there a way to make adb reverse work when adb is connected wireless?

Thanks for advance.


问:
CircleCI: Error unmarshaling return header; nested exception is:
We keep getting the following exception on CircleCI while building out project. Everything runs well when running the job from the CircleCI CLI. Has anyone found a fix / resolution for this?</p>

```<code>Compilation with Kotlin compile daemon was not successful
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
    java.io.EOFException
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:236)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
    at com.sun.proxy.$Proxy104.compile(Unknown Source)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.incrementalCompilationWithDaemon(GradleKotlinCompilerWork.kt:284)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:198)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:141)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:118)
    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:158)
    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:153)
    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:92)
    at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:447)
    at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:355)
    at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(Tasks.kt:312)
    at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:284)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
    at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
    at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
    at java.util.Optional.map(Optional.java:215)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
    at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
    at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
    at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
    at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
    at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
    at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
    at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
    at java.util.Optional.map(Optional.java:215)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
    at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readByte(DataInputStream.java:267)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222)
    ... 110 more

Unable to clear jar cache after compilation, maybe daemon is already down: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
    java.net.ConnectException: Connection refused (Connection refused)
Could not connect to kotlin daemon. Using fallback strategy.
</code>```

答: Yes, we also faced the same issue, increased the memory in jenkins cloud configuration, which fixed the issue.</p>

Body:
We keep getting the following exception on CircleCI while building out project. Everything runs well when running the job from the CircleCI CLI. Has anyone found a fix / resolution for this?

Compilation with Kotlin compile daemon was not successful
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
    java.io.EOFException
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:236)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
    at com.sun.proxy.$Proxy104.compile(Unknown Source)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.incrementalCompilationWithDaemon(GradleKotlinCompilerWork.kt:284)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:198)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:141)
    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:118)
    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:158)
    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:153)
    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:92)
    at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:447)
    at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:355)
    at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(Tasks.kt:312)
    at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:284)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
    at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
    at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
    at java.util.Optional.map(Optional.java:215)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
    at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
    at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
    at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
    at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
    at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
    at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
    at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
    at java.util.Optional.map(Optional.java:215)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
    at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readByte(DataInputStream.java:267)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:222)
    ... 110 more

Unable to clear jar cache after compilation, maybe daemon is already down: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
    java.net.ConnectException: Connection refused (Connection refused)
Could not connect to kotlin daemon. Using fallback strategy.


问:
How to calculate speedup and efficiency in a hybrid CPU and GPU algorithm?
I have an algorithm that I have executed in parallel using only CPU and I have achieved a speedup of 30x. That is, an efficiency equal to 0.93 (efficiency = speedup/cores, i.e. 0.93 = 30/32).
Later I added 2 GPUs (Tesla C2075 of 448 cores each) together to the 32 CPU cores.
To calculate the efficiency including CPUs and GPUs, should I add the amount of GPU cores to the CPU cores? That is, I would calculate the efficiency using 928 cores (32 + 448 + 448 = 928). Or should it be calculated differently?

Speedup and efficiency has been calculated based on what has been said here:
https://software.intel.com/en-us/articles/predicting-and-measuring-parallel-performance

答:
GPUs have bigger "core complex" architectures called "SM" or "CU" with tens of pipelines each. Not "very" similar to "SIMD" of a CPU, they can issue commands in parallel to these pipelines in a "single-threaded" kernel code.

You have counted "cores" in CPU and not SIMD pipelines (which is 4 to 16 times of number of cores) so, it wouldn't be wrong to count SM units of Nvidia or CU of Amd or Slice subset of Intel etc.

Tesla C2075 has 14 SM units so you could add 14 for each GPU (32+14+14).

If you have also used SIMDified code for CPU, then it wouldn't be wrong to count each pipeline of a GPU which is 32 to 192 times the number of SM/CU(like 448 per GPU of yours) (32*SIMD_WIDTH + 448 + 448).

At least this is how I would compute "core efficiency" and "pipeline efficiency". If data transfer to/from GPU is not a bottleneck, efficiency should not drop much after GPUs are added.


问:
Replace value in SQL Table
I like to replace a 'NULL' value in FG_NFG_Selektion column but only in those row where Plant='935S'

Tried:

UPDATE [Table] SET [FG_NFG_Selektion] = REPLACE([FG_NFG_Selektion], 'NULL', 'FG') WHERE [Plant] = '935S'

Message back: 10000 rows affected but still the same 'NULL' is there in the table.

答:
Try with following query</p>

```<code>UPDATE [Table] SET `FG_NFG_Selektion` = 'FG' WHERE `Plant` = '935S' AND `FG_NFG_Selektion` IS NULL;
</code>```

Title: Replace value in SQL Table

Body:
Try with following query

UPDATE [Table] SET `FG_NFG_Selektion` = 'FG' WHERE `Plant` = '935S' AND `FG_NFG_Selektion` IS NULL;