问:
How can i make an a footer and the name in the had?
I need to make the name: Data Science in the header and in the footer i need to make
an a Steve Jacob. How can i make this, if i try it looks like wery bad it overlaps the left menu. There is how cite looks like:

There is my index.html:

Again, how can i make some notice in the footer and header which doesn't overlaps the left menu.

imgsize {
  width: 30%;
  height: 30%;
  margin-left: 30%;
  display: block;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><head>
  <title>Главная</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900" rel="stylesheet">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <link rel="stylesheet" href="static/css/style.css">

</head>

<body>

  <div class="wrapper d-flex align-items-stretch">
    <nav id="sidebar">
      <div class="custom-menu">
        <button type="button" id="sidebarCollapse" class="btn btn-primary">
              <i class="fa fa-bars"></i>
              <span class="sr-only">Toggle Menu</span>
            </button>
      </div>
      <div class="p-4 pt-5">
        <ul class="list-unstyled components mb-5">
          <img class="imgsize" src="{% static 'media/logo.png' %}" alt="">
          <li class="active">
            Главная
          </li>
          <li>
            Востребованность
          </li>
          <li>
            География
          </li>
          <li>
            Навыки
          </li>
          <li>
            Последние вакансии
          </li>
        </ul>

        <div class="footer">
          <p>
            <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->

            <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
          </p>
        </div>

      </div>
    </nav>

    <!-- Page Content  -->
    <div id="content" class="p-4 p-md-5 pt-5">

      <h2 class="mb-4">Sidebar #02</h2>

    </div>
  </div>

  <script src="static/js/jquery.min.js"></script>
  <script src="static/js/popper.js"></script>
  <script src="static/js/bootstrap.min.js"></script>
  <script src="static/js/main.js"></script>
</body>
<footer>

</footer></code>```

Body:
I need to make the name: Data Science in the header and in the footer i need to make
an a Steve Jacob. How can i make this, if i try it looks like wery bad it overlaps the left menu. There is how cite looks like:

There is my index.html:

Again, how can i make some notice in the footer and header which doesn't overlaps the left menu.

imgsize {
  width: 30%;
  height: 30%;
  margin-left: 30%;
  display: block;
}

  <title>Главная</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900" rel="stylesheet">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <link rel="stylesheet" href="static/css/style.css">

        <button type="button" id="sidebarCollapse" class="btn btn-primary">

              Toggle Menu
            </button>

            Главная

            Востребованность

            География

            Навыки

            Последние вакансии

Sidebar #02


来源: stackexchange

问:
losing data with merge
I try to combine two dataframes with the following code:

```<code>data = data.merge(test_data, on=['Date','About'], how='left')
</code>```

data columns:

```<code>Date About Duration_training RPE_training ...
</code>```

test_data columns:

```<code>Date About T-test Yoyo Heart_Rate(max)....
</code>```

I want to combine these two dataframes into one.
The data dataframe consists of all the days that the players had a training. So almost all days
The test-data dataframe consists of all information about test we do a few times a year.

The problem is now that in some cases, a test was performed on a day that there was no training. Therefore the information of that day get's lost.

I tried all options off merge and join but can't find a way that it is working how i would

ContentLicense: CC BY-SA 4.0

Title: losing data with merge

Body:
I try to combine two dataframes with the following code:

data = data.merge(test_data, on=['Date','About'], how='left')

data columns:

Date About Duration_training RPE_training ...

test_data columns:

Date About T-test Yoyo Heart_Rate(max)....

I want to combine these two dataframes into one.
The data dataframe consists of all the days that the players had a training. So almost all days
The test-data dataframe consists of all information about test we do a few times a year.

The problem is now that in some cases, a test was performed on a day that there was no training. Therefore the information of that day get's lost.

I tried all options off merge and join but can't find a way that it is working how i would


问:
how to handle CONNECT method in local proxy server written in Dart (http tunnel)
I'm trying to add a local proxy server in android mobile app (using Dart/Flutter) to modify HTTP response. This works fine for HTTP requests, but not for HTTPS.

For any HTTPS object, it sends with CONNECT method and I'm not sure how I can handle this. I have this code so far, but not even sure whether I'm doing it right. My goal is to get the original image from the response and validate the image content and block if invalid. Any suggestions or advice would be appreciated!

```<code>var proxyServer = await HttpServer.bind(addr, port);
proxyServer.listen((HttpRequest request) async {
    if (request.method == 'CONNECT') {
        int port = 443;
        String host = request.headers.host!;

        LogService.log('proxy server will try connecting to $host $port');

        var client = HttpClient();
        client.connectionTimeout = const Duration(seconds: 5);
        client
            .open(request.method, host, port, '')
            .then((HttpClientRequest clientRequest) async {

          var socket = await request.response.detachSocket();
          socket.listen((data) {
            LogService.log('proxy - listening on socket $data');

            // TODO: Parse the data as an HTTP response
          });

          // Close the connection when either side closes
          clientRequest.done.then((_) {
            LogService.log('proxy - clientRequest is done');
            socket.close();
          });
          socket.done.then((_) {
            LogService.log('proxy - socket is done');
            clientRequest.close();
          });
        });
    } else {
       ...
    }
});
</code>```

Body:
I'm trying to add a local proxy server in android mobile app (using Dart/Flutter) to modify HTTP response. This works fine for HTTP requests, but not for HTTPS.

For any HTTPS object, it sends with CONNECT method and I'm not sure how I can handle this. I have this code so far, but not even sure whether I'm doing it right. My goal is to get the original image from the response and validate the image content and block if invalid. Any suggestions or advice would be appreciated!

var proxyServer = await HttpServer.bind(addr, port);
proxyServer.listen((HttpRequest request) async {
    if (request.method == 'CONNECT') {
        int port = 443;
        String host = request.headers.host!;

        LogService.log('proxy server will try connecting to $host $port');

        var client = HttpClient();
        client.connectionTimeout = const Duration(seconds: 5);
        client
            .open(request.method, host, port, '')
            .then((HttpClientRequest clientRequest) async {

          var socket = await request.response.detachSocket();
          socket.listen((data) {
            LogService.log('proxy - listening on socket $data');

            // TODO: Parse the data as an HTTP response
          });

          // Close the connection when either side closes
          clientRequest.done.then((_) {
            LogService.log('proxy - clientRequest is done');
            socket.close();
          });
          socket.done.then((_) {
            LogService.log('proxy - socket is done');
            clientRequest.close();
          });
        });
    } else {
       ...
    }
});


问:
Justify Text in ReadMoreTextView in xml
I want to justify the text inside ReadMoreTexView like in Word.I am using ReadMoreTextView for adding Readmore functionality, but i want the text inside the ReadMoreTextView to be justified.

```<code>`<kr.co.prnd.readmore.ReadMoreTextView
    android:id="@+id/hikayatStory"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="24dp"
    android:layout_marginHorizontal="20dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="36dp"
    android:layout_marginBottom="16dp"
    android:fontFamily="@font/hoftype_capricho_light"
    android:paddingBottom="32dp"
    android:text=""
    android:inputType="textMultiLine"
    android:textScaleX="1.1"
    android:layout_gravity="center_horizontal"
    android:gravity="center"
    android:breakStrategy="balanced"
    android:textAlignment="center"
    android:justificationMode="inter_word"
    android:textColor="@color/black"
    android:textSize="16sp"
    app:readMoreColor="#4169e1"
    app:readMoreMaxLine="16"
    app:readMoreText="...Read More"
    />`
</code>```

i have tried textJustificationMode=true ,textAllignment=center,centerHorizonal , android:breakStrategy="balanced" .i am using this dependecy for ReadMoreTextView

implementation 'kr.co.prnd:readmore-textview:1.0.0'

Title: Justify Text in ReadMoreTextView in xml

Body:
I want to justify the text inside ReadMoreTexView like in Word.I am using ReadMoreTextView for adding Readmore functionality, but i want the text inside the ReadMoreTextView to be justified.

`<kr.co.prnd.readmore.ReadMoreTextView
    android:id="@+id/hikayatStory"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="24dp"
    android:layout_marginHorizontal="20dp"
    android:layout_marginTop="16dp"
    android:layout_marginEnd="36dp"
    android:layout_marginBottom="16dp"
    android:fontFamily="@font/hoftype_capricho_light"
    android:paddingBottom="32dp"
    android:text=""
    android:inputType="textMultiLine"
    android:textScaleX="1.1"
    android:layout_gravity="center_horizontal"
    android:gravity="center"
    android:breakStrategy="balanced"
    android:textAlignment="center"
    android:justificationMode="inter_word"
    android:textColor="@color/black"
    android:textSize="16sp"
    app:readMoreColor="#4169e1"
    app:readMoreMaxLine="16"
    app:readMoreText="...Read More"
    />`

i have tried textJustificationMode=true ,textAllignment=center,centerHorizonal , android:breakStrategy="balanced" .i am using this dependecy for ReadMoreTextView

implementation 'kr.co.prnd:readmore-textview:1.0.0'


问:
angular material dropdown can't repeat selection
I use Angular Material on my own NavBar:

Each drop-down responds the first time, but will NOT respond to consecutive clicks.
For example, if a user wishes to start a new project and after completing that, they would like to start another one, Start a New Project is unresponsive.

The user should not have to click around the screen in order to make Start New Project responsive again.

Thoughts?


问:
Html area don't follow his image
I have an image with an area (map) but the area move when I zoom.
The image have a width of 100% (don't move when I zoom) because I don't want it to take all the window when I zoom, and I think that's the problem. Here is my code:

```<code><!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <title>Hello World</title>
    <style>

        .img {
            width:100%;
        }

        .global {
            width:100%;
        }

        .right {
            position:relative;
            float:left;
            width:50%;
            border-style: solid;
        }

        .left {
            position:relative;
            margin-left:50%;
            border-style: solid;
        }
    </style>
</head>
<body>
    <h1>Bienvenue !</h1>
    <h2>
        <label style="color:blue;">
            Salut,<br>
            Ca va bien ?
        </label>
        <button onclick="myFunction()">
            Changer de réponse
        </button>
        <label id = "Label1">
            Oui
        </label>
        <script>
             function myFunction() {
                var txt = document.getElementById('Label1');
                if (txt.innerHTML === "Oui") {
                    txt.innerHTML = "Non";
                } else {
                    txt.innerHTML = "Oui";
                }
            }
        </script>
    </h2>
    <div class = "global">
        <div class = "right">
            <img src="image test.png" class = "img" usemap="#image-map">
                <map name="image-map">
                    <area alt="" title="" href="#" onclick = "myFunction()" coords="115,101,125,136,197,114,185,80" shape="poly">
                </map>
        </div>
        <div class = "left">
            <label>Salut comment ça va ?</label>
        </div>
    </div>

</body>
</html>
</code>```

That's the link of the image I have:

```<code>data:image/png;base64,[encoded data, 4532 characters]
</code>```

I can't give a width to the area so it follow the image and don't have any other idea to do that.

Title: Html area don't follow his image

Body:
I have an image with an area (map) but the area move when I zoom.
The image have a width of 100% (don't move when I zoom) because I don't want it to take all the window when I zoom, and I think that's the problem. Here is my code:

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Hello World</title>

Bienvenue !

            Salut,

            Ca va bien ?

        <button onclick="myFunction()">
            Changer de réponse
        </button>

            Oui

                <map name="image-map">
                    <area alt="" title="" href="#" onclick = "myFunction()" coords="115,101,125,136,197,114,185,80" shape="poly">
                </map>

            Salut comment ça va ?

That's the link of the image I have:

data:image/png;base64,[encoded data, 4532 characters]

I can't give a width to the area so it follow the image and don't have any other idea to do that.


问:
Signals and Slot access specifier in Qt
I am incredibly confused about the concept of access specifiers for Signals and Slots in Qt.

While researching, I stumble upon many answers that suggest the following:

"signals should only be emitted by the class who owns the signal."

However, immediately after the above suggestion, they also say something opposite:

"if signals were really protected or private, you would not be able to connect to them using the pointer-to-member function syntax. To make such connections possible thy need to be public"

I even tried looking up the Qt6 documentation:

"Signals are public access functions and can be emitted from anywhere, but we recommend to only emit them from the class that defines the signal and its subclasses."

I am truly confused at this point. Therefore, I have a couple of questions that I would highly appreciate it if someone can answer for me:

1- Is it required for Qt signals to be public or not? (Why does MOC make signals public after compilation?)

2- If it is not required for signals to be public, then what is the benefit of having them private?

3- If it is required for signals to be public, then why can slots have any access specifier?

4- Do access specifiers effect function-pointers at all in the connect method for signals and slots?

---------------------------------------------------

Title: Signals and Slot access specifier in Qt


问:
Gallery widget with multiple galleries inside, need to know when an user clicks on a certain gallery to display a certain element above the gallery
I'm using the Elementor native Gallery widget with multiple galleries, the user selects the title of the gallery and it automatically filters out by type. It works like a charm, point is I need to display boxes (divs) above the gallery, each for every gallery type and each with different information on the inside.
I thought about creating the divs and setting them to display none then using CSS to display when certain class criteria are met.

The point is I need to know when the user is on a certain gallery. I noticed elementor adds an elementor-item-active class on the element, but I can not simply activate a div when this class is present, since I would need to know which element has been triggered to display the correct div.

That's the HTML of the gallery element, as you can see, Gallery 1 is selected as it has the active attribute.

All galleries

g1

g2

g3

g4

```

How can I sort this out?

Body:
I'm using the Elementor native Gallery widget with multiple galleries, the user selects the title of the gallery and it automatically filters out by type. It works like a charm, point is I need to display boxes (divs) above the gallery, each for every gallery type and each with different information on the inside.
I thought about creating the divs and setting them to display none then using CSS to display when certain class criteria are met.

The point is I need to know when the user is on a certain gallery. I noticed elementor adds an elementor-item-active class on the element, but I can not simply activate a div when this class is present, since I would need to know which element has been triggered to display the correct div.

That's the HTML of the gallery element, as you can see, Gallery 1 is selected as it has the active attribute.

All galleries

g1

g2

g3

g4

How can I sort this out?


问:
Why "MaterialDesignInXAML" passwordbox icon not show?
I use "MaterialDesignInXAML" in the design of the page, I have a problem, I used the icon in the code below for the textbox, but the same method does not work for the passwordbox.
I do not know why ! No matter how hard I try, I cannot find a suitable solution. Look at the picture, the part related to the password icon does not appear.

```<code><StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                 <TextBox x:Name="txtUsername" Width="200" Height="35" materialDesign:TextFieldAssist.HasClearButton="True"
                                 TextAlignment="Left" VerticalContentAlignment="Center" FontSize="15"
                                 materialDesign:HintAssist.Hint="Username"
                                 materialDesign:TextFieldAssist.HasLeadingIcon="True"
                                 materialDesign:TextFieldAssist.LeadingIcon="Person"
                                 materialDesign:TextFieldAssist.LeadingIconSize="15"/>

                    </StackPanel>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 10 0 0">
                        <PasswordBox x:Name="txtPassword" Width="200" Height="35"
                                 materialDesign:TextFieldAssist.HasClearButton="True"
                                 VerticalContentAlignment="Center" FontSize="15"
                                 materialDesign:HintAssist.Hint="Username"
                                 materialDesign:TextFieldAssist.HasLeadingIcon="True"
                                 materialDesign:TextFieldAssist.LeadingIcon="Password"
                                     materialDesign:PasswordBoxAssist.PasswordMaskedIcon="Password"
                                 materialDesign:TextFieldAssist.LeadingIconSize="15"/>
                    </StackPanel>
</code>```

Password Icon not show!

Body:
I use "MaterialDesignInXAML" in the design of the page, I have a problem, I used the icon in the code below for the textbox, but the same method does not work for the passwordbox.
I do not know why ! No matter how hard I try, I cannot find a suitable solution. Look at the picture, the part related to the password icon does not appear.

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                 <TextBox x:Name="txtUsername" Width="200" Height="35" materialDesign:TextFieldAssist.HasClearButton="True"
                                 TextAlignment="Left" VerticalContentAlignment="Center" FontSize="15"
                                 materialDesign:HintAssist.Hint="Username"
                                 materialDesign:TextFieldAssist.HasLeadingIcon="True"
                                 materialDesign:TextFieldAssist.LeadingIcon="Person"
                                 materialDesign:TextFieldAssist.LeadingIconSize="15"/>

                    </StackPanel>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 10 0 0">
                        <PasswordBox x:Name="txtPassword" Width="200" Height="35"
                                 materialDesign:TextFieldAssist.HasClearButton="True"
                                 VerticalContentAlignment="Center" FontSize="15"
                                 materialDesign:HintAssist.Hint="Username"
                                 materialDesign:TextFieldAssist.HasLeadingIcon="True"
                                 materialDesign:TextFieldAssist.LeadingIcon="Password"
                                     materialDesign:PasswordBoxAssist.PasswordMaskedIcon="Password"
                                 materialDesign:TextFieldAssist.LeadingIconSize="15"/>
                    </StackPanel>

Password Icon not show!


问:
Why this "Error: Pattern matching error: no pattern matches value {"arch":"x64","distro":"rhel"}" appears whenever I run "npx prisma (some command)"?
Whenever I run npx prisma (some other command) I got that error (Error: Pattern matching error: no pattern matches value {"arch":"x64","distro":"rhel"}).
I don't understand what can be the problem. My application still is running properly.
Can anyone help me out with this? Thanks in advance!

I googled it and the answers I found suggest that there are some incompatibility somewhere over my application between some dependence, or thing related, and my operating system. However, I am not really sure about this but it can be a clue. If any other technical information be necessary to resolve this, comment here and I will display it.


问:
Setting custom headers on client side to be retrieved by server
I am creating a sort of authentication system, where a pop up opens, a user authenticates, the page closes, and a script retrieves all the users data from a database.

A function on the client side is supposed to set headers for the website using the authentication, then refresh it so that the headers can be accessed by a server.

There are multiple constraints

I can not just send a POST request to the server with the headers as the request body.

This is because the script is meant to be used by others and I want it to be as simple as possible (the dev shouldn’t have to create a bunch of POST endpoints or anything like that. I’m going for something like request.headers[“auth_username”].

I did some research on this and found the Headers API, and I tried that- this isn’t working for some reason because when I log all the headers on the server side I just get the default ones.

Here is my code:

const h = new Headers();
var authWindow;
window.addEventListener("message",(data)=>{
  h.set("so-auth-user",data.display);
  h.set("so-auth-email", data.email);
  h.set("so-auth-name", data.fName + " " + data.lName);
  setTimeout(()=>{authWindow.close()},500);

  location.reload();
})
```

The event listener just listens for the data sent by the pop up.

One thing that I immediately notice is that the Headers object is never acted upon. As far as my understanding goes, all the Header interface does is create a string with all of the headers… It doesn’t actually set headers on the website.

If this is the case, how would I set the headers so that when the servers are the request they can actually interact with the header values.

I don’t want to create an API call- I just need it so that all subsequent requests contain my custom headers… how would you go about this?

Body:
I am creating a sort of authentication system, where a pop up opens, a user authenticates, the page closes, and a script retrieves all the users data from a database.

A function on the client side is supposed to set headers for the website using the authentication, then refresh it so that the headers can be accessed by a server.

There are multiple constraints

I can not just send a POST request to the server with the headers as the request body.

This is because the script is meant to be used by others and I want it to be as simple as possible (the dev shouldn’t have to create a bunch of POST endpoints or anything like that. I’m going for something like request.headers[“auth_username”].

I did some research on this and found the Headers API, and I tried that- this isn’t working for some reason because when I log all the headers on the server side I just get the default ones.

Here is my code:

const h = new Headers();
var authWindow;
window.addEventListener("message",(data)=>{
  h.set("so-auth-user",data.display);
  h.set("so-auth-email", data.email);
  h.set("so-auth-name", data.fName + " " + data.lName);
  setTimeout(()=>{authWindow.close()},500);

  location.reload();
})

The event listener just listens for the data sent by the pop up.

One thing that I immediately notice is that the Headers object is never acted upon. As far as my understanding goes, all the Header interface does is create a string with all of the headers… It doesn’t actually set headers on the website.

If this is the case, how would I set the headers so that when the servers are the request they can actually interact with the header values.

I don’t want to create an API call- I just need it so that all subsequent requests contain my custom headers… how would you go about this?


问:
Why am I getting empty list from call to ossie.utils.sb.catalog() in RedhawkSDR manual's initial example of the Python Sandbox
I have just installed a Dockerized version of Redhawk from this Git repo: docker-redhawk-ubuntu

I'm attempting to work my way through the first sandbox exercise in the Redhawk manual Redhawk-Manual, but am encountering the following difficulty. The first two steps in this exercise are:

```<code>>>> from ossie.utils import sb
>>> sb.catalog()
['rh.HardLimit', 'rh.SigGen', ...]
</code>```

However, the response I get from the call to sb.catalog() is:

```<code>>>> sb.catalog()
[]
</code>```

What am I failing to see here? How do I need to set-up/initialize things so that I get the correct response from the call to sb.catalog()?

Body:
I have just installed a Dockerized version of Redhawk from this Git repo: docker-redhawk-ubuntu

I'm attempting to work my way through the first sandbox exercise in the Redhawk manual Redhawk-Manual, but am encountering the following difficulty. The first two steps in this exercise are:

>>> from ossie.utils import sb
>>> sb.catalog()
['rh.HardLimit', 'rh.SigGen', ...]

However, the response I get from the call to sb.catalog() is:

>>> sb.catalog()
[]

What am I failing to see here? How do I need to set-up/initialize things so that I get the correct response from the call to sb.catalog()?


问:
Extract the line from the file, concatenate it with a certain string problem
I have a problem, in the text file I have the form "User:Username Password,Real name Real Surname Email" and so on several lines, how can I add the word "(suspended)" to the beginning of a specific line?

My code does this:

```<code>"U(suspended)ser:Username Password,Real name Real Surname Email"
</code>```

How to fix it,to get?

```<code>"(suspended)User:Username Password,Real name Real Surname Email"
</code>```

Here's code:

```<code>    char username_to_suspend[50];
    scanf("%s",username_to_suspend);
    char line[100];
    char new_line[sizeof(line)]="(suspended) ";
    FILE *fp = fopen("users.txt", "r+");
    while(fgets(line,sizeof(line),fp)!=NULL)
    {
        if(strstr(line,username_to_suspend)!=NULL)
        {
            strcat(new_line,&line[1]);
            fseek(fp, -strlen(line), SEEK_CUR);
            fputs(new_line, fp);
        }
        else
        {
            continue;
        }
       break;

    }

    fclose(fp);
</code>```

Thanks in advance!

Best regards!

Body:
I have a problem, in the text file I have the form "User:Username Password,Real name Real Surname Email" and so on several lines, how can I add the word "(suspended)" to the beginning of a specific line?

My code does this:

"U(suspended)ser:Username Password,Real name Real Surname Email"

How to fix it,to get?

"(suspended)User:Username Password,Real name Real Surname Email"

Here's code:

    char username_to_suspend[50];
    scanf("%s",username_to_suspend);
    char line[100];
    char new_line[sizeof(line)]="(suspended) ";
    FILE *fp = fopen("users.txt", "r+");
    while(fgets(line,sizeof(line),fp)!=NULL)
    {
        if(strstr(line,username_to_suspend)!=NULL)
        {
            strcat(new_line,&line[1]);
            fseek(fp, -strlen(line), SEEK_CUR);
            fputs(new_line, fp);
        }
        else
        {
            continue;
        }
       break;

    }

    fclose(fp);

Thanks in advance!

Best regards!


问:
How do I truncate content from an input field to only 100 characters?
I want to be able to truncate the text from an input field that I save in my server with Node.js and express and display only the first 100 characters with a read more link attached.</p>
```<code><%- include("partials/header")  -%>

<h1>Home!</h1>

<p> <%= startingContent %> </p>

<% posts.forEach(function(post){%>
    <h1><%= post.title %></h1>
    <p>
        <%= post.content %>
        <a href="/posts/<%=post.title%>">Read More</a>
    </p>

<%})%>

<%- include("partials/footer") -%>
</code>```

Body:
I want to be able to truncate the text from an input field that I save in my server with Node.js and express and display only the first 100 characters with a read more link attached.

<%- include("partials/header")  -%>

Home!

 <%= startingContent %>

<% posts.forEach(function(post){%>

<%= post.title %>

        <%= post.content %>
        <a href="/posts/<%=post.title%>">Read More

<%})%>

<%- include("partials/footer") -%>


问:
Angular StoryBook. Color Change of Element. Want to change the color of the label and the text from storybook
I am writing an angular storybook for my component. I want to change the color of the stamp and also the color of the stampTitle. I have tried the following.

The HTML is like this.

```<code><ion-text class="{{stampClass}}">{{stampTitle}}</ion-text>
</code>```

My TS file properties to bind are

```<code> @Input() stamplClass:string;
  @Input() stampTitle:string;

</code>```

My component CSS are:

```<code>.class1 {
    background-color: var(-stamp-primary)
    color: var(-stamp--primarytext);
}
.class2 {
    background-color: var(-stamp-secondary)
    color: var(-stamp--secondarytext);
}
.class3{
    background-color: var(-stamp-teritiary)
    color: var(-stamp--teritiarytext);
}

</code>```

My Story for the above component is:

```<code>export const Stamp = Template.bind({});

const stampText = "Messi";
const stampClass = 'class2';

Stamp.args = {
    stampClass: stampClass,
    stampTitle: stampText,
};
</code>```

I want to change the color of the background and color of the textbook from storybook for testing purpose.

Body:
I am writing an angular storybook for my component. I want to change the color of the stamp and also the color of the stampTitle. I have tried the following.

The HTML is like this.

<ion-text class="{{stampClass}}">{{stampTitle}}</ion-text>

My TS file properties to bind are

 @Input() stamplClass:string;
  @Input() stampTitle:string;

My component CSS are:

.class1 {
    background-color: var(-stamp-primary)
    color: var(-stamp--primarytext);
}
.class2 {
    background-color: var(-stamp-secondary)
    color: var(-stamp--secondarytext);
}
.class3{
    background-color: var(-stamp-teritiary)
    color: var(-stamp--teritiarytext);
}

My Story for the above component is:

export const Stamp = Template.bind({});

const stampText = "Messi";
const stampClass = 'class2';

Stamp.args = {
    stampClass: stampClass,
    stampTitle: stampText,
};

I want to change the color of the background and color of the textbook from storybook for testing purpose.


问:
I am creating a shayri Application in Android Studio using Django admin as a Backend. (Kotlin)
My Application is simple, Django Backend has only one model named AddShayri and it has feature image and description as a field.

Right now I created an API in Django, but it is public. I want to protect it using an API key.

How can I do that?


问:
window is not defined - react-draft-wysiwyg even though I use it with next js (ssr)
A question has already been opened about this problem, but when I applied the given answer, the same error still persisted. I'm trying to do it using Next Js version 13. The error I get is "window is not defined". Does anyone have any knowledge of this?</p>
```<code>import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
import Layout from "../../components/Layout";
import { useState } from 'react';
import { EditorState, convertToRaw } from 'draft-js';
import dynamic from 'next/dynamic';
import draftToHtml from 'draftjs-to-html';
import htmlToDraft from 'html-to-draftjs';

const Editor = dynamic(
    () => import('react-draft-wysiwyg').then(mod => mod.Editor),
    { ssr: false }
)
</code>```

Body:
A question has already been opened about this problem, but when I applied the given answer, the same error still persisted. I'm trying to do it using Next Js version 13. The error I get is "window is not defined". Does anyone have any knowledge of this?

import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
import Layout from "../../components/Layout";
import { useState } from 'react';
import { EditorState, convertToRaw } from 'draft-js';
import dynamic from 'next/dynamic';
import draftToHtml from 'draftjs-to-html';
import htmlToDraft from 'html-to-draftjs';

const Editor = dynamic(
    () => import('react-draft-wysiwyg').then(mod => mod.Editor),
    { ssr: false }
)


问:
Unable to implement Google Maps in android compose project
I have setup a compose android app that uses google maps. it works fine requesting permission the first time, but any attempt to run it again I get this error.

Unable to update local snapshot for com.google.android.libraries.consentverifier, may result in stale flags.
java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed:

It will run fine again if I wipe the data on the emulator. I know the requests are reaching my google maps platform because I can see the request under metrics.


问:
Save as data and return value typed in input by function
```<code>const CHANNEL_ID = 'qqxtR1YAPcD40c4W';
const drone = new ScaleDrone(CHANNEL_ID, {
 data: { // Will be sent out as clientData via events
   name: getName(), // undefined
   color: getRandomColor(),
 }
});
</code>```
```<code>function getName(){
  var userName = document.getElementById("typeUserName");
  userName.addEventListener("keypress", (event) => {
    if(event.key === "Enter"){
       event.preventDefault();
       userName = userName.value;
       console.log(userName)
    }
    return userName;
    });
}
</code>```
```<code>function createMemberElement(member) {
  const { name, color } = member.clientData;
  const el = document.createElement('div');
  el.appendChild(document.createTextNode(name));
  el.className = 'member';
  el.style.color = color;
  return el;
}
</code>```

Hello, what I am trying to do here is make the function return the value typed in input once Enter is pressed and the value should be saved in drone's data, yet I keep getting undefined. Data is being defined right after loading the page so maybe that's causing the issue?

Body:
const CHANNEL_ID = 'qqxtR1YAPcD40c4W';
const drone = new ScaleDrone(CHANNEL_ID, {
 data: { // Will be sent out as clientData via events
   name: getName(), // undefined
   color: getRandomColor(),
 }
});

function getName(){
  var userName = document.getElementById("typeUserName");
  userName.addEventListener("keypress", (event) => {
    if(event.key === "Enter"){
       event.preventDefault();
       userName = userName.value;
       console.log(userName)
    }
    return userName;
    });
}

function createMemberElement(member) {
  const { name, color } = member.clientData;
  const el = document.createElement('div');
  el.appendChild(document.createTextNode(name));
  el.className = 'member';
  el.style.color = color;
  return el;
}

Hello, what I am trying to do here is make the function return the value typed in input once Enter is pressed and the value should be saved in drone's data, yet I keep getting undefined. Data is being defined right after loading the page so maybe that's causing the issue?


问:
Expo Camera - Development Build "This app is missing NSCameraUsageDescription"
I'm using the command expo run:ios to build my app on the phone using Expo's development build. I am also using the expo-camera component. However, when I navigate to the page with the camera, I get the following error from Expo.

"This app is missing NSCameraUsageDescription, so video services will
fail. Add this entry to your bundle's Info.plist"

What I've tried

I've tried adding "NSCameraUsageDescription" as a key in app.json as a child of "ios" > "infoPlist" > "NSCameraUsageDescription." However, I noticed the Info.plist generated in ios/expo/ still does not contain NSCameraUsageDescription.

I've also tried deleting the ios folder and rebuilding the project, but the problem still exists.


问:
Modify data table and persist data from Spotfire Web Player
I need to modify an embedded data table by ironpython script and persist the changes in Spotfire Web Player, is this possible?

I have the ironpython script to add a new row in a data table and its works. The script is asigned to a buttom (action control) so when i clicked the new row is generated, but when I press F5 to refresh the dashboard the changes are gone. Is there any way to save these changes?

I tried locally and it works too, but the problem is when i try in Web Player.

I think that the only way to change the data and persist is locally and then saving the .dxp in the server, is this correct?

Thanks!


问:
Groom in UE5 have proplem when play animation
I enabled the simulation and Groom settings as follows:

When I play animation turning left or turning right groom is a problem for the simulation.  You can also view a video of the problem.

How do I simulate the groom properly?


问:
Keyboardtype date not displaying a calendar for user to chose specific date
I am new to React Native and I want users to select a specific date from a calendar with the TextInput field.
I tried using the keyboardType="date" but it still shows a normal keyboard...

```<code>   <TextInput
        value={birthdate}
        keyboardType="date"
        onChangeText={(text) => setBirthdate(text)}
        placeholder="birthdate"
      />
</code>```

Body:
I am new to React Native and I want users to select a specific date from a calendar with the TextInput field.
I tried using the keyboardType="date" but it still shows a normal keyboard...

   <TextInput
        value={birthdate}
        keyboardType="date"
        onChangeText={(text) => setBirthdate(text)}
        placeholder="birthdate"
      />


问:
Quill Editor broken css
I'm having a small issue displaying the quill editor after the content has been created. I have tailwind installed as well but seems that it's not breaking the quill in any way. It's simply not loading CSS as it should, maybe not at all. My content is loading from the database, and I'm trying to display it like this:

```<code><div className={`ql-editor`} id='editor' dangerouslySetInnerHTML={{__html: thread.description}}/>
</code>```

Should I try to display it in another way? I have some trouble using quill with react and not showing the toolbar for example. But style is definitely not working.

Title: Quill Editor broken css

Body:
I'm having a small issue displaying the quill editor after the content has been created. I have tailwind installed as well but seems that it's not breaking the quill in any way. It's simply not loading CSS as it should, maybe not at all. My content is loading from the database, and I'm trying to display it like this:

<div className={`ql-editor`} id='editor' dangerouslySetInnerHTML={{__html: thread.description}}/>

Should I try to display it in another way? I have some trouble using quill with react and not showing the toolbar for example. But style is definitely not working.


问:
How to prevent gitlab pipeline from running twice when pushing a tag
I have a gitlab pipeline which looks like this:

```<code>stages:
  - build
  - deploy

build:
  stage: build
  script: //do stuff

deploy:
  stage: deploy
  script: //do stuff
  only:
    - /^v\d+\.\d+\.\d+
  when: on_success
</code>```

I want it to run build job for every commit, and run the deploy step if it has a tag matching the regex.
It almost works, but it runs twice when I push it with tag, once with deploy step and once without it. How can I prevent that?

Body:
I have a gitlab pipeline which looks like this:

stages:
  - build
  - deploy

build:
  stage: build
  script: //do stuff

deploy:
  stage: deploy
  script: //do stuff
  only:
    - /^v\d+\.\d+\.\d+
  when: on_success

I want it to run build job for every commit, and run the deploy step if it has a tag matching the regex.
It almost works, but it runs twice when I push it with tag, once with deploy step and once without it. How can I prevent that?


问:
How to override configuration of child project, added as jar in Gradle?
how can we override configuration of dependent child project in a Gradle project for example.
I have 2 Gradle project.

project 1 : this project has actual business logics.

project 2 : this project specified a flow of the execution with the help of spring boot.

now project 1 has dependency on project 2 as jar.

project 1 -> build.gradle -> project 2(as jar)

now as we can see project 2 only has flow, and all the business logic and structure is in project 1. so how can I pass details of project 1 to project 2.

like
configuration class,
base project (for component scan)


问:
Why do I keep getting an error saying "Private route is not a route"?
I am trying to make a private route and I get the following error: caught Error: [PrivateRoute] is not a  component. All component children of  must be a  or <React.Fragment>

The first two code blocks are two DIFFERENT attempts at trying to solve the problem with the PrivateRoute. None of which worked. I found some other solutions to the problem here on SO, but they are outdated.  Any suggestions?

```<code>const PrivateRoute = ({ children, ...rest }) => {
  const { currentUser } = useContext(AuthContext);
  return currentUser ? children : <Navigate to="/login" />;
};
</code>```
```<code>const PrivateRoute = ({ children, ...rest }) => {
  const { currentUser } = useContext(AuthContext);
  // return currentUser ? children : <Navigate to="/login" />;
  return (
    <Route
      {...rest}
      render={({ location }) =>
        currentUser ? (
          children
        ) : (
          <Navigate
            to={{
              pathname: "/login",
              state: { from: location },
            }}
          />
        )
      }
    />
  );
};
</code>```
```<code>        <Routes>
          <PrivateRoute>
            <Route
              path="form"
              element={
                <Form
                  deletePdfFromPreview={deletePdfFromPreview}
                  handleFile={handleFile}
                  createBookletDb={createBookletDb}
                />
              }
            />
            <Route index element={<Navigate to="booklets" replace />} />
            <Route
              exact
              path="booklets"
              element={
                <Booklets
                  allPdfFiles={allPdfFiles}
                  booklets={booklets}
                  currentPdfFiles={currentPdfFiles}
                  editBooklet={editBooklet}
                  deleteBooklet={deleteBooklet}
                />
              }
            />
          </PrivateRoute>
          <Route
            path="/login"
            element={
              <Login
                passwordError={passwordError}
                register={register}
                logout={logout}
                login={login}
              />
            }
          />
          <Route
            path="/register"
            element={
              <Register passwordError={passwordError} register={register} />
            }
          ></Route>
          <Route path="/about" element={<About />}></Route>
          <Route path="/booklet/:id" element={<Booklet />}></Route>
        </Routes>
</code>```

Body:
I am trying to make a private route and I get the following error: caught Error: [PrivateRoute] is not a  component. All component children of  must be a  or <React.Fragment>

The first two code blocks are two DIFFERENT attempts at trying to solve the problem with the PrivateRoute. None of which worked. I found some other solutions to the problem here on SO, but they are outdated.  Any suggestions?

const PrivateRoute = ({ children, ...rest }) => {
  const { currentUser } = useContext(AuthContext);
  return currentUser ? children : <Navigate to="/login" />;
};

const PrivateRoute = ({ children, ...rest }) => {
  const { currentUser } = useContext(AuthContext);
  // return currentUser ? children : <Navigate to="/login" />;
  return (
    <Route
      {...rest}
      render={({ location }) =>
        currentUser ? (
          children
        ) : (
          <Navigate
            to={{
              pathname: "/login",
              state: { from: location },
            }}
          />
        )
      }
    />
  );
};

        <Routes>
          <PrivateRoute>
            <Route
              path="form"
              element={
                <Form
                  deletePdfFromPreview={deletePdfFromPreview}
                  handleFile={handleFile}
                  createBookletDb={createBookletDb}
                />
              }
            />
            <Route index element={<Navigate to="booklets" replace />} />
            <Route
              exact
              path="booklets"
              element={
                <Booklets
                  allPdfFiles={allPdfFiles}
                  booklets={booklets}
                  currentPdfFiles={currentPdfFiles}
                  editBooklet={editBooklet}
                  deleteBooklet={deleteBooklet}
                />
              }
            />
          </PrivateRoute>
          <Route
            path="/login"
            element={
              <Login
                passwordError={passwordError}
                register={register}
                logout={logout}
                login={login}
              />
            }
          />
          <Route
            path="/register"
            element={
              <Register passwordError={passwordError} register={register} />
            }
          ></Route>
          <Route path="/about" element={<About />}></Route>
          <Route path="/booklet/:id" element={<Booklet />}></Route>
        </Routes>


问:
Can't access/update class object properties after creation - javascript
The problem is I get "Uncaught ReferenceError: holder is not defined" when trying to access object properties after object creation.

I'm doing the To Do List project for the the Odin Project.
JSFIDDLE: https://jsfiddle.net/appredator/8tcg7yo9/312/

Essentially, I want to click the add button, gather the values from the input fields, and save the values to their correct properties in a corresponding object and then display them as well.

```<code>   //HTML

    <div class="grid-container">
    <h2 class="projectName">
    Project
    </h2>
    <h2 class="task">
    Task
    </h2>
    <h2 class="dueDate">
    Due Date
    </h2>
    <h2 class="status">
    Status
    </h2>
    </div>
    <!-- End Header Div -->

    <!-- Begin To Do List Grid Rows -->
    <div class="projects">

    </div>

    <!-- Button at bottom of page -->
    <button id="addProject">
    Add To Do
    </button>

</code>```

//JS

```<code>class Project {

  constructor(name) {
    this.name = name;
    }

}

class ToDo {

  constructor(projectName, task, dueDate, status) {
    this.projectName = projectName;
    this.task = task;
    this.dueDate = dueDate;
    this.status = status;
    this.list =
    [{
    task: "",
    status: "",
    dueDate: "",
    }];

    }

}

// Add Project Button Logic

const addButton = document.querySelector("#addProject");
addButton.addEventListener('click', addProject);

function addProject(){

let counter = 0;
//Select bottom div for updates etc
var content = document.querySelector(".projects");

//Save projectNameField contents when enter is pressed on the ProjectName Field
const projectNameField = document.createElement("input");
projectNameField.classList.add('projectNameCell');
content.appendChild(projectNameField);
projectNameField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab') {
//Get and save project name
/* var project = projectNameField.value; */
//Instantiate Project constructor with DOM value
let project = new Project(projectNameField.value);
console.log(e.key)

projectNameField.remove();
//Use constructor to display project name in text
const projectNameDisplay = document.createElement("h3");
projectNameDisplay.classList.add('projectNameCell');
projectNameDisplay.innerHTML = project.name;
content.appendChild(projectNameDisplay);

}
});

