text:
Q: removing specific element from array Javascript I have some svg elements that are used to make up a map of the world. They look like this:
<path
     inkscape:connector-curvature="0"
     id="Afghanistan"
     onmouseover="displayName(this)"
     data-name="Afghanistan"
     data-id="AF"
     d="m 1369.9,333.8 -5.4,0 -3.8,-0.5 -2.5,2.9 -2.1,0.7 -1.5,1.3 -2.6,-2.1 -1,-5.4 -1.6,-0.3 0,-2 -3.2,-1.5 -1.7,2.3 0.2,2.6 -0.6,0.9 -3.2,-0.1 -0.9,3 -2.1,-1.3 -3.3,2.1 -1.8,-0.8 -4.3,-1.4 -2.9,0 -1.6,-0.2 -2.9,-1.7 -0.3,2.3 -4.1,1.2 0.1,5.2 -2.5,2 -4,0.9 -0.4,3 -3.9,0.8 -5.9,-2.4 -0.5,8 -0.5,4.7 2.5,0.9 -1.6,3.5 2.7,5.1 1.1,4 4.3,1.1 1.1,4 -3.9,5.8 9.6,3.2 5.3,-0.9 3.3,0.8 0.9,-1.4 3.8,0.5 6.6,-2.6 -0.8,-5.4 2.3,-3.6 4,0 0.2,-1.7 4,-0.9 2.1,0.6 1.7,-1.8 -1.1,-3.8 1.5,-3.8 3,-1.6 -3,-4.2 5.1,0.2 0.9,-2.3 -0.8,-2.5 2,-2.7 -1.4,-3.2 -1.9,-2.8 2.4,-2.8 5.3,-1.3 5.8,-0.8 2.4,-1.2 2.8,-0.7 -1.4,-1.9 z"></path>

I want to be able to click on one of these elements which is generated at random.If the user correctly clicks the randomly generated country it will change color to white, if they take two attempts it will be orange, three or more attempts it highlights the correct country for the user to click. Once the user clicks the correct country a new randomly generated country will be produced.
Thanks to Alex L, I have all of the countries in a variable and functions that will change the color and randomly generate a country each time the start button is clicked.
const allPaths = document.querySelectorAll('svg > path');

function displayName(elem){
   console.log(elem.id)
}

allPaths.forEach(elem => elem.addEventListener('click', myFuncHandler));

function myFuncHandler(e){
   const country_id = e.target.id;
   const thisCountry = e.target.getAttribute('data-name');
   const colour = thisCountry == targetSpan.innerHTML ? "#ffffff" : "#8a0000";
   e.target.style.fill = colour;

}

const StartButton = document.querySelector('#startButton');
StartButton.addEventListener('click', e => {
   const randIndex = Math.floor(Math.random() * (allPaths.length));
   const randCountry = allPaths[randIndex];
   targetSpan.innerHTML = randCountry.getAttribute('data-name');
   allPaths.forEach(elem => elem.style.fill = '#008000');
});

To achieve what I want, I believe I need to use the splice array method in some way. The color change is nearly there, I think I can just user the ? syntax a bit more as is done in the myFuncHandler function.

