问:
2 pagination for 2 tabs on a page
From HTML to Wordpress, I made a page with 2 tab as below.

NEWS and EVENT tab

Each NEWS and EVENT will show the posts for its own category, then I inserted pagination.
I click on "Page 2" on NEWS tab, then click EVENT tab, it also takes EVENT to Page 2 (EVENT should be Page 1 by default)...I Hope each one has its own pagination.
I searched for Multiple Custom Loop in One Page with Pagination in many places but the advices quite different to my case.

Is there any way to fix it? Thank all in advanced!

page-news.php

```<code><section id="news"\>
<div class="container"\>
<div class="warpper"\>
<input class="radio" id="one" name="group" type="radio" checked\>
<input class="radio" id="two" name="group" type="radio"\>

      <div class="tabs">
        <label class="tab" id="one-tab" for="one">NEWS</label>
        <label class="tab" id="two-tab" for="two">EVENT</label>
      </div>

      <div class="panels">

        <!-- NEWS -->
        <div class="panel" id="one-panel">
          <?php
          $my_query1 = new WP_Query(

            array(
              'post_type' => 'post',
              'paged' => $paged,
              'posts_per_page' => 3,
              'category_name' => 'news',
            )
          );

          if ($my_query1->have_posts()):
            echo '<ul>';
            while ($my_query1->have_posts()):
              $my_query1->the_post();
          ?>
          <li>
            <a href="<?php the_permalink(); ?>">
              <?php the_title(); ?><br>
              <?php the_time('Y.m.d') ?><br>
              <?php the_post_thumbnail(); ?>
            </a>
          </li><br>

          <?php
            endwhile;
            echo '</ul>';
            my_paginate($my_query1);
            wp_reset_postdata();
          endif;
          ?>
        </div>

        <!-- EVENT -->
        <div class="panel" id="two-panel">
          <?php
          $my_query2 = new WP_Query(
            array(
              'post_type' => 'post',
              'paged' => $paged,
              'posts_per_page' => 3,
              'category_name' => 'event',
            )
          );

          if ($my_query2->have_posts()):
            echo '<ul>';
            while ($my_query2->have_posts()):
              $my_query2->the_post();
          ?>
          <li>
            <a href="<?php the_permalink(); ?>">
              <?php the_title(); ?><br>
              <?php the_time('Y.m.d') ?><br>
              <?php the_post_thumbnail(); ?>
            </a>
          </li><br>

          <?php
            endwhile;
            echo '</ul>';
            my_paginate($my_query2);
            wp_reset_postdata();
          endif;
          ?>
        </div>

      </div>
    </div>

</div\>
</section\>
</code>```

Functions.php

```<code>function my_paginate($query_name = '')
{
  $settings = array(
    'side_range' => 3,
    // 現在ページの左右の表示数.
    'txt_prev' => '<',
    // 一つ戻るテキスト.
    'txt_next' => '>',
    // 一つ進むテキスト.
    'txt_first' => '|<',
    // 最初へ移動テキスト.
    'txt_last' => '>|', // 最後へ移動テキスト.

  );

  if ('' !== $query_name) {
    $query = $query_name;
  } else {
    global $paged, $wp_query;
    $query = $wp_query;
  }
  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  $showitems = ($settings['side_range'] * 2) + 1;
  $pages = $query->max_num_pages;

  if (1 !== $pages) {
    echo "<div class=\"pagination\">\n";
    echo "  <ul class=\"pagination__list\">\n";
    for ($i = 1; $i <= $pages; $i++) {
      if (1 !== $pages && (!($i >= $paged + $settings['side_range'] + 1 || $i <= $paged - $settings['side_range'] - 1) || $pages <= $showitems)) {
        echo ($paged === $i) ?
          '    <li class="pagination__item--current">' . esc_html($i) . "</li>\n" :
          '    <li class="pagination__item"><a href="' . esc_url(get_pagenum_link($i)) . '">' . esc_html($i) . "</a></li>\n";
      }
    }
    echo "  </ul>\n";
    echo '  <p class="pagination__pos">Page ' . esc_html($paged) . '/' . esc_html($pages) . "</p>\n";
    if ($paged > 2 && $paged > $settings['side_range'] + 1 && $showitems < $pages) {
      echo '  <a class="pagination__btn--first" href="' . esc_url(get_pagenum_link(1)) . '">' . esc_html($settings['txt_first']) . "</a>\n";
    }
    if ($paged > 1) {
      echo '  <a class="pagination__btn--prev" href="' . esc_url(get_pagenum_link($paged - 1)) . '">' . esc_html($settings['txt_prev']) . "</a>\n";
    }
    if ($paged < $pages) {
      echo '  <a class="pagination__btn--next" href="' . esc_url(get_pagenum_link($paged + 1)) . '">' . esc_html($settings['txt_next']) . "</a>\n";
    }
    if ($paged < $pages - 1 && $paged + $settings['side_range'] - 1 < $pages && $showitems < $pages) {
      echo '  <a class="pagination__btn--last" href="' . esc_url(get_pagenum_link($pages)) . '">' . esc_html($settings['txt_last']) . "</a>\n";
    }
    echo "</div>\n";
  }
}
</code>```

Title: 2 pagination for 2 tabs on a page

Body:
From HTML to Wordpress, I made a page with 2 tab as below.

NEWS and EVENT tab

Each NEWS and EVENT will show the posts for its own category, then I inserted pagination.
I click on "Page 2" on NEWS tab, then click EVENT tab, it also takes EVENT to Page 2 (EVENT should be Page 1 by default)...I Hope each one has its own pagination.
I searched for Multiple Custom Loop in One Page with Pagination in many places but the advices quite different to my case.

Is there any way to fix it? Thank all in advanced!

page-news.php

<input class="radio" id="one" name="group" type="radio" checked\>
<input class="radio" id="two" name="group" type="radio"\>

        NEWS
        EVENT

          <?php
          $my_query1 = new WP_Query(

            array(
              'post_type' => 'post',
              'paged' => $paged,
              'posts_per_page' => 3,
              'category_name' => 'news',
            )
          );

          if ($my_query1->have_posts()):
            echo '
';
            while ($my_query1->have_posts()):
              $my_query1->the_post();
          ?>

            <a href="<?php the_permalink(); ?>">
              <?php the_title(); ?>

              <?php the_time('Y.m.d') ?>

              <?php the_post_thumbnail(); ?>

          <?php
            endwhile;
            echo '
';
            my_paginate($my_query1);
            wp_reset_postdata();
          endif;
          ?>

          <?php
          $my_query2 = new WP_Query(
            array(
              'post_type' => 'post',
              'paged' => $paged,
              'posts_per_page' => 3,
              'category_name' => 'event',
            )
          );

          if ($my_query2->have_posts()):
            echo '
';
            while ($my_query2->have_posts()):
              $my_query2->the_post();
          ?>

            <a href="<?php the_permalink(); ?>">
              <?php the_title(); ?>

              <?php the_time('Y.m.d') ?>

              <?php the_post_thumbnail(); ?>

          <?php
            endwhile;
            echo '
';
            my_paginate($my_query2);
            wp_reset_postdata();
          endif;
          ?>

Functions.php

function my_paginate($query_name = '')
{
  $settings = array(
    'side_range' => 3,
    // 現在ページの左右の表示数.
    'txt_prev' => '<',
    // 一つ戻るテキスト.
    'txt_next' => '>',
    // 一つ進むテキスト.
    'txt_first' => '|<',
    // 最初へ移動テキスト.
    'txt_last' => '>|', // 最後へ移動テキスト.

  );

  if ('' !== $query_name) {
    $query = $query_name;
  } else {
    global $paged, $wp_query;
    $query = $wp_query;
  }
  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  $showitems = ($settings['side_range'] * 2) + 1;
  $pages = $query->max_num_pages;

  if (1 !== $pages) {
    echo "
\n";
    echo "
\n";
    for ($i = 1; $i <= $pages; $i++) {
      if (1 !== $pages && (!($i >= $paged + $settings['side_range'] + 1 || $i <= $paged - $settings['side_range'] - 1) || $pages <= $showitems)) {
        echo ($paged === $i) ?
          '
' . esc_html($i) . "
\n" :
          '
' . esc_html($i) . "
\n";
      }
    }
    echo "
\n";
    echo '
Page ' . esc_html($paged) . '/' . esc_html($pages) . "
\n";
    if ($paged > 2 && $paged > $settings['side_range'] + 1 && $showitems < $pages) {
      echo '  ' . esc_html($settings['txt_first']) . "\n";
    }
    if ($paged > 1) {
      echo '  ' . esc_html($settings['txt_prev']) . "\n";
    }
    if ($paged < $pages) {
      echo '  ' . esc_html($settings['txt_next']) . "\n";
    }
    if ($paged < $pages - 1 && $paged + $settings['side_range'] - 1 < $pages && $showitems < $pages) {
      echo '  ' . esc_html($settings['txt_last']) . "\n";
    }
    echo "
\n";
  }
}


来源: stackexchange

问:
Adding GitHub Team and Repo Admins to Repos Created From Template
I have a couple questions related to GitHub template repositories.  My team regularly creates repositories from a GitHub template repository.  We also have a GitHub team and like to add all of our repositories to our team.

My questions are:

Anytime a new repository is created from our template repository, how can it be automatically added to our GitHub team's list of repositories?

