问:
curl doesn't send (the last line) cookie from file
Platform: Windows7

Test with http://httpbin.org

Set a cookie in the browser http://httpbin.org/cookies/set/name/value

I use the EditThisCookie Chrome extension to output the cookie into Netscape HTTP Cookie format (select Netscape HTTP cookie file in the EditThisCookie settings ).

filename: cookie

```<code># Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by EditThisCookie
httpbin.org FALSE   /   FALSE   0   name    value
</code>```

In Powershell, I run

```<code>curl "http://httpbin.org/cookies" -H "Proxy-Connection: keep-alive" -H "Pragma: no-cache" -H "Cache-Control: no-cache" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" --compressed --insecure -b cookie --verbose -o bb.html
</code>```

The cookie is not sent according the verbose information (No HTTP cookie header is shown in request)

答:
Only  the last line cookie won't be sent if you don't add an extra blank line.

Solution:

Add an extra blank line in the file.

```<code># Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by EditThisCookie
httpbin.org FALSE   /   FALSE   0   name    value

</code>```

Then it works.

https://github.com/curl/curl/issues/4946

Body:
Platform: Windows7

Test with http://httpbin.org

Set a cookie in the browser http://httpbin.org/cookies/set/name/value

I use the EditThisCookie Chrome extension to output the cookie into Netscape HTTP Cookie format (select Netscape HTTP cookie file in the EditThisCookie settings ).

filename: cookie

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by EditThisCookie
httpbin.org FALSE   /   FALSE   0   name    value

In Powershell, I run

curl "http://httpbin.org/cookies" -H "Proxy-Connection: keep-alive" -H "Pragma: no-cache" -H "Cache-Control: no-cache" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" --compressed --insecure -b cookie --verbose -o bb.html

The cookie is not sent according the verbose information (No HTTP cookie header is shown in request)

Body:
Only  the last line cookie won't be sent if you don't add an extra blank line.

Solution:

Add an extra blank line in the file.

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by EditThisCookie
httpbin.org FALSE   /   FALSE   0   name    value

Then it works.

https://github.com/curl/curl/issues/4946


来源: stackexchange

问:
Calculating average of list from certain point in list?
I have a question, I know that it is possible to calculate the average of a list but is it possible to calculate average but from a certain point?

For example:

```<code>def Average(lst):
    return sum(lst) / len(lst)

list = [2, 8, 6, 7, 3, 2, 1]
average = Average(lst)
</code>```

Printing average of the list:

```<code>print("Average of the list =", round(average, 2))
</code>```

Output:
    Average of the list = 4.14

Say we want to keep the first 3 values and average the rest to have only 4 values in the list

So my new list is:

```<code>list = [2, 8, 6, 7, 3, 2, 1]
new_list = [2, 8, 6, 12.25]
</code>```

Edit 1

Thank you all for your answers. I have another question, say, I don't know the length of my list and I just want 4 elements in my new list. How could I tackle this?

答:
Suppose you want to round off the list from an index (Here 3)

```<code>mylist = [2, 8, 6, 7, 3, 2, 1]

def round_list(lst, index):
    avg = [sum(lst[int(index):])/(len(lst)-index)]
    new_lst = (lst[:int(index)]) + avg
    return new_lst

new_list = round_list(mylist, 3)
print(new_list)
</code>```

output : [2, 8, 6, 3.25]

ContentLicense: CC BY-SA 4.0

Body:
I have a question, I know that it is possible to calculate the average of a list but is it possible to calculate average but from a certain point?

For example:

def Average(lst):
    return sum(lst) / len(lst)

list = [2, 8, 6, 7, 3, 2, 1]
average = Average(lst)

Printing average of the list:

print("Average of the list =", round(average, 2))

Output:
    Average of the list = 4.14

Say we want to keep the first 3 values and average the rest to have only 4 values in the list

So my new list is:

list = [2, 8, 6, 7, 3, 2, 1]
new_list = [2, 8, 6, 12.25]

Edit 1

Thank you all for your answers. I have another question, say, I don't know the length of my list and I just want 4 elements in my new list. How could I tackle this?

Body:
Suppose you want to round off the list from an index (Here 3)

mylist = [2, 8, 6, 7, 3, 2, 1]

