问:
XSL FO: margin-top not working with word if negative value is used
I am using marin-top to adjust space between elements.

I am using negative value for my case, and it works fine for PDF. But for word document, it has opposite impact. Space is getting big instead of shrinking.

```<code><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" font-weight="bold" text-align="right" margin-top="-1em">My Text</fo:block>
</code>```

Any way to get it working for word too?

Body:
I am using marin-top to adjust space between elements.

I am using negative value for my case, and it works fine for PDF. But for word document, it has opposite impact. Space is getting big instead of shrinking.

<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" font-weight="bold" text-align="right" margin-top="-1em">My Text</fo:block>

Any way to get it working for word too?


来源: stackexchange

问:
How can I jump to Photos app by a specific image's identifier on my App?
This question is similar to how can I show selected image in the Photos app.  I'm writing a photo gallery app that loads photos from Photos using PHImageManager.requestImage(), so for a specific low-quality image(usually CGSize(width: 256, height: 256)) shows on my App, I could get all the information of it's PHAsset, such as identifier.

From that question, I know it may not be possible to allow the user clicking the image to open Photos with the selected image.  Actually there is another way of using PHImageManager.requestImage() to fetch HQ images, such as:

photoCollection.requestImage(for: asset, targetSize: CGSize(width: 1024, height: 1024))
```

However, this will fetch the original image from iCloud, but my app is designed for No Network Needed.

The key point is to make the user can quickly find the original photo from the Photos, so maybe the underwriting solution is: to show the Date of that image on the screen, so the user can go back to Photos and locate that photo by date, anyone have a better solution?

ContentLicense: CC BY-SA 4.0

Body:
This question is similar to how can I show selected image in the Photos app.  I'm writing a photo gallery app that loads photos from Photos using PHImageManager.requestImage(), so for a specific low-quality image(usually CGSize(width: 256, height: 256)) shows on my App, I could get all the information of it's PHAsset, such as identifier.

From that question, I know it may not be possible to allow the user clicking the image to open Photos with the selected image.  Actually there is another way of using PHImageManager.requestImage() to fetch HQ images, such as:

photoCollection.requestImage(for: asset, targetSize: CGSize(width: 1024, height: 1024))

However, this will fetch the original image from iCloud, but my app is designed for No Network Needed.

The key point is to make the user can quickly find the original photo from the Photos, so maybe the underwriting solution is: to show the Date of that image on the screen, so the user can go back to Photos and locate that photo by date, anyone have a better solution?


问:
Can we get location validation when scan a gps qr code?
i have a question. I make a GenerateQR make by 2 input ( 2 data in the input ). I can use 1 input to make QRgenerate but with 2 input it not working.
Here's my code:

```<code>const wrapper = document.querySelector(".wrapper"),
qrInput1 = wrapper.querySelector(".form input1"),
qrInput2 = wrapper.querySelector(".form input2"),
generateBtn = wrapper.querySelector(".form button"),
qrImg = wrapper.querySelector(".qr-code img");
let preValue;
generateBtn.addEventListener("click", () => {
    let qrValue1 = qrInput1.value.trim();
    let qrValue2 = qrInput2.value.trim();
    if(!qrValue1 && qrInput2 || preValue === qrValue1 && preValue === qrValue2) return;
    preValue1 = qrValue1;
    preValue2 = qrValue2;
    generateBtn.innerText = "Generating QR Code...";
    qrImg.src = `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${qrValue}`;
    qrImg.addEventListener("load", () => {
        wrapper.classList.add("active");
        generateBtn.innerText = "Generate QR Code";
    });
});
qrInput1.addEventListener("keyup", () => {
    if(!qrInput1.value.trim()) {
        wrapper.classList.remove("active");
        preValue1 = "";
    }
});
qrInput2.addEventListener("keyup", () => {
    if(!qrInput2.value.trim()) {
        wrapper.classList.remove("active");
        preValue2 = "";
    }
});
</code>```

about JS file, i using qrInput1 and qrInput2 but it seems not working after all. so anyone know the solution for my problem

Body:
i have a question. I make a GenerateQR make by 2 input ( 2 data in the input ). I can use 1 input to make QRgenerate but with 2 input it not working.
Here's my code:

const wrapper = document.querySelector(".wrapper"),
qrInput1 = wrapper.querySelector(".form input1"),
qrInput2 = wrapper.querySelector(".form input2"),
generateBtn = wrapper.querySelector(".form button"),
qrImg = wrapper.querySelector(".qr-code img");
let preValue;
generateBtn.addEventListener("click", () => {
    let qrValue1 = qrInput1.value.trim();
    let qrValue2 = qrInput2.value.trim();
    if(!qrValue1 && qrInput2 || preValue === qrValue1 && preValue === qrValue2) return;
    preValue1 = qrValue1;
    preValue2 = qrValue2;
    generateBtn.innerText = "Generating QR Code...";
    qrImg.src = `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${qrValue}`;
    qrImg.addEventListener("load", () => {
        wrapper.classList.add("active");
        generateBtn.innerText = "Generate QR Code";
    });
});
qrInput1.addEventListener("keyup", () => {
    if(!qrInput1.value.trim()) {
        wrapper.classList.remove("active");
        preValue1 = "";
    }
});
qrInput2.addEventListener("keyup", () => {
    if(!qrInput2.value.trim()) {
        wrapper.classList.remove("active");
        preValue2 = "";
    }
});

about JS file, i using qrInput1 and qrInput2 but it seems not working after all. so anyone know the solution for my problem


问:
jQuery: don't collapse element if hasClass show + transition
I am trying to figure out, how to prevent element collapsing and opening again if it is already open. There are multiple collapse elements and I want one to be always open. When collapsed element is clicked, one that is showing collapses and other opens up.

Here is my script to handle the collapse:

```<code>$('.li').click(function() {
    var current = $(this).find('collapse');
    if(!(current).hasClass('show')) {
        $('.collapse').removeClass('show');
        current.addClass(show);
    };
});
</code>```

It works fine when clicking collapsed element, but when the clicked element is showing, it collapses and shows up again. How to prevent this? I assume I am not very far from the solution, but I cannot figure it out.

EDIT:

here is a fiddle for the case:

https://jsfiddle.net/gc7ejfps/1/

I got edited the script a bit for the case, but now it works as it should. Now my question is, how to add transition to this? I tried with an example from bootstrap collapse (Customizing the collapse transition in bootstrap 4), but didn't get it to work.

Body:
I am trying to figure out, how to prevent element collapsing and opening again if it is already open. There are multiple collapse elements and I want one to be always open. When collapsed element is clicked, one that is showing collapses and other opens up.

Here is my script to handle the collapse:

$('.li').click(function() {
    var current = $(this).find('collapse');
    if(!(current).hasClass('show')) {
        $('.collapse').removeClass('show');
        current.addClass(show);
    };
});

It works fine when clicking collapsed element, but when the clicked element is showing, it collapses and shows up again. How to prevent this? I assume I am not very far from the solution, but I cannot figure it out.

EDIT:

here is a fiddle for the case:

https://jsfiddle.net/gc7ejfps/1/

I got edited the script a bit for the case, but now it works as it should. Now my question is, how to add transition to this? I tried with an example from bootstrap collapse (Customizing the collapse transition in bootstrap 4), but didn't get it to work.


问:
How to expand an input area height for the Editor cotnrol
When the number of lines reaches some limit, Editor starts scrolling its text, even if the Editor's HorisontalOptions is set to FillEndExpand.

I would like to expand input area along the entire Editor height.

My MainPage.xaml has this:

```<code><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp1.MainPage">
    <Grid>

        <Editor HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"/>

    </Grid>

</ContentPage>
</code>```

Body:
When the number of lines reaches some limit, Editor starts scrolling its text, even if the Editor's HorisontalOptions is set to FillEndExpand.

I would like to expand input area along the entire Editor height.

My MainPage.xaml has this:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp1.MainPage">
    <Grid>

        <Editor HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"/>

    </Grid>

</ContentPage>


问:
React Native notification android come as silent push not as normal push
I am integrate push notification in my react native application with firebase and refer this document
https://rnfirebase.io/messaging/usage

So I did code as below

```<code>import messaging from '@react-native-firebase/messaging';
import * as globals from '../constants/common';

export const requestUserPermission = async () => {
  const authStatus = await messaging().requestPermission();
  const enabled =
     authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
     authStatus === messaging.AuthorizationStatus.PROVISIONAL;

    if (enabled) {
       console.log('Authorization status:', authStatus);
       getFcmToken();
     }
   }

   const getFcmToken = async () => {
   let token = await messaging().getToken();
   globals.FCMTOKEN = token;
   console.log("Fcm Token ==>> ", token);
   };

   export const notificationListener = () => {
      messaging().onNotificationOpenedApp(remoteMessage => {
      console.log('Notification Cause', remoteMessage.notification);
    });
    messaging().getInitialNotification()
     .then(remoteMessage => {
       if (remoteMessage) {
           console.log('Notification caused app to open from quit state:',
                   remoteMessage.notification,);
         }
       });
      }
</code>```

When i run above code in Android it is comming as silent push refer my attackment

Any idea how can i solve this?

Body:
I am integrate push notification in my react native application with firebase and refer this document
https://rnfirebase.io/messaging/usage

So I did code as below

import messaging from '@react-native-firebase/messaging';
import * as globals from '../constants/common';

export const requestUserPermission = async () => {
  const authStatus = await messaging().requestPermission();
  const enabled =
     authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
     authStatus === messaging.AuthorizationStatus.PROVISIONAL;

    if (enabled) {
       console.log('Authorization status:', authStatus);
       getFcmToken();
     }
   }

   const getFcmToken = async () => {
   let token = await messaging().getToken();
   globals.FCMTOKEN = token;
   console.log("Fcm Token ==>> ", token);
   };

   export const notificationListener = () => {
      messaging().onNotificationOpenedApp(remoteMessage => {
      console.log('Notification Cause', remoteMessage.notification);
    });
    messaging().getInitialNotification()
     .then(remoteMessage => {
       if (remoteMessage) {
           console.log('Notification caused app to open from quit state:',
                   remoteMessage.notification,);
         }
       });
      }

When i run above code in Android it is comming as silent push refer my attackment

Any idea how can i solve this?


问:
How to stop/kill command task in my jobs which running continuously in IICS
Command task is running continuously if i stopped Task flow manually in My jobs. How to stop this command task. Also, if I run new task flow with command task, the status is showing queued unable to stop these command task.

I have stopped Main task flow, but still command task is running. I want to stop these command task due to this other command tasks are not running the status is showing queued or running for all time.


问:
TypeError: Cannot read properties of undefined (reading 'GUILD_MESSAGES') when using Discord.js Intents
I'm trying to run a Discord bot using the discord.js library, but I'm getting the following error: TypeError: Cannot read properties of undefined (reading 'GUILD_MESSAGES'). I have installed the latest version of the discord.js library and enabled the relevant intents in the Discord Developer Portal, but the error persists. Here is my code:</p>
```<code>const Discord = require('discord.js');

