问:
ImagePullBackOff with Fluxcd on Private Autopilot GKE cluster
I'm starting with a new project, default VPC, and forked fluxcd/flux2-kustomize-helm-example github repository.

When I attempted to flux bootstrap into a clean new PRIVATE Autopilot K8s cluster, nothing became available (see below). The pods were stuck at ImagePullBackOff and the log traces looked like everything was in airplane mode.

I suspect I need to open up a Cloud NAT access to ghcr.io/fluxcd/helm-controller, github.com/fluxcd,  et. al. unless there is a fluxcd mirror within gcr.io.

```<code>NAME                                           READY   STATUS             RESTARTS   AGE
pod/helm-controller-57ff7dd7b5-nnpm8           0/1     ImagePullBackOff   0          4m50s
pod/kustomize-controller-9f9bf46d9-wzcdr       0/1     ImagePullBackOff   0          4m50s
pod/notification-controller-64496c6d67-g6wpx   0/1     ImagePullBackOff   0          4m50s
pod/source-controller-7467658dcb-t6bsp         0/1     ImagePullBackOff   0          4m50s

NAME                              TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)   AGE
service/notification-controller   ClusterIP   10.42.1.103   <none>        80/TCP    4m51s
service/source-controller         ClusterIP   10.42.3.58    <none>        80/TCP    4m51s
service/webhook-receiver          ClusterIP   10.42.1.217   <none>        80/TCP    4m51s

NAME                                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/helm-controller           0/1     1            0           4m51s
deployment.apps/kustomize-controller      0/1     1            0           4m51s
deployment.apps/notification-controller   0/1     1            0           4m51s
deployment.apps/source-controller         0/1     1            0           4m51s

NAME                                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/helm-controller-57ff7dd7b5           1         1         0       4m50s
replicaset.apps/kustomize-controller-9f9bf46d9       1         1         0       4m50s
replicaset.apps/notification-controller-64496c6d67   1         1         0       4m50s
replicaset.apps/source-controller-7467658dcb         1         1         0       4m50s
</code>```

Body:
I'm starting with a new project, default VPC, and forked fluxcd/flux2-kustomize-helm-example github repository.

When I attempted to flux bootstrap into a clean new PRIVATE Autopilot K8s cluster, nothing became available (see below). The pods were stuck at ImagePullBackOff and the log traces looked like everything was in airplane mode.

I suspect I need to open up a Cloud NAT access to ghcr.io/fluxcd/helm-controller, github.com/fluxcd,  et. al. unless there is a fluxcd mirror within gcr.io.

NAME                                           READY   STATUS             RESTARTS   AGE
pod/helm-controller-57ff7dd7b5-nnpm8           0/1     ImagePullBackOff   0          4m50s
pod/kustomize-controller-9f9bf46d9-wzcdr       0/1     ImagePullBackOff   0          4m50s
pod/notification-controller-64496c6d67-g6wpx   0/1     ImagePullBackOff   0          4m50s
pod/source-controller-7467658dcb-t6bsp         0/1     ImagePullBackOff   0          4m50s

NAME                              TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)   AGE
service/notification-controller   ClusterIP   10.42.1.103   <none>        80/TCP    4m51s
service/source-controller         ClusterIP   10.42.3.58    <none>        80/TCP    4m51s
service/webhook-receiver          ClusterIP   10.42.1.217   <none>        80/TCP    4m51s

NAME                                      READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/helm-controller           0/1     1            0           4m51s
deployment.apps/kustomize-controller      0/1     1            0           4m51s
deployment.apps/notification-controller   0/1     1            0           4m51s
deployment.apps/source-controller         0/1     1            0           4m51s

NAME                                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/helm-controller-57ff7dd7b5           1         1         0       4m50s
replicaset.apps/kustomize-controller-9f9bf46d9       1         1         0       4m50s
replicaset.apps/notification-controller-64496c6d67   1         1         0       4m50s
replicaset.apps/source-controller-7467658dcb         1         1         0       4m50s


来源: stackexchange

问:
(windows nvidia video codec sdk) How to set up an hevc encode session in c++ that asynchrnously encodes a dxgi surface texture and outputs to stdout?
I'm working on a c++ executable that grabs my display output using DXGI output duplication in the form of DXGI surface textures(I think), directly encodes it in HEVC using my GPU hardware encoder, which then downloads the bitstream to system memory so it can be output to stdout.