A: Looks like this is building off my last answer: https://stackoverflow.com/a/61431954/9792594
So I build on this for your requirements here.
Better to look at the demo in codePen (as there is a char limit here so I can't include all countries): https://codepen.io/Alexander9111/pen/ExVXEOq
Note: each time they get it correct, we splice it out the array. This means up front you need to put the nodelist into an array with const allPaths = [...document.querySelectorAll("svg path")];

const targetSpan = document.querySelector("#target");
const allPaths = [...document.querySelectorAll("svg path")];
const attempts = document.querySelector("#attempts");
/*
function displayName(elem){
  console.log(elem.id)
}
*/
allPaths.forEach((elem) => elem.addEventListener("click", myFuncHandler));

function myFuncHandler(e) {
  const country_id = e.target.id;
  const thisCountry = e.target.getAttribute("title");
  if (thisCountry == targetSpan.innerHTML) {
    const colour = "#004400"; //green
    e.target.style.fill = colour;
    const correctInd = allPaths.findIndex(
      (el) => el.getAttribute("title") == targetSpan.innerHTML
    );
    allPaths.splice(correctInd, 1);
    nextCountry(e);
  } else {
    const currAttempt = parseInt(attempts.innerHTML);
    if (currAttempt >= 3) {
      //find correct answer
      const correctAns = allPaths.find(
        (el) => el.getAttribute("title") == targetSpan.innerHTML
      );
      const colour = "#63d463"; //light-green
      correctAns.style.fill = colour;
    } else {
      attempts.innerHTML = currAttempt + 1;
      const colour = "#d4800b"; //orange
      e.target.style.fill = colour;
    }
  }
}

const startButton = document.querySelector("#startButton");
startButton.addEventListener("click", (e) => {
  startButton.disabled = true;
  nextCountry(e);
});

function nextCountry(e) {
  attempts.innerHTML = 1;
  const randIndex = Math.floor(Math.random() * allPaths.length);
  const randCountry = allPaths[randIndex];
  targetSpan.innerHTML = randCountry.getAttribute("title");
  allPaths.forEach((elem) => (elem.style.fill = "#CCCCCC"));
}
<button id="startButton">Start Game</button>

Please click on ___; attempt 1 of 3

<svg id="world" width="800px" height="500px" viewport="0 0 1000 1000" xmlns="http://www.w3.org/2000/svg" xmlns:amcharts="http://amcharts.com/ammap" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
  <defs>

    <amcharts:ammap projection="mercator" leftLongitude="-169.6" topLatitude="83.68" rightLongitude="190.25" bottomLatitude="-55.55" />

  </defs>
  <g style="transform: scale(0.7)">
    <path id="AF" title="Afghanistan" class="land" d="M646.879,356.901L649.738,358.201L651.853,357.745L652.438,356.188L654.651,355.669L656.231,354.617L656.791,351.832L659.154,351.154L659.594,349.902L660.917,350.843L661.762,350.952L663.323,350.975L665.438,351.716L666.295,352.143L668.324,351.017L669.27,351.694L670.174,350.085L671.85,350.159L672.281,349.641L672.578,348.213L673.785,346.975L675.303,347.785L674.998,348.869L675.846,349.038L675.585,351.994L676.694,353.137L677.672,352.404L678.916,352.057L680.663,350.486L682.594,350.745L685.486,350.751L685.985,351.758L684.353,352.15L682.928,352.795L679.71,353.2L676.699,353.931L675.063,355.439L675.725,356.899L676.046,358.603L674.649,360.033L674.766,361.335L673.995,362.549L671.328,362.444L672.43,364.663L670.646,365.507L669.455,367.511L669.609,369.491L668.514,370.415L667.477,370.109L665.334,370.537L665.027,371.451L662.939,371.446L661.377,373.289L661.278,376.039L657.635,377.374L655.682,377.092L655.114,377.794L653.438,377.386L650.634,377.865L645.936,376.228L648.479,373.298L648.249,371.202L646.125,370.65L645.905,368.565L644.987,365.921L646.187,364.094L644.966,363.599L645.736,361.148z" />
    <path id="AR" title="Argentina" class="land" d="M291.601,648.907l-2.664,0.245l-1.43,-1.726l-1.689,-0.13l-3.002,-0.003l-0.002,-10.568l1.077,2.148l1.402,3.525l3.645,2.865l3.925,1.207L291.601,648.907zM293.101,526.469l1.648,2.178l1.094,-2.426l3.197,0.125l0.453,0.644l5.155,4.945l2.292,0.464l3.426,2.262l2.888,1.202l0.402,1.362l-2.76,4.731l2.827,0.854l3.149,0.479l2.217,-0.505l2.543,-2.398l0.458,-2.743l1.389,-0.593l1.407,1.789l-0.057,2.489l-2.361,1.729l-1.883,1.282l-3.165,3.078l-3.741,4.372l-0.701,2.594l-0.75,3.365l0.028,3.297l-0.608,0.742l-0.217,2.165l-0.192,1.761l3.56,2.914l-0.383,2.368l1.752,1.507l-0.143,1.7l-2.694,4.516l-4.157,1.913l-5.624,0.746l-3.08,-0.361l0.589,2.147l-0.574,2.721l0.518,1.851l-1.682,1.299l-2.874,0.512l-2.696,-1.347l-1.083,0.967l0.391,3.71l1.893,1.135l1.535,-1.189l0.835,1.962l-2.582,1.18l-2.251,2.383l-0.412,3.907l-0.663,2.107l-2.648,0.011l-2.198,2.035l-0.804,3.013l2.757,2.982l2.681,0.831l-0.964,3.726l-3.312,2.375l-1.822,5.025l-2.559,1.719l-1.149,2.059l0.905,4.641l1.866,2.633l-1.182,-0.231l-2.599,-0.715l-6.775,-0.608l-1.162,-2.632l0.054,-3.332l-1.867,0.284l-0.988,-1.596l-0.245,-4.599l2.151,-1.878l0.889,-2.68l-0.326,-2.112l1.486,-3.52l1.024,-5.35l-0.301,-2.331l1.224,-0.748l-0.3,-1.478l-1.301,-0.782l0.924,-1.63l-1.266,-1.462l-0.655,-4.395l1.127,-0.767l-0.474,-4.543l0.659,-3.751l0.75,-3.223l1.679,-1.3l-0.853,-3.462l-0.009,-3.217l2.123,-2.263l-0.065,-2.868l1.6,-3.313l0.007,-3.086l-0.728,-0.609l-1.292,-5.694l1.728,-3.343l-0.265,-3.115l1.002,-2.896l1.836,-2.963l1.979,-1.95l-0.839,-1.225l0.585,-1.001l-0.089,-5.143l3.054,-1.509l0.962,-3.159l-0.34,-0.758l2.336,-2.722L293.101,526.469z" />
    <path id="AU" title="Australia" class="land" d="M882.928,588.16l2.709,1.277l1.526,-0.508l2.188,-0.71l1.682,0.248l0.199,4.425l-0.961,1.3l-0.289,3.064l-0.98,-1.047l-1.946,2.675l-0.58,-0.208l-1.725,-0.12l-1.729,-3.276l-0.384,-2.496l-1.617,-3.254l0.071,-1.695L882.928,588.16zM877.779,502.097l1.01,2.254l1.799,-1.084l0.929,1.218l1.346,1.125l-0.288,1.28l0.598,2.484l0.426,1.452l0.706,0.355l0.761,2.495l-0.271,1.52l0.908,1.995l3.038,1.542l1.98,1.407l1.881,1.292l-0.367,0.721l1.604,1.872l1.09,3.249l1.119,-0.662l1.137,1.306l0.686,-0.464l0.483,3.208l1.989,1.871l1.302,1.167l2.191,2.488l0.788,2.487l0.072,1.774l-0.193,1.937l1.336,2.676l-0.16,2.811l-0.485,1.48l-0.757,2.871l0.057,1.859l-0.555,2.34l-1.238,2.996l-2.077,1.631l-1.023,2.59l-0.936,1.666l-0.831,2.932l-1.082,1.707l-0.709,2.583l-0.362,2.401l0.144,1.109l-1.607,1.224l-3.139,0.128l-2.588,1.454l-1.288,1.38l-1.694,1.539l-2.322,-1.584l-1.718,-0.629l0.436,-1.851l-1.533,0.67l-2.455,2.582l-2.424,-0.97l-1.59,-0.564l-1.604,-0.254l-2.714,-1.027l-1.813,-2.175l-0.521,-2.655l-0.651,-1.752l-1.378,-1.398l-2.697,-0.414l0.922,-1.661l-0.679,-2.522l-1.369,2.351l-2.495,0.627l1.467,-1.885l0.425,-1.953l1.083,-1.646l-0.225,-2.472l-2.28,2.849l-1.752,1.15l-1.074,2.693l-2.189,-1.396l0.087,-1.791l-1.754,-2.43l-1.479,-1.247l0.527,-0.766l-3.598,-2.001l-1.971,-0.094l-2.696,-1.597l-5.021,0.31l-3.631,1.175l-3.19,1.1l-2.676,-0.219l-2.972,1.696l-2.432,0.766l-0.54,1.75l-1.035,1.363l-2.38,0.082l-1.761,0.299l-2.478,-0.613l-2.017,0.367l-1.925,0.154l-1.668,1.801l-0.817,-0.153l-1.406,0.959l-1.348,1.082l-2.046,-0.134l-1.879,-0.001l-2.975,-2.168l-1.507,-0.642l0.061,-1.927l1.393,-0.456l0.476,-0.761l-0.1,-1.196l0.343,-2.302l-0.313,-1.948l-1.482,-3.294l-0.46,-1.845l0.121,-1.83l-1.116,-2.079l-0.071,-0.934l-1.242,-1.262l-0.35,-2.468l-1.603,-2.477l-0.388,-1.327l1.231,1.346l-0.946,-2.881l1.391,0.898l0.83,1.203l-0.047,-1.59l-1.388,-2.43l-0.269,-0.968l-0.65,-0.917l0.305,-1.767l0.574,-0.75l0.383,-1.519l-0.3,-1.768l1.159,-2.165l0.211,2.292l1.185,-2.071l2.278,-1.002l1.366,-1.276l2.143,-1.095l1.274,-0.232l0.772,0.367l2.209,-1.109l1.701,-0.33l0.425,-0.65l0.742,-0.271l1.55,0.07l2.947,-0.867l1.524,-1.313l0.716,-1.575l1.645,-1.491l0.126,-1.169l0.073,-1.589l1.962,-2.474l1.181,2.514l1.193,-0.582l-0.998,-1.375l0.88,-1.409l1.237,0.629l0.34,-2.205l1.532,-1.421l0.676,-1.138l1.41,-0.491l0.044,-0.804l1.232,0.335l0.049,-0.722l1.233,-0.412l1.355,-0.387l2.071,1.318l1.556,1.705l1.755,0.02l1.783,0.271l-0.594,-1.582l1.343,-2.303l1.264,-0.749l-0.437,-0.715l1.218,-1.632l1.698,-1.006l1.435,0.339l2.355,-0.537l-0.051,-1.455l-2.054,-0.936l1.493,-0.413l1.857,0.704l1.489,1.167l2.361,0.729l0.801,-0.288l1.738,0.875l1.638,-0.815l1.054,0.248l0.656,-0.547l1.287,1.41l-0.747,1.528l-1.064,1.155l-0.964,0.096l0.325,1.146l-0.824,1.435l-0.996,1.414l0.201,0.814l2.229,1.596l2.16,0.928l1.443,0.999l2.027,1.722l0.79,-0.003l1.468,0.746l0.426,0.901l2.677,0.992l1.852,-0.999l0.549,-1.566l0.568,-1.289l0.349,-1.59l0.853,-2.3l-0.39,-1.394l0.202,-0.837l-0.324,-1.643l0.367,-2.157l0.538,-0.581l-0.437,-0.953l0.678,-1.511l0.532,-1.563l0.07,-0.81l1.042,-1.063l0.791,1.388l0.194,1.783l0.699,0.344l0.119,1.197l1.02,1.452l0.21,1.62L877.779,502.097z" />
    <path id="BR" title="Brazil" class="land" d="M313.681,551.79L317.421,547.418L320.586,544.34L322.469,543.058L324.83,541.33L324.887,538.84L323.48,537.052L322.092,537.645L322.642,535.862L323.022,534.045L323.023,532.363L322.015,531.81L320.963,532.303L319.917,532.167L319.59,530.995L319.329,528.217L318.804,527.315L316.91,526.5L315.766,527.09L312.806,526.512L312.992,522.447L312.163,520.793L313.04,520.18L312.77,518.493L313.538,517.2L314.036,514.884L313.374,513.063L311.842,512.244L311.542,511.093L311.953,509.414L306.578,509.294L305.5,505.924L306.317,505.876L306.281,504.633L305.734,503.793L305.611,502.132L303.982,501.282L302.218,501.311L301.058,500.479L299.163,499.912L298.059,498.845L294.919,498.374L291.875,495.822L292.1,493.918L291.755,492.828L292.054,490.708L288.385,491.186L286.908,492.249L284.456,493.397L283.831,494.255L282.387,494.317L280.302,494.077L278.72,494.565L277.445,494.239L277.632,489.939L275.332,491.605L272.857,491.532L271.797,490.024L269.936,489.86L270.529,488.648L268.971,486.934L267.804,484.401L268.543,483.887L268.541,482.702L270.235,481.892L269.956,480.376L270.671,479.402L270.875,478.096L274.081,476.194L276.379,475.656L276.755,475.236L279.282,475.367L280.542,467.72L280.608,466.512L280.169,464.917L278.925,463.901L278.939,461.877L280.519,461.418L281.079,461.707L281.174,460.64L279.531,460.352L279.497,458.608L284.959,458.671L285.887,457.71L286.666,458.594L287.212,460.237L287.742,459.894L289.285,461.367L291.465,461.187L292.008,460.334L294.093,459.684L295.248,459.227L295.573,458.047L297.576,457.254L297.425,456.668L295.049,456.429L294.66,454.672L294.773,452.802L293.518,452.078L294.044,451.821L296.12,452.178L298.349,452.876L299.158,452.216L301.175,451.783L304.311,450.737L305.336,449.671L304.965,448.882L306.423,448.758L307.075,449.402L306.71,450.63L307.674,451.053L308.317,452.351L307.54,453.334L307.093,455.708L307.811,457.118L308.014,458.408L309.739,459.715L311.115,459.853L311.425,459.308L312.312,459.187L313.58,458.698L314.492,457.957L316.042,458.194L316.725,458.094L318.25,458.322L318.502,457.752L318.032,457.198L318.312,456.391L319.443,456.639L320.768,456.354L322.374,456.945L323.598,457.52L324.466,456.764L325.093,456.88L325.476,457.665L326.818,457.466L327.893,456.407L328.753,454.354L330.412,451.799L331.367,451.667L332.061,453.211L333.633,458.088L335.133,458.548L335.208,460.471L333.1,462.764L333.972,463.604L338.928,464.041L339.029,466.833L341.159,465.005L344.687,466.006L349.344,467.708L350.712,469.34L350.253,470.883L353.513,470.024L358.97,471.499L363.159,471.39L367.304,473.699L370.884,476.828L373.044,477.634L375.442,477.747L376.458,478.629L377.41,482.195L377.875,483.894L376.759,488.546L375.332,490.389L371.38,494.329L369.594,497.544L367.518,500.019L366.817,500.075L366.034,502.183L366.233,507.581L365.451,512.059L365.153,513.986L364.267,515.143L363.77,519.082L360.927,522.96L360.45,526.053L358.181,527.357L357.524,529.168L354.478,529.161L350.067,530.326L348.092,531.679L344.952,532.57L341.652,535.01L339.279,538.071L338.871,540.393L339.337,542.12L338.813,545.302L338.177,546.85L336.217,548.604L333.106,554.28L330.641,556.873L328.734,558.412L327.456,561.566L325.601,563.48L324.825,561.585L326.061,560.007L324.439,557.759L322.24,555.944L319.354,553.855L318.313,553.95L315.5,551.446z" />
    <path id="CA" title="Canada" class="land" d="M198.925,96.233l-0.222,-5.902l3.63,0.579l1.634,0.955l3.351,4.925l-0.76,4.97l-4.148,2.771l-2.284,-3.123L198.925,96.233zM212.14,108.876l0.334,-1.49l-1.968,-2.448l-5.646,-0.194l0.748,3.676l5.254,0.827L212.14,108.876zM248.488,155.832l3.085,5.103l0.812,0.574l3.069,-1.275l3.021,0.201l2.98,0.276l-0.248,-2.643l-4.835,-5.381l-6.417,-1.077l-1.349,0.666L248.488,155.832zM183.063,93.132l-2.708,4.188l6.242,0.516l4.615,4.438l4.579,1.498l-1.092,-5.68l-2.145,-6.726l-7.582,-5.353l-5.504,-2.044l0.204,5.687L183.063,93.132zM208.96,82.895l5.127,-0.116l-2.216,4.002l-0.043,5.297l3.013,5.756l5.811,1.766l4.96,-0.99l5.181,-10.729l3.85,-4.447l-3.38,-4.97l-2.215,-10.648l-4.599,-3.188l-4.718,-3.682l-3.581,-9.561l-6.521,0.937l1.225,4.149l-2.874,1.246l-1.943,5.322l-1.944,7.458l1.776,7.261L208.96,82.895zM145.21,136.272l3.92,1.953l12.667,-1.298l-5.824,4.771l0.357,3.431l4.264,-0.236l7.074,-4.58l9.495,-1.673l1.706,-5.218l-0.493,-5.569l-2.938,-0.502l-2.497,1.929l-1.099,-4.133l-0.945,-5.699l-2.895,-1.415l-2.569,4.411l4.01,11.049l-4.898,-0.851l-4.981,-6.788l-7.891,-3.998l-2.639,3.321L145.21,136.272zM167.773,94.206l-3.646,-2.897l-1.504,-0.659l-2.876,4.284l-0.045,2.002l4.656,0.014L167.773,94.206zM166.305,106.564l0.932,-3.985l-3.954,-2.125l-4.094,1.385l-2.271,4.261l4.159,4.207L166.305,106.564zM195.404,139.803l4.623,-1.106l1.277,-8.252l-0.087,-5.945l-2.144,-5.56l-0.216,1.596l-3.943,-0.699l-4.223,4.087l-3.017,-0.37l0.178,8.924l4.596,-0.868l-0.058,6.465L195.404,139.803zM192.118,185.406l-5.06,-3.927l-4.709,-4.208l-0.869,-6.18l-1.76,-8.925l-3.141,-3.839l-2.787,-1.547l-2.467,1.417l1.992,9.586l-1.409,3.731l-2.294,-8.979l-2.562,-3.105l-3.168,4.814l-3.899,-4.76l-6.239,2.868l1.399,-4.463l-2.865,-1.875l-7.507,5.838l-1.952,3.711l-2.354,6.771l4.896,2.317l4.325,-0.122l-6.503,3.461l1.479,3.129l3.976,0.169l5.991,-0.669l5.422,1.959l-3.66,1.445l-3.953,-0.372l-4.328,1.409l-1.865,0.874l3.455,6.354l2.489,-0.883l3.828,2.145l1.519,3.651l4.988,-0.725l7.105,-1.157l5.264,-2.646l3.26,-0.479l4.823,2.115l5.074,1.219l0.945,-2.859l-1.789,-3.049l4.604,-0.645L192.118,185.406zM199.863,184.425l-1.96,3.539l-2.468,2.486l3.829,3.541l2.284,-0.854l3.779,2.358l1.743,-2.732l-1.709,-3.03l-0.841,-1.526l-1.682,-1.458L199.863,184.425zM182.25,154.982l-2.131,-2.175l-3.757,0.397l-0.953,1.384l4.374,6.752L182.25,154.982zM210.937,168.154l3.008,-6.927l3.343,-1.848l4.189,-8.743l-5.356,-2.47l-5.842,-0.357l-2.782,2.77l-1.465,4.231l-0.043,4.817l1.75,8.188L210.937,168.154zM228.092,145.149l5.756,-0.185l8.043,-1.614l3.589,1.275l4.181,-2.26l1.749,-2.84l-0.626,-4.519l-3.003,-4.229l-4.556,-0.801l-5.709,0.969l-4.457,2.441l-4.091,-0.939l-3.782,-0.495l-1.781,-2.702l-3.217,-2.614l0.639,-4.433l-2.42,-3.982l-5.52,0.027l-3.113,-3.988l-5.779,-0.799l-1.055,5.096l3.25,3.745l5.8,1.454l2.815,5.095l0.341,5.602l0.97,5.99l7.452,3.417L228.092,145.149zM139.073,126.88l5.212,-5.053l2.62,-0.587l2.16,-4.228l0.385,-9.769l-3.846,1.914l-4.3,-0.18l-5.758,8.189l-4.759,8.977l3.799,2.51L139.073,126.88zM211.251,143.053l1.525,-4.14l-1.023,-3.458l-2.448,-3.918l-4.031,3.018l-1.493,4.924l3.399,2.787L211.251,143.053zM202.943,154.49l-0.729,-2.881l-5.002,1.264l-3.344,-2.107l-3.318,4.804l3.089,6.282l-5.725,-1.174l-0.056,3.011l6.968,7.046l1.94,3.38l2.701,0.731l4.598,-3.413l0.504,-8.211l-4.244,-4.074L202.943,154.49zM128.949,308.228l-1.157,-2.344l-2.799,-1.769l-1.386,-2.053l-0.954,-1.505l-2.635,-0.464l-1.721,-0.667l-2.943,-0.962l-0.242,1.021l1.08,2.38l2.886,0.781l0.505,1.231l2.509,1.502l0.841,1.513l4.604,1.92L128.949,308.228zM250.655,230.599l-2.002,-2.109l-2.063,0.498l-0.249,-3.062l-3.212,-2.035l-3.07,-2.267l-1.63,-1.753l-1.435,1.034l-0.521,-2.963l-2.026,-0.555l-0.956,6.134l-0.358,5.107l-2.438,3.136l3.8,-0.604l0.963,3.65l3.99,-3.225l2.78,-3.379l1.575,2.863l4.363,1.511L250.655,230.599zM130.121,178.055l7.38,-4.179v-3.874l3.477,-6.407l6.875,-6.689l3.525,-2.467l-3.01,-4.199l-2.723,-2.953l-7.162,-0.572l-4.004,-2.156l-9.477,1.625l2.742,6.225l-2.432,6.431l-1.942,6.866l-1.203,3.858l6.474,4.694L130.121,178.055zM264.358,205.358l0.316,-1.009l-0.031,-3.175l-2.189,-2.084l-2.57,1.047l-1.191,4.167l0.7,3.559l3.143,-0.361L264.358,205.358zM288.177,212.904l4.408,6.601l3.45,2.855l4.921,-7.87l0.873,-4.933l-4.41,-0.474l-4.03,-6.696l-4.451,-1.64l-6.604,-4.968l5.148,-3.634l-2.652,-7.542l-2.442,-3.354l-6.769,-3.352l-2.922,-5.549l-5.207,1.991l-0.363,-3.863l-3.862,-4.322l-6.221,-4.714l-2.652,3.714l-5.547,2.662l0.417,-6.064l-4.81,-10.052l-7.106,4.063l-2.591,7.701l-2.209,-5.923l2.063,-6.371l-7.24,2.651l-2.883,3.991l-2.155,8.421l0.889,9.051l3.983,0.038l-2.932,3.924l2.332,2.961l4.547,1.255l5.931,2.417l10.204,1.818l5.083,-1.044l1.501,-2.42l2.211,2.788l2.471,0.462l2.968,4.965l-1.796,1.98l5.68,2.626l4.295,3.678l1.081,2.55l0.771,3.239l-3.627,6.925l-0.979,3.443l0.937,2.423l-5.772,0.859l-5.269,0.119l-1.847,4.869l2.372,2.226l8.107,-1.031l-0.045,-1.889l4.083,3.148l4.183,3.276l-0.979,1.773l3.398,3.021l6.017,3.535l7.604,2.391l-0.456,-2.089l-2.92,-3.672l-3.963,-5.373l7.033,4.997l3.536,1.66l0.966,-4.438l-1.825,-6.298l-1.155,-1.729l-3.806,-3.035l-2.949,-3.911l0.354,-3.942L288.177,212.904zM222.346,51.338l2.336,7.293l4.957,5.88l9.811,-1.088l6.313,1.968l-4.375,6.053l-2.214,-1.776l-7.664,-0.712l1.19,8.314l3.96,6.036l-0.795,5.201l-4.972,3.462l-2.271,5.471l4.548,2.646l3.823,8.549l-7.497,-5.703l-1.71,0.941l1.381,9.377l-5.184,2.833l0.352,5.851l5.301,0.626l4.173,1.438l8.236,-1.845l7.327,3.269l7.492,-7.191l-0.061,-3.019l-4.791,0.482l-0.392,-2.841l3.917,-3.829l1.33,-5.151l4.332,-3.829l2.664,-4.762l-2.319,-7.103l1.938,-2.649l-3.865,-1.887l8.489,-1.628l1.787,-3.147l5.784,-2.604l4.795,-13.473l4.569,-4.943l6.616,-11.124l-6.104,0.098l2.535,-4.303l6.784,-3.993l6.841,-8.903l0.123,-5.731l-5.131,-6.042l-6.021,-2.93l-7.494,-1.819l-6.072,-1.489l-6.073,-1.503l-8.095,3.977l-1.49,-2.527l-8.57,0.976l-5.028,2.571l-3.701,3.65L242.028,30.5L239,24.517l-3.477,-1.142l-4.122,7.97l-5.501,3.348l-3.274,0.664l-4.169,3.837l0.614,6.646L222.346,51.338zM296.747,316.344l-0.982,-1.984l-1.059,1.262l0.701,1.361l3.556,1.713l1.039,-0.262l1.379,-1.656l-2.6,0.111L296.747,316.344zM239.747,238.477l0.614,1.63l1.979,0.138l3.282,-3.337l0.06,-1.188l-3.851,-0.059L239.747,238.477zM301.875,304.917l-2.867,-1.799l-3.687,-1.087l-0.97,0.365l2.607,2.039l3.634,1.343l1.365,-0.076L301.875,304.917zM326.765,309.712l-0.357,-2.235l-1.962,0.723l0.868,-3.113l-2.796,-1.321l-1.293,1.047l-2.488,-1.179l0.984,-1.509l-1.883,-0.933l-1.83,1.469l1.855,-3.825l1.497,-2.8l0.542,-1.217l-1.301,-0.197l-2.433,1.547l-1.738,2.529l-2.897,6.917l-2.354,2.558l1.22,1.144l-1.747,1.473l0.43,1.231l5.442,0.126l3.013,-0.248l2.69,1.005l-1.98,1.932l1.673,0.142l3.253,-3.576l0.781,0.528l-0.608,3.367l1.843,0.77l1.269,-0.151l1.18,-3.614L326.765,309.712zM305.569,314.475l-2.811,4.56l-4.633,0.581l-3.642,-2.009l-0.915,-3.07l-0.889,-4.462l2.648,-2.829l-2.482,-2.089l-4.195,0.426l-5.881,3.53l-4.501,5.452l-2.381,0.672l3.227,-3.804l4.044,-5.574l3.575,-1.899l2.348,-3.112l2.904,-0.303l4.208,0.031l5.997,0.919l4.74,-0.708l3.528,-3.624l4.621,-1.587l2.012,-1.58l2.035,-1.706l-0.205,-5.188l-1.126,-1.772l-2.184,-0.628l-1.111,-4.047l-1.8,-1.548l-4.471,-1.264l-2.521,-2.822l-3.729,-2.826l1.127,-3.197l-3.101,-6.26l-3.651,-6.893l-2.184,-4.983l-1.855,2.611l-2.682,6.053l-4.06,2.973l-2.032,-3.155l-2.561,-0.847l-0.932,-6.99l0.084,-4.797l-5,-0.438l-0.851,-2.266l-3.453,-3.436l-2.611,-2.039l-2.322,1.583l-2.883,-0.585l-4.807,-1.646l-1.952,1.397l0.937,9.177l1.222,5.116l-3.309,5.751l3.406,4.022l1.904,4.44l0.229,3.422l-1.554,3.504l-3.177,3.461l-4.489,2.281l1.978,2.529l1.464,7.402l-1.517,4.676l-2.159,1.458l-4.172,-4.283l-2.031,-5.168l-0.872,-4.759l0.458,-4.194l-3.05,-0.474l-4.63,-0.283l-2.971,-2.082l-3.513,-1.373l-2.006,-2.379l-2.803,-1.935l-5.21,-2.229l-3.923,1.02l-1.311,-3.947l-1.263,-4.99l-4.12,-0.902l0.155,-6.411l1.087,-4.483l3.041,-6.6l3.431,-4.902l3.262,-0.769l0.186,-4.048l2.213,-2.682l4.014,-0.424l3.252,-4.392l0.818,-2.897l2.703,-5.725l0.836,-3.5l2.899,2.107l3.899,-1.076l5.49,-4.964l0.357,-3.539l-1.977,-3.98l2.086,-4.057l-0.169,-3.865l-3.763,-3.953l-4.145,-1.19l-3.985,-0.624l-0.153,8.714l-2.045,6.555l-2.928,5.304l-2.712,-4.946l0.835,-5.606l-3.352,-5.018l-3.747,6.09l0.012,-7.991l-5.214,-1.626l2.488,-4.014l-3.809,-9.586L212,170.539l-3.698,-1.442l-3.315,6.428l-0.225,9.343l3.272,3.292l3.004,4.906l-1.268,7.708l-2.255,-0.202l-1.785,5.884l0.017,-7.004l-4.345,-2.583l-2.493,1.335l0.324,4.672l-4.09,-0.178l-4.353,1.173l-4.954,-3.353l-3.131,0.598l-2.818,-4.114l-2.263,-1.84l-2.243,0.773l-3.413,0.355l-1.811,2.614l2.862,3.187l-3.05,3.725l-2.989,-4.423l-2.388,1.302l-7.568,0.873l-5.068,-1.589l3.945,-3.736l-3.782,-3.902l-2.747,0.5l-3.859,-1.323l-6.562,-2.891l-4.288,-3.373l-3.396,-0.469l-1.059,2.357l-3.445,1.311l-0.379,-6.15l-3.733,5.505l-4.741,-7.321l-1.938,-0.892l-0.626,3.905l-2.092,1.904l-1.926,-3.393l-4.589,2.048l-4.2,3.551l-4.165,-0.98l-3.396,2.495l-2.461,3.276l-2.924,-0.717l-4.414,-3.8l-5.23,-1.936l-0.019,27.648l-0.015,35.43l2.761,0.167l2.731,1.556l1.958,2.436l2.491,3.596l2.728,-3.054l2.815,-1.793l1.488,2.855l1.889,2.229l2.567,2.424l1.753,3.794l2.867,5.881l4.767,3.204l0.078,3.124l-1.559,2.355l0.059,2.484l3.392,3.449l0.492,3.761l3.587,1.958l-0.399,2.79l1.562,3.958l5.078,1.825l2.003,1.887l5.428,4.227l0.376,0.011h7.963h8.324h2.756h8.546h8.271h8.412l8.417,0l9.528,0l9.593,-0.003l5.803,0.003l0.008,-1.644l0.949,-0.021l0.498,2.345l0.872,0.718l1.958,0.26l2.863,0.672l2.72,1.303l2.271,-0.545l3.449,1.089l1.138,-1.659l1.591,-0.663l0.623,-1.032l0.632,-0.554l2.607,0.856l1.932,0.102l0.67,0.566l0.938,2.382l3.147,0.627l-0.495,1.182l1.109,1.212l-0.478,1.56l1.177,0.513l-0.587,1.372l0.752,0.125l0.527,-0.597l0.55,0.898l2.103,0.501l2.132,0.042l2.273,0.412l2.508,0.779l0.915,1.256l1.816,3.037l-0.903,1.299l-2.279,-0.54l-1.415,-2.441l0.355,2.486l-1.337,2.17l0.147,1.838l-0.231,1.074l-1.815,1.267l-1.318,2.091l-0.617,1.321l1.539,0.237l2.081,-1.201l1.225,-1.059l0.833,-0.173l1.542,0.382l0.746,-0.591l1.368,-0.481l2.443,-0.469v0.002l0,-0.002l-0.249,-1.15l-0.134,0.044l-0.856,0.198l-1.118,-0.363l0.839,-1.317l0.855,-0.457l1.979,-0.565l2.37,-0.528l1.244,0.734l0.782,-0.851l0.889,-0.54l0.596,0.286l0.032,0.061l2.87,-2.73l1.265,-0.726l4.26,-0.027l5.167,-0.003l0.281,-0.978l0.897,-0.2l1.191,-0.616l0.995,-1.82l0.855,-3.148l2.139,-3.097l0.932,1.083l1.88,-0.7l1.245,1.187l-0.002,5.525l1.833,2.251l3.116,-0.483l4.488,-0.13l-4.868,3.261l0.107,3.291l2.129,0.283l3.133,-2.793l2.781,-1.584l6.21,-2.351l3.469,-2.616l-1.811,-1.46L305.569,314.475zM251.905,243.372l1.098,-3.124l-0.713,-1.233l-1.148,-0.132l-1.082,1.804l-0.131,0.413l0.736,1.771L251.905,243.372zM109.249,279.8L109.249,279.8l1.559,-2.354L109.249,279.8z" />
    <path id="CN" title="China" class="land" d="M784.628,410.405l-2.423,1.412l-2.299,-0.91l-0.081,-2.535l1.382,-1.341l3.063,-0.831l1.612,0.071l0.627,1.131l-1.232,1.301L784.628,410.405zM833.186,302.885l4.88,1.379l3.321,3.035l1.135,3.945l4.261,0.005l2.431,-1.647l4.634,-1.239l-1.474,3.761l-1.089,1.512l-0.961,4.462l-1.886,3.888l-3.402,-0.703l-2.407,1.4l0.739,3.357l-0.404,4.553l-1.432,0.103l0.017,1.929l-1.811,-2.244l-1.114,2.13l-4.33,1.625l0.438,1.975l-2.424,-0.136l-1.331,-1.172l-1.927,2.644l-3.09,1.984l-2.283,2.347l-3.92,1.057l-2.064,1.689l-3.02,0.981l1.49,-1.668l-0.587,-1.411l2.221,-2.454l-1.481,-1.93l-2.444,1.302l-3.165,2.544l-1.728,2.34l-2.75,0.173l-1.431,1.676l1.479,2.409l2.294,0.582l0.095,1.583l2.218,1.025l3.143,-2.513l2.489,1.374l1.813,0.093l0.455,1.836l-3.97,0.974l-1.311,1.872l-2.727,1.728l-1.439,2.393l3.019,1.864l1.102,3.307l1.706,3.046l1.904,2.529l-0.046,2.426l-1.76,0.887l0.671,1.725l1.65,1l-0.431,2.609l-0.712,2.518l-1.567,0.284l-2.047,3.407l-2.271,4.086l-2.604,3.676l-3.855,2.818l-3.9,2.553l-3.159,0.347l-1.714,1.34l-0.97,-0.979l-1.586,1.498l-3.919,1.504l-2.967,0.459l-0.957,3.151l-1.554,0.174l-0.735,-2.162l0.664,-1.157l-3.762,-0.959l-1.325,0.488l-2.823,-0.778l-1.335,-1.222l0.443,-1.738l-2.563,-0.553l-1.352,-1.138l-2.39,1.615l-2.726,0.349l-2.236,-0.016l-1.505,0.737l-1.453,0.442l0.424,3.433l-1.495,-0.082l-0.252,-0.703l-0.085,-1.24l-2.057,0.874l-1.214,-0.552l-2.082,-1.128l0.816,-2.507l-1.775,-0.587l-0.669,-2.801l-2.96,0.506l0.337,-3.635l2.655,-2.58l0.113,-2.566l-0.083,-2.398l-1.224,-0.75l-0.937,-1.86l-1.641,0.235l-3.023,-0.474l0.947,-1.334l-1.314,-1.986l-1.999,1.346l-2.352,-0.785l-3.232,2.03l-2.552,2.355l-2.262,0.395l-1.228,-0.849l-1.48,-0.077l-2.004,-0.732l-1.515,0.803l-1.854,2.341l-0.235,-2.481l-1.71,0.665l-3.27,-0.309l-3.172,-0.725l-2.275,-1.393l-2.179,-0.627l-0.941,-1.533l-1.575,-0.459l-2.831,-2.094l-2.248,-0.993l-1.162,0.773l-3.896,-2.265l-2.755,-2.065l-0.786,-3.629l2.012,0.445l0.375,-0.092l0.541,-0.458l0.125,-0.417l-0.521,-0.625l-0.042,-1.167l-0.729,-0.063l-0.5,-0.417l-0.063,-0.729l0.438,-0.021l-0.354,-1.167l0.188,-0.208l1.083,0.063l1.813,-2.583l0.646,-2.333l-1.063,-0.875l-1.771,-0.542l-1.583,0.313l-2.336,1.187l-3.206,-1.041l-0.333,-0.979l-1.458,-0.604l-0.444,-1.427l-2.071,-1.627l-0.499,-1.007l-0.421,-2.012l0.098,-1.381l-1.703,-0.812l-0.921,0.359l-0.711,-3.324l0.798,-0.829l-0.387,-0.85l2.677,-1.726l1.938,-0.718l2.968,0.492l1.061,-2.354l3.597,-0.44l0.999,-1.478l4.419,-2.031l0.394,-0.853l-0.224,-2.165l1.924,-0.995l-2.524,-6.754l5.555,-1.582l1.436,-0.886l2.022,-7.262l5.563,1.353l1.56,-1.86l0.134,-4.186l2.329,-0.395l2.134,-2.831l1.098,-0.352l0.736,2.97l2.356,2.23l3.999,1.565l1.935,3.319l-1.079,4.728l1.009,1.729l3.332,0.678l3.776,0.552l3.388,2.448l1.732,0.433l1.277,3.568l1.646,2.269l3.091,-0.088l5.787,0.852l3.729,-0.528l2.768,0.565l4.148,2.291l3.393,-0.003l1.241,1.164l3.265,-2.014l4.529,-1.312l4.202,-0.144l3.276,-1.337l2.012,-2.051l1.963,-1.297l-0.454,-1.28l-0.896,-1.499l1.473,-2.538l1.577,0.358l2.882,0.8l2.794,-2.101l4.275,-1.546l2.055,-2.662l1.974,-1.156l4.072,-0.541l2.213,0.459l0.307,-1.453l-2.541,-2.887l-2.25,-1.333l-2.155,1.538l-2.766,-0.647l-1.587,0.528l-0.723,-1.706l1.981,-4.228l1.365,-3.247l3.365,1.632l3.952,-2.739l-0.026,-1.929l2.531,-4.725l1.56,-1.45l-0.035,-2.522l-1.538,-1.095l2.315,-2.313l3.484,-0.845l3.718,-0.127l4.196,1.394l2.462,1.711l1.733,4.611l1.051,1.937l0.977,2.731L833.186,302.885z" />
    <path id="CO" title="Colombia" class="land" d="M263.917,463.809L262.717,463.149L261.341,462.227L260.544,462.669L258.165,462.283L257.481,461.085L256.959,461.129L254.154,459.539L253.774,458.674L254.82,458.465L254.696,457.069L255.354,456.059L256.745,455.872L257.925,454.12L258.998,452.655L257.965,451.991L258.494,450.37L257.861,447.812L258.462,447.077L258.02,444.707L256.885,443.212L257.244,441.847L258.147,442.048L258.676,441.213L258.025,439.555L258.366,439.143L259.814,439.232L261.918,437.264L263.073,436.963L263.1,436.029L263.617,433.637L265.225,432.321L266.992,432.267L267.215,431.675L269.409,431.912L271.615,430.477L272.708,429.84L274.065,428.467L275.059,428.642L275.794,429.392L275.25,430.351L273.449,430.828L272.737,432.248L271.652,433.062L270.837,434.115L270.494,436.134L269.717,437.786L271.164,437.975L271.523,439.271L272.142,439.89L272.364,441.023L272.031,442.064L272.129,442.65L272.819,442.885L273.487,443.864L277.093,443.594L278.722,443.951L280.695,446.364L281.828,446.064L283.848,446.214L285.446,445.895L286.438,446.376L285.933,447.884L285.307,448.823L285.087,450.828L285.651,452.684L286.448,453.513L286.545,454.138L285.124,455.526L286.141,456.141L286.887,457.115L287.742,459.894L287.212,460.237L286.666,458.594L285.887,457.71L284.959,458.671L279.497,458.608L279.531,460.352L281.174,460.64L281.079,461.707L280.519,461.418L278.939,461.877L278.925,463.901L280.169,464.917L280.608,466.512L280.542,467.72L279.282,475.367L277.878,473.883L277.041,473.817L278.85,470.978L276.703,469.672L275.02,469.912L274.007,469.43L272.462,470.167L270.375,469.817L268.723,466.896L267.425,466.178L266.53,464.864L264.665,463.544z" />

    <path id="CZ" title="Czechia" class="land" d="M522.807,307.861L521.515,307.061L520.198,307.281L518.021,305.983L517.034,306.302L515.457,308.037L513.374,306.673L511.791,304.837L510.36,303.804L510.063,301.979L509.572,300.683L511.61,299.729L512.651,298.631L514.665,297.773L515.368,296.927L516.107,297.438L517.358,296.974L518.688,298.403L520.784,298.788L520.609,299.999L522.132,300.904L522.55,299.773L524.474,300.264L524.739,301.631L526.824,301.895L528.114,304.025L527.278,304.03L526.844,304.804L526.2,304.99L526.017,305.963L525.48,306.165L525.404,306.561L524.447,307L523.205,306.929z" />
    <path id="DE" title="Germany" class="land" d="M503.072,278.923L503.122,280.798L505.956,281.92L505.926,283.617L508.776,282.721L510.353,281.407L513.519,283.299L514.842,284.812L515.498,287.205L514.716,288.449L515.734,290.098L516.428,292.547L516.209,294.11L517.358,296.974L516.107,297.438L515.368,296.927L514.665,297.773L512.651,298.631L511.61,299.729L509.572,300.683L510.063,301.979L510.36,303.804L511.791,304.837L513.374,306.673L512.385,308.624L511.378,309.158L511.775,311.878L511.514,312.582L510.64,311.733L509.295,311.606L507.291,312.35L504.818,312.173L504.419,313.264L503,312.116L502.154,312.344L499.149,311.075L498.573,311.978L496.188,311.949L496.544,308.974L497.962,306.074L493.922,305.288L492.599,304.165L492.757,302.27L492.197,301.287L492.515,298.319L492.044,293.629L493.729,293.627L494.439,291.916L495.138,287.691L494.614,286.108L495.162,285.11L497.505,284.853L498.025,285.893L499.929,283.56L499.288,281.767L499.159,279.022L501.278,279.664z" />

  </g>
</svg>


text:
Q: Dependency Injection inside class library for a net core web api project I have a .NET Core WEB API project and I would like to be a container for multiples "projects" as .NET CORE Class Library.
What I have is:

*

*Solution "Orbit" with a .NET Core Web API project on it.

*Solution "SpaceRadar" with a .NET Core Class Library.
First, inside my "Orbit" project, the Startup class, what I have made so far:
  public void ConfigureServices(IServiceCollection services)
    {

        this.ConfigureMVC(services);
        this.ConfigureIOC(services);

    }

    private void ConfigureMVC(IServiceCollection services)
    {
        IMvcBuilder mvcBuilder = services.AddMvc(option => { option.EnableEndpointRouting = false; });
        // for each assembly inside modules directory, add the controllers
        foreach (string assemblyPath in Directory.GetFiles($"{System.AppDomain.CurrentDomain.BaseDirectory}/Modules", "*.dll", SearchOption.AllDirectories))
        {
            var assembly = Assembly.LoadFile(assemblyPath);
            mvcBuilder.AddApplicationPart(assembly);
        }
    }

This part works well, since we can trigger the Controller that is defined inside my SpaceRadar project.
However I wanted to use dependency injection in my class library project, if possible by scanning the dll to get all the types that extends IScopedServices / ISingletonServices / ITransientServices.
But honestly, I have no idea where to register my interface and their respective implementation.
I tried this solution:
private void ConfigureIOC(IServiceCollection services)
    {

        // Store all the type that need to be injected in the IOC system
        List<Type> implementationTypes = new List<Type>();
        List<Type> singletons = new List<Type>();
        List<Type> scopeds = new List<Type>();
        List<Type> transients = new List<Type>();

        // for each assembly, load it, populate the type list of things to be injected
        foreach (string assemblyPath in Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory, "*.dll", SearchOption.AllDirectories))
        {
            var assembly = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath);
            implementationTypes.AddRange(assembly.GetExportedTypes().Where(type => type.IsClass && (type.GetInterface("ISingletonServices") != null || type.GetInterface("IScopedServices") != null || type.GetInterface("ITransientServices") != null)));
            singletons.AddRange(assembly.GetExportedTypes().Where(type => type.IsInterface && type.GetInterface("ISingletonServices") != null));
            scopeds.AddRange(assembly.GetExportedTypes().Where(type => type.IsInterface && type.GetInterface("IScopedServices") != null));
            transients.AddRange(assembly.GetExportedTypes().Where(type => type.IsInterface && type.GetInterface("ITransientServices") != null));
        }

        // Register into the service collection
        foreach (Type type in singletons)
        {
            services.AddSingleton(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
        }
        foreach (Type type in scopeds)
        {
            services.AddScoped(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
        }
        foreach (Type type in transients)
        {
            services.AddTransient(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
        }

}

But it seems that there is a problem of context of the assembly.
I tried also the Assembly.LoadFrom() but isn't working, the ReaderLoadContext solution found on a blog
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using System.Threading.Tasks;

namespace Orbit
{
    public class ReaderLoadContext : AssemblyLoadContext
    {
        private AssemblyDependencyResolver _resolver;

        public ReaderLoadContext(string readerLocation)
        {
            _resolver = new AssemblyDependencyResolver(readerLocation);
        }

        protected override Assembly Load(AssemblyName assemblyName)
        {
            string assemblyPath = _resolver.ResolveAssemblyToPath(assemblyName);
            if (assemblyPath != null)
            {
                return LoadFromAssemblyPath(assemblyPath);
            }

            return null;
        }

        protected override IntPtr LoadUnmanagedDll(string unmanagedDllName)
        {
            string libraryPath = _resolver.ResolveUnmanagedDllToPath(unmanagedDllName);

            if (libraryPath != null)
            {
                return LoadUnmanagedDllFromPath(libraryPath);
            }

            return IntPtr.Zero;
        }
    }
}

And even to call a "setup" method inside the assembly

        private void ConfigureIOC(IServiceCollection services)
        {
            // for each assembly, load it, add the controller into the mvcBuilder and populate the type list of things to be injected
            foreach (string assemblyPath in Directory.GetFiles($"{System.AppDomain.CurrentDomain.BaseDirectory}/Modules", "*.dll", SearchOption.AllDirectories))
            {
                Assembly assembly = Assembly.LoadFrom(assemblyPath);
                Type startup = assembly.GetTypes().SingleOrDefault(t => t.Name == "Startup");
                if (startup != null)
                {
                    var setupMethod = startup.GetMethod("Setup");
                    setupMethod.Invoke(setupMethod, new Object[] { services });
                }
            }
        }

and inside my class library
public static void Setup(IServiceCollection services)
        {

            List<Type> implementationTypes = new List<Type>();
            List<Type> singletons = new List<Type>();
            List<Type> scopeds = new List<Type>();
            List<Type> transients = new List<Type>();

            foreach (string assemblyPath in Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.dll", SearchOption.AllDirectories))
            {
                var assembly = Assembly.Load(assemblyPath);
                // get all Singleton, Scoped and Transient interfaces
                implementationTypes.AddRange(assembly.GetTypes().Where(type => type.IsClass && (type.GetInterface("ISingletonServices") != null || type.GetInterface("IScopedServices") != null || type.GetInterface("ITransientServices") != null)));
                singletons.AddRange(assembly.GetTypes().Where(type => type.IsInterface && type.GetInterface("ISingletonServices") != null));
                scopeds.AddRange(assembly.GetTypes().Where(type => type.IsInterface && type.GetInterface("IScopedServices") != null));
                transients.AddRange(assembly.GetTypes().Where(type => type.IsInterface && type.GetInterface("ITransientServices") != null));
            }

            // Register into the service collection
            foreach (Type type in singletons)
            {
                services.AddSingleton(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
            }
            foreach (Type type in scopeds)
            {
                services.AddScoped(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
            }
            foreach (Type type in transients)
            {
                services.AddTransient(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
            }

        }

I also tried the HostingStartup attribute
[assembly: HostingStartup(typeof(SpaceRadar.ServiceKeyInjection))]
namespace SpaceRadar
{
    public class ServiceKeyInjection : IHostingStartup
    {
        public void Configure(IWebHostBuilder builder)
        {
            builder.ConfigureServices((context, services) => {
                List<Type> implementationTypes = new List<Type>();
                List<Type> singletons = new List<Type>();
                List<Type> scopeds = new List<Type>();
                List<Type> transients = new List<Type>();

                foreach (string assemblyPath in Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.dll", SearchOption.AllDirectories))
                {
                    var assembly = Assembly.Load(assemblyPath);
                    // get all Singleton, Scoped and Transient interfaces
                    implementationTypes.AddRange(assembly.GetTypes().Where(type => type.IsClass && (type.GetInterface("ISingletonServices") != null || type.GetInterface("IScopedServices") != null || type.GetInterface("ITransientServices") != null)));
                    singletons.AddRange(assembly.GetTypes().Where(type => type.IsInterface && type.GetInterface("ISingletonServices") != null));
                    scopeds.AddRange(assembly.GetTypes().Where(type => type.IsInterface && type.GetInterface("IScopedServices") != null));
                    transients.AddRange(assembly.GetTypes().Where(type => type.IsInterface && type.GetInterface("ITransientServices") != null));
                }

                // Register into the service collection
                foreach (Type type in singletons)
                {
                    services.AddSingleton(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
                }
                foreach (Type type in scopeds)
                {
                    services.AddScoped(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
                }
                foreach (Type type in transients)
                {
                    services.AddTransient(type, implementationTypes.Single(t => t.GetInterface(type.FullName) != null));
                }
            });
        }
    }
}

All this solutions doesn't allow me inside my class library to have this kind of controller:
 public class RadarControllers : BaseControllers
    {
        private readonly IRadarServices _radarServices;

        public RadarControllers(IRadarServices radarServices)
        {
            _radarServices = radarServices;
        }

        [HttpGet("radars")]
        public async Task<IActionResult> GetRadars(CancellationToken cancellationToken)
        {
            IList<string> data = await _radarServices.GetRadars(cancellationToken);
            return Ok(data);
        }
    }

How to proceed for this dependency injection ?
Thanks.

A: I finally found a way to deals with that.
The issue is that on each projet, the assembly name is the same (for instance : "Services").
.Net core does not like this and it seems that if I try to load through  AssemblyLoadContext.Default.LoadFromAssemblyPath, it keep loading the same assembly no matter the path to indicate.
On the projet, I just right click > Properties and change the assembly name to an another. Thanks to that,  AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath) works.
For instance, if I have project A and B, I rename the assembly names services with
A.Services
and B.Services
so The dll is now A.Services.dll instead of Services.dll

redpajama_set_name: RedPajamaStackExchange


text:
Q: I have little confusion in inheritance in PHP I have class name Animal which consists of two methods, like...
Class Animal
{

protected function method1(){
    //some code
}

protected function method2(){
    //some code
}

}

Now I want to make two child classes which extends class Animal. One is cat
and another is dog, like
Class Cat extends Animal
{
}

And,
Class Dog extends Animal
{
}

Now, what I want is that, child class Cat can access both the methods defined in class Animal, but class Dog can access method1, not method2. How can I set my access modifiers in class Animal, so that this logic can happen?

A: You can't do that. It would violate the Liskov substitution principle. In OOP the extends keyword can be read as "is special case of".
If you are too lazy to read,here is the short version.
Also, this lecture might be useful.


text:
Q: Is it possible to edit wiki pages with multiple people at the same time? Is it possible to edit wiki pages with multiple people at the same time?
Is there any official page that refer to this question?

A: It's not possible to edit with multiple people.
I tried create user A and B. First A edits like "ABCDE", and also B edits like "12345".
Then A hit the save button and it is okay but after A saves the page, B hit the save button and gitlab shows a following message:
Someone edited the page the same time you did. Please check out the page and make sure your changes will not unintentionally remove theirs.


text:
Q: NullReferenceException on join with Postgres EF Provider I have a postgres database and using asp.net core mvc (+ ef). The database is created correctly. I have two tables 'Module' and 'ModuleMenu'. I want to get all the menu's for a given module but I keep on failing to create the linq query.
Situation
Model: Module.cs
namespace project.Model
{
    public class Module
    {
        [Required]
        public string ID { get; set; }

        [Required]
        public string Name { get; set; }

        [Required]
        public string Description { get; set; }
    }
}

Model: ModuleMenu.cs
namespace project.Models
{
    public class ModuleMenu
    {
        [Required]
        public string ID { get; set; }

        public int ModuleID { get; set; }

        [Required]
        public string Title { get; set; }

        [ForeignKey("ModuleID")]
        public virtual Module Module { get; set; }
    }
}

ApplicationDbContext.cs
namespace project.Data
{
    public class ApplicationDbContext
    {
        public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
            : base(options)
        {
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }

        public DbSet<Module> Modules { get; set; }

        public DbSet<ModuleMenu> ModuleMenus { get; set; }
    }
}

Query
public List<ModuleMenu> GetModuleMenus(){
    var query = from m in _dbContext.ModuleMenus
                join mod in _dbContext.Modules on
                    m.ModuleID equals mod.ID
                select m;

    return query.ToList();
}

Error
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
      An exception was thrown attempting to execute the error handler.
System.NullReferenceException: Object reference not set to an instance of an object.

Can anyone help me to correctly create the query?

A: Is this part correct in your code?
public int ModuleID { get; set; }

It seems that you might have had an error in the type used for the fk.
Below I changed the type to be string rather than int.
public string ModuleID { get; set; }

based on that update, the query could look like this.
public ModuleMenu[] GetModuleMenusForModule(string moduleId)
{
    return _dbContext.ModuleMenus.Where(x => x.ModuleID == moduleId).ToArray();
}

A: I would expect that model to error (ModelID and ID are incompatible types). If that were correct, your code should work. Or simpler:
public List<ModuleMenu> GetModuleMenus()
{
    return _dbContext.ModuleMenus.ToList();
}


text:
Q: Order amount credit memo partial refund not correct Unfortunately, I have a issue with magento 1.9.2.0.
I made a partial refund credit memo for a customer. However, the total order amount is wrong. How can i fix this issue?

I found this and this as well, but don't know if that is the best way to fix this issue.
Can someone help me?
Thanks!

Update: still no solution found after a month.
Here is the English version of image which helps to understand the question.

A: This is an issue in the 2.2.1 version of the MSP module. MSP is aware of this issue and have an updated version which you can get through their support.
Credits goes to René Creditmemo Grand Total does not include Tax


text:
Q: Adding list1 to list2 and updating list1 without affecting list2 I'm working on a board game and currently trying to save all surrounding neighbors in a 2D array as lists in a list. The problem that I'm having is that when I have saved list1 to list2, and then move on in the iteration and change list1 to something else, it also affects list2 so I lose the values of the other neighbor.
This is what I have tried:
     private ArrayList<ArrayList> forcedPlays = new ArrayList<ArrayList>();
     private ArrayList<Integer> forcedPlay = new ArrayList<Integer>();

    private void findNeighbors(){
     for (int y = -1; y <=1 ; y+=2) {
           for (int x = -1; x <= 1; x+=2) {
               if (board[myY+y][myX+x]!=null){
                   enemyY = myY+y;
                   enemyX = myX+x;
                    forcedPlay.addAll(Arrays.asList(
                                     Integer.valueOf(enemyY),
                                     Integer.valueOf(enemyX)));

     forcedPlays.add(forcedPlay);
     forcedPlay.clear()}}}}

If my player is surrounded by two neighbors I would expect the output of the forcedPlays to look like for example: [[2,1],[4,3]], but instead it looks like [[],[]]. So what I what I don't understand is how do i add list1 to list2 and then cut the connection between them so when I clear list1 it wont clear list2?

A: You can create a copy of forcedPlay before adding it.
forcedPlays.add(new ArrayList<Integer>(forcedPlay));

This way changes made to forcedPlay won't affect the list that was added to the outer list.

A: You're doing a reference copy. Basically list1 is pointing at some of the elements of list2. You need to add to list2 copies of elements in list1, clones.


text:
Q: Android Studio NDK release/debug defines How can I specify a define for the debug build only?
How can I specify a define for the release build only?

A: NDEBUG gets defined when it's a Release build, so you can use that.
E.g.
#ifdef NDEBUG
#define RELEASE_BUILD
#else
#define DEBUG_BUILD
#endif


text:
Q: Scroll page for everyone who is on that page, on your scroll Is it possible to use make the following functionality with JavaScript:
Let's say we have 3 different people on 3 different devices on example.com
Can we mimic the scroll on everyone's device once  someone scrolls the page?
Do you think web sockets can help here?
Bonus functionality: also mimic the clicks and redirects to oder pages
TLDR: Replicate BrowserSync but without NodeJS, online, on public domain and for everyone present.


text:
Q: weird problem with windows 7 dual boot I first installed Windows 7 and then Ubuntu 17.10 along side the windows. Ubuntu can boot without issue. But if I select Windows7 from the GRUB bootloader, something strange happens.
40% chance the screen turns magenta (same color as GRUB background) and freezes
40% chance the screen turns magenta but the Windows 7 startup sound can be heard
20% chance it can actually boot into Windows 7 without issues

A: If this is a newer laptop with secure boot and UEFI in the BIOS settings:
[yes manual changes in the BIOS settings]
- turn off secure boot,
- choose legacy in the boot list option
    this will boot Linux,
- choose UEFI in the boot list option
    this will boot Windows,
I've got a Dell I7 7737 and this became the only
way I can sucessfully dual-boot after not being able
to coose Linux/Windows in the GRUB boot screen,


text:
Q: Making a strongly named COM interop assembly with a PFX file I am trying to create a strongly named COM interop assembly with a PFX file.
TlbImp.exe is perfectly happy with an SNK file created using "sn.exe -k" (which contains both public and private keys), but the problem is that I have a PFX file...
I can export the public key from PFX to SNK using sn.exe -p, but it only exports the public key, which TlbImp.exe does not like at all. Can I export both public and private keys?
I tried to install the PFX file using
sn.exe -i MyCompany.pfx xyz
and then import the type library using
TlbImp.exe /keycontainer:xyz ...",
but that gives me
TlbImp : error TI0000 : Invalid strong name parameters specified.
What can I do?
Thank you!
UPDATE: Oleg's answer and his utility below work perfectly.
The PFX file (after it is re-exported) can be successfully used to extract the
public key (sn.exe -p) to be used it with tlbimp.exe (tlbimp.exe
/publickey:xyz.pub). The PFX file can then be used to re-sign the interop
dll (sn.exe -R)
Comodo really did drop the ball on this one. Below is the dump (certutil.exe
-dump -v xyz.pfx) of the original and fixed PFX files:

Before:
CERT_KEY_PROV_INFO_PROP_ID(2):
Key Container = {36BDD7BD-F295-47B2-B9E7-C25BD5B4313E}
Unique container name:
bf63afd9ba3fb912ccd3423c6486e5fc_25e0623f-f712-49e2-abda-f31f014b5dae
Provider = Microsoft Enhanced Cryptographic Provider v1.0
ProviderType = 1
Flags = 0
KeySpec = 1 -- AT_KEYEXCHANGE
...
Private Key:
PRIVATEKEYBLOB
Version: 2
aiKeyAlg: 0xa400
CALG_RSA_KEYX
Algorithm Class: 0xa000(5) ALG_CLASS_KEY_EXCHANGE
Algorithm Type: 0x400(2) ALG_TYPE_RSA
Algorithm Sub-id: 0x0(0) ALG_SID_RSA_ANY

After:
CERT_KEY_PROV_INFO_PROP_ID(2):
Key Container = {DBA6454E-F6D2-4F0B-AB1B-9E4F7C0E139C}
Unique container name:
d2d09f87081c1af7c4225889f1af2250_25e0623f-f712-49e2-abda-f31f014b5dae
Provider = Microsoft Enhanced Cryptographic Provider v1.0
ProviderType = 1
Flags = 0
KeySpec = 2 -- AT_SIGNATURE
...
Private Key:
PRIVATEKEYBLOB
Version: 2
aiKeyAlg: 0x2400
CALG_RSA_SIGN
Algorithm Class: 0x2000(1) ALG_CLASS_SIGNATURE
Algorithm Type: 0x400(2) ALG_TYPE_RSA
Algorithm Sub-id: 0x0(0) ALG_SID_RSA_ANY

A: Try to do the following
sn.exe -p MyCompany.pfx MyCompany.pub
tlbimp.exe My.dll /delaysign /publickey:MyCompany.pub /out:Interop.My.dll
sn.exe -R Interop.My.dll MyCompany.pfx

If you create primary interop assembly from tlb file of a COM DLL you will tlbimp.exe in the form
tlbimp.exe My.tlb /primary /delaysign /publickey:MyCompany.pub /out:Interop.My.dll

You can additionally use code signing of the interop assembly:
signtool.exe sign /f MyCompany.pfx /p password /t http://timestamp.verisign.com/scripts/timstamp.dll /v Interop.My.dll

UPDATED: I found the reason of your problem which you has. First of all I should explain (or remind) about one feature of the key container.
The private key exist in the key container. The key container can be on the local hard disk in some file from the folder %APPDATA%\Microsoft\Crypto\RSA\YourUserSid. In the same way the key container can be the part of PFX file. In both cases one key container can save up to two private keys: one for digital signature (AT_SIGNATURE) and another for key exchange (AT_KEYEXCHANGE). You can look through parameters of CryptGenKey function for more details. Both keys can be absolutely different. For example you can hold in the digital signature of one key container private key of the size 4096 and in the key exchange part of the same container another private key of the size 2048.
The certificate has CERT_KEY_PROV_INFO_PROP_ID as one from its certificate extended property. It save the CRYPT_KEY_PROV_INFO structure which dwKeySpec (with the value AT_SIGNATURE, AT_KEYEXCHANGE or some other like AT_KEYEXCHANGE | AT_SIGNATURE) field are used together with other fields pwszContainerName (le-fe9728d2-af26-4f15-9be0-48c5af6f21dc for example), pwszProvName ("Microsoft Enhanced Cryptographic Provider v1.0" for example), dwProvType (PROV_RSA_FULL for example). So one has full reference to the key from the certificate.
The problem is that the certificate which you have has the key saved in the key exchange part of the container and not in the digital signature part. It make no problem in case of usage of SignTool.exe tool, but in case of the usage tlbimp.exe you get the error

TlbImp : error TI1000 : The type library importer encountered an
  unexpected exception: System.Security.SecurityException - Invalid
  assembly public key. (Exception from HRESULT: 0x8013141E)

I suppose that it's common problem of Comodo or probably Comodo certificates which one get from through Tucows.
CN = UTN-USERFirst-Object
OU = http://www.usertrust.com
O = The USERTRUST Network
L = Salt Lake City
S = UT
C = US

To reproduce the problem which I describe you can do the following steps:
1) Create key pair, save it in the key exchange of the new key container and create self-signed certificate which you the key pair. We can use for example the following parameter of MakeCert.exe to do this:

MakeCert.exe -pe -ss MY -a sha1 -cy authority -len 2048 -e 12/31/2020
  -r -n "CN=My Company Root Authority,O=My Company,C=DE" -eku 1.3.6.1.5.5.7.3.3 -sky exchange -len 2048 -sk myKeyContainer

In the above example we save the new key in the key container with explicit specified name 'myKeyContainer' to make easier to find and examine it in the future. In practice one don't specify the parameter and the container name will be generated automatically based on new GUID.
2) Use "Certificates" Snap-In to export from MMC.EXE the new created certificate as PFX file. You have to choose a password during the export. Alternatively you can use CertUtil.exe to do the same.

CertUtil.exe -privatekey -user -exportpfx -p yourPassword "My Company Root
  Authority" MyCompany.pfx

3) Export public part of the key in the SNK format. I prefer to use .PUB extension instead of .SNK to distinguish it more clear from the .SNK file holding the key pair. One can use sn.exe with -p parameter to do this:

sn.exe -p MyCompany.pfx MyCompany.pub

4) Now one can use tlbimp.exe to reproduce the error.

tlbimp.exe My.tlb /machine:X86 /primary /delaysign
  /publickey:MyCompany.pub /out:Interop.My.dll

If you would not use the switch -sky exchange at the first step the usage of tlbimp.exe will be successfully and you could use in the next step

sn.exe -R Interop.My.dll MyCompany.pfx

to sign the Interop.My.dll. After that you can use code signing to dll additionally

signtool.exe sign /f MyCompany.pfx /p yourPassword /t
  http://timestamp.verisign.com/scripts/timstamp.dll /v Interop.My.dll

Sorry for the long text, but I want be sure that people who will have the same problem will be able to understand it.
To solve the problem you need use any tool which can export and import private key. You should export the key from the key exchange part of the container and import it in the same container in the digital signature part. If you would have problem to find the corresponding tool I can try help. I don't know existing tools very good, but I know many ways how to write program which do this. In case of .NET I would use ExportCspBlob to export the key and use ImportCspBlob to import it back. One should change only one bit in the key blob to use AT_SIGNATURE instead of AT_KEYEXCHANGE. If you open the key container you should use KeyNumber.Exchange once as CspParameters.KeyNumber parameter and KeyNumber.Signature in the next step.
UPDATED 2: I found here description which corresponds my assumptions. One workaround which are suggested is to set REG_DWORD value with the name KeySpec and the value 2 (AT_SIGNATURE) in the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName. I tested this, but it's not help for the usage of tlbimp.exe.
So I just wrote the utility which do all the work. You should import your PFX file and then start my utility ChangeKeyProvInfo.exe with the certificate Issue name. For example
ChangeKeyProvInfo.exe "Dmitry Streblechenko"

After that I add the digital signature part in the key container with the same private key as has the key exchange part. Then I change the property of the certificate to use the digital signature part of the key container.
You can download the utility here and here the source code.
To make easier to find the code I post it also below. You should see the code only as the quick and dirty solution which I wrote today, so the code is not perfect.
#define STRICT

#include <windows.h>
#include <wincrypt.h>
#include <tchar.h>

#pragma comment (lib, "Crypt32.lib")

int _tmain(int argc, LPCTSTR *argv)
{
    HCERTSTORE hStore = NULL;
    PCCERT_CONTEXT pCertContext = NULL;
    LPCTSTR pszCertSubjectName = NULL;
    BOOL bSuccess, bResult = FALSE;
    DWORD cbData = 0, dwKeySpec = 0;
    HCRYPTKEY hKey = 0, hKeyNew = 0;
    BOOL fCallerFreeProvOrNCryptKey;
    PBYTE pPrivateKeyBlob = NULL;
    PUBLICKEYSTRUC *pPublicKey = NULL;
    HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey = 0;
    PCRYPT_KEY_PROV_INFO pKeyProvInfo = NULL;

    if (argc != 2) {
        _tprintf(TEXT("USAGE:\r\n\tChangeKeyProvInfo.exe CertSubjectName\n"));
        return 1;
    }
    pszCertSubjectName = argv[1];

    __try {
        hStore = CertOpenStore (CERT_STORE_PROV_SYSTEM,
            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
            (HCRYPTPROV_LEGACY)0,
            CERT_STORE_ENUM_ARCHIVED_FLAG | CERT_STORE_OPEN_EXISTING_FLAG | CERT_SYSTEM_STORE_CURRENT_USER,
            TEXT("MY"));
        if (hStore == NULL) {
            _tprintf(TEXT("Error in CertOpenStore(): %d"), GetLastError());
            __leave;
        }

        pCertContext = CertFindCertificateInStore (hStore,
            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
            0,
            CERT_FIND_SUBJECT_STR,
            pszCertSubjectName,
            NULL);
        if (pCertContext == NULL) {
            _tprintf(TEXT("Error in CertFindCertificateInStore(): %d"), GetLastError());
            __leave;
        }

        bSuccess = CryptAcquireCertificatePrivateKey(pCertContext,
            CRYPT_ACQUIRE_COMPARE_KEY_FLAG | CRYPT_ACQUIRE_NO_HEALING,
            NULL,
            &hCryptProvOrNCryptKey,
            &dwKeySpec,
            &fCallerFreeProvOrNCryptKey);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CryptAcquireCertificatePrivateKey(): %d"), GetLastError());
            __leave;
        }

        bSuccess = CryptGetUserKey (hCryptProvOrNCryptKey, dwKeySpec, &hKey);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CryptGetUserKey(): %d"), GetLastError());
            __leave;
        }

        // get privale key as clear text data in form PRIVATEKEYBLOB
        cbData = 0;
        bSuccess = CryptExportKey (hKey, 0, PRIVATEKEYBLOB, 0, NULL, &cbData);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CryptExportKey(): %d"), GetLastError());
            __leave;
        }

        pPrivateKeyBlob = (PBYTE)LocalAlloc(LPTR, cbData);
        if (pPrivateKeyBlob == NULL) {
            _tprintf(TEXT("Error in LocalAlloc(): %d"), GetLastError());
            __leave;
        }

        bSuccess = CryptExportKey (hKey, 0, PRIVATEKEYBLOB, 0, pPrivateKeyBlob, &cbData);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CryptExportKey(): %d"), GetLastError());
            __leave;
        }

        // the PRIVATEKEYBLOB started with the PUBLICKEYSTRUC which contains the KeyAlg
        // CALG_RSA_KEYX are used for AT_KEYEXCHANGE
        // CALG_RSA_SIGN are used for AT_SIGNATURE
        pPublicKey = (PUBLICKEYSTRUC *)pPrivateKeyBlob;
        if (pPublicKey->aiKeyAlg == CALG_RSA_SIGN) {
            _tprintf(TEXT("Currently AT_SIGNATURE are used - nothing to do.\n"));
            __leave;
        } else if (pPublicKey->aiKeyAlg != CALG_RSA_KEYX) {
            _tprintf(TEXT("ERROR: Unknown algorithm 0x%X are used\n"), pPublicKey->aiKeyAlg);
            __leave;
        }

        // !!!!!! the next line in the most important !!!!!!
        pPublicKey->aiKeyAlg = CALG_RSA_SIGN;
        bSuccess = CryptImportKey (hCryptProvOrNCryptKey, pPrivateKeyBlob, cbData, (HCRYPTKEY)NULL, CRYPT_EXPORTABLE, &hKeyNew);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CertGetCertificateContextProperty(): %d"), GetLastError());
            __leave;
        }
        _tprintf(TEXT("The key container has successfully imported the same key for the AT_SIGNATURE usage.\n"));

        bSuccess = CertGetCertificateContextProperty (pCertContext, CERT_KEY_PROV_INFO_PROP_ID, 0, &cbData);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CertGetCertificateContextProperty(): %d"), GetLastError());
            __leave;
        }
        pKeyProvInfo = (PCRYPT_KEY_PROV_INFO)LocalAlloc (LPTR, cbData);
        if (pKeyProvInfo == NULL) {
            _tprintf(TEXT("Error in LocalAlloc(): %d"), GetLastError());
            __leave;
        }

        bSuccess = CertGetCertificateContextProperty (pCertContext, CERT_KEY_PROV_INFO_PROP_ID, pKeyProvInfo, &cbData);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CertGetCertificateContextProperty(): %d"), GetLastError());
            __leave;
        }
        // !!!!!! the next line in the most important !!!!!!
        pKeyProvInfo->dwKeySpec = AT_SIGNATURE;
        bSuccess = CertSetCertificateContextProperty (pCertContext, CERT_KEY_PROV_INFO_PROP_ID, CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG, pKeyProvInfo);
        if (!bSuccess) {
            _tprintf(TEXT("Error in CertSetCertificateContextProperty(): %d"), GetLastError());
            __leave;
        }
        _tprintf(TEXT("The certificale property was successfully changed to use the key with AT_SIGNATURE.\n"));
        bResult = TRUE;
    }
    __finally {
        if (pPrivateKeyBlob)
            pPrivateKeyBlob = (PBYTE) LocalFree (pPrivateKeyBlob);

        if (pKeyProvInfo)
            pKeyProvInfo = (PCRYPT_KEY_PROV_INFO) LocalFree (pKeyProvInfo);

        if (pCertContext)
            bSuccess = CertFreeCertificateContext (pCertContext);

        if (hKeyNew)
            bSuccess = CryptDestroyKey (hKeyNew);

        if (hCryptProvOrNCryptKey)
            bSuccess = CryptReleaseContext (hCryptProvOrNCryptKey, 0);

        if (hStore)
            bSuccess = CertCloseStore (hStore, CERT_CLOSE_STORE_CHECK_FLAG);
    }

    return bResult? 0: 1;
}

