text:
Q: unlock gnome-keyring on login Running debian testing, no display manager, i3 window manager.
gnome-keyring & libpam-gnome-keyring packages are installed. Added following 2 lines to end of /etc/pam.d/login:
auth       optional     pam_gnome_keyring.so
session    optional     pam_gnome_keyring.so auto_start

keyring is started by systemd @ /etc/systemd/user/graphical-session-pre.target.wants/gnome-keyring-daemon.service, but also tried replacing it from xinitrc:
eval $(/usr/bin/gnome-keyring-daemon --replace --components=gpg,pkcs11,secrets,ssh)

/var/log/auth.log has following from OS login:
Jun 26 00:35:39 p14s su[1409]: (to laur) root on none
Jun 26 00:35:39 p14s su[1409]: pam_unix(su:session): session opened for user laur(uid=1000) by (uid=0)
Jun 26 00:35:39 p14s systemd: pam_unix(systemd-user:session): session opened for user laur(uid=1000) by (uid=0)
Jun 26 00:35:39 p14s su[1409]: pam_unix(su:session): session closed for user laur
Jun 26 00:35:41 p14s su[1922]: (to laur) root on none
Jun 26 00:35:41 p14s su[1922]: pam_unix(su:session): session opened for user laur(uid=1000) by (uid=0)
Jun 26 00:35:42 p14s su[1922]: pam_unix(su:session): session closed for user laur
Jun 26 00:35:42 p14s su[2005]: (to laur) root on none
Jun 26 00:35:42 p14s su[2005]: pam_unix(su:session): session opened for user laur(uid=1000) by (uid=0)
Jun 26 00:35:42 p14s login[1174]: gkr-pam: unable to locate daemon control file
Jun 26 00:35:42 p14s login[1174]: gkr-pam: stashed password to try later in open session
Jun 26 00:35:42 p14s login[1174]: pam_unix(login:session): session opened for user laur(uid=1000) by LOGIN(uid=0)
Jun 26 00:35:42 p14s systemd-logind[1003]: New session 2 of user laur.
Jun 26 00:35:42 p14s login[1174]: gkr-pam: unlocked login keyring <----- this should be success, right?
Jun 26 00:35:42 p14s su[2005]: pam_unix(su:session): session closed for user laur
Jun 26 00:35:42 p14s su[2078]: (to laur) root on none
Jun 26 00:35:42 p14s su[2078]: pam_unix(su:session): session opened for user laur(uid=1000) by (uid=0)
Jun 26 00:35:42 p14s su[2078]: pam_unix(su:session): session closed for user laur
Jun 26 00:35:45 p14s polkitd(authority=local): Registered Authentication Agent for unix-session:2 (system bus name :1.81 [/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1], object path /org/gnome/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Jun 26 00:35:46 p14s gnome-keyring-daemon[2026]: The Secret Service was already initialized
Jun 26 00:35:46 p14s gnome-keyring-daemon[3062]: discover_other_daemon: 1
Jun 26 00:35:48 p14s su[4284]: (to laur) root on none
Jun 26 00:35:48 p14s su[4284]: pam_unix(su-l:session): session opened for user laur(uid=1000) by (uid=0)
Jun 26 00:35:50 p14s su[4284]: pam_unix(su-l:session): session closed for user laur
Jun 26 00:35:50 p14s su[4365]: (to laur) root on none
Jun 26 00:35:50 p14s su[4365]: pam_unix(su-l:session): session opened for user laur(uid=1000) by (uid=0)
Jun 26 00:35:50 p14s su[4365]: pam_unix(su-l:session): session closed for user laur
Jun 26 00:35:50 p14s su[4402]: (to laur) root on none
Jun 26 00:35:50 p14s su[4402]: pam_unix(su-l:session): session opened for user laur(uid=1000) by (uid=0)

Did also try deleting existing keyring(s), to be re-created. Keyring has same password as my user login.
Still no joy. How to approach this in 2022?

A: Think I got it sorted. Don't have deep understanding of what's going on, but it has to do with dbus.
Problem is the way i3 was started from ~/.xinitrc:
exec dbus-run-session i3

I'm guessing it causes keyring-daemon to be tied to different dbus session than i3 (and, by extension, most everything else in user space).
To overcome this, I'm now launching i3 from ~/.xsession via systemd instead; note I've deleted ~/.xinitrc altogether.
$ cat ~/.xsession
systemctl --user import-environment
systemctl --user daemon-reload

# note we add the 'wait' flag, which disallows immediate exit, which in turn would stop X session right after it.
exec systemctl --user start --wait xsession.target

startx is started with no arguments: exec startx
Relevant systemd units:
$ tree -a ~/.config/systemd/user/
├── i3wm.service
├── xsession.target
└── xsession.target.requires
    └── i3wm.service -> ../i3wm.service

$ cat ~/.config/systemd/user/i3wm.service
[Unit]
Description=i3 Window Manager
PartOf=graphical-session.target

[Service]
ExecStart=/usr/bin/i3
ExecStopPost=/usr/bin/systemctl --user stop graphical-session.target
Restart=on-failure

[Install]
RequiredBy=xsession.target

$ cat ~/.config/systemd/user/xsession.target
[Unit]
Description=X session managed by systemd
BindsTo=graphical-session.target

Encrypted keyring now gets unlocked by PAM on login as expected.
Note those two lines added to /etc/pam.d/login as described in the question are still very much needed.
Courtesy of this blog


text:
Q: Click on button and close another button Here's code :

              Name

            Gender

              <button ng-if="person.expanded" ng-click="person.expanded = false">-</button>
              <button ng-if="!person.expanded" ng-click="person.expanded = true">+</button>

            {{person.name}}
            {{person.gender}}

            {{person.details}}

plunker :
http://plnkr.co/edit/yYq1dt?p=preview
What I want to do : when I click ex. "Bob" the informations will collapse. Then when I click another person I want to close the "Bob".

A: Here's the edit to the code given in the link. Simply call the function which makes the expanded tabs as false.
HTML

          <button ng-if="person.expanded" ng-click="expand(person)">-</button>
          <button ng-if="!person.expanded" ng-click="expand(person)">+</button>

        {{person.name}}
        {{person.gender}}

        {{person.details}}

JS
function repeatTest($scope) {
  $scope.people = [
    {name: "Bob", gender: "Male", details: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque quis nisi quis mi tincidunt luctus ut quis nunc. Nam non risus tincidunt risus sodales condimentum. Morbi sed gravida elit. Nunc a turpis vestibulum elit posuere blandit. Phasellus luctus lectus non porta auctor. Etiam pellentesque imperdiet posuere. Nullam adipiscing congue nisl, in vulputate odio ornare ac."},
    {name: "Jane", gender: "Female", details: "Maecenas quis sodales lectus, vitae convallis ipsum. Ut ac viverra tellus. Quisque vulputate, orci placerat eleifend scelerisque, eros nunc rutrum odio, pharetra mattis leo neque vel eros. Cras id purus nec lorem vehicula rutrum a vel arcu. Quisque eget euismod augue. Integer volutpat auctor lorem, quis lacinia nisl tempus nec. Nunc fringilla, odio eget molestie varius, tortor turpis dignissim lacus, sed varius nunc velit eu turpis. Etiam sed congue diam. In ornare elit nec dolor faucibus ornare. Ut eget erat vel elit tristique iaculis. Maecenas et semper lorem. Nam mollis ante et ipsum vestibulum posuere. Ut non purus non risus tempor vulputate et vitae ipsum. Mauris et sem sit amet quam pulvinar fringilla."},
    {name: "Bill", gender: "Male", details: "Quisque rhoncus scelerisque sapien, tempor vestibulum dui tincidunt eu. Maecenas scelerisque, dolor sed vehicula pulvinar, ligula erat ornare arcu, in dictum ipsum libero vel est. Donec porttitor venenatis lacus, a laoreet orci. Proin quam mi, ultrices in ullamcorper vel, malesuada suscipit lectus. Nam faucibus commodo quam, auctor vehicula felis condimentum quis. Phasellus tempor molestie enim, at vehicula justo auctor eu. Pellentesque venenatis elit eu malesuada fringilla."}
  ];
  $scope.expand = function(selectedperson) {

    var boolexpansion = !selectedperson.expanded;

    angular.forEach($scope.people, function(person) {
      person.expanded = false;
   });
   if(boolexpansion) {
     selectedperson.expanded = !selectedperson.expanded;
   }
  }
}

A: You need to iterate on $scope.people during collapse event to close all others.
It should be like, In HTML:
<button ng-if="person.expanded" ng-click="person.expanded = false">-</button>
<button ng-if="!person.expanded" ng-click="collapseExpand(person)">+</button>

In Controller:
$scope.collapseExpand = function(currentPerson){
  $scope.people.forEach(function(person) {
      person.expanded = false; //make all person collapse
    });
  currentPerson.expanded  = true; //make current person expand
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Provide setInterval's ID and clear by ID How can I provide specific ID to setInterval() and then call clearInterval() by ID.
$('.notify').each(function () {
    var chkr = $(this).find('span').text();

    if (chkr == 'Offline') {
        if (typeof(clearC) !== 'undefined') {
            clearInterval(clearC);
        }

        // how can i provide the ID of "clearC" below
        clearC = setInterval(function () {
            soundOn();
        }, 500);
    }
    else {
        //how can i clear "clearC" with the ID provided in if statement
        if (typeof(clearC) !== 'undefined') {
            clearInterval(clearC);
        }
    }
});

The Problem is when if statement execute then sound goes on. But for next row its enter in else statement (because "Online") and clear the interval although it should not be.
So my concern is to clear clearInterval for specific row until there "Online" text found.

A: It seems like you want to make sure you keep track of the intervalIds for each of the objects.  So store the intervalId on the objects themselves, using the jQuery .data feature:
clearC = setInterval(function () { soundOn(); }, 500);
$(this).data("intervalId", clearC);

When you want to retrieve it:
clearInterval($(this).data("intervalId"));

A: You can declare clearC as an object {}, create and store its ID in the .id property, and setInterval() in its .interval property. In this way you can check its ID by getting clearC.id.
var clearC = {};
// ...
$('.notify').each(function(){
  var chkr = $(this).find('span').text();

  if(chkr == 'Offline'){
    if(typeof(clearC.interval) !== 'undefined'){
      clearInterval(clearC.interval);
    }

    // this way you can provide the ID of "clearC.interval" below
    clearC.id = "your-id";
    clearC.interval = setInterval(function () {
      soundOn();
    }, 500);
  }
  else{
    // this way you can clear "clearC.interval" with the ID provided in if statement
    if(typeof(clearC.interval) !== 'undefined'){
      if (clearC.id === "your-id")
        clearInterval(clearC.interval);
    }
  }
});

A: What about this way?
$('.notify').each(function() {
    var $this = $(this);
    var intervalID = $this.data('intervalID');
    var chkr = $this.find('span').text();

    clearInterval(intervalID);
    if (chkr === 'Offline') {
        $this.data('intervalID', setInterval(function() { soundOn(); }, 500));
    }
});

P.S. You don't need to check variable with interval ID on undefined, there is no real profit in performance, but unnecessary code.

A: Your code is already correct, so I'm a little confused.
It's pretty simple. The id is the return value of setInterval. setInterval does not accept an id to an existing timer -- what do you expect it would be used for?
https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval


text:
Q: Removing Multiple Values from XSLT I'm trying to fix this multi value problem for this XML/ XSLT code but can't seem to figure out whats wrong. For some employees (not all), their record on the output file contains multiple SSN values.  This is causing an issue with the receiving system because it's only expecting one value. Any Help would be great;y appreciated as I am really stuck with this and need to submit a report in 36 hours. Thank you so much. (Attached are the xml file code and the XSLT code)
XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <pi:Payroll_Extract_Employees xmlns:pi="urn:com.workday/picof">
        <pi:PayGroup>
            <pi:Header>
                <pi:Version>18</pi:Version>
                <pi:Payroll_Company_ID>25G</pi:Payroll_Company_ID>
                <pi:Payroll_Company_Name>Acme.net</pi:Payroll_Company_Name>
                <pi:Pay_Group_ID>G85D6W87D</pi:Pay_Group_ID>
                <pi:Pay_Group_Name>G85D6W87D Semi-monthly</pi:Pay_Group_Name>
                <pi:Pay_Period_Start>2013-02-16-08:00</pi:Pay_Period_Start>
                <pi:Pay_Period_End>2013-02-28-08:00</pi:Pay_Period_End>
                <pi:Updated_From>2013-02-28T18:00:15.171-08:00</pi:Updated_From>
                <pi:Updated_To>2013-03-07T12:25:36.860-08:00</pi:Updated_To>
                <pi:All_Effective>false</pi:All_Effective>
            </pi:Header>
            <pi:Employee>
                <pi:Summary>
                    <pi:Employee_ID>1332</pi:Employee_ID>
                    <pi:Name>Robert Paulson</pi:Name>
                    <pi:Payroll_Company_ID>25G</pi:Payroll_Company_ID>
                    <pi:Payroll_Company_Name>Acme.net</pi:Payroll_Company_Name>
                    <pi:Pay_Group_ID>G85D6W87D</pi:Pay_Group_ID>
                    <pi:Pay_Group_Name>G85D6W87D Semi-monthly</pi:Pay_Group_Name>
                </pi:Summary>
                <pi:Personal>
                    <pi:First_Name>Robert</pi:First_Name>
                    <pi:Middle_Name>B</pi:Middle_Name>
                    <pi:Last_Name>Paulson</pi:Last_Name>
                    <pi:Gender>M</pi:Gender>
                    <pi:Birth_Date>1972-07-19</pi:Birth_Date>
                    <pi:Marital_Status>S</pi:Marital_Status>
                    <pi:First_Address_Line_Data pi:Label="Address Line 1" pi:Type="ADDRESS_LINE_1">5555
                        Marcos Street</pi:First_Address_Line_Data>
                    <pi:First_Municipality>San Diego</pi:First_Municipality>
                    <pi:First_Region>CA</pi:First_Region>
                    <pi:First_Postal_Code>92109</pi:First_Postal_Code>
                    <pi:Area_Code>619</pi:Area_Code>
                    <pi:Phone_Number>5559999</pi:Phone_Number>
                    <pi:First_Email_Address>bobby@acme.net</pi:First_Email_Address>
                </pi:Personal>
                <pi:Status>
                    <pi:Employee_Status>A</pi:Employee_Status>
                    <pi:Hire_Date>2011-02-28</pi:Hire_Date>
                    <pi:Original_Hire_Date>2011-02-28</pi:Original_Hire_Date>
                    <pi:Continuous_Service_Date>2011-02-28</pi:Continuous_Service_Date>
                    <pi:Seniority_Date>2011-02-28</pi:Seniority_Date>
                </pi:Status>
                <pi:Position>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Worker_Type>FTR</pi:Worker_Type>
                    <pi:Job_Exempt>1</pi:Job_Exempt>
                    <pi:Scheduled_Weekly_Hours>40</pi:Scheduled_Weekly_Hours>
                    <pi:Default_Weekly_Hours>40</pi:Default_Weekly_Hours>
                    <pi:Pay_Cycle_Hours>86.67</pi:Pay_Cycle_Hours>
                    <pi:Pay_Rate_Type>H</pi:Pay_Rate_Type>
                    <pi:Compensation_Effective_Date>2013-01-01</pi:Compensation_Effective_Date>
                    <pi:Total_Base_Pay>27.2645</pi:Total_Base_Pay>
                    <pi:Base_Pay_Currency>USD</pi:Base_Pay_Currency>
                    <pi:Base_Pay_Frequency>H</pi:Base_Pay_Frequency>
                    <pi:Organization_One>1500</pi:Organization_One>
                    <pi:Workers_Compensation_Code>8810</pi:Workers_Compensation_Code>
                    <pi:Business_Site>San Diego Office</pi:Business_Site>
                    <pi:Business_Site_Name>San Diego Office</pi:Business_Site_Name>
                    <pi:Business_Site_Region>CA</pi:Business_Site_Region>
                    <pi:Supervisor_Name>Jed Sanders (1402)</pi:Supervisor_Name>
                </pi:Position>
                <pi:Identifier>
                    <pi:Operation>REMOVE</pi:Operation>
                    <pi:Identifier_Type>SSN</pi:Identifier_Type>
                    <pi:Identifier_Value>123456788</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Identifier>
                    <pi:Operation>ADD</pi:Operation>
                    <pi:Identifier_Type>SSN</pi:Identifier_Type>
                    <pi:Identifier_Value>111111111</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Identifier>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Identifier_Type>ADP_No</pi:Identifier_Type>
                    <pi:Identifier_Value>541</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Additional_Information>
                    <pi:PreferredFirstName>Bobby</pi:PreferredFirstName>
                </pi:Additional_Information>
            </pi:Employee>
            <pi:Employee>
                <pi:Summary>
                    <pi:Employee_ID>1842</pi:Employee_ID>
                    <pi:Name>James Johnson</pi:Name>
                     <pi:Payroll_Company_ID>25G</pi:Payroll_Company_ID>
                    <pi:Payroll_Company_Name>Acme.net</pi:Payroll_Company_Name>
                    <pi:Pay_Group_ID>G85D6W87D</pi:Pay_Group_ID>
                    <pi:Pay_Group_Name>G85D6W87D Semi-monthly</pi:Pay_Group_Name>
                </pi:Summary>
                <pi:Personal>
                    <pi:First_Name>James</pi:First_Name>
                    <pi:Middle_Name>B</pi:Middle_Name>
                    <pi:Last_Name>Johnson</pi:Last_Name>
                    <pi:Gender>M</pi:Gender>
                    <pi:Birth_Date>1982-09-17</pi:Birth_Date>
                    <pi:Marital_Status>S</pi:Marital_Status>
                    <pi:First_Address_Line_Data pi:Label="Address Line 1" pi:Type="ADDRESS_LINE_1">1111
                        Hampton Way</pi:First_Address_Line_Data>
                    <pi:First_Municipality>San Diego</pi:First_Municipality>
                    <pi:First_Region>CA</pi:First_Region>
                    <pi:First_Postal_Code>92109</pi:First_Postal_Code>
                    <pi:Area_Code>619</pi:Area_Code>
                    <pi:Phone_Number>5551234</pi:Phone_Number>
                    <pi:First_Email_Address>jjohnson@acme.net</pi:First_Email_Address>
                </pi:Personal>
                <pi:Status>
                    <pi:Employee_Status>A</pi:Employee_Status>
                    <pi:Hire_Date>2010-03-28</pi:Hire_Date>
                    <pi:Original_Hire_Date>2010-03-28</pi:Original_Hire_Date>
                    <pi:Continuous_Service_Date>2010-03-28</pi:Continuous_Service_Date>
                    <pi:Seniority_Date>2010-03-28</pi:Seniority_Date>
                </pi:Status>
                <pi:Position>
                    <pi:Operation>REMOVE</pi:Operation>
                    <pi:Worker_Type>FTR</pi:Worker_Type>
                    <pi:Job_Exempt>1</pi:Job_Exempt>
                    <pi:Scheduled_Weekly_Hours>40</pi:Scheduled_Weekly_Hours>
                    <pi:Default_Weekly_Hours>40</pi:Default_Weekly_Hours>
                    <pi:Pay_Cycle_Hours>86.67</pi:Pay_Cycle_Hours>
                    <pi:Pay_Rate_Type>H</pi:Pay_Rate_Type>
                    <pi:Compensation_Effective_Date>2010-03-28</pi:Compensation_Effective_Date>
                    <pi:Total_Base_Pay>27.2645</pi:Total_Base_Pay>
                    <pi:Base_Pay_Currency>USD</pi:Base_Pay_Currency>
                    <pi:Base_Pay_Frequency>H</pi:Base_Pay_Frequency>
                    <pi:Organization_One>1500</pi:Organization_One>
                    <pi:Workers_Compensation_Code>8810</pi:Workers_Compensation_Code>
                    <pi:Business_Site>San Diego Office</pi:Business_Site>
                    <pi:Business_Site_Name>San Diego Office</pi:Business_Site_Name>
                    <pi:Business_Site_Region>CA</pi:Business_Site_Region>
                    <pi:Supervisor_Name>Jed Sanders (1402)</pi:Supervisor_Name>
                </pi:Position>
                <pi:Position>
                    <pi:Operation>ADD</pi:Operation>
                    <pi:Worker_Type>FTR</pi:Worker_Type>
                    <pi:Job_Exempt>1</pi:Job_Exempt>
                    <pi:Scheduled_Weekly_Hours>40</pi:Scheduled_Weekly_Hours>
                    <pi:Default_Weekly_Hours>40</pi:Default_Weekly_Hours>
                    <pi:Pay_Cycle_Hours>86.67</pi:Pay_Cycle_Hours>
                    <pi:Pay_Rate_Type>S</pi:Pay_Rate_Type>
                    <pi:Compensation_Effective_Date>2013-01-01</pi:Compensation_Effective_Date>
                    <pi:Total_Base_Pay>95123</pi:Total_Base_Pay>
                    <pi:Base_Pay_Currency>USD</pi:Base_Pay_Currency>
                    <pi:Base_Pay_Frequency>S</pi:Base_Pay_Frequency>
                    <pi:Organization_One>1500</pi:Organization_One>
                    <pi:Workers_Compensation_Code>8810</pi:Workers_Compensation_Code>
                    <pi:Business_Site>San Diego Office</pi:Business_Site>
                    <pi:Business_Site_Name>San Diego Office</pi:Business_Site_Name>
                    <pi:Business_Site_Region>CA</pi:Business_Site_Region>
                    <pi:Supervisor_Name>Jed Sanders (1402)</pi:Supervisor_Name>
                </pi:Position>
                <pi:Identifier>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Identifier_Type>SSN</pi:Identifier_Type>
                    <pi:Identifier_Value>222222222</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Identifier>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Identifier_Type>ADP_No</pi:Identifier_Type>
                    <pi:Identifier_Value>543</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Additional_Information>
                    <pi:PreferredFirstName>Jimmy</pi:PreferredFirstName>
                </pi:Additional_Information>
            </pi:Employee>
        </pi:PayGroup>
        <pi:PayGroup>
            <pi:Header>
                <pi:Version>18</pi:Version>
                <pi:Payroll_Company_ID>NMA</pi:Payroll_Company_ID>
                <pi:Payroll_Company_Name>Acme.net</pi:Payroll_Company_Name>
                <pi:Pay_Group_ID>DS87D7RR9</pi:Pay_Group_ID>
                <pi:Pay_Group_Name>DS87D7RR9 Weekly</pi:Pay_Group_Name>
                <pi:Pay_Period_Start>2013-02-16-08:00</pi:Pay_Period_Start>
                <pi:Pay_Period_End>2013-02-28-08:00</pi:Pay_Period_End>
                <pi:Updated_From>2013-02-28T18:00:15.171-08:00</pi:Updated_From>
                <pi:Updated_To>2013-03-07T12:25:36.860-08:00</pi:Updated_To>
                <pi:All_Effective>false</pi:All_Effective>
            </pi:Header>
            <pi:Employee>
                <pi:Summary>
                    <pi:Employee_ID>1432</pi:Employee_ID>
                    <pi:Name>Steve Whatever</pi:Name>
                    <pi:Payroll_Company_ID>NMA</pi:Payroll_Company_ID>
                    <pi:Payroll_Company_Name>Acme.net</pi:Payroll_Company_Name>
                    <pi:Pay_Group_ID>DS87D7RR9</pi:Pay_Group_ID>
                    <pi:Pay_Group_Name>DS87D7RR9 Weekly</pi:Pay_Group_Name>
                </pi:Summary>
                <pi:Personal>
                    <pi:First_Name>Steve</pi:First_Name>
                    <pi:Middle_Name>B</pi:Middle_Name>
                    <pi:Last_Name>Whatever</pi:Last_Name>
                    <pi:Gender>M</pi:Gender>
                    <pi:Birth_Date>1985-07-19</pi:Birth_Date>
                    <pi:Marital_Status>S</pi:Marital_Status>
                    <pi:First_Address_Line_Data pi:Label="Address Line 1" pi:Type="ADDRESS_LINE_1">1234
                        Dreyfus Lane</pi:First_Address_Line_Data>
                    <pi:First_Municipality>San Diego</pi:First_Municipality>
                    <pi:First_Region>CA</pi:First_Region>
                    <pi:First_Postal_Code>92109</pi:First_Postal_Code>
                    <pi:Area_Code>619</pi:Area_Code>
                    <pi:Phone_Number>5558888</pi:Phone_Number>
                    <pi:First_Email_Address>steve@acme.net</pi:First_Email_Address>
                </pi:Personal>
                <pi:Status>
                    <pi:Employee_Status>A</pi:Employee_Status>
                    <pi:Hire_Date>2009-02-28</pi:Hire_Date>
                    <pi:Original_Hire_Date>2009-02-28</pi:Original_Hire_Date>
                    <pi:Continuous_Service_Date>2009-02-28</pi:Continuous_Service_Date>
                    <pi:Seniority_Date>2009-02-28</pi:Seniority_Date>
                </pi:Status>
                <pi:Position>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Worker_Type>FTR</pi:Worker_Type>
                    <pi:Job_Exempt>1</pi:Job_Exempt>
                    <pi:Scheduled_Weekly_Hours>40</pi:Scheduled_Weekly_Hours>
                    <pi:Default_Weekly_Hours>40</pi:Default_Weekly_Hours>
                    <pi:Pay_Cycle_Hours>86.67</pi:Pay_Cycle_Hours>
                    <pi:Pay_Rate_Type>H</pi:Pay_Rate_Type>
                    <pi:Compensation_Effective_Date>2013-01-01</pi:Compensation_Effective_Date>
                    <pi:Total_Base_Pay>27.2645</pi:Total_Base_Pay>
                    <pi:Base_Pay_Currency>USD</pi:Base_Pay_Currency>
                    <pi:Base_Pay_Frequency>H</pi:Base_Pay_Frequency>
                    <pi:Organization_One>1500</pi:Organization_One>
                    <pi:Workers_Compensation_Code>8810</pi:Workers_Compensation_Code>
                    <pi:Business_Site>San Diego Office</pi:Business_Site>
                    <pi:Business_Site_Name>San Diego Office</pi:Business_Site_Name>
                    <pi:Business_Site_Region>CA</pi:Business_Site_Region>
                    <pi:Supervisor_Name>Adam Sandler (5472)</pi:Supervisor_Name>
                </pi:Position>
                <pi:Identifier>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Identifier_Type>SSN</pi:Identifier_Type>
                    <pi:Identifier_Value>333333333</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Identifier>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Identifier_Type>ADP_No</pi:Identifier_Type>
                    <pi:Identifier_Value>542</pi:Identifier_Value>
                </pi:Identifier>
            </pi:Employee>
            <pi:Employee>
                <pi:Summary>
                    <pi:Employee_ID>3333</pi:Employee_ID>
                    <pi:Name>James Anything</pi:Name>
                    <pi:Payroll_Company_ID>NMA</pi:Payroll_Company_ID>
                    <pi:Payroll_Company_Name>Acme.net</pi:Payroll_Company_Name>
                    <pi:Pay_Group_ID>DS87D7RR9</pi:Pay_Group_ID>
                    <pi:Pay_Group_Name>DS87D7RR9 Weekly</pi:Pay_Group_Name>
                </pi:Summary>
                <pi:Personal>
                    <pi:First_Name>James</pi:First_Name>
                    <pi:Middle_Name>B</pi:Middle_Name>
                    <pi:Last_Name>Anything</pi:Last_Name>
                    <pi:Gender>M</pi:Gender>
                    <pi:Birth_Date>1975-04-01</pi:Birth_Date>
                    <pi:Marital_Status>S</pi:Marital_Status>
                    <pi:First_Address_Line_Data pi:Label="Address Line 1" pi:Type="ADDRESS_LINE_1">9865
                        Wells Lane</pi:First_Address_Line_Data>
                    <pi:First_Municipality>San Diego</pi:First_Municipality>
                    <pi:First_Region>CA</pi:First_Region>
                    <pi:First_Postal_Code>92109</pi:First_Postal_Code>
                    <pi:Area_Code>619</pi:Area_Code>
                    <pi:Phone_Number>5557272</pi:Phone_Number>
                    <pi:First_Email_Address>jany@acme.net</pi:First_Email_Address>
                </pi:Personal>
                <pi:Status>
                    <pi:Employee_Status>A</pi:Employee_Status>
                    <pi:Hire_Date>2012-09-28</pi:Hire_Date>
                    <pi:Original_Hire_Date>2012-09-28</pi:Original_Hire_Date>
                    <pi:Continuous_Service_Date>2012-09-28</pi:Continuous_Service_Date>
                    <pi:Seniority_Date>2012-09-28</pi:Seniority_Date>
                </pi:Status>
                <pi:Position>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Worker_Type>FTR</pi:Worker_Type>
                    <pi:Job_Exempt>1</pi:Job_Exempt>
                    <pi:Scheduled_Weekly_Hours>40</pi:Scheduled_Weekly_Hours>
                    <pi:Default_Weekly_Hours>40</pi:Default_Weekly_Hours>
                    <pi:Pay_Cycle_Hours>86.67</pi:Pay_Cycle_Hours>
                    <pi:Pay_Rate_Type>H</pi:Pay_Rate_Type>
                    <pi:Compensation_Effective_Date>2013-01-01</pi:Compensation_Effective_Date>
                    <pi:Total_Base_Pay>27.2645</pi:Total_Base_Pay>
                    <pi:Base_Pay_Currency>USD</pi:Base_Pay_Currency>
                    <pi:Base_Pay_Frequency>H</pi:Base_Pay_Frequency>
                    <pi:Organization_One>1500</pi:Organization_One>
                    <pi:Workers_Compensation_Code>8810</pi:Workers_Compensation_Code>
                    <pi:Business_Site>San Diego Office</pi:Business_Site>
                    <pi:Business_Site_Name>San Diego Office</pi:Business_Site_Name>
                    <pi:Business_Site_Region>CA</pi:Business_Site_Region>
                    <pi:Supervisor_Name>Adam Sandler (5472)</pi:Supervisor_Name>
                </pi:Position>
                <pi:Identifier>
                    <pi:Operation>NONE</pi:Operation>
                    <pi:Identifier_Type>SSN</pi:Identifier_Type>
                    <pi:Identifier_Value>444444444</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Identifier>
                    <pi:Operation>REMOVE</pi:Operation>
                    <pi:Identifier_Type>ADP_No</pi:Identifier_Type>
                    <pi:Identifier_Value>544</pi:Identifier_Value>
                </pi:Identifier>
                <pi:Identifier>
                    <pi:Operation>ADD</pi:Operation>
                    <pi:Identifier_Type>ADP_No</pi:Identifier_Type>
                    <pi:Identifier_Value>545</pi:Identifier_Value>
                </pi:Identifier>
            </pi:Employee>
        </pi:PayGroup>
    </pi:Payroll_Extract_Employees>

XSLT Code:
<!-- <?xml version="1.0" encoding="UTF-8"?>   -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:pi="urn:com.workday/picof">

    <xsl:variable name="sep">,</xsl:variable>

    <xsl:template match="pi:Payroll_Extract_Employees">
        <xsl:text>
</xsl:text>
        <xsl:for-each select="pi:PayGroup">
            <xsl:text>Pay Group: </xsl:text>
            <xsl:value-of select="pi:Header/pi:Pay_Group_Name"/>
            <xsl:text>
</xsl:text>

            <xsl:text>EmployeeID,Last_Name,First_Name,SSN,Hire_Date
</xsl:text>
            <xsl:for-each select="pi:Employee">

                <xsl:value-of select="pi:Summary/pi:Employee_ID"/>
                <xsl:value-of select="$sep"/>

                <xsl:value-of select="pi:Personal/pi:Last_Name"/>
                <xsl:value-of select="$sep"/>

                <xsl:value-of select="pi:Personal/pi:First_Name"/>
                <xsl:value-of select="$sep"/>

                <xsl:value-of select="pi:Identifier[pi:Identifier_Type = 'SSN']/pi:Identifier_Value"/>
                <xsl:value-of select="$sep"/>

                <xsl:value-of select="pi:Status/pi:Hire_Date"/>

                <xsl:text>
</xsl:text>
            </xsl:for-each>  <!-- end employee loop -->

            <xsl:text>
</xsl:text>

        </xsl:for-each>  <!-- end paygroup loop -->

    </xsl:template> <!-- end of main template -->
</xsl:stylesheet>

A: You didn't provide any guidance regarding which of the SSN numbers to pick, and with only a single example to go by I am largely guessing here. Try replacing:
<xsl:value-of select="pi:Identifier[pi:Identifier_Type = 'SSN']/pi:Identifier_Value"/>

with:
<xsl:value-of select="pi:Identifier[pi:Identifier_Type = 'SSN' and not(pi:Operation='REMOVE')]/pi:Identifier_Value"/>

This is based on the assumption that whenever an SSN is being REMOVEd, there will be another one (and only one) ADDed - and that's the one you want to have in your output. Of course you'll have to consult your source XML's schema in order to verify such assumption.

A:
It has to be the most recent SSN if there are multiple values

I agree with previous comments and answers that this is a little sketchy requirement. In the source there is nothing that suggests "most recent". There are several possible conclusions, that you will have to check with whoever has the specification of your input XML:

*

*the most recent is also the last, use:
<xsl:value-of select="pi:Identifier[pi:Identifier_Type = 'SSN']
    [last()]/pi:Identifier_Value"/>

*the most recent is always the first, use:
<xsl:value-of select="pi:Identifier[pi:Identifier_Type = 'SSN']
    [1]/pi:Identifier_Value"/>

*the most recent is the last, but may not have a certain "operation" (as suggested by Michael):
<xsl:value-of select="pi:Identifier[pi:Identifier_Type = 'SSN'
    and not(pi:Operation='REMOVE')][last()]/pi:Identifier_Value"/>

*anything else (fill in the blanks)


text:
Q: Time complexity of recursion-tree What will be the time complexity of a function Fn(n) which recursively calls Fn(1),Fn(2),Fn(3),...,Fn(n-1) to solve Fn(n). Fn(1) =1 is given as base condition. Will it be O(n^n) or less. I think it should be less than O(n^n) but i am not able to find a way to get the correct complexity of this recursion.
recursion tree for Fn(4) would be something like this
              Fn(4)
         /        |     \
      Fn(3)    Fn(2)   Fn(1)
     /   \        /
   Fn(2) Fn(1) Fn(1)
   /
Fn(1)

A: The recurrence would look something like this:
T(1) = 1
T(n) = Σ T(i), from i = 1 to n-1

Not particularly helpful at first glance, huh? So Let's break this down into subproblems and see what they look like:
   T(5) = T(4) + T(3) + T(2) + T(1)
=> T(5) = T(4) + T(3) + T(2) + 1

   // The sub problems
   T(4) = T(3) + T(2) + 1
   T(3) = T(2) + 1
   T(2) = 1

Now let's substitute some of these sub problems back into our original problem:
   T(5) = T(4) + T(3) + T(2) + 1
=> T(5) = T(4) + T(4)
=> T(5) = 2T(4)

So we can derive that the recurrence really looks like:
T(n) = 2T(n-1)
T(n-1) = 2T(n-2)

So we can rewrite our recurrence as
T(n) = 2[ 2T(n-2) ]
T(n) = 2[ 2 [ 2T(n-3) ] ]
...
T(n) = 2^k [ T(n-k) ]

Since our base case we've described earlier is
T(1) = 1
// Therefore
n = 1
k = 1
n = k

Now we can substitute at our recurrence for:
   T(n) = 2^n [ T(1) ]
   T(n) = 2^n [ O(1) ]
=> T(n) = 2^n

Therefore, your recurrence is O(2^n)

A: T(F(I)) = T(F(I - 1)) + T(F(I - 1)) + O(1), so it looks like O(2^n).
(Take a look at you recursion tree, T(F(4)) = T(F(3)) + T(F(2)) + T(F(1)) + O(1), while substitute T(F(2)) + T(F(1)) with T(F(3)) you will get T(F(4)) = T(F(3)) + T(F(3)))

A: We can prove by induction that it is 2^n
First we prove that F(n) = (2^n-1) * F(1)
it is true for n=1 so let's prove this for n+1
F(n+1) = F(n) + F(n-1) + .. + F(1)
=(2^n-1 + 2^n-2 +...+2^0) * F(1)
=((1-2^n)/(1-2)) * F(1) = 2^n * F(1)
So we have the formula and from it the complexity is easy to get

A: Because you memoize, it will be O(n) time. You use O(n) in memory to compensate for it.


text:
Q: Material UI + Formik, handleSubmit() doesn't work I am making a form using Format and Material UI, however when I try to submit the form, nothing happens. I have tried changing button's type, checking initial values and. validation schema. Here is the code of the useFormik and MUI form:
  const initialValues = useMemo<Course>(
    () => ({
      category: '',
      name: '',
      grade: '',
      month: '',
      year: '',
    }),
    [],
  );

  const validationSchema = yup.object({
    category: yup.string().required(t('errors:cannotBeEmpty')),
    name: yup.string().required(t('errors:cannotBeEmpty')),
    grade: yup.string().required(t('errors:pleasePick')),
    month: yup.string().required(t('errors:cannotBeEmpty', { name: t('common:date') })),
    year: yup.number().required(t('errors:cannotBeEmpty', { name: t('common:date') })),
  });

  const { values, touched, errors, handleChange, setFieldValue, handleSubmit, isSubmitting, resetForm } =
    useFormik<any>({
      initialValues,
      validationSchema,
      onSubmit: async ({ category, name, grade, month, year }, { setErrors }) => {
           console.log(values);
        // const date = new Date(year, month);
        // try {
        //   await dispatch(actions.createGlance({ name: gpa, grade, date, category }));
        //   setMessageModalVisible(true);
        // } catch (err) {
        //   if (err.message) {
        //     toast.error(err.message);
        //   }
        //   setErrors(err.errors ?? {});
        // }
      },
      enableReinitialize: true,
    });

  useEffect(() => {
    if (!open) {
      resetForm();
    }
  }, [resetForm, open]);

  return (
    <mui.Modal open={open} onClose={onClose}>
      <mui.Box sx={modalStyle}>
        <mui.Box sx={closeButton}>
          <img style={{ cursor: 'pointer' }} src={CloseIcon} alt="close-icon" onClick={onClose} />
        </mui.Box>
        <mui.Box sx={{ textAlign: 'center', width: '506px', margin: '0 auto' }}>
          <mui.Typography sx={modalTitle}>{t('profile.student.transcriptScreen.addTests')}</mui.Typography>
          <mui.Typography sx={modalSubTitle}>
            {t('profile.student.transcriptScreen.addYourFinalGrade')}
            <mui.Typography onClick={openLetterGradingScaleModal} sx={modalBlueSubTitle}>
              {' '}
              {t('profile.student.transcriptScreen.clickHereToViewScale')}
            </mui.Typography>
          </mui.Typography>
        </mui.Box>
        <mui.FormControl
        <mui.Box style={{ display: 'flex', justifyContent: 'center', margin: '64px 0 16px 0' }}>
          <mui.FormControl style={{ width: '598px' }}>
            <mui.InputLabel id="course-selection-label">
              {t('profile.student.transcriptScreen.selectCourse')}
            </mui.InputLabel>
            <mui.Select
              label={t('profile.student.transcriptScreen.selectCourse')}
              labelId="course-selection-label"
              value={values.category ?? ''}
              name="category"
              onChange={handleChange}
            >
              {categoryOptions.map(({ name, id }) => (
                <mui.MenuItem value={id}>{name}</mui.MenuItem>
              ))}
            </mui.Select>
          </mui.FormControl>
        </mui.Box>
        {values.category !== '' && (
          <mui.Box
            style={{ paddingBottom: '16px', margin: '0 auto', width: '598px', borderBottom: '1px solid #E0E0E0' }}
          >
            <mui.Box style={{ display: 'flex', justifyContent: 'space-between', width: '598px', margin: '16px auto' }}>
              <mui.FormControl style={{ width: '48%' }}>
                <mui.InputLabel id="course-name-label">
                  {t('common:subjectCourseName', {
                    subject:
                      values.category === 'SOCIAL_STUDIES'
                        ? 'Social Studies'
                        : values.category.toLowerCase().charAt(0).toUpperCase() +
                          values.category.toLowerCase().slice(1),
                  })}
                </mui.InputLabel>
                <mui.OutlinedInput
                  name="name"
                  value={values.name ?? ''}
                  onChange={handleChange}
                  label={t('common:subjectCourseName', {
                    subject:
                      values.category === 'SOCIAL_STUDIES'
                        ? 'Social Studies'
                        : values.category.toLowerCase().charAt(0).toUpperCase() +
                          values.category.toLowerCase().slice(1),
                  })}
                ></mui.OutlinedInput>
              </mui.FormControl>

              <mui.FormControl style={{ width: '48%' }}>
                <mui.InputLabel id="course-grade-label">{t('common:grade')}</mui.InputLabel>
                <mui.Select name="grade" value={values.grade ?? ''} onChange={handleChange} label={t('common:grade')}>
                  {gradeOptions.map(({ name }) => (
                    <mui.MenuItem value={name}>{name}</mui.MenuItem>
                  ))}
                </mui.Select>
              </mui.FormControl>
            </mui.Box>

            <mui.Box style={{ display: 'flex', justifyContent: 'space-between', width: '598px', margin: '16px auto' }}>
              <mui.FormControl style={{ width: '48%' }}>
                <mui.InputLabel id="course-semester-label">{t('common:semesterTaken')}</mui.InputLabel>
                <mui.Select
                  name="month"
                  value={values.month ?? ''}
                  onChange={handleChange}
                  label={t('common:semesterTaken')}
                >
                  {semesterOptions.map(({ name, id }) => (
                    <mui.MenuItem value={id}>{name}</mui.MenuItem>
                  ))}
                </mui.Select>
              </mui.FormControl>

              <mui.FormControl style={{ width: '48%' }}>
                <mui.InputLabel id="course-year-label">{t('common:yearTaken')}</mui.InputLabel>
                <mui.Select name="year" value={values.year ?? ''} onChange={handleChange} label={t('common:yearTaken')}>
                  {yearOptions.map(({ name }) => (
                    <mui.MenuItem value={+name}>{name}</mui.MenuItem>
                  ))}
                </mui.Select>
              </mui.FormControl>
            </mui.Box>
          </mui.Box>
        )}
        {values.category !== '' && (
          <mui.Box
            style={{
              paddingTop: '32px',
              width: '598px',
              margin: '0 auto',
              display: 'flex',
              justifyContent: 'space-between',
            }}
          >
            <mui.Button style={{ fontWeight: 600 }} variant="outlined">
              {t('common:addMore')}
            </mui.Button>
            <mui.Button type="button" onClick={() => handleSubmit()} style={{ fontWeight: 600 }} variant="contained">
              {t('common:save')}
            </mui.Button>
          </mui.Box>
        )}
      </mui.Box>
    </mui.Modal>
  );

I have checked a plenty of other Stackoverflow posts, but none of the responses helped me. I would be really pleased if someone helps me with this issue!
Thank you.


text:
Q: can't use mysql count in this query I have this query right now to grab comments on my website:
SELECT a.author_id,
a.guest_username,
a.comment_text,
a.comment_id,
u.pc_info_public,
u.distro,
a.time_posted,
a.last_edited,
a.last_edited_time,
u.username,
u.user_group,
u.secondary_user_group,
u.`avatar`,
u.`avatar_gravatar`,
u.`gravatar_email`,
u.`avatar_uploaded`,
u.`avatar_gallery`,
u.pc_info_filled,
ul.username as username_edited
FROM `articles_comments` a
LEFT JOIN `users` u ON a.author_id = u.user_id
LEFT JOIN `users` ul ON ul.user_id = a.last_edited
WHERE a.`article_id` = ? ORDER BY a.`comment_id` ASC LIMIT ?

I'm trying to add-in a COUNT(l.likes) from a table called "likes" (the "l" being what I name it when doing the ON check).
The problem is, when I add the COUNT in, my query instantly fails with an error like this:

Syntax error or access violation: 1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'goltest.a.author_id'; this is incompatible with sql_mode=only_full_group_by

I've googled and googled and all the examples I can find to fix it don't make sense to me, can someone elaborate on the error?

A: The error message tells you what's wrong: You need to group by something, to count how many likes that something has. The grouping is usually done on the primary key on which you're joining the tables.


text:
Q: What does the average mean in Jarzynski equality? Jarzynski equality:
$$
\left<\exp(-\beta W)\right> = \exp(-\beta \Delta F)
$$
In Jarzynski's paper on Physics Review Letter on arxiv, he just said canonical ensemble average, but he mean which system's canonical ensemble? And the Jarzynski equality is confirmed by experiment, how do we comprehend ensemble distribution in real life?

A: You can think of it as an average over trials.
On each trial, you do some work on the system by adjusting the external parameters. Each time you use the same protocol for changing the parameters. The amount of work will vary from trial to trial because of the probability distribution over initial states and the stochastic interactions with the heat bath (at least in later versions of the derivation).
This results in a probability distribution over $W$. You can average over that distribution, or equivalently average over an infinite number of trials. This is the average in the equality.


text:
Q: C# RestSharp API returns data with no Headers I am struggling with converting JSON (obtained from a Rest API) into a C# Class.  The reason that I am having difficulty is because the JSON data being returned does not appear to have any headers, which directly plays at odds with the generated C# class.
My process is as follows:

*

*Make the call to Rest API and get JSON Data

*In Visual Studio, go to Edit > Paste Special > Paste as JSON Class

*This sets up the class structure, using parental objects like "Rootobject" and "Class1"

*Attempt to deserialize/convert the data into the class by using System.Text.JSON's Deserialize call.

The Deserialize call is failing because the data does not have "Class1" as a header.
Conversely, if I add it manually, the class conversion succeeds:

The ultimate question, is how do I get the Rest API to return the data while using these types of headers?
If someone could point me in the right direction I would appreciate it.

Edit:  Here is the JSON and C# Generated Class -
JSON (This is a single piece of data, but the real JSON has many of these separated by comma)
[
    {
        "id": 63062,
        "parent_id": 0,
        "status": "processing",
        "currency": "USD",
        "version": "6.5.1",
        "prices_include_tax": false,
        "date_created": "",
        "date_modified": "",
        "discount_total": "0.00",
        "discount_tax": "0.00",
        "shipping_total": "5.99",
        "shipping_tax": "0.00",
        "cart_tax": "0.00",
        "total": "18.98",
        "total_tax": "0.00",
        "customer_id": ,
        "order_key": "",
        "billing": {
            "first_name": "",
            "last_name": "",
            "company": "",
            "address_1": "",
            "address_2": "",
            "city": "",
            "state": "",
            "postcode": "",
            "country": "",
            "email": "@.com",
            "phone": ""
        },
        "shipping": {
            "first_name": "",
            "last_name": "",
            "company": "",
            "address_1": "",
            "address_2": "",
            "city": "",
            "state": "",
            "postcode": "",
            "country": "",
            "phone": ""
        },
        "payment_method": "",
        "payment_method_title": "",
        "transaction_id": "",
        "customer_ip_address": "",
        "customer_user_agent": "",
        "created_via": "",
        "customer_note": "",
        "date_completed": null,
        "date_paid": "",
        "cart_hash": "",
        "number": "",
        "meta_data": [
            {
                "id": ,
                "key": "",
                "value": "no"
            },
            {
                "id": ,
                "key": "",
                "value": ""
            },
            {
                "id": ,
                "key": "",
                "value": "0"
            },
            {
                "id": ,
                "key": "",
                "value": ""
            },
            {
                "id": ,
                "key": "",
                "value": "4"
            },
            {
                "id": ,
                "key": "",
                "value": ""
            },
            {
                "id": ,
                "key": "",
                "value": ""
            },
            {
                "id": ,
                "key": "_",
                "value": ""
            },
            {
                "id": ,
                "key": "",
                "value": "18"
            },
            {
                "id": ,
                "key": "_",
                "value": ""
            },
            {
                "id": ,
                "key": "_",
                "value": "yes"
            },
            {
                "id": ,
                "key": "_",
                "value": "23-01"
            },
            {
                "id": ,
                "key": "_",
                "value": ""
            },
            {
                "id": ,
                "key": "",
                "value": "true"
            }
        ],
        "line_items": [
            {
                "id": ,
                "name": "",
                "product_id": ,
                "variation_id": ,
                "quantity": 3,
                "tax_class": "",
                "subtotal": "12.99",
                "subtotal_tax": "0.00",
                "total": "12.99",
                "total_tax": "0.00",
                "taxes": [],
                "meta_data": [
                    {
                        "id": ,
                        "key": "",
                        "value": "medium_jar",
                        "display_key": "Size",
                        "display_value": ""
                    }
                ],
                "sku": "",
                "price": 4.33,
                "parent_name": ""
            }
        ],
        "tax_lines": [],
        "shipping_lines": [
            {
                "id": ,
                "method_title": "",
                "method_id": "",
                "instance_id": "0",
                "total": "5.99",
                "total_tax": "0.00",
                "taxes": [],
                "meta_data": []
            }
        ],
        "fee_lines": [],
        "coupon_lines": [],
        "refunds": [],
        "payment_url": "https:///",
        "date_created_gmt": "",
        "date_modified_gmt": "",
        "date_completed_gmt": null,
        "date_paid_gmt": "",
        "currency_symbol": "$",
        "_links": {
            "self": [
                {
                    "href": "https:///wp-json/wc"
                }
            ],
            "collection": [
                {
                    "href": "https:///wp-jso"
                }
            ],
            "customer": [
                {
                    "href": "https:///wp-json/w"
                }
            ]
        }
    }
]

C# CODE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{

    public class Rootobject
    {
        public Class1[] Class1 { get; set; }
    }

    public class Class1
    {
        public int id { get; set; }
        public int parent_id { get; set; }
        public string status { get; set; }
        public string currency { get; set; }
        public string version { get; set; }
        public bool prices_include_tax { get; set; }
        public DateTime date_created { get; set; }
        public DateTime date_modified { get; set; }
        public string discount_total { get; set; }
        public string discount_tax { get; set; }
        public string shipping_total { get; set; }
        public string shipping_tax { get; set; }
        public string cart_tax { get; set; }
        public string total { get; set; }
        public string total_tax { get; set; }
        public int customer_id { get; set; }
        public string order_key { get; set; }
        public Billing billing { get; set; }
        public Shipping shipping { get; set; }
        public string payment_method { get; set; }
        public string payment_method_title { get; set; }
        public string transaction_id { get; set; }
        public string customer_ip_address { get; set; }
        public string customer_user_agent { get; set; }
        public string created_via { get; set; }
        public string customer_note { get; set; }
        public object date_completed { get; set; }
        public DateTime date_paid { get; set; }
        public string cart_hash { get; set; }
        public string number { get; set; }
        public Meta_Data[] meta_data { get; set; }
        public Line_Items[] line_items { get; set; }
        public object[] tax_lines { get; set; }
        public Shipping_Lines[] shipping_lines { get; set; }
        public object[] fee_lines { get; set; }
        public object[] coupon_lines { get; set; }
        public object[] refunds { get; set; }
        public string payment_url { get; set; }
        public DateTime date_created_gmt { get; set; }
        public DateTime date_modified_gmt { get; set; }
        public object date_completed_gmt { get; set; }
        public DateTime date_paid_gmt { get; set; }
        public string currency_symbol { get; set; }
        public _Links _links { get; set; }
    }

    public class Billing
    {
        public string first_name { get; set; }
        public string last_name { get; set; }
        public string company { get; set; }
        public string address_1 { get; set; }
        public string address_2 { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string postcode { get; set; }
        public string country { get; set; }
        public string email { get; set; }
        public string phone { get; set; }
    }

    public class Shipping
    {
        public string first_name { get; set; }
        public string last_name { get; set; }
        public string company { get; set; }
        public string address_1 { get; set; }
        public string address_2 { get; set; }
        public string city { get; set; }
        public string state { get; set; }
        public string postcode { get; set; }
        public string country { get; set; }
        public string phone { get; set; }
    }

    public class _Links
    {
        public Self[] self { get; set; }
        public Collection[] collection { get; set; }
    }

    public class Self
    {
        public string href { get; set; }
    }

    public class Collection
    {
        public string href { get; set; }
    }

    public class Meta_Data
    {
        public int id { get; set; }
        public string key { get; set; }
        public string value { get; set; }
    }

    public class Line_Items
    {
        public int id { get; set; }
        public string name { get; set; }
        public int product_id { get; set; }
        public int variation_id { get; set; }
        public int quantity { get; set; }
        public string tax_class { get; set; }
        public string subtotal { get; set; }
        public string subtotal_tax { get; set; }
        public string total { get; set; }
        public string total_tax { get; set; }
        public object[] taxes { get; set; }
        public Meta_Data1[] meta_data { get; set; }
        public string sku { get; set; }
        public float price { get; set; }
        public string parent_name { get; set; }
    }

    public class Meta_Data1
    {
        public int id { get; set; }
        public string key { get; set; }
        public string value { get; set; }
        public string display_key { get; set; }
        public string display_value { get; set; }
    }

    public class Shipping_Lines
    {
        public int id { get; set; }
        public string method_title { get; set; }
        public string method_id { get; set; }
        public string instance_id { get; set; }
        public string total { get; set; }
        public string total_tax { get; set; }
        public object[] taxes { get; set; }
        public object[] meta_data { get; set; }
    }

}


text:
Q: Merging two heaps: O(n*log(n)) vs. O(n + m) I want to merge a binary heap implemented as an array with size m into another heap (of the same kind) with n elements. Using repeated inserts, this takes O(m * log(n)). It seems to be commonly agreed that the alternative method of concatenating the arrays and then rebuilding the heap, taking O(m + n) is more efficient.
Now it seems clear to me that for some pairs (m, n) with m < n, the O(m * log(n)) method would be more efficient. According to Wolfram Alpha this is the case for m < (n * log(2)) / log(n / 2). Is this interpretation correct? And is a check worth the implementation effort/runtime-hit in practice?

A: Your interpration is wrong. As you insert elements one by one in the first heap its size will grow, getting closer to m+n, thus the complexity each insert will no longer be O(log(n)). In fact inserting elements one by one will have complexity on the order of O(m * log(m + n)).
This make the limit for the value of m for which it is better to inserting the values from the smaller heap one by one tighter, but does not eliminate it. For instance if you have a heap of size 100000 and want to merge it with a heap of size 2, it is better to insert the two elements.
Also note there are different kinds of heaps that support merge operation with better complexity. For instance a leftist heap is easy to implement and supports merge in O(log(n)).


text:
Q: how can match the list variable from websocket to connected other function? (websocket speed fast) Python 3.8. purpose: crypto bot
I am inventing my trade bot - purchase order based on realtime data from websocket.
the variable from websocket receiving to purchase order.
Variable : Coin name, current price, volume
However, I found that there is wrongly arranged coinname and price because too fast data coming from websocket. see below e.g result in terminal
[websocket data] KRW-ETC 37910.0 3929084208.6026936
[websocket data] KRW-KAVA 6425.0 15130964966.364386
[Purchase variable] KRW-ETC, 6425.0 this information is being a base coming from websocket to place an order.
[websocket data] KRW-VET 62.9 5068532801.084056
KRW-ETC is a list with 37910.0 (price) as variable for Purchase function and next websocket data(list variable) is KRW-KAVA with 6425.
after it, Purchase function gets variable - KRW-ETC + 6425.0 (which is KRW-KAVA price, next data from websocket).
anybody who knows how to manage this - well-paired with purchase function/fast websocket data speed, please kindly advise me.
in websocket receiving function
while True :
        data = wm.get()
        self.code, self.close, self.volume = data['code'], data['trade_price'], data['acc_trade_price']
        print(self.code, self.close , self.volume)
        self.__q.put([self.code, self.close, self.volume])

Purchase order
def purchase(self):
    while True:
        print(f'{self.__q.get()[0]}, {self.__q.get()[1]} this information is being a base coming from websocket to place an order. ')

A: I found a solution by myself.
Just to pick self.__q data as another variable and use the variable.
E.g)
Value = self__q.get()

Then I can use the value in the function freely without change.
This happened because while I use self__q, self__q value is changed by web-socket to download another data.


text:
Q: Is there a single word that is a more vicious connotation of "competition"? I'm writing a mildly dystopian scenario where competition is taken to vicious extremes, and I was wondering if there was a word that I could use (specifically a noun that was a synonym of "competition") to describe the sort of vicious, cutthroat ... _________ (the word that I want) that was going on.
I'm specifically looking for a word that doesn't refer to a one-off event (like "contest" or "tug-of-war"), but rather is more about the state of things.

A: Try death struggle or struggle to the death; such a struggle can last a long time -- for instance in a civil war, which in the worst case can continue for decades.

A: Consider the following terms:
• rat race, "An activity or situation which is congested with participants and which is hectic or tedious, especially in the context of a busy, modern urban lifestyle"
• slugfest, using a figurative form of the sense "(sports) A game or match in which heavy hits are exchanged"
• infighting, "Fighting or quarreling among the members of a single group or side", a term that perhaps fits well in the example sentence

A: How about "rivalry," "antagonism, and "oppugnancy?"

rivalry: the state or condition of competition or antagonism.
antagonism: an active hostility or opposition, as between unfriendly or conflicting groups.
oppugnancy: the state or quality of being oppugnant; antagonism.

A: Maybe someone can come up with more vicious but off the top of my head there is death match.  Not sure you can get more vicious than death.
A good slang piece for a constant death match or an ongoing death match competition is thunderdome.


text:
Q: Get specific value from object of arrays ES6 way I am having a data like
var d = [{
  "AD": {
    "name": "Andorra",
    "native": "Andorra",
    "phone": "376",
    "continent": "EU",
    "capital": "Andorra la Vella",
    "currency": "EUR",
  }
}, {
  "AE": {
    "name": "United Arab Emirates",
    "native": "دولة الإمارات العربية المتحدة",
    "phone": "971",
    "continent": "AS",
    "capital": "Abu Dhabi",
    "currency": "AED",
  }
}, {
  "AF": {
    "name": "Afghanistan",
    "native": "افغانستان",
    "phone": "93",
    "continent": "AS",
    "capital": "Kabul",
    "currency": "AFN",
  }
}]

and i want to get the name of each object using ES6 higher-order functions without using for or foreach.
i have tried filter and map but not knowing when to use what

A: You can easily achieve that using Array.prototype.reduce() as follows:

var d = [{
  "AD": {
    "name": "Andorra",
    "native": "Andorra",
    "phone": "376",
    "continent": "EU",
    "capital": "Andorra la Vella",
    "currency": "EUR",
  }
}, {
  "AE": {
    "name": "United Arab Emirates",
    "native": "دولة الإمارات العربية المتحدة",
    "phone": "971",
    "continent": "AS",
    "capital": "Abu Dhabi",
    "currency": "AED",
  }
}, {
  "AF": {
    "name": "Afghanistan",
    "native": "افغانستان",
    "phone": "93",
    "continent": "AS",
    "capital": "Kabul",
    "currency": "AFN",
  }
}]

const names = d.reduce((acc, curr) => {
  const keys = Object.keys(curr);
  const name = curr[keys[0]].name;
  acc.push(name)
  return acc;
}, []);

console.log(names)

A: The simply way to achieve that is for me :

var d = [{
  "AD": {
    "name": "Andorra",
    "native": "Andorra",
    "phone": "376",
    "continent": "EU",
    "capital": "Andorra la Vella",
    "currency": "EUR",
  }
}, {
  "AE": {
    "name": "United Arab Emirates",
    "native": "دولة الإمارات العربية المتحدة",
    "phone": "971",
    "continent": "AS",
    "capital": "Abu Dhabi",
    "currency": "AED",
  }
}, {
  "AF": {
    "name": "Afghanistan",
    "native": "افغانستان",
    "phone": "93",
    "continent": "AS",
    "capital": "Kabul",
    "currency": "AFN",
  }
}]

d.map(item => {
 console.log(Object.keys(item));
})

A: If there are only one key per object (AD, AE, AF...) you can use something like :

const d = [{
  AD: {
    name: 'Andorra',
  }
}, {
  AE: {
    name: 'United Arab Emirates',
  }
}, {
  AF: {
    name: 'Afghanistan',
  },
}];

const reduced = d.map(x => x[Object.keys(x)[0]].name);

console.log(reduced);

If there can be multiple key like (AD, AE, ...) you can use something like :

const d = [{
  AD: {
    name: 'Andorra',
  },

  DF: {
    name: 'Paris',
  },
}, {
  AF: {
    name: 'Afghanistan',
  },
}];

const reduced = d.reduce((tmp, x) => [
  ...tmp,

  ...Object.values(x).map(y => y.name),
], []);

console.log(reduced);


text:
Q: Any PHP function to convert invalid characters in Cookie? I got this: Warning: Cookie values can not contain any of the following ',; \t\r\n\013\014'
is there a function to remove those?  and also convert the "+" sign in to %2B ?

A: try urlencode($cookie_value);

A: At last, I use base64_encode  to do that.


text:
Q: Scaffolding controller doesn't work with visual studio 2013 update 2 PROBLEM:
I have updated to Visual Studio 2013 update 2 and now I cannot scaffold controllers.
The problem is not project specific: when I try to scaffold a controller, I get the following error in ALL and ANY project:
There was an error running the selected code generator:
'Exception has been thrown by the target of an invocation.'

It was working before updating to Visual Studio 2013 update 2.
Have googled the issue to death, but none of the various suggestions work
Eg:

*

*Commenting out OnModelCreating in my context;

*Removing packages such as MvcScaffolding, etc (I have none installed and it doesn't work with ANY project);
I have modified/customised some of the templates, but it was working after the changes.
EDIT:
I uninstalled Visual Studio 2013 Update 2 and thereby reverted to Visual Studio version 12.0.21005.1 REL.
The problem has disappeared.  Therefore, the problem is quite definitely with Update 2.
QUESTION:
Does anyone (including Microsoft) know of a fix?
EDIT 2:
Farruk Subhani's answer does not address the question:  The question clearly states that removing references to MVCScaffolding does not solve the issue.
I have added a 200 point bounty, please address the question as clearly stated.

A: Solution
Make sure section
<connectionStrings>..</connectionStrings>

is after
<configSections>..</configSections>

A: Please run the following command in the Package Manager Console:
Uninstall-Package EntityFramework -Force

Install-Package EntityFramework

Uninstall-Package  MvcScaffolding

Install-Package MvcScaffolding

A: Hey for all of you that nothing works, the real answer is you need to remove ANYTHING that has a configSource on the web.config and the connection string needs to be inlined.
EDIT:
Someone pointed out that it needs to be only <configSettings>, <appSettings>, and <connectionStrings> tags NOT using a configSource attribute. And that he was still able to use configSource attributes elsewhere, such as the rewriter tag.
I think it's that the tooling cannot follow configSource locations for the stuff it uses like connection strings and application settings.
Microsoft should be on this issue if not fixed yet.
EDIT 2:
Even thought @awrigley has marked his answer as correct it's a known Visual Studio bug. I've managed to tell then and I think it will get some attention soon.
https://github.com/aspnet/Tooling/issues/169#issuecomment-144197015

A: I had the very same issue with Visual Studio 2013 Update 3, but only for the scaffolders working with Entity Framework.
The issue is seemingly caused by the incompatibility between Entity Framework 6.1.0 and the scaffolders in Visual Studio 2013 Update 2 and above.
To upgrade EF do the following:

Uninstall-Package EntityFramework -Force
Install-Package EntityFramework

This answer is borrowed from here
After the upgrade the scaffolders are working fine for me. Make sure to install the new version in every project where Entity Framework is required.

A: n my case, I solved the issue with the connection string in the web.config.
Previuos the issue I has
  <connectionStrings configSource="Configs\ConnectionString.config"/>

and I doesnt know why, but vs cant connect to the database and fail.
after the change
<connectionStrings>
    <add name="UIBuilderContext" connectionString="metadata=res:/ ..... " />
  </connectionStrings>

and it works

A: This can be useful for people who haven't installed any scaffolding nuget packages in their solution.
In fact I don't have mvcscaffolding or t4scaffolding installed and got the same error message.
In my case the problem/bug was caused by changing the connection string.
Here what I had/steps to reproduce.

*

*Installed Visual Studio 2013 Community Edition

*Created MVC project

*Created code first model

*Edited connection string to connect to a real server, like this:
<add name="DefaultConnection"
     connectionString="server=myserv;database=MyCustomerDB;user id=myuser;password=mypass"
     providerName="System.Data.SqlClient" />

Then I enabled migrations via nuget, like this:

*

*Enable-Migrations

*Add-Migration InitialCreate

*Update-Database

*I started the website and I could register a user. All tables were created correctly.

Then I created a controller by using the scaffolding option:

*

*right click on "Controllers" > "Add" > Controller... > MVC 5 Controller with views, using Entity Framework > selected my context and a class to be used. It worked.

Then I decided to do more code first changes and begin from scratch:

*

*I changed the connection string as follows, to use localdb:
<add name="DefaultConnection"
     connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-Test-20141126094523.mdf;Initial Catalog=aspnet-Test-20141126094523;Integrated Security=True"
     providerName="System.Data.SqlClient" />

Then I went on:

*

*deleted the migrations folder

*re-enabled migrations using the same commands as above, in the nuget console

*started thw website and registered a user

*checked the mdf db. All tables are there, so the connection string works.

*right click on "Controllers" > "Add" > Controller... > MVC 5 Controller with views, using Entity Framework. Selected my context and a class to be used. It did not work and this popup error appeared:

There was an error running the selected code generator: 'Exception has
  been thrown by the target of an invocation.'

SOLUTION:
After some investigation, what I did, is changing back the connection string in the web.config to the initial one to the "real server" (instead of localdb). I tried again to generate the controller with views. It worked!
So it seems to me a connection string problem/bug or a localdb problem... can't explain it. Maybe Visual Studio doesn't like what I did, I had to keep my old connection string...
Anyway, so now when I need scaffolding I just change the connection string to the one that works. Then to test my website I change it back to the localdb one.

A: I'll explain here a little bit more in English, so anyone can understand. Hope this helps anyone out there This occurs because Visual Studio fails to connect to the database model .
This happens when you change the name and/or the path in the class that extends DbContext and didn't change it in the Web.config file (at the outermost part of your project: the root).
Example:
Imagine you scaffolded the DbContext code:
a) You right clicked a folder in your project and added a "ADO.NET Entity Data Model", and you named it "Model1"
You get the following code:
  public class Model1 : DbContext
{
    // Your context has been configured to use a 'Model1' connection string from your application's
    // configuration file (App.config or Web.config). By default, this connection string targets the
    // 'Skelleton.Models.Model1' database on your LocalDb instance.
    //
    // If you wish to target a different database and/or database provider, modify the 'Model1'
    // connection string in the application configuration file.
    public Model1()
        : base("name=Model1")
    {
    }

    // Add a DbSet for each entity type that you want to include in your model. For more information
    // on configuring and using a Code First model, see http://go.microsoft.com/fwlink/?LinkId=390109.

    // public virtual DbSet<MyEntity> MyEntities { get; set; }
}

b) Now, you have decided that the name you've just written is plain bad, so you change it to AppContext
Your code now looks like this:
  public class AppContext : DbContext
{
    // Your context has been configured to use a 'AppContext' connection string from your application's
    // configuration file (App.config or Web.config). By default, this connection string targets the
    // 'Skelleton.Models.AppContext' database on your LocalDb instance.
    //
    // If you wish to target a different database and/or database provider, modify the 'AppContext'
    // connection string in the application configuration file.
    public AppContext()
        : base("name=AppContext")
    {
    }

