text:
Q: How to create all permutations of a list of tuples depending on one boolean field keeping order in Python Let's say i have an input as a list of tuples like this:
[('a', True),
 ('b', False),
 ('c', True),
 ('d', False)]

Every tuple which has True as second parameter is considered optional.

*

*amount of tuples in the list is arbitrary

*the value of the first value is arbitrary and must be preserved

Now I want to permutate this struct the following way:

*

*the output should be a list of list of tuples

*every list of tuples is unique

*the lists differenciates on the optional tuples which are either there or not

*tuples which are False don't change (disappear)

*ordering of the tuples inside the lists does not change

*ordering of the tuples does not change

*lists of tuples can be in any order

The output of the example above should therefore look like this:
[[('a', True),
  ('b', False),
  ('c', True),
  ('d', False)],

 [('b', False),
  ('c', True),
  ('d', False)],

 [('a', True),
  ('b', False),
  ('d', False)],

 [('b', False),
  ('d', False)]]

Any thoughts how to solve this one in an elegant way? I tried with recursion but I could not pull it off.

A: I'm not sure there is a particularly elegant way.  Conceptually, you need to compute the power set of the optional elements, but merge it with the non-optional elements in a way that fulfils your requirements.  Here is one way:
import itertools
a = [('a', True), ('b', False), ('c', True), ('d', False)]
optional_count = sum(optional for x, optional in a)
for include in itertools.product([True, False], repeat=optional_count):
    include_iter = iter(include)
    print([
        (x, optional)
        for x, optional in a
        if not optional or next(include_iter)
    ])

printing
[('a', True), ('b', False), ('c', True), ('d', False)]
[('a', True), ('b', False), ('d', False)]
[('b', False), ('c', True), ('d', False)]
[('b', False), ('d', False)]

The loop iterates over all tuples indicating whether to include the optional elements:
True, True
True, False
False, True
False, False

The list comprehension in the print statement includes all non-optional elements, and for the optional ones looks at the next available element from include.

A: There is actually a nice recursive solution I just thought of:
def choices(a):
    if not a:
        yield []
        return
    head, *tail = a
    if head[1]:
        yield from choices(tail)
    for tail_choice in choices(tail):
        yield [head] + tail_choice

This creates a lazy generator over all lists of tuples:
>>> list(choices(a))
[[('b', False), ('d', False)],
 [('b', False), ('c', True), ('d', False)],
 [('a', True), ('b', False), ('d', False)],
 [('a', True), ('b', False), ('c', True), ('d', False)]]

A: You could make choices by making a copy of the list of so far made choices and append the new value to the copy and afterwards merging it with the list of so far made choices.
Sorry for that horrible explanation, but I can't come up with anything better right now. Feel free to edit, if you can come up with anything better. Otherwise I hope, below diagram and code do a better job at explaining my solution.
                                        []
                    -------------------------------------------
                   []                                        [0]
       ----------------------------                ---------------------------
       []                       [1]                [0]                  [0, 1]
       ...                      ...                ...                  ...

The basic idea is to iterate over ever item, clone all partial solutions and append the item to the cloned solutions.
def choose(arr):
    res = [[]]

    for t in arr:
        if t[1]:
            # make a copy of all found solutions
            clone = [list(c) for c in res]

            # append the new value to the original solutions
            for l in res:
                l.append(t)

            # merge solution-list with the list of copies
            res += clone
        else:
            # non-optional element => just add the element to all solutions
            for l in res:
                l.append(t)

    return res

Output:
print('\n'.join(str(l) for l in choose([('a', True), ('b', False), ('c', True), ('d', False)])

[('a', True), ('b', False), ('c', True), ('d', False)]
  [('b', False), ('c', True), ('d', False)]
  [('a', True), ('b', False), ('d', False)]
  [('b', False), ('d', False)]


text:
Q: 2017 solar eclipse: why are these two maximal eclipse points different? referring to this guide, there is a point in southern Illinois that has the longest duration eclipse and a point in western Kentucky where the eclipse is the "greatest".

the first i understand, the second doesn't make sense to me.  for anyone in the center of the path, the eclipse is as total as it can possibly be.  at some moment, the moon is squarely in front of the sun.
can someone explain the difference?

A: How do you mark an answer as an educated guess. Ah well, perhaps this will help.
Different points on the earth's surface must be at different distances from the moon. The angular diameter of the moon is greater at the point on the earth that is closest to the moon (nearer things are bigger). Is the greatest eclipse at this place?
The transit time will also be impacted by the rotation of the earth, which will have the effect of shortening it as the moon takes aprox a month to get round and the earth surface only a day. In the location of the "greatest" eclipse where the surface of the earth intersects the shadow tangentially the rotation is in the most effective direction for a rapid transit. The longest transit time must be elsewhere; where the angular diameter of the moon is nearly largest, and the surface of the earth is cutting a slightly longer section through the shadow.
TBH It's an enhancement to the question, I suppose, given that I have been creative.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to use custom Navigationcontroller in AppDelegate by using a Storyboard I've got a problem concerning Navigationcontroller in AppDelegate. I'm using a storyboard, which looks like this:

As a result of using Push notifications, i've got the following function in my AppDelegate File:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
//...
}

When the notification arrives I want to initialize the "Detail View" - Controller which needs an ID as a parameter. This ID is part of my payload so it is present in didReceiveRemoteNotification.
I'd like to to the follwing:
DetailView *detail = [storyboard instantiateViewControllerWithIdentifier:@"detail"];

detail.conversationID = theID;

[self.navigationController pushViewController:detail animated:YES];

My question at this point is: how can I get the navigation controller? I've searched for a function like "getNavigationControllerByIdentifier" or something like this, but found nothing. I can't instantiate the Detail View Controller directly because the navigationbar is missing there.
I hope you understand what I mean - if you think my approach is completly wrong please correct me ;o)
Just another small information: It's not important for me that the back button in the Detail View Controller goes back to the Table View - it's enough when it links to the controller with the button "Load Table View".
Thank you for help!

A: UINavigationController is a UIViewController subclass and can also be assigned an identifier in the storyboard.
Use -instantiateViewControllerWithIdentifier: to create the UINavigationController and it's root view controller. You may need to instantiate all of the intermediate controllers in code and modify the navigation controller's viewControllers property to set up the appropriate navigation stack. This way when the app launches into the detail view, they can find their way back as if they had manually pushed all the way through via the interface.

A: You can use rootViewController on your window object.
UIViewController *rootViewController = self.window.rootViewController;
// You now have in rootViewController the view with your "Hello world" label and go button.

// Get the navigation controller of this view controller with:
UINavigationController *navigationController = rootViewController.navigationController;

// You can now use it to push your next view controller:
DetailViewController *detail = [navigationController.storyboard instantiateViewControllerWithIdentifier:@"detail"];
detail.conversationID = theID;
[navigationController pushViewController:detailViewController animated:YES];


text:
Q: Funções do PYAUTOGUI não funcionando Estou automatizando a instalação de um software utilizando python com pyautogui:
import pyautogui
import time
import pyperclip

for window in pyautogui.getWindows():
    pyautogui.getWindow(window).minimize()

##Abre local do .exe
pyautogui.hotkey("win","r")
pyautogui.press("\\")
pyautogui.press("\\")
pyperclip.copy("ts1/publico/Meus Documentos/Equipes Qualidade/Automação/Aplicativos/Folha/Sefip 8.4")
pyautogui.hotkey("ctrl","v")
pyautogui.press("enter")

##Encontra .exe e da double click nele
executavel = None
while executavel is None:
    executavel = pyautogui.locateOnScreen("executavel.png", grayscale=False)
executalvelX, executavelY = pyautogui.center(executavel)
pyautogui.click(executalvelX, executavelY, clicks=2)

##O instalador abre, aqui ele deveria encontrar o botão 'sim' e clicar nele.
##O Script encontra a posição do botao, porém não clica, não pressiona teclas, não move o mouse.
botaoSim = None
while botaoSim is None:
    botaoSim = pyautogui.locateOnScreen("botaosim.png", grayscale=False)
botaoSimX, botaoSimY = pyautogui.center(botaoSim)
pyautogui.click(botaoSimX, botaoSimY)

for _ in range(4):
    next1 = None
    while next1 is None:
        next1 = pyautogui.locateOnScreen("next.png", grayscale=False)
    next1X, next1Y = pyautogui.center(next1)
    pyautogui.click(next1X, next1Y)

Porém, em certa etapa do processo, algumas funções como clicar, mover o mouse, pressionar uma tecla não funcionam.

Gostaria de saber se estou fazendo algo de errado, ou se é pelo fato de ser uma instalação de um sistema.

A: Se você instalar o OpenCV, você pode usar o recurso confidence.
Às vezes há pequenos ajustes e modificações nos pixeis de uma imagem e diminuir o nível de precisão na busca pode aumentar as chances de encontrar a imagem que quer.
x, y = pyautogui.locateCenterOnScreen('printscreen.png', confidence=0.8)
pyautogui.click(x, y)

A: Olá, Nathan! Desculpa responder um pouco tarde, mas passei por um problema semelhante agora.
A solução foi simplesmente abrir o aplicativo que eu queria clicar como Administrador e, magicamente, o mouse voltou a clicar na tela do aplicativo.
Espero que ajude!

A: executavel = pyautogui.locateOnScreen("executavel.png",grayscale=True, confidence=0.9)

