问:
How to combine chained menu and custom-select
I have added a form at the bottom of my webpage using the custom-select:
https://www.w3schools.com/howto/howto_custom_select.asp

But in the sidebar I use the chained select menu:
http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm

In the chained menu I would also like to see the custom-select dropdown styling, but for some reason it does not show. Is there a conflict in the scripts, or am I missing something here?

This is the js of the custom-select form field:

```<code>var x, i, j, l, ll, selElmnt, a, b, c;
/* Look for any elements with the class "custom-select": */
x = document.getElementsByClassName("custom-select");
l = x.length;
for (i = 0; i < l; i++) {
selElmnt = x[i].getElementsByTagName("select")[0];
ll = selElmnt.length;
/* For each element, create a new DIV that will act as the selected item: */
a = document.createElement("DIV");
a.setAttribute("class", "select-selected");
a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
x[i].appendChild(a);
/* For each element, create a new DIV that will contain the option list: */
b = document.createElement("DIV");
b.setAttribute("class", "select-items select-hide");
for (j = 1; j < ll; j++) {
/* For each option in the original select element,
create a new DIV that will act as an option item: */
c = document.createElement("DIV");
c.innerHTML = selElmnt.options[j].innerHTML;
c.addEventListener("click", function(e) {
    /* When an item is clicked, update the original select box,
    and the selected item: */
    var y, i, k, s, h, sl, yl;
    s = this.parentNode.parentNode.getElementsByTagName("select")[0];
    sl = s.length;
    h = this.parentNode.previousSibling;
    for (i = 0; i < sl; i++) {
      if (s.options[i].innerHTML == this.innerHTML) {
        s.selectedIndex = i;
        h.innerHTML = this.innerHTML;
        y = this.parentNode.getElementsByClassName("same-as-selected");
        yl = y.length;
        for (k = 0; k < yl; k++) {
          y[k].removeAttribute("class");
        }
        this.setAttribute("class", "same-as-selected");
        break;
      }
    }
    h.click();
});
b.appendChild(c);
}
x[i].appendChild(b);
a.addEventListener("click", function(e) {
/* When the select box is clicked, close any other select boxes,
and open/close the current select box: */
e.stopPropagation();
closeAllSelect(this);
this.nextSibling.classList.toggle("select-hide");
this.classList.toggle("select-arrow-active");
});
}
function closeAllSelect(elmnt) {
/* A function that will close all select boxes in the document,
except the current select box: */
var x, y, i, xl, yl, arrNo = [];
x = document.getElementsByClassName("select-items");
y = document.getElementsByClassName("select-selected");
xl = x.length;
yl = y.length;
for (i = 0; i < yl; i++) {
if (elmnt == y[i]) {
  arrNo.push(i)
} else {
  y[i].classList.remove("select-arrow-active");
}
}
for (i = 0; i < xl; i++) {
if (arrNo.indexOf(i)) {
  x[i].classList.add("select-hide");
}
}
}

/* If the user clicks anywhere outside the select box,
then close all select boxes: */
document.addEventListener("click", closeAllSelect);
</code>```

And this is the chained select code:

```<code>var _disable_empty_list=false;
var _hide_empty_list=false;
var onclickaction="alert"

function goListGroup(){
for (i=arguments.length-1;i>=0; i--){
if (arguments[i].selectedIndex!=-1){
var selectedOptionvalue=arguments[i].options[arguments[i].selectedIndex]value
if (selectedOptionvalue!=""){
if (onclickaction=="alert")
alert(selectedOptionvalue)
else if (newwindow==1)
window.open(selectedOptionvalue)
else
window.location=selectedOptionvalue
break
}
}
}
}

if (typeof(disable_empty_list)=="undefined") { disable_empty_list=_disable_empty_list; }
if (typeof(hide_empty_list)=="undefined") { hide_empty_list=_hide_empty_list; }

var cs_goodContent=true, cs_M="M", cs_L="L", cs_curTop=null, cs_curSub=null;

function cs_findOBJ(obj,n) {
  for (var i=0; i<obj.length; i++) {
    if (obj[i].name==n) { return obj[i]; }
  }
  return null;
}
function cs_findContent(n) { return cs_findOBJ(cs_content,n); }

function cs_findM(m,n) {
  if (m.name==n) { return m; }

  var sm=null;
  for (var i=0; i<m.items.length; i++) {
    if (m.items[i].type==cs_M) {
      sm=cs_findM(m.items[i],n);
      if (sm!=null) { break; }
    }
  }
  return sm;
}
function cs_findMenu(n) { return (cs_curSub!=null && cs_curSub.name==n)?cs_curSub:cs_findM(cs_curTop,n); }

function cs_contentOBJ(n,obj){ this.name=n; this.menu=obj; this.lists=new Array(); this.cookie=""; }; cs_content=new Array();
function cs_topmenuOBJ(tm) { this.name=tm; this.items=new Array(); this.df=0; this.addM=cs_addM; this.addL=cs_addL; }
function cs_submenuOBJ(dis,link,sub) {
  this.name=sub;
  this.type=cs_M; this.dis=dis; this.link=link; this.df=0;

  var x=cs_findMenu(sub);
  this.items=x==null?new Array():x.items;

  this.addM=cs_addM; this.addL=cs_addL;
}
function cs_linkOBJ(dis,link) { this.type=cs_L; this.dis=dis;this.link=link; }

function cs_addM(dis,link,sub) { this.items[this.items.length]=new cs_submenuOBJ(dis,link,sub); }
function cs_addL(dis,link) { this.items[this.items.length]=new cs_linkOBJ(dis,link); }

function cs_showMsg(msg) { window.status=msg; }
function cs_badContent(n) { cs_goodContent=false; cs_showMsg("["+n+"] Not Found."); }

function cs_optionOBJ(text,value) { this.text=text; this.value=value; }
function cs_emptyList(list) { for (var i=list.options.length-1; i>=0; i--) { list.options[i]=null; } }
function cs_refreshList(list,opt,df) {
cs_emptyList(list);

  for (var i=0; i<opt.length; i++) {
    list.options[i]=new Option(opt[i].text, opt[i].value);
  }

  if (opt.length>0) {
    list.selectedIndex=df;
  }
}
function cs_getOptions(menu) {
  var opt=new Array();
  for (var i=0; i<menu.items.length; i++) {
    opt[i]=new cs_optionOBJ(menu.items[i].dis, menu.items[i].link);
  }
  return opt;
}
function cs_updateListGroup(content,idx,sidx,mode) {
  var i=0, curItem=null, menu=content.menu;

  while (i<idx) {
    menu=menu.items[content.lists[i++].selectedIndex];
  }

  if (menu.items[sidx].type==cs_M && idx<content.lists.length-1) {
    var df=cs_getIdx(mode,content.cookie,idx+1,menu.items[sidx].df);

    cs_refreshList(content.lists[idx+1],     cs_getOptions(menu.items[sidx]), df);
    if (content.cookie) {
      cs_setCookie(content.cookie+"_"+(idx+1),df);
    }

    if (idx+1<content.lists.length) {
      if (disable_empty_list) {
        content.lists[idx+1].disabled=false;
      }
      if (hide_empty_list) {
        content.lists[idx+1].style.display="";
      }

      cs_updateListGroup(content,idx+1,df,mode);
    }
  }
  else {
    for (var s=idx+1; s<content.lists.length; s++) {
      cs_emptyList(content.lists[s]);

      if (disable_empty_list) {
        content.lists[s].disabled=true;
      }
      if (hide_empty_list) {
        content.lists[s].style.display="none";
      }

      if (content.cookie) {
        cs_setCookie(content.cookie+"_"+s,"");
      }
    }
  }
}
function cs_initListGroup(content,mode) {
  var df=cs_getIdx(mode,content.cookie,0,content.menu.df);

  cs_refreshList(content.lists[0], cs_getOptions(content.menu), df);
if (content.cookie) {
    cs_setCookie(content.cookie+"_"+0,df);
  }

  cs_updateListGroup(content,0,df,mode);
}

function cs_updateList() {
  var content=this.content;
  for (var i=0; i<content.lists.length; i++) {
    if (content.lists[i]==this) {
      if (content.cookie) {
        cs_setCookie(content.cookie+"_"+i,this.selectedIndex);
      }

      if (i<content.lists.length-1) {
        cs_updateListGroup(content,i,this.selectedIndex,"");
      }
    }
  }
}

function cs_getIdx(mode,name,idx,df) {
  if (mode) {
    var cs_idx=cs_getCookie(name+"_"+idx);
    if (cs_idx!="") {
      df=parseInt(cs_idx);
    }
  }
  return df;
}

function _setCookie(name, value) {
  document.cookie=name+"="+value;
}
function cs_setCookie(name, value) {
  setTimeout("_setCookie('"+name+"','"+value+"')",0);
}

function cs_getCookie(name) {
  var cookieRE=new RegExp(name+"=([^;]+)");
  if (document.cookie.search(cookieRE)!=-1) {
    return RegExp.$1;
  }
  else {
    return "";
  }
}

// ----
function addListGroup(n,tm) {
  if (cs_goodContent) {
    cs_curTop=new cs_topmenuOBJ(tm); cs_curSub=null;

    var c=cs_findContent(n);
    if (c==null) {
      cs_content[cs_content.length]=new cs_contentOBJ(n,cs_curTop);
    }
    else {
      delete(c.menu); c.menu=cs_curTop;
    }
  }
}

function addList(n,dis,link,sub,df) {
  if (cs_goodContent) {
    cs_curSub=cs_findMenu(n);

    if (cs_curSub!=null) {
      cs_curSub.addM(dis,link||"",sub);
      if (typeof(df)!="undefined") {     cs_curSub.df=cs_curSub.items.length-1; }
    }
    else {
      cs_badContent(n);
    }
  }
}

function addOption(n,dis,link,df) {
  if (cs_goodContent) {
    cs_curSub=cs_findMenu(n);

    if (cs_curSub!=null) {
      cs_curSub.addL(dis,link||"");
      if (typeof(df)!="undefined") {     cs_curSub.df=cs_curSub.items.length-1; }
    }
    else {
      cs_badContent(n);
    }
  }
}

function initListGroup(n) {
      var _content=cs_findContent(n), count=0;
  if (_content!=null) {
    content=new cs_contentOBJ("cs_"+n,_content.menu);
    cs_content[cs_content.length]=content;

    for (var i=1; i<initListGroup.arguments.length; i++) {
      if (typeof(arguments[i])=="object" && arguments[i].tagName && arguments[i].tagName=="SELECT") {
        content.lists[count]=arguments[i];

        arguments[i].onchange=cs_updateList;
        arguments[i].content=content; arguments[i].idx=count++;
      }
      else if (typeof(arguments[i])=="string" && /^[a-zA-    Z_]\w*$/.test(arguments[i])) {
        content.cookie=arguments[i];
      }
    }

    if (content.lists.length>0) {
      cs_initListGroup(content,content.cookie);
    }
  }
}

function resetListGroup(n) {
  var content=cs_findContent("cs_"+n);
  if (content!=null && content.lists.length>0) {
    cs_initListGroup(content,"");
  }
}
// ------
</code>```

Body:
I have added a form at the bottom of my webpage using the custom-select:
https://www.w3schools.com/howto/howto_custom_select.asp

But in the sidebar I use the chained select menu:
http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm

In the chained menu I would also like to see the custom-select dropdown styling, but for some reason it does not show. Is there a conflict in the scripts, or am I missing something here?