// Specify which intents the client should have access to
const intents = new Discord.Intents([
    Discord.Intents.GUILD_MESSAGES,
    Discord.Intents.DIRECT_MESSAGES
]);

// Pass the intents array as an option when creating the Client object
const client = new Discord.Client({ intents: Discord.Intents.ALL });

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', message => {
    if (message.content === '!ping') {
        // Get a list of all guild channels
        const channels = message.guild.channels.cache;
        // Select a random channel from the list
        const channel = channels.random();
        // Get a list of all members in the channel
        const members = channel.members.array();
        // Select a random member from the list
        const member = members[Math.floor(Math.random() * members.length)];
        // Send a message to the channel mentioning the random member
        channel.send(`${member}, you have been pinged!`)
</code>```

Body:
I'm trying to run a Discord bot using the discord.js library, but I'm getting the following error: TypeError: Cannot read properties of undefined (reading 'GUILD_MESSAGES'). I have installed the latest version of the discord.js library and enabled the relevant intents in the Discord Developer Portal, but the error persists. Here is my code:

const Discord = require('discord.js');

// Specify which intents the client should have access to
const intents = new Discord.Intents([
    Discord.Intents.GUILD_MESSAGES,
    Discord.Intents.DIRECT_MESSAGES
]);

// Pass the intents array as an option when creating the Client object
const client = new Discord.Client({ intents: Discord.Intents.ALL });

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', message => {
    if (message.content === '!ping') {
        // Get a list of all guild channels
        const channels = message.guild.channels.cache;
        // Select a random channel from the list
        const channel = channels.random();
        // Get a list of all members in the channel
        const members = channel.members.array();
        // Select a random member from the list
        const member = members[Math.floor(Math.random() * members.length)];
        // Send a message to the channel mentioning the random member
        channel.send(`${member}, you have been pinged!`)


问:
is it possible to add rank with pagination in mongodb query?
```<code>db.user_stats.aggregate([{"$match":{"company_id":5}},{"$group":{"_id":"$item_id","review_count":{"$sum":"$review_count"},"avg_rating":{"$avg":"$avg_rating"},"item_id":{"$first":"$item_id"},"item_type":{"$first":"$item_type"},"company_id":{"$first":"$company_id"},"object_id":{"$first":"$_id"}}},{"$skip":0},{"$limit":20},{"$sort":{"review_count":1}}])
</code>```

And the data is stored below

```<code>{
  "_id": {
    "$oid": "639c7103e687877baf0b2f57"
  },
  "review_count": 1,
  "avg_rating": 4,
  "item_id": 2,
  "item_type": "user",
  "company_id": 5,
  "created_date": "2022-12-16 11:47:01"
},
{
  "_id": {
    "$oid": "639c7103e687877baf0b2f57"
  },
  "review_count": 10,
  "avg_rating": 4,
  "item_id": 2,
  "item_type": "user",
  "company_id": 5,
  "created_date": "2022-12-16 11:47:01"
}
</code>```

The Sorting and pagination are working correctly but we need to show the rank for every record with pagination.

The expected output

```<code>"items": {
            "totalCount": 2,
            "current": 1,
            "totalPages": 1,
            "data": [
                {
                    "id": "639c7103e687877baf0b2f57",
                    "item_id": 2,
                    "item_type": "team",
                    "item_title": "Team1",
                    "item_rank": 2
                },
                {
                    "id": "639c7103e687877baf0b2f51",
                    "item_id": 23,
                    "item_type": "team",
                    "item_rank": 2
                }
            ]
        }
</code>```

The item_rank is based on the review_count.

Body:
db.user_stats.aggregate([{"$match":{"company_id":5}},{"$group":{"_id":"$item_id","review_count":{"$sum":"$review_count"},"avg_rating":{"$avg":"$avg_rating"},"item_id":{"$first":"$item_id"},"item_type":{"$first":"$item_type"},"company_id":{"$first":"$company_id"},"object_id":{"$first":"$_id"}}},{"$skip":0},{"$limit":20},{"$sort":{"review_count":1}}])

And the data is stored below

{
  "_id": {
    "$oid": "639c7103e687877baf0b2f57"
  },
  "review_count": 1,
  "avg_rating": 4,
  "item_id": 2,
  "item_type": "user",
  "company_id": 5,
  "created_date": "2022-12-16 11:47:01"
},
{
  "_id": {
    "$oid": "639c7103e687877baf0b2f57"
  },
  "review_count": 10,
  "avg_rating": 4,
  "item_id": 2,
  "item_type": "user",
  "company_id": 5,
  "created_date": "2022-12-16 11:47:01"
}

The Sorting and pagination are working correctly but we need to show the rank for every record with pagination.

The expected output

"items": {
            "totalCount": 2,
            "current": 1,
            "totalPages": 1,
            "data": [
                {
                    "id": "639c7103e687877baf0b2f57",
                    "item_id": 2,
                    "item_type": "team",
                    "item_title": "Team1",
                    "item_rank": 2
                },
                {
                    "id": "639c7103e687877baf0b2f51",
                    "item_id": 23,
                    "item_type": "team",
                    "item_rank": 2
                }
            ]
        }

The item_rank is based on the review_count.


问:
Which is the suggested way to Localize self-defined View type in SwiftUI?
Take the following as an example:

struct CardView: View {
    var name: String
    ...
    var body: some View {
        ....
    }

    init(...) {
        ...
    }
}
```
<p>How to implement Localization on this???</p>
<p>So, from the following choices, which should I choose:</p>
<ol>
<li>inside <code>init</code>:</li>
</ol>
<pre class="lang-swift prettyprint-override"><code>init(name: String) {
    self.name = NSLocalizedString(name, comment="")
}
</code>```

make name a LocalizedStringKey, and force every string type to convert

when calling init, use NSLocalizedString every time

???

I haven't found any relevant info on Apple's website, can someone provide more details or vote on this ???

Body:
Take the following as an example:

struct CardView: View {
    var name: String
    ...
    var body: some View {
        ....
    }

    init(...) {
        ...
    }
}

How to implement Localization on this???

So, from the following choices, which should I choose:

inside init:

init(name: String) {
    self.name = NSLocalizedString(name, comment="")
}

make name a LocalizedStringKey, and force every string type to convert

when calling init, use NSLocalizedString every time

???

I haven't found any relevant info on Apple's website, can someone provide more details or vote on this ???


问:
Auth:api middleware not working for Laravel broadcasting routes
Hi I am using laravel passport to protect my api routes. I am using Beyondcode's laravel websockets package for my socket server.
My goal is to access my broadcasting routes for broadcasting only on a token bases.

Here is my BroadcastServiceProvider

```<code><?php

namespace App\Providers;

use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;

class BroadcastServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //Broadcast::routes();
        Broadcast::routes(["middleware" => "auth:api"]);
        require base_path('routes/channels.php');
    }
}
</code>```

Body:
Hi I am using laravel passport to protect my api routes. I am using Beyondcode's laravel websockets package for my socket server.
My goal is to access my broadcasting routes for broadcasting only on a token bases.

Here is my BroadcastServiceProvider

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;

class BroadcastServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //Broadcast::routes();
        Broadcast::routes(["middleware" => "auth:api"]);
        require base_path('routes/channels.php');
    }
}


问:
How can I add gaussian white noise to audio in python
What's the way to add Gaussian white noise to audio files like this? On google I've only found examples of adding noise to pictures. Thanks</p>
```<code>import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
from pydub import AudioSegment
from pydub.playback import play

song=AudioSegment.from_wav("bells.wav")
play(song)

samplerate, data= wavfile.read('bells.wav')
</code>```

Body:
What's the way to add Gaussian white noise to audio files like this? On google I've only found examples of adding noise to pictures. Thanks

import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
from pydub import AudioSegment
from pydub.playback import play

song=AudioSegment.from_wav("bells.wav")
play(song)

samplerate, data= wavfile.read('bells.wav')


问:
FileProvider keep sending unsupported attachment
I'm working on an app(min SDK is 26) that will share a .CSV file (/storage/emulated/0/Documents/SensorData_Date.csv) to Telegram.

I try to use FileProvider to share a document from my app to Telegram, WhatsApp, Gmail, etc. I use the code below, and when I test the result, my app will redirect me to Telegram, WhatsApp, or Gmail, and then it will not attach the csv file and show "unsupported attachement"

My Code:

== AndroidManifest.xml ==

```<code><provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="com.example.sharefiletest.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">

    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/shared_file_path" />
</provider>
</code>```

== shared_file_path.xml ==

```<code><?xml version="1.0" encoding="utf-8"?>
<paths>
    <root-path name="external_files" path="/storage/" />
    <external-path name="files_root" path="." />
    <external-path name="external_storage_root" path="." />
</paths>
</code>```

== Code in MainActivity ==

```<code>private String excel_file_name = "SensorData_Date.csv";
private File FilePath = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS), excel_file_name);