    // Add a DbSet for each entity type that you want to include in your model. For more information
    // on configuring and using a Code First model, see http://go.microsoft.com/fwlink/?LinkId=390109.

    // public virtual DbSet<MyEntity> MyEntities { get; set; }
}

Then, you try to Scaffold the CRUD (Create, Read, Update, Delete) operations with views and it fails!

Why is that?
Well, if we go to the web.config file, we can see the following string:
 <add name="Model1" connectionString="data source=(LocalDb)\v11.0;initial catalog=Skelleton.Models.Model1;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />

(This line is usually below <add name="DefaultConnection" )

And there is where the problem lies. You need to change Model1 for the name you've given out!
In this case, it should say "AppContext" instead of "Model1"
And where it says:
initial catalog=Skelleton.Models.Model1;

Verify that:

*

*It's the name of the .cs file that has the class

*The namespace (or the series of names (dot-separated) that comes before the name of your class) is the correct one. It's important to notice that you do not append to the end the ".cs" extension; just the name of your file.
It should look like this:

Because I changed the name of the class, both internally and externally (inside it and it's file name), and did not change its location, I just rename it to AppContext
After this has been done. You can scaffold normally ;)
Hope this helps!

A: For me, I had to ensure <configSettings>, <appSettings>, & <connectionStrings> tags were NOT using a configSource attribute.
I was still able to use configSource attributes else where, such as the rewriter tag.

