问:
NHibernate handle multiple requests Delete and SaveOrUpdate
I have .net core api that uses NHibernate, session is per request, when request start session is open at the end of the request session is committed in transaction.

One of the tables is being used as cache table so rows should be deleted in some cases.

One case is when getting data from another api crossing results with data in the table in order to take the newest rows according to date updated field, each older row is being deleted as part of this process.
Another case is a background service that gets events in order to indicate that the record is older and need to be deleted.

The issue is that in the same time when deleting older rows other request can actually update this row with new values.

Of curse that this scenario cause an exception:

```<code>NHibernate.StaleObjectStateException: 'Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
</code>```

What is the best way to solve this situation and detect that row has been deleted before SaveOrUpdate from another request at the same time?

Thank you

Body:
I have .net core api that uses NHibernate, session is per request, when request start session is open at the end of the request session is committed in transaction.

One of the tables is being used as cache table so rows should be deleted in some cases.

One case is when getting data from another api crossing results with data in the table in order to take the newest rows according to date updated field, each older row is being deleted as part of this process.
Another case is a background service that gets events in order to indicate that the record is older and need to be deleted.

The issue is that in the same time when deleting older rows other request can actually update this row with new values.

Of curse that this scenario cause an exception:

NHibernate.StaleObjectStateException: 'Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

What is the best way to solve this situation and detect that row has been deleted before SaveOrUpdate from another request at the same time?

Thank you


来源: stackexchange

问:
How to lookup submission or single row of data from Heroku via google sheet
A lot of the discussions around Heroku via google sheet integrations seem to be around importing an entire data clip which to me is limiting (especially if you have a large set of data). Is there a way to do a VLOOKUP or SEARCH into a Heroku dataclip and only extract a single row of data?  Below is the example:

In my google sheet I have the following URL:  www.helloWorld.com

In my data clip I have a column that contains 100,000 rows of unique URLS. I am looking for a formula that takes my URL in my google sheet, searches the Heroku data clip, and extracts the single row of data that contains the URL above...or extracts a single column that I define (like a VLOOKUP).

Is this possible?

I have tried simply extracting an entire data clip but again that is limiting as you cant pull in a large set of rows. Plus I feel like this is bad querying as I should just pull the data I need and not everything.

ContentLicense: CC BY-SA 4.0


问:
Laravel 8 - How to save path and redirect to it later when site root is not /?
Is there a way in Laravel to reliably save a path and redirect back to that path later?  The method I have seen does not work when the site root is at /path_to_root/ not / .

Example:  If I save "/path_to_site/mypage?x=y" like this:

```<code>                $parsedURL = parse_url($request->fullUrl());
                $url = $parsedURL['path'].'?'.$parsedURL['query'];
</code>```

When site root is /path_to_site/, then the redirect($url); does not work correctly.   It will redirect to /path_to_site/path_to_site/mypage?x=y

I'm doing this for a login page that's not on the site, so I am not using the Laravel login controller, but even for other purposes, I still want to know how to save a path and redirect to it.  Seems like it should be simple, but I have seen nothing that works.

Body:
Is there a way in Laravel to reliably save a path and redirect back to that path later?  The method I have seen does not work when the site root is at /path_to_root/ not / .

Example:  If I save "/path_to_site/mypage?x=y" like this:

                $parsedURL = parse_url($request->fullUrl());
                $url = $parsedURL['path'].'?'.$parsedURL['query'];

When site root is /path_to_site/, then the redirect($url); does not work correctly.   It will redirect to /path_to_site/path_to_site/mypage?x=y

I'm doing this for a login page that's not on the site, so I am not using the Laravel login controller, but even for other purposes, I still want to know how to save a path and redirect to it.  Seems like it should be simple, but I have seen nothing that works.


问:
Spring Boot Microservice - JUnit Controller Test - Cannot call url of another module from one module ( Status 404 ) How to mock microservice
I have a problem about running any test of service regarding spring boot microservice.

The issue is located at OrderControllerTest of order service.

After running all services up, I tried to run any test of OrderControllerTest but I got this issue shown below.

I got Status = 404 as authenticate/login belongs to auth service.

I have an auth service to implement the process of authentication and authorization with JWT.

Th request url which I want to request is http://AUTH-SERVICE/authenticate/login

How can I fix it?

I tried to use some options but they didn't help me fix the issue.

```<code>JWTResponse response = restTemplate.postForObject("http://localhost:7777/authenticate/login", loginRequest, JWTResponse.class);

JWTResponse response = restTemplate.postForObject("http://AUTH-SERVICE:7777/authenticate/login", loginRequest, JWTResponse.class);
</code>```

What should I do?

Here is the test method.

```<code>    @Test
    @DisplayName("Place Order -- Success Scenario")
    @WithMockUser(username = "User", authorities = { "ROLE_USER" })
    void test_When_placeOrder_DoPayment_Success() throws Exception {

        OrderRequest orderRequest = getMockOrderRequest();
        String jwt = getJWTTokenForRoleUser();

        MvcResult mvcResult
                = mockMvc.perform(MockMvcRequestBuilders.post("/order/placeorder")
                        .contentType(MediaType.APPLICATION_JSON_VALUE)
                        .header("Authorization", "Bearer " + jwt)
                        .content(objectMapper.writeValueAsString(orderRequest)))
                .andExpect(MockMvcResultMatchers.status().isOk())
                .andReturn();

        String orderId = mvcResult.getResponse().getContentAsString();

        Optional<Order> order = orderRepository.findById(Long.valueOf(orderId));
        assertTrue(order.isPresent());

        Order o = order.get();
        assertEquals(Long.parseLong(orderId), o.getId());
        assertEquals("PLACED", o.getOrderStatus());
        assertEquals(orderRequest.getTotalAmount(), o.getAmount());
        assertEquals(orderRequest.getQuantity(), o.getQuantity());

    }
</code>```

Here is the getJWTTokenForRoleUser method shown below.

```<code>private String getJWTTokenForRoleUser() throws Exception {

        var loginRequest = new LoginRequest("User","User");

        // HERE IS THE PROBLEM
        MvcResult result = mockMvc.perform(MockMvcRequestBuilders.post("/authenticate/login")
                        .contentType(MediaType.APPLICATION_JSON)
                        .content(asJsonString(loginRequest)))
                .andDo(MockMvcResultHandlers.print())
                .andExpect(MockMvcResultMatchers.status().isOk())
                .andReturn();

        String content = result.getResponse().getContentAsString();
        var loggedUser = objectMapper.readValue(content, JWTResponse.class);

        String jwt = jwtUtils.getUserNameFromJwtToken(loggedUser.getToken());

        return jwt;
    }
</code>```

Here is the getUserNameFromJwtToken of JwtUtils in order service

```<code>public String getUserNameFromJwtToken(String token) {
     if(token.startsWith("Bearer")){
                token = token.substring(7);
     }
     String username= Jwts.parser().setSigningKey(jwtSecret).parseClaimsJws(token).getBody().getSubject();
     return username;
}
</code>```

Here is the repo : Link

To run the app,

1 ) Run Service Registery (Eureka Server)

2 ) Run config server

3 ) Run zipkin and redis through these commands shown below on docker

```<code>  docker run -d -p 9411:9411 openzipkin/zipkin
  docker run -d --name redis -p 6379:6379 redis
</code>```

4 ) Run api gateway

5 ) Run other services

Body:
I have a problem about running any test of service regarding spring boot microservice.

The issue is located at OrderControllerTest of order service.

After running all services up, I tried to run any test of OrderControllerTest but I got this issue shown below.

I got Status = 404 as authenticate/login belongs to auth service.

I have an auth service to implement the process of authentication and authorization with JWT.

Th request url which I want to request is http://AUTH-SERVICE/authenticate/login

How can I fix it?

I tried to use some options but they didn't help me fix the issue.

JWTResponse response = restTemplate.postForObject("http://localhost:7777/authenticate/login", loginRequest, JWTResponse.class);

JWTResponse response = restTemplate.postForObject("http://AUTH-SERVICE:7777/authenticate/login", loginRequest, JWTResponse.class);

What should I do?

Here is the test method.

    @Test
    @DisplayName("Place Order -- Success Scenario")
    @WithMockUser(username = "User", authorities = { "ROLE_USER" })
    void test_When_placeOrder_DoPayment_Success() throws Exception {

        OrderRequest orderRequest = getMockOrderRequest();
        String jwt = getJWTTokenForRoleUser();

        MvcResult mvcResult
                = mockMvc.perform(MockMvcRequestBuilders.post("/order/placeorder")
                        .contentType(MediaType.APPLICATION_JSON_VALUE)
                        .header("Authorization", "Bearer " + jwt)
                        .content(objectMapper.writeValueAsString(orderRequest)))
                .andExpect(MockMvcResultMatchers.status().isOk())
                .andReturn();

        String orderId = mvcResult.getResponse().getContentAsString();

        Optional<Order> order = orderRepository.findById(Long.valueOf(orderId));
        assertTrue(order.isPresent());

        Order o = order.get();
        assertEquals(Long.parseLong(orderId), o.getId());
        assertEquals("PLACED", o.getOrderStatus());
        assertEquals(orderRequest.getTotalAmount(), o.getAmount());
        assertEquals(orderRequest.getQuantity(), o.getQuantity());

    }