Observação:
grayscale(True) = deixa a imagem em tons de cinza, melhora muito o reconhecimento
confidence(mínimo 0.1 máximo 1.0) = diz a fidelidade da imagem, mais próximo do real, varia entre 77 e 95 para melhores resultados, é uma precisão, quanto mais alto o valor, mais exato a imagem tem que ser. obs: usar acima de 0.9 da muito errado.

A: Você pode resolver esse problema assim:
Gere um executável(.exe) do seu arquivo .py
Vá em propriedades do arquivo
Aperte em Compatibilidade
E marque a caixa "Executar este programa como administrador"

A: Ao invés de importar o pyautogui como (import pyaotogui), faça com (from pyautogui import *)
Assim vc não precisa colocar pyautogui em cada linha. E no press você pode usar assim:
press("//", presses=2, interval=0.01) # Vai fazer o mesmo que as 2 linhas de comando press que usou no seu código


text:
Q: Как вывести ссылки постраничной навигации с точками? Каким образом вывести ссылки пагинации вот такого вида:
1 2 3 ... [6] ... 9 10
Додумался только вот до этого:
<?php for($i = 1; $i <= $pages; $i++): ?>
   <a href="?page=<?= $i ?>"><?= $i ?>
<?php endfor ?>

$pages — количество страничек.
Т. е. нужно, чтобы было видно ссылки на первую страницу, последнюю и текущую (активную), ну и чтобы строка со ссылками всегда была одинаковой длины и не увеличивалась.


text:
Q: How to read a first character from the last line of a file in python I am writing a scoreboard thingie in python (I am fairly new to the language). Basically user inputs their name and I want the program to read the file to determine, the number that the user is assigned to.

*

*For example, the names in the .txt file are:

*Num   Name      Score

*
*

*John Doe    3

*

*Mitch       5

*

*Jane        1

How do I now add user no.4 without the user typing the exact string to write, only their name.
Thanks a lot!

A: I suggest rethinking your design - you probably don't need the line numbers in the file, however you could just read the file and see how many lines there are.
This won't scale if you end up with a lot of data.
>>> with open("data.txt") as f:
...   l = list(f)
...

This reads your header
>>> l
['Num Name Score\n', 'John Doe 3\n', 'Mitch 5\n', 'Jane 1\n']
>>> len(l)
4

So len(l)-1 is the last number, and len(l) is what you need.

A: the easiest way to get the number of lines is by using readlines()
x=open("scoreboard.txt", "r")
line=x.readlines()
lastlinenumber= len(line)-1
x.close()

with open('scoreboard.txt', 'a') as scoreboard: #FIle is opened for appending
username = input("Enter your name!")
scoreboard.write(str(lastlinenumber) + '. ' + str(username) + ":  " + '\n')
scoreboard.close()

A: def add_user():
with open('scoreboard.txt', 'r') as scoreboard:
    #Reads the file to get the numbering of the next player.
    highest_num = 0
    for line in scoreboard:
        number = scoreboard.read(1)
        num = 0
        if number == '':
            num == 1
        else:
            num = int(number)
        if num > highest_num:
            highest_num = num
    highest_num += 1

with open('scoreboard.txt', 'a') as scoreboard: #FIle is opened for appending
    username = input("Enter your name!")
    scoreboard.write(str(highest_num) + '. ' + str(username) + ":  " + '\n')
    scoreboard.close()

Thank you guys, I figured it out. This is my final code for adding a new user to the list.


text:
Q: Embedded Tomcat9x; pom.xml: Error=java.lang.NoClassDefFoundError: javax/security/auth/message/config/RegistrationListener I have no idea how to research this error log, as I am following a Udemy course, but the Instructor is using an older version of all dependencies I'm posting with this question. One of the main things I'm pulling my hair out about is that although the following is included in my pom file, <failOnMissingWebXml>false</failOnMissingWebXml> I still get the following message added to the logs in the console No global web.xml found along with other errors. Another thing that has me pulling my hair is that the error logs references security protocols, and I wasn't aware that I had dependencies on those protocols added in this build. This will eventually be a Spring MVC application, but I am having trouble just setting up the pom file. My pom file and the error logs are below.
pom.xml
`

4.0.0
<groupId>academy.learnprogramming</groupId>
<artifactId>todo-list</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <spring.version>5.3.19</spring.version>
    <lombok.version>1.18.24</lombok.version>
    <logback.version>1.2.11</logback.version>
    <java-annotation.version>1.3.2</java-annotation.version>
    <java.version>11</java.version>
    <servlet-api.version>4.0.1</servlet-api.version>
    <cargo.version>1.9.10</cargo.version>
</properties>

<dependencies>

    <!-- spring web mvc -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- servlet api -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>${servlet-api.version}</version>
        <scope>provided</scope>
    </dependency>

    <!-- lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
    </dependency>

    <!-- logback -->
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
    </dependency>

    <!-- javax annotation api -->
    <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>javax.annotation-api</artifactId>
        <version>${java-annotation.version}</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-core-container-tomcat</artifactId>
        <version>${cargo.version}</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.10.1</version>
            <configuration>
                <target>${java.version}</target>
                <source>${java.version}</source>
                <release>${java.version}</release>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.3.2</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <version>1.9.10</version>
            <configuration>
                <container>
                    <containerId>tomcat9x</containerId>
                    <type>embedded</type>
                </container>
            </configuration>
        </plugin>
    </plugins>
</build>

`
error logs
"C:\Program Files\Java\jdk-11.0.13\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\James.Benton\IdeaProjects\todo-list "-Dmaven.home=C:\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\IntelliJ IDEA Community Edition 2021.2.3\lib\idea_rt.jar=57351:C:\IntelliJ IDEA Community Edition 2021.2.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2021.2.4 org.codehaus.cargo:cargo-maven3-plugin:1.9.10:run
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< academy.learnprogramming:todo-list >-----------------
[INFO] Building todo-list 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- cargo-maven3-plugin:1.9.10:run (default-cli) @ todo-list ---
[INFO] [en3.ContainerRunMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.9.10 for container tomcat9x
[INFO] [beddedLocalContainer] Tomcat 9.x Embedded starting...
May 03, 2022 11:04:50 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 03, 2022 11:04:50 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
May 03, 2022 11:04:50 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.58]
May 03, 2022 11:04:50 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 03, 2022 11:04:52 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
May 03, 2022 11:04:56 PM org.apache.catalina.startup.ContextConfig authenticatorConfig
SEVERE: Cannot instantiate an authenticator of class [org.apache.catalina.authenticator.NonLoginAuthenticator]
java.lang.NoClassDefFoundError: javax/security/auth/message/config/RegistrationListener
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at org.apache.catalina.startup.ContextConfig.authenticatorConfig(ContextConfig.java:395)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:997)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
    at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:788)
    at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:738)
    at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:249)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.cargo.container.tomcat.internal.TomcatEmbedded$Wrapper.invoke(TomcatEmbedded.java:454)
    at org.codehaus.cargo.container.tomcat.internal.TomcatEmbedded$Wrapper.invoke(TomcatEmbedded.java:413)
    at org.codehaus.cargo.container.tomcat.internal.TomcatEmbedded$Embedded.createContext(TomcatEmbedded.java:712)
    at org.codehaus.cargo.container.tomcat.TomcatEmbeddedLocalDeployer.deploy(TomcatEmbeddedLocalDeployer.java:91)
    at org.codehaus.cargo.container.tomcat.TomcatEmbeddedLocalDeployer.redeploy(TomcatEmbeddedLocalDeployer.java:149)
    at org.codehaus.cargo.container.tomcat.internal.AbstractCatalinaEmbeddedLocalContainer.doStart(AbstractCatalinaEmbeddedLocalContainer.java:166)
    at org.codehaus.cargo.container.spi.AbstractEmbeddedLocalContainer.startInternal(AbstractEmbeddedLocalContainer.java:78)
    at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(AbstractLocalContainer.java:229)
    at org.codehaus.cargo.maven3.ContainerStartMojo.executeLocalContainerAction(ContainerStartMojo.java:83)
    at org.codehaus.cargo.maven3.ContainerRunMojo.doExecute(ContainerRunMojo.java:95)
    at org.codehaus.cargo.maven3.AbstractCargoMojo.execute(AbstractCargoMojo.java:437)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.ClassNotFoundException: javax.security.auth.message.config.RegistrationListener
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 72 more

May 03, 2022 11:04:56 PM org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
May 03, 2022 11:04:56 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more components marked the context as not correctly configured
May 03, 2022 11:04:56 PM org.apache.catalina.core.ApplicationContext log
INFO: Warning: No org.apache.tomcat.JarScanner set in ServletContext. Falling back to default JarScanner implementation.
May 03, 2022 11:04:56 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 03, 2022 11:04:57 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 03, 2022 11:04:57 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [435] milliseconds.
May 03, 2022 11:04:57 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/todo-list] startup failed due to previous errors
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/C:/Users/James.Benton/.m2/repository/org/apache/tomcat/tomcat-catalina/9.0.58/tomcat-catalina-9.0.58.jar) to field java.io.ObjectStreamClass$Caches.localDescs
WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoaderBase
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] [beddedLocalContainer] Tomcat 9.x Embedded started on port [8080]
[INFO] Press Ctrl-C to stop the container...

