text:
Q: Determine User Active Directory Groups from Local Machine off Network My current project requires that I validate a user against Active Directory groups. The catch is, the computer may not always be connected to the domain but users may still need to run the tool. I understand that I can't query Active Directory while I'm not connected, instead I'm trying to query the Machine SAM (MSAM).
I am having trouble determining the current user while I'm disconnected from the network. Here's what I'm using:
PrincipalContext principalctx = new PrincipalContext(ContextType.Machine);
UserPrincipal uprincipal = new UserPrincipal(principalctx);

From this point, how do I ask who is currently logged into the local machine.
When connected to the domain, I can query using UserPrincipal.Current. If I am not connected to the domain it will fail saying "The server could not be contacted". Note: this method is not available using the above code, instead I can forgo the PrincipalContext and directly query the current user. With the current user identified I can query GetGroups() and determine if they're in one of the required groups.
Also, can someone please describe the three ContextType options ApplicationDirectory, Domain, Machine. I'm afraid I don't fully understand each option and therefore may be using it incorrectly.

A: From the top:

My current project requires that I validate a user against Active
  Directory groups. The catch is, the computer may not always be
  connected to the domain but users may still need to run the tool.

At this point, you must therefore accept that any enforced security is able to be bypassed by an attacker since it is entirely enforced on the client.  Not exactly part of the solution, but keep it in mind.

I understand that I can't query Active Directory while I'm not
  connected, instead I'm trying to query the Machine SAM (MSAM).

The Security Accounts Manager only stores the local accounts (MACHINENAME\Administrator and others).  It will not have domain user credentials.  You are thinking of the LSA cache, which remembers the last N domain logins's credentials (where N is a number from 0 to 50 as configured by Group Policy) and the last N SID to name mappings (defaults to 128, configurable via registry).  The Security Accounts Manager only stores domain accounts on a domain controller.

I am having trouble determining the current user while I'm
  disconnected from the network. Here's what I'm using: PrincipalContext
  principalctx = new PrincipalContext(ContextType.Machine);
  UserPrincipal uprincipal = new UserPrincipal(principalctx);
Also, can someone please describe the three ContextType options
  ApplicationDirectory, Domain, Machine. I'm afraid I don't fully
  understand each option and therefore may be using it incorrectly.

As noted above, information is not cached, but the ContextType enum can be described as follows:
From MSDN:

*

*Domain: The domain store. This represents the AD DS store. (As it says, this is for domain accounts, as in LDAP Directory access of Active Directory - which would require network access)

*ApplicationDirectory: The application directory store. This represents the AD LDS store. (AD Lightweight Directory Services (previously known as ADAM) is a smaller version of Active Directory designed to store credentials for a single application.  It is not relevant to this discussion, but also uses LDAP.)

*Machine: The computer store. This represents the SAM store. (Enumerates local accounts only)

From this point, how do I ask who is currently logged into the local
  machine.

You can always examine the logged on user by calling WindowsIdentity.GetCurrent().  This will return the logged in user's SID and Group SIDs, possibly cached, if the login occurred while offline.

When connected to the domain, I can query using UserPrincipal.Current.
  If I am not connected to the domain it will fail saying "The server
  could not be contacted". Note: this method is not available using the
  above code, instead I can forgo the PrincipalContext and directly
  query the current user. With the current user identified I can query
  GetGroups() and determine if they're in one of the required groups.

To determine group membership, check if the group's SID you want is in the identity returned by WindowsIdentity.GetCurrent.  If you are not using the SID in your Access Control system, you can translate a name to an SID by calling SecurityIdentifier.Translate.  You will need to translate it while online, then cache it for use offline.  It is storable as either a string or as binary, so both fit well in the registry.
// while we are online, translate the Group to SID
// Obviously, administrators would be a bad example as it is a well known SID...
var admins = new NTAccount("Administrators");
var adminSid = (SecurityIdentifier)admins.Translate(typeof(SecurityIdentifier));

// store the sid as a byte array on disk somewhere
byte[] adminSIDbytes = new byte[adminSid.BinaryLength];
adminSid.GetBinaryForm(adminSIDbytes, 0);

// at time of check, retrieve the sid and check membership
var sidToCheck = new SecurityIdentifier(adminSIDbytes, 0);
if (!wi.Groups.Contains(sidToCheck))
    throw new UnauthorizedAccessException("User is not a member of required group");

A: Another case:

*

*If you want to use PrincipalContext to get Network Domain name, please make sure you verified authentication and authorization. Like below :get Network Domain name


text:
Q: Joint distribution from marginals of exponential during an exercise on Martingales I came across the following request:
let $X_n \sim \mathcal{E}(n)$ be a sequence of independent random variables, so the pdf is $F_{X_n}= 1 - \exp(-nt)$. Let $S_0 = 0, S_n = X_1+\ldots+X_n$, compute successively:
$$ f_{S_1,S_2}(s,t) \text{ for } t\geq s \geq 0, f_{S_2}(t) \text{ for } t\geq 0 \text{ and } \mathbb{E}(S_1 | S_2) $$
I tried doing the following: $f_{x_1,x_2} = 2 e^{-x_1}\cdot e^{-2x_2} = 2 e^{-x_1-2x_2}$
.
The transformation should be $s_1 = x_1, s_2=x_2+x_1\implies x_2 = s_2-s_1$. The determinant of the Jacobian is $2$, which leads me to :
$$ f_{s_1,s_2}(s,t)= 4\cdot e^{-2t+s}$$
But then, how do I derive the marginal? When I integrate by $ds$ I get $+\infty$...did I do something wrong?

A: Your formula for $f_{s_1,s_2} (s,t)$ is valid only for $s\leq t$ since $s_1 \leq s_2$. $f_{s_1,s_2} (s,t)=0$ for $s>t$. Now you don't end up with a divergent integral, right?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to display data inside the Uppy Dashboard Modal? My clients want me to display the custom button and message inside the Uppy DashboardModal but I'm not able to display that. Anyone can please help me with this?
 <DashboardModal uppy={uppy}
            id={this.props.id || this.uploadModalId}
            inline
            disableStatusBar
            proudlyDisplayPoweredByUppy={false}
            showSelectedFiles={false}
            locale={{
              strings: {
                dropPaste: ''
              }
            }}
            plugins={['Dropbox', 'GoogleDrive']}
            width='100vw'
            height='177px'
          >

Hello World

            <Button>Hi</Button
          </DashboardModal>


text:
Q: Creating a Generic Save() Method for Models I have a fairly simple system, and for the purposes of this question there are essentially three parts:  Models, Repositories, Application Code.
At the core are the models.  Let's use a simple contrived example:
public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

In that same project is a generic repository interface.  At its simplest:
public interface IRepository<T>
{
    T Save(T model);
}

Implementations of that interface are in a separate project and injected with StructureMap.  For simplicity:
public class PersonRepository : IRepository<Person>
{
    public Person Save(Person model)
    {
        throw new NotImplementedException("I got to the save method!");
        // In the repository methods I would interact with the database, or
        // potentially with some other service for data persistence.  For
        // now I'm just using LINQ to SQL to a single database, but in the
        // future there will be more databases, external services, etc. all
        // abstracted behind here.
    }
}

So, in application code, if I wanted to save a model I would do this:
var rep = IoCFactory.Current.Container.GetInstance<IRepository<Person>>();
myPerson = rep.Save(myPerson);

Simple enough, but it feels like it could be automated a lot.  That pattern holds throughout the application code, so what I'm looking to do is create a single generic Save() on all models which would just be a shorthand call to the above application code.  That way one would need only call:
myPerson.Save();

But I can't seem to figure out a way to do it.  Maybe it's deceptively simple and I'm just not looking at it from the correct angle.  At first I tried creating an empty ISaveableModel<T> interface and intended to have each "save-able" model implement it, then for the single generic Save() method I would have an extension on the interface:
public static void Save<T>(this ISaveableModel<T> model)
{
    var rep = IoCFactory.Current.Container.GetInstance<IRepository<T>>();
    model = rep.Save(model);
}

But it tells me that rep.Save(model) has invalid arguments.  It seems that it's not wiring up the type inference as I'd hoped it would.  I tried a similar approach with a BaseModel<T> class from which models would inherit:
public class BaseModel<T>
{
    public void Save()
    {
        this = IoCFactory.Current.Container.GetInstance<IRepository<T>>().Save(this);
    }
}

But the compiler error is the same.  Is there a way to achieve what I'm trying to achieve?  I'm very flexible on the design, so if I'm going about something all wrong on an architectural level then I have room to step back and change the big picture.

A: Would a generic extension method solve it?
public static T Save<T>(this T current)
{
    var rep = IoCFactory.Current.Container.GetInstance<IRepository<T>>();
    rep.Save(current);
}

You can then constrain it to your ISaveableModel<T> interface. Return type above not implemented, but you can put it to a boolean or status flag, whatever.

A: In both approaches, the parameter to the Save() function is not of type T. In the first one, it is ISaveableModel<T>, and in the second, it is BaseModel<T>. Since the repository is a generic based on T, Save method will expect a variable of type T. You can add a simple cast to T before you call Save to fix it.
Alternatively, your IRepostory<T> can be changed to
public interface IRepository<T>
{
    T Save(ISaveableModel<T> model);
}

which makes more sense.


text:
Q: Append columns to list of dataframes using lapply and mapply I have a list of dataframes that to manipulate individually that looks like this:
df_list <- list(A1 = data.frame(v1 = 1:10,
                                v2 = 11:20),
                A2 = data.frame(v1 = 21:30,
                                v2 = 31:40))
df_list

Using lapply allows me to run a function over the list of dataframes like this:
library(tidyverse)
some_func <- function(lizt, comp = 2){
  lizt <- lapply(lizt, function(x){
    x <- x %>%
      mutate(IMPORTANT_v3 = v2 + comp)
    return(x)
  })
}
df_list_1 <- some_func(df_list)
df_list_1

So far so good but I need to run the function multiple times with different arguments so using mapply returns:
df_list_2 <- mapply(some_func,
                    comp = c(2, 3, 4),
                    MoreArgs = list(
                      lizt = df_list
                      ),
                    SIMPLIFY = F
)
df_list_2

This creates a new list of dataframes for each argument fed to the function in mapply giving me 3 lists of 2 dataframes. This is good but the output I'm looking for is to append a new column to each original dataframe for each argument in the mapply that would look like this:
desired_df_list <- list(A1 = data.frame(v1 = 1:10,
                                        v2 = 11:20,
                                        IMPORTANT_v3 = 13:22,
                                        IMPORTANT_v4 = 14:23,
                                        IMPORTANT_v5 = 15:24),
                        A2 = data.frame(v1 = 21:30,
                                        v2 = 31:40,
                                        IMPORTANT_v3 = 33:42,
                                        IMPORTANT_v4 = 34:43,
                                        IMPORTANT_v5 = 35:44))
desired_df_list

How can I wrangle the output of lists of lists of dataframes to isolate and append only the desired new columns (IMPORTANT_v3) to the original dataframe? Also open to other options such as mutating multiple columns inside the lapply using mapply but I haven't figured out how to code that as yet.
Thanks!

A: Solved like this:
main_func <- function(lizt, comp = c(2:4)){
  lizt <- lapply(lizt, function(x){

    df <- mapply(movavg,
                 n = comp,
                 type = "w",
                 MoreArgs = list(x$v2),
                 SIMPLIFY = T
    )
    colnames(df) <- paste0("IMPORTANT_v", 1:ncol(df))
    print(df)
    print(x)
    x <- cbind(x, df)
    return(x)
  })

}
desired_df_list_complete <- main_func(df_list)
desired_df_list_complete