//Save titleField contents when enter is pressed on the ProjectName Field
const taskField = document.createElement("input");
taskField.classList.add('taskCell');
content.appendChild(taskField);
taskField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab')  {
//Get and save title
//Instantiate toDo constructor with DOM value
let holder = new ToDo(taskField.value);
holder.projectName = document.querySelector(".projectNameCell").innerHTML;
holder.task = taskField.value;
console.log(holder.task)
//Use constructor to display project name in text
const taskDisplay = document.createElement("h3");
taskDisplay.classList.add('titleCell');
taskDisplay.innerHTML = holder.task;
taskField.remove();
content.appendChild(taskDisplay);

}
});

const dueDateField = document.createElement("input");
dueDateField.classList.add('dueDateCell');
content.appendChild(dueDateField);
dueDateField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab')  {
//Instantiate toDo constructor with DOM value
holder.dueDate = dueDateField.value;
/* console.log(task.list.dueDate) */

dueDateField.remove();
//Use constructor to display project name in text
const dueDateDisplay = document.createElement("h3");
dueDateDisplay.classList.add('dueDateCell');
dueDateDisplay.innerHTML = holder.dueDate;
content.appendChild(dueDateDisplay);

}
});

const statusField = document.createElement("input");
statusField.classList.add('statusCell');
content.appendChild(statusField);
statusField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab')  {

