问:
SQL server query to enter a new line in a same string
```<code>SELECT MI_CTIT_QUERIES.CTIT_QERY_SOURCE_MEM
, REPLACE(SUBSTRING(MI_CTIT_QUERIES.CTIT_QERY_SOURCE_MEM, 7, (LEN(MI_CTIT_QUERIES.CTIT_QERY_SOURCE_MEM) - 418)), ',', CHAR(10)) "Base Query"
, MI_CTIT_QUERIES.CTIT_KEY
FROM MI_CTIT_QUERIES
WHERE MI_CTIT_QUERIES.CTIT_KEY = 14298604
</code>```

Above is the query I have built to provide me results wherever it finds comma it will put the next string to new line but its just creating a tab

The String should appear as

'Do not edit' "Do not edit" newline
[MI_EVWKHIST].[MI_EVENT_TYP_CHR] "Order Type Code"
and so on...

Body:
SELECT MI_CTIT_QUERIES.CTIT_QERY_SOURCE_MEM
, REPLACE(SUBSTRING(MI_CTIT_QUERIES.CTIT_QERY_SOURCE_MEM, 7, (LEN(MI_CTIT_QUERIES.CTIT_QERY_SOURCE_MEM) - 418)), ',', CHAR(10)) "Base Query"
, MI_CTIT_QUERIES.CTIT_KEY
FROM MI_CTIT_QUERIES
WHERE MI_CTIT_QUERIES.CTIT_KEY = 14298604

Above is the query I have built to provide me results wherever it finds comma it will put the next string to new line but its just creating a tab

The String should appear as

'Do not edit' "Do not edit" newline
[MI_EVWKHIST].[MI_EVENT_TYP_CHR] "Order Type Code"
and so on...


来源: stackexchange

问:
Chrome local storage ignores .then() and .catch()
I trying to make a language manager for my chrome extension, for that I need to store an int value  in the local storage using a getter/setter.

```<code>function setLanguage(language) {
  chrome.storage.local.set({"language": language})
  .then(() => {
    //actions
    return (0);
  }).catch(() => {
    return (1)
  });
}

function getLanguage() {
  console.log("gettingLanguage");
  chrome.storage.local.get(["language"])
  .then((result) => {
    console.log(result.language);
    return (result.language);
  }).catch(() => {
    console.log("error");
    return (-1);
  });
  console.log("ignored");
}

</code>```

When I use these functions in the same file, I get the correct output.
However upon calling the get function in antoher file, it seems to be ignoring the then and catch and somehow reaches the end of the function as shown below.

As I've said, I tried to put the calling function in the same file, however it causes more problems for the implementation of other features.

I try to search for other solutions online but didn't find anything relevant.

ContentLicense: CC BY-SA 4.0

Body:
I trying to make a language manager for my chrome extension, for that I need to store an int value  in the local storage using a getter/setter.

function setLanguage(language) {
  chrome.storage.local.set({"language": language})
  .then(() => {
    //actions
    return (0);
  }).catch(() => {
    return (1)
  });
}

function getLanguage() {
  console.log("gettingLanguage");
  chrome.storage.local.get(["language"])
  .then((result) => {
    console.log(result.language);
    return (result.language);
  }).catch(() => {
    console.log("error");
    return (-1);
  });
  console.log("ignored");
}

When I use these functions in the same file, I get the correct output.
However upon calling the get function in antoher file, it seems to be ignoring the then and catch and somehow reaches the end of the function as shown below.

As I've said, I tried to put the calling function in the same file, however it causes more problems for the implementation of other features.

I try to search for other solutions online but didn't find anything relevant.


问:
Error when deploying .NET Core webapp to IIS
am getting the following error when i try to build and debug the solution

Error : The "CreateManifestFile" task returned false but did not log an error.


问:
Are there CPUs that do optimize integer divisions like compilers do?
As title says, optimizing compilers transform division by constant (non-pow 2) into reciprocal multiplication to avoid time expensive div instruction. I'm curious whether there is a CPU that does this optimization as code is being executed, caching frequently used divisor's 'magical constants' in a cache table and use them for computing div, if divisor operand is present in cache.

I've run some experiment on x64 (C++) and M1 (Rust, below), repeatedly dividing a number by same divisor and dividing by ever-changing divisor in loop. Both ended up being identical in performance comparison, I guess answer is no at least for these CPUs I tested on.

type div32 = i32;

#[inline(never)]
fn div_bench_fn(dividend: div32, mut divisor: div32, mut step: div32) -> f64 {
    step = std::hint::black_box(step);
    const LOOP_COUNT: u32 = 100_000_000;
    let start = std::time::Instant::now();
    let mut tmp = 0;
    for _ in 0..LOOP_COUNT {
        let res = dividend % divisor;
        divisor += step;
        tmp ^= res;
        std::hint::black_box(tmp);
    }
    let elapsed = start.elapsed().as_secs_f64();
    let div_sec = (LOOP_COUNT as f64) / elapsed;
    div_sec / 1_000_000.
}

fn main() {
    for _ in 0..10 {
        println!("--");
        println!("  static {:.2}m div/sec", div_bench_fn(0x12345678, 127, 0));
        println!("  dynamic {:.2}m div/sec", div_bench_fn(0x12345678, 127, 1));
    }
}
```
<p>Looping code (ARMv8.5-A)</p>
```divbench[0x1000017e8] <+64>:  cbz    w9, 0x10000185c           ; <+180> // panic if divisor == 0
divbench[0x1000017ec] <+68>:  sdiv   w13, w11, w9
divbench[0x1000017f0] <+72>:  msub   w13, w13, w9, w11
divbench[0x1000017f4] <+76>:  add    w9, w9, w19
divbench[0x1000017f8] <+80>:  eor    w8, w13, w8
divbench[0x1000017fc] <+84>:  str    w8, [sp, #0xc]
divbench[0x100001800] <+88>:  subs   w10, w10, #0x1
divbench[0x100001804] <+92>:  b.ne   0x1000017e8               ; <+64>
```
<p>Results (higher is better in this one)</p>
```--
  static 1018.66m div/sec
  dynamic 1568.52m div/sec
--
  static 1574.76m div/sec
  dynamic 1574.63m div/sec
--
  static 1575.77m div/sec
  dynamic 1574.38m div/sec
--
  static 1577.74m div/sec
  dynamic 1581.09m div/sec
--
  static 1585.35m div/sec
  dynamic 1591.46m div/sec
--
  static 1572.47m div/sec
  dynamic 1585.13m div/sec
--
  static 1560.05m div/sec
  dynamic 1571.18m div/sec
--
  static 1575.05m div/sec
  dynamic 1550.98m div/sec
--
  static 1556.27m div/sec
  dynamic 1571.85m div/sec
--
  static 1581.93m div/sec
  dynamic 1579.43m div/sec
```

Probably I'm not the only one to think this but I haven't been able to find information on this.

Body:
As title says, optimizing compilers transform division by constant (non-pow 2) into reciprocal multiplication to avoid time expensive div instruction. I'm curious whether there is a CPU that does this optimization as code is being executed, caching frequently used divisor's 'magical constants' in a cache table and use them for computing div, if divisor operand is present in cache.

I've run some experiment on x64 (C++) and M1 (Rust, below), repeatedly dividing a number by same divisor and dividing by ever-changing divisor in loop. Both ended up being identical in performance comparison, I guess answer is no at least for these CPUs I tested on.

type div32 = i32;

#[inline(never)]
fn div_bench_fn(dividend: div32, mut divisor: div32, mut step: div32) -> f64 {
    step = std::hint::black_box(step);
    const LOOP_COUNT: u32 = 100_000_000;
    let start = std::time::Instant::now();
    let mut tmp = 0;
    for _ in 0..LOOP_COUNT {
        let res = dividend % divisor;
        divisor += step;
        tmp ^= res;
        std::hint::black_box(tmp);
    }
    let elapsed = start.elapsed().as_secs_f64();
    let div_sec = (LOOP_COUNT as f64) / elapsed;
    div_sec / 1_000_000.
}

fn main() {
    for _ in 0..10 {
        println!("--");
        println!("  static {:.2}m div/sec", div_bench_fn(0x12345678, 127, 0));
        println!("  dynamic {:.2}m div/sec", div_bench_fn(0x12345678, 127, 1));
    }
}

Looping code (ARMv8.5-A)

divbench[0x1000017e8] <+64>:  cbz    w9, 0x10000185c           ; <+180> // panic if divisor == 0
divbench[0x1000017ec] <+68>:  sdiv   w13, w11, w9
divbench[0x1000017f0] <+72>:  msub   w13, w13, w9, w11
divbench[0x1000017f4] <+76>:  add    w9, w9, w19
divbench[0x1000017f8] <+80>:  eor    w8, w13, w8
divbench[0x1000017fc] <+84>:  str    w8, [sp, #0xc]
divbench[0x100001800] <+88>:  subs   w10, w10, #0x1
divbench[0x100001804] <+92>:  b.ne   0x1000017e8               ; <+64>

Results (higher is better in this one)

--
  static 1018.66m div/sec
  dynamic 1568.52m div/sec
--
  static 1574.76m div/sec
  dynamic 1574.63m div/sec
--
  static 1575.77m div/sec
  dynamic 1574.38m div/sec
--
  static 1577.74m div/sec
  dynamic 1581.09m div/sec
--
  static 1585.35m div/sec
  dynamic 1591.46m div/sec
--
  static 1572.47m div/sec
  dynamic 1585.13m div/sec
--
  static 1560.05m div/sec
  dynamic 1571.18m div/sec
--
  static 1575.05m div/sec
  dynamic 1550.98m div/sec
--
  static 1556.27m div/sec
  dynamic 1571.85m div/sec
--
  static 1581.93m div/sec
  dynamic 1579.43m div/sec

Probably I'm not the only one to think this but I haven't been able to find information on this.


问:
kNN (confusion_matrix & classification_report)
**Im trying to get the confusion_matrix & classification_report for a range of k values **

```<code>confusion_matrix = {}
classification_report = {}
neighbors = np.arange(5, 20)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,
random_state=42, stratify=y)
for neighbor in neighbors:
    # Set up a KNN Classifier
    knn = KNeighborsClassifier(n_neighbors=neighbor)
    # Fit the model
    knn.fit(X_train, y_train)
     # Compute
    y_pred= knn.predict(X_test)
    confusion_matrix[neighbor] = confusion_matrix(y_test,y_pred)
    classification_report[neighbor] = classification_report(y_test,y_pred)