A: It looks like you are missing something in the Tomcat.
At least it was asked on StackOverflow and GitHub both with the same Results. Had the problem once and adding the jar fixed the problem. Haven't tried it for a while now, but I think, that you might give it a try


text:
Q: jQuery Undelegate does not work I'm creating a responsive template and I want to remove the listeners on an element when screen is being resized or is smaller than the specified width.
Imagine an menu which when you hover on it's items, it shows you the sub-menus in normal displays but the same menu in mobile devices will show the sub-menus only by tapping or clicking on the items.
I can't make the undelegate work. In resized screen I still have the mouseover and mouseout event-listeners. I'm not getting any errors in console and I've tried both:

*

*.off('mouseover', 'li')

*.off('mouseover')

*.undelegate('li', 'mouseover')

*.undelegate('li')
and none of them works.
var $window = $(window);
    function handleSidenav() {
    $(".nav-list").delegate('li', 'mouseover', function(e) {
        $(this).find("a").addClass('active');
        $(this).find("div.sub-items").toggle();
    }).delegate('li', 'mouseout', function(e) {
        $(this).find('a').removeClass('active');
        $(this).find("div.sub-items").toggle();
    });
}

function checkWidth() {
    var windowsize = $window.width();
    if (windowsize < 767) {
        smallScreenDelegation();
    } else {
        SmallScreenUndelegation();
    }
}
checkWidth();
handleSidenav();
$window.resize(checkWidth());

function smallScreenDelegation() {
    $(".nav-list").undelegate('li'); //It's not working
    $(".nav-list").undelegate('li'); //It's not working
    $(".nav-list").delegate('li a:first', 'click', function(event) {
        if ($(this).next().is(':hidden')) {
            $(this).addClass('active');
            $(this).next().slideDown('slow');
        } else {
            $(this).removeClass('active').next().slideUp('slow');
        }
        event.preventDefault();
    });
}

A: You need to wrap window in the jQuery object. I'm not sure if you set $window = $(window), but it seems here that $window.width() and $window.resize(checkWidth) are missing parenthesis. I was able to get it working fine once I changed those to $(window). You have to define which event you want to undelegate. I used:
 $('.nav-list').undelegate('li', 'mouseover');

Open up console and you can see that it works: http://jsbin.com/efonut/6/edit
Also, it's really best to use .on() and off() vs .delegate() and .undelegate(), but at least this works...

A: I still don't know what was wrong with undelegate which I couldn't make it work, but I managed to fix my code by using on and off.
As adeneo said I was delegating and undelegating on each window resize which was quiet a bug and I think I fixed that but holding the last state on device variable.
var $window = $(window);
var device;

function desktopSidenav() {
    $(".nav-list > li").off('click');
    $(".nav-list > li").on('mouseover', function(e) {
        $(this).find("a").addClass('active');
        $(this).find("div.sub-items").toggle();
    }).on('mouseout', function(e) {
        $(this).find('a').removeClass('active');
        $(this).find("div.sub-items").toggle();
    });
}

function handheldSidenav() {
    $(".nav-list > li").off('mouseover').off('mouseout');
    $(".nav-list > li").on('click', function(e) {
        if ($(this).find("div.sub-items").is(':hidden')) {
            $(this).find("a:first").addClass('active').next().slideDown('slow');
        } else {
            $(this).find("a:first").removeClass('active').next().slideUp('slow');
        }
        e.preventDefault();
    });
}

Now I check the window size before doing anything else an I'll hold the device type in device variable. If window is resized, I'm gonna check the device state and do the things based on device type.
if ($window.width() > 767) {
    device = 'desktop';
    desktopSidenav();
} else {
    device = 'handheld';
    handheldSidenav();
}
$window.resize(function() {
    if ($window.width() > 767) {
        if (device == 'handheld') {
            device = 'desktop';
            desktopSidenav();
        }
    } else {
        if (device == 'desktop') {
            device = 'handheld';
            handheldSidenav();
        }
    }
});

If I use delegate and undelegate instead of on and off, the code won't work and I still don't know why, so this cannot be count as a real answer, but I wanted to tell everyone who has a similar problem to use jQuery's on and off instead on delegate.


text:
Q: Showing when an operator $T$ is invertible If $T$ is a linear transformation on $\mathbb{R^n}$ with $\|T-S\|< 1$, and $S$ is the invertible, how can I show $T$ invertible?
I need help for this problem. I think the inverse of $T$ is $S^{-1}\sum_{k=0}^{\infty}(I-TS^{-1})^k$. Since for the similar problem when $S=I$, the $T^{-1}$ would be $\sum_{k=0}^{\infty}(I-T)^k$. I wanted to make similar argument but $S$ can be any invertible operator not just a multiple of $I$.

A: As is stated in the comments, $\|T-S\|<1$ is not strong enough to ensure $T$ is invertible. A sufficient condition is that $\|T-S\|<\|S^{-1}\|^{-1}$, because then
$$\|S^{-1}T-I\|\leq\|S^{-1}\|\|T-S\|<1,$$
and you can apply what you mentioned to show that $S^{-1}T$ is invertible, and therefore $T$ is invertible.


text:
Q: RegEx for matching everything except a text between two words I have a text:
"The quick brown fox jumps over the lazy dog"
and I need to match everything except the text between a word and the first occurrence of a letter after this word as follows (in this case between brown and the first occurrence of "l"):
"The quick brown lazy dog"
I have tried some possible solutions but the closest match I have in my hand is exactly the opposite:
(?<=brown ).*?(?=l)

which matches " fox jumps over the"
EDIT:
I am using Klipfolio tool and the exact text I have is like this:
["String1: value1","String2: value2","String3: value3"]

And I want to match all except value1 and replace it with empty string.
Function I am using is SUBSTITUTE_REGEX

A: As mentioned, the simplest way is to do a string replacement.
To do the inverse is more involved and is done like this:
Find  (.*?brown ).*?(l.*)|(.+)
Replace $1$2$3
https://regex101.com/r/x8QW6r/1

A: You can just use your original pattern and replace the matched part with an empty string "".
Alternative way to do this is to create two match groups, which you can then combine to get the wanted result:
(.*brown )(?:[^l]*)(.*)

Full match  0-43   The quick brown fox jumps over the lazy dog
Group 1.    0-16   The quick brown
Group 2.    35-43  lazy dog

Demo


text:
Q: Framework to use to build a hybrid app using angular2 Iam new to angular 2 and would want to build a hybrid app using angular2. I see that ionic framework can be used or nativescript can also be used. I have used cordova with angular1 but do not know if it supports angular 2 also. Which is the best framework to build a hybrid app using angular2 and why?

A: There are lots of mobile frameworks support angular 2, even  React native you can use React native in Angular 2.
I have use many different hybrid mobile frameworks and at last I find nativescript is best. (For non hybrid frameworks ,Qt is very good.)
For Angular 2: After rc 5, It is very stable.

A: Both NativeScript and Ionic will enable you to build a mobile application using JavaScript (Angular 2).
With Ionic (version 2) you can use html and creating new elements is relatively easy, you just style the element with css. The application is hybrid as you mentioned - native app with webview, where your code is executed.
With NativeScript you use XML and the set of elements you can use is limited to components that are mapped to native components (ie. there is no html select box). The result is native application - no webview.
My opinion (I have used both technologies recently) - With Ionic you are faster in development and prototyping. With NativeScript you get better performance.
Both of these technologies are being developed and are not stable - because Angular2 is not stable as well.


text:
Q: How can I increase the numbers of posts on the main page of the Soho blogger/WordPress theme? The Soho theme has a section in which you can specify the number of blogs that show on the main page. I set it to 7 (the default number). But it only shows 3 under latest posts and then there is this older Posts link right below. How can I fix it so the 7 posts show on my main page?
I have used google and have not found the answer to this problem.

A: For Recent blog posts
By default, three of your most recent blog posts are displayed on your home page. Under the Home page section of your theme editor, you can control how many posts are displayed (3, 6, 9) or disable them from being shown.
Per Soho Theme Manual: Basic theme setup


text:
Q: Cannot get a selected text or value in ComboBox I have a combox in my wpf application with three items:
<ComboBoxItem Tag="some value">Text</ComboBoxItem>
<ComboBoxItem Tag="some value2">Text2</ComboBoxItem>
<ComboBoxItem Tag="some value3">Text3</ComboBoxItem>

I want to get a selected text or value at runtime. When I do this:
myComboBox.SelectedValue.ToString()

it returns this:
System.Windows.Controls.ComboBoxItem: Text2

How can I get a selected text or value?

A: Because you want the Content property of ComboBoxItem you should try like this:
(myComboBox.SelectedValue as ComboBoxItem).Content.ToString();

Or for Tag:
(myComboBox.SelectedValue as ComboBoxItem).Tag.ToString();

A: you need to cast the SelectedItem property of the Combobox to the object, then you can access the properties. So in your case you need to cast it to ComboBoxItem.

A: You just need to get the tag from the object.
<ComboBox SelectionChanged="Selector_OnSelectionChanged">
    <ComboBoxItem Tag="some value">Text</ComboBoxItem>
    <ComboBoxItem Tag="some value2">Text2</ComboBoxItem>
    <ComboBoxItem Tag="some value3">Text3</ComboBoxItem>
