问:
Getting Error 400 Bad Request Error when trying to load non-www website
I'm using Apache2. My server's website (Linode) loads normally only if I include the www.[name].com link. If I use [name].com without the www, I actually receive a page, but it reads the 400 Bad Request Error. Here is my etc/apache2/sites-available files:

website.conf

```<code><VirtualHost *:80>
    ServerName website.com
    ServerAlias www.website.com
    Redirect 301 / https://www.website.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =website.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
</code>```

Here is my website-le-ssl.conf file (for HTTPS/SSL):

```<code><IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName www.website.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /static /home/name/website/static
    <Directory /home/name/website/static>
        Require all granted
    </Directory>

    Alias /media /home/name/website/media
    <Directory /home/name/website/media>
        Require all granted
    </Directory>

    <Directory /home/name/website/website>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIScriptAlias / /home/name/website/website/wsgi.py
    WSGIDaemonProcess django_app python-path=/home/name/website/ python-home=/home/name/website/venv
    WSGIProcessGroup django_app

SSLCertificateFile /etc/letsencrypt/live/name.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/name.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
</code>```

In addition, I do not use .htaccess file, I do not use any other redirect file, and I have already enabled the a2enmod rewrite module. This site sometimes works without the non-www, but there are brief periods of time where it doesn't work and I'm confused as to why it acts this way. Is there a way to get Apache2 to redirect from non-www addresses to www addresses, and how do I make the redirect work ALL the time. Thank you!

Things tried:

I've tried using the RewriteEngine and mod_rewrite on the .htaccess file and I've tried completely restoring everything to default and reconfiguring it all from scratch and tutorials.

Body:
I'm using Apache2. My server's website (Linode) loads normally only if I include the www.[name].com link. If I use [name].com without the www, I actually receive a page, but it reads the 400 Bad Request Error. Here is my etc/apache2/sites-available files:

website.conf

<VirtualHost *:80>
    ServerName website.com
    ServerAlias www.website.com
    Redirect 301 / https://www.website.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =website.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Here is my website-le-ssl.conf file (for HTTPS/SSL):

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName www.website.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /static /home/name/website/static
    <Directory /home/name/website/static>
        Require all granted
    </Directory>

    Alias /media /home/name/website/media
    <Directory /home/name/website/media>
        Require all granted
    </Directory>

    <Directory /home/name/website/website>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIScriptAlias / /home/name/website/website/wsgi.py
    WSGIDaemonProcess django_app python-path=/home/name/website/ python-home=/home/name/website/venv
    WSGIProcessGroup django_app

SSLCertificateFile /etc/letsencrypt/live/name.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/name.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

In addition, I do not use .htaccess file, I do not use any other redirect file, and I have already enabled the a2enmod rewrite module. This site sometimes works without the non-www, but there are brief periods of time where it doesn't work and I'm confused as to why it acts this way. Is there a way to get Apache2 to redirect from non-www addresses to www addresses, and how do I make the redirect work ALL the time. Thank you!

Things tried:

I've tried using the RewriteEngine and mod_rewrite on the .htaccess file and I've tried completely restoring everything to default and reconfiguring it all from scratch and tutorials.


来源: stackexchange

问:
How do I mock auth0 login with jest?
I am trying to create a test that tests user login of the web app. I am using jest, react-testing-library, and auth0-js. I am new to Auth0 and jest in general, so I'm having difficulties on approaching this. I know that I don't want to hit auth0's api from the test itself, so I want to try to mock the webAuth.login call Thanks

Currently, I am getting the following error:

```<code>console.error
      Error: Cross origin http://localhost forbidden
</code>```

My current test looks like this:
`

```<code>import React from "react";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import auth0 from "auth0-js";
import Login from "../../components/login";

jest.mock("auth0-js");

test("Clicking the login button after filling in valid credentials successfully logs a user in", async () => {
    render(<Login goHome={null} />);
    const loginBtn = screen.getByRole("button", { name: "Log in" });
    const emailInput = screen.getByTestId("login-email");
    const passwordInput = screen.getByTestId("login-password");
    fireEvent.change(emailInput, { target: { value: "johndoe@test.com" } });
    fireEvent.change(passwordInput, { target: { value: "Test123!" } });
    fireEvent.click(loginBtn);
  });
</code>```

`

My login component has the following:
`

```<code>const submitHandler = (e: React.SyntheticEvent) => {
    e.preventDefault();
    webAuth.login(
      {
        realm: "Username-Password-Authentication",
        email: form.email,
        password: form.password,
        responseType: "token",
        redirectUri: "http://localhost:3000",
        onRedirecting: () => {
          setErrorMessage("");
          setForm(initialFormValues);
          setSuccess(true);
          setTimeout(() => {
            props.goHome();
          }, 3000);
        },
      },
      (err) => {
        if (err)
          setErrorMessage("Invalid Credentials Provided. Please Try Again.");
      }
    );
  };
</code>```

`

ContentLicense: CC BY-SA 4.0

Title: How do I mock auth0 login with jest?

Body:
I am trying to create a test that tests user login of the web app. I am using jest, react-testing-library, and auth0-js. I am new to Auth0 and jest in general, so I'm having difficulties on approaching this. I know that I don't want to hit auth0's api from the test itself, so I want to try to mock the webAuth.login call Thanks

Currently, I am getting the following error:

console.error
      Error: Cross origin http://localhost forbidden

My current test looks like this:
`

import React from "react";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import auth0 from "auth0-js";
import Login from "../../components/login";

jest.mock("auth0-js");

test("Clicking the login button after filling in valid credentials successfully logs a user in", async () => {
    render(<Login goHome={null} />);
    const loginBtn = screen.getByRole("button", { name: "Log in" });
    const emailInput = screen.getByTestId("login-email");
    const passwordInput = screen.getByTestId("login-password");
    fireEvent.change(emailInput, { target: { value: "johndoe@test.com" } });
    fireEvent.change(passwordInput, { target: { value: "Test123!" } });
    fireEvent.click(loginBtn);
  });

`

My login component has the following:
`

const submitHandler = (e: React.SyntheticEvent) => {
    e.preventDefault();
    webAuth.login(
      {
        realm: "Username-Password-Authentication",
        email: form.email,
        password: form.password,
        responseType: "token",
        redirectUri: "http://localhost:3000",
        onRedirecting: () => {
          setErrorMessage("");
          setForm(initialFormValues);
          setSuccess(true);
          setTimeout(() => {
            props.goHome();
          }, 3000);
        },
      },
      (err) => {
        if (err)
          setErrorMessage("Invalid Credentials Provided. Please Try Again.");
      }
    );
  };

`


问:
App Crashed in the clearbtn TouchUpInside method in Xamarin forms
```<code> <SearchBar Grid.Row="0" Grid.Column="1" HorizontalOptions="StartAndExpand" HorizontalTextAlignment="Start"
                    x:Name="VendorSearch"
                    FontSize="25"
                    BackgroundColor="{StaticResource TextWhiteColor}"
                    Placeholder="Search Vendor Name"
                    Text="{Binding VendorSearchText, Mode=TwoWay}"
                    TextChanged="VendorSearch_TextChanged"
                    VerticalOptions="Center"
                    WidthRequest="400" HeightRequest="50" />

void VendorSearch_TextChanged(System.Object sender, Xamarin.Forms.TextChangedEventArgs e)
    {
        try
        {

            SearchBar sb = (SearchBar)sender;

            if (!string.IsNullOrEmpty(sb.Text))
            {
                vm = (VM)this.BindingContext?.DataContext;
                if (vm != null)
                {
                    vm.VendorSearchCommand.Execute(sb.Text.Trim());
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error {0}", ex.StackTrace);
        }
    }
</code>```

Xamarin Forms App Crashes when we click on the 'x' button to clear text .. Why ??

All Null checks are in place but still it crashes

Body:
 <SearchBar Grid.Row="0" Grid.Column="1" HorizontalOptions="StartAndExpand" HorizontalTextAlignment="Start"
                    x:Name="VendorSearch"
                    FontSize="25"
                    BackgroundColor="{StaticResource TextWhiteColor}"
                    Placeholder="Search Vendor Name"
                    Text="{Binding VendorSearchText, Mode=TwoWay}"
                    TextChanged="VendorSearch_TextChanged"
                    VerticalOptions="Center"
                    WidthRequest="400" HeightRequest="50" />

void VendorSearch_TextChanged(System.Object sender, Xamarin.Forms.TextChangedEventArgs e)
    {
        try
        {

            SearchBar sb = (SearchBar)sender;

            if (!string.IsNullOrEmpty(sb.Text))
            {
                vm = (VM)this.BindingContext?.DataContext;
                if (vm != null)
                {
                    vm.VendorSearchCommand.Execute(sb.Text.Trim());
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error {0}", ex.StackTrace);
        }
    }

Xamarin Forms App Crashes when we click on the 'x' button to clear text .. Why ??

All Null checks are in place but still it crashes


问:
Content Script not working as expected in Chrome Extension
I'm making a chrome extension for personal use that essentially unhides your grade on canvas. I have the manifest v3 and the content script set up, however, the content script logs an empty object when I try to console.log my object. Note: The code isn't complete yet, I'm just testing what I have so far.

I tried to console.log an object I have that contains each assignment group and the respective grade within that group. However the console shows an empty object or nothing at all.

Heres the manifest:

```<code>{
"name": "Grade Revealer",
"version": "1.0.0",
"description": "A cool extension",
"permissions": ["storage", "tabs"],
"manifest_version": 3,
"content_scripts": [
    {
        "matches": ["https://instructure.com/courses/*"],
        "js": ["contentScript.js"]
    }
]
</code>```

}

And heres the content script:

```<code>document.addEventListener('DOMContentLoaded', function(){
console.log('DOM fully loaded and parsed');
let items = document.querySelector("#assigments")
let assGrpGrades = {}

if(items){
    items.querySelectorAll(".student_assignment").forEach((item) => {
        let possiblePoints = parseFloat(item.querySelector(".points_possible").innerText)
        console.log(possiblePoints)
        let pointsScored = parseFloat(item.querySelector(".grade").innerText)
        let group = item.querySelector(".context").innerText
        if(!assGrpGrades.hasOwnProperty(group)){
            assGrpGrades[group] = 0
            assGrpGrades[group + "PossiblePoints"] = 0
        }
        assGrpGrades[group] += pointsScored
        assGrpGrades[group + "PossiblePoints"] += possiblePoints
    })
}

for(let group in Object.keys(assGrpGrades)){
    assGrpGrades[group] = assGrpGrades[group]/assGrpGrades[group + "PossiblePoints"]
}

console.log(assGrpGrades)
</code>```

});

I tried both with and without the DOMContentLoaded event. Thanks for any help.

Edit: Heres version 2 of the code:

