问:
minikube - not able to access EXTERNAL-IP
I am using minikube on Windows 10 with docker driver.

I installed dvwa-web by following this guide: https://github.com/cytopia/docker-dvwa/tree/master/k8s

Got it installed, and this is the output:

```<code>kubectl get svc
NAME                 TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)          AGE
dvwa-mysql-service   ClusterIP      10.104.172.238   <none>          3306/TCP         69s
dvwa-web-service     LoadBalancer   10.106.62.70     192.168.49.20   8081:30789/TCP   69s
kubernetes           ClusterIP      10.96.0.1        <none>          443/TCP          7m41s
</code>```

The tutorial says I can access it through: http://192.168.49.20:8081
However, I could not when I tried.

when I issue command minikube service dvwa-web-service --url , I get this:
http://127.0.0.1:14176

and I can access it.
What is the problem? why I cannot access the app through EXTERNAL-IP?

Thanks.

Body:
I am using minikube on Windows 10 with docker driver.

I installed dvwa-web by following this guide: https://github.com/cytopia/docker-dvwa/tree/master/k8s

Got it installed, and this is the output:

kubectl get svc
NAME                 TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)          AGE
dvwa-mysql-service   ClusterIP      10.104.172.238   <none>          3306/TCP         69s
dvwa-web-service     LoadBalancer   10.106.62.70     192.168.49.20   8081:30789/TCP   69s
kubernetes           ClusterIP      10.96.0.1        <none>          443/TCP          7m41s

The tutorial says I can access it through: http://192.168.49.20:8081
However, I could not when I tried.

when I issue command minikube service dvwa-web-service --url , I get this:
http://127.0.0.1:14176

and I can access it.
What is the problem? why I cannot access the app through EXTERNAL-IP?

Thanks.


来源: stackexchange

问:
What is the difference between a gateway and a controller in springmvc
Recently, I am learning Java's microservice framework, and I don't understand some of the concepts.

In what form is the exposed service exposed? For example, the mall system includes order service and payment service. In what form are these services exposed? Is it the form of the previous http request? If it is an http request, should these services include the controller layer in the MVC three-tier architecture.

What is the difference between the gateway and the controller in springmvc. It feels that they all distribute the received requests to the service. Does that mean that the controller is no longer needed with the gateway?
These questions have been bothering me for a day,I need your help.

I found some posts, they are all talking about the function of the gateway, but few people mentioned the difference between the gateway and the controller.
I even feel like nginx + controller is the same as the gateway

ContentLicense: CC BY-SA 4.0


问:
how to keep telegram bot users language?
I created a telegram bot with Nodejs and node-telegram-bot-api package and Mongodb for the database. Now, I want to add multiple languages in the bot and I want to keep the user language selected, and back data with his language.

I know I can save user language on a field in Mongodb. but I wanna know if there is any best way to keep that for the best performance. because there are many responses to users, I must check the language users every second with this method.


问:
Android Base activity for NavigatonDrawer
I was trying to implement Android NavigationDrawer menu with Base Activity to show navigation drawer for nested activities using Kotlin.

According to tutorial activity_base_drawer.xml contains content_layout, which contains FrameLayout and in this FrameLayout my activity should be rendered.

NavigationDrawer menu itself working fine but it doesn't render activity_main.xml to FrameLayout, so it is always shows content_layout.xml i.e. empty screen.

What I have missed? How could I render activity_main to FrameLayout?

activity_base_drawer.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:context=".activities.BaseDrawerActivity"
     tools:openDrawer="start"
     android:fitsSystemWindows="true">

     <include layout="@layout/content_layout"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>

    <com.google.android.material.navigation.NavigationView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:layout_gravity="start"
        android:id="@+id/nav_view"
        app:headerLayout="@layout/main_drawer_header"
        app:menu="@menu/main_drawer_menu"/>

</androidx.drawerlayout.widget.DrawerLayout>
</code>```

content_layout.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

     <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/appBarLayout"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolBar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/app_main"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:titleTextColor="@color/app_main_text"/>
    </com.google.android.material.appbar.AppBarLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:id="@+id/activityContainer"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="@+id/appBarLayout">

    </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</code>```

BaseDrawerActivity.kt

```<code>open class BaseDrawerActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {

    lateinit var drawerLayout: DrawerLayout

    override fun setContentView(view: View?) {
         drawerLayout= layoutInflater.inflate(R.layout.activity_base_drawer, null) as DrawerLayout
         val container = drawerLayout.findViewById<FrameLayout>(R.id.activityContainer)
         container.addView(view)
         super.setContentView(drawerLayout)

         val toolbar: Toolbar =drawerLayout.findViewById(R.id.toolBar)
         setSupportActionBar(toolbar)

         val navigationView:NavigationView=drawerLayout.findViewById(R.id.nav_view)
         navigationView.setNavigationItemSelectedListener(this)

         val togle=ActionBarDrawerToggle(this@BaseDrawerActivity, drawerLayout, toolbar, R.string.menu_drawer_open, R.string.menu_drawer_close)
         drawerLayout.addDrawerListener(togle)
         togle.syncState()
    }
}
</code>```

MainActivity.kt

```<code>class MainActivity : BaseDrawerActivity() {

    var activityMainBinding: ActivityMainBinding? =null

    override fun onCreate(savedInstanceState: Bundle?) {
        activityMainBinding=ActivityMainBinding.inflate(layoutInflater)
        setContentView(activityMainBinding!!.root)
        super.onCreate(savedInstanceState)
    }
}
</code>```

Body:
I was trying to implement Android NavigationDrawer menu with Base Activity to show navigation drawer for nested activities using Kotlin.

According to tutorial activity_base_drawer.xml contains content_layout, which contains FrameLayout and in this FrameLayout my activity should be rendered.

NavigationDrawer menu itself working fine but it doesn't render activity_main.xml to FrameLayout, so it is always shows content_layout.xml i.e. empty screen.

What I have missed? How could I render activity_main to FrameLayout?

activity_base_drawer.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:context=".activities.BaseDrawerActivity"
     tools:openDrawer="start"
     android:fitsSystemWindows="true">

     <include layout="@layout/content_layout"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>

    <com.google.android.material.navigation.NavigationView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:layout_gravity="start"
        android:id="@+id/nav_view"
        app:headerLayout="@layout/main_drawer_header"
        app:menu="@menu/main_drawer_menu"/>

</androidx.drawerlayout.widget.DrawerLayout>

content_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

     <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/appBarLayout"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolBar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/app_main"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:titleTextColor="@color/app_main_text"/>
    </com.google.android.material.appbar.AppBarLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:id="@+id/activityContainer"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="@+id/appBarLayout">

    </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

BaseDrawerActivity.kt

open class BaseDrawerActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {

    lateinit var drawerLayout: DrawerLayout

    override fun setContentView(view: View?) {
         drawerLayout= layoutInflater.inflate(R.layout.activity_base_drawer, null) as DrawerLayout
         val container = drawerLayout.findViewById<FrameLayout>(R.id.activityContainer)
         container.addView(view)
         super.setContentView(drawerLayout)

         val toolbar: Toolbar =drawerLayout.findViewById(R.id.toolBar)
         setSupportActionBar(toolbar)

         val navigationView:NavigationView=drawerLayout.findViewById(R.id.nav_view)
         navigationView.setNavigationItemSelectedListener(this)

         val togle=ActionBarDrawerToggle(this@BaseDrawerActivity, drawerLayout, toolbar, R.string.menu_drawer_open, R.string.menu_drawer_close)
         drawerLayout.addDrawerListener(togle)
         togle.syncState()
    }
}

MainActivity.kt

class MainActivity : BaseDrawerActivity() {

    var activityMainBinding: ActivityMainBinding? =null

    override fun onCreate(savedInstanceState: Bundle?) {
        activityMainBinding=ActivityMainBinding.inflate(layoutInflater)
        setContentView(activityMainBinding!!.root)
        super.onCreate(savedInstanceState)
    }
}


问:
Lightweight fustfmt installation in docker
I want to have a docker image with the rustfmt. But I don't want the whole rust tooling to have smaller image.

I tried (the same approach worked for gofmt)

```<code>COPY --from=rust:1.65 /usr/local/cargo/bin/rustfmt /usr/bin/rustfmt
</code>```

but that didn't work with error:

```<code>error: rustup could not choose a version of rustfmt to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
</code>```

How can I handle this?

Body:
I want to have a docker image with the rustfmt. But I don't want the whole rust tooling to have smaller image.

I tried (the same approach worked for gofmt)

COPY --from=rust:1.65 /usr/local/cargo/bin/rustfmt /usr/bin/rustfmt

but that didn't work with error:

error: rustup could not choose a version of rustfmt to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.

How can I handle this?


问:
receiving a 502 CORS error having used them in the server
I have two servers, running on the same virtual machines:

https:xxx.domain1.com (the front-end)

https:yyy.domain1.com (the back-end only called from the front-end)

Both are running under nginx and the run correctly on my development Ubuntu 20.04.1 machine.

Now I' moving them on AWS: I created a Linux machine the same OS, and transferred both the machines.

So now I have

https:xxx.domain2.com (the front-end)

https:yyy.domain2.com (the back-end only called from the front-end)

