问:
Why can't I use the BuildInDocumentProperties (Microsoft.Office.Interop.Word) in a WPF project?
I have to change a Property in Word Documents and save them as PDF

(I Already installed the Nuget Microsoft.Office.Interop.Word)

In a console app it works perfect:

```<code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Word;
using Word = Microsoft.Office.Interop.Word;

namespace WordTest
{
    internal class Program
    {
        static void Main ( string [] args )
        {
            var fileName = "TestDoc";

            Word.Application application = new Word.Application();
            application.Visible = false;
            var inputFileName = @"C:\Input\" + fileName + ".docx";
            var outputFileName = @"C:\Output" + fileName + x + ".pdf";
            Word.Document document = application.Documents.Open(inputFileName, ReadOnly: false, Visible: false);
            document.BuiltInDocumentProperties [ "KeyWords" ].Value = "Test Value";

            document.ExportAsFixedFormat ( outputFileName, Word.WdExportFormat.wdExportFormatPDF );

            // Close the document and the application
            document.Close ();
        }
    }
}
</code>```

But when I do the same in my WPF Project

```<code>using Word = Microsoft.Office.Interop.Word;

namespace WordTest
{
    public partial class MainWindow : Window
    {
        public MainWindow ()
        {
            InitializeComponent ();

                        var fileName = "TestDoc";

            Word.Application application = new Word.Application();
            application.Visible = false;
            var inputFileName = @"C:\Input\" + fileName + ".docx";
            var outputFileName = @"C:\Output" + fileName + x + ".pdf";
            Word.Document document = application.Documents.Open(inputFileName, ReadOnly: false, Visible: false);
            document.BuiltInDocumentProperties [ "KeyWords" ].Value = "Test Value";

            document.ExportAsFixedFormat ( outputFileName, Word.WdExportFormat.wdExportFormatPDF );

            // Close the document and the application
            document.Close ();
        }
    }
}
</code>```

I get an error on the line document.BuiltInDocumentProperties [ "KeyWords" ].Value = "Test Value";

Cannot apply indexing with [] to an expression of type 'type'

Is there a reason why this doesn't work in a WPF application or is there a way to fix this.

Body:
I have to change a Property in Word Documents and save them as PDF

(I Already installed the Nuget Microsoft.Office.Interop.Word)

In a console app it works perfect:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Word;
using Word = Microsoft.Office.Interop.Word;

namespace WordTest
{
    internal class Program
    {
        static void Main ( string [] args )
        {
            var fileName = "TestDoc";

            Word.Application application = new Word.Application();
            application.Visible = false;
            var inputFileName = @"C:\Input\" + fileName + ".docx";
            var outputFileName = @"C:\Output" + fileName + x + ".pdf";
            Word.Document document = application.Documents.Open(inputFileName, ReadOnly: false, Visible: false);
            document.BuiltInDocumentProperties [ "KeyWords" ].Value = "Test Value";

            document.ExportAsFixedFormat ( outputFileName, Word.WdExportFormat.wdExportFormatPDF );

            // Close the document and the application
            document.Close ();
        }
    }
}

But when I do the same in my WPF Project

using Word = Microsoft.Office.Interop.Word;

namespace WordTest
{
    public partial class MainWindow : Window
    {
        public MainWindow ()
        {
            InitializeComponent ();

                        var fileName = "TestDoc";

            Word.Application application = new Word.Application();
            application.Visible = false;
            var inputFileName = @"C:\Input\" + fileName + ".docx";
            var outputFileName = @"C:\Output" + fileName + x + ".pdf";
            Word.Document document = application.Documents.Open(inputFileName, ReadOnly: false, Visible: false);
            document.BuiltInDocumentProperties [ "KeyWords" ].Value = "Test Value";

            document.ExportAsFixedFormat ( outputFileName, Word.WdExportFormat.wdExportFormatPDF );

            // Close the document and the application
            document.Close ();
        }
    }
}

I get an error on the line document.BuiltInDocumentProperties [ "KeyWords" ].Value = "Test Value";

Cannot apply indexing with [] to an expression of type 'type'

Is there a reason why this doesn't work in a WPF application or is there a way to fix this.


来源: stackexchange

问:
Flink Postgres query to jsonb column gives jdbc failure
I am using PyFlink 1.16 and flink-connector-jdbc-1.16.0.jar to query Postgres table with a jsonb column

```<code>sql = "SELECT entity_id FROM event_files"
table2 = table_env.sql_query(sql)
table2.execute().print()
</code>```

It failed with this error:

```<code>Caused by: java.lang.UnsupportedOperationException: Doesn't support Postgres type 'jsonb' yet
    at org.apache.flink.connector.jdbc.dialect.psql.PostgresTypeMapper.mapping(PostgresTypeMapper.java:173)
</code>```

I get this error despite not using the jsonb column.

I patched PostgresTypeMapper.java to map jsonb to varchar. Now the above code is working. But I want to query by jsonb column, payload. So I tried to cast it to varchar a column, P1:

```<code>sql = "SELECT entity_id, CAST(payload AS varchar) AS P1 FROM event_files"
table2 = table_env.sql_query(sql)
table2.execute().print()
</code>```

but that fails with:

```<code>Caused by: java.lang.ClassCastException: class org.postgresql.util.PGobject cannot be cast to class java.lang.String (org.postgresql.util.PGobject is in unnamed module of loader org.apache.flink.util.ChildFirstClassLoader @38c50913; java.lang.String is in module java.base of loader 'bootstrap')
    at org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter.lambda$createInternalConverter$224afae6$10(AbstractJdbcRowConverter.java:176)
</code>```

I have been trying to find ways around this including creating a view from event_files, but nothing has worked so far.

Details on patching flink-connector-jdbc

Cloned the flink-connector-jdbc project from GitHub and add a few lines to flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/psql/PostgresTypeMapper.java:

    private static final String PG_CHARACTER_VARYING_ARRAY = "_varchar";
    private static final String PG_JSONB = "jsonb";

            case PG_DATE_ARRAY:
                return DataTypes.ARRAY(DataTypes.DATE());
            case PG_JSONB:
                return DataTypes.STRING();
```

I build it with Maven.

ContentLicense: CC BY-SA 4.0

Body:
I am using PyFlink 1.16 and flink-connector-jdbc-1.16.0.jar to query Postgres table with a jsonb column

sql = "SELECT entity_id FROM event_files"
table2 = table_env.sql_query(sql)
table2.execute().print()

It failed with this error:

Caused by: java.lang.UnsupportedOperationException: Doesn't support Postgres type 'jsonb' yet
    at org.apache.flink.connector.jdbc.dialect.psql.PostgresTypeMapper.mapping(PostgresTypeMapper.java:173)

I get this error despite not using the jsonb column.

I patched PostgresTypeMapper.java to map jsonb to varchar. Now the above code is working. But I want to query by jsonb column, payload. So I tried to cast it to varchar a column, P1:

sql = "SELECT entity_id, CAST(payload AS varchar) AS P1 FROM event_files"
table2 = table_env.sql_query(sql)
table2.execute().print()

but that fails with:

Caused by: java.lang.ClassCastException: class org.postgresql.util.PGobject cannot be cast to class java.lang.String (org.postgresql.util.PGobject is in unnamed module of loader org.apache.flink.util.ChildFirstClassLoader @38c50913; java.lang.String is in module java.base of loader 'bootstrap')
    at org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter.lambda$createInternalConverter$224afae6$10(AbstractJdbcRowConverter.java:176)

I have been trying to find ways around this including creating a view from event_files, but nothing has worked so far.

Details on patching flink-connector-jdbc

Cloned the flink-connector-jdbc project from GitHub and add a few lines to flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/psql/PostgresTypeMapper.java:

    private static final String PG_CHARACTER_VARYING_ARRAY = "_varchar";
    private static final String PG_JSONB = "jsonb";

            case PG_DATE_ARRAY:
                return DataTypes.ARRAY(DataTypes.DATE());
            case PG_JSONB:
                return DataTypes.STRING();

I build it with Maven.


问:
Is there a way to send post request with body without given error?
JSON body is as follows:

```<code>{
  "data_environment": "apitestdata",
  "criteria": {
    "criteria_groups": [
      {
        "items": [
          {
            "column_name": "age_years",
            "expr": [
              50,
              100
            ],
            "oper": "between",
            "type": "criteria"
          },
          {
            "type": "oper",
            "value": "AND"
          },
          {
            "column_name": "gender",
            "expr": [
              "F"
            ],
            "oper": "in",
            "type": "criteria"
          }
        ],
        "source_key": "acxc",
        "type": "CriteriaGroup"
      },
      {
        "type": "oper",
        "value": "AND"
      },
      {
        "items": [
          {
            "column_name": "subcategory",
            "expr": [
              "SUGAR FREE CHOCOLATE CANDY",
              "SUGAR FREE DIET CANDY"
            ],
            "oper": "in",
            "type": "criteria"
          }
        ],
        "source_key": "iri",
        "type": "CriteriaGroup"
      },
      {
        "type": "oper",
        "value": "AND NOT"
      },
      {
        "items": [
          {
            "column_name": "subcategory",
            "expr": [
              "SUGARLESS GUM"
            ],
            "oper": "in",
            "type": "criteria"
          }
        ],
        "source_key": "iri",
        "type": "CriteriaGroup"
      }
    ]
  }
}
</code>```

I keep getting the following error when sending this request:

```<code>{
    "error": "unknown item type: CriteriaGroup in {\"items\":[{\"column_name\":\"age_years\",\"expr\":[50,100],\"oper\":\"between\",\"type\":\"criteria\"},{\"type\":\"oper\",\"value\":\"AND\"},{\"column_name\":\"gender\",\"expr\":[\"F\"],\"oper\":\"in\",\"type\":\"criteria\"}],\"source_key\":\"acxc\",\"type\":\"CriteriaGroup\"}"
}
</code>```

Body:
JSON body is as follows:

{
  "data_environment": "apitestdata",
  "criteria": {
    "criteria_groups": [
      {
        "items": [
          {
            "column_name": "age_years",
            "expr": [
              50,
              100
            ],
            "oper": "between",
            "type": "criteria"
          },
          {
            "type": "oper",
            "value": "AND"
          },
          {
            "column_name": "gender",
            "expr": [
              "F"
            ],
            "oper": "in",
            "type": "criteria"
          }
        ],
        "source_key": "acxc",
        "type": "CriteriaGroup"
      },
      {
        "type": "oper",
        "value": "AND"
      },
      {
        "items": [
          {
            "column_name": "subcategory",
            "expr": [
              "SUGAR FREE CHOCOLATE CANDY",
              "SUGAR FREE DIET CANDY"
            ],
            "oper": "in",
            "type": "criteria"
          }
        ],
        "source_key": "iri",
        "type": "CriteriaGroup"
      },
      {
        "type": "oper",
        "value": "AND NOT"
      },
      {
        "items": [
          {
            "column_name": "subcategory",
            "expr": [
              "SUGARLESS GUM"
            ],
            "oper": "in",
            "type": "criteria"
          }
        ],
        "source_key": "iri",
        "type": "CriteriaGroup"
      }
    ]
  }
}

I keep getting the following error when sending this request:

{
    "error": "unknown item type: CriteriaGroup in {\"items\":[{\"column_name\":\"age_years\",\"expr\":[50,100],\"oper\":\"between\",\"type\":\"criteria\"},{\"type\":\"oper\",\"value\":\"AND\"},{\"column_name\":\"gender\",\"expr\":[\"F\"],\"oper\":\"in\",\"type\":\"criteria\"}],\"source_key\":\"acxc\",\"type\":\"CriteriaGroup\"}"
}


问:
Twitter pixel activating multiple times - error with pixel helper or page?
I am seeing an issue alerted from my Twitter pixel helper extension that website tags are activating multiple times on a web page, but I can't work out why.

I am not a developer - I work in social media - but installing the odd tracking code is part of my role. I have taken out the actual codes in the below script.

If anyone else has experience this I would be interested to hear about their solutions! Thanks!

```<code><!-- Twitter conversion tracking base code -->
<script>
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='https://static.ads-twitter.com/uwt.js',
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
twq('config','BASECODE');
</script>
<!-- End Twitter conversion tracking base code -->
<!-- Twitter conversion tracking event code -->
<script type="text/javascript">
  // Insert Twitter Event ID
  twq('event', 'BASECODE+EVENT', {
  });