Anytime a new repository is created from our template repository, how can myself (and someone else) automatically be made admins of this new repository (even if we didn't create the repository)?

I've searched all over documentation and Stack Overflow for possible solutions but came up empty handed.  I've looked into using CODEOWNER files which might be useful, but don't look like they're designed for this use case.  I've also looked into creating new repositories from the GitHub CLI using the template repository and maybe a shell script to add it to our GitHub team, but was hoping for a simpler solution.

Thanks for any thoughts or suggestions!

ContentLicense: CC BY-SA 4.0


问:
How to Convert a Map Image to Interactive Map using QGIS
How do I convert a map of subdivided lots into an Interactive Map using QGIS to be used in Python Program to record owners, lot details and other details?

Image:


问:
log4j version on servicemix7.0.1
I'm having a problem learning to upgrade to log4j2. Before, I used log4j 1 with apache servicemix 6.1.2, when I upgraded to log4j 2, I got an incompatibility error. I am learning to run the application on apache servicemix 7.0.1 to get the latest version of log4j2 .

I have read the document but do not understand which version of servicemix 7.0.1 uses log4j. Can anyone help me?

Title: log4j version on servicemix7.0.1


问:
How to convey revision to text?
Markdown uses the "strikethrough" notation to indicate removed text, but how to show added text?

I would like to accomplish something similar in markdown, that is, to inform the reader how the text has been revised.

I would like to know if this is at all possible, and how is this problem solved in some existing applications. I'm looking to select an documentation publishing application (like Hugo/Docusausus/Gatsby, etc) to publish some documentation, and the ability to display revisions, inline is a must have feature. I'm willing to do some development, but if this wheel has already been invented, that's what I'm after. Has this wheel already been invented in markdown? How?

In the example above, shown from OpenOffice with revisions recorded and shown, it is clear that the wording "replacement text here" is a revision to the previous content "consectetur adipiscing elit".

OpenOffice uses a combination of text color, underline and strikethrough, and a vertical line to the left of the text to convey a revision.

The added text could be emphasized with bold or italics, but it seems inappropriate to add emphasis where none was intended by the author of the revision.

The question Get underlined text with Markdown suggests underlining with  or  which reportedly works in some places like githhub and jupyter notebooks, but I'm curious if there is a better way.

Also, the documentation at https://daringfireball.net/projects/markdown/syntax#html indicates that the html elements  and  for inserted and deleted, respectively, are supported in any markdown flavor; together, and possibly combined with some CSS to show color, come close to the word-processor way of showing revisioning.

Title: How to convey revision to text?


问:
Can't get SharePoint Administrators Group using Set-SPOUser
I want to get SharePoint Administrators Group using Get-SPOUser.

I verified it. As a result, I was able to get SharePoint Administrators Group in a certain Tenant.
But I was not able to get SharePoint Administrators Group in a other Tenant.
"https://XXX-admin.sharepoint.com/" is set to site parameter of Get-SPOUser.

Do you know why there is a cause?


问:
Using Devise_invitable
I am the beginner and I am confused about the devise_invitable. I have two users i.e. Admin and User, and Admin model is created and implemented with the devise_invitable.Then I just want to add user model with devise_invitable that will be created by admin.Is there any documentations or advice?

I'm confused about the User model.

Title: Using Devise_invitable


问:
No matching function for emplace upon adding a pair with std::hash
I am using a pair as a key with std::hash, but running into an error upon emplace() where it can't match the function. Nothing stands out to me by just looking at it. Anyone?

error: no matching member function for call to 'emplace'

```<code>class A
{
    using Pair = std::pair<std::string_view, std::string_view>;
    using MsrPairHash = std::hash<Pair>;
    std::unordered_map<Pair, std::shared_ptr<A>, MsrPairHash> mp;

public:
    void foo(std::string_view a, std::string_view b, std::shared_ptr<A> ptr)
    {
        mp.emplace({a, b}, std::move(ptr));
    }
};
</code>```

Body:
I am using a pair as a key with std::hash, but running into an error upon emplace() where it can't match the function. Nothing stands out to me by just looking at it. Anyone?

error: no matching member function for call to 'emplace'

class A
{
    using Pair = std::pair<std::string_view, std::string_view>;
    using MsrPairHash = std::hash<Pair>;
    std::unordered_map<Pair, std::shared_ptr, MsrPairHash> mp;

public:
    void foo(std::string_view a, std::string_view b, std::shared_ptr ptr)
    {
        mp.emplace({a, b}, std::move(ptr));
    }
};


问:
Python multithreading requests from proxy list
I've got this piece of code threading multiple requests at a time, which works as I need.

```<code>from threading import Thread
import requests

THREAD_COUNT = 6

def callback():
    try:
        r = requests.get('http://whatever')
        print(r)
    except KeyboardInterrupt:
        return

if __name__ == '__main__':
    threads = []
    for i in range(THREAD_COUNT):
        t = Thread(target=callback)
        threads.append(t)
        t.start()

    for t in threads:
        t.join()
</code>```

I am trying to figure out how to load proxy IPs from my text file to make multiple requests, but only one request per IP address. For example I got 20 IPs in my list so it should be 20 requests. I can't figure out how to thread it with my code above. Currently I can only achieve this without threading, where its read line by line, but that's not ideal.

```<code>with open("list_proxy.txt", "r") as file:
    data = file.read()

data_into_list = data.split("\n")
print(data_into_list)
</code>```

Body:
I've got this piece of code threading multiple requests at a time, which works as I need.

from threading import Thread
import requests

THREAD_COUNT = 6

def callback():
    try:
        r = requests.get('http://whatever')
        print(r)
    except KeyboardInterrupt:
        return

if __name__ == '__main__':
    threads = []
    for i in range(THREAD_COUNT):
        t = Thread(target=callback)
        threads.append(t)
        t.start()

    for t in threads:
        t.join()

I am trying to figure out how to load proxy IPs from my text file to make multiple requests, but only one request per IP address. For example I got 20 IPs in my list so it should be 20 requests. I can't figure out how to thread it with my code above. Currently I can only achieve this without threading, where its read line by line, but that's not ideal.

with open("list_proxy.txt", "r") as file:
    data = file.read()

data_into_list = data.split("\n")
print(data_into_list)


问:
Error While Pllotting over globe using matplotlib and contourf
I was trying to plot some data over the entire globe using geostationary projection. However, I got the following error. It seems to have some issues with the border areas. I am currently new to python and unable to figure out the same.

```<code>import h5py
import sys
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature

# First get data from HDF5 file with h5py:
fn = '..../3DIMG_03MAY2019_0230_L1B_STD_V01R00.h5'

with h5py.File(fn) as f:
    # retrieve image data:
    image = 'IMG_TIR1'
    image2 = 'IMG_TIR2'
    lon = f['Longitude'][:]*0.01
    lat = f['Latitude'][:]*0.01
    img_arr = f[image][0, :, :]
    img_arr2 = f[image2][0, :, :]

    # get _FillValue for data masking
    img_arr_fill = f[image].attrs['_FillValue'][0]
    img_arr_fill2 = f[image2].attrs['_FillValue'][0]

    sat_long = f.attrs['Nominal_Central_Point_Coordinates(degrees)_Latitude_Longitude'][1]
    sat_hght = f.attrs['Nominal_Altitude(km)'][0] * 1000.0  # (for meters)
    bt_lut_tir1 = np.array(f[image+str('_TEMP')])
    bt_lut_tir2 = np.array(f[image2+str('_TEMP')])
print('Done reading HDF5 file')

# Use np.ma.masked_equal with integer values to
# mask '_FillValue' data in corners:
img_arr_m = np.ma.masked_equal(img_arr, img_arr_fill)
img_arr_m2 = np.ma.masked_equal(img_arr2, img_arr_fill2)
lon_m = np.ma.masked_equal(lon, 327.67)
lat_m = np.ma.masked_equal(lat, 327.67)

# BT from LUT
def count2bt_lut_tir1(count):
    return bt_lut_tir1[count]
def count2bt_lut_tir2(count):
    return bt_lut_tir2[count]
bt_tir1_lut = count2bt_lut_tir1(img_arr_m)
bt_tir2_lut = count2bt_lut_tir2(img_arr_m2)

######### Plotting
# # Create Geostationary plot with cartopy and matplotlib

map_proj = ccrs.Geostationary(central_longitude=sat_long,satellite_height=sat_hght)

ax = plt.axes(projection=map_proj)
ax.set_global()
ax.coastlines(color='black',linewidth = 0.5)
ax.add_feature(cfeature.BORDERS, edgecolor='white', linewidth=0.25)
ax.add_feature(cfeature.STATES,edgecolor = 'red',linewidth = 0.5)
ax.gridlines(color='black', alpha=0.5, linestyle='--', linewidth=0.75, draw_labels=True)
plt.title('Brightness Temperature(K) in TIR1 (10.8 micron)') #\n' +
cb = ax.contourf(lon_m,lat_m,bt_tir1_lut,cmap = 'jet',transform = ccrs.PlateCarree())
plt.colorbar(cb)
plt.show()
</code>```

I got the following error while running the above code:

```<code>---------------------
PredicateError                            Traceback (most recent call last)
File ~/anaconda3/envs/rttov/lib/python3.9/site-packages/shapely/predicates.py:15, in BinaryPredicate.__call__(self, this, other, *args)
     14 try:
---> 15     return self.fn(this._geom, other._geom, *args)
     16 except PredicateError as err:
     17     # Dig deeper into causes of errors.

File ~/anaconda3/envs/rttov/lib/python3.9/site-packages/shapely/geos.py:584, in errcheck_predicate(result, func, argtuple)
    583 if result == 2:
--> 584     raise PredicateError("Failed to evaluate %s" % repr(func))
    585 return result

PredicateError: Failed to evaluate <_FuncPtr object at 0x7fb67e380f40>

During handling of the above exception, another exception occurred:

TopologicalError                          Traceback (most recent call last)
File ~/anaconda3/envs/rttov/lib/python3.9/site-packages/IPython/core/formatters.py:339, in BaseFormatter.__call__(self, obj)
    337     pass
    338 else:
--> 339     return printer(obj)
    340 # Finally look for special method names
    341 method = get_real_method(obj, self.print_method)
...
     37             "Likely cause is invalidity of the geometry %s" % (
     38                 self.fn.__name__, repr(geom)))
     39 raise err

TopologicalError: The operation 'GEOSContains_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7fb5c0ae45b0>

</code>```

I am attaching the HDF file I have used for plotting.
https://drive.google.com/file/d/16LX6wErokHjS9nc4EBepLgLEB1sqCgQK/view?usp=sharing

Body:
I was trying to plot some data over the entire globe using geostationary projection. However, I got the following error. It seems to have some issues with the border areas. I am currently new to python and unable to figure out the same.

import h5py
import sys
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature

# First get data from HDF5 file with h5py:
fn = '..../3DIMG_03MAY2019_0230_L1B_STD_V01R00.h5'

with h5py.File(fn) as f:
    # retrieve image data:
    image = 'IMG_TIR1'
    image2 = 'IMG_TIR2'
    lon = f['Longitude'][:]*0.01
    lat = f['Latitude'][:]*0.01
    img_arr = f[image][0, :, :]
    img_arr2 = f[image2][0, :, :]

    # get _FillValue for data masking
    img_arr_fill = f[image].attrs['_FillValue'][0]
    img_arr_fill2 = f[image2].attrs['_FillValue'][0]

    sat_long = f.attrs['Nominal_Central_Point_Coordinates(degrees)_Latitude_Longitude'][1]
    sat_hght = f.attrs['Nominal_Altitude(km)'][0] * 1000.0  # (for meters)
    bt_lut_tir1 = np.array(f[image+str('_TEMP')])
    bt_lut_tir2 = np.array(f[image2+str('_TEMP')])
print('Done reading HDF5 file')

# Use np.ma.masked_equal with integer values to
# mask '_FillValue' data in corners:
img_arr_m = np.ma.masked_equal(img_arr, img_arr_fill)
img_arr_m2 = np.ma.masked_equal(img_arr2, img_arr_fill2)
lon_m = np.ma.masked_equal(lon, 327.67)
lat_m = np.ma.masked_equal(lat, 327.67)

# BT from LUT
def count2bt_lut_tir1(count):
    return bt_lut_tir1[count]
def count2bt_lut_tir2(count):
    return bt_lut_tir2[count]
bt_tir1_lut = count2bt_lut_tir1(img_arr_m)
bt_tir2_lut = count2bt_lut_tir2(img_arr_m2)

######### Plotting
# # Create Geostationary plot with cartopy and matplotlib

map_proj = ccrs.Geostationary(central_longitude=sat_long,satellite_height=sat_hght)

ax = plt.axes(projection=map_proj)
ax.set_global()
ax.coastlines(color='black',linewidth = 0.5)
ax.add_feature(cfeature.BORDERS, edgecolor='white', linewidth=0.25)
ax.add_feature(cfeature.STATES,edgecolor = 'red',linewidth = 0.5)
ax.gridlines(color='black', alpha=0.5, linestyle='--', linewidth=0.75, draw_labels=True)
plt.title('Brightness Temperature(K) in TIR1 (10.8 micron)') #\n' +
cb = ax.contourf(lon_m,lat_m,bt_tir1_lut,cmap = 'jet',transform = ccrs.PlateCarree())
plt.colorbar(cb)
plt.show()

I got the following error while running the above code:

---------------------
PredicateError                            Traceback (most recent call last)
File ~/anaconda3/envs/rttov/lib/python3.9/site-packages/shapely/predicates.py:15, in BinaryPredicate.__call__(self, this, other, *args)
     14 try:
---> 15     return self.fn(this._geom, other._geom, *args)
     16 except PredicateError as err:
     17     # Dig deeper into causes of errors.

File ~/anaconda3/envs/rttov/lib/python3.9/site-packages/shapely/geos.py:584, in errcheck_predicate(result, func, argtuple)
    583 if result == 2:
--> 584     raise PredicateError("Failed to evaluate %s" % repr(func))
    585 return result

PredicateError: Failed to evaluate <_FuncPtr object at 0x7fb67e380f40>

During handling of the above exception, another exception occurred:

TopologicalError                          Traceback (most recent call last)
File ~/anaconda3/envs/rttov/lib/python3.9/site-packages/IPython/core/formatters.py:339, in BaseFormatter.__call__(self, obj)
    337     pass
    338 else:
--> 339     return printer(obj)
    340 # Finally look for special method names
    341 method = get_real_method(obj, self.print_method)
...
     37             "Likely cause is invalidity of the geometry %s" % (
     38                 self.fn.__name__, repr(geom)))
     39 raise err