I would like to encode asynchronously, which is reported to be possible in the docs. As I understand it, asynchronously would mean a single blocking method call that accepts a video frame in gpu memory and returns a compressed frame (nal unit I think it's called)

The executable is part of a remote access implementation I'm working on and would be ran as a subprocess by a main golang app when the client connects and authenticates.

Here's my code so far:

```<code>

#include <iostream>

#pragma comment(lib, "d3d11")
#include <d3d11.h>

#pragma comment(lib, "dxgi")
#include <dxgi1_2.h>

//#include <nvEncodeAPI.h>

using namespace std;

int main()
{

    //NvEncodeAPICreateInstance();

    // intermediate variables for casting
    IDXGIOutput* pDisplay_old;

    IDXGIFactory1* pFactory;
    IDXGIAdapter* pGPU;
    ID3D11Device* pD3D;
    IDXGIOutput1* pDisplay;

    // create DXGI factory
    if (CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&pFactory) != S_OK) return 1;

    // get GPU adapter
    if (pFactory -> EnumAdapters(0, &pGPU) != S_OK) return 2;

    // create D3D11 device
    D3D_FEATURE_LEVEL D3DFeatures [6]
    {
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1,
        D3D_FEATURE_LEVEL_10_0,
        D3D_FEATURE_LEVEL_9_3,
        D3D_FEATURE_LEVEL_9_2,
        D3D_FEATURE_LEVEL_9_1
    };
    if (D3D11CreateDevice(pGPU, D3D_DRIVER_TYPE_UNKNOWN, NULL, 0, D3DFeatures, ARRAYSIZE(D3DFeatures), D3D11_SDK_VERSION, &pD3D, NULL, NULL) != S_OK) return 3;

    // get display
    if (pGPU -> EnumOutputs(0, &pDisplay_old) != S_OK) return 4;
    pDisplay_old -> QueryInterface(&pDisplay);

    IDXGIOutputDuplication* pCapture;
    DXGI_OUTDUPL_DESC captureDesc;

    DXGI_OUTDUPL_FRAME_INFO frameInfo;
    IDXGIResource* pFrame;

    HRESULT captureResult;
    do
    {
        // create capture

        if (pDisplay -> DuplicateOutput(pD3D, &pCapture) != S_OK) return 5;
        pCapture -> GetDesc(&captureDesc);

        cout << captureDesc.ModeDesc.Width << ' ' << captureDesc.ModeDesc.Height;

        do
        {
            captureResult = pCapture -> AcquireNextFrame(INFINITE, &frameInfo, &pFrame);
            if (captureResult == S_OK)
            {
                if (frameInfo.LastPresentTime.QuadPart != 0)
                {

                    // === async blocking Encode logic and printing to stdout should be here =========

                    // =========================================================

                }

                captureResult = pCapture -> ReleaseFrame();
            }
            else if (captureResult == DXGI_ERROR_ACCESS_LOST) break;
            else return 6;
        }
        while (true);
    }
    while (true);

}

</code>```

It successfully grabs the display framebuffer in the form of IDXGIResource objects, which I (pCapture is the pointer to them), and now I need to figure out how to setup the nvenc session, get it to accept these strange objects as frame input, and getting the output into system memoryin a form that can be printed to stdout. (ideally async as described above)

I had a look at the docs https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-video-encoder-api-prog-guide/index.html, and while it's reasonably descriptive, it doesn't seem to offer any code examples, and I couldn't find any examples online either.

I downloaded the SDK headers and tried some stuff but I feel that it would be better for those familiar to guide me through this.

Thanks!

ContentLicense: CC BY-SA 4.0

Body:
I'm working on a c++ executable that grabs my display output using DXGI output duplication in the form of DXGI surface textures(I think), directly encodes it in HEVC using my GPU hardware encoder, which then downloads the bitstream to system memory so it can be output to stdout.

I would like to encode asynchronously, which is reported to be possible in the docs. As I understand it, asynchronously would mean a single blocking method call that accepts a video frame in gpu memory and returns a compressed frame (nal unit I think it's called)

The executable is part of a remote access implementation I'm working on and would be ran as a subprocess by a main golang app when the client connects and authenticates.

Here's my code so far:

#include <iostream>

#pragma comment(lib, "d3d11")
#include <d3d11.h>

#pragma comment(lib, "dxgi")
#include <dxgi1_2.h>

//#include <nvEncodeAPI.h>

using namespace std;

int main()
{

    //NvEncodeAPICreateInstance();

    // intermediate variables for casting
    IDXGIOutput* pDisplay_old;

    IDXGIFactory1* pFactory;
    IDXGIAdapter* pGPU;
    ID3D11Device* pD3D;
    IDXGIOutput1* pDisplay;

    // create DXGI factory
    if (CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&pFactory) != S_OK) return 1;

    // get GPU adapter
    if (pFactory -> EnumAdapters(0, &pGPU) != S_OK) return 2;

    // create D3D11 device
    D3D_FEATURE_LEVEL D3DFeatures [6]
    {
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1,
        D3D_FEATURE_LEVEL_10_0,
        D3D_FEATURE_LEVEL_9_3,
        D3D_FEATURE_LEVEL_9_2,
        D3D_FEATURE_LEVEL_9_1
    };
    if (D3D11CreateDevice(pGPU, D3D_DRIVER_TYPE_UNKNOWN, NULL, 0, D3DFeatures, ARRAYSIZE(D3DFeatures), D3D11_SDK_VERSION, &pD3D, NULL, NULL) != S_OK) return 3;

    // get display
    if (pGPU -> EnumOutputs(0, &pDisplay_old) != S_OK) return 4;
    pDisplay_old -> QueryInterface(&pDisplay);

    IDXGIOutputDuplication* pCapture;
    DXGI_OUTDUPL_DESC captureDesc;

    DXGI_OUTDUPL_FRAME_INFO frameInfo;
    IDXGIResource* pFrame;

    HRESULT captureResult;
    do
    {
        // create capture

        if (pDisplay -> DuplicateOutput(pD3D, &pCapture) != S_OK) return 5;
        pCapture -> GetDesc(&captureDesc);

        cout << captureDesc.ModeDesc.Width << ' ' << captureDesc.ModeDesc.Height;

        do
        {
            captureResult = pCapture -> AcquireNextFrame(INFINITE, &frameInfo, &pFrame);
            if (captureResult == S_OK)
            {
                if (frameInfo.LastPresentTime.QuadPart != 0)
                {

                    // === async blocking Encode logic and printing to stdout should be here =========

                    // =========================================================

                }

                captureResult = pCapture -> ReleaseFrame();
            }
            else if (captureResult == DXGI_ERROR_ACCESS_LOST) break;
            else return 6;
        }
        while (true);
    }
    while (true);

}

It successfully grabs the display framebuffer in the form of IDXGIResource objects, which I (pCapture is the pointer to them), and now I need to figure out how to setup the nvenc session, get it to accept these strange objects as frame input, and getting the output into system memoryin a form that can be printed to stdout. (ideally async as described above)

I had a look at the docs https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-video-encoder-api-prog-guide/index.html, and while it's reasonably descriptive, it doesn't seem to offer any code examples, and I couldn't find any examples online either.

I downloaded the SDK headers and tried some stuff but I feel that it would be better for those familiar to guide me through this.

Thanks!


问:
Bibliography management : retrieve the corresponding authors
I have a bibliography dataframe, with article titles, authors, journals and DOI (example below)

noms_prenoms_des_auteurs
titre_de_larticle
reference_de_larticle_doi

SOEWARTO J, CARRICONDE F, HUGOT N, BOCS S, HAMELIN C, ET MAGGIA L
Impact of Austropuccinia psidii in New Caledonia, a biodiversity hotspot
https://doi.org/10.1111/efp.12402

THIBAULT M, VIDAL E, POTTER M, DYER E, ET BRESCIA F
The red-vented bulbul (Pycnonotus cafer): serious pest or understudied invader?
https://doi.org/10.1007/s10530-017-1521-2

I want to retrieve the corresponding author for each article.

My first plan was to scraping on web (by extract text or mail icon), but the html class are not the same for each site, and some sites seems to forbid scraping.

Do you have any idea to retrieve this information ?
Maybe with bibliography management packages ? (RefManage, rcrossref...).

Thanks for your answers !


问:
Extract data from scanned file into spreadsheet
I teach a course in which students submit assignments on paper. I write the grades by hand and in parallel, scan the files for archiving.

I would like to automate the grade entering process. One way might be to use handwriting recognition. A simpler alternative might be to have bubbles that I would fill in for the grade (like number of bubbles to indicate the points) and similarly, bubbles representing each student in the course.

My question is: is there a way to automate reading and analysis of the scanned files so that the bubbles on each page are read and exported to a text file/spreadsheet?

I don't know programming so I haven't tried coding this. I did evaluate pdf to excel solutions but nothing fit my need.


问:
Xamarin Forms: BLE Laerdal Dfu OTA. compilation problems
I am trying to get an App to work with OTA Nordic Dfu, and the only xamarin nuget I can find was the one made by Laerdal on GitHub

When I try to build under iOS I am getting a few error like this one here:

```<code>Error MT5211: Native linking failed, undefined Objective-C class: _TtC13iOSDFULibrary11DFUFirmware. The symbol '_OBJC_CLASS_$__TtC13iOSDFULibrary11DFUFirmware' could not be found in any of the libraries or frameworks linked with your application.
</code>```

A bug is open for this, but so far not a word from the people maintaining it.

I am left wondering if this is actually a local problem and not a problem with the nugget its self. So if any one out here is able to compile this under iOS help would be really appreciated.

Body:
I am trying to get an App to work with OTA Nordic Dfu, and the only xamarin nuget I can find was the one made by Laerdal on GitHub

When I try to build under iOS I am getting a few error like this one here:

Error MT5211: Native linking failed, undefined Objective-C class: _TtC13iOSDFULibrary11DFUFirmware. The symbol '_OBJC_CLASS_$__TtC13iOSDFULibrary11DFUFirmware' could not be found in any of the libraries or frameworks linked with your application.

A bug is open for this, but so far not a word from the people maintaining it.

I am left wondering if this is actually a local problem and not a problem with the nugget its self. So if any one out here is able to compile this under iOS help would be really appreciated.


问:
Can we remove SHA1 from our app in flutter firebase and add new SHA1
Can we remove SHA1 from our app in flutter firebase and add new SHA1? And if we change the directory of our app where all the project exist and create new project and paste it some where else then new SHA1 number is generated?</p>


问:
How to open/manage an archaic data files
I have an archaic database for books and their content to open. I can not figure out what database system or another program I should use to open it. the files have these extensions: tbx, ind, ofk and bin in a binary folder. This is the image of all files that I have in the directory:

Would you please let me know how to open/manage this data


问:
Find and delete similar records in Postgres
TL\DR version - Find and delete rows in Postgres with same date but different time, leaving one record per date.

Long read:
At some point we've migrated our app's backend to a newer version - this is a Django application - migrated from Python 2, Django 1.8 to Python 3 - Django 4, and with this update we're changed timezone for backend from UTC+2 to UTC+3. And now strange things happens - records which previously successfully have been read from db with queryset StatChildVisit.objects.filter(date=day, garden_group=garden_group) - (day is a python's date only not datetime) after update returns empty queryset, although records for that day are still in db. More so newly created records have different time in them - records created with old timezone looks like 2022-12-28 22:00:00.000000 +00:00 new records looks like 2022-12-28 21:00:00.000000 +00:00
Seems that bug happened because date field in django's model have been declared as DateTimeField -

```<code>class StatChildVisit(models.Model):
    child = models.ForeignKey(Child, on_delete=models.CASCADE)
    date = models.DateTimeField(default=timezone.now)
    visit = models.BooleanField(_('Atended'), default=True)
    disease = models.BooleanField(_('Sick'), default=False)
    other_approved = models.BooleanField(_('Other approved'), default=False)
    garden_group = models.ForeignKey(GardenGroup, verbose_name=_('Garden group'), editable=False, blank=True, null=True, on_delete=models.CASCADE)
    rossecure_visit = models.ForeignKey('rossecure.Visits', editable=False, null=True, blank=True, on_delete=models.CASCADE)

    class Meta:
        verbose_name = _('Attendence')
        verbose_name_plural = _('Attendence')
        index_together = (
            ('date', 'garden_group'),
        )
        unique_together = (
            ('date', 'child'),
        )
</code>```

all records are always being created with date only (not datetime) passing to constructor

So we've decided to migrate this field to DateField, but after migration field type in DB is still 'timestamp with time zone', and besides, because this is a production database users after finding that some data looks like lost partially recreated records.
So now we have multiple records for same day but with different time which need to be deleted and because of constrains table column can not be altered with ALTER TABLE reports_statchildvisit ALTER COLUMN date TYPE date;

Because table have rather large records count (about 4 million) I think that problem should be solved via SQL side, and not Django side. My plan is to delete duplicates and then change column type to date.

I've tried to alter records with

```<code>update reports_statchildvisit
set date = date(date) + '21:00:00'::time
</code>```

but because I've tried that after users created similar records script failed with ERROR: duplicate key value violates unique constraint

UPD: DDL on the SQL side looks like this:

create table public.reports_statchildvisit
(
    id                 serial
        primary key,
    date               timestamp with time zone not null,
    visit              boolean                  not null,
    disease            boolean                  not null,
    child_id           integer                  not null
        constraint reports_statchil_child_id_30fbdf92a34d3fea_fk_children_child_id
            references public.children_child
            deferrable initially deferred,
    garden_group_id    integer
        constraint repor_garden_group_id_ef61dd52421b5d2_fk_project_gardengroup_id
            references public.project_gardengroup
            deferrable initially deferred,
    other_approved     boolean                  not null,
    rossecure_visit_id integer
        constraint repo_rossecure_visit_id_488614f59207663f_fk_rossecure_visits_id
            references public.rossecure_visits
            deferrable initially deferred,
    constraint reports_statchildvisit_date_3d6916481fe1e727_uniq
        unique (date, child_id)
);

alter table public.reports_statchildvisit
    owner to django;

create index reports_statchildvisit_10e12719
    on public.reports_statchildvisit (garden_group_id);

create index reports_statchildvisit_42d2af72
    on public.reports_statchildvisit (rossecure_visit_id);

create index reports_statchildvisit_date_66064e65c46d4137_idx
    on public.reports_statchildvisit (date, garden_group_id);

create index reports_statchildvisit_f36263a3
    on public.reports_statchildvisit (child_id);