</script>
<!-- End Twitter conversion tracking event code -->
<!-- Twitter conversion tracking event code -->
<script type="text/javascript">
  // Insert Twitter Event ID
  twq('event', 'BASECODE+EVENT', {
  });
</script>
<!-- End Twitter conversion tracking event code -->
</code>```

We aren't running ads at the moment so it's hard to test, but have had issues in the past with leads not being recorded when I had the event and base codes bundled together (ie all codes were in the same parameter). As an alternative I have separated them out - as above. But the Pixel code error remains the same.

Body:
I am seeing an issue alerted from my Twitter pixel helper extension that website tags are activating multiple times on a web page, but I can't work out why.

I am not a developer - I work in social media - but installing the odd tracking code is part of my role. I have taken out the actual codes in the below script.

If anyone else has experience this I would be interested to hear about their solutions! Thanks!

We aren't running ads at the moment so it's hard to test, but have had issues in the past with leads not being recorded when I had the event and base codes bundled together (ie all codes were in the same parameter). As an alternative I have separated them out - as above. But the Pixel code error remains the same.


问:
Visual Studio 2010 "default-ing" custom build
as it might be clear while looking at this posts title, I'm not quite sure what to google for.
Hence I hope someone here can help me out.

Recently I happened to begin using Qt.
I don't want to use Qt creator, rather stick with Visual Studio.

The problem is when I use the Meta Object Compiler within Visual Studio.
So far I was just adding a custom build step for those header files which need to be moc-ed.

But it is very annoying to add the command-line/etc each time I add a header file which needs to be moc-ed.
So I was wondering if its possible to add an option ( like "MOC-Build" ) into the dropdown box where I usually selected "Custom Build" which does the job.

I found ( tho not tested yet ) this msdn page http://blogs.msdn.com/b/msbuild/archive/2005/10/06/477064.aspx which explains how to add an option to the drop down box, but how can I provide a command-line/etc ?

Thanks in advance

ContentLicense: CC BY-SA 3.0


问:
Load Oracle Blob data type into SQL Server using ADF
I am migrating Oracle Database to SQL Server Database.
I have one table with one column having blob data type in Oracle.
In the target table (SQL Server), I have created the table with column data type as varbinary.
Then I am using ADF(Azure Data factory) to load data from Oracle to SQL Server.
ADF is long time and no records are being inserted.

Am I doing anything wrong? Please suggest.


问:
how i can make this column with same id to like this expected

ID
JOBS
Year

1
Farmer
2021

1
Programmer
2021

2
Nurse
2021

2
Lecturer
2021

Output I expected

ID
JOBS 1
JOBS 2
Year

1
Farmer
Programmer
2021

2
Nurse
Lecturer
2021


问:
How to get alternate route in google map android studio kotlin
I am creating an android app in android studio with Kotlin with a custom map and want to add a route for the user. so that users can select any route according to user preference. after clicking the route it gets select and the user can continue its route with proper navigation with my custom map.</p>


问:
Table sort icon and data table-top does not appear when i navigate to a new route in my angular application
I am using bootstrap datatables to structure my data in a table. It works on refresh but the table sort icon and data table-top disappears when i navigate to another route in my angular application.

when i visit another route on the dashboard, it doesn't appear (https://i.stack.imgur.com/PHF34.png), but it works on refresh (https://i.stack.imgur.com/zwQgr.png)


问:
csv files formatting in Excel
I have been dealing with a lot of csv files latelly and I need them to open in Excel and split correctly

I append "sep=," to the beginning of the text file and the columns get split correctly

the issue is, my language uses a lot of "special" characters like "ç" or "ã", and the formatting gets distorted if I add the beforementioned "sep=," to the file

is there any option I can add to the file so it is displayed without issues?

I am aware of the text to columns button but this is very inefficient since I am constantly doing this

Title: csv files formatting in Excel


问:
PictureBbox for Game Character
I'm just a beginner in programming. Right now I am familiarizing myself to it and I am using Vb.net as a practice.

I am trying to make a basic game in VS2019 and I use picturebox as a component for the character to move. Whenever I am moving it, there is a line appearing on the opposite side of the direction which where the character is going.

I figured out that this is because of the property of the picturebox, the picturebox itself is moving on a form with a background picture so whenever it is moving, the color of the form is what is appearing as the color of the line(borders of the picturebox).

Is there anyone that can teach me how can I be able to fix it? Thank you.

I try to search for solutions but I cannot be able to fully understand their solution or if their situation is same as mine. I found something here on stackoverflow about making a custom component. But whenever I am trying to make my own custom component base on what is in their guide, I cannot be able to proceed because of I cannot be able to understand it. In their guide, it says that I must create a custom component and make it inherit the original picturebox, but when I try to copy the exact thing I see, it shows an error like this.

"Base class 'PictureBox specified for class 'TransparentPictureBox cannot be different from the base class Component of one of its other partial types."

Title: PictureBbox for Game Character


问:
Facebook developer app violated policy issue
We are using Facebook login in one of our app. We completed data use checkup by submitting app already.

But we received below issues one by one.
At 1st, we received

Warning: App Violation - {AppName} appears to be creating a negative experience on Facebook in violation of our Platform Policies. If you do not make the changes to get your app into compliance, we will be forced to place a restriction on your app.

At 2nd, we received,

Your app {AppName} has been disabled - Your app {AppName} appears to be creating a negative experience on Facebook in violation of our Platform Policies.

At 3rd, we received

Your App was Incorrectly Frozen -  Due to an error in app inactivity monitoring, your app {AppName} was incorrectly frozen.
This action can easily be reversed, as apps can immediately be reinstated on the app dashboard. We are in the process of restoring activity to these apps, but an admin can immediately restore access to your own app if your app is still showing as inactive.

As per 3rd update, we couldn't reinstate app and we are not sure what exact policy violated. How to track exact issue and how to resolve this.


问:
How to move to different state based on guard result
I have a base state that can diverge into two states based on the result of the guard. The guard performs a validation that should determine the next state.

#1: Base State -> (Guard Fails) -> Search Failed State

#2: Base State -> (Guard Passes) -> New Search State

I have tried using withChoice but it seems that executes automatically and not on an event. I do not want my state to move automatically but rather still wait for an event to trigger selection of a choice.

The configuration I have at the moment:

```<code>@Override
public void configure(StateMachineStateConfigurer<RegistrationState, RegistrationStateEvent> states)
        throws Exception {
    states
            .withStates()
            .initial(RegistrationState.OPEN)
            .choice(RegistrationState.CONSISTENCY_CHECK_PASSED)
            .end(RegistrationState.CLOSED)
            .states(EnumSet.allOf(RegistrationState.class));
}
</code>```
```<code>@Override
    public void configure(StateMachineTransitionConfigurer<RegistrationState, RegistrationStateEvent> transitions)
            throws Exception {
        transitions
                .withExternal()
                .source(RegistrationState.OPEN).target(RegistrationState.CONSISTENCY_CHECK_PASSED).event(RegistrationStateEvent.DATA_CORRECT)
                .and()
                .withChoice()
                .source(RegistrationState.CONSISTENCY_CHECK_PASSED)
                .first(RegistrationState.MACHINE_ERP_DATA_COMPLETE, validGuard(externalService))
                .last(RegistrationState.MACHINE_DATA_NOT_FOUND)
                .and()
                .withExternal()
                .source(RegistrationState.MACHINE_ERP_DATA_COMPLETE).target(RegistrationState.MACHINE_CUSTOMER_ERP_DATA_COMPLETE)
                .event(RegistrationStateEvent.CUSTOMER_DATA_FOUND)
                .and()
                .withExternal()
                .source(RegistrationState.MACHINE_CUSTOMER_ERP_DATA_COMPLETE).target(RegistrationState.MAKE_CODE_WELL_KNOWN)
                .event(RegistrationStateEvent.MAKE_CODE_WELL_KNOWN);
    }