```<code>document.addEventListener('DOMContentLoaded', function(){
console.log('DOM fully loaded and parsed');
let items = document.querySelectorAll("#assigments .student_assignment")
let assGrpGrades = {}

if(items){
    items.forEach((item) => {
        let possiblePoints = parseFloat(item.querySelector(".points_possible").innerText)
        let pointsScored = parseFloat(item.querySelector(".grade").innerText)
        let group = item.querySelector(".context").innerText
        if(!assGrpGrades.hasOwnProperty(group)){
            assGrpGrades[group] = {
                pointsScored: 0,
                possiblePoints: 0
            }
        }
        assGrpGrades[group].pointsScored += pointsScored
        assGrpGrades[group].possiblePoints += possiblePoints
    })
}

for(let group in assGrpGrades){
    let totalPointsScored = assGrpGrades[group].pointsScored
    let totalPossiblePoints = assGrpGrades[group].possiblePoints
    assGrpGrades[group].averageScore = totalPointsScored / totalPossiblePoints
}

console.log(assGrpGrades)
</code>```

});

Please let me know if this is better or worse

Body:
I'm making a chrome extension for personal use that essentially unhides your grade on canvas. I have the manifest v3 and the content script set up, however, the content script logs an empty object when I try to console.log my object. Note: The code isn't complete yet, I'm just testing what I have so far.

I tried to console.log an object I have that contains each assignment group and the respective grade within that group. However the console shows an empty object or nothing at all.

Heres the manifest:

{
"name": "Grade Revealer",
"version": "1.0.0",
"description": "A cool extension",
"permissions": ["storage", "tabs"],
"manifest_version": 3,
"content_scripts": [
    {
        "matches": ["https://instructure.com/courses/*"],
        "js": ["contentScript.js"]
    }
]

}

And heres the content script:

document.addEventListener('DOMContentLoaded', function(){
console.log('DOM fully loaded and parsed');
let items = document.querySelector("#assigments")
let assGrpGrades = {}

if(items){
    items.querySelectorAll(".student_assignment").forEach((item) => {
        let possiblePoints = parseFloat(item.querySelector(".points_possible").innerText)
        console.log(possiblePoints)
        let pointsScored = parseFloat(item.querySelector(".grade").innerText)
        let group = item.querySelector(".context").innerText
        if(!assGrpGrades.hasOwnProperty(group)){
            assGrpGrades[group] = 0
            assGrpGrades[group + "PossiblePoints"] = 0
        }
        assGrpGrades[group] += pointsScored
        assGrpGrades[group + "PossiblePoints"] += possiblePoints
    })
}

for(let group in Object.keys(assGrpGrades)){
    assGrpGrades[group] = assGrpGrades[group]/assGrpGrades[group + "PossiblePoints"]
}

console.log(assGrpGrades)

});

I tried both with and without the DOMContentLoaded event. Thanks for any help.

Edit: Heres version 2 of the code:

document.addEventListener('DOMContentLoaded', function(){
console.log('DOM fully loaded and parsed');
let items = document.querySelectorAll("#assigments .student_assignment")
let assGrpGrades = {}

if(items){
    items.forEach((item) => {
        let possiblePoints = parseFloat(item.querySelector(".points_possible").innerText)
        let pointsScored = parseFloat(item.querySelector(".grade").innerText)
        let group = item.querySelector(".context").innerText
        if(!assGrpGrades.hasOwnProperty(group)){
            assGrpGrades[group] = {
                pointsScored: 0,
                possiblePoints: 0
            }
        }
        assGrpGrades[group].pointsScored += pointsScored
        assGrpGrades[group].possiblePoints += possiblePoints
    })
}

for(let group in assGrpGrades){
    let totalPointsScored = assGrpGrades[group].pointsScored
    let totalPossiblePoints = assGrpGrades[group].possiblePoints
    assGrpGrades[group].averageScore = totalPointsScored / totalPossiblePoints
}

console.log(assGrpGrades)

});

Please let me know if this is better or worse


问:
NuGet Restore failing randomly with error code NU3037 and NU3028
I am experiencing some unusual behavior when I build my .NET 6.0 API. Below is the error I'm receiving.

Actual Error:

error NU3037: Package
'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0'
from source 'https://api.nuget.org/v3/index.json': The repository
primary signature validity period has expired. [C:\code\MyApi.sln]

error NU3028: Package
'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0'
from source 'https://api.nuget.org/v3/index.json': The repository
primary signature's timestamping certificate is not trusted by the
trust provider. [C:\code\MyApi.sln]

Complete log/error from build:

```<code>MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':
   Signature type: Repository
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':   Subject Name: CN=NuGet.org Repository by Microsoft, O=NuGet.org Repository by Microsoft, L=Redmond, S=Washington, C=US
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':   SHA256 hash: 0E5F38F57DC1BCC806D8494F4F90FBCEDD988B46760709CBEEC6F4219AA6157D
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':   Valid from: 4/9/2018 7:00:00 PM to 4/14/2021 7:00:00 AM
 C:\code\MyApi\MyApi.csproj : error NU3037: Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature validity period has expired. [C:\code\MyApi.sln]
 C:\code\MyApi\MyApi.csproj : error NU3028: Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature's timestamping certificate is not trusted by the trust provider. [C:\code\MyApi.sln]
   Failed to restore C:\code\MyApi\MyApi.csproj (in 3.35 sec).
</code>```

Anyone know the cause of this? And how do you fix it?

Note: This is happening at random; sometimes, but not usually, rerunning the  build fixes it. The build has been working without issue for months, and I recently started to see this error.

I am running dotnet publish command inside a Docker, if it matters.

DockerFile:

```<code># escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Node/npm Install
RUN write-host "*********** Install node,npm"
ENV NODE_VERSION 16.13.0
RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION); `
Expand-Archive nodejs.zip -DestinationPath C:\; `
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
RUN SETX PATH C:\nodejs
RUN npm config set registry https://registry.npmjs.org/

# Install webpack
RUN write-host "*********** Install webpack"
RUN npm install webpack@4.1.1 -g
RUN npm install webpack-cli@3.2.1 -g

# Add the shared for version build
RUN write-host "*********** Copy shared directory"
COPY shared \shared

# Verify installation
RUN dotnet --version
RUN dotnet --info
RUN node -v
RUN npm -v
RUN webpack -v
#RUN dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
RUN dotnet nuget list source
</code>```

And the actual command in TeamCity to compile the code. This is the where it fails:

```<code>dotnet publish MyApi.sln -o C:\stage
</code>```

Body:
I am experiencing some unusual behavior when I build my .NET 6.0 API. Below is the error I'm receiving.

Actual Error:

error NU3037: Package
'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0'
from source 'https://api.nuget.org/v3/index.json': The repository
primary signature validity period has expired. [C:\code\MyApi.sln]

error NU3028: Package
'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0'
from source 'https://api.nuget.org/v3/index.json': The repository
primary signature's timestamping certificate is not trusted by the
trust provider. [C:\code\MyApi.sln]

Complete log/error from build:

MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':
   Signature type: Repository
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':   Subject Name: CN=NuGet.org Repository by Microsoft, O=NuGet.org Repository by Microsoft, L=Redmond, S=Washington, C=US
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':   SHA256 hash: 0E5F38F57DC1BCC806D8494F4F90FBCEDD988B46760709CBEEC6F4219AA6157D
   Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json':   Valid from: 4/9/2018 7:00:00 PM to 4/14/2021 7:00:00 AM
 C:\code\MyApi\MyApi.csproj : error NU3037: Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature validity period has expired. [C:\code\MyApi.sln]
 C:\code\MyApi\MyApi.csproj : error NU3028: Package 'runtime.win-arm64.runtime.native.System.Data.SqlClient.sni 4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature's timestamping certificate is not trusted by the trust provider. [C:\code\MyApi.sln]
   Failed to restore C:\code\MyApi\MyApi.csproj (in 3.35 sec).

Anyone know the cause of this? And how do you fix it?

Note: This is happening at random; sometimes, but not usually, rerunning the  build fixes it. The build has been working without issue for months, and I recently started to see this error.

I am running dotnet publish command inside a Docker, if it matters.

DockerFile:

# escape=`
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Node/npm Install
RUN write-host "*********** Install node,npm"
ENV NODE_VERSION 16.13.0
RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION); `
Expand-Archive nodejs.zip -DestinationPath C:\; `
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
RUN SETX PATH C:\nodejs
RUN npm config set registry https://registry.npmjs.org/

# Install webpack
RUN write-host "*********** Install webpack"
RUN npm install webpack@4.1.1 -g
RUN npm install webpack-cli@3.2.1 -g

# Add the shared for version build
RUN write-host "*********** Copy shared directory"
COPY shared \shared

# Verify installation
RUN dotnet --version
RUN dotnet --info
RUN node -v
RUN npm -v
RUN webpack -v
#RUN dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
RUN dotnet nuget list source

And the actual command in TeamCity to compile the code. This is the where it fails:

dotnet publish MyApi.sln -o C:\stage


问:
getting dependent variable from data after sm.ols
How can I get what the values (and column name, ideally) of what the model was trying to predict? Ex below:</p>
```<code>import pandas as pd
import numpy as np
import statsmodels.formula.api as sm

np.random.seed(5)

df = pd.DataFrame(np.random.randint(0,100,size=(15, 4)), columns=list('ABCD'))

fm = 'A ~ B + C'
results = sm.ols(formula=fm, data=df).fit()

## this gets columns used for independent variables
df[results.params.index[1:]]

## what can i use to get dep variable from df (or results?)
df[??]
#    A
# 0   99
# 1   73
# 2   30
# 3   15
# 4   44
# 5   47
# 6   18
# 7    1
# 8    5
# 9    4
# 10  31
# 11  83
# 12  30
# 13  65
# 14  78
</code>```

Body:
How can I get what the values (and column name, ideally) of what the model was trying to predict? Ex below:

import pandas as pd
import numpy as np
import statsmodels.formula.api as sm

np.random.seed(5)

df = pd.DataFrame(np.random.randint(0,100,size=(15, 4)), columns=list('ABCD'))

fm = 'A ~ B + C'
results = sm.ols(formula=fm, data=df).fit()

## this gets columns used for independent variables
df[results.params.index[1:]]

## what can i use to get dep variable from df (or results?)
df[??]
#    A
# 0   99
# 1   73
# 2   30
# 3   15
# 4   44
# 5   47
# 6   18
# 7    1
# 8    5
# 9    4
# 10  31
# 11  83
# 12  30
# 13  65
# 14  78


问:
How to use airflow to SSH into a server, activate a conda env and then run a python_callable def that imports from the ssh session
I'm a newbie to airflow.