The second server will be always called only by the first one. It should be considered hidden.

I run them, but, when accessing the front-end for the login, I received the following errors:

OPTIONS https://xxx.domain2.com/login         CORS Missing Allow Origin

Now, in the server https:yyy.domain2.com I always specified

```<code>const router = express();
router.use(cors())
</code>```

and the full nginx config file is as follow

```<code>server {

    server_name xxx.domain2.com;

    location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://localhost:3000;
        }
        listen 443 ssl; # managed by Certbot
            ssl_certificate /etc/letsencrypt/live/xxx.domain2.com/fullchain.pem; # managed by Certbot
            ssl_certificate_key /etc/letsencrypt/live/xxx.domain2.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {

    server_name yyy.domain2.com;
    add_header Access-Control-Allow-Origin "xxx.domain2.com";

    location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://localhost:3001;
        }

        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/xxx.domain2.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/xxx.domain2.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = xxx.domain2.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;

    server_name  xxx.domain2.com;
        return 404; # managed by Certbot
}

server {
    if ($host = yyy.domain2.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;

    server_name yyy.domain2.com ;
        return 404; # managed by Certbot
}
</code>```

Please note that I added the line

```<code>    add_header Access-Control-Allow-Origin "xxx.domain2.com";
</code>```

that I don't have on my development server.

====================== FIRST ADDENDUM ==========================

This is the client offending piece of code: The error is in response to the const res = await axios.put(cfLogin, { 'cf': cf }); request below.

```<code>    const handleSubmitCf = async (e) => {
        e.preventDefault();

        setSudo(false)

        try {
            const res = await axios.put(cfLogin, { 'cf': cf });
            if (res.status === 200 || res.status === 201)
                {
                    nextPhase();
                    setResponse(res.data.data1);
                }
            setErrore('');
        }
        catch (error) { setErrore(error.response.data); };
    }
</code>```

Body:
I have two servers, running on the same virtual machines:

https:xxx.domain1.com (the front-end)

https:yyy.domain1.com (the back-end only called from the front-end)

Both are running under nginx and the run correctly on my development Ubuntu 20.04.1 machine.

Now I' moving them on AWS: I created a Linux machine the same OS, and transferred both the machines.

So now I have

https:xxx.domain2.com (the front-end)

https:yyy.domain2.com (the back-end only called from the front-end)

The second server will be always called only by the first one. It should be considered hidden.

I run them, but, when accessing the front-end for the login, I received the following errors:

OPTIONS https://xxx.domain2.com/login         CORS Missing Allow Origin

Now, in the server https:yyy.domain2.com I always specified

const router = express();
router.use(cors())

and the full nginx config file is as follow

server {

    server_name xxx.domain2.com;

    location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://localhost:3000;
        }
        listen 443 ssl; # managed by Certbot
            ssl_certificate /etc/letsencrypt/live/xxx.domain2.com/fullchain.pem; # managed by Certbot
            ssl_certificate_key /etc/letsencrypt/live/xxx.domain2.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {

    server_name yyy.domain2.com;
    add_header Access-Control-Allow-Origin "xxx.domain2.com";

    location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://localhost:3001;
        }

        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/xxx.domain2.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/xxx.domain2.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = xxx.domain2.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;

    server_name  xxx.domain2.com;
        return 404; # managed by Certbot
}

server {
    if ($host = yyy.domain2.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;

    server_name yyy.domain2.com ;
        return 404; # managed by Certbot
}

Please note that I added the line

    add_header Access-Control-Allow-Origin "xxx.domain2.com";

that I don't have on my development server.

====================== FIRST ADDENDUM ==========================

This is the client offending piece of code: The error is in response to the const res = await axios.put(cfLogin, { 'cf': cf }); request below.

    const handleSubmitCf = async (e) => {
        e.preventDefault();

        setSudo(false)

        try {
            const res = await axios.put(cfLogin, { 'cf': cf });
            if (res.status === 200 || res.status === 201)
                {
                    nextPhase();
                    setResponse(res.data.data1);
                }
            setErrore('');
        }
        catch (error) { setErrore(error.response.data); };
    }


问:
Card is overflowing outside its column bounds
I am using the following to show a list horizontally or vertically depending on the screen size.

```<code><div class="row">
  <div class="col-md-3">
    <div class="d-md-none">
        <div class="card">
            <div class="card-body p-0">
                <ul class="list-group list-group-horizontal">
                    <li class="list-group-item border-0">
                        <a href="javascript: void(0);" @onclick="">
                            <i class="fas fa-search" />
                        </a>
                    </li>
                    <li class="list-group-item border-0">
                        <a href="javascript: void(0);" @onclick="">
                            <i class="fas fa-address-card" />
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <div class="d-none d-md-block">
     <!-- Here the list vertically !-->
    </div>
  </div>

  <div class="col-md-9">

  </div>
</div>
</code>```

The problem is that when viewed on mobile devices, the card overflows out of its div. What can I change to make this not happen? Can I decrease the spacing between the items?

Body:
I am using the following to show a list horizontally or vertically depending on the screen size.

The problem is that when viewed on mobile devices, the card overflows out of its div. What can I change to make this not happen? Can I decrease the spacing between the items?


问:
how to fetch 49 index value from a 100 element list without indexing?
I have a 100 element list with strings in it i want to fetch 49 element from the list without using indexing how can I do that .

I want the answer in a form of code which will fetch the 49 element without using indexing that is the only requirement of that program


问:
Yahoo finance conversation api
How can I get yahoo finance conversations by api. what I use now it doesn't return me all neweset data.

https://finance.yahoo.com/_finance_doubledown/api/resource/canvass.getMessageList;count=100;oauthConsumerKey=finance.oauth.client.canvass.prod.consumerKey;oauthConsumerSecret=finance.oauth.client.canvass.prod.consumerSecret;query=namespace="yahoo_finance" and (tag="AAPL");sortBy=createdAt;

Title: Yahoo finance conversation api


问:
How do I make a directive setting the query parameters?
I have the following line in the template
Page1
Here the query parameter is set for the link

Specifically, this parameter q1 will have to be set on many links in the application, while its value will be determined based on the current value of the route

Is it possible to create an attribute directive, for example 'setQ1QueryParam', which would add the Q1 parameter with the calculated value to the query parameters?


问:
How can I define a reference to a public field of an R6 class in Rcpp?
I am struggling with modifying elements of R environments in-place using Rcpp. More specifically, I would like to define variables pointing to elements of an R environment to ease working with
public fields of an R6 class.

Consider the following Rcpp function:

```<code>double update_data1_cpp(Environment &self, double x) {
  self["data"] = x;
  return self["data"];
}
</code>```

It takes a reference to the environment 'self' (e.g. an R6 class object) and updates the 'data' field with the value of 'x'.
How can I define a shorthand 'data_' for self["data"] without copying and still being able to modify 'data' in the environment 'self'?

I did not find an answer to that in the Rcpp guide on working with R6 classes https://gallery.rcpp.org/articles/handling-R6-objects-in-rcpp/.

This does not work (does not modify data in the environment), I guess it copies the value of 'data' in 'self' to 'data_' and then only modifies 'data_':

```<code>double update_data2_cpp(Environment &self, double x) {
  double data_ = self["data"];
  data_ = x;
  return self["data"];
}
</code>```

Trying to create a pointer to the address of self["data"] fails with 'taking address of temporary'

```<code>double update_data3_cpp(Environment &self, double x) {
  double *data_ = &(self["data"]);
  data_ = &x;
  return self["data"];
}
</code>```

I guess my Cpp pointer-magic is not strong enough to get through this :) Any help appreciated!

Body:
I am struggling with modifying elements of R environments in-place using Rcpp. More specifically, I would like to define variables pointing to elements of an R environment to ease working with
public fields of an R6 class.

Consider the following Rcpp function:

double update_data1_cpp(Environment &self, double x) {
  self["data"] = x;
  return self["data"];
}

It takes a reference to the environment 'self' (e.g. an R6 class object) and updates the 'data' field with the value of 'x'.
How can I define a shorthand 'data_' for self["data"] without copying and still being able to modify 'data' in the environment 'self'?

I did not find an answer to that in the Rcpp guide on working with R6 classes https://gallery.rcpp.org/articles/handling-R6-objects-in-rcpp/.

This does not work (does not modify data in the environment), I guess it copies the value of 'data' in 'self' to 'data_' and then only modifies 'data_':

double update_data2_cpp(Environment &self, double x) {
  double data_ = self["data"];
  data_ = x;
  return self["data"];
}

Trying to create a pointer to the address of self["data"] fails with 'taking address of temporary'

double update_data3_cpp(Environment &self, double x) {
  double *data_ = &(self["data"]);
  data_ = &x;
  return self["data"];
}

I guess my Cpp pointer-magic is not strong enough to get through this :) Any help appreciated!


问:
nrf52840 dongle debugging issue
I'm facing an issue to debug nrf52840 dongle rev 3.0 using a USB CDC application on top of BLE client application.
The same result was when using Fanstel based on nrf52840 connected via USB to the host as well.

In most cases unplugging and plunging the dongle force a target recovery after flashing the application.

When running the debugger it returns with the exception,

Cortex registers:

Disassembly viewer:

Using Cortex-Debug extension for VS Code. launch.jason as follows:

```<code>{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Cortex Debug",
            "cwd": "${workspaceRoot}",
            "executable": "${workspaceRoot}/_build/nrf52840_xxaa.out",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "jlink",
            "device": "nrf52",
            "interface": "swd",
            "serialNumber": "",
            "armToolchainPath": "/usr/local/gcc-arm-none-eabi-6-2017-q2-update/bin",
            "svdFile": "${workspaceRoot}/modules/nrfx/mdk/nrf52840.svd",
        }
    ]
}
</code>```

When I use BLE client application or USB CDC application, the debugger runs without any problems.

Title: nrf52840 dongle debugging issue

Body:
I'm facing an issue to debug nrf52840 dongle rev 3.0 using a USB CDC application on top of BLE client application.
The same result was when using Fanstel based on nrf52840 connected via USB to the host as well.

In most cases unplugging and plunging the dongle force a target recovery after flashing the application.

When running the debugger it returns with the exception,

Cortex registers:

Disassembly viewer:

Using Cortex-Debug extension for VS Code. launch.jason as follows:

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Cortex Debug",
            "cwd": "${workspaceRoot}",
            "executable": "${workspaceRoot}/_build/nrf52840_xxaa.out",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "jlink",
            "device": "nrf52",
            "interface": "swd",
            "serialNumber": "",
            "armToolchainPath": "/usr/local/gcc-arm-none-eabi-6-2017-q2-update/bin",
            "svdFile": "${workspaceRoot}/modules/nrfx/mdk/nrf52840.svd",
        }
    ]
}

When I use BLE client application or USB CDC application, the debugger runs without any problems.


问:
Cassandra Keyspace system_schema does not exist
I am getting the error that Cassandra keyspace system_schema does not exist. Why this happens and how to resolve it?

```<code>SELECT * FROM system_schema.keyspaces;
</code>```

```<code>InvalidRequest: code=2200 [Invalid query] message="Keyspace system_schema does not exist"
</code>```

I follow the command from this tutorial exactly. But it does not turn out successfully. I worry if I missed anything during the installation process.

Body:
I am getting the error that Cassandra keyspace system_schema does not exist. Why this happens and how to resolve it?

SELECT * FROM system_schema.keyspaces;

InvalidRequest: code=2200 [Invalid query] message="Keyspace system_schema does not exist"

I follow the command from this tutorial exactly. But it does not turn out successfully. I worry if I missed anything during the installation process.


问:
calling GLClear multiple times without swapping buffer casues memory leak (Windows MSVC)
When I call GLClear without swapping the buffer, it is causing memory leak.

I am not sure if this is a driver issue or if I am doing something wrong.

If anyone can give it a try or have any idea, please tell me.

TL;DR, this is the code summarized. You can find all the code after this block

```<code>static bool CloseFlag = false;

LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static PAINTSTRUCT ps;

    switch(uMsg)
    {
        case WM_SIZE:
            glViewport(0, 0, LOWORD(lParam), HIWORD(lParam));
            PostMessage(hWnd, WM_PAINT, 0, 0);
            return 0;

        case WM_CHAR:
            //Handle input....
            return 0;

        case WM_CLOSE:
            CloseFlag = true;
            return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

HWND CreateOpenGLWindow(char* title, int x, int y, int width, int height,
           BYTE type, DWORD flags)
{
    //Create window (with double buffer) and register it...
}

int main ()
{
    hWnd = CreateOpenGLWindow("minimal", 0, 0, 256, 256, PFD_TYPE_RGBA, 0);

    hRC = wglCreateContext(hDC);
    wglMakeCurrent(hDC, hRC);

    gladLoadWGL(hDC)
    gladLoadGL()
    ShowWindow(hWnd, SW_SHOW);

    while(!CloseFlag)
    {
        //Handles input
        while(PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        glClear(GL_COLOR_BUFFER_BIT);
    }

    wglMakeCurrent(NULL, NULL);
    ReleaseDC(hWnd, hDC);
    wglDeleteContext(hRC);
    DestroyWindow(hWnd);

    return 0;
}
</code>```

Here's a minimum code for reproducing it that uses Win32.

```<code>#ifndef UNICODE
#define UNICODE
#define _UNICODE
#endif

#include <windows.h>            /* must include this before GL/gl.h */
#include "glad/glad.h"
#include "glad/glad_wgl.h"
#include "wglext.h"
#include <string>

static bool CloseFlag = false;

void display(HDC hDC)
{
    /* rotate a triangle around */
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_TRIANGLES);
    glColor3f(1.0f, 0.0f, 0.0f);
    glVertex2i(0,  1);
    glColor3f(0.0f, 1.0f, 0.0f);
    glVertex2i(-1, -1);
    glColor3f(0.0f, 0.0f, 1.0f);
    glVertex2i(1, -1);
    glEnd();
    glFlush();

    SwapBuffers(hDC);
}

void JustClear()
{
    glClear(GL_COLOR_BUFFER_BIT);
}

LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static PAINTSTRUCT ps;

    switch(uMsg)
    {
        case WM_SIZE:
            glViewport(0, 0, LOWORD(lParam), HIWORD(lParam));
            PostMessage(hWnd, WM_PAINT, 0, 0);
            return 0;

        case WM_CHAR:
            switch (wParam)
            {
                case 27:            /* ESC key */
                    //PostQuitMessage(0);
                    CloseFlag = true;
                    break;
            }
            return 0;

        case WM_CLOSE:
            CloseFlag = true;
            //PostQuitMessage(0);
            return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

HWND CreateOpenGLWindow(char* title, int x, int y, int width, int height,
           BYTE type, DWORD flags)
{
    int         pf;
    HDC         hDC;
    HWND        hWnd;
    WNDCLASS    wc;
    PIXELFORMATDESCRIPTOR pfd;
    static HINSTANCE hInstance = 0;

    /* only register the window class once - use hInstance as a flag. */
    if (!hInstance) {
        hInstance = GetModuleHandle(NULL);
        wc.style         = CS_OWNDC;
        wc.lpfnWndProc   = (WNDPROC)WindowProc;
        wc.cbClsExtra    = 0;
        wc.cbWndExtra    = 0;
        wc.hInstance     = hInstance;
        wc.hIcon         = LoadIcon(NULL, IDI_WINLOGO);
        wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = NULL;
        wc.lpszMenuName  = NULL;
        wc.lpszClassName = L"OpenGL";

        if (!RegisterClass(&wc)) {

            return NULL;
        }
    }

    std::wstring className = L"OpenGL";

    hWnd = CreateWindow(className.c_str(), className.c_str(), WS_OVERLAPPEDWINDOW |
            WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
            x, y, width, height, NULL, NULL, hInstance, NULL);

    if (hWnd == NULL) {
        return NULL;
    }

    hDC = GetDC(hWnd);

    /* there is no guarantee that the contents of the stack that become
       the pfd are zeroed, therefore _make sure_ to clear these bits. */
    memset(&pfd, 0, sizeof(pfd));
    pfd.nSize        = sizeof(pfd);
    pfd.nVersion     = 1;
    pfd.dwFlags      = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | flags;
    pfd.iPixelType   = type;
    pfd.cColorBits   = 32;

    pf = ChoosePixelFormat(hDC, &pfd);
    if (pf == 0) {
        return 0;
    }

    if (SetPixelFormat(hDC, pf, &pfd) == FALSE) {
        return 0;
    }

    DescribePixelFormat(hDC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);

    ReleaseDC(hWnd, hDC);

    return hWnd;
}

int main ()
{
    HDC hDC;                /* device context */
    HGLRC hRC;              /* opengl context */
    HWND  hWnd;             /* window */
    MSG   msg;              /* message */

    hWnd = CreateOpenGLWindow("minimal", 0, 0, 256, 256, PFD_TYPE_RGBA, 0);
    if (hWnd == NULL)
        exit(1);

    hDC = GetDC(hWnd);
    hRC = wglCreateContext(hDC);
    wglMakeCurrent(hDC, hRC);

    if(!gladLoadWGL(hDC))
    {
        return -1;
    }

    if (!gladLoadGL())                  //Load Glad
    {
        return -1;
    }

    ShowWindow(hWnd, SW_SHOW);

    while(!CloseFlag)
    {
        //Handles input
        while(PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        //Render
        //display(hDC);
        JustClear();
    }

    wglMakeCurrent(NULL, NULL);
    ReleaseDC(hWnd, hDC);
    wglDeleteContext(hRC);
    DestroyWindow(hWnd);

    return 0;
}
</code>```

wglext.h is from here

Here's the OpenGL glad config

```<code>/*

    OpenGL loader generated by glad 0.1.36 on Fri Oct 28 11:12:34 2022.

    Language/Generator: C/C++
    Specification: gl
    APIs: gl=3.3
    Profile: compatibility
    Extensions:

    Loader: True
    Local files: False
    Omit khrplatform: False
    Reproducible: False

    Commandline:
        --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions=""
    Online:
        https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3
*/
</code>```

and Glad wgl 1.0 with all the extensions

and here's the CMake I used