```

Body:
TL\DR version - Find and delete rows in Postgres with same date but different time, leaving one record per date.

Long read:
At some point we've migrated our app's backend to a newer version - this is a Django application - migrated from Python 2, Django 1.8 to Python 3 - Django 4, and with this update we're changed timezone for backend from UTC+2 to UTC+3. And now strange things happens - records which previously successfully have been read from db with queryset StatChildVisit.objects.filter(date=day, garden_group=garden_group) - (day is a python's date only not datetime) after update returns empty queryset, although records for that day are still in db. More so newly created records have different time in them - records created with old timezone looks like 2022-12-28 22:00:00.000000 +00:00 new records looks like 2022-12-28 21:00:00.000000 +00:00
Seems that bug happened because date field in django's model have been declared as DateTimeField -

class StatChildVisit(models.Model):
    child = models.ForeignKey(Child, on_delete=models.CASCADE)
    date = models.DateTimeField(default=timezone.now)
    visit = models.BooleanField(_('Atended'), default=True)
    disease = models.BooleanField(_('Sick'), default=False)
    other_approved = models.BooleanField(_('Other approved'), default=False)
    garden_group = models.ForeignKey(GardenGroup, verbose_name=_('Garden group'), editable=False, blank=True, null=True, on_delete=models.CASCADE)
    rossecure_visit = models.ForeignKey('rossecure.Visits', editable=False, null=True, blank=True, on_delete=models.CASCADE)

    class Meta:
        verbose_name = _('Attendence')
        verbose_name_plural = _('Attendence')
        index_together = (
            ('date', 'garden_group'),
        )
        unique_together = (
            ('date', 'child'),
        )

all records are always being created with date only (not datetime) passing to constructor

So we've decided to migrate this field to DateField, but after migration field type in DB is still 'timestamp with time zone', and besides, because this is a production database users after finding that some data looks like lost partially recreated records.
So now we have multiple records for same day but with different time which need to be deleted and because of constrains table column can not be altered with ALTER TABLE reports_statchildvisit ALTER COLUMN date TYPE date;

Because table have rather large records count (about 4 million) I think that problem should be solved via SQL side, and not Django side. My plan is to delete duplicates and then change column type to date.

I've tried to alter records with

update reports_statchildvisit
set date = date(date) + '21:00:00'::time

but because I've tried that after users created similar records script failed with ERROR: duplicate key value violates unique constraint

UPD: DDL on the SQL side looks like this:

create table public.reports_statchildvisit
(
    id                 serial
        primary key,
    date               timestamp with time zone not null,
    visit              boolean                  not null,
    disease            boolean                  not null,
    child_id           integer                  not null
        constraint reports_statchil_child_id_30fbdf92a34d3fea_fk_children_child_id
            references public.children_child
            deferrable initially deferred,
    garden_group_id    integer
        constraint repor_garden_group_id_ef61dd52421b5d2_fk_project_gardengroup_id
            references public.project_gardengroup
            deferrable initially deferred,
    other_approved     boolean                  not null,
    rossecure_visit_id integer
        constraint repo_rossecure_visit_id_488614f59207663f_fk_rossecure_visits_id
            references public.rossecure_visits
            deferrable initially deferred,
    constraint reports_statchildvisit_date_3d6916481fe1e727_uniq
        unique (date, child_id)
);

alter table public.reports_statchildvisit
    owner to django;

create index reports_statchildvisit_10e12719
    on public.reports_statchildvisit (garden_group_id);

create index reports_statchildvisit_42d2af72
    on public.reports_statchildvisit (rossecure_visit_id);

create index reports_statchildvisit_date_66064e65c46d4137_idx
    on public.reports_statchildvisit (date, garden_group_id);

create index reports_statchildvisit_f36263a3
    on public.reports_statchildvisit (child_id);


问:
Return an array in a specified order
Currently, I'm trying to figure out a method to obtain the GraphQL result in the exact same order as an argument (array) passed to the query.

I do not have the argument available to me beforehand.

Suppose I have the following query:

```<code>query GetProducts($productIds: [Int!]) {
    products(entityIds: $productIds) {
       data
    }
}
</code>```

I would like to obtain the result of $productIds, which isn't known or available to me prior to the query.

Desired result, simplified:

```<code>"data": {"id": 1...} {"id": 2...} {"id": 3...}
"argument": {"productIds": [3, 1, 2]}
</code>```

Title: Return an array in a specified order

Body:
Currently, I'm trying to figure out a method to obtain the GraphQL result in the exact same order as an argument (array) passed to the query.

I do not have the argument available to me beforehand.

Suppose I have the following query:

query GetProducts($productIds: [Int!]) {
    products(entityIds: $productIds) {
       data
    }
}

I would like to obtain the result of $productIds, which isn't known or available to me prior to the query.

Desired result, simplified:

"data": {"id": 1...} {"id": 2...} {"id": 3...}
"argument": {"productIds": [3, 1, 2]}


问:
How call the same function with join at Kotlin Coroutines?
That is what i'm trying to do; first showing items with loading progress in my ui, when is the api request returned as success then i'm manipulating my list for pass to recyclerview adapter.

So i need call repeatedly updateAndSetAdapterList function in coroutines.

Here is my code that calling same function in Fragment;

```<code>        lifecycleScope.launch(Dispatchers.IO) {
            // Videos
            viewModel.dashboardVideosFlow.collectLatest { flow ->
                when (flow) {
                    ...
                    is VideosFlow.DataReceived -> {
                        val row = SectionVideosBodyData(flow.videos)
                        updateAndSetAdapterList(1, row) <----
                    }
                }
            }
        }

        lifecycleScope.launch(Dispatchers.IO) {
            // Questions
            viewModel.dashboardQuestionsFlow.collectLatest { flow ->
                when (flow) {
                    ....
                    is QuestionsFlow.DataReceived -> {
                        val row = SectionQuestionsBodyData(flow.questions)
                        updateAndSetAdapterList(3, row) <----
                    }
                }
            }
        }
</code>```

And this is the function that does something first on background thread after on main thread;

```<code>private suspend fun updateAndSetAdapterList(indexAt: Int? = null, row: BaseAdapterData? = null) {

    lifecycleScope.launch(Dispatchers.IO) {
            val newRows = mutableListOf<BaseAdapterData>()
            newRows.addAll(rows)

            if (indexAt != null && row != null) {
                newRows.removeAt(indexAt)
                newRows.add(indexAt, row)
            }

            withContext(Dispatchers.Main) {
                dashboardAdapter.submitList(newRows)
            }

            rows = newRows
        }
    }