print(confusion_matrix(y_test,y_pred))
print(classification_report(y_test,y_pred))
</code>```

**I was expecting something like a list of all reports **

```<code>---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/92/5m7b39tj1j5g7s50bvjdxglc0000gp/T/ipykernel_12129/985428575.py in <module>
     13      # Compute
     14     y_pred= knn.predict(X_test)
---> 15     confusion_matrix[neighbor] = confusion_matrix(y_test,y_pred)
     16     classification_report[neighbor] = classification_report(y_test,y_pred)
     17

TypeError: 'dict' object is not callable
</code>```

Body:
**Im trying to get the confusion_matrix & classification_report for a range of k values **

confusion_matrix = {}
classification_report = {}
neighbors = np.arange(5, 20)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,
random_state=42, stratify=y)
for neighbor in neighbors:
    # Set up a KNN Classifier
    knn = KNeighborsClassifier(n_neighbors=neighbor)
    # Fit the model
    knn.fit(X_train, y_train)
     # Compute
    y_pred= knn.predict(X_test)
    confusion_matrix[neighbor] = confusion_matrix(y_test,y_pred)
    classification_report[neighbor] = classification_report(y_test,y_pred)

print(confusion_matrix(y_test,y_pred))
print(classification_report(y_test,y_pred))

**I was expecting something like a list of all reports **

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/92/5m7b39tj1j5g7s50bvjdxglc0000gp/T/ipykernel_12129/985428575.py in <module>
     13      # Compute
     14     y_pred= knn.predict(X_test)
---> 15     confusion_matrix[neighbor] = confusion_matrix(y_test,y_pred)
     16     classification_report[neighbor] = classification_report(y_test,y_pred)
     17

TypeError: 'dict' object is not callable


问:
Create two return variants of object properties
Assume input:

```<code>const in = {name: 'hi'}
</code>```

processed by function X that returns two output versions:

```<code>const out = {nameRaw: ref('hi'), nameResult: ref(ok('hi')} // ok = neverthrow
</code>```

Adding typing to out:

errors but desired (errors to individual parts of line 3):

```<code>type funcOuta<Type extends funcInObj> = {
  [Property in keyof Type as `${Property & string}Raw`]: Ref<Type[Property]>
  [Property in keyof Type as `${Property & string}Result`]: Ref<Result<Type[Property]>,Error>>
};
</code>```

no errors but undesired as Raw out can be of same type as Result out (and thus requires type narrowing when using the outputs = undesired)

```<code>type funcOutb<Type extends DtoUscResp> = {
  [Property in keyof Type as `${Property & string}${'Raw' | 'Result'}`]:
    | Ref<Type[Property]>
    | Ref<Result<Type[Property]>,Error>>;
};
</code>```

How to properly type funcout such that each raw and result variant has its own corresponding type? -> answered, see @tobias

________________________ added later ________________

how to get a functionning complete example?The following code gives a TS error Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'funcOut<Type>'. No index signature with a parameter of type 'string' was found on type 'funcOut<Type>'.  -> unanswered

full code:

```<code>
type funcArg = {[index: string] : any}
type input = funcArg &  {name: string} // {name:hi}
type funcOut<Type> =
  {  [Property in keyof Type as `${Property & string}Raw`]: Type[Property] } &
  {  [Property in keyof Type as `${Property & string}Result`]: Array<Type[Property]> }
type test = funcOut<{name:' test'}> // yeey, type as expected!! credits @Tobias

function X<Type extends funcArg>(inp: funcArg):funcOut<Type> {
  let key:keyof Type & string
const res:funcOut<Type> = {} as funcOut<Type>
  for(key of Object.keys(inp))
    {
      res[key+'Raw'] = inp[key] // tserror
      res[key+'Result'] = new Array(inp[key]) // tserror
    }
   return res

}

const input: input= {name:'test'}
const outcome = X<input>(input)
console.log(outcome) // correct: {nameRaw": "test","nameResult": ["test"]}
</code>```

Body:
Assume input:

const in = {name: 'hi'}

processed by function X that returns two output versions:

const out = {nameRaw: ref('hi'), nameResult: ref(ok('hi')} // ok = neverthrow

Adding typing to out:

errors but desired (errors to individual parts of line 3):

type funcOuta<Type extends funcInObj> = {
  [Property in keyof Type as `${Property & string}Raw`]: Ref<Type[Property]>
  [Property in keyof Type as `${Property & string}Result`]: Ref<Result<Type[Property]>,Error>>
};

no errors but undesired as Raw out can be of same type as Result out (and thus requires type narrowing when using the outputs = undesired)

type funcOutb<Type extends DtoUscResp> = {
  [Property in keyof Type as `${Property & string}${'Raw' | 'Result'}`]:
    | Ref<Type[Property]>
    | Ref<Result<Type[Property]>,Error>>;
};

How to properly type funcout such that each raw and result variant has its own corresponding type? -> answered, see @tobias

________________________ added later ________________

how to get a functionning complete example?The following code gives a TS error Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'funcOut<Type>'. No index signature with a parameter of type 'string' was found on type 'funcOut<Type>'.  -> unanswered

full code:

type funcArg = {[index: string] : any}
type input = funcArg &  {name: string} // {name:hi}
type funcOut<Type> =
  {  [Property in keyof Type as `${Property & string}Raw`]: Type[Property] } &
  {  [Property in keyof Type as `${Property & string}Result`]: Array<Type[Property]> }
type test = funcOut<{name:' test'}> // yeey, type as expected!! credits @Tobias

function X<Type extends funcArg>(inp: funcArg):funcOut<Type> {
  let key:keyof Type & string
const res:funcOut<Type> = {} as funcOut<Type>
  for(key of Object.keys(inp))
    {
      res[key+'Raw'] = inp[key] // tserror
      res[key+'Result'] = new Array(inp[key]) // tserror
    }
   return res

}

const input: input= {name:'test'}
const outcome = X<input>(input)
console.log(outcome) // correct: {nameRaw": "test","nameResult": ["test"]}


问:
How many (separate) Keycloak clients for different platform versions of app?
I have an application which is built using Flutter and hence has 4 versions for each major platform/OS (Android, iOS, macOS and Windows) which are distributed via the respective app stores. The functionality of all these app versions is (almost) the same - i.e. only some minor differences in how certain features are implemented, but their overall functionality is the same.

When adding Keycloak as an IDP, I was asking myself the following question. The answer might be obvious, but I couldn't really find an explicit one yet so far:

Do I need to (or is it advisable) to create a separate client in Keycloak (more precisely the respective realm) for each of the app's platform versions (i.e. 4 different clients - one for the Android, iOS, macOS and Windows version) or can/should I use the same Keycloak client for all of them? Are there any advantages or disadvantages to one or the other approach?

Besides these 4 versions of the app, I have a REST API which handles access to the users' resources in the database. I assume that at least this API should have its own (confidential) client?

Given that all the app's platform versions have the same functionality, I do not really need to distinguish between certain access permissions etc. Even further, one major feature of the app is that it provides the same functionality on all different platforms.

One aspect I was thinking about is that if I had separate clients, then also the user's sessions for each app version/operating system would be managed via separate clients in Keycloak. But if I had just one client, then one user could have multiple sessions for different versions of the app within the same client. Would this cause any issues? (However, even if I had separate clients for each operating system, I could potentially still face this issue if a user is for instance using the iOS app on their iPhone and iPad - both of which would then be using my "iOS client" in Keycloak).


问:
C++ external static pointer is null from any class but one
I'm trying to make a game so I need some kind of external header file for all constants, static fields and such. It's just a header file without a class,so I can use all its fields from any class. But when I try to add static pointer fields to my header file something strange happens. If I try to set up those pointers with NEW CLASSNAME() from any class they work only in this class. From anywhere other then that class pointer stays Null.

I tryed to use not static pointer field and shared_ptr.
I need to have an external pointer field I can always get or reset with new, from anywhere.
(Don't think if this matters but the pointer is to my own class)


问:
Gulpfile.js Throws exception for wrench default implemented method of readdirSyncRecursive while calling require function of node.js
i am new to Gulp and specially Gulp 4. here i have my gulpfile.js

```<code>    /**
 *  Welcome to your gulpfile!
 *  The gulp tasks are splitted in several files in the gulp directory
 *  because putting all here was really too long
 */

'use strict';

var gulp = require('gulp');
var wrench = require('wrench');

/**
 *  This will load all js or coffee files in the gulp directory
 *  in order to load all gulp tasks
 */
wrench.readdirSyncRecursive('./gulp').filter(function(file) {
  return (/\.(js|coffee)$/i).test(file);
}).map(function(file) {
  require('./gulp/' + file);
});

/**
 *  Default task clean temporaries directories and launch the
 *  main optimization build task
 */
gulp.task('default', ['clean'], function () {
  gulp.start(['build']);
});

function done() {

}
</code>```

while trying to run => gulp build i am facing following Exception

```<code>AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (C:\Users\ahsan\Documents\dev-work\smsvoltapp\node_modules\undertaker\lib\set-task.js:10:3)
    at Gulp.task (C:\Users\ahsan\Documents\dev-work\smsvoltapp\node_modules\undertaker\lib\task.js:13:8)
    at Object.<anonymous> (C:\Users\ahsan\Documents\dev-work\smsvoltapp\gulp\build.js:28:6)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at C:\Users\ahsan\Documents\dev-work\smsvoltapp\gulpfile.js:19:3 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}