using movavg from pracma package in this example.


text:
Q: Arrive/ arrives/ arrived I don't know what is the exactly form of this verb in this sentence.

I would stay with the person until the emergency service arrives/arrive/arrived?

A:
I would stay with the person until emergency services arrived.

Note that "emergency services" is plural.  At least in the US.
Also note that your use of "would" is ambiguous here.  It could be a hypothetical situation or it could be a situation that happened in reality, over and over, in the past.  The wording is the same but the meaning is quite different.  When asking a question like this you might want to clarify which usage you are referring to, though in this case the answer is the same either way.


text:
Q: Python Multiprocessing iterates over script I am trying my hands upon multiprocessing.pool, and it seems to work fine, except that whole script loops again and again.....
My code -
from multiprocessing import Pool

print "at top!"

arr = [30, 30, 30, 30]

def fib(num):
    if num == 0 or num == 1: return 1
    else: return (fib(num - 1) + fib(num - 2))

def main():
    print "start"
    pool = Pool(processes=4)
    result = [pool.apply_async(fib, args=(arr[i],)) for i in range(4)]
    pool.close()
    pool.join()
    for res in result:
        print res.get()
    print "end"

if __name__ == '__main__':
    main()

print "end of program ?"

And what it returns is this -
at top!
start
at top!
end of program ?
at top!
end of program ?
at top!
end of program ?
at top!
end of program ?
1346269
1346269
1346269
1346269
end
end of program ?

What I don't want is the repeating at top ! and end of program.
I want the main program to freeze at that point and continue only after all the computations are finished.
PS. I am running it on windows 10, 64 - bit. Python 2.7 32 - bit.
Thanks in advance.

A: that's expected if you're running windows, the way that python windows spawns the processes: the script is imported as many times as there are spawned processes. So you cannot have only one "at top" print if you put unindented (at script top level). Same goes for print "end of program ?" of course.
(this doesn't happen on Linux which explains the comments of users saying that they cannot reproduce)
This is also why you had to protect your main with if __name__ == '__main__' test. So to get the expected output you'll have to do:
if __name__ == '__main__':
    print("at top!")
    main()
    print("end of program")


text:
Q: Redux: Another implementation for Selector Pattern The following example shows the usual implementation for the selector pattern. Then I'll discuss the problems of this implementation. After that I'll suggest another implementation that may prove useful.
Usual implementation:
Here is how the root reducer looks like along with public selectors:
// reducers/index.js
import { combineReducers } from 'redux';
import * as Items from './items';
import * as Login from './login';

export default combineReducers({
  login: Login.reducer,
  items: Items.reducer
  // more slices ...
});

// PUBLIC SELECTORS
export const getToken = state => Login.getToken(state.login);
export const getLoginError = state => Login.getError(state.login);
export const isLoginLoading = state => Login.isLoading(state.login);

export const getItems = state => Items.getToken(state.items);
export const getCurrentItem = state => Items.getError(state.items);
export const isItemsLoading = state => Items.isLoading(state.items);

// Selectors for data from other slices
// ...

// Selectors for derived data from multiple slices
export const getOwnedItems = (state) => {
  // ...
};

Here is how a slice reducer look like along with its private selectors:
// reducers/login.js
import {
  // actions ...
} from '../actions';

const defaultState = {
  // ...
};

export const reducer = (state = defaultState, action = {}) => {
  // Reducer ...
};

// PRIVATE SELECTORS
export const getToken = state => state.token;
export const getError = state => state.error;
export const isLoading = state => state.loading;

Another slice reducer and its private selectors:
// reducers/items.js
import {
  // actions ...
} from '../actions';

const defaultState = {
  // ...
};

export const reducer = (state = defaultState, action = {}) => {
  // Reducer ...
};

// PRIVATE SELECTORS
export const getItems = state => state.items;
export const getCurrentItem = state => state.currentItem;
export const isItemsLoading = state => state.isLoading;

The usage of this implementation would be like this:
import { getLoginError, isLoginLoading } from '../reducers';

const mapStateToProps = state => {
  return {
    error: getLoginError(state),
    loading: isLoginLoading(state)
  };
};

The Problem:
The previous implementation of selectors requires all public selectors to be defined in reducers/index.js. Notice that public selectors receives the full state which is managed by the root reducer defined in reducers/index.js.
Public selectors can be divided into two types. Extraction selectors just for extracting data from the state. And Derived information Selectors which computes derived information from the state. For the users all selectors are the same and their purpose is to separate the client code from the shape of the state.
First problem with the previous implementation is that all extraction selectors are written twice. Once as a public selector and another as a private selector where the public selector is calling the private one.
Second problem is that all private selectors for specific slice can only receive that slice but it is passed many times, once for each usage instance of a private selector for that slice which seems a good case for refactoring.
The following is another implementation for selectors that could prove useful:
Another implementation
The root reducer file will only provide one select() function which takes the full state and provide the public interface from which client code can retrieve data from the state.
The interface may consist of functions or collections of functions grouped under a name.
This structure allow us to provide an interface that will make implementing extraction selectors trivial in addition to the ability to provide more customized public selectors.
Please don't confuse the structure of the selector with the shape of the state. There is not coupling between the two. The public selector can still implement the same interface for the application even if the shape of the state changed.
Here is the public selectors implemented in select(state) function:
// reducers/index.js
import { combineReducers } from 'redux';
import * as Items from './items';
import * as Login from './login';

export default combineReducers({
  login: Login.reducer,
  items: Items.reducer
  // more slices ...
});

// PUBLIC SELECTORS
export const select = (state) => {
  return {
    login: Login.select(state.login),
    items: Items.select(state.items),

    // Selectors for drived data from multiple slices
    getOwnedItems: () => {
      // ...
    }
  };
};

Here is private selectors inplemented in the same way:
// reducers/login.js
import {
  // actions ...
} from '../actions';

const defaultState = {
  // ...
};

export const reducer = (state = defaultState, action = {}) => {
  // Reducer ...
};

// PRIVATE SELECTORS
export const select = (state) => {
  return {
    getToken: () => state.token,
    getError: () => state.error,
    isLoading: () => state.loading
  };
};

Again for another slice:
// reducers/items.js
import {
  // actions ...
} from '../actions';

const defaultState = {
  // ...
};

export const reducer = (state = defaultState, action = {}) => {
  // Reducer ...
};

// PRIVATE SELECTORS
export const select = (state) => {
  return {
    getItems: () => state.items,
    getCurrentItem: () => state.currentItem,
    isLoading: () => state.loading
  };
};

The usage of this implementation looks like this:
import { select } from '../reducers';

const mapStateToProps = state => {
  return {
    error: select(state).login.getError(),
    loading: select(state).login.isLoading()
  };
};

Question 1:
What are the drawbacks of this implementation?
Question 2:
Is there another way to address the problems described above?
Thank you


text:
Q: Kubernetes executor and private docker images in apache airflow deployed in Kubernetes not working I have deployed apache airflow in azure kubernetes.
Helm repository of apache airflow: https://github.com/apache/airflow/tree/master/chart
AKS version: 1.16.13
I am reading the dags in my GitHub with git-sync, for that, I have modified the values.yml file:
dags:
  persistence:
    # Enable persistent volume for storing dags
    enabled: false
    # Volume size for dags
    size: 1Gi
    # If using a custom storageClass, pass name here
    storageClassName:
    # access mode of the persistent volume
    accessMode: ReadWriteMany
    ## the name of an existing PVC to use
    existingClaim: ~
  gitSync:
    enabled: true
    # git repo clone url
    # ssh examples ssh://git@github.com/apache/airflow.git
    # git@github.com:apache/airflow.git
    # https example: https://github.com/apache/airflow.git
    repo: https://my_github_repository.git
    branch: master
    rev: HEAD
    root: "/git"
    dest: "repo"

Once I have airflow deployed I have tested it with this dag:
from airflow import DAG
from datetime import datetime, timedelta
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
from airflow.operators.dummy_operator import DummyOperator

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime.utcnow(),
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5)
}

dag = DAG(
    'kubernetes_sample', default_args=default_args, schedule_interval=timedelta(minutes=10))

start = DummyOperator(task_id='run_this_first', dag=dag)

passing = KubernetesPodOperator(namespace='default',
                          image="python:3.8-slim-buster",
                          cmds=["python3","-c"],
                          arguments=["print('hello world')"],
                          labels={"foo": "bar"},
                          name="passing-test",
                          task_id="passing-task",
                          get_logs=True,
                          dag=dag
                          )

passing.set_upstream(start)

It works fine. Now I want to use my own images. For that, I am using azure containers, and following this  guide: https://airflow.readthedocs.io/en/latest/howto/operator/kubernetes.html, I am using this code to create the secret to access to my azure registry:
kubectl create secret docker-registry testquay \
    --docker-server=quay.io \
    --docker-username=<Profile name> \
    --docker-password=<password>

I build my image and I test locally and it is working. I upload the image to azure container registry and I write the following dag:
from airflow import DAG
from datetime import datetime, timedelta
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
from airflow.operators.dummy_operator import DummyOperator
from kubernetes.client import models as k8s
import logging
import os
import sys
import traceback

try:

    default_args = {
        'owner': 'airflow',
        'depends_on_past': False,
        'start_date': datetime.utcnow(),
        'email': ['airflow@example.com'],
        'email_on_failure': False,
        'email_on_retry': False,
        'retries': 1,
        'retry_delay': timedelta(minutes=5)
    }

    dag = DAG(
        'test1', default_args=default_args, schedule_interval=timedelta(minutes=10))

    start = DummyOperator(task_id='run_this_first', dag=dag)

    quay_k8s = KubernetesPodOperator(
            namespace='default',
            image='<MY_SERVER_NAME>/testingairlfowdags:latest',
            image_pull_secrets=[k8s.V1LocalObjectReference('azure-registry')],
            name="testingairlfowdags",
            is_delete_operator_pod=True,
            in_cluster=True,
            task_id="task-two",
            get_logs=True,
            log_events_on_failure = True,
            dag=dag
        )

    start >> quay_k8s

except Exception as e:

    error_message = {
            "message": "An internal error ocurred"
            ,"error": str(e)
            , "error information" : str(sys.exc_info())
            , "traceback": str(traceback.format_exc())
        }
    logging.info(error_message)

But when the quay_k8s task starts a pod is created and suddenly killed, I cannot get any log.
The Kubernetes dashboard shows me this when the pod is initialised:

But then:


text:
Q: Modifiying just the  in titlesec pacakge Good day.
I'd like to add some space after each section. I'm using article class and I've looked in the titlesec package to customize this parameter. I've studied couple of questions and mostly people suggest using this command:
\titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}

In this case I need to modify each parameter which I don't want to do. How do I increase the after-sep proportionally without dealing with other parameters?
Example:
\documentclass[12pt]{article}
\usepackage{lipsum}
\begin{document}

\section{Header}
\lipsum[1]

\subsection{Subheader}
\lipsum[1]

\end{document}

I want to increase the space between title and the paragraph shown in this picture:

A: You can directly modify the setting using \@startsection; the relevant lines in article.cls are
% article.cls, line 312:
\newcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}

The arguments to \@startsection are

*

*name

*level

