Keenanaddiejosefa's Profile

205
Points

Questions
39

Answers
32

  • Asked on July 17, 2020 in Python.

    I believe you made it a little more complicated than absolutely necessary. Since you are using etree, you might as well use xpath to get there.

    names1 = root1.xpath('.//account/acctBasicInfo')  for name in names1:     rn = name.xpath('.//realname/text()')[0] #get the real name in root1     actNm = name.xpath('./acctName/text()')[0] #get the acctName in root1     #next line is the key: create a search expression to find in root2 an account with the same acctName as in the current node of root1     exp = f'.//account/acctBasicInfo[acctName/text()={actNm}]//realname/text()'         twin = root2.xpath(exp)[0] #execute the search     #now compare the real names in both accounts in the two roots, and if not the same, create alert     if rn != twin:         print({f'{actNm}': [{'realname': [f'{rn}--test1.xml', f'{twin}--test2.xml']}]}) 

    Output:

    {'600789488': [{'realname': ['lui--test1.xml', 'lu--test2.xml']}]} 
    • 311 views
    • 1 answers
    • 0 votes
  • Asked on July 16, 2020 in .NET.

    You can use the [DynamicData] attribute to achieve this. It accepts non constant values or complex objects to pass parameters to the target tests.

    Another option is to use custom datasource. Refer to https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.testtools.unittesting.itestdatasource?view=mstest-net-1.2.0 for more information.

    • 96 views
    • 1 answers
    • 0 votes
  • SAML 2.0 do not require Authn Requests to be signed by default (Logout Requests are required to be signed through). Therefore, the ITfoxtec Identity Saml2 package do not include the SigAlg and Signature parameters by default in the request.

    To sign Authn Requests set the Saml2Configuration.SignAuthnRequest = true in code or in configuration "Saml2:SignAuthnRequest" = "true".

    Edited – read from metadata

    The Saml2Configuration.SignAuthnRequest can be set from the IDP metadata WantAuthnRequestsSigned.

    .NET Framework sample code:

    if(entityDescriptor.IdPSsoDescriptor.WantAuthnRequestsSigned.HasValue) {     Saml2Configuration.SignAuthnRequest = entityDescriptor.IdPSsoDescriptor.WantAuthnRequestsSigned.Value;  } 

    .NET Framework sample IdentityConfig.cs

    .NET Core sample Startup.cs

    • 106 views
    • 1 answers
    • 0 votes
  • I put your client ID in an existing project and it showed up fine in my console. I had it dotenv require like this

    require("dotenv/config"); 

    console.log(process.env.clientID)

    • 86 views
    • 1 answers
    • 0 votes
  • Asked on July 16, 2020 in Python.

    Here is a slight improvement to the given thread-based solution.

    The code below supports exceptions:

    def runFunctionCatchExceptions(func, *args, **kwargs):     try:         result = func(*args, **kwargs)     except Exception, message:         return ["exception", message]      return ["RESULT", result]   def runFunctionWithTimeout(func, args=(), kwargs={}, timeout_duration=10, default=None):     import threading     class InterruptableThread(threading.Thread):         def __init__(self):             threading.Thread.__init__(self)             self.result = default         def run(self):             self.result = runFunctionCatchExceptions(func, *args, **kwargs)     it = InterruptableThread()     it.start()     it.join(timeout_duration)     if it.isAlive():         return default      if it.result[0] == "exception":         raise it.result[1]      return it.result[1] 

    Invoking it with a 5 second timeout:

    result = timeout(remote_calculate, (myarg,), timeout_duration=5) 
    • 139 views
    • 14 answers
    • 0 votes
  • Asked on July 16, 2020 in Python.

    you can have a dict as

    dict = {"boxingmma":"/home/brendan/Desktop/boxingtest.txt", "football":"/home/brendan/Desktop/splittest.txt", "football1":"/home/brendan/Desktop/testing2.txt"}  for key, value in dict:     if str(message.channel) == key:         if message.content.find("!boxing") != -1:              with open(value, 'r') as file:                 msg = file.read(2000).strip()                 while len(msg) > 0:                     await message.author.send(msg)                     msg = file.read(2000).strip() 

    for third value I put football as football1 because keys cannot be repeated.

    • 0 views
    • 1 answers
    • 0 votes
  • Asked on July 16, 2020 in Python.

    You are ignoring the return value for the recursive call:

    gcdIter (a,b%a)  

    Recursive calls are no different from calls to other functions; you’d still need to do something with the result of that call if that is what you tried to produce. You need to pass on that return value with return

    return gcdIter (a,b%a)     

    Note that you can assign to multiple targets when assigning:

    def gcdIter(a, b):     a, b = min(a, b), max(a, b)     if b % a == 0:         return a     return gcdIter(a, b % a)   

    You really don’t need to care about the bigger and smaller values here. A more compact version would be:

    def gcd_iter(a, b):     return gcd_iter(b, a % b) if b else abs(a) 
    • 75 views
    • 1 answers
    • 0 votes
  • Since anything beyond 12 isn’t defined in the Bootstrap CSS you’ll see nothing applied to the element you classify with those names. So you’ll only see inherited properties of elements/body/etc. applied

    <link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>  <div class="container">     <div class="navbar navbar-default">         <div class="navbar-header">             <a class="navbar-brand" href="#">Bootstrap 3</a>         </div>         <div class="navbar-collapse collapse">             <ul class="nav navbar-nav">                 <li class="dropdown active">                     <a href="#" class="dropdown-toggle" data-toggle="dropdown">Getting started <b class="caret"></b></a>                     <ul class="dropdown-menu">                         <li><a href="http://getbootstrap.com/getting-started/#download">Download Bootstrap</a></li>                         <li class="divider"></li>                         <li class="dropdown-header">Examples</li>                         <li><a href="http://getbootstrap.com/getting-started/#template">Basic template</a></li>                         <li><a href="http://getbootstrap.com/examples/starter-template/">Starter template</a></li>                         <li><a href="http://getbootstrap.com/examples/grid/">Grids</a></li>                         <li><a href="http://getbootstrap.com/examples/jumbotron/">Jumbotron</a></li>                         <li><a href="http://getbootstrap.com/examples/navbar/">Navbar</a></li>                         <li><a href="http://getbootstrap.com/examples/signin/">Sign-in page</a></li>                         <li><a href="http://getbootstrap.com/examples/sticky-footer/">Sticky footer</a></li>                         <li><a href="http://getbootstrap.com/examples/offcanvas/">Offcanvas</a></li>                         <li><a href="http://getbootstrap.com/examples/carousel/">Carousel</a></li>                         <li><a href="http://getbootstrap.com/examples/theme/">Theme</a></li>                                                 <li class="divider"></li>                         <li class="dropdown-header">Compatibility</li>                         <li><a href="http://getbootstrap.com/getting-started/#migration">Migrating from 2.x to 3.0</a></li>                         <li><a href="http://getbootstrap.com/getting-started/#browsers">Browser support</a></li>                         <li><a href="http://getbootstrap.com/getting-started/#third-parties">Third party support</a></li>                     </ul>                 </li>                 <li><a href="http://getbootstrap.com/css">CSS</a></li>                 <li><a href="http://getbootstrap.com/components">Components</a></li>                 <li><a href="http://getbootstrap.com/javascript">JavaScript</a></li>             </ul>             <ul class="nav navbar-nav navbar-right">                 <li class="active"><a href="http://getbootstrap.com/customize">Customize</a></li>             </ul>         </div>     </div>         <div class="jumbotron">         <h1>Twitter Bootstrap 3.0</h1>         <p class="lead">Starter template with CSS and JS included.</p>       </div>              <div class="col-sm-20">         Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV. Col-Sm-20 DIV.        </div> <br />       <div class="col-sm-12" >         Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV. Col-Sm-12 DIV.       </div> <br />       <div class="col-md-100">        Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.  Col-Sm-100 DIV.         </div> </div>

    • 95 views
    • 1 answers
    • 0 votes
  • Try parseInt function:

    var number = parseInt("10"); 

    But there is a problem. If you try to convert “010” using parseInt function, it detects as octal number, and will return number 8. So, you need to specify a radix (from 2 to 36). In this case base 10.

    parseInt(string, radix) 

    Example:

    var result = parseInt("010", 10) == 10; // Returns true  var result = parseInt("010") == 10; // Returns false 

    Note that parseInt ignores bad data after parsing anything valid.
    This guid will parse as 51:

    var result = parseInt('51e3daf6-b521-446a-9f5b-a1bb4d8bac36', 10) == 51; // Returns true 
    • 241 views
    • 27 answers
    • 0 votes
  • Asked on July 16, 2020 in HTML.

    </th> should be <th> without the /. because balise should be open without the / and close with

    function onSuccess(data) {     var table = document.getElementById("kaizens")     var lstProjetos = data.d.results;     $.each(lstProjetos, function (key, value) {         $("#head").append("<th>"+value.Area+"</th>");     });   
    • 96 views
    • 1 answers
    • 0 votes