Here is the getJWTTokenForRoleUser method shown below.

private String getJWTTokenForRoleUser() throws Exception {

        var loginRequest = new LoginRequest("User","User");

        // HERE IS THE PROBLEM
        MvcResult result = mockMvc.perform(MockMvcRequestBuilders.post("/authenticate/login")
                        .contentType(MediaType.APPLICATION_JSON)
                        .content(asJsonString(loginRequest)))
                .andDo(MockMvcResultHandlers.print())
                .andExpect(MockMvcResultMatchers.status().isOk())
                .andReturn();

        String content = result.getResponse().getContentAsString();
        var loggedUser = objectMapper.readValue(content, JWTResponse.class);

        String jwt = jwtUtils.getUserNameFromJwtToken(loggedUser.getToken());

        return jwt;
    }

Here is the getUserNameFromJwtToken of JwtUtils in order service

public String getUserNameFromJwtToken(String token) {
     if(token.startsWith("Bearer")){
                token = token.substring(7);
     }
     String username= Jwts.parser().setSigningKey(jwtSecret).parseClaimsJws(token).getBody().getSubject();
     return username;
}

Here is the repo : Link

To run the app,

1 ) Run Service Registery (Eureka Server)

2 ) Run config server

3 ) Run zipkin and redis through these commands shown below on docker

  docker run -d -p 9411:9411 openzipkin/zipkin
  docker run -d --name redis -p 6379:6379 redis

4 ) Run api gateway

5 ) Run other services


问:
renderHook returns undefined
I have the following code:

```<code>import { useState } from "react";

export const useCounter = (initialValue = 10) => {
  const [counter, setCounter] = useState(initialValue);

  const increaseCounter = (value = 1) => {
    setCounter(counter + value);
  };

  const resetCounter = () => {
    setCounter(initialValue);
  };

  const decreaseCounter = (value = 1) => {
    if (counter - value > 0) {
      setCounter(counter - value);
    }
  };

  console.log(counter);

  return {
    counter,
    increaseCounter,
    resetCounter,
    decreaseCounter,
  };
};
</code>```

and to test it I have this test:

```<code>import { renderHook } from "@testing-library/react";
import { useCounter } from "../../src/hooks";

describe("Testing useCounter", () => {
  test("Debe retornar los valores por defecto", () => {
    const { result } = renderHook(() => {
      useCounter(2);
    });
    console.log(result.current);
  });
});
</code>```

However result is undefined, instead to have the different properties the custom hook is returning.

The console.log in the hook is displayed with the expected value.

What could be wrong?

Title: renderHook returns undefined

Body:
I have the following code:

import { useState } from "react";

export const useCounter = (initialValue = 10) => {
  const [counter, setCounter] = useState(initialValue);

  const increaseCounter = (value = 1) => {
    setCounter(counter + value);
  };

  const resetCounter = () => {
    setCounter(initialValue);
  };

  const decreaseCounter = (value = 1) => {
    if (counter - value > 0) {
      setCounter(counter - value);
    }
  };

  console.log(counter);

  return {
    counter,
    increaseCounter,
    resetCounter,
    decreaseCounter,
  };
};

and to test it I have this test:

import { renderHook } from "@testing-library/react";
import { useCounter } from "../../src/hooks";

describe("Testing useCounter", () => {
  test("Debe retornar los valores por defecto", () => {
    const { result } = renderHook(() => {
      useCounter(2);
    });
    console.log(result.current);
  });
});

However result is undefined, instead to have the different properties the custom hook is returning.

The console.log in the hook is displayed with the expected value.

What could be wrong?


问:
How to feed input() function by writing to sys.stdin
In my gui application (PyQt5), the input() function is waiting for input in the background, i want to feed the output of lineEdit (when it is pressed) to the input() function. I tried writing the output to sys.stdin like so:

```<code>import sys
from io import StringIO
sys.stdin = StringIO(command)
</code>```

the problem is input() function cant take the input. any ideas on how to solve the problem?

Here is the full code:

```<code>import os
import sys
from PyQt5.uic import loadUi
from PyQt5.QtWidgets import QApplication
import threading
from io import StringIO

class App():
    def __init__(self) -> None:
        self.ui_file = 'app.ui'
        self.app = QApplication(sys.argv)
        self.window = loadUi(os.path.join(os.path.dirname(__file__), self.ui_file))
        self.window.pushButton.clicked.connect(self.connect)
        self.window.lineEdit_2.returnPressed.connect(self.enter)

    def enter(self):
        # take the input from lineEdit
        command = self.window.lineEdit_2.text()
        self.window.lineEdit_2.setText("")
        self.input(command)
        # feed the command as an input to the input() which is waiting
        sys.stdin = StringIO(command)

    def exec(self):
        self.window.show()
        self.app.exec_()

    def print(self, text):
        self.window.textBrowser.append(text)

    def connect(self):
        t = threading.Thread(target=self.run)
        t.start()

    def run(self):
        self.print('Password: ')
        # input() is waiting for input
        password = input('Password: ')
        print('password is', password)

def main():
    app = App()
    app.exec()

if __name__ == '__main__':
    main()
</code>```

Body:
In my gui application (PyQt5), the input() function is waiting for input in the background, i want to feed the output of lineEdit (when it is pressed) to the input() function. I tried writing the output to sys.stdin like so:

import sys
from io import StringIO
sys.stdin = StringIO(command)

the problem is input() function cant take the input. any ideas on how to solve the problem?

Here is the full code:

import os
import sys
from PyQt5.uic import loadUi
from PyQt5.QtWidgets import QApplication
import threading
from io import StringIO

class App():
    def __init__(self) -> None:
        self.ui_file = 'app.ui'
        self.app = QApplication(sys.argv)
        self.window = loadUi(os.path.join(os.path.dirname(__file__), self.ui_file))
        self.window.pushButton.clicked.connect(self.connect)
        self.window.lineEdit_2.returnPressed.connect(self.enter)

    def enter(self):
        # take the input from lineEdit
        command = self.window.lineEdit_2.text()
        self.window.lineEdit_2.setText("")
        self.input(command)
        # feed the command as an input to the input() which is waiting
        sys.stdin = StringIO(command)

    def exec(self):
        self.window.show()
        self.app.exec_()

    def print(self, text):
        self.window.textBrowser.append(text)

    def connect(self):
        t = threading.Thread(target=self.run)
        t.start()

    def run(self):
        self.print('Password: ')
        # input() is waiting for input
        password = input('Password: ')
        print('password is', password)

def main():
    app = App()
    app.exec()

if __name__ == '__main__':
    main()


问:
In my exception, output is e, i am lookin for an exception string
```<code>except Exception as e:
        logger.warning(e)
        logger.warning(
            'following query process error:')
        logger.warning(file_SQL)
    return columns, rows
</code>```

In my exception, output is e, i am lookin for an exception [error]:[error]

Body:
except Exception as e:
        logger.warning(e)
        logger.warning(
            'following query process error:')
        logger.warning(file_SQL)
    return columns, rows

In my exception, output is e, i am lookin for an exception [error]:[error]


问:
How can I return the first element in my JPQL native query using LIMIT clause when there's a relation between tables
I've recently noticed that JPQL doesn't support LIMIT keyword to set a limit in the query when there's more than one result. In my model I have two entities which have a relation with each other. By the way of illustration, suppose we have two entities, Bag and Student. One bag is related to a student but an student could have more than one bag. In this way, I have the following instructions inside my bag class in order to create that relationship between both entities:

```<code>@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "id_student")      // Column to relate bags with students.
private Student associated_student;
</code>```

Now, suppose each bag has a creation date (creation_date) and I'm interested on getting the bag with most recent creation date that is related to a given student.

As I mentioned at the beginning, knowing that LIMIT keyword is not supported in JPQL, I solved the problem using the following @Query.

```<code>@Query("select f from Bag f where f.associated_student.id_student = ?1 order by f.creation_date asc")
List<Bag> findBagsByStudentId(Long id_student);
</code>```

Now, in order to select the bag with the most creation date, I do the following steps:

```<code>Bag recent_bag = BagRepository.findBagsByStudentId(id_student).get(0);
</code>```

And here is the deal. I'd like not to use get(0) to access the bag I'm interested on, I've tried using nativeQuery like this

```<code>@Query(value = "select * from bags f where f.id_student = ?1 order by f.creation_date asc limit 1", nativeQuery = true)
</code>```

but it doesn't work. Any solution/suggestion will be appreciated, thanks in advance!

Body:
I've recently noticed that JPQL doesn't support LIMIT keyword to set a limit in the query when there's more than one result. In my model I have two entities which have a relation with each other. By the way of illustration, suppose we have two entities, Bag and Student. One bag is related to a student but an student could have more than one bag. In this way, I have the following instructions inside my bag class in order to create that relationship between both entities:

@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "id_student")      // Column to relate bags with students.
private Student associated_student;