UPDATED 2: Here you can download full protocol of an experiment which everybody can repeat to reproduce the problem how I understand if. The first certificate saved in the My.pfx can be analysed with respect of certutil.exe -dump -v My.pfx. The full output you can see here. The most important part of the output is:
...
  CERT_KEY_PROV_INFO_PROP_ID(2):
    ...
    KeySpec = 1 -- AT_KEYEXCHANGE

...
Private Key:
  PRIVATEKEYBLOB
  Version: 2
  aiKeyAlg: 0xa400
    CALG_RSA_KEYX
    Algorithm Class: 0xa000(5) ALG_CLASS_KEY_EXCHANGE
...
Encryption test passed

The modified certificates will be saved in My1.pfx. The output of the certutil.exe -dump -v My.pfx shows that the problem is fixed:
...
  CERT_KEY_PROV_INFO_PROP_ID(2):
    ...
    KeySpec = 2 -- AT_SIGNATURE

...
Private Key:
  PRIVATEKEYBLOB
  Version: 2
  aiKeyAlg: 0x2400
    CALG_RSA_SIGN
    Algorithm Class: 0x2000(1) ALG_CLASS_SIGNATURE
...
Signature test passed

UPDATE 3:
After 3 years, the problem with Comodo signatures is still present. Below is their response. Next time my certificate needs to be renewed, I will go with somebody else.