//Instantiate toDo constructor with DOM value
task.status = statusField.value;
console.log(task.dueDate)

statusField.remove();
//Use constructor to display project name in text
const statusDisplay = document.createElement("h3");
statusDisplay.classList.add('statusCell');
statusDisplay.innerHTML = task.status;
content.appendChild(statusDisplay);

}
});

counter++;

}
</code>```
```<code>

**I have tried adding get / set methods to the ToDo class with no luck. I also tried factory functions...
This is a scoping problem right? The properties are local scoped to the holder object?... I cut my code down on this post, but the full code is at jsfiddle. The reference error happens after you hit tab or enter on the 3rd input field.... Please advise. I'm kind of puzzled why objects would be so hard to access and update after creation lol. I created the object so I could use it. I know it's something trivial about scope and when to use constructors/classes/factories, but I cant figure it out.**
</code>```

Body:
The problem is I get "Uncaught ReferenceError: holder is not defined" when trying to access object properties after object creation.

I'm doing the To Do List project for the the Odin Project.
JSFIDDLE: https://jsfiddle.net/appredator/8tcg7yo9/312/

Essentially, I want to click the add button, gather the values from the input fields, and save the values to their correct properties in a corresponding object and then display them as well.

   //HTML

    Project

    Task

    Due Date

    Status

    <button id="addProject">
    Add To Do
    </button>

//JS

class Project {

  constructor(name) {
    this.name = name;
    }

}

class ToDo {

  constructor(projectName, task, dueDate, status) {
    this.projectName = projectName;
    this.task = task;
    this.dueDate = dueDate;
    this.status = status;
    this.list =
    [{
    task: "",
    status: "",
    dueDate: "",
    }];

    }

}

// Add Project Button Logic

const addButton = document.querySelector("#addProject");
addButton.addEventListener('click', addProject);

function addProject(){

let counter = 0;
//Select bottom div for updates etc
var content = document.querySelector(".projects");

//Save projectNameField contents when enter is pressed on the ProjectName Field
const projectNameField = document.createElement("input");
projectNameField.classList.add('projectNameCell');
content.appendChild(projectNameField);
projectNameField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab') {
//Get and save project name
/* var project = projectNameField.value; */
//Instantiate Project constructor with DOM value
let project = new Project(projectNameField.value);
console.log(e.key)

projectNameField.remove();
//Use constructor to display project name in text
const projectNameDisplay = document.createElement("h3");
projectNameDisplay.classList.add('projectNameCell');
projectNameDisplay.innerHTML = project.name;
content.appendChild(projectNameDisplay);

}
});

//Save titleField contents when enter is pressed on the ProjectName Field
const taskField = document.createElement("input");
taskField.classList.add('taskCell');
content.appendChild(taskField);
taskField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab')  {
//Get and save title
//Instantiate toDo constructor with DOM value
let holder = new ToDo(taskField.value);
holder.projectName = document.querySelector(".projectNameCell").innerHTML;
holder.task = taskField.value;
console.log(holder.task)
//Use constructor to display project name in text
const taskDisplay = document.createElement("h3");
taskDisplay.classList.add('titleCell');
taskDisplay.innerHTML = holder.task;
taskField.remove();
content.appendChild(taskDisplay);

}
});

const dueDateField = document.createElement("input");
dueDateField.classList.add('dueDateCell');
content.appendChild(dueDateField);
dueDateField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab')  {
//Instantiate toDo constructor with DOM value
holder.dueDate = dueDateField.value;
/* console.log(task.list.dueDate) */

dueDateField.remove();
//Use constructor to display project name in text
const dueDateDisplay = document.createElement("h3");
dueDateDisplay.classList.add('dueDateCell');
dueDateDisplay.innerHTML = holder.dueDate;
content.appendChild(dueDateDisplay);

}
});

const statusField = document.createElement("input");
statusField.classList.add('statusCell');
content.appendChild(statusField);
statusField.addEventListener('keydown', function onEvent(e) {
    if (e.key === 'Enter' || e.key === 'Tab')  {

//Instantiate toDo constructor with DOM value
task.status = statusField.value;
console.log(task.dueDate)

statusField.remove();
//Use constructor to display project name in text
const statusDisplay = document.createElement("h3");
statusDisplay.classList.add('statusCell');
statusDisplay.innerHTML = task.status;
content.appendChild(statusDisplay);

}
});

counter++;

}

**I have tried adding get / set methods to the ToDo class with no luck. I also tried factory functions...
This is a scoping problem right? The properties are local scoped to the holder object?... I cut my code down on this post, but the full code is at jsfiddle. The reference error happens after you hit tab or enter on the 3rd input field.... Please advise. I'm kind of puzzled why objects would be so hard to access and update after creation lol. I created the object so I could use it. I know it's something trivial about scope and when to use constructors/classes/factories, but I cant figure it out.**


问:
How to setup an Audience on Firebase to match Android 12+ users
I need to create an Audience on Firebase that matches all users with Android 12+.

I tested on an emulator with Android 12, doing it with OS Version for the Audience, didn't work:

Audience settings screen

How should I select the condition to match this Audience?


问:
When using Foreign keys in Sqlite3 for ESP8266, I get Unable to prepare: file is encrypted or is not a database
I am using ESP8266 and want to use a SQLite db stored in an SD.

Here is how I created the tables in SQL Online IDE:

CREATE TABLE "nfc_tag" (
    "id"  TEXT NOT NULL UNIQUE,
    "value"   TEXT NOT NULL,
    PRIMARY KEY(id)
);

CREATE TABLE "tag_log" (
  "tag_id" TEXT NOT NULL,
  "datetime" TEXT NOT NULL,
);
```
<p>And when I run:</p>
<pre class="lang-c prettyprint-override"><code>int query_tag(const char *tag) {
  const char *null;

  // Prepare the statement
  sqlite3_stmt *statement;
  if (sqlite3_prepare_v2(db, "SELECT value FROM nfc_tag WHERE id = ?;", -1, &statement, &null) != SQLITE_OK) {
    Serial.print("Unable to prepare: ");
    Serial.println(sqlite3_errmsg(db));
    return 0;
  }
}
</code>```

Everything is ok.
But I want tag_id to be a foreign key to id in nfc_tag, so I recreated the db and created the tables with this statement:

```<code>CREATE TABLE "nfc_tag" (
    "id"  TEXT NOT NULL UNIQUE,
    "value"   TEXT NOT NULL,
    PRIMARY KEY(id)
);