Now, suppose each bag has a creation date (creation_date) and I'm interested on getting the bag with most recent creation date that is related to a given student.

As I mentioned at the beginning, knowing that LIMIT keyword is not supported in JPQL, I solved the problem using the following @Query.

@Query("select f from Bag f where f.associated_student.id_student = ?1 order by f.creation_date asc")
List<Bag> findBagsByStudentId(Long id_student);

Now, in order to select the bag with the most creation date, I do the following steps:

Bag recent_bag = BagRepository.findBagsByStudentId(id_student).get(0);

And here is the deal. I'd like not to use get(0) to access the bag I'm interested on, I've tried using nativeQuery like this

@Query(value = "select * from bags f where f.id_student = ?1 order by f.creation_date asc limit 1", nativeQuery = true)

but it doesn't work. Any solution/suggestion will be appreciated, thanks in advance!


问:
Why does my Tkinter window close after the while loop, even though I have an update and a quit before hand?
I am trying to make an application that connects two people in python using both the socket and tkinter libraries. At the moment I am having problem getting the tkinter window to disappear like I want (My next steps will be having a new window appear for two people to perhaps chat in?

Right now I have the following snippet. I don't think I should need the update, because this is all in a thread while mainloop is in main. but it doesn't work with or without it. The tkinter will start to freeze while I am in the while loop of the socket connection, but I am not worried about fixing that at the moment I don't think.

Edit, adding more code to show my minimum amount of code. This is the least I could get to, before the socket or tkinter seemed to stop working all together

main Function:

```<code>from tkinter import *
import threading
from hosting import getHostAddress, getConnected
from client import connectToHost

def hostServer():
    hostB.destroy()
    connectB.destroy()
    e.destroy()

    addr, sock = getHostAddress()
    hostingText = addr + "\nWaiting for Connection"

    hostLabel = Label(window, text=hostingText)
    hostLabel.pack()

    getConnected(sock, window)

def connectToIP():
    IP = e.get()
    window.destroy()
    connectToHost(IP)

def connectServer():
    hostB.destroy()
    connectB.destroy()

    conLabel = Label(window, text="Enter Code")
    conLabel.pack(side="left")
    e.pack(side="left")
    window.geometry("250x50")
    conButton = Button(window, text="Connect", command=connectToIP)
    conButton.pack(side="left")

if __name__ =="__main__":
    window = Tk()

    e = Entry(window)
    hostB = Button(window, text="Host", command=threading.Thread(target=hostServer).start)
    hostB.pack()
    connectB = Button(window, text="Connect", command=connectServer)
    connectB.pack()

    window.mainloop()
</code>```

client.py

```<code>import socket

port = 5000;
client = socket.socket()

def connectToHost(IPAddr):
  client.connect((IPAddr, port))

  message = input(" -> ")  # take input

  while message.lower().strip() != 'bye':
    client.send(message.encode())  # send message
    data = client.recv(1024).decode()  # receive response

    print('Received from server: ' + data)  # show in terminal

    message = input(" -> ")  # again take input

  client.close()  # close the connection
</code>```

hosting.py

```<code>import socket

#def getPort():

def getHostAddress():
  hostname = socket.gethostname()
  IPAddr = socket.gethostbyname(hostname)

  sock = socket.socket()
  sock.bind((hostname, 5000))

  addr = IPAddr

  return addr, sock

def getConnected(sock, window):
  sock.listen(2)
  conn, address = sock.accept()  # accept new connection

  window.quit()
  window.update()

  while True:
    # receive data stream. it won't accept data packet greater than 1024 bytes
    data = conn.recv(1024).decode()
    if not data:
      # if data is not received break
      break
    print("from connected user: " + str(data))
    data = input(' -> ')
    conn.send(data.encode())  # send data to the client

  conn.close()  # close the connection
</code>```

Thanks in advance

Body:
I am trying to make an application that connects two people in python using both the socket and tkinter libraries. At the moment I am having problem getting the tkinter window to disappear like I want (My next steps will be having a new window appear for two people to perhaps chat in?

Right now I have the following snippet. I don't think I should need the update, because this is all in a thread while mainloop is in main. but it doesn't work with or without it. The tkinter will start to freeze while I am in the while loop of the socket connection, but I am not worried about fixing that at the moment I don't think.

Edit, adding more code to show my minimum amount of code. This is the least I could get to, before the socket or tkinter seemed to stop working all together

main Function:

from tkinter import *
import threading
from hosting import getHostAddress, getConnected
from client import connectToHost

def hostServer():
    hostB.destroy()
    connectB.destroy()
    e.destroy()

    addr, sock = getHostAddress()
    hostingText = addr + "\nWaiting for Connection"

    hostLabel = Label(window, text=hostingText)
    hostLabel.pack()

    getConnected(sock, window)

def connectToIP():
    IP = e.get()
    window.destroy()
    connectToHost(IP)

def connectServer():
    hostB.destroy()
    connectB.destroy()

    conLabel = Label(window, text="Enter Code")
    conLabel.pack(side="left")
    e.pack(side="left")
    window.geometry("250x50")
    conButton = Button(window, text="Connect", command=connectToIP)
    conButton.pack(side="left")

if __name__ =="__main__":
    window = Tk()

    e = Entry(window)
    hostB = Button(window, text="Host", command=threading.Thread(target=hostServer).start)
    hostB.pack()
    connectB = Button(window, text="Connect", command=connectServer)
    connectB.pack()

    window.mainloop()

client.py

import socket

port = 5000;
client = socket.socket()

def connectToHost(IPAddr):
  client.connect((IPAddr, port))

  message = input(" -> ")  # take input

  while message.lower().strip() != 'bye':
    client.send(message.encode())  # send message
    data = client.recv(1024).decode()  # receive response

    print('Received from server: ' + data)  # show in terminal

    message = input(" -> ")  # again take input

  client.close()  # close the connection

hosting.py

import socket

#def getPort():

def getHostAddress():
  hostname = socket.gethostname()
  IPAddr = socket.gethostbyname(hostname)

  sock = socket.socket()
  sock.bind((hostname, 5000))

  addr = IPAddr

  return addr, sock

def getConnected(sock, window):
  sock.listen(2)
  conn, address = sock.accept()  # accept new connection

  window.quit()
  window.update()

  while True:
    # receive data stream. it won't accept data packet greater than 1024 bytes
    data = conn.recv(1024).decode()
    if not data:
      # if data is not received break
      break
    print("from connected user: " + str(data))
    data = input(' -> ')
    conn.send(data.encode())  # send data to the client

  conn.close()  # close the connection

Thanks in advance


问:
Unable to do pandas profiling and generating report in notebook
This is the error which I always get. The vbox error comes in my both auto viz and profiling report. Please let me know if my notebook is outdated or where I am missing the part ?

**

```<code>type of the return value must be pandas_profiling.report.presentation.core.renderable.Renderable; got ipywidgets.widgets.widget_box.VBox instead
</code>```

**

I was trying to generate the profiling report automated version for exploratory data analysis .The code I used is written below: :

import sys

!{sys.executable} -m pip install -U pandas-profiling[notebook]

!jupyter nbextension enable --py widgetsnbextension

2. from pandas_profiling import ProfileReport

profile = ProfileReport(df, title="Pandas Profiling Report")

3.profile.to_widgets()

Body:
This is the error which I always get. The vbox error comes in my both auto viz and profiling report. Please let me know if my notebook is outdated or where I am missing the part ?

**

type of the return value must be pandas_profiling.report.presentation.core.renderable.Renderable; got ipywidgets.widgets.widget_box.VBox instead

**

I was trying to generate the profiling report automated version for exploratory data analysis .The code I used is written below: :

import sys

!{sys.executable} -m pip install -U pandas-profiling[notebook]

!jupyter nbextension enable --py widgetsnbextension

2. from pandas_profiling import ProfileReport

profile = ProfileReport(df, title="Pandas Profiling Report")

3.profile.to_widgets()


问:
Python - How to get the corresponding area of a PDF from a JPEG?
If I create a jpeg copy of a pdf and then use an algorithm to select an area on the jpeg, is there a way to find what part of the pdf my selected jpeg area corresponds to? I want to use my calculated area in tabula's read_pdf function and plug it into the area parameter so I need the corresponding top, left, bottom, and right points of the pdf. I am using pdf2image's convert_from_path to convert from a pdf to a jpeg.

```<code>from pdf2image import convert_from_path

pdf = "file.pdf"
page = convert_from_path(pdf, dpi = 300)
page.save("file.jpg", "JPEG")

#Calculation to find area on file.jpeg

image = cv2.imread('file.jpg')
c = [(119, 2434), (2450, 3897)] #selected area
cropped_image = image[c[0][1]:c[1][1], c[0][0]:c[1][0]]

#What area (top,left,bottom,right points) on the pdf does cropped_image correspond to?
</code>```

I tried plugging the coordinates from the selected area on the JPEG in, but the resulting dataframe from tabula was empty.

```<code>test = tabula.read_pdf("file.pdf", pandas_options = {'header': None}, area = [c[0][1], c[0][0], c[1][1], c[1][0]])
</code>```

I also tried adjusting the dpi when I used convert_from_path, but that also didn't work and I can't figure out what the correct dpi would even be since PDFs can contain vector objects.

Edit: I am using cv2.boundingRect() to get the points on the jpeg file. So the selected area in c are coordinates in from that operation. Thanks in advance.

Body:
If I create a jpeg copy of a pdf and then use an algorithm to select an area on the jpeg, is there a way to find what part of the pdf my selected jpeg area corresponds to? I want to use my calculated area in tabula's read_pdf function and plug it into the area parameter so I need the corresponding top, left, bottom, and right points of the pdf. I am using pdf2image's convert_from_path to convert from a pdf to a jpeg.

from pdf2image import convert_from_path

pdf = "file.pdf"
page = convert_from_path(pdf, dpi = 300)
page.save("file.jpg", "JPEG")

#Calculation to find area on file.jpeg

image = cv2.imread('file.jpg')
c = [(119, 2434), (2450, 3897)] #selected area
cropped_image = image[c[0][1]:c[1][1], c[0][0]:c[1][0]]

#What area (top,left,bottom,right points) on the pdf does cropped_image correspond to?

I tried plugging the coordinates from the selected area on the JPEG in, but the resulting dataframe from tabula was empty.

test = tabula.read_pdf("file.pdf", pandas_options = {'header': None}, area = [c[0][1], c[0][0], c[1][1], c[1][0]])

I also tried adjusting the dpi when I used convert_from_path, but that also didn't work and I can't figure out what the correct dpi would even be since PDFs can contain vector objects.

Edit: I am using cv2.boundingRect() to get the points on the jpeg file. So the selected area in c are coordinates in from that operation. Thanks in advance.


问:
Add many hyperlinks to word doc programmatically via R script
Suppose I have a very large word document with a TOC, sections, tables, and figures.  I have a spreadsheet (lookup) with two fields: text of interest, and hyperlink location.

Can I leverage the officer package to scan through the document's content, and insert the hyperlink (add if there is no hyperlink; modify if there is a hyperlink to a location) based on my lookup table?

Thank you.


问:
Google Speech-to-Text word-level timestamp is all zero
I have a one-day experience with any google cloud service, so please pardon such a novice question.

I am trying to transcribe audio recordings over the speech-to-text API, and the transcript itself is looking fine. However, when I inspect the timestamp of each word, they are all zero. I have no idea why this is the case, and of course any suggestion is appreciated.

from google.cloud import speech

# Instantiates a client
client = speech.SpeechClient()

# The name of the audio file to transcribe
gcs_uri = "gs://cloud-samples-data/speech/brooklyn_bridge.raw"

def transcribe_speech():
  audio = speech.RecognitionAudio(uri=gcs_uri)

  config = speech.RecognitionConfig(
      encoding=speech.RecognitionConfig.AudioEncoding.LINEAR16,
      sample_rate_hertz=16000,
      language_code="en-US",
      enable_word_confidence=True,
  )

  # Detects speech in the audio file
  response = client.recognize(config=config, audio=audio)

  for result in response.results:
    alternative = result.alternatives[0]
    print("Transcript: {}".format(alternative.transcript))
    print("Confidence: {}".format(alternative.confidence))

    for word_info in alternative.words:
            word = word_info.word
            start_time = word_info.start_time
            end_time = word_info.end_time
            confidence = word_info.confidence

            print(
                f"Word: {word}, start_time: {start_time.total_seconds()}, end_time: {end_time.total_seconds()}, confidence: {confidence}"
            )

transcribe_speech()
```

and the output:
Transcript: the blue swearing cruise control in their victory over Poland moving one step closer to achieving their ambitious goal of becoming the only the third men's team to repeat as World Cup 10 and the first has Brazil won back-to-back trophies in 1958 and 1962 as brilliant as Killian mbappe has been with the tournament high five goals he hasn't been doing it alone the PSG star has been affected by a wonderful Supporting Cast including and Tony Griezmann and Adria rebels in the French side that has one of the most balanced roster at this world cup
Confidence: 0.9663322567939758
Word: the, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: blue, start_time: 0.0, end_time: 0.0, confidence: 0.9142594337463379
Word: swearing, start_time: 0.0, end_time: 0.0, confidence: 0.9335734844207764
Word: cruise, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: control, start_time: 0.0, end_time: 0.0, confidence: 0.9244645833969116
Word: in, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: their, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: victory, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: over, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
...
...

Body:
I have a one-day experience with any google cloud service, so please pardon such a novice question.

I am trying to transcribe audio recordings over the speech-to-text API, and the transcript itself is looking fine. However, when I inspect the timestamp of each word, they are all zero. I have no idea why this is the case, and of course any suggestion is appreciated.

from google.cloud import speech

# Instantiates a client
client = speech.SpeechClient()

# The name of the audio file to transcribe
gcs_uri = "gs://cloud-samples-data/speech/brooklyn_bridge.raw"

def transcribe_speech():
  audio = speech.RecognitionAudio(uri=gcs_uri)

  config = speech.RecognitionConfig(
      encoding=speech.RecognitionConfig.AudioEncoding.LINEAR16,
      sample_rate_hertz=16000,
      language_code="en-US",
      enable_word_confidence=True,
  )

  # Detects speech in the audio file
  response = client.recognize(config=config, audio=audio)

  for result in response.results:
    alternative = result.alternatives[0]
    print("Transcript: {}".format(alternative.transcript))
    print("Confidence: {}".format(alternative.confidence))

    for word_info in alternative.words:
            word = word_info.word
            start_time = word_info.start_time
            end_time = word_info.end_time
            confidence = word_info.confidence

            print(
                f"Word: {word}, start_time: {start_time.total_seconds()}, end_time: {end_time.total_seconds()}, confidence: {confidence}"
            )

transcribe_speech()

and the output:
Transcript: the blue swearing cruise control in their victory over Poland moving one step closer to achieving their ambitious goal of becoming the only the third men's team to repeat as World Cup 10 and the first has Brazil won back-to-back trophies in 1958 and 1962 as brilliant as Killian mbappe has been with the tournament high five goals he hasn't been doing it alone the PSG star has been affected by a wonderful Supporting Cast including and Tony Griezmann and Adria rebels in the French side that has one of the most balanced roster at this world cup
Confidence: 0.9663322567939758
Word: the, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: blue, start_time: 0.0, end_time: 0.0, confidence: 0.9142594337463379
Word: swearing, start_time: 0.0, end_time: 0.0, confidence: 0.9335734844207764
Word: cruise, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: control, start_time: 0.0, end_time: 0.0, confidence: 0.9244645833969116
Word: in, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: their, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: victory, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
Word: over, start_time: 0.0, end_time: 0.0, confidence: 0.9876290559768677
...
...


问:
How I can change laravel created_at format to diffForHumans() in model casting
I want to change laravel default created_at format to diffForHumans() in model. I can change it to other formats like below

```<code>protected $casts = [
   'created_at' => 'datetime:H:i d M, Y', // Out put 03:40 09 Dec, 2022
];
</code>```

But I want it to diffForHumans() format. like below

```<code>protected $casts = [
   'created_at' => $this->created_at->diffForHumans(), // Out put should 2 days ago
];
</code>```

But I can't do it. Right now I'm using laravel 9

Thanks in advance :)

Sakib

Body:
I want to change laravel default created_at format to diffForHumans() in model. I can change it to other formats like below

protected $casts = [
   'created_at' => 'datetime:H:i d M, Y', // Out put 03:40 09 Dec, 2022
];

But I want it to diffForHumans() format. like below

protected $casts = [
   'created_at' => $this->created_at->diffForHumans(), // Out put should 2 days ago
];

But I can't do it. Right now I'm using laravel 9

Thanks in advance :)

Sakib


问:
Converting Dataframe to Be Compatible With Time Series
I have a dataframe called "df" that I would like to make compatible with a time series.

```<code>

    GeoName     TimePeriod     Population

0   Alamance, NC    2015        157,367
1   Alamance, NC    2016        160,663
2   Alamance, NC    2017        163,671
3   Alamance, NC    2018        166,901
4   Alamance, NC    2019        169,590
... ... ... ... ... ... ...
422 York, SC        2017        262,998
423 York, SC        2018        270,090

</code>```

I created another dataframe 'df2'

```<code>    Datetime
0   2015-07-01 00:00:00
1   2015-07-01 01:00:00
2   2015-07-01 02:00:00
3   2015-07-01 03:00:00
4   2015-07-01 04
</code>```

My goal is 1) have df2 have column names of the distinct geonames/counties_population (there are 61 distinct geonames but they appear more than once for distinct years)

I would like for ex. to have every hour of df2 for 2015 and Alamance, NC to show the population of 157,367 --> repeat for all 61 counties/every year

```<code>    Datetime               Alamance_NC_pop
0   2015-07-01 00:00:00    157,367
1   2015-07-01 01:00:00    157,367
2   2015-07-01 02:00:00    157,367
3   2015-07-01 03:00:00    157,367
4   2015-07-01 04:00:00    157,367
</code>```

Body:
I have a dataframe called "df" that I would like to make compatible with a time series.

    GeoName     TimePeriod     Population

0   Alamance, NC    2015        157,367
1   Alamance, NC    2016        160,663
2   Alamance, NC    2017        163,671
3   Alamance, NC    2018        166,901
4   Alamance, NC    2019        169,590
... ... ... ... ... ... ...
422 York, SC        2017        262,998
423 York, SC        2018        270,090

I created another dataframe 'df2'

    Datetime
0   2015-07-01 00:00:00
1   2015-07-01 01:00:00
2   2015-07-01 02:00:00
3   2015-07-01 03:00:00
4   2015-07-01 04

My goal is 1) have df2 have column names of the distinct geonames/counties_population (there are 61 distinct geonames but they appear more than once for distinct years)

I would like for ex. to have every hour of df2 for 2015 and Alamance, NC to show the population of 157,367 --> repeat for all 61 counties/every year

    Datetime               Alamance_NC_pop
0   2015-07-01 00:00:00    157,367
1   2015-07-01 01:00:00    157,367
2   2015-07-01 02:00:00    157,367
3   2015-07-01 03:00:00    157,367
4   2015-07-01 04:00:00    157,367


问:
Auditd - SOCKADDR - AF_LOCAL - Parsing issues
I set out to parse an auditd log entry containing a SOCKADDR event. I am running into issues with additional data and trying to identify where its coming from and the structure of it.

The current data size I am seeing is 220 hex characters total including the family.

Based on the below structure ref: https://linux.die.net/man/7/unix

```<code>#define UNIX_PATH_MAX    108

struct sockaddr_un {
    sa_family_t sun_family;               /* AF_UNIX */
    char        sun_path[UNIX_PATH_MAX];  /* pathname */
};
</code>```

I conducted parsing of the log entry as below.

Audit.log -> SOCKADDR entry -> saddr field start of parsing:

```<code>1. Read 4 bytes = 0100 = AF_LOCAL
2. Read remainder of field into variable
</code>```

After parsing out the sun_family, I have more than the structured 108 bytes remaining in the data.

Can anyone point me in the right direction as to where this data is coming from and what the structure is supposed to be?

Thank you for your help.

Body:
I set out to parse an auditd log entry containing a SOCKADDR event. I am running into issues with additional data and trying to identify where its coming from and the structure of it.

The current data size I am seeing is 220 hex characters total including the family.

Based on the below structure ref: https://linux.die.net/man/7/unix

#define UNIX_PATH_MAX    108

struct sockaddr_un {
    sa_family_t sun_family;               /* AF_UNIX */
    char        sun_path[UNIX_PATH_MAX];  /* pathname */
};

I conducted parsing of the log entry as below.

Audit.log -> SOCKADDR entry -> saddr field start of parsing:

1. Read 4 bytes = 0100 = AF_LOCAL
2. Read remainder of field into variable

After parsing out the sun_family, I have more than the structured 108 bytes remaining in the data.

Can anyone point me in the right direction as to where this data is coming from and what the structure is supposed to be?

Thank you for your help.


问:
Ruby on Rails - uninitialized constant Mail::TestMailer (NameError)
Been having an issue with my production ruby on rails app and I cannot figure out what is wrong.

I am not using any mailers and I have tried making a Mail::TestMailer constant, I have tried finding references to Mail::TestMailer and found none. application_mailer.rb has not been changed at all, just the default file.

```<code>uninitialized constant Mail::TestMailer (NameError)
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:42:in `<module:ClassMethods>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:40:in `<module:DeliveryMethods>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:8:in `<module:ActionMailer>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:5:in `<main>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/base.rb:438:in `<class:Base>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/base.rb:437:in `<module:ActionMailer>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/base.rb:12:in `<main>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
  /var/www/APPNAME/releases/10/app/mailers/application_mailer.rb:1:in `<main>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:30:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:135:in `const_get'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:135:in `cget'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:169:in `block in actual_eager_load_dir'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:40:in `block in ls'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:25:in `each'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:25:in `ls'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:164:in `actual_eager_load_dir'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:16:in `each'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:296:in `block in eager_load_all'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:294:in `each'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:294:in `eager_load_all'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application/finisher.rb:133:in `block in <module:Finisher>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `instance_exec'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `run'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails
</code>```

Body:
Been having an issue with my production ruby on rails app and I cannot figure out what is wrong.

I am not using any mailers and I have tried making a Mail::TestMailer constant, I have tried finding references to Mail::TestMailer and found none. application_mailer.rb has not been changed at all, just the default file.

uninitialized constant Mail::TestMailer (NameError)
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:42:in `<module:ClassMethods>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:40:in `<module:DeliveryMethods>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:8:in `<module:ActionMailer>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/delivery_methods.rb:5:in `'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/base.rb:438:in `<class:Base>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/base.rb:437:in `<module:ActionMailer>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/actionmailer-6.1.7/lib/action_mailer/base.rb:12:in `'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
  /var/www/APPNAME/releases/10/app/mailers/application_mailer.rb:1:in `'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:30:in `require'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:135:in `const_get'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:135:in `cget'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:169:in `block in actual_eager_load_dir'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:40:in `block in ls'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:25:in `each'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/helpers.rb:25:in `ls'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:164:in `actual_eager_load_dir'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:16:in `each'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:296:in `block in eager_load_all'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:294:in `each'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:294:in `eager_load_all'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/application/finisher.rb:133:in `block in <module:Finisher>'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `instance_exec'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails/initializable.rb:32:in `run'
  /var/www/APPNAME/shared/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7/lib/rails


问:
How To Incorporate AWS Glue Job Parameters Into SQL Query in Glue Visual Editor?
I am creating an AWS Glue job using the Glue Visual Editor.  The Glue job uses the SQL Query node to run a SQL query on an S3 source, including filtering on a start date and end date.  How would I set that date range using an input parameter?

Here is the Glue job.  It's currently running fine, with the start date and end date hardcoded.

Glue job showing SQL query with hardcoded start and end date

Here are the input parameters I created for the job.

Glue job input parameters

How would I access the parameters in the job, using the visual editor, and incorporate them into my SQL query?  Is this possible?

I've searched online for a way to access the parameters in the Glue visual interface, and searched the Glue menu for an input widget that would expose the parameters.  No luck so far.

Thank you!


问:
Python Ctypes creating a simple keyboard macro
I want create a simple keyboard macro with ctypes. When I press "spacebar", I need the keys "b" and "spacebar" be pressed (with a small delay between them). The thing is that when I run the code, it just presses continuously "f" and "space". I only need "b" and "space" to be pressed and only when I hit the spacebar. This my code. Due to me being python newbie, there might be many useless lines in there. Thanks.</p>
```<code>import ctypes
from ctypes import wintypes
import time
import win32con

user32 = ctypes.WinDLL('user32', use_last_error=True)

INPUT_MOUSE    = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2

KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP       = 0x0002
KEYEVENTF_UNICODE     = 0x0004
KEYEVENTF_SCANCODE    = 0x0008

MAPVK_VK_TO_VSC = 0

# List of all codes for keys:
# # msdn.microsoft.com/en-us/library/dd375731

B = 0x46
SPACE = 0x20

# C struct definitions

wintypes.ULONG_PTR = wintypes.WPARAM

class MOUSEINPUT(ctypes.Structure):
    _fields_ = (("dx",          wintypes.LONG),
                ("dy",          wintypes.LONG),
                ("mouseData",   wintypes.DWORD),
                ("dwFlags",     wintypes.DWORD),
                ("time",        wintypes.DWORD),
                ("dwExtraInfo", wintypes.ULONG_PTR))

class KEYBDINPUT(ctypes.Structure):
    _fields_ = (("wVk",         wintypes.WORD),
                ("wScan",       wintypes.WORD),
                ("dwFlags",     wintypes.DWORD),
                ("time",        wintypes.DWORD),
                ("dwExtraInfo", wintypes.ULONG_PTR))

    def __init__(self, *args, **kwds):
        super(KEYBDINPUT, self).__init__(*args, **kwds)

        if not self.dwFlags & KEYEVENTF_UNICODE:
            self.wScan = user32.MapVirtualKeyExW(self.wVk,
                                                 MAPVK_VK_TO_VSC, 0)

class HARDWAREINPUT(ctypes.Structure):
    _fields_ = (("uMsg",    wintypes.DWORD),
                ("wParamL", wintypes.WORD),
                ("wParamH", wintypes.WORD))

class INPUT(ctypes.Structure):
    class _INPUT(ctypes.Union):
        _fields_ = (("ki", KEYBDINPUT),
                    ("mi", MOUSEINPUT),
                    ("hi", HARDWAREINPUT))
    _anonymous_ = ("_input",)
    _fields_ = (("type",   wintypes.DWORD),
                ("_input", _INPUT))

LPINPUT = ctypes.POINTER(INPUT)

def _check_count(result, func, args):
    if result == 0:
        raise ctypes.WinError(ctypes.get_last_error())
    return args

user32.SendInput.errcheck = _check_count
user32.SendInput.argtypes = (wintypes.UINT, # nInputs
                             LPINPUT,       # pInputs
                             ctypes.c_int)  # cbSize

# Functions

def PressKey(hexKeyCode):
    x = INPUT(type=INPUT_KEYBOARD,
              ki=KEYBDINPUT(wVk=hexKeyCode))
    user32.SendInput(1, ctypes.byref(x), ctypes.sizeof(x))
    ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))