def round_list(lst, index):
    avg = [sum(lst[int(index):])/(len(lst)-index)]
    new_lst = (lst[:int(index)]) + avg
    return new_lst

new_list = round_list(mylist, 3)
print(new_list)

output : [2, 8, 6, 3.25]


问:
Delete closest tr and it's childs
I have the following code where I can delete the closest tr using delete function, but I want to create another function called delete-contato where it would delete the closest tr and its children that is all "email" and "telefone" associated with that "contato".

```<code>$(wrapper).on("click", ".delete-contato", function(e) {
        e.preventDefault();
        $(this).closest('tr').empty();

        x--;
    })

</code>```

This is the fiddle with the scenario and here's  snippet:

// funcao para adicionar um novo input no Contato
$(document).ready(function() {
  var max_fields = 99;
  var wrapper = $(".container-contato");
  var add_button = $(".add-contato");
  var add_email = $(".add-email");
  var add_telefone = $(".add-telefone");

  var x = 1;

  $(add_email).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $(wrapper).append(`

            <input type="text" name="contato_rpps.email['${x}']" placeholder="Outro Email"/>

              Delete

      `)
    }
  });

  $(add_telefone).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $(wrapper).append(`

            <input type="text" class="telefone" name="contato_rpps.telefone['${x}']" maxlength="15" onkeyup="phoneMask()" placeholder="Outro Telefone"/>

              Delete

      `)
    }
  });

  $(add_button).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $(wrapper).append(`

              <input type="text" class="nome" name="contato_rpps.nome['${x}']"/>

              <input type="text" name="contato_rpps.cargo['${x}']"/>

              <input type="text" name="contato_rpps.email['${x}']"/>

              <input type="text" class="telefone" name="contato_rpps.telefone['${x}']" maxlength="15" onkeyup="phoneMask()"/>

              Delete

          `); //add input box

    } else {
      alert('You Reached the limits')
    }
  });

  $(wrapper).on("click", ".delete", function(e) {
    e.preventDefault();
    $(this).closest('tr').empty();

    x--;
  })

  $(wrapper).on("click", ".delete-contato", function(e) {
    e.preventDefault();

    x--;
  })
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button class="add-contato">Novo Contato
              <span style="font-size:16px; font-weight:bold;">+ </span>
            </button>
<button type="button" class="add-email">Novo Email
              <span style="font-size:16px; font-weight:bold;">+ </span>
            </button>
<button type="button" class="add-telefone">Novo Telefone
              <span style="font-size:16px; font-weight:bold;">+ </span>
            </button>
<div>
  <table>
    <tbody class="container-contato">
      <tr>
        <td>
          <label><br>Nome</label>
          <input type="text" name="contato_rpps.nome['1']" class="nome">
          <br>
        </td>
        <td>
          <label><br>Cargo</label>
          <input type="text" name="contato_rpps.cargo['1']" class="cargo">
        </td>
        <td>
          <label><br>Email</label>
          <input type="email" name="contato_rpps.email['1']" class="email">
        </td>
        <td>
          <label><br>Telefone</label>
          <input type="text" class="telefone" placeholder="(00) 90000-0000" onkeyup="phoneMask()" name="contato_rpps.telefone['1']" maxlength="15">
        </td>
      </tr>
    </tbody>
  </table>
</div></code>```

I don't think i explained what i want cleary so.. when you press Novo Contato a new set of inputs is created and then you press Novo Email or Novo Telefone. So after press delete on Contanto i want all those new inputs to be deleted. Nome, Cargo, Email, Telefone and others Outros Emails and Outros Telefone generated.

Right now when you delete Contato, Outro Telefone and Outro Email stays.

答:
You need to assign identifiers to the child rows.  I did so for the email contact which you can see in my fiddle below.  You need to apply the same methods to your phone button click.

Notice I added "data-row-id" to your TRs and class names to link rows with it's parents.

Working Fiddle: https://jsfiddle.net/54uLrj8k/

```<code> $(document).on("click", ".delete-contato", function(e) {
    e.preventDefault();
    $btn = $(this)
    $tr = $(this).closest('tr');
    $id = $tr.attr('data-row-id');
    $('.child-row-' + $id).remove();
    $tr.remove();

    x--;
  });

 $(add_email).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $lastContact = $('tbody.container-contato tr.row-main:last');
      $id = $lastContact.attr('data-row-id');

      $(wrapper).append(`
        <tr class="child-row child-row-${$id} email-row" data-row-id="${$id}">
          <td>
            <input type="text" name="contato_rpps.email['${x}']" placeholder="Outro Email"/>
          </td>
          <td>
              <a href="#" class="delete">Delete</a>
          </td>
        </tr>
      `)
    }
  });