I'm working with Ubuntu 22.04 server and I need to run a proprietary python lib (import arcpy) that only lives on a windows server 2019. I've made a conda env on the win system and i can ssh into, activate, and run a local(win) python file. I would like to use the python_callable method for parsing out the tasks vs. running an entire py script. Is there a way to do this?

```<code>

def myDef(**context):
    xcom_stdout = context["task_instance"].xcom_pull(task_ids="ssh_conn_task")
    import needed_propority_package
    needed_propority_package.dosomething

    t1 = SSHOperator(

        ssh_conn_id = 'ssh_conn_task',
        command =r"conda activate path/to/conda/env && python",
        task_id='test_ssh_operator1',
        do_xcom_push=True,
        cmd_timeout=600,

    )

    t2 = ShortCircuitOperator(
        task_id='shortcircuitop',
        python_callable=myDef,
        provide_context=True,

    )
</code>```

Body:
I'm a newbie to airflow.

I'm working with Ubuntu 22.04 server and I need to run a proprietary python lib (import arcpy) that only lives on a windows server 2019. I've made a conda env on the win system and i can ssh into, activate, and run a local(win) python file. I would like to use the python_callable method for parsing out the tasks vs. running an entire py script. Is there a way to do this?

def myDef(**context):
    xcom_stdout = context["task_instance"].xcom_pull(task_ids="ssh_conn_task")
    import needed_propority_package
    needed_propority_package.dosomething

    t1 = SSHOperator(

        ssh_conn_id = 'ssh_conn_task',
        command =r"conda activate path/to/conda/env && python",
        task_id='test_ssh_operator1',
        do_xcom_push=True,
        cmd_timeout=600,

    )

    t2 = ShortCircuitOperator(
        task_id='shortcircuitop',
        python_callable=myDef,
        provide_context=True,

    )


问:
Firebase Value Event listener being skipped
When debugging, the program doesn't get into user ref value event listener why would this happen?

I get rid = null but the firebase instantiation is correct from what I can tell.

[text so stack overflow lets me post since there's too much code and no further explanation for the issue]

```<code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.send_message_chat);
    getSupportActionBar().hide();

    String userID = FirebaseAuth.getInstance().getCurrentUser().getUid();

    useref.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot snapshot) {
            for (DataSnapshot snap : snapshot.getChildren()) {
                rid = snap.child("receiverid").getValue(String.class);
            }
        }

        @Override
        public void onCancelled(@NonNull DatabaseError error) {
 throw error.toException();
        }
    });

    rv = findViewById(R.id.rvcahtitems);
    b = findViewById(R.id.chatsendb);
    field = findViewById(R.id.chatfield);
    user = FirebaseAuth.getInstance().getCurrentUser();
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String msg = field.getText().toString();
            if ((!msg.equals("")))
            {
                SendM(user.getUid(), rid, msg);
            }
            else
            {
                Toast.makeText(ChatScreen.this, "Can't send an empty message", Toast.LENGTH_SHORT);
            }
            field.setText("");

        }
    });
    rv.setLayoutManager(new LinearLayoutManager(this));
    readmsgs(userID, rid);
}

</code>```

Body:
When debugging, the program doesn't get into user ref value event listener why would this happen?

I get rid = null but the firebase instantiation is correct from what I can tell.

[text so stack overflow lets me post since there's too much code and no further explanation for the issue]

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.send_message_chat);
    getSupportActionBar().hide();

    String userID = FirebaseAuth.getInstance().getCurrentUser().getUid();

    useref.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot snapshot) {
            for (DataSnapshot snap : snapshot.getChildren()) {
                rid = snap.child("receiverid").getValue(String.class);
            }
        }

        @Override
        public void onCancelled(@NonNull DatabaseError error) {
 throw error.toException();
        }
    });

    rv = findViewById(R.id.rvcahtitems);
    b = findViewById(R.id.chatsendb);
    field = findViewById(R.id.chatfield);
    user = FirebaseAuth.getInstance().getCurrentUser();
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String msg = field.getText().toString();
            if ((!msg.equals("")))
            {
                SendM(user.getUid(), rid, msg);
            }
            else
            {
                Toast.makeText(ChatScreen.this, "Can't send an empty message", Toast.LENGTH_SHORT);
            }
            field.setText("");

        }
    });
    rv.setLayoutManager(new LinearLayoutManager(this));
    readmsgs(userID, rid);
}


问:
Get Stream Chat: Is it possible to hide message from the customers?
I'd like to add messages that are visible only to our support team, but should be hidden on the customer side.

The opposite should also be possible, how can I send a message from the backend straight to the customer but hide it for our support team?

Tried to search about SYSTEM messages but didn't find anything usable.


问:
How to see db tables when using entity framework model first
I have tried to use Entity Framework "model first" in VisualStudio2010, so i created the model with all the entities and the relationships on the .edmx file and generated the database.
but when i open SQL Server management studio i see that a new db was created but with no tables.
Am i supposed to see the tables?</p>

ContentLicense: CC BY-SA 3.0


问:
XCode iOS iPhone Simulator Does Not Connect to app In VSCode and Tanks Internet on Same Computer - Mac Mini M1,
Environment: Mac Mini M1, macOS Ventura 13.1, watchOS 9.1, Xcode 14.2 includes SDK iOS 16.2. Building first app in Expo ~47.0.6 using VSCode. Project compiles and works fine in actual iPhone connected to same network.  However, when I attempt to use the Xcode Simulator from VS Code to by pressing "i" in the terminal window after running locally with "npx expo start" or globally with 'expo start' or even clearing expo cache with expo r -c, I am mostly unsuccessful and the problems start. Simulator is usually automatically opened from the invoking of "i" from the Expo terminal menu and Expo Go is launched on the simulator, but the app will simply sit there with the spinner and finally fail after several minutes. On top of this, the internet to the same computer my project and simulator are on is completely tanked (drops off to zero or close bandwidth) until the simulator is completely closed. Very rarely the project will open on the simulator but the internet tanking is still an issue. Additionally, the Simulator refuses to close completely via the standard means of right clicking on the simulator icon in the Mac Doc and choosing Quit. I can only Force Quit the Simulator to get it to close completely. I greatly appreciate any feedback!

package.json File - React Native Project

```<code> "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-navigation/native": "^6.0.14",
    "@react-navigation/native-stack": "^6.9.2",
    "@reduxjs/toolkit": "^1.9.0",
    "expo": "~47.0.6",
    "expo-status-bar": "~1.4.2",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.5",
    "react-native-dotenv": "^3.4.2",
    "react-native-elements": "^3.4.2",
    "react-native-google-places-autocomplete": "^2.5.1",
    "react-native-maps": "^1.3.2",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.7",
    "react-redux": "^8.0.5",
    "twrnc": "^3.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

</code>```

Recently updated Xcode, macOS to no avail.

Running project locally with "npx expo start" or globally with 'expo start' or even clearing expo cache with expo r -c,

I have been tirelessly searching for a solution.

Body:
Environment: Mac Mini M1, macOS Ventura 13.1, watchOS 9.1, Xcode 14.2 includes SDK iOS 16.2. Building first app in Expo ~47.0.6 using VSCode. Project compiles and works fine in actual iPhone connected to same network.  However, when I attempt to use the Xcode Simulator from VS Code to by pressing "i" in the terminal window after running locally with "npx expo start" or globally with 'expo start' or even clearing expo cache with expo r -c, I am mostly unsuccessful and the problems start. Simulator is usually automatically opened from the invoking of "i" from the Expo terminal menu and Expo Go is launched on the simulator, but the app will simply sit there with the spinner and finally fail after several minutes. On top of this, the internet to the same computer my project and simulator are on is completely tanked (drops off to zero or close bandwidth) until the simulator is completely closed. Very rarely the project will open on the simulator but the internet tanking is still an issue. Additionally, the Simulator refuses to close completely via the standard means of right clicking on the simulator icon in the Mac Doc and choosing Quit. I can only Force Quit the Simulator to get it to close completely. I greatly appreciate any feedback!

package.json File - React Native Project

 "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-navigation/native": "^6.0.14",
    "@react-navigation/native-stack": "^6.9.2",
    "@reduxjs/toolkit": "^1.9.0",
    "expo": "~47.0.6",
    "expo-status-bar": "~1.4.2",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.5",
    "react-native-dotenv": "^3.4.2",
    "react-native-elements": "^3.4.2",
    "react-native-google-places-autocomplete": "^2.5.1",
    "react-native-maps": "^1.3.2",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.7",
    "react-redux": "^8.0.5",
    "twrnc": "^3.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

Recently updated Xcode, macOS to no avail.

Running project locally with "npx expo start" or globally with 'expo start' or even clearing expo cache with expo r -c,

I have been tirelessly searching for a solution.


问:
How can I store the values inputted by the user to the matrix (shiny)
Background:
Basically, I already have a matrix where user can input how many rows the matrix will have and what values are within the matrix. The code below already does that for me.

However, I do not know how and where I can store this matrix.

I wanted a way to store the user-inputted matrix as I'm going to pass it to my QSI program by directly calling the function in my QSI program within the server.

```<code>server <- function(input, output, session) {

  output$simplex_dataPoints <- renderUI({
    #For QSI
    dpc = input$dataPointsCount
    validate(
      need(isTruthy(dpc),label = "rows"),

    )

    matrixInput("matrix1",
                value = matrix(data= 0,
                               nrow= dpc,
                               ncol= 2,
                               dimnames = list(c(1:dpc),c("x","y"))
                ),

                rows = list(
                  n=dpc,
                  names = TRUE,
                  editableNames = FALSE
                ),
                cols = list (
                  n= 2,
                  names = TRUE,
                  editableNames = FALSE
                ),
                class = "numeric")

  })

}
</code>```

I haven't seen any answers here regarding my query so I'm not sure where to start.

Body:
Background:
Basically, I already have a matrix where user can input how many rows the matrix will have and what values are within the matrix. The code below already does that for me.

However, I do not know how and where I can store this matrix.

I wanted a way to store the user-inputted matrix as I'm going to pass it to my QSI program by directly calling the function in my QSI program within the server.

server <- function(input, output, session) {

  output$simplex_dataPoints <- renderUI({
    #For QSI
    dpc = input$dataPointsCount
    validate(
      need(isTruthy(dpc),label = "rows"),

    )

    matrixInput("matrix1",
                value = matrix(data= 0,
                               nrow= dpc,
                               ncol= 2,
                               dimnames = list(c(1:dpc),c("x","y"))
                ),

                rows = list(
                  n=dpc,
                  names = TRUE,
                  editableNames = FALSE
                ),
                cols = list (
                  n= 2,
                  names = TRUE,
                  editableNames = FALSE
                ),
                class = "numeric")

  })

}

I haven't seen any answers here regarding my query so I'm not sure where to start.