</ComboBox>

    private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        var cb = sender as ComboBox;
        if (cb == null)
        {
            return;
        }

        var selectedItem = cb.SelectedValue as ComboBoxItem;
        if (selectedItem == null)
        {
            return;
        }

        var tag = selectedItem.Tag;

        Debug.WriteLine(tag);
    }

A: Try this
<ComboBox Name="comboBox" SelectedValuePath="Content">
  <ComboBoxItem>text</ComboBoxItem>
  <ComboBoxItem>here</ComboBoxItem>
  <ComboBoxItem>text</ComboBoxItem>
</ComboBox>

Get the value
 var value = comboBox.SelectedValue.ToString()


text:
Q: Spatial Join of Polygons to Polygon Grid with Shared Boundaries in ArcGIS Desktop?
I have polygons containing an attribute to be summed by a polygon grid. the polygons with the attribute always share borders with each grid cell and never extend outside any grid cell (the grid has been used to 'union' the polygons prior).
I am having trouble in ArcMap 10.x getting the 'spatial join' tool using the 'intersect' or 'have their center in' or 'within' match options to assign the sum of the attributes of polygons within each grid cell to an attribute of the grid cell. I think this may be because of share borders, though the 'select by location' tool using 'within' will select the desired polygons.
The layers are the same projection and in the same geodatabase.
Also have set the 'merge rule' parameter of the field to 'sum' in the 'spatial join' tool.
The only work-around I've found is to use 'spatial join' tool with the 'intersect' match option and a 'search radius' set to a negative such as -100 meters.

A: @FelixIP answered this in the comments...
The spatial join is unnecessary when there is a summary statistics function (although the spatial join with 'have their centres' in as the match option should work, it did not for me).
This is useful when there are large polygons with a stat, say, a population estimate. You need to display this data on a common grid (vector). Sometimes two polygons or more intersect with a single grid poly. The following can be used:

*

*First scale your statistic - calculate population per unit area and
add to attribute table

*Union polygons with the poly grid (not
raster)

*Calculate the new population stat for each unioned poly
    - use the pop per unit area multiplied by the area of each unioned poly

*Summary statistics with the Gridcell ID as unique summary field

*Join output of (4) back to the poly grid using the Gridcell ID as unique case field


text:
Q: Trying to read from a file and skip punctuation in C++, tips? I'm trying to read from a file, and make a vector of all the words from the file. What I tried to do below is have the user input the filename, and then have the code open the file, and skip characters if they aren't alphanumeric, then input that to a file.
Right now it just closes immediately when I input the filename. Any idea what I could be doing wrong?
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

int main()
{

string line; //for storing words
vector<string> words; //unspecified size vector
string whichbook;
cout << "Welcome to the book analysis program. Please input the filename of the book you would like to analyze: ";
cin >> whichbook;
cout << endl;

ifstream bookread;
//could be issue
//ofstream bookoutput("results.txt");

bookread.open(whichbook.c_str());
//assert(!bookread.fail());

if(bookread.is_open()){
    while(bookread.good()){
        getline(bookread, line);
        cout << line;
        while(isalnum(bookread)){
            words.push_back(bookread);
        }
    }
}
cout << words[];
}

A: I think I'd do the job a bit differently. Since you want to ignore all but alphanumeric characters, I'd start by defining a locale that treats all other characters as white space:
struct digits_only: std::ctype<char> {
    digits_only(): std::ctype<char>(get_table()) {}

    static std::ctype_base::mask const* get_table() {
        static std::vector<std::ctype_base::mask>
            rc(std::ctype<char>::table_size,std::ctype_base::space);

        std::fill(&rc['0'], &rc['9']+1, std::ctype_base::digit);
        std::fill(&rc['a'], &rc['z']+1, std::ctype_base::lower);
        std::fill(&rc['A'], &rc['Z']+1, std::ctype_base::upper);
        return &rc[0];
    }
};

That makes reading words/numbers from the stream quite trivial. For example:
int main() {
    char const test[] = "This is a bunch=of-words and 2@numbers#4(with)stuff to\tseparate,them, I think.";
    std::istringstream infile(test);
    infile.imbue(std::locale(std::locale(), new digits_only));

    std::copy(std::istream_iterator<std::string>(infile),
              std::istream_iterator<std::string>(),
              std::ostream_iterator<std::string>(std::cout, "\n"));

    return 0;
}

For the moment, I've copied the words/numbers to standard output, but copying to a vector just means giving a different iterator to std::copy. For real use, we'd undoubtedly want to get the data from an std::ifstream as well, but (again) it's just a matter of supplying the correct iterator. Just open the file, imbue it with the locale, and read your words/numbers. All the punctuation, etc., will be ignored automatically.

A: The following would read every line, skip non-alpha numeric characters and add each line as an item to the output vector. You can adapt it so it outputs words instead of lines. I did not want to provide the entire solution, as this looks a bit like a homework problem.
#include <vector>
#include <sstream>
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    string line; //for storing words
    vector<string> words; //unspecified size vector
    string whichbook;
    cout << "Welcome to the book analysis program. Please input the filename of the book you would like to analyze: ";
    cin >> whichbook;
    cout << endl;

    ifstream bookread;
    //could be issue
    //ofstream bookoutput("results.txt");

    bookread.open(whichbook.c_str());
    //assert(!bookread.fail());

    if(bookread.is_open()){
         while(!(bookread.eof())){
            line = "";
            getline(bookread, line);

            string lineToAdd = "";

            for(int i = 0 ; i < line.size(); ++i)
            {
                if(isalnum(line[i]) || line[i] == ' ')
                {
                    if(line[i] == ' ')
                        lineToAdd.append(" ");
                    else
                    { // just add the newly read character to the string 'lineToAdd'
                        stringstream ss;
                        string s;
                        ss << line[i];
                        ss >> s;
                        lineToAdd.append(s);
                    }
                }
            }

            words.push_back(lineToAdd);

        }
    }
    for(int i = 0 ; i < words.size(); ++i)
    cout << words[i] + " ";

    return 0;
}


text:
Q: Adding parameters in ...args I am making a debug console.log wrapper like this:
debug = logger('[DEBUG] ' + ...args)
info = logger('[INFO] ' + ...args)
warn = logger('[WARN] ' + ...args)
error = logger('[ERR] ' + ...args)

function logger (...args) {
   console.log(arguments[0] + ' ' + arguments[1])
}

info('This is some info')
debug('This is some debug')
warn('This is some warn')
error('This is some error')

But I am getting an error:
SyntaxError: expected expression, got '...'

How can I pass a parameter before the ...args? Or any other SIMPLE way I can do what I want to achieve above?
Fiddle:
http://jsfiddle.net/keechan/e3wxLjmt/29/

A: You can accept a string parameter in your logger function and return a new function that prepends the string before logging.
function logger (str) {
   return function(...args){
       console.log(str, ...args);
   }
}
debug = logger('[DEBUG]')
info = logger('[INFO]')
warn = logger('[WARN]')
error = logger('[ERR]')

Demo!

A: I think you've mixed up how the rest operator works and where it needs to be defined.  Also, you pass args but then try to use arguments.  Here is a working solution that converts your declarations to functions that accept args, and then use it in logger:

const debug = (args) => logger('[DEBUG] ' + args)
const info = (args) => logger('[INFO] ' + args)
const warn = (args) => logger('[WARN] ' + args)
const error = (args) => logger('[ERR] ' + args)

function logger (...args) {
   console.log(args[0] + ' ' + args[1])
}

info('This is some info')
debug('This is some debug')
warn('This is some warn')
error('This is some error')

Keep in mind though, in the above you're still not really using the function the way you intended-- we're only passing a single argument (the two strings pre-concatenated).  But you can see that it also works if you pass separate args:

const debug = (msg) => logger('[DEBUG] ', msg)
const info = (msg) => logger('[INFO] ', msg)
const warn = (msg) => logger('[WARN] ', msg)
const error = (msg) => logger('[ERR] ', msg)

function logger (...args) {
   console.log(args[0] + ' ' + args[1])
}

info('This is some info');
debug('This is some debug');
warn('This is some warn');
error('This is some error');


text:
Q: private constructor in abstract class scenario Is there is any feasible solution to have private constructor in abstract class..please advise
public abstract class BaseClass
{
    private String member;

    private BaseClass(String member)
    {
        this.member = member;
    }

    ... abstract methods...
}

A: This defeats the purpose of abstract classes:

*

*An abstract class must be subclassed to be used.

*If a method is private, the subclass can't see it.
∴ It's effectively unreachable.
So, no.

EDIT @yshavit has found a hole in this logic which is very true - have a look at his comment (which should probably be an answer to the question?).

A: abstract class can have a private constructor. But that class cannot be extended by another class. Instead of adding a static inner class inside the abstract class and extends that abstract class.
 abstract class  Base{
public abstract void set();

private Base(){
System.out.println("Private Constructor!");
}
static class Derived extends Base{
public void set(){
System.out.println("set() method implemented!");
}
}
public static void main(String[] args){
new Base.Derived().set();
}
}