</code>```

But this seems to move through the choice state without waiting for an event first. I feel like I'm not grasping something properly.

Body:
I have a base state that can diverge into two states based on the result of the guard. The guard performs a validation that should determine the next state.

#1: Base State -> (Guard Fails) -> Search Failed State

#2: Base State -> (Guard Passes) -> New Search State

I have tried using withChoice but it seems that executes automatically and not on an event. I do not want my state to move automatically but rather still wait for an event to trigger selection of a choice.

The configuration I have at the moment:

@Override
public void configure(StateMachineStateConfigurer<RegistrationState, RegistrationStateEvent> states)
        throws Exception {
    states
            .withStates()
            .initial(RegistrationState.OPEN)
            .choice(RegistrationState.CONSISTENCY_CHECK_PASSED)
            .end(RegistrationState.CLOSED)
            .states(EnumSet.allOf(RegistrationState.class));
}

@Override
    public void configure(StateMachineTransitionConfigurer<RegistrationState, RegistrationStateEvent> transitions)
            throws Exception {
        transitions
                .withExternal()
                .source(RegistrationState.OPEN).target(RegistrationState.CONSISTENCY_CHECK_PASSED).event(RegistrationStateEvent.DATA_CORRECT)
                .and()
                .withChoice()
                .source(RegistrationState.CONSISTENCY_CHECK_PASSED)
                .first(RegistrationState.MACHINE_ERP_DATA_COMPLETE, validGuard(externalService))
                .last(RegistrationState.MACHINE_DATA_NOT_FOUND)
                .and()
                .withExternal()
                .source(RegistrationState.MACHINE_ERP_DATA_COMPLETE).target(RegistrationState.MACHINE_CUSTOMER_ERP_DATA_COMPLETE)
                .event(RegistrationStateEvent.CUSTOMER_DATA_FOUND)
                .and()
                .withExternal()
                .source(RegistrationState.MACHINE_CUSTOMER_ERP_DATA_COMPLETE).target(RegistrationState.MAKE_CODE_WELL_KNOWN)
                .event(RegistrationStateEvent.MAKE_CODE_WELL_KNOWN);
    }

But this seems to move through the choice state without waiting for an event first. I feel like I'm not grasping something properly.


问:
I am unable to access 'https://github.com/user-name/repo-name.git/': This requested URL returned error: 403
I would be glad if there is an engineer could help be with that.

Things I have tried to solve the issue:

1 - change and make sure the remote is right
2 - using personal access token from developer settings when asking for password
3 - trying to enter the password at password level
4 - updated the git on my ubuntu to the newer version.
nothing of the above methods worked and till now still getting the same error 403.


问:
vuejs how and when to properly get the brand name by ID
I have an API that can return product details but it shows the brand by its ID,
I can also request the list of brands which has the brands and their IDs

I've been trying to display the actual name in my template and not the ID and I keep running into problems, the data is not being reactive propery and i can only get it to load sometimes after vite does a HMR update

I also want to do this with an array of vendor objects which contain the ID and name of each of our vendors
(each product has an array of vendor IDS from which this product is available to purchase)

is thee something in missing in my code to make this work or am i just being an idiot

```<code><script setup>

import priceGraph from "../components/priceGraph.vue";
import { ref, computed } from "vue";
import { useProductsStore } from "../stores/products";
import { useRoute } from 'vue-router'
import axios from 'axios'

const store = useProductsStore();

const route = useRoute()

let id = route.params.id
let link = "http://127.0.0.1:8000/products/" + id

const deets = ref({
  name: "Loading",
  description: "Loading",
  brand: "loading", // this is brand ID
  brandname: "Loading", // this needs to be the brand name to be rendered
  sku: "Loading",
  asin: "Loading",
})

store.fetchProducts()
store.fetchVendors()
store.fetchBrands()

const vendorNames = store.vendors
const brandNames = store.brands
console.log(vendorNames, brandNames)

async function getDeets(link) {
  try {
    const data = await axios.get(link)
    deets.value = data.data;
    console.log(deets.value)
  } catch (error) {
    console.log(error);
  }
};
getDeets(link)

const brand = computed(() => brandNames.find((b) => b.id === deets.brand))
console.log(brand.value)

</script>

<template>
  <div class="container">

    <div class="back">
      <button @click="$router.go(-1)">Back</button>
    </div>
    <div class='deets'>
      <h1>Product Details</h1>
      <hr>
      <!-- <h2>ID: {{ deets.id }}</h2> -->
      <h2>Name: {{ deets.name }}</h2>
      <h3>Description: {{ deets.description }}</h3>
      <h2>Sku: {{ deets.sku }}</h2>
      <h3>brandID: {{ deets.brand }}</h3>
      <h3>brand name: {{ deets.brandname }}</h3>
      <h3>Asin: {{ deets.asin }}</h3>
      <h3>Date added: {{ deets.added }}</h3>
      <h3>Last updated: {{ deets.updated }}</h3>
      <hr>

    </div>

  </div>
</template>
</code>```

Body:
I have an API that can return product details but it shows the brand by its ID,
I can also request the list of brands which has the brands and their IDs

I've been trying to display the actual name in my template and not the ID and I keep running into problems, the data is not being reactive propery and i can only get it to load sometimes after vite does a HMR update

I also want to do this with an array of vendor objects which contain the ID and name of each of our vendors
(each product has an array of vendor IDS from which this product is available to purchase)

is thee something in missing in my code to make this work or am i just being an idiot

<template>

      <button @click="$router.go(-1)">Back</button>

Product Details

Name: {{ deets.name }}

Description: {{ deets.description }}

Sku: {{ deets.sku }}

brandID: {{ deets.brand }}

brand name: {{ deets.brandname }}

Asin: {{ deets.asin }}

Date added: {{ deets.added }}

Last updated: {{ deets.updated }}

</template>


问:
Tracking Index of Last-Clicked Frame
From https://stackoverflow.com/a/45211583 - code below - how can I get the "Change Color" button to change the color of the last-clicked frame?  That is, instead of boxes[0], somehow have a dynamic index.

Things I considered but did not work out:

Adding "metadata" to the Frame (e.g. ttk Frame with 'text' field), but if using ttk then I cannot set bg the same.

Getting event.x/y, which did not help, and x_root/y_root are relative to the top of the screen, not the Python window, so not helpful.

Having a self.last_clicked variable and getter within ManyBoxes class, but not sure how to populate it so here I am...

```<code>
class Navbar(tk.Frame):
    def __init__(self, parent):
        self.parent = parent
        super().__init__(self.parent)

        tk.Label(self.parent, text='Navbar').pack()

        tk.Button(self.parent, text='Change Color', command=self.change_color).pack()

    def change_color(self):
        # access upwards to MainApp, then down through Main, then ManyBoxes
        self.parent.main.many_boxes.boxes[0].config(bg='black')

class ManyBoxes(tk.Frame):
    def __init__(self, parent):
        self.parent = parent
        super().__init__(self.parent)

        self.boxes = []
        self.create_boxes()

    def button_action(self, e):
        print('%s was clicked' % e.widget['bg'])

    def create_boxes(self):
        colors = ['red', 'green', 'blue', 'yellow']
        c = 0
        for n in range(2):
            for m in range(2):
                box = tk.Frame(self, width=100, height=100, bg=colors[c])
                box.bind('<Button-1>', self.button_action)
                box.grid(row=n, column=m)
                self.boxes.append(box)
                c += 1

class Main(tk.Frame):
    def __init__(self, parent):
        super().__init__(parent)
        self.parent = parent

        self.many_boxes = ManyBoxes(self)
        self.many_boxes.pack()

class MainApp(tk.Frame):
    def __init__(self, parent):
        super().__init__(parent)

        self.navbar = Navbar(self)
        self.navbar.pack(fill=tk.Y)

        self.main = Main(self)
        self.main.pack(fill=tk.BOTH, expand=True)

if __name__ == "__main__":
    root = tk.Tk()
    MainApp(root).pack()
    root.mainloop()
</code>```

Title: Tracking Index of Last-Clicked Frame

Body:
From https://stackoverflow.com/a/45211583 - code below - how can I get the "Change Color" button to change the color of the last-clicked frame?  That is, instead of boxes[0], somehow have a dynamic index.

Things I considered but did not work out:

Adding "metadata" to the Frame (e.g. ttk Frame with 'text' field), but if using ttk then I cannot set bg the same.

Getting event.x/y, which did not help, and x_root/y_root are relative to the top of the screen, not the Python window, so not helpful.

Having a self.last_clicked variable and getter within ManyBoxes class, but not sure how to populate it so here I am...

class Navbar(tk.Frame):
    def __init__(self, parent):
        self.parent = parent
        super().__init__(self.parent)

        tk.Label(self.parent, text='Navbar').pack()

        tk.Button(self.parent, text='Change Color', command=self.change_color).pack()

    def change_color(self):
        # access upwards to MainApp, then down through Main, then ManyBoxes
        self.parent.main.many_boxes.boxes[0].config(bg='black')

class ManyBoxes(tk.Frame):
    def __init__(self, parent):
        self.parent = parent
        super().__init__(self.parent)

        self.boxes = []
        self.create_boxes()

    def button_action(self, e):
        print('%s was clicked' % e.widget['bg'])

    def create_boxes(self):
        colors = ['red', 'green', 'blue', 'yellow']
        c = 0
        for n in range(2):
            for m in range(2):
                box = tk.Frame(self, width=100, height=100, bg=colors[c])
                box.bind('<Button-1>', self.button_action)
                box.grid(row=n, column=m)
                self.boxes.append(box)
                c += 1

class Main(tk.Frame):
    def __init__(self, parent):
        super().__init__(parent)
        self.parent = parent

        self.many_boxes = ManyBoxes(self)
        self.many_boxes.pack()

class MainApp(tk.Frame):
    def __init__(self, parent):
        super().__init__(parent)

        self.navbar = Navbar(self)
        self.navbar.pack(fill=tk.Y)

        self.main = Main(self)
        self.main.pack(fill=tk.BOTH, expand=True)

if __name__ == "__main__":
    root = tk.Tk()
    MainApp(root).pack()
    root.mainloop()


问:
WeatherKit gives a 404 on real devices
When I'm using the following code to get the weather for a specific place, for test purposes into the simulator it gives the wanted result:

```<code>Button {

    Task {

      localWeather = try await WeatherService.shared.weather(for: CLLocation(latitude: 52.5153, longitude: 6.08565), including:  .daily(startDate: Date(), endDate: Calendar.current.date(byAdding: .day, value: 1, to: Date())!)).first.debugDescription

    }

} label: {

    Text("Get the test weather")

}

Text(localWeather)
</code>```

When I'm using this exact code on an actual device I get a 404 error saying that the request is invalid. Pasting the URL into a web browser gives a file that says no access. The developer's console says that I am submitting queries.

```<code>[WeatherDataService] Received invalid HTTP response code 404 for request: C7AEC7CC-E5F7-425D-8491-25B9302E2A0F:0