PRAGMA foreign_keys = ON;

CREATE TABLE "tag_log" (
  "tag_id" TEXT NOT NULL,
  "datetime" TEXT NOT NULL,
  FOREIGN KEY("tag_id") REFERENCES "nfc_tag"("id")
);
</code>```

And now, when I run the same code, I get Unable to prepare: file is encrypted or is not a database

I have not encrypted the db, and I can open it in VSCode and DB Browser for SQLite, so I guess it is not encrypted. I don't know if it is because of the foreign key, but it shouldn't be a problem because of the PRAGMA statement.

Any help would be appreciated, thanks in advance!

Body:
I am using ESP8266 and want to use a SQLite db stored in an SD.

Here is how I created the tables in SQL Online IDE:

CREATE TABLE "nfc_tag" (
    "id"  TEXT NOT NULL UNIQUE,
    "value"   TEXT NOT NULL,
    PRIMARY KEY(id)
);

CREATE TABLE "tag_log" (
  "tag_id" TEXT NOT NULL,
  "datetime" TEXT NOT NULL,
);

And when I run:

int query_tag(const char *tag) {
  const char *null;

  // Prepare the statement
  sqlite3_stmt *statement;
  if (sqlite3_prepare_v2(db, "SELECT value FROM nfc_tag WHERE id = ?;", -1, &statement, &null) != SQLITE_OK) {
    Serial.print("Unable to prepare: ");
    Serial.println(sqlite3_errmsg(db));
    return 0;
  }
}

Everything is ok.
But I want tag_id to be a foreign key to id in nfc_tag, so I recreated the db and created the tables with this statement:

CREATE TABLE "nfc_tag" (
    "id"  TEXT NOT NULL UNIQUE,
    "value"   TEXT NOT NULL,
    PRIMARY KEY(id)
);

PRAGMA foreign_keys = ON;

CREATE TABLE "tag_log" (
  "tag_id" TEXT NOT NULL,
  "datetime" TEXT NOT NULL,
  FOREIGN KEY("tag_id") REFERENCES "nfc_tag"("id")
);

And now, when I run the same code, I get Unable to prepare: file is encrypted or is not a database

I have not encrypted the db, and I can open it in VSCode and DB Browser for SQLite, so I guess it is not encrypted. I don't know if it is because of the foreign key, but it shouldn't be a problem because of the PRAGMA statement.

Any help would be appreciated, thanks in advance!


问:
Firestore security rules - `request.auth` is always null in react and next.js
Firebase version: 9.15.0
React version: 18.2.0
Next.js version: 13.1.1
Jotai version: 1.12.1

I'm trying to make a request to my firestore database. I am logged in, and I can print my uid to console fine. In the FirebaseError error, it mentions my method updateUserLicense. I'm using Jotai for state management. It's interesting that the atoms are undefined when set in onAuthStateChanged. However, I don't use them in updateUserLicense, so it shouldn't be an issue.

I have a file that initializes firebase and it's respective services, and then those are exported and imported by the javascript files that contain functions such as updateUserLicense. This file is under the "services" folder:

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";

const firebaseConfig = {
    apiKey: "AIzaSyB-ZPDz7RI6j07bxqfqcQqvuJC8CcQ5QFI",
    authDomain: "ai-docs-tool.firebaseapp.com",
    projectId: "ai-docs-tool",
    storageBucket: "ai-docs-tool.appspot.com",
    messagingSenderId: "57784220238",
    appId: "1:57784220238:web:18bd4a9bc3843b5451611f",
    measurementId: "G-0L2LR8LHX1"
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const db = getFirestore(app);

export {auth, db};

export * from "./authentication.service";
export * from "./license.service";
```
<p>Login button component:</p>
<pre class="lang-js prettyprint-override"><code>import React from 'react';
import { useAtom } from "jotai";
import { onAuthStateChanged } from "firebase/auth";
import { loginWithGoogle, updateUserLicense, auth } from "../services";
import { userAtom, licensesAtom } from "../state";