if(FilePath.exists())
{
   Intent intent = new Intent(Intent.ACTION_SEND);
   Uri uri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".fileprovider", FilePath);
   ShareFileToOtherApp.setType("text/comma-separated-values");
   ShareFileToOtherApp.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
   ShareFileToOtherApp.putExtra(Intent.EXTRA_STREAM, uri);
   startActivity(Intent.createChooser(intent, "Share the file ..."));
}
</code>```

== Result ==
Unsupported attachment

I already tried changing setType(), .addFlags(), and changing the manifest file, but all of them returned the same result.

Body:
I'm working on an app(min SDK is 26) that will share a .CSV file (/storage/emulated/0/Documents/SensorData_Date.csv) to Telegram.

I try to use FileProvider to share a document from my app to Telegram, WhatsApp, Gmail, etc. I use the code below, and when I test the result, my app will redirect me to Telegram, WhatsApp, or Gmail, and then it will not attach the csv file and show "unsupported attachement"

My Code:

== AndroidManifest.xml ==

<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="com.example.sharefiletest.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">

    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/shared_file_path" />
</provider>

== shared_file_path.xml ==

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <root-path name="external_files" path="/storage/" />
    <external-path name="files_root" path="." />
    <external-path name="external_storage_root" path="." />
</paths>

== Code in MainActivity ==

private String excel_file_name = "SensorData_Date.csv";
private File FilePath = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS), excel_file_name);

if(FilePath.exists())
{
   Intent intent = new Intent(Intent.ACTION_SEND);
   Uri uri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".fileprovider", FilePath);
   ShareFileToOtherApp.setType("text/comma-separated-values");
   ShareFileToOtherApp.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
   ShareFileToOtherApp.putExtra(Intent.EXTRA_STREAM, uri);
   startActivity(Intent.createChooser(intent, "Share the file ..."));
}

== Result ==
Unsupported attachment

I already tried changing setType(), .addFlags(), and changing the manifest file, but all of them returned the same result.


问:
How to decide upon having 1 resolver or resolver for each field in graphql?
What criteria should be considered before deciding to go with 1 resolver for the entire query type or resolvers for each field? What are the advantages & disadvantages of each way of defining resolvers?</p>


问:
is there a way to show input video capture devices in C# (except directshow filters) Like VMix App?
we have an (AJA Kona 3G) capture card (that it has 2 SDI inputs)
in my application that we wrote with C# and use from Direct show filters
we can see my card in list But in a wrong way that can you only one whole input (image no.1),
but in VMix app that it can show in Correct way that can show both 2 inputs (image no.2)
My application Video input List:
VMix app Video input List :
there is a one question -  which way used to show correct name (we are sure it is not Direct show)

can anyone help me ?
thanks

we used from Direct show filters in our application


问:
Can we pull podman image with native docker?
The following is my setup:

Docker repository in Artifactory (hosted on RHEL8)

Jenkins slave (hosted on RHEL7)

The Docker repository has some images (built with docker) which I pull in my Jenkins slave using a docker plugin and everything works fine.
Now I have built an image with podman build and pushed it to the Docker repository. Now when I try to do a docker pull on my jenkins slave, I get an error stating image not found. But I am able to pull the image with podman pull. Unfortunately podman pull is not working well in the Jenkins pipeline.

What I do:

on a RHEL8 server:

```<code>$ podman build -t artifactory/docker-repo/toothless:latest .
$ podman push artifactory/docker-repo/toothless:latest
</code>```

on a RHEL7 server:

```<code>$ docker pull artifactory/docker-repo/toothless:latest
</code>```

result:

```<code>Trying to pull repository artifactory/docker-repo/toothless ...
Pulling repository artifactory/docker-repo/toothless
Error: image docker-repo/toothless:latest not found
</code>```

Dockerfile:

```<code>From registry.access.redhat.com/ubi9:9.1.0
LABEL maintainer:NightFury
COPY AppStream.repo /etc/yum.repos.d/AppStream.repo
COPY BaseOS.repo /etc/yum.repos.d/BaseOS.repo
RUN /usr/bin/yum install -y gcc git
</code>```

I cannot build my image with docker on RHEL7 server because my image is of RHEL9. RHEL9 image on RHEL7 host is not supported

I would like to know whether it is possible or not to do a docker pull of a podman build image from docker repository. Please let me know if I am missing anything in my process.

Body:
The following is my setup:

Docker repository in Artifactory (hosted on RHEL8)

Jenkins slave (hosted on RHEL7)

The Docker repository has some images (built with docker) which I pull in my Jenkins slave using a docker plugin and everything works fine.
Now I have built an image with podman build and pushed it to the Docker repository. Now when I try to do a docker pull on my jenkins slave, I get an error stating image not found. But I am able to pull the image with podman pull. Unfortunately podman pull is not working well in the Jenkins pipeline.

What I do:

on a RHEL8 server:

$ podman build -t artifactory/docker-repo/toothless:latest .
$ podman push artifactory/docker-repo/toothless:latest

on a RHEL7 server:

$ docker pull artifactory/docker-repo/toothless:latest

result:

Trying to pull repository artifactory/docker-repo/toothless ...
Pulling repository artifactory/docker-repo/toothless
Error: image docker-repo/toothless:latest not found

Dockerfile:

From registry.access.redhat.com/ubi9:9.1.0
LABEL maintainer:NightFury
COPY AppStream.repo /etc/yum.repos.d/AppStream.repo
COPY BaseOS.repo /etc/yum.repos.d/BaseOS.repo
RUN /usr/bin/yum install -y gcc git

I cannot build my image with docker on RHEL7 server because my image is of RHEL9. RHEL9 image on RHEL7 host is not supported

I would like to know whether it is possible or not to do a docker pull of a podman build image from docker repository. Please let me know if I am missing anything in my process.


问:
Supabase types errors
Im using supabase with typescript and get some errors. I see them in webstorm, but not in vscode. Could u help me?

```<code>supabase
      .channel('custom-all-channel')
      .on(
        'postgres_changes',
        { event: '*', schema: 'public', table: 'players_online' },
        (payload) => {
          if (payload.eventType === 'INSERT') {
            players = [...players, { name: payload.new.name, id: payload.new.id }]
          }
          if (payload.eventType === 'DELETE') {
            players = players.filter((pl) => pl.id !== payload.old.id)
          }
        }
      )
      .subscribe()
</code>```

I get 2 errors:

Argument type "postgres_changes" is not assignable to parameter type ${REALTIME_LISTEN_TYPES.BROADCAST}

Argument type {schema: string, event: string, table: string} is not assignable to parameter type {event: string}

What am I missing?

Title: Supabase types errors

Body:
Im using supabase with typescript and get some errors. I see them in webstorm, but not in vscode. Could u help me?

supabase
      .channel('custom-all-channel')
      .on(
        'postgres_changes',
        { event: '*', schema: 'public', table: 'players_online' },
        (payload) => {
          if (payload.eventType === 'INSERT') {
            players = [...players, { name: payload.new.name, id: payload.new.id }]
          }
          if (payload.eventType === 'DELETE') {
            players = players.filter((pl) => pl.id !== payload.old.id)
          }
        }
      )
      .subscribe()

I get 2 errors:

Argument type "postgres_changes" is not assignable to parameter type ${REALTIME_LISTEN_TYPES.BROADCAST}

Argument type {schema: string, event: string, table: string} is not assignable to parameter type {event: string}

What am I missing?


问:
Uncaught TypeError: Argument 1 passed to Illuminate\Log\Logger::__construct() must be an instance of Illuminate\Log\Monolog
I wanna ask about configuration laravel in Ubuntu 22.04

I already set up configuration laravel file.

But i don't know, my app can't running, only show "This page isn’t working".

So, when i search again, i try to running php artisan serve and when i running that, i got error like this.

I don't know about this error, i try to search, but i don't get solution

root@svr-siporsat-app:/var/www/siporsat_app/html/siporsat# php artisan
serve PHP Fatal error:  Uncaught TypeError: Argument 1 passed to
Illuminate\Log\Logger::__construct() must be an instance of
Illuminate\Log\Monolog, instance of Monolog\Logger given, called in
/var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/LogManager.php on line 182 and defined in /var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/Logger.php:43
Stack trace:

#0 /var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(182):
Illuminate\Log\Logger->__construct(Object(Monolog\Logger),
Object(Illuminate\Events\Dispatcher))

#1 /var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(129):
Illuminate\Log\LogManager->createEmergencyLogger()

#2 /var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(112):
Illuminate\Log\LogManager->get('stack')

#3 /var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(590):
Illuminate\Log\LogMana in
/var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/Logger.php
on line 43 PHP Fatal error:  Uncaught TypeError: Argument 1 passed to
Illuminate\Log\Logger::__construct() must be an instance of
Illuminate\Log\Monolog, instance of Monolog\Logger given, called in
/var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/LogManager.php
on line 182 and defined in
/var/www/siporsat_app/html/siporsat/vendor/laravel/framework/src/Illuminate/Log/Logger.php:43


问:
Is that correct that it is not safe to use Java Thread API in Spring Web App running on Tomcat? Why?
I see many Java EE related question that says "never use Thread and Timer API in JavaEE/Servlet Based environments". Example

Is the same true for Spring web applications?

I saw examples where org.springframework.core.task.TaskExecutor, CompletableFuture, and @Async were used in Spring application, and I haven't seen use cases of Thread API.

I guess that the issue with Thread API is related to some request parameters that cannot be accessed by the spawned thread. I also heard "context is not propagated to the new thread".

I also saw "JSR-236" which says "java.util.Timer, java.lang.Thread and the thread pool creation APIs from the Java SE concurrency utilities (JSR-166) in the java.util.concurrent package should never be used within managed environments, as it creates threads outside the purview of the container".

May you clarify this question?
Which parameter may be lost if we create new Thread in Spring web application?
Are there use cases when it is safe to use Thread API in Spring Web App?
How Spring's TaskExecutor, @Async handle this issue?

Thanks.


问:
Could not resolve io.github.lizhangqu:coreprogress:1.0.2 in React Native during react-native-compressor installing
I am using react-native-0.70.6 and during the installation of react-native-compressor-1.6.1
I am getting an error when running npx react-native-run-android the error is
FAILURE: Build failed with an exception.

What went wrong:
Could not determine the dependencies of task ':react-native-compressor:compileDebugAidl'.

Could not resolve all task dependencies for configuration ':react-native-compressor:debugCompileClasspath'.
Could not resolve io.github.lizhangqu:coreprogress:1.0.2.
Required by:
project :react-native-compressor
> Skipped due to earlier error
> Skipped due to earlier error

Please help to fix the error...


问:
React render raw HTML as-is partially inside element
I need to add some raw HTML to my  to my React/Next.js app in addition to already-existing elements, something like below:

```<code><head>
<existingElements.../>
[I WANT TO INSERT WHATEVER ARBITRARY HTML HERE]
</head>
</code>```

<s>If I use dangerouslySetInnerHTML I lose the existing elements.</s>

I can't use dangerouslySetInnerHTML as  in Next.js doesn't have that property at all (and I'm trying to add to the Head element).

If I try using node-html-parser or react-html-parser:

```<code>import {parse} from 'node-html-parser';
[...]
let additionalElements:any = <></>;
additionalElements =  parse(MY_ARBITRARY_HTML_STRING); // no parse errors here
[...]
return <head>{additionalElements}</head>
</code>```

They end up erroring with `Error: Objects are not valid as a React child (my parsed HTML here).

I've thought there was a problem with the HTML that I provide but I get the same error even if I try providing something simple as hello.

