问:
flutter : RangeError (index): Invalid value: Only valid value is 0: 1 api
I can't fetch the next address

but I can fetch sequence shipto 0

RangeError (index): Invalid value: Only valid value is 0: 1

I search by name and it shows the address part of that name. But what happens is it shows only the first address. The next rank is not showing.

```<code>List<Item> listitem = [];
var loading = false;
Future<List<Item>> fetchMos() async {
 listitem.clear();
 var client = http.Client();
  String mosUrl =
     '';
 var url = Uri.parse(mosUrl);
 var headers = {'Client-Token': ''};
 var response = await client.get(url, headers: headers);
if (response.statusCode == 200) {
var data = jsonDecode((utf8.decode(response.bodyBytes)))['items'];
for (var index in data) {
  listitem.add(Item.fromJson(index));
  print(data);
}
loading = false;
  }
 return listitem;
 }

@override
  void initState() {
fetchMos().then((value) {
  setState(() {
    items.addAll(value);
  });
  super.initState();
});
</code>```

This is my search code.

```<code> onSearch(String text) async {
searchitems.clear();
if (text.isEmpty) {
  setState(() {
    loading = false;
  });
  return;
}

items.forEach((f) {
  if (f.custnum.toString().toUpperCase().toLowerCase().contains(text))
    searchitems.add(f);
});

setState(() {});
</code>```

It is the part that displays the address information

```<code>    child: searchitems.length != null ||
                      controller.text.isNotEmpty
                  ? ListView.builder(
                      controller: controllerlistview,
                      itemCount: searchitems.length,
                      itemBuilder: (context, index) {
                        return Card(
                          elevation: 3,
                          child: Column(
                            children: <Widget>[
                              Row(
                                mainAxisAlignment: MainAxisAlignment.end,
                                children: <Widget>[
                                  TextButton(
                                    child: const Text(
                                      'แก้ไข',
                                      style: TextStyle(
                                          fontFamily: "supermarket",
                                          fontSize: 14),
                                    ),
                                    onPressed: () {
                                      Navigator.push(
                                          context,
                                          MaterialPageRoute(
                                              builder: (context) =>
                                                  EditAddressPage()));
                                    },
                                  ),
                                ],
                              ),
                              Padding(
                                padding: const EdgeInsets.all(5),
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.start,
                                  children: [
                                    Text(
                                      'bill To / Ship To : ${searchitems[index].address![index].shipto.toString()}',
                                      style: TextStyle(
                                          color: Colors.black,
                                          fontSize: 16,
                                          fontFamily: "supermarket"),
                                    ),
                                  ],
                                ),
                              ),
                              Padding(
                                padding: const EdgeInsets.all(5),
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.start,
                                  children: [
                                    Text(
                                      "ที่อยู่ : ${searchitems[index].address![index].addr1.toString()}",
                                      style: TextStyle(
                                          color: Colors.black,
                                          fontSize: 16,
                                          fontFamily: "supermarket"),
                                    ),
                                  ],
                                ),
                              ),
                            ],
                          ),
                        );
                      })
</code>```

This is json

```<code>{
  "items": [
{
    "custnum": "",
    "name": "",
    "address": [
        {
            "shipto": 0,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
           "shipto": 1,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 2,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 3,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        }
    ]

},

{
"custnum": "",
"name": "",
"address": [
    {
        "shipto": 0,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    },
    {
       "shipto": 1,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    },
    {
        "shipto": 2,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    },
    {
        "shipto": 3,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    }
</code>```

],

Body:
I can't fetch the next address

but I can fetch sequence shipto 0

RangeError (index): Invalid value: Only valid value is 0: 1

I search by name and it shows the address part of that name. But what happens is it shows only the first address. The next rank is not showing.

List<Item> listitem = [];
var loading = false;
Future<List<Item>> fetchMos() async {
 listitem.clear();
 var client = http.Client();
  String mosUrl =
     '';
 var url = Uri.parse(mosUrl);
 var headers = {'Client-Token': ''};
 var response = await client.get(url, headers: headers);
if (response.statusCode == 200) {
var data = jsonDecode((utf8.decode(response.bodyBytes)))['items'];
for (var index in data) {
  listitem.add(Item.fromJson(index));
  print(data);
}
loading = false;
  }
 return listitem;
 }

@override
  void initState() {
fetchMos().then((value) {
  setState(() {
    items.addAll(value);
  });
  super.initState();
});

This is my search code.

 onSearch(String text) async {
searchitems.clear();
if (text.isEmpty) {
  setState(() {
    loading = false;
  });
  return;
}

items.forEach((f) {
  if (f.custnum.toString().toUpperCase().toLowerCase().contains(text))
    searchitems.add(f);
});

setState(() {});

It is the part that displays the address information

    child: searchitems.length != null ||
                      controller.text.isNotEmpty
                  ? ListView.builder(
                      controller: controllerlistview,
                      itemCount: searchitems.length,
                      itemBuilder: (context, index) {
                        return Card(
                          elevation: 3,
                          child: Column(
                            children: <Widget>[
                              Row(
                                mainAxisAlignment: MainAxisAlignment.end,
                                children: <Widget>[
                                  TextButton(
                                    child: const Text(
                                      'แก้ไข',
                                      style: TextStyle(
                                          fontFamily: "supermarket",
                                          fontSize: 14),
                                    ),
                                    onPressed: () {
                                      Navigator.push(
                                          context,
                                          MaterialPageRoute(
                                              builder: (context) =>
                                                  EditAddressPage()));
                                    },
                                  ),
                                ],
                              ),
                              Padding(
                                padding: const EdgeInsets.all(5),
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.start,
                                  children: [
                                    Text(
                                      'bill To / Ship To : ${searchitems[index].address![index].shipto.toString()}',
                                      style: TextStyle(
                                          color: Colors.black,
                                          fontSize: 16,
                                          fontFamily: "supermarket"),
                                    ),
                                  ],
                                ),
                              ),
                              Padding(
                                padding: const EdgeInsets.all(5),
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.start,
                                  children: [
                                    Text(
                                      "ที่อยู่ : ${searchitems[index].address![index].addr1.toString()}",
                                      style: TextStyle(
                                          color: Colors.black,
                                          fontSize: 16,
                                          fontFamily: "supermarket"),
                                    ),
                                  ],
                                ),
                              ),
                            ],
                          ),
                        );
                      })

This is json