This is the js of the custom-select form field:

var x, i, j, l, ll, selElmnt, a, b, c;
/* Look for any elements with the class "custom-select": */
x = document.getElementsByClassName("custom-select");
l = x.length;
for (i = 0; i < l; i++) {
selElmnt = x[i].getElementsByTagName("select")[0];
ll = selElmnt.length;
/* For each element, create a new DIV that will act as the selected item: */
a = document.createElement("DIV");
a.setAttribute("class", "select-selected");
a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
x[i].appendChild(a);
/* For each element, create a new DIV that will contain the option list: */
b = document.createElement("DIV");
b.setAttribute("class", "select-items select-hide");
for (j = 1; j < ll; j++) {
/* For each option in the original select element,
create a new DIV that will act as an option item: */
c = document.createElement("DIV");
c.innerHTML = selElmnt.options[j].innerHTML;
c.addEventListener("click", function(e) {
    /* When an item is clicked, update the original select box,
    and the selected item: */
    var y, i, k, s, h, sl, yl;
    s = this.parentNode.parentNode.getElementsByTagName("select")[0];
    sl = s.length;
    h = this.parentNode.previousSibling;
    for (i = 0; i < sl; i++) {
      if (s.options[i].innerHTML == this.innerHTML) {
        s.selectedIndex = i;
        h.innerHTML = this.innerHTML;
        y = this.parentNode.getElementsByClassName("same-as-selected");
        yl = y.length;
        for (k = 0; k < yl; k++) {
          y[k].removeAttribute("class");
        }
        this.setAttribute("class", "same-as-selected");
        break;
      }
    }
    h.click();
});
b.appendChild(c);
}
x[i].appendChild(b);
a.addEventListener("click", function(e) {
/* When the select box is clicked, close any other select boxes,
and open/close the current select box: */
e.stopPropagation();
closeAllSelect(this);
this.nextSibling.classList.toggle("select-hide");
this.classList.toggle("select-arrow-active");
});
}
function closeAllSelect(elmnt) {
/* A function that will close all select boxes in the document,
except the current select box: */
var x, y, i, xl, yl, arrNo = [];
x = document.getElementsByClassName("select-items");
y = document.getElementsByClassName("select-selected");
xl = x.length;
yl = y.length;
for (i = 0; i < yl; i++) {
if (elmnt == y[i]) {
  arrNo.push(i)
} else {
  y[i].classList.remove("select-arrow-active");
}
}
for (i = 0; i < xl; i++) {
if (arrNo.indexOf(i)) {
  x[i].classList.add("select-hide");
}
}
}

/* If the user clicks anywhere outside the select box,
then close all select boxes: */
document.addEventListener("click", closeAllSelect);

And this is the chained select code:

var _disable_empty_list=false;
var _hide_empty_list=false;
var onclickaction="alert"

function goListGroup(){
for (i=arguments.length-1;i>=0; i--){
if (arguments[i].selectedIndex!=-1){
var selectedOptionvalue=arguments[i].options[arguments[i].selectedIndex]value
if (selectedOptionvalue!=""){
if (onclickaction=="alert")
alert(selectedOptionvalue)
else if (newwindow==1)
window.open(selectedOptionvalue)
else
window.location=selectedOptionvalue
break
}
}
}
}

if (typeof(disable_empty_list)=="undefined") { disable_empty_list=_disable_empty_list; }
if (typeof(hide_empty_list)=="undefined") { hide_empty_list=_hide_empty_list; }

var cs_goodContent=true, cs_M="M", cs_L="L", cs_curTop=null, cs_curSub=null;

function cs_findOBJ(obj,n) {
  for (var i=0; i<obj.length; i++) {
    if (obj[i].name==n) { return obj[i]; }
  }
  return null;
}
function cs_findContent(n) { return cs_findOBJ(cs_content,n); }

function cs_findM(m,n) {
  if (m.name==n) { return m; }

  var sm=null;
  for (var i=0; i<m.items.length; i++) {
    if (m.items[i].type==cs_M) {
      sm=cs_findM(m.items[i],n);
      if (sm!=null) { break; }
    }
  }
  return sm;
}
function cs_findMenu(n) { return (cs_curSub!=null && cs_curSub.name==n)?cs_curSub:cs_findM(cs_curTop,n); }

function cs_contentOBJ(n,obj){ this.name=n; this.menu=obj; this.lists=new Array(); this.cookie=""; }; cs_content=new Array();
function cs_topmenuOBJ(tm) { this.name=tm; this.items=new Array(); this.df=0; this.addM=cs_addM; this.addL=cs_addL; }
function cs_submenuOBJ(dis,link,sub) {
  this.name=sub;
  this.type=cs_M; this.dis=dis; this.link=link; this.df=0;

  var x=cs_findMenu(sub);
  this.items=x==null?new Array():x.items;

  this.addM=cs_addM; this.addL=cs_addL;
}
function cs_linkOBJ(dis,link) { this.type=cs_L; this.dis=dis;this.link=link; }

function cs_addM(dis,link,sub) { this.items[this.items.length]=new cs_submenuOBJ(dis,link,sub); }
function cs_addL(dis,link) { this.items[this.items.length]=new cs_linkOBJ(dis,link); }

function cs_showMsg(msg) { window.status=msg; }
function cs_badContent(n) { cs_goodContent=false; cs_showMsg("["+n+"] Not Found."); }

function cs_optionOBJ(text,value) { this.text=text; this.value=value; }
function cs_emptyList(list) { for (var i=list.options.length-1; i>=0; i--) { list.options[i]=null; } }
function cs_refreshList(list,opt,df) {
cs_emptyList(list);

  for (var i=0; i<opt.length; i++) {
    list.options[i]=new Option(opt[i].text, opt[i].value);
  }

  if (opt.length>0) {
    list.selectedIndex=df;
  }
}
function cs_getOptions(menu) {
  var opt=new Array();
  for (var i=0; i<menu.items.length; i++) {
    opt[i]=new cs_optionOBJ(menu.items[i].dis, menu.items[i].link);
  }
  return opt;
}
function cs_updateListGroup(content,idx,sidx,mode) {
  var i=0, curItem=null, menu=content.menu;

  while (i<idx) {
    menu=menu.items[content.lists[i++].selectedIndex];
  }

  if (menu.items[sidx].type==cs_M && idx<content.lists.length-1) {
    var df=cs_getIdx(mode,content.cookie,idx+1,menu.items[sidx].df);

    cs_refreshList(content.lists[idx+1],     cs_getOptions(menu.items[sidx]), df);
    if (content.cookie) {
      cs_setCookie(content.cookie+"_"+(idx+1),df);
    }

    if (idx+1<content.lists.length) {
      if (disable_empty_list) {
        content.lists[idx+1].disabled=false;
      }
      if (hide_empty_list) {
        content.lists[idx+1].style.display="";
      }

      cs_updateListGroup(content,idx+1,df,mode);
    }
  }
  else {
    for (var s=idx+1; s<content.lists.length; s++) {
      cs_emptyList(content.lists[s]);

      if (disable_empty_list) {
        content.lists[s].disabled=true;
      }
      if (hide_empty_list) {
        content.lists[s].style.display="none";
      }

      if (content.cookie) {
        cs_setCookie(content.cookie+"_"+s,"");
      }
    }
  }
}
function cs_initListGroup(content,mode) {
  var df=cs_getIdx(mode,content.cookie,0,content.menu.df);

  cs_refreshList(content.lists[0], cs_getOptions(content.menu), df);
if (content.cookie) {
    cs_setCookie(content.cookie+"_"+0,df);
  }

  cs_updateListGroup(content,0,df,mode);
}

function cs_updateList() {
  var content=this.content;
  for (var i=0; i<content.lists.length; i++) {
    if (content.lists[i]==this) {
      if (content.cookie) {
        cs_setCookie(content.cookie+"_"+i,this.selectedIndex);
      }

      if (i<content.lists.length-1) {
        cs_updateListGroup(content,i,this.selectedIndex,"");
      }
    }
  }
}

function cs_getIdx(mode,name,idx,df) {
  if (mode) {
    var cs_idx=cs_getCookie(name+"_"+idx);
    if (cs_idx!="") {
      df=parseInt(cs_idx);
    }
  }
  return df;
}

function _setCookie(name, value) {
  document.cookie=name+"="+value;
}
function cs_setCookie(name, value) {
  setTimeout("_setCookie('"+name+"','"+value+"')",0);
}

function cs_getCookie(name) {
  var cookieRE=new RegExp(name+"=([^;]+)");
  if (document.cookie.search(cookieRE)!=-1) {
    return RegExp.$1;
  }
  else {
    return "";
  }
}

// ----
function addListGroup(n,tm) {
  if (cs_goodContent) {
    cs_curTop=new cs_topmenuOBJ(tm); cs_curSub=null;

    var c=cs_findContent(n);
    if (c==null) {
      cs_content[cs_content.length]=new cs_contentOBJ(n,cs_curTop);
    }
    else {
      delete(c.menu); c.menu=cs_curTop;
    }
  }
}

function addList(n,dis,link,sub,df) {
  if (cs_goodContent) {
    cs_curSub=cs_findMenu(n);

    if (cs_curSub!=null) {
      cs_curSub.addM(dis,link||"",sub);
      if (typeof(df)!="undefined") {     cs_curSub.df=cs_curSub.items.length-1; }
    }
    else {
      cs_badContent(n);
    }
  }
}

function addOption(n,dis,link,df) {
  if (cs_goodContent) {
    cs_curSub=cs_findMenu(n);

    if (cs_curSub!=null) {
      cs_curSub.addL(dis,link||"");
      if (typeof(df)!="undefined") {     cs_curSub.df=cs_curSub.items.length-1; }
    }
    else {
      cs_badContent(n);
    }
  }
}

function initListGroup(n) {
      var _content=cs_findContent(n), count=0;
  if (_content!=null) {
    content=new cs_contentOBJ("cs_"+n,_content.menu);
    cs_content[cs_content.length]=content;

    for (var i=1; i<initListGroup.arguments.length; i++) {
      if (typeof(arguments[i])=="object" && arguments[i].tagName && arguments[i].tagName=="SELECT") {
        content.lists[count]=arguments[i];

        arguments[i].onchange=cs_updateList;
        arguments[i].content=content; arguments[i].idx=count++;
      }
      else if (typeof(arguments[i])=="string" && /^[a-zA-    Z_]\w*$/.test(arguments[i])) {
        content.cookie=arguments[i];
      }
    }

    if (content.lists.length>0) {
      cs_initListGroup(content,content.cookie);
    }
  }
}

function resetListGroup(n) {
  var content=cs_findContent("cs_"+n);
  if (content!=null && content.lists.length>0) {
    cs_initListGroup(content,"");
  }
}
// ------


来源: stackexchange

问:
Rows mismatching when using filter formula in google sheets
In Google sheets, I have used a filter to fetch selective columns from Sheet A (based on some condition) to Sheet B.
In Sheet B, I have added some more columns related to the filtered columns.The issue is when the filtered columns change, my associated columns remain as it is.
Ideally they should also get altered when I am the filtered rows get changed.

I tried grouping these columns, but that was of no use.

ContentLicense: CC BY-SA 4.0


问:
Python: How to get image from USB Webcam?
I am very new in programming with python :)

My Setup:

Windows 11 Pro

Python 3.7

OpenCV 4.7

Webcam: HD Pro Webcam C920 from logitech