</code>```

It seems the node.js function require at line 19:3 is not upto the mark and valid for gulp4
Gulp version:
CLI version: 2.3.0
Local version: 4.0.2

npm -v => 8.19.2

Please help

Body:
i am new to Gulp and specially Gulp 4. here i have my gulpfile.js

    /**
 *  Welcome to your gulpfile!
 *  The gulp tasks are splitted in several files in the gulp directory
 *  because putting all here was really too long
 */

'use strict';

var gulp = require('gulp');
var wrench = require('wrench');

/**
 *  This will load all js or coffee files in the gulp directory
 *  in order to load all gulp tasks
 */
wrench.readdirSyncRecursive('./gulp').filter(function(file) {
  return (/\.(js|coffee)$/i).test(file);
}).map(function(file) {
  require('./gulp/' + file);
});

/**
 *  Default task clean temporaries directories and launch the
 *  main optimization build task
 */
gulp.task('default', ['clean'], function () {
  gulp.start(['build']);
});

function done() {

}

while trying to run => gulp build i am facing following Exception

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (C:\Users\ahsan\Documents\dev-work\smsvoltapp\node_modules\undertaker\lib\set-task.js:10:3)
    at Gulp.task (C:\Users\ahsan\Documents\dev-work\smsvoltapp\node_modules\undertaker\lib\task.js:13:8)
    at Object.<anonymous> (C:\Users\ahsan\Documents\dev-work\smsvoltapp\gulp\build.js:28:6)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at C:\Users\ahsan\Documents\dev-work\smsvoltapp\gulpfile.js:19:3 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

It seems the node.js function require at line 19:3 is not upto the mark and valid for gulp4
Gulp version:
CLI version: 2.3.0
Local version: 4.0.2

npm -v => 8.19.2

Please help


问:
bad request when posting to wordpress api
I get a 400 bad request when using the following code to post a new post on wordpress.

```<code>                // Set up the request parameters
            string url = "https://xxxx/wp-json/wp/v2/posts";
            string username = "info@xxxxx.com";
            string password = "xxxxx";
            string title = "My New Post";
            string content = "This is the content of my new post.";
            string imageUrl = "https://xxxxxx/wp-content/uploads/my-image.jpg";
            int categoryId = 123; // Replace with the ID of the "upcoming" category

            // Create the post object
            var post = new
            {
                title = new
                {
                    raw = title
                },
                content = new
                {
                    raw = content
                },
                featured_media = imageUrl,
                categories = new int[] { categoryId }
            };

            // Convert the post object to a JSON string
            string postJson = JsonConvert.SerializeObject(post);

            // Set up the request
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "POST";
            request.ContentType = "application/json";
            request.Credentials = new NetworkCredential(username, password);

            // Write the JSON data to the request body
            using (var streamWriter = new StreamWriter(request.GetRequestStream()))
            {
                streamWriter.Write(postJson);
                streamWriter.Flush();
                streamWriter.Close();
            }

            // Send the request and get the response
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
</code>```

I do have permalinks enabled so why do I get this error?

Body:
I get a 400 bad request when using the following code to post a new post on wordpress.

                // Set up the request parameters
            string url = "https://xxxx/wp-json/wp/v2/posts";
            string username = "info@xxxxx.com";
            string password = "xxxxx";
            string title = "My New Post";
            string content = "This is the content of my new post.";
            string imageUrl = "https://xxxxxx/wp-content/uploads/my-image.jpg";
            int categoryId = 123; // Replace with the ID of the "upcoming" category

            // Create the post object
            var post = new
            {
                title = new
                {
                    raw = title
                },
                content = new
                {
                    raw = content
                },
                featured_media = imageUrl,
                categories = new int[] { categoryId }
            };

            // Convert the post object to a JSON string
            string postJson = JsonConvert.SerializeObject(post);

            // Set up the request
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "POST";
            request.ContentType = "application/json";
            request.Credentials = new NetworkCredential(username, password);

            // Write the JSON data to the request body
            using (var streamWriter = new StreamWriter(request.GetRequestStream()))
            {
                streamWriter.Write(postJson);
                streamWriter.Flush();
                streamWriter.Close();
            }

            // Send the request and get the response
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

I do have permalinks enabled so why do I get this error?


问:
jaxb2-maven-plugin Jakarta cd:date binding
I have an xsd file, jaxb class generation is ok

```<code><?xml version="1.0"?>
  <schema
   xmlns="http://www.w3.org/2001/XMLSchema"
   targetNamespace="http://www.telecom.gouv.fr/normau/messages"
   xmlns:dc="http://purl.org/dc/terms"
   elementFormDefault="qualified">

<import namespace="http://purl.org/dc/terms" schemaLocation="https://www.telecom.gouv.fr/normau/dc.xsd"/>

<element name="PhoneCall">
    <complexType>
        <sequence>
            <element ref="dc:date">
            </element>
</code>```

but I want to customize the date Object from XMLGregorianCalendar to LocalDateTime. I created a binding.xjc

```<code><jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
           jaxb:version="3.0"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           xmlns:dc="http://purl.org/dc/terms"
           schemaLocation="https://www.telecom.gouv.fr/normau/dc.xsd"
           jaxb:extensionBindingPrefixes="xjc">
  <jaxb:globalBindings>
    <jaxb:serializable uid="1"/>
    <jaxb:javaType name="java.time.LocalDateTime" xmlType="dc:date" parseMethod="com.sioram.pflau.service.XmlDateAdapter.unmarshal" printMethod="com.sioram.pflau.service.XmlDateAdapter.marshal"/>
    </jaxb:globalBindings>
  </jaxb:bindings>
</code>```

but maven compains that dc: date is not defined.

```<code>[ERROR] file:/src/main/resources/binding.xjb [8,24] com.sun.istack.SAXParseException2: undefined simple type "{http://purl.org/dc/terms}date"
</code>```

So how can i add the dc:date type definition ?

Thanks for your help

Body:
I have an xsd file, jaxb class generation is ok

<?xml version="1.0"?>
  <schema
   xmlns="http://www.w3.org/2001/XMLSchema"
   targetNamespace="http://www.telecom.gouv.fr/normau/messages"
   xmlns:dc="http://purl.org/dc/terms"
   elementFormDefault="qualified">

<import namespace="http://purl.org/dc/terms" schemaLocation="https://www.telecom.gouv.fr/normau/dc.xsd"/>

<element name="PhoneCall">
    <complexType>
        <sequence>
            <element ref="dc:date">
            </element>

but I want to customize the date Object from XMLGregorianCalendar to LocalDateTime. I created a binding.xjc

<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
           jaxb:version="3.0"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           xmlns:dc="http://purl.org/dc/terms"
           schemaLocation="https://www.telecom.gouv.fr/normau/dc.xsd"
           jaxb:extensionBindingPrefixes="xjc">
  <jaxb:globalBindings>
    <jaxb:serializable uid="1"/>
    <jaxb:javaType name="java.time.LocalDateTime" xmlType="dc:date" parseMethod="com.sioram.pflau.service.XmlDateAdapter.unmarshal" printMethod="com.sioram.pflau.service.XmlDateAdapter.marshal"/>
    </jaxb:globalBindings>
  </jaxb:bindings>

but maven compains that dc: date is not defined.

[ERROR] file:/src/main/resources/binding.xjb [8,24] com.sun.istack.SAXParseException2: undefined simple type "{http://purl.org/dc/terms}date"

So how can i add the dc:date type definition ?

Thanks for your help


问:
I'm getting errors in msdt-follina
So, i am using ubuntu and installed msdt-follina on it. I run command python3 follina.py -c "calc.exe". It worked. Now i ran python3 follina.py -r 9999, and it gives me error:

```<code>[+] copied staging doc /tmp/9oiqeh0y
Traceback (most recent call last):
  File "/home/programersandco/msdt-follina/follina.py", line 166, in <module>
    main(parser.parse_args())
  File "/home/programersandco/msdt-follina/follina.py", line 104, in main
    shutil.make_archive(args.output, "zip", doc_path)
  File "/usr/lib/python3.10/shutil.py", line 1123, in make_archive
    filename = func(base_name, base_dir, **kwargs)
  File "/usr/lib/python3.10/shutil.py", line 1008, in _make_zipfile
    zf.write(path, arcname)
  File "/usr/lib/python3.10/zipfile.py", line 1773, in write
    with open(filename, "rb") as src, self.open(zinfo, 'w') as dest:
OSError: [Errno 22] Invalid argument: '/tmp/9oiqeh0y/doc/word/_rels/document.xml.rels'
</code>```

I tried with first command (python3 follina.py -c "calc.exe"), but it gives me the same error. Also i deleted whole folder and install it from github again, but nothing changed.

Title: I'm getting errors in msdt-follina

Body:
So, i am using ubuntu and installed msdt-follina on it. I run command python3 follina.py -c "calc.exe". It worked. Now i ran python3 follina.py -r 9999, and it gives me error:

[+] copied staging doc /tmp/9oiqeh0y
Traceback (most recent call last):
  File "/home/programersandco/msdt-follina/follina.py", line 166, in <module>
    main(parser.parse_args())
  File "/home/programersandco/msdt-follina/follina.py", line 104, in main
    shutil.make_archive(args.output, "zip", doc_path)
  File "/usr/lib/python3.10/shutil.py", line 1123, in make_archive
    filename = func(base_name, base_dir, **kwargs)
  File "/usr/lib/python3.10/shutil.py", line 1008, in _make_zipfile
    zf.write(path, arcname)
  File "/usr/lib/python3.10/zipfile.py", line 1773, in write
    with open(filename, "rb") as src, self.open(zinfo, 'w') as dest:
OSError: [Errno 22] Invalid argument: '/tmp/9oiqeh0y/doc/word/_rels/document.xml.rels'

I tried with first command (python3 follina.py -c "calc.exe"), but it gives me the same error. Also i deleted whole folder and install it from github again, but nothing changed.


问:
Unable to install tensorflow-text and unable to import keras_nlp
I am trying out the Keras-NLP library by using one of the examples provided on the Keras website. I have installed Keras-NLP using the command pip install keras-nlp and Tensorflow(version = 2.9.2).

When I run the following,

```<code>import keras_nlp
import tensorflow as tf
from tensorflow import keras
</code>```

I get the error as follows

```<code>ModuleNotFoundError                       Traceback (most recent call last)
Input In [5], in <cell line: 2>()
      1 get_ipython().system('pip install -q --upgrade keras-nlp tensorflow')
----> 2 import keras_nlp
      3 import tensorflow as tf
      4 from tensorflow import keras

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/__init__.py:17, in <module>
     15 from keras_nlp import layers
     16 from keras_nlp import metrics
---> 17 from keras_nlp import models
     18 from keras_nlp import tokenizers
     19 from keras_nlp import utils

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/models/__init__.py:30, in <module>
     26 from keras_nlp.models.distil_bert.distil_bert_tokenizer import (
     27     DistilBertTokenizer,
     28 )
     29 from keras_nlp.models.roberta.roberta_backbone import RobertaBackbone
---> 30 from keras_nlp.models.roberta.roberta_classifier import RobertaClassifier
     31 from keras_nlp.models.roberta.roberta_preprocessor import RobertaPreprocessor
     32 from keras_nlp.models.roberta.roberta_tokenizer import RobertaTokenizer

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/models/roberta/roberta_classifier.py:22, in <module>
     20 from keras_nlp.models.roberta.roberta_backbone import RobertaBackbone
     21 from keras_nlp.models.roberta.roberta_backbone import roberta_kernel_initializer
---> 22 from keras_nlp.models.roberta.roberta_preprocessor import RobertaPreprocessor
     23 from keras_nlp.models.roberta.roberta_presets import backbone_presets
     24 from keras_nlp.utils.pipeline_model import PipelineModel

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/models/roberta/roberta_preprocessor.py:20, in <module>
     17 import copy
     19 import tensorflow as tf