def ReleaseKey(hexKeyCode):
    x = INPUT(type=INPUT_KEYBOARD,
              ki=KEYBDINPUT(wVk=hexKeyCode,
                            dwFlags=KEYEVENTF_KEYUP))
    user32.SendInput(1, ctypes.byref(x), ctypes.sizeof(x))
    ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))

# Register hotkeys
ctypes.windll.user32.RegisterHotKey(None, 1, 0, win32con.VK_SPACE)

# Macro when the hotkey is pressed
try:
    msg = ctypes.wintypes.MSG()
    while ctypes.windll.user32.GetMessageA(ctypes.byref(msg), None, 0, 0) != 0:
        if msg.message == win32con.WM_HOTKEY:
             PressKey(0x46)
             time.sleep(1)
             ReleaseKey(0x46)
             PressKey(0x20)
             time.sleep(1)
             ReleaseKey(0x20)

# Cleanup
finally:
    ctypes.windll.user32.UnregisterHotKey(None, 1)
</code>```

Body:
I want create a simple keyboard macro with ctypes. When I press "spacebar", I need the keys "b" and "spacebar" be pressed (with a small delay between them). The thing is that when I run the code, it just presses continuously "f" and "space". I only need "b" and "space" to be pressed and only when I hit the spacebar. This my code. Due to me being python newbie, there might be many useless lines in there. Thanks.

import ctypes
from ctypes import wintypes
import time
import win32con

user32 = ctypes.WinDLL('user32', use_last_error=True)

INPUT_MOUSE    = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2

KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP       = 0x0002
KEYEVENTF_UNICODE     = 0x0004
KEYEVENTF_SCANCODE    = 0x0008

MAPVK_VK_TO_VSC = 0

# List of all codes for keys:
# # msdn.microsoft.com/en-us/library/dd375731

B = 0x46
SPACE = 0x20

# C struct definitions

wintypes.ULONG_PTR = wintypes.WPARAM

class MOUSEINPUT(ctypes.Structure):
    _fields_ = (("dx",          wintypes.LONG),
                ("dy",          wintypes.LONG),
                ("mouseData",   wintypes.DWORD),
                ("dwFlags",     wintypes.DWORD),
                ("time",        wintypes.DWORD),
                ("dwExtraInfo", wintypes.ULONG_PTR))

class KEYBDINPUT(ctypes.Structure):
    _fields_ = (("wVk",         wintypes.WORD),
                ("wScan",       wintypes.WORD),
                ("dwFlags",     wintypes.DWORD),
                ("time",        wintypes.DWORD),
                ("dwExtraInfo", wintypes.ULONG_PTR))

    def __init__(self, *args, **kwds):
        super(KEYBDINPUT, self).__init__(*args, **kwds)

        if not self.dwFlags & KEYEVENTF_UNICODE:
            self.wScan = user32.MapVirtualKeyExW(self.wVk,
                                                 MAPVK_VK_TO_VSC, 0)

class HARDWAREINPUT(ctypes.Structure):
    _fields_ = (("uMsg",    wintypes.DWORD),
                ("wParamL", wintypes.WORD),
                ("wParamH", wintypes.WORD))

class INPUT(ctypes.Structure):
    class _INPUT(ctypes.Union):
        _fields_ = (("ki", KEYBDINPUT),
                    ("mi", MOUSEINPUT),
                    ("hi", HARDWAREINPUT))
    _anonymous_ = ("_input",)
    _fields_ = (("type",   wintypes.DWORD),
                ("_input", _INPUT))

LPINPUT = ctypes.POINTER(INPUT)

def _check_count(result, func, args):
    if result == 0:
        raise ctypes.WinError(ctypes.get_last_error())
    return args

user32.SendInput.errcheck = _check_count
user32.SendInput.argtypes = (wintypes.UINT, # nInputs
                             LPINPUT,       # pInputs
                             ctypes.c_int)  # cbSize

# Functions

def PressKey(hexKeyCode):
    x = INPUT(type=INPUT_KEYBOARD,
              ki=KEYBDINPUT(wVk=hexKeyCode))
    user32.SendInput(1, ctypes.byref(x), ctypes.sizeof(x))
    ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))

def ReleaseKey(hexKeyCode):
    x = INPUT(type=INPUT_KEYBOARD,
              ki=KEYBDINPUT(wVk=hexKeyCode,
                            dwFlags=KEYEVENTF_KEYUP))
    user32.SendInput(1, ctypes.byref(x), ctypes.sizeof(x))
    ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))

# Register hotkeys
ctypes.windll.user32.RegisterHotKey(None, 1, 0, win32con.VK_SPACE)

# Macro when the hotkey is pressed
try:
    msg = ctypes.wintypes.MSG()
    while ctypes.windll.user32.GetMessageA(ctypes.byref(msg), None, 0, 0) != 0:
        if msg.message == win32con.WM_HOTKEY:
             PressKey(0x46)
             time.sleep(1)
             ReleaseKey(0x46)
             PressKey(0x20)
             time.sleep(1)
             ReleaseKey(0x20)

# Cleanup
finally:
    ctypes.windll.user32.UnregisterHotKey(None, 1)


问:
How to start and stop a new terminal from python after issuing commands
Linux/Python3:

I've read a couple of question regarding this but couldn't find the right solution. How do I start a new terminal from python, run a command on the new terminal, and terminate when the process is done.

Reason:
I have a multi-url list and for each url in my list, I want to perform several operations with playwright over proxy. For each set of operations, I would like to use tshark to capture network traffic with these filters:

tshark -i eth0 -n -f "host <IP_ADDR> and tcp and port <PORT>" -T fields -e frame.len -e ip.src -e ip.dst -E separator=, > myfile.csv

As it seems, I can only run this capture from another terminal.

My initial idea was to use the option pid and issuing a signal.SIGKILL but I already realised this wouldn't seem to do the trick as I don't even know if it is possible to issue a subprocess call in another subprocess for the tshark in the new terminal.

```<code>import subprocess, os, time, signal
p = subprocess.Popen('gnome-terminal')
...
...
...
...
os.kill(proc.pid, signal.SIGKILL)
</code>```

Just for the records, I am aware I could use other tools like the Scapy's AsyncSniffer to get traces using the AsyncSniffer.start() and AsyncSniffer.stop() but then in this case, I cannot parse my desired filter. Therefore, I thought the use of tshark will make life a bit easier.

Would really appreciate any help.

PS: I'm new to python. Would appreciate if you could explain as tho you'd tell the most clueless person. Also, any alternatives to this approach is highly appreciated.

Thanks
NS

Body:
Linux/Python3:

I've read a couple of question regarding this but couldn't find the right solution. How do I start a new terminal from python, run a command on the new terminal, and terminate when the process is done.

Reason:
I have a multi-url list and for each url in my list, I want to perform several operations with playwright over proxy. For each set of operations, I would like to use tshark to capture network traffic with these filters:

tshark -i eth0 -n -f "host <IP_ADDR> and tcp and port <PORT>" -T fields -e frame.len -e ip.src -e ip.dst -E separator=, > myfile.csv

As it seems, I can only run this capture from another terminal.

My initial idea was to use the option pid and issuing a signal.SIGKILL but I already realised this wouldn't seem to do the trick as I don't even know if it is possible to issue a subprocess call in another subprocess for the tshark in the new terminal.

import subprocess, os, time, signal
p = subprocess.Popen('gnome-terminal')
...
...
...
...
os.kill(proc.pid, signal.SIGKILL)

Just for the records, I am aware I could use other tools like the Scapy's AsyncSniffer to get traces using the AsyncSniffer.start() and AsyncSniffer.stop() but then in this case, I cannot parse my desired filter. Therefore, I thought the use of tshark will make life a bit easier.

Would really appreciate any help.

PS: I'm new to python. Would appreciate if you could explain as tho you'd tell the most clueless person. Also, any alternatives to this approach is highly appreciated.

Thanks
NS


问:
Why Docker faild with npm error only on MacOs
I have one project. And when i try it with "docker-compose up" command on my Windows-PC all is good! Docker do it perfectly without error.
But when i try this project on MacOS, i get error on "RUN npm i" step.
Why?
I get error on the end of error's message - failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1

Full error log:

```<code>> [111-backend builder 4/6] RUN npm i:
#0 4.159 npm WARN deprecated preview-email@3.0.5: Please upgrade to v3.0.7+ as we have added iOS Simulator support to previewing emails! See <https://github.com/forwardemail/preview-email/releases/tag/v3.0.6> and screenshots at <https://github.com/forwardemail/preview-email\#ios-simulator>.
#0 16.18 npm notice
#0 16.18 npm notice New major version of npm available! 8.19.2 -> 9.2.0
#0 16.18 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
#0 16.18 npm notice Run `npm install -g npm@9.2.0` to update!
#0 16.18 npm notice
#0 16.18 npm ERR! code 1
#0 16.18 npm ERR! path /app/node_modules/bcrypt
#0 16.18 npm ERR! command failed
#0 16.18 npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build
#0 16.18 npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 16.18 npm ERR! node-pre-gyp info it worked if it ends with ok
#0 16.18 npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
#0 16.18 npm ERR! node-pre-gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! node-pre-gyp info check checked for "/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
#0 16.18 npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@16.18.1 (node-v93 ABI, musl) (falling back to source compile with node-gyp)
#0 16.18 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! gyp info it worked if it ends with ok
#0 16.18 npm ERR! gyp info using node-gyp@9.1.0
#0 16.18 npm ERR! gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! gyp info ok
#0 16.18 npm ERR! gyp info it worked if it ends with ok
#0 16.18 npm ERR! gyp info using node-gyp@9.1.0
#0 16.18 npm ERR! gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#0 16.18 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#0 16.18 npm ERR! gyp ERR! find Python checking if "python3" can be used
#0 16.18 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#0 16.18 npm ERR! gyp ERR! find Python checking if "python" can be used
#0 16.18 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! find Python **********************************************************
#0 16.18 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#0 16.18 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#0 16.18 npm ERR! gyp ERR! find Python you can try one of the following options:
#0 16.18 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#0 16.18 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#0 16.18 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#0 16.18 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#0 16.18 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#0 16.18 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#0 16.18 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#0 16.18 npm ERR! gyp ERR! find Python **********************************************************
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! configure error
#0 16.18 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
#0 16.18 npm ERR! gyp ERR! stack     at exithandler (node:child_process:410:5)
#0 16.18 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:422:5)
#0 16.18 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#0 16.18 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
#0 16.18 npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:485:16)
#0 16.18 npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
#0 16.18 npm ERR! gyp ERR! System Linux 5.15.49-linuxkit
#0 16.18 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/app/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
#0 16.18 npm ERR! gyp ERR! cwd /app/node_modules/bcrypt
#0 16.18 npm ERR! gyp ERR! node -v v16.18.1
#0 16.18 npm ERR! gyp ERR! node-gyp -v v9.1.0
#0 16.18 npm ERR! gyp ERR! not ok
#0 16.18 npm ERR! node-pre-gyp ERR! build error
#0 16.18 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
#0 16.18 npm ERR! node-pre-gyp ERR! System Linux 5.15.49-linuxkit
#0 16.18 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#0 16.18 npm ERR! node-pre-gyp ERR! cwd /app/node_modules/bcrypt
#0 16.18 npm ERR! node-pre-gyp ERR! node -v v16.18.1
#0 16.18 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
#0 16.18 npm ERR! node-pre-gyp ERR! not ok
#0 16.19
#0 16.19 npm ERR! A complete log of this run can be found in:
#0 16.19 npm ERR!     /root/.npm/_logs/2022-12-08T22_27_57_791Z-debug-0.log
------
failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1
</code>```

Backend Dockerfile

```<code>FROM node:16-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm i
COPY . .
RUN npm run build