*indent

*beforeskip (if negative, suppress indentation on the next paragraph)

*afterskip (if negative, the title is run in)

*setup (commands for typesetting the title)

So you need to modify the afterskip, say
\makeatletter
\newcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {6ex \@plus 1ex}%
                                   {\normalfont\Large\bfseries}}
\makeatother

A: You can substitute the default values for indent and beforeskip (from article.cls as presented by egreg). To suppress indentation on the next paragraph, use starred version of \titlespacing.
\documentclass{article}
\usepackage{titlesec}
\titlespacing{\section}{0pt}{3.5ex plus 1ex minus -.2ex}{6ex plus 1ex}
\begin{document}
  Some text
  \section{First section}
  some text
  \section{Second section}
  some text
\end{document}


text:
Q: Formula or Operator not definable proof with Bisimulation in Modal Logic I have been searching for literature about showing that a property is not modally definable.
I found these two examples on the Web where the author uses the disjoint union for constructing two models that are bisimilar for showing that the operator global box is not definable.
Global Box
But later on the author also shows that asymmetry is not definable by two models that are bisimilar again but this time without the disjoint union.
Asymmetry
My question is how to define two models that are bisimilar in order to prove that a property is not definable. I know that the property must hold in one model but not the other, but how to achieve this?

A: There is no general principle of construction such models. In every particular situation you have to use creativity. But some facts can help you. Namely, you should keep in mind that aforementioned disjoint unions, upward-closed submodels (sometimes called generated submodels) and p-morphisms preserve modal satisfability (by means of bisimulation). As you pointed, in the former example the disjoint union was used, while in the later a p-morphism was constructed. In general, it's not enough to use only these three things, but for textbooks examples it suffices.


text:
Q: Javascript works great on localhost, doesn't work on server I am perplexed about why my script works on my laptop but doesn't work when I put it up on the server:

    <TITLE>Cubic Feet</TITLE>

<FORM NAME="Calculator" METHOD="post">

Enter the quantity (number of pieces, skids, boxes, whatever) and their dimensions (length, width, height) in INCHES, then click Calculate.

<INPUT TYPE="button" VALUE="Calculate" name="AddButton"  onClick="Calculate(this.form.q1.value, this.form.h1.value, this.form.w1.value, this.form.l1.value, this.form)">
<INPUT TYPE="button" VALUE="Clear" name="ClearButton" onClick="ClearForm(this.form)">

         Container 1 Qty <input type="TEXT" id="q1" value="" size="5">
         Length <input type="TEXT" id="l1" value="" size ="5">
         Width <input type="TEXT" id="w1" value="" size = "5">
         Height <input type="TEXT" id="h1" value="" size = "5">
         Cu.Ft. <input type="TEXT" id="cuft1" value="" size = "5">
         Skid spots <input type="TEXT" id="sk1" value="" size ="5">

         Container 2 Qty <input type="TEXT" id="q2" value="" size="5">
         Length <input type="TEXT" id="l2" value="" size="5">
         Width <input type="TEXT" id="w2" value="" size="5">
         Height <input type="TEXT" id="h2" value="" size="5">
         Cu.Ft. <input type="TEXT" id="cuft2" value="" size="5">
         Skid spots <input type="TEXT" id="sk2" value="" size="5">

         Container 3 Qty <input type="TEXT" id="q3" value="" size="5">
         Length <input type="TEXT" id="l3" value="" size="5">
         Width <input type="TEXT" id="w3" value="" size="5">
         Height <input type="TEXT" id="h3" value="" size="5">
         Cu.Ft. <input type="TEXT" id="cuft3" value="" size="5">
         Skid spots <input type="TEXT" id="sk3" value="" size="5">

        Totals:

         Total Qty <input type="TEXT" id="totalqty" value="" size="5">
         Cu.Ft. <input type="TEXT" id="totalcuft" value="" size="5">
         Skid spots <input type="TEXT" id="sktotal" value="" size="5">
         Linear Feet <input type="TEXT" id="feet" value="" size="5">

</FORM>

What could be causing it to not work on the server?
There's no error messages. Answers aren't being produced when I click calculate after I upload it onto the server. Works perfectly locally.
Thanks for having a look.

A: Replace cube4 with cube3, ss4 with ss3, text/javascript with javascript and put


text:
Q: How to copy values based on multiple checks and fill the values for other rows in same table using SQL Apologies for framing the question in an improper way but the logic I would like to clarify below for my problem. Hope it will help in understanding my problem
If I have below table as a sample data:
+-----+-----------+------+
|  a  |     b     |  c   |
+-----+-----------+------+
| 100 | Apple     | NULL |
| 100 | Orange    | 1.05 |
| 101 | Apple     | NULL |
| 102 | Apple     | NULL |
| 102 | Dont care | NULL |
| 103 | Apple     | NULL |
| 103 | Dont care | NULL |
| 103 | Orange    | 1.01 |
+-----+-----------+------+

Now I want to fill value of column C where it is NULL for column B = Apple. The value will be taken from column B= Orange of same column A value.
And if for a given distinct value of column A, we have column B= Apple but don't have column B = Orange, then the value of column C (for the given distinct value of column A and column B= Apple) should be populated with value of column C (for next ascending distinct value of column A having column B= Orange).
So my output should then look like:
+-----+-----------+------+
|  a  |     b     |  c   |
+-----+-----------+------+
| 100 | Apple     | 1.05 |
| 100 | Orange    | 1.05 |
| 101 | Apple     | 1.01 |
| 102 | Apple     | 1.01 |
| 102 | Dont care | NULL |
| 103 | Apple     | 1.01 |
| 103 | Dont care | NULL |
| 103 | Orange    | 1.01 |
+-----+-----------+------+

Thanks

A: You can do this with outer apply.
select t1.a,t1.b
,case when t1.b='Apple' and t1.c is null then t2.new_c else c end as new_c
from tbl t1
outer apply (select top 1 c as new_c
             from tbl t2 where t2.a>=t1.a and t2.b='Orange'
             order by a) t2


text:
Q: Using variable to select covariates for glm I am running a simulation of multiple experiments using random data to create glm models. In each individual experiment I need to select different covariates to build the glm. Is there a way to use variable names to specify which covariates to use in the formula? For example, for a data frame called data that will contain the heading y plus a set of other headings that changes with each iteration, something like:
data <- data.frame(x1 = c(1:100),x2 = c(2:101),x3 = c(3:102),x4 = c(4:103),x5 = c(5,104),y = c(6:105))

#Experiment #1:
covars = c(x1,x2,x4)
glm(y ~ sum(covars),data=data)

#Experiment #2:
covars = c(x1,x3,x4,x5)
glm(y ~ sum(covars),data=data)

#Experiment #3:
covars = c(x2,x4,x5)
glm(y ~ sum(covars),data=data)

#etc...

So far, I have tried using this approach with the sum & colnames functions but I get the following error: "invalid 'type' (character) of argument"
Thank you!

A: We can use . to represent all the columns except the dependent column 'y'
glm(y ~ ., data = data)


text:
Q: how to append the following data in a xml tag to get xml file as output? {
    "attrs": {
        "width": 578,
        "height": 200
    },
    "nodeType": "Stage",
    "children": [
        {
            "attrs": {},
            "nodeType": "Layer",
            "children": [
                {
                    "attrs": {
                        "x": 289,
                        "y": 100,
                        "sides": 6,
                        "radius": 70,
                        "fill": "red",
                        "stroke": "black",
                        "strokeWidth": 4
                    },
                    "nodeType": "Shape",
                    "shapeType": "RegularPolygon"
                }
            ]
        }
    ]
}

I have parsed the above json data but i dont know how to append the data to xml tag.thanks for any help.I want the xml tags with exact parent and child nodes using jquery.

A: I found this function after a quick Google search (source):
json2Xml = function(json, node) {
    var root = false;
    if (!node) {
        node = document.createElement('root');
        root = true;
    }

    for (var x in json) {
        // ignore inherited properties
        if (json.hasOwnProperty(x)) {

            if (x == '#text') { // text
                node.appendChild(document.createTextNode(json[x]));
            } else  if (x == '@attributes') { // attributes
                for (var y in json[x]) {
                    if (json[x].hasOwnProperty(y)) {
                        node.setAttribute(y, json[x][y]);
                    }
                }
            } else if (x == '#comment') { // comment
                // ignore
            } else { // elements
                if (json[x] instanceof Array) { // handle arrays
                    for (var i = 0; i < json[x].length; i++) {
                        node.appendChild(json2Xml(json[x][i], document.createElement(x)));
                    }
                } else {
                    node.appendChild(json2Xml(json[x], document.createElement(x)));
                }
            }
        }
    }

    if (root == true) {
        return this.textToXML(node.innerHTML);
    } else {
        return node;
    }
};

A: So you just want to convert from json to xml? tons of scripts on the net
jsFiddle using the obove lib: http://jsfiddle.net/RCZLF/
var foo = {/* json obj */}
$(function() {
    console.log(json2xml(foo,' '));
});


text:
Q: When to use session_start()? I've been going through some $_SESSION examples and I'm a little confused, should i use session_start() every time before I access or set $_SESSION['variable'] or should I only use session_start() once per page or just once the user has successfully logged in?

A: You should always use session_start() once at the First Line of your PHP page if you want to access all session in $_SESSION

A: Use it once per page, at the very top, before you plan to use any $_SESSION variables


text:
Q: WPF Control size is not the same as design at runtime I am creating a WPF application based on a book using Visual Studio 2022 Community. The problem is with how the UI looks different at runtime.
The problem is with the TextBox at the bottom. It only looks like what it suppose to after i try to resize the window a little.
Designer:

Running:

Here is my XAML code:
<Window x:Class="FontViewer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:FontViewer"
        mc:Ignorable="d"
        Title="Font Viewer" Height="480" Width="800">
    <DockPanel>
        <Border DockPanel.Dock="Top"
                CornerRadius="6"
                BorderThickness="1"
                BorderBrush="Gray"
                Background="LightGray"
                Padding="8"
                Margin="4 4 4 4"
        >
            <TextBlock FontSize="14"
                       TextWrapping="Wrap">
                Select a font to view from the list below.
                You can change the text by typing in the region at the bottom.
            </TextBlock>
        </Border>
        <ListBox x:Name="FontList"
                 DockPanel.Dock="Left"
                 ItemsSource="{x:Static Fonts.SystemFontFamilies}"
                 Width="160"
                 Margin="4 4 0 4"/>
        <TextBox x:Name="SampleText"
                 DockPanel.Dock="Bottom"
                 MinLines="4"
                 Margin="8 0 8 4"
                 TextWrapping="Wrap"
                 ToolTip="Type here to change the preview text.">
            The quick brown fox jumps over the lazy dog.
        </TextBox>
        <StackPanel Margin="8 4 8 4">
            <TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
                       FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
                       FontSize="10"
                       TextWrapping="Wrap"
                       Margin="0 0 0 4"/>
            <TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
                       FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
                       FontSize="16"
                       TextWrapping="Wrap"
                       Margin="0 0 0 4"/>
            <TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
                       FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
                       FontSize="24"
                       TextWrapping="Wrap"
                       Margin="0 0 0 4"/>
            <TextBlock Text="{Binding ElementName=SampleText, Path=Text}"
                       FontFamily="{Binding ElementName=FontList, Path=SelectedItem}"
                       FontSize="32"
                       TextWrapping="Wrap"
                       Margin="0 0 0 4"/>
        </StackPanel>
    </DockPanel>