{
  "items": [
{
    "custnum": "",
    "name": "",
    "address": [
        {
            "shipto": 0,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
           "shipto": 1,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 2,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        },
        {
            "shipto": 3,
            "addr1": "",
            "thanon": "",
            "tambon": "",
            "amphur": "",
            "prov_code": "",
            "province": "",
            "zipcode": "",
            "country": "",
            "contact": "",
            "postcode": ""
        }
    ]

},

{
"custnum": "",
"name": "",
"address": [
    {
        "shipto": 0,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    },
    {
       "shipto": 1,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    },
    {
        "shipto": 2,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    },
    {
        "shipto": 3,
        "addr1": "",
        "thanon": "",
        "tambon": "",
        "amphur": "",
        "prov_code": "",
        "province": "",
        "zipcode": "",
        "country": "",
        "contact": "",
        "postcode": ""
    }

],


来源: stackexchange

问:
In mobile Chrome, Caret moving to invisible in input type=text, after word enter (space pressed)
With mobile Chrome (not desktop Chrome and not mobile Fixefox), when I enter text in a input type="text" and the text width is greater than the text field width, when I enter the next word (pressing the spacebar), the last word and caret are shifted to the right invisible area. How can JavaScript or CSS fix this? I'm using Quasar (vue 3) and was using q-input first when I discovered this behavior in mobile Сhrome. I changed q-input to normal input type="text" but nothing changed. I also tried to experiment with setting the focus and selection start, when the model changes, depending on the previous position of the cursor, perhaps this could achieve the result, but I think this is too ugly and unreliable solution.</p>

ContentLicense: CC BY-SA 4.0


问:
How to create Material UI Sidebar of nested list items with multiple map functions?
I am trying to create a second sidebard of nested list items in a react app with MUI, however finding difficulties to map the data. The approach I am trying is to have a map fuction for the child items within a parent map higher order function in the react component. Could someone please help me to get into a solution.

Heres what I am trying to achive:

Screenshot of the prototype

Complete screen image

Here's the Data for list:

```<code>    {
        "_id": "6384adf3e445385733eed839",
        "accountName": "WestStar Labs",
        "accountType": "Facility",
        "providers": []
    },
    {
        "_id": "6351e49a7074da08f5ea17f2",
        "accountName": "Discover Labs 123",
        "accountType": "Group",
        "providers": [
            {
                "_id": "6351e5087074da08f5ea1803",
                "providerName": "Helen Manuel",
                "providerNPI": 1234567890,
                "accountType": "Provider"
            }
        ]
    },

    {
        "_id": "635450821a48fcc3c19558b7",
        "accountName": "New Account 005",
        "accountType": "Group",
        "providers": [
            {
                "_id": "6354508f1a48fcc3c19558ba",
                "providerName": "Dr Helen Sloane",
                "providerNPI": 123456789,
                "accountType": "Provider"
            }
        ]
    },

    {
        "_id": "6384d11809949f49ada17801",
        "accountName": "Discover Lab 123",
        "accountType": "Facility",
        "providers": []
    },
    {
        "_id": "638518b3f010e7da6f157eff",
        "accountName": "AirBioHealth 1",
        "accountType": "Group",
        "providers": []
    }
]
</code>```

As you see in the data if the accountType is Group then  I would need list its child items.

Here's the React code:

```<code>

import Box from '@mui/material/Box';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemButton from '@mui/material/ListItemButton';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import Divider from '@mui/material/Divider';
import CorporateFareIcon from '@mui/icons-material/CorporateFare';import DraftsIcon from '@mui/icons-material/Drafts';
import { FixedSizeList } from 'react-window';
import LocalHospitalIcon from '@mui/icons-material/LocalHospital';
import Person2RoundedIcon from '@mui/icons-material/Person2Rounded';

import { useSelector, useDispatch } from 'react-redux'

const AccountsSideBar = () => {

    const { accounts } = useSelector((state) => state.accountsList)

  return (
    <div>

<Box sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper', padding: 0 }}
      style={{maxHeight: 600, overflow: 'auto'}}>
      <nav aria-label="main mailbox folders">
        <List style={{maxHeight: '100%', overflow: 'auto'}}>

            {
            accounts.map((account) => (

               <ListItem disablePadding>
                <ListItemButton>
                  <ListItemIcon>
                    {account.accountType === 'Facility' ? <CorporateFareIcon color="primary" /> : <LocalHospitalIcon color="primary"/> }
                  </ListItemIcon>
                  <ListItemText
                  primaryTypographyProps={{fontSize: '12px',}}
                  > {account.accountName} </ListItemText>
                </ListItemButton>
              </ListItem>

            ))}

        </List>
      </nav>
      <Divider />

    </Box>

    </div>
  )
}

export default AccountsSideBar
</code>```

Thanks a bunch in advance :)

Body:
I am trying to create a second sidebard of nested list items in a react app with MUI, however finding difficulties to map the data. The approach I am trying is to have a map fuction for the child items within a parent map higher order function in the react component. Could someone please help me to get into a solution.

Heres what I am trying to achive:

Screenshot of the prototype

Complete screen image

Here's the Data for list:

    {
        "_id": "6384adf3e445385733eed839",
        "accountName": "WestStar Labs",
        "accountType": "Facility",
        "providers": []
    },
    {
        "_id": "6351e49a7074da08f5ea17f2",
        "accountName": "Discover Labs 123",
        "accountType": "Group",
        "providers": [
            {
                "_id": "6351e5087074da08f5ea1803",
                "providerName": "Helen Manuel",
                "providerNPI": 1234567890,
                "accountType": "Provider"
            }
        ]
    },

    {
        "_id": "635450821a48fcc3c19558b7",
        "accountName": "New Account 005",
        "accountType": "Group",
        "providers": [
            {
                "_id": "6354508f1a48fcc3c19558ba",
                "providerName": "Dr Helen Sloane",
                "providerNPI": 123456789,
                "accountType": "Provider"
            }
        ]
    },

    {
        "_id": "6384d11809949f49ada17801",
        "accountName": "Discover Lab 123",
        "accountType": "Facility",
        "providers": []
    },
    {
        "_id": "638518b3f010e7da6f157eff",
        "accountName": "AirBioHealth 1",
        "accountType": "Group",
        "providers": []
    }
]

As you see in the data if the accountType is Group then  I would need list its child items.

Here's the React code:

import Box from '@mui/material/Box';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemButton from '@mui/material/ListItemButton';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import Divider from '@mui/material/Divider';
import CorporateFareIcon from '@mui/icons-material/CorporateFare';import DraftsIcon from '@mui/icons-material/Drafts';
import { FixedSizeList } from 'react-window';
import LocalHospitalIcon from '@mui/icons-material/LocalHospital';
import Person2RoundedIcon from '@mui/icons-material/Person2Rounded';

import { useSelector, useDispatch } from 'react-redux'

const AccountsSideBar = () => {

    const { accounts } = useSelector((state) => state.accountsList)

  return (

<Box sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper', padding: 0 }}
      style={{maxHeight: 600, overflow: 'auto'}}>

        <List style={{maxHeight: '100%', overflow: 'auto'}}>

            {
            accounts.map((account) => (

               <ListItem disablePadding>
                <ListItemButton>
                  <ListItemIcon>
                    {account.accountType === 'Facility' ? <CorporateFareIcon color="primary" /> : <LocalHospitalIcon color="primary"/> }
                  </ListItemIcon>
                  <ListItemText
                  primaryTypographyProps={{fontSize: '12px',}}
                  > {account.accountName} </ListItemText>
                </ListItemButton>
              </ListItem>

            ))}

        </List>

      <Divider />

    </Box>

  )
}

export default AccountsSideBar

Thanks a bunch in advance :)


问:
How to render an HTML file when referencing it from a Chrome API method?
Here is some BEX code that uses a Chrome API method which requires a path to an HTML file:

```<code>chrome.devtools.panels.create(
  'My Panel',
  'icons/icon-48x48.png',
  'assets/panel.html',
  undefined
)
</code>```

All works well when src-bex/assets/panel.html exists.

How can a panel.vue file be used to generate this panel.html file in the assets folder?

I tried creating panel.vue in src/assets and src-bex/assets, hoping that the panel.vue file would magically appear. It did not.

I also reviewd https://quasar.dev/quasar-cli-vite/quasar-config-js for options to have Vue process files which are not referenced by Vue code.

Body:
Here is some BEX code that uses a Chrome API method which requires a path to an HTML file:

chrome.devtools.panels.create(
  'My Panel',
  'icons/icon-48x48.png',
  'assets/panel.html',
  undefined
)

All works well when src-bex/assets/panel.html exists.

How can a panel.vue file be used to generate this panel.html file in the assets folder?

I tried creating panel.vue in src/assets and src-bex/assets, hoping that the panel.vue file would magically appear. It did not.

I also reviewd https://quasar.dev/quasar-cli-vite/quasar-config-js for options to have Vue process files which are not referenced by Vue code.


问:
font-face does not display local font
I downloaded some fonts and am storing them in my src folder:

```<code>├── src
│   ├── fonts
│   │   ├── font.ttf
│   ├── components
</code>```

Then I tried to add them using font-face but I can't figure out why it's not working. Is there a specific place you're supposed to put them in your react project?

Right now I'm declaring the font in the same file where I'm trying to use it:

```<code>@font-face {
  font-family: "MyFont";
  src: local("MyFont"), url("path/to/font.ttf"),
    format("truetype");
}

p {
    font-family: 'MyFont'
}
</code>```

When I do this it just reverts to my system's font, overriding the fonts declared in my index.scss file:

```<code>html,
body {
  font-family: "Roboto", "Arial", sans-serif;
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code {
  font-family: "Roboto", "Arial", sans-serif;
}
</code>```

Is there a specific file I need to declare the font family? Am I importing it wrong? The file path is correct, so I'm not sure what's happening. I downloaded the fonts I wanted and copied the files into my src/fonts directory. Is that where the issue is coming from?

Title: font-face does not display local font

Body:
I downloaded some fonts and am storing them in my src folder:

├── src
│   ├── fonts
│   │   ├── font.ttf
│   ├── components

Then I tried to add them using font-face but I can't figure out why it's not working. Is there a specific place you're supposed to put them in your react project?

Right now I'm declaring the font in the same file where I'm trying to use it:

@font-face {
  font-family: "MyFont";
  src: local("MyFont"), url("path/to/font.ttf"),
    format("truetype");
}

p {
    font-family: 'MyFont'
}

When I do this it just reverts to my system's font, overriding the fonts declared in my index.scss file:

html,
body {
  font-family: "Roboto", "Arial", sans-serif;
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code {
  font-family: "Roboto", "Arial", sans-serif;
}

Is there a specific file I need to declare the font family? Am I importing it wrong? The file path is correct, so I'm not sure what's happening. I downloaded the fonts I wanted and copied the files into my src/fonts directory. Is that where the issue is coming from?


问:
How to avoid merging the Partial dependence plots
I am trying to plot objective function for the optimized neural network using plot_objective but the plots are getting merged. Is there anyway to fix this?

obtained plot

A similar question was asked here
So, I tried:

plt.tight_layout()

It is bit helpful but still there is merging like this
plot_tight

I used this:

_ = plot_objective(result,n_points=12)

and

plt.tight_layout()


问:
i am able to log the response from the api call but i am not able to save the response in a java script obj
**java script:
**

```<code>function myfunction(){
 response = fetch('https://official-joke-api.appspot.com/random_joke/')
.then(response => {
    if(response.ok){
       return response.json();
    }else {
        console.log('error;');
    }
})
.then(users => console.log(users));
}
</code>```

html:

```<code><body>
    <button onclick = "myfunction()"> random joke</button>
    <script src= "script.js"></script>
</code>```

i need to save the response in an array and just show only two elements in the UI not all the response

Body:
**java script:
**

function myfunction(){
 response = fetch('https://official-joke-api.appspot.com/random_joke/')
.then(response => {
    if(response.ok){
       return response.json();
    }else {
        console.log('error;');
    }
})
.then(users => console.log(users));
}

html:

    <button onclick = "myfunction()"> random joke</button>

i need to save the response in an array and just show only two elements in the UI not all the response


问:
Sort Pages According To List VBA
I have a PDF file that contains 500+ pages containing a unique number on each page. First I wanted to sort them with Acrobat PDF Pro DC Actions/JavaScript but its hard and I don't understand Java at all.

Then I realized that I can open PDFs in MS Word 365 as well and when I opened the same doc in MS Word 365 it is searchable.

Now I want a VBA code to rearrange these pages according to a list that I provide in XLSX or CSV or TXT etc. format and save it as a new file.

File Before Sort Pages

Sort List

File After Sort Pages

Title: Sort Pages According To List VBA


问:
Does whatsapp ignore og:image when the url is contains percent-encoding?
I have an issue with WhatsApp where the links to my open graph properties sometimes show the photo when sharing with WhatsApp and others not...

I research online and checked the size of the images and everything is more than fine in both! So I am guessing the issue might be because of the encoding of the Chinese characters in the URL...

https://www.eastmount.com.hk/properties/village-housechi-fai-path-detached-gated-garden-high-ceiling-property-id2283/

The above link show the photo without problem

```<code>https://www.eastmount.com.hk/properties/sai-kung-villa-house-property-for-rent-or-lease-in-villa-royale-nam-wai-%E5%8D%97%E9%82%8A%E5%9C%8D%E5%BE%A1%E8%8A%B1%E5%9C%92-convenient-location-club-house-eastmount-property-%E6%9D%B1-2/
</code>```

This one just totally ignores it.

Origial url before encoding does not show the image either:

https://www.eastmount.com.hk/properties/sai-kung-villa-house-property-for-rent-or-lease-in-villa-royale-nam-wai-南邊圍御花園-convenient-location-club-house-eastmount-property-東-2

Does anyone have any idea why this happen? It is possible that the encode url is causing problem?

Body:
I have an issue with WhatsApp where the links to my open graph properties sometimes show the photo when sharing with WhatsApp and others not...

I research online and checked the size of the images and everything is more than fine in both! So I am guessing the issue might be because of the encoding of the Chinese characters in the URL...

https://www.eastmount.com.hk/properties/village-housechi-fai-path-detached-gated-garden-high-ceiling-property-id2283/

The above link show the photo without problem

https://www.eastmount.com.hk/properties/sai-kung-villa-house-property-for-rent-or-lease-in-villa-royale-nam-wai-%E5%8D%97%E9%82%8A%E5%9C%8D%E5%BE%A1%E8%8A%B1%E5%9C%92-convenient-location-club-house-eastmount-property-%E6%9D%B1-2/

This one just totally ignores it.

Origial url before encoding does not show the image either:

https://www.eastmount.com.hk/properties/sai-kung-villa-house-property-for-rent-or-lease-in-villa-royale-nam-wai-南邊圍御花園-convenient-location-club-house-eastmount-property-東-2

Does anyone have any idea why this happen? It is possible that the encode url is causing problem?


问:
R Shiny: Why Doesn't My Leaflet Map Project Two Political Races?
StackOverflow! I am a hobbyist coder, longtime lurker, first-time poster, and am completely stuck on how to fix a bug in a Shiny dashboard I wrote in R. Using this tutorial as a starting point, I want to map the 2022 General Election results in the County I live in Ohio. I have collected the data, created new shapefiles to project the winning margin, and saved two .csv files to display the results at the overall and precinct levels.

Here is my server code:

```<code>library(DT)
library(leaflet)
library(leafpop)
library(sf)
library(shiny)
library(tidyr)

election.df <- read.csv("data/election.df.csv")
overall.df <- read.csv("data/overall.df.csv")

colnames(election.df)[colnames(election.df) == "precName"] <- "Precinct"

dem_df <- st_read("data/dem_df.shp")
rep_df <- st_read("data/rep_df.shp")

dem_df[dem_df$RACE == "223", "MARGIN"] <- (dem_df[dem_df$RACE == "223", "MARGIN"]/3)[,1]
rep_df[rep_df$RACE == "223", "MARGIN"] <- (rep_df[rep_df$RACE == "223", "MARGIN"]/3)[,1]

dem_min_max_values <- range(abs(dem_df$MARGIN), na.rm = TRUE)
rep_min_max_values <- range(abs(rep_df$MARGIN), na.rm = TRUE)

dem_palette <- colorNumeric(palette = "Blues",
                            domain=c(dem_min_max_values[1], dem_min_max_values[[2]]))

rep_palette <- colorNumeric(palette = "Reds",
                            domain=c(rep_min_max_values[1], rep_min_max_values[2]))

server <- function(input, output, session){
  overall <- reactive({
    overall.df[overall.df$raceNo %in% input$selectRace, c("Candidate", "Party", "Votes")]
  })

  output$overallDT <- renderDataTable(
    datatable(overall(),
              options = list(dom = 't'),
              rownames= FALSE) %>%
      formatCurrency("Votes",
                     currency = "",
                     interval = 3,
                     mark = ",",
                     digits = 0)

  )

  precinct <- reactive({
    pivot_wider(data = election.df[election.df$raceNo %in% input$selectRace, c("precNo", "Precinct", "candName", "votes", "Turnout")],
                names_from = candName,
                values_from = votes,
                names_sort = TRUE,
                names_glue = gsub("\\.", " ", "{candName}"))
  })

  output$precinctDT <- renderDataTable(
    datatable(precinct()[,-1])
  )

  dem_map <- reactive({
    merge(dem_df[dem_df$RACE %in% input$selectRace, c("PRECINC", "MARGIN", "geometry")], precinct(), by.x = "PRECINC", by.y = "precNo")
  })

  rep_map <- reactive({
    merge(rep_df[rep_df$RACE %in% input$selectRace, c("PRECINC", "MARGIN", "geometry")], precinct(), by.x = "PRECINC", by.y = "precNo")
  })

  output$myMap <- renderLeaflet({
    leaflet() %>%
      addProviderTiles("CartoDB.Positron")  %>%

      addPolygons(
        data = dem_map(),
        fillColor = ~dem_palette(dem_map()$MARGIN),
        popup = popupTable(x = dem_map(),
                           zcol = c(-1:-2, -ncol(dem_map())),
                           row.numbers = F,
                           feature.id = F),
        stroke = TRUE,
        smoothFactor = 0.2,
        fillOpacity = 2,
        color = "#666",
        weight = 1) %>%

      addPolygons(
        data = rep_map(),
        fillColor = ~rep_palette(rep_map()$MARGIN),
        popup = popupTable(x = rep_map(),
                           zcol = c(-1:-2, -ncol(rep_map())),
                           row.numbers = F,
                           feature.id = F),
        stroke = TRUE,
        smoothFactor = 0.2,
        fillOpacity = 2,
        color = "#666",
        weight = 1)
  })

}
</code>```

Here is the Git Hub repository if you would like to download it yourself.

Now, my issue is that I am unable to project the leaflet map for the Twinsburg and Hudson mayoral races. I expect to see the mapped results, and when a precinct is clicked, a popup window come up that displays the name, the turnout percentage, and the number of votes each candidate received. However, in R Studio I receive the message, "Error: subscript out of bounds". This only happens with the Twinsburg and Hudson mayoral elections and only after I had added the popupTable function to the popup option. Without that argument, the map displays correctly. The app has no problem working with the other election data.

Thanks in advance! I know I have to be missing something.

Body:
StackOverflow! I am a hobbyist coder, longtime lurker, first-time poster, and am completely stuck on how to fix a bug in a Shiny dashboard I wrote in R. Using this tutorial as a starting point, I want to map the 2022 General Election results in the County I live in Ohio. I have collected the data, created new shapefiles to project the winning margin, and saved two .csv files to display the results at the overall and precinct levels.

Here is my server code:

library(DT)
library(leaflet)
library(leafpop)
library(sf)
library(shiny)
library(tidyr)

election.df <- read.csv("data/election.df.csv")
overall.df <- read.csv("data/overall.df.csv")

colnames(election.df)[colnames(election.df) == "precName"] <- "Precinct"

dem_df <- st_read("data/dem_df.shp")
rep_df <- st_read("data/rep_df.shp")

dem_df[dem_df$RACE == "223", "MARGIN"] <- (dem_df[dem_df$RACE == "223", "MARGIN"]/3)[,1]
rep_df[rep_df$RACE == "223", "MARGIN"] <- (rep_df[rep_df$RACE == "223", "MARGIN"]/3)[,1]

dem_min_max_values <- range(abs(dem_df$MARGIN), na.rm = TRUE)
rep_min_max_values <- range(abs(rep_df$MARGIN), na.rm = TRUE)

dem_palette <- colorNumeric(palette = "Blues",
                            domain=c(dem_min_max_values[1], dem_min_max_values[[2]]))

rep_palette <- colorNumeric(palette = "Reds",
                            domain=c(rep_min_max_values[1], rep_min_max_values[2]))

server <- function(input, output, session){
  overall <- reactive({
    overall.df[overall.df$raceNo %in% input$selectRace, c("Candidate", "Party", "Votes")]
  })

  output$overallDT <- renderDataTable(
    datatable(overall(),
              options = list(dom = 't'),
              rownames= FALSE) %>%
      formatCurrency("Votes",
                     currency = "",
                     interval = 3,
                     mark = ",",
                     digits = 0)

  )

  precinct <- reactive({
    pivot_wider(data = election.df[election.df$raceNo %in% input$selectRace, c("precNo", "Precinct", "candName", "votes", "Turnout")],
                names_from = candName,
                values_from = votes,
                names_sort = TRUE,
                names_glue = gsub("\\.", " ", "{candName}"))
  })

  output$precinctDT <- renderDataTable(
    datatable(precinct()[,-1])
  )

  dem_map <- reactive({
    merge(dem_df[dem_df$RACE %in% input$selectRace, c("PRECINC", "MARGIN", "geometry")], precinct(), by.x = "PRECINC", by.y = "precNo")
  })

  rep_map <- reactive({
    merge(rep_df[rep_df$RACE %in% input$selectRace, c("PRECINC", "MARGIN", "geometry")], precinct(), by.x = "PRECINC", by.y = "precNo")
  })

  output$myMap <- renderLeaflet({
    leaflet() %>%
      addProviderTiles("CartoDB.Positron")  %>%

      addPolygons(
        data = dem_map(),
        fillColor = ~dem_palette(dem_map()$MARGIN),
        popup = popupTable(x = dem_map(),
                           zcol = c(-1:-2, -ncol(dem_map())),
                           row.numbers = F,
                           feature.id = F),
        stroke = TRUE,
        smoothFactor = 0.2,
        fillOpacity = 2,
        color = "#666",
        weight = 1) %>%

      addPolygons(
        data = rep_map(),
        fillColor = ~rep_palette(rep_map()$MARGIN),
        popup = popupTable(x = rep_map(),
                           zcol = c(-1:-2, -ncol(rep_map())),
                           row.numbers = F,
                           feature.id = F),
        stroke = TRUE,
        smoothFactor = 0.2,
        fillOpacity = 2,
        color = "#666",
        weight = 1)
  })

}

Here is the Git Hub repository if you would like to download it yourself.

Now, my issue is that I am unable to project the leaflet map for the Twinsburg and Hudson mayoral races. I expect to see the mapped results, and when a precinct is clicked, a popup window come up that displays the name, the turnout percentage, and the number of votes each candidate received. However, in R Studio I receive the message, "Error: subscript out of bounds". This only happens with the Twinsburg and Hudson mayoral elections and only after I had added the popupTable function to the popup option. Without that argument, the map displays correctly. The app has no problem working with the other election data.

Thanks in advance! I know I have to be missing something.


问:
What ru_maxrss: calculates?
Does ru_maxrss also includes the space that has been use on Stack for recursive calls ?

I need to know What all the things get calculated if I am using ru_maxrss.

Title: What ru_maxrss: calculates?


问:
Is it possible to create a sklearn multivariate polynomial regression that is cubic in one term and linear in the other?
I am trying to model a relationship in python using multiple terms including a time term but the model I am trying to recreate is one that uses a cubic polynomial in one variable and a linear polynomial in the time term. In other words, the model is in the following form:

```<code>y = c1 + c2*x + c3*x**2 + c4*x**3 + c5*time + error
</code>```

I have already used sklearn to create a polynomial regression to model the relationship between x and y but I am struggling to understand how to to extend this model to include a linear time term.

I have tried to approach the problem using the built in multivariate regression features but these seem to always put the relationship between all involved terms as a cubic relationship. The (very primitive) code I utilized for this was the following:

```<code>xtime = = np.stack([x,time],axis=1)
polyfeatures = PolynomialFeatures(degree=3)
feat = polyfeatures.fit_transform(xtime)
for i in range(len(feat)):
    feat[i][4] = 0
    feat[i][5] = 0
    feat[i][7] = 0
    feat[i][8] = 0
    feat[i][9] = 0
</code>```

The thinking behind this was to zero out all of the exponent values in feat that corresponded to terms that were not in the final equation that I was looking to create.
The result of this attempt was (unsurprisingly) a very poor regression that did not correlate with the data whatsoever.

If anyone has any recommendations I would be extremely grateful. Thank you so much for any help!

Body:
I am trying to model a relationship in python using multiple terms including a time term but the model I am trying to recreate is one that uses a cubic polynomial in one variable and a linear polynomial in the time term. In other words, the model is in the following form:

y = c1 + c2*x + c3*x**2 + c4*x**3 + c5*time + error

I have already used sklearn to create a polynomial regression to model the relationship between x and y but I am struggling to understand how to to extend this model to include a linear time term.

I have tried to approach the problem using the built in multivariate regression features but these seem to always put the relationship between all involved terms as a cubic relationship. The (very primitive) code I utilized for this was the following:

xtime = = np.stack([x,time],axis=1)
polyfeatures = PolynomialFeatures(degree=3)
feat = polyfeatures.fit_transform(xtime)
for i in range(len(feat)):
    feat[i][4] = 0
    feat[i][5] = 0
    feat[i][7] = 0
    feat[i][8] = 0
    feat[i][9] = 0

The thinking behind this was to zero out all of the exponent values in feat that corresponded to terms that were not in the final equation that I was looking to create.
The result of this attempt was (unsurprisingly) a very poor regression that did not correlate with the data whatsoever.

If anyone has any recommendations I would be extremely grateful. Thank you so much for any help!


问:
how do i make my bootstrap carousel scrollable without removing my overlaped navbar
please i was trying to build a bootstrap carousel, with darkened background images and i overlapped the navbar into the slideshow, but the carousel became unscrollable, it took the full weight and height of the screen,if the change the position from absolute, it becomes scrollable but at the same time the navbar doesnt overlap into the carousel.

`

```<code>   #demo{
     position:absolute;
        width:100%;
           top:0;
   }