Our Code Signing certificates are intended to be used for Microsoft Authenticode signatures (and other object-signing related items; e.g. jar signing) and are not quite intended for Microsoft Strong Name signing for assemblies. If Microsoft's application won't use a keypair with the keySpec set to their suggested default (1, AT_KEYEXCHANGE; which allows both signing and encryption) and only works with AT_SIGNATURE (only allows signing), then it would be to be a processing problem with Microsoft's utility and you would need to open a case with Microsoft to correct the issue. We have hundreds of thousands of customers that are able to apply Microsoft Authenticode & other object related signatures without issue with this keySpec set as-is. We are unwilling to modify a process that is working flawlessly for virtually everyone aside from a handful of individuals who wish to go the extreme and use a publicly trusted CA to strongName sign their assemblies. Most developers that we encounter do not use a CA signed certificate for Strong Name signing assemblies, but rather do so with a self-signed certificate due to maximum term limits that public CAs impose on all certs (no more than 3-5 years max.)
Based on the stackoverflow post, you have created a utility that corrects & does provide you with a workaround to your specific issue so unfortunately there would be nothing further that we can advise upon in this matter.
We apologize for the inconvenience.
Kind Regards,
Technical Support


text:
Q: Is there any way to create a KieSession without drools-compiler? I am trying to execute this code from my project to create a default kiesession:
KieServices kieServices = KieServices.Factory.get();
KieContainer kContainer = kieServices.getKieClasspathContainer();
KieSession session = kContainer.newKieSession();

