问:
how custom array radio button array in React CSS
I want custom an array radio buttons, but without the dot. I want remove it and use a div or something different. I don't find solution to do it, I failed to pass the input radio detection upper the div and use transparency to hide it. I think it's a CSS problem.
You know if there is possibility to do that.

here the github page with the component project:
https://github.com/knupel/gatsby_react_lab/tree/main/src/pages/gui/button_radio

and a link to see the halft success in action

https://stanlab.netlify.app/gui/button_radio/button_radio/

So when the top part of the dot is clicked the div color change like I wish, but my purpose is only using the square part to click and make the dot upper and transparency to only use the engine of the input radio, not the design. The problem it's when I make the full superposition nothing work like expected.

I try to make a simplest code to illustrate:

React component

import * as React from "react";
import { Fragment } from "react"
import { useState, createContext, useEffect, useContext  } from "react";
import './radio_button.css'

function useRadioContext() {
  const context = useContext(RadioContext);
  if (!context) {
    throw new Error(
      `Radio compound components cannot be rendered outside the Radio component`
    );
  }
  return context;
}

function RadioGroup({ children, defaultValue, onChange }) {
  const [toggle_is, set_toggle_is] = useState("");
    useEffect(() => {
    set_toggle_is(defaultValue);
  }, [defaultValue]);
  function toggle_state(value) {
    set_toggle_is(value);
    onChange(value);
  }

  return (
    <RadioContext.Provider value={[toggle_is, toggle_state]}>

{children}

    </RadioContext.Provider>
  );
}

function RadioSingle({ value, children }) {
  const [toggle_is, onChange] = useRadioContext();
  const checked = value === toggle_is;
  return (

                <input
                    className="radio-input"
                    id="radio_button"
                    value={value}
                    checked={checked}
                    type="radio"
                    onChange={({ target }) => {
                        // some code if necessary
                        console.log(target.value, checked);
                        onChange(target.value)}}
                />

  );
}

RadioGroup.RadioSingle = RadioSingle;

export default function RadioButton() {
    const num_button = [1,2,3,4,5,6,7,8,9];

    const [radio_is, set_radio_is] = useState([])
  let id = 0
  useEffect(() => {
    num_button.forEach(elem => {
            set_radio_is(prev_id => [...prev_id, {id: id++, index :elem -1, active_is: false}])
    })
  }, [])

    return(

            <Layout title="Graphic user interface : radio button"></Layout>
            <RadioGroup
        defaultValue="3"
        onChange={value => console.log("value: ", value)}
      >

                            {radio_is.map((elem, index) => (
                                // <RadioGroup.RadioSingle value={elem} >{index}</RadioGroup.RadioSingle>
                                <RadioGroup.RadioSingle value={index.toString()} >{index}</RadioGroup.RadioSingle>
                            ))}

      </RadioGroup>
                    ))}

    )
}

```
<p>CSS part</p>
<pre class="lang-css prettyprint-override"><code>.radio-label {
  margin-right: 7px;
}

.radio-input {
  height: 30px;
  width: 30px;
  margin: 0;
  z-index:1;
  opacity: 0.5;
  cursor: pointer;
}

.radio-input:checked + div {
    background: magenta;
}

.custom-radio {
  position:relative;
  z-index:0;
  bottom: 15px;
  width: 30px;
  height: 30px;
  background: cyan;

}
</code>```

Body:
I want custom an array radio buttons, but without the dot. I want remove it and use a div or something different. I don't find solution to do it, I failed to pass the input radio detection upper the div and use transparency to hide it. I think it's a CSS problem.
You know if there is possibility to do that.

here the github page with the component project:
https://github.com/knupel/gatsby_react_lab/tree/main/src/pages/gui/button_radio

and a link to see the halft success in action

https://stanlab.netlify.app/gui/button_radio/button_radio/

So when the top part of the dot is clicked the div color change like I wish, but my purpose is only using the square part to click and make the dot upper and transparency to only use the engine of the input radio, not the design. The problem it's when I make the full superposition nothing work like expected.

I try to make a simplest code to illustrate:

React component

import * as React from "react";
import { Fragment } from "react"
import { useState, createContext, useEffect, useContext  } from "react";
import './radio_button.css'

function useRadioContext() {
  const context = useContext(RadioContext);
  if (!context) {
    throw new Error(
      `Radio compound components cannot be rendered outside the Radio component`
    );
  }
  return context;
}

function RadioGroup({ children, defaultValue, onChange }) {
  const [toggle_is, set_toggle_is] = useState("");
    useEffect(() => {
    set_toggle_is(defaultValue);
  }, [defaultValue]);
  function toggle_state(value) {
    set_toggle_is(value);
    onChange(value);
  }

  return (
    <RadioContext.Provider value={[toggle_is, toggle_state]}>

{children}

    </RadioContext.Provider>
  );
}

function RadioSingle({ value, children }) {
  const [toggle_is, onChange] = useRadioContext();
  const checked = value === toggle_is;
  return (

                <input
                    className="radio-input"
                    id="radio_button"
                    value={value}
                    checked={checked}
                    type="radio"
                    onChange={({ target }) => {
                        // some code if necessary
                        console.log(target.value, checked);
                        onChange(target.value)}}
                />

  );
}

RadioGroup.RadioSingle = RadioSingle;

export default function RadioButton() {
    const num_button = [1,2,3,4,5,6,7,8,9];

    const [radio_is, set_radio_is] = useState([])
  let id = 0
  useEffect(() => {
    num_button.forEach(elem => {
            set_radio_is(prev_id => [...prev_id, {id: id++, index :elem -1, active_is: false}])
    })
  }, [])

    return(

            <Layout title="Graphic user interface : radio button"></Layout>
            <RadioGroup
        defaultValue="3"
        onChange={value => console.log("value: ", value)}
      >

                            {radio_is.map((elem, index) => (
                                // <RadioGroup.RadioSingle value={elem} >{index}</RadioGroup.RadioSingle>
                                <RadioGroup.RadioSingle value={index.toString()} >{index}</RadioGroup.RadioSingle>
                            ))}

      </RadioGroup>
                    ))}

    )
}

CSS part

.radio-label {
  margin-right: 7px;
}

.radio-input {
  height: 30px;
  width: 30px;
  margin: 0;
  z-index:1;
  opacity: 0.5;
  cursor: pointer;
}

.radio-input:checked + div {
    background: magenta;
}

.custom-radio {
  position:relative;
  z-index:0;
  bottom: 15px;
  width: 30px;
  height: 30px;
  background: cyan;

}


来源: stackexchange

问:
Flutter secure storage data is wiped out by third party apps like mobile optimizer apps
Hey I have created an app in which i have used flutter secure storage. But flutter secure storage data is cleared every time when the app is closed. I think this is due to performance optimizer which frees the mobile data. Now is there is any way in which i can prevent app data from being deleted .because in india most of the people uses performance optimizer specially xiomi redmi etc. App is working fine with motorola one power android version 10 and the problem creating device uses android version 11</p>

ContentLicense: CC BY-SA 4.0


问:
Can thttpd support multipart/form-data?
I could successfully setup thttpd and tested a sample page with form. If I replace the input element with type "file" and post a file upload, thttpd closes the connection without any response but the same works if the input type is text.

So does thttpd supports file uploading ie handling of multipart/form-data? If yes how to handle the same using a cgi written in C/C++?

ContentLicense: CC BY-SA 3.0

Title: Can thttpd support multipart/form-data?


问:
moviepy alters video aspect ratio
I got a simple code that cuts a video into multiple clips based on given frame numbers
but the video always gets altered (images attached)
If someone could provide me with some insight I would really appreciate it
Result
Original video

```<code>og_clip = mp.VideoFileClip(video)  # original video
start_frames, end_frames = get_clip_boundaries(video)  # returns frame numbers

og_clip.set_fps(fps)

clips = []
for i in range(len(start_frames)):
    start_time = start_frames[i] / fps  # corresponding timestamps to frame numbers
    end_time = end_frames[i] / fps

    clip = og_clip.subclip(start_time, end_time)
    clips.append(clip)
</code>```

I tried resizing the subclips already, nothing changed.
After that I checked the dimensions of the subclips and it seems that it's something else that gets altered

Title: moviepy alters video aspect ratio

Body:
I got a simple code that cuts a video into multiple clips based on given frame numbers
but the video always gets altered (images attached)
If someone could provide me with some insight I would really appreciate it
Result
Original video

og_clip = mp.VideoFileClip(video)  # original video
start_frames, end_frames = get_clip_boundaries(video)  # returns frame numbers

og_clip.set_fps(fps)

clips = []
for i in range(len(start_frames)):
    start_time = start_frames[i] / fps  # corresponding timestamps to frame numbers
    end_time = end_frames[i] / fps

    clip = og_clip.subclip(start_time, end_time)
    clips.append(clip)

I tried resizing the subclips already, nothing changed.
After that I checked the dimensions of the subclips and it seems that it's something else that gets altered


问:
How to copy spreadsheet table to doc without breaking the format with Apps Script
[Goal]

I want to be able to copy a table from a Spreadsheet and paste it to a Google Docs agenda document that is used for team meetings. The exact steps are as follows.

The user will use the custom menu on the Google Docs agenda file to run the script.

The script will copy the all the body content from another separate Google Docs template file.

It'll then paste everything starting from the 4th line from the top of the agenda file.
Example:

The script will copy a table from a Spreadsheet (in this example, range A5:G17).

The script will then paste the table into the agenda file in the exact location. Example:

[Issue]

However, the copied table from the spreadsheet executed by the script isn't properly formatted in the agenda template. Here are the examples.

What I DON'T want: This is done through the script.

What I do want: I had to manually copy the table from the spreadsheet and paste it manually to the agenda doc. However, I'd prefer having the script do it.

[My Code so far]

function onOpen() {
  initMenu();

}

function initMenu() {
  const ui = DocumentApp.getUi();
  const menu = ui.createMenu('Custom Functions');

  // updateMainData function
  menu.addItem('Add New Week', 'addNewWeek');
  menu.addToUi();

}