问:
Python Google Drive API not creating csv with list of all files within sub-folders
I am trying to get a list of files with names, dates, etc into a csv file from files on my Google Drive folder which has around 15k sub-folders (one level below) within the main folder that have about 1-10 files each that amount to around 65k files in total.

I used the following code in Python to create my csv file which generates the information for all the sub-folders but only about 18k of the individual files within those sub-folders (the most recently uploaded files in those sub-folders).

I am not quite sure why my code is not able to get the list for all the files in those sub-folders. Is there a limit I am hitting that stops me from getting the information for all the files?

Note: The folder I am storing the files is a shared folder but I don't think that should be affecting anything.

```<code>import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage

try:
    import argparse
    flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
    flags = None
import pandas as pd

# If modifying these scopes, delete your previously saved credentials
# at ~/.credentials/drive-python-quickstart.json

SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly'
CLIENT_SECRET_FILE = 'credentials.json'
APPLICATION_NAME = 'Drive API Python Quickstart'

folder_id = '########' # Set to id of the parent folder you want to list (should be the content folder)
folder_list = []
all_folders = []
file_list = []

def get_credentials():
    """Gets valid user credentials from storage.
    If nothing has been stored, or if the stored credentials are invalid,
    the OAuth2 flow is completed to obtain the new credentials.
    Returns:
        Credentials, the obtained credential.
    """

    home_dir = os.path.expanduser('~')
    credential_dir = os.path.join(home_dir, '.credentials')
    if not os.path.exists(credential_dir):
        os.makedirs(credential_dir)
    credential_path = os.path.join(credential_dir,'drive-python-quickstart.json')
    store = Storage(credential_path)
    credentials = store.get()
    if not credentials or credentials.invalid:
        flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
        flow.user_agent = APPLICATION_NAME
        if flags:
            credentials = tools.run_flow(flow, store, flags)
        else:  # Needed only for compatibility with Python 2.6
            credentials = tools.run(flow, store)
        print('Storing credentials to ' + credential_path)
    return credentials

def get_root_folder(): # Gets folder list from original root folder
    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    service = discovery.build('drive', 'v3', http=http)
    results = service.files().list(q="mimeType = 'application/vnd.google-apps.folder' and '"+folder_id+"' in parents",
        pageSize=1000, fields="nextPageToken, files(id, mimeType)", supportsAllDrives=True, includeItemsFromAllDrives=True).execute()
    folders = results.get('files', [])
    if not folders:
        print('No folders found.')
    else:
        for folder in folders:
            id = folder.get('id')
            folder_list.append(id)

def get_all_folders(folder_list): # Creates list of all sub folder under root, keeps going until no folders underneath
    for folder in folder_list:
        additional_folders = []
        credentials = get_credentials()
        http = credentials.authorize(httplib2.Http())
        service = discovery.build('drive', 'v3', http=http)
        results = service.files().list(
            q="mimeType = 'application/vnd.google-apps.folder' and '" +folder+ "' in parents",
            pageSize=1000, fields="nextPageToken, files(id, mimeType)", supportsAllDrives=True, includeItemsFromAllDrives=True).execute()
        items = results.get('files', [])
        for item in items:
            id = item.get('id')
            additional_folders.append(id)
        if not additional_folders:
            pass
        else:
            all_folders.extend(additional_folders)
            folder_list = additional_folders
            get_all_folders(folder_list)

def merge(): # Merges sub folder list with full list
    global full_list
    full_list = all_folders + folder_list
    full_list.append(folder_id)

def get_file_list(): # Runs over each folder generating file list, for files over 1000 uses nextpagetoken to run additional requests, picks up metadata included in the request
    for folder in full_list:
        credentials = get_credentials()
        http = credentials.authorize(httplib2.Http())
        service = discovery.build('drive', 'v3', http=http)
        page_token = None
        while True:
            results = service.files().list(
                q="'" + folder + "' in parents",
                pageSize=1000, fields="nextPageToken, files(name, md5Checksum, mimeType, size, createdTime, modifiedTime, id, parents, trashed)", pageToken=page_token, supportsAllDrives=True, includeItemsFromAllDrives=True).execute()
            items = results.get('files', [])
            for item in items:
                name = item['name']
                checksum = item.get('md5Checksum')
                size = item.get('size', '-')
                id = item.get('id')
                mimeType = item.get('mimeType', '-')
                createdTime = item.get('createdTime', 'No date')
                modifiedTime = item.get('modifiedTime', 'No date')
                parents = item.get('parents')
                trashed = item.get('trashed')
                file_list.append([name, checksum, mimeType, size, createdTime, modifiedTime, id, parents, trashed])
            page_token = results.get('nextPageToken', None)
            if page_token is None:
                break
    files = pd.DataFrame(file_list,columns=['file_name','checksum_md5','mimeType','size', 'date_created', 'date_last_modified','google_id', 'google_parent_id', 'trashed'])
    files.drop(files[files['trashed'] == True].index, inplace=True) #removes files which have True listed in trashed, these are files which had been moved to the recycle bin
    foldernumbers = files['mimeType'].str.contains('application/vnd.google-apps.folder').sum()
    filenumbers = (~files['mimeType'].str.contains('application/vnd.google-apps.folder')).sum()
    print('Number of folders is: ', foldernumbers)
    print('Number of files is: ', filenumbers)
    files.to_csv('D:/GoogleAPIMetadata.csv', index=False)

if __name__ == '__main__':
    print('Collecting folder id list')
    get_root_folder()
    get_all_folders(folder_list)
    merge()
    print('Generating file metadata list')
    get_file_list()
</code>```

Body:
I am trying to get a list of files with names, dates, etc into a csv file from files on my Google Drive folder which has around 15k sub-folders (one level below) within the main folder that have about 1-10 files each that amount to around 65k files in total.

I used the following code in Python to create my csv file which generates the information for all the sub-folders but only about 18k of the individual files within those sub-folders (the most recently uploaded files in those sub-folders).

I am not quite sure why my code is not able to get the list for all the files in those sub-folders. Is there a limit I am hitting that stops me from getting the information for all the files?

Note: The folder I am storing the files is a shared folder but I don't think that should be affecting anything.

import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage

try:
    import argparse
    flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
    flags = None
import pandas as pd

# If modifying these scopes, delete your previously saved credentials
# at ~/.credentials/drive-python-quickstart.json

SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly'
CLIENT_SECRET_FILE = 'credentials.json'
APPLICATION_NAME = 'Drive API Python Quickstart'

folder_id = '########' # Set to id of the parent folder you want to list (should be the content folder)
folder_list = []
all_folders = []
file_list = []

def get_credentials():
    """Gets valid user credentials from storage.
    If nothing has been stored, or if the stored credentials are invalid,
    the OAuth2 flow is completed to obtain the new credentials.
    Returns:
        Credentials, the obtained credential.
    """

    home_dir = os.path.expanduser('~')
    credential_dir = os.path.join(home_dir, '.credentials')
    if not os.path.exists(credential_dir):
        os.makedirs(credential_dir)
    credential_path = os.path.join(credential_dir,'drive-python-quickstart.json')
    store = Storage(credential_path)
    credentials = store.get()
    if not credentials or credentials.invalid:
        flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
        flow.user_agent = APPLICATION_NAME
        if flags:
            credentials = tools.run_flow(flow, store, flags)
        else:  # Needed only for compatibility with Python 2.6
            credentials = tools.run(flow, store)
        print('Storing credentials to ' + credential_path)
    return credentials

def get_root_folder(): # Gets folder list from original root folder
    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    service = discovery.build('drive', 'v3', http=http)
    results = service.files().list(q="mimeType = 'application/vnd.google-apps.folder' and '"+folder_id+"' in parents",
        pageSize=1000, fields="nextPageToken, files(id, mimeType)", supportsAllDrives=True, includeItemsFromAllDrives=True).execute()
    folders = results.get('files', [])
    if not folders:
        print('No folders found.')
    else:
        for folder in folders:
            id = folder.get('id')
            folder_list.append(id)

def get_all_folders(folder_list): # Creates list of all sub folder under root, keeps going until no folders underneath
    for folder in folder_list:
        additional_folders = []
        credentials = get_credentials()
        http = credentials.authorize(httplib2.Http())
        service = discovery.build('drive', 'v3', http=http)
        results = service.files().list(
            q="mimeType = 'application/vnd.google-apps.folder' and '" +folder+ "' in parents",
            pageSize=1000, fields="nextPageToken, files(id, mimeType)", supportsAllDrives=True, includeItemsFromAllDrives=True).execute()
        items = results.get('files', [])
        for item in items:
            id = item.get('id')
            additional_folders.append(id)
        if not additional_folders:
            pass
        else:
            all_folders.extend(additional_folders)
            folder_list = additional_folders
            get_all_folders(folder_list)

def merge(): # Merges sub folder list with full list
    global full_list
    full_list = all_folders + folder_list
    full_list.append(folder_id)

def get_file_list(): # Runs over each folder generating file list, for files over 1000 uses nextpagetoken to run additional requests, picks up metadata included in the request
    for folder in full_list:
        credentials = get_credentials()
        http = credentials.authorize(httplib2.Http())
        service = discovery.build('drive', 'v3', http=http)
        page_token = None
        while True:
            results = service.files().list(
                q="'" + folder + "' in parents",
                pageSize=1000, fields="nextPageToken, files(name, md5Checksum, mimeType, size, createdTime, modifiedTime, id, parents, trashed)", pageToken=page_token, supportsAllDrives=True, includeItemsFromAllDrives=True).execute()
            items = results.get('files', [])
            for item in items:
                name = item['name']
                checksum = item.get('md5Checksum')
                size = item.get('size', '-')
                id = item.get('id')
                mimeType = item.get('mimeType', '-')
                createdTime = item.get('createdTime', 'No date')
                modifiedTime = item.get('modifiedTime', 'No date')
                parents = item.get('parents')
                trashed = item.get('trashed')
                file_list.append([name, checksum, mimeType, size, createdTime, modifiedTime, id, parents, trashed])
            page_token = results.get('nextPageToken', None)
            if page_token is None:
                break
    files = pd.DataFrame(file_list,columns=['file_name','checksum_md5','mimeType','size', 'date_created', 'date_last_modified','google_id', 'google_parent_id', 'trashed'])
    files.drop(files[files['trashed'] == True].index, inplace=True) #removes files which have True listed in trashed, these are files which had been moved to the recycle bin
    foldernumbers = files['mimeType'].str.contains('application/vnd.google-apps.folder').sum()
    filenumbers = (~files['mimeType'].str.contains('application/vnd.google-apps.folder')).sum()
    print('Number of folders is: ', foldernumbers)
    print('Number of files is: ', filenumbers)
    files.to_csv('D:/GoogleAPIMetadata.csv', index=False)

if __name__ == '__main__':
    print('Collecting folder id list')
    get_root_folder()
    get_all_folders(folder_list)
    merge()
    print('Generating file metadata list')
    get_file_list()