How can I insert arbitrary HTML string into the head element while keeping existing head elements too, using React and Next.js?

(Note: I'm fully aware of XSS and security implications, this is an internally/strictly controlled HTML.)

Body:
I need to add some raw HTML to my  to my React/Next.js app in addition to already-existing elements, something like below:

<existingElements.../>
[I WANT TO INSERT WHATEVER ARBITRARY HTML HERE]

<s>If I use dangerouslySetInnerHTML I lose the existing elements.</s>

I can't use dangerouslySetInnerHTML as  in Next.js doesn't have that property at all (and I'm trying to add to the Head element).

If I try using node-html-parser or react-html-parser:

import {parse} from 'node-html-parser';
[...]
let additionalElements:any = <></>;
additionalElements =  parse(MY_ARBITRARY_HTML_STRING); // no parse errors here
[...]
return {additionalElements}

They end up erroring with `Error: Objects are not valid as a React child (my parsed HTML here).

I've thought there was a problem with the HTML that I provide but I get the same error even if I try providing something simple as hello.

How can I insert arbitrary HTML string into the head element while keeping existing head elements too, using React and Next.js?

(Note: I'm fully aware of XSS and security implications, this is an internally/strictly controlled HTML.)


问:
Freeze the simulation to insert a text into an input field in an AR environment
I just got into Unity and am trying to make an AR app. I'm simulating a simple circuit, and I've created a small detail window that shows the current and voltage. Now, as a user, I would like to manually enter the resistance for the component in this window. I've already created an InputField, but unfortunately I can't type anything into the field.
Does one of you have an idea ahead it may lie?
Regards</p>


问:
How can i represent my picture who are in bytes form in tkinter with a for loop?
i struggle to represent my photos which are in bytes form onto tkinter my plan was to have all my data in a dataframe and then represent it on tkinter with a for loop. It works with all the normal data which are strings but not with the photos. Right know i can only represent the last added photo of the dataframe.

```<code>
import pandas as pd
from PIL import ImageTk,Image
from tkinter import *
import sqlite3
import tkinter as tk
from tkinter import *
from tkinter import filedialog
from tkinter.filedialog import askopenfile
from PIL import Image, ImageTk
import base64
import io

global df_main

root = Tk()
root.title("Fabric Database")
root.geometry("400x400")
df_main = pd.read_csv("C:/Users/noahk/Documents/Trial.csv")

def upload_file():
    global lol
    global converted_string
    file = filedialog.askopenfilename()
    #with open(file, "rb") as image2string:
    converted_string = base64.b64encode(open(file, "rb").read())
    lol = converted_string.decode("utf-8")

def submit():
    global df_main
    df_main = df_main.append({'Name': str(name.get()), 'Country': str(country.get()), 'Price': str(price.get()), 'Thickness':str(thickness.get()), 'Fabric Example': lol}, ignore_index = True)
    #query_label = Label(root, text=df_main)
    #query_label.grid(row=12,column=1)
    print(df_main)

def show_pic():
    global img
    b = base64.b64decode(lol)
    img = Image.open(io.BytesIO(b))

    # resize the image and apply a high-quality down sampling filter
    img = img.resize((20, 20), Image.ANTIALIAS)

    # PhotoImage class is used to add image to widgets, icons etc
    img = ImageTk.PhotoImage(img)
    pic = Label(table, image=img)
    pic.grid(row=1,column=5)

def show_table():
    global b
    global img
    global pic

    table = Toplevel()
    table.title("Fabric Database")
    table.geometry("400x400")
    shape_x = df_main.shape
    img_list =[]
    for x in range(0,shape_x[0]):

        b = base64.b64decode(df_main["Fabric Example"][x])
        img = Image.open(io.BytesIO(b))

        # resize the image and apply a high-quality down sampling filter
        img = img.resize((20, 20), Image.ANTIALIAS)

        # PhotoImage class is used to add image to widgets, icons etc
        img = ImageTk.PhotoImage(img)

        img_list.append(img)
        print(img_list)
        table_name = Label(table, text="Name")
        table_name.grid(row=0,column=0)
        table_Country = Label(table, text="Country")
        table_Country.grid(row=0,column=1)
        table_Price = Label(table, text="Price")
        table_Price.grid(row=0,column=2)
        table_Thickness = Label(table, text="Thickness")
        table_Thickness.grid(row=0,column=3)
        table_Fabric = Label(table, text="Fabric Example")
        table_Fabric.grid(row=0,column=4)

        df_name_label = Label(table, text=df_main["Name"][x])
        df_name_label.grid(row=x+2,column=0)
        df_Countrylabel = Label(table, text=df_main["Country"][x])
        df_Countrylabel.grid(row=x+2,column=1)
        df_Pricelabel = Label(table, text=df_main["Price"][x])
        df_Pricelabel.grid(row=x+2,column=2)
        df_Thicknesslabel = Label(table, text=df_main["Thickness"][x])
        df_Thicknesslabel.grid(row=x+2,column=3)
        pic = Label(table, image=str.encode(img_list[x]))
        pic.grid(row=(2+x),column=4)

def search():
    search = Tk()
    search.title("Fabric Database")
    search.geometry("400x400")

    global name_table
    global country_table
    global price_table
    global thickness_table
    global fabric_example_table

    name_table = Entry(search, width=30)
    name_table.grid(row=2, column=0)
    country_table = Entry(search, width=30)
    country_table.grid(row=2, column=1)
    price_table = Entry(search, width=30)
    price_table.grid(row=2, column=2)
    thickness_table = Entry(search, width=30)
    thickness_table.grid(row=2, column=3)
    fabric_example_table = Entry(search, width=30)
    fabric_example_table.grid(row=2, column=4)
    name_label_table = Label(search, text="Name")
    name_label_table.grid(row=1, column=0)
    country_label_table = Label(search, text="Country")
    country_label_table.grid(row=1, column=1)
    price_label_table = Label(search, text="Price")
    price_label_table.grid(row=1, column=2)
    thickness_label_table = Label(search, text="Thickness")
    thickness_label_table.grid(row=1, column=3)
    fabric_example_label_table = Label(search, text="Fabric example")
    fabric_example_label_table.grid(row=1, column=4)

    global search_btn
    search_btn = Button(search, text="Search", command=search_table)
    search_btn.grid(row=3,column=0,columnspan=2,pady=10,padx=10,ipadx=120)

def search_table():
    stdf = df[(df["Name"]==name_table) & (df["Country"]==country_table) & (df["Price"]==price_table)&(df["Thickness"]==thickness_table)&(df["Fabric Example"]==fabric_example_table)]
    stdf_label = Label(search, text=stdf)
    stdf_label.grid(row=12,column=1)

global name
global country
global price
global thickness
global fabric_example

name = Entry(root, width=30)
name.grid(row=0, column=1, padx=20, pady=(10,0))
country = Entry(root, width=30)
country.grid(row=1, column=1)
price = Entry(root, width=30)
price.grid(row=2, column=1)
thickness = Entry(root, width=30)
thickness.grid(row=3, column=1)
fabric_example = tk.Button(root, text='Upload Files',
   width=20,command = lambda:upload_file())
fabric_example.grid(row=4, column=1)

show_btn = Button(root, text="Press", command=show_pic)
show_btn.grid(row=7,column=2)

#create text box labels
name_label = Label(root, text="Name")
name_label.grid(row=0, column=0, pady=(10,0))
country_label = Label(root, text="Country")
country_label.grid(row=1, column=0)
price_label = Label(root, text="Price")
price_label.grid(row=2, column=0)
thickness_label = Label(root, text="Thickness")
thickness_label.grid(row=3, column=0)
fabric_example_label = Label(root, text="Fabric example")
fabric_example_label.grid(row=4, column=0)

delete_box = Entry(root, width=30)
delete_box.grid(row=9,column=1,pady=5)
delete_box_label=Label(root, text="Select Row ID")
delete_box_label.grid(row=9,column=0, pady=5)

#Create Submit Button

submit_btn = Button(root, text="Add to Database", command=submit)
submit_btn.grid(row=5,column=0,columnspan=2,pady=10,padx=10,ipadx=105)

query_btn = Button(root, text="Show Table", command=show_table)
query_btn.grid(row=7,column=0,columnspan=2,pady=10,padx=10,ipadx=120)
'''

delete_btn = Button(root, text="Delete Column", command=delete)
delete_btn.grid(row=10,column=0,columnspan=2,pady=10,padx=10,ipadx=120)

update_btn = Button(root, text="Edit Table", command=edit)
update_btn.grid(row=11,column=0,columnspan=2,pady=10,padx=10,ipadx=120)
'''

search_btn = Button(root, text="Search Databank", command=search)
search_btn.grid(row=12,column=0,columnspan=2,pady=10,padx=10,ipadx=120)

root.mainloop()

</code>```

i tried everything, but it seems like the problem may is that it is in byte form, because i could not even represent the photo byte form.

Thanks for your help

Tried showing byte form string of photos and looping through the dataframe and putting it into Tkinter directly or putting the photos into a list and the list into the label and cycling through the list. i was expecting that i can put all photos and information of the dataframe into tkinter to represent the whole table but save the photos in byte form into the dataframe.

Body:
i struggle to represent my photos which are in bytes form onto tkinter my plan was to have all my data in a dataframe and then represent it on tkinter with a for loop. It works with all the normal data which are strings but not with the photos. Right know i can only represent the last added photo of the dataframe.

import pandas as pd
from PIL import ImageTk,Image
from tkinter import *
import sqlite3
import tkinter as tk
from tkinter import *
from tkinter import filedialog
from tkinter.filedialog import askopenfile
from PIL import Image, ImageTk
import base64
import io

global df_main

root = Tk()
root.title("Fabric Database")
root.geometry("400x400")
df_main = pd.read_csv("C:/Users/noahk/Documents/Trial.csv")

def upload_file():
    global lol
    global converted_string
    file = filedialog.askopenfilename()
    #with open(file, "rb") as image2string:
    converted_string = base64.b64encode(open(file, "rb").read())
    lol = converted_string.decode("utf-8")

def submit():
    global df_main
    df_main = df_main.append({'Name': str(name.get()), 'Country': str(country.get()), 'Price': str(price.get()), 'Thickness':str(thickness.get()), 'Fabric Example': lol}, ignore_index = True)
    #query_label = Label(root, text=df_main)
    #query_label.grid(row=12,column=1)
    print(df_main)

def show_pic():
    global img
    b = base64.b64decode(lol)
    img = Image.open(io.BytesIO(b))

    # resize the image and apply a high-quality down sampling filter
    img = img.resize((20, 20), Image.ANTIALIAS)

    # PhotoImage class is used to add image to widgets, icons etc
    img = ImageTk.PhotoImage(img)
    pic = Label(table, image=img)
    pic.grid(row=1,column=5)

def show_table():
    global b
    global img
    global pic

    table = Toplevel()
    table.title("Fabric Database")
    table.geometry("400x400")
    shape_x = df_main.shape
    img_list =[]
    for x in range(0,shape_x[0]):

        b = base64.b64decode(df_main["Fabric Example"][x])
        img = Image.open(io.BytesIO(b))

        # resize the image and apply a high-quality down sampling filter
        img = img.resize((20, 20), Image.ANTIALIAS)

        # PhotoImage class is used to add image to widgets, icons etc
        img = ImageTk.PhotoImage(img)

        img_list.append(img)
        print(img_list)
        table_name = Label(table, text="Name")
        table_name.grid(row=0,column=0)
        table_Country = Label(table, text="Country")
        table_Country.grid(row=0,column=1)
        table_Price = Label(table, text="Price")
        table_Price.grid(row=0,column=2)
        table_Thickness = Label(table, text="Thickness")
        table_Thickness.grid(row=0,column=3)
        table_Fabric = Label(table, text="Fabric Example")
        table_Fabric.grid(row=0,column=4)

        df_name_label = Label(table, text=df_main["Name"][x])
        df_name_label.grid(row=x+2,column=0)
        df_Countrylabel = Label(table, text=df_main["Country"][x])
        df_Countrylabel.grid(row=x+2,column=1)
        df_Pricelabel = Label(table, text=df_main["Price"][x])
        df_Pricelabel.grid(row=x+2,column=2)
        df_Thicknesslabel = Label(table, text=df_main["Thickness"][x])
        df_Thicknesslabel.grid(row=x+2,column=3)
        pic = Label(table, image=str.encode(img_list[x]))
        pic.grid(row=(2+x),column=4)

def search():
    search = Tk()
    search.title("Fabric Database")
    search.geometry("400x400")

    global name_table
    global country_table
    global price_table
    global thickness_table
    global fabric_example_table

    name_table = Entry(search, width=30)
    name_table.grid(row=2, column=0)
    country_table = Entry(search, width=30)
    country_table.grid(row=2, column=1)
    price_table = Entry(search, width=30)
    price_table.grid(row=2, column=2)
    thickness_table = Entry(search, width=30)
    thickness_table.grid(row=2, column=3)
    fabric_example_table = Entry(search, width=30)
    fabric_example_table.grid(row=2, column=4)
    name_label_table = Label(search, text="Name")
    name_label_table.grid(row=1, column=0)
    country_label_table = Label(search, text="Country")
    country_label_table.grid(row=1, column=1)
    price_label_table = Label(search, text="Price")
    price_label_table.grid(row=1, column=2)
    thickness_label_table = Label(search, text="Thickness")
    thickness_label_table.grid(row=1, column=3)
    fabric_example_label_table = Label(search, text="Fabric example")
    fabric_example_label_table.grid(row=1, column=4)

    global search_btn
    search_btn = Button(search, text="Search", command=search_table)
    search_btn.grid(row=3,column=0,columnspan=2,pady=10,padx=10,ipadx=120)

def search_table():
    stdf = df[(df["Name"]==name_table) & (df["Country"]==country_table) & (df["Price"]==price_table)&(df["Thickness"]==thickness_table)&(df["Fabric Example"]==fabric_example_table)]
    stdf_label = Label(search, text=stdf)
    stdf_label.grid(row=12,column=1)

global name
global country
global price
global thickness
global fabric_example

name = Entry(root, width=30)
name.grid(row=0, column=1, padx=20, pady=(10,0))
country = Entry(root, width=30)
country.grid(row=1, column=1)
price = Entry(root, width=30)
price.grid(row=2, column=1)
thickness = Entry(root, width=30)
thickness.grid(row=3, column=1)
fabric_example = tk.Button(root, text='Upload Files',
   width=20,command = lambda:upload_file())
fabric_example.grid(row=4, column=1)

show_btn = Button(root, text="Press", command=show_pic)
show_btn.grid(row=7,column=2)

#create text box labels
name_label = Label(root, text="Name")
name_label.grid(row=0, column=0, pady=(10,0))
country_label = Label(root, text="Country")
country_label.grid(row=1, column=0)
price_label = Label(root, text="Price")
price_label.grid(row=2, column=0)
thickness_label = Label(root, text="Thickness")
thickness_label.grid(row=3, column=0)
fabric_example_label = Label(root, text="Fabric example")
fabric_example_label.grid(row=4, column=0)

delete_box = Entry(root, width=30)
delete_box.grid(row=9,column=1,pady=5)
delete_box_label=Label(root, text="Select Row ID")
delete_box_label.grid(row=9,column=0, pady=5)

#Create Submit Button

submit_btn = Button(root, text="Add to Database", command=submit)
submit_btn.grid(row=5,column=0,columnspan=2,pady=10,padx=10,ipadx=105)

query_btn = Button(root, text="Show Table", command=show_table)
query_btn.grid(row=7,column=0,columnspan=2,pady=10,padx=10,ipadx=120)
'''

delete_btn = Button(root, text="Delete Column", command=delete)
delete_btn.grid(row=10,column=0,columnspan=2,pady=10,padx=10,ipadx=120)

update_btn = Button(root, text="Edit Table", command=edit)
update_btn.grid(row=11,column=0,columnspan=2,pady=10,padx=10,ipadx=120)
'''

search_btn = Button(root, text="Search Databank", command=search)
search_btn.grid(row=12,column=0,columnspan=2,pady=10,padx=10,ipadx=120)

root.mainloop()

i tried everything, but it seems like the problem may is that it is in byte form, because i could not even represent the photo byte form.

Thanks for your help

Tried showing byte form string of photos and looping through the dataframe and putting it into Tkinter directly or putting the photos into a list and the list into the label and cycling through the list. i was expecting that i can put all photos and information of the dataframe into tkinter to represent the whole table but save the photos in byte form into the dataframe.


问:
is it possible to insert some tags in TextField compose?
I'm developing with compose. And I want to insert some tags in TextFiled(EditText)
I searched for buildAnnotatedString.
However it looks like possible only for textStyle.
In Text widget, it is possible to insert icon with buildAnnotatedString, But in TextField, I can't insert inlineContent So that can't insert some Composable.
What I want to looks like below image

is it possible in Compose?


问:
How to use ExtractAssociatedIcon in dartlang win32 package
I am building a flutter desktop app for demo purpose.

One of my ideas is showing associated icon of a executable file. Just like you see in OS explorer.

By now I cannot find a flutter pack which helps me meet this need cross Linus, MacOS and Windows. Then I turned to win32 package which contains a function called ExtractAssociatedIcon. The same name I used with C# decades ago.

Here is definition of this function in shell32.g.dart file.

int ExtractAssociatedIcon(int hInst, Pointer<Utf16> pszIconPath, Pointer<Uint16> piIcon)
```

I use GetModuleHandle(nullptr) for hInst parameter. fileFullPath.toNativeUtf16() for pszIconPath. But I cannot figure out what is for piIcon.

I know piIcon is index of the icon. But the parameter type is Pointer. I don't know how to convert integer 0 to this type.

I know Pointer.fromAddress constructor. But takes address. Not a value.

Can anyone help that would be much appreciated.

I like to know how to call int ExtractAssociatedIcon(int hInst, Pointer pszIconPath, Pointer piIcon) in dartlang.

Body:
I am building a flutter desktop app for demo purpose.

One of my ideas is showing associated icon of a executable file. Just like you see in OS explorer.

By now I cannot find a flutter pack which helps me meet this need cross Linus, MacOS and Windows. Then I turned to win32 package which contains a function called ExtractAssociatedIcon. The same name I used with C# decades ago.

Here is definition of this function in shell32.g.dart file.

int ExtractAssociatedIcon(int hInst, Pointer<Utf16> pszIconPath, Pointer<Uint16> piIcon)

I use GetModuleHandle(nullptr) for hInst parameter. fileFullPath.toNativeUtf16() for pszIconPath. But I cannot figure out what is for piIcon.

I know piIcon is index of the icon. But the parameter type is Pointer. I don't know how to convert integer 0 to this type.

I know Pointer.fromAddress constructor. But takes address. Not a value.

Can anyone help that would be much appreciated.

I like to know how to call int ExtractAssociatedIcon(int hInst, Pointer pszIconPath, Pointer piIcon) in dartlang.


问:
Ngrx with feature flags - best practices
I am using ngrx in my project and I would like to include feature flagging on it, but I was checking some articles on the web and none of them mention ngrx, they used plain Angular service, guard or directive.

I was wondering if that makes sense as I did not found any article or comment mentioning it and it may not be the best solution integrate with ngrx.

My idea was to save the config of feature flags in the global store and then create specific selectors for each feature where we want to use them.

Some examples would be:

If we want to disable a route, check a selector in a guard.

If we want to disable a functionality in a component, use a specific selector to check the config property.

My question is: has anyone include feature flags with ngrx? Which are the best practices to configure it properly (if it makes sense)?

Thanks in advance!


问:
Recording audio blocks for musical looper doesn't function correctly
First I want to explain what does this little program is supposed to do. It is a musical looper, when not recording anything, it will basically bypass the incoming audio blocks to the output. When in recording mode (which is triggered by a button in tkinter gui) it will still bypass the input to the output, but it will also record incoming audio. When the recording is done, it will loop the recording. This is basically it.

The program consists of 3 files: https://gist.github.com/ramazanemreosmanoglu/ec64f51f101d9324612bcbcc597fabba

So this is what happens when I run the program:

(Nothing is played automatically in the video. When I record something and do nothing, nothing happens. At first, I thought I should add a midi monitor but we don't need it, just know that every sound is triggered by me.)

https://www.youtube.com/watch?v=PdBORfjHAgQ

What is wrong in this code? What is the correct way to record audio blocks on python with jack?


问:
window.print() download pdf content cut between two pages How to fix
enter image description here

And Also I have issue this PDF run correct in chrome but in firefox dose not work like css and bootstrap not apply

I want PDF Like This

4 Div Print with Diffrent Content and when start new div page break content print another div.In firefox now work page break css how can i resolve issue?

We are use reactjs how can i solve this issue with correct PDF and shift content

PDF Correct Show in chrome but extra content in one page it will be cut that we don't want to this

PDF Correct Show in chrome but firefox page break not work

window.print() we are use

is there any another options

this PDF support of all browser


问:
Resolve single field from collection returned by delegated query HotChocolate GrapQL
I'm using HotChocolate GraphQL to implement schema federation, the basic setup is working.

I'm attempting to extend a type from one of our downstream services using a delegated resolver and the extend type syntax.

I have the following type defined in service A:

```<code>type Foo {
  id: Int
}
</code>```

Service B is attempting to extend this type with the following extension:

```<code>extend type Foo {
  Bar: Int @delegate(schema: "ServiceB", path: "getUsers(userId: $fields:userId).userId")
}
</code>```

The problem i'm having is the result of the getUsers query happens to be a collection, but the new property Bar on Foo is a singular Int.

Is there a way I can perform this mapping? I would prefer not to add an additional query to support this.

Thanks

Body:
I'm using HotChocolate GraphQL to implement schema federation, the basic setup is working.

I'm attempting to extend a type from one of our downstream services using a delegated resolver and the extend type syntax.

I have the following type defined in service A:

type Foo {
  id: Int
}

Service B is attempting to extend this type with the following extension:

extend type Foo {
  Bar: Int @delegate(schema: "ServiceB", path: "getUsers(userId: $fields:userId).userId")
}

The problem i'm having is the result of the getUsers query happens to be a collection, but the new property Bar on Foo is a singular Int.

Is there a way I can perform this mapping? I would prefer not to add an additional query to support this.

Thanks


问:
Flutter - Custom widget animation state reversed in Gridview
I have a gridview with a couple of custom cards that when selected will change color to indicate to the user that they have selected the card. When I scroll down and return to the previously selected card, the color changes like it was never selected.

At first, I thought it was a key issue but that didn't solve anything.

This is the code I have

```<code>// Code for the Gridview
        GridView.builder(
          padding: EdgeInsets.all(Insets.sm),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
            mainAxisSpacing: Insets.sm,
            crossAxisSpacing: Insets.sm,
          ),
          itemCount: categories.length,
          itemBuilder: (BuildContext context, int index) {
            return CategoryCard(
              key: UniqueKey(),
              category: categories[index],
              onTap: (isSelected) {
                (isSelected)
                    ? game.categories.add(categories[index])
                    : game.categories.remove(categories[index]);
              },
            );
          },
        ),
</code>```
```<code>// This is the code for the custom widget
class CategoryCard extends StatefulWidget {
  const CategoryCard({
    super.key,
    required this.category,
    required this.onTap,
  });

  final Category category;
  final Function(bool) onTap;

  @override
  State<CategoryCard> createState() => _CategoryCardState();
}

class _CategoryCardState extends State<CategoryCard>
    with TickerProviderStateMixin {
  late AnimationController controller;
  late Animation<Color?> containerBackground;
  late Animation<Color?> imageBackground;
  late Animation<Color?> textColor;

  late CurvedAnimation curve;

  bool isSelected = true;

  @override
  void initState() {
    super.initState();
    controller = AnimationController(
      duration: const Duration(milliseconds: 300),
      vsync: this,
    );

    curve = CurvedAnimation(
      parent: controller,
      curve: Curves.easeInOut,
    );

    containerBackground =
        ColorTween(begin: Colors.white, end: AppColors.blue200)
            .animate(controller)
          ..addListener(() => setState(() {}));

    imageBackground =
        ColorTween(begin: AppColors.blue50, end: AppColors.blue100)
            .animate(controller)
          ..addListener(() => setState(() {}));

    textColor = ColorTween(begin: AppColors.blue300, end: Colors.white)
        .animate(controller)
      ..addListener(() => setState(() {}));
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  void animateColor() {
    if (isSelected) {
      controller.forward();
    } else {
      controller.reverse();
    }

    widget.onTap(isSelected);

    isSelected = !isSelected;
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () => {animateColor()},
      child: Container(
        decoration: BoxDecoration(
          color: containerBackground.value,
          borderRadius: Corners.lgBorder,
        ),
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          Container(
            padding: EdgeInsets.all(Insets.xs),
            decoration: BoxDecoration(
              color: imageBackground.value,
              borderRadius: Corners.lgBorder,
            ),
            clipBehavior: Clip.antiAlias,
            child: Image.asset(
              "assets/images/${widget.category.name.toLowerCase()}.png",
              width: 78,
              height: 78,
            ),
          ),
          SizedBox(height: Insets.med),
          Text(
            widget.category.name,
            style: TextStyles.body1.copyWith(color: textColor.value),
          )
        ]),
      ),
    );
  }
}
</code>```

Any help or explanation on why this is happening is appreciated.

Body:
I have a gridview with a couple of custom cards that when selected will change color to indicate to the user that they have selected the card. When I scroll down and return to the previously selected card, the color changes like it was never selected.

At first, I thought it was a key issue but that didn't solve anything.

This is the code I have

// Code for the Gridview
        GridView.builder(
          padding: EdgeInsets.all(Insets.sm),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
            mainAxisSpacing: Insets.sm,
            crossAxisSpacing: Insets.sm,
          ),
          itemCount: categories.length,
          itemBuilder: (BuildContext context, int index) {
            return CategoryCard(
              key: UniqueKey(),
              category: categories[index],
              onTap: (isSelected) {
                (isSelected)
                    ? game.categories.add(categories[index])
                    : game.categories.remove(categories[index]);
              },
            );
          },
        ),

// This is the code for the custom widget
class CategoryCard extends StatefulWidget {
  const CategoryCard({
    super.key,
    required this.category,
    required this.onTap,
  });

  final Category category;
  final Function(bool) onTap;

  @override
  State<CategoryCard> createState() => _CategoryCardState();
}

class _CategoryCardState extends State<CategoryCard>
    with TickerProviderStateMixin {
  late AnimationController controller;
  late Animation<Color?> containerBackground;
  late Animation<Color?> imageBackground;
  late Animation<Color?> textColor;

  late CurvedAnimation curve;

  bool isSelected = true;

  @override
  void initState() {
    super.initState();
    controller = AnimationController(
      duration: const Duration(milliseconds: 300),
      vsync: this,
    );

    curve = CurvedAnimation(
      parent: controller,
      curve: Curves.easeInOut,
    );

    containerBackground =
        ColorTween(begin: Colors.white, end: AppColors.blue200)
            .animate(controller)
          ..addListener(() => setState(() {}));

    imageBackground =
        ColorTween(begin: AppColors.blue50, end: AppColors.blue100)
            .animate(controller)
          ..addListener(() => setState(() {}));

    textColor = ColorTween(begin: AppColors.blue300, end: Colors.white)
        .animate(controller)
      ..addListener(() => setState(() {}));
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  void animateColor() {
    if (isSelected) {
      controller.forward();
    } else {
      controller.reverse();
    }

    widget.onTap(isSelected);

    isSelected = !isSelected;
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () => {animateColor()},
      child: Container(
        decoration: BoxDecoration(
          color: containerBackground.value,
          borderRadius: Corners.lgBorder,
        ),
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          Container(
            padding: EdgeInsets.all(Insets.xs),
            decoration: BoxDecoration(
              color: imageBackground.value,
              borderRadius: Corners.lgBorder,
            ),
            clipBehavior: Clip.antiAlias,
            child: Image.asset(
              "assets/images/${widget.category.name.toLowerCase()}.png",
              width: 78,
              height: 78,
            ),
          ),
          SizedBox(height: Insets.med),
          Text(
            widget.category.name,
            style: TextStyles.body1.copyWith(color: textColor.value),
          )
        ]),
      ),
    );
  }
}