function addNewWeek() {
  const doc = DocumentApp.getActiveDocument();

  const templateDoc = DocumentApp.openById("12COMKRpQT-sut-esvYR9B8KlrSptr5JcwP6Min2uxMU");
  const templateBody = templateDoc.getBody();
  var templateTotalElements = templateBody.getNumChildren();

  // Modifying Tempalte Date
  var index1 = templateBody.getChild(1).getText();
  const templateDate = new Date(templateBody.getChild(1).getText());
  const incrementDate = new Date(templateDate.setDate(templateDate.getDate() + 7));
  const convertDateFormat = Utilities.formatDate(incrementDate, "JST", "yyyy-MM-dd");
  templateBody.replaceText(index1, convertDateFormat);

  for (var i = 0; i < templateTotalElements; i++) {
    var body = doc.getBody();
    var element = templateBody.getChild(i).copy();
    var type = element.getType();

    if (type == DocumentApp.ElementType.PARAGRAPH) {
      body.insertParagraph(3 + i, element);

    } else if (type == DocumentApp.ElementType.TABLE) {
      body.insertTable(3 + i, element);

    } else if (type == DocumentApp.ElementType.LIST_ITEM) {
      body.insertListItem(3 + i, element);

    }

  }

  const mtgSheet = SpreadsheetApp.openById("1MMSGNt4tPZmTLEsOMNA9i1TI0duY88Ey9gJHMq0G9sU").getSheetByName("Sheet1");
  const mtgRange = mtgSheet.getRange("A1:G13").getDataRegion(SpreadsheetApp.Dimension.ROWS);
  const mtgValues = mtgRange.getDisplayValues();
  const mgtBackgroundColors = mtgRange.getBackgrounds();
  const mtgStyle = mtgRange.getTextStyles();

  var body = doc.getBody();
  var table = body.insertTable(8, mtgValues);
  table.setBorderWidth(0);

  for (var i = 0; i < table.getNumRows(); i++) {
    for (var j = 0; j < table.getRow(i).getNumCells(); j++) {
      var obj = {};
      obj[DocumentApp.Attribute.BACKGROUND_COLOR] = mgtBackgroundColors[i][j];
      obj[DocumentApp.Attribute.FONT_SIZE] = mtgStyle[i][j].getFontSize();

      if (mtgStyle[i][j].isBold()) {
        obj[DocumentApp.Attribute.BOLD] = true;

      }
      table.getRow(i).getCell(j).setAttributes(obj);

    }

  }

}
```

[References that I found]

I tried using the methods listed here, which got me very close, however, I don't know what to do next.

Body:
[Goal]

I want to be able to copy a table from a Spreadsheet and paste it to a Google Docs agenda document that is used for team meetings. The exact steps are as follows.

The user will use the custom menu on the Google Docs agenda file to run the script.

The script will copy the all the body content from another separate Google Docs template file.

It'll then paste everything starting from the 4th line from the top of the agenda file.
Example:

The script will copy a table from a Spreadsheet (in this example, range A5:G17).

The script will then paste the table into the agenda file in the exact location. Example:

[Issue]

However, the copied table from the spreadsheet executed by the script isn't properly formatted in the agenda template. Here are the examples.

What I DON'T want: This is done through the script.

What I do want: I had to manually copy the table from the spreadsheet and paste it manually to the agenda doc. However, I'd prefer having the script do it.

[My Code so far]

function onOpen() {
  initMenu();

}

function initMenu() {
  const ui = DocumentApp.getUi();
  const menu = ui.createMenu('Custom Functions');

  // updateMainData function
  menu.addItem('Add New Week', 'addNewWeek');
  menu.addToUi();

}

function addNewWeek() {
  const doc = DocumentApp.getActiveDocument();

  const templateDoc = DocumentApp.openById("12COMKRpQT-sut-esvYR9B8KlrSptr5JcwP6Min2uxMU");
  const templateBody = templateDoc.getBody();
  var templateTotalElements = templateBody.getNumChildren();

  // Modifying Tempalte Date
  var index1 = templateBody.getChild(1).getText();
  const templateDate = new Date(templateBody.getChild(1).getText());
  const incrementDate = new Date(templateDate.setDate(templateDate.getDate() + 7));
  const convertDateFormat = Utilities.formatDate(incrementDate, "JST", "yyyy-MM-dd");
  templateBody.replaceText(index1, convertDateFormat);

  for (var i = 0; i < templateTotalElements; i++) {
    var body = doc.getBody();
    var element = templateBody.getChild(i).copy();
    var type = element.getType();

    if (type == DocumentApp.ElementType.PARAGRAPH) {
      body.insertParagraph(3 + i, element);

    } else if (type == DocumentApp.ElementType.TABLE) {
      body.insertTable(3 + i, element);

    } else if (type == DocumentApp.ElementType.LIST_ITEM) {
      body.insertListItem(3 + i, element);

    }

  }

  const mtgSheet = SpreadsheetApp.openById("1MMSGNt4tPZmTLEsOMNA9i1TI0duY88Ey9gJHMq0G9sU").getSheetByName("Sheet1");
  const mtgRange = mtgSheet.getRange("A1:G13").getDataRegion(SpreadsheetApp.Dimension.ROWS);
  const mtgValues = mtgRange.getDisplayValues();
  const mgtBackgroundColors = mtgRange.getBackgrounds();
  const mtgStyle = mtgRange.getTextStyles();

  var body = doc.getBody();
  var table = body.insertTable(8, mtgValues);
  table.setBorderWidth(0);

  for (var i = 0; i < table.getNumRows(); i++) {
    for (var j = 0; j < table.getRow(i).getNumCells(); j++) {
      var obj = {};
      obj[DocumentApp.Attribute.BACKGROUND_COLOR] = mgtBackgroundColors[i][j];
      obj[DocumentApp.Attribute.FONT_SIZE] = mtgStyle[i][j].getFontSize();

      if (mtgStyle[i][j].isBold()) {
        obj[DocumentApp.Attribute.BOLD] = true;

      }
      table.getRow(i).getCell(j).setAttributes(obj);

    }

  }

}

[References that I found]

I tried using the methods listed here, which got me very close, however, I don't know what to do next.


问:
How to have the same screenshot with Chrome and Ubuntu using Puppeteer
I have defined parameters to take a screenshot with a defined parameters and using Puppeteer on Chrome the screenshot is perfect but when I use Ubuntu the behavior changes and the screenshot is not correct anymore. Do you have an idea please ?</p>
```<code>  if(title.includes("Love")){
    await page.evaluate(() => {
      window.scrollTo(0, 70);
    });
  }
}
</code>```

Body:
I have defined parameters to take a screenshot with a defined parameters and using Puppeteer on Chrome the screenshot is perfect but when I use Ubuntu the behavior changes and the screenshot is not correct anymore. Do you have an idea please ?

  if(title.includes("Love")){
    await page.evaluate(() => {
      window.scrollTo(0, 70);
    });
  }
}


问:
Compine RBAC with ABAC casbin
I am quite new programmer and I need your help. I need to combine RBAC with ABAC. For the application requirements, imagine that we have some endpoints that some users with a specific role have access tos (imagine only the admin can POST an action for a Items). I need to add some granuallity from the items that belongs into groups.So items inherit all permissions from parent group(recursively).The priority is permissions -> group permissions -> global permissions. Also for my model i need every user tohaves access only to his dashboard page APIi/v1/:id. for example user1 has access to api/v1/1 but not to api/v1/2.Is that possible  ?Would appreciate your suggestions.

My current implementation has 2 models (Nodejs implementation)

```<code>[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[role_definition]
g = _,_

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.sub) && keyMatch2(r.obj, p.obj) && regex match(r.act, p.act)

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub_rule, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = eval(p.sub_rule) && r.obj == p.obj && r.act == p.act
</code>```

Title: Compine RBAC with ABAC casbin

Body:
I am quite new programmer and I need your help. I need to combine RBAC with ABAC. For the application requirements, imagine that we have some endpoints that some users with a specific role have access tos (imagine only the admin can POST an action for a Items). I need to add some granuallity from the items that belongs into groups.So items inherit all permissions from parent group(recursively).The priority is permissions -> group permissions -> global permissions. Also for my model i need every user tohaves access only to his dashboard page APIi/v1/:id. for example user1 has access to api/v1/1 but not to api/v1/2.Is that possible  ?Would appreciate your suggestions.

My current implementation has 2 models (Nodejs implementation)

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[role_definition]
g = _,_

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.sub) && keyMatch2(r.obj, p.obj) && regex match(r.act, p.act)

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub_rule, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = eval(p.sub_rule) && r.obj == p.obj && r.act == p.act


问:
Change the DNS mapping from CNAME record to A record
Currently, I have my app hosted on azure SAAS offering and I have a CNAME against (ABC.DEF.com) its Azure specific DNS, I am migrating the service hosted under Azure to a VM which has its own public static IP, For that i have to change the DNS mapping from CNAME record to A record. I am planning to send guid in request header and check that header to allow traffic in app gateway. What are the options we have to do this or can we follow the above approach itself?

I have tried this approach and its working but wanted to find the right solution.


问:
ICU RuleBasedNumberFormat spellout trailing zero issue
There is a problem with number spellout in russian language.
Trailing zeros in decimal number are ignored in final result. Here is what I mean:
`

```<code>RuleBasedNumberFormat nf = new RuleBasedNumberFormat(Locale.forLanguageTag("ru"), RuleBasedNumberFormat.SPELLOUT);
// двенадцать целых три десятых, OK
System.err.println(nf.format(12.3, "%spellout-cardinal-neuter"));

// same output, двенадцать целых три десятых. Expected 'двенадцать целых триста тысячных'
System.err.println(nf.format(12.300, "%spellout-cardinal-neuter"));
</code>```

`

Played around with various settings and rules, seems like there is no way to set minimum fraction digits for spellout.

Body:
There is a problem with number spellout in russian language.
Trailing zeros in decimal number are ignored in final result. Here is what I mean:
`

RuleBasedNumberFormat nf = new RuleBasedNumberFormat(Locale.forLanguageTag("ru"), RuleBasedNumberFormat.SPELLOUT);
// двенадцать целых три десятых, OK
System.err.println(nf.format(12.3, "%spellout-cardinal-neuter"));

// same output, двенадцать целых три десятых. Expected 'двенадцать целых триста тысячных'
System.err.println(nf.format(12.300, "%spellout-cardinal-neuter"));