However, it fails on KieServices.Factory.get(); because:
Caused by: java.lang.RuntimeException: Unable to instance KieServices
            at org.kie.api.KieServices$Factory.<clinit>(KieServices.java:190)
            ... 63 more
Caused by: java.lang.ClassNotFoundException: org.drools.compiler.kie.builder.impl.KieServicesImpl
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:190)
            at org.kie.api.KieServices$Factory.<clinit>(KieServices.java:188)
            ... 63 more
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_67]
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_67]
   at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_67]
   at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
   ... 57 common frames omitted

I have a pre-compiled kjar and the kie-api as dependencies to my project. Why do I also need drools-compiler? Is there another way to create a ksession that does not require me to add drools-compiler to my dependencies (seeing as my kjar is already compiled)?
Here's the dependency portion of the project trying to use the rules:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.project</groupId>
    <artifactId>my-project</artifactId>
    <version>0.1-SNAPSHOT</version>
    <name>my-project</name>
    <dependencies>
        <dependency>
            <groupId>my.project</groupId>
            <artifactId>my-rule-kjar</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-api</artifactId>
            <version>6.1.0.Final</version>
        </dependency>
    </dependencies>
</project>

A: KieServices isn't necessarily the DRL compiler. If you look at the API of this interface you'll see that it is the entry point for instantiating all kinds of services provided by Kie.
It so happens that the implementation is packed into the jar where all "building" stuff is kept, including the DRL compiler. This doesn't mean it will actually be used.