</Window>

I have tried to mess around with the Margin but still in vain.
Do you know the how to fix this?


text:
Q: Can you export variables to a text file, as variables not a string Hello my problem is that, i need to find a way to export variables as a text file (or another file type) and then import the variables into python so that I can, use them later on within the program. for example
i = 0

while I != 10:
    i = i + 1
    Var1 = input("What is your name")
    Var2 = ("What is your surname")

    with open('filename', 'w') as file_out:
        file_out.write(var1 + "/n")
        file_out.write(var2 + "/n")
        file_out.write("/n")

Now if I ran this code it would probably (might have messed up typing it here ;P), it would save the variable1 to the first line, variable 2 to the second and then leaves a line in a newly generated text file, but now i need to reopen the text file within python and then use the the first variables result (for example if someone typed 'john', i need the program to know who john is and what his surname is), similarly when its repeated the program will then write below johns name with someone else's (for example 'ethan'), the program will then write below ethan, along with his surname in the same format.
Thus what I'm asking is if there's anyway to instead export these as variables instead of strings, because if so i could just open the text file and tell my program to use the variables. could someone please tell me if what I suggest is at least possible and if they could how to do so.

A: It looks like you want to look at the pickle module
Use a dictionary to store multiple variables when using this method. It's a useful container for an indeterminate number variables created on the fly.
import pickle

myvardict = {}
i = 0
while i != 10
    i =+ 1
    Var1 = input("What is your name")
    Var2 = input("What is your surname")
    myvardict[i] = [Var1, Var2]

pickle.dump(myvardict,"myoutfile.pic")

Then to load you'll just need to call the appropriate method
import pickle
myvardict = pickle.load("myoutfile.pic")

A: Instead of pickling your object you could store your data as JSON (especially helpful if you're going to export your data structures to other languages).
import json
data = dict(i=1,j=12,hello=world)
with open('data.json','w') as json_file:
   json.dump(data)

and then you can load it in using:
 import json
 data = None
 with open('data.json') as json_file:
     data = json.load(json_file)


text:
Q: Upgrading Apache from 2.4.6 to 2.4.41 on Centos 7 I would like to seek some guidance on how to upgrade httpd 2.4.6 to 2.4.41 on centos 7. I realised there are similar questions but for RHEL7. The reason for upgrade is due to vulnerability CVE-2017-9788, CVE-2014-3523 for httpd-2.4.6.
How should I go about upgrading the versions? Do I need to build from the the source zip? And would I need to do any symlink or PATH variable or things like that? Do I need to copy the current configuration to new installation path? Sorry if I sounded a bit amateur because I have little experience in this area.
Any help would be appreciated. Thanks.


text:
Q: macOS: how to install JavaFX properly to run mqtt-spy? I'm trying to run mqtt-spy-1.0.0.jar on my macOS 10.14 system but it won't start, returning the following error message:

According to the developers, this problem is caused if JavaFX is missing on the system.
The latest version of the Oracle JDK is installed on my system as can be seen below, however, I'm aware that Oracle has excluded JavaFX from the JDK in v11.

So I downloaded JavaFX from GluonHQ and followed their instructions on how to get started.

Despite having both required variables set correctly in ~/.bash_profile, mqtt-spy-1.0.0.jar is still returning the error message shown on the first screenshot ...
What else do I need to do or what do I need to do differently to run mqtt-spy?

A: There is already an issue filed about this, but not a solution.
I haven't really tried to get it fully working, but these are the required steps to run a jar on Java 11 that requires JavaFX 11, but doesn't bundle it:

*

*Go to OpenJFX docs and read about how to get started with JavaFX 11.

*Download JavaFX 11 for your platform from here. Unzip it

*Providing that you have Java 11 installed, and set as JAVA_HOME:
With mqtt-spy-1.0.0.jar (as latest release), you can run:
java --module-path /path-to/javafx-sdk-11.0.1/lib \
    --add-modules javafx.controls,javafx.fxml -jar mqtt-spy-1.0.0.jar

After you run this, you will get this exception:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)

Since Java 9, JAXB is not part of the JDK either. So you can add try to download the dependency from here) and add it to the classpath. But this will take some iterations (there are a few other required jars more, see this).
So why don't you use the latest snapshot available, that includes dependencies: mqtt-spy-1.0.1-beta-b18-jar-with-dependencies.jar.
With this:
java --module-path /path-to/javafx-sdk-11.0.1/lib \
    --add-modules javafx.controls,javafx.fxml -jar mqtt-spy-1.0.1-beta-b18-jar-with-dependencies.jar

I get:

Warning: But this doesn't mean that the app will fully work. Given that it is a Java 8 app, there are things that have changed in JavaFX 11, mainly related to the control skins. If the app was using private API (com.sun.javafx....), that won't work now, because either it has been moved to public packages, or because it is not accessible by the modules. For the latter you can use --add-opens, but for the former there is no solution other than update the app dependencies to Java 9+.


text:
Q: Linux: How to create a zip from the result of a grep I have a directory that has over 6 million files.
I can't list them all and I need to zip a few of them.
Can I do something like:
$zip -r archive.zip dir1/ | grep "*_201605*"

so far everytime I run this command it zips everything.

A: From the example in manual:
zip -R foo "*.c"

You could adapt for your case:
zip -r archive.zip "dir1/*_201605*"

For more complicated cases you can profit from the --names-stdin option which is:

Take the list of input files from standard input. Only one filename per line.


text:
Q: the JSON object must be str, bytes or bytearray, not 'dict' I am following a web scraping tutorial to learn web scraping now. I followed the instructions step by step, but an error came up.
the JSON object must be str, bytes or bytearray, not 'dict'
I searched this error and most of the solutions were encoding or decoding, however it didn't work for my code. When I used encoding or decoding, it gave me another error that "'dict' object has no attribute 'decode'"
I am using Python 2.7.10 on pycharm.
This is the error:
Traceback (most recent call last):
  File "/Users/junjielin/PycharmProjects/meituan/index.py", line 46, in <module>
    main(url)
  File "/Users/junjielin/PycharmProjects/meituan/index.py", line 42, in main
    shop_id_list = get_detail_id(category_url, headers=headers)
  File "/Users/junjielin/PycharmProjects/meituan/index.py", line 35, in get_detail_id
     return json.loads(content_id.get('data')).get('poiidList')
   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 348, in loads
    'not {!r}'.format(s.__class__.__name__))
TypeError: the JSON object must be str, bytes or bytearray, not 'dict'

And the followings is my code:
# —*- coding:utf-8 -*-
import requests
from bs4 import BeautifulSoup #解析网页,获取标签内容
import json
import lxml

url = 'http://taishan.meituan.com/'
headers = {
    'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
    'Accept-Language':'en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4',
    'Cache-Control':'max-age=0',
    'Connection':'keep-alive',
    'Host':'taishan.meituan.com',
    'Referer':'http://taishan.meituan.com/',
    'Upgrade-Insecure-Requests':'1',
    'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
    'Content-Type':'text/html; charset=UTF-8',
}

def get_start_links(url):
    html = requests.get(url).text
    #print (html)
    soup = BeautifulSoup(html, 'lxml')
    links = [link.find('div').find('div').find('dl').find('dt').find('a')['href'] for link in soup.find_all('div', class_='J-nav-item')]
    #print (links)
    return links

def get_detail_id(url, headers=None):
    html = requests.get(url, headers=headers).text
    soup = BeautifulSoup(html, 'lxml')
    # loads将json转dict
    content_id = json.loads(soup.find('div',class_='J-scrollloader cf J-hub')['data-async-params'])
#    a = content_id.get('data')
    return json.loads(content_id.get('data')).get('poiidList')

def main(url):
     start_url_list = get_start_links(url)
     for j in start_url_list:
         for i in  range(1, 11):
            category_url = j+'/all/page{}'.format(i)
            shop_id_list = get_detail_id(category_url, headers=headers)
            print (shop_id_list)

if __name__ == '__main__':
    main(url)

Edit
Thank you for your quick responses. With your information, I removed the call to json.loads in the return statement, which became:
return content_id.get('data').get('poiidList')

However, it gave me a new error:
  Traceback (most recent call last):
  File "/Users/junjielin/PycharmProjects/meituan/index.py", line 46, in <module>
    main(url)
  File "/Users/junjielin/PycharmProjects/meituan/index.py", line 42, in main
    shop_id_list = get_detail_id(category_url, headers=headers)
  File "/Users/junjielin/PycharmProjects/meituan/index.py", line 35, in get_detail_id
    return content_id.get('data').get('poiidList')
AttributeError: 'str' object has no attribute 'get'

I don't understand what this means.


text:
Q: ORA-00911: when using Insert command on datasource Trying to set up an insert statement in asp.net.
My double line insertCommand is as follows:
InsertCommand="INSERT INTO DVD(DVD_ID, DVD_TITLE, RENTAL_COST, RATING, COVER_IMAGE) VALUES (DVD_SEQ.NEXTVAL, :DVD_TITLE, :RENTAL_COST, :RATING, :COVER_IMAGE);
        INSERT INTO DVD_GENRE(DVD_ID, GENRE_ID) VALUES (DVD_SEQ.CURRVAL, :GENRE_ID)"

The code for the insert parameters are:
<InsertParameters>
    <asp:ControlParameter ControlID="titleBox" DefaultValue="TITLEDEFAULT"
        Name="DVD_TITLE" PropertyName="Text" Type="String" />
    <asp:ControlParameter ControlID="rentalBox" DefaultValue="99"
        Name="RENTAL_COST" PropertyName="Text" Type="String" />
    <asp:ControlParameter ControlID="ratingList" DefaultValue="25" Name="RATING"
        PropertyName="SelectedValue" Type="Int32" />
    <asp:Parameter Name="COVER_IMAGE" Type="String" DefaultValue="0.jpg" />
    <asp:ControlParameter ControlID="genreList" Name="GENRE_ID"
        PropertyName="SelectedValue" />
</InsertParameters>

And my OracleDB table (DVD) which is being inserted into is:
create table dvd_genre
(
dvd_id integer not null,
genre_id integer not null,
primary key (dvd_id, genre_id),
foreign key(dvd_id) references DVD(dvd_id),
foreign key(genre_id) references GENRE(genre_id)
);

My only guess at what's causing this is the ';' character to break up the two insert statements. Yes I understand I should probably create a trigger but I've read this can work as well. If I remove the ';' character I get an error about the query not being properly ended. Any help would be much appreciated!!

A: 1) "ORA-00911" means "invalid character"
2) Yes, the ";" is a good candidate.  Q: Can you execute two SQL inserts in a single ASP command?  I don't know ;)
3) Suggestion: break it down to one SQL statement, and see if the problem goes away.
4) If so, your options include:
a) issuing two SQL statements in the same place as your ASP code (that's what I'd do, but I don't know if it's an option in your program)
b) use a trigger (definitely not what I'd do)
c) create a PL/SQL stored procedure and invoke it from your ASP instead of the raw SQL (arguably the best choice of all)
IMHO..