`

Played around with various settings and rules, seems like there is no way to set minimum fraction digits for spellout.


问:
textInfo.ToTitleCase Converts First letter capital eventhough culture info set as en-US
The following example was mentioned in below URL

https://learn.microsoft.com/en-us/dotnet/standard/base-types/changing-case

```<code>public class Example
{
   public static void Main()
   {
      string[] values = { "a tale of two cities", "gROWL to the rescue",
                          "inside the US government", "sports and MLB baseball",
                          "The Return of Sherlock Holmes", "UNICEF and children"};

      TextInfo ti = CultureInfo.CurrentCulture.TextInfo;
      foreach (var value in values)
         Console.WriteLine("{0} --> {1}", value, ti.ToTitleCase(value));
   }
}
// The example displays the following output:
//    a tale of two cities --> A Tale Of Two Cities
//    gROWL to the rescue --> Growl To The Rescue
//    inside the US government --> Inside The US Government
//    sports and MLB baseball --> Sports And MLB Baseball
//    The Return of Sherlock Holmes --> The Return Of Sherlock Holmes
//    UNICEF and children --> UNICEF And Children
</code>```

This is their NOTE

Note that although it is culture-sensitive, the TextInfo.ToTitleCase
method does not provide linguistically correct casing rules. For
instance, in the previous example, the method converts "a tale of two
cities" to "A Tale Of Two Cities". However, the linguistically correct
title casing for the en-US culture is "A Tale of Two Cities."

So In my app I used to following code to generate ToTitleCase()

```<code>public static string ConvertToTitleCase(string text)
{
    try
    {
        TextInfo textInfo = new CultureInfo("en-US", true).TextInfo;
        return textInfo.ToTitleCase(text);
    }
    catch (Exception)
    {

        throw;
    }
}
</code>```

When I pass the "UNICEF and children" to it, it gives me the output as
Unicef And Children.
How to avoid titlecasing if we type a word which have CAPITAL LETTERS. also not capitalize words like "of"

Body:
The following example was mentioned in below URL

https://learn.microsoft.com/en-us/dotnet/standard/base-types/changing-case

public class Example
{
   public static void Main()
   {
      string[] values = { "a tale of two cities", "gROWL to the rescue",
                          "inside the US government", "sports and MLB baseball",
                          "The Return of Sherlock Holmes", "UNICEF and children"};

      TextInfo ti = CultureInfo.CurrentCulture.TextInfo;
      foreach (var value in values)
         Console.WriteLine("{0} --> {1}", value, ti.ToTitleCase(value));
   }
}
// The example displays the following output:
//    a tale of two cities --> A Tale Of Two Cities
//    gROWL to the rescue --> Growl To The Rescue
//    inside the US government --> Inside The US Government
//    sports and MLB baseball --> Sports And MLB Baseball
//    The Return of Sherlock Holmes --> The Return Of Sherlock Holmes
//    UNICEF and children --> UNICEF And Children

This is their NOTE

Note that although it is culture-sensitive, the TextInfo.ToTitleCase
method does not provide linguistically correct casing rules. For
instance, in the previous example, the method converts "a tale of two
cities" to "A Tale Of Two Cities". However, the linguistically correct
title casing for the en-US culture is "A Tale of Two Cities."

So In my app I used to following code to generate ToTitleCase()

public static string ConvertToTitleCase(string text)
{
    try
    {
        TextInfo textInfo = new CultureInfo("en-US", true).TextInfo;
        return textInfo.ToTitleCase(text);
    }
    catch (Exception)
    {

        throw;
    }
}

When I pass the "UNICEF and children" to it, it gives me the output as
Unicef And Children.
How to avoid titlecasing if we type a word which have CAPITAL LETTERS. also not capitalize words like "of"


问:
expo FileSystem overwrite exsting image
I want to modify the metadata of an existing image. To do this, I am reading the image as a base64 string using await FileSystem.readAsStringAsync(imageUri, { encoding: "base64" }), and then modifying the metadata using the piexifjs library. However, when I try to write the modified image back to the file system using await FileSystem.writeAsStringAsync(imageUri, base64Code[1], { encoding: FileSystem.EncodingType.Base64 }), I get an error saying that the location is not writable.

One potential solution is to delete the original image and then write the modified image as a new file. However, this is not ideal because it prompts the user on Android devices to confirm the modification every time the metadata is edited.

Is there a better way to overwrite an existing image with a new base64 string without deleting the original file?

Title: expo FileSystem overwrite exsting image


问:
Why adding new condition gives me "The heap is empty" error on KNN search?
I am doing following KNN search request:

```<code>{
"filter": {
    "bool": {
        "must_not": {
            "term": {
                "some_field": 14642652
            }
        },
        "must": {
            "term": {
                "some_field2": true
            }
        }
    }
},
"knn": {
    "field": "photo_vector",
    "k": 5,
    "num_candidates": 5,
    "query_vector": [
        ...
    ]
}
</code>```

}

ES responses with 200 code, but I get following error on shards field:

```<code>{
"took": 522,
"timed_out": false,
"_shards": {
    "total": 12,
    "successful": 2,
    "skipped": 0,
    "failed": 10,
    "failures": [
        {
            "shard": 0,
            "index": "photos-v4",
            "node": "ZF73KImLQ2qVcRhedvBKcA",
            "reason": {
                "type": "illegal_state_exception",
                "reason": "The heap is empty"
            }
        }
    ]
},
   "hits": {...}
}
</code>```

If I remove the condition "some_field2": true, everything is ok.
What can be a reason for this error and how to fix it?

Body:
I am doing following KNN search request:

{
"filter": {
    "bool": {
        "must_not": {
            "term": {
                "some_field": 14642652
            }
        },
        "must": {
            "term": {
                "some_field2": true
            }
        }
    }
},
"knn": {
    "field": "photo_vector",
    "k": 5,
    "num_candidates": 5,
    "query_vector": [
        ...
    ]
}

}

ES responses with 200 code, but I get following error on shards field:

{
"took": 522,
"timed_out": false,
"_shards": {
    "total": 12,
    "successful": 2,
    "skipped": 0,
    "failed": 10,
    "failures": [
        {
            "shard": 0,
            "index": "photos-v4",
            "node": "ZF73KImLQ2qVcRhedvBKcA",
            "reason": {
                "type": "illegal_state_exception",
                "reason": "The heap is empty"
            }
        }
    ]
},
   "hits": {...}
}

If I remove the condition "some_field2": true, everything is ok.
What can be a reason for this error and how to fix it?


问:
how to manage a committed transaction and rollback
I basically have two procs Proc1 and Proc2, where the Proc1 writes to a table and Proc2 works upon data in the table.

so, the basic code would be:

```<code>Proc1(
// do some calculation
// insert into myTable data;
);

Proc2(
//do some calulation find coef
//read data from myTable where data_stat > 3 + coef;
//update information in my table;
);

</code>```

The problem is that both the proc have individual failure points, and since I need to work for Proc2 after the data is written in the table, I want a behaviour like this:

```<code>START TRANSACTION;
   start transaction;
    x = CALL Proc1();
    if(x = true)
      COMMIT TRANSACTION;
    else ROLLBACK TRANSACTION;

   // the data is commited;
   y = CALL Proc2()
   if(y=true) COMMIT TRANSACTION;
   else ROLLBACK TRANSACTION;
COMMIT TRANSACTION;
</code>```

I was looking to use save points, but, it seems that doens't temporarily commit data, because after proc2 fails, I'd like to revert to the state before the Proc1 committed. So, what are my options to create the behaviour I want other than writing a reverse proc?

Body:
I basically have two procs Proc1 and Proc2, where the Proc1 writes to a table and Proc2 works upon data in the table.

so, the basic code would be:

Proc1(
// do some calculation
// insert into myTable data;
);

Proc2(
//do some calulation find coef
//read data from myTable where data_stat > 3 + coef;
//update information in my table;
);

The problem is that both the proc have individual failure points, and since I need to work for Proc2 after the data is written in the table, I want a behaviour like this:

START TRANSACTION;
   start transaction;
    x = CALL Proc1();
    if(x = true)
      COMMIT TRANSACTION;
    else ROLLBACK TRANSACTION;

   // the data is commited;
   y = CALL Proc2()
   if(y=true) COMMIT TRANSACTION;
   else ROLLBACK TRANSACTION;
COMMIT TRANSACTION;

I was looking to use save points, but, it seems that doens't temporarily commit data, because after proc2 fails, I'd like to revert to the state before the Proc1 committed. So, what are my options to create the behaviour I want other than writing a reverse proc?


问:
Karate summary reports not giving combined report for all feature file in 1.4.0 RC2
I am recently using version 1.4.0 RC2, and I have observed that the karate summary report does not show the test result for all the feature files, but the last one in the list.
Early in one of my projects I was using 0.9.6 and did not face this issue, I was getting all the feature file test results consolidated in my karate summary report.

so I tried running the package in the project were I have 0.9.6 version and can see the consolidated report beeing generated

I check in 1.0.2 and there I can see the issue again

Has there been any change in the way the report is generated? do we need any other tags or dependencies to get the combined result?

```<code>package com.api.sa;

import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import com.intuit.karate.junit5.Karate;

public class runner {

    @Karate.Test
    @Order(1)
    Karate runPolicySetsGet() {
        return Karate.run("classpath:com/api/sa/AccountsDetails.feature").relativeTo(getClass());
    }

    @Karate.Test
    @Order(2)
    Karate runPolicySetsGet1() {
        return Karate.run("classpath:com/api/sa/PasswordExpire.feature").relativeTo(getClass());
    }

}
</code>```

Report

Expect that the Summary contains the result for the Account details also

Body:
I am recently using version 1.4.0 RC2, and I have observed that the karate summary report does not show the test result for all the feature files, but the last one in the list.
Early in one of my projects I was using 0.9.6 and did not face this issue, I was getting all the feature file test results consolidated in my karate summary report.

so I tried running the package in the project were I have 0.9.6 version and can see the consolidated report beeing generated

I check in 1.0.2 and there I can see the issue again

Has there been any change in the way the report is generated? do we need any other tags or dependencies to get the combined result?

package com.api.sa;

import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import com.intuit.karate.junit5.Karate;

public class runner {

    @Karate.Test
    @Order(1)
    Karate runPolicySetsGet() {
        return Karate.run("classpath:com/api/sa/AccountsDetails.feature").relativeTo(getClass());
    }

    @Karate.Test
    @Order(2)
    Karate runPolicySetsGet1() {
        return Karate.run("classpath:com/api/sa/PasswordExpire.feature").relativeTo(getClass());
    }

}

Report

Expect that the Summary contains the result for the Account details also


问:
Difference between parameters with double dash and without in C# Selenium webdriver
Is there a difference between passing parameters with dashes and without?

```<code>ChromeOptions options = new ChromeOptions();

options.AddArguments(new List<string>()
{
   "headless", "no-sandbox", "disable-dev-shm-usage",
   "disable-gpu", "start-maximized", "disable-extensions"
});
</code>```

and

```<code>ChromeOptions options = new ChromeOptions();

options.AddArguments(new List<string>()
{
   "--headless", "--no-sandbox", "--disable-dev-shm-usage",
   "--disable-gpu", "--start-maximized", "--disable-extensions"
});
</code>```

Body:
Is there a difference between passing parameters with dashes and without?

ChromeOptions options = new ChromeOptions();

options.AddArguments(new List<string>()
{
   "headless", "no-sandbox", "disable-dev-shm-usage",
   "disable-gpu", "start-maximized", "disable-extensions"
});

and

ChromeOptions options = new ChromeOptions();

options.AddArguments(new List<string>()
{
   "--headless", "--no-sandbox", "--disable-dev-shm-usage",
   "--disable-gpu", "--start-maximized", "--disable-extensions"
});


问:
How to crop bitmap and save with original clarity of image?
When I crop a bitmap from an image, the clarity of the cropped bitmap is reduced. How to bring the original clarity of the bitmap when cropping.

```<code>temp = temporary bitmap image,
varas.ptval = orignal image.
</code>```

This is the result:

my code:

```<code>Bitmap temp;

Bitmap croped;

Rectangle rectangle = new Rectangle();

rectangle.Height = varas.Rect_H;

rectangle.Width = varas.Rect_W;

rectangle.X = varas.Rect_X;

rectangle.Y = varas.Rect_Y;

temp = varas.ptval;

croped = cropBitmap(temp, rectangle);

varas.RGBcrop = croped;

croped.Save(paths + "\\" + "SPR_" + ".jpeg", ImageFormat.Jpeg);
</code>```

I want such a result:

Body:
When I crop a bitmap from an image, the clarity of the cropped bitmap is reduced. How to bring the original clarity of the bitmap when cropping.

temp = temporary bitmap image,
varas.ptval = orignal image.

This is the result:

my code:

Bitmap temp;

Bitmap croped;

Rectangle rectangle = new Rectangle();

rectangle.Height = varas.Rect_H;

rectangle.Width = varas.Rect_W;

rectangle.X = varas.Rect_X;

rectangle.Y = varas.Rect_Y;

temp = varas.ptval;

croped = cropBitmap(temp, rectangle);

varas.RGBcrop = croped;

croped.Save(paths + "\\" + "SPR_" + ".jpeg", ImageFormat.Jpeg);

I want such a result:


问:
DAG stages in spark
I have created simple word count spark job.

word_count.py :-

```<code>sc = SparkContext("local","PySpark Word Count Exmaple")
print("0:",type(sc))
print("0:",sc)

# read data from text file and split each line into words
rdd = sc.textFile("file:///home/prashant/hello.txt")
print("1:",type(rdd))
print("2:",rdd)
words=rdd.flatMap(lambda line: line.split(" "))
print("3:",type(words))
print("4:",words)

# count the occurrence of each word
wordmap = words.map(lambda word: (word, 1))
print("5:",type(wordmap))
print("6:",wordmap)
wordCounts=wordmap.reduceByKey(lambda a,b:a +b)
print("7:",type(wordmap))
print("8:",wordmap)

# save the counts to output
wordCounts.saveAsTextFile("file:///home/prashant/spark_output1")
</code>```

This spark job created below two stages.I have attached a screenshot

Can someone explain how to read this DAG and make sense out of it?
Another question, reduceByKey() wide transformation is shown in stage 0.
But this was the last transformation done.I was expecting it to be in stage1 instead of stage 0.
How spark divides transformation functions into stages?

Title: DAG stages in spark

Body:
I have created simple word count spark job.

word_count.py :-

sc = SparkContext("local","PySpark Word Count Exmaple")
print("0:",type(sc))
print("0:",sc)

# read data from text file and split each line into words
rdd = sc.textFile("file:///home/prashant/hello.txt")
print("1:",type(rdd))
print("2:",rdd)
words=rdd.flatMap(lambda line: line.split(" "))
print("3:",type(words))
print("4:",words)

# count the occurrence of each word
wordmap = words.map(lambda word: (word, 1))
print("5:",type(wordmap))
print("6:",wordmap)
wordCounts=wordmap.reduceByKey(lambda a,b:a +b)
print("7:",type(wordmap))
print("8:",wordmap)

# save the counts to output
wordCounts.saveAsTextFile("file:///home/prashant/spark_output1")

This spark job created below two stages.I have attached a screenshot

Can someone explain how to read this DAG and make sense out of it?
Another question, reduceByKey() wide transformation is shown in stage 0.
But this was the last transformation done.I was expecting it to be in stage1 instead of stage 0.
How spark divides transformation functions into stages?


问:
Fetch matching object from array based on $in operator in mongodb
I'm trying to find out only matching objects from the array if we pass two status data this should return based on these two conditions. Please check my expected output result.

Based on the condition, I need to populate only matching objects from array. I have seen multi places result is coming based on the one condition like status: 'Open' or 'close', but I need status: ['Open','Closed'] like this and based on these two condition need to return all matching objects.

I have 120k documents like this in my collections

{
 "_id" : ObjectId("6375fd3e72488f3023bec621"),
 "name" : "AAA",
  "grade" : "A",
  "gradeStatus" : [
   {
   "status" : "Closed",
   "risk" : "66"
   },
   {
   "status" : "Open",
   "risk" : "88"
   },
   {
   "status" : "Hold",
   "risk" : "88"
   },
   {
   "status" : "Closed",
   "risk" : "88"
   },
   {
   "status" : "Cancelled",
   "risk" : "88"
   },
   {
   "status" : "Open",
   "risk" : "88"
    }
    ]
}
```
<p>I have used this query</p>
<p>I appreciate if this can be done without using aggregation framework <code>db.getCollection('testTable').aggregate([ { $unwind: "$gradeStatus"},     {$match: {"gradeStatus.status" : {$in:["Open","Closed"]}}},     {$project: { "_id": 1, "name":1,"grade":1, "gradeStatus.status": 1 }} ])</code></p>
<p>Expected output:</p>
<pre class="lang-json prettyprint-override"><code>{
 "_id" : ObjectId("6375fd3e72488f3023bec621"),
 "name" : "AAA",
  "grade" : "A",
  "gradeStatus" : [
   {
   "status" : "Closed",
   "risk" : "66"
   },
   {
   "status" : "Open",
   "risk" : "88"
   },
   {
   "status" : "Closed",
   "risk" : "88"
   },
   {
   "status" : "Open",
   "risk" : "88"
    }
    ]
}
</code>```

Body:
I'm trying to find out only matching objects from the array if we pass two status data this should return based on these two conditions. Please check my expected output result.

Based on the condition, I need to populate only matching objects from array. I have seen multi places result is coming based on the one condition like status: 'Open' or 'close', but I need status: ['Open','Closed'] like this and based on these two condition need to return all matching objects.

I have 120k documents like this in my collections

{
 "_id" : ObjectId("6375fd3e72488f3023bec621"),
 "name" : "AAA",
  "grade" : "A",
  "gradeStatus" : [
   {
   "status" : "Closed",
   "risk" : "66"
   },
   {
   "status" : "Open",
   "risk" : "88"
   },
   {
   "status" : "Hold",
   "risk" : "88"
   },
   {
   "status" : "Closed",
   "risk" : "88"
   },
   {
   "status" : "Cancelled",
   "risk" : "88"
   },
   {
   "status" : "Open",
   "risk" : "88"
    }
    ]
}

I have used this query

I appreciate if this can be done without using aggregation framework db.getCollection('testTable').aggregate([ { $unwind: "$gradeStatus"},     {$match: {"gradeStatus.status" : {$in:["Open","Closed"]}}},     {$project: { "_id": 1, "name":1,"grade":1, "gradeStatus.status": 1 }} ])

Expected output:

{
 "_id" : ObjectId("6375fd3e72488f3023bec621"),
 "name" : "AAA",
  "grade" : "A",
  "gradeStatus" : [
   {
   "status" : "Closed",
   "risk" : "66"
   },
   {
   "status" : "Open",
   "risk" : "88"
   },
   {
   "status" : "Closed",
   "risk" : "88"
   },
   {
   "status" : "Open",
   "risk" : "88"
    }
    ]
}


问:
How to call object inside array to call the entire data
I have my javascript with a function to add tables with loop but i want to add the format tables, if the header same org it would be the same row with the other data but if not the same it would be create another org with my data from my json and send it to my email but when i send it, it always empty.

What i want is like one row for org, 3 col for id, endpoint,online etc

and the json that show up is always like this

```<code>`data { Items [
{ org: four,
online: true,
id: 1,
endpoint: ovcx
}
]
Items [
{ org: four,
online: true,
id: 2,
endpoint: ovcx
}
]
[
{ org: four,
online: true,
id: 3,
endpoint: ovcx
}
]

data { Items [
{ org: bmw,
online: true,
id: 1,
endpoint: ovcx
}
]

[
{ org: bmw,
online: true,
id: 2,
endpoint: ovcx
}
]
}`
</code>```

let tableContent = ""
let stats = document.getElementById("status")

function tables() {
    tableContent += `<thead><tr><th class="tc-head" colspan="5">` + data[i].org + "

"

        + `<tr><td class="tc-row">ID</td><td class="tc-row">EndPoint</td><td class="tc-row">Status</td></tr></tbody>`
}

function tablesinfo() {
    tableContent +=

        `<tbody><tr><td class="tc-col">` + data[j].id + "	"

        + `<td class="tc-col">` + data[j].endpoint + "	"

        // + `<td class="tc-col">` + data[j].updatedAt + "	"

        // + `<td class="tc-col">` + data[j].exp + "	"

        + `<td id="status">` + data[j].online + "	"
}

for (i = 0; i < data.length; i++) {
    if (i == 0) {
        tables()
        for (j = 0; j < data.length; j++) {
            if (data[i].org == data[j].org) {
                tablesinfo()

            }
            else if (data[j].org != data[j].org) {
                j++
            }
        }
    }
    else if (data[i].org != data[i - 1].org) {
        tables()
        for (j = 0; j < data.length; j++) {
            if (data[i].org == data[j].org) {
                tablesinfo()

            }
            else if (data[j].org != data[j].org) {
                j++
            }
        }
    }
}

output.innerHTML = tableContent;```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Charger Station Status</title>
    <style type="text/css">
      .tc {
        border-collapse: collapse;
        border-color: #9abad9;
        border-spacing: 0;
      }
      .tc td {
        background-color: #ebf5ff;
        border-color: #9abad9;
        border-style: solid;
        border-width: 1px;
        color: #444;
        font-family: Arial, sans-serif;
        font-size: 14px;
        overflow: hidden;
        padding: 10px 5px;
        word-break: normal;
      }
      .tc th {
        background-color: #409cff;
        border-color: #9abad9;
        border-style: solid;
        border-width: 1px;
        color: #fff;
        font-family: Arial, sans-serif;
        font-size: 14px;
        font-weight: normal;
        overflow: hidden;
        padding: 10px 5px;
        word-break: normal;
      }
      .tc .tc-row {
        background-color: #efefef;
        border-color: inherit;
        text-align: center;
        vertical-align: top;
      }
      .tc .tc-head {
        background-color: #9aff99;
        border-color: inherit;
        font-weight: bold;
        text-align: center;
        vertical-align: top;
      }
      .tc #status {
        border-color: inherit;
        text-align: left;
        vertical-align: top;
      }
      .tc .tc-col{
        border-color: inherit;
        text-align: left;
        vertical-align: top;
      }
      .red{
        background-color: red;
        color: blue;
      }
      .green{
        color: #409cff;
        background-color: green;
      }
      .green{
        color: #000000;
        background-color: white;
      }
      @media screen and (max-width: 767px) {
        .tc {
          width: auto !important;
        }
        .tc col {
          width: auto !important;
        }
        .tc-wrap {
          overflow-x: auto;
          -webkit-overflow-scrolling: touch;
        }
      }
    </style>
  </head>
  <body>
    <div class="tc-wrap">
      <table class="tc" id="output">
      </table>
    </div>
    <script src="script.js"></script>
  </body>