text:
Q: Docker mount type bind while build is failing I am using docker build kit to build by docker image.
I want bind the host volume to cache the libraries, I am using mount type bind. Here is my docker file. (ref from here and here)
# syntax = docker/dockerfile:experimental
FROM maven:3.6.2-jdk-8-slim AS build
WORKDIR /app
COPY ./pom.xml .
RUN --mount=type=bind,source=/home/ubuntu/.m2,target=/root/.m2,rw mvn clean dependency:go-offline -B
COPY ./src ./src
RUN --mount=type=bind,source=/home/ubuntu/.m2,target=/root/.m2,rw mvn package

FROM tomcat:9.0.30-jdk8-openjdk
COPY --from=build /app/target/service.war /usr/local/tomcat/webapps/

The syntax RUN --mount=type=bind,source=/home/ubuntu/.m2,target=/root/.m2,rw mvn clean dependency:go-offline -B is throwing following error.
failed to solve with frontend dockerfile.v0:
failed to solve with frontend gateway.v0: rpc error: code = Unknown desc =
failed to build LLB: failed to compute cache key: "/home/ubuntu/.m2" not found: not found

I checked, the path /home/ubuntu/.m2 exists. Is there any issue in syntax?
I was earlier using --mount=type=cache, it was working perfectly. The reason I want to switch to this is, if the downloaded maven libraries are stored in the host file system it self then even if we do docker system prune --all, we don't need to download the cached libraries again.