</code>```

please how do i make the carousel only a banner secion, without removing the navbar section?

0i tried changing the Id (#demo) position from absolute to relative, the overlapped navbar went out of the carousel and the page becomes scrollable but if i add position : absolute, the navbar overlaps into the carousel but the webpage stops being scrollable

Body:
please i was trying to build a bootstrap carousel, with darkened background images and i overlapped the navbar into the slideshow, but the carousel became unscrollable, it took the full weight and height of the screen,if the change the position from absolute, it becomes scrollable but at the same time the navbar doesnt overlap into the carousel.

`

   #demo{
     position:absolute;
        width:100%;
           top:0;
   }

please how do i make the carousel only a banner secion, without removing the navbar section?

0i tried changing the Id (#demo) position from absolute to relative, the overlapped navbar went out of the carousel and the page becomes scrollable but if i add position : absolute, the navbar overlaps into the carousel but the webpage stops being scrollable


问:
How to include pdfs for python package installation?
Looking at sklearn is able to install excels, I suspect there must be a way to include files other than .py files for python package installation. For instance, pdfs, jupyter notebooks, etc. Anyone knows how to do so?


问:
How can I show product parent category in woocommerce?
I'm trying to show product parent categories (Just one category not all). Now how can I show the product parent category in woocommerce?</p>
```<code>$woocpt_args          = array(
    'post_type' => 'product',
);
$woocpt_all_products  = new WP_Query( $woocpt_args );

while ( $woocpt_all_products->have_posts() ) :
    $woocpt_all_products->the_post();
    global $product;
    echo wc_get_product_category_list( get_the_id() );
endwhile;
</code>```

Body:
I'm trying to show product parent categories (Just one category not all). Now how can I show the product parent category in woocommerce?

$woocpt_args          = array(
    'post_type' => 'product',
);
$woocpt_all_products  = new WP_Query( $woocpt_args );

while ( $woocpt_all_products->have_posts() ) :
    $woocpt_all_products->the_post();
    global $product;
    echo wc_get_product_category_list( get_the_id() );
endwhile;


问:
how to convert char to wchar_t in C++
If I have this below code -

```<code>string str;
wstring wstr;

for (char x : str)
{
    wstr += x;
}
</code>```

Is this line wstr += x wrong? Do I need some conversion function to convert char x to wchar_t to be stored in wstr? If yes, which conversion function do I need?

Edit - I have gone through the linked answers, it mentions about converting the array of wchar_t and char -> for that for sure conversion functions are needed but my question specifically asks if a char -> wchar_t would need conversion function

Title: how to convert char to wchar_t in C++

Body:
If I have this below code -

string str;
wstring wstr;

for (char x : str)
{
    wstr += x;
}

Is this line wstr += x wrong? Do I need some conversion function to convert char x to wchar_t to be stored in wstr? If yes, which conversion function do I need?

Edit - I have gone through the linked answers, it mentions about converting the array of wchar_t and char -> for that for sure conversion functions are needed but my question specifically asks if a char -> wchar_t would need conversion function


问:
How to connect my gRPC server written in java with graphQL server
I have a simple graphQL server

```<code>import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";

const typeDefs = `#graphql
type Task {
    id: String
  name: String
  completed: Boolean
}

type Query {
  tasks: [Task]
}
`;

const tasks = [
  { id: "todo-1", name: "Eat", completed: true },
  { id: "todo-2", name: "Sleep", completed: false },
  { id: "todo-3", name: "Repeat", completed: false },
];

const resolvers = {
  Query: {
    tasks: () => tasks,
  },
};

const server = new ApolloServer({
  typeDefs,
  resolvers,
});

const { url } = await startStandaloneServer(server, {
  listen: { port: 4002 },
});

console.log(`  Server ready at: ${url}`);

</code>```

I want this server to connect to gRPC server which has the CRUD operation implementations, and I want to perform those CRUD operations using graphQL queries and resolvers since I will be connecting this graphQL server with the frontend part

proto file:

```<code>syntax = "proto3";

option java_package = "com.practice.grpc";
option java_outer_classname = "Todos";

service TodoList{
  rpc viewTodos(Empty) returns(stream Todo);
  rpc editTodo(Todo) returns(APIResponse);
  rpc addTodo(Todo) returns (APIResponse);
  rpc deleteTodo(Todo) returns (APIResponse);
}

message Todo{
  int32 id = 1;
  string title = 2;
  string editTitle = 3; //optional
  bool completed = 4;
}

message APIResponse{
  string responseMessage = 1;
  int32 responseCode = 2;
}
message Empty{}
message ErrorResponse {
  string title = 1;
  int32 responseCode = 2;
}
</code>```

Body:
I have a simple graphQL server

import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";

const typeDefs = `#graphql
type Task {
    id: String
  name: String
  completed: Boolean
}

type Query {
  tasks: [Task]
}
`;

const tasks = [
  { id: "todo-1", name: "Eat", completed: true },
  { id: "todo-2", name: "Sleep", completed: false },
  { id: "todo-3", name: "Repeat", completed: false },
];

const resolvers = {
  Query: {
    tasks: () => tasks,
  },
};

const server = new ApolloServer({
  typeDefs,
  resolvers,
});

const { url } = await startStandaloneServer(server, {
  listen: { port: 4002 },
});

console.log(`  Server ready at: ${url}`);

I want this server to connect to gRPC server which has the CRUD operation implementations, and I want to perform those CRUD operations using graphQL queries and resolvers since I will be connecting this graphQL server with the frontend part

proto file:

syntax = "proto3";

option java_package = "com.practice.grpc";
option java_outer_classname = "Todos";

service TodoList{
  rpc viewTodos(Empty) returns(stream Todo);
  rpc editTodo(Todo) returns(APIResponse);
  rpc addTodo(Todo) returns (APIResponse);
  rpc deleteTodo(Todo) returns (APIResponse);
}

message Todo{
  int32 id = 1;
  string title = 2;
  string editTitle = 3; //optional
  bool completed = 4;
}

message APIResponse{
  string responseMessage = 1;
  int32 responseCode = 2;
}
message Empty{}
message ErrorResponse {
  string title = 1;
  int32 responseCode = 2;
}


问:
Is there a way to make a row expand on clicking the row itself rather than the arrow icon in vue primevue datatable
I currently have a datatable in vue with rows and columns. I am trying to make the row itself clickable instead of the toggle arrow on the left side of the table. But I am unable to find a proper solution so far. Could you please help me out with it??

I have posted my code below

```<code>template>
  <div>
    <PV-DataTable
      :value="solutions"
      sortMode="multiple"
      stripedRows
      selectionMode="single"
      responsiveLayout="scroll"
      v-model:expandedRows="expandedRows"
      >
      <template #empty> No solutions found </template>
      <PV-Column :expander="true" headerStyle="width: 3rem" />
      <PV-ColumnGroup type="header">
        <PV-Row>
          <PV-Column header=" " :rowspan="2" />
          <PV-Column header="Solver" :rowspan="2" sortable />
          <PV-Column header="Runtime" :colspan="3" sortable />
        </PV-Row>
        <PV-Row>
          <PV-Column header="Total" :sortable="true" field="runtimeTotal" />
          <PV-Column
            header="Overhead"
            :sortable="true"
            field="runtimeOverhead"
          />
          <PV-Column header="QPU" :sortable="true" field="runtimeQPU" />
        </PV-Row>
      </PV-ColumnGroup>
      <PV-Column field="solution.solver" />
      <PV-Column field="solution.runtime.total" />
      <PV-Column field="solution.runtime.overhead" />
      <PV-Column field="solution.runtime.qpu" />

      <template #expansion="slotProps" >
        <div class="solutions-subtable " >
          <PV-DataTable
            :value="getSampleWithEnergy(slotProps.data.solution)"
            responsiveLayout="scroll"
            selectionMode="single"
            v-model:selection="selectedSample"
            @rowSelect="onRowSelect"
          >
            <PV-ColumnGroup type="header" >
              <PV-Row>
                <PV-Column header="Sample" :rowspan="2"/>
                <PV-Column header="Energy" :rowspan="2" />
              </PV-Row>
            </PV-ColumnGroup>
            <PV-Column field="sample"  />
            <PV-Column field="energy" />
          </PV-DataTable>
        </div>
      </template>
    </PV-DataTable>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import axios from "@/api";
import type { Solution } from "@/types";

export default defineComponent({
  props: {
    optId: {
      type: String,
      default: "" as string,
    },
  },
  data() {
    return {
      solutions: null,
      expandedRows: [],
      selectedSample: null,

    };
  },
  mounted() {
    this.fetchData();
  },
  methods: {
    async fetchData() {
      await axios
        .get(`/api/optimizations/${this.optId}/solutions`)
        .then((res: { data: any; }) => {
          this.solutions = res.data;
        })
        .catch((e: { message: any; }) => {
          console.error(e);
          const content = {
            severity: "error",
            summary: "Solutions could not be loaded.",
            detail: e.message,
            life: 3000,
          };
          this.$emitter.emit("show-toast", content);
        });
    },
    getSampleWithEnergy(solutionData: Solution) {
      const samples = [];
      for (let i = 0; i < solutionData.samples.length; i++) {
        const sampleWithNums = solutionData.samples[i].map(function (
          element: boolean
        ) {
          return Number(element);
        });
        samples.push({
          sample: sampleWithNums,
          energy: solutionData.energies[i],
        });
      }
      return samples;
    },
    onRowSelect(event: any) {
      this.$toast.add({
        severity: "info",
        summary: "Sample Selected",
        detail:
          "Selected sample " +
          event.data.sample +
          ". Check Solutions Tab for more details.",
        life: 3000,
      });
      this.$emit("sampleSelected", this.selectedSample);
    },
  },
});
</script>

</code>```
```<code>
type here
</code>```

I have tried going through the primevue datatable documentation but so far no use.

Body:
I currently have a datatable in vue with rows and columns. I am trying to make the row itself clickable instead of the toggle arrow on the left side of the table. But I am unable to find a proper solution so far. Could you please help me out with it??

I have posted my code below

template>

    <PV-DataTable
      :value="solutions"
      sortMode="multiple"
      stripedRows
      selectionMode="single"
      responsiveLayout="scroll"
      v-model:expandedRows="expandedRows"
      >
      <template #empty> No solutions found </template>
      <PV-Column :expander="true" headerStyle="width: 3rem" />
      <PV-ColumnGroup type="header">
        <PV-Row>
          <PV-Column header=" " :rowspan="2" />
          <PV-Column header="Solver" :rowspan="2" sortable />
          <PV-Column header="Runtime" :colspan="3" sortable />
        </PV-Row>
        <PV-Row>
          <PV-Column header="Total" :sortable="true" field="runtimeTotal" />
          <PV-Column
            header="Overhead"
            :sortable="true"
            field="runtimeOverhead"
          />
          <PV-Column header="QPU" :sortable="true" field="runtimeQPU" />
        </PV-Row>
      </PV-ColumnGroup>
      <PV-Column field="solution.solver" />
      <PV-Column field="solution.runtime.total" />
      <PV-Column field="solution.runtime.overhead" />
      <PV-Column field="solution.runtime.qpu" />

      <template #expansion="slotProps" >

          <PV-DataTable
            :value="getSampleWithEnergy(slotProps.data.solution)"
            responsiveLayout="scroll"
            selectionMode="single"
            v-model:selection="selectedSample"
            @rowSelect="onRowSelect"
          >
            <PV-ColumnGroup type="header" >
              <PV-Row>
                <PV-Column header="Sample" :rowspan="2"/>
                <PV-Column header="Energy" :rowspan="2" />
              </PV-Row>
            </PV-ColumnGroup>
            <PV-Column field="sample"  />
            <PV-Column field="energy" />
          </PV-DataTable>

      </template>
    </PV-DataTable>

</template>

type here

I have tried going through the primevue datatable documentation but so far no use.


问:
Inconsistent Type assertion in typescript when in Trpc publicProcedure (with prisma)
I am trying to create a public procedure to query a product that is stored in my database. If the product is not found, I am asking Prisma to throw an error, in fact, I am using the findUniqueOrThrow function.

This is what the snippet looks like

```<code>getProductById: publicProcedure
    .input(z.object({ pid: z.string() }))
    .query(async ({ ctx, input }) => {

      try{
        return await ctx.prisma.pollProduct.findUniqueOrThrow({
          where: {
            pid: input.pid,
          },
        });
      }
      catch(e){
        if(e instanceof Prisma.NotFoundError){
          // At this point productData is CjResponse | undefined
          const {data: productData, isFetched} = trpc.cjApi.getItemById.useQuery({productId: input.pid})

          // In the if statement, productData is CjResponse since we know for a fact that it's not a falsy value
          if( productData && productData.data){
            return ctx.prisma.pollProduct.create({
              data: {
                // As soon as productData is assigned as the value of the description key
                // the value is becomes `any`
                description: productData
              }
            })
          }
        }
      }

    }),
</code>```

I am considering taking a different approach, but I would like to know if this is wrong on my end or if typescript is tripping. Thank you for your time.

Note that I am aware that it would be better to use findUnique and check if the result is null, given that my catch block as of right now would be triggered for any other error. It is simply puzzling to me that typescript would behave like this.

edit: It looks like it doesn't relly appreciate the fact that I am using a trpc query inside a public procedure.

Body:
I am trying to create a public procedure to query a product that is stored in my database. If the product is not found, I am asking Prisma to throw an error, in fact, I am using the findUniqueOrThrow function.

This is what the snippet looks like

getProductById: publicProcedure
    .input(z.object({ pid: z.string() }))
    .query(async ({ ctx, input }) => {

      try{
        return await ctx.prisma.pollProduct.findUniqueOrThrow({
          where: {
            pid: input.pid,
          },
        });
      }
      catch(e){
        if(e instanceof Prisma.NotFoundError){
          // At this point productData is CjResponse | undefined
          const {data: productData, isFetched} = trpc.cjApi.getItemById.useQuery({productId: input.pid})

          // In the if statement, productData is CjResponse since we know for a fact that it's not a falsy value
          if( productData && productData.data){
            return ctx.prisma.pollProduct.create({
              data: {
                // As soon as productData is assigned as the value of the description key
                // the value is becomes `any`
                description: productData
              }
            })
          }
        }
      }

    }),

I am considering taking a different approach, but I would like to know if this is wrong on my end or if typescript is tripping. Thank you for your time.

Note that I am aware that it would be better to use findUnique and check if the result is null, given that my catch block as of right now would be triggered for any other error. It is simply puzzling to me that typescript would behave like this.

edit: It looks like it doesn't relly appreciate the fact that I am using a trpc query inside a public procedure.


问:
Next js router query all data is not coming
I made a request to my backend and brought all the categories to the homepage. From there I redirected to a page called [category_slug].jsx.

I'm getting data with useEffect and I'm pulling it from the context api

```<code>categories.map((category) => (
          <Link
            href={{ pathname: `/categories/${category.category_slug}`, query: category }}
            className="text-sm hover:underline hover:opacity-60"
            key={category.id}
          >
            {category.name}
          </Link>
        ))
</code>```

Also, I used this method before to make the page with the videos and it worked then.

All data comes to that page, but the videos come with 2 empty strings, but it should not come as such.

{
    "id": "9",
    "name": "test2",
    "category_slug": "test2",
    "description": "testt2",
    "videos": [
        "",
        ""
    ],
    "image": "",
    "created": "2022-12-07T02:07:05.838815Z",
    "updated": "2022-12-07T02:07:05.838840Z"
}
```
<p>My [id] page:</p>
```import React from "react";

const CategoryPage = () => {
    const router = useRouter()
    const category = router.query;

    console.log(category)

  // captilaze first letter and lowercase the rest
  const capitalize = (s) => {
    if (typeof s !== "string") return "";
    return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();

  };
  return (
    <>

    {  /* <CustomHead title={capitalize(category.name)} />*/}

            { /*
{category.name}
*/}

    </>
  );
};

export default CategoryPage;
```

Please excuse me if I didn't express myself very well.

Body:
I made a request to my backend and brought all the categories to the homepage. From there I redirected to a page called [category_slug].jsx.

I'm getting data with useEffect and I'm pulling it from the context api

categories.map((category) => (
          <Link
            href={{ pathname: `/categories/${category.category_slug}`, query: category }}
            className="text-sm hover:underline hover:opacity-60"
            key={category.id}
          >
            {category.name}
          </Link>
        ))

Also, I used this method before to make the page with the videos and it worked then.

All data comes to that page, but the videos come with 2 empty strings, but it should not come as such.

{
    "id": "9",
    "name": "test2",
    "category_slug": "test2",
    "description": "testt2",
    "videos": [
        "",
        ""
    ],
    "image": "",
    "created": "2022-12-07T02:07:05.838815Z",
    "updated": "2022-12-07T02:07:05.838840Z"
}

My [id] page:

import React from "react";

const CategoryPage = () => {
    const router = useRouter()
    const category = router.query;

    console.log(category)

  // captilaze first letter and lowercase the rest
  const capitalize = (s) => {
    if (typeof s !== "string") return "";
    return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();

  };
  return (
    <>

    {  /* <CustomHead title={capitalize(category.name)} />*/}

            { /*
{category.name}
*/}

    </>
  );
};

export default CategoryPage;

Please excuse me if I didn't express myself very well.


问:
Visual studio .NET MAUI windows build button is missing
Basically, i have this small MAUI project and somewhere along the way, the Windows deployment button is gone. I can no longer deploy and test on windows. I have no idea what i did wrong.
Please, see my .csproj file and screenshot below. Maybe im missing something.

```<code><Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net7.0-ios;net7.0-android</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.22621.0</TargetFrameworks>
        <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
        <!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
        <OutputType>Exe</OutputType>
        <RootNamespace>MAUIDependencySample</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>

        <!-- Display name -->
        <ApplicationTitle>MAUIDependencySample</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.example</ApplicationId>
        <ApplicationIdGuid>0D7F5EAA-B445-45A1-9898-B9535F8F0DED</ApplicationIdGuid>

        <!-- Versions -->
        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">27.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
    </PropertyGroup>

    <PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Debug'">
        <CodesignKey>Apple Development: example (PCQ252A654)</CodesignKey>
        <!--<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>-->
        <CodesignProvision>Example Development</CodesignProvision>
        <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios'">
      <ProvisioningType>manual</ProvisioningType>
    </PropertyGroup>

    <ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

        <!-- Splash Screen -->
        <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

        <!-- Images -->
        <MauiImage Include="Resources\Images\*" />
        <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*" />

        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    </ItemGroup>

    <ItemGroup>
      <PackageReference Include="CommunityToolkit.Maui" Version="1.2.0" />
      <PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
      <PackageReference Include="FirebaseDatabase.net" Version="4.1.0" />
      <PackageReference Include="IdentityModel.OidcClient" Version="5.0.2" />
      <PackageReference Include="LibBLEStandard" Version="1.0.5" />
      <PackageReference Include="MauiLibBLE" Version="1.0.0" />
      <PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
      <PackageReference Include="System.ObjectModel" Version="4.3.0" />
    </ItemGroup>

    <ItemGroup>
      <MauiXaml Update="Views\BarcodeScanView.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Views\BluetoothFunctionsView.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Views\HomeView.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
    </ItemGroup>

</Project>

</code>```

So as you can see from the screenshot, there is no button to deploy to windows.

Info: im on the latest visual studio at the moment, 17.4.2. If i do a brand new MAUI project, i can see the windows button.

I have tried changing the target and minimum windows sdk version.

I have also tried going back and forth with .net 6 and 7, but still no luck.

Has anyone ever seen this before?

Body:
Basically, i have this small MAUI project and somewhere along the way, the Windows deployment button is gone. I can no longer deploy and test on windows. I have no idea what i did wrong.
Please, see my .csproj file and screenshot below. Maybe im missing something.

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net7.0-ios;net7.0-android</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.22621.0</TargetFrameworks>

        <OutputType>Exe</OutputType>
        <RootNamespace>MAUIDependencySample</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>

        <ApplicationTitle>MAUIDependencySample</ApplicationTitle>

        <ApplicationId>com.example</ApplicationId>
        <ApplicationIdGuid>0D7F5EAA-B445-45A1-9898-B9535F8F0DED</ApplicationIdGuid>

        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">27.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
    </PropertyGroup>

    <PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Debug'">
        <CodesignKey>Apple Development: example (PCQ252A654)</CodesignKey>

        <CodesignProvision>Example Development</CodesignProvision>
        <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios'">
      <ProvisioningType>manual</ProvisioningType>
    </PropertyGroup>

    <ItemGroup>

        <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

        <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

        <MauiImage Include="Resources\Images\*" />
        <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

        <MauiFont Include="Resources\Fonts\*" />

        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    </ItemGroup>

    <ItemGroup>
      <PackageReference Include="CommunityToolkit.Maui" Version="1.2.0" />
      <PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
      <PackageReference Include="FirebaseDatabase.net" Version="4.1.0" />
      <PackageReference Include="IdentityModel.OidcClient" Version="5.0.2" />
      <PackageReference Include="LibBLEStandard" Version="1.0.5" />
      <PackageReference Include="MauiLibBLE" Version="1.0.0" />
      <PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
      <PackageReference Include="System.ObjectModel" Version="4.3.0" />
    </ItemGroup>

    <ItemGroup>
      <MauiXaml Update="Views\BarcodeScanView.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Views\BluetoothFunctionsView.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Views\HomeView.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
    </ItemGroup>

</Project>

So as you can see from the screenshot, there is no button to deploy to windows.

Info: im on the latest visual studio at the moment, 17.4.2. If i do a brand new MAUI project, i can see the windows button.

I have tried changing the target and minimum windows sdk version.

I have also tried going back and forth with .net 6 and 7, but still no luck.

Has anyone ever seen this before?


问:
How to connect the iphone from visual studio for mac 2022?
I installed Visual Studio for mac and created a demo app for ios. After that, I change the target ios version to ios 15. Now I can connect to the simulator with ios 16 but not to the iPhone which runs on ios 15. VS for mac said "os version lower than deployment version".
ps. This iPhone runs ok with Xcode 14 after I downgrade the target version to ios 15 in Xcode.

I downgrade all target/platform version settings which I can find in vs for mac and Xcode. Did I miss something else?


问:
Unable to make OkHttpClient call
I have a library in which request is happening. Library is using Okhttp-4.9.3. I dont have control on the client builder. When I checked the class file from the library below is the code

```<code>protected OkHttpClient getHttpClient() {
    if (okHttpClient == null) {
      okHttpClient = new OkHttpClient();
    }

    Authenticator proxyAuthenticator = (route, response) -> {
      String credential = Credentials.basic(System.getProperty(HTTP_PROXY_USER), System.getProperty(HTTP_PROXY_PASS));
      return response.request().newBuilder()
        .header(HEADER_PROXY_AUTH, credential)
        .build();
    };

    return okHttpClient.newBuilder()
      .addInterceptor(new RetryInterceptor(retryCount))
      .connectTimeout(timeout, timeoutUnit)
      .writeTimeout(timeout, timeoutUnit)
      .readTimeout(timeout, timeoutUnit)
      .proxyAuthenticator(proxyAuthenticator)
      .build();
  }
</code>```

I set System.setProperty(HTTP_PROXY_USER, "TestUser"), System.setProperty(HTTP_PROXY_PASS, "TestPassword")

When I make the request, I am receiving 'java.net.ProtocolException: Too many follow-up requests: 21'

I have below questions. Any help or suggestions I would really appreciate it

It is not expecting proxyHostName and port. How does this work with only credentials. Is there any parameter within System that sets this.

If the error is not related to proxy authentication, then what is the parameter for redirects

Title: Unable to make OkHttpClient call

Body:
I have a library in which request is happening. Library is using Okhttp-4.9.3. I dont have control on the client builder. When I checked the class file from the library below is the code

protected OkHttpClient getHttpClient() {
    if (okHttpClient == null) {
      okHttpClient = new OkHttpClient();
    }

    Authenticator proxyAuthenticator = (route, response) -> {
      String credential = Credentials.basic(System.getProperty(HTTP_PROXY_USER), System.getProperty(HTTP_PROXY_PASS));
      return response.request().newBuilder()
        .header(HEADER_PROXY_AUTH, credential)
        .build();
    };

    return okHttpClient.newBuilder()
      .addInterceptor(new RetryInterceptor(retryCount))
      .connectTimeout(timeout, timeoutUnit)
      .writeTimeout(timeout, timeoutUnit)
      .readTimeout(timeout, timeoutUnit)
      .proxyAuthenticator(proxyAuthenticator)
      .build();
  }

I set System.setProperty(HTTP_PROXY_USER, "TestUser"), System.setProperty(HTTP_PROXY_PASS, "TestPassword")

When I make the request, I am receiving 'java.net.ProtocolException: Too many follow-up requests: 21'

I have below questions. Any help or suggestions I would really appreciate it

It is not expecting proxyHostName and port. How does this work with only credentials. Is there any parameter within System that sets this.

If the error is not related to proxy authentication, then what is the parameter for redirects


问:
How does one initialize opam inside a Dockerfile?
I've created Docker images with opam before, but I don't know why this one is not working. I start from an image that already has opam, but that doesn't seem to work.

Dockerfile:

FROM continuumio/miniconda3
#FROM ocaml/opam:latest
FROM ruby:3.1.2

MAINTAINER Brando Miranda "brandojazz@gmail.com"

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    ssh \
    git \
    m4 \
    libgmp-dev \
    wget \
    ca-certificates \
    rsync \
    strace \
    gcc \
    rlwrap \
    sudo \
    lsb-release \
    opam
# RUN apt-get clean all

# - This most likely won't work. For now I don't have a solution for a Ruby on Docker container Ubuntu: https://stackoverflow.com/questions/74695464/why-cant-i-install-ruby-3-1-2-in-linux-docker-container?noredirect=1#comment131843536_74695464
#RUN apt-get install -y --no-install-recommends rbenv
#RUN apt-get install -y --no-install-recommends ruby-build
#RUN apt-get install -y --no-install-recommends ruby-full
#RUN rbenv install 3.1.2
#RUN rbenv global 3.1.2

# https://github.com/giampaolo/psutil/pull/2103

RUN useradd -m bot
# format for chpasswd user_name:password
RUN echo "bot:bot" | chpasswd
RUN adduser bot sudo

WORKDIR /home/bot
USER bot

ADD https://api.github.com/repos/IBM/pycoq/git/refs/heads/main version.json

# -- setup opam like VP's PyCoq
# https://stackoverflow.com/questions/74711264/how-does-one-initialize-opam-inside-a-dockerfile
RUN opam init --disable-sandboxing
```
<p>Error:</p>
<pre class="lang-none prettyprint-override"><code>(meta_learning) brandomiranda~/pycoq ❯ docker build -t brandojazz/pycoq:latest_arm .
[+] Building 8.6s (12/34)
 => [internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 3.56kB                                                                                0.0s
 => [internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [internal] load metadata for docker.io/library/ruby:3.1.2                                                                                0.0s
 => CACHED [stage-1  1/30] FROM docker.io/library/ruby:3.1.2                                                                                0.0s
 => CACHED https://api.github.com/repos/IBM/pycoq/git/refs/heads/main                                                                              0.0s
 => [stage-1  2/30] RUN apt-get update   && apt-get install -y --no-install-recommends     ssh     git     m4     libgmp-dev     wget     ca-cert  3.8s
 => [stage-1  3/30] RUN useradd -m bot                                                                                0.3s
 => [stage-1  4/30] RUN echo "bot:bot" | chpasswd                                                                                0.3s
 => [stage-1  5/30] RUN adduser bot sudo                                                                                0.3s
 => [stage-1  6/30] WORKDIR /home/bot                                                                                0.0s
 => [stage-1  7/30] ADD https://api.github.com/repos/IBM/pycoq/git/refs/heads/main version.json                                                    0.0s
 => ERROR [stage-1  8/30] RUN opam init --disable-sandboxing                                                                                3.7s
------
 > [stage-1  8/30] RUN opam init --disable-sandboxing:
#12 0.123 [NOTE] Will configure from built-in defaults.
#12 0.127 Checking for available remotes: rsync and local, git, mercurial.
#12 0.132   - you won't be able to use darcs repositories unless you install the darcs command on your system.
#12 0.132
#12 0.141
#12 0.141 <><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
#12 3.718 [ERROR] Could not update repository "default": Failed to extract archive /tmp/opam-7-6d07ae/index.tar.gz: "/bin/tar xfz /tmp/opam-7-6d07ae/index.tar.gz -C /home/bot/.opam/repo/default.new" exited with code 2
#12 3.718 [ERROR] Initial download of repository failed
------
executor failed running [/bin/sh -c opam init --disable-sandboxing]: exit code: 40
</code>```

How do I fix this?

Body:
I've created Docker images with opam before, but I don't know why this one is not working. I start from an image that already has opam, but that doesn't seem to work.

Dockerfile:

FROM continuumio/miniconda3
#FROM ocaml/opam:latest
FROM ruby:3.1.2

MAINTAINER Brando Miranda "brandojazz@gmail.com"

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    ssh \
    git \
    m4 \
    libgmp-dev \
    wget \
    ca-certificates \
    rsync \
    strace \
    gcc \
    rlwrap \
    sudo \
    lsb-release \
    opam
# RUN apt-get clean all

# - This most likely won't work. For now I don't have a solution for a Ruby on Docker container Ubuntu: https://stackoverflow.com/questions/74695464/why-cant-i-install-ruby-3-1-2-in-linux-docker-container?noredirect=1#comment131843536_74695464
#RUN apt-get install -y --no-install-recommends rbenv
#RUN apt-get install -y --no-install-recommends ruby-build
#RUN apt-get install -y --no-install-recommends ruby-full
#RUN rbenv install 3.1.2
#RUN rbenv global 3.1.2

# https://github.com/giampaolo/psutil/pull/2103

RUN useradd -m bot
# format for chpasswd user_name:password
RUN echo "bot:bot" | chpasswd
RUN adduser bot sudo

WORKDIR /home/bot
USER bot

ADD https://api.github.com/repos/IBM/pycoq/git/refs/heads/main version.json

# -- setup opam like VP's PyCoq
# https://stackoverflow.com/questions/74711264/how-does-one-initialize-opam-inside-a-dockerfile
RUN opam init --disable-sandboxing

Error:

(meta_learning) brandomiranda~/pycoq ❯ docker build -t brandojazz/pycoq:latest_arm .
[+] Building 8.6s (12/34)
 => [internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 3.56kB                                                                                0.0s
 => [internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [internal] load metadata for docker.io/library/ruby:3.1.2                                                                                0.0s
 => CACHED [stage-1  1/30] FROM docker.io/library/ruby:3.1.2                                                                                0.0s
 => CACHED https://api.github.com/repos/IBM/pycoq/git/refs/heads/main                                                                              0.0s
 => [stage-1  2/30] RUN apt-get update   && apt-get install -y --no-install-recommends     ssh     git     m4     libgmp-dev     wget     ca-cert  3.8s
 => [stage-1  3/30] RUN useradd -m bot                                                                                0.3s
 => [stage-1  4/30] RUN echo "bot:bot" | chpasswd                                                                                0.3s
 => [stage-1  5/30] RUN adduser bot sudo                                                                                0.3s
 => [stage-1  6/30] WORKDIR /home/bot                                                                                0.0s
 => [stage-1  7/30] ADD https://api.github.com/repos/IBM/pycoq/git/refs/heads/main version.json                                                    0.0s
 => ERROR [stage-1  8/30] RUN opam init --disable-sandboxing                                                                                3.7s
------
 > [stage-1  8/30] RUN opam init --disable-sandboxing:
#12 0.123 [NOTE] Will configure from built-in defaults.
#12 0.127 Checking for available remotes: rsync and local, git, mercurial.
#12 0.132   - you won't be able to use darcs repositories unless you install the darcs command on your system.
#12 0.132
#12 0.141
#12 0.141 <><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
#12 3.718 [ERROR] Could not update repository "default": Failed to extract archive /tmp/opam-7-6d07ae/index.tar.gz: "/bin/tar xfz /tmp/opam-7-6d07ae/index.tar.gz -C /home/bot/.opam/repo/default.new" exited with code 2
#12 3.718 [ERROR] Initial download of repository failed
------
executor failed running [/bin/sh -c opam init --disable-sandboxing]: exit code: 40

How do I fix this?


问:
Inventory transaction sum for each month
i have a table with detail transaction for lot. Lot are harvest and store before being ship.

Date     lot   transaction  qty

5 sept   3     store        300

8 sept   3     ship         -50

10 oct   3     ship         -20

15 nov   3     ship         -20

...

If i want the inventory for a specific moment, i simply sum between to date

I would like a query  that can give me a sum from store to a specific month throught the entirr year like:

Lot  sept  to oct  to nov ...

3    250    230     210   ...

Select  lot, sum(qty) from ... where (date > 1 sept and date < 1 oct) as sept, (date > 1 sept and date < 1 nov)... group by lot

I did'nt find anything or figure out how to do it i a simple query.

Regards

Obtain one table with a query  where is see the evolution of quantity over the year.


问:
Google Sheets Add-On - Show Side Bar Error
We recently published a google sheet add-on(Reviewed and approved by Google OAuthTeam & Workspace Team).

The add-on upon user action from a menu item - fetches data from a REST API. When the response from the REST API is 200 OK - launches the side bar.

This seems to be working at the time of development. But NOT working as add-on. The error that I see in the cloud logs is as follows.

Exception: You do not have access to perform that action. Please ask
the owner of this item to grant access to you.

```<code>  var html = HtmlService.createTemplateFromFile('dashboard').evaluate()
   .setTitle("Dashboard").setSandboxMode(HtmlService.SandboxMode.IFRAME);

    var ss =  SpreadsheetApp.getUi(); // Or DocumentApp or SlidesApp or FormApp.
    ss.showSidebar(html);
</code>```

It fails in the line ss.showSidebar(html);

"Test Deployment" as "Installed for current user", "Enabled in current
document", "Installed and Enabled" DID NOT throw any errors

I have seen an issue of similar kind reported in Issue Tracker here but that's pretty old. So not sure if that's still valid.

Any help/guidance on this subject would be very much appreciated.

This add-on is working on a Windows machine/Chrome browser

This add-on is working on a MacOS Catalina/Chrome browser

This add-on is NOT WORKING on a MacOS Monterey M1 Chip/Chrome browser

This add-on is working on a MacOS Monterey M1 Chip/Safari Browser with a strange behavoiur - Every Google Script that you call opens a new tab on the browser

Body:
We recently published a google sheet add-on(Reviewed and approved by Google OAuthTeam & Workspace Team).

The add-on upon user action from a menu item - fetches data from a REST API. When the response from the REST API is 200 OK - launches the side bar.

This seems to be working at the time of development. But NOT working as add-on. The error that I see in the cloud logs is as follows.

Exception: You do not have access to perform that action. Please ask
the owner of this item to grant access to you.

  var html = HtmlService.createTemplateFromFile('dashboard').evaluate()
   .setTitle("Dashboard").setSandboxMode(HtmlService.SandboxMode.IFRAME);

    var ss =  SpreadsheetApp.getUi(); // Or DocumentApp or SlidesApp or FormApp.
    ss.showSidebar(html);

It fails in the line ss.showSidebar(html);

"Test Deployment" as "Installed for current user", "Enabled in current
document", "Installed and Enabled" DID NOT throw any errors

I have seen an issue of similar kind reported in Issue Tracker here but that's pretty old. So not sure if that's still valid.

Any help/guidance on this subject would be very much appreciated.

This add-on is working on a Windows machine/Chrome browser

This add-on is working on a MacOS Catalina/Chrome browser

This add-on is NOT WORKING on a MacOS Monterey M1 Chip/Chrome browser

This add-on is working on a MacOS Monterey M1 Chip/Safari Browser with a strange behavoiur - Every Google Script that you call opens a new tab on the browser


问:
Why won't my code save object to local storage?
Trying to create a flashcard app with cards made using user input and then saved into local storage so it can be accessed even after refreshing.

```<code>const newBtn = document.getElementById("newBtn")

function getWordList() {
  return JSON.parse(localStorage.getItem("wordList") || "\[\]")
}

function saveWord(list) {
  localStorage.setItem("wordList", JSON.stringify(list));
}

function addWord() {
  let list = getWordList();

  const newWord = {
    id       : document.getElementById("english").value,
    english  : document.getElementById("english").value,
    japanese : document.getElementById("japanese").value
  };

  list.push(newWord);

  saveWord(list);
}

document.addEventListener('DOMContentLoaded', ()=\>{
  newBtn.addEventListener("click", addWord);
});
</code>```

User puts text in input field

Submit Button is Pressed

word list is accessed from local storage

inputs are used to create a new object

object is pushed into the word list

word list is then saved with the new object added

I feel like all of the pieces are there but i'm assembling it incorrectly.

Body:
Trying to create a flashcard app with cards made using user input and then saved into local storage so it can be accessed even after refreshing.

const newBtn = document.getElementById("newBtn")

function getWordList() {
  return JSON.parse(localStorage.getItem("wordList") || "\[\]")
}

function saveWord(list) {
  localStorage.setItem("wordList", JSON.stringify(list));
}

function addWord() {
  let list = getWordList();

  const newWord = {
    id       : document.getElementById("english").value,
    english  : document.getElementById("english").value,
    japanese : document.getElementById("japanese").value
  };

  list.push(newWord);

  saveWord(list);
}

document.addEventListener('DOMContentLoaded', ()=\>{
  newBtn.addEventListener("click", addWord);
});

User puts text in input field

Submit Button is Pressed

word list is accessed from local storage

inputs are used to create a new object

object is pushed into the word list

word list is then saved with the new object added

I feel like all of the pieces are there but i'm assembling it incorrectly.


问:
Crashyltics CFR for a time range is lower than the lowest dip in that range
Whenever the CFR goes down 98% we need to make a 30 days report and show it to elders at work. This is the first time I am doing this report.

I noticed the lowest dip was 97.93 and yet the CFR for last 30 days is 96.35. Please see the image.

I read that this (here) figure is aggregation over time and the formula used is

CRASH_FREE_USERS_PERCENTAGE = 1 - (CRASHED_USERS / ALL_USERS) x 100

Question in context: For the last 30 days range, If the lowest dip is 97.93%. Then how come CFR is 96.35% for that range.


问:
AMAZON SES unable to send email to forward only email addresses
I have setup Amazon SES to work with keycloak.  SES is sending out email verification correctly upon signups.

However, if a user  uses a forward-only-email-address  while  registering,  SES does not send the verification email. Instead  admin (From address) gets an email from

MAILER-DAEMON@us-east-2.amazonses.com

to  From account

Does SES require  special setup  for sending out email to a forward-only-email-address (email address that  does not have  actual mailbox associated with)


问:
How to run/execute a script saved from a subprocess in python?
I am using Databricks and making a connection with Shell Scripts to my github Repo. I am trying to mimic the same folders/files on the repo onto my Databricks so that it is dynamic as possible. I am taking each Script/Data from the Github repo and pulling that into my Databricks notebook and saving each as a variable. My question is once I have this file/data saved to a variable how can I execute the python script?

Currently my code looks something like this:

```<code>%sh git clone github.com/some-repo.git
cd folder/file
import subprocess as sp
some_file = sp.getoutput('cat ./some-script.py;)

print(some_file)
>>> def hell()
>>>    print("hello world!")
</code>```

Also if there is a better way to do this please feel free to recommend.
Thank you

Body:
I am using Databricks and making a connection with Shell Scripts to my github Repo. I am trying to mimic the same folders/files on the repo onto my Databricks so that it is dynamic as possible. I am taking each Script/Data from the Github repo and pulling that into my Databricks notebook and saving each as a variable. My question is once I have this file/data saved to a variable how can I execute the python script?

Currently my code looks something like this:

%sh git clone github.com/some-repo.git
cd folder/file
import subprocess as sp
some_file = sp.getoutput('cat ./some-script.py;)

print(some_file)
>>> def hell()
>>>    print("hello world!")

Also if there is a better way to do this please feel free to recommend.
Thank you


问:
how to import file name / line numbers when using IDApython?
When I use the UI of IDA to load a binary file with debug info, a window which prints "DWARF info found" will come out and I can choose "Import file names/line numbers" to present the correponding source lines of certain addresses.

However, I find when I using command line to run ida like "idat64 -A -S'script' binary_name", idat64 would not load the DWARF without specific setting.

I tried to find possible setting to load the DWARF infos but failed. Could someone help me solve this problem?

I want to use

```<code>ida_nalt.get_source_linnum
</code>```

and

```<code>ida_lines.get_sourcefile
</code>```

to export the address-to-line mapping informations.

However, without loading the DWARF info, running the scripts will only print invalid results.

Body:
When I use the UI of IDA to load a binary file with debug info, a window which prints "DWARF info found" will come out and I can choose "Import file names/line numbers" to present the correponding source lines of certain addresses.

However, I find when I using command line to run ida like "idat64 -A -S'script' binary_name", idat64 would not load the DWARF without specific setting.

I tried to find possible setting to load the DWARF infos but failed. Could someone help me solve this problem?

I want to use

ida_nalt.get_source_linnum

and

ida_lines.get_sourcefile

to export the address-to-line mapping informations.

However, without loading the DWARF info, running the scripts will only print invalid results.


问:
Is it possible to render 1-2 thousand images in Flutter?
I am using Flutter to develop a game. I would like to display 1-2 thousand small images that can move (via a AnimatedPositioned widget for example) on the screen. The resolution will be very low of each individual image of course. I'm unsure if Fluttter has a feature or is able to handle such a feature and would like to know if it's possible, and if so, best method to get there.

I've tried displaying 1000 images using Image.asset('my_image.PNG') in a GridView.builder(), using the profiler, my emulator was only able to achieve 6fps average.