问:
Copy and Paste Data From 2 Different Workbooks with the Same Sheet Name
Hi I'm new to VBA and I need help copying and pasting the data from multiple tabs in one main workbook to individual workbooks with the same tab name.

For example, every month I receive a source file that has data in sheets "5532, 6789, 4325, 9999" and I want to copy and paste all the data in each sheet to a correlating workbook based on the same tab name.

main file

Correlating file:

correlatingfile

Is it possible to create a loop to open the main workbook and copy and paste the data from each cost center tab in the main workbook to the correlating cost center workbook. Such as copying and pasting the data from tab 5532 to workbook CC_5532? Sheets from both workbooks have the same names.

This is my code so far to open all the individual cost center workbooks.

```<code>

    Sub CopyandPasteDataFromWBs()

   'reference variables for main wb
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim file As Variant
    Dim mwb As Workbook

    'Current Directory of folder
     ChDir ("C:\Users\user55\OneDrive - DummyOrg Inc\Documents\Working Files")

    'loop through each org
     Dim orgcount As Integer
     For orgcount = 1 To 4

    'Open file dialoge
    file = Application.GetOpenFilename

    'stop loop if user cancels
    If file = False Then
        Exit For
    End If

   Next
   End Sub
</code>```

I just need any helpful advice or support on next steps.

Body:
Hi I'm new to VBA and I need help copying and pasting the data from multiple tabs in one main workbook to individual workbooks with the same tab name.

For example, every month I receive a source file that has data in sheets "5532, 6789, 4325, 9999" and I want to copy and paste all the data in each sheet to a correlating workbook based on the same tab name.

main file

Correlating file:

correlatingfile

Is it possible to create a loop to open the main workbook and copy and paste the data from each cost center tab in the main workbook to the correlating cost center workbook. Such as copying and pasting the data from tab 5532 to workbook CC_5532? Sheets from both workbooks have the same names.

This is my code so far to open all the individual cost center workbooks.

    Sub CopyandPasteDataFromWBs()

   'reference variables for main wb
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim file As Variant
    Dim mwb As Workbook

    'Current Directory of folder
     ChDir ("C:\Users\user55\OneDrive - DummyOrg Inc\Documents\Working Files")

    'loop through each org
     Dim orgcount As Integer
     For orgcount = 1 To 4

    'Open file dialoge
    file = Application.GetOpenFilename

    'stop loop if user cancels
    If file = False Then
        Exit For
    End If

   Next
   End Sub

I just need any helpful advice or support on next steps.


问:
update options without reseting the zoom
I am using React ApexChart in order to show off some data, and I have a switch that shows and hides the data labels. The options are changing without problems, but the zoom level is resetting every time. Is there a way to keep the zoom level when changing the options?

Here is a small preview of the component:

```<code>import Chart from "react-apexcharts";
import React, { useEffect, useState } from 'react';
import { Layout } from "antd";

interface Props {
  series?: ApexAxisChartSeries;
  chartOptiosn?: Record<string, any>;
  [ key: string ]: any;
}

export const DynamicChart: React.FC<Props> = React.memo( ( props: Props ) => {
  const { Content } = Layout;
  const { series, chartOptions, uuid } = props;
  const [ initialRerender, setInitialRerender ] = useState( false );

  useEffect( () => {
    if ( !initialRerender ) {
      setInitialRerender( true );
    }
  }, [ initialRerender ] );

  useEffect( () => {
  }, [] );

  useEffect( () => {
    console.log( chartOptions );
  }, [ chartOptions ] );

  return (
    <Layout>
      <Content>
        <Chart
          options={ { ...structuredClone( chartOptions || {} ), chart: { ...chartOptions.chart, id: uuid } } }
          series={ series }
          type="area"
          height={ 350 }
        />
      </Content>
    </Layout>

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

Here are the options:

```<code>export const defaultOptions: ApexCharts.ApexOptions = {
  series: [],
  chart: {
    animations: {
      enabled: true,
      easing: "linear",
      dynamicAnimation: {
        speed: 300
      }
    },
    toolbar: {
      show: true,
      tools: {
        download: `<svg viewBox="64 64 896 896" focusable: "false" name= "download" theme="outlined"><path d="M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"></path></svg>`,
        selection: false,
        zoom: true,
        zoomin: true,
        zoomout: true,
        pan: true,
        customIcons: []
      },
    },
    zoom: {
      enabled: true
    }
  },
  dataLabels: {
    enabled: false
  },
  yaxis: {
    labels: {
      style: {
        fontSize: "14px",
        fontWeight: 600,
        colors: [ "#8c8c8c" ],
      },
    },
  },
  xaxis: {
    type: "datetime"
  }
};
</code>```

Here is a demo for more depth of the problem that I am facing.

Just zoom in between the 3 seconds interval and after the labels reappear, the zoom is refreshed. Is there a way to stop that in react, or should I seek a vanilla approach and ditch the react solution all together?

Body:
I am using React ApexChart in order to show off some data, and I have a switch that shows and hides the data labels. The options are changing without problems, but the zoom level is resetting every time. Is there a way to keep the zoom level when changing the options?

Here is a small preview of the component:

import Chart from "react-apexcharts";
import React, { useEffect, useState } from 'react';
import { Layout } from "antd";

interface Props {
  series?: ApexAxisChartSeries;
  chartOptiosn?: Record<string, any>;
  [ key: string ]: any;
}

export const DynamicChart: React.FC<Props> = React.memo( ( props: Props ) => {
  const { Content } = Layout;
  const { series, chartOptions, uuid } = props;
  const [ initialRerender, setInitialRerender ] = useState( false );

  useEffect( () => {
    if ( !initialRerender ) {
      setInitialRerender( true );
    }
  }, [ initialRerender ] );

  useEffect( () => {
  }, [] );

  useEffect( () => {
    console.log( chartOptions );
  }, [ chartOptions ] );

  return (
    <Layout>
      <Content>
        <Chart
          options={ { ...structuredClone( chartOptions || {} ), chart: { ...chartOptions.chart, id: uuid } } }
          series={ series }
          type="area"
          height={ 350 }
        />
      </Content>
    </Layout>

  );
} );

Here are the options:

export const defaultOptions: ApexCharts.ApexOptions = {
  series: [],
  chart: {
    animations: {
      enabled: true,
      easing: "linear",
      dynamicAnimation: {
        speed: 300
      }
    },
    toolbar: {
      show: true,
      tools: {
        download: `<svg viewBox="64 64 896 896" focusable: "false" name= "download" theme="outlined"><path d="M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"></path></svg>`,
        selection: false,
        zoom: true,
        zoomin: true,
        zoomout: true,
        pan: true,
        customIcons: []
      },
    },
    zoom: {
      enabled: true
    }
  },
  dataLabels: {
    enabled: false
  },
  yaxis: {
    labels: {
      style: {
        fontSize: "14px",
        fontWeight: 600,
        colors: [ "#8c8c8c" ],
      },
    },
  },
  xaxis: {
    type: "datetime"
  }
};

Here is a demo for more depth of the problem that I am facing.

Just zoom in between the 3 seconds interval and after the labels reappear, the zoom is refreshed. Is there a way to stop that in react, or should I seek a vanilla approach and ditch the react solution all together?


问:
What to do when the package (qpcR) downloads in R but cannot use a function in the package?
I am trying to run an old script and I successfully downloaded the qpcR package. However, it will not let me use the HQIC command. I have tried uninstalling qpcR and reinstalling it. I keep getting the following error down below. What can I do?</p>
```<code>Loading required package: MASS
Warning: package ‘MASS’ was built under R version 4.0.5
Loading required package: minpack.lm
Loading required package: rgl
Loading required package: robustbase
Warning: package ‘robustbase’ was built under R version 4.0.5
Loading required package: Matrix
</code>```

Body:
I am trying to run an old script and I successfully downloaded the qpcR package. However, it will not let me use the HQIC command. I have tried uninstalling qpcR and reinstalling it. I keep getting the following error down below. What can I do?

Loading required package: MASS
Warning: package ‘MASS’ was built under R version 4.0.5
Loading required package: minpack.lm
Loading required package: rgl
Loading required package: robustbase
Warning: package ‘robustbase’ was built under R version 4.0.5
Loading required package: Matrix


问:
Conditionally lag value over multiple rows
I am trying to find cases where one type of error causes multiple sequential instances of a second type of error on a vehicle. For example, if there are two vehicles, 'a' and 'b', and vehicle a has an error of type 1 ('error_1') on day 0, it can cause errors of type 2 ('error_2') on days 1, 2, 3, and 4. I want to create a variable named cascading_error that shows every consecutive error_2 following an error_1. Note that in the case of vehicle b, it is possible to have an error_2 without a preceding error_1, in which case the value for cascading_error should be 0.

Here's what I've tried:

```<code>    vals = [('a',0,1,0),('a',1,0,1),('a',2,0,1),('a',3,0,1),('b',0,0,0),('b',1,0,0),('b',2,0,1), ('b',3,0,1)]
    df = spark.createDataFrame(vals, ['vehicle','day','error_1','error_2'])
    w = Window.partitionBy('vehicle').orderBy('day')
    df = df.withColumn('cascading_error', F.lag(df.error_1).over(w) * df.error_2)
    df = df.withColumn('cascading_error', F.when((F.lag(df.cascading_error).over(w)==1) & (df.error_2==1), F.lit(1)).otherwise(df.cascading_error))
    df.show()
