问:
Using wiremock to proxy/record calls to AWS Cloudfront service
We have a container-based service running in AWS ECS with the front end hosted by AWS Cloudfront, and authorization handled by AWS Cognito. I'm trying to configure Wiremock to be a proxy for this service so I can record the calls and mappings to later use in unit tests for a client app I'm writing in python.

I'm running the Wiremock server in standalone mode, and have it proxying to calls to the url of our service. However, Cloudfront keeps returning either a 403-Bad Request error or 403-Forbidden error when I connect via Wiremock.

When I use curl, and pass all the correct headers (Content-Type: application/json, Authentication: Bearer ) it works just fine when I use https://myservice.example.com/api/foo.  But as soon as I swap out "myservice.example.com" for "localhost:8000", I get the Cloudfront generated errors.

I'm guessing I have some  mis-configuration where, despite passing the headers to Wiremock, I haven't properly told Wiremock to pass those headers on to "the service", which is really Cloudfront.

Not being a Java guy, I'm finding the Wiremock docs a little difficult to understand, and am trying to use the command-line arguments to configure Wiremock like this:

```<code>/usr/bin/java -jar \
  ./wiremock-jre8-standalone-2.35.0.jar \
  --port=8000 \
  --verbose \
  --root-dir=test_data/wiremock \
  --enable-browser-proxying \
  --preserve-host-header \
  --print-all-network-traffic \
  --record-mappings \
  --trust-proxy-target=https://myservice.example.com \
  --proxy-all=https://myservice.example.com

</code>```

Request:

```<code>$ curl -k -X GET -H "Content-Type: application/json" \
    -H "Authorization: Bearer ${JWT}" \
    http://127.0.0.1:8000/api/foo
</code>```

Response:

```<code><html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>CloudFront</center>
</body>
</html>
</code>```

When using exactly the same curl command, but changing the URL to point directly at my service instead of the proxy, I get the response I expected (hoped for?) through the proxy:

```<code>curl -k -X GET -H "Content-Type: application/json" \
    -H "Authorization: Bearer ${JWT}" \
    https://myservice.example.com/api/foo

[
  {
    "id": "09d91ea0-7cb0-4786-b3fc-145fc88a1a3b",
    "name": "foo",
    "created": "2022-06-09T02:32:11Z",
    "updated": "2022-06-09T20:08:43Z",
  },
  {
    "id": "fb2b6454-4336-421a-bc2f-f1d588a78d12",
    "name": "bar",
    "created": "2022-10-05T06:23:24Z",
    "updated": "2022-10-05T18:34:32Z",
 }
]
</code>```

Any help would be greatly appreciated.

Thanks.

Body:
We have a container-based service running in AWS ECS with the front end hosted by AWS Cloudfront, and authorization handled by AWS Cognito. I'm trying to configure Wiremock to be a proxy for this service so I can record the calls and mappings to later use in unit tests for a client app I'm writing in python.

I'm running the Wiremock server in standalone mode, and have it proxying to calls to the url of our service. However, Cloudfront keeps returning either a 403-Bad Request error or 403-Forbidden error when I connect via Wiremock.

When I use curl, and pass all the correct headers (Content-Type: application/json, Authentication: Bearer ) it works just fine when I use https://myservice.example.com/api/foo.  But as soon as I swap out "myservice.example.com" for "localhost:8000", I get the Cloudfront generated errors.

I'm guessing I have some  mis-configuration where, despite passing the headers to Wiremock, I haven't properly told Wiremock to pass those headers on to "the service", which is really Cloudfront.

Not being a Java guy, I'm finding the Wiremock docs a little difficult to understand, and am trying to use the command-line arguments to configure Wiremock like this:

/usr/bin/java -jar \
  ./wiremock-jre8-standalone-2.35.0.jar \
  --port=8000 \
  --verbose \
  --root-dir=test_data/wiremock \
  --enable-browser-proxying \
  --preserve-host-header \
  --print-all-network-traffic \
  --record-mappings \
  --trust-proxy-target=https://myservice.example.com \
  --proxy-all=https://myservice.example.com

Request:

$ curl -k -X GET -H "Content-Type: application/json" \
    -H "Authorization: Bearer ${JWT}" \
    http://127.0.0.1:8000/api/foo

Response:

<title>403 Forbidden</title>

403 Forbidden

CloudFront

When using exactly the same curl command, but changing the URL to point directly at my service instead of the proxy, I get the response I expected (hoped for?) through the proxy:

curl -k -X GET -H "Content-Type: application/json" \
    -H "Authorization: Bearer ${JWT}" \
    https://myservice.example.com/api/foo

[
  {
    "id": "09d91ea0-7cb0-4786-b3fc-145fc88a1a3b",
    "name": "foo",
    "created": "2022-06-09T02:32:11Z",
    "updated": "2022-06-09T20:08:43Z",
  },
  {
    "id": "fb2b6454-4336-421a-bc2f-f1d588a78d12",
    "name": "bar",
    "created": "2022-10-05T06:23:24Z",
    "updated": "2022-10-05T18:34:32Z",
 }
]

Any help would be greatly appreciated.

Thanks.


来源: stackexchange

问:
IPhone is not receiving silent push notifications via APNs properly
we are trying to implement silent push notifications in our react native app. Unfornately we get some strange trouble with iOS. After all we could find 3 cases, where push notifications arent received at our test iPhones properly.

We have also tested our new feature on Android but apparently these issues only occur on iOS. We found the same question on stackoverflow (iOS Silent Push Notification not delivered after device reboot) but the answers were not quite helpful.

In our first case we discovered that the delivery of Push Notifications to multiple iPhones doesnt seem reliable. We tested this problem with 2 phones (iOS 15 + iOS 16), where one of them doesnt receive messages correctly. On the one hand the messages were not displayed after starting our app and on the other hand the notifications didnt show up at all. We couldnt find any reasons for that and we are pretty sure that React Native is not the problem here. We could only find this strange log:

```<code>"com.apple.pushLaunch.de.example.app:37D069:[{name: ApplicationPolicy, policyWeight: 50.000,
response: {Decision: Absolutely Must Not Proceed, Score: 0.00,
Rationale: [{[pushDisallowed]: Required:0.00, Observed:1.00},]}}
{name: BootTimePolicy, policyWeight: 0.010, response:
{Decision: Must Not Proceed, Score: 0.00,
Rationale: [{[Minimum seconds after boot]: Required:120.00, Observed:68.56},]}}
{name: , policyWeight: 1.000, response: {Decision: Must Not Proceed, Score: 0.00,
Rationale: [{timeSinceThunderingHerdTriggerEvent < 300}]}}],
FinalDecision: Absolutely Must Not Proceed}"
</code>```

Our second problem occur when we send a push notification to an inactive phone. After sending the message and booting our phone, we are not able to receive the message at all except the user start the app. This problem always occur when the phone was off.

The third problem is quite similar to the second one. First we reboot our test device and send after that a push notification via APNS. The user will not receive any messages, if the app is not started. We could find this log:

```<code>"Daemon Canceling Activities: {(com.apple.pushLaunch.de.example.app:E7F648)}"

"CANCELED:com.apple.pushLaunch.de.example.app:E7F648 at priority 5 <private>!"

"com.apple.pushLaunch.de.example.app:71F21A:[
{name: ApplicationPolicy, policyWeight: 50.000, response:
{Decision: Absolutely Must Not Proceed, Score: 0.00,
Rationale: [{[pushDisallowed]: Required:0.00, Observed:1.00},]}}
{name: ThunderingHerdPolicy, policyWeight: 1.000, response:
{Decision: Must Not Proceed, Score: 0.00,
Rationale: [{timeSinceThunderingHerdTriggerEvent < 300}]}}],
FinalDecision: Absolutely Must Not Proceed}"
</code>```

Our payload has only the content-availability header set to true. There is no other header  specified in the payload. The response of the Apns is always 200.

All these problems seems to be an hotfix but we could not find any useful informations by apple. Any ideas would be very helpful.

For Android and iOS we use the react native libraries:

https://github.com/react-native-push-notification/ios

https://github.com/zo0r/react-native-push-notification

ContentLicense: CC BY-SA 4.0

Body:
we are trying to implement silent push notifications in our react native app. Unfornately we get some strange trouble with iOS. After all we could find 3 cases, where push notifications arent received at our test iPhones properly.

We have also tested our new feature on Android but apparently these issues only occur on iOS. We found the same question on stackoverflow (iOS Silent Push Notification not delivered after device reboot) but the answers were not quite helpful.

In our first case we discovered that the delivery of Push Notifications to multiple iPhones doesnt seem reliable. We tested this problem with 2 phones (iOS 15 + iOS 16), where one of them doesnt receive messages correctly. On the one hand the messages were not displayed after starting our app and on the other hand the notifications didnt show up at all. We couldnt find any reasons for that and we are pretty sure that React Native is not the problem here. We could only find this strange log:

"com.apple.pushLaunch.de.example.app:37D069:[{name: ApplicationPolicy, policyWeight: 50.000,
response: {Decision: Absolutely Must Not Proceed, Score: 0.00,
Rationale: [{[pushDisallowed]: Required:0.00, Observed:1.00},]}}
{name: BootTimePolicy, policyWeight: 0.010, response:
{Decision: Must Not Proceed, Score: 0.00,
Rationale: [{[Minimum seconds after boot]: Required:120.00, Observed:68.56},]}}
{name: , policyWeight: 1.000, response: {Decision: Must Not Proceed, Score: 0.00,
Rationale: [{timeSinceThunderingHerdTriggerEvent < 300}]}}],
FinalDecision: Absolutely Must Not Proceed}"

Our second problem occur when we send a push notification to an inactive phone. After sending the message and booting our phone, we are not able to receive the message at all except the user start the app. This problem always occur when the phone was off.

The third problem is quite similar to the second one. First we reboot our test device and send after that a push notification via APNS. The user will not receive any messages, if the app is not started. We could find this log:

"Daemon Canceling Activities: {(com.apple.pushLaunch.de.example.app:E7F648)}"

"CANCELED:com.apple.pushLaunch.de.example.app:E7F648 at priority 5 <private>!"

"com.apple.pushLaunch.de.example.app:71F21A:[
{name: ApplicationPolicy, policyWeight: 50.000, response:
{Decision: Absolutely Must Not Proceed, Score: 0.00,
Rationale: [{[pushDisallowed]: Required:0.00, Observed:1.00},]}}
{name: ThunderingHerdPolicy, policyWeight: 1.000, response:
{Decision: Must Not Proceed, Score: 0.00,
Rationale: [{timeSinceThunderingHerdTriggerEvent < 300}]}}],
FinalDecision: Absolutely Must Not Proceed}"