Any help or explanation on why this is happening is appreciated.


问:
Django - Annotate field
I have 3 models:

1.

```<code>class Calendar(models.Model):
    ...
    supplier = models.CharField(...)
    subassort = models.CharField(..., null=True)
</code>```

Data example:

```<code>supplier  | subassort
----------------------
12345     | subassort1
67890     | subassort2
</code>```

```<code>class SupplierProductAssortments(models.Model):
    subassort = models.CharField(...)
    supplier = models.CharField(...)
    ui2_code = models.CharField(...)
</code>```

Data example:

```<code>supplier  | subassort  | ui2_code
---------------------------------
12345     | subassort1 | ui-1
12345     | subassort1 | ui-2
67890     | subassort2 | ui-3
</code>```

```<code>class UI2(models.Model):
    code = models.CharField(...)
    name = models.CharField(...)
</code>```

Data example:

```<code>code | name
-------------
ui-1 | milk
ui-2 | cheese
ui-3 | meat
</code>```

I need to annotate ui2 field to queryset of Calendar. For better understanding below I wrote a function that demonstrates it:

```<code>def get_calendars_with_ui2s():
    calendars = Calendar.objects.all()  # need to annotate ui2 names

    for calendar in calendars:
        if subassort := calendar.subassort:
            ui2_codes = SupplierProductAssortments.objects\
                .filter(supplier=calendar.supplier, subassort=subassort)\
                .values_list('ui2_code', flat=True)
            ui2 = UI2.objects.filter(code__in=ui2_codes).values_list('name', flat=True)
        else:
            ui2 = []

        calendar.ui2 = ui2

    return calendars
</code>```