I want to access the camera image in Python. Everything works with my integrated camera.
When I want to access the USB camera, nothing works. I do not get video from my USB webcam.

I try the following code to see, if there is a camera.

```<code>import cv2
cap = cv2.VideoCapture(0)

print(cap.isOpened())
</code>```

It works with my integrated Webcam. I get a True

With cap = cv2.VideoCapture(2) i get False

But if i try this with cap = cv2.VideoCapture(1) i get nothing back and there is no error. The program just keeps running. My conclusion: Somehow the USB camera has to work. Otherwise I would also expect a False for cap = VideoCapture(1).

I have already found and tried many things on the Internet. Unfortunately, nothing has helped.
I have also tried pygame, but that does not seem to run under windows.

How do I get video from my USB camera?

Thanks for your help :)

Body:
I am very new in programming with python :)

My Setup:

Windows 11 Pro

Python 3.7

OpenCV 4.7

Webcam: HD Pro Webcam C920 from logitech

I want to access the camera image in Python. Everything works with my integrated camera.
When I want to access the USB camera, nothing works. I do not get video from my USB webcam.

I try the following code to see, if there is a camera.

import cv2
cap = cv2.VideoCapture(0)

print(cap.isOpened())

It works with my integrated Webcam. I get a True

With cap = cv2.VideoCapture(2) i get False

But if i try this with cap = cv2.VideoCapture(1) i get nothing back and there is no error. The program just keeps running. My conclusion: Somehow the USB camera has to work. Otherwise I would also expect a False for cap = VideoCapture(1).

I have already found and tried many things on the Internet. Unfortunately, nothing has helped.
I have also tried pygame, but that does not seem to run under windows.

How do I get video from my USB camera?

Thanks for your help :)


问:
I have an input box.If i type 5,5 more fields will be added and if i type 6,6 field will be added,and i have to do it using React js
well My question is,I am adding input field dynamically onClicking of a button,But now i have a input box,Where i will put number,And that number of input will be added,suppuse i type 5,so 5 more input will be added so which number i will put same number of input will be added

`const addFormFields = () => {
setFormValues([...formValues, { name: "", email: "" }])
}

your text{formValues.map((element, index) => (

Name
<input type="text" name="name" value={element.name || ""} onChange={e => handleChange(index, e)} />
))

<button className="button add" type="button" onClick={() => addFormFields()}>Add`


问:
How to automate and compare two excel sheets (comparison) on sharepoint preferably with python code?
I am pulling Quickbooks data to an excel sheet on my desktop.  That sheet needs to be compared to a seperate sheet and compare which accounts are past due on the SP excel sheet with a red highlight.  Im looking for a more generalized answer.  Uploading a python file to the same SP folder? Power Automate? And then the general steps for each. Thank you.

I see many possible paths, but not sure which ones work or do not, as well as the steps for each because this is my first time automating on the cloud.


问:
Sum of elementwise product of subsets' min of two arrays
As the title suggests, writing the question explicitly could create some confusion. So, I start by an example.

Let's say we have two arrays: a = [1,3,2] and [5,4,3]. What I would like compute in a brute-force way is to first compute the minimum of each of the subset as:

```<code>aa = [1, 3, 2, min(1,3), min(1,2), min(3,2), min(1,3,2)]
bb = [5, 4, 6, min(5,4), min(5,6), min(4,6), min(5,4,6)]
</code>```

and then finally the sum of the product aa ** bb:

```<code>1*5 + 3*4 + 2*6 + min(1,3)*min(5,4) + min(1,2) * min(5,6) +  min(3,2)*min(4,6) + min(1,3,2)*min(5,4,6)
</code>```

Obviously, the brute-force calculation is not efficient, and the memory and time complexity increase exponentially with respect to the number of elements in the arrays.

To give a bit more context, the arrays could be of real numbers (positive and negatives), and each element in the first array corresponds to the element with the same index in the second array.

I have already seen some similar problems, like:

Sum of OR of smallest and largest elements of each subset of a set

Sum of products of elements of all subarrays of length k

But they are mainly focused on sum of the min of subsets for one array only.

Body:
As the title suggests, writing the question explicitly could create some confusion. So, I start by an example.

Let's say we have two arrays: a = [1,3,2] and [5,4,3]. What I would like compute in a brute-force way is to first compute the minimum of each of the subset as:

aa = [1, 3, 2, min(1,3), min(1,2), min(3,2), min(1,3,2)]
bb = [5, 4, 6, min(5,4), min(5,6), min(4,6), min(5,4,6)]

and then finally the sum of the product aa ** bb:

1*5 + 3*4 + 2*6 + min(1,3)*min(5,4) + min(1,2) * min(5,6) +  min(3,2)*min(4,6) + min(1,3,2)*min(5,4,6)

Obviously, the brute-force calculation is not efficient, and the memory and time complexity increase exponentially with respect to the number of elements in the arrays.

To give a bit more context, the arrays could be of real numbers (positive and negatives), and each element in the first array corresponds to the element with the same index in the second array.

I have already seen some similar problems, like:

Sum of OR of smallest and largest elements of each subset of a set

Sum of products of elements of all subarrays of length k

But they are mainly focused on sum of the min of subsets for one array only.


问:
Influx subquery returns no results
I'm experimenting with subqueries in InfluxDB (shell version: 1.7.4), and I've encountered this issue:

```<code>> SELECT "value"  AS "legacy" FROM my_table WHERE time >= '2022-12-22 18:00:00' AND entityId = '637deee12ccd09000b8bea57' tz('Europe/Athens')
name: my_table

time                          legacy
----                          ------
2022-12-22T18:15:16.261+02:00 11
2022-12-22T19:15:30.65+02:00  12

> SELECT * FROM (SELECT "value"  AS "legacy" FROM my_table WHERE time >= '2022-12-22 18:00:00' AND entityId = '637deee12ccd09000b8bea57' tz('Europe/Athens'))
>
> SELECT SUM(*) FROM (SELECT "value"  AS "legacy" FROM my_table WHERE time >= '2022-12-22 18:00:00' AND entityId = '637deee12ccd09000b8bea57' tz('Europe/Athens'))
>
</code>```

The second and third queries, both return an empty result. I would expect the second to return the same result as the first one, and the third to return the sum. What have I misunderstood?

Title: Influx subquery returns no results

Body:
I'm experimenting with subqueries in InfluxDB (shell version: 1.7.4), and I've encountered this issue:

> SELECT "value"  AS "legacy" FROM my_table WHERE time >= '2022-12-22 18:00:00' AND entityId = '637deee12ccd09000b8bea57' tz('Europe/Athens')
name: my_table

time                          legacy
----                          ------
2022-12-22T18:15:16.261+02:00 11
2022-12-22T19:15:30.65+02:00  12

> SELECT * FROM (SELECT "value"  AS "legacy" FROM my_table WHERE time >= '2022-12-22 18:00:00' AND entityId = '637deee12ccd09000b8bea57' tz('Europe/Athens'))
>
> SELECT SUM(*) FROM (SELECT "value"  AS "legacy" FROM my_table WHERE time >= '2022-12-22 18:00:00' AND entityId = '637deee12ccd09000b8bea57' tz('Europe/Athens'))
>

The second and third queries, both return an empty result. I would expect the second to return the same result as the first one, and the third to return the sum. What have I misunderstood?


问:
Discord.NET Slash commands not showing
So I making a discord Bot and for some Reason I can't see the slash command I created.

Slash command

[SlashCommand("ping", "Receive a ping message")]
public async Task HandlePingCommand()
{
    await RespondAsync("Stop pinging me!");
}
```
<p>I'm almost sure it has something to do with the bots permissions.
I have set the GatewayIntents AllUnprivileged and MessageContent.</p>
<p><strong>Discord Developer Portal Permissions</strong>
<img src="https://i.stack.imgur.com/5M6nB.png" alt="enter image description here" />
<img src="https://i.stack.imgur.com/22rqE.png" alt="enter image description here" /></p>
<p><img src="https://i.stack.imgur.com/bGpRD.png" alt="enter image description here" /></p>
<p><strong>Added Information</strong></p>
<pre class="lang-cs prettyprint-override"><code>if (IsDebug())
    await sCommands.RegisterCommandsToGuildAsync("my server id"));
else
    await sCommands.RegisterCommandsGloballyAsync(true);
</code>```

I also added the applications.commands scope

If any more information and / or code is need I'll ofcourse add it.

Title: Discord.NET Slash commands not showing

Body:
So I making a discord Bot and for some Reason I can't see the slash command I created.

Slash command

[SlashCommand("ping", "Receive a ping message")]
public async Task HandlePingCommand()
{
    await RespondAsync("Stop pinging me!");
}

I'm almost sure it has something to do with the bots permissions.
I have set the GatewayIntents AllUnprivileged and MessageContent.

Discord Developer Portal Permissions

Added Information

if (IsDebug())
    await sCommands.RegisterCommandsToGuildAsync("my server id"));
else
    await sCommands.RegisterCommandsGloballyAsync(true);

I also added the applications.commands scope

If any more information and / or code is need I'll ofcourse add it.


问:
Xdebug 3 / PHP / VS Code / Win10 - Not opening in browser properly - any ideas what's wrong?
I've installed XAMPP (control panel 3.3.0) on my Windows 10 PC. I then installed VS Code (v1.74.3)

I ran the phpinfo() and pasted the results into the Xdebug wizard and followed the instructions on that page (downloaded php_xdebug-3.2.0-8.2-vs16-x86_64.dll, renamed as php_xdebug.dll and saved to C:\xampp\php\ext)

I then added the following to C:\xampp\php\php.ini file.

zend_extension = xdebug
```

I restarted the Apache server and VS Code. I also installed the PHP Debug (v1.30) extension to VS Code.

When I load up a test PHP file and try to debug it, it seems to work as expected in VS Code (it stops at breakpoints, I can step through, the variables pane updates, and echo'd text appears in the debug console. This is when I do "launch currently open script").

But when I do "launch built-in web server", to see what it looks like in a browser, it opens Chrome to http://localhost:62xxx/ (the number changes each time) and the page says:

Not Found

The requested resource / was not found on this server.

I've probably just missed a setup/config step somewhere.  How do I get it to open a browser that shows what the script is outputting?

Body:
I've installed XAMPP (control panel 3.3.0) on my Windows 10 PC. I then installed VS Code (v1.74.3)

I ran the phpinfo() and pasted the results into the Xdebug wizard and followed the instructions on that page (downloaded php_xdebug-3.2.0-8.2-vs16-x86_64.dll, renamed as php_xdebug.dll and saved to C:\xampp\php\ext)

I then added the following to C:\xampp\php\php.ini file.

zend_extension = xdebug

I restarted the Apache server and VS Code. I also installed the PHP Debug (v1.30) extension to VS Code.

When I load up a test PHP file and try to debug it, it seems to work as expected in VS Code (it stops at breakpoints, I can step through, the variables pane updates, and echo'd text appears in the debug console. This is when I do "launch currently open script").

But when I do "launch built-in web server", to see what it looks like in a browser, it opens Chrome to http://localhost:62xxx/ (the number changes each time) and the page says:

Not Found

The requested resource / was not found on this server.

I've probably just missed a setup/config step somewhere.  How do I get it to open a browser that shows what the script is outputting?


问:
How to get the properties name, type and other info from a class gotton through CSharpCompilation.Create()?
I've previously asked a question "How to get the Type of an Array of Nullable Primitive?" How to get the Type of an Array of Nullable Primitive?.

In that question, I have a class in my c# program and I was able to use reflection to find out the properties name/type/array(or not)/nullable(or not).

Now, I want to do the same but the class is read in from a file (and not part of the c# program).  I check online for some codes that I can compile the file using CSharpCompilation.Create() into an assembly.  By trial and error, I manage to print out the name and type.

```<code> Assembly a = Assembly.Load(ms.ToArray());
 var _prop = a.GetType("ClassName").GetProperties();

 foreach (var _p in _prop)
 {
      Console.WriteLine(_p.Name);
      Console.WriteLine(_p.GetMethod.ReturnType.Name);
      Console.WriteLine();
 }