Our payload has only the content-availability header set to true. There is no other header  specified in the payload. The response of the Apns is always 200.

All these problems seems to be an hotfix but we could not find any useful informations by apple. Any ideas would be very helpful.

For Android and iOS we use the react native libraries:

https://github.com/react-native-push-notification/ios

https://github.com/zo0r/react-native-push-notification


问:
Update field number in ms access
I have a table called table books in Microsoft Access. In this table there is a field called availability which means the number of books up till now. My question is how to use update query to add number x to the value in field availability.

Update field in MS Access.

Title: Update field number in ms access


问:
Python napari align
I have my path code:

```<code>import napari
import glob
import skimage.io

# Get the list of all image files in the specified folder
folder_path = "/Users/zosia/Desktop/realingment/"
image_paths = glob.glob(folder_path + "/*.tiff")

# Load the images using skimage
images = [skimage.io.imread(f) for f in image_paths]

# Check the shapes of the images
for i, image in enumerate(images):
    print(f"Image {i+1} shape: {image.shape}")

# Create a napari viewer
viewer = napari.Viewer()

# Add the images as layers in the viewer
for i, image in enumerate(images):
    viewer.add_image(image, name=f"Image {i+1}")

# Set the first image as the reference image
reference_layer = viewer.layers[0]
reference_layer.reference_image = True

# Align all the layers to the reference layer
for layer in viewer.layers[1:]:
    layer.transform(reference_layer)

# Print the names of the layers
for i, layer in enumerate(viewer.layers):
    print(f"Layer {i+1} name: {layer.name}")
</code>```

These are the parameters of my images

```<code>Image 1 shape: (1080, 1080)
Image 2 shape: (1080, 1080)
Image 3 shape: (1080, 1080)
Image 4 shape: (1080, 1080)
Image 5 shape: (1080, 1080)
Image 6 shape: (1080, 1080)
Image 7 shape: (1080, 1080)
Image 8 shape: (1080, 1080)
Image 9 shape: (1080, 1080)
Image 10 shape: (1080, 1080)
Image 11 shape: (1080, 1080)
Image 12 shape: (1080, 1080)
Image 13 shape: (1080, 1080)
Image 14 shape: (1080, 1080)
Image 15 shape: (1080, 1080)
</code>```

I try align them all to first image  but i got error:

```<code>AttributeError                            Traceback (most recent call last)
Cell In [1], line 29
     27 # Align all the layers to the reference layer
     28 for layer in viewer.layers[1:]:
---> 29     layer.transform(reference_layer)
     31 # Print the names of the layers
     32 for i, layer in enumerate(viewer.layers):

AttributeError: 'Image' object has no attribute 'transform'
</code>```

I want all the other images to align to the first one. Maybe I should use a different function? I don't know how to fix the error, so I'm asking for help.

Title: Python napari align

Body:
I have my path code:

import napari
import glob
import skimage.io

# Get the list of all image files in the specified folder
folder_path = "/Users/zosia/Desktop/realingment/"
image_paths = glob.glob(folder_path + "/*.tiff")

# Load the images using skimage
images = [skimage.io.imread(f) for f in image_paths]

# Check the shapes of the images
for i, image in enumerate(images):
    print(f"Image {i+1} shape: {image.shape}")

# Create a napari viewer
viewer = napari.Viewer()

# Add the images as layers in the viewer
for i, image in enumerate(images):
    viewer.add_image(image, name=f"Image {i+1}")

# Set the first image as the reference image
reference_layer = viewer.layers[0]
reference_layer.reference_image = True

# Align all the layers to the reference layer
for layer in viewer.layers[1:]:
    layer.transform(reference_layer)

# Print the names of the layers
for i, layer in enumerate(viewer.layers):
    print(f"Layer {i+1} name: {layer.name}")

These are the parameters of my images

Image 1 shape: (1080, 1080)
Image 2 shape: (1080, 1080)
Image 3 shape: (1080, 1080)
Image 4 shape: (1080, 1080)
Image 5 shape: (1080, 1080)
Image 6 shape: (1080, 1080)
Image 7 shape: (1080, 1080)
Image 8 shape: (1080, 1080)
Image 9 shape: (1080, 1080)
Image 10 shape: (1080, 1080)
Image 11 shape: (1080, 1080)
Image 12 shape: (1080, 1080)
Image 13 shape: (1080, 1080)
Image 14 shape: (1080, 1080)
Image 15 shape: (1080, 1080)

I try align them all to first image  but i got error:

AttributeError                            Traceback (most recent call last)
Cell In [1], line 29
     27 # Align all the layers to the reference layer
     28 for layer in viewer.layers[1:]:
---> 29     layer.transform(reference_layer)
     31 # Print the names of the layers
     32 for i, layer in enumerate(viewer.layers):

AttributeError: 'Image' object has no attribute 'transform'

I want all the other images to align to the first one. Maybe I should use a different function? I don't know how to fix the error, so I'm asking for help.


问:
read_csv: Object "not found" when using specification functions
I'm only starting out with R. I wanted to import several .csv files, but while on it and fixing problems along the way, I encountered a new one, which I can not find a solution to. To read several .csv files and therefore used this code:

```<code>mctd_data <- list.files(path = "D:\\The\\filepath\\containing\\my\\data",
                        pattern = "*.csv", full.names = TRUE) %>%
  lapply(read_csv, locale=locale(encoding="latin1")) %>%
  bind_rows

mctd_data
</code>```

It was read and just told me to specify the columns because it couldn't discern the data types. Therefore I tried spec(mctd_data). However everytime I use the variable in this or another function, it cannot find the object:

Error in stopifnot(inherits(x, "tbl_df")) : object 'mctd_data' not found

I wasn't sure if it is a formal or a systematical error. I also tried to turn the code above, or the data respectively, into a dataframe, but it still couldn't find the object. Although I also don't know if I went about it the right way.
Can you tell me, what I'm overlooking, what I have to fix, or how I can efficiently import the data another way, so it can be found?

Body:
I'm only starting out with R. I wanted to import several .csv files, but while on it and fixing problems along the way, I encountered a new one, which I can not find a solution to. To read several .csv files and therefore used this code:

mctd_data <- list.files(path = "D:\\The\\filepath\\containing\\my\\data",
                        pattern = "*.csv", full.names = TRUE) %>%
  lapply(read_csv, locale=locale(encoding="latin1")) %>%
  bind_rows

mctd_data

It was read and just told me to specify the columns because it couldn't discern the data types. Therefore I tried spec(mctd_data). However everytime I use the variable in this or another function, it cannot find the object:

Error in stopifnot(inherits(x, "tbl_df")) : object 'mctd_data' not found

I wasn't sure if it is a formal or a systematical error. I also tried to turn the code above, or the data respectively, into a dataframe, but it still couldn't find the object. Although I also don't know if I went about it the right way.
Can you tell me, what I'm overlooking, what I have to fix, or how I can efficiently import the data another way, so it can be found?


问:
Add IP restricted firewall rule in Lightsail with terraform
I'm building infrastructure in Lightsail with Terraform. Is there a way to add a firewall rule allowing access to a port only from the IP of another instance I create? This is possible through the web UI, but so far I can only find the aws_lightsail_instance_public_ports resource, which does not accept an IP restriction list.


问:
How to organize the work of all components with socket.io?
I have multiple socket.io components but I can only connect to one. How to be able to control socket.io from any component? Is it possible to connect it in Vuex? Or is it better not to?</p>