</code>```

Title: Delete closest tr and it's childs

Body:
I have the following code where I can delete the closest tr using delete function, but I want to create another function called delete-contato where it would delete the closest tr and its children that is all "email" and "telefone" associated with that "contato".

$(wrapper).on("click", ".delete-contato", function(e) {
        e.preventDefault();
        $(this).closest('tr').empty();

        x--;
    })

This is the fiddle with the scenario and here's  snippet:

// funcao para adicionar um novo input no Contato
$(document).ready(function() {
  var max_fields = 99;
  var wrapper = $(".container-contato");
  var add_button = $(".add-contato");
  var add_email = $(".add-email");
  var add_telefone = $(".add-telefone");

  var x = 1;

  $(add_email).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $(wrapper).append(`

            <input type="text" name="contato_rpps.email['${x}']" placeholder="Outro Email"/>

              Delete

      `)
    }
  });

  $(add_telefone).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $(wrapper).append(`

            <input type="text" class="telefone" name="contato_rpps.telefone['${x}']" maxlength="15" onkeyup="phoneMask()" placeholder="Outro Telefone"/>

              Delete

      `)
    }
  });

  $(add_button).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $(wrapper).append(`

              <input type="text" class="nome" name="contato_rpps.nome['${x}']"/>

              <input type="text" name="contato_rpps.cargo['${x}']"/>

              <input type="text" name="contato_rpps.email['${x}']"/>

              <input type="text" class="telefone" name="contato_rpps.telefone['${x}']" maxlength="15" onkeyup="phoneMask()"/>

              Delete

          `); //add input box

    } else {
      alert('You Reached the limits')
    }
  });

  $(wrapper).on("click", ".delete", function(e) {
    e.preventDefault();
    $(this).closest('tr').empty();

    x--;
  })

  $(wrapper).on("click", ".delete-contato", function(e) {
    e.preventDefault();

    x--;
  })
});

<button class="add-contato">Novo Contato
              +
            </button>
<button type="button" class="add-email">Novo Email
              +
            </button>
<button type="button" class="add-telefone">Novo Telefone
              +
            </button>

Nome
          <input type="text" name="contato_rpps.nome['1']" class="nome">

Cargo
          <input type="text" name="contato_rpps.cargo['1']" class="cargo">

Email
          <input type="email" name="contato_rpps.email['1']" class="email">

Telefone
          <input type="text" class="telefone" placeholder="(00) 90000-0000" onkeyup="phoneMask()" name="contato_rpps.telefone['1']" maxlength="15">

I don't think i explained what i want cleary so.. when you press Novo Contato a new set of inputs is created and then you press Novo Email or Novo Telefone. So after press delete on Contanto i want all those new inputs to be deleted. Nome, Cargo, Email, Telefone and others Outros Emails and Outros Telefone generated.

Right now when you delete Contato, Outro Telefone and Outro Email stays.

Body:
You need to assign identifiers to the child rows.  I did so for the email contact which you can see in my fiddle below.  You need to apply the same methods to your phone button click.

Notice I added "data-row-id" to your TRs and class names to link rows with it's parents.

Working Fiddle: https://jsfiddle.net/54uLrj8k/

 $(document).on("click", ".delete-contato", function(e) {
    e.preventDefault();
    $btn = $(this)
    $tr = $(this).closest('tr');
    $id = $tr.attr('data-row-id');
    $('.child-row-' + $id).remove();
    $tr.remove();

    x--;
  });

 $(add_email).click(function(e) {
    e.preventDefault();
    if (x < max_fields) {
      x++;
      $lastContact = $('tbody.container-contato tr.row-main:last');
      $id = $lastContact.attr('data-row-id');

      $(wrapper).append(`
        <tr class="child-row child-row-${$id} email-row" data-row-id="${$id}">
          <td>
            <input type="text" name="contato_rpps.email['${x}']" placeholder="Outro Email"/>
          </td>
          <td>
              <a href="#" class="delete">Delete</a>
          </td>
        </tr>
      `)
    }
  });


问:
Postman - JWT authentication using key file
I am trying to use Postman to test API developed on Google Cloud Platform: App Engine behind an API endpoint.

I have the key file in the JSON format:

```<code>{
  "type": "service_account",
  "project_id": "[[my_project_name]]",
  "private_key_id": "[[private_key_id]]",
  "private_key": "-----BEGIN PRIVATE KEY-----\n[[private_key]]\n-----END PRIVATE KEY-----\n",
  "client_email": "[[service_account_email]]",
  "client_id": "",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[[service_account_email]]"
}
</code>```

And I am able to retrieve access token using python code:

```<code>import time
import google.auth.crypt
import google.auth.jwt