</code>```

I don't know if this is the correct way to get the information.  But my problem now is that I cannot find out if the type is an array and/or a nullable type.  In my previous question, I learnt that I can use

```<code>var type = _propertyType.GetElementType();
type = Nullable.GetUnderylingType(type) ?? type;
var UType = type.Name;
</code>```

to get the nullable.  In my current example, how do I know if the property is an array and/or nullable ?  The package I'm using:

```<code>using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using System.Reflection;
</code>```

Thanks.

Body:
I've previously asked a question "How to get the Type of an Array of Nullable Primitive?" How to get the Type of an Array of Nullable Primitive?.

In that question, I have a class in my c# program and I was able to use reflection to find out the properties name/type/array(or not)/nullable(or not).

Now, I want to do the same but the class is read in from a file (and not part of the c# program).  I check online for some codes that I can compile the file using CSharpCompilation.Create() into an assembly.  By trial and error, I manage to print out the name and type.

 Assembly a = Assembly.Load(ms.ToArray());
 var _prop = a.GetType("ClassName").GetProperties();

 foreach (var _p in _prop)
 {
      Console.WriteLine(_p.Name);
      Console.WriteLine(_p.GetMethod.ReturnType.Name);
      Console.WriteLine();
 }

I don't know if this is the correct way to get the information.  But my problem now is that I cannot find out if the type is an array and/or a nullable type.  In my previous question, I learnt that I can use

var type = _propertyType.GetElementType();
type = Nullable.GetUnderylingType(type) ?? type;
var UType = type.Name;

to get the nullable.  In my current example, how do I know if the property is an array and/or nullable ?  The package I'm using:

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using System.Reflection;

Thanks.


问:
Because of scientific notation, data is automatically converted to numeric in importation
I have some registers like 1D-2, 1E-2, 1F-3, and so on in a system.

When exporting a .csv from the system, and reading the file in excel the rows with "E" in the name are automacally converted to number due the scientific notation, e.g., 1E-1 became 0.1, with no possibility of returning the data to the original format, even converting to text.

Is it possible to avoid this conversion when importing my.csv? Because I am unable to alter my original data pattern.


问:
Concurrent users trying to insert and update in same SQL server table
I have a scenario where 50-70 users are trying to do API calls to insert records in SQL Server tables and also update the existing records at the same time.

SQL server version is as below

Microsoft SQL Server 2017 (RTM-CU22) (KB4577467) - 14.0.3356.20 (X64)   Aug 20 2020 22:33:27   Copyright (C) 2017 Microsoft Corporation  Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2016 Datacenter 10.0  (Build 14393: )
(Hypervisor)

To avoid selects, AWS is doing READ REPLICA of audit tables to a new database.

However, INSERT + UPDATE on the same table (may be different records) are creating deadlocks.

How can this be handled in a seamless way ?

Generally this type of concurrent web application : how do they manage deadlocks? Should there by any queue mechanisms to set the order? If yes, how ?


问:
I can't filter the API service
I want to filter and extract the data from an API service with the country code entered, the user's location data and the entered distance.But when ı try to do this all data except distance comes according to the filter I gave.

This is my APİ

```<code>@GET("poi?key=26018b6e-bf05-4e36-ba42-4ee689645f76")
fun getChargeStations(
    @Query("countryCode") countryCode: String,
    @Query("distance") distance: Int,
    @Query("latitude") latitude: Double,
    @Query("longtitude") longtitude: Double
): Single<ChargingResponse>
</code>```

When ı try this the filter works fine:

```<code>@GET("poi?countrycode="TR"&longitude=29.1214153&latitude=40.9560062&distance=1&key=9683a373-b255-497f-a835-99326f835bfc")
FUN getchargeitems(): Single<ChargingResponse
</code>```

Title: I can't filter the API service

Body:
I want to filter and extract the data from an API service with the country code entered, the user's location data and the entered distance.But when ı try to do this all data except distance comes according to the filter I gave.

This is my APİ

@GET("poi?key=26018b6e-bf05-4e36-ba42-4ee689645f76")
fun getChargeStations(
    @Query("countryCode") countryCode: String,
    @Query("distance") distance: Int,
    @Query("latitude") latitude: Double,
    @Query("longtitude") longtitude: Double
): Single<ChargingResponse>

When ı try this the filter works fine:

@GET("poi?countrycode="TR"&longitude=29.1214153&latitude=40.9560062&distance=1&key=9683a373-b255-497f-a835-99326f835bfc")
FUN getchargeitems(): Single<ChargingResponse


问:
How to merge different datasets for Classification Problem in deep learning
If I have two very different types of datasets and two very different classification techniques where output class labels of both data sources are same, is there a good way to combine the two outputs?  I've heard of several concepts like boosting and ensemble learning, would these be applicable?

I have heard of ensemble learning and multimodal approaches.


问:
TCP connection close automatically
My TCP Server not close client socket,but the client read EOF.,Then client closes socket,my server recv failed with 64..(winsock)

I want to konw when does this happen.

Title: TCP connection close automatically


问:
Exception in thread "main" org.apache.kafka.common.KafkaException: Failed to construct kafka consumer: SSL Error
I have this error

```<code>Caused by: org.apache.kafka.common.KafkaException: SSL trust store is specified, but trust store password is not specified.
    at org.apache.kafka.common.security.ssl.SslFactory.createTruststore(SslFactory.java:184)
    at org.apache.kafka.common.security.ssl.SslFactory.configure(SslFactory.java:104)
    at org.apache.kafka.common.network.SslChannelBuilder.configure(SslChannelBuilder.java:41)
</code>```

Although same code is deployed in other environments work just fine.

The code is trying to work as a kafka consumer

If I query using Kafka console consumer, it fetches data properly

Body:
I have this error

Caused by: org.apache.kafka.common.KafkaException: SSL trust store is specified, but trust store password is not specified.
    at org.apache.kafka.common.security.ssl.SslFactory.createTruststore(SslFactory.java:184)
    at org.apache.kafka.common.security.ssl.SslFactory.configure(SslFactory.java:104)
    at org.apache.kafka.common.network.SslChannelBuilder.configure(SslChannelBuilder.java:41)

Although same code is deployed in other environments work just fine.

The code is trying to work as a kafka consumer

If I query using Kafka console consumer, it fetches data properly


问:
How do I resolve "BAD_COLUMN_NAME" error in python bokeh? What does the error mean?
I am attempting to create a tiled heatmap somewhat like the one shown here using bokeh. It seems like everything should be working, but I keep getting an E-1001 (BAD_COLUMN_NAME) error. I've double-checked that everything is indeed named properly and that the 'z' variable does contain data, but still get the error. The problem seems to be in the "graph.rect() portion of the code. The dataset is pretty substantial and I shouldn't share it publicly, but here's the code:

```<code>from bokeh.plotting import figure, output_file, show
from bokeh.transform import linear_cmap
import pandas as pd

orig_data = pd.read_csv('AcuteCatVals_Coords.csv')

x = list(orig_data.x_coord)
y = list(orig_data.y_coord)
z = list(orig_data.z_coord)
low, high = min(z), max(z)

source = ColumnDataSource(dict(x=x, y=y, z=z))

graph = figure(title='rectTrial')

cmap = linear_cmap(field_name='z', palette=magma(10), low=low, high=high)

graph.rect(x,
           y,
           width=1,
           height=1,
           color=cmap)

show(graph)
</code>```

Here is the error it keeps throwing:

```<code>ERROR:bokeh.core.validation.check:E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name. This could either be due to a misspelling or typo, or due to an expected column being missing. : key "fill_color" value "z", key "hatch_color" value "z", key "line_color" value "z", key "x" value "x", key "y" value "y" [renderer: GlyphRenderer(id='10934', ...)]
</code>```

I've attempted different color mapping techniques and whatnot. I ended up getting a similar result to what I'm trying to do by using a scatterplot (shown below) but I would really like to figure out how to get the rectangles to work.

Any thoughts would be greatly appreciated!

Body:
I am attempting to create a tiled heatmap somewhat like the one shown here using bokeh. It seems like everything should be working, but I keep getting an E-1001 (BAD_COLUMN_NAME) error. I've double-checked that everything is indeed named properly and that the 'z' variable does contain data, but still get the error. The problem seems to be in the "graph.rect() portion of the code. The dataset is pretty substantial and I shouldn't share it publicly, but here's the code:

from bokeh.plotting import figure, output_file, show
from bokeh.transform import linear_cmap
import pandas as pd

orig_data = pd.read_csv('AcuteCatVals_Coords.csv')

x = list(orig_data.x_coord)
y = list(orig_data.y_coord)
z = list(orig_data.z_coord)
low, high = min(z), max(z)

source = ColumnDataSource(dict(x=x, y=y, z=z))

graph = figure(title='rectTrial')

cmap = linear_cmap(field_name='z', palette=magma(10), low=low, high=high)

graph.rect(x,
           y,
           width=1,
           height=1,
           color=cmap)

show(graph)

Here is the error it keeps throwing:

ERROR:bokeh.core.validation.check:E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name. This could either be due to a misspelling or typo, or due to an expected column being missing. : key "fill_color" value "z", key "hatch_color" value "z", key "line_color" value "z", key "x" value "x", key "y" value "y" [renderer: GlyphRenderer(id='10934', ...)]

I've attempted different color mapping techniques and whatnot. I ended up getting a similar result to what I'm trying to do by using a scatterplot (shown below) but I would really like to figure out how to get the rectangles to work.

Any thoughts would be greatly appreciated!


问:
Split fixed effect regression: ERROR in esttable() output "'nchar()' requires a character vector"
I have been trying to run a fixed effect OLS regression using the package "fixest".
There are supposed to be multiple regressions generated (per year) using "split = "year"".
This seems to work without any errors but when I try to plot the regression reults using "esttable()" I receive an error:

--> Error in nchar(ROWNAMES) : 'nchar()' requires a character vector

```<code>rm(list=ls())
options(digits = 7, scipen = 999)

library(fixest)
library(wooldridge) # for Dataset