问:
How to add List data to google sheets from flutter
[![This is the code for user data[![Code of google sheets[][2]][2]

I am creating car service management system android app. so the data need to insert to google sheets when the user signing out. but when the process completed, the google sheet row shows the last data of the list data. anyone please help me,,, bcz I need to deliver this app within 2 days


问:
groupby doesnt work with sum() onlu cumsum()
I'm trying to use grubby to do something similar to "SUMIF" but when I use "cumsum" it works normally but the "sum" appears as a result "NaN"

```<code>df1 = pd.read_excel(r'df directory')

df1['soma_lmg'] = df1.groupby('concat')['vl_is'].cumsum()[try with cumsum()]
</code>```

if i try "sum()" i gave error[try with sum()]

sum() and cumsum() but doestwork

i want this:

Body:
I'm trying to use grubby to do something similar to "SUMIF" but when I use "cumsum" it works normally but the "sum" appears as a result "NaN"

df1 = pd.read_excel(r'df directory')

df1['soma_lmg'] = df1.groupby('concat')['vl_is'].cumsum()[try with cumsum()]

if i try "sum()" i gave error[try with sum()]

sum() and cumsum() but doestwork

i want this:


问:
patchMapping partial modification with springboot
I am a beginner in springboot, I followed a tutorial but the person does not explain for patchmapping. I can't update the modified data. The only solution I found is to use if and else to see if the field is modified or not. Who could explain to me please.

userModel

```<code>public class User extends AbstractEntity{

    private String civility;

    private String lastname;

    private String firstname;

    @Column(unique = true)
    private String email;

    private String password;

    private String phone;

    private String birth_day;

}
</code>```

userDto

```<code>public class UserDto {

    private Integer id;
    private String civility;
    private String lastname;
    private String firstname;
    private String birth_day;
    private String email;
    private String password;
    private String phone;

    public static UserDto fromEntity(User user) {
        return UserDto.builder()
                .id(user.getId())
                .civility(user.getCivility())
                .lastname(user.getLastname())
                .firstname(user.getFirstname())
                .birth_day(user.getBirth_day())
                .email(user.getEmail())
                .password(user.getPassword())
                .phone(user.getPhone())
                .build();
    }

    public static User toEntity(UserDto user) {
        return User.builder()
                .id(user.getId())
                .civility(user.getCivility())
                .lastname(user.getLastname())
                .firstname(user.getFirstname())
                .birth_day(user.getBirth_day())
                .email(user.getEmail())
                .password(user.getPassword())
                .phone(user.getPhone())
                .build();
    }
}
</code>```

UserRepository

```<code>public interface UserRepository extends JpaRepository<User, Integer> {

    Optional<User> findByEmail(String email);
}
</code>```

userServiceImpl

```<code>public class UserServiceImpl implements UserService {

    private final UserRepository userRepository;

    @Override
    public Integer updateByid(Integer id, UserDto dto) {
        User user2 = userRepository.findById(id)
                .orElseThrow(()-> new EntityNotFoundException("Aucun utilisateur n'a été trouvé avec l'ID fourni :" + id));
        if (dto.getEmail() == null ) {
            user2.setEmail(user2.getEmail());
        } else {
            user2.setEmail(dto.getEmail());
        }
        user2.setPassword(dto.getPassword());
        userRepository.save(user2);
        return user2.getId();
    }
}
</code>```

userService

```<code>public interface UserService extends AbstractService<UserDto> {

}
</code>```

userController

```<code>public class UserController {

    private final UserService service;

    @PatchMapping("/update/{user-id}")
    public ResponseEntity<Integer> updateAccount(
            @PathVariable("user-id") Integer userId,
            @RequestBody UserDto user
    ) {
        System.out.println(user);
        return ResponseEntity.ok(service.updateByid(userId,user));
    }
}
</code>```

Body:
I am a beginner in springboot, I followed a tutorial but the person does not explain for patchmapping. I can't update the modified data. The only solution I found is to use if and else to see if the field is modified or not. Who could explain to me please.

userModel

public class User extends AbstractEntity{

    private String civility;

    private String lastname;

    private String firstname;

    @Column(unique = true)
    private String email;

    private String password;

    private String phone;

    private String birth_day;

}

userDto

public class UserDto {

    private Integer id;
    private String civility;
    private String lastname;
    private String firstname;
    private String birth_day;
    private String email;
    private String password;
    private String phone;

    public static UserDto fromEntity(User user) {
        return UserDto.builder()
                .id(user.getId())
                .civility(user.getCivility())
                .lastname(user.getLastname())
                .firstname(user.getFirstname())
                .birth_day(user.getBirth_day())
                .email(user.getEmail())
                .password(user.getPassword())
                .phone(user.getPhone())
                .build();
    }

    public static User toEntity(UserDto user) {
        return User.builder()
                .id(user.getId())
                .civility(user.getCivility())
                .lastname(user.getLastname())
                .firstname(user.getFirstname())
                .birth_day(user.getBirth_day())
                .email(user.getEmail())
                .password(user.getPassword())
                .phone(user.getPhone())
                .build();
    }
}

UserRepository

public interface UserRepository extends JpaRepository<User, Integer> {

    Optional<User> findByEmail(String email);
}

userServiceImpl

public class UserServiceImpl implements UserService {

    private final UserRepository userRepository;

    @Override
    public Integer updateByid(Integer id, UserDto dto) {
        User user2 = userRepository.findById(id)
                .orElseThrow(()-> new EntityNotFoundException("Aucun utilisateur n'a été trouvé avec l'ID fourni :" + id));
        if (dto.getEmail() == null ) {
            user2.setEmail(user2.getEmail());
        } else {
            user2.setEmail(dto.getEmail());
        }
        user2.setPassword(dto.getPassword());
        userRepository.save(user2);
        return user2.getId();
    }
}

userService

public interface UserService extends AbstractService<UserDto> {

}

userController

public class UserController {

    private final UserService service;

    @PatchMapping("/update/{user-id}")
    public ResponseEntity<Integer> updateAccount(
            @PathVariable("user-id") Integer userId,
            @RequestBody UserDto user
    ) {
        System.out.println(user);
        return ResponseEntity.ok(service.updateByid(userId,user));
    }
}


问:
Passing a date -d to sed command
I got a script looking like that :

```<code>function tvpsport(){
wget -qO- 'https://sport.tvp.pl/'|
     grep -i -B 9 'video_id'|
     grep 'title\|broadcast_start\|video'|
     sed -e 's/"//g' \
         -e 's/,$//g' \
         -e 's/\\u2013/-/g' \
         -e 's/\\u0105/ą/g' \
         -e 's/\\u0119/ę/g' \
         -e 's/\\u0142/ł/g' \
         -e 's/\\u00f3/ó/g' \
         -e 's/\\u015a/Ś/g' \
         -e 's/\\u017a/ź/g' \
         -e 's/\\u017c/ż/g' \
         -e 's/\\u0144/ń/g' \
         -e 's/title : //g' \
         -e "s/broadcast_start : /$(date -d) /g" \
         -e 's/video_id : /https:\/\/tvp.pl\/sess\/TVPlayer2\/embed.php?ID=/g'
}
</code>```

which gives output :

Title of transmission
date -d {time format}
a link to transmission

I want to express that format date to human readable (from eg. 161145246842 to dd/mm/YYYY)
and output like :

date (dd/mm/YYYY) title of transmission
a link to a transmission

I tried to covrt date on this line :

-e 's/broadcast_start : /date -d /g' \

but with no luck

Title: Passing a date -d to sed command

Body:
I got a script looking like that :

function tvpsport(){
wget -qO- 'https://sport.tvp.pl/'|
     grep -i -B 9 'video_id'|
     grep 'title\|broadcast_start\|video'|
     sed -e 's/"//g' \
         -e 's/,$//g' \
         -e 's/\\u2013/-/g' \
         -e 's/\\u0105/ą/g' \
         -e 's/\\u0119/ę/g' \
         -e 's/\\u0142/ł/g' \
         -e 's/\\u00f3/ó/g' \
         -e 's/\\u015a/Ś/g' \
         -e 's/\\u017a/ź/g' \
         -e 's/\\u017c/ż/g' \
         -e 's/\\u0144/ń/g' \
         -e 's/title : //g' \
         -e "s/broadcast_start : /$(date -d) /g" \
         -e 's/video_id : /https:\/\/tvp.pl\/sess\/TVPlayer2\/embed.php?ID=/g'
}

which gives output :

Title of transmission
date -d {time format}
a link to transmission

I want to express that format date to human readable (from eg. 161145246842 to dd/mm/YYYY)
and output like :

date (dd/mm/YYYY) title of transmission
a link to a transmission

I tried to covrt date on this line :

-e 's/broadcast_start : /date -d /g' \

but with no luck


问:
Background job creation failed: An item with the same key has already been added. Key: CurrentCulture
I'm using hangfire with SQLite and when I'm trying to create multiple jobs my application gives this error.

It even creates some jobs before giving the error.

```<code>Hangfire.BackgroundJobClientException: Background job creation failed. See inner exception for details.
---> System.ArgumentException: An item with the same key has already been added. Key: CurrentCulture
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](List`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Hangfire.Storage.SQLite.SQLiteMonitoringApi.<>c__DisplayClass25_0.<JobDetails>b__0(HangfireDbContext _)
   at Hangfire.Console.States.ConsoleApplyStateFilter.OnStateApplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
   at Hangfire.States.StateMachine.InvokeOnStateApplied(Tuple`2 x)
   at Hangfire.Profiling.ProfilerExtensions.InvokeAction[TInstance](InstanceAction`1 tuple)
   at Hangfire.Profiling.ProfilerExtensions.InvokeMeasured[TInstance](IProfiler profiler, TInstance instance, Action`1 action, String message)
   at Hangfire.States.StateMachine.ApplyState(ApplyStateContext initialContext)
   at Hangfire.Client.CoreBackgroundJobFactory.<>c__DisplayClass14_0.<Create>b__3(Int32 attempt)
   at Hangfire.Client.CoreBackgroundJobFactory.<>c__DisplayClass15_0.<RetryOnException>b__0(Int32 attempt)
   at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException[T](Int32& attemptsLeft, Func`2 action)
--- End of stack trace from previous location ---
   at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException[T](Int32& attemptsLeft, Func`2 action)
   at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException(Int32& attemptsLeft, Action`1 action)
   at Hangfire.Client.CoreBackgroundJobFactory.Create(CreateContext context)
   at Hangfire.Client.BackgroundJobFactory.<>c__DisplayClass12_0.<CreateWithFilters>b__0()
   at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func`1 continuation)
   at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func`1 continuation)
   at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func`1 continuation)
   at Hangfire.Client.BackgroundJobFactory.Create(CreateContext context)
   at Hangfire.BackgroundJobClient.Create(Job job, IState state)
   --- End of inner exception stack trace ---
   at Hangfire.BackgroundJobClient.Create(Job job, IState state)
   at Infrastructure.BackgroundJobs.HangfireService.Enqueue(Expression`1 methodCall) in C:\Users\6110183\source\repos\ThomsonReuters.HighQIntegration\Infrastructure\BackgroundJobs\HangfireService.cs:line 16
   at Infrastructure.Strategies.Implementations.TimesheetStrategy.RunAsync() in C:\Users\6110183\source\repos\ThomsonReuters.HighQIntegration\Infrastructure\Strategies\Implementations\TimesheetStrategy.cs:line 95
</code>```

Similar code that generates the error

```<code>int countTest = 1000;

for (int i = 0; i < countTest; i++)
{
   BackgroundJob.Enqueue(() => Console.WriteLine("Executing: " + i));
}
</code>```

Can help me?

Thanks

Body:
I'm using hangfire with SQLite and when I'm trying to create multiple jobs my application gives this error.

It even creates some jobs before giving the error.

Hangfire.BackgroundJobClientException: Background job creation failed. See inner exception for details.
---> System.ArgumentException: An item with the same key has already been added. Key: CurrentCulture
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](List`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Hangfire.Storage.SQLite.SQLiteMonitoringApi.<>c__DisplayClass25_0.<JobDetails>b__0(HangfireDbContext _)
   at Hangfire.Console.States.ConsoleApplyStateFilter.OnStateApplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
   at Hangfire.States.StateMachine.InvokeOnStateApplied(Tuple`2 x)
   at Hangfire.Profiling.ProfilerExtensions.InvokeAction[TInstance](InstanceAction`1 tuple)
   at Hangfire.Profiling.ProfilerExtensions.InvokeMeasured[TInstance](IProfiler profiler, TInstance instance, Action`1 action, String message)
   at Hangfire.States.StateMachine.ApplyState(ApplyStateContext initialContext)
   at Hangfire.Client.CoreBackgroundJobFactory.<>c__DisplayClass14_0.<Create>b__3(Int32 attempt)
   at Hangfire.Client.CoreBackgroundJobFactory.<>c__DisplayClass15_0.<RetryOnException>b__0(Int32 attempt)
   at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException[T](Int32& attemptsLeft, Func`2 action)
--- End of stack trace from previous location ---
   at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException[T](Int32& attemptsLeft, Func`2 action)
   at Hangfire.Client.CoreBackgroundJobFactory.RetryOnException(Int32& attemptsLeft, Action`1 action)
   at Hangfire.Client.CoreBackgroundJobFactory.Create(CreateContext context)
   at Hangfire.Client.BackgroundJobFactory.<>c__DisplayClass12_0.<CreateWithFilters>b__0()
   at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func`1 continuation)
   at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func`1 continuation)
   at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func`1 continuation)
   at Hangfire.Client.BackgroundJobFactory.Create(CreateContext context)
   at Hangfire.BackgroundJobClient.Create(Job job, IState state)
   --- End of inner exception stack trace ---
   at Hangfire.BackgroundJobClient.Create(Job job, IState state)
   at Infrastructure.BackgroundJobs.HangfireService.Enqueue(Expression`1 methodCall) in C:\Users\6110183\source\repos\ThomsonReuters.HighQIntegration\Infrastructure\BackgroundJobs\HangfireService.cs:line 16
   at Infrastructure.Strategies.Implementations.TimesheetStrategy.RunAsync() in C:\Users\6110183\source\repos\ThomsonReuters.HighQIntegration\Infrastructure\Strategies\Implementations\TimesheetStrategy.cs:line 95