```<code>cmake_minimum_required(VERSION 3.14)

set (CMAKE_CXX_STANDARD 11)

# For Clang to do parsing
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# set the project name
project(Example)

add_executable(EXAMPLE_EXE ${CMAKE_CURRENT_LIST_DIR}/Src/main.cpp)

add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/glad_v0.1.36")

find_package(OpenGL REQUIRED)

target_include_directories(EXAMPLE_EXE PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/wglExt")

target_link_libraries(EXAMPLE_EXE PUBLIC OpenGL::GL glad)
</code>```

Body:
When I call GLClear without swapping the buffer, it is causing memory leak.

I am not sure if this is a driver issue or if I am doing something wrong.

If anyone can give it a try or have any idea, please tell me.

TL;DR, this is the code summarized. You can find all the code after this block

static bool CloseFlag = false;

LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static PAINTSTRUCT ps;

    switch(uMsg)
    {
        case WM_SIZE:
            glViewport(0, 0, LOWORD(lParam), HIWORD(lParam));
            PostMessage(hWnd, WM_PAINT, 0, 0);
            return 0;

        case WM_CHAR:
            //Handle input....
            return 0;

        case WM_CLOSE:
            CloseFlag = true;
            return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

HWND CreateOpenGLWindow(char* title, int x, int y, int width, int height,
           BYTE type, DWORD flags)
{
    //Create window (with double buffer) and register it...
}

int main ()
{
    hWnd = CreateOpenGLWindow("minimal", 0, 0, 256, 256, PFD_TYPE_RGBA, 0);

    hRC = wglCreateContext(hDC);
    wglMakeCurrent(hDC, hRC);

    gladLoadWGL(hDC)
    gladLoadGL()
    ShowWindow(hWnd, SW_SHOW);

    while(!CloseFlag)
    {
        //Handles input
        while(PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        glClear(GL_COLOR_BUFFER_BIT);
    }

    wglMakeCurrent(NULL, NULL);
    ReleaseDC(hWnd, hDC);
    wglDeleteContext(hRC);
    DestroyWindow(hWnd);

    return 0;
}

Here's a minimum code for reproducing it that uses Win32.

#ifndef UNICODE
#define UNICODE
#define _UNICODE
#endif

#include <windows.h>            /* must include this before GL/gl.h */
#include "glad/glad.h"
#include "glad/glad_wgl.h"
#include "wglext.h"
#include <string>

static bool CloseFlag = false;

void display(HDC hDC)
{
    /* rotate a triangle around */
    glClear(GL_COLOR_BUFFER_BIT);
    glBegin(GL_TRIANGLES);
    glColor3f(1.0f, 0.0f, 0.0f);
    glVertex2i(0,  1);
    glColor3f(0.0f, 1.0f, 0.0f);
    glVertex2i(-1, -1);
    glColor3f(0.0f, 0.0f, 1.0f);
    glVertex2i(1, -1);
    glEnd();
    glFlush();

    SwapBuffers(hDC);
}

void JustClear()
{
    glClear(GL_COLOR_BUFFER_BIT);
}

LONG WINAPI WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static PAINTSTRUCT ps;

    switch(uMsg)
    {
        case WM_SIZE:
            glViewport(0, 0, LOWORD(lParam), HIWORD(lParam));
            PostMessage(hWnd, WM_PAINT, 0, 0);
            return 0;

        case WM_CHAR:
            switch (wParam)
            {
                case 27:            /* ESC key */
                    //PostQuitMessage(0);
                    CloseFlag = true;
                    break;
            }
            return 0;

        case WM_CLOSE:
            CloseFlag = true;
            //PostQuitMessage(0);
            return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

HWND CreateOpenGLWindow(char* title, int x, int y, int width, int height,
           BYTE type, DWORD flags)
{
    int         pf;
    HDC         hDC;
    HWND        hWnd;
    WNDCLASS    wc;
    PIXELFORMATDESCRIPTOR pfd;
    static HINSTANCE hInstance = 0;

    /* only register the window class once - use hInstance as a flag. */
    if (!hInstance) {
        hInstance = GetModuleHandle(NULL);
        wc.style         = CS_OWNDC;
        wc.lpfnWndProc   = (WNDPROC)WindowProc;
        wc.cbClsExtra    = 0;
        wc.cbWndExtra    = 0;
        wc.hInstance     = hInstance;
        wc.hIcon         = LoadIcon(NULL, IDI_WINLOGO);
        wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = NULL;
        wc.lpszMenuName  = NULL;
        wc.lpszClassName = L"OpenGL";

        if (!RegisterClass(&wc)) {

            return NULL;
        }
    }

    std::wstring className = L"OpenGL";

    hWnd = CreateWindow(className.c_str(), className.c_str(), WS_OVERLAPPEDWINDOW |
            WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
            x, y, width, height, NULL, NULL, hInstance, NULL);

    if (hWnd == NULL) {
        return NULL;
    }

    hDC = GetDC(hWnd);

    /* there is no guarantee that the contents of the stack that become
       the pfd are zeroed, therefore _make sure_ to clear these bits. */
    memset(&pfd, 0, sizeof(pfd));
    pfd.nSize        = sizeof(pfd);
    pfd.nVersion     = 1;
    pfd.dwFlags      = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | flags;
    pfd.iPixelType   = type;
    pfd.cColorBits   = 32;

    pf = ChoosePixelFormat(hDC, &pfd);
    if (pf == 0) {
        return 0;
    }

    if (SetPixelFormat(hDC, pf, &pfd) == FALSE) {
        return 0;
    }

    DescribePixelFormat(hDC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);

    ReleaseDC(hWnd, hDC);

    return hWnd;
}

int main ()
{
    HDC hDC;                /* device context */
    HGLRC hRC;              /* opengl context */
    HWND  hWnd;             /* window */
    MSG   msg;              /* message */

    hWnd = CreateOpenGLWindow("minimal", 0, 0, 256, 256, PFD_TYPE_RGBA, 0);
    if (hWnd == NULL)
        exit(1);

    hDC = GetDC(hWnd);
    hRC = wglCreateContext(hDC);
    wglMakeCurrent(hDC, hRC);

    if(!gladLoadWGL(hDC))
    {
        return -1;
    }

    if (!gladLoadGL())                  //Load Glad
    {
        return -1;
    }

    ShowWindow(hWnd, SW_SHOW);

    while(!CloseFlag)
    {
        //Handles input
        while(PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        //Render
        //display(hDC);
        JustClear();
    }

    wglMakeCurrent(NULL, NULL);
    ReleaseDC(hWnd, hDC);
    wglDeleteContext(hRC);
    DestroyWindow(hWnd);

    return 0;
}

wglext.h is from here

Here's the OpenGL glad config

/*

    OpenGL loader generated by glad 0.1.36 on Fri Oct 28 11:12:34 2022.

    Language/Generator: C/C++
    Specification: gl
    APIs: gl=3.3
    Profile: compatibility
    Extensions:

    Loader: True
    Local files: False
    Omit khrplatform: False
    Reproducible: False

    Commandline:
        --profile="compatibility" --api="gl=3.3" --generator="c" --spec="gl" --extensions=""
    Online:
        https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3
*/

and Glad wgl 1.0 with all the extensions

and here's the CMake I used

cmake_minimum_required(VERSION 3.14)

set (CMAKE_CXX_STANDARD 11)

# For Clang to do parsing
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# set the project name
project(Example)

add_executable(EXAMPLE_EXE ${CMAKE_CURRENT_LIST_DIR}/Src/main.cpp)

add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/glad_v0.1.36")

find_package(OpenGL REQUIRED)

target_include_directories(EXAMPLE_EXE PUBLIC "${CMAKE_CURRENT_LIST_DIR}/External/wglExt")

target_link_libraries(EXAMPLE_EXE PUBLIC OpenGL::GL glad)


问:
is there a way to code a product recommendation system on RStudio using svm or knn? (Without using recommenderlab)
I want to code a product recommendation system on RStudio, using KNN or SVM. But i dont wanna use recommenderlab.

Is there an easy way to code it? I have variables such as name, gender, price, product type, product brand etc etc.

I tried running SVM and KNN. I got the confusion matrixes with the product type.

But i don't know how to get a list of recommended products for a particular user.


问:
What is the correct approach to create a custom machine shell using FreeCAD
I am new to FreeCAD, I've read some books, and the online help.

I am trying to create a plastic shell for POS hardware, for 3d printing, a non-perfect cube shallow piece of plastic, with some holes and shelves on it, and inside it, plus some mounting capabilities.

Could be compared somehow to a custom lectern, shell for a coffee maker

As a software dev, I like the parametric powers of FreeCAD, the python integrations, but at the same time I do understand the importance of developing thinks in an idiomatic, organized and sane way, using improper tricks might get you close to the goal, but cost a price later.

I am not sure what's the correct approach for creating shallow complex shapes, and would like to hear from experienced Designers, how these things are best designed.

Create solid using part design, and then creating a smaller solid with same design then subtract one from the other.

Working with mesh design, to build the base shape then convert to a part, to add the bells and whistles

Work with arch workbench (not sure about 3d printing later, and if they are real 3d)

Other

I would also like to use the spreadsheet feature to be able to change/toggle easily some key features

I've tried all 3 options, none of them seemed natively solving the problem, could be that's my novicey, but I think maybe I am really on the wrong path.

Thanks


问:
TypeError: 'str' object is not callable
This is my code:

```<code>import scapy.all
from scapy.all import *

def create_ip_packet(my_req):
    ip_packet = IP(dst=my_req)
    return ip_packet

</code>```

my_req is a simple string as "www.google.com"
and I'm trying to create a packet with an IP layer that sets the source address as the above string

The full ERROR is:
in create_ip_packet
ip_packet = IP(dst=my_req)
TypeError: 'str' object is not callable

I tried different ways of importation found on Google but it still doesn't work. Could anyone please tell me what I'm doing wrong?

Title: TypeError: 'str' object is not callable

Body:
This is my code:

import scapy.all
from scapy.all import *

def create_ip_packet(my_req):
    ip_packet = IP(dst=my_req)
    return ip_packet

my_req is a simple string as "www.google.com"
and I'm trying to create a packet with an IP layer that sets the source address as the above string

The full ERROR is:
in create_ip_packet
ip_packet = IP(dst=my_req)
TypeError: 'str' object is not callable

I tried different ways of importation found on Google but it still doesn't work. Could anyone please tell me what I'm doing wrong?


问:
Capturing the event/hook when creating a new product in woocommerce
I am trying to update a meta data when a woocommerce product is entered or modified and no hook is working right for me, I can't seem to capture the hook to launch my function.

I have tried all of these without success:

```<code>
add_action( 'save_post', 'guarda_galeria_curso_relacionado', 10, 2 );

add_action( 'wp_after_insert_post', 'guarda_galeria_curso_relacionado', 10, 2 );

add_action( 'publish_product', 'guarda_galeria_curso_relacionado', 10,2 );

add_action( 'woocommerce_process_product_meta', 'guarda_galeria_curso_relacionado', 10, 2);

add_action( 'woocommerce_new_product', 'guarda_galeria_curso_relacionado', 10, 2 );

add_action( 'woocommerce_admin_process_product_object', 'guarda_galeria_curso_relacionado' );

add_action( 'acf/save_post', 'guarda_galeria_curso_relacionado', 5);

</code>```

Wordpress
Woocommerce Versión 6.9.4

If I deliberately cause an error, then some of the hooks are executed.

Error: PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function test_guarda_galeria_curso_relacionado(), 1 passed

```<code>
add_action('acf/save_post', 'test_guarda_galeria_curso_relacionado', 10);

function test_guarda_galeria_curso_relacionado( $post_id, $post ) {

echo "<script>alert('entra1')</script>";

}

</code>```

¡This error cause execute this other hook!

```<code>add_action( 'woocommerce_process_product_meta', 'action_save_product_meta2' );
function action_save_product_meta2( $post_id ) {
    echo "<script>alert('".$post_id."')</script>";
          $product = wc_get_product( $post_id );
          $related_course = get_field('related_course',$post_id);
          $related_course_id = $related_course->ID;
    echo "<script>alert('".$related_course_id."')</script>";
          $images = get_field('course_gallery', $related_course_id, false);
    //echo "<script>alert('".print_r($images)."')</script>";
          update_field( 'galeria_relacionada', $images, $post_id );
          //update_post_meta( $post_id, 'galeria_relacionada', $images );

}
</code>```

I hope someone can give me some light with this problem that apriori is very simple : )

Body:
I am trying to update a meta data when a woocommerce product is entered or modified and no hook is working right for me, I can't seem to capture the hook to launch my function.

I have tried all of these without success:

add_action( 'save_post', 'guarda_galeria_curso_relacionado', 10, 2 );

add_action( 'wp_after_insert_post', 'guarda_galeria_curso_relacionado', 10, 2 );

add_action( 'publish_product', 'guarda_galeria_curso_relacionado', 10,2 );

add_action( 'woocommerce_process_product_meta', 'guarda_galeria_curso_relacionado', 10, 2);

add_action( 'woocommerce_new_product', 'guarda_galeria_curso_relacionado', 10, 2 );

add_action( 'woocommerce_admin_process_product_object', 'guarda_galeria_curso_relacionado' );

add_action( 'acf/save_post', 'guarda_galeria_curso_relacionado', 5);

Wordpress
Woocommerce Versión 6.9.4

If I deliberately cause an error, then some of the hooks are executed.

Error: PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function test_guarda_galeria_curso_relacionado(), 1 passed

add_action('acf/save_post', 'test_guarda_galeria_curso_relacionado', 10);

function test_guarda_galeria_curso_relacionado( $post_id, $post ) {

echo "";

}

¡This error cause execute this other hook!

add_action( 'woocommerce_process_product_meta', 'action_save_product_meta2' );
function action_save_product_meta2( $post_id ) {
    echo "";
          $product = wc_get_product( $post_id );
          $related_course = get_field('related_course',$post_id);
          $related_course_id = $related_course->ID;
    echo "";
          $images = get_field('course_gallery', $related_course_id, false);
    //echo "";
          update_field( 'galeria_relacionada', $images, $post_id );
          //update_post_meta( $post_id, 'galeria_relacionada', $images );

}

I hope someone can give me some light with this problem that apriori is very simple : )


问:
How to set max width for specific block with TinyMCE editor
I've integrated TinyMCE with React.js.

But there is a feature I need which seems TinyMCE doesn't support it natively so I wanna know how can I add it.

you see the two blocks that are surrounded by the red box (see the image below) have maxWidth and width which I set it manually via DevTools

max-width: 800px;
width: 100%;
margin: 0px auto;
```

I wanna know how can I set the above css for the current selected block using TinyMCE API.

so the user can resize the max-width for the current selected block by clicking a button in the toolbar (which will call the TinyMCE API to resize its max-width)

Body:
I've integrated TinyMCE with React.js.

But there is a feature I need which seems TinyMCE doesn't support it natively so I wanna know how can I add it.

you see the two blocks that are surrounded by the red box (see the image below) have maxWidth and width which I set it manually via DevTools

max-width: 800px;
width: 100%;
margin: 0px auto;

I wanna know how can I set the above css for the current selected block using TinyMCE API.

so the user can resize the max-width for the current selected block by clicking a button in the toolbar (which will call the TinyMCE API to resize its max-width)


问:
injecting react tsx into content script - google chrome
I'm having some issue I couldn't find information about online.

I have a chrome extension, which when I click on the extension's icon, I have a popup UI opening.

Next, when I click on a certain button, it injects JS code into my content script. Cool!

Issue begins when I try to inject a react code into the page. How could I inject such thing instead of JS code?

Or even better, how could I render there a new ReactTSX component?

I'll just add that what I attempt to do is that when a user clicks on a button in the popup's ui, it takes a print screen using captureCurrentVisible, which I want to pass to a large screen so I can draw on that image using a canvas (I have built the component responsible for that, I just don't know how to open a window, full screen, which I could edit the image on).

Regards! :-)


问:
Caching tensorflow dataset before iteration results in empty dataset
I'm using the from_generator Method of the Dataset API in TensorFlow.
However, when I iterate through the dataset (to count the samples) with caching enabled, the dataset is empty:

output_signature = (tensorflow.TensorSpec(shape=(64, 64, 2), dtype=tensorflow.float32),
                        tensorflow.TensorSpec(shape=(), dtype=tensorflow.int16))
dataset = tensorflow.data.Dataset.from_generator(MSUMFSDFrameGenerator(pathlib.Path(dataset_locations["mfsd"]), True), output_signature=output_signature)
dataset = dataset.repeat().prefetch(buffer_size=tensorflow.data.AUTOTUNE).cache(filename)
size = dataset.reduce(0, lambda x,_: x+1).numpy()
```
<p>But when I cache the dataset <strong>after</strong> iteration, the dataset seems to be fine (but isn't cached then and needs regeneration for training again):</p>
<pre class="lang-py prettyprint-override"><code>output_signature = (tensorflow.TensorSpec(shape=(64, 64, 2), dtype=tensorflow.float32),
                        tensorflow.TensorSpec(shape=(), dtype=tensorflow.int16))
dataset = tensorflow.data.Dataset.from_generator(MSUMFSDFrameGenerator(pathlib.Path(dataset_locations["mfsd"]), True), output_signature=output_signature)
dataset = dataset.repeat().prefetch(buffer_size=tensorflow.data.AUTOTUNE)
size = dataset.reduce(0, lambda x,_: x+1).numpy()
dataset = dataset.cache(filename)
</code>```

Do you know how to iterate a cached dataset (to obtain the number of samples)?

Body:
I'm using the from_generator Method of the Dataset API in TensorFlow.
However, when I iterate through the dataset (to count the samples) with caching enabled, the dataset is empty:

output_signature = (tensorflow.TensorSpec(shape=(64, 64, 2), dtype=tensorflow.float32),
                        tensorflow.TensorSpec(shape=(), dtype=tensorflow.int16))
dataset = tensorflow.data.Dataset.from_generator(MSUMFSDFrameGenerator(pathlib.Path(dataset_locations["mfsd"]), True), output_signature=output_signature)
dataset = dataset.repeat().prefetch(buffer_size=tensorflow.data.AUTOTUNE).cache(filename)
size = dataset.reduce(0, lambda x,_: x+1).numpy()

But when I cache the dataset after iteration, the dataset seems to be fine (but isn't cached then and needs regeneration for training again):

output_signature = (tensorflow.TensorSpec(shape=(64, 64, 2), dtype=tensorflow.float32),
                        tensorflow.TensorSpec(shape=(), dtype=tensorflow.int16))
dataset = tensorflow.data.Dataset.from_generator(MSUMFSDFrameGenerator(pathlib.Path(dataset_locations["mfsd"]), True), output_signature=output_signature)
dataset = dataset.repeat().prefetch(buffer_size=tensorflow.data.AUTOTUNE)
size = dataset.reduce(0, lambda x,_: x+1).numpy()
dataset = dataset.cache(filename)

Do you know how to iterate a cached dataset (to obtain the number of samples)?


问:
build failed in Cyclic during deployment
Frontend package.

Backend package.json

server.js backend

T tried to deploy the website on cyclic but its saying sh: react-scripts: command not found
build failed


问:
How can I have subcommands with a "fallthrough" behavior?
I have a program which is basically a kind of web client, so mostly the user will be running it with a single parameter, a URL:

```<code>myclient https://example.com
</code>```

But occasionally the user might want to configure the program using a subcommand:

```<code>myclient configure-this ...
myclient configure-that ...
myclient configure-other ...
</code>```

So I'd like to use subparsers to handle the subcommands, but I want a kind of "fallthrough" where if the first argument isn't recognized as any subcommand, the script just assumes it's a URL.

Can this be done using argparse?

Body:
I have a program which is basically a kind of web client, so mostly the user will be running it with a single parameter, a URL:

myclient https://example.com

But occasionally the user might want to configure the program using a subcommand:

myclient configure-this ...
myclient configure-that ...
myclient configure-other ...

So I'd like to use subparsers to handle the subcommands, but I want a kind of "fallthrough" where if the first argument isn't recognized as any subcommand, the script just assumes it's a URL.

Can this be done using argparse?


问:
FilePond remove uploded file with revert property
I have a propblem with removing file with revert property here is my code :

```<code>  server={{
      process: (fieldName, file, progress, load, error) => {
        handelUploadFile(fieldName, file, progress, load, error);
      },
      revert: (uniqueFileId, load, error) => {
        handelDeleteFile(uniqueFileId, load, error);
      },
    }}

  const handelDeleteFile = async (uniqueFileId, load, error) => {
  const key = "DELETE";
  let config = {
  url: "/deletefile",
  method: "delete",
  params: { filenames: uniqueFileId },
  };
  let status;
  const response = await axios(config);
  status = response.status;
  if (status === 200) {
  load(response.status);
  } else {
  error("error in delete file");
  }
  };
</code>```

by the way i used before another project and that still working with the same code

i change the version og filepond but it didn't work

i tried this code :

```<code> server={{
      revert: (uniqueFileId, load, error) => {
          console.log(uniqueFileId)  // return undefined
      },
    }}
</code>```

what is problem ?

Body:
I have a propblem with removing file with revert property here is my code :

  server={{
      process: (fieldName, file, progress, load, error) => {
        handelUploadFile(fieldName, file, progress, load, error);
      },
      revert: (uniqueFileId, load, error) => {
        handelDeleteFile(uniqueFileId, load, error);
      },
    }}

  const handelDeleteFile = async (uniqueFileId, load, error) => {
  const key = "DELETE";
  let config = {
  url: "/deletefile",
  method: "delete",
  params: { filenames: uniqueFileId },
  };
  let status;
  const response = await axios(config);
  status = response.status;
  if (status === 200) {
  load(response.status);
  } else {
  error("error in delete file");
  }
  };

by the way i used before another project and that still working with the same code

i change the version og filepond but it didn't work

i tried this code :

 server={{
      revert: (uniqueFileId, load, error) => {
          console.log(uniqueFileId)  // return undefined
      },
    }}

what is problem ?


问:
expo-camera error “camera not working” on android web app upon toggleswitch camera type
I am using expo-camera on my app that can be run to a web on android/ios. Setting camera type works but when I try to switch/toggle camera on android i got an error “camera not working”</p>


问:
how do i resolve " Gradle sync failed: Plugin with id 'maven' not found." error without changing react version
i am using react -v 16.13.1 and native -v 0.63.4  and gradle plugin 4.0.2 and gradle  6.7.1

I tried by changing 2048 to 1024 in gradle.properties unable to resolve


问:
Random tag appeared in a span -
Hi I have a  in my code and i am using it for javascript code. But suddenly  tag appeared in my code. I am created a function to display how many users are online. PHP and Javascript codes are added below...........................................................................

My index.php code:

```<code>
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
    <!-- Navbar Brand-->
    <a class="navbar-brand ps-3" href="index.php">CMS Admin</a>
    <!-- Sidebar Toggle-->
    <button class="btn btn-link btn-sm order-1 order-lg-0 me-4 me-lg-0" id="sidebarToggle" href="#!"><i
                class="fas fa-bars"></i></button>
    <!-- Navbar Search-->
    <form class="d-none d-md-inline-block form-inline ms-auto me-0 me-md-3 my-2 my-md-0">
        <!--                <div class="input-group">-->
        <!--                    <input class="form-control" type="text" placeholder="Search for..." aria-label="Search for..." aria-describedby="btnNavbarSearch" />-->
        <!--                    <button class="btn btn-primary" id="btnNavbarSearch" type="button"><i class="fas fa-search"></i></button>-->
        <!--                </div>-->
    </form>
    <!-- Navbar-->
    <ul class="navbar-nav ms-auto ms-md-0 me-3 me-lg-4">

        <!--                <a class="nav-link" href="">Users Online: --><?php //echo users_online(); ?><!--</a>-->

        <a class="nav-link" href="">Users Online:<span class="usersonline"></span></a>

        <a class="nav-link" href="../index.php">Home</a>
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button" data-bs-toggle="dropdown"
               aria-expanded="false"><i class="fas fa-user fa-fw"></i> <?php echo $_SESSION['firstname']; ?></a>
            <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
                <li><a class="dropdown-item" href="profile.php">Settings</a></li>
                <li><a class="dropdown-item" href="#!">Activity Log</a></li>
                <li>
                    <hr class="dropdown-divider"/>
                </li>
                <li><a class="dropdown-item" href="../includes/logout.php">Logout</a></li>
            </ul>
        </li>
    </ul>

</nav>
</code>```

My js code:

```<code>function loadUsersOnline() {
    $.get("functions.php?onlineusers=result", function (data) {
        $(".usersonline").text(data);
    });
}

setInterval(function () {
    loadUsersOnline();
},500);
</code>```

My functions.php code:

```<code>
function users_online()
{

    if (isset($_GET['onlineusers'])) {

        global $connection;

        if (!$connection) {
            session_start();

            include "../includes/db.php";

            $session = session_id();
            $time = time();
            $time_out_in_seconds = 60;
            $time_out = $time - $time_out_in_seconds;

            $query = "SELECT * FROM users_online WHERE session = '$session'";
            $send_query = mysqli_query($connection, $query);
            $count = mysqli_num_rows($send_query);

            if ($count == NULL) {
                mysqli_query($connection, "INSERT INTO users_online(session, time) VALUES('$session', '$time')");
            } else {
                mysqli_query($connection, "UPDATE users_online SET time = '$time' WHERE session = '$session'");
            }

            $users_online_query = mysqli_query($connection, "SELECT * FROM users_online WHERE time > '$time_out'");
            echo $users_count = mysqli_num_rows($users_online_query);
        }
    } // get req
}

users_online();

</code>```

Thanks in Advance!

Title: Random tag appeared in a span - </center>

Body:
Hi I have a  in my code and i am using it for javascript code. But suddenly  tag appeared in my code. I am created a function to display how many users are online. PHP and Javascript codes are added below...........................................................................

My index.php code:

    CMS Admin

    <button class="btn btn-link btn-sm order-1 order-lg-0 me-4 me-lg-0" id="sidebarToggle" href="#!"></button>

    <form class="d-none d-md-inline-block form-inline ms-auto me-0 me-md-3 my-2 my-md-0">

    </form>

        <?php //echo users_online(); ?>

        Users Online:

        Home

             <?php echo $_SESSION['firstname']; ?>

Settings

Activity Log

Logout

My js code:

function loadUsersOnline() {
    $.get("functions.php?onlineusers=result", function (data) {
        $(".usersonline").text(data);
    });
}

setInterval(function () {
    loadUsersOnline();
},500);

My functions.php code:

function users_online()
{

    if (isset($_GET['onlineusers'])) {

        global $connection;

        if (!$connection) {
            session_start();

            include "../includes/db.php";

            $session = session_id();
            $time = time();
            $time_out_in_seconds = 60;
            $time_out = $time - $time_out_in_seconds;

            $query = "SELECT * FROM users_online WHERE session = '$session'";
            $send_query = mysqli_query($connection, $query);
            $count = mysqli_num_rows($send_query);

            if ($count == NULL) {
                mysqli_query($connection, "INSERT INTO users_online(session, time) VALUES('$session', '$time')");
            } else {
                mysqli_query($connection, "UPDATE users_online SET time = '$time' WHERE session = '$session'");
            }

            $users_online_query = mysqli_query($connection, "SELECT * FROM users_online WHERE time > '$time_out'");
            echo $users_count = mysqli_num_rows($users_online_query);
        }
    } // get req
}

users_online();

Thanks in Advance!


问:
The time complexity for accessing MultiDArray
What is the time complexity of accessing 2D Array: system.out.print(Arr[0][1]);

I searched, but found more than one answers


问:
pipenv installed pip does not work with specified python version
On a Raspberry Pi OS Bullseye system, I tried to install numpy with pipenv using a specific python version and got this:

```<code>$ pipenv --python /opt/python/3.7/bin/python3 install numpy --verbose
Creating a virtualenv for this project…
Using /opt/python/3.7/bin/python3 (3.7.9) to create virtualenv…
⠋created virtual environment CPython3.7.9.final.0-32 in 410ms
  creator CPython3Posix(dest=/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv)
    added seed packages: pip==20.3.4, pkg_resources==0.0.0, setuptools==44.1.1, wheel==0.34.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

Virtualenv location: /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC
Installing numpy…
⠙Installing 'numpy'
$ "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip" install   --verbose    "numpy" -i https://pypi.org/simple --exists-action w
⠙
Error:  An error occurred while installing numpy!
Traceback (most recent call last):
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pip._vendor.packaging'
</code>```

Looking at the verbose output i see that the path to pip used by pipenv is /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip.

Calling this pip directly indeed leads to the same error:

```<code>$ /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip --version
Traceback (most recent call last):
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pip._vendor.packaging'
</code>```

Which python is used in that case? Looking at the shebang line it would seem it's the one I passed to pipenv initially:

```<code>$ head -n 1 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip
#!/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python

$ ls -l /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python
lrwxrwxrwx 1 pi pi 27 Dec 11 11:00 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python -> /opt/python/3.7/bin/python3
</code>```

But when I explicitly use that exact interpreter there is no error:

```<code>$ /opt/python/3.7/bin/python3 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip --version
pip 20.1.1 from /opt/python/3.7/lib/python3.7/site-packages/pip (python 3.7)
</code>```

The difference seems to be that in the case it goes wrong, the pip installation in /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip is used while in the working case it's the one in /opt/python/3.7/lib/python3.7/site-packages/pip.

But why? My understanding of the shebang is that it points to the interpreter that's to be used. In the working example all i do is call that interpreter explicitly myself. Why is there a difference in behaviour?

And also, why did pipenv even install its own pip in /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip ? Why didn't it reuse the pip that comes with the python version I passed? And if that's just how pipenv works, why is its pip broken? What's going on? And how can I fix it?

EDIT

When i use my system python 3.9 installation it works fine.

Body:
On a Raspberry Pi OS Bullseye system, I tried to install numpy with pipenv using a specific python version and got this:

$ pipenv --python /opt/python/3.7/bin/python3 install numpy --verbose
Creating a virtualenv for this project…
Using /opt/python/3.7/bin/python3 (3.7.9) to create virtualenv…
⠋created virtual environment CPython3.7.9.final.0-32 in 410ms
  creator CPython3Posix(dest=/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv)
    added seed packages: pip==20.3.4, pkg_resources==0.0.0, setuptools==44.1.1, wheel==0.34.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

Virtualenv location: /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC
Installing numpy…
⠙Installing 'numpy'
$ "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip" install   --verbose    "numpy" -i https://pypi.org/simple --exists-action w
⠙
Error:  An error occurred while installing numpy!
Traceback (most recent call last):
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pip._vendor.packaging'

Looking at the verbose output i see that the path to pip used by pipenv is /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip.

Calling this pip directly indeed leads to the same error:

$ /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip --version
Traceback (most recent call last):
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pip._vendor.packaging'

Which python is used in that case? Looking at the shebang line it would seem it's the one I passed to pipenv initially:

$ head -n 1 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip
#!/home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python

$ ls -l /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python
lrwxrwxrwx 1 pi pi 27 Dec 11 11:00 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/python -> /opt/python/3.7/bin/python3

But when I explicitly use that exact interpreter there is no error:

$ /opt/python/3.7/bin/python3 /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/bin/pip --version
pip 20.1.1 from /opt/python/3.7/lib/python3.7/site-packages/pip (python 3.7)

The difference seems to be that in the case it goes wrong, the pip installation in /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip is used while in the working case it's the one in /opt/python/3.7/lib/python3.7/site-packages/pip.

But why? My understanding of the shebang is that it points to the interpreter that's to be used. In the working example all i do is call that interpreter explicitly myself. Why is there a difference in behaviour?

And also, why did pipenv even install its own pip in /home/pi/.local/share/virtualenvs/deep-dregs-eaJke9eC/lib/python3.7/site-packages/pip ? Why didn't it reuse the pip that comes with the python version I passed? And if that's just how pipenv works, why is its pip broken? What's going on? And how can I fix it?

EDIT

When i use my system python 3.9 installation it works fine.


问:
Updating the lastModifiedTime of a file with Java on Windows fails when the filename includes non-ASCII characters
I have a Java program that's attempting to modify the last modified time of a file:

import java.io.File;
import java.util.Calendar.Builder;

public class UpdateMtime {
    public static void main(String[] args) {
        if (args.length < 1) {
            System.exit(1);
        }
        String fileName = args[0];
        try {
            File fileToUpdate = new File(fileName);
            Builder calBuilder = new Builder();
            calBuilder.setDate(2002, 10, 01);
            if(fileToUpdate.setLastModified(calBuilder.build().getTimeInMillis())) {
                System.out.println("Mtime update successful");
            }
            else {
                System.out.println("Mtime update unsuccessful");
            }
        }
        catch (Exception e) {
            System.out.println(e.getMessage());
            System.out.println(e.getStackTrace());
        }
    }
}
```

On Windows, running java UpdateMtime "test.txt" in PowerShell 7.3 returns Mtime update successful, and I can see the file's last modified time is updated to 11/01/2022 12:00AM.

However, running java UpdateMtime "тестовый файл.txt" returns Mtime update unsuccessful, and the file's last modified time is not updated.

Why isn't Java able to update the last modified time of a filename that has non-ASCII characters on Windows? I tried this same example on Linux, and the program was able to successfully update the last modified time on both files.

Body:
I have a Java program that's attempting to modify the last modified time of a file:

import java.io.File;
import java.util.Calendar.Builder;

public class UpdateMtime {
    public static void main(String[] args) {
        if (args.length < 1) {
            System.exit(1);
        }
        String fileName = args[0];
        try {
            File fileToUpdate = new File(fileName);
            Builder calBuilder = new Builder();
            calBuilder.setDate(2002, 10, 01);
            if(fileToUpdate.setLastModified(calBuilder.build().getTimeInMillis())) {
                System.out.println("Mtime update successful");
            }
            else {
                System.out.println("Mtime update unsuccessful");
            }
        }
        catch (Exception e) {
            System.out.println(e.getMessage());
            System.out.println(e.getStackTrace());
        }
    }
}

On Windows, running java UpdateMtime "test.txt" in PowerShell 7.3 returns Mtime update successful, and I can see the file's last modified time is updated to 11/01/2022 12:00AM.

However, running java UpdateMtime "тестовый файл.txt" returns Mtime update unsuccessful, and the file's last modified time is not updated.

Why isn't Java able to update the last modified time of a filename that has non-ASCII characters on Windows? I tried this same example on Linux, and the program was able to successfully update the last modified time on both files.


问:
HTML Mail background is white cause of signature
I have created an e-mail-signature in HTML and I am using it with the native Apple Mail-app on iPhone.

I am using Dark Mode, too, but sadly, the background of my emails turns white if I use my signature. I don't know what is causing this.

Is there a way to put the background transparent so it won't be white and turns black text to white (automatically done by the mail client, here apple mail)

Here is my signature :

```<code><div>
    <style>
        .sh-src a {
            text-decoration: none !important;
        }
    </style>
</div>
<br />
<table cellpadding="0" cellspacing="0" border="0" class="sh-src" style="margin: 0px; border-collapse: collapse;">
    <tr>
        <td style="padding: 0px 1px 0px 0px;">
            <table cellpadding="0" cellspacing="0" border="0" style="border-collapse: separate; margin: 0px;">
                <tr>
                    <!---->
                    <td valign="top" style="padding: 0px 17px 0px 1px; vertical-align: top;">
                        <table cellpadding="0" cellspacing="0" border="0" style="margin: 0px; border-collapse: collapse;">
                            <tr>
                                <td style="padding: 0px 1px 0px 0px; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap;">
                                    <p style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; font-weight: 700; color: rgb(0, 0, 0); white-space: nowrap; margin: 1px;">My name</p>
                                    <p style="font-family: Arial, sans-serif; font-size: 13px; line-height: 19px; white-space: nowrap; color: rgb(136, 136, 136); margin: 1px;">My function</p>
                                    <!---->
                                    <!---->
                                </td>
                            </tr>
                            <tr>
                                <!---->
                                <td valign="middle" colspan="3" style="padding: 3px 1px 0px 0px; vertical-align: middle;">
                                    <table cellpadding="0" cellspacing="0" border="0" style="margin: 0px; border-collapse: collapse;">
                                        <tr>
                                            <td width="22" style="font-size: 0px; line-height: 0px; padding: 0px 1px 0px 0px;">
                                                <p style="margin: 1px;">
                                                    <a href="linkedin url" target="_blank">
                                                        <img src="https://signaturehound.com/api/v1/png/linkedin/round-outlined/007bff.png" alt="" width="22" height="22" style="display: block; border: 0px; max-width: 22px;" />
                                                    </a>
                                                </p>
                                            </td>
                                            <td width="2" style="padding: 0px 0px 1px;"></td>
                                            <td width="22" style="font-size: 0px; line-height: 0px; padding: 0px 1px 0px 0px;">
                                                <p style="margin: 1px;">
                                                    <a href="insta url" target="_blank">
                                                        <img src="https://signaturehound.com/api/v1/png/instagram/round-outlined/007bff.png" alt="" width="22" height="22" style="display: block; border: 0px; max-width: 22px;" />
                                                    </a>
                                                </p>
                                            </td>
                                            <td width="2" style="padding: 0px 0px 1px;"></td>
                                            <td width="22" style="font-size: 0px; line-height: 0px; padding: 0px 1px 0px 0px;">
                                                <p style="margin: 1px;">
                                                    <a href="YouTube url" target="_blank">
                                                        <img src="https://signaturehound.com/api/v1/png/youtube/round-outlined/007bff.png" alt="" width="22" height="22" style="display: block; border: 0px; max-width: 22px;" />
                                                    </a>
                                                </p>
                                            </td>
                                            <td width="2" style="padding: 0px 0px 1px;"></td>
                                            <td width="22" style="font-size: 0px; line-height: 0px; padding: 0px 1px 0px 0px;">
                                                <p style="margin: 1px;">
                                                    <a href="imdb url" target="_blank">
                                                        <img src="https://signaturehound.com/api/v1/png/imdb/round-outlined/007bff.png" alt="" width="22" height="22" style="display: block; border: 0px; max-width: 22px;" />
                                                    </a>
                                                </p>
                                            </td>
                                            <td width="2" style="padding: 0px 0px 1px;"></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td style="padding: 1px 0px 0px; border-right-width: 2px; border-right-style: solid; border-right-color: rgb(0, 123, 255);"></td>
                    <td valign="top" style="padding: 0px 1px 0px 17px; vertical-align: top;">
                        <table cellpadding="0" cellspacing="0" border="0" style="margin: 0px; border-collapse: collapse;">
                            <tr>
                                <td style="padding: 0px 1px 0px 0px;">
                                    <table cellpadding="0" cellspacing="0" border="0" style="margin: 0px; border-collapse: collapse;">
                                        <tr>
                                            <td valign="middle" style="padding: 1px 5px 1px 0px; vertical-align: middle;">
                                                <p style="margin: 1px;"><img src="https://signaturehound.com/api/v1/png/email/default/007bff.png" alt="" width="18" height="18" style="display: block; border: 0px; max-width: 18px;" /></p>
                                            </td>
                                            <td style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(136, 136, 135) !important; padding: 1px 0px; vertical-align: middle;">
                                                <p style="margin: 1px;">
                                                    <a
                                                        href="mailto:mail"
                                                        target="_blank"
                                                        style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(136, 136, 136); text-decoration: none !important;"
                                                    >
                                                        <span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(136, 136, 136); text-decoration: none !important;">
                                                            mail.com
                                                        </span>
                                                    </a>
                                                </p>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="middle" style="padding: 1px 5px 1px 0px; vertical-align: middle;">
                                                <p style="margin: 1px;"><img src="https://signaturehound.com/api/v1/png/mobile/default/007bff.png" alt="" width="18" height="18" style="display: block; border: 0px; max-width: 18px;" /></p>
                                            </td>
                                            <td style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(136, 136, 135) !important; padding: 1px 0px; vertical-align: middle;">
                                                <p style="margin: 1px;">
                                                    <a
                                                        href="tel:phone"
                                                        target="_blank"
                                                        style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(136, 136, 136); text-decoration: none !important;"
                                                    >
                                                        <span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(136, 136, 136); text-decoration: none !important;">
                                                            My phone
                                                        </span>
                                                    </a>
                                                </p>
                                            </td>
                                        </tr>
                                        <!---->
                                        <tr>
                                            <td valign="middle" style="padding: 1px 5px 1px 0px; vertical-align: middle;">
                                                <p style="margin: 1px;"><img src="https://signaturehound.com/api/v1/png/website/default/007bff.png" alt="" width="18" height="18" style="display: block; border: 0px; max-width: 18px;" /></p>
                                            </td>
                                            <td
                                                style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(0, 123, 254) !important; font-weight: 700; padding: 1px 0px; vertical-align: middle;"
                                            >
                                                <p style="margin: 1px;">
                                                    <a
                                                        href="domain.com"
                                                        target="_blank"
                                                        style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(0, 123, 255); font-weight: 700; text-decoration: none !important;"
                                                    >
                                                        <span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap; color: rgb(0, 123, 255); font-weight: 700; text-decoration: none !important;">
                                                            domain.com
                                                        </span>
                                                    </a>
                                                </p>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" style="padding: 0px 1px 14px 0px; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: rgb(0, 123, 255);"></td>
                </tr>
            </table>
        </td>
    </tr>
    <!---->
    <!---->
    <!---->
    <tr>
        <td style="padding: 0px 1px 0px 0px;">

        </td>
    </tr>
</table>
</code>```

Also when I write the mail, the signature looks good as it should looks but not when it’s sent :

Body:
I have created an e-mail-signature in HTML and I am using it with the native Apple Mail-app on iPhone.

I am using Dark Mode, too, but sadly, the background of my emails turns white if I use my signature. I don't know what is causing this.

Is there a way to put the background transparent so it won't be white and turns black text to white (automatically done by the mail client, here apple mail)

Here is my signature :

My name

My function

                                                            mail.com

                                                            My phone

                                                            domain.com

Also when I write the mail, the signature looks good as it should looks but not when it’s sent :


问:
Kotlin changes parameter names to alphabetical values on release for a Flutter app
I recently started running into an issue, where, when building my Flutter in release mode to deploy to Play Console's internal testing track, some of my functions in Flutter started failing.

For context, I have EventChannels that stream data from a native function to Flutter, from which I construct a Flutter object.

After countless hours of investigation, it turned out that, in debug mode, the JSON string I'm constructing in Kotlin, contains the correct keys, however, when doing the same thing in release, the keys turn to a:, b:, c:, etc.

At this point in time, I've got no obfuscation enabled in the app, and I'm not too sure why this would have suddenly broke.

I can't cater for the actual names, and alphabetical values in my toJson() function on my class, so want to know how, in release, can I get my parameter values back?

The kotlin class that's encoded to JSON looks like this:

class ScanResponseModel(var name: String, var mac: String, var axis: String, var number : String)
```
<p>The json output for this, in <code>DEBUG</code>, looks like this:</p>
<pre class="lang-json prettyprint-override"><code>[{
    "name":"2325",
    "mac":"D4:1C:32:33:EE:1F",
    "axis":"left",
    "number":"0002325"
}, {
    "name":"2122",
    "mac":"DC:20:3F:E7:05:B7",
    "axis":"right",
    "number":"0002122"
}]
</code>```

The exact same output in RELEASE, looks like this:

[{
    "a":"2325",
    "b":"D4:1C:32:33:EE:1F",
    "c":"left",
    "d":"0002325"
},
{
    "a":"2122",
    "b":"DC:20:3F:E7:05:B7",
    "c":"right",
    "d":"0002122"
}]
```

Body:
I recently started running into an issue, where, when building my Flutter in release mode to deploy to Play Console's internal testing track, some of my functions in Flutter started failing.

For context, I have EventChannels that stream data from a native function to Flutter, from which I construct a Flutter object.

After countless hours of investigation, it turned out that, in debug mode, the JSON string I'm constructing in Kotlin, contains the correct keys, however, when doing the same thing in release, the keys turn to a:, b:, c:, etc.

At this point in time, I've got no obfuscation enabled in the app, and I'm not too sure why this would have suddenly broke.

I can't cater for the actual names, and alphabetical values in my toJson() function on my class, so want to know how, in release, can I get my parameter values back?

The kotlin class that's encoded to JSON looks like this:

class ScanResponseModel(var name: String, var mac: String, var axis: String, var number : String)

The json output for this, in DEBUG, looks like this:

[{
    "name":"2325",
    "mac":"D4:1C:32:33:EE:1F",
    "axis":"left",
    "number":"0002325"
}, {
    "name":"2122",
    "mac":"DC:20:3F:E7:05:B7",
    "axis":"right",
    "number":"0002122"
}]

The exact same output in RELEASE, looks like this:

[{
    "a":"2325",
    "b":"D4:1C:32:33:EE:1F",
    "c":"left",
    "d":"0002325"
},
{
    "a":"2122",
    "b":"DC:20:3F:E7:05:B7",
    "c":"right",
    "d":"0002122"
}]


问:
Vb.NET - Transparent elements in User Control
Does anybody know why this happens?
I've a TabControl where I insert UserControls but all the elements with white background create a hole in the WinForm and I can see the desktop...

The only way I find is to change Background color of elements but in some Element I've some visual bug.