export default function LoginButton() {
  const [user, setUser] = useAtom(userAtom);
  const [licenses, setLicenses] = useAtom(licensesAtom);

  onAuthStateChanged(auth, async (newUser) => {
    if(newUser && user == null) {
      setUser(newUser);
      const license = await updateUserLicense(newUser);
      setLicenses(license);
    }
  });

  return (
    <button onClick={loginWithGoogle}>Login</button>
  )
}
</code>```

Troublesome update function, in a separate file under a folder called "services":

import {db} from "./index";
import { getFirestore, doc, getDoc, setDoc, serverTimestamp, updateDoc } from "firebase/firestore";
import { v4 as uuidv4 } from "uuid";
import { auth } from "./index";

export async function updateUserLicense(user) {
    if(user == null) return;
    console.log("UID:", user.uid); // Prints the uid passed in fine, so user is authenticated
    const docRef = doc(db, "license-keys", user.uid); // All of this code works when the security rules are read/write enabled for all.
    const docSnap = await getDoc(docRef);

    if(docSnap.exists()) {
        updateDoc(docRef, {lastRead: serverTimestamp()});
        return docSnap.data().licenses;
    }
    else {
        const newLicense = uuidv4();
        setDoc(docRef, {licenses: [newLicense], lastRead: serverTimestamp()});
        return newLicense;
    }

}
```
<p>Security rules:</p>
<pre class="lang-js prettyprint-override"><code>rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /license-keys/{id} {
      allow read: if request.auth != null;
      allow create: if request.auth != null;
    }
  }
}
</code>```

My database, and the rules playground that shows it working if I pass in the uid by hand:

I've tried using the rules playground, but it always passes with the uid that I use.
I tried printing the user.uid to see if it's there, and it is.
I've tried logging out, and then in and again, and it still doesn't work.
I tried downgrading to v8, but it just broke my project.

Body:
Firebase version: 9.15.0
React version: 18.2.0
Next.js version: 13.1.1
Jotai version: 1.12.1

I'm trying to make a request to my firestore database. I am logged in, and I can print my uid to console fine. In the FirebaseError error, it mentions my method updateUserLicense. I'm using Jotai for state management. It's interesting that the atoms are undefined when set in onAuthStateChanged. However, I don't use them in updateUserLicense, so it shouldn't be an issue.

I have a file that initializes firebase and it's respective services, and then those are exported and imported by the javascript files that contain functions such as updateUserLicense. This file is under the "services" folder:

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";

const firebaseConfig = {
    apiKey: "AIzaSyB-ZPDz7RI6j07bxqfqcQqvuJC8CcQ5QFI",
    authDomain: "ai-docs-tool.firebaseapp.com",
    projectId: "ai-docs-tool",
    storageBucket: "ai-docs-tool.appspot.com",
    messagingSenderId: "57784220238",
    appId: "1:57784220238:web:18bd4a9bc3843b5451611f",
    measurementId: "G-0L2LR8LHX1"
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const db = getFirestore(app);

export {auth, db};

export * from "./authentication.service";
export * from "./license.service";

Login button component:

import React from 'react';
import { useAtom } from "jotai";
import { onAuthStateChanged } from "firebase/auth";
import { loginWithGoogle, updateUserLicense, auth } from "../services";
import { userAtom, licensesAtom } from "../state";

export default function LoginButton() {
  const [user, setUser] = useAtom(userAtom);
  const [licenses, setLicenses] = useAtom(licensesAtom);

  onAuthStateChanged(auth, async (newUser) => {
    if(newUser && user == null) {
      setUser(newUser);
      const license = await updateUserLicense(newUser);
      setLicenses(license);
    }
  });

  return (
    <button onClick={loginWithGoogle}>Login</button>
  )
}

Troublesome update function, in a separate file under a folder called "services":

import {db} from "./index";
import { getFirestore, doc, getDoc, setDoc, serverTimestamp, updateDoc } from "firebase/firestore";
import { v4 as uuidv4 } from "uuid";
import { auth } from "./index";

export async function updateUserLicense(user) {
    if(user == null) return;
    console.log("UID:", user.uid); // Prints the uid passed in fine, so user is authenticated
    const docRef = doc(db, "license-keys", user.uid); // All of this code works when the security rules are read/write enabled for all.
    const docSnap = await getDoc(docRef);

    if(docSnap.exists()) {
        updateDoc(docRef, {lastRead: serverTimestamp()});
        return docSnap.data().licenses;
    }
    else {
        const newLicense = uuidv4();
        setDoc(docRef, {licenses: [newLicense], lastRead: serverTimestamp()});
        return newLicense;
    }

}

Security rules:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /license-keys/{id} {
      allow read: if request.auth != null;
      allow create: if request.auth != null;
    }
  }
}

My database, and the rules playground that shows it working if I pass in the uid by hand:

I've tried using the rules playground, but it always passes with the uid that I use.
I tried printing the user.uid to see if it's there, and it is.
I've tried logging out, and then in and again, and it still doesn't work.
I tried downgrading to v8, but it just broke my project.


问:
projectNotLinked error when using Google Play API Explorer to issue refund
I am trying to use Google Play Developer API (API explorer). Specifically talking about "orders.refund" API- I want to refund and revoke a single purchased IAP but getting the error below.

Went into Google Play Developer console

API access -> Created a new Google Cloud Project. Under APIs, I see "Google Play Android Developer API" set to "ON".

I click View API details which forwards me to my Google Cloud project where I see my Google Play Android Developer API

I click "Try in API explorer"

On the left side, I click order -> refund, and fill in the PackageName, orderID and revoke boolean field.

Google OAuth 2.0 and API Key are both checked, and I click EXECUTE

"Sign up with Google" dialog appears, I choose the same account I have, and then get the below error

Tried what other posts suggested a few years back- adding a new IAP product in Google Play Console, deleted it, but still no-go.

Anyone knows how to unblock me?

{
"error": {
"code": 403,
"message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
"errors": [
{
"message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
"domain": "androidpublisher",
"reason": "projectNotLinked"
}
]
}
}


问:
CNN-LSTM performance identical to LSTM, is there a mistake in my code? (Pytorch)
I am trying to recreate the models from a study in which CNN-LSTM outperformed LSTM, but my CNN-LSTM produces nearly identical results to the LSTM. So it seems like the addition of the convolutional layers is not doing anything. The study describes the CNN-LSTM model like this:

The model is constructed by a single LSTM layer and two CNN layers. To form the CNN part, two 1D convolutional neural networks are stacked without any pooling layer. The second CNN layer is followed by a Rectified Linear Unit (ReLU) activation function. Each of the flattened output of the CNN’s ReLU layer and the LSTM layer is projected to the same dimension using a fully connected layer. Finally, a dropout layer is placed before the output layer.

Did I make a mistake in the implementation? The results of my CNN-LSTM are almost exactly the same as when I use the LSTM on its own. The LSTM on its own is the exact same code as below, just without the two conv1d layers and without the ReLu activation function.

```<code>class CNN_LSTM(nn.Module):
    def __init__(self, input_size, seq_len, params, output_size):
        super(CNN_LSTM, self).__init__()
        self.n_hidden = params['lstm_hidden']        # neurons in each lstm layer
        self.seq_len = seq_len                       # length of the input sequence
        self.n_layers = 1                            # nr of recurrent layers in the lstm
        self.n_filters = params['n_filters']         # size of filter in cnn
        self.c1 = nn.Conv1d(in_channels=1, out_channels=params['n_filters'], kernel_size=1, stride=1)
        self.c2 = nn.Conv1d(in_channels=params['n_filters'], out_channels=1, kernel_size=1, stride=1)
        self.lstm = nn.LSTM(
            input_size=input_size,         # nr of input features
            hidden_size=params['lstm_hidden'],
            num_layers=1
        )
        self.flatten = nn.Flatten()
        self.fc1 = nn.Linear(in_features=seq_len*params['lstm_hidden'], out_features=params['dense_hidden'])
        self.dropout = nn.Dropout(p=.4)
        self.fc2 = nn.Linear(in_features=params['dense_hidden'], out_features=output_size) # output_size = nr of output features

    def reset_hidden_state(self):
        self.hidden = (
            torch.zeros(self.n_layers, self.seq_len, self.n_hidden).to(device=device),
            torch.zeros(self.n_layers, self.seq_len, self.n_hidden).to(device=device),
        )
    def forward(self, sequences):
        out = self.c1(sequences.view(len(sequences), 1, -1))
        out = self.c2(out.view(len(out), self.n_filters, -1))
        out = F.relu(out)
        out, self.hidden = self.lstm(
            out.view(len(out), self.seq_len, -1),
            self.hidden
        )
        out = self.flatten(out)
        out = self.fc1(out)
        out = self.dropout(out)
        out = self.fc2(out)
        return out