Similar code that generates the error

int countTest = 1000;

for (int i = 0; i < countTest; i++)
{
   BackgroundJob.Enqueue(() => Console.WriteLine("Executing: " + i));
}

Can help me?

Thanks


问:
Hybris hotfolder import by FTP does not create cronjob
When I send file by FTP to hotfolder path directly, import cronjob cannot be created. It moves to the file to archive folder as it is successfully imported.
I can see it triggered CleanupTask without creating impex import cronjob.

```<code>Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed CustomHeaderInitTask.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=ja_JP,net=false]] in 4ms
Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed ImpexTransformerTask.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=en,net=false]] in 4ms
Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed HotFolderImpexRunnerTask$$EnhancerBySpringCGLIB$$af2492be.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=en,net=false]] in 0ms
Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed CleanupTask.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=en,net=false]] in 1ms
</code>```

But if I send file to FTP user's home folder and copy it via cp command to the hotfolder path, it imports successfully. It creates cronjob, I can see changes on backoffice.

What is difference between sending files directly to hotfolder path and copying them in the server by command? Also, I tried another environment, it works as expected even if I send it directly to the hotfolder path by FTP.

Body:
When I send file by FTP to hotfolder path directly, import cronjob cannot be created. It moves to the file to archive folder as it is successfully imported.
I can see it triggered CleanupTask without creating impex import cronjob.

Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed CustomHeaderInitTask.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=ja_JP,net=false]] in 4ms
Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed ImpexTransformerTask.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=en,net=false]] in 4ms
Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed HotFolderImpexRunnerTask$$EnhancerBySpringCGLIB$$af2492be.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=en,net=false]] in 0ms
Setting tenant <<master>> on the current thread Thread[task-scheduler-7,5,main]
Processed CleanupTask.execute [header=de.hybris.platform.acceleratorservices.dataimport.batch.BatchHeader@306f39fd[file=/app/hybris_commerce/hybris/data/acceleratorservices/import/master/apparel/product/processing/hotfolderFileName-jp-en-202212150552.csv,catalog=catalogName,language=en,net=false]] in 1ms

But if I send file to FTP user's home folder and copy it via cp command to the hotfolder path, it imports successfully. It creates cronjob, I can see changes on backoffice.

What is difference between sending files directly to hotfolder path and copying them in the server by command? Also, I tried another environment, it works as expected even if I send it directly to the hotfolder path by FTP.


问:
Error: 'The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.'
I'm asking this question again because existing solutions are not working in 2022.

Users give their package name in an input URL.

I have Oauth on my website.

I get auth token and refresh token from here and send a request to the following API.

```<code>GET https://www.googleapis.com/androidpublisher/v3/applications/your_package_name/reviews?
access_token=your_auth_token

</code>```

I get the following error

```<code>I get the project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.'
</code>```

Is this happening because I have not asked for any scope in Oauth?

Is there any way I can make getting reviews as simple as possible for users? Like after Oauth, users can immediately look at their ratings for this week.

I have switched on all these on play.google.com/console.

Body:
I'm asking this question again because existing solutions are not working in 2022.

Users give their package name in an input URL.

I have Oauth on my website.

I get auth token and refresh token from here and send a request to the following API.

GET https://www.googleapis.com/androidpublisher/v3/applications/your_package_name/reviews?
access_token=your_auth_token

I get the following error

I get the project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.'

Is this happening because I have not asked for any scope in Oauth?

Is there any way I can make getting reviews as simple as possible for users? Like after Oauth, users can immediately look at their ratings for this week.

I have switched on all these on play.google.com/console.


问:
Change point size dynamically
Is it possible to change the point style of a line chart dynamically?   Specifically, when clicking on the legend item.

For example, here the line width changes, but the points in the graph don't.

```<code>    legendItem.onclick = (e) => {
        chart._metasets[item.datasetIndex].dataset.options.borderWidth = 10;
        chart._metasets[item.datasetIndex].dataset.options.radius = 30;
        chart._metasets[item.datasetIndex].dataset.options.pointRadius = 30;
        chart.render();
    };
</code>```

Title: Change point size dynamically

Body:
Is it possible to change the point style of a line chart dynamically?   Specifically, when clicking on the legend item.

For example, here the line width changes, but the points in the graph don't.

    legendItem.onclick = (e) => {
        chart._metasets[item.datasetIndex].dataset.options.borderWidth = 10;
        chart._metasets[item.datasetIndex].dataset.options.radius = 30;
        chart._metasets[item.datasetIndex].dataset.options.pointRadius = 30;
        chart.render();
    };


问:
Pandas KeyError: 'cannot use a single bool to index into setitem' when trying to use .loc property
when I'm trying to call the following code i get the error KeyError: 'cannot use a single bool to index into setitem'.

Base.loc[ 'CDD1' in Base['col'], 'test'] = "abc"

When i change the code as shown below there are no errors, but unfortunetly, that's not the case, i need to slice the data frame to find all rows where the column 'col' contains the string 'CDD1'.

Base.loc[ Base['col'] == 'CDD1', 'test'] = "abc"


问:
Is there a way to optimize my code for faster performance
I've written an algorithm that checks if a number is prime or not. it works just fine but when the integer value gets close to 1 million it begins to slow and when it's exactly 1 million it gets stuck trying to determine if it's prime or not.

here's is what i've tried

```<code>def isPrime(n):

    c = []
    for i in range(1, n+1):
        if i % i == 0 and n % i == 0:
            c.append(i)
    if len(c) > 2 or len(c) == 1:
        return(0)
    return(1)
</code>```

https://pastebin.com/embed_js/CKC4sGFy

```<code>def factors(n):

    for i in range(1, n+1):
        if n % i == 0:
            if isPrime(i):
                print(i)
</code>```

here i wrote another algorithm for prime factors calling on the prime checker

https://pastebin.com/embed_js/VLUCSK3s

Body:
I've written an algorithm that checks if a number is prime or not. it works just fine but when the integer value gets close to 1 million it begins to slow and when it's exactly 1 million it gets stuck trying to determine if it's prime or not.

here's is what i've tried

def isPrime(n):

    c = []
    for i in range(1, n+1):
        if i % i == 0 and n % i == 0:
            c.append(i)
    if len(c) > 2 or len(c) == 1:
        return(0)
    return(1)

https://pastebin.com/embed_js/CKC4sGFy

def factors(n):

    for i in range(1, n+1):
        if n % i == 0:
            if isPrime(i):
                print(i)

here i wrote another algorithm for prime factors calling on the prime checker

https://pastebin.com/embed_js/VLUCSK3s


问:
How can I compile C# user code in a sandbox
If I have an app that allows users to enter C# code, how can I sandbox this code to block any malicious scripts?

In a very rudimentary example the app would be a textbox with a button that says "Compile". I then use the "codeDomProvider.CompileAssemblyFromSource" to compile and run the code.

I've seen the possibility of a AppDomain but that seems to be for external DLLs being referenced in, rather than code inside of an already complied and running app.

Is AppDomain the correct approach here so that when the "compile" button is pressed the usercode is ran in a sandbox?


问:
want to connect two devices through blue tooth only once
My question is that I want to connect two iphone's or ipod's through bluetooth and after that I can send sound files between two devices, my question is that once the two devies are connected successfully through bluetooth I can not want to connect more than one time through blue tooth</p>

ContentLicense: CC BY-SA 3.0


问:
Dialogflow integration with Android App UI
Just wondering if there is way to integrate Dialogflow responses with an Android app and control the app’s UI in response to the conversation.

Say the user is trying to do something in an mobile app and asks for help. So the app rather than talking the user through would actually demonstrate how to do it by controlling the app UI.

Could custom payload response be an option? Have not really tried Dialogflow yet just exploring at the moment. Would be good to hear from someone who tried something similar.


问:
Unittest python code coverage - google colab
On Google colab I have several test cases in python. This is my command to run test: unittest.main(argv=[''], verbosity=3, exit = False). How to view the code test coverage report?


问:
Why repaint doesn't call to paintComponent function?
this code is part of client. the part of getting information from the server is working, but it's not calling to repaint function (line 6).

```<code>public class Client extends JPanel implements Runnable{

public Client() throws IOException{
        f = new JFrame("Bad Ice Cream by - Rotem Hanoch");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(this.width,this.height);
        f.setResizable(false);
        f.setFocusable(false);
        f.setVisible(true);
        initBoard();
        f.add(this);
    }

    public void run(){
        while(true){
            try {
                Board.Type mat[][] = (Board.Type[][]) this.objectInputStream.readObject();
                updateBoard(mat);
                this.repaint();
            } catch (IOException ex) {} catch (ClassNotFoundException ex) {}
        }
    }

    public void paintComponent(Graphics g){
        System.out.println("hello");
    }
}
</code>```

I tried to figure out why it doesn't work because it doesn't recognize the function. I expect it to print me a message so I know it has reached the function.

Body:
this code is part of client. the part of getting information from the server is working, but it's not calling to repaint function (line 6).

public class Client extends JPanel implements Runnable{

public Client() throws IOException{
        f = new JFrame("Bad Ice Cream by - Rotem Hanoch");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(this.width,this.height);
        f.setResizable(false);
        f.setFocusable(false);
        f.setVisible(true);
        initBoard();
        f.add(this);
    }

    public void run(){
        while(true){
            try {
                Board.Type mat[][] = (Board.Type[][]) this.objectInputStream.readObject();
                updateBoard(mat);
                this.repaint();
            } catch (IOException ex) {} catch (ClassNotFoundException ex) {}
        }
    }