data(crime4)
m1 <- feols(crmrte ~ polpc | year,  data = crime4, split = "year")
esttable(m1)
</code>```

I tried to research the issue and follow the traceback, but don't understand the packages documentation on CRAN.

Body:
I have been trying to run a fixed effect OLS regression using the package "fixest".
There are supposed to be multiple regressions generated (per year) using "split = "year"".
This seems to work without any errors but when I try to plot the regression reults using "esttable()" I receive an error:

--> Error in nchar(ROWNAMES) : 'nchar()' requires a character vector

rm(list=ls())
options(digits = 7, scipen = 999)

library(fixest)
library(wooldridge) # for Dataset

data(crime4)
m1 <- feols(crmrte ~ polpc | year,  data = crime4, split = "year")
esttable(m1)

I tried to research the issue and follow the traceback, but don't understand the packages documentation on CRAN.


问:
How to correctly set env variables in oh-my-zsh
I am new to use oh-my-zsh and couldnt figure out where can I add a new env variable which we usually add in .zshrc file. Now the new zshrc file(after installing oh-my-zsh) does not show any of my already added env variables also.

I am using macbook(m1/apple) chip with oh-my-zsh. How or where can I add a new env variable. For example before using oh-my-zsh, I used to add the following lines in ~./zshrc and source the file/open a new terminal to reflect the changes.

```<code>eval "$(~/.rbenv/bin/rbenv init - zsh)"
export PATH="$HOME:/.rbenv/versions/3.1.3/bin
</code>```

Body:
I am new to use oh-my-zsh and couldnt figure out where can I add a new env variable which we usually add in .zshrc file. Now the new zshrc file(after installing oh-my-zsh) does not show any of my already added env variables also.

I am using macbook(m1/apple) chip with oh-my-zsh. How or where can I add a new env variable. For example before using oh-my-zsh, I used to add the following lines in ~./zshrc and source the file/open a new terminal to reflect the changes.

eval "$(~/.rbenv/bin/rbenv init - zsh)"
export PATH="$HOME:/.rbenv/versions/3.1.3/bin


问:
Flutter websocket Error. Connection to 'http:...#' was not upgraded to websocket
I'm getting this error when trying to connect to the server I opened locally.
It converts ws to http. and put a # sign at the end.

Socket:
final channel = IOWebSocketChannel.connect(Uri.parse('ws://192.168.1.226:10600'));

**Error: **
Restarted application in 1.052ms. D/EGL_emulation(14743): app_time_stats: avg=8757.14ms min=3.84ms max=218720.27ms count=25 E/flutter (14743): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: WebSocketException: Connection to 'http://192.168.1.226:10600#' was not upgraded to websocket

The server was created with .net 4.8.

I would be glad if you help

I want to show the messages sent by the server in the application.


问:
Avoid 'interleaved LSN' in postgres replication slot
I am trying to stream data from postgres replication slot with output plugin 'test_decoding'. When there are big, multiple transactions running, the output plugin seems to have interleaved LSN, ie, they are not in sequence.

How can I have the transactions in sequence and if that's not possible, how can I keep track of the offset, ie, up till where I have read and I will use this offset as starting point to stream data.


问:
How i can set open by default collapsible?
How can i set this default collapsible opening?
Without bootstrap

`