</html></code>```

async function listItems(){
  try {
    console.log('========data scan=======');
    const data = await docClient.scan( params ).promise()
    const filter = data.Items.filter( ( item ) => !item.online && item.exp <= Math.floor( ( new Date( Date.now() ) ).getTime() / 1000.0 ) )
    console.log('filter', filter)
    const scanning = fs.readFileSync(
      `./table.html`,
      "utf8")

    if ( filter.length >= 1 ) {
      const to = 'myemail@gmail.com';
      const subject = 'EV Scanning Data!!!';
      const text = mustache.render(scanning, { ...data, ...filter })
      const send = await sendEmail( to, subject, text );
      console.log( 'send', send, 'data', data );

      filter.map( item => {
        let putItemParams = {
          TableName: tableListStation,
          Item: {
            id: item.id,
            org: item.org,
            online: item.online,
            endpoint: item.endpoint,
            exp: Math.floor( ( new Date( Date.now() + 172800000 ) ).getTime() / 1000.0 ),
            updatedAt: momentGetDateJKT()
          }
        };
        console.log('item params', putItemParams)
        docClient.put( putItemParams, ( err, datadb ) => {
          if ( err ) {
            console.log('error push')
            return({ message: err.message });
          } else {
            console.log('oke', datadb)
            return data;
          }
        } );
      })
    }
    return data
  } catch (err) {
    return err
  }
}```