    public void paintComponent(Graphics g){
        System.out.println("hello");
    }
}

I tried to figure out why it doesn't work because it doesn't recognize the function. I expect it to print me a message so I know it has reached the function.


问:
Why does the same exact material-ui text field's height shrink in one spot and not another?
I am using the Material UI Text Field component as a search bar in my app. On one of the pages, I have it in 2 spots, one on the outside of the page, and another inside my DevExtreme Data Grid.

See here

For whatever reason, this shrinks the search bar, despite it being the exact same component being used in 2 spots.

My question is, what causes MUI to shrink the height of their text input field so that I can fix it accordingly inside of my data grid?

I've tried adjusting line-height, padding, margin's, etc all inside the data grid, unfortunately to no avail. The only thing I've noticed is that deep in the inspector tool, the shrunken search bar has a height of 1.435em, and checking that off will cause the search bar to correct itself to the standard height.


问:
AKS: Kubernetes Pod volume mounting failing even after PV is bound and attached to pod
I am trying to deploy pod with file mount to azure file share, it seems to bound just fine, but does not mount on the container - could i get some help to make it mount please

I create secret:

```<code>kubectl create secret generic azstorage-secret --from-literal=azurestorageaccountname=$AKS_PERS_STORAGE_ACCOUNT_NAME --from-literal=azurestorageaccountkey=$STORAGE_KEY -n large-agents
</code>```

my conatiners:

```<code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: linuxbuildagent-large
  namespace: agents-large
spec:
  replicas: 3
  serviceName: "azdevops-agent-sv"
  selector:
    matchLabels:
      app: azdevops-agent
  template:
    metadata:
      labels:
        app: azdevops-agent
    spec:
      containers:
        - name: selfhosted-agents
          ...
          volumeMounts:
          - name: azurefileshare
            mountPath: /angular-cache
          securityContext:
            privileged: true
      volumes:
      - name: azurefileshare
        persistentVolumeClaim:
          claimName: pvc-azurefile
</code>```

my persistent volume:

```<code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-azurefile
  namespace: agents-large
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain  # if set as "Delete" file share would be removed in pvc deletion
  storageClassName: azurefile-csi
  csi:
    driver: file.csi.azure.com
    readOnly: false
    volumeHandle: azureBuildClient  # make sure this volumeid is unique in the cluster
    volumeAttributes:
      storageAccount: EXISTING_STORAGE_ACCOUNT_NAME
      shareName: longtestshare
    nodeStageSecretRef:
      name: azstorage-secret
      namespace: agents-large
</code>```

my pv claim:

```<code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-azurefile
  namespace: agents-large
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: azurefile-csi
  volumeName: pv-azurefile
  resources:
    requests:
      storage: 10Gi
</code>```

pv bound in aks cluster:

pv claims bound in aks cluster:

Events in describe pod:

```<code>    node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
    Events:
      Type     Reason       Age                 From     Message
      ----     ------       ----                ----     -------
      Warning  FailedMount  38m (x19 over 88m)  kubelet  Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[docker-graph-storage azurefileshare kube-api-access-cx6tn]: timed out waiting for the condition
      Warning  FailedMount  24m (x6 over 66m)   kubelet  MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32
    Mounting command: mount
    Mounting arguments: -t cifs -o dir_mode=0777,actimeo=30,mfsymlinks,file_mode=0777,<masked> //crbbroakspersistentstg.file.core.windows.net/longtestshare /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount
    Output: mount error(2): No such file or directory
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
      Warning  FailedMount  20m (x5 over 86m)    kubelet  Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[azurefileshare kube-api-access-cx6tn docker-graph-storage]: timed out waiting for the condition
      Warning  FailedMount  5m3s (x31 over 90m)  kubelet  MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32
    Mounting command: mount
    Mounting arguments: -t cifs -o file_mode=0777,dir_mode=0777,actimeo=30,mfsymlinks,<masked> //crbbroakspersistentstg.file.core.windows.net/longtestshare /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount
    Output: mount error(2): No such file or directory
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
</code>```

kubectl get events in namespace:

```<code>28m         Warning   FailedMount   pod/linuxbuildagent-large-0   MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32...
2m46s       Warning   FailedMount   pod/linuxbuildagent-large-0   Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[docker-graph-storage azurefileshare kube-api-access-cx6tn]: timed out waiting for the condition
13m         Warning   FailedMount   pod/linuxbuildagent-large-0   MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32...
7m19s       Warning   FailedMount   pod/linuxbuildagent-large-0   Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[azurefileshare kube-api-access-cx6tn docker-graph-storage]: timed out waiting for the condition
</code>```

Body:
I am trying to deploy pod with file mount to azure file share, it seems to bound just fine, but does not mount on the container - could i get some help to make it mount please

I create secret:

kubectl create secret generic azstorage-secret --from-literal=azurestorageaccountname=$AKS_PERS_STORAGE_ACCOUNT_NAME --from-literal=azurestorageaccountkey=$STORAGE_KEY -n large-agents

my conatiners:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: linuxbuildagent-large
  namespace: agents-large
spec:
  replicas: 3
  serviceName: "azdevops-agent-sv"
  selector:
    matchLabels:
      app: azdevops-agent
  template:
    metadata:
      labels:
        app: azdevops-agent
    spec:
      containers:
        - name: selfhosted-agents
          ...
          volumeMounts:
          - name: azurefileshare
            mountPath: /angular-cache
          securityContext:
            privileged: true
      volumes:
      - name: azurefileshare
        persistentVolumeClaim:
          claimName: pvc-azurefile

my persistent volume:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-azurefile
  namespace: agents-large
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain  # if set as "Delete" file share would be removed in pvc deletion
  storageClassName: azurefile-csi
  csi:
    driver: file.csi.azure.com
    readOnly: false
    volumeHandle: azureBuildClient  # make sure this volumeid is unique in the cluster
    volumeAttributes:
      storageAccount: EXISTING_STORAGE_ACCOUNT_NAME
      shareName: longtestshare
    nodeStageSecretRef:
      name: azstorage-secret
      namespace: agents-large

my pv claim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-azurefile
  namespace: agents-large
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: azurefile-csi
  volumeName: pv-azurefile
  resources:
    requests:
      storage: 10Gi

pv bound in aks cluster:

pv claims bound in aks cluster:

Events in describe pod:

    node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
    Events:
      Type     Reason       Age                 From     Message
      ----     ------       ----                ----     -------
      Warning  FailedMount  38m (x19 over 88m)  kubelet  Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[docker-graph-storage azurefileshare kube-api-access-cx6tn]: timed out waiting for the condition
      Warning  FailedMount  24m (x6 over 66m)   kubelet  MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32
    Mounting command: mount
    Mounting arguments: -t cifs -o dir_mode=0777,actimeo=30,mfsymlinks,file_mode=0777,<masked> //crbbroakspersistentstg.file.core.windows.net/longtestshare /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount
    Output: mount error(2): No such file or directory
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
      Warning  FailedMount  20m (x5 over 86m)    kubelet  Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[azurefileshare kube-api-access-cx6tn docker-graph-storage]: timed out waiting for the condition
      Warning  FailedMount  5m3s (x31 over 90m)  kubelet  MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32
    Mounting command: mount
    Mounting arguments: -t cifs -o file_mode=0777,dir_mode=0777,actimeo=30,mfsymlinks,<masked> //crbbroakspersistentstg.file.core.windows.net/longtestshare /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount
    Output: mount error(2): No such file or directory
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

kubectl get events in namespace:

28m         Warning   FailedMount   pod/linuxbuildagent-large-0   MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32...
2m46s       Warning   FailedMount   pod/linuxbuildagent-large-0   Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[docker-graph-storage azurefileshare kube-api-access-cx6tn]: timed out waiting for the condition
13m         Warning   FailedMount   pod/linuxbuildagent-large-0   MountVolume.MountDevice failed for volume "pv-azurefile" : rpc error: code = Internal desc = volume(azureBuildClient) mount //crbbroakspersistentstg.file.core.windows.net/longtestshare on /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-azurefile/globalmount failed with mount failed: exit status 32...
7m19s       Warning   FailedMount   pod/linuxbuildagent-large-0   Unable to attach or mount volumes: unmounted volumes=[azurefileshare], unattached volumes=[azurefileshare kube-api-access-cx6tn docker-graph-storage]: timed out waiting for the condition


问:
Odoo 15.0 trying to override website_sale/view/template.xml
I have make a custom module and inherit the template i wanted and try to override the website_sale/view/template.xml inputs company_name and vat to be invincible but it don't override it it just add 2 fields more.

```<code><template id="address_b2b" inherit_id="website_sale.address_b2b">
    <xpath expr="//div[@id='div_phone']" position="replace">
        <div class="w-100"/>
        <t t-set='vat_warning' t-value="'vat' in checkout and checkout['vat'] and not can_edit_vat" />
        <t t-if="mode == ('new', 'billing') or (mode == ('edit', 'billing') and (can_edit_vat or 'vat' in checkout and checkout['vat']))">
            <div t-attf-class="form-group #{error.get('company_name') and 'o_has_error' or ''} col-lg-6 mb-0">
                <label class="col-form-label font-weight-normal label-optional" for="company_name">Company Name</label>
                <input type="text" name="company_name" t-attf-class="form-control #{error.get('company_name') and 'is-invalid' or ''}" t-att-value="'commercial_company_name' in checkout and checkout['commercial_company_name'] or 'company_name' in checkout and checkout['company_name']" t-att-readonly="'1' if vat_warning else None"/>
                <small t-if="vat_warning" class="form-text text-muted d-block d-lg-none">Changing company name is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.</small>
            </div>
            <div t-attf-class="form-group #{error.get('vat') and 'o_has_error' or ''} col-lg-6 div_vat mb-0">
                <label class="col-form-label font-weight-normal label-optional" for="vat">TIN / VAT </label>
                <input type="text" name="vat" t-attf-class="form-control #{error.get('vat') and 'is-invalid' or ''}" t-att-value="'vat' in checkout and checkout['vat']" t-att-readonly="'1' if vat_warning else None" />
                <small t-if="vat_warning" class="form-text text-muted d-block d-lg-none">Changing VAT number is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.</small>
            </div>
            <div t-if="vat_warning" class="col-12 d-none d-lg-block mb-1">
                <small class="form-text text-muted">Changing company name or VAT number is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.</small>
            </div>
        </t>
    </xpath>
</template>
</code>```