.collapsible {
background-color: #777;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}

.active, .collapsible:hover {
background-color: #555;
}

.collapsible:after {
content: '\002B';
color: white;
font-weight: bold;
float: right;
margin-left: 5px;
}

.active:after {
content: "\2212";
}

.content {
padding: 0 18px;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
background-color: #f1f1f1;
}

Animated Collapsibles

A Collapsible:

Open Collapsible

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Collapsible Set:

Open Section 1

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Open Section 2

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Open Section 3

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

var coll = document.getElementsByClassName("collapsible");
var i;

for (i = 0; i

`


问:
VBA FilePicker no longer opening from ThisWork.Path
I have a workbook (located on our network) with a macro enabled so I can email exported PDF worksheets via Outlook every Friday. The exported worksheet PDF gets saved to the same location as the Workbook. Outlook then opens the FilePicker and lets me select the file that I want to attach to the email. For some reason the Filepicker is now not opening to ThisWork.path anymore; it opens to my default MyDocuments located on my native computer. The exported file still saves in the proper spot (located on the network) but the FilePicker just wont open to that location. Now, if I move this Workbook to my direct computer, the FilePicker works as it should. I have not changed anything in the VBA so I don't know why this is all the sudden not working. It worked just last week. Below is the code I believe to be relevant to the issue.</p>
```<code>   'Creates workpath string
    Dim mypath As String, fname As String
    mypath = ThisWorkbook.Path
    fname = CreateObject("Scripting.FileSystemObject").GetBaseName(ThisWorkbook.Name)
'********************************************************
    'Saves PDF with Template Text and Date based on Order Date
    Sheets(1).ExportAsFixedFormat 0, mypath & "\" & "TEXT Order Sheet  " & Format(Range("D7").Value, "mm-dd-yy")
    ActiveSheet.Name = Format(Range("D7").Value, "mm-dd-yy")
'********************************************************
Dim xStrFile As String
    Dim xFilePath As String
    Dim xFileDlg As FileDialog
    Dim xFileDlgItem As Variant
    Dim xOutApp As Outlook.Application
    Dim xMailOut As Outlook.MailItem
    Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    Set xFileDlg = Application.FileDialog(msoFileDialogFilePicker)

    xFileDlg.Filters.Clear
    xFileDlg.Filters.Add "pdf files", "*.pdf"
    xFileDlg.AllowMultiSelect = True
    xFileDlg.InitialFileName = ThisWorkbook.Path

    If xFileDlg.Show = -1 Then
'********************************************************
        With xMailOut
         .Display
            .To = "fake@email.com"
            .Subject = "TEXT" & Range("D7").Value
            .HTMLBody = "<p style='font-family:calibri;font-size:12.0pt'>" & "Here is our TEXT order for the week of " & Range("D7").Value & "." & " Please respond to this email to confirm that you have received the order." & .HTMLBody
                        For Each xFileDlgItem In xFileDlg.SelectedItems
                .Attachments.Add xFileDlgItem
            Next xFileDlgItem
            .Display
        End With
    End If
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
'********************************************************
</code>```

Body:
I have a workbook (located on our network) with a macro enabled so I can email exported PDF worksheets via Outlook every Friday. The exported worksheet PDF gets saved to the same location as the Workbook. Outlook then opens the FilePicker and lets me select the file that I want to attach to the email. For some reason the Filepicker is now not opening to ThisWork.path anymore; it opens to my default MyDocuments located on my native computer. The exported file still saves in the proper spot (located on the network) but the FilePicker just wont open to that location. Now, if I move this Workbook to my direct computer, the FilePicker works as it should. I have not changed anything in the VBA so I don't know why this is all the sudden not working. It worked just last week. Below is the code I believe to be relevant to the issue.

   'Creates workpath string
    Dim mypath As String, fname As String
    mypath = ThisWorkbook.Path
    fname = CreateObject("Scripting.FileSystemObject").GetBaseName(ThisWorkbook.Name)
'********************************************************
    'Saves PDF with Template Text and Date based on Order Date
    Sheets(1).ExportAsFixedFormat 0, mypath & "\" & "TEXT Order Sheet  " & Format(Range("D7").Value, "mm-dd-yy")
    ActiveSheet.Name = Format(Range("D7").Value, "mm-dd-yy")
'********************************************************
Dim xStrFile As String
    Dim xFilePath As String
    Dim xFileDlg As FileDialog
    Dim xFileDlgItem As Variant
    Dim xOutApp As Outlook.Application
    Dim xMailOut As Outlook.MailItem
    Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xMailOut = xOutApp.CreateItem(olMailItem)
    Set xFileDlg = Application.FileDialog(msoFileDialogFilePicker)

    xFileDlg.Filters.Clear
    xFileDlg.Filters.Add "pdf files", "*.pdf"
    xFileDlg.AllowMultiSelect = True
    xFileDlg.InitialFileName = ThisWorkbook.Path

    If xFileDlg.Show = -1 Then
'********************************************************
        With xMailOut
         .Display
            .To = "fake@email.com"
            .Subject = "TEXT" & Range("D7").Value
            .HTMLBody = "
" & "Here is our TEXT order for the week of " & Range("D7").Value & "." & " Please respond to this email to confirm that you have received the order." & .HTMLBody
                        For Each xFileDlgItem In xFileDlg.SelectedItems
                .Attachments.Add xFileDlgItem
            Next xFileDlgItem
            .Display
        End With
    End If
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
'********************************************************


问:
Seeked event - tolerance
I want to know the average "time-lost" (tolerance) in the seeked event.

e.g. video.currentTime = 50, but we may have timeupdate lost (timeupdate event) "250ms", so, it is a possibility to seek to "50.250s", and I don't know if we can lose more time or not e.g. if we run the code in old or bad device.

I tried in the new devices and the time update was instant, but I have to be sure for the bad devices.

Title: Seeked event - tolerance


问:
How can i make a laravel api admin/user login role authentication?
Im making a api with laravel 9 about a fitness app. This app will have 2 roles Admin and Normal user. What im struggling with is making an Authentication system for the users, so that an Admin can have access to certain routes that a normal user wont. To do that i created a middleware called AdminMiddleware

```<code>    {
            if(Auth::check()){

                //if admin role = 1
                $user = Auth::guard('api')->user();
                if(Auth::user()->role == 1){
                    return $next($request);

                }
                else{
                    return redirect('/login')->with('message', 'Access Denied');
                }
            }
            else{
                return redirect('/login')->with('message', 'Log In to gain access');
            }

        return $next($request);

    }
</code>```

This checks whether the user is an admin or not.

This is the routes where the middleware is used

```<code>Route::middleware(['auth', 'isAdmin'])->get('/admin', function () {
    Route::post('/addProducts', [ProductController::class, 'store']);
    Route::delete('/deleteProducts/{id}', [ProductController::class, 'destroy']);

    Route::post('/addRecipe', [RecipeController::class, 'store']);
    Route::put('/updateRecipe/{id}', [RecipeController::class, 'update'], function (Request $id) {
        return 'Recipe '.$id;
    });
    Route::delete('/deleteRecipe/{id}', [RecipeController::class, 'destroy']);

    Route::post('/addEvent', [SpecialEventsController::class, 'store']);
    Route::get('event/{id}', [SpecialEventsController::class, 'show'], function (Request $id) {
        return 'Events '.$id;
    });
    Route::put('/updateEvent/{id}', [SpecialEventsController::class, 'update'], function (Request $id) {
        return 'Recipe '.$id;
    });
    Route::delete('/deleteEvent/{id}', [SpecialEventsController::class, 'destroy']);

});
</code>```

And this is the Login Controller, where im having my problems:

```<code>public function login(Request $request)
            {

                //(Auth::guard('api')->attempt(['email' => $request->email, 'password' => $request->password]))
                if(Auth::guard('api')(['email' => $request->email, 'password' => $request->password])){
                    $user = Auth::guard('api')->user();
                    if($user){
                        $success['token'] =  $user->createToken('MyApp')->accessToken;
                        $success['name'] =  $user->name;
                        $success['role'] =  $user->role;
                        return $this->sendResponse($success, 'User login successfully.');
                    }
                    else{
                        return $this->sendError('Unauthorised.', ['error'=>'Unauthorised']);
                    }
                }
                else{
                    return $this->sendError('Unauthorised.', ['error'=>'Unauthorised']);
                }
            }
        }
</code>```

This code is returning

```<code>Error: Object of type Laravel\Passport\Guards\TokenGuard is not callable in file C:\xampp\htdocs\Ritwell-App - Copy (2)\app\Http\Controllers\API\RegisterController.php on line 52
</code>```

The part

```<code>Auth::guard('api')(['email' => $request->email, 'password' => $request->password])){
</code>```

was originally

```<code>if(Auth::attempt
</code>```

but that code gave me an exception

```<code>BadMethodCallException: Method Laravel\Passport\Guards\TokenGuard::attempt does not exist. in file C:\xampp\htdocs\Ritwell-App - Copy (2)\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php on line 113
</code>```

I tried using resources online to help with answers but this is what i could come up with so far and it isnt working.

Can someone tell me what am i doing wrong and what is missing in my code?

Body:
Im making a api with laravel 9 about a fitness app. This app will have 2 roles Admin and Normal user. What im struggling with is making an Authentication system for the users, so that an Admin can have access to certain routes that a normal user wont. To do that i created a middleware called AdminMiddleware

    {
            if(Auth::check()){

                //if admin role = 1
                $user = Auth::guard('api')->user();
                if(Auth::user()->role == 1){
                    return $next($request);

                }
                else{
                    return redirect('/login')->with('message', 'Access Denied');
                }
            }
            else{
                return redirect('/login')->with('message', 'Log In to gain access');
            }

        return $next($request);

    }

This checks whether the user is an admin or not.

This is the routes where the middleware is used

Route::middleware(['auth', 'isAdmin'])->get('/admin', function () {
    Route::post('/addProducts', [ProductController::class, 'store']);
    Route::delete('/deleteProducts/{id}', [ProductController::class, 'destroy']);

    Route::post('/addRecipe', [RecipeController::class, 'store']);
    Route::put('/updateRecipe/{id}', [RecipeController::class, 'update'], function (Request $id) {
        return 'Recipe '.$id;
    });
    Route::delete('/deleteRecipe/{id}', [RecipeController::class, 'destroy']);

    Route::post('/addEvent', [SpecialEventsController::class, 'store']);
    Route::get('event/{id}', [SpecialEventsController::class, 'show'], function (Request $id) {
        return 'Events '.$id;
    });
    Route::put('/updateEvent/{id}', [SpecialEventsController::class, 'update'], function (Request $id) {
        return 'Recipe '.$id;
    });
    Route::delete('/deleteEvent/{id}', [SpecialEventsController::class, 'destroy']);

});

And this is the Login Controller, where im having my problems:

public function login(Request $request)
            {

                //(Auth::guard('api')->attempt(['email' => $request->email, 'password' => $request->password]))
                if(Auth::guard('api')(['email' => $request->email, 'password' => $request->password])){
                    $user = Auth::guard('api')->user();
                    if($user){
                        $success['token'] =  $user->createToken('MyApp')->accessToken;
                        $success['name'] =  $user->name;
                        $success['role'] =  $user->role;
                        return $this->sendResponse($success, 'User login successfully.');
                    }
                    else{
                        return $this->sendError('Unauthorised.', ['error'=>'Unauthorised']);
                    }
                }
                else{
                    return $this->sendError('Unauthorised.', ['error'=>'Unauthorised']);
                }
            }
        }

This code is returning

Error: Object of type Laravel\Passport\Guards\TokenGuard is not callable in file C:\xampp\htdocs\Ritwell-App - Copy (2)\app\Http\Controllers\API\RegisterController.php on line 52

The part

Auth::guard('api')(['email' => $request->email, 'password' => $request->password])){

was originally

if(Auth::attempt

but that code gave me an exception

BadMethodCallException: Method Laravel\Passport\Guards\TokenGuard::attempt does not exist. in file C:\xampp\htdocs\Ritwell-App - Copy (2)\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php on line 113

I tried using resources online to help with answers but this is what i could come up with so far and it isnt working.

Can someone tell me what am i doing wrong and what is missing in my code?


问:
How To Change Chrome Extension Icon Dynamically With If Statement?
I am currently using the following code which changes the icon after clicking on the chrome extension icon. However, I would like to change it with a dependency, meaning I would like to use a if stement, which, let's say, changes the iconA.png to iconB.png when I click on the extention icon and vise versa.

This is the code I have so far:

chrome.action.onClicked.addListener(function (tab) { if (chro) chrome.action.setIcon({ path: "icon16.png" }) });


问:
How to draw line segments made of different colors with correct joins?
I use the following code to draw multiple lines :

```<code>using (var path = new GraphicsPath())
{
    foreach (var linesByColor in lines.GroupByAdjacent(x => x.Color))
    {
        path.Reset();
        foreach (var lines in linesByColor)
        {
            path.AddLine(...);
        }

        using (var pen = new Pen(linesByColor.Key))
        {
            g.DrawPath(pen, path);
        }
    }
}
</code>```

Here is the result (please ignore the black border) :

The issue occurs between red and green paths (at the join).
It make sense since it's two different paths.
Here is what I want :

Is there a way to achieve this easily ?
One possibility would be to not draw lines but shapes, taking care of the joins. That's probably not trivial.

Body:
I use the following code to draw multiple lines :

using (var path = new GraphicsPath())
{
    foreach (var linesByColor in lines.GroupByAdjacent(x => x.Color))
    {
        path.Reset();
        foreach (var lines in linesByColor)
        {
            path.AddLine(...);
        }

        using (var pen = new Pen(linesByColor.Key))
        {
            g.DrawPath(pen, path);
        }
    }
}

Here is the result (please ignore the black border) :

The issue occurs between red and green paths (at the join).
It make sense since it's two different paths.
Here is what I want :

Is there a way to achieve this easily ?
One possibility would be to not draw lines but shapes, taking care of the joins. That's probably not trivial.


问:
tkinter unkown error with window updating
i wrote a simple program in tkinter to remind me for medicines every fixed interval of time, and when the alarm rings a snooze button should appear which should set the timer to 10 minutes and after that alarm should ring again and if stop is pressed instead of snooze this time it should reset the timer to initially given fixed interval of time.
i don't understand why the snooze button never appears after alarm plays
here's the code :-

```<code>import tkinter as tk
import sounddevice as sd
import soundfile as sf
import time
stop = False
def start_alarm():
    global interval
    interval = int(entry.get())  # get the interval from the user
    time_left.config(text=str(interval) + " seconds left")
    countdown()

def stop_alarm():
    global stop
    stop = True
    sd.stop()
    start_alarm()

def snooze_alarm():
    global stop
    stop = True
    sd.stop()
    interval += 600
    time_left.config(text=str(interval) + " seconds left")
    countdown()

def countdown():
    global interval
    global stop
    if interval > 0 and not stop:
        interval -= 1
        time_left.config(text=str(interval) + "    seconds left")
        time_left.after(1000, countdown)
    elif not stop:
        play_alarm()

def play_alarm():
    data, fs = sf.read('alarm.wav', dtype='float32')
    sd.play(data, fs)
    status = sd.wait()
    create_snooze_button()

def create_snooze_button():
    global snooze_button
    snooze_button = tk.Button(root, text="Snooze", command=snooze_alarm)
    snooze_button.pack()

root = tk.Tk()
root.title("Medicine Reminder")

label = tk.Label(root, text="Enter time interval (in seconds):")
label.pack()

entry = tk.Entry(root)
entry.pack()

start_button = tk.Button(root, text="Start", command=start_alarm)
start_button.pack()

stop_button = tk.Button(root, text="Stop", command=stop_alarm)
stop_button.pack()

time_left = tk.Label(root, text="")
time_left.pack()

root.mainloop()

</code>```

any help is highly appreciated

Body:
i wrote a simple program in tkinter to remind me for medicines every fixed interval of time, and when the alarm rings a snooze button should appear which should set the timer to 10 minutes and after that alarm should ring again and if stop is pressed instead of snooze this time it should reset the timer to initially given fixed interval of time.
i don't understand why the snooze button never appears after alarm plays
here's the code :-

import tkinter as tk
import sounddevice as sd
import soundfile as sf
import time
stop = False
def start_alarm():
    global interval
    interval = int(entry.get())  # get the interval from the user
    time_left.config(text=str(interval) + " seconds left")
    countdown()

def stop_alarm():
    global stop
    stop = True
    sd.stop()
    start_alarm()

def snooze_alarm():
    global stop
    stop = True
    sd.stop()
    interval += 600
    time_left.config(text=str(interval) + " seconds left")
    countdown()

def countdown():
    global interval
    global stop
    if interval > 0 and not stop:
        interval -= 1
        time_left.config(text=str(interval) + "    seconds left")
        time_left.after(1000, countdown)
    elif not stop:
        play_alarm()

def play_alarm():
    data, fs = sf.read('alarm.wav', dtype='float32')
    sd.play(data, fs)
    status = sd.wait()
    create_snooze_button()

def create_snooze_button():
    global snooze_button
    snooze_button = tk.Button(root, text="Snooze", command=snooze_alarm)
    snooze_button.pack()

root = tk.Tk()
root.title("Medicine Reminder")

label = tk.Label(root, text="Enter time interval (in seconds):")
label.pack()

entry = tk.Entry(root)
entry.pack()

start_button = tk.Button(root, text="Start", command=start_alarm)
start_button.pack()

stop_button = tk.Button(root, text="Stop", command=stop_alarm)
stop_button.pack()

time_left = tk.Label(root, text="")
time_left.pack()

root.mainloop()

any help is highly appreciated


问:
Set Label control on BezierSegment path
I understand the concept of drawing the path using BezierSegment.
However, can I set label control position onto the path? Thks!!</p>

ContentLicense: CC BY-SA 3.0

Title: Set Label control on BezierSegment path


问:
JWT authentication API spring Java
I have got a trouble with a test I am having.
I want to make an authentication JWT with spring.
But I am not a java developper.
I grab some stuff on the internet
the result is coded here : https://github.come/etouraille/boat

Previously I had a rest API that was working, but when I haded the jwt things not working anymore
When I curl Localhost I have got no return from the api

curl -v localhost:8080/boats/99

Please some one help me managing my rest authenticated API

Kind Regards

Title: JWT authentication API spring Java


问:
programmatic access to pubchem bioassay data in R
I'm trying to loop over a list of 11,500 PubChem CIDs to retrieve the BioAssay results table (when available).
For example, for the CID 2965821, this is the table I want to obtain. I only need the rows where activity is "Active".

Following this script, I can only get to the numbers of the active aids, but I can't get the full table with the names of the targets, etc.

Here is the code I have with only one compound:

```<code>df <- data.frame("Compound" = 2965821)
df <- as.data.table(df)

#set up progressbar
pb <- txtProgressBar(min = 0, max = nrow(df), style = 3)

#loop through df rows
for(i in 1:nrow(df)){
  #update progressbar
  setTxtProgressBar(pb, i)

  #extract active aids data
  data <- fromJSON(readLines(paste0("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/", df[i,]$Compound, "/aids/JSON/?aids_type=active")))

  #extract active aid numbers
  compound_active_aid_numbers <- data$InformationList$Information$AID

  #add to df
  df[i, name := compound_active_aid_numbers]
}

compound_active_aid_numbers

</code>```

When I asked the PubChem staff for help, they gave me a different URL syntax that uses Structured Data Query (SDQ) agent and that directs me to the table I need. I've integrated this URL in the following loop – the problem is that it is extremely slow.

```<code>library(tidyverse)

df <- data.frame("Compound" = 2965821)
df <- as.data.table(df)
data_bioassays <- NULL
for(i in 1:nrow(df)){
url <- paste0('https://pubchem.ncbi.nlm.nih.gov/sdq/sdqagent.cgi?infmt=json&outfmt=csv&query={"download":"*","collection":"bioactivity","where":{"ands":[{"cid":"',df[i,]$Compound,'"}]},"order":["acvalue,asc"],"start":1,"limit":10000000,"downloadfilename":"CID_',df[i,]$Compound,'_bioactivity","nullatbottom":1}')
  data_x <- fread(url) %>% filter(activity=="Active")
  data_bioassays <- bind_rows(data_bioassays,data_x)
}

data_bioassays
</code>```

Would you have any suggestions on how to improve this code?

Thank you!

Body:
I'm trying to loop over a list of 11,500 PubChem CIDs to retrieve the BioAssay results table (when available).
For example, for the CID 2965821, this is the table I want to obtain. I only need the rows where activity is "Active".

Following this script, I can only get to the numbers of the active aids, but I can't get the full table with the names of the targets, etc.

Here is the code I have with only one compound:

df <- data.frame("Compound" = 2965821)
df <- as.data.table(df)

#set up progressbar
pb <- txtProgressBar(min = 0, max = nrow(df), style = 3)

#loop through df rows
for(i in 1:nrow(df)){
  #update progressbar
  setTxtProgressBar(pb, i)

  #extract active aids data
  data <- fromJSON(readLines(paste0("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/", df[i,]$Compound, "/aids/JSON/?aids_type=active")))

  #extract active aid numbers
  compound_active_aid_numbers <- data$InformationList$Information$AID

  #add to df
  df[i, name := compound_active_aid_numbers]
}

compound_active_aid_numbers

When I asked the PubChem staff for help, they gave me a different URL syntax that uses Structured Data Query (SDQ) agent and that directs me to the table I need. I've integrated this URL in the following loop – the problem is that it is extremely slow.

library(tidyverse)

df <- data.frame("Compound" = 2965821)
df <- as.data.table(df)
data_bioassays <- NULL
for(i in 1:nrow(df)){
url <- paste0('https://pubchem.ncbi.nlm.nih.gov/sdq/sdqagent.cgi?infmt=json&outfmt=csv&query={"download":"*","collection":"bioactivity","where":{"ands":[{"cid":"',df[i,]$Compound,'"}]},"order":["acvalue,asc"],"start":1,"limit":10000000,"downloadfilename":"CID_',df[i,]$Compound,'_bioactivity","nullatbottom":1}')
  data_x <- fread(url) %>% filter(activity=="Active")
  data_bioassays <- bind_rows(data_bioassays,data_x)
}

data_bioassays

Would you have any suggestions on how to improve this code?

Thank you!


问:
How to upgrade gcc compiler to latest version
I have gcc 6.3.0 and to run tensorflow 2.11.0 along with cuda 11.2, I require gcc version 9.3.1, but I just cannot find a simple and straightforward way to do that. Some people say install mysys, other sites point to sourceforge download link, while download links on mingw site point to github repos, I just don't understand how to upgrade this thing.
It would be really helpful if someone could explain it like you are explaining it to complete newbie, step by step.

Last time, I downloaded mysys2 because someone told that it will automatically upgrade gcc to latest version, mysys2 came with a python 3.10, and I was working with python 3.9, and it created a lot of issues, later I had to reset my pc. That's way I just want to know the direct way to upgrade this thing instead of upgrading other software. I also tried by downloading mingw, but the installer available on sourceforge gives gcc 6.3.0 and not the latest gcc.
And what is this cygwin which gives unix like environment, why do i require unix like environment. Even if cygwin can do it easily, I am hesitant to download cygwin, cause i don't want another repeat of tragedy that happened due to mysys2, afterall, installing a complete set of programs that i don't know anything about and will probably never use will only create additional errors.


问:
"BadZipFile: File is not a zip file" when reading a .xlsx with pandas on Sagemaker
I have a .xlsx that I can read with pd.read_excel on deepnote but when I use jupyter notebook in SageMaker I get BadZipFile: File is not a zip file. Indeed:

```<code>df_atom_1 = pd.read_excel('20221222 - Extractions d\'entreprises.xlsx', sheet_name='Groupe 1')
</code>```

It returns:

```<code>---------------------------------------------------------------------------
BadZipFile                                Traceback (most recent call last)
/tmp/ipykernel_12134/1331544060.py in <cell line: 1>()
----> 1 df_atom_1 = pd.read_excel('20221222 - Extractions d\'entreprises.xlsx', sheet_name='Groupe 1')

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
    309                     stacklevel=stacklevel,
    310                 )
--> 311             return func(*args, **kwargs)
    312
    313         return wrapper

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/io/excel/_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options)
    362     if not isinstance(io, ExcelFile):
    363         should_close = True