sa_keyfile='[[path_to_the_api_key_file]]'
sa_email='[[service_account_email]]'
audience='[[my_api_url]]'
expiry_length=3600
now = int(time.time())
payload = {
    'iat': now,
    "exp": now + expiry_length,
    'iss': sa_email,
    'aud':  audience,
    'sub': sa_email,
    'email': sa_email
}

signer = google.auth.crypt.RSASigner.from_service_account_file(sa_keyfile)
jwt = google.auth.jwt.encode(signer, payload)

print(jwt)
</code>```

If I setup in Postman OAuth 2.0 as authentication method and paste obtained JWT as Access Token then request is working just fine.

I would like to move whole JWT token operation into the Postman, without need to invoke Python code in advance. I tried to use Get New Access Token from Postman, but neither option supports JSON key file.

Is it possible to get JWT token from JSON key file using Postman only?

答:
You can try authenticating with Oauth making HTTP requests with Postman. The process would be the following:

Create a JSON Web Token yourself which includes a header, a claim
set, and a signature. (The signature would require the private key from the service account key.json file)

Then request an access token from the Google OAuth 2.0 Authorization
Server.

Afterwards get the access token from the JSON response that the

Authorization Server returns.

It is explained in this link.

I think it can be done. Either way, I don't see this as a practical solution if it has to be done frequently.

Body:
I am trying to use Postman to test API developed on Google Cloud Platform: App Engine behind an API endpoint.

I have the key file in the JSON format:

{
  "type": "service_account",
  "project_id": "[[my_project_name]]",
  "private_key_id": "[[private_key_id]]",
  "private_key": "-----BEGIN PRIVATE KEY-----\n[[private_key]]\n-----END PRIVATE KEY-----\n",
  "client_email": "[[service_account_email]]",
  "client_id": "",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[[service_account_email]]"
}

And I am able to retrieve access token using python code:

import time
import google.auth.crypt
import google.auth.jwt

sa_keyfile='[[path_to_the_api_key_file]]'
sa_email='[[service_account_email]]'
audience='[[my_api_url]]'
expiry_length=3600
now = int(time.time())
payload = {
    'iat': now,
    "exp": now + expiry_length,
    'iss': sa_email,
    'aud':  audience,
    'sub': sa_email,
    'email': sa_email
}

signer = google.auth.crypt.RSASigner.from_service_account_file(sa_keyfile)
jwt = google.auth.jwt.encode(signer, payload)

print(jwt)

If I setup in Postman OAuth 2.0 as authentication method and paste obtained JWT as Access Token then request is working just fine.

I would like to move whole JWT token operation into the Postman, without need to invoke Python code in advance. I tried to use Get New Access Token from Postman, but neither option supports JSON key file.

Is it possible to get JWT token from JSON key file using Postman only?


问:
Installing guided LDA package with pip on Windows
I am trying to pip install guidedlda on Windows. I installed Microsoft Visual Studio as installation requires it. When I the command I get Microsoft Visual Studio\\2019\\Community\\VC\\14.24.28314\\bin\\Hostx86x64\\c1.exe failed with exit status 2 error
Any ideas about how to solve it?

For full error please see: github.com/vi3k6i5/GuidedLDA/issues/43
(I also tried to implement suggested solution: copy pasting guidedlda.py, utils.py, datasets.py and the few NYT data set items into the original LDA package, did not really work)

答:
This happened to me as well. Apparently there are issues on setting up guidedlda on windows OS.
Please check out this repo https://github.com/dex314/GuidedLDA_WorkAround
And follow instructions on the readme.
I was able to successfully set up guidedlda through that. :-)</p>


问:
Update dropdown list Google Forms with C#
I am using code to read information from Google Sheets (results from Google Forms) with C# but now I want to update a dropdown list for a specific Google forms with C#. I have seen code where you can update a dropdown list with google app script (https://developers.google.com/apps-script/reference/forms )but I can not find code to do this within C#. It is possible within C# to update a google sheet so you should think it is possible to do the same with Google Forms. Does anyone done this?
The example i have found is very simple within app script</p>

```<code>var existingForm = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var item = form.getitembyid(3567489);
var values = ["oranges", "Tomatoes"]
item.asListItem().setChoicesValues(values);
</code>```

答:
There is no Forms API, so you cannot do this directly with C#. Because of this, the only option, if you want to do this programmatically, is using Apps Script.

There are workarounds, though, to "wrap" the Apps Script, and call it remotely from your C# program:

Workaround #1 (Apps Script Web App):

You could publish your script as a web app and use this as a URL endpoint that you will access with your C# application. The web app would receive the HTTP requests from your application, and edit the form. For example, you could do a POST request with data about the items you want to edit, and use the corresponding event object to retrieve that information. It could be something along these lines:

function doPost(e) {
  var formId = e.parameter.id; // Your form id
  var itemId = e.parameter.itemId; // Your item id
  var form = FormApp.openById(formId);
  var item = form.getItemById(itemId);
  var values = e.parameters.values; // ["oranges", "Tomatoes"]
  item.asListItem().setChoicesValues(values);
}
```