A: I think, the problem is due to bad configuration in web.config file.
In my case I had multiple
<entityFramework> sections in web.config, and the problem resolved after I changed the configurations.

A: I'm on VS 2013 Update 4 and have exactly same issue. It works for me when moving connection string from external file into web.config. So I guess you could try to make sure not using configureSource attribute for connectionString when scaffolding.
My web.config before and after the change
Before:
<connectionStrings configureSource="connectionStrings.config/>

After:
<configuration>
  <configSections>

  </configSections>
  <log4net configSource="log4net.config" />
  <connectionStrings>
    <clear/>
    <add name="DefaultConnection" connectionString="Data Source=.;Initial Catalog=YourDb;Integrated Security=False;User ID=sa;Password=YourPassword!#;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
  </connectionStrings>

A: A combination of things have worked for me:

*

*Upgrade to Visual Studio 2013 Update 3.

*Upgrade Entity Framework to 6.1.1

*Modify the context configuration to use IDbSet<...> instead of DbSet<...> (I have heard that this can affect using async actions, but not apparently in my case, as I use this in my login actions, etc, as supplied by ASP.NET Identity 2 sample Nuget package).
Quite why this combination works, I have no idea.  But then given the thundering silence from MS, I am probably not alone.  I guess update 2 just didn't work...