I try to remove two inputs company_name and vat i expected to override the 2 fields and make them invincible but he don't do that he just add 2 fields more at the template

Body:
I have make a custom module and inherit the template i wanted and try to override the website_sale/view/template.xml inputs company_name and vat to be invincible but it don't override it it just add 2 fields more.

<template id="address_b2b" inherit_id="website_sale.address_b2b">
    <xpath expr="//div[@id='div_phone']" position="replace">

        <t t-set='vat_warning' t-value="'vat' in checkout and checkout['vat'] and not can_edit_vat" />
        <t t-if="mode == ('new', 'billing') or (mode == ('edit', 'billing') and (can_edit_vat or 'vat' in checkout and checkout['vat']))">

                Company Name
                <input type="text" name="company_name" t-attf-class="form-control #{error.get('company_name') and 'is-invalid' or ''}" t-att-value="'commercial_company_name' in checkout and checkout['commercial_company_name'] or 'company_name' in checkout and checkout['company_name']" t-att-readonly="'1' if vat_warning else None"/>
                Changing company name is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.

                TIN / VAT
                <input type="text" name="vat" t-attf-class="form-control #{error.get('vat') and 'is-invalid' or ''}" t-att-value="'vat' in checkout and checkout['vat']" t-att-readonly="'1' if vat_warning else None" />
                Changing VAT number is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.

                Changing company name or VAT number is not allowed once document(s) have been issued for your account. Please contact us directly for this operation.

        </t>
    </xpath>
</template>

I try to remove two inputs company_name and vat i expected to override the 2 fields and make them invincible but he don't do that he just add 2 fields more at the template


问:
Go-Mongo One to Many Relationship
How to manage relationship in go-mongo?

I am trying as follows but not working:

type Post struct {
    ID         primitive.ObjectID `json:"id" bson:"_id"`
    Text       string             `json:"text" bson:"text,omitempty"`
    Comments   []Comment          `json:"comments" bson:"comment,omitempty"`
}

type Comment struct {
    ID         primitive.ObjectID `json:"id" bson:"_id"`
    Text       string             `json:"text" bson:"text,omitempty"`
    PostID     primitive.ObjectID `json:"postId" bson:"post_id,omitempty"`
}
```
<p>JSON Response output now has <code>null</code> comments:</p>
```{
    "id": "639c74bcb997f791b691bfa9",
    "text": "my post text here",
    "comments": null
}
```
<p>JSON expected output I want:</p>
```{
    "id": "639c74bcb997f791b691bfa9",
    "text": "my post text here",
    "comments": [
      {
        "id": "100c74bcb997f791b691bfa9",
        "text": "my comment text here"
      },
      {
        "id": "200c74bcb997f791b691bfa9",
        "text": "my comment text here"
      }
    ]
}
```

Title: Go-Mongo One to Many Relationship

Body:
How to manage relationship in go-mongo?

I am trying as follows but not working:

type Post struct {
    ID         primitive.ObjectID `json:"id" bson:"_id"`
    Text       string             `json:"text" bson:"text,omitempty"`
    Comments   []Comment          `json:"comments" bson:"comment,omitempty"`
}

type Comment struct {
    ID         primitive.ObjectID `json:"id" bson:"_id"`
    Text       string             `json:"text" bson:"text,omitempty"`
    PostID     primitive.ObjectID `json:"postId" bson:"post_id,omitempty"`
}

JSON Response output now has null comments:

{
    "id": "639c74bcb997f791b691bfa9",
    "text": "my post text here",
    "comments": null
}

JSON expected output I want:

{
    "id": "639c74bcb997f791b691bfa9",
    "text": "my post text here",
    "comments": [
      {
        "id": "100c74bcb997f791b691bfa9",
        "text": "my comment text here"
      },
      {
        "id": "200c74bcb997f791b691bfa9",
        "text": "my comment text here"
      }
    ]
}


问:
MSK Connector fails to be created
I am trying to create an MSK connector using kafka-connect-aws-s3-kafka-2-8-4.0.0.zip, but it is stuck in ** Creating...** status and it fails with an unknown error.
So a bit about my connector config:
I am trying to deploy this Connector in order to sink data from MSK to s3 ( kafka-connect-aws )

here are the connector properties:

```<code>connector.class=io.lenses.streamreactor.connect.aws.s3.sink.S3SinkConnector
behavior.on.null.values=ignore
s3.region=eu-central-1
flush.size=5
tasks.max=8
topics=MyTopic
s3.part.size=5242880
connect.s3.vhost.bucket=true
schema.enable=false
format.bytearray.separator=\n--==SEPARATOR==--\n
key.converter.schemas.enable=false
connect.s3.kcql=INSERT INTO kafka-connect-aws2:evelin-msk SELECT * FROM MyTopic WITH_FLUSH_INTERVAL = 300
format.class=io.confluent.connect.s3.format.bytearray.ByteArrayFormat
partitioner.class=io.confluent.connect.storage.partitioner.DefaultPartitioner
value.converter.schemas.enable=false
connect.s3.aws.region=eu-central-1
value.converter=org.apache.kafka.connect.converters.ByteArrayConverter
storage.class=io.confluent.connect.s3.storage.S3Storage
errors.log.enable=true
s3.bucket.name=kafka-connect-aws
</code>```

Any idea what could be the reason? Please let me know if I need to provide more information

Title: MSK Connector fails to be created

Body:
I am trying to create an MSK connector using kafka-connect-aws-s3-kafka-2-8-4.0.0.zip, but it is stuck in ** Creating...** status and it fails with an unknown error.
So a bit about my connector config:
I am trying to deploy this Connector in order to sink data from MSK to s3 ( kafka-connect-aws )

here are the connector properties:

connector.class=io.lenses.streamreactor.connect.aws.s3.sink.S3SinkConnector
behavior.on.null.values=ignore
s3.region=eu-central-1
flush.size=5
tasks.max=8
topics=MyTopic
s3.part.size=5242880
connect.s3.vhost.bucket=true
schema.enable=false
format.bytearray.separator=\n--==SEPARATOR==--\n
key.converter.schemas.enable=false
connect.s3.kcql=INSERT INTO kafka-connect-aws2:evelin-msk SELECT * FROM MyTopic WITH_FLUSH_INTERVAL = 300
format.class=io.confluent.connect.s3.format.bytearray.ByteArrayFormat
partitioner.class=io.confluent.connect.storage.partitioner.DefaultPartitioner
value.converter.schemas.enable=false
connect.s3.aws.region=eu-central-1
value.converter=org.apache.kafka.connect.converters.ByteArrayConverter
storage.class=io.confluent.connect.s3.storage.S3Storage
errors.log.enable=true
s3.bucket.name=kafka-connect-aws

Any idea what could be the reason? Please let me know if I need to provide more information


问:
Looping over QuickGrid-columns instead of hardcoding with Blazor
I have been using the QuickGrid build by the Blazor team (https://aspnet.github.io/quickgridsamples/). It is working, but I have many columns, so I am interested in figuring out whether I can loop over the <PropertyColumn>-components instead of hardcoding them.

My Component.razor component:

```<code><div class="scrollable" >
            <QuickGrid Items="MethodThatGetsIQueryableElements()">
                @foreach (var ColumnDTO in ColumnDTOs) {
                    if (ColumnDTO.Show)
                    {
                        if (ColumnDTO.Name == ComponentEnums.Department)
                        {
                            <PropertyColumn Property="@(v => v.Department)" Sortable="true" />
                        }
                        if (ColumnDTO.Name == ComponentEnums.Name)
                        {
                            <PropertyColumn Property="@(v => v.Name)" Sortable="true" />
                        }
                        [... Numerous other columns in same format...]
                    }
                }
            </QuickGrid>
</div>
</code>```

The initial conditional statement is connected with a checkbox, so basically checking/unchecking will show/hide the given column. My main difficulty is with the lambda expression for the Property-parameter. I can't seem to get it working with a foreach-loop.

The Items I am trying to loop through is a IQueryable<RowDTO> with the RowDTO just holding information on each row of data. The ColumnDTO holds the name of the column based on an enum-class (ComponentEnums) and the show/hide-boolean. Samples of the classes:

RowDTO.cs:

```<code>public class RowDTO
{
    public RowDTO(string department, string name, [....] )
    {
        Department = department;
        Name = name;
        [....]
    }
    public string Department { get; set; }
    public string Name { get; set; }
    [....]
}
</code>```

ColumnDTO.cs:

```<code>public class ColumnDTO
{
    public ColumnDTO(ComponentEnums name, bool show)
    {
        Name = name;
        Show = show;

    }
    public ComponentEnums Name { get; set; }
    public bool Show { get; set; } = true;
}

</code>```

Body:
I have been using the QuickGrid build by the Blazor team (https://aspnet.github.io/quickgridsamples/). It is working, but I have many columns, so I am interested in figuring out whether I can loop over the <PropertyColumn>-components instead of hardcoding them.

My Component.razor component:

            <QuickGrid Items="MethodThatGetsIQueryableElements()">
                @foreach (var ColumnDTO in ColumnDTOs) {
                    if (ColumnDTO.Show)
                    {
                        if (ColumnDTO.Name == ComponentEnums.Department)
                        {
                            <PropertyColumn Property="@(v => v.Department)" Sortable="true" />
                        }
                        if (ColumnDTO.Name == ComponentEnums.Name)
                        {
                            <PropertyColumn Property="@(v => v.Name)" Sortable="true" />
                        }
                        [... Numerous other columns in same format...]
                    }
                }
            </QuickGrid>

The initial conditional statement is connected with a checkbox, so basically checking/unchecking will show/hide the given column. My main difficulty is with the lambda expression for the Property-parameter. I can't seem to get it working with a foreach-loop.

The Items I am trying to loop through is a IQueryable<RowDTO> with the RowDTO just holding information on each row of data. The ColumnDTO holds the name of the column based on an enum-class (ComponentEnums) and the show/hide-boolean. Samples of the classes:

RowDTO.cs:

public class RowDTO
{
    public RowDTO(string department, string name, [....] )
    {
        Department = department;
        Name = name;
        [....]
    }
    public string Department { get; set; }
    public string Name { get; set; }
    [....]
}

ColumnDTO.cs:

public class ColumnDTO
{
    public ColumnDTO(ComponentEnums name, bool show)
    {
        Name = name;
        Show = show;

    }
    public ComponentEnums Name { get; set; }
    public bool Show { get; set; } = true;
}


问:
What should be the best practices to have multiple projects in single maven cucumber project?
I have more than four different projects going on and client need all these projects into one roof of pom.xml file. So, what should be the best practice should I opt and what should be the maven cucumber structure should for my project? All these projects are not inter-dependent.

I did not try because this is very new for me and I did not know about how should I go. How to create the hierarchy for the multiple independent project. Client will just execute all the feature files by testrunner testng.xml file.


问:
Find Duplicates, Update Records That Have NonMin with Min Value, Delete Non Min From Duplicate Sets
I am trying to build a stored procedure or just a query that will do several things.

Identify duplicate patients in the "patients" table that have the same client number, insured number, DOB, but different patient number.

Take the minimum patient value from each duplicate set (could be multiple of the same duplicate sets that exists in different client numbers)

Update the patient value in the "claims" and "claimsmaster" tables with min patient value where the non min patient value is present.

Finally delete all of the non min patient rows from the "patients" table.

I am working with Advantage Database that can use most sql syntax but not all.

Here is what I have, is there a better or easier way to do this? I don't think my statements will account for multiple duplicates that exist with different clients numbers.

```<code>CREATE PROCEDURE DupePatients( )
BEGIN