TopologicalError: The operation 'GEOSContains_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x7fb5c0ae45b0>

I am attaching the HDF file I have used for plotting.
https://drive.google.com/file/d/16LX6wErokHjS9nc4EBepLgLEB1sqCgQK/view?usp=sharing


问:
Which system call macro to use
There are some Linux system calls (e.g., gettid) which have no glibc wrapper and thus must be invoked via the syscall function.

Looking in /usr/include/x86_64-linux-gnu/bits/syscall.h, I see definitions like

#ifdef __NR_gettid
# define SYS_gettid __NR_gettid
#endif
```

What is the reason for two aliases for the same system call number?  Is one more portable/stable?  I guess my question boils down to: Which macro should I be using in my code?

Title: Which system call macro to use

Body:
There are some Linux system calls (e.g., gettid) which have no glibc wrapper and thus must be invoked via the syscall function.

Looking in /usr/include/x86_64-linux-gnu/bits/syscall.h, I see definitions like

#ifdef __NR_gettid
# define SYS_gettid __NR_gettid
#endif

What is the reason for two aliases for the same system call number?  Is one more portable/stable?  I guess my question boils down to: Which macro should I be using in my code?


问:
How to prevent selected Camel headers being mapped onto HTTP headers
I want to enrich a Camel exchange with content fetched from some external web service. However, when calling that service, I do not want all the headers on my incoming exchange to be mapped onto HTTP headers, just some selected ones should be mapped. Hence, I try to use a HeaderFilteringStrategy as follows:

    override fun configure() {
        from(direct("webservice-query"))
            .setHeader("Accept").constant("application/json")
            .setHeader(Exchange.HTTP_PATH)
            .simple("/partner:\${header.$PARTNER_ID_HEADER}")
            .setHeader(Exchange.HTTP_QUERY).constant("attachments=true")
            .enrich(http(partnerDbUrl)
                     .headerFilterStrategy(myHeaderFilterStrategy)
                     .httpMethod(HttpMethods.GET), PartnerAggregationStrategy
                    )
    }
```

where myHeaderFilterStrategy is an instance of a custom HeaderFilteringStrategy. However, the HTTP component does not use this strategy. Instead, a default HttpHeaderFilteringStrategy is used. Why? What is wrong with the above route configuration? How can I set a custom header filtering strategy, or otherwise prevent unwanted headers polluting the HTTP request?

Body:
I want to enrich a Camel exchange with content fetched from some external web service. However, when calling that service, I do not want all the headers on my incoming exchange to be mapped onto HTTP headers, just some selected ones should be mapped. Hence, I try to use a HeaderFilteringStrategy as follows:

    override fun configure() {
        from(direct("webservice-query"))
            .setHeader("Accept").constant("application/json")
            .setHeader(Exchange.HTTP_PATH)
            .simple("/partner:\${header.$PARTNER_ID_HEADER}")
            .setHeader(Exchange.HTTP_QUERY).constant("attachments=true")
            .enrich(http(partnerDbUrl)
                     .headerFilterStrategy(myHeaderFilterStrategy)
                     .httpMethod(HttpMethods.GET), PartnerAggregationStrategy
                    )
    }

where myHeaderFilterStrategy is an instance of a custom HeaderFilteringStrategy. However, the HTTP component does not use this strategy. Instead, a default HttpHeaderFilteringStrategy is used. Why? What is wrong with the above route configuration? How can I set a custom header filtering strategy, or otherwise prevent unwanted headers polluting the HTTP request?


问:
C# TcpListener vs TcpChannel
I'm trying to implement an application that will allow other applications to connect and send messages over TCP.  I've come across two classes, TcpListener and TcpServerChannel, that appear to accomplish what I'm looking to do.  However I'm not seeing any real benefits to one vs the other with the one exception that the TcpServerChannel class is only available in .Net Framework where TcpListener is available in the most recent versions of .Net core as well as .Net Framework

Can anyone explain to me what the difference is between the TcpListener Class and the TcpServerChannel Class?

Title: C# TcpListener vs TcpChannel


问:
Laravel App on Azure redirects to myweb.scm.azurewebsites.net/route
I have a free azure App service that has all the laravel project files inside of wwwroot.

i have updated the APP_URL to https://myweb.azurewebsites.net/ and also in the app.php just to be on the safe side.

The App is able to load the welcome page on https://myweb.azurewebsites.net/ but once i go to /home it redirects to https://myweb.scm.azurewebsites.net/home. I need assistance on why its redirecting to https://myweb.scm.azurewebsites.net/home and not https://myweb.azurewebsites.net/home?

Im thinking its something to do with my default config below. I am very new to nginx.

Below is my default for nginx

```<code>server {
#proxy_cache cache;
    #proxy_cache_valid 200 1s;
listen 8080;
listen [::]:8080;
root /home/site/wwwroot/public;
index  index.php index.html index.htm;
server_name  myweb.azurewebsites.net www.myweb.azurewebsites.net;
port_in_redirect off;

location / {
    try_files $uri $uri/ /index.php?$args;
}

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /html/;
}

# Disable .git directory
location ~ /\.git {
    deny all;
    access_log off;
    log_not_found off;

# Add locations of phpmyadmin here.
location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
    fastcgi_pass 127.0.0.1:9000;
    include fastcgi_params;
    fastcgi_param HTTP_PROXY "";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_intercept_errors on;
    fastcgi_connect_timeout         300;
    fastcgi_send_timeout           3600;
    fastcgi_read_timeout           3600;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 4 256k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
}
</code>```

}

Body:
I have a free azure App service that has all the laravel project files inside of wwwroot.

i have updated the APP_URL to https://myweb.azurewebsites.net/ and also in the app.php just to be on the safe side.

The App is able to load the welcome page on https://myweb.azurewebsites.net/ but once i go to /home it redirects to https://myweb.scm.azurewebsites.net/home. I need assistance on why its redirecting to https://myweb.scm.azurewebsites.net/home and not https://myweb.azurewebsites.net/home?

Im thinking its something to do with my default config below. I am very new to nginx.

Below is my default for nginx

server {
#proxy_cache cache;
    #proxy_cache_valid 200 1s;
listen 8080;
listen [::]:8080;
root /home/site/wwwroot/public;
index  index.php index.html index.htm;
server_name  myweb.azurewebsites.net www.myweb.azurewebsites.net;
port_in_redirect off;

location / {
    try_files $uri $uri/ /index.php?$args;
}

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /html/;
}