FROM node:16-alpine AS production
WORKDIR /app
COPY --from=builder /app/package*.json ./
RUN npm i --omit=dev
COPY --from=builder /app/ecosystem.config.js ./
COPY --from=builder /app/dist ./dist
RUN npm install pm2 -g
EXPOSE 3000
CMD ["pm2-runtime", "start", "ecosystem.config.js"]
</code>```

docker-compose.yml

```<code>version: "3.2"
services:

  database:
    container_name: postgres
    image: "postgres:12"
    networks:
      - db
    ports:
      - "5432:5432"
    volumes:
      - volume:/var/lib/postgresql/data
    env_file: .env
    restart: unless-stopped

  backend:
    container_name: backend
    build: ./backend
    env_file: .env
    restart: "unless-stopped"
    ports:
      - "4000:3000"
    networks:
      - network
      - db
    links:
      - database
    depends_on:
      - database

  frontend:
    container_name: frontend
    build: ./frontend
    ports:
      - "8081:80"
    networks:
      - network
    restart: "unless-stopped"

volumes:
  volume:
    driver: local

networks:
  db:
    driver: bridge
    internal: true
  network:
    driver: bridge
</code>```

Body:
I have one project. And when i try it with "docker-compose up" command on my Windows-PC all is good! Docker do it perfectly without error.
But when i try this project on MacOS, i get error on "RUN npm i" step.
Why?
I get error on the end of error's message - failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1

Full error log:

> [111-backend builder 4/6] RUN npm i:
#0 4.159 npm WARN deprecated preview-email@3.0.5: Please upgrade to v3.0.7+ as we have added iOS Simulator support to previewing emails! See <https://github.com/forwardemail/preview-email/releases/tag/v3.0.6> and screenshots at <https://github.com/forwardemail/preview-email\#ios-simulator>.
#0 16.18 npm notice
#0 16.18 npm notice New major version of npm available! 8.19.2 -> 9.2.0
#0 16.18 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
#0 16.18 npm notice Run `npm install -g npm@9.2.0` to update!
#0 16.18 npm notice
#0 16.18 npm ERR! code 1
#0 16.18 npm ERR! path /app/node_modules/bcrypt
#0 16.18 npm ERR! command failed
#0 16.18 npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build
#0 16.18 npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 16.18 npm ERR! node-pre-gyp info it worked if it ends with ok
#0 16.18 npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
#0 16.18 npm ERR! node-pre-gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! node-pre-gyp info check checked for "/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
#0 16.18 npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.1 and node@16.18.1 (node-v93 ABI, musl) (falling back to source compile with node-gyp)
#0 16.18 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-arm64-musl.tar.gz
#0 16.18 npm ERR! gyp info it worked if it ends with ok
#0 16.18 npm ERR! gyp info using node-gyp@9.1.0
#0 16.18 npm ERR! gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! gyp info ok
#0 16.18 npm ERR! gyp info it worked if it ends with ok
#0 16.18 npm ERR! gyp info using node-gyp@9.1.0
#0 16.18 npm ERR! gyp info using node@16.18.1 | linux | arm64
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#0 16.18 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#0 16.18 npm ERR! gyp ERR! find Python checking if "python3" can be used
#0 16.18 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#0 16.18 npm ERR! gyp ERR! find Python checking if "python" can be used
#0 16.18 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! find Python **********************************************************
#0 16.18 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#0 16.18 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#0 16.18 npm ERR! gyp ERR! find Python you can try one of the following options:
#0 16.18 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#0 16.18 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#0 16.18 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#0 16.18 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#0 16.18 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#0 16.18 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#0 16.18 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#0 16.18 npm ERR! gyp ERR! find Python **********************************************************
#0 16.18 npm ERR! gyp ERR! find Python
#0 16.18 npm ERR! gyp ERR! configure error
#0 16.18 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
#0 16.18 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
#0 16.18 npm ERR! gyp ERR! stack     at exithandler (node:child_process:410:5)
#0 16.18 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:422:5)
#0 16.18 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#0 16.18 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
#0 16.18 npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:485:16)
#0 16.18 npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
#0 16.18 npm ERR! gyp ERR! System Linux 5.15.49-linuxkit
#0 16.18 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/app/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
#0 16.18 npm ERR! gyp ERR! cwd /app/node_modules/bcrypt
#0 16.18 npm ERR! gyp ERR! node -v v16.18.1
#0 16.18 npm ERR! gyp ERR! node-gyp -v v9.1.0
#0 16.18 npm ERR! gyp ERR! not ok
#0 16.18 npm ERR! node-pre-gyp ERR! build error
#0 16.18 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
#0 16.18 npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
#0 16.18 npm ERR! node-pre-gyp ERR! System Linux 5.15.49-linuxkit
#0 16.18 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
#0 16.18 npm ERR! node-pre-gyp ERR! cwd /app/node_modules/bcrypt
#0 16.18 npm ERR! node-pre-gyp ERR! node -v v16.18.1
#0 16.18 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
#0 16.18 npm ERR! node-pre-gyp ERR! not ok
#0 16.19
#0 16.19 npm ERR! A complete log of this run can be found in:
#0 16.19 npm ERR!     /root/.npm/_logs/2022-12-08T22_27_57_791Z-debug-0.log
------
failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1

Backend Dockerfile

FROM node:16-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm i
COPY . .
RUN npm run build

FROM node:16-alpine AS production
WORKDIR /app
COPY --from=builder /app/package*.json ./
RUN npm i --omit=dev
COPY --from=builder /app/ecosystem.config.js ./
COPY --from=builder /app/dist ./dist
RUN npm install pm2 -g
EXPOSE 3000
CMD ["pm2-runtime", "start", "ecosystem.config.js"]

docker-compose.yml

version: "3.2"
services:

  database:
    container_name: postgres
    image: "postgres:12"
    networks:
      - db
    ports:
      - "5432:5432"
    volumes:
      - volume:/var/lib/postgresql/data
    env_file: .env
    restart: unless-stopped

  backend:
    container_name: backend
    build: ./backend
    env_file: .env
    restart: "unless-stopped"
    ports:
      - "4000:3000"
    networks:
      - network
      - db
    links:
      - database
    depends_on:
      - database

  frontend:
    container_name: frontend
    build: ./frontend
    ports:
      - "8081:80"
    networks:
      - network
    restart: "unless-stopped"

volumes:
  volume:
    driver: local

networks:
  db:
    driver: bridge
    internal: true
  network:
    driver: bridge


问:
I'm trying to add and item to cart, and also delete it through the clear cart button
I'm trying to add an item to the cart, and also delete it through the clear cart button. I hope I have pasted the necessary code correctly. Had tried to work on it but after a few failing tests, reverted the code to the original. I'm still new to react I hope you understand.</p>
```<code>function Home() {
    const [data, setData] = useState([]);
    useEffect(() => {
      // auto-login
      fetch("/coffees").then((res) => {
        if (res.ok) {
          res.json().then((data) => setData(data))
        }
      });
    }, [])
    console.log(data)
    return (
    <>
    <div className="box">
        <div className="projo">
        <h2 >Welcome to Coffee-cafe</h2>
        </div>
            <div className="projects">
             {data.map((data) =>{
              return(
                <div className="card">
                    <img className="avatar" src={data.coffee_image} alt="coffee"></img>
                    <div className="card-content">
                        <h4><b>{data.coffee_name}</b></h4>
                        <p id="desc">{data.description}</p>
                        <p className="price">{data.price}</p>
                        {/* <p>{data.category}</p> */}
                        <button onClick={() => ({})} className="btn1" id="btn1">Add to Cart</button>
                    </div>
                </div>
                )
            })}
            </div>
    </div>

    </>

    )
}