---> 20 import tensorflow_text as tf_text
     21 from tensorflow import keras
     23 from keras_nlp.models.roberta.roberta_presets import backbone_presets

ModuleNotFoundError: No module named 'tensorflow_text'

</code>```

I also tried to install tensorflow-text using the commands pip install -U tensorflow-text==2.9.2 and pip install -U tensorflow-text. Both of these commands give the following error:

Error from first command

```<code>ERROR: Could not find a version that satisfies the requirement tensorflow-text==2.9.2 (from versions: none)
ERROR: No matching distribution found for tensorflow-text==2.9.2
</code>```

Error from second command

```<code>ERROR: Could not find a version that satisfies the requirement tensorflow-text (from versions: none)
ERROR: No matching distribution found for tensorflow-text

</code>```

The system I am using is as follows:

MacOS Monterey
Apple M1 Pro chip

Is there any other prerequisite library I should install to make this work? Thank You in advance!

Body:
I am trying out the Keras-NLP library by using one of the examples provided on the Keras website. I have installed Keras-NLP using the command pip install keras-nlp and Tensorflow(version = 2.9.2).

When I run the following,

import keras_nlp
import tensorflow as tf
from tensorflow import keras

I get the error as follows

ModuleNotFoundError                       Traceback (most recent call last)
Input In [5], in <cell line: 2>()
      1 get_ipython().system('pip install -q --upgrade keras-nlp tensorflow')
----> 2 import keras_nlp
      3 import tensorflow as tf
      4 from tensorflow import keras

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/__init__.py:17, in <module>
     15 from keras_nlp import layers
     16 from keras_nlp import metrics
---> 17 from keras_nlp import models
     18 from keras_nlp import tokenizers
     19 from keras_nlp import utils

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/models/__init__.py:30, in <module>
     26 from keras_nlp.models.distil_bert.distil_bert_tokenizer import (
     27     DistilBertTokenizer,
     28 )
     29 from keras_nlp.models.roberta.roberta_backbone import RobertaBackbone
---> 30 from keras_nlp.models.roberta.roberta_classifier import RobertaClassifier
     31 from keras_nlp.models.roberta.roberta_preprocessor import RobertaPreprocessor
     32 from keras_nlp.models.roberta.roberta_tokenizer import RobertaTokenizer

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/models/roberta/roberta_classifier.py:22, in <module>
     20 from keras_nlp.models.roberta.roberta_backbone import RobertaBackbone
     21 from keras_nlp.models.roberta.roberta_backbone import roberta_kernel_initializer
---> 22 from keras_nlp.models.roberta.roberta_preprocessor import RobertaPreprocessor
     23 from keras_nlp.models.roberta.roberta_presets import backbone_presets
     24 from keras_nlp.utils.pipeline_model import PipelineModel

File /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/keras_nlp/models/roberta/roberta_preprocessor.py:20, in <module>
     17 import copy
     19 import tensorflow as tf
---> 20 import tensorflow_text as tf_text
     21 from tensorflow import keras
     23 from keras_nlp.models.roberta.roberta_presets import backbone_presets

ModuleNotFoundError: No module named 'tensorflow_text'

I also tried to install tensorflow-text using the commands pip install -U tensorflow-text==2.9.2 and pip install -U tensorflow-text. Both of these commands give the following error:

Error from first command

ERROR: Could not find a version that satisfies the requirement tensorflow-text==2.9.2 (from versions: none)
ERROR: No matching distribution found for tensorflow-text==2.9.2

Error from second command

ERROR: Could not find a version that satisfies the requirement tensorflow-text (from versions: none)
ERROR: No matching distribution found for tensorflow-text

The system I am using is as follows:

MacOS Monterey
Apple M1 Pro chip

Is there any other prerequisite library I should install to make this work? Thank You in advance!


问:
How to make this slider slides with Alpine js?
I have a slider which uses Alpine js but struggle to get the slides to slide automatically with Alpine js.
At the moment, the slider only slides on manual inputs.

Any idea how to get a slide to slide for example, every 2 seconds?

Thanks!

```<code>        <div x-data="carousel()" class="relative">
            <img
                class="h-[500px] w-full object-cover object-center"
                :src="images[selected]"
                alt="mountains"
            />

            <button
                @click="if (selected > 0 ) {selected -= 1} else { selected = images.length - 1 }"
                class="absolute inset-y-0 left-0 px-2 py-[25%] h-full w-8 group hover:bg-gray-500 hover:bg-opacity-75 cursor-pointer"
            >
        <span class="hidden group-hover:block text-gray-50">
          ←
        </span>
            </button>
            <button
                @click="if (selected < images.length - 1  ) {selected += 1} else { selected = 0 }"
                class="absolute inset-y-0 right-0 px-2 py-[25%] h-full w-8 group hover:bg-gray-500 hover:bg-opacity-75 cursor-pointer"
            >
        <span class="hidden group-hover:block text-gray-50">
          →
        </span>
            </button>

            <div class="absolute bottom-0 w-full p-4 flex justify-center space-x-2">
                <template x-for="(image,index) in images" :key="index">
                    <button
                        @click="selected = index"
                        :class="{'bg-gray-300': selected == index, 'bg-gray-500': selected != index}"
                        class="h-2 w-2 rounded-full hover:bg-gray-300 ring-2 ring-gray-300"
                    ></button>
                </template>
            </div>
        </div>
        <script>
            const carousel = () => {
                return {
                    selected: 0,
                    images: [
                        "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80",
                        "https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80",
                        "https://images.unsplash.com/photo-1500534314209-a25ddb2bd429?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=987&q=80",
                        "https://images.unsplash.com/photo-1486870591958-9b9d0d1dda99?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80",
                        "https://images.unsplash.com/photo-1485160497022-3e09382fb310?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80",
                        "https://images.unsplash.com/photo-1472791108553-c9405341e398?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2137&q=80"
                    ]
                };
            };
        </script>