A: I have performed following to solve this issue:

*

*In Package Manager check if you have MVCScffolding or T4Scaffolding (Core or pre release for vs2013)

*Uninstall all packaged that depend on any of MVCScaffolding or T4Scaffolding

*Copy CodeTemplates Folder in full (Do not replace your custom templates but make sure you have rest of the files from root of this folder. I take that you have done that part as you have customised some templates so you know where this folder is)

*Build Your project and close it.

*Restart Visual Studio under admin mode

*Open Package Manager Console (it should not have any errors and you can see PM> without errors.

*Right Click on Controller folder and choose Add->New Scaffolding Item or Choose Add->Controller both should ask which one you want and then choose MVC5 scaffold or which ever appears in list.

*You will then get to select your parameters if its controller you might need to choose DBContext or repository etc.

This produced the controller and relevant views for me.
I added a custom partial view called QuickView in that folder however this scaffolding procedure did not consider that and only generated views that it was doing by default. I am not sure if you need to add these custom views in a file to tell Scaffolder to generate those as well.

A: For me what worked was to make sure the <configSections> node in the web.config file was the first node immediately after <configuration> node.
Initially, when I added my connectionStrings, I had actually placed it before the configSections, which made the Scaffold tool break.
Seems like when the scaffolding runs and tries to grab connection info, it expects the config section for the entityFramework node to be there already so it know what DB provider to use, but when I had the connection string before configSections, it didn't know to use LocalDB (which is what my conn string was using).

A: I have been having this same problem in update 4. I found that the problem came from the <configSections></configSections> not having a section name defined. The fix I put in between the tags is as follows and all the errors were fixed:

Build the project and everything should work. Cheers!

A: I'm running VS 2015RC the last one before final cut. Not to discount any of the solutions here. My solution was under nugget package manager and updated my Microsoft.Aspnet.Mvc 5.2.3 package and that fix my issue.
I hope that helps anyone using VS 2015.

A: i used Initializer and when remove/comment Initializer from myDbContext constructer , scaffolding work fine
public myDbContext () : base("name=DefaultConnection")
    {

        //Database.SetInitializer(new DropCreateDatabaseIfModelChanges<DastanakDbContext>());
        //Database.Initialize(true);
    }


text:
Q: Cycle Basis = Matroids? How is it even possible? Can anyone explain to me why a cycle basis hones the properties of a matroid? Especially points 2 & 3.
How can a subset of I also be a member of I? Isn't a cycle basis supposed to be consisted of cycles and cycles only? If the cycle basis consisted a triangle, wouldn't a subset of the triangle become an edge? And by point 2 am I supposed to say that the edge is also a member of I?
I would really appreciate it if anyone can use a square or pentagon graph to explain, cuz my mind is really messed up...
Thanks in advance.


text:
Q: MS Access VBA always calling for Macro when manually running Having this strange behaviour in my Access DB since today. If I try to run code in VBA (i.e. F5) a box comes up and asked to select a macro to run. Never had this problem before as I just want it to run the code I did. Tried to find a solution but no success.
I happens for all my code... like Public Function or Private Sub...
For example I created this code. When I execute it by clicking the button it works but if I run in VBA with F5 it always asks for the macro...
Public Sub Command18_Click()
MsgBox ("Hello")
End Sub

A: This occurs if you try to hit f5 and run code in a form.
While you can hit f5 for a regular plain jane code in a code module, if you try this for form code, then f5 will pop that macro prompt.
Also, if by accident (or by intent) created a class module? Then again, you see that prompt.
So, for a form code module, or a class code module?
Such code can be started by hitting f5, since you need to create an "instance" of that class before it can be run.
And, a form's code module also is considered a class module - an instance (in this case the form has to be open) must be created first. So, in the case of form's code module, you can set break-point in that code to debug, but you can't hit f5 in such code modules, or inside of class modules - since an "instance" of that object has to be created first, and hitting f5 is not able nor capable of knowing which or even where such code exists to create the instance of that class code module (of which even form's code modules are also this case).
The HUGE giveaway here is that in your comments you note some click() event. Well, then that means your working with code inside of a form's code module - and f5 can't be used to start such code - it is still a class module, and an instance of that code module has to be created first.
So, if I create a class code module like this:

then
  Option Compare Database
  Option Explicit

  Sub TestMsg()

      MsgBox "hello"

  End Sub

Now, if I hit f5 in above sub, the macro prompt appears!!!!
I would have to create a plain jane regular code module, and say type in this:
Sub TestFun55()

  Dim MyClass As New Class1

  MyClass.TestMsg

End Sub

So, I can hit f5 in above.
And the SAME goes for code inside of a form's module. You can't hit f5 in that form's code module (which is considered a class code module).


text:
Q: How to break a maven build when there is a dependency conflict? I ran mvn dependency:tree for a project and I saw output like the following:
[INFO] my:project:jar:1.0.0-SNAPSHOT
[INFO] +- some.other:library:jar:2.0.0:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.6.0:compile
[INFO] |  \- (org.slf4j:slf4j-api:jar:1.6.0:compile - omitted for conflict with 1.6.1)

This is a bad state to be in because my project depends directly on slf4j 1.6.0 and some library that we depend on transitively depends on slf4j 1.6.1. These two versions happen to be binary compatible so the build passes without any warnings. Is there a way to get Maven to be more strict about its dependency resolution so that I could configure a new build that would fail in this scenario? In this case, the solution would be to just update our dependency to the newer version of slf4j.

A: Though dated, I think this SO discussion is related.