# Disable .git directory
location ~ /\.git {
    deny all;
    access_log off;
    log_not_found off;

# Add locations of phpmyadmin here.
location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
    fastcgi_pass 127.0.0.1:9000;
    include fastcgi_params;
    fastcgi_param HTTP_PROXY "";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_intercept_errors on;
    fastcgi_connect_timeout         300;
    fastcgi_send_timeout           3600;
    fastcgi_read_timeout           3600;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 4 256k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
}

}


问:
Android in-app-billing not working on Wear OS, only on the phone
When installed directly on a phone the app works well. However, on a wearable "onPurchasesUpdated" is not called after the purchase was completed through the phone, so the purchase cannot be acknowledged.

Also "queryPurchases" always only returns an empty list, even though a purchase was made on the phone. "queryPurchaseHistory" shows the purchase, but cannot be used to acknowledge.
"onPurchasesUpdated" is only called when the process is cancelled on the wearable side.

```<code>billingClient = BillingClient.newBuilder(application)
    .setListener(this).enablePendingPurchases().build();
//only called when cancelled on wearable, never when cancel/complete on phone
@Override
public void onPurchasesUpdated(@NonNull BillingResult billingResult,
    @Nullable List<Purchase> list) {
    ...
}
</code>```

I tried billing:5.1.0 & 4.1.0, license tester account, 2 different phones and 3 different watches.
Even Googles sample code "TrivialTestDrive" shows the same issue here.
What could I be missing?

Body:
When installed directly on a phone the app works well. However, on a wearable "onPurchasesUpdated" is not called after the purchase was completed through the phone, so the purchase cannot be acknowledged.

Also "queryPurchases" always only returns an empty list, even though a purchase was made on the phone. "queryPurchaseHistory" shows the purchase, but cannot be used to acknowledge.
"onPurchasesUpdated" is only called when the process is cancelled on the wearable side.

billingClient = BillingClient.newBuilder(application)
    .setListener(this).enablePendingPurchases().build();
//only called when cancelled on wearable, never when cancel/complete on phone
@Override
public void onPurchasesUpdated(@NonNull BillingResult billingResult,
    @Nullable List<Purchase> list) {
    ...
}

I tried billing:5.1.0 & 4.1.0, license tester account, 2 different phones and 3 different watches.
Even Googles sample code "TrivialTestDrive" shows the same issue here.
What could I be missing?


问:
Add additional output to the default log in next.js
I'm doing fetch on the server side of next.js.
If it's a 500 error, I get an error on the server side.

I am doing fetch on the server side of next.js.
If an error such as a 500 error is returned during an API call, an error occurs on the server side.
I would like to add an entry to the log that is displayed at that time, but I am having trouble doing so.

I want to display the log in a way that adds time to the log.


问:
Add Access-Control header to Google Domain 301 redirect
I'm trying to add the following header to my 301 redirect from https://id.danielbakas.com to https://pod.danielbakas.com:

Access-Control-Allow-Origin: *

My 301 redirect was setup using Google Domain's "Website Redirect", but I can't seem to find any documentation about adding headers to the redirect.

If you were to curl the origin URL you would find that the Access-Control-Allow-Origin header is missing:

```<code>curl --head https://id.danielbakas.com
HTTP/2 301
location: https://pod.danielbakas.com/profile/card
date: Wed, 14 Dec 2022 17:36:39 GMT
content-type: text/html; charset=UTF-8
server: ghs
content-length: 237
x-xss-protection: 0
x-frame-options: SAMEORIGIN
</code>```

However, if you were to curl the destination URL, you would find that the header is indeed present:

```<code>curl --head https://pod.danielbakas.com/profile/card
HTTP/1.1 200 OK
Vary: Accept,Authorization,Origin
X-Powered-By: Community Solid Server
Updates-Via: wss://pod.danielbakas.com/
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Accept-Patch,Accept-Post,Accept-Put,Allow,ETag,Last-Modified,Link,Location,Updates-Via,WAC-Allow
Allow: OPTIONS, HEAD, GET, PATCH, PUT, DELETE
Accept-Patch: text/n3, application/sparql-update
Accept-Put: */*
Content-Type: text/turtle
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Link: <https://pod.danielbakas.com/profile/card.meta>; rel="describedby"
Link: <https://pod.danielbakas.com/profile/card.acl>; rel="acl"
Last-Modified: Mon, 12 Dec 2022 20:21:11 GMT
ETag: "1670876471000"
WAC-Allow: user="read",public="read"
Date: Wed, 14 Dec 2022 17:38:07 GMT
Connection: keep-alive
Keep-Alive: timeout=5
</code>```

How could I configure this redirect so that this header is present in the origin URL?

Thank you so much!

Body:
I'm trying to add the following header to my 301 redirect from https://id.danielbakas.com to https://pod.danielbakas.com:

Access-Control-Allow-Origin: *

My 301 redirect was setup using Google Domain's "Website Redirect", but I can't seem to find any documentation about adding headers to the redirect.

If you were to curl the origin URL you would find that the Access-Control-Allow-Origin header is missing:

curl --head https://id.danielbakas.com
HTTP/2 301
location: https://pod.danielbakas.com/profile/card
date: Wed, 14 Dec 2022 17:36:39 GMT
content-type: text/html; charset=UTF-8
server: ghs
content-length: 237
x-xss-protection: 0
x-frame-options: SAMEORIGIN

However, if you were to curl the destination URL, you would find that the header is indeed present:

curl --head https://pod.danielbakas.com/profile/card
HTTP/1.1 200 OK
Vary: Accept,Authorization,Origin
X-Powered-By: Community Solid Server
Updates-Via: wss://pod.danielbakas.com/
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Accept-Patch,Accept-Post,Accept-Put,Allow,ETag,Last-Modified,Link,Location,Updates-Via,WAC-Allow
Allow: OPTIONS, HEAD, GET, PATCH, PUT, DELETE
Accept-Patch: text/n3, application/sparql-update
Accept-Put: */*
Content-Type: text/turtle
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Link: <https://pod.danielbakas.com/profile/card.meta>; rel="describedby"
Link: <https://pod.danielbakas.com/profile/card.acl>; rel="acl"
Last-Modified: Mon, 12 Dec 2022 20:21:11 GMT
ETag: "1670876471000"
WAC-Allow: user="read",public="read"
Date: Wed, 14 Dec 2022 17:38:07 GMT
Connection: keep-alive
Keep-Alive: timeout=5

How could I configure this redirect so that this header is present in the origin URL?

Thank you so much!


问:
SwiftUI Delete a List Section
Is there a way to delete an entire list section with a function in SwiftUI? I have a list that you can add sections to as you please, but don't know how to delete them when you want to. I know that you can delete a list item itself using the deleteItems function, but I would like to use a button to delete the entire section. When I try to use the standard "deleteItems" function, it asks for "offsets: IndexSet". I am unsure what this IndexSet would be.

I can't find out what should go in the IndexSet field.

Here is my code

```<code>struct SampleView: View {
    @Environment(\.managedObjectContext) private var viewContext
    @Environment(\.presentationMode) var presentationMode
    @FetchRequest(
        sortDescriptors: [NSSortDescriptor(keyPath: \Category.categoryString, ascending: false)],
        animation: .default)
    private var listedCategory: FetchedResults<Category>
    @State var categoryString: String = ""
    var body: some View {
        VStack{
            TextField("Enter Text Here", text: $categoryString)
            Button {
                let newlistedCategory = Category(context: viewContext)
                newlistedCategory.categoryString = categoryString
                do {
                    try viewContext.save()
                } catch {
                    let nsError = error as NSError
                    fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
                }
                categoryString = ""
            } label: {
                Text("Save")
            }
            List{
                ForEach(listedCategory) { listedCategory in
                    if listedCategory.typeString == "Item" {
                        Section(header: Text(listedCategory.categoryString!)) {
                            Button {
                                //deleteCategories(offsets: <#T##IndexSet#>)
                            } label: {
                                Text("Delete")
                            }
                        }
                    }
                }
            }
            Spacer()
        }
    }

    private func deleteCategories(offsets: IndexSet) {
        withAnimation {
            offsets.map { listedCategory[$0] }.forEach(viewContext.delete)
            do {
                try viewContext.save()
            } catch {
                // Replace this implementation with code to handle the error appropriately.
                // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
                let nsError = error as NSError
                fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
            }
        }
    }
}
</code>```

Title: SwiftUI Delete a List Section

Body:
Is there a way to delete an entire list section with a function in SwiftUI? I have a list that you can add sections to as you please, but don't know how to delete them when you want to. I know that you can delete a list item itself using the deleteItems function, but I would like to use a button to delete the entire section. When I try to use the standard "deleteItems" function, it asks for "offsets: IndexSet". I am unsure what this IndexSet would be.

I can't find out what should go in the IndexSet field.

Here is my code

struct SampleView: View {
    @Environment(\.managedObjectContext) private var viewContext
    @Environment(\.presentationMode) var presentationMode
    @FetchRequest(
        sortDescriptors: [NSSortDescriptor(keyPath: \Category.categoryString, ascending: false)],
        animation: .default)
    private var listedCategory: FetchedResults<Category>
    @State var categoryString: String = ""
    var body: some View {
        VStack{
            TextField("Enter Text Here", text: $categoryString)
            Button {
                let newlistedCategory = Category(context: viewContext)
                newlistedCategory.categoryString = categoryString
                do {
                    try viewContext.save()
                } catch {
                    let nsError = error as NSError
                    fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
                }
                categoryString = ""
            } label: {
                Text("Save")
            }
            List{
                ForEach(listedCategory) { listedCategory in
                    if listedCategory.typeString == "Item" {
                        Section(header: Text(listedCategory.categoryString!)) {
                            Button {
                                //deleteCategories(offsets: <#T##IndexSet#>)
                            } label: {
                                Text("Delete")
                            }
                        }
                    }
                }
            }
            Spacer()
        }
    }

    private func deleteCategories(offsets: IndexSet) {
        withAnimation {
            offsets.map { listedCategory[$0] }.forEach(viewContext.delete)
            do {
                try viewContext.save()
            } catch {
                // Replace this implementation with code to handle the error appropriately.
                // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
                let nsError = error as NSError
                fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
            }
        }
    }
}


问:
Missing all commits in Github repository but Only showing up my contribution activity
I had just commits and push my project in Eclipse on my Mac which is new environment where I just moved my project from Window version. But I lost all commits over 250 in my Github repository but there are still commits' history on my contribution activity.
Unfortunately, I don't know what happened and I couldn't remember what I did.
There were few ways I tried to find my latest commit Id before pushing new commits.

First, git log There are two histories that I'd just commits and push.

```<code>PS C:\Users\SECHAN\apms_salonSystem> git log
commit 7044db9b601bd414b6e163e2c3154708362a1b00 (HEAD -> master, origin/master,
origin/HEAD)
Author: sol namgung <nandaras0103@gmail.com>
Date:   Sat Dec 10 23:15:32 2022 +0900

change ImagePath on mac

commit 313f55ab3d9bd3ce662d392c3ff0f95704cff774
Author: sol namgung <nandaras0103@gmail.com>
Date:   Sat Dec 10 21:03:43 2022 +0900

first commit on mac and added products pictures changed of directories
</code>```

Second, I had git fsck --lost-found to find dangling commits.

```<code> PS C:\Users\SECHAN\apms_salonSystem> git fsck --lost-found
 Checking object directories: 100% (256/256), done.
 Checking objects: 100% (1175/1175), done
</code>```

but I got nothing of commits' history.

Can anyone share informations or any solutions for that. I'd very appreciate it.
Thanks again.

Body:
I had just commits and push my project in Eclipse on my Mac which is new environment where I just moved my project from Window version. But I lost all commits over 250 in my Github repository but there are still commits' history on my contribution activity.
Unfortunately, I don't know what happened and I couldn't remember what I did.
There were few ways I tried to find my latest commit Id before pushing new commits.

First, git log There are two histories that I'd just commits and push.

PS C:\Users\SECHAN\apms_salonSystem> git log
commit 7044db9b601bd414b6e163e2c3154708362a1b00 (HEAD -> master, origin/master,
origin/HEAD)
Author: sol namgung <nandaras0103@gmail.com>
Date:   Sat Dec 10 23:15:32 2022 +0900

change ImagePath on mac

commit 313f55ab3d9bd3ce662d392c3ff0f95704cff774
Author: sol namgung <nandaras0103@gmail.com>
Date:   Sat Dec 10 21:03:43 2022 +0900

first commit on mac and added products pictures changed of directories

Second, I had git fsck --lost-found to find dangling commits.

 PS C:\Users\SECHAN\apms_salonSystem> git fsck --lost-found
 Checking object directories: 100% (256/256), done.
 Checking objects: 100% (1175/1175), done

but I got nothing of commits' history.

Can anyone share informations or any solutions for that. I'd very appreciate it.
Thanks again.


问:
Why does manage.py runserver showing this instead of server link?
Started this project 2 days ago, yesterday I was trying to run instead it was showing this. Tried to  create a new app i.e 'python manage.py startapp app_name' which doesn't work too. should i create a new environment? Each time I close vs code and each time it shows different types of problem.

```<code>(env.0.5) D:\Web\ecom\mosh>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\apps\config.py", line 193, in create
    import_module(entry)
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tags'
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 74, in execute
    super().execute(*args, **options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 111, in handle
    self.run(**options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 118, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 680, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 661, in start_django
    reloader.run(django_main_thread)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 344, in run
    self.run_loop()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 350, in run_loop
    next(ticker)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 390, in tick
    for filepath, mtime in self.snapshot_files():
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 411, in snapshot_files
    for file in self.watched_files():
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 304, in watched_files
    yield from iter_all_python_module_files()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 120, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 160, in iter_modules_and_files
    if not path.exists():
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\pathlib.py", line 1388, in exists
    self.stat()
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\pathlib.py", line 1194, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'
</code>```

Body:
Started this project 2 days ago, yesterday I was trying to run instead it was showing this. Tried to  create a new app i.e 'python manage.py startapp app_name' which doesn't work too. should i create a new environment? Each time I close vs code and each time it shows different types of problem.

(env.0.5) D:\Web\ecom\mosh>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\apps\config.py", line 193, in create
    import_module(entry)
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tags'
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 74, in execute
    super().execute(*args, **options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 111, in handle
    self.run(**options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\core\management\commands\runserver.py", line 118, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 680, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 661, in start_django
    reloader.run(django_main_thread)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 344, in run
    self.run_loop()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 350, in run_loop
    next(ticker)
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 390, in tick
    for filepath, mtime in self.snapshot_files():
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 411, in snapshot_files
    for file in self.watched_files():
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 304, in watched_files
    yield from iter_all_python_module_files()
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 120, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "D:\Web\ecom\mosh\env.0.5\lib\site-packages\django\utils\autoreload.py", line 160, in iter_modules_and_files
    if not path.exists():
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\pathlib.py", line 1388, in exists
    self.stat()
  File "c:\users\shuvo\appdata\local\programs\python\python38\lib\pathlib.py", line 1194, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'


问:
sequence project and how to print something that wasn't selected from tableaumodele
this what I have until now but I can't finish this problem to look something like this picturehow the code should look</p>
```<code>

tableau = []
tableaumodele = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print("------Entrez la squence de nombre-------")

for i in range(0, 10):
    nombre = int(input("Entrez un nombre :"))
    tableau.append(nombre)

tableau.sort()
print(tableau) #to check if the ascending order of the numbers entered

if tableau == tableaumodele:
    print("Réussi")
else:
    # YOU COMPLETE THE CODE TO INDICATE WHICH NUMBER IS MISSING
    # AND WHAT NUMBER IS ENTERED MORE THAN ONCE

 print("Merci d'avoir jouer.")
</code>```

Body:
this what I have until now but I can't finish this problem to look something like this picturehow the code should look

tableau = []
tableaumodele = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print("------Entrez la squence de nombre-------")

for i in range(0, 10):
    nombre = int(input("Entrez un nombre :"))
    tableau.append(nombre)

tableau.sort()
print(tableau) #to check if the ascending order of the numbers entered

if tableau == tableaumodele:
    print("Réussi")
else:
    # YOU COMPLETE THE CODE TO INDICATE WHICH NUMBER IS MISSING
    # AND WHAT NUMBER IS ENTERED MORE THAN ONCE

 print("Merci d'avoir jouer.")


问:
Error Domain=AVFoundationErrorDomain Code=-11800
```<code>i have a problem downloading file from url end export it in device "https://sdkapis.ringme.vn:8443/sdk/fileupload/2022/12/15/2cc0f2058e1c7b8f655ca6f9a04b42d9.aac" , i download it and store it but it is working error occurs in exportSession?.exportAsynchronously
</code>```

error : Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x28164f060 {Error Domain=NSOSStatusErrorDomain Code=-16979 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16979), NSURL=file:///var/mobile/Containers/Data/Application/96A04F25-2F8D-4CE5-A2E9-D67884A318FD/Library/Caches/tmp_audio.m4a, NSLocalizedDescription=The operation could not be completed}

```<code>func downloadFile(_ messageFile: Message) {
        guard let fileUrl = messageFile.mediaLink, let offline_url = messageFile.offline_url else {
            return
        }

        let tmpFileUrl = URL.init(fileURLWithPath: self.cachePath(with: "tmp_audio"))

        self.updateDownloadFile(messageFile, isSuccess: nil)
        if self.listDownloadingFile.firstIndex(of: messageFile.messageId) != nil {
            return
        }

        self.listDownloadingFile.append(messageFile.messageId)
        HttpClient.shared.requestData(fileUrl, method: .get) { [weak self] (data, error) in
            if let data = data {
                do {
                    try data.write(to: tmpFileUrl)

                    let audioAsset = AVURLAsset.init(url: tmpFileUrl, options: [AVURLAssetPreferPreciseDurationAndTimingKey: true])
                    let exportSession = AVAssetExportSession.init(asset: audioAsset, presetName: AVAssetExportPresetAppleM4A)
                    exportSession?.outputURL = offline_url
                    exportSession?.outputFileType = AVFileType.m4a

                    exportSession?.exportAsynchronously(completionHandler: {
                        DispatchQueue.main.async {
                            if exportSession?.error == nil || exportSession?.status == AVAssetExportSession.Status.completed {
                                self?.updateDownloadFile(messageFile, isSuccess: true)
                            }
                            else {
                                self?.updateDownloadFile(messageFile, isSuccess: false)
                            }
                        }
                    })
                } catch {
                    RingmeLog.shared.error(error)
                    self?.updateDownloadFile(messageFile, isSuccess: false)
                }
            }
            else {
                self?.updateDownloadFile(messageFile, isSuccess: false)
            }
        }
    }
</code>```

I tried many ways but it doesn't work

Body:
i have a problem downloading file from url end export it in device "https://sdkapis.ringme.vn:8443/sdk/fileupload/2022/12/15/2cc0f2058e1c7b8f655ca6f9a04b42d9.aac" , i download it and store it but it is working error occurs in exportSession?.exportAsynchronously

error : Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x28164f060 {Error Domain=NSOSStatusErrorDomain Code=-16979 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16979), NSURL=file:///var/mobile/Containers/Data/Application/96A04F25-2F8D-4CE5-A2E9-D67884A318FD/Library/Caches/tmp_audio.m4a, NSLocalizedDescription=The operation could not be completed}

func downloadFile(_ messageFile: Message) {
        guard let fileUrl = messageFile.mediaLink, let offline_url = messageFile.offline_url else {
            return
        }

        let tmpFileUrl = URL.init(fileURLWithPath: self.cachePath(with: "tmp_audio"))

        self.updateDownloadFile(messageFile, isSuccess: nil)
        if self.listDownloadingFile.firstIndex(of: messageFile.messageId) != nil {
            return
        }

        self.listDownloadingFile.append(messageFile.messageId)
        HttpClient.shared.requestData(fileUrl, method: .get) { [weak self] (data, error) in
            if let data = data {
                do {
                    try data.write(to: tmpFileUrl)

                    let audioAsset = AVURLAsset.init(url: tmpFileUrl, options: [AVURLAssetPreferPreciseDurationAndTimingKey: true])
                    let exportSession = AVAssetExportSession.init(asset: audioAsset, presetName: AVAssetExportPresetAppleM4A)
                    exportSession?.outputURL = offline_url
                    exportSession?.outputFileType = AVFileType.m4a

                    exportSession?.exportAsynchronously(completionHandler: {
                        DispatchQueue.main.async {
                            if exportSession?.error == nil || exportSession?.status == AVAssetExportSession.Status.completed {
                                self?.updateDownloadFile(messageFile, isSuccess: true)
                            }
                            else {
                                self?.updateDownloadFile(messageFile, isSuccess: false)
                            }
                        }
                    })
                } catch {
                    RingmeLog.shared.error(error)
                    self?.updateDownloadFile(messageFile, isSuccess: false)
                }
            }
            else {
                self?.updateDownloadFile(messageFile, isSuccess: false)
            }
        }
    }

I tried many ways but it doesn't work


问:
refresh a pixel art array swift
is there anyway of refreshing the code to update , when the uiColorArray array variable changes

view code:

```<code>   var body: some View {

        let cellCount = 32

        VStack(spacing:1) {
            ForEach(1...cellCount, id:\.self) { r in
                HStack(spacing:1) {
                    ForEach(1...cellCount, id:\.self) { c in
                        ZStack {
                            Rectangle()
                                .fill(Color(uiColorArray[c+r]))
                                .frame(width: 10, height: 10)
                        }

                    }
                }
            }
        }.gesture(drag)}
}
</code>```

array declaration :

```<code>public var uiColorArray = [UIColor](){
    didSet {
        print("arrayChanged")
    }
</code>```

any help would be nice thanks in advance...

the array to refresh the screen

Title: refresh a pixel art array swift

Body:
is there anyway of refreshing the code to update , when the uiColorArray array variable changes

view code:

   var body: some View {

        let cellCount = 32

        VStack(spacing:1) {
            ForEach(1...cellCount, id:\.self) { r in
                HStack(spacing:1) {
                    ForEach(1...cellCount, id:\.self) { c in
                        ZStack {
                            Rectangle()
                                .fill(Color(uiColorArray[c+r]))
                                .frame(width: 10, height: 10)
                        }

                    }
                }
            }
        }.gesture(drag)}
}

array declaration :

public var uiColorArray = [UIColor](){
    didSet {
        print("arrayChanged")
    }

any help would be nice thanks in advance...

the array to refresh the screen


问:
IndexError: index 263 is out of bounds for axis 0 with size 0
I'm new to learning python and was trying to run sample code to display the dataset. This is the sample code:

```<code>x = random.randint(0,len(data_train))
plt.figure(figsize=(24,18))
plt.subplot(1,2,1)
imshow(data_train[x])
plt.subplot(1,2,2)
imshow(data_mask[x])
plt.show()
</code>```

Cell outputs:

```<code>IndexError                                Traceback (most recent call last)
Cell In[41], line 7
      5 imshow(data_train[x])
      6 plt.subplot(1,2,2)
----> 7 imshow(data_mask[x])
      8 plt.show()

IndexError: index 263 is out of bounds for axis 0 with size 0
</code>```

How can I solve this issue? please tell me if other information is needed, thank you.

Body:
I'm new to learning python and was trying to run sample code to display the dataset. This is the sample code:

x = random.randint(0,len(data_train))
plt.figure(figsize=(24,18))
plt.subplot(1,2,1)
imshow(data_train[x])
plt.subplot(1,2,2)
imshow(data_mask[x])
plt.show()

Cell outputs:

IndexError                                Traceback (most recent call last)
Cell In[41], line 7
      5 imshow(data_train[x])
      6 plt.subplot(1,2,2)
----> 7 imshow(data_mask[x])
      8 plt.show()

IndexError: index 263 is out of bounds for axis 0 with size 0

How can I solve this issue? please tell me if other information is needed, thank you.


问:
Is there a better way to create Class than this?
I have lots of class who inherit abstract class and many interface.
but problem is class should implement members declared in interface.
so I should type lots of duplicate code.

I think that violates OOP's DRY principle, So I tried many things but below is my best.

Is there any way better than mine?

Current

```<code>public interface InterfaceWithProperties
{
    public int IntegerProperty { get; set; }
    public string StringProperty { get; set; }
}

public abstract class AbstractClass1
{
    public abstract Guid GuidProperty1;
}

public abstract class AbstractClass2
{
    public abstract Guid GuidProperty2;
}

public sealed class DerivativeClass1 : AbstractClass1, InterfaceWithProperties
{
    [TargetAttribute(ValueForDerivativeClass1)] public override Guid GuidProperty1 { get; set; }

    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}

public sealed class DerivativeClass2 : AbstractClass2, InterfaceWithProperties
{
    [TargetAttribute(ValueForDerivativeClass2)] public override GuidProperty2 { get; set; }

    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}
</code>```

There could be a lot of sealed derivative class with different base class but same interface.
so below parts duplicate many times

```<code>{
    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}
</code>```

So Is There a way to declare this part of code for my purpose?

for example I imagine some "augmentation" type achieve like this.

```<code>public augmentation AugmentationWithProperties : InterfaceWithProperties
{
    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}
</code>```

so now derivative classes look like these

```<code>public sealed class DerivativeClass1 : AbstractClass1, AugmentationWithProperties
{
    [TargetAttribute(ValueForDerivativeClass1)] public override Guid GuidProperty1 { get; set; }
}

public sealed class DerivativeClass2 : AbstractClass2, AugmentationWithProperties
{
    [TargetAttribute(ValueForDerivativeClass2)] public override Guid GuidProperty2 { get; set; }
}
</code>```

Is There a Way to achieve this?

Please Give me your advice, Thank you.

Body:
I have lots of class who inherit abstract class and many interface.
but problem is class should implement members declared in interface.
so I should type lots of duplicate code.

I think that violates OOP's DRY principle, So I tried many things but below is my best.

Is there any way better than mine?

Current

public interface InterfaceWithProperties
{
    public int IntegerProperty { get; set; }
    public string StringProperty { get; set; }
}

public abstract class AbstractClass1
{
    public abstract Guid GuidProperty1;
}

public abstract class AbstractClass2
{
    public abstract Guid GuidProperty2;
}

public sealed class DerivativeClass1 : AbstractClass1, InterfaceWithProperties
{
    [TargetAttribute(ValueForDerivativeClass1)] public override Guid GuidProperty1 { get; set; }

    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}

public sealed class DerivativeClass2 : AbstractClass2, InterfaceWithProperties
{
    [TargetAttribute(ValueForDerivativeClass2)] public override GuidProperty2 { get; set; }

    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}

There could be a lot of sealed derivative class with different base class but same interface.
so below parts duplicate many times

{
    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}

So Is There a way to declare this part of code for my purpose?

for example I imagine some "augmentation" type achieve like this.

public augmentation AugmentationWithProperties : InterfaceWithProperties
{
    [SomeAttribute] public int IntegerProperty { get; set; }
    [SomeAttribute] public string StringProperty { get; set; }
}

so now derivative classes look like these

public sealed class DerivativeClass1 : AbstractClass1, AugmentationWithProperties
{
    [TargetAttribute(ValueForDerivativeClass1)] public override Guid GuidProperty1 { get; set; }
}

public sealed class DerivativeClass2 : AbstractClass2, AugmentationWithProperties
{
    [TargetAttribute(ValueForDerivativeClass2)] public override Guid GuidProperty2 { get; set; }
}

Is There a Way to achieve this?

Please Give me your advice, Thank you.


问:
How to handle multiple interfaces?
How to handle multiple interfaces?
export const RequestSort = (TableApi:keyof Alarm ,SortProp:SortProps)

Alarm and AlarmSearch
I would like to pass three of List's Interfaces as arguments
I don't know how.

```<code>interface Alarm {
    shopNumber: number;
    shopName: string;
    daiNo: number;
    errorCode: number;
    errorContents: string;
    occurrenceDateTime: string;
}

interface AlarmSearch {
    shopNumberSearch: number;
    shopNameSearch: string;
    daiNoSearch: number;
    errorCodeSearch: number;
    errorContentsSearch: string;
    occurrenceDateTimeSearch: sting;
}

interface List {
    No :number;
    Name :string;
    Address:string;
    streetAddress:string
    phone:string
}

export const RequestSort = (TableApi:keyof Alarm ,SortProp:SortProps) => {

    const {order,orderBy,rows} = SortProp;

    const isAsc = orderBy === TableApi && order === 'asc';          //true or false
    const newOrder = isAsc ? 'desc' : 'asc';                        //asc or desc
    const newRows = rows.sort(getComparator(newOrder, TableApi));

    const ReturnProps:ReturnProp = {orderData:newOrder,orderByData:TableApi,rowsData:newRows}
    return ReturnProps;
};

TableApi:keyof..
</code>```

The keys (columns) of the 3-key interface will be implemented.

Title: How to handle multiple interfaces?

Body:
How to handle multiple interfaces?
export const RequestSort = (TableApi:keyof Alarm ,SortProp:SortProps)

Alarm and AlarmSearch
I would like to pass three of List's Interfaces as arguments
I don't know how.

interface Alarm {
    shopNumber: number;
    shopName: string;
    daiNo: number;
    errorCode: number;
    errorContents: string;
    occurrenceDateTime: string;
}

interface AlarmSearch {
    shopNumberSearch: number;
    shopNameSearch: string;
    daiNoSearch: number;
    errorCodeSearch: number;
    errorContentsSearch: string;
    occurrenceDateTimeSearch: sting;
}

interface List {
    No :number;
    Name :string;
    Address:string;
    streetAddress:string
    phone:string
}

export const RequestSort = (TableApi:keyof Alarm ,SortProp:SortProps) => {

    const {order,orderBy,rows} = SortProp;

    const isAsc = orderBy === TableApi && order === 'asc';          //true or false
    const newOrder = isAsc ? 'desc' : 'asc';                        //asc or desc
    const newRows = rows.sort(getComparator(newOrder, TableApi));

    const ReturnProps:ReturnProp = {orderData:newOrder,orderByData:TableApi,rowsData:newRows}
    return ReturnProps;
};

TableApi:keyof..

The keys (columns) of the 3-key interface will be implemented.


问:
Can't get Set-Cookie header in production
My stack is the following: NestJS backend (Express under the hood) deployed on Elastic Beanstalk, NextJS frontend deployed on AWS Amplify, CloudFront as CDN, and I can't get Set-Cookie header back to the frontend NextJS app, nor a cookie is being set.
FE and BE are on a different domains.

Locally everything works fine, when FE and BE apps are local, eg. I'm getting Set-Cookie and a cookie is stored in the browser. When FE is local and BE is deployed, it doesn't work as expected also when communicating between the two. CORS is being set up and there's no error there. Cookie options seems right too.

On the backend, CORS has been set with 3 options, out of the factory method, eg. app.enableCors({...}):

explicit origin (no wildcard) - works with allowed credentials turned on

credentials set to true - allow credentials header

allowed headers
So, CORS is working, no error there, just not returning Set-Cookie header when deployed.

For cookie, I'm using cookie-parser npm module, and having set up the following options for the cookie when returning the response for POST /auth/login request:

httpOnly: true - no script reading

maxAge (1 day into the future from request time)

sameSite: 'none' - cross-site enabled

secure: true - https (required for cross-site)

On the frontend, I'm using NextJS with axios npm module to fetch an API. Also, I'm having credentials set to true.

I tried to update CORS settings on load balancers, eg. proxy for the backend, and was doing a lot of research on Stack Overflow and other platforms, but couldn't find a solution. Most solutions mention that some options are missing for the backend, like CORS and a cookie settings, and credentials: true for the frontend. But as mentioned before, seems I got that covered. CloudFront settings didn't help either. CloudFront caching policy - didn't help. Something is missing or am doing it wrong.

Everything points that the AWS has to be set up properly(default/basic settings), but I don't know what excatly. Any help?


问:
How can I add the delete button to my todo list using tailwind css and vanilla javascript?
I am trying to build a todo list using tailwind and vanilla js. I have run into a problem where when a task item is added to the list my code is able to render the task text but the edit and delete buttons are missing. I can tell that the funtion is working because in the dev tools I can see that the divs are being created. Thing is there is nothing in them. Could use a hand here?

Here are examples of my code.

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Include the Tailwind CSS stylesheet -->
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
    <script src="https://cdn.tailwindcss.com"></script>
    <title>To Do List</title>
</head>
<body class="bg-neutral-800">
    <div class="font-mono text-slate-400 container mx-auto bg-slate-900 rounded-xl m-12 p-12 task_list_empty">
            <form class="w-auto" id="new-task-form">
                <h1 class="text-3xl text-center">To Do List</h1>
                <div class="m-12">
                    <input type="text" name="task" class="w-full border-2 border-gray-300 p-2 rounded-lg" placeholder="Enter a task" name="new_task_input" id="new_task_input" value="">
                    <button id="new_task_input_button" type="submit" class="bg-slate-500 text-white px-4 py-2 rounded font-medium">Add</button>
                </div>
                <div class="todo m-12 leading-10">
                    <ul id="todo-list">

                    </ul>
                </div>
            </form>
    </div>
</body>
<script src="todolist.js"></script>
</html>
</code>```
```<code>@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
}

@layer components {
    .todo-list-item{
        @apply flex items-center mb-2;
    }
    .todo-list-item__deleteButton{
        @apply bg-rose-900 text-white px-4 py-2 rounded font-medium;
    }
    .todo-list-item__deleteButton:hover{
        @apply bg-rose-800;
    }
    .todo-list-item__editButton{
        @apply bg-teal-900 text-white px-4 py-2 rounded font-medium;
    }
    .todo-list-item__editButton:hover{
        @apply bg-teal-800;
    }

}

@layer utilities {
}
</code>```
```<code>//Variables
let container = document.querySelector(".container");
let newTaskInput = document.getElementById("new_task_input");
let taskform = document.getElementById("new-task-form");
let tasksList = document.getElementById("todo-list");
let deleteBtns = []; // initialize deleteBtns as an empty array

//Add Event Listeners
taskform.addEventListener("submit", function (e) {
  e.preventDefault();
  let newTaskInputValue = taskform.elements.new_task_input;
  addTask(newTaskInputValue.value);

  newTaskInputValue.value = "";
  container.classList.remove("task_list_empty");
});

//Add task to list
function addTask(task) {
  const newTaskItem = document.createElement("li");
  newTaskItem.setAttribute("class", "todo-list-item");

  //add the delete button
  const deleteButton = document.createElement("button");
  deleteButton.setAttribute("class", "todo-list-item__deleteButton");

  //add the edit button
  const editButton = document.createElement("button");
  editButton.setAttribute("class", "todo-list-item__editButton");

  //add the task text
  const taskText = document.createElement("div");
  taskText.setAttribute("class", "todo-list-item__text");

  //Set the value of the input to the task text
  taskText.innerText = task;

  //append the task text to the list item
  newTaskItem.appendChild(taskText);

  //append the delete button to the li
  newTaskItem.appendChild(deleteButton);

  //append the edit button to the li
  newTaskItem.appendChild(editButton);

  //append the li to the ul
  tasksList.appendChild(newTaskItem);

  //completion funtionality on the delete button
  onTaskCompletion(deleteButton);

  // add the delete button to the array of delete buttons
  deleteBtns.push(deleteButton);
}

//TO remove the task from the list
function onTaskCompletion(deleteButton) {
  deleteButton.addEventListener("click", function () {
    deleteButton.parentElement.remove();
    if (tasksList.children.length === 0) {
      container.classList.add("task_list_empty");
    }
  });
}
</code>```

Body:
I am trying to build a todo list using tailwind and vanilla js. I have run into a problem where when a task item is added to the list my code is able to render the task text but the edit and delete buttons are missing. I can tell that the funtion is working because in the dev tools I can see that the divs are being created. Thing is there is nothing in them. Could use a hand here?

Here are examples of my code.

<!DOCTYPE html>

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

<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">

    <title>To Do List</title>

            <form class="w-auto" id="new-task-form">

To Do List

                    <input type="text" name="task" class="w-full border-2 border-gray-300 p-2 rounded-lg" placeholder="Enter a task" name="new_task_input" id="new_task_input" value="">
                    <button id="new_task_input_button" type="submit" class="bg-slate-500 text-white px-4 py-2 rounded font-medium">Add</button>

            </form>

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
}

@layer components {
    .todo-list-item{
        @apply flex items-center mb-2;
    }
    .todo-list-item__deleteButton{
        @apply bg-rose-900 text-white px-4 py-2 rounded font-medium;
    }
    .todo-list-item__deleteButton:hover{
        @apply bg-rose-800;
    }
    .todo-list-item__editButton{
        @apply bg-teal-900 text-white px-4 py-2 rounded font-medium;
    }
    .todo-list-item__editButton:hover{
        @apply bg-teal-800;
    }

}

@layer utilities {
}

//Variables
let container = document.querySelector(".container");
let newTaskInput = document.getElementById("new_task_input");
let taskform = document.getElementById("new-task-form");
let tasksList = document.getElementById("todo-list");
let deleteBtns = []; // initialize deleteBtns as an empty array

//Add Event Listeners
taskform.addEventListener("submit", function (e) {
  e.preventDefault();
  let newTaskInputValue = taskform.elements.new_task_input;
  addTask(newTaskInputValue.value);

  newTaskInputValue.value = "";
  container.classList.remove("task_list_empty");
});

//Add task to list
function addTask(task) {
  const newTaskItem = document.createElement("li");
  newTaskItem.setAttribute("class", "todo-list-item");

  //add the delete button
  const deleteButton = document.createElement("button");
  deleteButton.setAttribute("class", "todo-list-item__deleteButton");

  //add the edit button
  const editButton = document.createElement("button");
  editButton.setAttribute("class", "todo-list-item__editButton");

  //add the task text
  const taskText = document.createElement("div");
  taskText.setAttribute("class", "todo-list-item__text");

  //Set the value of the input to the task text
  taskText.innerText = task;

  //append the task text to the list item
  newTaskItem.appendChild(taskText);

  //append the delete button to the li
  newTaskItem.appendChild(deleteButton);

  //append the edit button to the li
  newTaskItem.appendChild(editButton);

  //append the li to the ul
  tasksList.appendChild(newTaskItem);

  //completion funtionality on the delete button
  onTaskCompletion(deleteButton);

  // add the delete button to the array of delete buttons
  deleteBtns.push(deleteButton);
}

//TO remove the task from the list
function onTaskCompletion(deleteButton) {
  deleteButton.addEventListener("click", function () {
    deleteButton.parentElement.remove();
    if (tasksList.children.length === 0) {
      container.classList.add("task_list_empty");
    }
  });
}


问:
Can you find source code about Redis Cluster that circumstance?
https://redis.io/docs/reference/cluster-spec/#masters-reply-to-replica-vote-request

enter image description here

I can not find certain source code about the above circumstance, if you find, hope you show it to me.
Thank you very much!

picture to prove or source code part


问:
How does one run `eval $(opam env)` when the command substitution is changes to the environment - all ran from within **python**?
I am aware that one can't easily run eval from python (though I admit I don't fully understand why). I've been trying a bunch of things -- even using opem exec --switch $SWITCH $command_substitution_output to do it but I can't get it to work.

This is my attempt:

```<code>def run_eval_opam_env(switch: str,
                      ):
    """
Tries to run through opam exec command arg https://opam.ocaml.org/doc/man/opam-exec.html.
eval $(opam env --switch=switch --set-switch)
    note:
        - command substituion: replace the command ran here $(cmd) with its output (string).
        It turns out, $() is called a command substitution. The command in between $() or backticks (“) is run and the
        output replaces $().
    ref:
        - command sub: https://blog.wplauncher.com/what-is-in-linux/#:~:text=Example%20of%20command%20substitution%20using%20%24()%20in%20Linux%3A&text=Again%2C%20%24()%20is%20a%20command,another%20context%E2%80%9D%20(Source).
        - eval $(opam env): https://stackoverflow.com/questions/30155960/what-is-the-use-of-eval-opam-config-env-or-eval-opam-env-and-their-differen?noredirect=1&lq=1
        - there is a way with opam exec: https://discuss.ocaml.org/t/is-eval-opam-env-switch-switch-set-switch-equivalent-to-opam-switch-set-switch/10957/4
    """
    logging.info(f'{run_eval_opam_env=}')
    # - get cmd sub output
    try:
        cmd_sub_output: str = subprocess.check_output(f'opam env --switch={switch} --set-switch'.split())
    except Exception as e:
        logging.critical(f'Error: {e=}')
        raise e
    # - run command to eval
    # command: str = f'eval {cmd_sub_output}'  # doesn't seem possible https://stackoverflow.com/questions/53950225/python-check-output-call-to-eval-with-arguments-fails
    command: list[str] = f'opam exec --switch {switch}'.split()
    # command: list[str] = command + cmd_sub_output.split()
    command: list[str] = command + [cmd_sub_output]
    logging.info(f"-> {command=}")
    try:
        # res = subprocess.run(command.split(), check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        res = subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        logging.info(f'{res.stdout.decode()=}')
        logging.info(f'{res.stderr.decode()=}')
    except Exception as e:
        logging.critical(f'Error: {e=}')
        raise e
</code>```

the output of the command substitution is a bunch of env stuff. How do I excute it in a subprocess or in the opam exec command?

See it's:

```<code>b"OPAMSWITCH='ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAMSWITCH;\nOPAM_SWITCH_PREFIX='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAM_SWITCH_PREFIX;\nCAML_LD_LIBRARY_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml'; export CAML_LD_LIBRARY_PATH;\nOCAML_TOPLEVEL_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/toplevel'; export OCAML_TOPLEVEL_PATH;\nMANPATH=':/usr/kerberos/man:/usr/share/man:/usr/local/man:/usr/man:/opt/puppetlabs/puppet/share/man:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/man'; export MANPATH;\nPATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/bin:/dfs/scratch0/brando9/anaconda/envs/iit_synthesis/bin:/lfs/ampere4/0/brando9/.local/bin:/lfs/ampere4/0/brando9/.ruby-build/bin:/lfs/ampere4/0/brando9/.rbenv/shims:/lfs/ampere4/0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/anaconda/condabin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/.local/bin:/dfs/scratch0/brando9/.ruby-build/bin:/dfs/scratch0/brando9/.rbenv/shims:/dfs/scratch0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/afs/cs/software/sbin:/afs/cs/software/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin'; export PATH;\n"
</code>```

but the cmd seems like nonsense:

```<code>subprocess.CalledProcessError: Command '['opam', 'exec', '--switch', 'ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1', b"OPAMSWITCH='ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAMSWITCH;\nOPAM_SWITCH_PREFIX='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAM_SWITCH_PREFIX;\nCAML_LD_LIBRARY_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml'; export CAML_LD_LIBRARY_PATH;\nOCAML_TOPLEVEL_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/toplevel'; export OCAML_TOPLEVEL_PATH;\nMANPATH=':/usr/kerberos/man:/usr/share/man:/usr/local/man:/usr/man:/opt/puppetlabs/puppet/share/man:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/man'; export MANPATH;\nPATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/bin:/dfs/scratch0/brando9/anaconda/envs/iit_synthesis/bin:/lfs/ampere4/0/brando9/.local/bin:/lfs/ampere4/0/brando9/.ruby-build/bin:/lfs/ampere4/0/brando9/.rbenv/shims:/lfs/ampere4/0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/anaconda/condabin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/.local/bin:/dfs/scratch0/brando9/.ruby-build/bin:/dfs/scratch0/brando9/.rbenv/shims:/dfs/scratch0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/afs/cs/software/sbin:/afs/cs/software/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin'; export PATH;\n"]'
</code>```

I also tried just doing feval {cmd_sub_output} without success.

related:

https://discuss.ocaml.org/t/is-eval-opam-env-switch-switch-set-switch-equivalent-to-opam-switch-set-switch/10957/6

Python check_output call to eval (with arguments) fails

Running `eval $(something)` commands using Python sub-process

Is there a way to run the bash eval command in python?

What is the use of eval `opam config env` or eval $(opam env) and their difference?

opam exec https://opam.ocaml.org/doc/man/opam-exec.html

Body:
I am aware that one can't easily run eval from python (though I admit I don't fully understand why). I've been trying a bunch of things -- even using opem exec --switch $SWITCH $command_substitution_output to do it but I can't get it to work.

This is my attempt:

def run_eval_opam_env(switch: str,
                      ):
    """
Tries to run through opam exec command arg https://opam.ocaml.org/doc/man/opam-exec.html.
eval $(opam env --switch=switch --set-switch)
    note:
        - command substituion: replace the command ran here $(cmd) with its output (string).
        It turns out, $() is called a command substitution. The command in between $() or backticks (“) is run and the
        output replaces $().
    ref:
        - command sub: https://blog.wplauncher.com/what-is-in-linux/#:~:text=Example%20of%20command%20substitution%20using%20%24()%20in%20Linux%3A&text=Again%2C%20%24()%20is%20a%20command,another%20context%E2%80%9D%20(Source).
        - eval $(opam env): https://stackoverflow.com/questions/30155960/what-is-the-use-of-eval-opam-config-env-or-eval-opam-env-and-their-differen?noredirect=1&lq=1
        - there is a way with opam exec: https://discuss.ocaml.org/t/is-eval-opam-env-switch-switch-set-switch-equivalent-to-opam-switch-set-switch/10957/4
    """
    logging.info(f'{run_eval_opam_env=}')
    # - get cmd sub output
    try:
        cmd_sub_output: str = subprocess.check_output(f'opam env --switch={switch} --set-switch'.split())
    except Exception as e:
        logging.critical(f'Error: {e=}')
        raise e
    # - run command to eval
    # command: str = f'eval {cmd_sub_output}'  # doesn't seem possible https://stackoverflow.com/questions/53950225/python-check-output-call-to-eval-with-arguments-fails
    command: list[str] = f'opam exec --switch {switch}'.split()
    # command: list[str] = command + cmd_sub_output.split()
    command: list[str] = command + [cmd_sub_output]
    logging.info(f"-> {command=}")
    try:
        # res = subprocess.run(command.split(), check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        res = subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        logging.info(f'{res.stdout.decode()=}')
        logging.info(f'{res.stderr.decode()=}')
    except Exception as e:
        logging.critical(f'Error: {e=}')
        raise e

the output of the command substitution is a bunch of env stuff. How do I excute it in a subprocess or in the opam exec command?

See it's:

b"OPAMSWITCH='ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAMSWITCH;\nOPAM_SWITCH_PREFIX='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAM_SWITCH_PREFIX;\nCAML_LD_LIBRARY_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml'; export CAML_LD_LIBRARY_PATH;\nOCAML_TOPLEVEL_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/toplevel'; export OCAML_TOPLEVEL_PATH;\nMANPATH=':/usr/kerberos/man:/usr/share/man:/usr/local/man:/usr/man:/opt/puppetlabs/puppet/share/man:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/man'; export MANPATH;\nPATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/bin:/dfs/scratch0/brando9/anaconda/envs/iit_synthesis/bin:/lfs/ampere4/0/brando9/.local/bin:/lfs/ampere4/0/brando9/.ruby-build/bin:/lfs/ampere4/0/brando9/.rbenv/shims:/lfs/ampere4/0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/anaconda/condabin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/.local/bin:/dfs/scratch0/brando9/.ruby-build/bin:/dfs/scratch0/brando9/.rbenv/shims:/dfs/scratch0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/afs/cs/software/sbin:/afs/cs/software/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin'; export PATH;\n"

but the cmd seems like nonsense:

subprocess.CalledProcessError: Command '['opam', 'exec', '--switch', 'ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1', b"OPAMSWITCH='ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAMSWITCH;\nOPAM_SWITCH_PREFIX='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1'; export OPAM_SWITCH_PREFIX;\nCAML_LD_LIBRARY_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml/stublibs:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/ocaml'; export CAML_LD_LIBRARY_PATH;\nOCAML_TOPLEVEL_PATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/lib/toplevel'; export OCAML_TOPLEVEL_PATH;\nMANPATH=':/usr/kerberos/man:/usr/share/man:/usr/local/man:/usr/man:/opt/puppetlabs/puppet/share/man:/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/man'; export MANPATH;\nPATH='/lfs/ampere4/0/brando9/.opam/ocaml-variants.4.07.1+flambda_coq-serapi.8.11.0+0.11.1/bin:/dfs/scratch0/brando9/anaconda/envs/iit_synthesis/bin:/lfs/ampere4/0/brando9/.local/bin:/lfs/ampere4/0/brando9/.ruby-build/bin:/lfs/ampere4/0/brando9/.rbenv/shims:/lfs/ampere4/0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/anaconda/condabin:/dfs/scratch0/brando9/anaconda/bin:/dfs/scratch0/brando9/.local/bin:/dfs/scratch0/brando9/.ruby-build/bin:/dfs/scratch0/brando9/.rbenv/shims:/dfs/scratch0/brando9/.rbenv/bin:/usr/local/cuda-11.7/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/afs/cs/software/sbin:/afs/cs/software/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin'; export PATH;\n"]'

I also tried just doing feval {cmd_sub_output} without success.

related:

https://discuss.ocaml.org/t/is-eval-opam-env-switch-switch-set-switch-equivalent-to-opam-switch-set-switch/10957/6

Python check_output call to eval (with arguments) fails

Running `eval $(something)` commands using Python sub-process

Is there a way to run the bash eval command in python?

What is the use of eval `opam config env` or eval $(opam env) and their difference?

opam exec https://opam.ocaml.org/doc/man/opam-exec.html