Body:
I have my javascript with a function to add tables with loop but i want to add the format tables, if the header same org it would be the same row with the other data but if not the same it would be create another org with my data from my json and send it to my email but when i send it, it always empty.

What i want is like one row for org, 3 col for id, endpoint,online etc

and the json that show up is always like this

`data { Items [
{ org: four,
online: true,
id: 1,
endpoint: ovcx
}
]
Items [
{ org: four,
online: true,
id: 2,
endpoint: ovcx
}
]
[
{ org: four,
online: true,
id: 3,
endpoint: ovcx
}
]

data { Items [
{ org: bmw,
online: true,
id: 1,
endpoint: ovcx
}
]

[
{ org: bmw,
online: true,
id: 2,
endpoint: ovcx
}
]
}`

let tableContent = ""
let stats = document.getElementById("status")

function tables() {
    tableContent += `<thead><tr><th class="tc-head" colspan="5">` + data[i].org + "

"

        + `<tr><td class="tc-row">ID</td><td class="tc-row">EndPoint</td><td class="tc-row">Status</td></tr></tbody>`
}

function tablesinfo() {
    tableContent +=

        `<tbody><tr><td class="tc-col">` + data[j].id + "	"

        + `<td class="tc-col">` + data[j].endpoint + "	"

        // + `<td class="tc-col">` + data[j].updatedAt + "	"

        // + `<td class="tc-col">` + data[j].exp + "	"

        + `<td id="status">` + data[j].online + "	"
}

for (i = 0; i < data.length; i++) {
    if (i == 0) {
        tables()
        for (j = 0; j < data.length; j++) {
            if (data[i].org == data[j].org) {
                tablesinfo()

            }
            else if (data[j].org != data[j].org) {
                j++
            }
        }
    }
    else if (data[i].org != data[i - 1].org) {
        tables()
        for (j = 0; j < data.length; j++) {
            if (data[i].org == data[j].org) {
                tablesinfo()

            }
            else if (data[j].org != data[j].org) {
                j++
            }
        }
    }
}

output.innerHTML = tableContent;

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Charger Station Status</title>

async function listItems(){
  try {
    console.log('========data scan=======');
    const data = await docClient.scan( params ).promise()
    const filter = data.Items.filter( ( item ) => !item.online && item.exp <= Math.floor( ( new Date( Date.now() ) ).getTime() / 1000.0 ) )
    console.log('filter', filter)
    const scanning = fs.readFileSync(
      `./table.html`,
      "utf8")

    if ( filter.length >= 1 ) {
      const to = 'myemail@gmail.com';
      const subject = 'EV Scanning Data!!!';
      const text = mustache.render(scanning, { ...data, ...filter })
      const send = await sendEmail( to, subject, text );
      console.log( 'send', send, 'data', data );

      filter.map( item => {
        let putItemParams = {
          TableName: tableListStation,
          Item: {
            id: item.id,
            org: item.org,
            online: item.online,
            endpoint: item.endpoint,
            exp: Math.floor( ( new Date( Date.now() + 172800000 ) ).getTime() / 1000.0 ),
            updatedAt: momentGetDateJKT()
          }
        };
        console.log('item params', putItemParams)
        docClient.put( putItemParams, ( err, datadb ) => {
          if ( err ) {
            console.log('error push')
            return({ message: err.message });
          } else {
            console.log('oke', datadb)
            return data;
          }
        } );
      })
    }
    return data
  } catch (err) {
    return err
  }
}


问:
How to animate rearranging of composables from Column to Row and backwards?
How can I make same animation as in this video (here) but without using experimental APIs (except of AnimatedContent)? I want to rearrange elements from Row to Column. Here's the sample function which I need to animate

@Composable
fun SuperheroCard(superhero: Superhero, modifier: Modifier = Modifier) {
    Card(
        elevation = 2.dp,
        modifier = modifier
            .fillMaxWidth()
    ) {
        Row(modifier = Modifier.padding(16.dp)) {
            Column(modifier = Modifier.weight(1f)) {
                Text(
                    text = stringResource(id = superhero.nameRes),
                    style = MaterialTheme.typography.h3
                )
                Text(text = stringResource(id = superhero.descriptionRes), modifier = Modifier.wrapContentWidth())
            }
            Spacer(
                modifier = Modifier
                    .width(16.dp)
            )
            Box(
                modifier = Modifier
                    .size(72.dp)
                    .clip(RoundedCornerShape(8.dp))

            ) {
                Image(
                    painter = painterResource(superhero.imageRes),
                    contentDescription = null,
                    alignment = Alignment.TopCenter,
                    contentScale = ContentScale.FillWidth
                )
            }
        }
    }
}
```

I've tried to copy and paste the SceneScope class and SceneHost composable, but it requires too much experimental APIs and I don't understand how does it work because I am newbie at Compose and Android

Body:
How can I make same animation as in this video (here) but without using experimental APIs (except of AnimatedContent)? I want to rearrange elements from Row to Column. Here's the sample function which I need to animate

@Composable
fun SuperheroCard(superhero: Superhero, modifier: Modifier = Modifier) {
    Card(
        elevation = 2.dp,
        modifier = modifier
            .fillMaxWidth()
    ) {
        Row(modifier = Modifier.padding(16.dp)) {
            Column(modifier = Modifier.weight(1f)) {
                Text(
                    text = stringResource(id = superhero.nameRes),
                    style = MaterialTheme.typography.h3
                )
                Text(text = stringResource(id = superhero.descriptionRes), modifier = Modifier.wrapContentWidth())
            }
            Spacer(
                modifier = Modifier
                    .width(16.dp)
            )
            Box(
                modifier = Modifier
                    .size(72.dp)
                    .clip(RoundedCornerShape(8.dp))

            ) {
                Image(
                    painter = painterResource(superhero.imageRes),
                    contentDescription = null,
                    alignment = Alignment.TopCenter,
                    contentScale = ContentScale.FillWidth
                )
            }
        }
    }
}

I've tried to copy and paste the SceneScope class and SceneHost composable, but it requires too much experimental APIs and I don't understand how does it work because I am newbie at Compose and Android


问:
Issue while implementing drag and drop of markers in react and leaflet based application
I need to implement multiple markers drag & drop functionality on map which is built using leaflet.
I also need to create a drop zone where these group of markers will be dropped finally.
steps are

select multiple markers and enable dragging for them

hovering on any parent marker will enable drop zone

Release selected markers on drop zone area and then drop zone gone
Please refer screenshot attached.

Drop zone around marker for dragging & dropping selected markers

I have used L.circleMarker object to create the drop zone and mouseover and mouseout event of marker to add and remove the drop zone from map.

So when I drag a selected marker and take it on top of target marker a drop zone is visible and when it goes away from the target marker the drop zone needs to go away.

To remove the drop zone I need to maintain a reference of drop zone object in state so that it can be removed on mouseout event of marker.

The updation of drop zone reference in state is performed on mouseover event of marker.

My issue is when I hover on marker then the drop zone that is added as shown in picture.
And immediately after that mouseout event gets called as drop zone gets added on top of marker and the contact between mouse and marker is lost as drop zone is placed between marker and mouse triggering the mouseout event.

To solve this issue I have set zIndex to drop zone to push it behind the marker. But after this another issue is generated.
As I need to update drop zone layer reference in state after adding drop zone in map the drop zone fails to display unless I release the dragged marker.

Can anyone please provide a solution for above problem or recommend a better way to implement this requirement


问:
Report or Dashboard
I want to create a software package that at each run, reading csv daily report located on a specific path, will create report (pdf) or a dashboard visible to the user. I would like to have a package platform independent so the user can see the report or the dashboard without problem.

I've implemented a dashboard with Power BI but the user that should see the report/dashboard must have PowerBI.

Title: Report or Dashboard


问:
Getting Memory leaks when using MFC regular DLL with WinUI 3 application
Getting memory leaks when using MFC regular DLL with WinUI 3 application.
This leak happens only when I set Page via window.content() or Frame.Navigate() method and if I don't set page to window content and only activate window, leaks will not come, but in our requirement both showing Page content and use of mfc dll is required.

I reproduce the issue in this sample project MemoryLeakTestCPP.zip

This project is tested on Microsoft Visual Studio Professional 2019 ( Version 16.11.8 ) in Debug x86 environment.

here is screenshot of output having leaks.
memory-leaks screenshot

MainPage.xaml is looks like below , if we remove from it then one leak will be reduced, so I think leaks are getting due to no destruction of Page

```<code><Page>
    <StackPanel>
        <Button>Click me</Button>
    </StackPanel>