text:
Q: Lollipop 5.0 Sample License Checker App crashes on Emulator (AVD) When running the the sample license check app provided by Google in sdk/extras/google/play_licensing it crashes on the Emulator(AVD) running Lollipop (5.0) (I don't have a phone running 5.0). It works fine on Phone running Kitkat.
On 4.4 Kitkat it gives a warning the
Implicit intents with startService are not safe: Intent { act=com.android.vending.licensing.ILicensingService }

android.content.ContextWrapper.bindService:538 com.google.android.vending.licensing.LicenseChecker.checkAccess:150 LicActivity.doCheck:126

I am not sure 5.0 they have moved it from a warning to full blown error.
I don't know how to convert the implicit intent call to an explicit one.
It's being called in the LicenceChecker class
   boolean bindResult = mContext
                            .bindService(
                                    new Intent(
                                            new String(
                                               Base64.decode("HEX_TEXT"))),
                                    this, // ServiceConnection.
                                    Context.BIND_AUTO_CREATE);

BASE 64 decodes into com.android.vending.licensing.ILicensingService
I just receive an error message Unfortunately, licence checker has stopped. in a dialog box.
It is showing this message in logcat
java.lang.RuntimeException: Unable to instantiate application com.android.vending.VendingApplication: java.lang.ClassNotFoundException:

 Didn't find class "com.android.vending.VendingApplication" on path: DexPathList[[zip file "/system/app/LicenseChecker/LicenseChecker.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

It's been reported a while back but still no solution
http://code.google.com/p/android/issues/detail?id=61680

A: Adding
intent.setPackage("com.android.vending");

to your Intent ensures that it is an explicit intent as required by Android 5.0.

A: Try this
Intent serviceIntent = new Intent(
     new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")));
     serviceIntent.setPackage("com.android.vending");

     boolean bindResult = mContext
             .bindService(
               serviceIntent,
               this, // ServiceConnection.
               Context.BIND_AUTO_CREATE);


text:
Q: Responsive Images - Generating multiple images from Theme Customizer control upload? So, after poking around in the code it looks like the filter image_make_intermediate_size is not called by the various WP_Customize_Control() classes at either WP_Customize_Image_Control() or it's parent WP_Customize_Upload_Control().
I'm looking to auto-generate images of various sizes, for responsive image serving and I need to execute the image_make_intermediate_size() function with some custom sizes that are specific to my extended custom control.  Just not sure how to ensure that the uploaded images call this function mainly because I haven't been able to track down where or how the upload functionality of WP_Customize_Control() is "unhooked" from the default upload behavior where the function is normally executed.
Note that the way it works is obviously the best option, don't want every image uploaded through the theme customizer to auto-generate all the default image sizes, but for my use case, I prefer to use native functionality and just pass some unique size paramters to image_make_intermediate_size().

A: If someone has a better solution, I'm open to it, however, what I came up with seems to work fine.
Basically the following code is just waiting for the image to finish uploading and then hooking into the add_attachment action.  Once the first is added, we hook in and then generate the new images via the post ID (for the image attachment) which is the only data passed to us by the add_attachment action.
First, we get the image by calling the post by ID and then a bit of regex saves the various filepaths, filename, and other data bits.  Note that I'm recursively adding 3 images of different sizes so change that if you're just looking to create 1 image or images of different sizes.  Also I've named my theme as a prerequisite for the $_POST data, from looking at this data on various image upload actions, it looks like this is the most concrete way to set a conditional for being inside the theme customizer.  There's not much else to go on, but none of the other areas that utilize the image editor include $_POST['post_data']['theme'], so just replace that with your theme name or use property_exists if you want it to apply to all themes and only the customizer.
add_filter('add_attachment','generate_responsive_sizes');

function generate_responsive_sizes( $attachment_id ) {

    $image_data = get_post( $attachment_id );

    // quit if the post_type is not attachment and mime_type is not jpeg/jpg/gif
    if ( $image_data->post_type != 'attachment' || $image_data->post_mime_type != ( 'image/jpeg' || 'image/png' || 'image/gif' ) )
        return false;

    // quit if the theme is not pure - only PURE gets responsive images, add new themes with responsive images  here
    if ( $_POST['post_data']['theme'] != 'pure' )
        return false;

    $file = substr( strrchr( $image_data->guid, '/' ), 1 );
    $filepath = str_replace( $file, '', $image_data->guid );
    $file_arr = preg_split( '/\./', $file );
    $filename = $file_arr[0];
    $file_ext = $file_arr[1];
    $upload_dir = wp_upload_dir();

    $sizes = array(
            '1024' => array(
                    'width' => 1024,
                    'height' => 768,
                    'crop' => true,
                ),
            '1680' => array(
                    'width' => 1680,
                    'height' => 1050,
                    'crop' => true,
                ),
            '2560' => array(
                    'width' => 2560,
                    'height' => 1440,
                    'crop' => true,
                ),
        );

    if ( ! is_wp_error( $image ) ) {
        foreach ($sizes as $key => $value) {
            $image = wp_get_image_editor( $image_data->guid );
            $dimensions = $image->get_size();
            if ( $dimensions['width'] < $value['width'] && $dimensions['height'] < $value['height'] ) {
                continue;
            }
            $image->resize( $value['width'], $value['height'], $value['crop'] );
            if ( $dimensions['width'] < $value['width'] ) {
                $value['width'] = $dimensions['width'];
            }
            $image->save( $upload_dir['path'] . '/' . $filename . '-' . $value['width'] . 'x' . $value['height'] . '.' . $file_ext );
        }
    }

}


text:
Q: How to fix toggle menu not working on mobile device I'm new at more or less everything. Working on my first site using bootstrap and cannot figure out why my menu works in the browser but not on the mobile.
I have read some threads about similar problems and tried some thing but no success. Bootstrap css and scripts are loaded.

  <button type="button" class="navbar-toggle"  data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>

         Link (current)

        Link

        Link

        Link

      Logga in

Logga in

              <form id="ajax-login-form" action="/login/process" method="post" role="form" autocomplete="off">

                  Användarnamn
                  <input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Användarnamn" value="" autocomplete="off">

                  Lösenord
                  <input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Lösenord" autocomplete="off">
                  <input type="checkbox" tabindex="3" name="remember" id="remember">
                      Kom ihåg mig

                      <input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-success" value="Log In">

                        Glömt lösenord?

                <input type="hidden" class="hide" name="token" id="token" value="a465a2791ae0bae853cf4bf485dbe1b6">
              </form>

Please help this poor noob. I would be forever grateful.

A: This issue might be caused by jquery version mismatch with bootstrap. So check your versions of bootstrap and jquery. Also, It seems you have mistaken while creating a collapsible navbar, check your collapse button and data toggle targets also.
Still, here is my navbar its responsive and links are working fine on mobile too:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    B-strap NavBar
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".dual-collapse2">

    </button>

        Home

        menu-1

        menu-2

        menu-3

        menu-4

        Settings

        Login

        Registration

        Log Out

This is a very common problem there are a lot of answers on so search before asking a question.

A: Thank you.
The sollution was made by changing these parts:
<button type="button" class="navbar-toggler mr-2"  data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>

And:

To this:
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>

And switched order here:


text:
Q: WPF Application - Visual Studio 2008 Toolbox Not Loading Correctly! I'm pretty new to WPF however i've got a solid understanding of WindowsForms. When I create a new WinForms application in Visual Studio the Toolbox displays a huge list of different controls that can be used for developing the program.
However, this is only the second time i've started to design stuff in WPF and the toolbox is literally only showing a few of the common controls - things like text boxes and buttons and not much else.
I've create a WPF app before in which i dragged a flow document onto the grid and played around with its capabilities, but that doesn't seem to be there.
No idea why this is happening?
Something not loading correctly?
Any help would be greatly appreciated!

A: Go to tools -> Import and Export settings -> Wizard will be opened choose Import selected environment setting click next you will find sth similar to this
C:\Documents and Settings\deepak.kumar2\My Documents\Visual Studio 2008\Settings\VWD Express
A file will be selected by default, change this file either in VWD Express folder or in Settings folder
this name will be sth like CurrentSettings.vssettings now click next and close
now go to tools-> Choose toolbox items -> select WPF Component tab now choose any control from the available list
Deepak Kalra

A: You can reset the toolbox to its original state using the Choose Toolbox Items Dialog.
Be aware, though - WPF has far fewer controls in the Toolbox than Windows Forms.  By default, there will not be many controls available, especially if you're comparing it against a windows forms control/form.

A: I had problems once with VS2008 not showing toolbox items. Although my problem wasn't related to WPF, the solution I found might be useful - what I did was to start Visual Studio through command line, using an option to reset skip packages during load.
From VS command prompt:
devenv.exe /resetskippkgs


text:
Q: Center two divs in vertically I need help centering two divs vertically in a fixed width/height div, where the two div scales in the middle of the parent div.
the first child div has a max-height, so it can scales dynamically to an extent. How can I center them so that teal and green divs goes in the middle of blue vertically?
JSFiddle HERE : https://jsfiddle.net/850sdmhj/

.subtext-container {
  position: absolute;
  width: 180px;
  height: 65px;
  color: #ffffff;
  background-color: blue;
  bottom: 0;
}
.color-teal {
  max-height: 40px;
  overflow: hidden;
  background-color: teal;
}
.color-green {
  max-height: 13px;
  font-size: 9px;
  background-color: green;
}

teal

green

A: Try  display:flex property to make it work.
Updated CSS:
.subtext-container {
  position: absolute;
  width: 180px;
  height: 65px;
  color: #ffffff;
  background-color: blue;
  bottom: 0;
  display: flex;
  justify-content: center;
  flex-direction: column;
}

.color-teal {
  max-height: 40px;
  overflow: hidden;
  background-color: teal;
}

.color-green {
  height: 13px;
  font-size: 9px;
  background-color: green;
}

Example fiddle : Demo
Note : Please check the browser support.
Browser support : http://caniuse.com/#feat=flexbox

A: Use the following CSS for the subtext-container
.subtext-container {
  position: relative;
  width: 180px;
  height: 65px;
  color: #ffffff;
  background-color: blue;
  bottom: 0;
  display:table-cell;
  vertical-align:middle;
}

Updated Fiddle https://jsfiddle.net/850sdmhj/1/

A: Maybe, by using a wrapper like

.color-wrap{
        position:relative; top:50%;
        transform:translateY(-50%)
      }

.subtext-container {
  position: absolute;
  width: 180px;
  height: 65px;
  color: #ffffff;
  background-color: blue;
  bottom: 0;
}

.color-teal {
  max-height: 40px;
  overflow: hidden;
  background-color: teal;
}

.color-green {
  height: 13px;
  font-size: 9px;
  background-color: green;
}

.color-wrap{
 position:relative; top:50%;
 -webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%)
}

teal

green

A: I would put .color-teal and .color-green inside another dive with ".vertical-align" class.

teal

green

And then in CSS file:
.vertical-align{ /* This will do the trick to center content vertically */
  display: table-cell;
  vertical-align: middle;
}

.subtext-container {
  display: table; /* Add Display Table to the container */
}

This will work only if the container (the one with display:table) has a fixed height.
Your fiddle with the working example: https://jsfiddle.net/rx79sb6m/
Also you can read this post where you can find another 5 methods to achieve the same result.


text:
Q: Troca de chaves Diffie-Hellman em grupo Como fazer uma troca de chaves diffie hellman com 10-20 pessoas por exemplo, tem como?

A: Esse é um problema em aberto. Enquanto fazer com dois participantes é trivial, e com três possível (embora envolva uma matemática um pouco mais avançada), não se conhece um meio de se fazer isso para quatro ou mais participantes.
Dois participantes, generalizado
As operações do Diffie-Hellman são feitas não no conjunto dos números Naturais, Inteiros, Reais, etc, mas sim em um grupo cíclico com gerador g. Suponha que Alice, Bob, Charlie e Dave publiquem cada um seu componente público no protocolo:

A = ga, B = gb, C = gc, D = gd

Como a, b, c e d são mantidos em segredo, os demais participantes não podem usá-lo em qualquer cálculo. Para Alice e Bob criarem uma chave comum, ambos precisam calcular:

Kab = ga*b

O que é simples: Alice conhece a e B = g^b, então basta ela fazer B^a = (g^b)^a = g^(a*b) = Kab. Bob conhece b e A = g^a, então A^b = (g^a)^b = g^(a*b) = Kab. Mas e se os quatro participantes quiserem criar uma chave comum? Um candidato natural seria:

Kabcd = ga*b*c*d

Mas aí temos um problema: Alice só conhece a, B = g^b, C = g^c e D = g^d; ela não conhece b, c e d, nem possui meios de obtê-los (se possuísse, o DH seria totalmente inseguro, pois o atacante também conseguiria calcular esses valores com base em A, B, C e D).
A única maneira de calcular isso seria com ajuda dos demais participantes:

*

*Alice calcula Kab = B^a, Kac = C^a e Kad = D^a; ela envia Kac para Bob (publicamente, ou privadamente com ajuda de Kab);

*Bob agora conhece Kac = g^(a*c), e pode calcular Kabc = Kac ^ b = (g^(a*c))^b = g^(a*b*c); ele envia isso pra Dave;

*Dave agora conhece Kabc = g^(a*b*c), e pode calcular Kabcd = Kabc^d = (g^(a*b*c))^d = g^(a*b*c*d).
Etc. Se cada participante enviar aos outros os resultados intermediários, no fim todos poderão calcular a chave comum.
O problema é: não é um desperdício de troca de mensagens? Ora, se for pra cada participante sair revelando parte da computação pros outros, de modo que todos possam calcular o resultado final, não seria mais simples em vez disso:

*

*Alice calcula Kab = B^a, Kac = C^a e Kad = D^a;

*Alice cria uma nova chave K aleatória;

*Alice envia K para cada um dos outros, usando Kab, Kac e Kad.

A suposta vantagem do Diffie-Hellman em grupo seria cada participante publicar sua "chave pública" apenas uma vez, e qualquer participante poder calcular uma chave comum ao grupo inteiro sem nenhuma troca adicional de mensagem. De modo que esse esquema não seria uma solução para o problema proposto.
Três participantes
Com apenas três participantes, é possível fazer isso sem nenhuma troca adicional de mensagens, mas é necessário se estabelecer alguns parâmetros adicionais, e a forma de cálculo é um tanto mais complexa. A matemática envolvida está além do meu alcance, mas uma explicação da técnica pode ser vista nessa resposta no crypto.SE.
Em resumo, é descrita uma operação e(P, Q) tal que e(P^a, Q^b) = e(P, Q)^(a*b), de modo que se Alice, Bob e Charlie publicarem:

A = ga, B = gb, C = gc

Então Alice pode calcular:
Kabc = e(B, C)^a = e(g^b, g^c)^a = (e(g, g)^(b*c))^a = e(g, g)^(a*b*c)

Bob pode calcular:
Kabc = e(A, C)^b = e(g^a, g^c)^b = (e(g, g)^(a*c))^b = e(g, g)^(a*b*c)

e Charlie pode calcular:
Kabc = e(A, B)^c = e(g^a, g^b)^c = (e(g, g)^(a*b))^c = e(g, g)^(a*b*c)

Nota: em alguns cenários, o passo "confirmação de chaves" (i.e. cada participante provar aos demais que ele computou a chave correta, que um adversário não interferiu no processo) pode ser necessário, tal como no DH de dois participantes. Nesse caso, os benefícios dessa técnica se anulam (já que trocas adicionais de mensagens são necessárias), sendo mais uma razão pela qual isso é pouco usado na prática.

A: Na verdade existem várias propostas de acordos de chaves em grupo. Claro que é tudo muito acadêmico então não há padrões ou produtos pronto, mas os protocolos existem.
Alguns são bem complicados, o mais simples que achei foi esse, aqui está arquivo do paper.
É um short paper publicado no IEEE communication letters,ele é bem claro na descrição do protocolo, então acho que você não vai ter problemas pra entender.
Qualquer dúvida na notação, ou mesmo na parte matemática é só perguntar. ;)