--> 364         io = ExcelFile(io, storage_options=storage_options, engine=engine)
    365     elif engine and engine != io.engine:
    366         raise ValueError(

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/io/excel/_base.py in __init__(self, path_or_buffer, engine, storage_options)
   1189                 ext = "xls"
   1190             else:
-> 1191                 ext = inspect_excel_format(
   1192                     content_or_path=path_or_buffer, storage_options=storage_options
   1193                 )

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/io/excel/_base.py in inspect_excel_format(content_or_path, storage_options)
   1088         # ZipFile typing is overly-strict
   1089         # https://github.com/python/typeshed/issues/4212
-> 1090         zf = zipfile.ZipFile(stream)  # type: ignore[arg-type]
   1091
   1092         # Workaround for some third party files that use forward slashes and

~/anaconda3/envs/python3/lib/python3.8/zipfile.py in __init__(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps)
   1267         try:
   1268             if mode == 'r':
-> 1269                 self._RealGetContents()
   1270             elif mode in ('w', 'x'):
   1271                 # set the modified flag so central directory gets written

~/anaconda3/envs/python3/lib/python3.8/zipfile.py in _RealGetContents(self)
   1334             raise BadZipFile("File is not a zip file")
   1335         if not endrec:
-> 1336             raise BadZipFile("File is not a zip file")
   1337         if self.debug > 1:
   1338             print(endrec)

BadZipFile: File is not a zip file
</code>```

The version of pandas on SageMaker is: '1.3.4'. Jupyter version on sagemaker is '1.2.5'.

Body:
I have a .xlsx that I can read with pd.read_excel on deepnote but when I use jupyter notebook in SageMaker I get BadZipFile: File is not a zip file. Indeed:

df_atom_1 = pd.read_excel('20221222 - Extractions d\'entreprises.xlsx', sheet_name='Groupe 1')

It returns:

---------------------------------------------------------------------------
BadZipFile                                Traceback (most recent call last)
/tmp/ipykernel_12134/1331544060.py in <cell line: 1>()
----> 1 df_atom_1 = pd.read_excel('20221222 - Extractions d\'entreprises.xlsx', sheet_name='Groupe 1')

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
    309                     stacklevel=stacklevel,
    310                 )
--> 311             return func(*args, **kwargs)
    312
    313         return wrapper

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/io/excel/_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options)
    362     if not isinstance(io, ExcelFile):
    363         should_close = True
--> 364         io = ExcelFile(io, storage_options=storage_options, engine=engine)
    365     elif engine and engine != io.engine:
    366         raise ValueError(

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/io/excel/_base.py in __init__(self, path_or_buffer, engine, storage_options)
   1189                 ext = "xls"
   1190             else:
-> 1191                 ext = inspect_excel_format(
   1192                     content_or_path=path_or_buffer, storage_options=storage_options
   1193                 )

~/anaconda3/envs/python3/lib/python3.8/site-packages/pandas/io/excel/_base.py in inspect_excel_format(content_or_path, storage_options)
   1088         # ZipFile typing is overly-strict
   1089         # https://github.com/python/typeshed/issues/4212
-> 1090         zf = zipfile.ZipFile(stream)  # type: ignore[arg-type]
   1091
   1092         # Workaround for some third party files that use forward slashes and

~/anaconda3/envs/python3/lib/python3.8/zipfile.py in __init__(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps)
   1267         try:
   1268             if mode == 'r':
-> 1269                 self._RealGetContents()
   1270             elif mode in ('w', 'x'):
   1271                 # set the modified flag so central directory gets written

~/anaconda3/envs/python3/lib/python3.8/zipfile.py in _RealGetContents(self)
   1334             raise BadZipFile("File is not a zip file")
   1335         if not endrec:
-> 1336             raise BadZipFile("File is not a zip file")
   1337         if self.debug > 1:
   1338             print(endrec)

BadZipFile: File is not a zip file

The version of pandas on SageMaker is: '1.3.4'. Jupyter version on sagemaker is '1.2.5'.


问:
Form data not being submitted to server (node js KNEX)
HTML form data not submitting to database after form is submitted. Could it be that im missing something that i need to execute the function, like .then? If so where does it need to be added to?

server.js

```<code>app.post('/tasks',appUrl, (req, res) => {
    const { task, description, duedate } = req.body;

    console.log(task, description, duedate);
    createTask(task, description, duedate)
    res.send({ task, description, duedate });
});
</code>```

db.js

```<code>const createTask = (task, description, duedate)=>{
    db('tasks')
    .insert([
        { task_name:task, description:description, due_date: duedate},
            ])
    .returning('*')
}
</code>```

Body:
HTML form data not submitting to database after form is submitted. Could it be that im missing something that i need to execute the function, like .then? If so where does it need to be added to?

server.js

app.post('/tasks',appUrl, (req, res) => {
    const { task, description, duedate } = req.body;

    console.log(task, description, duedate);
    createTask(task, description, duedate)
    res.send({ task, description, duedate });
});

db.js

const createTask = (task, description, duedate)=>{
    db('tasks')
    .insert([
        { task_name:task, description:description, due_date: duedate},
            ])
    .returning('*')
}


问:
AWS amplify mock fails with 'Variable "$lastSync" got invalid value 0; Expected type AWSTimestamp.'
I have created an Amplify GraphQL API and use it in a React Native app using Amplify DataStore. All works fine but when I try to mock the API locally the DataStore sync fails.

Mock Output:

```<code>✅ GraphQL schema compiled successfully.

Edit your schema at /Users/bas/Projects/Private/for-sale/amplify/backend/api/forsale/schema.graphql or place .graphql files in a directory at /Users/bas/Projects/Private/for-sale/amplify/backend/api/forsale/schema
Running GraphQL codegen
✔ Generated GraphQL operations successfully and saved at src/graphql
✔ Code generated successfully and saved in file src/API.ts
AppSync Mock endpoint is running at http://192.168.1.79:20002
</code>```

DataStore debug output:

```<code> LOG  [DEBUG] 50:05.54 Util -  attempt #1 with this vars: ["query operation($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: ModelHouseFilterInput){
   syncHouses(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter){
    items {
      id
      address
      photos
      owner
      identityId
      createdAt
      updatedAt
      _version
      _lastChangedAt
      _deleted
  }
    nextToken
    startedAt
   }
  }",{"limit":1000,"nextToken":null,"lastSync":0,"filter":null}]
 LOG  [DEBUG] 50:05.81 Util - error on  {"data": null, "errors": [{"locations": [Array], "message": "Variable \"$lastSync\" got invalid value 0; Expected type AWSTimestamp."}]}
 LOG  [DEBUG] 50:05.81 Util -  retrying in 209.25572077170597 ms