A: The maven-enforcer-plugin has a dependencyConvergence configuration which does what I want. Coincidentally, the example from the documentation uses slf4j.
Configure it like this:
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-enforcer-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <id>enforce</id>
            <configuration>
                <rules>
                    <DependencyConvergence />
                </rules>
            </configuration>
            <goals>
                <goal>enforce</goal>
            </goals>
        </execution>
    </executions>
</plugin>

This combination of dependencies will cause a build to fail:
  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>1.6.1</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-nop</artifactId>
      <version>1.6.0</version>
    </dependency>
  </dependencies>

With this being logged during compilation:
[ERROR]
Dependency convergence error for org.slf4j:slf4j-api:1.6.1 paths to dependency are:
+-org.myorg:my-project:1.0.0-SNAPSHOT
  +-org.slf4j:slf4j-jdk14:1.6.1
    +-org.slf4j:slf4j-api:1.6.1
and
+-org.myorg:my-project:1.0.0-SNAPSHOT
  +-org.slf4j:slf4j-nop:1.6.0
    +-org.slf4j:slf4j-api:1.6.0


text:
Q: Changing text in a label not working in customtkinter I am trying to create a simple age calculating program using customtkinter as it is my first time using it although for some reason the age is not showing up in the age_label. What is supposed to happen is you type in the year you were born in year_entry, press the enter_button, and then your age will show up next to label_age in age_label however nothing shows up in the age_label. I have tried setting the age_label["text"] to a string instead of a variable to see if it works but that doesn't work either.
import tkinter as tk
import customtkinter
import tkinter.font as font