</code>```

I want to use synchronous api call functions but i want to use the ui update function as asynchronous that called from these synchronous functions.

Body:
That is what i'm trying to do; first showing items with loading progress in my ui, when is the api request returned as success then i'm manipulating my list for pass to recyclerview adapter.

So i need call repeatedly updateAndSetAdapterList function in coroutines.

Here is my code that calling same function in Fragment;

        lifecycleScope.launch(Dispatchers.IO) {
            // Videos
            viewModel.dashboardVideosFlow.collectLatest { flow ->
                when (flow) {
                    ...
                    is VideosFlow.DataReceived -> {
                        val row = SectionVideosBodyData(flow.videos)
                        updateAndSetAdapterList(1, row) <----
                    }
                }
            }
        }

        lifecycleScope.launch(Dispatchers.IO) {
            // Questions
            viewModel.dashboardQuestionsFlow.collectLatest { flow ->
                when (flow) {
                    ....
                    is QuestionsFlow.DataReceived -> {
                        val row = SectionQuestionsBodyData(flow.questions)
                        updateAndSetAdapterList(3, row) <----
                    }
                }
            }
        }

And this is the function that does something first on background thread after on main thread;

private suspend fun updateAndSetAdapterList(indexAt: Int? = null, row: BaseAdapterData? = null) {

    lifecycleScope.launch(Dispatchers.IO) {
            val newRows = mutableListOf<BaseAdapterData>()
            newRows.addAll(rows)

            if (indexAt != null && row != null) {
                newRows.removeAt(indexAt)
                newRows.add(indexAt, row)
            }

            withContext(Dispatchers.Main) {
                dashboardAdapter.submitList(newRows)
            }

            rows = newRows
        }
    }

I want to use synchronous api call functions but i want to use the ui update function as asynchronous that called from these synchronous functions.


问:
Using Modal Digits in Dynamic Link Elementor
Elementor button links and photos have short code capability; But when I put the Digits shortcode inside, it doesn't work properly.

I put the Digits code in the dynamic link of buttons and photos in Elementor, but it doesn't work.


问:
Saving Woocommerce Payment Gateway settings on a custom admin page
I'm trying to create a custom admin page which has Woocommerce Stripe Payment gateway options. Specifically just the Stripe API keys related fields. Reason for this is I need to limit access to Woocommerce settings pages and only want to expose very few things, so bringing just the few things to a custom page seems like the simplest thing.

However, this has been trickier than I expected. I've been trying to do this through extending WC_Payment_Gateway class, but this now seems like the wrong idea. Since I don't think I can extend a specific Gateway's class? I would basically need to rewrite the Stripe plugin I guess.

Also thinking there must be an easier way. Has anyone done this before?
Is it possible to create a settings forms with Woocommerce Settings API outside of the normal WC settings page?

Using this method, I didn't actually even get the form to print out, just the fields (i.e. no Submit button).

```<code>class WoocommerceStripeInt extends WC_Payment_Gateway
    {

        public function __construct () {

            $this->id           = 'stripe';
            $this->method_title = __( 'Stripe', 'woocommerce-gateway-stripe' );
            /* translators: 1) link to Stripe register page 2) link to Stripe api keys page */
            $this->method_description = __( 'Stripe works by adding payment fields on the checkout and then sending the details to Stripe for verification.', 'woocommerce-gateway-stripe' );
            $this->has_fields         = true;

            // Load the settings fields.
            $this->init_form_fields();

            // Load the settings.
            $this->init_settings();

            // Get setting values.
            $this->title        = $this->get_option( 'title' );
            $this->description  = $this->get_option( 'description' );
            $this->instructions = $this->get_option( 'instructions' );
            $this->order_status = $this->get_option( 'testmode' );

            add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));

        }

        /**
         * Initialise Gateway Settings Form Fields
         */
        function init_form_fields() {
            $this->form_fields = apply_filters(
                'wc_stripe_settings', array(
                    'testmode'                            => [
                        'title'       => __( 'Test mode', 'woocommerce-gateway-stripe' ),
                        'label'       => __( 'Enable Test Mode', 'woocommerce-gateway-stripe' ),
                        'type'        => 'checkbox',
                        'description' => __( 'Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe' ),
                        'default'     => 'yes',
                        'desc_tip'    => true,
                    ],
                    'test_publishable_key'                => [
                        'title'       => __( 'Test Publishable Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'text',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_test_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                    'test_secret_key'                     => [
                        'title'       => __( 'Test Secret Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'password',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_test_" or "rk_test_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                    'publishable_key'                     => [
                        'title'       => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'text',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_live_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                    'secret_key'                          => [
                        'title'       => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'password',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_live_" or "rk_live_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                )
            );
        }

        function admin_options() {
            ?>
            <h2><?php _e('Stripe Settings','woocommerce'); ?></h2>
            <table class="form-table">
            <?php $this->generate_settings_html(); ?>
            </table> <?php
        }

    }
</code>```

Any help would be appreciated, thanks.

Body:
I'm trying to create a custom admin page which has Woocommerce Stripe Payment gateway options. Specifically just the Stripe API keys related fields. Reason for this is I need to limit access to Woocommerce settings pages and only want to expose very few things, so bringing just the few things to a custom page seems like the simplest thing.

However, this has been trickier than I expected. I've been trying to do this through extending WC_Payment_Gateway class, but this now seems like the wrong idea. Since I don't think I can extend a specific Gateway's class? I would basically need to rewrite the Stripe plugin I guess.

Also thinking there must be an easier way. Has anyone done this before?
Is it possible to create a settings forms with Woocommerce Settings API outside of the normal WC settings page?

Using this method, I didn't actually even get the form to print out, just the fields (i.e. no Submit button).

class WoocommerceStripeInt extends WC_Payment_Gateway
    {

        public function __construct () {

            $this->id           = 'stripe';
            $this->method_title = __( 'Stripe', 'woocommerce-gateway-stripe' );
            /* translators: 1) link to Stripe register page 2) link to Stripe api keys page */
            $this->method_description = __( 'Stripe works by adding payment fields on the checkout and then sending the details to Stripe for verification.', 'woocommerce-gateway-stripe' );
            $this->has_fields         = true;

            // Load the settings fields.
            $this->init_form_fields();

            // Load the settings.
            $this->init_settings();

            // Get setting values.
            $this->title        = $this->get_option( 'title' );
            $this->description  = $this->get_option( 'description' );
            $this->instructions = $this->get_option( 'instructions' );
            $this->order_status = $this->get_option( 'testmode' );

            add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));

        }

        /**
         * Initialise Gateway Settings Form Fields
         */
        function init_form_fields() {
            $this->form_fields = apply_filters(
                'wc_stripe_settings', array(
                    'testmode'                            => [
                        'title'       => __( 'Test mode', 'woocommerce-gateway-stripe' ),
                        'label'       => __( 'Enable Test Mode', 'woocommerce-gateway-stripe' ),
                        'type'        => 'checkbox',
                        'description' => __( 'Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe' ),
                        'default'     => 'yes',
                        'desc_tip'    => true,
                    ],
                    'test_publishable_key'                => [
                        'title'       => __( 'Test Publishable Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'text',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_test_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                    'test_secret_key'                     => [
                        'title'       => __( 'Test Secret Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'password',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_test_" or "rk_test_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                    'publishable_key'                     => [
                        'title'       => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'text',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_live_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                    'secret_key'                          => [
                        'title'       => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
                        'type'        => 'password',
                        'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_live_" or "rk_live_" will be saved.', 'woocommerce-gateway-stripe' ),
                        'default'     => '',
                        'desc_tip'    => true,
                    ],
                )
            );
        }

        function admin_options() {
            ?>

<?php _e('Stripe Settings','woocommerce'); ?>

            <?php $this->generate_settings_html(); ?>

 <?php
        }

    }

Any help would be appreciated, thanks.


问:
Dashboard Bootstrap Components - Displaying Dropdown Menu based on viewport Size
As it stands, my navbar is composed as follows:

```<code>dbc.Navbar(
    dbc.Col(# logo is displayed here as div
        align="center",
        style={"display": "grid", "justify-content": "left"},
    ),
    dbc.Col(# app title is displayed here
        align="center",
        style={"display": "grid", "justify-content": "center"},
    ),
    dbc.NavbarToggler(id="navbar-toggler", n_clicks=0),
    dbc.Collapse(
        children=[right_elems],
        id="navbar-collapse",
        is_open=False,
        navbar = True
),
)
</code>```

For reference, the Toggler only shows on specific Viewport sizes.

The children right_elems in the layout are defined with style={"display": "grid", "justify-content": "right"}. Which is perfect when the NavbarToggler doesn't show, but when it does, I am able to change their position to center when the Toggler is clicked.

I achieve it with this:

```<code>app.clientside_callback(
   '''
   function toggle_navbar(n, is_open){
       let items = document.getElementByClassName("menu-item");
       if (n){
           for (var i=0, i < items.length; i++){
                items[i].style.justifyContent = "center";
            }
           return !is_open;
       }
       for (var i=0, i < items.length; i++){
            items[i].style.justifyContent = "right";
       }
       return is_open;
   }
   '''
   Output("navar-collapse", "is_open")
   [Input("navbar-toggler", "n_clicks")],
   [State("navbar-collapse", "is_open")],
)
</code>```

My problem now is that if the viewport is changed back to what is was without the Toggler showing, the right_elems stay with justify-content: center instead of going back to justify-content: right.

Is there a way to style the Menu items strictly when the menu is clicked and the right_elems show in said menu?

Body:
As it stands, my navbar is composed as follows:

dbc.Navbar(
    dbc.Col(# logo is displayed here as div
        align="center",
        style={"display": "grid", "justify-content": "left"},
    ),
    dbc.Col(# app title is displayed here
        align="center",
        style={"display": "grid", "justify-content": "center"},
    ),
    dbc.NavbarToggler(id="navbar-toggler", n_clicks=0),
    dbc.Collapse(
        children=[right_elems],
        id="navbar-collapse",
        is_open=False,
        navbar = True
),
)

For reference, the Toggler only shows on specific Viewport sizes.

The children right_elems in the layout are defined with style={"display": "grid", "justify-content": "right"}. Which is perfect when the NavbarToggler doesn't show, but when it does, I am able to change their position to center when the Toggler is clicked.

I achieve it with this:

app.clientside_callback(
   '''
   function toggle_navbar(n, is_open){
       let items = document.getElementByClassName("menu-item");
       if (n){
           for (var i=0, i < items.length; i++){
                items[i].style.justifyContent = "center";
            }
           return !is_open;
       }
       for (var i=0, i < items.length; i++){
            items[i].style.justifyContent = "right";
       }
       return is_open;
   }
   '''
   Output("navar-collapse", "is_open")
   [Input("navbar-toggler", "n_clicks")],
   [State("navbar-collapse", "is_open")],
)

My problem now is that if the viewport is changed back to what is was without the Toggler showing, the right_elems stay with justify-content: center instead of going back to justify-content: right.

Is there a way to style the Menu items strictly when the menu is clicked and the right_elems show in said menu?


问:
Pinterest API: Access to XMLHttpRequest blocked by CORS policy
Trying to access the pinterest API in my Next.js / React app, but it won't work:

```<code> const redirectUrl = 'http://localhost:3000/pinterest';
    const clientId = '1234';
    const clientSecret = 'XXXXXXXXXXX';

    let url = 'https://api.pinterest.com/v5/oauth/token';
    let body = {
        'code': code,
        'grant_type': 'authorization_code',
        'redirect_uri': redirectUrl
    };

    let accessTokenRequestBody = Object.keys(body)
        .map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(body[k])}`)
        .join('&');

    // console.log(`RequestBody=${JSON.stringify(accessTokenRequestBody, null, 2)}`);
    // console.log(accessTokenRequestBody);

    const clientIdAndSecretBase64 = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');

    try {

        let response = await axios.post(url, accessTokenRequestBody, {
            "headers": {
                'Content-Type': 'application/x-www-form-urlencoded', //; charset=UTF-8
                'Authorization': `Basic ${clientIdAndSecretBase64}`
            }
        })

        console.log(response)
    } catch (e) {
        console.log("error")
        console.log(e?.reponse?.data)
    }
</code>```

The error I get is:

Access to XMLHttpRequest at 'https://api.pinterest.com/v5/oauth/token' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I don't fully understand though, as I have localhost:3000 and localhost:3000/pinterest in my pinterest apps whitelist.

What else could be the culprit here?

Body:
Trying to access the pinterest API in my Next.js / React app, but it won't work:

 const redirectUrl = 'http://localhost:3000/pinterest';
    const clientId = '1234';
    const clientSecret = 'XXXXXXXXXXX';

    let url = 'https://api.pinterest.com/v5/oauth/token';
    let body = {
        'code': code,
        'grant_type': 'authorization_code',
        'redirect_uri': redirectUrl
    };

    let accessTokenRequestBody = Object.keys(body)
        .map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(body[k])}`)
        .join('&');

    // console.log(`RequestBody=${JSON.stringify(accessTokenRequestBody, null, 2)}`);
    // console.log(accessTokenRequestBody);

    const clientIdAndSecretBase64 = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');

    try {

        let response = await axios.post(url, accessTokenRequestBody, {
            "headers": {
                'Content-Type': 'application/x-www-form-urlencoded', //; charset=UTF-8
                'Authorization': `Basic ${clientIdAndSecretBase64}`
            }
        })

        console.log(response)
    } catch (e) {
        console.log("error")
        console.log(e?.reponse?.data)
    }

The error I get is:

Access to XMLHttpRequest at 'https://api.pinterest.com/v5/oauth/token' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I don't fully understand though, as I have localhost:3000 and localhost:3000/pinterest in my pinterest apps whitelist.

What else could be the culprit here?


问:
How do I make the text scroll continously
I have no code to show yet because I have no idea how to do that... my question is: How do I make the text scroll continously i.e., as soon the line 9 is getting up, rather  show the blank space, show the contents of line 1 and so on, so there's no empty space. I supposed to do that with JS, I guess but I don't know how to get those offsets or show the contents from top right after the bottom lines is moving up... my current code goes like this:

#jobs_container {
  background: transparent;
  width: 600px;
  height: 300px;
  border: 3px solid #e4e4e4;
  border-radius: 12px;
  border-style: dashed;
  padding: 1px;
  font-size: 12px;
}

#jobs_header {
  display: flex;
  justify-content: space-between;
  height: 25px;
  background-color: #e4e4e4;
  border-radius: 12px 12px 0 0;
  padding: 1rem;
}
#jobs_header_left {
  display: flex;
  align-items: center;

}
#jobs_header_left > span {
  padding-right: 4px;
    cursor: pointer;
  color: #0048FF;
}
#jobs_header_center {
    text-align: center;
    font: 20px Verdana;
    color: darkblue;
}

#jobs_header_right {
  display: flex;
  align-items: center;

}
#jobs_today {
  margin-inline: 5px;
  cursor: pointer;
  color: #0048FF;
}
#jobs_nextButton {
  background: transparent;
  border: none;
  padding: 0px 3px;
  cursor: pointer;
}

#jobs_prevButton {
  background: transparent;
  border: none;
  transform: scaleX(-1);
  padding: 0px 3px;
  cursor: pointer;
}

#jobs_content {
  font-style: calibre;
  margin-left: 10px;
  margin-top: 10px;
  position: relative;
  overflow-x: scroll;
  max-height: 300px;
  text-align: justify;
}

#jobs_content #jobs_listOfEvents {
    overflow: hidden;
    animation-name: jobs_agendaSlide;
    animation-duration: 25s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    position: relative;
}

#jobs_listOfEvents:hover {
  animation-play-state: paused;
}

@keyframes jobs_agendaSlide {
    from {
        top: 10px;
    }

    to {
        top: -200px;
    }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code>    <div id="jobs_container">
    <div id="jobs_header">
      <div id="jobs_header_left">
      </div>
      <div id="jobs_header_center">
        Center text
      </div>
      <div id="jobs_header_right">
      </div>
    </div>
      <div id="jobs_content">
          <div id="jobs_listOfEvents">
            line1<hr>
            line2<hr>
            line3<hr>
            line4<hr>
            line5<hr>
            line6<hr>
            line7<hr>
            line8<hr>
            line9<hr>
          </div>
      </div>
  </div></code>```

Body:
I have no code to show yet because I have no idea how to do that... my question is: How do I make the text scroll continously i.e., as soon the line 9 is getting up, rather  show the blank space, show the contents of line 1 and so on, so there's no empty space. I supposed to do that with JS, I guess but I don't know how to get those offsets or show the contents from top right after the bottom lines is moving up... my current code goes like this:

#jobs_container {
  background: transparent;
  width: 600px;
  height: 300px;
  border: 3px solid #e4e4e4;
  border-radius: 12px;
  border-style: dashed;
  padding: 1px;
  font-size: 12px;
}