</Page>
</code>```

From MFC DLL, for testing I only declare one object of class(CTestClass) from mfc dll in WinUI project.
DLL is linked via .lib in WinUI project.

Steps to reproduce the bug

Download the project having leaks from MemoryLeakTestCPP.zip

Unzip and build it in Microsoft Visual Studio Professional 2019 ( Version 16.11.8 ) in Debug x86 environment.

Run the application in debug mode

Close the application

Detected Memory Leaks will be shown in Output tab.

Expected behavior

Memory leaks should not be detected

NuGet packages used in projects are:

```<code>Microsoft.WindowsAppSDK.1.2.221116.1
Microsoft.Windows.SDK.BuildTools.10.0.22621.755
Microsoft.Windows.ImplementationLibrary.1.0.211019.2
Microsoft.Windows.CppWinRT.2.0.210806.1
</code>```

Windows version

Windows 10 (20H2): Build 19042

Body:
Getting memory leaks when using MFC regular DLL with WinUI 3 application.
This leak happens only when I set Page via window.content() or Frame.Navigate() method and if I don't set page to window content and only activate window, leaks will not come, but in our requirement both showing Page content and use of mfc dll is required.

I reproduce the issue in this sample project MemoryLeakTestCPP.zip

This project is tested on Microsoft Visual Studio Professional 2019 ( Version 16.11.8 ) in Debug x86 environment.

here is screenshot of output having leaks.
memory-leaks screenshot

MainPage.xaml is looks like below , if we remove from it then one leak will be reduced, so I think leaks are getting due to no destruction of Page

<Page>
    <StackPanel>
        <Button>Click me</Button>
    </StackPanel>
</Page>

From MFC DLL, for testing I only declare one object of class(CTestClass) from mfc dll in WinUI project.
DLL is linked via .lib in WinUI project.

Steps to reproduce the bug

Download the project having leaks from MemoryLeakTestCPP.zip

Unzip and build it in Microsoft Visual Studio Professional 2019 ( Version 16.11.8 ) in Debug x86 environment.

Run the application in debug mode

Close the application

Detected Memory Leaks will be shown in Output tab.

Expected behavior

Memory leaks should not be detected

NuGet packages used in projects are:

Microsoft.WindowsAppSDK.1.2.221116.1
Microsoft.Windows.SDK.BuildTools.10.0.22621.755
Microsoft.Windows.ImplementationLibrary.1.0.211019.2
Microsoft.Windows.CppWinRT.2.0.210806.1

Windows version

Windows 10 (20H2): Build 19042


问:
Unsupported lookup 'unaccent' for CKEditor5 Field or join on the field not permitted
I am using CKEditor5 for my body field and trying to filter using unaccent like so

Post.objects.filter(body__unaccent__icontains="text")
```
<p>but I get the error</p>
<p><code>Unsupported lookup 'unaccent' for CKEditor5 Field or join on the field not permitted</code></p>
<p>FYI, I did all the necessary configuration to be sure <code>unaccent</code> works perfectly. How do I know? I successfully executed</p>
<pre class="lang-py prettyprint-override"><code>Post.objects.filter(title__unaccent__icontains="text")
</code>```

where title is defined with CharField.

My suggestion is that, unaccent didn't work for the first case because of CKEditor5. Is there a way to get this to work with this package?

Body:
I am using CKEditor5 for my body field and trying to filter using unaccent like so

Post.objects.filter(body__unaccent__icontains="text")

but I get the error

Unsupported lookup 'unaccent' for CKEditor5 Field or join on the field not permitted

FYI, I did all the necessary configuration to be sure unaccent works perfectly. How do I know? I successfully executed

Post.objects.filter(title__unaccent__icontains="text")

where title is defined with CharField.

My suggestion is that, unaccent didn't work for the first case because of CKEditor5. Is there a way to get this to work with this package?


问:
Javascript Get Label Of Button
The following element from browser inspector is shown on a button:

```<code><label _ngcontent-nyq-c70="" translate="" class="font-family-title label">BET</label>
</code>```

I am trying to get the label 'BET' using the following:

```<code>var test = document.getElementsByClassName("font-family-title label")[0].innerText;
console.log("test is: "+test);
</code>```

It returns undefined. The website is https://spribe.co/games/aviator

Title: Javascript Get Label Of Button

Body:
The following element from browser inspector is shown on a button:

BET

I am trying to get the label 'BET' using the following:

var test = document.getElementsByClassName("font-family-title label")[0].innerText;
console.log("test is: "+test);

It returns undefined. The website is https://spribe.co/games/aviator


问:
Error : Function CollectionReference.doc() cannot be called with an empty path
This is the javascript code I was running and ended up in getting this error in the javascript console:

Error : Function CollectionReference.doc() cannot be called with an empty path

Other people did answer the same question, but it didn't work in my case.

```<code>const firebaseApp = firebase.initializeApp({
  // my configuration here
});
const db = firebaseApp.firestore();
const auth = firebaseApp.auth();

const user = firebase.auth().currentUser;
firebase.auth().onAuthStateChanged((user) => {
  if (user) {
    // User is signed in, see docs for a list of available properties
    // https://firebase.google.com/docs/reference/js/firebase.User
    var uid = user.uid;
    console.log("Logged in");
    // ...
  } else {
    // User is signed out
    // ...
    alert("you are not logged in");
    window.location.href = "Auth.html";
  }
});

const Publish = () => {
  const user = firebase.auth().currentUser;
    // const displayName = user.displayName;
    const email_value = user.email;
    // const photoURL = user.photoURL;
    // const emailVerified = user.emailVerified;
    // const uid = user.uid;

  let blogTitle = document.getElementById("exampleFormControlInput1").value;
  let articleField = document.getElementById("exampleFormControlTextarea1").value;
  var docName = blogTitle.toString()

  db.collection(email_value).doc(docName).set({
    title: docName,
    article: articleField,
  })

}
</code>```

I tried the solutions given by other people like -- ${docName} but that didn't work. I am really confused at this point and don't know what I did wrong with the javascript.

Body:
This is the javascript code I was running and ended up in getting this error in the javascript console:

Error : Function CollectionReference.doc() cannot be called with an empty path

Other people did answer the same question, but it didn't work in my case.

const firebaseApp = firebase.initializeApp({
  // my configuration here
});
const db = firebaseApp.firestore();
const auth = firebaseApp.auth();

const user = firebase.auth().currentUser;
firebase.auth().onAuthStateChanged((user) => {
  if (user) {
    // User is signed in, see docs for a list of available properties
    // https://firebase.google.com/docs/reference/js/firebase.User
    var uid = user.uid;
    console.log("Logged in");
    // ...
  } else {
    // User is signed out
    // ...
    alert("you are not logged in");
    window.location.href = "Auth.html";
  }
});

const Publish = () => {
  const user = firebase.auth().currentUser;
    // const displayName = user.displayName;
    const email_value = user.email;
    // const photoURL = user.photoURL;
    // const emailVerified = user.emailVerified;
    // const uid = user.uid;

  let blogTitle = document.getElementById("exampleFormControlInput1").value;
  let articleField = document.getElementById("exampleFormControlTextarea1").value;
  var docName = blogTitle.toString()

  db.collection(email_value).doc(docName).set({
    title: docName,
    article: articleField,
  })

}

I tried the solutions given by other people like -- ${docName} but that didn't work. I am really confused at this point and don't know what I did wrong with the javascript.


问:
Upload locally modified GIT description file to remote
I would like to upload a locally modified GIT description file (i.e.: .git/description) to the remote.

For testing purpose, I created a brand new bare local repository:

$ mkdir test-remote && cd $_
$ git init --bare
```
<p>Then, I:</p>
<ul>
<li>cloned it to a specific directory.</li>
<li>made some changes to the cloned <code>.git/description</code>.</li>
<li>created an empty commit on a new <code>master</code> branch.</li>
<li>pushed <code>master</code> changes to <code>origin</code>.</li>
</ul>
<pre class="lang-bash prettyprint-override"><code>$ git clone --local ./test-remote test
$ git checkout -b master
$ echo "TEST" > .git/description
$ git status
$ git commit --allow-empty -m "Initial commit."
$ git push origin master
</code>```

However, I noticed that changes to .git/description don't appear in git status and does not appear in origin's local files after push either..

Is this file expected to be modified on the remote-side only? Is there a way to modify it locally and then upload it to the remote?

Although this question provides a good answer, the post is 12 years old and the solution is a bit tedious (creating symbolic links) regarding the number of repositories I own. Is there anything that could help in newer GIT versions?

Body:
I would like to upload a locally modified GIT description file (i.e.: .git/description) to the remote.

For testing purpose, I created a brand new bare local repository:

$ mkdir test-remote && cd $_
$ git init --bare

Then, I:

cloned it to a specific directory.

made some changes to the cloned .git/description.

created an empty commit on a new master branch.

pushed master changes to origin.

$ git clone --local ./test-remote test
$ git checkout -b master
$ echo "TEST" > .git/description
$ git status
$ git commit --allow-empty -m "Initial commit."
$ git push origin master

However, I noticed that changes to .git/description don't appear in git status and does not appear in origin's local files after push either..

Is this file expected to be modified on the remote-side only? Is there a way to modify it locally and then upload it to the remote?

Although this question provides a good answer, the post is 12 years old and the solution is a bit tedious (creating symbolic links) regarding the number of repositories I own. Is there anything that could help in newer GIT versions?


问:
Scroll position of LazyColumn or LazyRow in pixel?
I want to detect scroll position of my LazyRow.

For example I scroll 2000px in a LazyRow and then navigate to another screen and come back. when I come back, LazyRow is scrolled 2000px and state is saved correctly. However I need that initial 2000px scroll position. how can I achieve that?

```<code>rememberLazyListState().firstVisibleItemScrollOffset
</code>```

As shown above, LazyListSate only gives firstVisibleItemScrollOffset and not the whole scrolling position.

Update: I want this scroll position to react based on it. As in the image below, I have a LazyRow and an Image together. an example usecase is when user scrolls the list, I want to change image's alpha.

Body:
I want to detect scroll position of my LazyRow.

For example I scroll 2000px in a LazyRow and then navigate to another screen and come back. when I come back, LazyRow is scrolled 2000px and state is saved correctly. However I need that initial 2000px scroll position. how can I achieve that?

rememberLazyListState().firstVisibleItemScrollOffset

As shown above, LazyListSate only gives firstVisibleItemScrollOffset and not the whole scrolling position.

Update: I want this scroll position to react based on it. As in the image below, I have a LazyRow and an Image together. an example usecase is when user scrolls the list, I want to change image's alpha.


问:
Changing a project link to an external link when clicking on a thumbnail in Cargo Collective?
I use cargo collective (original cargo, not cargo 2) for my portfolio site. On my website (thingsonfiredesign.com) I have a mix of client projects and my own original prints that I sell in my online shop.

I would like to be able to make it so when a thumbnail for a shop item is clicked, it will go to the relevant bigcartel page, instead of the default Cargo Project page.

I have access to the CSS and html for the cargo theme I'm using, but it's limited. Is this even possible to do?

I've tried researching this question on the Cargo help section, but they took down most of their old customisation topics when they released Cargo 2 a few years ago.


问:
How to narrow the types on an overloaded function with a second optional parameter in TypeScript?
Given an overloaded function where the first parameter can be two types, and the second parameter only exists in one of the variants, how to make the compiler happy when we check the type of the first parameter?

Here's what I tried and the ways it doesn't work. Here's a link for the playground

declare const bar: (input: string, extra: string) => boolean;
declare const baz: (input: string[]) => boolean;

export function foo(input: string[]): boolean;
export function foo(input: string, extra: string): boolean;
export function foo(input: string | string[], extra?: string): boolean {
  if (typeof input === 'string') {
    // ERROR: (parameter) extra: string | undefined
    return bar(input, extra);
  }

  return baz(input);
}

export function foo1(input: string[]): boolean;
export function foo1(input: string, extra: string): boolean;
export function foo1(input: string | string[], extra?: string): boolean {
  if (typeof input === 'string' && extra) {
    return bar(input, extra);
  }

  // ERROR: (parameter) input: string | string[]
  return baz(input);
}

export function foo2(input: string[]): boolean;
export function foo2(input: string, extra: string): boolean;
export function foo2(input: string | string[], extra?: string): boolean {
  if (typeof input === 'string') {
    // This works but it's unnecessarily verbose
    if (extra) {
      return bar(input, extra);
    }
    throw new Error('Unable to reach here');
  }

  return baz(input);
}
```