window = customtkinter.CTk()
window.geometry("300x100")
window.title("Age Calculator")
window.resizable(width=False, height=False)

def enterButton():
    year = year_entry.get()
    age = str(2022 - int(year))
    age_label["text"] = str(age)

customtkinter.set_appearance_mode("System")
customtkinter.set_default_color_theme("green")

label_year = customtkinter.CTkLabel(master=window, text="Enter year of birth:", text_font=('Arial', 13))
label_year.place(relx=0.25, rely=0.2, anchor=tk.CENTER)

label_age = customtkinter.CTkLabel(master=window, text="Age:", text_font=('Arial', 13))
label_age.place(relx=0.42, rely=0.7, anchor=tk.CENTER)

year_entry = customtkinter.CTkEntry(master=window, width=50, height=10, placeholder_text="Year")
year_entry.place(relx=0.65, rely=0.2, anchor=tk.E)

enter_button = customtkinter.CTkButton(master=window, text="Enter", width=80, height=7, corner_radius=5, command=enterButton)
enter_button.place(relx=0.7, rely=0.10)

age_label = customtkinter.CTkLabel(master=window, text="", text_font=('Arial', 13), width=50)
age_label.place(relx=0.5, rely=0.55)

window.mainloop()

A: Changing attributes with the brackets notation like this:
widget["attribute"] = new_value