Workaround #2 (Apps Script API):

Another way, if you want to edit your form remotely from your C# application, is to use Apps Script API to create and run the Apps Script project that contains the code for editing the form. Beware, this is not an easy way, and it would take several steps:

Get access to the Form via OAuth 2.0.

Using this library, create a project with Apps Script API, by using the method projects.create. I'd suggest you to create a project that is bound to the Form, so that you don't need to authorize the script when it's time to execute it. If you do that, you would need to specify the parentId in your request body (and in your script you could use FormApp.getActiveForm() instead, which wouldn't require authorization).

Using the scriptId retrieved from the response in previous step, call projects.updateContent, in which you would have to add the code corresponding to the files in your project.

Call scripts.run to execute your code an update your form. If you have created a standalone script in step 2, you will have to authorize your project via OAuth 2.0.

Reference:

Apps Script Web Apps

Using OAuth 2.0 to Access Google APIs

Google Apps Script API

Apps Script API Client Library for .NET

Body:
I am using code to read information from Google Sheets (results from Google Forms) with C# but now I want to update a dropdown list for a specific Google forms with C#. I have seen code where you can update a dropdown list with google app script (https://developers.google.com/apps-script/reference/forms )but I can not find code to do this within C#. It is possible within C# to update a google sheet so you should think it is possible to do the same with Google Forms. Does anyone done this?
The example i have found is very simple within app script

var existingForm = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var item = form.getitembyid(3567489);
var values = ["oranges", "Tomatoes"]
item.asListItem().setChoicesValues(values);

Body:
There is no Forms API, so you cannot do this directly with C#. Because of this, the only option, if you want to do this programmatically, is using Apps Script.

There are workarounds, though, to "wrap" the Apps Script, and call it remotely from your C# program:

Workaround #1 (Apps Script Web App):

You could publish your script as a web app and use this as a URL endpoint that you will access with your C# application. The web app would receive the HTTP requests from your application, and edit the form. For example, you could do a POST request with data about the items you want to edit, and use the corresponding event object to retrieve that information. It could be something along these lines:

function doPost(e) {
  var formId = e.parameter.id; // Your form id
  var itemId = e.parameter.itemId; // Your item id
  var form = FormApp.openById(formId);
  var item = form.getItemById(itemId);
  var values = e.parameters.values; // ["oranges", "Tomatoes"]
  item.asListItem().setChoicesValues(values);
}