[WeatherService] Encountered an error when fetching weather data subset; location=<+52.51530000,+6.08565000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 05/01/2023, 13:55:53 Central European Standard Time,  error=responseFailed(<NSHTTPURLResponse: 0x282ce0260> { URL: https://weather-data.apple.com/v3/weather/en/52.515/6.086?timezone=Europe/Amsterdam&dataSets=forecastHourly,forecastDaily&dailyStart=2023-01-10T12:00:00Z&dailyEnd=2023-01-10T12:00:00Z&hourlyStart=2023-01-10T11:00:00Z&hourlyEnd=2023-01-10T16:00:00Z&country=NL } { Status Code: 404, Headers {

    "Access-Control-Allow-Origin" =     (

        "*"

    );

    "Cache-Control" =     (

        "max-age=0, no-cache, no-store"

    );

    Connection =     (

        "keep-alive"

    );

    "Content-Length" =     (

        0

    );

    "Content-Security-Policy" =     (

        "default-src 'self';"

    );

    Date =     (

        "Thu, 05 Jan 2023 12:59:27 GMT"

    );

    Expires =     (

        "Thu, 05 Jan 2023 12:59:27 GMT"

    );

    Pragma =     (

        "no-cache"

    );

    Server =     (

        "AppleHttpServer/21be5247c6351682d1d9aa22fe98c8f0d4902838"

    );

    "Strict-Transport-Security" =     (

        "max-age=31536000; includeSubDomains",

        "max-age=31536000"

    );

    "X-Apple-Origin" =     (

        "bcd49c7f-c567-3921-a041-3d4ef58e5423"

    );

    "X-B3-TraceId" =     (

        c8c6547722afc53f

    );

    "X-Cache" =     (

        "TCP_MISS from a104-110-190-91.deploy.akamaitechnologies.com (AkamaiGHost/10.10.3-45298580) (-)"

    );

    "X-Content-Type-Options" =     (

        nosniff

    );

    "X-Frame-Options" =     (

        DENY

    );

    "X-REQUEST-ID" =     (

        "407e37bc-ddf6-45fd-84d0-1d3d3b8651b0"

    );

    "X-XSS-Protection" =     (

        "1; mode=block"

    );

} }, Optional(""))
</code>```

I fixed it once by deleting Xcode and the app from my iPhone, but that doesn't work anymore.

Any suggestions?

Title: WeatherKit gives a 404 on real devices

Body:
When I'm using the following code to get the weather for a specific place, for test purposes into the simulator it gives the wanted result:

Button {

    Task {

      localWeather = try await WeatherService.shared.weather(for: CLLocation(latitude: 52.5153, longitude: 6.08565), including:  .daily(startDate: Date(), endDate: Calendar.current.date(byAdding: .day, value: 1, to: Date())!)).first.debugDescription

    }

} label: {

    Text("Get the test weather")

}

Text(localWeather)

When I'm using this exact code on an actual device I get a 404 error saying that the request is invalid. Pasting the URL into a web browser gives a file that says no access. The developer's console says that I am submitting queries.

[WeatherDataService] Received invalid HTTP response code 404 for request: C7AEC7CC-E5F7-425D-8491-25B9302E2A0F:0

[WeatherService] Encountered an error when fetching weather data subset; location=<+52.51530000,+6.08565000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 05/01/2023, 13:55:53 Central European Standard Time,  error=responseFailed(<NSHTTPURLResponse: 0x282ce0260> { URL: https://weather-data.apple.com/v3/weather/en/52.515/6.086?timezone=Europe/Amsterdam&dataSets=forecastHourly,forecastDaily&dailyStart=2023-01-10T12:00:00Z&dailyEnd=2023-01-10T12:00:00Z&hourlyStart=2023-01-10T11:00:00Z&hourlyEnd=2023-01-10T16:00:00Z&country=NL } { Status Code: 404, Headers {

    "Access-Control-Allow-Origin" =     (

        "*"

    );

    "Cache-Control" =     (

        "max-age=0, no-cache, no-store"

    );

    Connection =     (

        "keep-alive"

    );

    "Content-Length" =     (

        0

    );

    "Content-Security-Policy" =     (

        "default-src 'self';"

    );

    Date =     (

        "Thu, 05 Jan 2023 12:59:27 GMT"

    );

    Expires =     (

        "Thu, 05 Jan 2023 12:59:27 GMT"

    );

    Pragma =     (

        "no-cache"

    );

    Server =     (

        "AppleHttpServer/21be5247c6351682d1d9aa22fe98c8f0d4902838"

    );

    "Strict-Transport-Security" =     (

        "max-age=31536000; includeSubDomains",

        "max-age=31536000"

    );

    "X-Apple-Origin" =     (

        "bcd49c7f-c567-3921-a041-3d4ef58e5423"

    );

    "X-B3-TraceId" =     (

        c8c6547722afc53f

    );

    "X-Cache" =     (

        "TCP_MISS from a104-110-190-91.deploy.akamaitechnologies.com (AkamaiGHost/10.10.3-45298580) (-)"

    );

    "X-Content-Type-Options" =     (

        nosniff

    );

    "X-Frame-Options" =     (

        DENY

    );

    "X-REQUEST-ID" =     (

        "407e37bc-ddf6-45fd-84d0-1d3d3b8651b0"

    );

    "X-XSS-Protection" =     (

        "1; mode=block"

    );

} }, Optional(""))

I fixed it once by deleting Xcode and the app from my iPhone, but that doesn't work anymore.

Any suggestions?


问:
Azure Devops fields not available in Update an item in Sharepoint List
I have created a Cloud flow in Power Automate.

The trigger is when a work item is updated in Azure Devops.
1.1  In Azure Devops I have added a custom field to the Bug and Product Backlog item screen

The action is to update a SharePoint list.
2.1  In the SharePoint list, have a corresponding field.
2.2  When I want to use Add dynamic content to 'map' the two fields then it is not available to select:

SharePoint step

In the screen print, the field where I have the problem is Release Date.
The field below (ADO SharePoint ID) is the same scenario, where I added the custom field to the Azure Devops screen, and have the field in my Sharepoint list.  For this one I was able to select the Azure field.


问:
How to add Previous and next buttons?
I would like to add some buttons that allow the user to scroll through all the images.

```<code><div class="film-wrapper">
<div class="film-list">
  <div class="film-list-item">
      <p> <img class="film-list-item-img" src="images/BeautyATB.png" alt=""> <span         class="film-list-title">Beauty and the Beast (1991)</span> </p>
      <p><span class="film-list-title"><br>
    </span></p>
<p class="film-list-desc">Animation, Family,Fantasy: A prince cursed to spend his days as a     hideous monster sets out to regain his humanity by earning a young woman's love.</p>
      <button class="film-list-button">Watch</button>
  </div>
    <div class="film-list-item">
      <img class="film-list-item-img" src="images/Hook.jpg" alt="">
      <span class="film-list-title">Hook (1991)</span>
      <p class="film-list-desc">Adventure,Comedy,Family: When Captain James Hook kidnaps    his children, an adult Peter Pan must return to Neverland and reclaim his youthful spirit in order   to challenge his old enemy.</p>
      <button class="film-list-button">Watch</button>
    </div>
    <div class="film-list-item">
      <img class="film-list-item-img" src="images/TheWild.png" alt="">
      <span class="film-list-title">The Wild (2006)</span>
      <p class="film-list-desc">Animation,Adventure,Comedy: An adolescent lion is accidentally shipped from the New York Zoo to Africa. Now running free, his zoo pals must put aside their differences to help bring him back.</p>
      <button class="film-list-button">Watch</button>
    </div>
    <div class="film-list-item">
      <img class="film-list-item-img" src="images/Shrek3.png" alt="">
      <span class="film-list-title">Shrek 3 (2007)</span>
      <p class="film-list-desc">Animation,Adventure,Comedy: Designated as the heir to the land of Far, Far Away, Shrek hatches a plan to install the rebellious Artie as the new king while Princess Fiona tries to fend off a coup d'état by Prince Charming.</p>
      <button class="film-list-button">Watch</button>
    </div>
    <div class="film-list-item">
      <img class="film-list-item-img" src="images/Princess.png" alt="">
      <span class="film-list-title">The Princess Diaries (2001)</span>
      <p class="film-list-desc">Comedy,Family,Romance: Mia Thermopolis has just found out that she is the heir to the throne of Genovia. With her friends Lilly and Michael Moscovitz in tow, she tries to navigate through the rest of her sixteenth year.</p>
      <button class="film-list-button">Watch</button>
    </div>
    <div class="film-list-item">
      <img class="film-list-item-img" src="images/Nemo.png" alt="">
      <span class="film-list-title">Finding Nemo (2003)</span>
      <p class="film-list-desc">Animation,Adventure,Comedy: After his son is captured in the Great Barrier Reef and taken to Sydney, a timid clownfish sets out on a journey to bring him home.</p>
      <button class="film-list-button">Watch</button>
    </div>
    <div class="film-list-item">
      <img class="film-list-item-img" src="images/DespicableMe.png" alt="">
      <span class="film-list-title">Despicable Me (2010)</span>
      <p class="film-list-desc">Animation,Adventure,Comedy: When a criminal mastermind uses a trio of orphan girls as pawns for a grand scheme, he finds their love is profoundly changing him for the better.</p>
      <button class="film-list-button">Watch</button>
    </div>
</div>
</code>```

Tried another another way using one button and a loop but didnt work, just want to make 2 buttons instead of the one.

Title: How to add Previous and next buttons?

Body:
I would like to add some buttons that allow the user to scroll through all the images.

  Beauty and the Beast (1991)

Animation, Family,Fantasy: A prince cursed to spend his days as a     hideous monster sets out to regain his humanity by earning a young woman's love.

      <button class="film-list-button">Watch</button>

      Hook (1991)

Adventure,Comedy,Family: When Captain James Hook kidnaps    his children, an adult Peter Pan must return to Neverland and reclaim his youthful spirit in order   to challenge his old enemy.

      <button class="film-list-button">Watch</button>

      The Wild (2006)

Animation,Adventure,Comedy: An adolescent lion is accidentally shipped from the New York Zoo to Africa. Now running free, his zoo pals must put aside their differences to help bring him back.

      <button class="film-list-button">Watch</button>

      Shrek 3 (2007)

Animation,Adventure,Comedy: Designated as the heir to the land of Far, Far Away, Shrek hatches a plan to install the rebellious Artie as the new king while Princess Fiona tries to fend off a coup d'état by Prince Charming.

      <button class="film-list-button">Watch</button>

      The Princess Diaries (2001)

Comedy,Family,Romance: Mia Thermopolis has just found out that she is the heir to the throne of Genovia. With her friends Lilly and Michael Moscovitz in tow, she tries to navigate through the rest of her sixteenth year.

      <button class="film-list-button">Watch</button>

      Finding Nemo (2003)

Animation,Adventure,Comedy: After his son is captured in the Great Barrier Reef and taken to Sydney, a timid clownfish sets out on a journey to bring him home.

      <button class="film-list-button">Watch</button>

      Despicable Me (2010)

Animation,Adventure,Comedy: When a criminal mastermind uses a trio of orphan girls as pawns for a grand scheme, he finds their love is profoundly changing him for the better.

      <button class="film-list-button">Watch</button>

Tried another another way using one button and a loop but didnt work, just want to make 2 buttons instead of the one.


问:
React DataTable Component - Default Sort Not Working
I use the react-data-table-component (along with the react-data-table-component-extensions library) for displaying various tables. I have a datatable where the sorting of any column works when I click on the column header but the default sorting does not work when the page is loaded (on other pages where I use different data, it works).

The initial json array data contains a labelid which I use to get the labelname and labelyear, then I add these values into a new json array and pass the new one into the DataTable.

Code Snippet:

```<code>const [initialDiary, setInitialDiary]       = useState([]);
const [updatedDiaries, setUpdatedDiaries]   = useState([]);