text: Q: How can I detect an edge swipe (touch) with pure JS? I am creating a webapp using MDC-Web and I decided to add a left edge swipe to open the drawer. The problem is that I can't find any good solution by searching on the internet using at the same time pure JS and edge swiping (not swiping anywhere on the screen, only from the edge). If you have any solution that uses pure JS and edge swipe, it would be greatly appreciated.


text:
Q: MacBook Pro retina, hardware repair - advice A pair of weeks ago I spilled coffee on my MacBook Pro Retina 15'' (MacBookPro10,2, Early 2013), and now I just received the quote from the customer support centre.
It's a 3rd party authorized reseller and service provider (listed on Apple's website).
Their evaluation:

Spillage is visible on Logic board
  no light on magsafe adapter
  Certain keys not working on Topcase
  Full Diagnostics unable to be completed due to issue.
New logic board needed (661-7386)
New Topcase needed (661-7454)
New Magsafe board needed (923-0096)

They are going to replace these components:

*

*661-7386 PCBA,MLB,2.7G,16GHZ-HYN,VRAM,KEPLER (£ 380.00)

*B661-7454 BATTERY OOW, TOP CASE, 15 (£ 150.00)

*923-0096 PCBA,MAGSAFE 2 (£ 30.00)

They explained to me that in order to replace the keyboard they also need to replace the whole top block, which also comprises the battery, the speakers and the trackpad.
Also, the processor (Intel Core), the 2 graphics cards (integrated and discrete) and the memory (RAM) are all soldered to the logic board, so they have to replace them all.
Basically, the only components not being replaced will be the SSD, the display and the fans.
I have got a couple of questions:

*

*is their list of components to be replaced correct? Is it true that replacing the logic board also means replacing all the rest?

*What's the normal Apple policy for this kind of replacements? Do they have to use new components, or can they use refurbished ones? (I'd rather to get new parts)

A: Their evaluation & explanation sounds legitimate.  I would assume that when the coffee was spilled it made it's way into the keyboard.  If this is the case it's entirely reasonable to assume that it would make it's way through the keys and inside the top case, with the next component it reaches being the logic board.
In regards to your two questions:
1) Without seeing the Mac and only relying on my experience (see below) I can only make an assumption, but from the information given the list of parts does seem very likely.  Yes, the logic board contains a majority of components for your Mac.  The processor, GPU, SMC, some ports, etc are all located on this one major component.  With the way I'm assuming the spill occurred the coffee wouldn't have made it to the SSD, which connects directly to the logic board, thanks to the SSD being located on the opposite side of the logic board.  The only fault I see with their explanation is the speakers, I haven't replaced a Retina top case in a while but I could've sworn that the speakers are still separate components.
2) There's no way for them to tell you upfront if the parts are new or refurbished.  Apple re-uses eligible (meaning not beyond economical repair) parts after a strict refurbishing process that includes individual testing of components.  When technicians receive parts there is no distinguishing feature to know if it's used or newly manufactured.  Honestly, the only way to be sure is if you request a part for a Mac that was just released, simply because there wouldn't have been time to collect used parts and put them through the refurbishing cycle.  Either way in my experience I've never seen a trend of service (repair) parts being faulty.  It DOES happen from time to time but I've never seen a trend of obviously refurbished parts leading to repeat repairs or premature failures.  Apple's replacement parts do carry a 90 day warranty or take over the rest of your existing AppleCare warranty, whichever is a longer period.
Did the AASP mention a flat rate or depot repair to you?  I haven't priced out the parts they mentioned in a while b considering the amount of damage that might be a little bit cheaper.  Basically Apple offers tiered flat rate repairs for out of warranty situations.  Since this is liquid damage it would likely be a tier 4, the highest of them, but it might still be a little cheaper.  Might be something to ask them about.
Source - I worked as a Genius for several years, as an in-store and onsite AppleCare certified technician for several years and have dealt with AppleCare extensively on both sides (as a technician and as a representative for an enterprise customer) for several years.  I've repaired well over 1000 MacBooks, around 1000 iMacs, several hundred MacBook Pros/Airs and a couple hundred Mac minis and Mac Pros.  Everything from in warranty failures to severe fire and liquid damage.

A: Your first question can not be answered without physical access to the hardware.
Your second question about parts:
If for some reason Apple service uses refurbished components! they will inform you.
If refurbished is used it is
a) apple certified
b) comes with Apple standard warranty.


text:
Q: How can I get more error message about `HIVE_BAD_DATA` in AWS Athena? I am running select *** statement in Athena against a database table in glue. I get this error:
Your query has the following error(s):

HIVE_BAD_DATA: Error parsing field value 'false' for field 38: java.lang.Boolean cannot be cast to java.lang.Double

This query ran against the "video" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 6ab2d2e8-c0a0-4329-ac91-be2683c05462.

From the error message, I understand it is about a field type of boolean which its value is a string 'false'. But it doesn't tell me which column has such error. I have a table which includes more than 30 columns and about 9 of them are boolean. Is there an easier way for me to find out the problem column instead of just querying each of them one by one?


text:
Q: Drupal 7 Views: Term filter with relationship I have 2 content types:
One content type is named: "Offer". This content type includes a reference field to choose one hotel, form the other content type: "Hotel". The content type "Hotel" has a term reference field called "sports".
Now I want to build a view filter, which uses the content type "Offer", and uses the sport terms which i get over the hotel relationship.
I already tried to create a relationship on my own:

*

*Reference to the hotel

*Added taxonomy field sport with the relationship to the hotel, which i created before

*Then i added the taxonomy field to my filter, and selected the Relationship in the drop down menu.

But this doesn't work at all.
Anyone can help me?
Regards M.

A: The view should initially return the hotel content type.
Add a optional relationship to the offer reference field, this will give you access to the fields in the offer content type.  Once you've done that you should be able to add whatever field you want as an exposed filter.
To get the sports working you may have to add the relationship Has taxonomy term in order to get what you want and then add the term as an exposed filter.

A: Use the patch over at https://www.drupal.org/node/1492260 for autocomplete.
A select list should work the same way as with this patch, but it's built-in.  In either case, you have to enable it by checking the checkbox in the content type field config.


text:
Q: Magento eWay plugin Function Not Permitted to Terminal I'm getting below error with eWay AU Direct plugin in Magento
58 Function Not Permitted to Terminal

What could this mean???

A: It's an error code returned by your eWay service, and not a problem with Magento or your code.