export default Home;

function Checkout() {
    return (
        <>
         <div className="section">
       <div className="photo">
           <img className="dp" src={image1} alt="coffee"></img>
           <div className="info">
               <h3>Coffee:</h3>
               <p>Price:</p>
               <p>Category:</p>
               <div className="check-out-btn">
                   {/* <button className="add">AddToCart</button> */}
                   <button className="delete">ClearCart</button>
               </div>
           </div>
       </div>
   </div>
</code>```

Body:
I'm trying to add an item to the cart, and also delete it through the clear cart button. I hope I have pasted the necessary code correctly. Had tried to work on it but after a few failing tests, reverted the code to the original. I'm still new to react I hope you understand.

function Home() {
    const [data, setData] = useState([]);
    useEffect(() => {
      // auto-login
      fetch("/coffees").then((res) => {
        if (res.ok) {
          res.json().then((data) => setData(data))
        }
      });
    }, [])
    console.log(data)
    return (
    <>

Welcome to Coffee-cafe

             {data.map((data) =>{
              return(

{data.coffee_name}

{data.description}

{data.price}

                        {/*
{data.category}
 */}
                        <button onClick={() => ({})} className="btn1" id="btn1">Add to Cart</button>

                )
            })}

    </>

    )
}

export default Home;

function Checkout() {
    return (
        <>

Coffee:

Price:

Category:

                   {/* <button className="add">AddToCart</button> */}
                   <button className="delete">ClearCart</button>


问:
Nlog - Can I set an action when nlog is done writing to a file?
My current .net core nlog WebAPI config. I'm using:

```<code> <targets async="true">
</code>```

Asynchronous target wrapper allows the logger code to execute more
quickly, by queueing messages and processing them in a separate
thread.

https://github.com/nlog/NLog/wiki/AsyncWrapper-target#async-attribute-and-asyncwrapper

```<code><targets async="true">
    <target name="jsonfile" xsi:type="File" fileName="/MyAPI${date:format=yyyy-MM-dd HH-mm-ss}.json" >
      <layout xsi:type="JsonLayout">
        <attribute name="Date" layout="${date:format=O}" />
      </layout>
    </target>
  </targets>
</code>```

This creates files every second:
MyAPI_2022-12-08 23-06-28.json

How how can I let nlog do something (f.ex. change the name or move it to another folder) when nlog is done writing to the file? I have a system (Splunk Universal Forwarder) that picks up the logs and I don't want it to pick up the file while it's being written to.

Thanks! :-)

Body:
My current .net core nlog WebAPI config. I'm using:

 <targets async="true">

Asynchronous target wrapper allows the logger code to execute more
quickly, by queueing messages and processing them in a separate
thread.

https://github.com/nlog/NLog/wiki/AsyncWrapper-target#async-attribute-and-asyncwrapper

<targets async="true">
    <target name="jsonfile" xsi:type="File" fileName="/MyAPI${date:format=yyyy-MM-dd HH-mm-ss}.json" >
      <layout xsi:type="JsonLayout">
        <attribute name="Date" layout="${date:format=O}" />
      </layout>
    </target>
  </targets>

This creates files every second:
MyAPI_2022-12-08 23-06-28.json

How how can I let nlog do something (f.ex. change the name or move it to another folder) when nlog is done writing to the file? I have a system (Splunk Universal Forwarder) that picks up the logs and I don't want it to pick up the file while it's being written to.

Thanks! :-)


问:
com.android.builder.testing.api.DeviceException: No online devices found
```<code>* Get more help at https://help.gradle.org

BUILD FAILED in 4m 55s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 55s

    at makeError (C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\execa\index.js:174:9)
    at C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\@react-native-community\cli\build\index.js:142:9)
</code>```

I make update in environment but only no running the emulator.

I need only excecute the emulator for project reeact native

Body:
* Get more help at https://help.gradle.org

BUILD FAILED in 4m 55s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 55s

    at makeError (C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\execa\index.js:174:9)
    at C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\cjfra\Documents\GESTAOTECC\DevProjetos\videoapp\node_modules\@react-native-community\cli\build\index.js:142:9)

I make update in environment but only no running the emulator.

I need only excecute the emulator for project reeact native


问:
FME package: "Error in cov2cor(x$cov.unscaled) : 'V' is not a square numeric matrix" in fitting using modFit()
I'm trying to fit the differential equation using the least squares method (FME package).
However, I keep getting this error that I don't know how to tackle.

The reproducible example:

times = seq(0, 4, by = 0.5)
dat = data.frame(time = seq(1,4),
                 Tick = c(128, 52.5, 28, 121))
N = 10

tick.model <- function(time, y, params, ...) {    #here we begin a function with three arguments
  with(as.list(c(y, params)),{

    dTick <- (30 - s.t*Tick)*Tick*0.3*N - delta.t*Tick
    return(list(c(dTick)))
  })
}
y = c(Tick = 82.375)

cost1 <- function(p) {
  out <- ode(y, times, tick.model, p)
  modCost(out, dat, weight = "none")
}
params <- c(s.t=0.1, delta.t = 1)
fit = modFit(f = cost1, p = params, lower = rep(0,2),
             upper = c(10, 5))
summary(fit)
```
<p>The result comes out like this:</p>
<pre class="lang-r prettyprint-override"><code>Parameters:
         Estimate Std. Error t value Pr(>|t|)
s.t     0.3641876         NA      NA       NA
delta.t 0.0001417         NA      NA       NA

Residual standard error: 60.92 on 2 degrees of freedom
Error in cov2cor(x$cov.unscaled) : 'V' is not a square numeric matrix
In addition: Warning message:
In summary.modFit(fit) : Cannot estimate covariance; system is singular
</code>```

Also, the fitted model doesn't look nice
.

I have no idea what I could have done wrong.

Body:
I'm trying to fit the differential equation using the least squares method (FME package).
However, I keep getting this error that I don't know how to tackle.

The reproducible example:

times = seq(0, 4, by = 0.5)
dat = data.frame(time = seq(1,4),
                 Tick = c(128, 52.5, 28, 121))
N = 10

tick.model <- function(time, y, params, ...) {    #here we begin a function with three arguments
  with(as.list(c(y, params)),{

    dTick <- (30 - s.t*Tick)*Tick*0.3*N - delta.t*Tick
    return(list(c(dTick)))
  })
}
y = c(Tick = 82.375)

cost1 <- function(p) {
  out <- ode(y, times, tick.model, p)
  modCost(out, dat, weight = "none")
}
params <- c(s.t=0.1, delta.t = 1)
fit = modFit(f = cost1, p = params, lower = rep(0,2),
             upper = c(10, 5))
summary(fit)

The result comes out like this:

Parameters:
         Estimate Std. Error t value Pr(>|t|)
s.t     0.3641876         NA      NA       NA
delta.t 0.0001417         NA      NA       NA

Residual standard error: 60.92 on 2 degrees of freedom
Error in cov2cor(x$cov.unscaled) : 'V' is not a square numeric matrix
In addition: Warning message:
In summary.modFit(fit) : Cannot estimate covariance; system is singular

Also, the fitted model doesn't look nice
.

I have no idea what I could have done wrong.


问:
DBT incremental models - Is there a way to keep track of the "updated" timestamp?
Is there a way to create an incremental model with dbt and update the timestamp if a new row was added or an existing row was updated, but not if the row remains unchanged?

Have tried changing stategies, nothing avails.