Expected output:

```<code>supplier  | subassort  | ui2
---------------------------------------
12345     | subassort1 | [milk, cheese]
67890     | subassort2 | [meat]
</code>```

If when filtering ui2_codes was by one field I guess it could be solved by OuterRef. But there are filtering by two fields.

How can I annotate field ui2?

P.S. No FK

Title: Django - Annotate field

Body:
I have 3 models:

1.

class Calendar(models.Model):
    ...
    supplier = models.CharField(...)
    subassort = models.CharField(..., null=True)

Data example:

supplier  | subassort
----------------------
12345     | subassort1
67890     | subassort2

class SupplierProductAssortments(models.Model):
    subassort = models.CharField(...)
    supplier = models.CharField(...)
    ui2_code = models.CharField(...)

Data example:

supplier  | subassort  | ui2_code
---------------------------------
12345     | subassort1 | ui-1
12345     | subassort1 | ui-2
67890     | subassort2 | ui-3

class UI2(models.Model):
    code = models.CharField(...)
    name = models.CharField(...)

Data example:

code | name
-------------
ui-1 | milk
ui-2 | cheese
ui-3 | meat

I need to annotate ui2 field to queryset of Calendar. For better understanding below I wrote a function that demonstrates it:

def get_calendars_with_ui2s():
    calendars = Calendar.objects.all()  # need to annotate ui2 names

    for calendar in calendars:
        if subassort := calendar.subassort:
            ui2_codes = SupplierProductAssortments.objects\
                .filter(supplier=calendar.supplier, subassort=subassort)\
                .values_list('ui2_code', flat=True)
            ui2 = UI2.objects.filter(code__in=ui2_codes).values_list('name', flat=True)
        else:
            ui2 = []

        calendar.ui2 = ui2

    return calendars