text:
Q: 401 when accessing Dynamics CRM 2016 Web APIs I am struggling to access the Dynamics 2016 CRM OData Web APIs from a console application.
We have Dynamics CRM 2016 installed, configured with Claims-based authentication, and using AD FS v3.0.
My understanding is that a console app (or web app) should be able to access the Web APIs using Windows integrated authentication (i.e. NTML or Kerberos) without any special treatment ... or maybe the OAuth flow should work when enabled.
For a regular user accessing Dynamics "pages", the authentication works fine (redirection to AD FS log in page), but accessing the OData APIs does not seem to work (for instance : https://crm.domain.org/api/discovery/v8.0/ ) :

*

*in a browser I get a Windows login prompt and typing valid credentials always results in a HTTP 401 unauthorized error

*in a brower, if I navigate to a Web API url after having logged on on the pages , then I can access the Web APIs (i.e. some cookies must be set and I am already implicitly authorized)

*from code, using an HttpClient with specific valid credentials (or current credentials) , I also get a 401

Things I have tried :

*

*if I disable Claims-based authentication completely , HttpClient works fine and I can access the OData APIs

*if I leave Claims-based authentication enabled, and activate OAuth via PowerShell Add-PSSnapin Microsoft.Crm.PowerShell ; $ClaimsSettings = Get-CrmSetting -SettingType OAuthClaimsSettings; $ClaimsSettings.Enabled = $true ; Set-CrmSetting -Setting $ClaimsSettings ;.
Windows integrated authentication still does not work, but using Bearer authentication is now possible. I can use this snippet to retrieve the OAuth Endpoint for token generation, and use AuthenticationContext.AcquireTokenAsync to issue a token, and then pass it in the Authorization HTTP Header ... but then, no matter what, I get this error :
Bearer error=invalid_token, error_description
=Error during token validation!, authorization_uri=https://our.adfs.domain.org/adfs/oauth2/authorize, resource_id=https://crm.domain.org/
Am I missing something ? is that possibly a configuration issue ?

A: From this answer from the dynamics community forum, it looks like the api is pretty strict about the parameters and headers it requires. When doing the request, make sure you have the Cache-Control: no-cache and Content-Type: application/x-www-form-urlencoded headers set.
In the subsequent request to access the api with the retrieved token you should set the Authorization header in the form of Bearer: TOKEN (worth noting since a lot of people actually thought they could directly put the token), the OData-Version: 4.0, Cache-Control: no-cache and Accept: application/json ones too.
Looking at the different OAuth endpoints and the previously linked answer, I'm not sure the authorization uri is the right one (eg https://login.windows.net), so do you make sure that's correct. It's also stated that you should use the OAuth endpoint url and use the WWW-Authenticate header that returns the valid one, even if this route will respond with a 401. I'm sure you already saw this example, but it provides a pretty complete overview of an auth flow and how the token is retrieved using AcquireTokenAsync where you pass your resource and clientID. I might also be looking at an updated page and it's not relevant in your case.
You also want to check if the resource id you specified is the correct one, some people reported to have to specify one in the form of https://crm3.domain.org/ or https://crm4.domain.org/ instead of the bare one, so that could be one thing.

It could also be a configuration issue, given what @l said about the fact an IP would work instead of the domain name. It could very well be a certificate problem, where it's not validated correctly or untrusted, thus creating the error you see even if it's not the appropriate message. Also make sure your 443 port is allowed through your firewall(s).
One interesting post where the author explains that the Form Authentication setting of the AD FS Management Console was required for him to proceed (it's CRM 2013, but might still be related).


text:
Q: Return label of the column which has the maximum value if it is higher than a certain number I have a pandas dataframe with 18 columns, the columns from 2:17 hold numerical values with labels 2-17. I want to add a new column ('category') to the dataframe to include the label of the column which holds the maximum value if that value is higher than a certain number (0.5). I used the below code after utilizing a related question on #Pandas (python): max in columns define new value in new column
  test_df['Category'] = test_df.values[:,2:18].argmax(1) if (test_df.values[:,2:18].max(1) >=0.5) else 'none'

when I run the above code, I get the error message "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()", any advice is appreciated.

A: Use mask to hide row where no values are greater than 0.5 then extract the column name with idxmax.
test_df['Category'] = (
    test_df.iloc[:, 2:18].mask(~test_df.iloc[:, 2:18].ge(0.5).any(1), other=pd.NA)
           .idxmax(1).fillna('none')
)

Output:
>>> test_df
       A     B      col0      col1      col2      col3      col4      col5      col6      col7      col8      col9     col10     col11     col12     col13     col14     col15 Category
0  alpha  beta  0.004926  0.262662  0.059676  0.026302  0.360741  0.256310  0.472451  0.340764  0.472086  0.379545  0.437554  0.435562  0.438726  0.503708  0.193708  0.260441    col13
1  alpha  beta  0.178689  0.326015  0.514489  0.050754  0.391687  0.153947  0.157198  0.396039  0.009823  0.275651  0.454966  0.204654  0.111680  0.250095  0.297196  0.183910     col2
2  alpha  beta  0.513636  0.019905  0.418037  0.188359  0.393665  0.481321  0.196138  0.507833  0.042835  0.022343  0.156208  0.191423  0.258029  0.351852  0.354429  0.301106     col0
3  alpha  beta  0.042417  0.472806  0.020204  0.411681  0.019293  0.140623  0.108013  0.136260  0.490850  0.004276  0.212354  0.470580  0.107478  0.011461  0.366930  0.100539     none
4  alpha  beta  0.287596  0.317487  0.520418  0.048656  0.033835  0.519975  0.237952  0.449427  0.211287  0.204319  0.465478  0.343144  0.408842  0.050700  0.508506  0.169613     col2
5  alpha  beta  0.154299  0.369279  0.188567  0.083248  0.004332  0.436839  0.329708  0.458652  0.329425  0.068757  0.238121  0.102302  0.497296  0.219990  0.041560  0.455992     none
6  alpha  beta  0.361315  0.010401  0.039190  0.013335  0.236268  0.268206  0.407632  0.149902  0.041239  0.481870  0.338411  0.430095  0.335075  0.405940  0.108008  0.393766     none
7  alpha  beta  0.087221  0.146438  0.202438  0.132151  0.126972  0.442878  0.011017  0.471010  0.229542  0.139989  0.476444  0.294640  0.057385  0.369218  0.433006  0.388687     none
8  alpha  beta  0.519944  0.083779  0.520042  0.382255  0.315839  0.083350  0.038597  0.114521  0.160149  0.424750  0.192139  0.457243  0.054164  0.252922  0.133647  0.240518     col2
9  alpha  beta  0.246072  0.172740  0.002171  0.046882  0.132817  0.365952  0.252149  0.516113  0.050739  0.054263  0.331012  0.493549  0.433013  0.484111  0.118902  0.475689     col7

Setup MRE
np.random.seed(2022)
test_df = pd.DataFrame(np.random.random((10, 16))) / 1.9
test_df.columns = 'col' + test_df.columns.astype(str)
tmp_df = pd.DataFrame({'A': 'alpha', 'B': 'beta'}, index=test_df.index)
test_df = pd.concat([tmp_df, test_df], axis=1)


text:
Q: Are link (non-splittable) quandles complete invariant up to orientation? I am reading knot quandles. I read that knot quandles are complete knot invariant upto orientation from thesis of David joyce, An Algebraic Approach to Symmetry with Applications to Knot Theory, page no. $53$. In the proof it is used that in case of knot, the knot group act transitively on the knot quandle. While reading the book "Surface-Knots in 4-Space: An Introduction" by Seiichi Kamada, on page no.$152$ it is mentioned in the comment $22$: "A similar result holds when $K$ and $K'$ are non-splittable oriented links.
I am not able to prove it, because in case of links with more that one component, the action of link group on link quandle is not transitive.
Can someone help me? Any suggestions or hints would be helpful.

A: Edit: Many thanks to Lorenzo Traldi for helping me understand the correct statement for the way in which the fundamental quandle is a complete invariant.
Let me review here a definition of quandles and how the proof goes that they are a complete invariant of oriented knots up to orientation-reversed mirror image.
The link quandle $Q(L,*)$ of an oriented link $L\subset S^3$ with basepoint $*\in S^3-\nu(L)$ is the collection of all homotopy classes of paths from $*$ to $\partial(S^3-\nu(L))$ (where $\nu(L)$ is a tubular neighborhood of $L$, and where the homotopies allow the end to slide along $\partial(S^3-\nu(L))$), along with

*

*A function $\lambda:Q(L,*)\to \pi_1(S^3-\nu(L),*)$ given by $p\mapsto p\; \overline{\mu_{p(1)}}\; \overline{p}$, where $\mu_{p(1)}$ is some meridian loop in $\nu(L)$ at $p(1)$ having $+1$ linking number with $L$. (Note: this requires knowing $L\subset S^3$ and cannot in general be recovered from $S^3-\nu (L)$). This is the loop corresponding to a path, hence $\lambda$.

*A group action of $\pi_1(S^3-\nu(L),*)$ on $Q(L,*)$ by $g\cdot p=gp$ (concatenation).
These form an enriched quandle in the following sense:

*

*$g\lambda_p g^{-1}=\lambda_{gp}$ for all $g\in \pi_1(S^3-\nu(L))$ and $p\in Q(L)$.

*$\lambda_pp=p$ for all $p\in Q(L)$.

If you substitute in $g=\lambda_q$, you can get $\lambda_q\lambda_pr=\lambda_{\lambda_q p}\lambda_q r$, which with $y\triangleright x:=\lambda_xy$ renders as $(r\triangleright p)\triangleright q=(r\triangleright q)\triangleright(p\triangleright q)$.  The second renders as $p\triangleright p=p$.
The non-enriched version of the quandle is from forgetting $\pi_1(S^3-L)$ and instead considering the map as $\lambda:Q(L,*)\to\operatorname{Aut}(Q(L,*))$, which sends each element of $Q(L,*)$ to its action on $Q(L,*)$. (Quandles are also known as automorphic sets.)  Up to an automorphism of a peripheral group system for $\pi_1(S^3-L)$, the enriched quandle structure can be recovered from the quandle.
A note about $\lambda$: the image $\lambda(Q(L))$ is a union of conjugacy classes of $\pi_1(S^3-\nu(L))$, due to $g\lambda_p g^{-1}=\lambda_{gp}$.  In particular, through the construction each conjugacy class corresponds to the free homotopy class of some meridian --- one class per link component --- so the quandle is certainly not transitive for links of more than one component.  It's worth knowing that $\lambda(Q(L))$ generates $\pi_1(S^3-\nu(L))$, with a quick reason being from the Wirtinger presentation.
Another note about it: $\lambda$ is functorial in the sense that if there is a quandle homomorphism $f:Q(L)\to Q(L')$, then there is an induced homomorphism $f_*:\pi_1(S^3-\nu(L))\to \pi_1(S^3-\nu(L'))$ compatible with $\lambda$.  (In a way, this induced homomorphism is part of the definition of the (enriched) quandle homomorphism, so this is just putting different terminology on the concept.)
Theorem 1. For an oriented knot $K$, $Q(K)$ is a complete invariant of the knot, up to orientation-reversed mirror image.
Proof. Fix an element $p\in Q(K)$, which represents a particular choice of meridian for $K$.  Let $G=\pi_1(S^3-\nu(K))$ and $H=\operatorname{Stab}_G(p)$.

*

*For $g\in \pi_1(\partial\nu(K),p(1))$, $(pg\overline{p})p\sim p$ in $Q(K)$, hence  $p\pi_1(\partial\nu(K),p(1))\overline{p}\subseteq H$.

*For $g\in H$, since $gp\sim p$, we can take the edge of this homotopy to get a path $h$ from $gp(1)$ to $p(1)$ in $\partial\nu(K)$.  We can write $g=p\overline{h}\overline{p}$, which is in $p\pi_1(\partial\nu(K),p(1))\overline{p}$.
Thus, $H=p\pi_1(\partial\nu(K),p(1))\overline{p}$.  That is, we can recover a peripheral subgroup and a meridian.  Suppose there is an oriented knot $K'$ with $Q(K)\cong Q(K')$, and let $p'$ be the image of $p$ in $Q(K')$.  By functoriality, there is an isomorphism $G\cong G'=\pi_1(S^3-\nu K')$, and it carries $H$ to $H'=\operatorname{Stab}_{G'}(p')$, which by the above argument is a peripheral subgroup.  Since knot complements are Haken manifolds with connected boundaries, Waldhausen '68 applies and there is a homeomorphism $S^3-\nu (K)\cong S^3-\nu (K')$ carrying oriented meridian to oriented meridian.  The meridians allow us to glue solid tori into the knot complements in a way that the homeomorphism extends to all of $S^3$.  If the homeomomorphism is orientation-preserving, then $K$ and $K'$ are isotopic.  Otherwise, if it is orientation-reversing, then $K$ and the mirror image $mK'$ as unoriented knots are isotopic.  The orientation of a meridian determines the orientation of a knot, so since the mirror image reverses the orientation of a meridian, it is that $K$ and $-mK'$ are isotopic as oriented knots. Q.E.D.
Theorem 2. For a nonsplit oriented link $L$, $Q(L)$ is a complete invariant of the link, up to orientation-reversed mirror image.
Proof. Let $L$ be a nonsplit link having components $L_1,\dots,L_k$.  Define an equivalence relation on $Q(L)$ generated by $p_1\sim p_2$ if there exists a $q\in Q(L)$ such that $p_1=\lambda_qp_2$.
Equivalence classes are in one-to-one correspondence with components of $L$, so choose a representative element $p_i\in Q(L)$ for each component, with $p_i(1)\in\partial\nu(L_i)$ (though we might not know which corresponds to which component).  With $H_i=\operatorname{Stab}_{G}(p_i)$, as before we get peripheral subgroups $H_i=p_i\pi_1(\partial\nu(L_i),p_i(1))\overline{p_i}$. Since $L$ is nonsplit, then $S^3-\nu(L)$ is a Haken manifold, so by Lemmas 13.8 and 13.7 in Hempel we get from the isomorphism $G\cong G'$ that carries each $H_i$ to $H_i'$ a homeomorphism $S^3-\nu(L)\cong S^3-\nu(L')$ when $L'$ is another nonsplit link with $Q(L)\cong Q(L')$.  By a similar argument as before using the meridians implied by the $p_i$'s, either $L$ and $L'$ or $L$ and $-mL'$ are isotopic. Q.E.D.
This result is a consequence of Theorem 5.2 and Corollary 5.3 of
Fenn, Roger; Rourke, Colin, Racks and links in codimension two, J. Knot Theory Ramifications 1, No. 4, 343-406 (1992). ZBL0787.57003.
For them, a link $L$ in $S^3$ is an oriented link, and they view the orientation in terms of consistently orienting the transverse disks of a tubular neighborhood for $L$ (the link is transversely oriented). Stated for quandles, they prove that if $Q(L)$ and $Q(L')$ are isomorphic for non-split links $L$ and $L'$ in $S^3$, then there is a homeomorphism $h : S^3 \to S^3$ carrying $L$ to $L'$ and transverse orientations to transverse orientations (equivalently, oriented meridians to oriented meridians).  If $h$ is orientation-preserving, then $L \sim L'$, and if $h$ is orientation-reversing, $L \sim -mL'$.
One can show that $Q(L)\cong Q(-mL)$ and $Q(mL)\cong Q(-L)$, so this is the strongest possible statement.


text:
Q: Scraping Sports Data With Beautifulsoup This is my first-time web scraping with beautiful soup and wanted to do a little project with hockey since I am a huge fan of the sport. I am a little stuck and wondering how to retrieve the header names of the stats for each player.
Here is my current code:
from bs4 import BeautifulSoup
import requests
import re
import pandas as pd

url = "http://www.espn.com/nhl/statistics/player/_/stat/points/year/2020/seasontype/2"

page = requests.get(url)

soup = BeautifulSoup(page.text, 'html.parser')

allStats = []
players = soup.find_all('tr', attrs={'class':re.compile('row player')})
for player in players:
    stats = [stat.get_text() for stat in player.find_all('td')]
    allStats += stats
body = soup.find_all('div', {"class":"wrapper"})

print(allStats)

allColumns = []
headers = soup.find_all('tr', attrs = {'class': 'colhead'})
for col in headers:
    columns = [col.get_text() for col in headers.find_all('td')]
    allColumns += columns

print(allColumns)

I am currently getting an error that says "ResultSet object has no attribute '%s' for the line
headers = soup.find_all('tr', attrs = {'class': 'colhead'})

Eventually, I want to get a list of all of the Stat Names being tracked and use that as the columns in a pandas dataframe that lists each player and their corresponding stats.
What's the best way to achieve this?
Thanks for your help!

A: There's a typo in your headers iteration that's why you're getting the error,
AttributeError: ResultSet object has no attribute 'find_all'. You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?

I suppose the expected result is as follows.
allColumns = []
headers = soup.find_all('tr', attrs = {'class': 'colhead'})
for header in headers:
    columns = [head.get_text() for head in header.find_all('td')]
    allColumns += columns
>>>
['', 'PP', 'SH', 'RK', 'PLAYER', 'TEAM', 'GP', 'G', 'A', 'PTS', '+/-', 'PIM', 'PTS/G', 'SOG', 'PCT', 'GWG', 'G', 'A', 'G', 'A', '', 'PP', 'SH', 'RK', 'PLAYER', 'TEAM', 'GP', 'G', 'A', 'PTS', '+/-', 'PIM', 'PTS/G', 'SOG', 'PCT', 'GWG', 'G', 'A', 'G', 'A', '', 'PP', 'SH', 'RK', 'PLAYER', 'TEAM', 'GP', 'G', 'A', 'PTS', '+/-', 'PIM', 'PTS/G', 'SOG', 'PCT', 'GWG', 'G', 'A', 'G', 'A', '', 'PP', 'SH', 'RK', 'PLAYER', 'TEAM', 'GP', 'G', 'A', 'PTS', '+/-', 'PIM', 'PTS/G', 'SOG', 'PCT', 'GWG', 'G', 'A', 'G', 'A']

A: Just as alternative, there is an espn api to get the statistics. But it's not documented as to how to pull a specicif season or season type:
http://site.api.espn.com/apis/site/v2/sports/football/nfl/statistics
However, you can pull out player stats from the nhl.com site with their api:
import requests
import pandas as pd

url = 'https://statsapi.web.nhl.com/api/v1/teams'
jsonDataTeams = requests.get(url).json()

teamsDict = {}
for team in jsonDataTeams['teams']:
    rosterLink = 'https://statsapi.web.nhl.com' + team['link'] + '/roster'
    teamsDict.update({team['name']:rosterLink})

playersDict = {}
for team, link in teamsDict.items():
    jsonDataPlayers = requests.get(link).json()
    for player in jsonDataPlayers['roster']:
        playerLink = 'https://statsapi.web.nhl.com' + player['person']['link'] + '/stats'
        playersDict.update({player['person']['fullName']:playerLink})
    print ('Downloaded: %s' %team)

rows = []
count = 0
tot = len(playersDict)
for player, link in playersDict.items():
    count+=1
    payload = {'stats':'statsSingleSeason',
               'season':'20192020'}
    playerStats = requests.get(link, params=payload).json()
    try:
        row = playerStats['stats'][0]['splits'][0]['stat']
        row.update({'player':player})
        rows.append(row)
        print ('%s of %s - Stats collected for: %s' %(count,tot,player))
    except:
        print ('%s of %s - No stats available for: %s' %(count,tot,player))

df = pd.DataFrame(rows)

Output:
print(df.head(20).to_string())
   timeOnIce   ot  shutouts  ties  wins  losses   saves  powerPlaySaves  shortHandedSaves  evenSaves  shortHandedShots  evenShots  powerPlayShots  savePercentage  goalAgainstAverage  games  gamesStarted  shotsAgainst  goalsAgainst timeOnIcePerGame  powerPlaySavePercentage  shortHandedSavePercentage  evenStrengthSavePercentage               player  assists  goals   pim  shots   hits  powerPlayGoals  powerPlayPoints powerPlayTimeOnIce evenTimeOnIce penaltyMinutes  faceOffPct  shotPct  gameWinningGoals  overTimeGoals  shortHandedGoals  shortHandedPoints shortHandedTimeOnIce  blocked  plusMinus  points  shifts evenTimeOnIcePerGame shortHandedTimeOnIcePerGame powerPlayTimeOnIcePerGame
0    2340:03  3.0       1.0   0.0  16.0    20.0  1186.0           132.0              26.0     1028.0              29.0     1110.0           155.0           0.917              2.7692     40          39.0        1294.0         108.0            58:30                85.161290                  89.655172                   92.612613       Corey Crawford      NaN    NaN   NaN    NaN    NaN             NaN              NaN                NaN           NaN            NaN         NaN      NaN               NaN            NaN               NaN                NaN                  NaN      NaN        NaN     NaN     NaN                  NaN                         NaN                       NaN
1    1179:36  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     69           NaN           NaN           NaN            17:05                      NaN                        NaN                         NaN         Travis Zajac     16.0    9.0  28.0   72.0   58.0             1.0              1.0              39:55        942:36             28       52.84     12.5               1.0            0.0               1.0                3.0               197:05     39.0      -12.0    25.0  1476.0                13:39                       02:51                     00:34
2    1504:25  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     68           NaN           NaN           NaN            22:07                      NaN                        NaN                         NaN          P.K. Subban     11.0    7.0  79.0  151.0   88.0             2.0              6.0             160:14       1232:41             79        0.00      4.6               3.0            0.0               0.0                0.0               111:30     90.0      -21.0    18.0  1883.0                18:07                       01:38                     02:21
3    1112:11  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     65           NaN           NaN           NaN            17:06                      NaN                        NaN                         NaN        Kyle Palmieri     20.0   25.0  41.0  155.0   74.0            11.0             18.0             206:17        891:54             41       32.43     16.1               3.0            1.0               0.0                0.0                14:00     36.0       -4.0    45.0  1374.0                13:43                       00:12                     03:10
4    1020:59  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     51           NaN           NaN           NaN            20:01                      NaN                        NaN                         NaN       Dmitry Kulikov      8.0    2.0  32.0   54.0  104.0             0.0              0.0              06:20        944:51             32        0.00      3.7               1.0            0.0               0.0                0.0                69:48     77.0       -4.0    10.0  1241.0                18:31                       01:22                     00:07
5     538:48  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     27           NaN           NaN           NaN            19:57                      NaN                        NaN                         NaN          Ryan Murray      7.0    2.0   4.0   32.0   12.0             0.0              2.0              23:15        460:25              4        0.00      6.3               0.0            0.0               0.0                0.0                55:08     50.0       -9.0     9.0   708.0                17:03                       02:02                     00:51
6    1584:26  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     69           NaN           NaN           NaN            22:57                      NaN                        NaN                         NaN       Damon Severson     23.0    8.0  52.0  114.0   81.0             3.0             10.0             137:22       1277:50             52        0.00      7.0               2.0            0.0               0.0                0.0               169:14     97.0      -20.0    31.0  1924.0                18:31                       02:27                     01:59
7     417:53  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     29           NaN           NaN           NaN            14:24                      NaN                        NaN                         NaN       Connor Carrick      5.0    1.0  17.0   25.0   27.0             0.0              0.0              02:29        402:01             17        0.00      4.0               1.0            0.0               0.0                0.0                13:23     39.0       -6.0     6.0   564.0                13:51                       00:27                     00:05
8     969:45  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     66           NaN           NaN           NaN            14:41                      NaN                        NaN                         NaN         Nikita Gusev     31.0   13.0  12.0  158.0   12.0             5.0             15.0             164:10        805:25             12       33.33      8.2               2.0            0.0               0.0                0.0                00:10      7.0      -15.0    44.0  1173.0                12:12                       00:00                     02:29
9     677:27  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     43           NaN           NaN           NaN            15:45                      NaN                        NaN                         NaN     Andreas Johnsson     13.0    8.0  14.0   78.0   43.0             4.0              5.0              86:53        581:07             14        0.00     10.3               1.0            0.0               0.0                0.0                09:27     21.0        0.0    21.0   897.0                13:30                       00:13                     02:01
10   1003:22  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     56           NaN           NaN           NaN            17:55                      NaN                        NaN                         NaN         Will Butcher     17.0    4.0   6.0   62.0   31.0             0.0              1.0              72:35        918:16              6        0.00      6.5               1.0            0.0               0.0                0.0                12:31     75.0       -8.0    21.0  1269.0                16:23                       00:13                     01:17
11    899:52  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     68           NaN           NaN           NaN            13:14                      NaN                        NaN                         NaN           Miles Wood     12.0   11.0  57.0  141.0  102.0             0.0              0.0              53:47        841:58             57        0.00      7.8               1.0            0.0               0.0                0.0                04:07     26.0      -19.0    23.0  1169.0                12:22                       00:03                     00:47
12   1057:23  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     65           NaN           NaN           NaN            16:16                      NaN                        NaN                         NaN          Pavel Zacha     24.0    8.0  14.0   97.0   62.0             3.0              8.0             106:40        818:37             14       43.27      8.2               1.0            0.0               2.0                4.0               132:06     19.0      -12.0    32.0  1343.0                12:35                       02:01                     01:38
13   2684:01  8.0       3.0   0.0  22.0    14.0  1328.0           160.0              36.0     1132.0              42.0     1225.0           185.0           0.915              2.7720     47          43.0        1452.0         124.0            57:06                86.486486                  85.714286                   92.408163  Mackenzie Blackwood      NaN    NaN   NaN    NaN    NaN             NaN              NaN                NaN           NaN            NaN         NaN      NaN               NaN            NaN               NaN                NaN                  NaN      NaN        NaN     NaN     NaN                  NaN                         NaN                       NaN
14    838:58  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     60           NaN           NaN           NaN            13:58                      NaN                        NaN                         NaN         Jesper Bratt     16.0   16.0   6.0  101.0   29.0             1.0              6.0             120:47        716:17              6       23.07     15.8               2.0            0.0               0.0                0.0                01:54     22.0       -6.0    32.0  1096.0                11:56                       00:01                     02:00
15    122:45  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     12           NaN           NaN           NaN            10:13                      NaN                        NaN                         NaN       Michael McLeod      2.0    0.0   4.0   11.0   19.0             0.0              0.0              00:12        120:51              4       50.00      0.0               0.0            0.0               0.0                0.0                01:42      6.0        4.0     2.0   158.0                10:04                       00:08                     00:01
16   1047:32  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     58           NaN           NaN           NaN            18:03                      NaN                        NaN                         NaN        Nico Hischier     22.0   14.0  12.0  123.0   48.0             2.0             10.0             155:56        838:15             12       51.73     11.4               1.0            0.0               1.0                2.0                53:21     37.0      -16.0    36.0  1278.0                14:27                       00:55                     02:41
17    967:47  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     61           NaN           NaN           NaN            15:51                      NaN                        NaN                         NaN          Jack Hughes     14.0    7.0  10.0  123.0   12.0             4.0              9.0             193:42        772:59             10       36.14      5.7               2.0            1.0               0.0                0.0                01:06     21.0      -26.0    21.0  1104.0                12:40                       00:01                     03:10
18   1523:44  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     68           NaN           NaN           NaN            22:24                      NaN                        NaN                         NaN          Ryan Pulock     25.0   10.0  14.0  163.0  110.0             3.0              8.0             120:08       1302:12             14        0.00      6.1               3.0            1.0               0.0                0.0               101:24    139.0        8.0    35.0  1788.0                19:09                       01:29                     01:46
19   1106:16  NaN       NaN   NaN   NaN     NaN     NaN             NaN               NaN        NaN               NaN        NaN             NaN             NaN                 NaN     64           NaN           NaN           NaN            17:17                      NaN                        NaN                         NaN       Johnny Boychuk      9.0    2.0  14.0   96.0  135.0             1.0              1.0              05:24        968:51             14        0.00      2.1               0.0            0.0               0.0                0.0               132:01    128.0      -11.0    11.0  1420.0                15:08                       02:03                     00:05


text:
Q: Best Toroid winding I want to build a steplizer transformer to generate 3kv. I understand the principal of turns ratio in a transformer, but don't understand the optimal amount of turns. How many turns required to give best voltage and current. How would I optimize this?
Here is what I have so far for my physical dimensions:
Core ID - 86mm (8.6cm) OD - 170mm (17cm) H - 66mm (6.6cm)
Wire D - 3mm

A: With a transformer, you don't 'optimise' the number of turns, you use the minimum number of turns possible, so as to use as little wire, that will meet the magnetic requirements of the core.
That's a big core you have there, so I'll assume it's made of iron, and is for 240v mains. Obviously as assumptions become clearer, any wrong assumptions and the resulting maths can be corrected.
You have to have enough turns on the core so that changes in field in the core can generate a voltage equal to the input.
Any iron core should support 1.5T peak comfortably. At mains frequency of 50Hz, the field is changing at a peak of \$2\pi fB_{max}\$, so 6.3x50x1.5 = 472 T/s. High quality iron may support more, perhaps 1.7T, but 1.5 is a safer limit.
That field is operating over the cross sectional area of the core, which is 42mm * 66mm, to give a peak flux change of 472*66m*42m of 1.3Weber/s. There will be some insulation within this cross section, say approaching 10%, so we'll reduce the 1.3 down to 1.2 for safety.
This toroidal core will therefore generate up 1.2v per turn peak, at 50Hz (20% more at 60Hz).
For a maximum input voltage of 240v rms = 340v peak, you will need at least 283 primary turns. You could use more, to reduce the field. As you want to make a steplizer, it's possible your input voltage may at times be higher, so you should increase the number of turns to match your specification.
A rule of thumb for current density in modest sized transformers is 3A/mm2. 3mm diameter wire has an area of 7mm2, so you should get 20A through this wire with modest heating. 20A * 240v is 4.8kVA.
The toroid has a hole of 86mm diameter, which is an area of 5800mm2. A fill factor of 50% would be extraordinarily good going, so don't assume you can put more than 2900/7 = 400 turns of 3mm wire through it.
It sounds like you have the right size of wire and right size of core for a 3kVA 240v auto-transformer, can you confirm mkeith's surmises?


text:
Q: whats the significance between having the java class containing the main method setup as public and not When I started learning Java I too started with the ubiqutous Hello world app. Which is more or less like :
public class MyClass {

 public static void main(String args[]){

    //some code here....

 }

}

Its been many years since my tryst with Java but recently I was confronted by a beginner with a problem : Her class file wouldn't run even though she was able to compile correctly.
After looking at her code the first thing I noticed was that is didn't have the public access specifier on the class with the main method. I immediately mocked her on that slip up and went about "fixing" it by adding the public access modifier. The joke was on me offcourse as that didn't make any difference either. I then realized that she was trying to execute the compiled class from a different directory from the one where the class file was. I changed to that dir and issued the java command and it ran immediately.
This brings me to my question... Most hello world examples have the class setup with public access when its just as ok to not have that at all. So what difference does it make  if at all for a class that contains the main method ?
To help make it clearer as to what we were doing exactly here are the steps :
We had the class in
c:\users\[usersname]\[my documents folder]\myprog.class

and we tried to run it from c:\ (as our working dir) . We did specify the full relative path expecting it to work. like so :
java users\[usersname]\[my documents folder]\myprog

Offcourse this just failed untill I changed into the documents folder making it the current working dir and issuing the command again like so
java myprog

So basically such a call makes sense when you have the class in a package resembling the folder structure prepended to its name. In this case the class is not in any package.

A: The "public" vs. "package" specifier has to do with whether classes in other packages are allowed to "see" the class.
Most hello world programs ignore packages, so they go with the more common public option. Most people never have to learn about other package specifiers (and their limitations) until they actually learn to organize their project into packages. Of course, if you have only one class, it doesn't matter either.
Also, I'm not sure why you mock novice programmers. I've been coding in Java for 10 years and still learn new things all the time.

A: Like any method, visibility to other classes is at stake.  Your main method will be accessible to other classes if you mark it public.

A:
So what difference does it make  if at all for a class that contains the main method ?

It doesn't!
You can happly run the main method of a class with public access modifier or without it.
Your problem was, the class was in a different directory so, the interpreter ( java ) didn't knew where too look at.
Let's say I have:  src/Hello.java
And you compile it with: javac src/Hello.java
It compiles fine, and then you try to execute it: java Hello
but that won't run, not because  the class defined has public access or not, but because the generated .class file is inside the directory src and not right here ( . )
You can specify where do you want the .class files to be placed using the -d option.
See this example:
$mkdir src
$cat >src/Hello.java <<.
> class Hello {
>     public static void main( String [] args ) {
>         System.out.println("Hello, world");
>     }
> }
> .
$javac src/Hello.java
$java Hello
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
Caused by: java.lang.ClassNotFoundException: Hello
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
$cd src/
$java Hello
Hello, world
$cd ..
$ls
src
$rm src/Hello.class
$javac -d . src/Hello.java
$java Hello
Hello, world
$

A: Is it really not required?  Interesting, I have to say that I haven't tried it.
Asides from whether the Java runtime can invoke your main class or not, the access modifiers on that class mean the same as they do for any other.  If a class is public, then other classes can reference it, whereas if its private they won't be able to (with of course protected and default being middle grounds).
Regardless of whether it's strictly necessary to make the main class public, it doesn't make any conceptual sense to do otherwise.  Narrower access definitions can be taken as signs that this class won't be accessed by external aspects, so you're free to change the definition as you see fit.  In this context, your main class is most definitely public and so I'd argue it would be wrong (even if legal) to define it as anything else.

A: A visibility modifier (public, private, or protected) is actually optional.
When you don't specify a visibility modifier, default visibility applies.
Default visibility allows classes in the same package to access whatever it is that has default visibility (whether it's a class, method, or attribute)


text:
Q: buildout - using different python version i have set up buildout project (django to be specific) that has to run in old machine, it works fine in my local system with python 2.7.
In production server it runs python 2.5 and i want to configure buildout that it would download and use 2.6, but only this project not system wide.
So i assume it should use some sort of recipe, but witch and how? I cannot find one. I hope to achieve it only using buildout.cfg file..

A: Buildout specifically supports this scenario. Each part in a buildout can use it's own python interpreter, or you can set one python interpreter globally for all parts. This defaults to the python used to run buildout.
To set the python interpreter used, set the python option to the name of a part that contains an executable option. This can be a part that builds a whole new python interpreter. Here is an example:
[buildout]
python = python
parts =
    python

[python]
recipe = zc.recipe.cmmi
url = http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
executable = ${buildout:directory}/parts/python/bin/python2.6
extra_options=
    --enable-unicode=ucs4
    --with-threads
    --with-readline

Any other parts in this buildout now will use the python 2.6 executable.
You may want to symlink the python script into the buildout bin/ directory as well; the following part would do that for you:
[pythonbin]
recipe = plone.recipe.command
command = ln -s ${python:executable} ${buildout:bin-directory}/python

A: Whichever python you use to do run the initial bootstrap.py is the one that will be used for your entire project.  All paths will reference that specific python and the sitepackages for that specific python will be used.
This is one of the best things about buildout
This is a 32 bit python 2.6:
/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 boostrap.py

This is a 64 bit python 2.7:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python bootstrap.py

Now go look at the bin/ it created.
Then do your actual bin/buildout -c dev.cfg and look at the scripts in the bin.  For my 32 bit example:
For the first one I see in my django file:
#!/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
...
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages',

The accepted answer says you need to compile a whole python.  This is not needed nor advised, though it would mean you have a completely isolated sitepackages.  But there are easier ways to tell buildout to not include the sitepackages.
The answer from esaelPsnoroMoN is actually correct, but s/he didn't describe the solution very well.  (I ignored it myself before)

A: Answer of Martijn Pieters doesnt seem to help me. I need different versions of python inside buildout scripts.
This is my example
[buildout]
parts = py2script
        py3script
index = https://pypi.python.org/simple

[python36]
executable = /usr/bin/python3.6
[python27]
executable = /usr/bin/python2.7

[py3script]
recipe = zc.recipe.egg:scripts
python = python36
eggs = bobo
interpreter = python3_interpreter

[py2script]
recipe = zc.recipe.egg:scripts
python = python27
eggs = bobo
interpreter = python2_interpreter

Every time inside python(2|3)_interpreter scripts will be written that python version which I used for bootstraping. So my buildout.cfg doesnt seem to work as expected.

A: Usually every buildout project contains a bootstrap.py script with is initially run
using the Python interpreter that you need/want for this project. Running bootstrap.py
will locally create/install a buildout and all the stuff you need. The typical usage pattern is:
svn checkout <some_url_of_a_buildout_project>
cd my_project
/path/to/my/python bootstrap.py
bin/buildout


text:
Q: authenticating HTTPS servers using certificates with Browser I am trying to send multiple server certificate for authentification with browser.
Generating multiple selfsigned certificates;

*

*self signed cert1

*self signed cert2

and appending to file like this;
-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----

-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----

On Mozilla browser, if I click on site information, then I can see two cert, but it always
verify with topmost first certificate only.
Is there a way to verify all generated self signed certificate by browser?