useEffect(() => {
      initialDiary.map(diary => {
          // the get functions return simple strings
          var newDiary = {...diary, ['labelName']:getLabelName(diary.labelID),
                                    ['labelYear']:getLabelYear(diary.labelID)};
          setUpdatedDiaries(prev => [...prev, newDiary]);
      })
}, [winediaries]);

...

// I want to sort by labelyear, the 3rd column
<DataTableExtensions columns={columns} data={updatedDiaries} export={false} print={false}>
      <DataTable noHeader defaultSortField={3} defaultSortAsc={false} highlightOnHover customStyles={customStyles}
                 pagination paginationRowsPerPageOptions={rows} paginationPerPage={15}>
      </DataTable>
</DataTableExtensions>
</code>```

Body:
I use the react-data-table-component (along with the react-data-table-component-extensions library) for displaying various tables. I have a datatable where the sorting of any column works when I click on the column header but the default sorting does not work when the page is loaded (on other pages where I use different data, it works).

The initial json array data contains a labelid which I use to get the labelname and labelyear, then I add these values into a new json array and pass the new one into the DataTable.

Code Snippet:

const [initialDiary, setInitialDiary]       = useState([]);
const [updatedDiaries, setUpdatedDiaries]   = useState([]);

useEffect(() => {
      initialDiary.map(diary => {
          // the get functions return simple strings
          var newDiary = {...diary, ['labelName']:getLabelName(diary.labelID),
                                    ['labelYear']:getLabelYear(diary.labelID)};
          setUpdatedDiaries(prev => [...prev, newDiary]);
      })
}, [winediaries]);

...

// I want to sort by labelyear, the 3rd column
<DataTableExtensions columns={columns} data={updatedDiaries} export={false} print={false}>
      <DataTable noHeader defaultSortField={3} defaultSortAsc={false} highlightOnHover customStyles={customStyles}
                 pagination paginationRowsPerPageOptions={rows} paginationPerPage={15}>
      </DataTable>
</DataTableExtensions>


问:
How can I put the elements of a form horizontally?
This is the layout and I would like the form elements to be horizontal instead of vertical

This is my view code

def requerimientos(request):
    form_procesos = forms.procesos
    form_impuesto = forms.impuestos
    return render(request, 'requerimientos.html',{"proceso" : form_procesos,"impuesto" : form_impuesto,"value": 2})
```
<p>This is my HTML code</p>
<pre class="lang-html prettyprint-override"><code><div class="col-12 col-md-6 offset-md-3">
        <div class="card">
            <div class="card-body">
                {% if value == 1 %}

                <h5 style="font-family: 'Ubuntu', sans-serif;">Proceso:</h5>
                <form action="{% url 'contacto' %}" method="POST">
                    {% csrf_token %}
                    {% crispy proceso %}
                </form>

                {% else %}
                <h5 style="font-family: 'Ubuntu', sans-serif;">Proceso:</h5>
                <form action="{% url 'contacto' %}" method="POST">
                    {% csrf_token %}
                    {% crispy proceso %}

                </form>
                <h5 style="font-family: 'Ubuntu', sans-serif;">Impuesto:</h5>
                <form action="{% url 'contacto' %}" method="POST">
                    {% csrf_token %}
                    {% crispy impuesto %}
                </form>
                {% endif %}

            </div>
        </div>

        <!-- Boton de enviar -->
        <br>
        <div class="d-flex justify-content-end">
            <button type="submit" class="btn btn-primary">Enviar</button>
        </div>

    </div>
</code>```

This is my form code

from django.forms import ModelForm
from django import forms
from crispy_forms.helper import FormHelper, Layout

class procesos(forms.Form):
    mora = forms.BooleanField(required=False)
    deuda_atrasada = forms.BooleanField(required=False)

class impuestos(forms.Form):
    inmobiliario = forms.BooleanField(required=False)
    baldio = forms.BooleanField(required=False)
    rural = forms.BooleanField(required=False)
    edificado = forms.BooleanField(required=False)
    automotor = forms.BooleanField(required=False)
    embarcaciones = forms.BooleanField(required=False)
    complementario = forms.BooleanField(required=False)

```

I have another question, I created two forms because I needed to describe what each element was, that is, the process section and the tax section, but... how do I do it if I don't create a single form and show 'x' number of elements? And, if I can't show them, how can I make the button submit these two forms?

In turn, that is why I use a "value" variable to differentiate in case it is, for example, "mora" and when I submit then it will reload the page but it will show another form

Body:
This is the layout and I would like the form elements to be horizontal instead of vertical

This is my view code

def requerimientos(request):
    form_procesos = forms.procesos
    form_impuesto = forms.impuestos
    return render(request, 'requerimientos.html',{"proceso" : form_procesos,"impuesto" : form_impuesto,"value": 2})

This is my HTML code

                {% if value == 1 %}

Proceso:

                <form action="{% url 'contacto' %}" method="POST">
                    {% csrf_token %}
                    {% crispy proceso %}
                </form>

                {% else %}

Proceso:

                <form action="{% url 'contacto' %}" method="POST">
                    {% csrf_token %}
                    {% crispy proceso %}

                </form>

Impuesto:

                <form action="{% url 'contacto' %}" method="POST">
                    {% csrf_token %}
                    {% crispy impuesto %}
                </form>
                {% endif %}

            <button type="submit" class="btn btn-primary">Enviar</button>

This is my form code

from django.forms import ModelForm
from django import forms
from crispy_forms.helper import FormHelper, Layout

class procesos(forms.Form):
    mora = forms.BooleanField(required=False)
    deuda_atrasada = forms.BooleanField(required=False)

class impuestos(forms.Form):
    inmobiliario = forms.BooleanField(required=False)
    baldio = forms.BooleanField(required=False)
    rural = forms.BooleanField(required=False)
    edificado = forms.BooleanField(required=False)
    automotor = forms.BooleanField(required=False)
    embarcaciones = forms.BooleanField(required=False)
    complementario = forms.BooleanField(required=False)

I have another question, I created two forms because I needed to describe what each element was, that is, the process section and the tax section, but... how do I do it if I don't create a single form and show 'x' number of elements? And, if I can't show them, how can I make the button submit these two forms?

In turn, that is why I use a "value" variable to differentiate in case it is, for example, "mora" and when I submit then it will reload the page but it will show another form


问:
Identify Input Record/Row/Line No. causing the Exception in an Spring Batch process
I have been surfing several websites since few days to find a generic solution to this problem : How to identify which input record is causing the Batch process to fail in exception cases?
I have a requirement where I need to log that line no. and corresponding Exception. Note that the record can fail in any Batch phase - Reading, Processing, Writing.

I am new to Java Spring Batch and working at this problem statement. I did find a few options, but not sure if they provide a generic solution:

Create a property in MyObject and set it incrementally in Reader

Implement ItemCountAware, create a property in MyObject and manually increment it by calling setItemCount

Is there an easier and generic way to identify the record no failing in any Batch phase?


问:
Detect progress of a download from HTML download attribute
When using the download attribute on a link, is there a way to measure the progress of the download? Whether it has started or finished etc.
At the moment in our UI we show a message saying "Download starting soon" after the user has clicked. Ideally we would hide this message once the download has actually started.</p>


问:
Separate data response rich text and plain text
I'm dealing with a Next Typescript project. I'm building a form with formik, slate framework to send a form with rich text to server. The problem is with the old data, it was already stored in database as plain text and the new one will be stored as rich text. So, when I receive all data from server, the errors happen when I try to show the data. I need to separate which is the old data with plain text and which is the new with rich text and then use the approciate method to show the data. Please help me and forgive for my bad english.

I tried to slice the string of the response data. If it contain word like "bold, italic,...." so that was rich text but it won't work.


问:
python's FPDF multicell is writing upside down for RTL
I am using a website i built with flask to get data from user (Arabic text) and generate a PDF file using FPDF and merging it with a existing PDF background as a template using PyPDF2, I am also using from bidi.algorithm import get_display import and arabic_reshaper to fix arabic letters.

I am getting a text from <textarea> and sending it to my write_to_pdf(), it does support the multiline and everything is going great except that the text is being written from down

example:

this is my input:

تكريم الطلاب المتفوقين المتفوقين بمتوسطة
  وثانوية عثمان بن عفان للفصل الدراسي الاول اليوم الاحد
 الموافق 1444\6\8 وبحضور مشرف التوجيه و الارشاد  بمكتب تعليم المظيلف الاستاذ عقيل بن محمد الشيخي

output:

output

my writing function:

```<code>def write_to_file(fields):
    PDF = FPDF(format="A4")
    fields: list[dict]
    with open(f"{BASE_PATH}/pdf_templates/school_template.pdf", "rb"):
        PDF.add_page()

    for field in fields:

        set_color(PDF, field["color"])

        set_font(PDF, field["font"], field["font_size"])

        PDF.set_xy(field["coordinates"]["x"], field["coordinates"]["y"])

        fixed_arabic_text = fix_arabic_text(field["text"])

        if field["resize_to_fit"] == True:
            resize_to_fit(PDF, fixed_arabic_text, max_size=field["max_size"])

        PDF.multi_cell(field["width"], field["hieght"], align=field["align"],
                    txt=fixed_arabic_text, border=field["border"], )
</code>```

edit: reversing the text worked but now it writing LTR and i need RTL :D
output 2 but needs to be RTL

Body:
I am using a website i built with flask to get data from user (Arabic text) and generate a PDF file using FPDF and merging it with a existing PDF background as a template using PyPDF2, I am also using from bidi.algorithm import get_display import and arabic_reshaper to fix arabic letters.

I am getting a text from <textarea> and sending it to my write_to_pdf(), it does support the multiline and everything is going great except that the text is being written from down

example:

this is my input:

تكريم الطلاب المتفوقين المتفوقين بمتوسطة
  وثانوية عثمان بن عفان للفصل الدراسي الاول اليوم الاحد
 الموافق 1444\6\8 وبحضور مشرف التوجيه و الارشاد  بمكتب تعليم المظيلف الاستاذ عقيل بن محمد الشيخي

output:

output

my writing function:

def write_to_file(fields):
    PDF = FPDF(format="A4")
    fields: list[dict]
    with open(f"{BASE_PATH}/pdf_templates/school_template.pdf", "rb"):
        PDF.add_page()

    for field in fields:

        set_color(PDF, field["color"])

        set_font(PDF, field["font"], field["font_size"])

        PDF.set_xy(field["coordinates"]["x"], field["coordinates"]["y"])

        fixed_arabic_text = fix_arabic_text(field["text"])

        if field["resize_to_fit"] == True:
            resize_to_fit(PDF, fixed_arabic_text, max_size=field["max_size"])

        PDF.multi_cell(field["width"], field["hieght"], align=field["align"],
                    txt=fixed_arabic_text, border=field["border"], )