</code>```

Source for the study I am using.

Body:
I am trying to recreate the models from a study in which CNN-LSTM outperformed LSTM, but my CNN-LSTM produces nearly identical results to the LSTM. So it seems like the addition of the convolutional layers is not doing anything. The study describes the CNN-LSTM model like this:

The model is constructed by a single LSTM layer and two CNN layers. To form the CNN part, two 1D convolutional neural networks are stacked without any pooling layer. The second CNN layer is followed by a Rectified Linear Unit (ReLU) activation function. Each of the flattened output of the CNN’s ReLU layer and the LSTM layer is projected to the same dimension using a fully connected layer. Finally, a dropout layer is placed before the output layer.

Did I make a mistake in the implementation? The results of my CNN-LSTM are almost exactly the same as when I use the LSTM on its own. The LSTM on its own is the exact same code as below, just without the two conv1d layers and without the ReLu activation function.

class CNN_LSTM(nn.Module):
    def __init__(self, input_size, seq_len, params, output_size):
        super(CNN_LSTM, self).__init__()
        self.n_hidden = params['lstm_hidden']        # neurons in each lstm layer
        self.seq_len = seq_len                       # length of the input sequence
        self.n_layers = 1                            # nr of recurrent layers in the lstm
        self.n_filters = params['n_filters']         # size of filter in cnn
        self.c1 = nn.Conv1d(in_channels=1, out_channels=params['n_filters'], kernel_size=1, stride=1)
        self.c2 = nn.Conv1d(in_channels=params['n_filters'], out_channels=1, kernel_size=1, stride=1)
        self.lstm = nn.LSTM(
            input_size=input_size,         # nr of input features
            hidden_size=params['lstm_hidden'],
            num_layers=1
        )
        self.flatten = nn.Flatten()
        self.fc1 = nn.Linear(in_features=seq_len*params['lstm_hidden'], out_features=params['dense_hidden'])
        self.dropout = nn.Dropout(p=.4)
        self.fc2 = nn.Linear(in_features=params['dense_hidden'], out_features=output_size) # output_size = nr of output features

    def reset_hidden_state(self):
        self.hidden = (
            torch.zeros(self.n_layers, self.seq_len, self.n_hidden).to(device=device),
            torch.zeros(self.n_layers, self.seq_len, self.n_hidden).to(device=device),
        )
    def forward(self, sequences):
        out = self.c1(sequences.view(len(sequences), 1, -1))
        out = self.c2(out.view(len(out), self.n_filters, -1))
        out = F.relu(out)
        out, self.hidden = self.lstm(
            out.view(len(out), self.seq_len, -1),
            self.hidden
        )
        out = self.flatten(out)
        out = self.fc1(out)
        out = self.dropout(out)
        out = self.fc2(out)
        return out

Source for the study I am using.


问:
How to add searchinputs as array in localStorage with React TypeScript
I'm trying to make a search bar, where the search will occur once the button (or enter) is clicked. To this, I want to save the searched phrases in localStorage.

I have no problem with the first part. Things work fine when searching with a button or on enter-click. However, when I try to add the search as an array to localStorage I keep getting issues (like string doesn't work with an array, and many more. I've tried A LOT of different things). I've done this with JS and vanilla React, but never with TS.

In the provided code, the search works, and to put in at least something (as simple as I could) - the latest value is also stored in localStorage.

The code can be found here

Or here:

```<code>// index file
import { useState } from "react";
import { Searchbar } from "./searchbar";
import { SearchContainer } from "./style";