</code>```

Where is invalid value 0; Expected type AWSTimestamp coming from and how can this be fixed?

Body:
I have created an Amplify GraphQL API and use it in a React Native app using Amplify DataStore. All works fine but when I try to mock the API locally the DataStore sync fails.

Mock Output:

✅ GraphQL schema compiled successfully.

Edit your schema at /Users/bas/Projects/Private/for-sale/amplify/backend/api/forsale/schema.graphql or place .graphql files in a directory at /Users/bas/Projects/Private/for-sale/amplify/backend/api/forsale/schema
Running GraphQL codegen
✔ Generated GraphQL operations successfully and saved at src/graphql
✔ Code generated successfully and saved in file src/API.ts
AppSync Mock endpoint is running at http://192.168.1.79:20002

DataStore debug output:

 LOG  [DEBUG] 50:05.54 Util -  attempt #1 with this vars: ["query operation($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: ModelHouseFilterInput){
   syncHouses(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter){
    items {
      id
      address
      photos
      owner
      identityId
      createdAt
      updatedAt
      _version
      _lastChangedAt
      _deleted
  }
    nextToken
    startedAt
   }
  }",{"limit":1000,"nextToken":null,"lastSync":0,"filter":null}]
 LOG  [DEBUG] 50:05.81 Util - error on  {"data": null, "errors": [{"locations": [Array], "message": "Variable \"$lastSync\" got invalid value 0; Expected type AWSTimestamp."}]}
 LOG  [DEBUG] 50:05.81 Util -  retrying in 209.25572077170597 ms

Where is invalid value 0; Expected type AWSTimestamp coming from and how can this be fixed?


问:
can't push my project to the right location in the git repository
I've wrote a java class and I can't push it to the right place in my git repo.

Now I have 2 versions of the code in the git repo - one is the code skeleton that we got (without implementation), and the second is the right and full version but not in the right path.

I need to move it from:

```<code>ap2023-hw5/AP-hw5/ap2023-hw5/src/main/java/smarticulous/Smarticulous.java
</code>```

to:

```<code>ap2023-hw5/src/main/java/smarticulous/Smarticulous.java
</code>```

I've  tried to git push from several paths but no one pushed it to the right one.

Body:
I've wrote a java class and I can't push it to the right place in my git repo.

Now I have 2 versions of the code in the git repo - one is the code skeleton that we got (without implementation), and the second is the right and full version but not in the right path.

I need to move it from:

ap2023-hw5/AP-hw5/ap2023-hw5/src/main/java/smarticulous/Smarticulous.java

to:

ap2023-hw5/src/main/java/smarticulous/Smarticulous.java

I've  tried to git push from several paths but no one pushed it to the right one.


问:
How to check which credential Azure python SDK class DefaultAzureCredential is using for login
I'm using Azure SDK for python in the machine learning env and to create a Workspace instance I'm using the following code.

```<code>from azure.identity import DefaultAzureCredential
from azureml.core import Workspace

credential = DefaultAzureCredential()
Workspace.from_config()
</code>```

How to I know which type of credential Azure is using to authenticate my ML Studio Compute instance? I've read this article that shows that the DefaultAzureCredential class try 5 different types of credential. Yesterday I was having some kind of problems authenticating and I had to enable a Manage Identity in my ML Studio Compute instance and add the manage identity as a contributor in the IAM of the Azure Machine Learning Studio service but today with a new machine I'm having no trouble with the authentication.

In yesterday authentication I had to authenticate using the CLI command

```<code>az login --identity --username $DEFAULT_IDENTITY_CLIENT_ID
</code>```

Body:
I'm using Azure SDK for python in the machine learning env and to create a Workspace instance I'm using the following code.

from azure.identity import DefaultAzureCredential
from azureml.core import Workspace

credential = DefaultAzureCredential()
Workspace.from_config()

How to I know which type of credential Azure is using to authenticate my ML Studio Compute instance? I've read this article that shows that the DefaultAzureCredential class try 5 different types of credential. Yesterday I was having some kind of problems authenticating and I had to enable a Manage Identity in my ML Studio Compute instance and add the manage identity as a contributor in the IAM of the Azure Machine Learning Studio service but today with a new machine I'm having no trouble with the authentication.

In yesterday authentication I had to authenticate using the CLI command

az login --identity --username $DEFAULT_IDENTITY_CLIENT_ID


问:
XMLHttpRequest() reports file exists, although it is NOT there
For some days of my browser diary program, I want to play a Song-of-the-Day file (mp3), so I check whether file exists, and program 'works', except that XMLHttpRequest() returns status == 200 (meaning file exists) also for files (filenames) that don't exist.
At the moment I only have a file for 1st Jan, named 0101.mp3, so only for that day I want to display an icon to show that there is a song available.
Relevant part:

```<code>function check4Sotd(month, day) {
    var sotd = 'mydocs/sotd/' + pad(month) + pad(day) + '.mp3'; // pad puts leading zeroes, thus file for 1 Jan. will be 0101.mp3
    var sotdexists = false;         // assume there is no Song-of-the-Day file
    const myReq = new XMLHttpRequest();
    myReq.open('HEAD', sotd, false);
    myReq.send();
    console.log(sotd + " --- " + myReq.status);
    if (myReq.status == 200) {      // then the mp3 file exists
        sotdexists = true;
    }
    /*  Some other stuff  */
    if(sotdexists) {
        $("#sotdIcon").show();      // show Song-of-the-Day icon
    }
};
</code>```

Output on console for some example dates:

```<code>mydocs/sotd/0113.mp3 --- 404
mydocs/sotd/0112.mp3 --- 404
mydocs/sotd/0111.mp3 --- 200
mydocs/sotd/0110.mp3 --- 200
mydocs/sotd/0109.mp3 --- 200
mydocs/sotd/0108.mp3 --- 200
mydocs/sotd/0101.mp3 --- 200
mydocs/sotd/1231.mp3 --- 404
mydocs/sotd/1230.mp3 --- 404
mydocs/sotd/1201.mp3 --- 404
mydocs/sotd/0201.mp3 --- 200
mydocs/sotd/0202.mp3 --- 404
mydocs/sotd/0102.mp3 --- 200
mydocs/sotd/0131.mp3 --- 200
mydocs/sotd/0121.mp3 --- 200
mydocs/sotd/0120.mp3 --- 404
</code>```

Only file 0101.mp3 should give a status of 200.
I also tried changing filename to song0101.mp3 but that test gave same result.
You can see that there is a certain pattern in the status 200 lines.
What is going on here ?
Thanks for any help !

===============

Thanks Titus for your quick reply.
The relevant part of my code now looks like this:

```<code>const myReq = new XMLHttpRequest();
myReq.onreadystatechange = function() {
    console.log(sotd + " -- " + this.readyState + " -- " + this.status);
    if (this.readyState == 4 && this.status == 200) {
        sotdexists = true;
    }
};
myReq.open('HEAD', sotd, false);
myReq.send();
</code>```

and the log still shows the same problem:

```<code>mydocs/sotd/0113.mp3 -- 1 -- 0
mydocs/sotd/0113.mp3 -- 4 -- 404
mydocs/sotd/0112.mp3 -- 1 -- 0
mydocs/sotd/0112.mp3 -- 4 -- 404
mydocs/sotd/0111.mp3 -- 1 -- 0
mydocs/sotd/0111.mp3 -- 4 -- 200
mydocs/sotd/0110.mp3 -- 1 -- 0
mydocs/sotd/0110.mp3 -- 4 -- 200
mydocs/sotd/0109.mp3 -- 1 -- 0
mydocs/sotd/0109.mp3 -- 4 -- 200
mydocs/sotd/0101.mp3 -- 1 -- 0
mydocs/sotd/0101.mp3 -- 4 -- 200
mydocs/sotd/0129.mp3 -- 1 -- 0
mydocs/sotd/0129.mp3 -- 4 -- 404
</code>```

but still only the file mydocs/sotd/0101.mp3 exists, so why the status 200 for the others ?

Body:
For some days of my browser diary program, I want to play a Song-of-the-Day file (mp3), so I check whether file exists, and program 'works', except that XMLHttpRequest() returns status == 200 (meaning file exists) also for files (filenames) that don't exist.
At the moment I only have a file for 1st Jan, named 0101.mp3, so only for that day I want to display an icon to show that there is a song available.
Relevant part:

function check4Sotd(month, day) {
    var sotd = 'mydocs/sotd/' + pad(month) + pad(day) + '.mp3'; // pad puts leading zeroes, thus file for 1 Jan. will be 0101.mp3
    var sotdexists = false;         // assume there is no Song-of-the-Day file
    const myReq = new XMLHttpRequest();
    myReq.open('HEAD', sotd, false);
    myReq.send();
    console.log(sotd + " --- " + myReq.status);
    if (myReq.status == 200) {      // then the mp3 file exists
        sotdexists = true;
    }
    /*  Some other stuff  */
    if(sotdexists) {
        $("#sotdIcon").show();      // show Song-of-the-Day icon
    }
};

Output on console for some example dates:

mydocs/sotd/0113.mp3 --- 404
mydocs/sotd/0112.mp3 --- 404
mydocs/sotd/0111.mp3 --- 200
mydocs/sotd/0110.mp3 --- 200
mydocs/sotd/0109.mp3 --- 200
mydocs/sotd/0108.mp3 --- 200
mydocs/sotd/0101.mp3 --- 200
mydocs/sotd/1231.mp3 --- 404
mydocs/sotd/1230.mp3 --- 404
mydocs/sotd/1201.mp3 --- 404
mydocs/sotd/0201.mp3 --- 200
mydocs/sotd/0202.mp3 --- 404
mydocs/sotd/0102.mp3 --- 200
mydocs/sotd/0131.mp3 --- 200
mydocs/sotd/0121.mp3 --- 200
mydocs/sotd/0120.mp3 --- 404

Only file 0101.mp3 should give a status of 200.
I also tried changing filename to song0101.mp3 but that test gave same result.
You can see that there is a certain pattern in the status 200 lines.
What is going on here ?
Thanks for any help !

===============

Thanks Titus for your quick reply.
The relevant part of my code now looks like this:

const myReq = new XMLHttpRequest();
myReq.onreadystatechange = function() {
    console.log(sotd + " -- " + this.readyState + " -- " + this.status);
    if (this.readyState == 4 && this.status == 200) {
        sotdexists = true;
    }
};
myReq.open('HEAD', sotd, false);
myReq.send();

and the log still shows the same problem:

mydocs/sotd/0113.mp3 -- 1 -- 0
mydocs/sotd/0113.mp3 -- 4 -- 404
mydocs/sotd/0112.mp3 -- 1 -- 0
mydocs/sotd/0112.mp3 -- 4 -- 404
mydocs/sotd/0111.mp3 -- 1 -- 0
mydocs/sotd/0111.mp3 -- 4 -- 200
mydocs/sotd/0110.mp3 -- 1 -- 0
mydocs/sotd/0110.mp3 -- 4 -- 200
mydocs/sotd/0109.mp3 -- 1 -- 0
mydocs/sotd/0109.mp3 -- 4 -- 200
mydocs/sotd/0101.mp3 -- 1 -- 0
mydocs/sotd/0101.mp3 -- 4 -- 200
mydocs/sotd/0129.mp3 -- 1 -- 0
mydocs/sotd/0129.mp3 -- 4 -- 404

but still only the file mydocs/sotd/0101.mp3 exists, so why the status 200 for the others ?


问:
Make text input Georgian instead of English
I need to write Georgian text in react input. for example, if user writes abc it should be აბც(Keys that are one Georgian keyboard instead of a,b and c).

I tried using plugins like react-language-keyboard but its too old and throwing error, (You might have mismatching versions of React and the renderer (such as React DOM))


问:
Match data from pivot table to normal table vba
I would like to know if is possible to match data from a pivot table to a normal table.

Example: i have a pivot table and select one item from "account" field and match that id account in the table at the right side.

example

And its possible to get the email from that id that matches with account?


问:
Is there a way to configure color-ranges for PM2 monit?
I'm using PM2 monitor to track my various services.

One tool is designed to use a lot of memory, and constantly shows as red in Pm2. I don't want this. I want to to only show red above a custom threshold I've configured.

Is this possible?