is not implemented in CustomTkinter and won't be implemented in the future. I would also consider this bad coding style, because when you see the bracket notation with a string inside, you would assume it's a dictionary, but it's not.
You need to use the .configure() method:
widget.configure(attribute=new_value)

A: I used the .configure(text= new_string_value) but I could not see it on the screen.

Python 3.713
customtkinter 5.0.3


text:
Q: How can all postfix alerts to root be disabled? I've recently installed Postfix on Ubuntu 14.04 and I'm using a gmail account to send messages from it.
From time to time I get delivery failure messages to root@mydomain.com. The title of those messages is:
*** SECURITY information for myhost

The content was one time related to unresolved host; another time an incorrect password attempt for a sudo command.
How can all these types of messages can be turned off? Is it possible to make all messages with root@mydomain.com recipient be ignored by Postfix?

A: You can edit /etc/aliases file and change the line with postmaster to something like:
postmaster: /dev/null

This will redirect every mail to postmaster to the trash. It could be better to redirect it to a local file instead of trashing them. Look at your option in man page of aliases
After you have made your change to /etc/aliases, run
newaliases
postfix reload

A: Your system writing security alerts and postfix sending them on to you indicates that something is wrong. Simply sending these alerts to /dev/null is going to hide genuine security issues. In this case you will have a security problem, probably being send when someone attempts to log in. The fix is to check through your auth.log to see what is triggering these messages (search for "problem" - grep problem /var/log/auth.log) and work out why before fixing it.


text:
Q: Google script to delete rows when I use the deleteRows function I get the error :
TypeError: Cannot read property 'deleteRows' of null
    at clearRange(Code:4:4)
here is my code:
function clearRange() {
var ss = SpreadsheetApp.getActive();
// Rows start at "2" -  delete of N rows (400)
ss.deleteRow(2, 400);
}

Can you please help me to solve this issue?
Thanks and regards
Thierry

A: As Andres has said, your script may not be attached to your sheet, and you will have to go to the sheet in question and click Tools > Script Editor.
However, there are two other possible issues -

*

*The function is named deleteRows and not deleteRow

*You're calling deleteRows() on a Spreadsheet object. It is a Sheet function.

If these were the issues, this code should fix it.
function clearRange() {
  var ss = SpreadsheetApp.getActive();
  var sheet = ss.getActiveSheet();
  // Rows start at "2" -  delete of N rows (400)
  sheet.deleteRows(2, 400);
}

A: Your ss spreadsheet variable is null which means your script is not bound to any spreadsheet as it should be to use the getActive method. You can create a container bound script following the steps explained here:

To create a bound script, open a Google Sheets, Docs, Slides, or Forms
  file, then select Tools > Script editor.


text:
Q: Current value of generator In Python I can build a generator like so:
def gen():
    x = range(0, 100)
    for i in x:
        yield i

I can now define an instance of the generator using:
a = gen()

And pull new values from the generator using
a.next()

But is there a way—a.current()—to get the current value of the generator?

A: You set the value of a variable.
current_value = a.next()

then use current_value for all it's worth.
Python uses this often in for statements
a = xrange(10)
for x in a:
    print(x)

Here you are defining x as the current value of a.

A: There isn't such a method, and you cannot add attributes to a generator. A workaround would be to create an iterator object that wraps your generator, and contains a 'current' attribute. Taking it an extra step is to use it as a decorator on the generator.
Here's a utility decorator class which does that:
class with_current(object):

    def __init__(self, generator):
        self.__gen = generator()

    def __iter__(self):
        return self

    def __next__(self):
        self.current = next(self.__gen)
        return self.current

    def __call__(self):
        return self

You can then use it like this:
@with_current
def gen():
    x=range(0,100)
    for i in x:
        yield i

a = gen()

print(next(a))
print(next(a))
print(a.current)

Outputs:
0
1
1

A: Using another global variable to store the current value might be feasible.
# Variable that store the current value of the generator
generator_current_val = None

def generator():
    global generator_current_val # to set the current value

    for i in range(10):
        generator_current_val = i
        yield i

a = generator()

print(next(a)) # 0
print(next(a)) # 1
print(next(a)) # 2
print(generator_current_val) # 2
print(next(a)) # 3

A: You can use a sliding window generator, something like
def _window(i: Iterator[T]) -> Iterator[Tuple[T, Optional[T]]]:
    prev = None
    for x in i:
        if prev:
            yield prev, x
        prev = x
    yield prev, None

i = _window(iter([1,2,3,4]))
print(next(i)) # (1, 2)
print(next(i)) # (2, 3)
print(next(i)) # (3, 4)
print(next(i)) # (4, None)


text:
Q: App Attest, why the counter value should be equal to 0 I was
https://developer.apple.com/documentation/devicecheck/validating_apps_that_connect_to_your_server
and came across the below statement
counter (4 bytes) — A value that reports the number of times your app has used the attested key to sign an assertion.
It says that while verifying the attestation object, Verify that the authenticator data's counter field equals 0.
Why is that necessary? what does this signify.
Can we reset the value to zero?


text:
Q: Copying Selected file from OpenFileDialog c# I'm trying to copy a file from OpenFileDialog to a file path
And I'm still a basic so it's hard for me. I google stuffs too but I dont understand that much.
Can someone please help me out
private void button2_Click(object sender, EventArgs e)
    {
        // Show the dialog and get result.
        DialogResult result = openFileDialog1.ShowDialog();
        if (result == DialogResult.OK) // Test result.
        {
            string newPath = @"C:\Users\" + un + "\\AppData\\Roaming\\NF";
            File.SetAttributes(newPath, FileAttributes.Normal);
            File.Copy(openFileDialog1.FileName, newPath, true);
        }
    }

A: The second argument of File.Copy is the name of the file in the new path.
You are passing a directory name.
Add this to your code before copying
string destFile = Path.Combine(newPath, Path.GetFileName(openFileDialog1.FileName));
File.Copy(openFileDialog1.FileName, destFile, true);

Apart from this I recommend to not build your paths using string concatenations. This could be easily a source of errors.  Use always the methods available in the class Path
string newPath = Path.Combine("C:\\Users",  un, "AppData\\Roaming\\NF");


text:
Q: Remind me to post that answer later I have asked a question; then, as the tumbleweed blew through my living room, I fixed it myself, and I forgot I had ever asked.
Now I need to reformat, and clean up the question, but I don't have time or inclination.
Could you put up a reminder so I can mark that question as "hmm I must do that someday" and see it each time I return?
I want to make the site better, just not today.

A:
I have asked a question ... and I forgot I had ever asked

All four of your questions are on your user profile:
https://stackoverflow.com/users/571567/paul
Just click on your name at the top of every page and scroll down to "questions" to refer to any of them at any time.