Body:
Given an overloaded function where the first parameter can be two types, and the second parameter only exists in one of the variants, how to make the compiler happy when we check the type of the first parameter?

Here's what I tried and the ways it doesn't work. Here's a <a href="https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEYD2A7AzgF3gI1gLngAoBLFABwFcMDMZSBzAGnhAA8MYoaOGBKeALwA+HEiQQQUFAG4AsAChQkWAmTosuAF4ES5Ktzop6AbQC6-YaPGSZChWzJIYWAGYUUYDMVTwXY3ZTU8LQMZrwE2GISUnLyDk6u7p7eKL7+pIEGDMxsHFzBPEbhVtG2cayOzr5JXj5+SAH6BYb08AA+zaGmOeycAPxZRRFRNvAA3grw8MQuRBgAnmQgSLMZVIICAvAA5CFG2-wT8lNTAPSn8ACiAErXAPLXOmSwUAC2IBggMPy5nIOtHXcoBcpBAwEmJzgGAoMFSuBgjQwPTyvFiUwAvnZjvAoTC4VBNIjUQpMfJ7BUEtUPLVUvUAIyI-5hYbWGLkyqJakpNJIBlrIJ7JgsXr5QXFSKssrxKpuLl1MR8vQCwoAzpGMzI-r-cUjKTjCEzOaLZarJUbLa7FXbeAAMhtwpR+uxU1xsJwsERmqgxOxpIh5yutweTxe70+32mSv+7TVJlMENd+MJ-J9fvKHKpyXlSAATIzY8ySjZYtLOVnaWI8-z-l7tSzSiWKTKatz6lWo7GY4KNQ6tbGdZKnVNDYQFksVpHAuadoKDkOTgGACoAC2IaHgAHcnABrdfYdbEDC7eDuFDgEBoNCwYgQebwABuX0iaBAEOHs0Iv2985OOI+ePdBF+S9H1f1JX8MGXGAkA3eAz1gy4YGghFtgAVRQKBsAkeAMCQP8oDAZd4GXL4QAONF4DTF1-zdLQiViUkgA" rel="nofollow noreferrer">link for the playground

declare const bar: (input: string, extra: string) => boolean;
declare const baz: (input: string[]) => boolean;

export function foo(input: string[]): boolean;
export function foo(input: string, extra: string): boolean;
export function foo(input: string | string[], extra?: string): boolean {
  if (typeof input === 'string') {
    // ERROR: (parameter) extra: string | undefined
    return bar(input, extra);
  }

  return baz(input);
}

export function foo1(input: string[]): boolean;
export function foo1(input: string, extra: string): boolean;
export function foo1(input: string | string[], extra?: string): boolean {
  if (typeof input === 'string' && extra) {
    return bar(input, extra);
  }

  // ERROR: (parameter) input: string | string[]
  return baz(input);
}

export function foo2(input: string[]): boolean;
export function foo2(input: string, extra: string): boolean;
export function foo2(input: string | string[], extra?: string): boolean {
  if (typeof input === 'string') {
    // This works but it's unnecessarily verbose
    if (extra) {
      return bar(input, extra);
    }
    throw new Error('Unable to reach here');
  }

  return baz(input);
}


问:
Actix-web unable to send Set-Cookie
So i use actix web on the backend and svelte on the frontend

This sends the cookie to the frontend

                let cookie = auth_authority.create_signed_cookie(UserClaims {
                    id: o.id,
                    role: Role::User,
                })?;
                info!("Logged in user");
                info!("{}", cookie);
                Ok(HttpResponse::Ok()
                    .cookie(cookie)
                    .json("You are now logged in"))
```
<p>And this is the CORS config:</p>
<pre class="lang-rust prettyprint-override"><code>        let cors = Cors::default()
            .allowed_origin("http://localhost:3000")
            .allowed_methods(vec!["POST", "GET"])
            .allowed_headers(vec![
                header::AUTHORIZATION,
                header::CONTENT_TYPE,
            ])
            .expose_any_header()
            .supports_credentials()
            .max_age(3600);
</code>```

And this is the function that fetches the data for svelte:

        const resp = await fetch("http://0.0.0.0:4000/login", {
            method: "POST",
            mode: 'cors',
            credentials: 'include',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(
                {
                    username,
                    password,
                }
            )
        })

```

I do not recieve the Set-Cookie header when using a web browser but when i use curl i do(Most likely caused by CORS). I can send other headers that i create but i cannot send Set-Cookie no matter what. I used the .supports_credentials() method to allow cookies but that did nothing.

Can someone guide me into a direction to solve this or does someone know how to solve it?

Title: Actix-web unable to send Set-Cookie

Body:
So i use actix web on the backend and svelte on the frontend

This sends the cookie to the frontend

                let cookie = auth_authority.create_signed_cookie(UserClaims {
                    id: o.id,
                    role: Role::User,
                })?;
                info!("Logged in user");
                info!("{}", cookie);
                Ok(HttpResponse::Ok()
                    .cookie(cookie)
                    .json("You are now logged in"))

And this is the CORS config:

        let cors = Cors::default()
            .allowed_origin("http://localhost:3000")
            .allowed_methods(vec!["POST", "GET"])
            .allowed_headers(vec![
                header::AUTHORIZATION,
                header::CONTENT_TYPE,
            ])
            .expose_any_header()
            .supports_credentials()
            .max_age(3600);

And this is the function that fetches the data for svelte:

        const resp = await fetch("http://0.0.0.0:4000/login", {
            method: "POST",
            mode: 'cors',
            credentials: 'include',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(
                {
                    username,
                    password,
                }
            )
        })

I do not recieve the Set-Cookie header when using a web browser but when i use curl i do(Most likely caused by CORS). I can send other headers that i create but i cannot send Set-Cookie no matter what. I used the .supports_credentials() method to allow cookies but that did nothing.

Can someone guide me into a direction to solve this or does someone know how to solve it?


问:
Keycloak.X (quarkus based) on CloudFoundry
we want to deploy keycloak.X to cloudfoundry. I found older approaches (How to deploy keycloak to cloudfoundry) with two options:

wrapping it as a Spring application (see [1], but this project does not keep up with keycloak release cycle in time)

using the docker image (diego_dockeris disabled in my target environment)

So I am stuck with the Quarkus distribution.

Ideally, I dont want to change too much on the application itself (risk assessment ...) but only wrap it for cloud foundry.

The start script targets a class named QuarkusEntryPoint, but I don't know how to put it into a buildpack.

[1] https://github.com/thomasdarimont/embedded-spring-boot-keycloak-server


问:
Down Key returns the First index of Qcompleter instead Popup on Down Key Press
I want help regarding two minor issues

I have a QCompleter working in QComboBox (editable)

```<code>import sys
from PyQt5.QtWidgets import QVBoxLayout, QComboBox, QApplication, QWidget, QCompleter
from PyQt5.QtCore import Qt, QStringListModel

def auto_complete(list_data, box_object):
    model = QStringListModel()
    model.setStringList(list_data)

    completer = QCompleter()
    completer.setFilterMode(Qt.MatchContains)
    completer.setCaseSensitivity(Qt.CaseSensitivity(0))
    completer.setModel(model)
    box_object.setCompleter(completer)
</code>```

and this widget with combobox

```<code>class Widget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)

        lay = QVBoxLayout(self)
        comb = QComboBox()
        comb.setEditable(True)
        lay.addWidget(comb)
        self.setFixedWidth(400)
        self.setFixedHeight(170)
        names_list = ["foo", "boo", "hoo"]
        comb.addItems(names_list)
        comb.setCurrentIndex(-1)
        auto_complete(names_list, comb)

app = QApplication(sys.argv)
w = Widget()
w.show()
sys.exit(app.exec_())
</code>```

Working fine here.

Now the 1st issue is, when cursor is in comb, and i press down arrow key. comb is filled with foo automatically instead of Popping up the names_list. i want completer to show/Popup the whole list on press down arrow key.

The Second issue is, when i type oo, the whole list shows, and when i press down arrow key on last selection hoo, cursor comes to comboBox in editing poisition with only oo presenting. I want cursor not to return but stay on last selection on press down arrow key, up arrow key must work as normal

Body:
I want help regarding two minor issues

I have a QCompleter working in QComboBox (editable)

import sys
from PyQt5.QtWidgets import QVBoxLayout, QComboBox, QApplication, QWidget, QCompleter
from PyQt5.QtCore import Qt, QStringListModel

def auto_complete(list_data, box_object):
    model = QStringListModel()
    model.setStringList(list_data)

    completer = QCompleter()
    completer.setFilterMode(Qt.MatchContains)
    completer.setCaseSensitivity(Qt.CaseSensitivity(0))
    completer.setModel(model)
    box_object.setCompleter(completer)

and this widget with combobox

class Widget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)

        lay = QVBoxLayout(self)
        comb = QComboBox()
        comb.setEditable(True)
        lay.addWidget(comb)
        self.setFixedWidth(400)
        self.setFixedHeight(170)
        names_list = ["foo", "boo", "hoo"]
        comb.addItems(names_list)
        comb.setCurrentIndex(-1)
        auto_complete(names_list, comb)

app = QApplication(sys.argv)
w = Widget()
w.show()
sys.exit(app.exec_())

Working fine here.

Now the 1st issue is, when cursor is in comb, and i press down arrow key. comb is filled with foo automatically instead of Popping up the names_list. i want completer to show/Popup the whole list on press down arrow key.

The Second issue is, when i type oo, the whole list shows, and when i press down arrow key on last selection hoo, cursor comes to comboBox in editing poisition with only oo presenting. I want cursor not to return but stay on last selection on press down arrow key, up arrow key must work as normal


问:
The video tag does not work in the react app on iPhone, but works on the desktop
I am trying to add a video tag to my react application. On desktop (tested in Chrome), it works fine, but not on iPhone (tested in iPhone 12).

I haven't found a solution yet

Here my code:

```<code><video key={videoLink} width="100%" controls playsInline autoPlay>
    <source src={videoLink} type="video/mp4">
    </source>