</code>```

This is my result

```<code>| vehicle | day | error_1 | error_2 | cascading_error |
| ------- | --- | ------- | ------- | --------------- |
|       a |   0 |       1 |       0 |            null |
|       a |   1 |       0 |       1 |               1 |
|       a |   2 |       0 |       1 |               1 |
|       a |   3 |       0 |       1 |               0 |
|       a |   4 |       0 |       1 |               0 |
|       b |   0 |       0 |       0 |            null |
|       b |   1 |       0 |       0 |               0 |
|       b |   2 |       0 |       1 |               0 |
|       b |   3 |       0 |       1 |               0 |
</code>```

The code is generating the correct cascading_error value on days 1 and 2 for vehicle a, but not on days 3 and 4, which should also be 1. It seems that the logic of combining cascading_error with error_2 to update cascading_error only works for a single row, not sequential ones.

Body:
I am trying to find cases where one type of error causes multiple sequential instances of a second type of error on a vehicle. For example, if there are two vehicles, 'a' and 'b', and vehicle a has an error of type 1 ('error_1') on day 0, it can cause errors of type 2 ('error_2') on days 1, 2, 3, and 4. I want to create a variable named cascading_error that shows every consecutive error_2 following an error_1. Note that in the case of vehicle b, it is possible to have an error_2 without a preceding error_1, in which case the value for cascading_error should be 0.

Here's what I've tried:

    vals = [('a',0,1,0),('a',1,0,1),('a',2,0,1),('a',3,0,1),('b',0,0,0),('b',1,0,0),('b',2,0,1), ('b',3,0,1)]
    df = spark.createDataFrame(vals, ['vehicle','day','error_1','error_2'])
    w = Window.partitionBy('vehicle').orderBy('day')
    df = df.withColumn('cascading_error', F.lag(df.error_1).over(w) * df.error_2)
    df = df.withColumn('cascading_error', F.when((F.lag(df.cascading_error).over(w)==1) & (df.error_2==1), F.lit(1)).otherwise(df.cascading_error))
    df.show()

This is my result

| vehicle | day | error_1 | error_2 | cascading_error |
| ------- | --- | ------- | ------- | --------------- |
|       a |   0 |       1 |       0 |            null |
|       a |   1 |       0 |       1 |               1 |
|       a |   2 |       0 |       1 |               1 |
|       a |   3 |       0 |       1 |               0 |
|       a |   4 |       0 |       1 |               0 |
|       b |   0 |       0 |       0 |            null |
|       b |   1 |       0 |       0 |               0 |
|       b |   2 |       0 |       1 |               0 |
|       b |   3 |       0 |       1 |               0 |

The code is generating the correct cascading_error value on days 1 and 2 for vehicle a, but not on days 3 and 4, which should also be 1. It seems that the logic of combining cascading_error with error_2 to update cascading_error only works for a single row, not sequential ones.


问:
How to increase the text field size within sanity studio?
How can I increase the height of the text input in sanity studio? when the user enters a lot of text, I would like it to go to the next line making it far easier to read.

I have tried adjusting the row property on the text type, but everything stays on the same line.


问:
Why is my code showing incorrect everytime
I feel stupid for asking this question but I have no idea why this isn't working. It keeps showing incorrect for every time I run the program</p>
```<code>import random
print("Pick a number 1-2")
ry = input()
nmr = random.randrange(0,2)
if ry == nmr:
    print('congrats')
else:
    print('Incorrect')

if ry not in '1,2':
    print('Invalid Input - * 1-2 Input requested* ')
</code>```

Body:
I feel stupid for asking this question but I have no idea why this isn't working. It keeps showing incorrect for every time I run the program

import random
print("Pick a number 1-2")
ry = input()
nmr = random.randrange(0,2)
if ry == nmr:
    print('congrats')
else:
    print('Incorrect')

if ry not in '1,2':
    print('Invalid Input - * 1-2 Input requested* ')


问:
Python script scheduling
I have a Python script that does an HTTP request:

```<code>import requests

# https://discord.com/api/v9/channels/1052679335221411901/messages

payload = {'content': "Smurf Supply Grand opening!\n\nFresh League of Legends NA accounts\n40-50k BE\nEmail "
                      "Unverified\n\nPayment methods: Paypal/Crypto\n\nPrice : 0.85 USD\n\nBulk discounts DM "
                      "ME\n\nGiveaway 10X accounts in bio\n\nhttps://shoppy.gg/@Hijoka "
           }

header = {'authorization': 'MTAzNTMwNDMwNTIxMDcwMzk0Mg.G7ZkQI.SJZUo_4o-_z6fmw0TQUTlWHrTXvhAMSRlWOMN4'}

r = requests.post("https://discord.com/api/v9/channels/1052679335221411901/messages", json=payload, headers=header)
</code>```

I would like this to script to repeat itself every 30 minutes. How would I go about doing this?

Title: Python script scheduling

Body:
I have a Python script that does an HTTP request:

import requests

# https://discord.com/api/v9/channels/1052679335221411901/messages

payload = {'content': "Smurf Supply Grand opening!\n\nFresh League of Legends NA accounts\n40-50k BE\nEmail "
                      "Unverified\n\nPayment methods: Paypal/Crypto\n\nPrice : 0.85 USD\n\nBulk discounts DM "
                      "ME\n\nGiveaway 10X accounts in bio\n\nhttps://shoppy.gg/@Hijoka "
           }

header = {'authorization': 'MTAzNTMwNDMwNTIxMDcwMzk0Mg.G7ZkQI.SJZUo_4o-_z6fmw0TQUTlWHrTXvhAMSRlWOMN4'}

r = requests.post("https://discord.com/api/v9/channels/1052679335221411901/messages", json=payload, headers=header)

I would like this to script to repeat itself every 30 minutes. How would I go about doing this?


问:
Matching values multiple columns in one dataframe with values in multip
I have two dataframes, and I am trying to transfer information from one to the other, based on conditions in multiple columns:

```<code>  df1 = data.frame("Name" = c("John", "Jake", "John", "Jake"), "Date" = c("2020-01-03", "2020-01-02", "2020-01-03", "2020-01-04"))

    df1
Name       Date
1 John 2020-01-03
2 Jake 2020-01-02
3 John 2020-01-03
4 Jake 2020-01-04

df2 = data.frame("Name" = c("John", "Jake", "John", "Jake"), "Date" = c("2020-01-03", "2020-01-01", "2020-01-01", "2020-01-04"), "NewData" = c("Stuff1", "Stuff2", "Stuff3", "Stuff4"))

df2
  Name       Date NewData
1 John 2020-01-03  Stuff1
2 Jake 2020-01-01  Stuff2
3 John 2020-01-01  Stuff3
4 Jake 2020-01-04  Stuff4
</code>```

I'd like to create a new column, df1$NewData.copied, which would get the data from df2$NewData if there is a match of names (df1$Name == df2$Name) and a comparison of a date (df1$Date > df2$Date).

At the end, df1 will look like:

```<code>  Name       Date NewData.copied
1 John 2020-01-03         Stuff3
2 Jake 2020-01-02         Stuff2
3 John 2020-01-03         Stuff3
4 Jake 2020-01-04           <NA>
</code>```

(or "" instead of NA).

I need to keep all the observations in df1, whether there is a match or not.

I've tried using %in% and match+mapply, but I keep getting "longer argument not a multiple of length of shorter" arguments.

Body:
I have two dataframes, and I am trying to transfer information from one to the other, based on conditions in multiple columns:

  df1 = data.frame("Name" = c("John", "Jake", "John", "Jake"), "Date" = c("2020-01-03", "2020-01-02", "2020-01-03", "2020-01-04"))

    df1
Name       Date
1 John 2020-01-03
2 Jake 2020-01-02
3 John 2020-01-03
4 Jake 2020-01-04

df2 = data.frame("Name" = c("John", "Jake", "John", "Jake"), "Date" = c("2020-01-03", "2020-01-01", "2020-01-01", "2020-01-04"), "NewData" = c("Stuff1", "Stuff2", "Stuff3", "Stuff4"))

df2
  Name       Date NewData
1 John 2020-01-03  Stuff1
2 Jake 2020-01-01  Stuff2
3 John 2020-01-01  Stuff3
4 Jake 2020-01-04  Stuff4

I'd like to create a new column, df1$NewData.copied, which would get the data from df2$NewData if there is a match of names (df1$Name == df2$Name) and a comparison of a date (df1$Date > df2$Date).

At the end, df1 will look like:

  Name       Date NewData.copied
1 John 2020-01-03         Stuff3
2 Jake 2020-01-02         Stuff2
3 John 2020-01-03         Stuff3
4 Jake 2020-01-04           <NA>

(or "" instead of NA).

I need to keep all the observations in df1, whether there is a match or not.

I've tried using %in% and match+mapply, but I keep getting "longer argument not a multiple of length of shorter" arguments.


问:
I'm using Selenium in my code, but I keep getting an error. Can anyone help?"
Basically, whenever I run my code it always errors at the part where it says

```<code>username_field = login_form.find_element(By.NAME, 'login_email')

</code>```

Here is the complete source code

```<code>from selenium import webdriver
from selenium.webdriver.common.by import By

# Set the path to the Chrome driver executable
chrome_driver_path = '/path/to/chromedriver'

# Create a new Chrome webdriver
driver = webdriver.Chrome(chrome_driver_path)

# Navigate to the PayPal login page
driver.get('https://www.paypal.com/signin')

# Find all elements with the class 'login-form'
login_form_elements = driver.find_element(By.CLASS_NAME, 'contentContainer')

# Get the first element from the list
login_form = login_form_elements

# Find the username field inside the login form
username_field = login_form.find_element(By.NAME, 'login_email')

# Find the password field inside the login form
password_field = login_form.find_element(By.NAME, 'login_password')

# Fill in the username and password
username_field.send_keys('your_username')
password_field.send_keys('your_password')

# Find the login button and click it
login_button = login_form.find_element_by_id('btnLogin')
login_button.click()

</code>```

I tried everything still doesn't work

Body:
Basically, whenever I run my code it always errors at the part where it says

username_field = login_form.find_element(By.NAME, 'login_email')

Here is the complete source code

from selenium import webdriver
from selenium.webdriver.common.by import By

# Set the path to the Chrome driver executable
chrome_driver_path = '/path/to/chromedriver'

# Create a new Chrome webdriver
driver = webdriver.Chrome(chrome_driver_path)

# Navigate to the PayPal login page
driver.get('https://www.paypal.com/signin')

# Find all elements with the class 'login-form'
login_form_elements = driver.find_element(By.CLASS_NAME, 'contentContainer')

# Get the first element from the list
login_form = login_form_elements

# Find the username field inside the login form
username_field = login_form.find_element(By.NAME, 'login_email')

# Find the password field inside the login form
password_field = login_form.find_element(By.NAME, 'login_password')

# Fill in the username and password
username_field.send_keys('your_username')
password_field.send_keys('your_password')

# Find the login button and click it
login_button = login_form.find_element_by_id('btnLogin')
login_button.click()

I tried everything still doesn't work


问:
File cannot be created in Google Drive from hidden sheet in Google Sheets
I am trying to export a hidden sheet as a PDF to Google Drive. When the sheet is hidden, the file cannot be properly created. When the sheet is not hidden, the PDF export works as expected.

Is this the expected behavior with hidden sheets? If so, what's the best workaround? Do I need to unhide the sheet, create the file, and then hide the sheet again?

Code.gs:

```<code>function exportProfiles() {
  var sheet = SpreadsheetApp.getActive().getSheetByName("Profiles");
  var sheetUrl = SpreadsheetApp.getActive().getUrl();
  var sheetId = '&gid=' + sheet.getSheetId();
  var exportUrl = sheetUrl.replace(/\/edit.*$/, '')
    +'/export?'+'format=pdf'+'&size=letter'+'&portrait=false'+'&fitw=true'
    +'&top_margin=0.75'+'&bottom_margin=0.75'+'&left_margin=0.75'+'&right_margin=0.75'
    +'&sheetnames=false'+'&printtitle=false'+'&pagenum=center'+'&gridlines=false'+'&fzr=false'
    + sheetId;

  var blob = getFileAsBlob(exportUrl);
  blob.setName("My Test File");
  DriveApp.createFile(blob);
}