Workaround #2 (Apps Script API):

Another way, if you want to edit your form remotely from your C# application, is to use Apps Script API to create and run the Apps Script project that contains the code for editing the form. Beware, this is not an easy way, and it would take several steps:

Get access to the Form via OAuth 2.0.

Using this library, create a project with Apps Script API, by using the method projects.create. I'd suggest you to create a project that is bound to the Form, so that you don't need to authorize the script when it's time to execute it. If you do that, you would need to specify the parentId in your request body (and in your script you could use FormApp.getActiveForm() instead, which wouldn't require authorization).

Using the scriptId retrieved from the response in previous step, call projects.updateContent, in which you would have to add the code corresponding to the files in your project.

Call scripts.run to execute your code an update your form. If you have created a standalone script in step 2, you will have to authorize your project via OAuth 2.0.

Reference:

Apps Script Web Apps

Using OAuth 2.0 to Access Google APIs

Google Apps Script API

Apps Script API Client Library for .NET


问:
Gitlab CI: Trigger different child pipelines from parent pipeline based on directory of changes
I would like to use Parent\Child pipilens https://docs.gitlab.com/ee/ci/parent_child_pipelines.html in this way.
I have this source structure:

```<code>- backend
--- .gitlab-ci.yml
--- src
- frontend
--- .gitlab-ci.yml
--- src
-.gitlab-ci.yml
</code>```

I want to trigger backend or frontend .gitlab-ci.yml based on the path where new commit happens: if it happend on frontend, only frontend.gitlab-ci.yml should be used for build\publish.

Is it possible?

答:
You can specify to execute different pipelines based on where the changes in the code occurred using the only: changes configuration documented here.