Expected output:

supplier  | subassort  | ui2
---------------------------------------
12345     | subassort1 | [milk, cheese]
67890     | subassort2 | [meat]

If when filtering ui2_codes was by one field I guess it could be solved by OuterRef. But there are filtering by two fields.

How can I annotate field ui2?

P.S. No FK


问:
Price to bar calculation formula/calculation
How is price to bar ratio calculated in tradingview

It gives different number for each price so was wondering how it's calculated exactly


问:
nothing displayed in browser although webpack compiled successfully
Hi I got below code from an online learning course but I'm not sure why nothing is being rendered on the browser when I run "npm start" on my terminal and that webpack compiled successfully. To create a new React app, i used "npm init react-app what-is-context". Can anyone advise what could be wrong here? It is just an example on using contextAPI in React.

App.js

```<code>import "./App.css";
import { UserProvider, useUser } from "./UserContext";

const LoggedInUser = () => {
  const {user} = useUser();
  return (
    <p>
      Hello <span className="Username">{user.name}</span>
    </p>
  );
};

const Header = () => {
  return (
    <header>
      <h2>Blog App</h2>
      <LoggedInUser />
    </header>
  );
};

const Page = () => {
  const {user} = useUser();
  return (
    <div>
      <h2>What is Lorem ipsum?</h2>
      <p>
        In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available. It is also used to temporarily replace text in a process called greeking, which allows designers to consider the form of a webpage or publication, without the meaning of the text influencing the design.
      </p>
      <p>Written by {user.name}</p>
    </div>
  )
}

function App() {
  return (
    <div className="App">
      <Header />
      <Page />
    </div>
  );
};

function Root() {
  return (
    <UserProvider>
      <App />
    </UserProvider>
  );
}
export default Root;
</code>```

UserContext.js

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

const UserContext = createContext(undefined);

export const UserProvider = ({children}) => {
    const [user] = useState({
        name: "John",
        email: "john@example.com",
        dob: "01/01/2000",
    })
    return <UserContext.Provider value={{ user }}></UserContext.Provider>;
};

export const useUser = () => useContext(UserContext);
</code>```

Body:
Hi I got below code from an online learning course but I'm not sure why nothing is being rendered on the browser when I run "npm start" on my terminal and that webpack compiled successfully. To create a new React app, i used "npm init react-app what-is-context". Can anyone advise what could be wrong here? It is just an example on using contextAPI in React.

App.js

import "./App.css";
import { UserProvider, useUser } from "./UserContext";

const LoggedInUser = () => {
  const {user} = useUser();
  return (

      Hello {user.name}

  );
};

const Header = () => {
  return (

Blog App

      <LoggedInUser />

  );
};

const Page = () => {
  const {user} = useUser();
  return (

What is Lorem ipsum?

        In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available. It is also used to temporarily replace text in a process called greeking, which allows designers to consider the form of a webpage or publication, without the meaning of the text influencing the design.

Written by {user.name}

  )
}

function App() {
  return (

      <Page />

  );
};

function Root() {
  return (
    <UserProvider>
      <App />
    </UserProvider>
  );
}
export default Root;

UserContext.js

import { createContext, useContext, useState } from "react";

const UserContext = createContext(undefined);

export const UserProvider = ({children}) => {
    const [user] = useState({
        name: "John",
        email: "john@example.com",
        dob: "01/01/2000",
    })
    return <UserContext.Provider value={{ user }}></UserContext.Provider>;
};

export const useUser = () => useContext(UserContext);


问:
Parallelization of multi-step pipeline
I have troubles with making readable and highly parallelized pipeline in Java.

Background: I have ~10 step pipeline. Some steps call libraries, that do their own locking and admission controls (esp. for remote calls). I'd like to maximize the parallelism while preserving readability.

My implementation does it using Java streams:

```<code>return Stream
  .of("some input")
  .parallel()
  .map(x -> step1(param, x))
  .flatMap(Util2::step2)
  .map(Util3::step3)
  .flatMap(Util4::step4)
  .flatMap(Util5::step5)
  .map(x -> step6(x, somethingElse))
  // few more steps
  .toList();
</code>```

I really like the way this is expressed and it would probably work as expected if it didn't contain admission controls on the library level. Maybe because of that, it seems it's not utilizing CPU to the fullest and whole pipeline is really slow.

My load average is around 0.6 when running, so my system has performance to do more. I know step1 itself is fast, when I shorten the pipeline to do just that. Even then, I can see only first element of step1 to go to step2 for pretty long time - I guess it has to complete pipeline for that element before starting with the next one. Maybe it goes "DFS".

What I also tried:

```<code>// Shows still the same thread confirming my suspicion.
System.out.println("We're in " + Thread.currentThread().getName());
</code>```

And I also tried using a different executor, but it seems it also has no effects whatsoever, also confirmed by me getting thread names:

```<code>var executor = Executors.newFixedThreadPool(100);
var maybeResult = executor.submit(() -> Stream
  .of("some input")
  .parallel()
  .map(x -> step1(param, x))
  .flatMap(Util2::step2)
  ... and so on);