UPDATE claims
SET patientss = (SELECT distinct min(patientss)
                        FROM patients
                        WHERE clientnum = clientnum AND c.insuredss = cm.insuredss AND c.pdob = c.pdob
                        GROUP BY clientnum, insuredss, pdob);

UPDATE claimsmaster
SET patientss = (SELECT distinct min(patientss)
                        FROM patients
                        WHERE clientnum = clientnum AND insuredss = insuredss AND pdob = pdob
                        GROUP BY clientnum, insuredss, pdob);

/* Delete duplicate rows from the patients table,
     keeping only the row with the minimum patientss value. */

DELETE
  FROM patients
  WHERE patientss <> (SELECT distinct min(patientss)
                        FROM patients
                        WHERE clientnum = clientnum AND insuredss = insuredss AND pdob = pdob
                        GROUP BY clientnum, insuredss, pdob);

END;
</code>```

I tried this but it will not account for multiple duplicates that exist with different client numbers.

Body:
I am trying to build a stored procedure or just a query that will do several things.

Identify duplicate patients in the "patients" table that have the same client number, insured number, DOB, but different patient number.

Take the minimum patient value from each duplicate set (could be multiple of the same duplicate sets that exists in different client numbers)

Update the patient value in the "claims" and "claimsmaster" tables with min patient value where the non min patient value is present.

Finally delete all of the non min patient rows from the "patients" table.

I am working with Advantage Database that can use most sql syntax but not all.

Here is what I have, is there a better or easier way to do this? I don't think my statements will account for multiple duplicates that exist with different clients numbers.

CREATE PROCEDURE DupePatients( )
BEGIN

UPDATE claims
SET patientss = (SELECT distinct min(patientss)
                        FROM patients
                        WHERE clientnum = clientnum AND c.insuredss = cm.insuredss AND c.pdob = c.pdob
                        GROUP BY clientnum, insuredss, pdob);

UPDATE claimsmaster
SET patientss = (SELECT distinct min(patientss)
                        FROM patients
                        WHERE clientnum = clientnum AND insuredss = insuredss AND pdob = pdob
                        GROUP BY clientnum, insuredss, pdob);

/* Delete duplicate rows from the patients table,
     keeping only the row with the minimum patientss value. */

DELETE
  FROM patients
  WHERE patientss <> (SELECT distinct min(patientss)
                        FROM patients
                        WHERE clientnum = clientnum AND insuredss = insuredss AND pdob = pdob
                        GROUP BY clientnum, insuredss, pdob);

END;

I tried this but it will not account for multiple duplicates that exist with different client numbers.


问:
How to Save the Form Data With the user_id field to the Database with the JWT token in React?
I'm using Django, Django-Rest-Api, React, and Axios.

I trying to make the youtube clone web-app. So I made a create form with Title, Description, Video, and Image fields. And I need to add the user_id field.

It supposes to take the JWT token, and use it as an user_id in the user field.

JWT token of the glebapetenok@gmail.com user

This file is about video creation form.

```<code>// ...
// frontend/src/components/admin/create.js
import React, { useState } from 'react';
import axiosInstance from '../../axios';
import { useHistory } from 'react-router-dom';