</code>```

Body:
I have a slider which uses Alpine js but struggle to get the slides to slide automatically with Alpine js.
At the moment, the slider only slides on manual inputs.

Any idea how to get a slide to slide for example, every 2 seconds?

Thanks!

            <button
                @click="if (selected > 0 ) {selected -= 1} else { selected = images.length - 1 }"
                class="absolute inset-y-0 left-0 px-2 py-[25%] h-full w-8 group hover:bg-gray-500 hover:bg-opacity-75 cursor-pointer"
            >

          ←

            </button>
            <button
                @click="if (selected < images.length - 1  ) {selected += 1} else { selected = 0 }"
                class="absolute inset-y-0 right-0 px-2 py-[25%] h-full w-8 group hover:bg-gray-500 hover:bg-opacity-75 cursor-pointer"
            >

          →

            </button>

                <template x-for="(image,index) in images" :key="index">
                    <button
                        @click="selected = index"
                        :class="{'bg-gray-300': selected == index, 'bg-gray-500': selected != index}"
                        class="h-2 w-2 rounded-full hover:bg-gray-300 ring-2 ring-gray-300"
                    ></button>
                </template>


问:
Null check operator use on a null value
```<code>class _HomePageState extends State<HomePage> {
   const SizedBox(height: 10),
    Flexible(
     child: StreamBuilder( //here the error i'm not so sure
     stream: ref.snapshots(),
     builder: (context,AsyncSnapshot<QuerySnapshot> snapshot){
      if(snapshot.hasError){
        return Center(
           child: Text("Error:${snapshot.error}"),
       );
      }

     return Scrollbar(
        child: GridView.builder(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          mainAxisSpacing: 15,
          crossAxisSpacing: 15,
          childAspectRatio: 2/3,
        ),
           itemCount: snapshot.data!.docs.length,
           itemBuilder: (context,index) {

         final DocumentSnapshot documentSnapshot = snapshot.data!.docs[index];
          return Card(
            shape: BeveledRectangleBorder(
            borderRadius: BorderRadius.circular(15.0),
          ),
           elevation: 0,
           child: InkWell(
           onTap: (){
           Navigator.push(context, PageTransition(
type:PageTransitionType.leftToRight,
            child: DetailPage(
image:documentSnapshot['image'],                                             category:documentSnapshot['category'],                                             name:documentSnapshot['name'],                                            description:documentSnapshot['description'],                                          price:documentSnapshot['price'],
  )));
},

 child: Container(
   margin: const EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
      Ink.image(image: NetworkImage(documentSnapshot['image'][0]),
      height: 90,
      width: double.infinity,),
          const SizedBox(height: 5,),
          RichText(
           textAlign: TextAlign.start,
           text: TextSpan(
           text: documentSnapshot['category'],
           style: const TextStyle(
                  color: Colors.black,
                  fontWeight: FontWeight.bold,
                  fontSize: 12.0)),
           ),
</code>```

i used this code to display product on the homepage but it just glimpse appear the error of null value but i still can run and display the product then how i should fix the code. Logic error.
This is my full code of the streamBuilder

Title: Null check operator use on a null value

Body:
class _HomePageState extends State<HomePage> {
   const SizedBox(height: 10),
    Flexible(
     child: StreamBuilder( //here the error i'm not so sure
     stream: ref.snapshots(),
     builder: (context,AsyncSnapshot<QuerySnapshot> snapshot){
      if(snapshot.hasError){
        return Center(
           child: Text("Error:${snapshot.error}"),
       );
      }

     return Scrollbar(
        child: GridView.builder(
          shrinkWrap: true,
          physics: const NeverScrollableScrollPhysics(),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          mainAxisSpacing: 15,
          crossAxisSpacing: 15,
          childAspectRatio: 2/3,
        ),
           itemCount: snapshot.data!.docs.length,
           itemBuilder: (context,index) {

         final DocumentSnapshot documentSnapshot = snapshot.data!.docs[index];
          return Card(
            shape: BeveledRectangleBorder(
            borderRadius: BorderRadius.circular(15.0),
          ),
           elevation: 0,
           child: InkWell(
           onTap: (){
           Navigator.push(context, PageTransition(
type:PageTransitionType.leftToRight,
            child: DetailPage(
image:documentSnapshot['image'],                                             category:documentSnapshot['category'],                                             name:documentSnapshot['name'],                                            description:documentSnapshot['description'],                                          price:documentSnapshot['price'],
  )));
},

 child: Container(
   margin: const EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0),
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
      Ink.image(image: NetworkImage(documentSnapshot['image'][0]),
      height: 90,
      width: double.infinity,),
          const SizedBox(height: 5,),
          RichText(
           textAlign: TextAlign.start,
           text: TextSpan(
           text: documentSnapshot['category'],
           style: const TextStyle(
                  color: Colors.black,
                  fontWeight: FontWeight.bold,
                  fontSize: 12.0)),
           ),

i used this code to display product on the homepage but it just glimpse appear the error of null value but i still can run and display the product then how i should fix the code. Logic error.
This is my full code of the streamBuilder


问:
moveit package following instructions provided but faced error after running in ros 2
```<code>[robot_state_publisher-3] [INFO] [1672396573.523060458] [robot_state_publisher]: got segment link6
[robot_state_publisher-3] [INFO] [1672396573.523065047] [robot_state_publisher]: got segment world
[ERROR] [robot_state_publisher-3]: process[robot_state_publisher-3] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
[INFO] [robot_state_publisher-3]: sending signal 'SIGTERM' to process[robot_state_publisher-3]
[ERROR] [robot_state_publisher-3]: process has died [pid 87783, exit code -15, cmd '/opt/ros/foxy/lib/robot_state_publisher/robot_state_publisher --ros-args -r __node:=robot_state_publisher --params-file /tmp/launch_params_7xb9pf6_'].
</code>```

I tried to use your moveit package following instructions provided but faced error after running

```<code>$ ros2 launch moveit_config_m1013 m1013.launch.py
</code>```

Body:
[robot_state_publisher-3] [INFO] [1672396573.523060458] [robot_state_publisher]: got segment link6
[robot_state_publisher-3] [INFO] [1672396573.523065047] [robot_state_publisher]: got segment world
[ERROR] [robot_state_publisher-3]: process[robot_state_publisher-3] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
[INFO] [robot_state_publisher-3]: sending signal 'SIGTERM' to process[robot_state_publisher-3]
[ERROR] [robot_state_publisher-3]: process has died [pid 87783, exit code -15, cmd '/opt/ros/foxy/lib/robot_state_publisher/robot_state_publisher --ros-args -r __node:=robot_state_publisher --params-file /tmp/launch_params_7xb9pf6_'].

I tried to use your moveit package following instructions provided but faced error after running

$ ros2 launch moveit_config_m1013 m1013.launch.py


问:
Expose Global Function within an IIFE built in Vue 3 and bundled with Vite
So I have a peculiar situation here. I have built a widget with Vue 3 and bundled it as an IIFE in order to isolate the code from the client, so the end users will be able to download a script from a CDN and change some parameters at will via HTML data attributes within the script, something like this:

```<code>!-- Widget -->
<script src="https://cdn.xyz.xyz/widget.min.js"
   data-icon="path_to_icon.jpg"
   data-title="Brand support"
   data-jwt-url="jwt token url"
   data-rubiko-url="another url"
   data-company-websocket-url="websocket url"
   data-theme="default"
   data-brand-id="brand-id">
</script>
<!-- end of Widget -->
</code>```

The widget is working fine and all the HTML attributes coming from the script can be customized. There's only one requirement that is kind of confusing to me. As you can see one of the data attributes (data-jwt-url) is an endpoint. The Widget will fetch the token from that URL and then use it to retrieve some data from an API. But I need to expose a global function that the end user will be able to use in any part of their code in order to retrieve a token at any point within their code.

In Vue this function is like this:

```<code>const retrieveSignedJWT = async () => {
  if (jwtUrl.value) {
    fetch(jwtUrl.value)
      .then(async (response) => {
        const data = await response.text();
        // check for error response
        if (!response.ok) {
          // get an error message from body or default to response statusText
          const error = (data && data.message) || response.statusText;
          return Promise.reject(error);
        }
        let jwt = data;
        token.value = data;
        decodeToken(jwt);
        retrieveCategories();
      })
      .catch((error) => {
        error.value = error;
        console.error("There was an error!", error);
      });
  } else {
    console.log("The JWT URL coming from the script is corrupted");
  }
};
</code>```

Then I call that function from the onMounted Hook:

```<code>onMounted(async () => {
  await retrieveSignedJWT();
});
</code>```

By doing that as soon as the Widget has loaded into the client site, the widget will retrieve a Token. The question is how can I expose the retrieveSignedJWT function via Vue so the client can call it from anywhere in their code something like having in mind that the production code is an IIFE:

```<code>widget.retrieveSignedJWT();
</code>```

Body:
So I have a peculiar situation here. I have built a widget with Vue 3 and bundled it as an IIFE in order to isolate the code from the client, so the end users will be able to download a script from a CDN and change some parameters at will via HTML data attributes within the script, something like this:

!-- Widget -->

The widget is working fine and all the HTML attributes coming from the script can be customized. There's only one requirement that is kind of confusing to me. As you can see one of the data attributes (data-jwt-url) is an endpoint. The Widget will fetch the token from that URL and then use it to retrieve some data from an API. But I need to expose a global function that the end user will be able to use in any part of their code in order to retrieve a token at any point within their code.

In Vue this function is like this:

const retrieveSignedJWT = async () => {
  if (jwtUrl.value) {
    fetch(jwtUrl.value)
      .then(async (response) => {
        const data = await response.text();
        // check for error response
        if (!response.ok) {
          // get an error message from body or default to response statusText
          const error = (data && data.message) || response.statusText;
          return Promise.reject(error);
        }
        let jwt = data;
        token.value = data;
        decodeToken(jwt);
        retrieveCategories();
      })
      .catch((error) => {
        error.value = error;
        console.error("There was an error!", error);
      });
  } else {
    console.log("The JWT URL coming from the script is corrupted");
  }
};

Then I call that function from the onMounted Hook:

onMounted(async () => {
  await retrieveSignedJWT();
});

By doing that as soon as the Widget has loaded into the client site, the widget will retrieve a Token. The question is how can I expose the retrieveSignedJWT function via Vue so the client can call it from anywhere in their code something like having in mind that the production code is an IIFE:

widget.retrieveSignedJWT();


问:
Forgot PGP Passphrase for Docker Login
I want to use Docker Desktop and to run docker-compose up, but I am getting permission denied and a prompt asking me to enter passphrase for PGP, but I forgot and don't even remember setting a passphrase in the first place.

enter image description here

What to do? I don't care if I loose stuff, I just want to run Docker.

I tried to uninstall Docker and docker-compose and reinstalling, but the problem persists. How do I recover the passphrase?

Title: Forgot PGP Passphrase for Docker Login


问:
Python- Exception has occurred: PorcupineInvalidArgumentError
My code is having some problems when I use ".pnn" file which I downloaded from https://picovoice.ai/. It shows an error and not working well. However, if I delete the ".pnn" file (keyword_path) and replace it with an existing hot word pvporcupine has, it runs fine. I don't know how to fix it and I need some help. Thanks

Here is my code:

```<code>    #!/usr/bin/env python3
import struct
import pyaudio
import pvporcupine

porcupine = None
pa = None
audio_stream = None

try:
  access_key = "${key}" # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
  keyword_paths = ["C:\\Users\\adamn\\Documents\\voice\\hey-jarvis_en_windows_v2_1_0 (1)\\hey-jarvis_en_windows_v2_1_0.ppn"]

  porcupine = pvporcupine.create(access_key=access_key, keyword_paths=keyword_paths)

  pa = pyaudio.PyAudio()

  audio_stream = pa.open(
                rate=porcupine.sample_rate,
                channels=1,
                format=pyaudio.paInt16,
                input=True,
                frames_per_buffer=porcupine.frame_length)

  while True:
      pcm = audio_stream.read(porcupine.frame_length)
      pcm = struct.unpack_from("h" * porcupine.frame_length, pcm)

      keyword_index = porcupine.process(pcm)

      if keyword_index >= 0:
          print("Hotword Detected")
finally:
  if porcupine is not None:
      porcupine.delete()

  if audio_stream is not None:
      audio_stream.close()

  if pa is not None:
          pa.terminate()
</code>```

here is the error:

```<code>PS C:\Users\adamn\Documents\voice> & C:/Users/adamn/AppData/Local/Programs/Python/Python310/python.exe c:/Users/adamn/Documents/voice/detection.py
[ERROR] failed to parse AccessKey '${key}'
Traceback (most recent call last):
  File "c:\Users\adamn\Documents\voice\detection.py", line 14, in <module>
    porcupine = pvporcupine.create(access_key=access_key, keyword_paths=keyword_paths)
  File "C:\Users\adamn\AppData\Local\Programs\Python\Python310\lib\site-packages\pvporcupine\__init__.py", line 77, in create
    return Porcupine(
  File "C:\Users\adamn\AppData\Local\Programs\Python\Python310\lib\site-packages\pvporcupine\porcupine.py", line 158, in __init__
    raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
pvporcupine.porcupine.PorcupineInvalidArgumentError
</code>```

Body:
My code is having some problems when I use ".pnn" file which I downloaded from https://picovoice.ai/. It shows an error and not working well. However, if I delete the ".pnn" file (keyword_path) and replace it with an existing hot word pvporcupine has, it runs fine. I don't know how to fix it and I need some help. Thanks

Here is my code:

    #!/usr/bin/env python3
import struct
import pyaudio
import pvporcupine

porcupine = None
pa = None
audio_stream = None

try:
  access_key = "${key}" # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
  keyword_paths = ["C:\\Users\\adamn\\Documents\\voice\\hey-jarvis_en_windows_v2_1_0 (1)\\hey-jarvis_en_windows_v2_1_0.ppn"]

  porcupine = pvporcupine.create(access_key=access_key, keyword_paths=keyword_paths)

  pa = pyaudio.PyAudio()

  audio_stream = pa.open(
                rate=porcupine.sample_rate,
                channels=1,
                format=pyaudio.paInt16,
                input=True,
                frames_per_buffer=porcupine.frame_length)

  while True:
      pcm = audio_stream.read(porcupine.frame_length)
      pcm = struct.unpack_from("h" * porcupine.frame_length, pcm)

      keyword_index = porcupine.process(pcm)

      if keyword_index >= 0:
          print("Hotword Detected")
finally:
  if porcupine is not None:
      porcupine.delete()

  if audio_stream is not None:
      audio_stream.close()

  if pa is not None:
          pa.terminate()

here is the error:

PS C:\Users\adamn\Documents\voice> & C:/Users/adamn/AppData/Local/Programs/Python/Python310/python.exe c:/Users/adamn/Documents/voice/detection.py
[ERROR] failed to parse AccessKey '${key}'
Traceback (most recent call last):
  File "c:\Users\adamn\Documents\voice\detection.py", line 14, in <module>
    porcupine = pvporcupine.create(access_key=access_key, keyword_paths=keyword_paths)
  File "C:\Users\adamn\AppData\Local\Programs\Python\Python310\lib\site-packages\pvporcupine\__init__.py", line 77, in create
    return Porcupine(
  File "C:\Users\adamn\AppData\Local\Programs\Python\Python310\lib\site-packages\pvporcupine\porcupine.py", line 158, in __init__
    raise self._PICOVOICE_STATUS_TO_EXCEPTION[status]()
pvporcupine.porcupine.PorcupineInvalidArgumentError


问:
NoSuchMethodException is throwing when trying to access getActivePasswordQuality() method of LockPatternUtils class
I want to get access to com.android.internal.widget.LockPatternUtils class object using reflection and want to know the Lock method user has set in Android device.

I am using below code for that :

```<code>    private fun getAuthenticationMethodType() : Int {
    var lockType = 0
    try {
        val lockPatternUtilsClass = Class.forName("com.android.internal.widget.LockPatternUtils")
        val lockPatternUtils =
            lockPatternUtilsClass.getConstructor(Context::class.java).newInstance(this)

        val method: Method = lockPatternUtilsClass.getMethod("getActivePasswordQuality")
        // === The above Line throws an exception NoSuchMethodException === //

        val method2: Method = lockPatternUtilsClass.getDeclaredMethod("getActivePasswordQuality",
                            Class.forName("android.os.UserHandle"))
       // === Tried above line too, but this Line also throws an exception NoSuchMethodException === //

        val userHandleClass = Class.forName("android.os.UserHandle")
        val myUserIdMethod = userHandleClass.getMethod("myUserId")
        val userId = myUserIdMethod.invoke(userHandleClass)

        lockType = method.invoke(lockPatternUtils, userId) as Int
    } catch (e: java.lang.Exception) {
        e.printStackTrace()
        Log.d("TAG","exception : " + e.printStackTrace())
    }
     return lockType
}
</code>```

I am trying on Android 12.

I checked on Android Documentation Non-SDK API lists and found that getActivePasswordQuality and getKeyguardStoredPasswordQuality methods are marked as greyList. As per documentation of greyList, it says :

Unsupported (greylist) :  Non-SDK interfaces that are currently unrestricted and your app can use. Note however, that these interfaces are unsupported and subject to change without notice. Expect these interfaces to be conditionally blocked in future Android versions in a max-target-x list.

But, these both methods are not accessible. My understanding is that the methods marked with greyList can be accessible. Is it correct?

Is there any mistake in my code?

How to know lock password type that user has set like PIN/Password/Pattern/Biometric, just categorisation is needed

Body:
I want to get access to com.android.internal.widget.LockPatternUtils class object using reflection and want to know the Lock method user has set in Android device.

I am using below code for that :

    private fun getAuthenticationMethodType() : Int {
    var lockType = 0
    try {
        val lockPatternUtilsClass = Class.forName("com.android.internal.widget.LockPatternUtils")
        val lockPatternUtils =
            lockPatternUtilsClass.getConstructor(Context::class.java).newInstance(this)

        val method: Method = lockPatternUtilsClass.getMethod("getActivePasswordQuality")
        // === The above Line throws an exception NoSuchMethodException === //

        val method2: Method = lockPatternUtilsClass.getDeclaredMethod("getActivePasswordQuality",
                            Class.forName("android.os.UserHandle"))
       // === Tried above line too, but this Line also throws an exception NoSuchMethodException === //

        val userHandleClass = Class.forName("android.os.UserHandle")
        val myUserIdMethod = userHandleClass.getMethod("myUserId")
        val userId = myUserIdMethod.invoke(userHandleClass)

        lockType = method.invoke(lockPatternUtils, userId) as Int
    } catch (e: java.lang.Exception) {
        e.printStackTrace()
        Log.d("TAG","exception : " + e.printStackTrace())
    }
     return lockType
}

I am trying on Android 12.

I checked on Android Documentation Non-SDK API lists and found that getActivePasswordQuality and getKeyguardStoredPasswordQuality methods are marked as greyList. As per documentation of greyList, it says :

Unsupported (greylist) :  Non-SDK interfaces that are currently unrestricted and your app can use. Note however, that these interfaces are unsupported and subject to change without notice. Expect these interfaces to be conditionally blocked in future Android versions in a max-target-x list.

But, these both methods are not accessible. My understanding is that the methods marked with greyList can be accessible. Is it correct?

Is there any mistake in my code?

How to know lock password type that user has set like PIN/Password/Pattern/Biometric, just categorisation is needed


问:
Best way to bypass table with over 3000 partition in Hive
I have huge table with 8500+ partitions and it uses with join to small table.
I have problem with Hive limit = 3k partitions and execution time.

I use it like this:

```<code>select
/* broadcast(a) */
/* streamtable(b) */
/* broadcast(c) */
/* broadcast(d) */
a.fields, b.field, c.field, d.field
from <small_table_1> a
left join (select * from <huge_table> where date_part > 20150100
           union all
           select * from <huge_table> where date_part between 20070100 and 20150100
           union all
           select * from <huge_table> where date_part < 20070100
) b on a.field = b.field
left join <small_table_2> on .....
left join <small_table_2> on .....
</code>```

Is there a better way to optimize my query?

Body:
I have huge table with 8500+ partitions and it uses with join to small table.
I have problem with Hive limit = 3k partitions and execution time.

I use it like this:

select
/* broadcast(a) */
/* streamtable(b) */
/* broadcast(c) */
/* broadcast(d) */
a.fields, b.field, c.field, d.field
from <small_table_1> a
left join (select * from <huge_table> where date_part > 20150100
           union all
           select * from <huge_table> where date_part between 20070100 and 20150100
           union all
           select * from <huge_table> where date_part < 20070100
) b on a.field = b.field
left join <small_table_2> on .....
left join <small_table_2> on .....

Is there a better way to optimize my query?


问:
Conda not using latest package version
I am using Anaconda (latest version of september). I have executed 'conda update --all' to get the latest packages, in particular Scipy. But when I import scipy from a python shell, it's only importing the 1.7.3 version, not the latest one (1.9.1).

I am not fluent with the conda framework. I tried running conda install scipy which did not change anything, and conda install scipy=1.9.1 (which seems to hang).

I am using the base environment. This is a fresh isntall of the latest Anconda (with package update via conda, not any use of pip that could interfere).

Listing the packages via conda yields:

>>> conda list scipy
# packages in environment at /home/***/anaconda3:
#
# Name                    Version                   Build  Channel
scipy                     1.7.3            py39hc147768_0

```
<p>However, when I look at the content of the <code>anaconda3/pkgs</code> folder:</p>
<pre class="lang-bash prettyprint-override"><code>>>> ls anaconda3/pkgs/ | grep scipy

anaconda3/pkgs/scipy-1.7.3-py39hc147768_0.conda
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_0.conda
anaconda3/pkgs/scipy-1.7.3-py39hc147768_0 (contains Scipy 1.7.3)
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_0 (contains Scipy 1.9.1)
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_09jfxaf1g (empty folder)
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_0dydy5wnw (empty folder)
</code>```

So I am assuming that conda has both Scipy 1.7.3 and 1.9.1. But why can't I import the lastest one ?

How may I correct this situation ?

EDIT: creating a new environment and reinstalling the packages as needed solves my problem. However, how come the base environment is stuck with the earlier version ?

Title: Conda not using latest package version

Body:
I am using Anaconda (latest version of september). I have executed 'conda update --all' to get the latest packages, in particular Scipy. But when I import scipy from a python shell, it's only importing the 1.7.3 version, not the latest one (1.9.1).

I am not fluent with the conda framework. I tried running conda install scipy which did not change anything, and conda install scipy=1.9.1 (which seems to hang).

I am using the base environment. This is a fresh isntall of the latest Anconda (with package update via conda, not any use of pip that could interfere).

Listing the packages via conda yields:

>>> conda list scipy
# packages in environment at /home/***/anaconda3:
#
# Name                    Version                   Build  Channel
scipy                     1.7.3            py39hc147768_0

However, when I look at the content of the anaconda3/pkgs folder:

>>> ls anaconda3/pkgs/ | grep scipy

anaconda3/pkgs/scipy-1.7.3-py39hc147768_0.conda
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_0.conda
anaconda3/pkgs/scipy-1.7.3-py39hc147768_0 (contains Scipy 1.7.3)
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_0 (contains Scipy 1.9.1)
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_09jfxaf1g (empty folder)
anaconda3/pkgs/scipy-1.9.1-py39h14f4228_0dydy5wnw (empty folder)

So I am assuming that conda has both Scipy 1.7.3 and 1.9.1. But why can't I import the lastest one ?

How may I correct this situation ?

EDIT: creating a new environment and reinstalling the packages as needed solves my problem. However, how come the base environment is stuck with the earlier version ?


问:
Update using two unique fields
There are two tables

|   table_1 | periodically TRUNCATE and INSERT updated information

|   table_2 | rows are updated based on data from table_1

the first and second tables have a unique index for the lap, tt fields

My current request to update via

```<code>INSERT INTO public.table_2 ... VALUES (...) ON CONFLICT (lap,tt) DO UPDATE SET ...
</code>```

There is a field in the second table table_2.status and I need

if the ("lap", "tt") entry is in the first table, then update
table_2.status =1

if there are no records, then update
table_2.status=0

So far, I first do update table_2.status=0 and then it already goes

```<code>INSERT ...VALUES (...) ON CONFLICT ...DO UPDATE SET
</code>```

If there was one unique field, then I would do an Update via

```<code>....SELECT column1 FROM table1 WHERE column1 in (SELECT column1 FROM table2)....
</code>```

but how can I do it with two unique fields.... I can't understand

UP

```<code> UNIQUE INDEX table_1_idx ON public.table_1 USING btree (lap, tt);
 UNIQUE INDEX table_2_idx ON public.table_2 USING btree (lap, tt);
</code>```

Title: Update using two unique fields

Body:
There are two tables

|   table_1 | periodically TRUNCATE and INSERT updated information

|   table_2 | rows are updated based on data from table_1

the first and second tables have a unique index for the lap, tt fields

My current request to update via

INSERT INTO public.table_2 ... VALUES (...) ON CONFLICT (lap,tt) DO UPDATE SET ...

There is a field in the second table table_2.status and I need

if the ("lap", "tt") entry is in the first table, then update
table_2.status =1

if there are no records, then update
table_2.status=0

So far, I first do update table_2.status=0 and then it already goes

INSERT ...VALUES (...) ON CONFLICT ...DO UPDATE SET

If there was one unique field, then I would do an Update via

....SELECT column1 FROM table1 WHERE column1 in (SELECT column1 FROM table2)....

but how can I do it with two unique fields.... I can't understand

UP

 UNIQUE INDEX table_1_idx ON public.table_1 USING btree (lap, tt);
 UNIQUE INDEX table_2_idx ON public.table_2 USING btree (lap, tt);


问:
How to add windows on the same form?
I have a program that when I click the "next" button, another window appears with the same form or other components appear.

I tried to add a panel on the main form with two buttons "home" and "next" and then a panel where you can see other forms to give the feeling that the page is changing. In the constructor I try to pass the previous form and the main one so that when clicked it returns to it with all its elements.

```<code>DesktopReserve formPadre;
DesktopPrincipal deskPrincipal;

public Form1(DesktopReserve formPadre, DesktopPrincipal deskPrincipal)
{
  InitializeComponent();

  this.formPadre = formPadre;
  this.deskPrincipal = deskPrincipal;
  this.deskPrincipal.returnButton.Click += new System.EventHandler(this.returnButton_Click);
}
</code>```

I understand that this is not the best way to do it. Apart from the fact that when I show the different forms within this panel it shows in another size, I would like to know a more efficient way to execute this.

Title: How to add windows on the same form?

Body:
I have a program that when I click the "next" button, another window appears with the same form or other components appear.

I tried to add a panel on the main form with two buttons "home" and "next" and then a panel where you can see other forms to give the feeling that the page is changing. In the constructor I try to pass the previous form and the main one so that when clicked it returns to it with all its elements.

DesktopReserve formPadre;
DesktopPrincipal deskPrincipal;

public Form1(DesktopReserve formPadre, DesktopPrincipal deskPrincipal)
{
  InitializeComponent();

  this.formPadre = formPadre;
  this.deskPrincipal = deskPrincipal;
  this.deskPrincipal.returnButton.Click += new System.EventHandler(this.returnButton_Click);
}

I understand that this is not the best way to do it. Apart from the fact that when I show the different forms within this panel it shows in another size, I would like to know a more efficient way to execute this.


问:
Is possible to populate GraphQL error response manually?
due to well-known N+1 problem we decided to move away from @ResolveField() feature of NestJS and use our implementation of DataLoader instead. By doing so, we must handle errors of resolvers manually because the resolution of graphql data is not driven by NestJS (or apollo) anymore.

This put us into a problem when we want to return a GraphQL error response (e.g. "Book not found") from graphql query in a standard manner like this:

```<code>{
    "data": {
        user: {
            id: 1
            book: null
        }
    }
    "errors": [
        {
            "message": "Book not found",
            "statusCode": 400
        }
    ]
}
</code>```

But since we are not using @ResolveField() anymore we resolve nested data (book) manually
we receive this response:

```<code>{
    "data": null
    "errors": [
        {
            "message": "Book not found",
            "statusCode": 400
        }
    ]
}
</code>```

Is there any way to populate GraphQL error response manually?

    @Query(() => User)
    async user(@Args('id') id: number): Promise<User> {
        const user = await this.userService.findOne(id);
        try{
            const book = await this.bookService.findOne(user.bookId);
            user.book = book;
        } catch (e) {
            // How to populate GraphQL error response manually?
            user.book = null;
        }
        return user;
    }
```

Thanks for your help and have a nice day!

Body:
due to well-known N+1 problem we decided to move away from @ResolveField() feature of NestJS and use our implementation of DataLoader instead. By doing so, we must handle errors of resolvers manually because the resolution of graphql data is not driven by NestJS (or apollo) anymore.

This put us into a problem when we want to return a GraphQL error response (e.g. "Book not found") from graphql query in a standard manner like this:

{
    "data": {
        user: {
            id: 1
            book: null
        }
    }
    "errors": [
        {
            "message": "Book not found",
            "statusCode": 400
        }
    ]
}

But since we are not using @ResolveField() anymore we resolve nested data (book) manually
we receive this response:

{
    "data": null
    "errors": [
        {
            "message": "Book not found",
            "statusCode": 400
        }
    ]
}

Is there any way to populate GraphQL error response manually?

    @Query(() => User)
    async user(@Args('id') id: number): Promise<User> {
        const user = await this.userService.findOne(id);
        try{
            const book = await this.bookService.findOne(user.bookId);
            user.book = book;
        } catch (e) {
            // How to populate GraphQL error response manually?
            user.book = null;
        }
        return user;
    }

Thanks for your help and have a nice day!


问:
how to get output in numerical order in python for multiple extension?
this python script show folder image in html viewer in browser

but the multiple extension I can not get output in numerical order

```<code>import os
import glob
import re

html = ""
strPath = os.path.realpath(__file__)
print( f"Full Path    :{strPath}" )
nmFolders = strPath.split( os.path.sep )
print( f"Folder Name  :{nmFolders[-2]}" )
for X in {nmFolders[-2]}:
    for Y in {'*.webp', '*.png', '*.jpg', '*.bmp', '*.jpeg', '*.gif'}:

         for file in sorted(glob.glob( os.path.join(Y) ),key=len):
                html += f"<div align='center'><img src ='{os.path.realpath(file)}'/>"
                html += f''' \n '''

for X in {nmFolders[-2]}:

    with open(f"{X}.html","w", encoding="utf-8") as outputfile:
        outputfile.write(html)

os.startfile(f"{X}.html")
</code>```

html output

```<code><div align='center'><img src ='D:\program files\image\4.gif'/>
 <div align='center'><img src ='D:\program files\image\5.gif'/>
 <div align='center'><img src ='D:\program files\image\1.png'/>
 <div align='center'><img src ='D:\program files\image\8.png'/>
 <div align='center'><img src ='D:\program files\image\6.webp'/>
 <div align='center'><img src ='D:\program files\image\7.jpeg'/>
 <div align='center'><img src ='D:\program files\image\3.bmp'/>
 <div align='center'><img src ='D:\program files\image\9.bmp'/>
 <div align='center'><img src ='D:\program files\image\2.jpg'/>
 <div align='center'><img src ='D:\program files\image\10.jpg'/>

</code>```

I want output :

```<code> <div align='center'><img src ='D:\program files\image\1.png'/>
 <div align='center'><img src ='D:\program files\image\2.jpg'/>
 <div align='center'><img src ='D:\program files\image\3.bmp'/>
 <div align='center'><img src ='D:\program files\image\4.gif'/>
 <div align='center'><img src ='D:\program files\image\5.gif'/>
 <div align='center'><img src ='D:\program files\image\6.webp'>
 <div align='center'><img src ='D:\program files\image\7.jpeg'/>
 <div align='center'><img src ='D:\program files\image\8.png'/>
 <div align='center'><img src ='D:\program files\image\9.bmp'/>
 <div align='center'><img src ='D:\program files\image\10.jpg'/>

</code>```

Because of the multiple extension I can not get output in numerical order.

key need to change.

Body:
this python script show folder image in html viewer in browser

but the multiple extension I can not get output in numerical order

import os
import glob
import re

html = ""
strPath = os.path.realpath(__file__)
print( f"Full Path    :{strPath}" )
nmFolders = strPath.split( os.path.sep )
print( f"Folder Name  :{nmFolders[-2]}" )
for X in {nmFolders[-2]}:
    for Y in {'*.webp', '*.png', '*.jpg', '*.bmp', '*.jpeg', '*.gif'}:

         for file in sorted(glob.glob( os.path.join(Y) ),key=len):
                html += f"
"
                html += f''' \n '''

for X in {nmFolders[-2]}:

    with open(f"{X}.html","w", encoding="utf-8") as outputfile:
        outputfile.write(html)

os.startfile(f"{X}.html")

html output

I want output :

Because of the multiple extension I can not get output in numerical order.

key need to change.


问:
Video call by webrtc works in avd but not in real phone
Video call with webrtc works well in avd, but the call is not established inside the real phone.
I guess that the problem is in this part
"W/main_texture_ca( 4178): type=1400 audit(0.0:151571): avc: denied { getattr } for name="dmabuf:" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c151 ,c258,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 "
Because AVD does not show such a thing, but I don't know how to solve this problem!
In general, the following output is written in the console</p>
```<code>D/FlutterWebRTCPlugin( 4178): onAddTrack
I/flutter ( 4178): Signaling state change: RTCSignalingState.RTCSignalingStateHaveRemoteOffer
I/flutter ( 4178): Add remote stream
W/FlutterWebRTCPlugin( 4178): FlutterRTCVideoRenderer.setVideoTrack, set video track to a13e526e-fc21-4921-84be-20db79990691
I/BufferQueueProducer( 4178): [SurfaceTexture-0-4178-14](id:105200000016,api:1,p:4178,c:4178) disconnect: api 1
D/libMEOW ( 4178): meow delete tls: 0xb40000747d831580
D/libMEOW ( 4178): meow new tls: 0xb40000747d831580
D/libMEOW ( 4178): applied 0 plugin for [com.example.meetoy].
I/BufferQueueProducer( 4178): [SurfaceTexture-0-4178-14](id:105200000016,api:1,p:4178,c:4178) connect: api=1 producerControlledByApp=true
D/FlutterWebRTCPlugin( 4178): onIceGatheringChangeGATHERING
D/FlutterWebRTCPlugin( 4178): onIceCandidate
D/FlutterWebRTCPlugin( 4178): onIceCandidate
I/flutter ( 4178): Signaling state change: RTCSignalingState.RTCSignalingStateStable
I/flutter ( 4178): ICE connection state change: RTCIceGatheringState.RTCIceGatheringStateGathering
D/FlutterWebRTCPlugin( 4178): onConnectionChangeCONNECTING
D/FlutterWebRTCPlugin( 4178): onIceCandidate
D/FlutterWebRTCPlugin( 4178): onIceCandidate
D/FlutterWebRTCPlugin( 4178): onIceCandidate
I/flutter ( 4178): Connection state change: RTCPeerConnectionState.RTCPeerConnectionStateConnecting
I/mali_config( 4178): @get_buffer_dataspace_setting: update dataspace from GE (0x10020000 -> 0x08020000)
W/main_texture_ca( 4178): type=1400 audit(0.0:151571): avc: denied { getattr } for name="dmabuf:" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c151,c258,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=com.example.meetoy
D/FlutterWebRTCPlugin( 4178): onIceGatheringChangeCOMPLETE
I/flutter ( 4178): ICE connection state change: RTCIceGatheringState.RTCIceGatheringStateComplete
</code>```

Body:
Video call with webrtc works well in avd, but the call is not established inside the real phone.
I guess that the problem is in this part
"W/main_texture_ca( 4178): type=1400 audit(0.0:151571): avc: denied { getattr } for name="dmabuf:" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c151 ,c258,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 "
Because AVD does not show such a thing, but I don't know how to solve this problem!
In general, the following output is written in the console

D/FlutterWebRTCPlugin( 4178): onAddTrack
I/flutter ( 4178): Signaling state change: RTCSignalingState.RTCSignalingStateHaveRemoteOffer
I/flutter ( 4178): Add remote stream
W/FlutterWebRTCPlugin( 4178): FlutterRTCVideoRenderer.setVideoTrack, set video track to a13e526e-fc21-4921-84be-20db79990691
I/BufferQueueProducer( 4178): [SurfaceTexture-0-4178-14](id:105200000016,api:1,p:4178,c:4178) disconnect: api 1
D/libMEOW ( 4178): meow delete tls: 0xb40000747d831580
D/libMEOW ( 4178): meow new tls: 0xb40000747d831580
D/libMEOW ( 4178): applied 0 plugin for [com.example.meetoy].
I/BufferQueueProducer( 4178): [SurfaceTexture-0-4178-14](id:105200000016,api:1,p:4178,c:4178) connect: api=1 producerControlledByApp=true
D/FlutterWebRTCPlugin( 4178): onIceGatheringChangeGATHERING
D/FlutterWebRTCPlugin( 4178): onIceCandidate
D/FlutterWebRTCPlugin( 4178): onIceCandidate
I/flutter ( 4178): Signaling state change: RTCSignalingState.RTCSignalingStateStable
I/flutter ( 4178): ICE connection state change: RTCIceGatheringState.RTCIceGatheringStateGathering
D/FlutterWebRTCPlugin( 4178): onConnectionChangeCONNECTING
D/FlutterWebRTCPlugin( 4178): onIceCandidate
D/FlutterWebRTCPlugin( 4178): onIceCandidate
D/FlutterWebRTCPlugin( 4178): onIceCandidate
I/flutter ( 4178): Connection state change: RTCPeerConnectionState.RTCPeerConnectionStateConnecting
I/mali_config( 4178): @get_buffer_dataspace_setting: update dataspace from GE (0x10020000 -> 0x08020000)
W/main_texture_ca( 4178): type=1400 audit(0.0:151571): avc: denied { getattr } for name="dmabuf:" dev="dmabuf" ino=1 scontext=u:r:untrusted_app:s0:c151,c258,c512,c768 tcontext=u:object_r:unlabeled:s0 tclass=filesystem permissive=0 app=com.example.meetoy
D/FlutterWebRTCPlugin( 4178): onIceGatheringChangeCOMPLETE
I/flutter ( 4178): ICE connection state change: RTCIceGatheringState.RTCIceGatheringStateComplete


问:
Exception in thread "main" java.lang.NoClassDefFoundError: com/toedter/calendar/JDateChooser

I created the JAR file with Maven, after running it with the java -jar command, it throws me an exception:

```<code>(Exception in thread "main" java.lang.NoClassDefFoundError: com/toedter/calendar/JDateChooser)
</code>```

Reading on the forums the problem lies in the classpath, the Jar does not recognize Maven dependencies.

I really don't know how to do it, can someone help me, please?

Body:
I created the JAR file with Maven, after running it with the java -jar command, it throws me an exception:

(Exception in thread "main" java.lang.NoClassDefFoundError: com/toedter/calendar/JDateChooser)

Reading on the forums the problem lies in the classpath, the Jar does not recognize Maven dependencies.

I really don't know how to do it, can someone help me, please?


问:
How to Maintain fullscreen mode even if i refresh the page in javascript
I have a requirement in my project where user should view the content in Fullscreen only.
i have handled redirection to other page if user exits Fullscreen, but the requirement is when the user refreshes the page, it should not redirect to other page and should maintain fullscreen mode and reload.

if fullscreen exits on refresh i tried to push back to fullscreen mode but not worked


问:
Caching a function with refresh rate
I have the following scenario. Below is a minimalist version of what I am trying to do
in a simple spring boot REST API Controller and Service.

```<code>func()
{
String lv=vService.getlv("1.2.1");
String mv=vService.getmv("1.3.1");

}

@Service
public class VService{

    public String getlv(String version){
        JsonArray lvVersions=makeHTTPGETLv();
        String result=getVersion(lvVersions,version);
        return result;
    }
    public String getMv(String version){
            JsonArray mvVersions=makeHTTPGETMv();
            String result=getVersion(mvVersions,version);
        return result;

}

private String getVersion(JsonArray versions, String version){
    Map<String,String> versionMap=new HashMap<>();
    for(JsonElement je: versions){
    JsonObject jo=je.getAsJsonObject();
            //some logic
            versionMap.put(jo.get("ver").getAsString(),jo.get("rver").getAsString);
    }
    return versionMap.get(version);
}
}

</code>```

The getVersion method internally builds a map every time it is called.
The getlv method and getMv method both invokes the getVersion method
In the call getVersion(lvVersions,version); the lvVersions value will always be same,
It is a JSON array containing the mapping between versions.
And so each time getlv is called we are making a GET request makeHTTPGETLv and then
searching for the corresponding mapping of the given version.

Due to the static nature of this, it could be cached.
The multiple GET calls to makeHTTPGETLv could be avoided as it will always return the same JSON array (the changes could occur in some days though) and also the map that is built inside the getVersion method is unchanging.
Since the JsonArray could change, which is the response of a GET request,
So there could be a logic to update the cache every x minute. which could be 5 minutes or 60 mins.

How do I achieve this in spring boot?
Also to avoid taking the time for the first call, I could use Eager loading.

Steps Taken:

I tried using the @Cacheable annotation on top of the functions. It didn't have any effect. It seems I will have to put some more logic there. I could put out a separate function that builds the map that is being built inside the getVersion function. And so use this map for every call. But this map needs to be updated periodically (could be 5 mins, 60 mins, or even 1 day) which will require a GET call and building up the map. This reduces the problem of updating the Map every x minute. Because then I could directly use the map to fetch the corresponding version and avoid the GET call and parsing the response every time.

Similar Reducible/Smaller/alternate problem:

```<code>class Test {
    private Map<String,String> map;

    private void buildMap(){
      }
}
</code>```

The buildMap function updates the map attribute. Is there a way that buildMap function gets called every 30 minutes so that the map remains updated? That sounds like a cron job. Not sure if some caching is helpful here or if cron job and how to achieve that in spring boot.

Title: Caching a function with refresh rate

Body:
I have the following scenario. Below is a minimalist version of what I am trying to do
in a simple spring boot REST API Controller and Service.

func()
{
String lv=vService.getlv("1.2.1");
String mv=vService.getmv("1.3.1");

}

@Service
public class VService{

    public String getlv(String version){
        JsonArray lvVersions=makeHTTPGETLv();
        String result=getVersion(lvVersions,version);
        return result;
    }
    public String getMv(String version){
            JsonArray mvVersions=makeHTTPGETMv();
            String result=getVersion(mvVersions,version);
        return result;

}

private String getVersion(JsonArray versions, String version){
    Map<String,String> versionMap=new HashMap<>();
    for(JsonElement je: versions){
    JsonObject jo=je.getAsJsonObject();
            //some logic
            versionMap.put(jo.get("ver").getAsString(),jo.get("rver").getAsString);
    }
    return versionMap.get(version);
}
}

The getVersion method internally builds a map every time it is called.
The getlv method and getMv method both invokes the getVersion method
In the call getVersion(lvVersions,version); the lvVersions value will always be same,
It is a JSON array containing the mapping between versions.
And so each time getlv is called we are making a GET request makeHTTPGETLv and then
searching for the corresponding mapping of the given version.

Due to the static nature of this, it could be cached.
The multiple GET calls to makeHTTPGETLv could be avoided as it will always return the same JSON array (the changes could occur in some days though) and also the map that is built inside the getVersion method is unchanging.
Since the JsonArray could change, which is the response of a GET request,
So there could be a logic to update the cache every x minute. which could be 5 minutes or 60 mins.

How do I achieve this in spring boot?
Also to avoid taking the time for the first call, I could use Eager loading.

Steps Taken:

I tried using the @Cacheable annotation on top of the functions. It didn't have any effect. It seems I will have to put some more logic there. I could put out a separate function that builds the map that is being built inside the getVersion function. And so use this map for every call. But this map needs to be updated periodically (could be 5 mins, 60 mins, or even 1 day) which will require a GET call and building up the map. This reduces the problem of updating the Map every x minute. Because then I could directly use the map to fetch the corresponding version and avoid the GET call and parsing the response every time.

Similar Reducible/Smaller/alternate problem:

class Test {
    private Map<String,String> map;

    private void buildMap(){
      }
}

The buildMap function updates the map attribute. Is there a way that buildMap function gets called every 30 minutes so that the map remains updated? That sounds like a cron job. Not sure if some caching is helpful here or if cron job and how to achieve that in spring boot.


问:
how to integrate rtl css in angular in a way that we can load style.css and style.rtl.css alternatively as we change lang from UI
i want to generate css or scss for already existing code/project's custom css/scss as separate file and want to switch b/w normal and rtl css through UI interaction.

I'm using rtlcss node package and following this gist for generating css at build time.

Angular version could be any newer is better i.e. Angular 12+

I'm looking for some automated or smart way to do this, i could generate rtl css and append in already existing css file. and prepend [dir='rlt'] with each rule. but flaw in that approach as follow.

```<code>// style.css
.my-class {
  width: 200px;
  margin-left: 16px;
}

[dir='rtl'] .my-class {
  width: 200px; // flaw : property repeatation
  margin-left: 0; // flaw : adding extra rule & its not neccessary *-left to have zero in every case.
  margin-right: 16px;
}
</code>```

Body:
i want to generate css or scss for already existing code/project's custom css/scss as separate file and want to switch b/w normal and rtl css through UI interaction.

I'm using rtlcss node package and following this gist for generating css at build time.

Angular version could be any newer is better i.e. Angular 12+

I'm looking for some automated or smart way to do this, i could generate rtl css and append in already existing css file. and prepend [dir='rlt'] with each rule. but flaw in that approach as follow.

// style.css
.my-class {
  width: 200px;
  margin-left: 16px;
}

[dir='rtl'] .my-class {
  width: 200px; // flaw : property repeatation
  margin-left: 0; // flaw : adding extra rule & its not neccessary *-left to have zero in every case.
  margin-right: 16px;
}