export const Search = () => {
  const [search, setSearch] = useState<string>("");

  return (
    <SearchContainer>
      <Searchbar setSearch={setSearch} />
      <p>SEARCHED: {search}</p>
    </SearchContainer>
  );
};
</code>```
```<code>// search bar file
import { useRef, KeyboardEvent, useEffect } from "react";

type SearchProps = {
  setSearch: React.Dispatch<React.SetStateAction<string>>;
};

export const Searchbar = ({ setSearch }: SearchProps) => {
  // with useRef we don't have to reload the page for every input
  const inputRef = useRef<HTMLInputElement>(null);

  const handleClick = () => {
    setSearch(String(inputRef.current?.value));
    localStorage.setItem("form", JSON.stringify(inputRef.current?.value)); // Issue here
  };

  // Enable search with the enter-key
  const log = (e: KeyboardEvent): void => {
    e.key === "Enter" ? handleClick() : null;
  };

  useEffect(() => {
    const value = localStorage.getItem("form");
    value ? JSON.parse(value) : "";
  }, [setSearch]);

  return (
    <div>
      <input
        type="text"
        autoComplete="off"
        ref={inputRef}
        placeholder="search game..."
        onKeyDown={log}
      />
      <button onClick={handleClick}>SEARCH</button>
    </div>
  );
};
</code>```

I've been on this for a while now so any help is appreciated. (I am also trying to learn TS from scratch, but until I get to here...).

Body:
I'm trying to make a search bar, where the search will occur once the button (or enter) is clicked. To this, I want to save the searched phrases in localStorage.

I have no problem with the first part. Things work fine when searching with a button or on enter-click. However, when I try to add the search as an array to localStorage I keep getting issues (like string doesn't work with an array, and many more. I've tried A LOT of different things). I've done this with JS and vanilla React, but never with TS.

In the provided code, the search works, and to put in at least something (as simple as I could) - the latest value is also stored in localStorage.

The code can be found here

Or here:

// index file
import { useState } from "react";
import { Searchbar } from "./searchbar";
import { SearchContainer } from "./style";

export const Search = () => {
  const [search, setSearch] = useState<string>("");

  return (
    <SearchContainer>
      <Searchbar setSearch={setSearch} />

SEARCHED: {search}

    </SearchContainer>
  );
};

// search bar file
import { useRef, KeyboardEvent, useEffect } from "react";

type SearchProps = {
  setSearch: React.Dispatch<React.SetStateAction<string>>;
};

export const Searchbar = ({ setSearch }: SearchProps) => {
  // with useRef we don't have to reload the page for every input
  const inputRef = useRef<HTMLInputElement>(null);

  const handleClick = () => {
    setSearch(String(inputRef.current?.value));
    localStorage.setItem("form", JSON.stringify(inputRef.current?.value)); // Issue here
  };

  // Enable search with the enter-key
  const log = (e: KeyboardEvent): void => {
    e.key === "Enter" ? handleClick() : null;
  };

  useEffect(() => {
    const value = localStorage.getItem("form");
    value ? JSON.parse(value) : "";
  }, [setSearch]);

  return (

      <input
        type="text"
        autoComplete="off"
        ref={inputRef}
        placeholder="search game..."
        onKeyDown={log}
      />
      <button onClick={handleClick}>SEARCH</button>

  );
};

I've been on this for a while now so any help is appreciated. (I am also trying to learn TS from scratch, but until I get to here...).


问:
Decoding new access_token from google oauth login response
I am using the package @react-oauth/google package for authentication in my react app.
According to it's docs, if I use <GoogleLogin onSuccess={...} /> component, then I receive credential in the response from which I can easily decode the user information.

```<code><GoogleLogin
     onSuccess={(res) => {
        console.log(res);
     }}