export default function Create() {
    const history = useHistory();
    const initialFormData = Object.freeze({
        title: '',
        description: '',
    });

    const [videoData, updateFormData] = useState(initialFormData);
    const [videoimage, setVideoImage] = useState(null);
    const [videovideo, setVideoVideo] = useState(null);

    const handleChange = (e) => {
        if ([e.target.name] == 'image') {
            setVideoImage({
                image: e.target.files,
            });
            console.log(e.target.files);
        }
        if ([e.target.name] == 'video') {
            setVideoVideo({
                video: e.target.files,
            });
            console.log(e.target.files);
        }
        if ([e.target.name] == 'title') {
            updateFormData({
                ...videoData,
                [e.target.name]: e.target.value.trim(),
            });
        } else {
            updateFormData({
                ...videoData,
                [e.target.name]: e.target.value.trim(),
            });
        }
    };

    const handleSubmit = (e) => {
        const config = { headers: { 'Content-Type': 'multipart/form-data' } };
        const URL = 'http://127.0.0.1:8000/api/admin/create/';
        let formData = new FormData();
        formData.append('title', videoData.title);

        // default user_id seted to 1
        formData.append('user', 1);

        formData.append('description', videoData.description);
        formData.append('image', videoimage.image[0]);
        formData.append('video', videovideo.video[0]);
        axios
            .post(URL, formData, config)
            .then((res) => {
                console.log(res.data);
            })
            .catch((err) => console.log(err));
    };
</code>```

Here is the Api file with JWT settings in the frontend folder

```<code>// frontend/src/axios.js
import axios from 'axios';

const baseURL = 'http://127.0.0.1:8000/api/';

const axiosInstance = axios.create({
    baseURL: baseURL,
    timeout: 5000,
    headers: {
        Authorization: localStorage.getItem('access_token')
            ? 'JWT ' + localStorage.getItem('access_token')
            : null,
        'Content-Type': 'application/json',
        accept: 'application/json',
    },
});

axiosInstance.interceptors.response.use(
    (response) => {
        return response;
    },
    async function (error) {
        const originalRequest = error.config;

        if (typeof error.response === 'undefined') {
            alert(
                'A server/network error occurred. ' +
                    'Looks like CORS might be the problem. ' +
                    'Sorry about this - we will get it fixed shortly.'
            );
            return Promise.reject(error);
        }

        if (
            error.response.status === 401 &&
            originalRequest.url === baseURL + 'token/refresh/'
        ) {
            window.location.href = '/login/';
            return Promise.reject(error);
        }

        if (
            error.response.data.code === 'token_not_valid' &&
            error.response.status === 401 &&
            error.response.statusText === 'Unauthorized'
        ) {
            const refreshToken = localStorage.getItem('refresh_token');

            if (refreshToken) {
                const tokenParts = JSON.parse(atob(refreshToken.split('.')[1]));

                // exp date in token is expressed in seconds, while now() returns milliseconds:
                const now = Math.ceil(Date.now() / 1000);
                console.log(tokenParts.exp);

                if (tokenParts.exp > now) {
                    return axiosInstance
                        .post('/token/refresh/', {
                            refresh: refreshToken,
                        })
                        .then((response) => {
                            localStorage.setItem('access_token', response.data.access);
                            localStorage.setItem('refresh_token', response.data.refresh);

                            axiosInstance.defaults.headers['Authorization'] =
                                'JWT ' + response.data.access;
                            originalRequest.headers['Authorization'] =
                                'JWT ' + response.data.access;

                            return axiosInstance(originalRequest);
                        })
                        .catch((err) => {
                            console.log(err);
                        });
                } else {
                    console.log('Refresh token is expired', tokenParts.exp, now);
                    window.location.href = '/login/';
                }
            } else {
                console.log('Refresh token not available.');
                window.location.href = '/login/';
            }
        }

        // specific error handling done elsewhere
        return Promise.reject(error);
    }

);

export default axiosInstance;
</code>```

Body:
I'm using Django, Django-Rest-Api, React, and Axios.

I trying to make the youtube clone web-app. So I made a create form with Title, Description, Video, and Image fields. And I need to add the user_id field.

It supposes to take the JWT token, and use it as an user_id in the user field.

JWT token of the glebapetenok@gmail.com user

This file is about video creation form.

// ...
// frontend/src/components/admin/create.js
import React, { useState } from 'react';
import axiosInstance from '../../axios';
import { useHistory } from 'react-router-dom';

export default function Create() {
    const history = useHistory();
    const initialFormData = Object.freeze({
        title: '',
        description: '',
    });

    const [videoData, updateFormData] = useState(initialFormData);
    const [videoimage, setVideoImage] = useState(null);
    const [videovideo, setVideoVideo] = useState(null);

    const handleChange = (e) => {
        if ([e.target.name] == 'image') {
            setVideoImage({
                image: e.target.files,
            });
            console.log(e.target.files);
        }
        if ([e.target.name] == 'video') {
            setVideoVideo({
                video: e.target.files,
            });
            console.log(e.target.files);
        }
        if ([e.target.name] == 'title') {
            updateFormData({
                ...videoData,
                [e.target.name]: e.target.value.trim(),
            });
        } else {
            updateFormData({
                ...videoData,
                [e.target.name]: e.target.value.trim(),
            });
        }
    };

    const handleSubmit = (e) => {
        const config = { headers: { 'Content-Type': 'multipart/form-data' } };
        const URL = 'http://127.0.0.1:8000/api/admin/create/';
        let formData = new FormData();
        formData.append('title', videoData.title);

        // default user_id seted to 1
        formData.append('user', 1);

        formData.append('description', videoData.description);
        formData.append('image', videoimage.image[0]);
        formData.append('video', videovideo.video[0]);
        axios
            .post(URL, formData, config)
            .then((res) => {
                console.log(res.data);
            })
            .catch((err) => console.log(err));
    };

Here is the Api file with JWT settings in the frontend folder

// frontend/src/axios.js
import axios from 'axios';

const baseURL = 'http://127.0.0.1:8000/api/';

const axiosInstance = axios.create({
    baseURL: baseURL,
    timeout: 5000,
    headers: {
        Authorization: localStorage.getItem('access_token')
            ? 'JWT ' + localStorage.getItem('access_token')
            : null,
        'Content-Type': 'application/json',
        accept: 'application/json',
    },
});

axiosInstance.interceptors.response.use(
    (response) => {
        return response;
    },
    async function (error) {
        const originalRequest = error.config;

        if (typeof error.response === 'undefined') {
            alert(
                'A server/network error occurred. ' +
                    'Looks like CORS might be the problem. ' +
                    'Sorry about this - we will get it fixed shortly.'
            );
            return Promise.reject(error);
        }

        if (
            error.response.status === 401 &&
            originalRequest.url === baseURL + 'token/refresh/'
        ) {
            window.location.href = '/login/';
            return Promise.reject(error);
        }

        if (
            error.response.data.code === 'token_not_valid' &&
            error.response.status === 401 &&
            error.response.statusText === 'Unauthorized'
        ) {
            const refreshToken = localStorage.getItem('refresh_token');

            if (refreshToken) {
                const tokenParts = JSON.parse(atob(refreshToken.split('.')[1]));

                // exp date in token is expressed in seconds, while now() returns milliseconds:
                const now = Math.ceil(Date.now() / 1000);
                console.log(tokenParts.exp);

                if (tokenParts.exp > now) {
                    return axiosInstance
                        .post('/token/refresh/', {
                            refresh: refreshToken,
                        })
                        .then((response) => {
                            localStorage.setItem('access_token', response.data.access);
                            localStorage.setItem('refresh_token', response.data.refresh);

                            axiosInstance.defaults.headers['Authorization'] =
                                'JWT ' + response.data.access;
                            originalRequest.headers['Authorization'] =
                                'JWT ' + response.data.access;

                            return axiosInstance(originalRequest);
                        })
                        .catch((err) => {
                            console.log(err);
                        });
                } else {
                    console.log('Refresh token is expired', tokenParts.exp, now);
                    window.location.href = '/login/';
                }
            } else {
                console.log('Refresh token not available.');
                window.location.href = '/login/';
            }
        }

        // specific error handling done elsewhere
        return Promise.reject(error);
    }

);

export default axiosInstance;


问:
Connecting with teradatasql returns wrong non-latin characters
I'm trying to connect with teradata with code is as follows:

```<code>from sqlalchemy import create_engine

engine = create_engine(f'teradatasql://{HOST}/?logmech=KRB5')
with engine.connect() as conn:
    df = pd.read_sql(query, conn)
</code>```

This works, but data wth non-latin characters is transformed into wrong ones. For example
instead of Siemianowice Śląskie I get Siemianowice \x8cl¥skie.
I'm aware of the fact that I can't change charset with teradatasql, but its default is utf-8 which, if I recall correctly, should have no problem with this set of characters. What's going on here?

Body:
I'm trying to connect with teradata with code is as follows:

from sqlalchemy import create_engine

engine = create_engine(f'teradatasql://{HOST}/?logmech=KRB5')
with engine.connect() as conn:
    df = pd.read_sql(query, conn)

This works, but data wth non-latin characters is transformed into wrong ones. For example
instead of Siemianowice Śląskie I get Siemianowice \x8cl¥skie.
I'm aware of the fact that I can't change charset with teradatasql, but its default is utf-8 which, if I recall correctly, should have no problem with this set of characters. What's going on here?


问:
Chrome Extension: How to use an image in CSS
How do I use an image in CSS? I looked up older threads of StackOverflow and the official documentation but could not find anything to help me. Why is it so hard to use an image?

This is how I use the image in CSS:

    background-image: url('chrome-extension://gkiofiinipjoiemamkbdhonmljhagnce/images/arrows-up-blue.png');
```
<p>Directory structure:</p>
```coolextension:
---manifest.json
---images
------arrows-up-blue.png
...
```
<p>Manifest:</p>
<pre class="lang-json prettyprint-override"><code>{
    "manifest_version": 3,
    "name": "Reading time",
    "version": "1.0",
    "description": "Add the reading time to Chrome Extension documentation articles",
    "web_accessible_resources": [
        {
          "resources": ["images/arrows-up-blue.png"],
          "matches": ["https://www.cooldomain.de/*"]
        }
    ],
    "content_scripts": [
        {
          "css": ["styles/content.css"],
          "js": ["scripts/content.js"],
          "matches": [
            "https://www.cooldomain.de/*"
          ]
        }
    ]
}
</code>```

The error:

Can someone help me?

Body:
How do I use an image in CSS? I looked up older threads of StackOverflow and the official documentation but could not find anything to help me. Why is it so hard to use an image?

This is how I use the image in CSS:

    background-image: url('chrome-extension://gkiofiinipjoiemamkbdhonmljhagnce/images/arrows-up-blue.png');

Directory structure:

coolextension:
---manifest.json
---images
------arrows-up-blue.png
...

Manifest:

{
    "manifest_version": 3,
    "name": "Reading time",
    "version": "1.0",
    "description": "Add the reading time to Chrome Extension documentation articles",
    "web_accessible_resources": [
        {
          "resources": ["images/arrows-up-blue.png"],
          "matches": ["https://www.cooldomain.de/*"]
        }
    ],
    "content_scripts": [
        {
          "css": ["styles/content.css"],
          "js": ["scripts/content.js"],
          "matches": [
            "https://www.cooldomain.de/*"
          ]
        }
    ]
}

The error:

Can someone help me?


问:
Sharing of vector for AES encryption and decryption
We are using AES encryption to encrypt and decrypt data that is sent between browser and the server. AES encryption needs a secret key,which is hard coded and known by the client and the server.

Apart from the shared secret key, AES encryption also needs an initialisation vector( IV), which is unique and generated every time when a new request is sent either from the client or the server.

Is it ok for sharing this uniquely generated vector in every request in the http header between browser and server ? Are there any security risks in doing so?


问:
flutter: trying to send a file with an Arabic name to the api
I am trying to send a file with an Arabic name to the api, but it is saved in the api with an encrypted name, knowing that the problem is only with the Arabic names. I thought that the problem was with the api itself, but when I tested the api on the postman it was accepting files with Arabic names, the problem is in the code and I don’t know what is the problem. please help.


问:
Conflict but not interference in DBMS transaction schedule
Would something like

T1
T2

R(A)

W(A)

R(B)

W(B)

COMMIT

COMMIT

be considered a conflict that makes the schedule non-serializable, but not an interference?

I thought it might be inconsistent analysis, but to be so I think one transaction would have to do only the reading and the other would do the writing.


问:
Export/Import Printer .DRS file with PowerShell
I have 30+ Windows 2012 r2 servers, each with 30+ Zebra printers installed.
I want to be able to use PowerShell import (and export) the human readable .DRS files that can be generated with the print management UI in both the Preferences and Default locations.

I have seen lots of mentions of this: RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry for import/export settings, but the file is not particularly readable, does not conform with requirements to store .DRS files, and I can't seem to get it to import the settings anyway.

I have admin on these servers, I am open to using the reg. but my understanding is that Zebras do custom things in the Devmode key - so it is not just a simple reg dump and conversion

I can use Get-PrintConfiguration and Get-CimInstance but not seeing Darkness, Speed, etc. in these outputs

```<code>$printerName = "Zebra_1"
$compNameSource = $env:COMPUTERNAME
$Printer = Get-CimInstance -ClassName Win32_Printer -Filter "Name='$PrinterName'"
$somePrinterConfig = Get-PrintConfiguration -ComputerName $compNameSource  -PrinterName $printerName
$Printer.PSObject.Properties | ForEach-Object {
    $_.Name, $_.Value
}
$somePrinterConfig.PSObject.Properties | ForEach-Object {
    $_.Name, $_.Value
}
</code>```

output:

```<code>Name            : Caption
Value           : Zebra_1
CimType         : String
Flags           : Property, ReadOnly, NotModified
IsValueModified : False
Name            : Description
Value           :
CimType         : String
Flags           : Property, ReadOnly, NotModified, NullValue
....
</code>```

.DRS file:

```<code>[FileInfo]
Type=Driver Configuration File
Printer Type=201
[Barcodes]
BarcodeNum=6
[BARFONT0]
Name=EAN 13
UseHeight=1
JoinMode=2
StripTrailingSpaces=1
Kind=0
ID=1
Height=160
Expansion=1
Ratio=16908546
Flags=6164
…
[Parameters]
PaperSize=256
FormName=U
PageWidth=508
PageHeight=254
HDPI=300
VDPI=300
Orientation=3
Quantity=1
Cutter=0
BatchCut=0
Darkness=26
Speed=2
…
</code>```

Body:
I have 30+ Windows 2012 r2 servers, each with 30+ Zebra printers installed.
I want to be able to use PowerShell import (and export) the human readable .DRS files that can be generated with the print management UI in both the Preferences and Default locations.

I have seen lots of mentions of this: RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry for import/export settings, but the file is not particularly readable, does not conform with requirements to store .DRS files, and I can't seem to get it to import the settings anyway.

I have admin on these servers, I am open to using the reg. but my understanding is that Zebras do custom things in the Devmode key - so it is not just a simple reg dump and conversion

I can use Get-PrintConfiguration and Get-CimInstance but not seeing Darkness, Speed, etc. in these outputs

$printerName = "Zebra_1"
$compNameSource = $env:COMPUTERNAME
$Printer = Get-CimInstance -ClassName Win32_Printer -Filter "Name='$PrinterName'"
$somePrinterConfig = Get-PrintConfiguration -ComputerName $compNameSource  -PrinterName $printerName
$Printer.PSObject.Properties | ForEach-Object {
    $_.Name, $_.Value
}
$somePrinterConfig.PSObject.Properties | ForEach-Object {
    $_.Name, $_.Value
}

output:

Name            : Caption
Value           : Zebra_1
CimType         : String
Flags           : Property, ReadOnly, NotModified
IsValueModified : False
Name            : Description
Value           :
CimType         : String
Flags           : Property, ReadOnly, NotModified, NullValue
....

.DRS file:

[FileInfo]
Type=Driver Configuration File
Printer Type=201
[Barcodes]
BarcodeNum=6
[BARFONT0]
Name=EAN 13
UseHeight=1
JoinMode=2
StripTrailingSpaces=1
Kind=0
ID=1
Height=160
Expansion=1
Ratio=16908546
Flags=6164
…
[Parameters]
PaperSize=256
FormName=U
PageWidth=508
PageHeight=254
HDPI=300
VDPI=300
Orientation=3
Quantity=1
Cutter=0
BatchCut=0
Darkness=26
Speed=2
…