edit: reversing the text worked but now it writing LTR and i need RTL :D
output 2 but needs to be RTL


问:
3D animation is giving an error i dont understand
i am trying to make a 3d animation of a solarsystem. It works in 2D but when i try to step it up to 3D i run into an error that i cant fix.

My code :

```<code>fig2 = plt.figure(figsize = (30,30))
ax2 = fig2.add_subplot(1,1,1, projection = "3d")
ax2.set_xlabel("x...[AE]")
ax2.set_ylabel("y...[AE]")
ax2.set_zlabel("z...[AE]")
ax2.set_xlim(-10,10)
ax2.set_ylim(-10,10)
ax2.set_zlim(-10,10)
#ax.set_xlim(-np.max(x_path),np.max(x_path))
#ax.set_ylim(-np.max(y_path),np.max(y_path))
#ax.set_zlim(-np.max(x_path),np.max(x_path))
ax2.grid()

for i in range(N):
    ax2.plot3D(position[i][0]/AE, position[i][1]/AE ,position[i][2]/AE)

planets = []    # müssen für die simulation punkte erstellen, die dann in der simulation         geupdated werden

for i in range(N):
    punkt, = ax2.plot(position[i][0][0]/ AE, position[i][1][0] / AE, position[i][2][0] /AE,      color = color[i], markersize = 50) # erstellt die punkte an den startpositionen
    planets.append(punkt)

def update(frames):                      # funktion for the animation
   for i in range(N):
       planets[i].set_data(position[i][0][frames] / AE, position[i][1][frames]/AE)
       planets[i].set_3d_properties(position[i][2][frames]/AE)
   return planets

animation = mpl.animation.FuncAnimation(fig2, update, interval=1000, frames = t.size)
animation.save("Sonnensystem.mp4", fps=30)
plt.show()
</code>```

the error:

```<code>File "file name", line 1538, in plot

zs = np.broadcast_to(zs, len(xs))

TypeError: object of type 'numpy.float64' has no len()
</code>```

does someone know whats the couse ?

thanks :)

I am trying to genereate a 3D animation of the solarsystem. It workes fine in 2D but for 3D i get an unknown error that i cant fix

Body:
i am trying to make a 3d animation of a solarsystem. It works in 2D but when i try to step it up to 3D i run into an error that i cant fix.

My code :

fig2 = plt.figure(figsize = (30,30))
ax2 = fig2.add_subplot(1,1,1, projection = "3d")
ax2.set_xlabel("x...[AE]")
ax2.set_ylabel("y...[AE]")
ax2.set_zlabel("z...[AE]")
ax2.set_xlim(-10,10)
ax2.set_ylim(-10,10)
ax2.set_zlim(-10,10)
#ax.set_xlim(-np.max(x_path),np.max(x_path))
#ax.set_ylim(-np.max(y_path),np.max(y_path))
#ax.set_zlim(-np.max(x_path),np.max(x_path))
ax2.grid()

for i in range(N):
    ax2.plot3D(position[i][0]/AE, position[i][1]/AE ,position[i][2]/AE)

planets = []    # müssen für die simulation punkte erstellen, die dann in der simulation         geupdated werden

for i in range(N):
    punkt, = ax2.plot(position[i][0][0]/ AE, position[i][1][0] / AE, position[i][2][0] /AE,      color = color[i], markersize = 50) # erstellt die punkte an den startpositionen
    planets.append(punkt)

def update(frames):                      # funktion for the animation
   for i in range(N):
       planets[i].set_data(position[i][0][frames] / AE, position[i][1][frames]/AE)
       planets[i].set_3d_properties(position[i][2][frames]/AE)
   return planets

animation = mpl.animation.FuncAnimation(fig2, update, interval=1000, frames = t.size)
animation.save("Sonnensystem.mp4", fps=30)
plt.show()

the error:

File "file name", line 1538, in plot

zs = np.broadcast_to(zs, len(xs))

TypeError: object of type 'numpy.float64' has no len()

does someone know whats the couse ?

thanks :)

I am trying to genereate a 3D animation of the solarsystem. It workes fine in 2D but for 3D i get an unknown error that i cant fix


问:
Plot Trajectory of Tracked Objects: PyQtGraph
I need to plot a trajectory of tracked objects in PyQtGraph. For this, to make this application dynamic, I need to concatenate variable names with numbers like this

```<code>self.plot(X1, Y1....)
self.plot(X2, Y2...)
self.plot(X3, Y3...)
</code>```

Is there a possible solution to make variable names like this in Python? I cannot use list because the plot data has arrays of different shapes and scales, besides, the plot function of PyQtGraph doesnt take multi-dimensional array. It throws error.

I am a newbie in Python. So, couldn't find any solution to this. Can anyone help me please? Thanks in advance.

The code of drawing plot

```<code>    def graphPlot(self, data):
    X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5, X6, Y6, X7, Y7, X8, Y8, X9, Y9, X10, Y10, X11, Y11, X12, Y12, X13, Y13, X14, Y14, X15, Y15, X16, Y16, X17, Y17, X18, Y18, X19, Y19, X20, Y20, X21, Y21 = [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []

    #for i in :
    for dt in data:
        dt2 = dt.split(',')
        frame, time, tracker_id, class_, xmin, ymin, xmax, ymax, x, y =  dt2
        tid = int(''.join(filter(str.isdigit, tracker_id)))
        #Tracks.append(tid)
        if tid == 1:
            #print(dt2)
            x1 = float(''.join(filter(str.isdigit, x)))
            y1 = float(''.join(filter(str.isdigit, y)))
            x2 = x1/1000
            y2 = y1/1000
            X1.append(x2)
            Y1.append(y2)

        if tid == 2:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X2.append(x2)
            Y2.append(y2)

        if tid == 3:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X3.append(x2)
            Y3.append(y2)

        if tid == 4:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X4.append(x2)
            Y4.append(y2)

        if tid == 5:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X5.append(x2)
            Y5.append(y2)

        if tid == 10:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X6.append(x2)
            Y6.append(y2)

        if tid == 11:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X7.append(x2)
            Y7.append(y2)

        if tid == 13:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X8.append(x2)
            Y8.append(y2)

        if tid == 14:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X9.append(x2)
            Y9.append(y2)

        if tid == 15:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X10.append(x2)
            Y10.append(y2)

        if tid == 17:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X11.append(x2)
            Y11.append(y2)

        if tid == 19:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X12.append(x2)
            Y12.append(y2)

        if tid == 20:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X13.append(x2)
            Y13.append(y2)

        if tid == 21:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X14.append(x2)
            Y14.append(y2)

        if tid == 22:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X15.append(x2)
            Y15.append(y2)

        if tid == 25:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X16.append(x2)
            Y16.append(y2)

        if tid == 28:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X17.append(x2)
            Y17.append(y2)

        if tid == 29:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X18.append(x2)
            Y18.append(y2)

        if tid == 30:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X19.append(x2)
            Y19.append(y2)

        if tid == 31:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X20.append(x2)
            Y20.append(y2)

        if tid == 32:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X21.append(x2)
            Y21.append(y2)

    self.plot(X1, Y1, "Tracker ID: 1", 'y')
    self.plot(X2, Y2, "Tracker ID: 2", 'm')
    self.plot(X3, Y3, "Tracker ID: 3", 'w')
    self.plot(X4, Y4, "Tracker ID: 4", 'l')
    self.plot(X5, Y5, "Tracker ID: 5", 'b')
    self.plot(X6, Y6, "Tracker ID: 10", 'g')
    self.plot(X7, Y7, "Tracker ID: 11", 'r')
    self.plot(X8, Y8, "Tracker ID: 13", 'b')
    self.plot(X9, Y9, "Tracker ID: 14", 'g')
    self.plot(X10, Y10, "Tracker ID: 15", 'l')
    self.plot(X11, Y11, "Tracker ID: 17", 'd')
    self.plot(X12, Y12, "Tracker ID: 19", 'c')
    self.plot(X13, Y13, "Tracker ID: 20", 'r')
    self.plot(X14, Y14, "Tracker ID: 21", 'm')
    self.plot(X15, Y15, "Tracker ID: 22", 'w')
    self.plot(X16, Y16, "Tracker ID: 25", 'y')
    self.plot(X17, Y17, "Tracker ID: 28", 'r')
    self.plot(X18, Y18, "Tracker ID: 29", 'g')
    self.plot(X19, Y19, "Tracker ID: 30", 'w')
    self.plot(X20, Y20, "Tracker ID: 31", 'b')
    self.plot(X21, Y21, "Tracker ID: 32", 'r')

    # t = (np.unique(Tracks))
    # print(t)

def plot(self, x, y, plotname, color):
    pen = pg.mkPen(color=color)
    self.graphWidget.plot(x, y, name=plotname, pen=pen)
</code>```

Body:
I need to plot a trajectory of tracked objects in PyQtGraph. For this, to make this application dynamic, I need to concatenate variable names with numbers like this

self.plot(X1, Y1....)
self.plot(X2, Y2...)
self.plot(X3, Y3...)

Is there a possible solution to make variable names like this in Python? I cannot use list because the plot data has arrays of different shapes and scales, besides, the plot function of PyQtGraph doesnt take multi-dimensional array. It throws error.

I am a newbie in Python. So, couldn't find any solution to this. Can anyone help me please? Thanks in advance.