return maybeResult.get();
</code>```

I considered running custom thread for each step; one would also flatten the lists and so on. But it's much less readable when I just start writing that. And it's a lot of work.

I also tried using Flux from project reactor and the result seems to be the same.

Idea profiler shows me CPU usage (as far as I know/see) and thus is useless.

To exclude some issues in my setup:
I am running on 8 core CPU, running bare-metal on Ubuntu. Java program is directly executed from Idea, running Java Correto 17. And I'm running it as @ShellMethod from Spring Boot currently.
I try to keep my settings as default as possible, but I have pretty large system, so I cannot isolate it properly.
Suggesting debugging tools to find out what's blocking it, other frameworks or design is fine, I only cannot rewrite all the APIs.

Title: Parallelization of multi-step pipeline

Body:
I have troubles with making readable and highly parallelized pipeline in Java.

Background: I have ~10 step pipeline. Some steps call libraries, that do their own locking and admission controls (esp. for remote calls). I'd like to maximize the parallelism while preserving readability.

My implementation does it using Java streams:

return Stream
  .of("some input")
  .parallel()
  .map(x -> step1(param, x))
  .flatMap(Util2::step2)
  .map(Util3::step3)
  .flatMap(Util4::step4)
  .flatMap(Util5::step5)
  .map(x -> step6(x, somethingElse))
  // few more steps
  .toList();

I really like the way this is expressed and it would probably work as expected if it didn't contain admission controls on the library level. Maybe because of that, it seems it's not utilizing CPU to the fullest and whole pipeline is really slow.

My load average is around 0.6 when running, so my system has performance to do more. I know step1 itself is fast, when I shorten the pipeline to do just that. Even then, I can see only first element of step1 to go to step2 for pretty long time - I guess it has to complete pipeline for that element before starting with the next one. Maybe it goes "DFS".

What I also tried:

// Shows still the same thread confirming my suspicion.
System.out.println("We're in " + Thread.currentThread().getName());

And I also tried using a different executor, but it seems it also has no effects whatsoever, also confirmed by me getting thread names:

var executor = Executors.newFixedThreadPool(100);
var maybeResult = executor.submit(() -> Stream
  .of("some input")
  .parallel()
  .map(x -> step1(param, x))
  .flatMap(Util2::step2)
  ... and so on);
return maybeResult.get();

I considered running custom thread for each step; one would also flatten the lists and so on. But it's much less readable when I just start writing that. And it's a lot of work.

I also tried using Flux from project reactor and the result seems to be the same.

Idea profiler shows me CPU usage (as far as I know/see) and thus is useless.

To exclude some issues in my setup:
I am running on 8 core CPU, running bare-metal on Ubuntu. Java program is directly executed from Idea, running Java Correto 17. And I'm running it as @ShellMethod from Spring Boot currently.
I try to keep my settings as default as possible, but I have pretty large system, so I cannot isolate it properly.
Suggesting debugging tools to find out what's blocking it, other frameworks or design is fine, I only cannot rewrite all the APIs.


问:
Using macros for configuration while hiding source code?
Currently i am preparing a firmware application that will be used in a product for customers. However, the customer should be able to configure some of the parameters/settings before deploying the product. Unfortunately, the product, hence the firmware, is based off Espressif's ESP-IDF library and they define configurable parameters using macros like

```<code>CONFIG_BT_ENABLED=y
CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE=y
CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN=y
CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
CONFIG_BT_BTU_TASK_STACK_SIZE=4512
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
</code>```

And this means that everytime the customer needs to reconfigure, they have to recompile with modifications to the macro and that would mean they can see the source code.

Is there any tools for C/C++ or any methods that can allow the end user to configure and yet be unable to see the source code? Thanks.

Body:
Currently i am preparing a firmware application that will be used in a product for customers. However, the customer should be able to configure some of the parameters/settings before deploying the product. Unfortunately, the product, hence the firmware, is based off Espressif's ESP-IDF library and they define configurable parameters using macros like

CONFIG_BT_ENABLED=y
CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE=y
CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN=y
CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
CONFIG_BT_BTU_TASK_STACK_SIZE=4512
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y

And this means that everytime the customer needs to reconfigure, they have to recompile with modifications to the macro and that would mean they can see the source code.

Is there any tools for C/C++ or any methods that can allow the end user to configure and yet be unable to see the source code? Thanks.


问:
File: /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist
I am going to install dcap on my vm with kernel : Linux version 5.15.0-1029-azure (buildd@lcy02-amd64-076) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #36~20.04.1-Ubuntu SMP Tue Dec 6 17:00:26 UTC 2022 I tried the command sudo apt-get install libsgx-dcap-quote-verify-dev but I get error :

```<code>Reading package lists... Done
Building dependency tree
Reading state information... Done
libsgx-dcap-quote-verify-dev is already the newest version (1.15.100.3-focal1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-headers-5.15.0-1029-azure (5.15.0-1029.36~20.04.1) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-1029-azure
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist.
   ...fail!
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 4
dpkg: error processing package linux-headers-5.15.0-1029-azure (--configure):
 installed linux-headers-5.15.0-1029-azure package post-installation script subprocess returned error exit status 1
Setting up linux-image-5.15.0-1029-azure (5.15.0-1029.36~20.04.1) ...
Setting up linux-headers-5.4.0-135-generic (5.4.0-135.152) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.4.0-135-generic
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist.
   ...fail!
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 4
dpkg: error processing package linux-headers-5.4.0-135-generic (--configure):
 installed linux-headers-5.4.0-135-generic package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-headers-azure:
 linux-headers-azure depends on linux-headers-5.15.0-1029-azure; however:
  Package linux-headers-5.15.0-1029-azure is not configured yet.

dpkg: error processing package linux-headers-azure (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-azure:No apport report written because the error message indicates its a followup error from a previous failure.

 linux-azure depends on linux-headers-azure (= 5.15.0.1029.36~20.04.19); however:
  Package linux-headers-azure is not configured yet.

dpkg: error processing package linux-azure (--configure):
 dependency problems - leaving unconfigured
Processing triggers for linux-image-5.15.0-1029-azure (5.15.0-1029.36~20.04.1) ...No apport report written because MaxReports is reached already

/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-1029-azure
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist.
   ...fail!
run-parts: /etc/kernel/postinst.d/dkms exited with return code 4
dpkg: error processing package linux-image-5.15.0-1029-azure (--configure):
 installed linux-image-5.15.0-1029-azure package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-headers-5.15.0-1029-azure
 linux-headers-5.4.0-135-generic
 linux-headers-azure
 linux-azure
 linux-image-5.15.0-1029-azure
E: Sub-process /usr/bin/dpkg returned an error code (1)
</code>```

I think the main error comes from /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist. I have no idea why this error ocuurs do you have any solution for it?

Body:
I am going to install dcap on my vm with kernel : Linux version 5.15.0-1029-azure (buildd@lcy02-amd64-076) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #36~20.04.1-Ubuntu SMP Tue Dec 6 17:00:26 UTC 2022 I tried the command sudo apt-get install libsgx-dcap-quote-verify-dev but I get error :

Reading package lists... Done
Building dependency tree
Reading state information... Done
libsgx-dcap-quote-verify-dev is already the newest version (1.15.100.3-focal1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-headers-5.15.0-1029-azure (5.15.0-1029.36~20.04.1) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-1029-azure
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist.
   ...fail!
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 4
dpkg: error processing package linux-headers-5.15.0-1029-azure (--configure):
 installed linux-headers-5.15.0-1029-azure package post-installation script subprocess returned error exit status 1
Setting up linux-image-5.15.0-1029-azure (5.15.0-1029.36~20.04.1) ...
Setting up linux-headers-5.4.0-135-generic (5.4.0-135.152) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.4.0-135-generic
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist.
   ...fail!
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 4
dpkg: error processing package linux-headers-5.4.0-135-generic (--configure):
 installed linux-headers-5.4.0-135-generic package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-headers-azure:
 linux-headers-azure depends on linux-headers-5.15.0-1029-azure; however:
  Package linux-headers-5.15.0-1029-azure is not configured yet.

dpkg: error processing package linux-headers-azure (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-azure:No apport report written because the error message indicates its a followup error from a previous failure.

 linux-azure depends on linux-headers-azure (= 5.15.0.1029.36~20.04.19); however:
  Package linux-headers-azure is not configured yet.

dpkg: error processing package linux-azure (--configure):
 dependency problems - leaving unconfigured
Processing triggers for linux-image-5.15.0-1029-azure (5.15.0-1029.36~20.04.1) ...No apport report written because MaxReports is reached already

/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-1029-azure
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist.
   ...fail!
run-parts: /etc/kernel/postinst.d/dkms exited with return code 4
dpkg: error processing package linux-image-5.15.0-1029-azure (--configure):
 installed linux-image-5.15.0-1029-azure package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-headers-5.15.0-1029-azure
 linux-headers-5.4.0-135-generic
 linux-headers-azure
 linux-azure
 linux-image-5.15.0-1029-azure
E: Sub-process /usr/bin/dpkg returned an error code (1)

I think the main error comes from /var/lib/dkms/sgx/1.36.2/source/dkms.conf does not exist. I have no idea why this error ocuurs do you have any solution for it?


问:
How to deal with reporting slowly changing dimensions
For a client I am creating a data warehouse in which we have some slowly changing dimensions (or facts if that is even a thing?). For example we want to report the annually recurring revenue (ARR) for subscriptions and we want to have both the currently active and the expired subscriptions in there. So that we can see the ARR over a timeline.

The data we retrieve looks like this:

subscription_id
account_id
ARR
start_date
end_date

1
1
10
01-01-2022
31-03-2022

2
2
20
01-01-2022
31-12-2022

3
1
5
01-04-2022
31-11-2022

So in this case the same account (account_id 1) renewed a subscription at the 01-04-2022. In the report of 2022 we want to see the ARR for all months in 2022. I've looked into slowly changing dimensions, however something I can not really see in that concept is how to report both the currently active license and the history in a dashboard. If we for example want to visualize the ARR in all of 2022 per month in a dashboarding tool we want to see both subscriptions for account_id 1 over the course of the year, not just the currently active one. This seems to be very tricky to do in most dashboarding tools.

To overcome this I've done the following. I created a calendar table with an interval of 1 month and I cross join it with the table above to generate a fact table. The end result would look like:

timestamp
account_id
ARR

01-01-2022
1
10

01-01-2022
2
20

01-02-2022
1
10

...
...
...

01-11-2022
1
10

01-11-2022
2
20

01-11-2022
2
20

This makes it really easy for the user of the reporting tool to filter on a specific month and show the ARR between the dates and over multiple subscriptions. It does however generate a lot of extra data, but at the moment the storage space is not an issue. And it makes it more of a transactional style table, but the ARR is not really a transaction (i.e. it is not really a sold product on a specific date).

My question is: Are there better ways of generating a fact table where the source data contains a date range?


问:
I'm getting [no body] from exception message in spring boot application, how to remove it
When i write Junit tests for checking exception in my spring boot app , i'm getting exception message as below

404 Not Found: [no body]

How to remove [no body] from my response

my test case

```<code>    @Test
    public void whenLogout_thenReturnError(){
      mockServer.except(requestTo(MY_URL))
               .andExcept(method(POST))
               .andRespond(withStatus(HttpStatus.NOT_FOUND));
     try{
        service.logout(ACCESS_TOKEN);
        fail("Should Throw Exception");
     }catch(CustomError e){
        mockServer.verify();
        assertEquals("404 Not Found",e.getCause().getMessage());
     }
}
</code>```

CustomError

```<code>public class CustomError extends RuntimeException{

private final CustomErrorCode code;

public CustomError(WebMailErrorCode code){
    super(code.message());
    this.code = code;
}

public WebMailError(CustomErrorCode code,Exception e){
    super(code.message(),e);
    this.code = code;
}

public CustomErrorCode getCode() {
    return code;
}
</code>```

}

Body:
When i write Junit tests for checking exception in my spring boot app , i'm getting exception message as below

404 Not Found: [no body]

How to remove [no body] from my response

my test case

    @Test
    public void whenLogout_thenReturnError(){
      mockServer.except(requestTo(MY_URL))
               .andExcept(method(POST))
               .andRespond(withStatus(HttpStatus.NOT_FOUND));
     try{
        service.logout(ACCESS_TOKEN);
        fail("Should Throw Exception");
     }catch(CustomError e){
        mockServer.verify();
        assertEquals("404 Not Found",e.getCause().getMessage());
     }
}

CustomError

public class CustomError extends RuntimeException{

private final CustomErrorCode code;

public CustomError(WebMailErrorCode code){
    super(code.message());
    this.code = code;
}

public WebMailError(CustomErrorCode code,Exception e){
    super(code.message(),e);
    this.code = code;
}

public CustomErrorCode getCode() {
    return code;
}

}


问:
Encode HTTP-request body with gzip
When I send a request to HTTP server I can specify header
Accept-Encoding: br, gzip, deflate, and then server can compress the response body.

Is there a way to compress sent request the same way using curl or any other http client?

Title: Encode HTTP-request body with gzip


问:
android doesn't backup after reinstall while allowbackup is true
Android allowbackup doesn't work after uninstalling the app and reinstalling.

manifest:

```<code>    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
</code>```

FIRST install, MainActivity:

```<code>   //read. it prints 0 at first time as needed
   Log.d("temp", PreferenceManager.getDefaultSharedPreferences(context).getInt("temp", 0));

   // write 55 to "temp"
   SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        sharedPreferences.edit()
                .putInt("temp", 55)
                .commit();

   //read. it prints 55 as needed
   Log.d("temp", PreferenceManager.getDefaultSharedPreferences(context).getInt("temp", 0));
</code>```

At this time, I comment the 'write' line. Then I uninstall the app and reinstall.

```<code>   **//read. it prints 0 and not 55. why?**
   Log.d("temp", PreferenceManager.getDefaultSharedPreferences(context).getInt("temp", 0));
</code>```

data_extraction_rules.xml:

```<code><data-extraction-rules>
<cloud-backup>
    <include domain="sharedpref" path="."/>
    <!-- TODO: Use <include> and <exclude> to control what is backed up.
    <include .../>
    <exclude .../>
    -->
</cloud-backup>
<!--
<device-transfer>
    <include .../>
    <exclude .../>
</device-transfer>
-->
</code>```

backup_rules.xml:

```<code><full-backup-content>
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
</full-backup-content>
</code>```

Body:
Android allowbackup doesn't work after uninstalling the app and reinstalling.

manifest:

    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"

FIRST install, MainActivity:

   //read. it prints 0 at first time as needed
   Log.d("temp", PreferenceManager.getDefaultSharedPreferences(context).getInt("temp", 0));

   // write 55 to "temp"
   SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        sharedPreferences.edit()
                .putInt("temp", 55)
                .commit();

   //read. it prints 55 as needed
   Log.d("temp", PreferenceManager.getDefaultSharedPreferences(context).getInt("temp", 0));

At this time, I comment the 'write' line. Then I uninstall the app and reinstall.

   **//read. it prints 0 and not 55. why?**
   Log.d("temp", PreferenceManager.getDefaultSharedPreferences(context).getInt("temp", 0));

data_extraction_rules.xml:

<data-extraction-rules>
<cloud-backup>
    <include domain="sharedpref" path="."/>

</cloud-backup>

backup_rules.xml:

<full-backup-content>
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
</full-backup-content>