function getFileAsBlob(exportUrl) {
  let response = UrlFetchApp.fetch(exportUrl, {
    muteHttpExceptions: true,
    headers: {
      Authorization: 'Bearer '+ScriptApp.getOAuthToken(),
    },
  });
  return response.getBlob();
}
</code>```

Body:
I am trying to export a hidden sheet as a PDF to Google Drive. When the sheet is hidden, the file cannot be properly created. When the sheet is not hidden, the PDF export works as expected.

Is this the expected behavior with hidden sheets? If so, what's the best workaround? Do I need to unhide the sheet, create the file, and then hide the sheet again?

Code.gs:

function exportProfiles() {
  var sheet = SpreadsheetApp.getActive().getSheetByName("Profiles");
  var sheetUrl = SpreadsheetApp.getActive().getUrl();
  var sheetId = '&gid=' + sheet.getSheetId();
  var exportUrl = sheetUrl.replace(/\/edit.*$/, '')
    +'/export?'+'format=pdf'+'&size=letter'+'&portrait=false'+'&fitw=true'
    +'&top_margin=0.75'+'&bottom_margin=0.75'+'&left_margin=0.75'+'&right_margin=0.75'
    +'&sheetnames=false'+'&printtitle=false'+'&pagenum=center'+'&gridlines=false'+'&fzr=false'
    + sheetId;

  var blob = getFileAsBlob(exportUrl);
  blob.setName("My Test File");
  DriveApp.createFile(blob);
}

function getFileAsBlob(exportUrl) {
  let response = UrlFetchApp.fetch(exportUrl, {
    muteHttpExceptions: true,
    headers: {
      Authorization: 'Bearer '+ScriptApp.getOAuthToken(),
    },
  });
  return response.getBlob();
}


问:
Flurry and Phonegap for Android: How to use onPageView
has anyone experiences to track the viewing pages in Phonegap App for android with Flurry?

Right now i have to use events. But it makes me unable to view the user path in Flurry Dashboard. Because phonegap app has typically only 1 actvitiy, so it's also not ok when i call  Flurry.onPageView() in my main activity.

There is should be a way to custom the name of the page so that i can track the viewing page event with Flurry.


问:
Cannot implement socketIO pod in Kotlin multiflatform
```<code>cocoapods {
    ios.deploymentTarget = "15.2"

    version = "1.0"

    summary = "This is sample Summary"
    homepage = "Home URL"

    pod("socket.IO")
}
</code>```

While I try make grade sync I got this error. I think I have add some extraOption in pod integration but I don't have any idea.
Maybe problem is that socket.IO uses very old target version and some value type

```<code>Executing of 'xcodebuild -project Pods.xcodeproj -scheme socket.IO -sdk iphoneos -configuration Release' failed with code 65 and message:

^
1 error generated.
In file included from /Users/nekbakhtzabirov/Documents/MarshalKMM/shared/build/cocoapods/synthetic/IOS/Pods/socket.IO/SocketIOTransportWebsocket.m:21:
/Users/nekbakhtzabirov/Documents/MarshalKMM/shared/build/cocoapods/synthetic/IOS/Pods/socket.IO/SocketIOTransportWebsocket.h:23:9: fatal error: could not build module 'SocketRocket'
#import "SRWebSocket.h"
</code>```

Body:
cocoapods {
    ios.deploymentTarget = "15.2"

    version = "1.0"

    summary = "This is sample Summary"
    homepage = "Home URL"

    pod("socket.IO")
}

While I try make grade sync I got this error. I think I have add some extraOption in pod integration but I don't have any idea.
Maybe problem is that socket.IO uses very old target version and some value type

Executing of 'xcodebuild -project Pods.xcodeproj -scheme socket.IO -sdk iphoneos -configuration Release' failed with code 65 and message:

^
1 error generated.
In file included from /Users/nekbakhtzabirov/Documents/MarshalKMM/shared/build/cocoapods/synthetic/IOS/Pods/socket.IO/SocketIOTransportWebsocket.m:21:
/Users/nekbakhtzabirov/Documents/MarshalKMM/shared/build/cocoapods/synthetic/IOS/Pods/socket.IO/SocketIOTransportWebsocket.h:23:9: fatal error: could not build module 'SocketRocket'
#import "SRWebSocket.h"


问:
get the current commit hash from nuxt3/h3 api
In my nuxt2.x project, when I add an API (express) I use to get the current commit hash, it helps me keep tab on the version runing on my server and to keep an history of the deployment:

const cp = require("child_process");

const run = function(command) {
    return cp
        .execSync(command)
        .toString()
        .trim();
};

module.exports = {

    async status (req, res, next) {
        try {

            // get commit hash
            const commit = run('git rev-parse HEAD');

            /* ... */

            res.json({ commit });

        } catch (e) {
            next(e);
        }
    }
};
```

I would like to perform something similar in nuxt3 using the new nitro/h3.js engine, but I don't know how to get the commit hash.

Body:
In my nuxt2.x project, when I add an API (express) I use to get the current commit hash, it helps me keep tab on the version runing on my server and to keep an history of the deployment:

const cp = require("child_process");

const run = function(command) {
    return cp
        .execSync(command)
        .toString()
        .trim();
};

module.exports = {

    async status (req, res, next) {
        try {

            // get commit hash
            const commit = run('git rev-parse HEAD');

            /* ... */

            res.json({ commit });

        } catch (e) {
            next(e);
        }
    }
};

I would like to perform something similar in nuxt3 using the new nitro/h3.js engine, but I don't know how to get the commit hash.


问:
Find and open all files that match name
I have a workspace with a lot of folders. They share a file that I would like to compare. I know I can't compare multiple files at once (wouldn't it be nice) but at least I would like to open the same file from all subfolders and then use Compare Active File with command.

Is this possible? CTRL+P only gives me a possibility to see the results but not to open all of them:

Title: Find and open all files that match name


问:
I'm pulling the data from the api, then I get an error when I delete and post
https://hapi.fhir.org/baseR4/Patient I want to do a get post and delete operation with axios from this api. While performing the get operation successfully, I am getting errors in the delete and post operation.Actually, I think I've solved some of the problem, because the api I got is not an object, I'm getting these errors probably, but I don't know how to convert an api to an object or I don't have the slightest idea how to use the object function, please help me

const client = axios.create({
  baseURL: "https://hapi.fhir.org/baseR4/Patient",
});

const App = () => {
  const [title, setTitle] = useState("");
  const [body, setBody] = useState("");
  const [patients, setPosts] = useState([]);

  // GET with Axios
  useEffect(() => {
    const fetchPost = async () => {
      try {
        let response = await client.get("?_limit=10");
        setPosts(response.data);
      } catch (error) {
        console.log(error);
      }
    };
    fetchPost();
  }, []);

  // DELETE with Axios
  const deletePost = async (id) => {
    try {
      await client.delete(`${id}`);
      setPosts(
        patients.filter((post) => {
          return post.id !== id;
        })
      );
    } catch (error) {
      console.log(error);
    }
  };

  // handle form submission
  const handleSubmit = (e) => {
    e.preventDefault();
    addPosts(title, body);
  };

  // POST with Axios
  const addPosts = async (title, body) => {
    try {
      let response = await client.post("", {
        title: title,
        body: body,
      });
      setPosts([response.data, ...patients]);
      setTitle("");
      setBody("");
    } catch (error) {
      console.log(error);
    }
  };

  return (

POSTS APP

        <form onSubmit={handleSubmit}>
          <input
            type="text"
            className="form-control"
            value={title}
            onChange={(e) => setTitle(e.target.value)}
          />
          <textarea
            name=""
            className="form-control"
            id=""
            cols="10"
            rows="8"
            value={body}
            onChange={(e) => setBody(e.target.value)}
          ></textarea>
          <button type="submit">Add Post</button>
        </form>

All Posts

        {patients?.entry?.map((patient) => (

            {patient?.resource?.address?.map((adr) => {
              return (
                <>

{adr.city}

{adr.postalCode}

                </>
              );
            })}

              <button
                className="delete-btn"
                onClick={() => deletePost(patient.id)}
              >
                Delete
              </button>

        ))}

  );
};