</video>
</code>```

Body:
I am trying to add a video tag to my react application. On desktop (tested in Chrome), it works fine, but not on iPhone (tested in iPhone 12).

I haven't found a solution yet

Here my code:

<video key={videoLink} width="100%" controls playsInline autoPlay>
    <source src={videoLink} type="video/mp4">
    </source>
</video>


问:
How to replace the return type of an abstract method in the subclass
In my project, I am using a class like this :

```<code>public class ConcreteHandler extends AbstractHandler {
    @Override
    protected FlawedLogger getLogger() { return FlawedLogger.getInstance(); }
}
</code>```

However, because of security concerns, I can no longer use the class FlawedLogger, I have to replace it with the new provided Logger class, which is not related to FlawedLogger in any way.

The class AbstractHandler is also provided in a library, it has an abstract method getLogger() and a bunch of public methods.

To achieve my goal, I plan to copy the AbstractHandler into a new class and change the return type of its abstract method, so I can still use the ConcreteHandler :

```<code>public class ConcreteHandler extends NewAbstractHandler {
    @Override
    protected Logger getLogger() { return Logger.getInstance(); }
}
</code>```

Is there a better way to do it ?

Body:
In my project, I am using a class like this :

public class ConcreteHandler extends AbstractHandler {
    @Override
    protected FlawedLogger getLogger() { return FlawedLogger.getInstance(); }
}

However, because of security concerns, I can no longer use the class FlawedLogger, I have to replace it with the new provided Logger class, which is not related to FlawedLogger in any way.

The class AbstractHandler is also provided in a library, it has an abstract method getLogger() and a bunch of public methods.

To achieve my goal, I plan to copy the AbstractHandler into a new class and change the return type of its abstract method, so I can still use the ConcreteHandler :

public class ConcreteHandler extends NewAbstractHandler {
    @Override
    protected Logger getLogger() { return Logger.getInstance(); }
}

Is there a better way to do it ?


问:
Use of arrow functions in object literal
How to use arrow functions in object literal so that it will be able to access the elements in the object ?

```<code>// class person {
//     name = "nripesh";
//     surname = "neupane";
//     changeSurname = (newSurname) => {
//         this.surname = newSurname; // surname = newSurname also don't work.
//     }
// }
// const nripesh = new person();

const nripesh = {
  name: 'nripesh',
  surname: 'neupane',

  changeSurname: (newSurname) => {
    console.log(this);
    surname = newSurname;
  },
};

console.log(nripesh.surname);
nripesh.changeSurname('Pariyar');
console.log(nripesh.surname);
</code>```

I was expecting to get
1st output:neupane
2nd output: Pariyar

What i am getting
1st output:neupane
2nd output: neupane

// In changeSurname method, this refer to global this which is undefined and using just surname is also undefined. This works dine when i use

```<code>changeSurname: function(newSurname) {
this.surname = newSurname;
}
</code>```

Body:
How to use arrow functions in object literal so that it will be able to access the elements in the object ?

// class person {
//     name = "nripesh";
//     surname = "neupane";
//     changeSurname = (newSurname) => {
//         this.surname = newSurname; // surname = newSurname also don't work.
//     }
// }
// const nripesh = new person();

const nripesh = {
  name: 'nripesh',
  surname: 'neupane',

  changeSurname: (newSurname) => {
    console.log(this);
    surname = newSurname;
  },
};

console.log(nripesh.surname);
nripesh.changeSurname('Pariyar');
console.log(nripesh.surname);

I was expecting to get
1st output:neupane
2nd output: Pariyar

What i am getting
1st output:neupane
2nd output: neupane

// In changeSurname method, this refer to global this which is undefined and using just surname is also undefined. This works dine when i use

changeSurname: function(newSurname) {
this.surname = newSurname;
}


问:
Linux, get the human-readable name of the default file manager?
xdg-mime query default inode/directory gives me package name like org.gnome.Nautilus.desktop. Can I get human-readable app name like, in this case, "Files", instead?


问:
Material UI Datagrid row number is stuck on 0-0 of 0
I'm trying to implement the server side pagination on MUI datagrid, but I am having issues with the row number at the bottom of the page stuck on 0-0 of 0. There are about 500 entries and I can see that Rows per page is working (number of entries change as I cycle through 20, 50, and 100) but the row number is always stuck on 0-0 of 0 and I am unable to go to the next page.

Has anyone seen this type of behaviour before? It'd be appreciated if you could share your experience and how you solved the issue.

Screenshot of the datagird with error

```<code>  const [page, setPage] = useState(0);
  const [pageSize, setPageSize] = useState(20);
  const [sort, setSort] = useState({});
</code>```
```<code>        <DataGrid
          loading={isLoading || !data}
          getRowId={(row) => row._id}
          rows={(data && data.transactions) || []}
          columns={columns}
          rowCount={(data && data.total) || 0}
          rowsPerPageOptions={[20, 50, 100]}
          pagination
          page={page}
          pageSize={pageSize}
          paginationMode="server"
          sortingMode="server"
          onPageChange={(newPage) => setPage(newPage)}
          onPageSizeChange={(newPageSize) => setPageSize(newPageSize)}
          onSortModelChange={(newSortModel) => setSort(...newSortModel)}
        />
</code>```

image of the working datagrid

I was expecting a result similar to above but with server side pagination function implemented.

Body:
I'm trying to implement the server side pagination on MUI datagrid, but I am having issues with the row number at the bottom of the page stuck on 0-0 of 0. There are about 500 entries and I can see that Rows per page is working (number of entries change as I cycle through 20, 50, and 100) but the row number is always stuck on 0-0 of 0 and I am unable to go to the next page.

Has anyone seen this type of behaviour before? It'd be appreciated if you could share your experience and how you solved the issue.

Screenshot of the datagird with error

  const [page, setPage] = useState(0);
  const [pageSize, setPageSize] = useState(20);
  const [sort, setSort] = useState({});

        <DataGrid
          loading={isLoading || !data}
          getRowId={(row) => row._id}
          rows={(data && data.transactions) || []}
          columns={columns}
          rowCount={(data && data.total) || 0}
          rowsPerPageOptions={[20, 50, 100]}
          pagination
          page={page}
          pageSize={pageSize}
          paginationMode="server"
          sortingMode="server"
          onPageChange={(newPage) => setPage(newPage)}
          onPageSizeChange={(newPageSize) => setPageSize(newPageSize)}
          onSortModelChange={(newSortModel) => setSort(...newSortModel)}
        />

image of the working datagrid

I was expecting a result similar to above but with server side pagination function implemented.


问:
VBA: Bug where pages seem to Merge and Excel freezes
I'm running code in VBA that takes a user through multiple pages depending on their selection using code like below:

```<code>Sub Continue_to_Tech_selection()
Application.ScreenUpdating = False
    Sheets("Tech Selection").Visible = True
    Sheets("Tech Selection").Select
Application.ScreenUpdating = True
End Sub
</code>```

But I am running into an issue where things like the Comboboxes placed on one page persists into the next page when the new page is opened.

In addition one of the pages completely freezes as if Application.ScreenUpdataing = False but this is not the case in the code, furthermore, what is displayed is a mix of multiple different pages (see below)

Is this a known Bug? Or are there any suggestions to get around this issue?

Body:
I'm running code in VBA that takes a user through multiple pages depending on their selection using code like below:

Sub Continue_to_Tech_selection()
Application.ScreenUpdating = False
    Sheets("Tech Selection").Visible = True
    Sheets("Tech Selection").Select
Application.ScreenUpdating = True
End Sub

But I am running into an issue where things like the Comboboxes placed on one page persists into the next page when the new page is opened.

In addition one of the pages completely freezes as if Application.ScreenUpdataing = False but this is not the case in the code, furthermore, what is displayed is a mix of multiple different pages (see below)

Is this a known Bug? Or are there any suggestions to get around this issue?


问:
find url in a string using typescript : anchor tag displayed as plain text
I am trying to find the URL in a given text using typescript and if its the URL, then I have to make it as hyperlink.
I used the code from one of the stackoverflow links.

I have tried the below code :

```<code>Urlify(text) {
    var exp = /(\b((https?|ftp|file):\/\/|(www))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)/ig;
    var res = text.replace(exp,"<a href='$1'>$1</a>");
    console.log("res : ", res);
    return res;
}
</code>```

However, I am not able to see it as an URL in browser.  It looks like below :

Hi the line is www.google.com. End of line.

Instead of

Hi the line is www.google.om. End of line.

Why am I seeing the "a href" in browser ? Am I missing anything ?
Please help.

Body:
I am trying to find the URL in a given text using typescript and if its the URL, then I have to make it as hyperlink.
I used the code from one of the stackoverflow links.

I have tried the below code :

Urlify(text) {
    var exp = /(\b((https?|ftp|file):\/\/|(www))[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]*)/ig;
    var res = text.replace(exp,"$1");
    console.log("res : ", res);
    return res;
}

However, I am not able to see it as an URL in browser.  It looks like below :

Hi the line is www.google.com. End of line.

Instead of

Hi the line is www.google.om. End of line.

Why am I seeing the "a href" in browser ? Am I missing anything ?
Please help.


问:
WSO2 v3.1.0 Unable to connect to publisher and Devportal portal
I am using wso2 v3.1.0, but I can no longer connect to the API Manager Publisher, API Manager Devportal portal.
・Error 504 occurs when trying to access
・WSO2 resources are build on AWS EC2 instances.
・No infrastructure changes were made before or after the issue.
・Requests to the API are executed normally.
・The problem does not occur with WSO2 v4.0.0, which is used separately, but only with products using WSO2 v3.1.0
Do you have any information on issues similar to this problem? Also, if you know the cause and the solution, I would like the information.

I know that redeploying the WSO2 resource on AWS EC2 may solve the problem, but I would like to consider other avenues before doing it.