/>
// Response
{credential: 'eyJhbGciOiJSUzI1NiIsImtpZCI6IjhlMGFjZjg5MWUwOTAwOT…u5AjExZ4f6zvn8P-SZB4V0vTtQo-nXkR2ela_1foHoKXzCWDA', clientId:'626778026017....apps.googleusercontent.com', select_by: 'btn'}
</code>```

But If I want to use my own custom button, then I have to use useGoogleLogin hook. Doing so, I get access_token in the response and facing difficulties decoding user information.

```<code>  const login = useGoogleLogin({
    onSuccess: async (response) => {
      console.log("Res", response);
    },
  });
 return (
    <Button onClick={() => login()}>
    ...

// Response
access_token: "ya29.a0...nw0163",
authuser: "0",
expires_in:3599,
...
</code>```

I have tried sending that token to my backend server and using the verifyIdToken function provided by import { OAuth2Client } from "google-auth-library". But it gives the error like: Wrong number of segments in token ...

Am I missing something?

Body:
I am using the package @react-oauth/google package for authentication in my react app.
According to it's docs, if I use <GoogleLogin onSuccess={...} /> component, then I receive credential in the response from which I can easily decode the user information.

<GoogleLogin
     onSuccess={(res) => {
        console.log(res);
     }}
/>
// Response
{credential: 'eyJhbGciOiJSUzI1NiIsImtpZCI6IjhlMGFjZjg5MWUwOTAwOT…u5AjExZ4f6zvn8P-SZB4V0vTtQo-nXkR2ela_1foHoKXzCWDA', clientId:'626778026017....apps.googleusercontent.com', select_by: 'btn'}

But If I want to use my own custom button, then I have to use useGoogleLogin hook. Doing so, I get access_token in the response and facing difficulties decoding user information.

  const login = useGoogleLogin({
    onSuccess: async (response) => {
      console.log("Res", response);
    },
  });
 return (
    <Button onClick={() => login()}>
    ...

// Response
access_token: "ya29.a0...nw0163",
authuser: "0",
expires_in:3599,
...

I have tried sending that token to my backend server and using the verifyIdToken function provided by import { OAuth2Client } from "google-auth-library". But it gives the error like: Wrong number of segments in token ...

Am I missing something?


问:
Celery can't find .settings
I installed redis and celery, set everything up, I run celery in terminal - everything is ok:

```<code>(venv) Air-Evgeny:gunter_site evgenybar$ celery -A gunter_site worker -l info

 -------------- celery@Air-Evgeny.Dlink v5.2.7 (dawn-chorus)
--- ***** -----
-- ******* ---- macOS-13.0.1-x86_64-i386-64bit 2023-01-02 18:35:10
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app:         gunter_site:0x106d5a3a0
- ** ---------- .> transport:   redis://127.0.0.1:6379/0
- ** ---------- .> results:
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery

[tasks]
  . gunter_site.celery.debug_task
</code>```

Next, through the Python console, I try to run debug_task.delay() from celery.py to check that everything is working fine:

>>> from gunter_site.gunter_site.celery import debug_task

^Everything is ok at this stage

>>> debug_task.delay()

^Here I get a long list of problems that end with:
ModuleNotFoundError: No module named 'gunter_site.settings'

Redis launched in docker: docker run -p 6379:6379 --name redis-celery -d redis
Redis work:

```<code>evgenybar@Air-Evgeny ~ % docker ps -a
CONTAINER ID   IMAGE     COMMAND                  CREATED       STATUS       PORTS                    NAMES
01d5f6356e0f   redis     "docker-entrypoint.s…"   2 hours ago   Up 2 hours   0.0.0.0:6379->6379/tcp   redis-celery
</code>```

I have already tried to create a test project with an older version of django, start redis explicitly by specifying the port: docker run -p 127.0.0.1:16379:6379 --name redis-celery -d redis, tried to find a solution on google and on youtube but no one seems to have the same problem.

Title: Celery can't find .settings

Body:
I installed redis and celery, set everything up, I run celery in terminal - everything is ok:

(venv) Air-Evgeny:gunter_site evgenybar$ celery -A gunter_site worker -l info

 -------------- celery@Air-Evgeny.Dlink v5.2.7 (dawn-chorus)
--- ***** -----
-- ******* ---- macOS-13.0.1-x86_64-i386-64bit 2023-01-02 18:35:10
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app:         gunter_site:0x106d5a3a0
- ** ---------- .> transport:   redis://127.0.0.1:6379/0
- ** ---------- .> results:
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery

[tasks]
  . gunter_site.celery.debug_task

Next, through the Python console, I try to run debug_task.delay() from celery.py to check that everything is working fine:

>>> from gunter_site.gunter_site.celery import debug_task

^Everything is ok at this stage

>>> debug_task.delay()

^Here I get a long list of problems that end with:
ModuleNotFoundError: No module named 'gunter_site.settings'

Redis launched in docker: docker run -p 6379:6379 --name redis-celery -d redis
Redis work:

evgenybar@Air-Evgeny ~ % docker ps -a
CONTAINER ID   IMAGE     COMMAND                  CREATED       STATUS       PORTS                    NAMES
01d5f6356e0f   redis     "docker-entrypoint.s…"   2 hours ago   Up 2 hours   0.0.0.0:6379->6379/tcp   redis-celery

I have already tried to create a test project with an older version of django, start redis explicitly by specifying the port: docker run -p 127.0.0.1:16379:6379 --name redis-celery -d redis, tried to find a solution on google and on youtube but no one seems to have the same problem.


问:
How do you update ThreeJS objects based on parameter changes?
To elaborate I am using React, ThreeJS, React-Three-Fibre

I want to create 100 points, but I am struggling to understand how I can go about it with the React-Three-Fibre API. My first thought was that based on the syntax I could add <Point> as a DOM element to the <mesh> element. In terms of DOM elements it's just a canvas with drawings in it so I realize it's not a valid approach.

Another issue I am having is when setting pre determined positions from some function, the elements get rendered before the function is executed so they never get added. Once the function finishes executing I suppose I would have to update the canvas to reflect the positional, etc changes.

I tried updating the canvas in the form of

```<code>useFrame((state) => (meshRef.forceUpdate());
</code>```

But that is not a function so I'm lost on how I can go about updating the Points with new positions

```<code>const PointerStar = () => {

    // This reference gives us direct access to the THREE.Mesh object
    const meshRef = useRef()

    // This reference gives us direct access to the points container
    const pointsRef = useRef()

    // Hold state for hovered and clicked events
    const [hovered, setHovered] = useState(false)
    const [clicked, setClicked] = useState(false)

    // Buffers
    let positionsBuffer = []
    let positionsBuffer2 = [1, 1, 1]
    let colorsBuffer = []
    let sizesBuffer = []

    const buffer_arrays_populate = () => {
        positionsBuffer.push(-3,0,0)
        colorsBuffer.push(125, 213, 12)
        sizesBuffer.push(2)

        console.log(positionsBuffer)
        console.log(colorsBuffer)
        console.log(sizesBuffer)
    }

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

    return (
        <mesh ref={meshRef}>
            <Points limit={3} ref={pointsRef}>
                <Point position={positionsBuffer}/>
                <Point position={[3, 0, 0]}/>
            </Points>
        </mesh>
    )
</code>```

Body:
To elaborate I am using React, ThreeJS, React-Three-Fibre

I want to create 100 points, but I am struggling to understand how I can go about it with the React-Three-Fibre API. My first thought was that based on the syntax I could add <Point> as a DOM element to the <mesh> element. In terms of DOM elements it's just a canvas with drawings in it so I realize it's not a valid approach.

Another issue I am having is when setting pre determined positions from some function, the elements get rendered before the function is executed so they never get added. Once the function finishes executing I suppose I would have to update the canvas to reflect the positional, etc changes.

I tried updating the canvas in the form of

useFrame((state) => (meshRef.forceUpdate());

But that is not a function so I'm lost on how I can go about updating the Points with new positions

const PointerStar = () => {

    // This reference gives us direct access to the THREE.Mesh object
    const meshRef = useRef()

    // This reference gives us direct access to the points container
    const pointsRef = useRef()

    // Hold state for hovered and clicked events
    const [hovered, setHovered] = useState(false)
    const [clicked, setClicked] = useState(false)

    // Buffers
    let positionsBuffer = []
    let positionsBuffer2 = [1, 1, 1]
    let colorsBuffer = []
    let sizesBuffer = []

    const buffer_arrays_populate = () => {
        positionsBuffer.push(-3,0,0)
        colorsBuffer.push(125, 213, 12)
        sizesBuffer.push(2)

        console.log(positionsBuffer)
        console.log(colorsBuffer)
        console.log(sizesBuffer)
    }

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

    return (
        <mesh ref={meshRef}>
            <Points limit={3} ref={pointsRef}>
                <Point position={positionsBuffer}/>
                <Point position={[3, 0, 0]}/>
            </Points>
        </mesh>
    )


问:
Cannot use package as dependency with concurrency checking enabled in Package.swift
I have enabled concurrency checking for a swift library package target by adding the compiler flag -warn-concurrency in Package.swift:

```<code>let package = Package(
    name: "MyLibrary",
    // ... etc ...
    targets: [
        .target(
            name: "MyLibrary",
            // ... etc ...
            swiftSettings: [
                .unsafeFlags(["-Xfrontend", "-warn-concurrency"]),
            ]
        )
    ]
)
</code>```

This works fine. Everything builds and tests run. However, when this package is checked in to version control and used as a dependency of another package, the compiler generates the error:

```<code>the target 'MyLibrary' in product 'MyLibrary' contains unsafe build flags
</code>```

How can I use a package dependency that has concurrency checking enabled?

Body:
I have enabled concurrency checking for a swift library package target by adding the compiler flag -warn-concurrency in Package.swift:

let package = Package(
    name: "MyLibrary",
    // ... etc ...
    targets: [
        .target(
            name: "MyLibrary",
            // ... etc ...
            swiftSettings: [
                .unsafeFlags(["-Xfrontend", "-warn-concurrency"]),
            ]
        )
    ]
)

This works fine. Everything builds and tests run. However, when this package is checked in to version control and used as a dependency of another package, the compiler generates the error:

the target 'MyLibrary' in product 'MyLibrary' contains unsafe build flags

How can I use a package dependency that has concurrency checking enabled?


问:
Paytm Payout API Complete Backend Code In Js
I am unable verify Checksum.

I tried use all the mandatory parameters to generate cheksum but its is some how not working.


问:
PKCS12_parse: unsupported - when running a ruby application as a service on the server
In my ruby application, I am creating Apple wallet passes.
The application actually works well, but when I try to start it as a service (/etc/systemd/system), it is failing.
I can see that almost everything is working, but it fails when I want to parse the p12 certificate.

My function to sign the manifest file

```<code>def sign_manifest(serial_number)
    temporary_path = "./passes/#{CUSTOMER}_#{serial_number}"
    certificate_path = "./certs/Zertifikate.p12"
    wwdr_path = "./certs/WWDR.pem"
    manifest_path = "./passes/#{CUSTOMER}_#{serial_number}/manifest.json"

  puts "Signing the manifest"
  # Import the certificates
  p12_certificate = OpenSSL::PKCS12::new(File.read(certificate_path), "")
  wwdr_certificate = OpenSSL::X509::Certificate.new(File.read(wwdr_path))

  # Sign the data
  flag = OpenSSL::PKCS7::BINARY|OpenSSL::PKCS7::DETACHED
  signed = OpenSSL::PKCS7::sign(p12_certificate.certificate, p12_certificate.key, File.read(manifest_path), [wwdr_certificate], flag)

  # Create an output path for the signed data
  signature_url = temporary_path + "/signature"

  # Write out the data
  File.open(signature_url, "w") do |f|
    f.syswrite signed.to_der
  end
end
</code>```

Manually start with the command line

When I start the application manually with the command

ruby passGenerator.rb -p 20001 -o 0.0.0.0

on my server, it is working well, no issues.

Start as a service

The service itself looks like:

```<code># wallet.service

[Unit]
Description = Apple Wallet Pass Generator
After = network.target

[Service]
WorkingDirectory = /var/www/html/passGenerator
ExecStart = ruby /var/www/html/passGenerator/passGenerator.rb -p 20001 -o 0.0.0.0

[Install]
WantedBy = multi-user.target
</code>```

and start it with:

systemctl start wallet

I can start the service, and the server is running, but as soon as I want to create a new pass and come to this function, it crashes with the error:

PKCS12_parse: unsupported in the line of
p12_certificate = OpenSSL::PKCS12::new(File.read(certificate_path), "“)

(In the code snippet line 9)

I first thought about the relative paths, but everything else works with the relative paths.
Can anybody explain why that is happening?

Body:
In my ruby application, I am creating Apple wallet passes.
The application actually works well, but when I try to start it as a service (/etc/systemd/system), it is failing.
I can see that almost everything is working, but it fails when I want to parse the p12 certificate.

My function to sign the manifest file

def sign_manifest(serial_number)
    temporary_path = "./passes/#{CUSTOMER}_#{serial_number}"
    certificate_path = "./certs/Zertifikate.p12"
    wwdr_path = "./certs/WWDR.pem"
    manifest_path = "./passes/#{CUSTOMER}_#{serial_number}/manifest.json"

  puts "Signing the manifest"
  # Import the certificates
  p12_certificate = OpenSSL::PKCS12::new(File.read(certificate_path), "")
  wwdr_certificate = OpenSSL::X509::Certificate.new(File.read(wwdr_path))

  # Sign the data
  flag = OpenSSL::PKCS7::BINARY|OpenSSL::PKCS7::DETACHED
  signed = OpenSSL::PKCS7::sign(p12_certificate.certificate, p12_certificate.key, File.read(manifest_path), [wwdr_certificate], flag)

  # Create an output path for the signed data
  signature_url = temporary_path + "/signature"

  # Write out the data
  File.open(signature_url, "w") do |f|
    f.syswrite signed.to_der
  end
end

Manually start with the command line

When I start the application manually with the command

ruby passGenerator.rb -p 20001 -o 0.0.0.0

on my server, it is working well, no issues.

Start as a service

The service itself looks like:

# wallet.service

[Unit]
Description = Apple Wallet Pass Generator
After = network.target

[Service]
WorkingDirectory = /var/www/html/passGenerator
ExecStart = ruby /var/www/html/passGenerator/passGenerator.rb -p 20001 -o 0.0.0.0

[Install]
WantedBy = multi-user.target

and start it with:

systemctl start wallet

I can start the service, and the server is running, but as soon as I want to create a new pass and come to this function, it crashes with the error:

PKCS12_parse: unsupported in the line of
p12_certificate = OpenSSL::PKCS12::new(File.read(certificate_path), "“)

(In the code snippet line 9)

I first thought about the relative paths, but everything else works with the relative paths.
Can anybody explain why that is happening?


问:
client.run('mytoken') crashes and i dont know why
Traceback (most recent call last):

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in

```<code>start(fakepyfile,mainpyfile)
</code>```

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start

```<code>exec(open(mainpyfile).read(),  __main__.__dict__)
</code>```

File "", line 39

```<code>client.run('token')

^
</code>```

SyntaxError: invalid syntax

[Program finished]

i tried to make a welcome message say a random joke from radapi or whatever its called,and this is what happened

Body:
Traceback (most recent call last):

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in

start(fakepyfile,mainpyfile)

File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start

exec(open(mainpyfile).read(),  __main__.__dict__)

File "", line 39

client.run('token')

^

SyntaxError: invalid syntax

[Program finished]

i tried to make a welcome message say a random joke from radapi or whatever its called,and this is what happened