#jobs_header {
  display: flex;
  justify-content: space-between;
  height: 25px;
  background-color: #e4e4e4;
  border-radius: 12px 12px 0 0;
  padding: 1rem;
}
#jobs_header_left {
  display: flex;
  align-items: center;

}
#jobs_header_left > span {
  padding-right: 4px;
    cursor: pointer;
  color: #0048FF;
}
#jobs_header_center {
    text-align: center;
    font: 20px Verdana;
    color: darkblue;
}

#jobs_header_right {
  display: flex;
  align-items: center;

}
#jobs_today {
  margin-inline: 5px;
  cursor: pointer;
  color: #0048FF;
}
#jobs_nextButton {
  background: transparent;
  border: none;
  padding: 0px 3px;
  cursor: pointer;
}

#jobs_prevButton {
  background: transparent;
  border: none;
  transform: scaleX(-1);
  padding: 0px 3px;
  cursor: pointer;
}

#jobs_content {
  font-style: calibre;
  margin-left: 10px;
  margin-top: 10px;
  position: relative;
  overflow-x: scroll;
  max-height: 300px;
  text-align: justify;
}

#jobs_content #jobs_listOfEvents {
    overflow: hidden;
    animation-name: jobs_agendaSlide;
    animation-duration: 25s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    position: relative;
}

#jobs_listOfEvents:hover {
  animation-play-state: paused;
}

@keyframes jobs_agendaSlide {
    from {
        top: 10px;
    }

    to {
        top: -200px;
    }
}

        Center text

            line1

            line2

            line3

            line4

            line5

            line6

            line7

            line8

            line9


问:
Environment variable equivalent for Next.js static HTML exports
I am serving a static HTML exported next.js app in a docker image with nginx. However, I need to make some variables configurable after the image is build (I am not saying runtime since there isn't a run actually, nginx is serving staticly built HTML, JS and CSS files). Since the environment variables are processed during the build, changing them is not an option. Is there a way to make some variables configurable for this scenario?</p>


问:
Insert A xref component view into Autocad-ME
I been trying to figure out how to import an xref view into my dwg in VBA Autocad-ME.
I have found code online that use .AttachExternalReference. But this only attaches the whole drawing and not an specific component. I do even know if this is possible in Autocad ME. But it should be something simple enough that there most be a way to do. If any of you know, I would appreciate the help.

I attached the example I started with, but it is not quite doing what I am looking for.

```<code>Sub Example_AttachExternalReference()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This example displays all the blocks in the current drawing
' before and after adding an external reference.
'
' This example uses the "city map.dwg" found in the Sample
' directory. If you do not have this drawing, or if it is
' in a different directory, insert a valid path and file name
' for the PathName variable below.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Dim ThisDrawing As AcadDocument
    Dim InsertPoint(0 To 2) As Double
    'Dim insertedBlock As AcadExternalReference
    Dim insertedBlock As Object
    Dim tempBlock As acadBlock
    Dim msg As String, PathName As String
    Dim InsertionPoint(0 To 2)  As Double
    Dim blockname As String

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Set ThisDrawing = AcadApplication.ActiveDocument
    ' Define external reference to be inserted
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    PathName = "C:\Users\jomartinez\Desktop\happyFace.dwg"
    blockname = "nameOfBlock"
    ' Display current Block information for this drawing
    'GoSub ListBlocks

    ' Add the external reference to the drawing
    Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "XREF_IMAGE", InsertPoint, 1, 1, 1, 0, False)
    'Set tempBlock = ThisDrawing.ModelSpace.InsertBlock(InsertionPoint, blockname, _
                                1, 1, 1, 0 * 0.0174532925)
    ThisDrawing.Application.ZoomAll

End Sub
</code>```

Body:
I been trying to figure out how to import an xref view into my dwg in VBA Autocad-ME.
I have found code online that use .AttachExternalReference. But this only attaches the whole drawing and not an specific component. I do even know if this is possible in Autocad ME. But it should be something simple enough that there most be a way to do. If any of you know, I would appreciate the help.

I attached the example I started with, but it is not quite doing what I am looking for.

Sub Example_AttachExternalReference()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This example displays all the blocks in the current drawing
' before and after adding an external reference.
'
' This example uses the "city map.dwg" found in the Sample
' directory. If you do not have this drawing, or if it is
' in a different directory, insert a valid path and file name
' for the PathName variable below.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Dim ThisDrawing As AcadDocument
    Dim InsertPoint(0 To 2) As Double
    'Dim insertedBlock As AcadExternalReference
    Dim insertedBlock As Object
    Dim tempBlock As acadBlock
    Dim msg As String, PathName As String
    Dim InsertionPoint(0 To 2)  As Double
    Dim blockname As String

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Set ThisDrawing = AcadApplication.ActiveDocument
    ' Define external reference to be inserted
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    PathName = "C:\Users\jomartinez\Desktop\happyFace.dwg"
    blockname = "nameOfBlock"
    ' Display current Block information for this drawing
    'GoSub ListBlocks

    ' Add the external reference to the drawing
    Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "XREF_IMAGE", InsertPoint, 1, 1, 1, 0, False)
    'Set tempBlock = ThisDrawing.ModelSpace.InsertBlock(InsertionPoint, blockname, _
                                1, 1, 1, 0 * 0.0174532925)
    ThisDrawing.Application.ZoomAll

End Sub


问:
SOLR: Is it possible to set a different offset for each group if you know the groups that will be returned?
Example: Group by status where status contains the possible variables of 'complete' or 'in progress', set offset for 'complete': 0, offset for 'in progress': 10.

Group offset sets offset for all groups which is not what I need for my use case.


问:
What is the difference between String and String? in dart?
```<code>String name = stdin.readLineSync();
</code>```

in the line above an error is shown that says

```<code>("A value of type 'String?' can't be assigned to a variable of type 'String'.
Try changing the type of the variable, or casting the right-hand type to 'String'.dartinvalid_assignment")
</code>```

so please what is the difference between String and String?.

I changed the String to String? and it worked but I want to know the difference between the two data types.

Body:
String name = stdin.readLineSync();

in the line above an error is shown that says

("A value of type 'String?' can't be assigned to a variable of type 'String'.
Try changing the type of the variable, or casting the right-hand type to 'String'.dartinvalid_assignment")

so please what is the difference between String and String?.

I changed the String to String? and it worked but I want to know the difference between the two data types.


问:
Check if server is running and restart it
I run a NodeJS server on a cloud Virtual Private Server. Sometimes I have a coding error and now Node exits the process and my website becomes unavailable. I would like to restart it automatically as soon as possible.

One option is forever (from this answer), but then I can't monitor if forever itself is running. (Also, it didn't run the server when I tried it.)

I tried cron checking every minute and restarting it, but it also fails and I don't understand why. Here is the cron task:

```<code>* * * * * running=$(lsof -i :8443); [[ "" == "$running" ]] && /opt/bitnami/node/bin/node app.js  >> /path/to/stdout/log 2>> /path/to/stderr/log &
</code>```

How can I restart the server soon after it hangs?

Body:
I run a NodeJS server on a cloud Virtual Private Server. Sometimes I have a coding error and now Node exits the process and my website becomes unavailable. I would like to restart it automatically as soon as possible.

One option is forever (from this answer), but then I can't monitor if forever itself is running. (Also, it didn't run the server when I tried it.)

I tried cron checking every minute and restarting it, but it also fails and I don't understand why. Here is the cron task:

* * * * * running=$(lsof -i :8443); [[ "" == "$running" ]] && /opt/bitnami/node/bin/node app.js  >> /path/to/stdout/log 2>> /path/to/stderr/log &

How can I restart the server soon after it hangs?


问:
Accuracy and Loss Plots for Tensorflow Model 2.0
I am following this tutorial https://www.youtube.com/watch?v=amURyS6CAaY exactly on training a TensorFlow model with a custom dataset. I tried adding a Tensorboard however it does not show the accuracy and loss by epoch. The issue with the below code is that it is only plotting 1 point instead of the loss over each epoch. How can this be fixed?

Here is my attempted code which is added to https://colab.research.google.com/drive/1QCU_dCR0ozI8j6X2btEDCsaUk5p_b1uw?usp=sharing:

```<code>logger = 'TensorBoard' #@param ['TensorBoard']

if logger == 'TensorBoard':
  %load_ext tensorboard
  %tensorboard --logdir '/content/gdrive/MyDrive/Colab_Notebooks/customTF2/training'
</code>```

Current Result:

Expected Result:

source: TensorBoard - Plot training and validation losses on the same graph?

Body:
I am following this tutorial https://www.youtube.com/watch?v=amURyS6CAaY exactly on training a TensorFlow model with a custom dataset. I tried adding a Tensorboard however it does not show the accuracy and loss by epoch. The issue with the below code is that it is only plotting 1 point instead of the loss over each epoch. How can this be fixed?

Here is my attempted code which is added to https://colab.research.google.com/drive/1QCU_dCR0ozI8j6X2btEDCsaUk5p_b1uw?usp=sharing:

logger = 'TensorBoard' #@param ['TensorBoard']

if logger == 'TensorBoard':
  %load_ext tensorboard
  %tensorboard --logdir '/content/gdrive/MyDrive/Colab_Notebooks/customTF2/training'

Current Result:

Expected Result:

source: TensorBoard - Plot training and validation losses on the same graph?


问:
JAVA: Get jar from github and parse as zip goes wrong with encoding
So im using kohsuke's library to read files from GitHub and my idea is to list a bunch of jar files in a git folder to then find inside the file "fabric.mod.json" and return a list of all the variables "id" from all the jsons in the folder. Here is my code:

```<code>    public static void main(String[] args) throws Exception {
        GitHub github = GitHub.connectAnonymously();
        GHRepository repository = github.getRepository("LIUKRAST/PersonalMods");
        List<GHContent> contents = repository.getDirectoryContent("moddedserver/mods", "main");
        for (GHContent content : contents) {
            System.out.println(content.getName());
            if (content.getName().endsWith(".jar")) {
                System.out.println(content.getEncoding());
                InputStream is = content.read();
                ZipInputStream zis = new ZipInputStream(is);
                ZipEntry entry;
                while ((entry = zis.getNextEntry()) != null) {
                    String name = entry.getName();
                    if (name.equals("fabric.mod.json")) {
                        String json = readEntryAsString(zis);
                        JSONObject obj = new JSONObject(json);
                        String modId = obj.getString("id");
                        System.out.println("It is a mod! MODID:" + modId);
                        break;
                    }
                }
                is.close();
                zis.close();
            }
        }
    }

    public static String readEntryAsString(ZipInputStream zis) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(zis));
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            sb.append(line);
        }
        return sb.toString();
    }
</code>```

It works fine with some files, but other jar files return this error:

```<code>Exception in thread "main" java.lang.UnsupportedOperationException: Unrecognized encoding: none
    at org.kohsuke.github.GHContent.read(GHContent.java:198)
    at Main.main(Main.java:23)
</code>```

It means that the encoding is null, but how is that possible? And how can i change the jar encoding?

I expected to see a list of all the ids, without errors

Body:
So im using kohsuke's library to read files from GitHub and my idea is to list a bunch of jar files in a git folder to then find inside the file "fabric.mod.json" and return a list of all the variables "id" from all the jsons in the folder. Here is my code:

    public static void main(String[] args) throws Exception {
        GitHub github = GitHub.connectAnonymously();
        GHRepository repository = github.getRepository("LIUKRAST/PersonalMods");
        List<GHContent> contents = repository.getDirectoryContent("moddedserver/mods", "main");
        for (GHContent content : contents) {
            System.out.println(content.getName());
            if (content.getName().endsWith(".jar")) {
                System.out.println(content.getEncoding());
                InputStream is = content.read();
                ZipInputStream zis = new ZipInputStream(is);
                ZipEntry entry;
                while ((entry = zis.getNextEntry()) != null) {
                    String name = entry.getName();
                    if (name.equals("fabric.mod.json")) {
                        String json = readEntryAsString(zis);
                        JSONObject obj = new JSONObject(json);
                        String modId = obj.getString("id");
                        System.out.println("It is a mod! MODID:" + modId);
                        break;
                    }
                }
                is.close();
                zis.close();
            }
        }
    }

    public static String readEntryAsString(ZipInputStream zis) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(zis));
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            sb.append(line);
        }
        return sb.toString();
    }

It works fine with some files, but other jar files return this error:

Exception in thread "main" java.lang.UnsupportedOperationException: Unrecognized encoding: none
    at org.kohsuke.github.GHContent.read(GHContent.java:198)
    at Main.main(Main.java:23)

It means that the encoding is null, but how is that possible? And how can i change the jar encoding?

I expected to see a list of all the ids, without errors


问:
Docker [Errno 13] Permission denied with custom user
I am trying to create a docker image and here is my current Dockerfile.

Dockerfile:

```<code>FROM path-to-internal-images/python:3.8
RUN adduser --system myuser
WORKDIR /home/myuser
COPY requirements.txt .
RUN pip install -i https://myendpoint/api/pypi/pypi-abc/simple -r requirements.txt
COPY myfile.py .
USER myuser
</code>```

Build and Run the container:

```<code>$ IMG_TAG="docker.abc.com/my-image:0.1"
$ docker build -t ${IMG_TAG} .
$ docker push ${IMG_TAG}
$docker run --rm -it ${IMG_TAG} /bin/bash

myuser@ mymachine:~$ pwd
  /home/myuser
myuser@mymachine:~$ python myfile.py --output-path <PATH_TO_A_DIRECTORY>
</code>```

In myfile.py I accept --output-path as an argument which is path to a directory (e.g. /output) and this could be any value and then it creates a directory using this path provided. However, since I am using myuser and not root I get following error:

```<code>  File "myfile.py", line 20, in write_function
    os.makedirs(dir, exist_ok=True)
  File "/usr/local/lib/python3.8/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/local/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/output'
</code>```

My question is: Is it possible to use myuser and still be able to create directory structure based on the argument passed when myfile.py is called when the container is running? I don't think I can use RUN chown here as I do not know the directory upfront, is there any other way to achieve this?

I am relatively new to containerization and docker, so any pointers would help.

Body:
I am trying to create a docker image and here is my current Dockerfile.

Dockerfile:

FROM path-to-internal-images/python:3.8
RUN adduser --system myuser
WORKDIR /home/myuser
COPY requirements.txt .
RUN pip install -i https://myendpoint/api/pypi/pypi-abc/simple -r requirements.txt
COPY myfile.py .
USER myuser

Build and Run the container:

$ IMG_TAG="docker.abc.com/my-image:0.1"
$ docker build -t ${IMG_TAG} .
$ docker push ${IMG_TAG}
$docker run --rm -it ${IMG_TAG} /bin/bash

myuser@ mymachine:~$ pwd
  /home/myuser
myuser@mymachine:~$ python myfile.py --output-path <PATH_TO_A_DIRECTORY>

In myfile.py I accept --output-path as an argument which is path to a directory (e.g. /output) and this could be any value and then it creates a directory using this path provided. However, since I am using myuser and not root I get following error:

  File "myfile.py", line 20, in write_function
    os.makedirs(dir, exist_ok=True)
  File "/usr/local/lib/python3.8/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/local/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/output'

My question is: Is it possible to use myuser and still be able to create directory structure based on the argument passed when myfile.py is called when the container is running? I don't think I can use RUN chown here as I do not know the directory upfront, is there any other way to achieve this?

I am relatively new to containerization and docker, so any pointers would help.


问:
Tweepy: scrape tweets based on a certain time interval with certain hashtags and location info
I'm trying to scrape tweets about Russia-Ukraine war including certain hashtags. I want to scraper tweets between Jan 2022 - Dec 2022 shared in USA and BR. I have elevated tw developer account. How can I do this?  I used snscrape but it scrapes loc info from users' bio and is not structured.</p>


问:
How to obtain a list of instance properties for a given type without creating instances?
```<code>class A:
    def __init__(self):
        self.a = "value"

    @classmethod
    def get_instance_properties(cls):
        print(function_of_interest(cls))  # ["a"] or {"a": "value"}.
</code>```

Looking for an implementation of function_of_interest() that produces one of the results mentioned in the comment.

Body:
class A:
    def __init__(self):
        self.a = "value"

    @classmethod
    def get_instance_properties(cls):
        print(function_of_interest(cls))  # ["a"] or {"a": "value"}.

Looking for an implementation of function_of_interest() that produces one of the results mentioned in the comment.


问:
How can I change where pytorch looks for my Cuda installation?
I'm trying to run stable diffusion locally using Windows 10 but I'm having trouble with my cuda and pytorch installations. I've tested the Cuda install (adding some vectors) and it works, yet pytorch claims it's not available.

Can I reset pytorch? How can I change where python or pytorch is looking for Cuda?

I am able to see that Cuda is installed using 'nvcc --version'

```<code>C:\Users\Nolasaurus\OneDrive\Python\stable-diffusion>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_19:00:59_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0
</code>```

but pytorch returns not available.

```<code>>>> import torch
>>> torch.cuda.is_available()
False
</code>```

I have uninstalled and re-installed pytorch with no change.

Body:
I'm trying to run stable diffusion locally using Windows 10 but I'm having trouble with my cuda and pytorch installations. I've tested the Cuda install (adding some vectors) and it works, yet pytorch claims it's not available.