text:
Q: Let $m$ and $n$ be positive integers such that $\gcd(m,n)=1.$Compute $\gcd(5^m+7^m,5^n+7^n)$. Problem: Let $m$ and  $n$ be positive integers such that $\gcd(m,n)=1.$Compute $\gcd(5^m+7^m,5^n+7^n)$.
My Attempt: I wrote a simple computer program and deduced that $\gcd(5^m+7^m,5^n+7^n)=2$ if $m+n$  is odd and $\gcd(5^m+7^m,5^n+7^n)=12$ if $m+n$ is even. I would like to know if there is a way to prove these results.
Edit: Found a solution on the web:
I don't understand why $\gcd(s_m,s_n)=\gcd(s_m,s_{n-2m})$. According to me, $\gcd(s_m,s_n)=\gcd(s_m,5^m7^ms_{n-2m})$.

A: Here's a simple case.  See if you can generalize it:
$\gcd (5^3+7^3,5^7+7^7)=$
$\gcd (5^3+7^3,5^7+7^7-7^4 (5^3+7^3))=$
$\gcd (5^3+7^3,5^7-5^3*7^4)=$ note: $5\not \mid 5^3+7^3$ so
$\gcd (5^3+7^3,5^4-7^4)=$
$\gcd (5^3+7^3,5^4-7^4+7 (5^3+7^3))=$
$\gcd (5^3+7^3,5^4+5^3*7)=$
$\gcd (5^3+7^3,5+7)=$
$\gcd (5^3+7^3-7^2 (5+7),5+7)=$
$\gcd(5^3-7^2*5,5+7)=$
$\gcd(5^2-7^2,5+7)=$
$\gcd (5^2-7^2+7 (5+7),5+7)=$
$\gcd (5^2+7*5,5+7)=$
$\gcd (5+7,5+7)=12$
As $\gcd(m,n)=1$
This "swinging" by reducing and subtracting the powers will eventually result in $5^{\gcd (m,n)}\pm 7^{\gcd (m,n)}=5\pm 7= 2|12$. (Positive/negative doesn't matter for gcd)
Whether it will be $5+7$ or $5-7$ will depend on whether we swing an even or  odd number of times.
=====
=====
Alright.  Here's a more thorough proof:
Let $\gcd(B,A) = 1$ and wolog $B > A$ and $\gcd(n,m)=1$ wolog $n>m$ then $\gcd(B^n+A^n, B^m+A^m) = B + (-1)^{m+n}A$  (and so $\gcd(7^n+5^n,7^m+5^m) = 2$ if $m+n$ is odd and is $12$ if $m+n$ is even.
Proof:
$\gcd(n,m)=1$ which means by Euclid's algorithm That there are series of $n_i, m_i;k_i$ so that:
$n=n_0; m= m_0$
$n_0 = k_0*m_0 + m_1$
$n_1 = m_0; n_1 = k_1*m_1 + m_2$
.....
$n_i = m_{i-1}; n_i = k_i*m_i + m_{i+1}$
...
$n_{z-1} = k_{z-1}m_{z-1} + 1; m_z = 1$
$n_z=m_{z-1} = 1*m_{z- 1}$
$n_{z+1} = 1 $
Interestingly $z$ is odd if and only if $n+m$ is odd. (To be honest I'm not sure how to prove that.)
$\gcd(B^n + A^n,B^m + A^m) = \gcd(B^n + A^n - B^{n-m}(B^m + A^m),B^m + A^m)=$
$\gcd(B^n + A^n - B^n - B^{n-m}A^m,B^m + A^m) = \gcd(A^n - A^mB^{n-m},B^m +A^m)=$
$\gcd(-A^m(B^{n-m} - A^{n-m}),B^m + A^m) = \gcd(B^{n-m} - A^{n-m},B^m+ A^m)$
And repeating via induction we can get:
$=\gcd(B^{n-k_0*m=m_1} \pm A^{m_1},B^{m=n_1} + A^{n_1})$ where it is a "plus" if $k_0$ is even and a "minus" if $k_0$ is odd.
An repeating via induction we can get:
$=\gcd(B \pm A, B \pm A) = B\pm A$
"plus" if $\sum k_i$ is even, and "minus" if the sum is odd.
Somehow we can show $\sum k_i \text{ is odd } \iff z \text { is even } \iff $m+n $ \text { is even }$.  I guess that part needs a little work.


text:
Q: Несовместимость версии pip и tensorflow При попытке установить tensorflow pip install tensorflow
Пишет
Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

При попытке обновить pip пишет, что и так установлена последняя версия (18.1)
Requirement already up-to-date: pip in e:\projects\python\Project1\venv\lib\site-packages (18.1)
Установлен только python 3.7.0. Система windows 7 x64.


text:
Q: Нужно переформатировать массив, который содержит пустые ключи но при этом имеет значения Есть массив:
[heals_data] => Array
    (
        [] => Array
            (
                [scan_heals_data] => b322d23ed44560b6d988b6eea11a1c34.jpg
            )

        [0] => Array
            (
                [what_diseases] => болен
                [conclusion_date] => 8,51555444
            )
        [1] => Array
            (
                [what_diseases] => здоров
                [conclusion_date] => 43534535444
            )
        [3] => Array
            (
                [what_diseases] => неизвестно
                [conclusion_date] => 76887
            )
    )

Нужно изменить его формат так, чтобы на место пустого ключа [] встал ключ из его значения то есть [scan_heals_data]
Заранее я не знаю какие массивы есть внутри пустого ключа и какие ключи есть у этих внутренних массивов.
На выходе должен получиться массив вот такого вида:
[heals_data] => Array
    (
        [scan_heals_data] => b322d23ed44560b6d988b6eea11a1c34.jpg

        [0] => Array
            (
                [what_diseases] => болен
                [conclusion_date] => 8,51555444
            )
        [1] => Array
            (
                [what_diseases] => здоров
                [conclusion_date] => 43534535444
            )
        [3] => Array
            (
                [what_diseases] => неизвестно
                [conclusion_date] => 76887
            )
    )

A: $heals_data = Array
(
    '' => Array
        (
            'scan_heals_data' => 'b322d23ed44560b6d988b6eea11a1c34.jpg'
        ),
    0 => Array
        (
            'what_diseases' => 'болен',
            'conclusion_date' => 8,51555444
        ),
    1 => Array
        (
            'what_diseases' => 'здоров',
            'conclusion_date' => 43534535444
        ),
    3 => Array
        (
            'what_diseases' => 'неизвестно',
            'conclusion_date' => 76887
        ),
);

$result = array();
foreach ($heals_data as $key => $value) {
    if (empty($key) && ($key != '0')) {
        $result[key($value)] = $value[key($value)];
    } else {
        $result[$key] = $value;
        // array_push($result, $value); - либо так
    }
}

var_dump($result);


text:
Q: Error locating element using Protractor - Failed: script timeout: result was not received in 20 seconds I have a very basic website developed in Angular 6 and I am trying to write some e2e tests for it. But the first script itself is giving me a hard time. I am getting the following error -
C:\Users\user\Documents\workspace-vs-code\protractor-poc>protractor
[18:25:12] I/launcher - Running 1 instances of WebDriver
[18:25:12] I/direct - Using ChromeDriver directly...
[14500:21224:0129/182513.778:ERROR:configuration_policy_handler_list.cc(91)] Unk
nown policy: PasswordManagerAllowShowPasswords
[14500:21224:0129/182513.866:ERROR:configuration_policy_handler_list.cc(91)] Unk
nown policy: PasswordManagerAllowShowPasswords

DevTools listening on ws://127.0.0.1:58686/devtools/browser/22a05a0a-e850-47e3-b
a7b-fecc6ed97ac8
Jasmine started
(node:20576) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmp
dir() instead.

  service catalog search
    x should login
      - Failed: script timeout: result was not received in 20 seconds
        (Session info: chrome=71.0.3578.98)
        (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53
f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64)
        (Session info: chrome=71.0.3578.98)
        (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53
f3f74387),platform=Windows NT 6.1.7601 SP1 x86_64)
          at Object.checkLegacyResponse (C:\Users\user\AppData\Roaming\npm\no
de_modules\protractor\node_modules\selenium-webdriver\lib\error.js:546:15)
          at parseHttpResponse (C:\Users\user\AppData\Roaming\npm\node_module
s\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
          at doSend.then.response (C:\Users\user\AppData\Roaming\npm\node_mod
ules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30)
          at process._tickCallback (internal/process/next_tick.js:68:7)
      From: Task: Protractor.waitForAngular() - Locator: By(css selector, *[id="
password"])
          at Driver.schedule (C:\Users\user\AppData\Roaming\npm\node_modules\
protractor\node_modules\selenium-webdriver\lib\webdriver.js:807:17)
          at ProtractorBrowser.executeAsyncScript_ (C:\Users\user\AppData\Roa
ming\npm\node_modules\protractor\built\browser.js:425:28)
          at angularAppRoot.then (C:\Users\user\AppData\Roaming\npm\node_modu
les\protractor\built\browser.js:456:33)
          at ManagedPromise.invokeCallback_ (C:\Users\user\AppData\Roaming\np
m\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1376:14
)
          at TaskQueue.execute_ (C:\Users\user\AppData\Roaming\npm\node_modul
es\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14)
          at TaskQueue.executeNext_ (C:\Users\user\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27)
          at asyncRun (C:\Users\user\AppData\Roaming\npm\node_modules\protrac
tor\node_modules\selenium-webdriver\lib\promise.js:2927:27)
          at C:\Users\user\AppData\Roaming\npm\node_modules\protractor\node_m
odules\selenium-webdriver\lib\promise.js:668:7
          at process._tickCallback (internal/process/next_tick.js:68:7)Error
          at ElementArrayFinder.applyAction_ (C:\Users\user\AppData\Roaming\n
pm\node_modules\protractor\built\element.js:459:27)
          at ElementArrayFinder.(anonymous function).args [as isDisplayed] (C:\U
sers\user\AppData\Roaming\npm\node_modules\protractor\built\element.js:91:29)

          at ElementFinder.(anonymous function).args [as isDisplayed] (C:\Users\
user\AppData\Roaming\npm\node_modules\protractor\built\element.js:831:22)
          at UserContext.<anonymous> (C:\Users\user\Documents\workspace-vs-co
de\protractor-poc\e2e\app.servicecatalogsearch.ts:17:44)
          at step (C:\Users\user\Documents\workspace-vs-code\protractor-poc\e
2e\app.servicecatalogsearch.ts:32:23)
          at Object.next (C:\Users\user\Documents\workspace-vs-code\protracto
r-poc\e2e\app.servicecatalogsearch.ts:13:53)
          at C:\Users\user\Documents\workspace-vs-code\protractor-poc\e2e\app
.servicecatalogsearch.ts:7:71
          at new Promise (<anonymous>)
          at __awaiter (C:\Users\user\Documents\workspace-vs-code\protractor-
poc\e2e\app.servicecatalogsearch.ts:3:12)
          at UserContext.<anonymous> (C:\Users\user\Documents\workspace-vs-co
de\protractor-poc\e2e\app.servicecatalogsearch.ts:51:16)
      From: Task: Run it("should login") in control flow
      From asynchronous test:
      Error
          at Suite.<anonymous> (C:\Users\user\Documents\workspace-vs-code\pro
tractor-poc\e2e\app.servicecatalogsearch.ts:15:5)
          at Object.<anonymous> (C:\Users\user\Documents\workspace-vs-code\pr
otractor-poc\e2e\app.servicecatalogsearch.ts:3:1)
          at Module._compile (internal/modules/cjs/loader.js:689:30)
          at Module.m._compile (C:\Users\user\Documents\workspace-vs-code\pro
tractor-poc\node_modules\ts-node\src\index.ts:422:23)
          at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
          at Object.require.extensions.(anonymous function) [as .ts] (C:\Users\A
527629\Documents\workspace-vs-code\protractor-poc\node_modules\ts-node\src\index
.ts:425:12)

**************************************************
*                    Failures                    *
**************************************************

1) service catalog search should login
  - Failed: script timeout: result was not received in 20 seconds
    (Session info: chrome=71.0.3578.98)
    (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f7
4387),platform=Windows NT 6.1.7601 SP1 x86_64)

Executed 1 of 1 spec (1 FAILED) in 24 secs.
[18:25:39] I/launcher - 0 instance(s) of WebDriver still running
[18:25:39] I/launcher - chrome #01 failed 1 test(s)
[18:25:39] I/launcher - overall: 1 failed spec(s)
[18:25:39] E/launcher - Process exited with error code 1

And my test script is -
import { browser, element, by, until, ExpectedConditions, By } from 'protractor';

describe('service catalog search', function() {

    it('should login', function() {
      browser.get('http://localhost:4200');
      element(by.id('password')).sendKeys('abc');
    });
  });

Now the problem is while sending keys. If I remove sendkeys, then it passes but don't know if it locates it properly.
Following is the html -

A: I got my answer here after struggling enough. Much thanks to Gleb to share it.
Instead of element(by), I used browser.driver.findElement

A: I've set up a very basic test that is almost same as yours:
it('should have value', () => {
    browser.get('http://localhost:4200/register');
    element(by.id('email')).sendKeys('abc');

    expect(element(by.id('email')).getAttribute('value')).toEqual('abc');
});

*

*Get to register page (url)

*Get input element with id "email" and type to it some text

*Assert to check if that input element has previously typed text as a value

In my case, it works just fine.
Can you add assert? Maybe that gives us more information what goes wrong.

A: I notice that you put async keyword for it block, probably you are trying to implement async/await approach, in this case your code should look like so
it('should login', async function() {
  await browser.get('http://localhost:4200');
  await element(by.id('password')).sendKeys('abc');
});

If you doubt if an expression require await keyword, check protractor API and you will see, that, for example, sendKeys returns !webdriver.promise.Promise. Which means you should add await, otherwise protractor would not wait this step to be done before moving forward, which may cause an error, like the one you have.
P.S. To enable async/await you should put the following option in conf file
SELENIUM_PROMISE_MANAGER: false

Otherwise your code does not require async/await declaration and Web Driver Control Flow will do all the job for you, though it is currently deprecated and will be removed in a later moment.


text:
Q: Installation of texlive fails while downloading luatex (checksums differ) I installed texlive 2020 some time ago without any problems. While updating it some issue with luatex occured and luatex stopper working. So I uninstalled texlive and decided to reinstall it.
However, the installation fails when trying to download luatex:
Installing [34/64, time/total: 00:26/00:58]: luahbtex.win32 [1515k]
TeXLive::TLUtils::check_file_and_remove: checksums differ for C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\ihYA0IWEp_/luahbtex.win32.tar.xz:
TeXLive::TLUtils::check_file_and_remove:   tlchecksum=5e395b24bd9e710be88f1f2e2a3bd18022daf3cf1e2be18d27192eccea50f5ddaa122c6ae8cd4cce6b54d3a8608ae9e119d0dbf25d1e37aa2da8a986aa0a0c70, arg=04f90e04de858fb120852cebd84671f026b355fd1ac1acb5fee48f559f06709f8c25fa4f2ccf84a602de92ff728de5bfdc97610325c803540b349c2c3f1faf18
TeXLive::TLUtils::check_file_and_remove: backtrace:
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:2330: TeXLive::TLUtils::check_file_and_remove
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1976: TeXLive::TLUtils::unpack
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1811: TeXLive::TLPDB::_install_data
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1727: TeXLive::TLPDB::not_virtual_install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:1552: TeXLive::TLPDB::install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:2160: TeXLive::TLUtils::install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:980: main::do_install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:732: main::do_installation
TeXLive::TLUtils::check_file_and_remove:   removing C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\ihYA0IWEp_/luahbtex.win32.tar.xz, but saving copy in C:\Users\mishk\AppData\Local\Temp\Ku6tO0tyna
TLPDB::_install_data: downloading did not succeed (check_file_and_remove failed) for http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet/archive/luahbtex.win32.tar.xz
TLUtils::install_packages: Failed to install luahbtex.win32
Will be retried later.

I switched to minimal installation to save time, tried different mirrors, but still get the same error.
I am running Windows 10 as administrator with Avast turned off. The same problem occurs on the other machine as well.
Full log:
TeX Live installer invocation: C:/Users/mishk/Downloads/install-tl-20200512/install-tl -from_ext_gui -repository http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet -lang en_us
Loading http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet/tlpkg/texlive.tlpdb
Installing TeX Live 2020 from: http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet (not verified)
Platform: win32 => 'Windows'
Distribution: net  (downloading)
Using URL: http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet
Directory for temporary files: C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ
Installer revision: 54993
Database revision: 55117
Settings:
  TEXDIR: "C:/texlive/2020"
  TEXMFCONFIG: "~/.texlive2020/texmf-config"
  TEXMFHOME: "~/texmf"
  TEXMFLOCAL: "C:/texlive/texmf-local"
  TEXMFSYSCONFIG: "C:/texlive/2020/texmf-config"
  TEXMFSYSVAR: "C:/texlive/2020/texmf-var"
  TEXMFVAR: "~/.texlive2020/texmf-var"
  binary_aarch64-linux: ""
  binary_amd64-freebsd: ""
  binary_amd64-netbsd: ""
  binary_armhf-linux: ""
  binary_i386-cygwin: ""
  binary_i386-freebsd: ""
  binary_i386-linux: ""
  binary_i386-netbsd: ""
  binary_i386-solaris: ""
  binary_win32: "1"
  binary_x86_64-cygwin: ""
  binary_x86_64-darwin: ""
  binary_x86_64-darwinlegacy: ""
  binary_x86_64-linux: ""
  binary_x86_64-linuxmusl: ""
  binary_x86_64-solaris: ""
  collection-basic: "1"
  collection-bibtexextra: ""
  collection-binextra: ""
  collection-context: ""
  collection-fontsextra: ""
  collection-fontsrecommended: ""
  collection-fontutils: ""
  collection-formatsextra: ""
  collection-games: ""
  collection-humanities: ""
  collection-langarabic: ""
  collection-langchinese: ""
  collection-langcjk: ""
  collection-langcyrillic: ""
  collection-langczechslovak: ""
  collection-langenglish: ""
  collection-langeuropean: ""
  collection-langfrench: ""
  collection-langgerman: ""
  collection-langgreek: ""
  collection-langitalian: ""
  collection-langjapanese: ""
  collection-langkorean: ""
  collection-langother: ""
  collection-langpolish: ""
  collection-langportuguese: ""
  collection-langspanish: ""
  collection-latex: ""
  collection-latexextra: ""
  collection-latexrecommended: ""
  collection-luatex: ""
  collection-mathscience: ""
  collection-metapost: ""
  collection-music: ""
  collection-pictures: ""
  collection-plaingeneric: ""
  collection-pstricks: ""
  collection-publishers: ""
  collection-texworks: ""
  collection-wintools: "1"
  collection-xetex: ""
  doc_splitting_supported: "1"
  inst_platform: "win32"
  instopt_adjustpath: "1"
  instopt_adjustrepo: "1"
  instopt_desktop_integration: "1"
  instopt_file_assocs: "1"
  instopt_letter: ""
  instopt_portable: ""
  instopt_write18_restricted: "1"
  n_collections_available: "41"
  n_collections_selected: "2"
  n_systems_available: "16"
  n_systems_selected: "1"
  scheme-basic: ""
  scheme-context: ""
  scheme-custom: ""
  scheme-full: ""
  scheme-gust: ""
  scheme-infraonly: ""
  scheme-medium: ""
  scheme-minimal: "1"
  scheme-small: ""
  scheme-tetex: ""
  selected_scheme: "scheme-minimal"
  src_splitting_supported: "1"
  this_platform: "win32"
  tlpdbopt_autobackup: "1"
  tlpdbopt_backupdir: "tlpkg/backups"
  tlpdbopt_create_formats: "1"
  tlpdbopt_desktop_integration: "1"
  tlpdbopt_file_assocs: "1"
  tlpdbopt_generate_updmap: ""
  tlpdbopt_install_docfiles: "1"
  tlpdbopt_install_srcfiles: "1"
  tlpdbopt_location: "http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet"
  tlpdbopt_post_code: "1"
  tlpdbopt_sys_bin: "/usr/local/bin"
  tlpdbopt_sys_info: "/usr/local/share/info"
  tlpdbopt_sys_man: "/usr/local/share/man"
  tlpdbopt_w32_multi_user: ""
  total_size: "226"
Installing to: C:/texlive/2020
Not an admin install; not making read-only
Not an admin install; not making read-only
Not an admin install; not making read-only
Not an admin install; not making read-only
Installing [01/64, time/total: ??:??/??:??]: texlive.infra [420k]
Installing [02/64, time/total: 00:01/02:06]: texlive.infra.win32 [1397k]
Installing [03/64, time/total: 00:02/00:58]: tlperl.win32 [6816k]
Installing [04/64, time/total: 00:07/00:43]: amsfonts [4725k]
Installing [05/64, time/total: 00:10/00:39]: bibtex [404k]
Installing [06/64, time/total: 00:11/00:42]: bibtex.win32 [41k]
Installing [07/64, time/total: 00:11/00:42]: cm [235k]
Installing [08/64, time/total: 00:12/00:45]: collection-basic [1k]
Installing [09/64, time/total: 00:12/00:45]: collection-wintools [1k]
Installing [10/64, time/total: 00:12/00:45]: colorprofiles [113k]
Installing [11/64, time/total: 00:13/00:48]: dehyph [46k]
Installing [12/64, time/total: 00:13/00:48]: dviout.win32 [2183k]
postaction install fileassoc for dviout.win32: .dvi, TL.DVIOUT.view.2020
Installing [13/64, time/total: 00:14/00:45]: dvipdfmx [3077k]
Installing [14/64, time/total: 00:16/00:43]: dvipdfmx.win32 [315k]
Installing [15/64, time/total: 00:17/00:45]: dvips [566k]
Installing [16/64, time/total: 00:17/00:44]: dvips.win32 [92k]
Installing [17/64, time/total: 00:18/00:46]: ec [280k]
Installing [18/64, time/total: 00:19/00:48]: enctex [272k]
Installing [19/64, time/total: 00:19/00:48]: etex [197k]
Installing [20/64, time/total: 00:20/00:50]: etex-pkg [7k]
Installing [21/64, time/total: 00:20/00:50]: glyphlist [25k]
Installing [22/64, time/total: 00:20/00:50]: graphics-def [13k]
Installing [23/64, time/total: 00:21/00:52]: hyph-utf8 [312k]
Installing [24/64, time/total: 00:21/00:51]: hyphen-base [22k]
Installing [25/64, time/total: 00:22/00:54]: hyphenex [187k]
Installing [26/64, time/total: 00:22/00:53]: ifplatform [156k]
Installing [27/64, time/total: 00:23/00:55]: iftex [217k]
Installing [28/64, time/total: 00:23/00:55]: knuth-lib [30k]
Installing [29/64, time/total: 00:23/00:55]: knuth-local [23k]
Installing [30/64, time/total: 00:24/00:57]: kpathsea [1074k]
Installing [31/64, time/total: 00:25/00:57]: kpathsea.win32 [476k]
Installing [32/64, time/total: 00:25/00:56]: lua-alt-getopt [6k]
Installing [33/64, time/total: 00:26/00:58]: luahbtex [30k]
Installing [34/64, time/total: 00:26/00:58]: luahbtex.win32 [1515k]
TeXLive::TLUtils::check_file_and_remove: checksums differ for C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\ihYA0IWEp_/luahbtex.win32.tar.xz:
TeXLive::TLUtils::check_file_and_remove:   tlchecksum=5e395b24bd9e710be88f1f2e2a3bd18022daf3cf1e2be18d27192eccea50f5ddaa122c6ae8cd4cce6b54d3a8608ae9e119d0dbf25d1e37aa2da8a986aa0a0c70, arg=04f90e04de858fb120852cebd84671f026b355fd1ac1acb5fee48f559f06709f8c25fa4f2ccf84a602de92ff728de5bfdc97610325c803540b349c2c3f1faf18
TeXLive::TLUtils::check_file_and_remove: backtrace:
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:2330: TeXLive::TLUtils::check_file_and_remove
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1976: TeXLive::TLUtils::unpack
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1811: TeXLive::TLPDB::_install_data
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1727: TeXLive::TLPDB::not_virtual_install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:1552: TeXLive::TLPDB::install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:2160: TeXLive::TLUtils::install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:980: main::do_install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:732: main::do_installation
TeXLive::TLUtils::check_file_and_remove:   removing C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\ihYA0IWEp_/luahbtex.win32.tar.xz, but saving copy in C:\Users\mishk\AppData\Local\Temp\Ku6tO0tyna
TLPDB::_install_data: downloading did not succeed (check_file_and_remove failed) for http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet/archive/luahbtex.win32.tar.xz
TLUtils::install_packages: Failed to install luahbtex.win32
Will be retried later.
Installing [35/64, time/total: 00:27/01:00]: luatex [1867k]
Installing [36/64, time/total: 00:28/00:58]: luatex.win32 [1780k]
TeXLive::TLUtils::check_file_and_remove: checksums differ for C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\yKP08lsWBY/luatex.win32.tar.xz:
TeXLive::TLUtils::check_file_and_remove:   tlchecksum=2e22def143606949b8eab4ce7a0850768e1d78ed9bccdfc35db54f6caabb22788f324c323c4b9f51827463f3c5e848c62821beef24d00ead81078d7c03f49232, arg=c0ce160951a2c73f733c573db352d13ccb953c9d2313f09b2535118c02a906b473877c981b7afd44cb15461a567bb788e10522d8bfbb13288f11ee7e1cf0f23c
TeXLive::TLUtils::check_file_and_remove: backtrace:
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:2330: TeXLive::TLUtils::check_file_and_remove
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1976: TeXLive::TLUtils::unpack
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1811: TeXLive::TLPDB::_install_data
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1727: TeXLive::TLPDB::not_virtual_install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:1552: TeXLive::TLPDB::install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:2160: TeXLive::TLUtils::install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:980: main::do_install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:732: main::do_installation
TeXLive::TLUtils::check_file_and_remove:   removing C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\yKP08lsWBY/luatex.win32.tar.xz, but saving copy in C:\Users\mishk\AppData\Local\Temp\rCImd3CKoo
TLPDB::_install_data: downloading did not succeed (check_file_and_remove failed) for http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet/archive/luatex.win32.tar.xz
TLUtils::install_packages: Failed to install luatex.win32
Will be retried later.
Installing [37/64, time/total: 00:29/01:00]: makeindex [460k]
Installing [38/64, time/total: 00:30/01:01]: makeindex.win32 [18k]
Installing [39/64, time/total: 00:30/01:01]: metafont [80k]
Installing [40/64, time/total: 00:30/01:00]: metafont.win32 [142k]
Installing [41/64, time/total: 00:31/01:02]: mflogo [242k]
Installing [42/64, time/total: 00:31/01:02]: mfware [102k]
Installing [43/64, time/total: 00:32/01:03]: mfware.win32 [58k]
Installing [44/64, time/total: 00:32/01:03]: modes [294k]
Installing [45/64, time/total: 00:32/01:02]: pdftex [1610k]
Installing [46/64, time/total: 00:34/01:03]: pdftex.win32 [693k]
Installing [47/64, time/total: 00:34/01:01]: plain [70k]
Installing [48/64, time/total: 00:35/01:03]: tex [77k]
Installing [49/64, time/total: 00:35/01:03]: tex-ini-files [5k]
Installing [50/64, time/total: 00:35/01:03]: tex.win32 [130k]
Installing [51/64, time/total: 00:36/01:04]: texlive-common [471k]
Installing [52/64, time/total: 00:36/01:03]: texlive-docindex [159k]
Installing [53/64, time/total: 00:37/01:05]: texlive-en [1848k]
Installing [54/64, time/total: 00:38/01:02]: texlive-msg-translations [138k]
Installing [55/64, time/total: 00:38/01:02]: texlive-scripts [344k]
Installing [56/64, time/total: 00:39/01:03]: texlive-scripts.win32 [36k]
Installing [57/64, time/total: 00:39/01:03]: tlgs.win32 [6674k]
Installing [58/64, time/total: 00:45/01:00]: tlpsv.win32 [1411k]
Installing [59/64, time/total: 00:46/01:00]: tlshell [27k]
Installing [60/64, time/total: 00:46/01:00]: tlshell.win32 [2599k]
Installing [61/64, time/total: 00:48/00:58]: unicode-data [289k]
Installing [62/64, time/total: 00:49/00:59]: updmap-map [295k]
Installing [63/64, time/total: 00:50/01:00]: wintools.win32 [5816k]
Installing [64/64, time/total: 00:56/00:59]: xdvi [175k]
Retrying to install: luahbtex.win32 [1515k]
TeXLive::TLUtils::check_file_and_remove: checksums differ for C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\mKPyES02sC/luahbtex.win32.tar.xz:
TeXLive::TLUtils::check_file_and_remove:   tlchecksum=5e395b24bd9e710be88f1f2e2a3bd18022daf3cf1e2be18d27192eccea50f5ddaa122c6ae8cd4cce6b54d3a8608ae9e119d0dbf25d1e37aa2da8a986aa0a0c70, arg=04f90e04de858fb120852cebd84671f026b355fd1ac1acb5fee48f559f06709f8c25fa4f2ccf84a602de92ff728de5bfdc97610325c803540b349c2c3f1faf18
TeXLive::TLUtils::check_file_and_remove: backtrace:
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:2330: TeXLive::TLUtils::check_file_and_remove
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1976: TeXLive::TLUtils::unpack
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1811: TeXLive::TLPDB::_install_data
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLPDB.pm:1727: TeXLive::TLPDB::not_virtual_install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/tlpkg/TeXLive/TLUtils.pm:1566: TeXLive::TLPDB::install_package
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:2160: TeXLive::TLUtils::install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:980: main::do_install_packages
 -> C:/Users/mishk/Downloads/install-tl-20200512/install-tl:732: main::do_installation
TeXLive::TLUtils::check_file_and_remove:   removing C:\Users\mishk\AppData\Local\Temp\CquMnkiesJ\mKPyES02sC/luahbtex.win32.tar.xz, but saving copy in C:\Users\mishk\AppData\Local\Temp\nBsmWFlBXt
TLPDB::_install_data: downloading did not succeed (check_file_and_remove failed) for http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet/archive/luahbtex.win32.tar.xz
Installation failed.
Rerunning the installer will try to restart the installation.
Or you can restart by running the installer with:
  install-tl-windows.bat --repository http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet --profile installation.profile [YOUR-EXTRA-ARGS]
or
  install-tl-advanced.bat --repository http://mirror.datacenter.by/pub/mirrors/CTAN/systems/texlive/tlnet --profile installation.profile [YOUR-EXTRA-ARGS]

A: I had the same problem and the same error messages reinstalling TexLive, both on clean Windows and during an upgrade.
As a workaround, you may download the TexLive2020 ISO and use it instead of the network installer which is searching the latest package repo. Present ISO has date 2020-04-06.
You may find the download at CTAN Directory systems/texlive/Images or follow the link:
https://ctan.org/tex-archive/systems/texlive/Images
After mounting the image, run the "install-tl-windows.bat" as admin and follow normal install (verify that the install is pointing to the ISO and not net.repo).


text:
Q: Can't understand how to use SAM interface in Kotlin I can't understand why the following code works:
Sam Interface:
    fun interface WebResponseHandler
{
    fun onWebResponseFinished(jsonObject:JSONObject)
}

and Implemnetaiton looks like:
  val onWebResponseHandler: VolleyHandler.WebResponseHandler = VolleyHandler.WebResponseHandler()
{
    fun onWebResponseFinished(jsonObject: JSONObject) {
        Log.v("da", "dsa")
    }

    fun foo() {
        it.getString("name")
    }
}

How does foo function knows what is it? After all, foo function isn't part of the VolleyHandler.WebResponseHandler interface, and it works only when interface as only one method.Function Foo is being called without any arguments, so why is the meaning of it there?
In addition another problem occurs if I'm omitting the keyword fun from the interface declaration, when i'm trying to implement the interface:
val onWebResponseHandler: VolleyHandler.WebResponseHandler = VolleyHandler.WebResponseHandler()
{
    fun onWebResponseFinished(jsonObject: JSONObject) {
        Log.v("da", "dsa")
    }

    fun foo() {
        Log.v("something", "something")

    }
}

I'm getting a compilation error saying

Interface WebResponseHandler does not have constructors

what is the different between both situation? If i remove the () i'm getting a lot of different errors like :

Function declaration must have a name

I hope someone can figure out what is wrong here

A: It's not Kotlin that's a mess, it's that you're using the wrong syntax for what you want to do.
What fun interface lets you do is write
val onWebResponseHandler = VolleyHandler.WebResponseHandler {
    jsonObject: JSONObject -> Log.v("da", "dsa")
}

What you can do with a normal interface is write
val onWebResponseHandler = object : VolleyHandler.WebResponseHandler() {
    fun onWebResponseFinished(jsonObject: JSONObject) {
        Log.v("da", "dsa")
    }

    fun foo() {
        Log.v("something", "something")

    }
}

Your code does none of those things, and when compiled, doesn't do anything like what you mean it to.  What you wrote is equivalent to
val onWebResponseHandler = VolleyHandler.WebResponseHandler() {
  unusedJsonObject: JSONObject ->
    fun aFunctionWhichIsDefinedAndNeverCalled(jsonObject: JSONObject) {
        Log.v("da", "dsa")
    }

    fun anotherFunctionWhichIsDefinedAndNeverCalled() {
        unusedJsonObject.getString("name")
    }
    // doesn't actually do anything at all when executed
    // just defines functions which aren't ever invoked
}

...which compiles because, since it's a fun interface, you can just pass a lambda to the constructor, but doesn't actually do anything resembling what you expect.

A: Here's a different way of explaining it that might help.
If you want to assign an implementation of an interface to a variable or property, you usually have to use an anonymous class syntax like this. Note the use of object:  and override.
val onWebResponseHandler = object : VolleyHandler.WebResponseHandler {
    override fun onWebResponseFinished(jsonObject: JSONObject) {
        Log.v("da", jsonObject.toString())
    }
}

You could also define other public functions in your anonymous class, but this is pointless because there is no way to access the unique members of an anonymous class, so you would not be able to call the function foo() in this example:
val onWebResponseHandler = object : VolleyHandler.WebResponseHandler {
    override fun onWebResponseFinished(jsonObject: JSONObject) {
        Log.v("da", jsonObject.toString())
    }

    fun foo() {
        Log.v("something", "something")
    }
}

If you make your interface a fun interface, that enables the use of lambda syntax to define that single function like this. This is what SAM conversion is. It treats your lambda as an anonymous implementation of your interface.
val onWebResponseHandler = VolleyHandler.WebResponseHandler { jsonObject ->
    Log.v("da", jsonObject.toString())
}

Furthermore, if a lambda has only one parameter, you can omit defining the parameter name, and simply call it it so this is equivalent to the above:
val onWebResponseHandler = VolleyHandler.WebResponseHandler {
    Log.v("da", it.toString())
}

Also, be aware that you can define a function anywhere in your code, including right in the middle of another function. For example:
fun bar() {

    fun foo() {
        Log.i("foo", "foo")
    }

    foo()
}

is equivalent to
fun bar() {

    val foo: () -> Unit = {
        Log.i("foo", "foo")
    }

    foo() // or foo.invoke()
}

So in your original code, you combined these concepts to create a lambda function that has other functions defined in it that are never used. The confusion probably comes because it looks similar to my top block of code, where we are defining an anonymous class with the object: syntax. The big difference is that you omitted object: and override, so you are using the lambda syntax. Your code is equivalent to:
val onWebResponseHandler = VolleyHandler.WebResponseHandler { jsonObject ->

    val onWebResponseFinished: (JSONObject) -> Unit = {
        Log.v("da", "dsa")
    }

    val foo: () -> Unit = {
        jsonObject.getString("name")
    }

}

which without lambda syntax (SAM conversion) would look like
val onWebResponseHandler = object : VolleyHandler.WebResponseHandler {
    override fun onWebResponseFinished(jsonObject: JSONObject) {
        val onWebResponseFinished: (JSONObject) -> Unit = {
            Log.v("da", "dsa")
        }

        val foo: () -> Unit = {
            jsonObject.getString("name")
        }
    }
}


text:
Q: How to stop Apache redirecting to index.html I have a Django app that I am serving with Apache using uwsgi.
When I go to
http://www.myserver.com/
Apache redirects me to
http://www.myserver.com/index.html/
Which then gives me an error "page not found" (the site does not use an index.html page).
The other URLs work fine, eg http://www.myserver.com/mystuff - is correctly served.
How can I stop Apache redirecting the start site to index.html

A: There are 2 places to look for the problem:

*

*httpd.conf, .htaccess  - both are apache web server configuration files.

*301 redirects(if you used any before). If you had any, you won't get to your root url unless you purge browser url routing cache(clearing browser data on chrome doesn't help, for example). How to do that - depends on your browser. To read more on that topic http://getluky.net/2010/12/14/301-redirects-cannot-be-undon/


text:
Q: 'Out of memory error' when building Android on a VM So, I'm trying to build Android. I select a device by lunch, make clean, and then run make updatepackage with various -j switches.
However, the build will fail with following error:
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp
Out of memory error (version 1.2-a24 'Carnac' (283001 7e39a352cafc1eb3b4ae95846a101b93ccbc9cf0)).
Java heap space.
Try increasing heap size with java option '-Xmx<size>'.
Warning: This may have produced partial or corrupted output.
[ 42% 11683/27285] build out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jack
ninja: build stopped: subcommand failed.
build/core/ninja.mk:144: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

The OS I'm using is Ubuntu 15.10 on a 4-core VM. I've tried adding more swap memory (currently it's 8GB and 24GB as swap), selecting various -j values (4 to 10), and as per GC overhead limit exceeded when building android source , changing -Xmx value.
As to the last one, the only reference to -Xmx is there:
APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"

However, changing it to more from 1024m to anything else changes nothing.
So, what could I do to make it build?


text:
Q: It's/I'm acting in your best interest/interests The plural version is more common according to Google ngram. It is also used as an example in Cambridge's dictionary.

It's in his interests to keep careful records

However, I would like to know whether the plural and the singular versions are equally perfect to use without sounding unnatural.
If there is any difference, of course I would like to learn about it.
Singular:

It's/I'm acting in your best interest

Plural:

It's/I'm acting in your best interests

Google ngram is provided for both with "your" and without:
your best interest,your best interests,best interest,best interests

A: From the definition of the word interest in Macmillan's Dictionary
Sense 5
[countable/uncountable] an advantage or benefit to someone or something
be in your (own) interest(s) (=bring an advantage or benefit):

It's in their own interest to cooperate.

have someone's (best) interests at heart (=want to help them):

He claims he has only my best interests at heart.

be in someone's/something's (best) interest(s) (=bring an advantage or benefit):

The president doesn't believe the plan is in the best interest of the company.

However, The FreeDictionary gives two versions for the idiom "... at heart"
have someone's best interest(s) at heart
to make decisions based on someone's best interests.

I know she was only doing what would benefit her, but she said she had
  my best interests at heart.

And from Oxford Dictionaries, it seems that interests is generally more common.
in the interests (or interest) of something
2 For the benefit of:

in the interests of security we are keeping the information confidential
One such principle holds that space is to be explored and used 'for
  the benefit and in the interests of all countries.'
We are doing so because it is in our best interests and in the
  interests of our citizens.
The Government should act in their interests and not just in the
  interests of the elite who can afford to build nursing homes.

It seems it is a question that may bug some native speakers too!
A relevant question on the Web: question for grammar junkies.....

Is it... "..in the child's best interest?" or "...in the child's best
  interests?"
Does the answer change if you change "child" to "children?"

NB: Since the proof was in Macmillan's dictionary already, I should consult more than one dictionary from now on. In fact, many times I find clearer answers and definitely some examples when they are not provided in Cambridge's. I like Cambridge's look and feel more and it is a decent work to be honest.
Edit:
This one is even more interesting!
in the interest v. in the interests
Edit 2
With this, the post should come to an end
Best interest or interests?
MIND OUR ENGLISH
The Star Online
, Thursday April 10, 2008

IS IT grammatically correct to say "I have your best interest at
  heart" or "I have your best interests at heart"?
Assuming both of the above are correct, in the following sentence,
  which would you say works better?
"Your priorities are important so believe us when we say that we have
  your best interest(s) at heart."
– Viv
1) Both are grammatically correct, but when "interest" means
  "advantage" or "benefit", the plural "interests" is more often used.
2) I would go for "best interests".


text:
Q: Windows 7 task bar at autohide, make it totally disapear? My desktop look is empty so all I have is a nice wallpaper. My Windows taskbar has the "Taskbar Appearance" setting to "Auto-hide the taskbar". Although hidden, it leaves a thin top layer so you can still see it a bit, and where the pinned shortcuts are. Is it possible to totally have it hidden without a trace? This is a serious question. It really bugs m.

A: I know I'm really late here but this exact same thing was bugging me and having to hit a hotkey when I needed the taskbar got old fast so I finally wrote my own program to hide the taskbar. In case you still want or need it, here's a download link:
ShyBar
I should warn you that while its completely stable on both my systems, this is very new code so there may be some minor bugs in there. Mostly cosmetic stuff though, nothing to fear.

A: Try solution proposed here (Aviassin Taskbar Eliminator).

A: I found it.
http://www.thewindowsclub.com/hide-taskbar-windows-7-hotkey
It isn't quite what you are looking for.  Hitting CtrlEsc will completely hide the taskbar.  Hitting it again brings it back up.  Mousing over it though won't bring it up.

It looks similar to this program, Taskbar Activate. This program is very old, but it hits your exact specifications. Completely hidden taskbar with mouseover support.
There is an occasional bug where the start button continues to show, but the taskbar is hidden.
Hope that helps.

A: Here's another late reply:
I was annoyed by the 1px border and the loss of an entire screen edge, so I wrote some software to deal with this a while ago. You can find it here: https://github.com/ihameed/task-homie/releases
There's no installation necessary. Just run the executable.
This software doesn't support configurable mouse hot zones; once the taskbar is hidden, it can only be summoned again with the logo key or with ctrl-esc (or programmatically). This is intentional. Unlike Taskbar Eliminator, this doesn't require using a new non-standard keyboard shortcut to hide and display the taskbar.


text:
Q: What is the meaning of $n\log^2(n)$ I know this seems ridiculously an obvious thing but: What does $n\log^2(n)$ mean? Does it mean $n\log (\log(n))$ or $n\log(n)^2$? I am trying to compare it with $n\log(n)$ to check which one of the two is bigger for large $n\in \mathbb{N}$.

A: I would say that it means $$n[\log(n)]^2.$$

A: The usual interpretation is $n\log^2n=n(\log n)^2$.

A: It's simple exponentiation:
$$\log^2(n) = \log(n)*\log(n)$$

A: Maybe you have seen the notation $\cos^2(x)$, as in $\cos^2(x)+\sin^2(x) = 1$. This is just notation, and it means $\cos^2(x) = (\cos(x))^2$.
Similarly for $\log$.


text:
Q: Angular 5 router.navigate error There is an user crud page and when an new user is saved is necessary that url change with id parameter that user saved. I don't known what happen but when call this.router.navigate(['/user', user.id]) an error happens. Following the code with router and component where the error occur.
Url to create a new user
http://localhost:4200/user
Url to update user
http://localhost:4200/user/38
//route config
    const routes: Routes = [
  {
    path: ':id',
    component: UserComponent,
    resolve: {
      user: UserResolve
    }
  },
  {
    path: '',
    component: UserComponent,
    resolve: {
      user: UserResolve
    }
  }
]

//component
this.router.navigate(['/user', user.id])

//error
ERROR Error: Uncaught (in promise): [object Object]
    at resolvePromise (zone.js:824)
    at resolvePromise (zone.js:795)
    at eval (zone.js:873)
    at ZoneDelegate.invokeTask (zone.js:425)
    at Object.onInvokeTask (core.js:4620)
    at ZoneDelegate.invokeTask (zone.js:424)
    at Zone.runTask (zone.js:192)
    at drainMicroTaskQueue (zone.js:602)
    at ZoneTask.invokeTask [as invoke] (zone.js:503)
    at invokeTask (zone.js:1540)

A: I've just started to learn angular a few weeks ago so i'm just trying to help.
in your routes ts file you are linking '' to UserComponent but you are expecting the router to load the UserComponent when the path '/user' is called.
Replace the empty '' by user and tell us what's new. Thanks !


text:
Q: Exception has occurred. _CastError (type '_InternalLinkedHashMap' is not a subtype of type 'List' in type cast) uisng getx I TRIED USING MAP TO COLLECT DATA BUT IT DOESN'T WORK EITHER I AM TRYING TO GET LIST OF PRICE FROM REST API USING GETX IN FLUTTER BUT RESULTING TO THE ERROR BELOW SAYING CAST ERROR ON LOADING APP

A: You are receiving a map and trying to parse in as a List. Thats what the error is telling you.
I would approach this by creating a model class for the and serialising the data there.
class User {
  final String name;
  final String email;

  User(this.name, this.email);

  User.fromJson(Map<String, dynamic> json)
      : name = json['name'],
        email = json['email'];

  Map<String, dynamic> toJson() => {
        'name': name,
        'email': email,
      };
}

example from flutter docs