The code of drawing plot

    def graphPlot(self, data):
    X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5, X6, Y6, X7, Y7, X8, Y8, X9, Y9, X10, Y10, X11, Y11, X12, Y12, X13, Y13, X14, Y14, X15, Y15, X16, Y16, X17, Y17, X18, Y18, X19, Y19, X20, Y20, X21, Y21 = [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []

    #for i in :
    for dt in data:
        dt2 = dt.split(',')
        frame, time, tracker_id, class_, xmin, ymin, xmax, ymax, x, y =  dt2
        tid = int(''.join(filter(str.isdigit, tracker_id)))
        #Tracks.append(tid)
        if tid == 1:
            #print(dt2)
            x1 = float(''.join(filter(str.isdigit, x)))
            y1 = float(''.join(filter(str.isdigit, y)))
            x2 = x1/1000
            y2 = y1/1000
            X1.append(x2)
            Y1.append(y2)

        if tid == 2:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X2.append(x2)
            Y2.append(y2)

        if tid == 3:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X3.append(x2)
            Y3.append(y2)

        if tid == 4:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X4.append(x2)
            Y4.append(y2)

        if tid == 5:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X5.append(x2)
            Y5.append(y2)

        if tid == 10:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X6.append(x2)
            Y6.append(y2)

        if tid == 11:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X7.append(x2)
            Y7.append(y2)

        if tid == 13:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X8.append(x2)
            Y8.append(y2)

        if tid == 14:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X9.append(x2)
            Y9.append(y2)

        if tid == 15:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X10.append(x2)
            Y10.append(y2)

        if tid == 17:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X11.append(x2)
            Y11.append(y2)

        if tid == 19:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X12.append(x2)
            Y12.append(y2)

        if tid == 20:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X13.append(x2)
            Y13.append(y2)

        if tid == 21:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X14.append(x2)
            Y14.append(y2)

        if tid == 22:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X15.append(x2)
            Y15.append(y2)

        if tid == 25:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X16.append(x2)
            Y16.append(y2)

        if tid == 28:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X17.append(x2)
            Y17.append(y2)

        if tid == 29:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X18.append(x2)
            Y18.append(y2)

        if tid == 30:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X19.append(x2)
            Y19.append(y2)

        if tid == 31:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X20.append(x2)
            Y20.append(y2)

        if tid == 32:
            x2 = float(''.join(filter(str.isdigit, x)))
            y2 = float(''.join(filter(str.isdigit, y)))
            x2 = x2/1000
            y2 = y2/1000
            X21.append(x2)
            Y21.append(y2)

    self.plot(X1, Y1, "Tracker ID: 1", 'y')
    self.plot(X2, Y2, "Tracker ID: 2", 'm')
    self.plot(X3, Y3, "Tracker ID: 3", 'w')
    self.plot(X4, Y4, "Tracker ID: 4", 'l')
    self.plot(X5, Y5, "Tracker ID: 5", 'b')
    self.plot(X6, Y6, "Tracker ID: 10", 'g')
    self.plot(X7, Y7, "Tracker ID: 11", 'r')
    self.plot(X8, Y8, "Tracker ID: 13", 'b')
    self.plot(X9, Y9, "Tracker ID: 14", 'g')
    self.plot(X10, Y10, "Tracker ID: 15", 'l')
    self.plot(X11, Y11, "Tracker ID: 17", 'd')
    self.plot(X12, Y12, "Tracker ID: 19", 'c')
    self.plot(X13, Y13, "Tracker ID: 20", 'r')
    self.plot(X14, Y14, "Tracker ID: 21", 'm')
    self.plot(X15, Y15, "Tracker ID: 22", 'w')
    self.plot(X16, Y16, "Tracker ID: 25", 'y')
    self.plot(X17, Y17, "Tracker ID: 28", 'r')
    self.plot(X18, Y18, "Tracker ID: 29", 'g')
    self.plot(X19, Y19, "Tracker ID: 30", 'w')
    self.plot(X20, Y20, "Tracker ID: 31", 'b')
    self.plot(X21, Y21, "Tracker ID: 32", 'r')

    # t = (np.unique(Tracks))
    # print(t)

def plot(self, x, y, plotname, color):
    pen = pg.mkPen(color=color)
    self.graphWidget.plot(x, y, name=plotname, pen=pen)


问:
Content items do not reload when new data arrives?
I am currently working on the backend of my electron software with a python program that continuously sends random data to the javascript program and to the react variables (React library) via Flask. But the element that receives the data does not reload automatically. I have to reload the page to display new data because as soon as I reload the page, it calls the getdata() function of my python program. I would like to know how to insert the data so that the elements update automatically with the display?

Here is my JS and python code :

main.js :

```<code>const { BrowserWindow, app, ipcMain, Notification } = require('electron');
const path = require('path');

const isDev = !app.isPackaged;

function createWindow() {
  const win = new BrowserWindow({
    width: 1200,
    height: 800,
    backgroundColor: "white",
    webPreferences: {
      nodeIntegration: false,
      worldSafeExecuteJavaScript: true,
      contextIsolation: true,
      preload: path.join(__dirname, 'preload.js')
    }
  })

  win.loadFile('index.html');
}

if (isDev) {
  require('electron-reload')(__dirname, {
    electron: path.join(__dirname, 'node_modules', '.bin', 'electron')
  })
}

app.whenReady().then(createWindow)
</code>```

App.js :

```<code>import React, { useState, useEffect } from 'react';

export default function App() {
  const [data, setData] = useState([]);

  useEffect(() => {
    const fetchData = async () => {
      const response = await fetch("http://localhost:5000/api/data");
      const data = await response.json();
      setData(data);
    };
    // Exécute la fonction toutes les secondes
    const intervalId = setInterval(fetchData, 1000);
    // Nettoie l'intervalle lorsque le composant est démonté
    return () => clearInterval(intervalId);
    }, []);
  return (
    <div>
            <div class="home">
                <div class="template-1" id="temp1">
                <div class="panel-1">
                    <div class="panel-header">
                    <h1>Panel 1</h1>
                    <i class='bx bx-cog modal-trigger-panel'></i>
                    </div>
                    <div class="panel-body">
                    <div class="sec-5 modal-trigger-data" id="hs-sec-5">
                        <span class="h1" id="h1-fs-s5">{this.state.data[0]}</span>
                        <h2>TWIST</h2>
                        <h3>s5</h3>
                    </div>
                    <div class="sec-4 modal-trigger-data" id="hs-sec-4">
                        <h1>--</h1>
                        <h2>TWIST</h2>
                        <h3>s4</h3>
                    </div>
                    <div class="sec-3 modal-trigger-data" id="hs-sec-3">
                        <h1>--</h1>
                        <h2>TWIST</h2>
                        <h3>s3</h3>
                    </div>
                    <div class="sec-2 modal-trigger-data" id="hs-sec-2">
                        <h1>--</h1>
                        <h2>TWIST</h2>
                        <h3>s2</h3>
                    </div>
                    <div class="sec-1 modal-trigger-data" id="hs-sec-1">
                        <h1>--</h1>
                        <h2>TWIST</h2>
                        <h3>s1</h3>
                    </div>
                    </div>
                </div>
                </div>
            </div>
        </div>
  )
}
</code>```

Python :

```<code>from flask import Flask, jsonify
import random

app = Flask(__name__)

@app.route('/api/data')
def get_data():
  data = [random.randint(0, 100) for _ in range(10)]
  return jsonify(data)

if __name__ == '__main__':
  app.run(debug=True)
</code>```

Regards,

Body:
I am currently working on the backend of my electron software with a python program that continuously sends random data to the javascript program and to the react variables (React library) via Flask. But the element that receives the data does not reload automatically. I have to reload the page to display new data because as soon as I reload the page, it calls the getdata() function of my python program. I would like to know how to insert the data so that the elements update automatically with the display?

Here is my JS and python code :

main.js :

const { BrowserWindow, app, ipcMain, Notification } = require('electron');
const path = require('path');

const isDev = !app.isPackaged;

function createWindow() {
  const win = new BrowserWindow({
    width: 1200,
    height: 800,
    backgroundColor: "white",
    webPreferences: {
      nodeIntegration: false,
      worldSafeExecuteJavaScript: true,
      contextIsolation: true,
      preload: path.join(__dirname, 'preload.js')
    }
  })

  win.loadFile('index.html');
}

if (isDev) {
  require('electron-reload')(__dirname, {
    electron: path.join(__dirname, 'node_modules', '.bin', 'electron')
  })
}

app.whenReady().then(createWindow)

App.js :

import React, { useState, useEffect } from 'react';

export default function App() {
  const [data, setData] = useState([]);

  useEffect(() => {
    const fetchData = async () => {
      const response = await fetch("http://localhost:5000/api/data");
      const data = await response.json();
      setData(data);
    };
    // Exécute la fonction toutes les secondes
    const intervalId = setInterval(fetchData, 1000);
    // Nettoie l'intervalle lorsque le composant est démonté
    return () => clearInterval(intervalId);
    }, []);
  return (

Panel 1

                        {this.state.data[0]}

TWIST

s5

--

TWIST

s4

--

TWIST

s3

--

TWIST

s2

--

TWIST

s1

  )
}

Python :

from flask import Flask, jsonify
import random

app = Flask(__name__)

@app.route('/api/data')
def get_data():
  data = [random.randint(0, 100) for _ in range(10)]
  return jsonify(data)

if __name__ == '__main__':
  app.run(debug=True)

Regards,


问:
Using ODataQueryOptions in .NET Core (how to create a HttpRequest/HttpRequestMessage?)
I am trying to convert a .NET Framework project to .NET Core. There is a method that contains this code:

```<code>var type = model.FindDeclaredType(typeof(T).FullName);
var source = model.FindEntityContainer("Container").FindEntitySet(nameof(T));
var context = new ODataQueryContext(model, typeof(T), null);

var request = new HttpRequestMessage(HttpMethod.Get, baseAddress + dataQueryString);
queryOptions = new ODataQueryOptions<T>(context, request);
</code>```

I get the error that it cannot convert a HttpRequestMessage from type System.Net.Http.HttpRequestMessage to Microsoft.AspNetCore.Http.HttpRequest. Apparently HttpRequestMessage is deprecated in .NET Core, but I also can't find any information on how to create a HttpRequest. I'm using the Microsoft.AspNetCore.Odata nuget package v8.0.12. This is a client application, so I'm open to other ways of doing this if there are more simple options available.

Any help is much appreciated.

Tried different versions of the package. Tried the httpshim package. Tried installing the AspNetCore.Http package but then get errors about dependency versions. Tried a lot of googling but it always shows me non-.NET core code.

Body:
I am trying to convert a .NET Framework project to .NET Core. There is a method that contains this code:

var type = model.FindDeclaredType(typeof(T).FullName);
var source = model.FindEntityContainer("Container").FindEntitySet(nameof(T));
var context = new ODataQueryContext(model, typeof(T), null);

var request = new HttpRequestMessage(HttpMethod.Get, baseAddress + dataQueryString);
queryOptions = new ODataQueryOptions<T>(context, request);

I get the error that it cannot convert a HttpRequestMessage from type System.Net.Http.HttpRequestMessage to Microsoft.AspNetCore.Http.HttpRequest. Apparently HttpRequestMessage is deprecated in .NET Core, but I also can't find any information on how to create a HttpRequest. I'm using the Microsoft.AspNetCore.Odata nuget package v8.0.12. This is a client application, so I'm open to other ways of doing this if there are more simple options available.

Any help is much appreciated.

Tried different versions of the package. Tried the httpshim package. Tried installing the AspNetCore.Http package but then get errors about dependency versions. Tried a lot of googling but it always shows me non-.NET core code.


问:
Tab navigation React Native hide part of bottom menu buttons
I am new to this field and have been puzzling over this question for several days. Now I have three screens and three buttons.
I try to do next.

When I click on a middle button I want to hide left and right buttons and change active button's image.

This code from documentation with a small modification
when I click on right button I want to switch left and middle buttons

```<code>import * as React from 'react';
import { Text, View } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';

function HomeScreen() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Home!</Text>
    </View>
  );
}

function SettingsScreen() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Settings!</Text>
    </View>
  );
}

const Tab = createBottomTabNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Tab.Navigator
        screenOptions={({ route }) => ({
          tabBarIcon: ({ focused, color, size }) => {
            if (route.name === 'Home') {
              return (
                <Ionicons
                  name={
                    focused
                      ? 'ios-information-circle'
                      : 'ios-information-circle-outline'
                  }
                  size={size}
                  color={color}
                />
              );
            } else if (route.name === 'Settings') {
              return (
                <Ionicons
                  name={focused ? 'beaker' : 'ios-list'}
                  size={size}
                  color={color}
                />
              );
            }  else if (route.name === 'Test') {
              return (
                <Ionicons
                  name={focused ? 'basketball' : 'aperture'}
                  size={size}
                  color={color}
                />
              );
            }
          },
          tabBarInactiveTintColor: 'gray',
          tabBarActiveTintColor: 'tomato',
        })}>
        <Tab.Screen
          name="Home"
          component={HomeScreen}
          options={{ tabBarBadge: 3 }}
        />
        <Tab.Screen name="Settings" component={SettingsScreen} />
        <Tab.Screen name="Test" component={SettingsScreen} />
      </Tab.Navigator>
    </NavigationContainer>
  );
}
</code>```

Body:
I am new to this field and have been puzzling over this question for several days. Now I have three screens and three buttons.
I try to do next.

When I click on a middle button I want to hide left and right buttons and change active button's image.

This code from documentation with a small modification
when I click on right button I want to switch left and middle buttons

import * as React from 'react';
import { Text, View } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';

function HomeScreen() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Home!</Text>
    </View>
  );
}