Can I reset pytorch? How can I change where python or pytorch is looking for Cuda?

I am able to see that Cuda is installed using 'nvcc --version'

C:\Users\Nolasaurus\OneDrive\Python\stable-diffusion>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_May__3_19:00:59_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0

but pytorch returns not available.

>>> import torch
>>> torch.cuda.is_available()
False

I have uninstalled and re-installed pytorch with no change.


问:
How to automate page redrawing at a certain interval using JS?
I am writing a web page for an RFID access control system, and I need to implement automatic redrawing on the main page where the last action is displayed (for example, so that you don't have to manually refresh the page when a person has passed to see information about him).

My part of the data page:

```<code><#macro tbody>
        <#list activities as activity>
        <tr>
            <td>${activity.scannerHardwareNum}</td>
            <td>${activity.formattedEnterActivity}</td>
            <td onclick="goTo('user/get/${activity.user.userId}')">${activity.user.surname} ${activity.user.name} ${activity.user.patronymic}</td>
        </tr>
    </#list>
</#macro>

<#macro content>
    <script>
        setInterval(() => goTo('start') , 3000)
    </script>
    <@table caption="Last activity"/>
</#macro>
</code>```

At first, I tried to implement it using an ajax request:

```<code>function goTo(link) {
    $.ajax({
        url: "http://localhost:" + getPort() + "/" + link,
        type: "GET",
        success: function () {
            console.log('OK');
        },
        error: function (response) {
            console.log(this.url)
            alert(response);
        }
    })
}
</code>```

But the data was not updated, I assumed that this was due to the fact that my data comes using a template engine and when redrawing the page, new data does not come, since there is no new request for them.

As a result, I implemented this simply using a JS script to navigate to the same page:

```<code>function goTo(link) {
    let port = getPort();
    console.log('http://localhost:' + port + '/' + link);
    window.location.href = 'http://localhost:' + port + '/' + link;
}
</code>```

But now the page is being updated, and I would like to complete this task without updating, if it possible.

Body:
I am writing a web page for an RFID access control system, and I need to implement automatic redrawing on the main page where the last action is displayed (for example, so that you don't have to manually refresh the page when a person has passed to see information about him).

My part of the data page:

<#macro tbody>
        <#list activities as activity>

            ${activity.scannerHardwareNum}
            ${activity.formattedEnterActivity}
            ${activity.user.surname} ${activity.user.name} ${activity.user.patronymic}

    </#list>
</#macro>

<#macro content>

    <@table caption="Last activity"/>
</#macro>

At first, I tried to implement it using an ajax request:

function goTo(link) {
    $.ajax({
        url: "http://localhost:" + getPort() + "/" + link,
        type: "GET",
        success: function () {
            console.log('OK');
        },
        error: function (response) {
            console.log(this.url)
            alert(response);
        }
    })
}

But the data was not updated, I assumed that this was due to the fact that my data comes using a template engine and when redrawing the page, new data does not come, since there is no new request for them.

As a result, I implemented this simply using a JS script to navigate to the same page:

function goTo(link) {
    let port = getPort();
    console.log('http://localhost:' + port + '/' + link);
    window.location.href = 'http://localhost:' + port + '/' + link;
}

But now the page is being updated, and I would like to complete this task without updating, if it possible.


问:
Getting a user's OAuth2 token for Google API
I work on a web app that uses cognito for authentication, and it only enables sign in from Google. I'm currently working on a feature that requires the use of the listDirectoryPeople method (https://developers.google.com/people/api/rest/v1/people/listDirectoryPeople)

I need to authorize via the logged-in user's OAuth2 token and I can't seem to figure out how to get that from cognito without rewriting the whole login system which is not a very feasible solution. Any ideas?

I tried finding the token in the user object returned by cognito, and creating a separate auth session for the Google API.


问:
Entries will not export from Moodle Glossary
I'm attempting to export the glossary in each chapter of a course, but whenever I attempt to do so, most of the entries will not actually make it to the XML file.  I've found that any entry that has "Exported Entry" listed near the bottom right is one that will not export with the request.  How can I get these entries to export all together per chapter?  Or if I can't, how can I get the chapter-relevant terms into their respective chapters from the main glossary in a reasonable timeframe?

The entries that will not export all have this in common.


问:
Bootstrap 5.2.3 modal - HTML form causes blank screen
I am having an issue with form within a modal. I can have to time input elements, no more nor can I have any date elements or the screen will go blank instead of showing the modal.

Here the working version of the modal with the two time inputs

Modal Heading

                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>

            <form action="myBookingBackend.php" method='post'>

                    Time Start
                    <input type="time" name="timeStart" id="timeStart">

                    Time End
                    <input type="time" name="timeEnd" id="timeEnd">

                    <input type="hidden" name="bookingIdHidden" id="bookingIdHidden" value="">

                <button type="submit" id="submit" class="btn btn-primasry">Submit</button>
            </form>

                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>

```
</div>
</div>
</p>
<p>Here is an image to show you it working</p>
<p>And here is a non-functioning version of my modal. Note: the new time input is a direct copy and past of the previous time input with name and id changed so in theory there should be no issue.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="hidden modal fade" id="myModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <!-- Modal Header -->
            <div class="modal-header">
                <h4 class="modal-title">Modal Heading</h4>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>
            <!-- Modal body -->
            <div class="modal-body" id="bookingIdText">

            </div>
            <form action="myBookingBackend.php" method='post'>
                <div>
                    <label for="timeStart">Time Start</label>
                    <input type="time" name="timeStart" id="timeStart">

                    <label for="timeEnd">Time End</label>
                    <input type="time" name="timeEnd" id="timeEnd">

                    <label for="timeEnd1">Time End</label>
                    <input type="time" name="timeEnd1" id="timeEnd1">

                    <input type="hidden" name="bookingIdHidden" id="bookingIdHidden" value="">
                </div>

                <button type="submit" id="submit" class="btn btn-primasry">Submit</button>
            </form>
            <!-- Modal footer -->
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div></code>```

and... not working

I have struggle with this issue for a bit and cannot work it out nor can I find anything online regarding it.

Here is my version of bootstrap I am using

```     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script></code>```

I have the same issue when attempting to use the <select> and <option> tags to create a dropdown box so I tried out these:

        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">

        ```
</div>
</div>
</p>
<p>No luck</p>
<p>I thought I may add, this modal uses jQuery to set the value of the hidden element</p>
<p>Just in case this is the cause of my troubles, here is the jQuery function</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function takeId(newButtonId){

    $('#myModal').modal('show');
    try {
        $('#bookingIdHidden').attr('value', newButtonId);

    } catch(err) {
        alert(err);
    }
};</code>```

<input type='button' name='edit' value='Edit' onclick=takeId($newButtonId) id='1' </button>```

Any help would be much appreciated

Body:
I am having an issue with form within a modal. I can have to time input elements, no more nor can I have any date elements or the screen will go blank instead of showing the modal.

Here the working version of the modal with the two time inputs

Modal Heading

                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>

            <form action="myBookingBackend.php" method='post'>

                    Time Start
                    <input type="time" name="timeStart" id="timeStart">

                    Time End
                    <input type="time" name="timeEnd" id="timeEnd">

                    <input type="hidden" name="bookingIdHidden" id="bookingIdHidden" value="">

                <button type="submit" id="submit" class="btn btn-primasry">Submit</button>
            </form>

                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>

Here is an image to show you it working

And here is a non-functioning version of my modal. Note: the new time input is a direct copy and past of the previous time input with name and id changed so in theory there should be no issue.

Modal Heading

                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>

            <form action="myBookingBackend.php" method='post'>

                    Time Start
                    <input type="time" name="timeStart" id="timeStart">

                    Time End
                    <input type="time" name="timeEnd" id="timeEnd">

                    Time End
                    <input type="time" name="timeEnd1" id="timeEnd1">

                    <input type="hidden" name="bookingIdHidden" id="bookingIdHidden" value="">

                <button type="submit" id="submit" class="btn btn-primasry">Submit</button>
            </form>

                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>

and... not working

I have struggle with this issue for a bit and cannot work it out nor can I find anything online regarding it.

Here is my version of bootstrap I am using

```     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">

I have the same issue when attempting to use the <select> and <option> tags to create a dropdown box so I tried out these:

        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">

No luck

I thought I may add, this modal uses jQuery to set the value of the hidden element

Just in case this is the cause of my troubles, here is the jQuery function

function takeId(newButtonId){

    $('#myModal').modal('show');
    try {
        $('#bookingIdHidden').attr('value', newButtonId);

    } catch(err) {
        alert(err);
    }
};

<input type='button' name='edit' value='Edit' onclick=takeId($newButtonId) id='1' </button>

Any help would be much appreciated


问:
Describe AWS SCP Policy to filter region for further automation
While describing scp policies getting an unformatted output that through Python I need to filer out for active regions that's I have enabled. Can anyone please guide me how to achieve that?

```<code>scp = response.describe_policy(PolicyId='p-xxxxxx')
print(json.dumps(scp['Policy']['Content'], indent=4))
</code>```

Output:

```<code>$ python test_lambda_copy.py
"{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"\",\n      \"Effect\": \"Deny\",\n      \"Action\": [\n        \"zocalo:*\",\n        \"workmail:*\",\n        \"workdocs:*\",\n        \"organizations:Update*\",\n        \"organizations:Remove*\",\n        \"organizations:Register*\",\n        \"organizations:Move*\",\n        \"organizations:Leave*\",\n        \"organizations:Invite*\",\n        \"organizations:Enable*\",\n        \"organizations:Disable*\",\n        \"organizations:Detach*\",\n        \"organizations:Deregister*\",\n        \"organizations:Delete*\",\n
       \"organizations:Decline*\",\n        \"organizations:Create*\",\n        \"organizations:Cancel*\",\n        \"organizations:Attach*\",\n        \"lightsail:*\",\n        \"kms:ScheduleKeyDeletion\",\n        \"kms:DisableKeyRotation\",\n        \"guardduty:StopMonitoringMembers\",\n        \"guardduty:DisassociateMembers\",\n        \"guardduty:DisassociateFromMasterAccount\",\n        \"guardduty:DeleteThreatIntelSet\",\n        \"guardduty:DeleteMembers\",\n        \"guardduty:DeleteIPSet\",\n        \"guardduty:DeleteDetector\",\n        \"gamelift:*\",\n        \"ec2:DeleteFlowLogs\",\n
    \"discovery:*\",\n        \"cloudtrail:UpdateTrail\",\n        \"cloudtrail:StopLogging\",\n        \"cloudtrail:DeleteTrail\",\n        \"cloudshell:*\",\n        \"chime:*\"\n      ],\n      \"Resource\": \"*\",\n      \"Condition\": {\n        \"StringNotEquals\": {\n          \"aws:RequestedRegion\": [\n            \"us-west-2\",\n            \"us-west-1\",\n            \"us-east-1\",\n
   \"eu-west-1\",\n            \"eu-central-1\",\n            \"ca-central-1\",\n            \"ap-southeast-2\"\n          ]\n        }\n      }\n    }\n  ]\n}"
</code>```

Out of the above output I am interested in getting below output only for regions. But looks like its not JSON style data, and more like plain text data. Any

```<code>"Condition": {\n'
 '        "StringNotEquals": {\n'
 '          "aws:RequestedRegion": [\n'
 '            "us-west-2",\n'
 '            "us-west-1",\n'
 '            "us-east-1",\n'
 '            "eu-west-1",\n'
 '            "eu-central-1",\n'
 '            "ca-central-1",\n'
 '            "ap-southeast-2"\n'
 '          ]\n'
 '        }\n'
</code>```

Body:
While describing scp policies getting an unformatted output that through Python I need to filer out for active regions that's I have enabled. Can anyone please guide me how to achieve that?

scp = response.describe_policy(PolicyId='p-xxxxxx')
print(json.dumps(scp['Policy']['Content'], indent=4))

Output:

$ python test_lambda_copy.py
"{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"\",\n      \"Effect\": \"Deny\",\n      \"Action\": [\n        \"zocalo:*\",\n        \"workmail:*\",\n        \"workdocs:*\",\n        \"organizations:Update*\",\n        \"organizations:Remove*\",\n        \"organizations:Register*\",\n        \"organizations:Move*\",\n        \"organizations:Leave*\",\n        \"organizations:Invite*\",\n        \"organizations:Enable*\",\n        \"organizations:Disable*\",\n        \"organizations:Detach*\",\n        \"organizations:Deregister*\",\n        \"organizations:Delete*\",\n
       \"organizations:Decline*\",\n        \"organizations:Create*\",\n        \"organizations:Cancel*\",\n        \"organizations:Attach*\",\n        \"lightsail:*\",\n        \"kms:ScheduleKeyDeletion\",\n        \"kms:DisableKeyRotation\",\n        \"guardduty:StopMonitoringMembers\",\n        \"guardduty:DisassociateMembers\",\n        \"guardduty:DisassociateFromMasterAccount\",\n        \"guardduty:DeleteThreatIntelSet\",\n        \"guardduty:DeleteMembers\",\n        \"guardduty:DeleteIPSet\",\n        \"guardduty:DeleteDetector\",\n        \"gamelift:*\",\n        \"ec2:DeleteFlowLogs\",\n
    \"discovery:*\",\n        \"cloudtrail:UpdateTrail\",\n        \"cloudtrail:StopLogging\",\n        \"cloudtrail:DeleteTrail\",\n        \"cloudshell:*\",\n        \"chime:*\"\n      ],\n      \"Resource\": \"*\",\n      \"Condition\": {\n        \"StringNotEquals\": {\n          \"aws:RequestedRegion\": [\n            \"us-west-2\",\n            \"us-west-1\",\n            \"us-east-1\",\n
   \"eu-west-1\",\n            \"eu-central-1\",\n            \"ca-central-1\",\n            \"ap-southeast-2\"\n          ]\n        }\n      }\n    }\n  ]\n}"

Out of the above output I am interested in getting below output only for regions. But looks like its not JSON style data, and more like plain text data. Any

"Condition": {\n'
 '        "StringNotEquals": {\n'
 '          "aws:RequestedRegion": [\n'
 '            "us-west-2",\n'
 '            "us-west-1",\n'
 '            "us-east-1",\n'
 '            "eu-west-1",\n'
 '            "eu-central-1",\n'
 '            "ca-central-1",\n'
 '            "ap-southeast-2"\n'
 '          ]\n'
 '        }\n'


问:
How do I remove the y-axis title in R for plot_ly?
I would like to remove the y-axis title for plot_ly in R, but I can't find any suggestions on how to do this.

If I specify a blank axis title, it generates an automatic title.


问:
Force Style to Plain Text
I am using TinyMCE to input entries for a dictionary and I want to guide the person compiling with preset styles. The user chooses (from a dropdown) preconfigured styles for the dictionary definition (plain text, black font, 12pt size), examples in the definition (italic, blue font, 12pt size) or labels (italic, gray font, 11pt size).

These are my preconfigured styes:

```<code>style_formats: [
    {title: 'Definition', inline: 'span', styles: {color: '#000000', fontSize: '12pt'}},
    {title: 'Example', inline: 'span', styles: {color: '#236FA1', fontStyle: 'italic', fontSize: '12pt'}},
    {title: 'Label', inline: 'span', styles: {color: '#7E8C8D', fontSize: '11pt'}},
  ]
</code>```

These style formats settings basically work. My problem is that once I select the "Example" style, the font switches to italics and it stays so also when I later select "Definition" or "Label".

https://www.tiny.cloud/docs/tinymce/6/content-formatting/ lists many formatting options, but it seems there's nothing for forcing "plain" text.

In general I would appreciate any advice to build "presets" that a user could choose, while typing "inline" to pull preconfigured styles, with font type, color, size and formatting. This tremendously helps the data input consistency.
Thanks, Emanuele

Title: Force Style to Plain Text

Body:
I am using TinyMCE to input entries for a dictionary and I want to guide the person compiling with preset styles. The user chooses (from a dropdown) preconfigured styles for the dictionary definition (plain text, black font, 12pt size), examples in the definition (italic, blue font, 12pt size) or labels (italic, gray font, 11pt size).

These are my preconfigured styes:

style_formats: [
    {title: 'Definition', inline: 'span', styles: {color: '#000000', fontSize: '12pt'}},
    {title: 'Example', inline: 'span', styles: {color: '#236FA1', fontStyle: 'italic', fontSize: '12pt'}},
    {title: 'Label', inline: 'span', styles: {color: '#7E8C8D', fontSize: '11pt'}},
  ]

These style formats settings basically work. My problem is that once I select the "Example" style, the font switches to italics and it stays so also when I later select "Definition" or "Label".

https://www.tiny.cloud/docs/tinymce/6/content-formatting/ lists many formatting options, but it seems there's nothing for forcing "plain" text.

In general I would appreciate any advice to build "presets" that a user could choose, while typing "inline" to pull preconfigured styles, with font type, color, size and formatting. This tremendously helps the data input consistency.
Thanks, Emanuele


问:
Strsplit function in R
I'm currently working through some coursework where data has been provided on supermarket chip sales. Part of the task is to remove any entries where products are not chips and have been provided code to enter to help with this:

productWords <- data.table(unlist(strsplit(unique(transaction_data[, "PROD_NAME"]), "")))
```
<p>the data file provided = transaction_data and PROD_NAME variable is the column we're interested in.</p>
<p>This however, returns the error:</p>
```Error in strsplit(unique(transaction_data[, "PROD_NAME"]), "") : non-character argument
```
<p>Can someone please explain what it is that I'm doing wrong, or am I missing something? I'm not sure how this code would be able to understand the product and differentiate between another, am I meant to be adding something in with the code based on product names I've seen while looking through the data?</p>
<p>Here are some lines of the data as an example:</p>
```  DATE       STORE_NBR LYLTY_CARD_NBR TXN_ID PROD_NBR PROD_NAME                                PROD_QTY TOT_SALES
  <date>         <dbl>          <dbl>  <dbl>    <dbl> <chr>                                       <dbl>     <dbl>
1 2018-10-17         1           1000      1        5 Natural Chip        Compny SeaSalt175g          2       6
2 2019-05-14         1           1307    348       66 CCs Nacho Cheese    175g                        3       6.3
3 2019-05-20         1           1343    383       61 Smiths Crinkle Cut  Chips Chicken 170g          2       2.9
```

Title: Strsplit function in R

Body:
I'm currently working through some coursework where data has been provided on supermarket chip sales. Part of the task is to remove any entries where products are not chips and have been provided code to enter to help with this:

productWords <- data.table(unlist(strsplit(unique(transaction_data[, "PROD_NAME"]), "")))

the data file provided = transaction_data and PROD_NAME variable is the column we're interested in.

This however, returns the error:

Error in strsplit(unique(transaction_data[, "PROD_NAME"]), "") : non-character argument

Can someone please explain what it is that I'm doing wrong, or am I missing something? I'm not sure how this code would be able to understand the product and differentiate between another, am I meant to be adding something in with the code based on product names I've seen while looking through the data?

Here are some lines of the data as an example:

  DATE       STORE_NBR LYLTY_CARD_NBR TXN_ID PROD_NBR PROD_NAME                                PROD_QTY TOT_SALES
  <date>         <dbl>          <dbl>  <dbl>    <dbl> <chr>                                       <dbl>     <dbl>
1 2018-10-17         1           1000      1        5 Natural Chip        Compny SeaSalt175g          2       6
2 2019-05-14         1           1307    348       66 CCs Nacho Cheese    175g                        3       6.3
3 2019-05-20         1           1343    383       61 Smiths Crinkle Cut  Chips Chicken 170g          2       2.9