export default App;
```

This is the error I get while doing the delete operation: TypeError: patients.filter is not a function at deletePost (Patient.js:31:1) This is the error I get while doing the add operation POST hapi.fhir.org/baseR4/Patient 400 (Bad Request) AxiosError {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST' –

Body:
https://hapi.fhir.org/baseR4/Patient I want to do a get post and delete operation with axios from this api. While performing the get operation successfully, I am getting errors in the delete and post operation.Actually, I think I've solved some of the problem, because the api I got is not an object, I'm getting these errors probably, but I don't know how to convert an api to an object or I don't have the slightest idea how to use the object function, please help me

const client = axios.create({
  baseURL: "https://hapi.fhir.org/baseR4/Patient",
});

const App = () => {
  const [title, setTitle] = useState("");
  const [body, setBody] = useState("");
  const [patients, setPosts] = useState([]);

  // GET with Axios
  useEffect(() => {
    const fetchPost = async () => {
      try {
        let response = await client.get("?_limit=10");
        setPosts(response.data);
      } catch (error) {
        console.log(error);
      }
    };
    fetchPost();
  }, []);

  // DELETE with Axios
  const deletePost = async (id) => {
    try {
      await client.delete(`${id}`);
      setPosts(
        patients.filter((post) => {
          return post.id !== id;
        })
      );
    } catch (error) {
      console.log(error);
    }
  };

  // handle form submission
  const handleSubmit = (e) => {
    e.preventDefault();
    addPosts(title, body);
  };

  // POST with Axios
  const addPosts = async (title, body) => {
    try {
      let response = await client.post("", {
        title: title,
        body: body,
      });
      setPosts([response.data, ...patients]);
      setTitle("");
      setBody("");
    } catch (error) {
      console.log(error);
    }
  };

  return (

POSTS APP

        <form onSubmit={handleSubmit}>
          <input
            type="text"
            className="form-control"
            value={title}
            onChange={(e) => setTitle(e.target.value)}
          />
          <textarea
            name=""
            className="form-control"
            id=""
            cols="10"
            rows="8"
            value={body}
            onChange={(e) => setBody(e.target.value)}
          ></textarea>
          <button type="submit">Add Post</button>
        </form>

All Posts

        {patients?.entry?.map((patient) => (

            {patient?.resource?.address?.map((adr) => {
              return (
                <>

{adr.city}

{adr.postalCode}

                </>
              );
            })}

              <button
                className="delete-btn"
                onClick={() => deletePost(patient.id)}
              >
                Delete
              </button>

        ))}

  );
};

export default App;

This is the error I get while doing the delete operation: TypeError: patients.filter is not a function at deletePost (Patient.js:31:1) This is the error I get while doing the add operation POST hapi.fhir.org/baseR4/Patient 400 (Bad Request) AxiosError {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST' –


Title: radius in nn2() function in RANN r-package

Body:
I was trying to use the solution offered here to find all the location from df which are within the 70 km distance from my point of interest userLocation=c(6.9,55.2), but it does not work properly !

    df = structure(list(lng = c(6.2694184, 6.25737207, 6.23839104, 6.25844252,
6.22595901, 6.21351832, 6.2010845, 6.1886414, 6.1762058, 6.1637609,
6.15132287, 6.13887619, 6.12643637, 6.14361895, 6.16332364, 6.18302157,
6.2027276, 6.22242688, 6.24213488, 6.26842752, 6.26745135, 6.24518597,
6.26645948, 6.24420242, 6.22357831, 6.26548171, 6.24321746, 6.2226023,
6.20041884, 6.18070459, 6.16099845, 6.16716672, 6.17960629, 6.18686265,
6.2078525, 6.19203657, 6.20447434, 6.21691835, 6.2293537, 6.24179593,
6.26009321, 6.26448764, 6.2422317, 6.21927538, 6.20186455, 6.26350828,
6.24124514, 6.22028969, 6.26251321, 6.2402584, 6.23404584, 6.26153227,
6.22171658, 5.94065657, 6.10363006, 6.11606487, 6.12850589, 6.14093826,
6.15337749, 6.16582359, 6.17826103, 6.19070472, 6.20313974, 6.20009703,
5.96044213, 5.96988333, 5.98023582, 5.98966667, 5.99910246, 6.00003829,
6.00947365, 6.01889843, 6.02832882, 6.01983402, 6.02925771, 6.038687,
6.0481219, 6.05754688, 6.03963788, 6.04906608, 6.05848435, 6.06792377,
6.07735326, 6.08677283, 6.05941948, 6.06885218, 6.07829049, 6.08771889,
6.09713671, 6.10657633, 6.11600538, 6.07922538, 6.08864707, 6.10756108,
6.12000483, 6.13243993, 6.12019786, 6.14488189, 6.15733073, 6.16977091,
6.16621949, 6.13805015, 6.13652024, 5.941545, 6.20491484, 6.18423897,
6.17806466, 6.16355552, 6.15738696, 6.14558294, 6.14286638, 6.13670293,
6.12217027, 6.11601258, 6.10148275, 6.09533146, 6.08080511, 6.07464337,
6.06011984, 6.03729438, 6.05394895, 6.02546329, 6.0136389, 6.03674112,
6.05743408, 6.07812006, 6.09879971, 6.11948795, 6.11063647, 6.08914275,
6.08440881, 6.0018212, 6.02491713, 5.98999461, 6.01308427, 5.97815849,
6.00125809, 5.96632973, 5.98943792, 5.9995124, 6.02119838, 6.04364466,
6.0223476, 6.04560587, 6.03821257, 6.06131821, 6.06046748, 5.97888909,
5.95766873, 6.24771247, 6.04931495, 6.25538943, 6.23227728, 6.25434093,
6.25329159, 6.25225759, 6.25120656, 6.25015469, 6.24911757, 6.06338238,
6.08539205, 6.10756976, 6.12975108, 6.15193667, 6.17411029, 6.19630377,
6.21848591, 6.22602495, 6.23123663, 6.20931486, 6.23019515, 6.20826628,
6.22915282, 6.20721685, 6.22810966, 6.21962063, 6.20209266, 6.20618216,
6.19702482, 6.1799057, 6.15772301, 6.13554395, 6.11336914, 6.09118237,
6.09738412, 6.11958004, 6.12698723, 6.14767387, 6.16835417, 6.18613747,
6.185096, 6.165456, 6.14476821, 6.15765091, 6.23561071, 6.08001353,
6.22353732, 6.2376767, 6.21143885, 6.19936347, 6.18727866, 6.17520066,
6.16311385, 6.15103386, 6.13894506, 6.12686243, 6.11478725, 6.10270261,
6.09818625, 6.12128852, 6.2468456, 6.22571713, 6.24558662, 6.22445138,
6.24434288, 6.22320086, 6.24308194, 6.22194875, 6.24182062, 6.22068065,
6.24057332, 6.21942655, 6.2113264, 6.22341814, 6.19699748, 6.18490568,
6.1988361, 6.17283631, 6.16074252, 6.14867115, 6.13657473, 6.13954049,
6.16263694, 6.18482009, 6.20327221, 6.20009595, 6.19278885, 6.17005571
), lat = c(54.67598304, 54.83924292, 54.83162024, 54.82483795,
54.82033259, 54.80904336, 54.79775292, 54.78646988, 54.77517665,
54.76389082, 54.75260377, 54.74131515, 54.73002531, 54.72096456,
54.71392047, 54.70687309, 54.69983176, 54.69278713, 54.68573957,
54.68934722, 54.7027117, 54.69910571, 54.71606682, 54.71246092,
54.70614626, 54.72943123, 54.72582507, 54.71951053, 54.71576339,
54.72280423, 54.72985112, 54.74274399, 54.75402944, 54.73569581,
54.72983408, 54.7653223, 54.77660496, 54.78789538, 54.79918423,
54.81047187, 54.80230996, 54.74279524, 54.73918917, 54.74155047,
54.75043676, 54.75615956, 54.75255324, 54.75849353, 54.76951451,
54.76590829, 54.77879358, 54.78287875, 54.84106585, 54.79004116,
54.73264696, 54.7439301, 54.755221, 54.76651031, 54.77779842,
54.78908531, 54.80037062, 54.81166369, 54.82295519, 54.83631649,
54.78306731, 54.79535153, 54.77609951, 54.7883729, 54.80065457,
54.76912877, 54.78140068, 54.7936805, 54.80595963, 54.7621547,
54.77443373, 54.78671208, 54.79898973, 54.81126633, 54.75518666,
54.76746422, 54.77974071, 54.7920169, 54.80429202, 54.81656608,
54.74821493, 54.76049101, 54.7727664, 54.78504073, 54.79732298,
54.80959594, 54.82187682, 54.74124062, 54.75351485, 54.76118719,
54.77247897, 54.78376916, 54.79513973, 54.79505815, 54.80634591,
54.8176321, 54.8309898, 54.82587825, 54.81251828, 54.80340625,
54.85043439, 54.85669012, 54.84379843, 54.8629602, 54.85006754,
54.83850747, 54.86921769, 54.85633303, 54.87548056, 54.86259492,
54.88174916, 54.86885358, 54.88800555, 54.8751176, 54.89427628,
54.89688611, 54.88137801, 54.88534048, 54.87379377, 54.87235508,
54.86608859, 54.85982748, 54.85356275, 54.84730376, 54.83491117,
54.82992904, 54.84309445, 54.86224596, 54.86080945, 54.85069668,
54.84926234, 54.8391549, 54.83771415, 54.82760306, 54.82617384,
54.81401612, 54.81866848, 54.82193287, 54.83203, 54.85454492,
54.8418856, 54.84463218, 54.83126946, 54.807705, 54.81314447,
54.95082492, 54.90870481, 54.85261135, 54.8544958, 54.86597391,
54.87933643, 54.89269028, 54.90605271, 54.91941509, 54.93277779,
54.91930405, 54.92337651, 54.92712528, 54.93087901, 54.93462874,
54.93838307, 54.94213376, 54.94588009, 54.93325056, 54.86785843,
54.86365241, 54.88122101, 54.87701472, 54.89458354, 54.890377,
54.90794604, 54.9204011, 54.92916856, 54.90373959, 54.91606989,
54.92541899, 54.92166542, 54.91791682, 54.91416421, 54.91041621,
54.89753741, 54.90128459, 54.88863077, 54.8823668, 54.87609923,
54.88468492, 54.89804726, 54.89094652, 54.89720452, 54.90830415,
55.08370977, 54.93641839, 55.07226944, 55.06170442, 55.06083624,
55.04939327, 55.03795778, 55.02652115, 55.01508302, 55.00364374,
54.99220296, 54.98077001, 54.96932695, 54.95789135, 54.94469353,
54.94333719, 54.96418243, 54.9585686, 54.97754901, 54.9719349,
54.99090692, 54.98529252, 55.00427341, 54.99865908, 55.01763087,
55.01201625, 55.03099761, 55.02538271, 55.03790915, 55.04934232,
55.02208092, 55.01064489, 54.99998971, 54.99920808, 54.98776941,
54.97632995, 54.9648976, 54.95153594, 54.95007267, 54.95382515,
54.96186591, 54.98662348, 54.97394968, 54.97118391)), class = "data.frame", row.names = c(NA,
-238L))

What I have done is as follow :
Add the point of interest to the beginning of df

df = rbind(userLocation,df)

Set the radius to 0.64 since according to here, every 0.1 is equivalent to 11.1 km !

radius <- 0.64
      #Identifying neighbors
      res <- nn2(df, k=nrow(df), searchtype="radius", radius = radius)

Since my point of interest is the first row in df I would expect all the non zero index in the first row are the points within my 70 km threshold

 Ind <- res$nn.idx[1,][res$nn.idx[1,]>0]

My Ind object has just one  value!

 Ind
[1] 1

but if I plot the data, all of the points are within 70 km distance :

I would appreciate it if someone could help me here.


问:
Mockito Inject mock into Spy object
```<code>Class A {
    B b;
    C c;
}

Class C {
    D d;
    E e;
}
</code>```

I want to write unit test for A but I do not want to mock methods of C. However, I do want to mock D and E in C.

I have tried these options:
Option 1:

```<code>@Mock B b;
@Mock D d;
@Mock E e;
@Spy @InjectMocks C c;
@InjectMocks A a;
</code>```

Option 2:

```<code>@Mock B b;
@Mock D d;
@Mock E e;
@Spy C c = Mockito.spy(new C(d,e));
@InjectMocks A a;
</code>```

Option 3:
suggestions in Mockito Inject mock into Spy object

None of the options are working for me. Will appreciate any help.

Title: Mockito Inject mock into Spy object

Body:
Class A {
    B b;
    C c;
}

Class C {
    D d;
    E e;
}

I want to write unit test for A but I do not want to mock methods of C. However, I do want to mock D and E in C.

I have tried these options:
Option 1:

@Mock B b;
@Mock D d;
@Mock E e;
@Spy @InjectMocks C c;
@InjectMocks A a;

Option 2:

@Mock B b;
@Mock D d;
@Mock E e;
@Spy C c = Mockito.spy(new C(d,e));
@InjectMocks A a;

Option 3:
suggestions in Mockito Inject mock into Spy object

None of the options are working for me. Will appreciate any help.