function SettingsScreen() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Settings!</Text>
    </View>
  );
}

const Tab = createBottomTabNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Tab.Navigator
        screenOptions={({ route }) => ({
          tabBarIcon: ({ focused, color, size }) => {
            if (route.name === 'Home') {
              return (
                <Ionicons
                  name={
                    focused
                      ? 'ios-information-circle'
                      : 'ios-information-circle-outline'
                  }
                  size={size}
                  color={color}
                />
              );
            } else if (route.name === 'Settings') {
              return (
                <Ionicons
                  name={focused ? 'beaker' : 'ios-list'}
                  size={size}
                  color={color}
                />
              );
            }  else if (route.name === 'Test') {
              return (
                <Ionicons
                  name={focused ? 'basketball' : 'aperture'}
                  size={size}
                  color={color}
                />
              );
            }
          },
          tabBarInactiveTintColor: 'gray',
          tabBarActiveTintColor: 'tomato',
        })}>
        <Tab.Screen
          name="Home"
          component={HomeScreen}
          options={{ tabBarBadge: 3 }}
        />
        <Tab.Screen name="Settings" component={SettingsScreen} />
        <Tab.Screen name="Test" component={SettingsScreen} />
      </Tab.Navigator>
    </NavigationContainer>
  );
}


问:
Where to store the external access token using when SPA is using JWT
So this is more a question of concept than actual code

So I have authenticated a user against an external CRM (Dynamics) system. Here all portal users are connected to one user in CRM which is named "API".

When I authenticate John Doe against the CRM system he gets a access token to the external CRM as a user named "API".
So I use JWT, containing some small information about this Contact (John Doe) in the payload. And a secret which is stored on the server to verify what contact is sending the request.

But my problem is now with the access token (generated from the external system), what should I do with that. Because I cant put it in the payload, as this is sensitive data and will easily be read in the JWT and they will get access to the external system.
And if there are 100 000 portal users, I can't retrieve an access token for each time they write/read from/to CRM. So I one way or another I probably should store this external access token. But what is my options and is it a 'best way' to store this external access token?


问:
"(#200) Provide valid app ID", when accessing graph API explorer via URL
I want to retrieve data regarding insights of my Facebook posts. I am able to retrieve all this information under graph API explorer but keep on getting errors the moment I put it into a graph URL.
Here is the URL :

https://graph.facebook.com/v15.0/{page_id}/posts?fields=insights.metric(post_engaged_users,page_posts_impressions_unique)&token_access=ACCESS_TOKEN

(I removed the page_id and ACCESS_TOKEN for privacy.)

I end up getting this error:

```<code>{
   "error": {
      "message": "(#200) Provide valid app ID",
      "type": "OAuthException",
      "code": 200,
      "fbtrace_id": "AuaCwwoNGZW_U4Ivay4Xi1f"
   }
}
</code>```

Can someone guide me on what to do in this case? I guess I have to include my app_ID into the Graph API URL, but where exactly?

Thank you.

I searched for a solution from the Facebook developer community but could not get any solutions.

Body:
I want to retrieve data regarding insights of my Facebook posts. I am able to retrieve all this information under graph API explorer but keep on getting errors the moment I put it into a graph URL.
Here is the URL :

https://graph.facebook.com/v15.0/{page_id}/posts?fields=insights.metric(post_engaged_users,page_posts_impressions_unique)&token_access=ACCESS_TOKEN

(I removed the page_id and ACCESS_TOKEN for privacy.)

I end up getting this error:

{
   "error": {
      "message": "(#200) Provide valid app ID",
      "type": "OAuthException",
      "code": 200,
      "fbtrace_id": "AuaCwwoNGZW_U4Ivay4Xi1f"
   }
}

Can someone guide me on what to do in this case? I guess I have to include my app_ID into the Graph API URL, but where exactly?

Thank you.

I searched for a solution from the Facebook developer community but could not get any solutions.


Title: MAX9867 Not redirecting MICLP input to LOUTP

Body:
I'm having problems configuring max9867 as a direct output without going through I2C. I perform the settings of the following registers. I'm using zephyr as rtos.

[00:00:01.709,625] <dbg> max9867: codec_read_reg: RD | REG: 0x00 VAL: 0x00 - 00000000
[00:00:01.730,651] <dbg> max9867: codec_read_reg: RD | REG: 0x01 VAL: 0x20 - 00100000
[00:00:01.751,586] <dbg> max9867: codec_read_reg: RD | REG: 0x02 VAL: 0x00 - 00000000
[00:00:01.772,491] <dbg> max9867: codec_read_reg: RD | REG: 0x03 VAL: 0x00 - 00000000
[00:00:01.793,518] <dbg> max9867: codec_read_reg: RD | REG: 0x04 VAL: 0xe6 - 11100110
[00:00:01.814,361] <dbg> max9867: codec_read_reg: RD | REG: 0x05 VAL: 0x10 - 00010000
[00:00:01.835,601] <dbg> max9867: codec_read_reg: RD | REG: 0x06 VAL: 0x10 - 00010000
[00:00:01.856,689] <dbg> max9867: codec_read_reg: RD | REG: 0x07 VAL: 0x01 - 00000001
[00:00:01.877,685] <dbg> max9867: codec_read_reg: RD | REG: 0x08 VAL: 0x00 - 00000000
[00:00:01.898,834] <dbg> max9867: codec_read_reg: RD | REG: 0x09 VAL: 0x00 - 00000000
[00:00:01.919,708] <dbg> max9867: codec_read_reg: RD | REG: 0x0a VAL: 0x11 - 00010001
[00:00:01.940,979] <dbg> max9867: codec_read_reg: RD | REG: 0x0b VAL: 0xc0 - 11000000
[00:00:01.962,188] <dbg> max9867: codec_read_reg: RD | REG: 0x0c VAL: 0x00 - 00000000
[00:00:01.983,123] <dbg> max9867: codec_read_reg: RD | REG: 0x0d VAL: 0x33 - 00110011
[00:00:02.004,180] <dbg> max9867: codec_read_reg: RD | REG: 0x0e VAL: 0x00 - 00000000
[00:00:02.025,329] <dbg> max9867: codec_read_reg: RD | REG: 0x0f VAL: 0x00 - 00000000
[00:00:02.046,264] <dbg> max9867: codec_read_reg: RD | REG: 0x10 VAL: 0x04 - 00000100
[00:00:02.067,230] <dbg> max9867: codec_read_reg: RD | REG: 0x11 VAL: 0x09 - 00001001
[00:00:02.088,165] <dbg> max9867: codec_read_reg: RD | REG: 0x12 VAL: 0x34 - 00110100
[00:00:02.109,130] <dbg> max9867: codec_read_reg: RD | REG: 0x13 VAL: 0x34 - 00110100
[00:00:02.130,035] <dbg> max9867: codec_read_reg: RD | REG: 0x14 VAL: 0x40 - 01000000
[00:00:02.150,909] <dbg> max9867: codec_read_reg: RD | REG: 0x15 VAL: 0x00 - 00000000
[00:00:02.172,027] <dbg> max9867: codec_read_reg: RD | REG: 0x16 VAL: 0x03 - 00000011
[00:00:02.193,023] <dbg> max9867: codec_read_reg: RD | REG: 0x17 VAL: 0x00 - 00000000

The image below follows the shape of the flow I'm trying to configure.
Functional Diagram

But there is no signal coming out of the LOUTP. Do you have any guidance for me, am I doing something wrong?


问:
How do I troubleshoot the "PLS-00103: Encountered the symbol 'end-of-file' when expecting one of the following" error in Griddb?
My Code:

```<code>CREATE OR REPLACE PROCEDURE get_employee_name (p_id IN NUMBER, p_name OUT VARCHAR)
AS
BEGIN
  SELECT name INTO p_name
  FROM employees
  WHERE id = p_id;
END;
/

BEGIN
  get_employee_name(1, v_name);
  DBMS_OUTPUT.PUT_LINE('Employee name: ' || v_name);
END;
</code>```

I'm trying to execute this query below but got this error:

PLS-00103: Encountered the symbol 'end-of-file' when expecting one of
the following

Body:
My Code:

CREATE OR REPLACE PROCEDURE get_employee_name (p_id IN NUMBER, p_name OUT VARCHAR)
AS
BEGIN
  SELECT name INTO p_name
  FROM employees
  WHERE id = p_id;
END;
/

BEGIN
  get_employee_name(1, v_name);
  DBMS_OUTPUT.PUT_LINE('Employee name: ' || v_name);
END;

I'm trying to execute this query below but got this error:

PLS-00103: Encountered the symbol 'end-of-file' when expecting one of
the following


问:
I am trying to connect MSSql Server using JTDS library in android studio. but it is time out when I am using Mobile Network
I am using JTDS library to connect to MSSql Server Database. It is working perfectly on all previous version of android. But after upgrading android 13, it is not get connected when i am using mobile network. But it is getting connected when i am using wifi network.

connection= DriverManager.getConnection(connectionURL);
Here it is giving Network I/O Error. But surprisingly it is working perfectly on wifi network.

Please help me sort out this issue....
Thanks in advance

I tried connection on wifi network as well as mobile network. It is working on wifi network. not on mobile network. And this issue is started after upgrading android 13. All previous version of android are doing well.