You can therefor specify to execute a pipeline frontend only if changes happen within the frontend folder (analog for `backend).

You can use the include: local feature (documented here) to include the frontend/.gitlab-ci.yml-file within the pipeline for the frontend that is defined in the root .gitlab-ci.yml.
For examples on how to exactly configure the pipeline so that it triggers a configuration provided in a local file, please see here.

Parent-child pipelines also support the only: changes configuration as documented here.

Body:
I would like to use Parent\Child pipilens https://docs.gitlab.com/ee/ci/parent_child_pipelines.html in this way.
I have this source structure:

- backend
--- .gitlab-ci.yml
--- src
- frontend
--- .gitlab-ci.yml
--- src
-.gitlab-ci.yml

I want to trigger backend or frontend .gitlab-ci.yml based on the path where new commit happens: if it happend on frontend, only frontend.gitlab-ci.yml should be used for build\publish.

Is it possible?


问:
Dynamically change color to lighter or darker by percentage CSS
We have a big application on the site and we have a few links which are, let's say blue color like the blue links on this site. Now I want to make some other links, but with lighter color. Obviously I can just do simply by the hex code adding in the CSS file, but our site lets user decide what colors they want for their customized profile/site (like Twitter).

So, my question is: can we reduce the color by percentage?

Let's say the following code is CSS:

a {
  color: blue;
}

a.lighter {
  color: -50%; /* obviously not correct way, but just an idea */
}
```
<p>OR</p>
<pre class="lang-css prettyprint-override"><code>a.lighter {
  color: blue -50%;  /* again not correct, but another example of setting color and then reducing it */
}
</code>```

Is there a way to reduce a color by a percentage?

答:
if you decide to use http://compass-style.org/, a sass-based css framework, it provides very useful darken() and lighten() sass functions to dynamically generate css. it's very clean:

```<code>@import compass/utilities

$link_color: #bb8f8f
a
  color: $link_color
a:visited
  color: $link_color
a:hover
  color: darken($link_color,10)
</code>```

generates

```<code>a {
  color: #bb8f8f;
}

a:visited {
  color: #bb8f8f;
}

a:hover {
  color: #a86f6f;
}
</code>```

Body:
We have a big application on the site and we have a few links which are, let's say blue color like the blue links on this site. Now I want to make some other links, but with lighter color. Obviously I can just do simply by the hex code adding in the CSS file, but our site lets user decide what colors they want for their customized profile/site (like Twitter).

So, my question is: can we reduce the color by percentage?

Let's say the following code is CSS:

a {
  color: blue;
}

a.lighter {
  color: -50%; /* obviously not correct way, but just an idea */
}

OR

a.lighter {
  color: blue -50%;  /* again not correct, but another example of setting color and then reducing it */
}

Is there a way to reduce a color by a percentage?

Body:
if you decide to use http://compass-style.org/, a sass-based css framework, it provides very useful darken() and lighten() sass functions to dynamically generate css. it's very clean:

@import compass/utilities

$link_color: #bb8f8f
a
  color: $link_color
a:visited
  color: $link_color
a:hover
  color: darken($link_color,10)

generates

a {
  color: #bb8f8f;
}

a:visited {
  color: #bb8f8f;
}

a:hover {
  color: #a86f6f;
}

ContentLicense: CC BY-SA 3.0


问:
Select columns based on != condition
I have a dataframe and I have a list of some column names that correspond to the dataframe. How do I filter the dataframe so that it != the list of column names, i.e. I want the dataframe columns that are outside the specified list.

I tried the following:
quant_vair = X != true_binary_cols

but get the output error of: Unable to coerce to Series, length must be 545: given 155

Been battling for hours, any help will be appreciated.

答:
It will help:</p>

```<code>df.drop(columns = ["col1", "col2"])
</code>```

Title: Select columns based on != condition

Body:
It will help:

df.drop(columns = ["col1", "col2"])


问:
Read <body> tag of HTML file using C#
I need to get all the content inside the body tag of an HTML file using C#. Are there any good and effective ways of doing this?</p>

答:
Reading the Html Structure into Html String and Getting the Body Tag content using C# without HtmlAgility packages

```<code>       private void Button_Click(object sender, RoutedEventArgs e)
        {
            string filepath = @"C:\Users\Testing\Documents\sample1.txt";
            string htmlString = File.ReadAllText(filepath);
            string htmlTagPattern = "<.*?>";
            Regex oRegex = new Regex(".*?<body.*?>(.*?)</body>.*?", RegexOptions.Multiline);
            htmlString = oRegex.Replace(htmlString, string.Empty);
            htmlString = Regex.Replace(htmlString, htmlTagPattern, string.Empty);
            htmlString = Regex.Replace(htmlString, @"^\s+$[\r\n]*", "", RegexOptions.Multiline);
            htmlString = htmlString.Replace(" ", string.Empty);
        }
</code>```

Title: Read <body> tag of HTML file using C#

Body:
Reading the Html Structure into Html String and Getting the Body Tag content using C# without HtmlAgility packages

       private void Button_Click(object sender, RoutedEventArgs e)
        {
            string filepath = @"C:\Users\Testing\Documents\sample1.txt";
            string htmlString = File.ReadAllText(filepath);
            string htmlTagPattern = "<.*?>";
            Regex oRegex = new Regex(".*?<body.*?>(.*?)</body>.*?", RegexOptions.Multiline);
            htmlString = oRegex.Replace(htmlString, string.Empty);
            htmlString = Regex.Replace(htmlString, htmlTagPattern, string.Empty);
            htmlString = Regex.Replace(htmlString, @"^\s+$[\r\n]*", "", RegexOptions.Multiline);
            htmlString = htmlString.Replace("&nbsp;", string.Empty);
        }


问:
How to create circle progressBar on Android Wear
How can i create circle progress bar on wear border like on video(1:30)? This is built-in widget or custom? I didn't find any information about this.
screen from video</p>

答:
If you scroll down about half way through this page you'll see the XAML for the Circular Progress Bar:
https://developer.android.com/reference/android/widget/ProgressBar.html

```<code><ProgressBar
  android:id="@+id/indeterminateBar"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />
</code>```

The IndeterminateBar is default to Circle as it's undefined the actual 'Progress'

Body:
If you scroll down about half way through this page you'll see the XAML for the Circular Progress Bar:
https://developer.android.com/reference/android/widget/ProgressBar.html

<ProgressBar
  android:id="@+id/indeterminateBar"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />

The IndeterminateBar is default to Circle as it's undefined the actual 'Progress'