text:
Q: How can I transform a date to string when the date is retrieved from a SQL? I am trying to show the DATE in a word document. However, the code broke with the following exception. (I believe I need to change the DATE to STRING
    d.add_run(date_implemented(Part_No_New_Part))
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\python_docx-0.8.7-py3.7.egg\docx\text\paragraph.py", line 37, in add_run
    run.text = text
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\python_docx-0.8.7-py3.7.egg\docx\text\run.py", line 163, in text
    self._r.text = text
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\python_docx-0.8.7-py3.7.egg\docx\oxml\text\run.py", line 104, in text
    _RunContentAppender.append_to_run_from_text(self, text)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\python_docx-0.8.7-py3.7.egg\docx\oxml\text\run.py", line 134, in append_to_run_from_text
    appender.add_text(text)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\python_docx-0.8.7-py3.7.egg\docx\oxml\text\run.py", line 142, in add_text
    self.add_char(char)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\python_docx-0.8.7-py3.7.egg\docx\oxml\text\run.py", line 156, in add_char
    elif char in '\r\n':
TypeError: 'in <string>' requires string as left operand, not datetime.datetime

Repl Closed
I am able to generate the document. However, this is my Output
Date implemented: (datetime.datetime(2011, 5, 31, 0, 0),)
I want my output to be like this:
Date Implemented: 5/31/2015

The functions are the following:
def date_implemented(Part_No_New_Part):
    dsn_tns = cx_Oracle.makedsn('Server_NAME', 'XXXXX', service_name='TEST')
    conn = cx_Oracle.connect(user=r'XXX', password='XXXX', dsn=dsn_tns)
    c = conn.cursor()
    w_sql =('SELECT RELEASED_DT FROM TABLE1
       WHERE PART_NO = UPPER(TRIM(:Part_No_New_Part)) AND STATE =\'Released\'')
    c.execute(w_sql,[Part_No_New_Part])
    for result in c:
        if result ==' ':
            print(" ")
        else:
            print('')
    return result

def document(result):
        d = doc.add_paragraph()
    d.add_run('Date implemented: ').bold=True
    d.add_run(date_implemented(Part_No_New_Part))

A: So you could either use
str(date_var_from_sql)

or if you want a custom format:
date_var_from_sql.strftime('%m/%d/%Y')

See this for the format string syntax for strftime


text:
Q: `activator ~ run` doesn't work When running activator ~ run, here is what happens:

*

*When the dev server first runs, I get a message in the console saying that the server is listening on port 9000.

*Now, when I make changes to the files and save, nothing is outputted to the console.

*When I refresh the page, however, I see a message about reload in the console, and the browser loads.

I thought ~ run meant re-run at every file change?

A: Open your build.sbt file and check if it contains line like fork in run := true in it. If it does, delete the line or set the value to false.
Why is that?
this fork is required by Activator UI to spawn the processes, so every time, when you are starting your app from UI, it adds the line first to make sure that will exist. Anyway it causes some problems with hot reload (and also some other weird things, like app hanging, memory leaks).

A: According to Play Docs:

Tip: You can run your application using ~run to enable direct compilation on file change. This way scala template files are auto discovered when you create a new template in view and auto compiled when the file changes. If you use normal run then you have to hit Refresh on your browser each time.

So it apparently only applies to Scala template files.
EDIT
Ryan is right, just tested it and it works also for Scala files.
Since it does not work at all with the whitespace between "~" and "run" I suppose that's not a problem as well (you quoted it with whitespace).

A: Have you tried starting the console first by typing
activator

Then after the console is up you could type
[your-app] $ ~run

Usually, whenever any files changed/added. It will trigger compilation process.

redpajama_set_name: RedPajamaStackExchange


text:
Q: BootstrapVue access b-table row data in slot template I have a delete button on each row and I need to get log_id from items to pass to function deleteLog.  That function always alerts log_id is undefined.
How can I pass log_id to the function deleteLog without undefined?
<template>
    <b-table striped hover :items="items" :fields="fields">
        <template v-slot:cell(Delete)>
            <b-button variant="danger" v-on:click="deleteLog(log_id)">Delete</b-button>
        </template>
    </b-table>
</template>

<script>
export default {
    data() {
        return {
            fields: ['Year', 'Month', 'Round', 'Name', 'Delete', 'log_id'],
            items: []
        }
    }
}
</script>

A: You can access the row data and its log_id through the slot data:
<b-table striped hover :items="items" :fields="fields">
    <template v-slot:cell(Delete)="data"> <!-- `data` -->
        <b-button variant="danger" v-on:click="deleteLog(data.item.log_id)">Delete</b-button>
    </template>
</b-table>

Here's another syntax, destructuring the slot data:
<b-table striped hover :items="items" :fields="fields">
    <template v-slot:cell(Delete)="{ item }"> <!-- `item` -->
      <b-button variant="danger" v-on:click="deleteLog(item.log_id)">Delete</b-button>
    </template>
</b-table>


text:
Q: maas-dhcpd is not on because bind9 127.0.0.1#954: connection refused Do anyone know how to resolve this issue?
Service 'maas-dhcpd' is not on, it will be started.
Service 'bind9' failed to start. Its current state is 'dead' and 'Result: exit-code'.
Reloading BIND failed (is it running?): Command `rndc -c /etc/bind/maas/rndc.conf.maas reload` returned non-zero exit status 1:#012rndc: connect failed: 127.0.0.1#954: connection refused

I have 2 subnets, one bridge and one local network with 3 interfaces
eth0, eth1, br1
my network interfaces:
source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback
dns-nameservers x.x.1.1
dns-search maas

# The primary network interface
auto eth0
iface eth0 inet static
address x.x.1.2
netmask 255.255.255.0
gateway x.x.1.1
dns-nameservers x.x.1.1 8.8.8.8 8.8.4.4
mtu 1500

auto eth1
iface eth1 inet manual
mtu 1500

auto br1
iface br1 inet static
address x.x.30.1
netmask 255.255.255.0
   bridge_ports eth1
   bridge_stp off
   bridge_fd 0
   bridge_maxwait 0

Maas subnet configuration from UI:
Managed allocation is disabled for below:
Name x.x.1.0/24
CIDR x.x.1.0/24
Gateway IP x.x.1.2
DNS 172.16.1.1

Managed allocation is enabled for below:
Name x.x.30.0/24
CIDR x.x.30.0/24
Gateway IP x.x.30.1
DNS x.x.1.1

Running sudo rndc -c /etc/bind/maas/rndc.conf.maas reload ends up with:
rndc: connect failed: 127.0.0.1#954: connection refused

I'm not sure what am I missing, this MaaS version is 2.5
Additional note: for while i'm investigating, I noticed that there are duplicated entries in named.conf.maas, if I fix the duplicate manually, it will be autogenerated again and back to the same issue.
/etc/bind/maas/named.conf.maas:92: zone 'x.y.z.in-addr.arpa': already exists previous definition: /etc/bind/maas/named.conf.maas:56

The above issue is related to https://discourse.maas.io/t/facing-old-bug-lp-1683047-with-maas-2-5-stable-bind9-fails-to-start-duplicated-entry/314

A: I managed to solve this issue following https://discourse.maas.io/t/facing-old-bug-lp-1683047-with-maas-2-5-stable-bind9-fails-to-start-duplicated-entry/314/7?u=atdhrhs

I couldn't find the duplicated ips, however i deleted those ones that i get the error about, and it worked.


text:
Q: How detect smooth movement in android I am trying to detect the movement of android device since my app starts when movement detected, for that i am using  accelerometer motion sensor. But it is detecting movement when phone shakes,  but not working for smooth movement. I am not getting how to detect smooth movement.
Here is my motion sensor code on accelerometer.
  public void onSensorChanged(SensorEvent event) {
        // TODO Auto-generated method stub
        TextView tvX= (TextView)findViewById(R.id.x_axis);
        TextView tvY= (TextView)findViewById(R.id.y_axis);
        TextView tvZ= (TextView)findViewById(R.id.z_axis);
        ImageView iv = (ImageView)findViewById(R.id.image);
        float x = event.values[0];
        float y = event.values[1];
        float z = event.values[2];
        if (!mInitialized) {
            mLastX = x;
            mLastY = y;
            mLastZ = z;
            tvX.setText("0.0");
            tvY.setText("0.0");
            tvZ.setText("0.0");
            mInitialized = true;
        } else {
            float deltaX = Math.abs(mLastX - x);
            float deltaY = Math.abs(mLastY - y);
            float deltaZ = Math.abs(mLastZ - z);
            if (deltaX < NOISE) deltaX = (float)0.0;
            if (deltaY < NOISE) deltaY = (float)0.0;
            if (deltaZ < NOISE) deltaZ = (float)0.0;
            mLastX = x;
            mLastY = y;
            mLastZ = z;
            tvX.setText(Float.toString(deltaX));
            tvY.setText(Float.toString(deltaY));
            tvZ.setText(Float.toString(deltaZ));
            iv.setVisibility(View.VISIBLE);

            if(deltaX!=0||deltaY!=0||deltaZ!=0)
            {
                Handler gpsHandler = new Handler();
            //  locateHandler.sendEmptyMessage(1);

                 gpsHandler.post(new Runnable() {
                     public void run() {
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mlocListener);}});
            }

        }

    }


text:
Q: Does GPflow 2.0 support putting priors on (hyper)parameters of GPs? I would like to put some prior on the (hyper)parameters of the GP models in GPflow, but I cannot find any module (like gpflow.priors) or doc about this issue.
Besides, I noticed that prior is one of the arguments of the class parameter, together with a question.

A: GPflow 2.0 uses tensorflow_probability distributions objects for the priors, e.g.
model.kernel.lengthscales.prior = tensorflow_probability.distributions.Gamma(
    gpflow.utilities.to_default_float(1.0), gpflow.utilities.to_default_float(1.0)
)

(or pass the distribution object as the prior argument of the gpflow.Parameter class). Note that TensorFlow by default uses float32, whereas with GPs we typically want to work in float64 - hence the calls to to_default_float.
This is mentioned in the documentation, both in the notebook on understanding models and discussed in depth in the notebook on how to use MCMC with GPflow.


text:
Q: Fix Bounce Rate of google analytics My website consists of many webpages having only a download option for file. Now these webpages are crawled by google and now people are visiting those webpages and downloading the files but the bounce rate is increasing as they only need to  visit one webpage.
How do i fix my bounce rate?
Will setting timer on download button help?
what do i need to do?
Additional Information: I am using LAMP
My webpage looks like this page

A: Track your download as event (e.g. with an onclick event on the download button) and set the "nointeraction" flag to false (or do not set it at all since false is the default). Then people with download will have two interactions (so they are not bounces) while people who did not interact with your page will still count as bounces.
Example w/ jQuery:
<button id="download" name="mydocument">
 <script>
 $('#download').click(function(){
  ga('send','event','download',this.name);
 });
</script>

Documentation for event tracking is here.
Timers do not measure interaction, so I would not use them. Rather use clicks, scroll events or anything else that indicates your user is actually doing something.


text:
Q: Polynomial Growth on a Region The current question is related to this past question.
Let $f(z)$ be an entire function. If $|f(z)|<|z|^n$ for $|\text{Im}(z)|>1$, does it follow that $f(z)$ is a polynomial?
I know how to prove the statement is true if we haven't restricted the domain where the inequality holds; in fact, we could then say it's a polynomial of degree at most $n$. This makes me lean toward assuming the statement here is true. When I asked my professor, he wasn't as convinced, so I thought I'd come here.
Does anyone have any proofs or counterexample to the above?

A: A counterexample is provided on p. 165 of the book Complex Analysis by Joseph Bak and Donald Newman; their function is bounded by a constant on $|\text{Im}(z)|\geq \pi$, but obviously you can adjust accordingly.
I'll paraphrase the idea, though you can view it yourself on the Google preview of the book. Put
$$
f(z) = \int_0^\infty \frac{e^{zt}}{t^t}\,dt;
$$
the integral converges absolutely for every $z$, and by applying Fubini's and Morera's theorems one sees that $f$ is entire. Likewise, it is clear from the formula that $\overline{f(z)} = f(\bar{z})$, so $f$ is symmetric about the real axis and we need only show that $|f(z)| \leq C$ for some constant $C$ on $\text{Im}(z)>\pi$. To prove this bound, they use the analyticity of the integrand (in the integral defining $f$) in the variable $t$ to replace the integral over the real line with the limit of two contour integrals:
$$
\int_0^\infty \frac{e^{zt}}{t^t}\,dt = \int_{I}-\lim_{r\to \infty} \int_{c_r} \frac{e^{zt}}{t^t}\,dt;
$$
here $I$ is the imaginary axis and $c_r$ is the quarter circle of radius $r$ in the upper right quadrant. They then parametrize both curves and bound the integrands straightforwardly to show that $f$ is bounded when $\text{Im}(z)>\pi$.


text:
Q: Problema ao criar minimax em jogo de xadrez Estou codificando um jogo de xadrez apenas no C puro. O jogo em si está pronto, estou a algum tempo tentando desenvolver o algoritmo de minimax. Atualmente o algoritmo está quase pronto, porém ainda não está retornando e eu acho que o problema está na função do minimax.
Atual código abaixo, eu tentei rodar ele, mas quando a IA tenta jogar, simplesmente o jogo termina, aparenta ser um loop novamente, mas não identifiquei ele.
// liberando o lixo acumulado
void LiberarMemoria(Lista_ia* root){
    Jogadas* next = root->head;
    while(next != NULL){
        Jogadas* tmp = next;
        next = next->prox;
        free(tmp);
    }
    free(root);
}

// Simulate 5 turn ahead for choose the best current move
Jogadas *minimax(int tabuleiro[TAM][TAM], int depth, int Player, Jogadas* novaJogada){

    // Copy the board for don't change it
    int i, j, copia[TAM][TAM];
    for(i=0; i<=9; i++){
        for(j=0; j<=9; j++){
            copia[i][j] = tabuleiro[i][j];
        }
    }

    copia[novaJogada->lin_dps][novaJogada->col_dps] = copia[novaJogada->lin_atual][novaJogada->col_atual];
    copia[novaJogada->lin_atual][novaJogada->col_atual] = 0;

    if(gameover(tabuleiro) == 1){
        // Se o Player 2 (Computer) jogou e ganhou, agr seria a vez do player 1
        if (Player == 1){
            novaJogada->pontuacao = -99999;
            return novaJogada;
        }
        else{
            novaJogada->pontuacao = 99999;
            return novaJogada;
        }
    }

    if(depth == 0){
        return novaJogada;
    }

    Lista_ia *Moves = inicializarLista();

    verificar_jogadas_possiveis(copia, Moves, Player);

    Jogadas *tmp;

    // Simulating the current Player 2 (Computer) move
    if(Player == 2){
        novaJogada->pontuacao = -9999;

        for(tmp = Moves->head; tmp != NULL; tmp = tmp->prox){

            Jogadas *BestMove = minimax(copia, depth - 1, 1, tmp);

            if(BestMove->pontuacao > novaJogada->pontuacao){
                novaJogada->pontuacao = BestMove->pontuacao;
            }
        }
        LiberarMemoria(Moves);
        return novaJogada;
    }
    // Simulating the best Player 1 move
    else{
        novaJogada->pontuacao = 9999;

        for(tmp = Moves->head; tmp != NULL; tmp = tmp->prox){

            Jogadas *BestMove = minimax(copia, depth - 1, 2, tmp);

            if(BestMove->pontuacao < novaJogada->pontuacao){
                novaJogada->pontuacao = BestMove->pontuacao;
            }
        }
        LiberarMemoria(Moves);
        return novaJogada;
    }
}

Jogadas *IniciarMinMax(int tabuleiro[TAM][TAM], int depth, int Player){
    Lista_ia *Moves = inicializarLista();

    // Copy the board for don't change it
    int i, j, copia[TAM][TAM];
    for(i=0; i<=9; i++){
        for(j=0; j<=9; j++){
            copia[i][j] = tabuleiro[i][j];
        }
    }

    verificar_jogadas_possiveis(copia, Moves, Player);

    Jogadas* bestMove = NULL;
    Jogadas* tmp;

    for(tmp = Moves->head; tmp != NULL; tmp = tmp->prox){
        // iniciando busca
        Jogadas *current = minimax(copia, depth, Player, tmp);
        if(bestMove == NULL || current->pontuacao > bestMove->pontuacao){
            bestMove = current;
        }
    }
    // clonando resultado para retornar antes de liberar a memoria
    Jogadas *result = (Jogadas*)malloc(sizeof(Jogadas));
    result->lin_atual = bestMove->lin_atual;
    result->col_atual = bestMove->col_atual;
    result->lin_dps = bestMove->lin_dps;
    result->col_dps = bestMove->col_dps;
    result->pontuacao = bestMove->pontuacao;

    LiberarMemoria(Moves);

    return result;
}

Informações adicionais que pediram para me ajudarem no problema.
typedef struct jogadas{
    int lin_atual;
    int col_atual;
    int lin_dps;
    int col_dps;
    int pontuacao;
    struct jogadas *prox;
}Jogadas;

typedef struct turno{
    int turn;
    struct turno *prox;
}Turno;

typedef struct lista_ia{
    struct jogadas *head;
}Lista_ia;

void verificar_jogadas_possiveis(int tabuleiro[TAM][TAM], Lista_ia *Allmoves, int Player){
    int i, j, m, n;
    Jogadas *tmp;
    for(i=1; i<9; i++){
        for(j=1; j<9; j++){
            if(checar_peca_inimiga(tabuleiro[i][j]) == Player){
                for(m=1; m<9; m++){
                    for(n=1; n<9; n++){
                        tmp = (Jogadas*)malloc(sizeof(Jogadas));
                        tmp->lin_atual = i;
                        tmp->col_atual = j;
                        tmp->lin_dps = m;
                        tmp->col_dps = n;
                        if(validar_jogada(tabuleiro, tmp) == 1){
                            //tmp->pontuacao += pontuar_jogadas(tabuleiro, m, n);
                            tmp->pontuacao = 0;
                            tmp->prox = Allmoves->head;
                            Allmoves->head = tmp;
                        }
                    }
                }
            }
        }
    }
    // Free memory space
    free(tmp);
}

OBS: o for está correto, eu havia me esquecido mas o tabuleiro é uma matriz 10x10 onde as bordas servem apenas para orientar o jogador de onde jogar, como uma batalha naval... A, B, C, D... e 1, 2, 3, 4... etc.

A: Primeiro de tudo você precisa implementar o analisador de posição. Ele é a real inteligência do seu jogo. Quanto melhor você fizer ele, melhor serão as decisões na hora de realizar a jogada.
void ValorPosicaoEstatica(int[TAM][TAM] t, Jogadas* jogada)
{
    // calcular quem esta com vantagem e de quanto e atribuir em jogada
}

Quanto a lista que eu tinha falado era algo assim.
// função auxiliar para dar o start no MinMax
Jogadas* IniciarMinMax(int tabuleiro[TAM][TAM], int profundidade, int player)
{
    Lista_ia *Moves = (Lista_ia*)malloc(sizeof(Lista_ia));
    Moves->head = NULL;

    int x[TAM][TAM];
    for(i=0; i< TAM; i++)
    {
        for(j=0; j < TAM; j++)
        {
            x[i][j] = tabuleiro[i][j];
        }
    }
    verificar_jogadas_possiveis(x, Moves, player);
    Jogadas* bestMove = NULL;
    for(tmp = Moves->head; tmp != NULL; tmp = tmp->prox)
    {
        // iniciando busca
        Jogadas *current = minimax(x, profundidade, player, tmp);
        if(bestMove == NULL || current->pontuacao > bestMove->pontuacao)
        {
            bestMove = current;
        }
    }
    // clonando resultado para retornar antes de liberar a memoria
    Jogadas *result = (Jogadas*)malloc(sizeof(Jogadas));
    result->lin_atual = bestMove->lin_atual;
    result->col_atual = bestMove->col_atual;
    result->lin_dps = bestMove->lin_dps;
    result->col_dps = bestMove->col_dps;
    result->pontuacao = bestMove->pontuacao;

    LiberarMemoria(Moves);

    return result;
}

Adicionei uma função de limpeza, porque no xadrez a quantidade de nós que seu minimax vai correr não é pouco. Como ele não realiza a "poda", ele percorrera todos os nós. Então deve analisar no mínimo 3 ou 4 milhão de nós em uma busca de profundidade 5. Após o sexto turno isso deve ir bem além, só caindo no final de jogo.
// liberando o lixo acumulado
void LiberarMemoria(Lista_ia* root)
{
    Jogadas* next = root->head;
    while(next != NULL)
    {
        Jogadas* tmp = next;
        next = next->prox;
        free(tmp);
    }
    free(root);
}

E por fim refiz o método minmax para fazer sentido com a função de start. Acredito que deve estar ok.
Jogadas *minimax(int tabuleiro[TAM][TAM], int depth, int Player, Jogadas* novaJogada)
{

    // Clona o tabuleiro e executa a jogada pedida
    int copia[TAM][TAM];
    for(i=0; i< TAM; i++)
    {
        for(j=0; j < TAM; j++)
        {
            copia[i][j] = tabuleiro[i][j];
        }
    }
    copia[jogada->lin_dps][jogada->col_dps] = copia[jogada->lin_atual][jogada->col_atual];
    copia[jogada->lin_atual][jogada->col_atual] = 0;

    if(gameover(copia))
    {
        // voce precisa dizer como o jogo acabou
        // se o computador ganhou novaJogada->pontuacao = 99999;
        // se o jogador ganhou novaJogada->pontuacao = -99999;
        // se empatou novaJogada->pontuacao = 0;
        return novaJogada;
    }

    // se a busca ja terminou só retorna o valor da jogada
    if(depth == 0)
    {
        // aqui voce precisa criar a função para o programa saber que valor dar
        // a posição atual, de quem esta na vantagem e por quanto;
        ValorPosicaoEstatica(copia, novaJogada);
        return novaJogada;
    }

    Lista_ia *Moves = (Lista_ia*)malloc(sizeof(Lista_ia));
    Moves->head = NULL;

    verificar_jogadas_possiveis(copia, Moves, Player);

    Jogadas *tmp;

    if(Player == 2)
    {
        novaJogada->pontuacao = -9999;
        for(tmp = Moves->head; tmp != NULL; tmp = tmp->prox)
        {
            Jogadas *BestMove = minimax(copia, depth - 1, 1, tmp);
            if(BestMove->pontuacao > novaJogada->pontuacao)
            {
                novaJogada->pontuacao = BestMove->pontuacao;
            }
        }
        LiberarMemoria(Moves);
        return novaJogada;
    }
    else
    {
        novaJogada->pontuacao = 9999;
        for(tmp = Moves->head; tmp != NULL; tmp = tmp->prox)
        {
            Jogadas *BestMove = minimax(copia, depth - 1, 2, tmp);
            if(BestMove->pontuacao < novaJogada->pontuacao)
            {
                novaJogada->pontuacao = BestMove->pontuacao;
            }
        }
        LiberarMemoria(Moves);
        return novaJogada;
    }
}


text:
Q: Install as an application on a web server? Why? I just registered a domain through discountasp.net.  When I upload an asp.net web application, in order for me to run it, I need to install the folder the web app is located in as an application.  I am still unclear on why this needs to be done?  Can someone provide an explanation.

A: Well,
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1d1c9a73-b4c5-4cfb-ad69-b77fa2e17e19.mspx?mfr=true
is some good initial reading.
Making it an application will allow it to spawn worker threads that are isolated from other applications on your web server (assuming they are using different pools). This is good for security and performance. It's really a lot more in depth that that, but it's a good starting point.


text:
Q: Variadic template function unpack order I have this code:
template<typename ...T>
struct Test
{
    void call(string str)
    {
        abc(get<T>(str)...);
    }

    template<typename U>
    string get(string& inp)
    {
        string ret{ inp[0] };
        inp.erase(0, 1);

        cout << ret << endl; // first "a", next "b", next "c" - everything is ok

        return ret;
    }

    void abc(string a, string b, string c)
    {
        cout << a << " " << b << " " << c << endl; // "b c a" - why?
    }
};

I'm calling it like this:
Test<int, bool, float> test;
test.call("abc");

And the output is b c a thought I expect a b c. Moreover in get() function I have a correct order. Why is this? I can't find any rule about this order.

A: The order of evaluation of function arguments is unspecified.
abc(get<T>(str)...);

That is essentially the same as:
abc(get<T1>(str), get<T2>(str), get<TN>(str));

You could enforce evaluation order by generating an array to store the strings, then dispatching from that array:
template <std::size_t N, std::size_t... Idx>
void call_helper(std::array<std::string, N> arr, std::index_sequence<Idx...>) {
    abc(std::get<Idx>(arr)...);
}

void call(string str)
{
    std::array<std::string,sizeof...(T)> arr { get<T>(str)... };
    call_helper(arr, std::index_sequence_for<T...>{});
}

A: The order of function call arguments are not guaranteed. Therefore, abc(get<T>(str)...); doesn't have a defined order.
See Order of evaluation in C++ function parameters for more details.


text:
Q: whats syntax for calling other scenario in same feature file? I know we can call one scenario into other with syntax
* def ret = call read('fileName.feature@scenarioName')

This is fine, but if i wish to call other scenario from same feature file, it doesn't makes sense to pass file name. I would like some relative path like feature to avoid maintenance if someone renames file.
So my question - is it possible to call other scenario in same feature file without mentioning feature file name?

A: No this is absolutely not possible. Also, this will confuse the hell out of people trying to read your test-suite in the future.
Note that you can use variables (fixed in 0.9.6.RC1)
* def common = 'common.feature'
* def ret = call read(common + '@scenarioName')


text:
Q: Python redirect C++ library stdout to tempfile while it is also redirected in shell I am calling a C++ library in my Python code, and I want to redirect all the stdout of that library into a temp file for post processing. (I know it is a bad design decision.......)
I have read through multiple similar questions and find that this can be done by redirect at the file descriptor level using os.dup2() Redirect stdout and stderr of an external library in Python
redirect_file = tempfile.TemporaryFile(mode='w+b')
stdout_fd = sys.stdout.fileno()
sys.stdout.close()
os.dup2(redirect_file.fileno(), stdout_fd)
# call C++ libaray here, capture output in redirect_file

However, I find that it only works if the Python script is executed without shell redirection. With shell redirection, the C++ library output will not be captured by temp file, and so I cannot do my post processing.
$ python foo.py                        # this works
$ python foo.py > redirected_output     # C++ output will appear in the redirected_output directly

Due to other constraint my code must be executed with redirection in shell, so I need to solve it within Python.


text:
Q: Extracting specific values from column based on other column I have a data frame with the following structure:
d1 <- data.frame(
  stringsAsFactors = FALSE,
             Stock = c("Stock 1","Stock 1","Stock 1",
                       "Stock 2","Stock 2","Stock 2","Stock 3","Stock 3",
                       "Stock 3"),
          Column.1 = c("...","...","...","...",
                       "...","...","...","...","..."),
          Column.2 = c("...","...","...","...",
                       "...","...","...","...","..."),
             Value = c(1, 1, 1, 0.5, 0.5, 0.5, 0.2, 0.2, 0.2)
)

Stock
Column 1
Column 2
Value

Stock 1
...
...
1

Stock 1
...
...
1

Stock 1
...
...
1

Stock 2
...
...
0.5

Stock 2
...
...
0.5

Stock 2
...
...
0.5

Stock 3
...
...
0.2

Stock 3
...
...
0.2

Stock 3
...
...
0.2

But with 2000 stocks. Basically each stock has the same value in the given column. I would like to extract this value for each stock and put it in another data frame which is a list of stocks with different variables that looks like this:
d2 <- data.frame(
  stringsAsFactors = FALSE,
             Stock = c("Stock 1", "Stock 2", "Stock 3", "Stock 4", "Stock 5"),
        Variable.1 = c("y", "y", "y", "y", "y"),
        Variable.2 = c("x", "x", "x", "x", "x"),
             Value = c("1", "0.5", "0.2", "...", "...")
)

Stock
Variable 1
Variable 2
Value

Stock 1
y
x
1

Stock 2
y
x
0.5

Stock 3
y
x
0.2

Stock 4
y
x
...

Stock 5
y
x
...

How do I do this? :)
Edit: There are other columns than the one I want to extract the data from. :)

A: Suppose the first data set you posted is called d1, and the second you posted is called d2. The unique function will remove duplicate elements from your first data.frame.
merge(d2, unique(d1[,c("Stock", "Value")]))

    Stock Variable1 Variable2 Value
1 Stock 1         y         x   1.0
2 Stock 2         y         x   0.5
3 Stock 3         y         x   0.2

If you want to keep all rows from d2, even if there is not a match in d1, you can specify all.x = TRUE in the call to `merge.
merge(d2, unique(d1[,c("Stock", "Value")]), all.x = TRUE)

    Stock Variable1 Variable2 Value
1 Stock 1         y         x   1.0
2 Stock 2         y         x   0.5
3 Stock 3         y         x   0.2
4 Stock 4         y         x    NA
5 Stock 5         y         x    NA

A: Try merge like below
> merge(df2, unique(df1), all.x = TRUE)
   Stock Variable1 Variable2 Value
1 Stock1         y         x   1.0
2 Stock2         y         x   0.5
3 Stock3         y         x   0.2
4 Stock4         y         x    NA
5 Stock5         y         x    NA

Data
> dput(df1)
structure(list(Stock = c("Stock1", "Stock1", "Stock1", "Stock2",
"Stock2", "Stock2", "Stock3", "Stock3", "Stock3"), Value = c(1,
1, 1, 0.5, 0.5, 0.5, 0.2, 0.2, 0.2)), class = "data.frame", row.names = c(NA,
-9L))

> dput(df2)
structure(list(Stock = c("Stock1", "Stock2", "Stock3", "Stock4",
"Stock5"), Variable1 = c("y", "y", "y", "y", "y"), Variable2 = c("x",
"x", "x", "x", "x")), class = "data.frame", row.names = c(NA,
-5L))


text:
Q: How to correctly label an included PDF? I have this:
\label{appendix:b}
\includepdf[scale=0.8,pages=1,pagecommand=\chapter{interview}]{interview/interview}
\includepdf[scale=0.8,pages=2-,pagecommand={}]{interview/interview}
\label{appendix:bslut}

And I'm calling it with cleveref:
\cpagerefrange{appendix:b}{appendix:bslut}

The problem is that I get the wrong page number for the last page -- it adds a page. What should be "pages 1-5" is instead "pages 1-6". I have Googled this like a madman, and I can't figure out what to do. I hope some of the superstars here can help! I have cleveref after hyperref, as recommended...
EDIT: As requested, I tried to make an MWE, but for some reason it gives me:
LaTeX Warning: Reference `appendix:bslut' on page 1 undefined on input line 7.

Here it is, though. "multipage" should be a PDF spanning several pages.
\documentclass{memoir}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\chapter{Foo}
Foo\cpagerefrange{appendix:b}{appendix:bslut}.

\chapter{Bar}
\label{appendix:b}
\includepdf[scale=0.8,pages=1,pagecommand=\chapter{Multipage}]{multipage}
\includepdf[scale=0.8,pages=2-,pagecommand={}]{multipage}
\label{appendix:bslut}

\end{document}

A: The following code gets the chapter title on the first page of the included PDF and enables the correct page references. mypages is a 16 page PDF used merely for demonstration purposes.
\documentclass{memoir}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{cleveref}

\makeatletter
  \newcommand\incpdfchapter{%
    \ifartopt\par\@nameuse{chapterblock}\else
      \thispagestyle{chapter}
      \global\@topnum\z@
    \fi
    \m@mindentafterchapter
    \@ifstar{\@m@mschapter}{\@m@mchapter}}
\makeatother

\begin{document}
\chapter{Foo}
Foo\cpagerefrange{appendix:b}{appendix:bslut}.

\chapter{Bar}
\clearforchapter
\includepdf[scale=0.8,pages=1,pagecommand=\incpdfchapter{Multipage}\label{appendix:b}]{mypages}
\includepdf[scale=0.8,pages=2-15,pagecommand={}]{mypages}
\includepdf[scale=0.8,pages=16,pagecommand={}\label{appendix:bslut}]{mypages}

\end{document}

If you would prefer a more automated solution at the cost of a bit less flexibility in specifying your labels, you might try something like this:
\documentclass{memoir}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{xparse}

\makeatletter
  \newcommand\incpdfchapter{%
    \ifartopt\par\@nameuse{chapterblock}\else
      \thispagestyle{chapter}
      \global\@topnum\z@
    \fi
    \m@mindentafterchapter
    \@ifstar{\@m@mschapter}{\@m@mchapter}}
  \newcounter{incpdfpages}
  \NewDocumentCommand\myincpdf{ d<> O {} m m }{%
    \clearforchapter
    \IfNoValueTF{#1}{%
      \def\incpdflabel{#3}}{%
      \def\incpdflabel{#1}}
    \includepdf[#2, pages=1, pagecommand=\incpdfchapter{#3}\label{\incpdflabel}]{#4}%
    \setcounter{incpdfpages}{1}%
    \includepdf[#2, pages=2-, pagecommand=\refstepcounter{incpdfpages}\label{\incpdflabel:\theincpdfpages}]{#4}%
    }
  \NewDocumentCommand\mysingpdf{ d<> O {} m m }{%
    \clearforchapter
    \IfNoValueTF{#1}{%
      \def\incpdflabel{#3}}{%
      \def\incpdflabel{#1}}
    \includepdf[#2, pages=1, pagecommand=\incpdfchapter{#3}\label{\incpdflabel}]{#4}%
    }
\makeatother

\begin{document}
\chapter{Foo}
Foo\cpagerefrange{appendix:b}{appendix:b:16}. Here is a reference to \cpageref{appendix:c}.

\chapter{Bar}
\myincpdf<appendix:b>[scale=0.8]{My Pages}{mypages}
\mysingpdf<appendix:c>[scale=0.8]{My Other Page}{mygraphics}

\end{document}

Again, mypages.pdf is assumed to be a 16 page PDF. The command \myincpdf<>[]{}{} takes 2 optional and 2 mandatory arguments.

*

*The first optional argument is specified using <> and should be the label you'd like to use for the first page of the included PDF. Labels for later pages are constructed from this label by appending :n where n is the number of the page in the original PDF. For example, if the PDF has 16 pages, the last page gets the label baselabel:16 where baselabel is the label you specified for the first page. If you do not specify the label, it will be set to the value of the chapter title. (Be careful that you do not leave the label unset if the chapter title includes characters which don't work in labels.)

*The second optional argument is specified using []. Include any extra options you want passed to \includepdf here.

*The first mandatory argument should specify the title of the chapter.

*The second mandatory argument should give the PDF file to be included.

Obviously, this is not really tested. I checked it worked for my example and for cases where I omitted the optional arguments but that's all. Caveat emptor.
EDIT: I've updated the code in response to the question concerning single-page PDFs in the comments. \mysingpdf is just like \myincpdf but it will include only the first page of the PDF. Use this command for single-page documents or for cases where you only want the first page to be included.


text:
Q: Each time I turn on my Pokémon it comes up with my husbands Pokémon :( We both have ours under different emails through Google. I've tried uninstalling mine and re-installing but it still comes up his :(

A: You should be able to log out of the account if you start it up without network connectivity.  A "Log out" button appears after a few seconds of trying to log in when there's no connectivity (turn off cellular data and wifi, or try Airplane mode).


text:
Q: Delete empty lines in CSV I'm trying to clean up a CSV file that is builded like this:
;Header1;Header2;Header3;
;;;;
;1;2;3;
;;;;

How can I detect and delete those ";;;;" empty lines with Go?
Edit:
i have this so far (shortened)
r := csv.NewReader(in)
r.Comma = ';'

w := csv.NewWriter(out)
w.Comma = ';'

for {
 rec, err := r.Read()
 if err != nil {
    if err == io.EOF {
            break
        }
    return err
    }

// detect if rec is empty and go to next line (call r.Read()?)

err = w.Write(rec)

}

w.Flush()

A: The following code should help. I've commented on the relevant parts so that it's easy to understand.
package main

import (
    "encoding/csv"
    "os"
)

// handle error using panic
func handleError(err error) {
    if err != nil {
        panic(err)
    }
}

// empty returns true if all fields are empty
func empty(record []string) bool {
    for i := range record {
        if record[i] != "" {
            return false
        }
    }
    return true
}

func main() {
    in, err := os.Open("in.csv")
    handleError(err)
    defer in.Close()

    out, err := os.Create("out.csv")
    handleError(err)
    defer out.Close()

    r := csv.NewReader(in)
    {
        r.Comma = ';'             // Delimiter
        r.FieldsPerRecord = 0     // Number of fields should match with the header
        r.TrimLeadingSpace = true // Trim the leading spaces
    }

    w := csv.NewWriter(out)
    {
        w.Comma = ';' // Delimiter
    }

    // Read all records
    records, err := r.ReadAll()
    handleError(err)

    // Write records that are not empty
    for _, record := range records {
        if !empty(record) {
            _ = w.Write(record)
        }
    }

    // Flush records in buffer
    w.Flush()
}

Input:
;Header1;Header2;Header3;
;;;;
;1;2;3;
;;;;

Output:
;Header1;Header2;Header3;
;1;2;3;


text:
Q: FTP gives an error 550 but file permissions are the same Setup:

*

*Windows Server 2008 R2 with updates.

*Filezilla FTP Server 0.9.60 (for LAN use only)

Clients:

*

*Total Commander 10

*WinSCP 5.17

I have two files in the same folder. I can overwrite one of them via FTP and the other one I can't. I get error 550 "Could not open file for writing" in both clients.
I compared file permissions with icacls and they are exactly the same. The user on behalf of which Filezilla Server is running, has full rights to the folder and to both files.
I can rename the bad file via FTP client, but not overwrite it.
The problem is actually bigger than just one file, I have a lot of files on this server with the same problem.
What else should I check?

A: The problem turned out to be in the "read only" file attribute


text:
Q: Windows 10 Notification Center doesn't open the link I recently upgraded to Windows 10 and I discovered that there's a Notification Center. In short, I enabled Facebook push notification and I receive them properly with no problem, but when I open the Notification Center and click on the notification that I received, it does nothing, it doesn't open the link, and the notification goes away.

A: After a Windows update, I encountered a similar issue. Apparently, parts of the Notification system now run as a Background app, and this can be set in the Privacy Control Panel (CPL).

*

*Press Windows and select the Privacy CPL.

*Scroll down to Background apps

*Enable Let apps run in the background.

*Enable Settings.

*If Facebook or your preferred browser appear in the list of apps, enable them. [Edge is off on my settings because it is not the [preferred browser.]

*Enable Windows Security, particularly if you use Defender.

Also, third-party privacy tools such as O&O ShutUp10, shown below, can also disable background apps. Allow App Notifications.

Hopefully, Notifications will work again. Post here if it works, or you found another solution.


text:
Q: IE not response to a checkbox ticked by a VBA code I'm trying to write  VBA code to control IE automatic extract data from a local intranet website . Everything work ok with the default setting of the website. However when i change the criteria of input data by a VBA code for ticking a checkbox on the website, the website seems not to be activated (checkbox not visible although it checked), then the website extract empty data while with the same input there is data extracted when I manually doing it.
Please help me out on this issue. Thank you.
This is when i manually select the checkbox
This is when VBA code select the checkbox
My VBA Code:
Sub ExractData()
            Dim URL As String
            Dim btnTaiBaocao As Object
            Dim DkVantin As Object
            Dim DataVanTin As Object
            Dim TenDangNhap As Object
            Dim MatKhau As Object
            Dim btnDangNhap As Object
            Dim iepopup As Object
            Dim hWND As Long
            Dim childHWND As Long
            Dim lr_stk As Long
            Dim k As Long
                    Set ie = CreateObject("InternetExplorer.Application")
                        ie.Visible = True
                        URL = "xxxxxxxxxxxxxxxxxxxxxxx"
                        ie.Navigate (URL)
                    Do
                    DoEvents
                    Loop Until ie.ReadyState = 4
                    Set TenDangNhap = ie.Document.getElementById("txtNameAdmin")
                    TenDangNhap.Value = Sheet1.Range("g1")
                    Set MatKhau = ie.Document.getElementById("txtPassword")
                    MatKhau.Value = Sheet1.Range("g2")
                    Set btnDangNhap = ie.Document.getElementById("btnLogin")
                    btnDangNhap.Click

                    lr_stk = Sheet2.Range("B" & Rows.Count).End(xlUp).Row
                    For k = 2 To lr_stk
                         Set ie = CreateObject("InternetExplorer.Application")
                         ie.Visible = True

                         URL = Sheet4.Range("H2").Value
                         ie.Navigate (URL)

                         Do
                             DoEvents
                         Loop Until ie.ReadyState = 4

                        ie.Document.getElementById("ctl00_ContentPlaceHolder1_ddType").selectedindex = Sheet4.Range("H3").Value
                        ie.Document.getElementById("ctl00_ContentPlaceHolder1_rdoActOld").fireevent ("onchange")
                        Application.Wait (Now + TimeValue("00:00:3"))
                        ie.Document.getElementById("ctl00_ContentPlaceHolder1_rdoActOld").Checked = True
                        Set DataVanTin = ie.Document.getElementById("ctl00_ContentPlaceHolder1_txtCIF_TK")
                        DataVanTin.Value = Sheet2.Range("J" & k)
                        Application.Wait (Now + TimeValue("00:00:1"))
                         Set btnTaiBaocao = ie.Document.getElementById("ctl00_ContentPlaceHolder1_btnDownload")
                        btnTaiBaocao.Click
                        Application.Wait (Now + TimeValue("00:00:30"))
           ' ……….
                    Next k
End Sub

Web page source:

                                                                                <input id="ctl00_ContentPlaceHolder1_rdoActNew" type="radio" name="ctl00$ContentPlaceHolder1$sdoAct" value="rdoActNew" checked="checked" tabindex="4" />NewCore

                                                                                <input id="ctl00_ContentPlaceHolder1_rdoActOld" type="radio" name="ctl00$ContentPlaceHolder1$sdoAct" value="rdoActOld" tabindex="5" />OldCore

A: You can try .Checked = "checked" instead of true and it's possible that you have to use extra quotes around checked. And you have already set IE at the start, i think you can leave this part out in the loop (will make it faster to).


text:
Q: Using micronaut on CloudRun fully managed I tried to run micronaut framework on Cloud Run for testing clod start performance.
When I deploy in command line, I have this issue:
Deploying...
  Creating Revision... Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information....failed
Deployment failed
ERROR: (gcloud.beta.run.deploy) Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.

However, I tested several dockerfile configuration, and I think that my last one is good for passing the EnvVar port to the expected Micronaut EnvVar:
FROM gradle:jdk11-slim as builder
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle build

FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim
COPY --from=builder /home/gradle/src/build/libs/micronaut-jib-cr*.jar micronaut-jib-cr.jar
ENV MICRONAUT_SERVER_PORT=${PORT}
EXPOSE ${PORT}
CMD java  -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dcom.sun.management.jmxremote -noverify ${JAVA_OPTS} -jar micronaut-jib-cr.jar

So, I went deeped in the Cloud Run logs, and I saw an another cause of this problem
D  Container Sandbox Limitation: Unsupported syscall setsockopt(0x8,0x1,0xc,0x2ae1273fc05c,0x4,0x32)
D  Container Sandbox Limitation: Unsupported syscall setsockopt(0x8,0x6,0x6,0x2ae1273fc03c,0x4,0x3a)
A  Error: Could not find or load main class micronaut.jib.cr.Application
A  Caused by: java.lang.ClassNotFoundException: micronaut.jib.cr.Application
D  Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753ef50,0x2,0x2ae12753ef50)
D  Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753ef50,0x2,0x2ae12753ef50)
D  Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D  Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D  Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)
D  Container Sandbox Limitation: Unsupported syscall semctl(0x1,0x0,0x2,0x2ae12753f440,0x2,0x2ae12753f440)

Is it a real wrong port usage ? In this case, can you help me with my dockerfile ?
If not, is it a known Cloud Run limitation ?
There is a work-around on micronaut to solve this syscall limitation ?
Thanks for your help

A: It's not a port issue. It looks like you hit a limitation of gvisor, which is the sandbox used by Cloud Run. Your container is trying to make a syscall that the sandbox does not (yet) support, which is causing the container to crash during start-up.

A: Indeed, John Hanley was right. My gradle build didn't reference the correct main class... I shame of this evident error. But I used Visual Studio Code for the first time (because it seems trendy!), and the package refactor is not as efficient as IntelliJ one ! (Or I haven't the right plugin!)
Thanks for your help, now it work perfectly (and more again with GraalVM packaging!)


text:
Q: use of make depend while compiling fips enabled openssl I have solaris 10 machine. I'm trying to compile fips enabled openssl in it.
i was not able to build shared libraries using GNU gcc.
but with sun cc the build was successful. but sun cc doesnt have makedepend.
so is it safe to skip the make depend option while compiling?
what is the use of make depend in openssl ?

A: makedepend is installed in /usr/openwin/bin on Solaris 10, if you've installed the X11 software - make sure that's in your $PATH if you installed it.   It's generally used by developers to insert into Makefiles information about which .o files depend on which .c & .h files, so that as they edit the software they can rebuild only the .o files that depend on the sources they edited.


text:
Q: Which one to choose Apache Oozie or Apache Airflow? Need a comparison I am new to job schedulers and was looking out for one to run jobs on big data cluster. I was quite confused with the available choices. Found Oozie to have many limitations as compared to the already existing ones such as TWS, Autosys, etc.
Need some comparison points on Oozie vs. Airflow.
Appreciate your help.

A: In my experience Airflow is the best data pipeline right now. It's best suited for managing complex, long running workflows. UI and modularity are over the top.
Airflow

*

*+ Python Code for DAGs

*+ Has connectors for every major service/cloud provider

*+ More versatile

*+ Advanced metrics

*+ Better UI and API

*+ Capable of creating extremely complex workflows

*+ Jinja Templating

*+ Can be used as an Orchestrator for the Tensorflow Extended ecosystem

*= Can be parallelized

*= Native Connections to HDFS, HIVE, PIG etc..

*= Graph as DAG

Oozie

*

*--- Java or XML for DAGs

*- hard to build complex pipelines

*- smaller, less active community

*- worse WEB GUI

*- Java API

*= Can be parallelized

*= Native Connections to HDFS, HIVE, PIG etc..

*= Graph as DAG

As you see, Airflow is an easier to use (especially in large heteregenoeus team), more versatile and powerful option than Oozie.
As I said: go with Airflow.
Article you may find interesting


text:
Q: Worker Script Failing to Load for Vue Webpack Built App I deployed a Node application to CouchDB that I developed and built from a Vue Webpack template.  One of the modules I rely on, pdfjs-dist, relies on a worker.
After running npm run build and getting my output in dist, I copy the output files to couchapp to deploy them to CouchDB.  I get no errors during deployment and the site looks fine once it's up.
However, when I try doing something that requries pdfjs-dist, I get the error:

NetworkError: Failed to load worker script at
  "http://.../docuapp/documentation/_design/uploads/static/js/app.4eb1aecbadc78360a76e.worker.js"
  (unbekannt)
      Error: Loading chunk 0 failed.
      Stack-Trace:
      u@http://.../docuapp/documentation/_design/uploads/static/js/manifest.a6f78538bddeebdefd4a.js:1:957
        manifest.a6f78538bddeebdefd4a.js:1:1378
      Error: Loading chunk 0 failed.  manifest.a6f78538bddeebdefd4a.js:1:957

So I check out the url that's failing to load, and the document is missing.  But when I remove the worker part of the url, i.e.
http://.../docuapp/documentation/_design/uploads/static/js/app.4eb1aecbadc78360a76e.js

This page loads, and I'm guessing that's the resource that's needed.
Does anyone have any guesses as to what's going wrong here?
Here's my package.json
{
  "name": "docu-back",
  "version": "1.0.0",
  "description": "A Vue.js project",
  "author": "",
  "private": true,
  "scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev",
    "build": "node build/build.js"
  },
  "dependencies": {
    "element-ui": "^2.0.11",
    "mime-types": "^2.1.17",
    "nano": "^6.4.2",
    "node-dir": "^0.1.17",
    "pdfjs-dist": "^2.0.332",
    "querystring-browser": "^1.0.4",
    "vue": "^2.5.2",
    "vue-awesome": "^2.3.4",
    "vue-router": "^3.0.1"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "chalk": "^2.0.1",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.28.0",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.4",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "html-webpack-plugin": "^2.30.1",
    "node-notifier": "^5.1.2",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.2.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "rimraf": "^2.6.0",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "url-loader": "^0.5.8",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^3.6.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.11.1",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 6.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

build/build.js
'use strict'
require('./check-versions')()

process.env.NODE_ENV = 'production'

const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')

const spinner = ora('building for production...')
spinner.start()

rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
  if (err) throw err
  webpack(webpackConfig, (err, stats) => {
    spinner.stop()
    if (err) throw err
    process.stdout.write(stats.toString({
      colors: true,
      modules: false,
      children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
      chunks: false,
      chunkModules: false
    }) + '\n\n')

    if (stats.hasErrors()) {
      console.log(chalk.red('  Build failed with errors.\n'))
      process.exit(1)
    }

    console.log(chalk.cyan('  Build complete.\n'))
    console.log(chalk.yellow(
      '  Tip: built files are meant to be served over an HTTP server.\n' +
      '  Opening index.html over file:// won\'t work.\n'
    ))
  })
})

build/webpack.base.conf.js
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')

function resolve (dir) {
  return path.join(__dirname, '..', dir)
}

module.exports = {
  context: path.resolve(__dirname, '../'),
  entry: {
    app: './src/main.js'
  },
  output: {
    path: config.build.assetsRoot,
    filename: '[name].js',
    publicPath: process.env.NODE_ENV === 'production'
      ? config.build.assetsPublicPath
      : config.dev.assetsPublicPath
  },
  resolve: {
      extensions: ['.js', '.vue', '.json'],

    alias: {
        'vue$': 'vue/dist/vue.esm.js',
        querystring: 'querystring-browser',
        '@': resolve('src'),
        '_qs': 'querystring-browser'
    }
  },
  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: vueLoaderConfig
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('img/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('media/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
        }
      }
    ]
  },
  node: {
    // prevent webpack from injecting useless setImmediate polyfill because Vue
    // source contains it (although only uses it if it's native).
    setImmediate: false,
    // prevent webpack from injecting mocks to Node native modules
    // that does not make sense for the client
    dgram: 'empty',
    fs: 'empty',
    net: 'empty',
    tls: 'empty',
    child_process: 'empty'
  }
}

build/webpack.dev.conf.js
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')

const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)

const devWebpackConfig = merge(baseWebpackConfig, {
  module: {
    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
  },
  // cheap-module-eval-source-map is faster for development
  devtool: config.dev.devtool,

  // these devServer options should be customized in /config/index.js
  devServer: {
    clientLogLevel: 'warning',
    historyApiFallback: {
      rewrites: [
        { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
      ],
    },
    hot: true,
    contentBase: false, // since we use CopyWebpackPlugin.
    compress: true,
    host: HOST || config.dev.host,
    port: PORT || config.dev.port,
    open: config.dev.autoOpenBrowser,
    overlay: config.dev.errorOverlay
      ? { warnings: false, errors: true }
      : false,
    publicPath: config.dev.assetsPublicPath,
    proxy: config.dev.proxyTable,
    quiet: true, // necessary for FriendlyErrorsPlugin
    watchOptions: {
      poll: config.dev.poll,
    }
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': require('../config/dev.env')
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
    new webpack.NoEmitOnErrorsPlugin(),
    // https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      inject: true
    }),
    // copy custom static assets
    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, '../static'),
        to: config.dev.assetsSubDirectory,
        ignore: ['.*']
      }
    ])
  ]
})

module.exports = new Promise((resolve, reject) => {
  portfinder.basePort = process.env.PORT || config.dev.port
  portfinder.getPort((err, port) => {
    if (err) {
      reject(err)
    } else {
      // publish the new Port, necessary for e2e tests
      process.env.PORT = port
      // add port to devServer config
      devWebpackConfig.devServer.port = port

      // Add FriendlyErrorsPlugin
      devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
        compilationSuccessInfo: {
          messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
        },
        onErrors: config.dev.notifyOnErrors
        ? utils.createNotifierCallback()
        : undefined
      }))

      resolve(devWebpackConfig)
    }
  })
})

build/webpack.prod.conf.js
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

const env = require('../config/prod.env')

const webpackConfig = merge(baseWebpackConfig, {
  module: {
    rules: utils.styleLoaders({
      sourceMap: config.build.productionSourceMap,
      extract: true,
      usePostCSS: true
    })
  },
  devtool: config.build.productionSourceMap ? config.build.devtool : false,
  output: {
    path: config.build.assetsRoot,
    filename: utils.assetsPath('js/[name].[chunkhash].js'),
    chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
  },
  plugins: [
    // http://vuejs.github.io/vue-loader/en/workflow/production.html
    new webpack.DefinePlugin({
      'process.env': env
    }),
    new UglifyJsPlugin({
      uglifyOptions: {
        compress: {
          warnings: false
        }
      },
      sourceMap: config.build.productionSourceMap,
      parallel: true
    }),
    // extract css into its own file
    new ExtractTextPlugin({
      filename: utils.assetsPath('css/[name].[contenthash].css'),
      // Setting the following option to `false` will not extract CSS from codesplit chunks.
      // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
      // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
      // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
      allChunks: true,
    }),
    // Compress extracted CSS. We are using this plugin so that possible
    // duplicated CSS from different components can be deduped.
    new OptimizeCSSPlugin({
      cssProcessorOptions: config.build.productionSourceMap
        ? { safe: true, map: { inline: false } }
        : { safe: true }
    }),
    // generate dist index.html with correct asset hash for caching.
    // you can customize output by editing /index.html
    // see https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      filename: config.build.index,
      template: 'index.html',
      inject: true,
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeAttributeQuotes: true
        // more options:
        // https://github.com/kangax/html-minifier#options-quick-reference
      },
      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
      chunksSortMode: 'dependency'
    }),
    // keep module.id stable when vendor modules does not change
    new webpack.HashedModuleIdsPlugin(),
    // enable scope hoisting
    new webpack.optimize.ModuleConcatenationPlugin(),
    // split vendor js into its own file
    new webpack.optimize.CommonsChunkPlugin({
      name: 'vendor',
      minChunks (module) {
        // any required modules inside node_modules are extracted to vendor
        return (
          module.resource &&
          /\.js$/.test(module.resource) &&
          module.resource.indexOf(
            path.join(__dirname, '../node_modules')
          ) === 0
        )
      }
    }),
    // extract webpack runtime and module manifest to its own file in order to
    // prevent vendor hash from being updated whenever app bundle is updated
    new webpack.optimize.CommonsChunkPlugin({
      name: 'manifest',
      minChunks: Infinity
    }),
    // This instance extracts shared chunks from code splitted chunks and bundles them
    // in a separate chunk, similar to the vendor chunk
    // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
    new webpack.optimize.CommonsChunkPlugin({
      name: 'app',
      async: 'vendor-async',
      children: true,
      minChunks: 3
    }),

    // copy custom static assets
    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, '../static'),
        to: config.build.assetsSubDirectory,
        ignore: ['.*']
      }
    ])
  ]
})

if (config.build.productionGzip) {
  const CompressionWebpackPlugin = require('compression-webpack-plugin')

  webpackConfig.plugins.push(
    new CompressionWebpackPlugin({
      asset: '[path].gz[query]',
      algorithm: 'gzip',
      test: new RegExp(
        '\\.(' +
        config.build.productionGzipExtensions.join('|') +
        ')$'
      ),
      threshold: 10240,
      minRatio: 0.8
    })
  )
}

if (config.build.bundleAnalyzerReport) {
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
  webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}

module.exports = webpackConfig

I'll gladly provide any other files if they're helpful.
Here's how I import pdfjs-dist:
text.js
var pdfjs = require('pdfjs-dist');
pdfjs.disableWorker = true

A: My guess on the problem is that pdfjs requires the workerSrc property to be known in runtime. But when you use webpack it will probably assign an unguessable hash on the file name, so you can't really put the filename as a string in your code.
But pdfjs provides a solution for us! They have included a webpack file in their distribution.
In your code
var pdfjs = require("pdfjs-dist/webpack");
//we dont't include the normal module
//but the one with the webpack configuration
//that the pdfjs team provides us.

//no need to disable worker
//or point to the workerSrc

So what this thing does
//inside "pdfjs-dist/webpack"

'use strict';

var pdfjs = require('./build/pdf.js');
var PdfjsWorker = require('worker-loader!./build/pdf.worker.js');

if (typeof window !== 'undefined' && 'Worker' in window) {
  pdfjs.GlobalWorkerOptions.workerPort = new PdfjsWorker();
}

module.exports = pdfjs;

Basically it includes the original build from ./build/pdf.js and it will also import for us the worker script with the worker-loader. A webpack loader designed to import web-workers in our apps. Then it assigns the actual worker in the pdfjs instance and it exports it.
After you import the above file in your app you will have a pdfjs instance configured with a web-worker ready for your bundle!


text: Q: How can I make a read-only Linux system (which uses unionfs) read/write for the duration of upgrades? Assuming having an embedded linux application, and for protection against corruption from example abrupt power offs, you implement a read only system with union fs. But then, how is it possible to make the system read write again, in case you need to perform some software update?


text:
Q: Be successful vs good luck Does it sound right to say "be successful" instead of "good luck" as a quick reply? For instance:

A : I have a tough exam tomorrow.
B : I hope you'll be successful in your exam.

I suppose using "be successful" as a part of a sentence sounds right, but isn't it kind of awkward or unnatural to say "be successful" as a short reply instead of "good luck"?

A: "Be successful" sounds like a command - like you are ordering them to succeed.  Contrast this with "Good luck!", which means "I hope that you have good luck!".  In the latter you're not telling them what to do, you're describing something about yourself: offering some support, basically, which is rarely unwelcome.
You could say "I hope you are successful!", and while this is not a command, it does sound rather awkward.  I can't quite put my finger on why.  I would be inclined to say "I hope it goes well!", if you don't want to say "Good luck!".
Similarly, "I hope you pass!" sounds even more awkward to my ears: possibly because it raises the possibility that they might not pass, ie that they might fail, and bringing this up may be unwelcome - they probably don't want to think about failing.  This may be the reason that "I hope you are successful!" sounds awkward: it may be too similar to "I hope you don't fail!".
Talking about "luck", or it "going well", on the other hand, don't seem to raise the spectre of failure so much: perhaps because even if you are not lucky with the questions you may still pass, if you're well prepared.
Anyway, short answer: just say "Good luck!".


text:
Q: scss function for animation keyframes i would like to do a reusable sass function that makes it easy for me to write a @keyframes css animation without writing too much code but I'm not sure how to go about it, especially the math part.
i have a div containing a single background image with this css
height: 100vh;
width: 8000px;

this background image is composed of 25 frames. so each frame is 320px wide.
the animation should translateX() the div by multiple of 320px every 4%, so something like this:
@keyframes animation {
    0% {
        transform:translateX(0);
    }
    4% {
        transform:translateX(-320px);
    }
    8% {
        transform:translateX(-640px);
    }

    ...
}

i would like to make a function of this but I'm new to scss functions and i really don't know where to start. if someone could give me a hint that would be great!
thanks

A: Could be better (modularise) but here is for you;
@mixin deneme($i){
  @for $i from 0 through 100/$i {
    #{$i * 4}% {
      transform:translateX(#{-320 * $i});
    }
  }
}

UPDATE:
I think this one is a bit better.
@mixin deneme($increase, $angle){
  @for $x from 0 through 100/$increase {
    #{$x * $increase }% {
      transform:translateX($angle * $x);
    }
  }
}


text:
Q: Can not import snappy in python I use the package named python-snappy. This package requires snappy library. So, I download and install snappy successfully by the following commands such as:
./configure
make
sudo make install

When I import snappy, I receive the errors:
from _snappy import CompressError, CompressedLengthError, \
ImportError: libsnappy.so.1 cannot open shared object file: No such file or directory

I'm using Python 2.7, snappy, python-snappy and Ubuntu 12.04
How can I fix this problem?
Thanks

A: Traditionally you might have to run the ldconfig utility to update your /etc/ld.so.cache (or equivalent as appropriate to your OS).  Sometimes it might be necessary to add new entries (paths) to your /etc/ld.so.conf.
Basically the shared object (so) loaders on many versions of Unix (and probably other Unix-like operating systems) use a cache to help resolve their base filenames into actual files to be loaded (usually mmap()'d).  This is roughly similar to the intermittent need to run hash -r or rehash in your shell after adding things to directories in your PATH.
Usually you can just run ldconfig with no arguments (possibly after adding your new library's path to your /etc/ld.so.conf text file).  Good Makefiles will do this for you during make install.
Here's a little bit more info: http://linux.101hacks.com/unix/ldconfig/

A: You can install the python-snappy and libsnappy1 from the ubuntu repos:
$ sudo apt-get install libsnappy1 python-snappy

You should not have to download anything.

A: the following worked for me:
$ conda install python-snappy

then in my code I used:
import snappy

A: Here for e.g. anaconda python

*

*Download snappy from github

*also download the python file

*extract both files

*google-snappy folder
$ ./configure
$ make
$ sudo make install

*Then in python folder:
$ python setup.py build   # here I get the same import _snappy error
$ python setup.py install # after this import works


text:
Q: Create tag field with preselect options my goal is to create tag field on partner view with options that can be preselected - as for example on original tag field with multiple values that can be selected. Combination of selection field with many2many_tags widget.
This is my XML and I know its working because I tried with category_id field
<field name="category_id" widget="many2many_tags" string="ISO Country Code"/>

I'd like to replace category_id with my own list of values that can be selected from on frontend as when you use tags and can select predefined ones.
I tried using this solution odoo multi select field .. create list values to choose from but when I copy this inside my .py file and try to call "vaction_ids" field there is error:
"Field "vaction_ids" does not exist in model "res.partner"
Help please, what do I need to do to predefine values and to call that field in XML?


text:
Q: How laravel relationship internally works? I have really surprised about laravel relationship  becasue it gives  result without duplicate entries while if compare to left join.
for example recently i tried self join has many to same table
 public function parentMenu(){
        return $this->hasMany(Page::class,'parent_page_id','id');
    }

and it return following result
Array
(
    [0] => Array
        (
            [id] => 1
            [page_name] => Branch Details
            [page_url] => #
            [parent_page_id] => 0
            [page_type] => 1
            [created_at] => 2018-06-23 23:45:34
            [updated_at] => 2018-06-23 23:45:34
            [deleted_at] =>
            [slug] => branch_detail
            [parent_menu] => Array
                (
                    [0] => Array
                        (
                            [id] => 2
                            [page_name] => Add Branch Detail
                            [page_url] => add-branch
                            [parent_page_id] => 1
                            [page_type] => 1
                            [created_at] => 2018-06-23 23:45:54
                            [updated_at] => 2018-06-23 23:45:54
                            [deleted_at] =>
                            [slug] => add_branch_detail
                        )

                    [1] => Array
                        (
                            [id] => 11
                            [page_name] => View Branch Detail
                            [page_url] => list-branch
                            [parent_page_id] => 1
                            [page_type] => 1
                            [created_at] => 2018-06-23 23:46:08
                            [updated_at] => 2018-06-23 23:46:08
                            [deleted_at] =>
                            [slug] =>
                        )

                )

        )

also i have tried to figure out the query
Array
(
    [0] => Array
        (
            [query] => select * from `pages` where `pages`.`deleted_at` is null
            [bindings] => Array
                (
                )

            [time] => 0.82
        )

    [1] => Array
        (
            [query] => select * from `pages` where `pages`.`parent_page_id` in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and `pages`.`deleted_at` is null
            [bindings] => Array
                (
                    [0] => 1
                    [1] => 2
                    [2] => 4
                    [3] => 5
                    [4] => 7
                    [5] => 8
                    [6] => 9
                    [7] => 10
                    [8] => 11
                    [9] => 12
                )

            [time] => 0.86
        )

)

Now my question is suppose if i try to get same result what will be the mysql query .Since i  want to know how internally relation query works ? will it do forloop internally or else in query itself it will produce result .
Also will it execute separate query in loop to retrieve child menu list ?

A: Laravel's active record implementation doesn't use joins for its relationships (well is does for some of them but that's for relationships like belongsToMany where it needs to use a pivot/intermediate table).
What will actually happen is Eloquent will get the related keys from the table and perform another query to get the required relationship e.g.
Post has many Comment and there are 3 posts in the db with ids 1, 2 and 3.
Post::with('comments')->get();

Will result in:
Query 1
SELECT * from `posts`

Query 2
SELECT * FROM `comments` WHERE `comment`.`post_id` in ('1', '2', '3')

It will hen go through the results from the 2nd query and match them to the models loaded from the first.

If you want to see what queries are being run from your Laravel app then I would suggest installing either:

*

*Laravel Debugbar

*Clockwork
Amongst other things, either of these tools will show you the queries that are being run.


text:
Q: Ubuntu 15.04 build Android 5.0 error: You are attempting to build with the incorrect version of java. why? Error:
============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar  java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode).
The required version is: "1.7.x"

Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:174: *** stop.  Stop.

#### make failed to build some targets (1 seconds) ####

java -version:
$ java -version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

javac -version:
$ javac -version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
javac 1.7.0_80

$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
* 2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1         manual mode

$ sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                                         Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/bin/javac   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/bin/javac   1071      manual mode
* 2            /usr/lib/jvm/java-7-oracle/bin/javac          1         manual mode

A: For those of you that want to build Gingerbread thru KitKat (which requires Oracle JDK 1.6) but already have your system configured for Lollipop (JDK 1.7), here's the easiest way to update your system:
First add the PPA for updated Java builds.
sudo add-apt-repository ppa:webupd8team/java

Then install:
sudo apt-get update && sudo apt-get install oracle-java6-installer

Once that completes, you simply need to tell Linux to use the older version of Java and Java Compiler to render content.
Run the following two commands separately, making the correct selection for Oracle JDK 1.6 both times when prompted. Again in the terminal:
sudo update-alternatives --config java
sudo update-alternatives --config javac

A: Setup environment for required version is: 1.7.x
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH

you can change the JAVA_HOME path by using below commands:
sudo update-alternatives --config javac

sudo update-alternatives --config java


text:
Q: numpy performace: custom elementwise operation in numpy over variable same size ndarray I am trying to write an efficient vectorized numpy custom function that essentially performs elementwise mean sans -1 if at all present.
The idea is given list/tuple of same size ndarray as input produce a single same size ndarray which is effectively a (elementwise) mean of all ndarray provided as input.
The only possible values in these array can be [-1, 0, 1]. But when this custom mean is calculated, I want to ignore -1 from mean calculation if other values are present. The method for this custom mean mean_with_dont_knows_int.
I have tried universal functions and also operation along axis (after stacking the in arrays) but as the input shape increases, computational time increases reaching in minutes for relatively small 500, 500, 10 shape input.
Following is what I have got to so far:
from typing import Tuple

import numpy as np
import pytest

def mean_with_dont_knows_int(*argv: int):
    arr = np.array(argv, dtype=np.int8)
    return mean_with_dont_knows_from_1d(arr)

def mean_with_dont_knows_from_1d(arr: np.ndarray) -> int:
    arr = np.delete(arr, np.argwhere(arr == -1))
    if arr.size == 0:
        return -1
    return int(arr.sum() / len(arr) >= 0.5)

def mean_with_dont_knows(*argv: np.ndarray, use_ufunc: bool = True):
    if use_ufunc:
        return np.frompyfunc(mean_with_dont_knows_int, len(argv), 1)(*argv)
    return np.apply_along_axis(mean_with_dont_knows_from_1d, -1, np.stack(argv, axis=-1))

@pytest.mark.parametrize("shape", [(10, 10, 5), (50, 50, 10), (500, 500, 10), (500, 500, 20), ])
def test_mean_with_ufunc(shape: Tuple[int, int, int]):
    mask1 = np.ones(shape, dtype=np.int8)
    mask2 = np.zeros(shape, dtype=np.int8)
    mask3 = np.zeros(shape, dtype=np.int8)
    expected = np.zeros(shape)
    expected[0, 0, :] = 1
    mask3[0, 0, :] = -1
    result = mean_with_dont_knows(mask1, mask2, mask3)
    assert np.array_equal(result, expected) is True

@pytest.mark.parametrize("shape", [(10, 10, 5), (50, 50, 10), (500, 500, 10), (500, 500, 20), ])
def test_mean_with_axis(shape: Tuple[int, int, int]):
    mask1 = np.ones(shape, dtype=np.int8)
    mask2 = np.zeros(shape, dtype=np.int8)
    mask3 = np.zeros(shape, dtype=np.int8)
    expected = np.zeros(shape)
    expected[0, 0, :] = 1
    mask3[0, 0, :] = -1
    result = mean_with_dont_knows(mask1, mask2, mask3, use_ufunc=False)
    assert np.array_equal(result, expected) is True

I am seeing performance bootlneck as the array size increases. Linear increase in performance actually .. as shown in the results below:
python -m pytest --durations=0  --capture=no  test.py                                                                              Exe on: 12:33:26 on 2020-08-16
=================================================================================================== test session starts ===================================================================================================
platform darwin -- Python 3.8.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /Users/suneeta.mall/Documents/nearmap/data-science/planck
plugins: nbval-0.9.6, cov-2.10.0
collected 8 items

test.py ........

================================================================================================= slowest test durations ==================================================================================================
107.01s call     test.py::test_mean_with_axis[shape3]
104.04s call     test.py::test_mean_with_ufunc[shape3]
52.77s call     test.py::test_mean_with_axis[shape2]
52.32s call     test.py::test_mean_with_ufunc[shape2]
0.58s call     test.py::test_mean_with_ufunc[shape1]
0.54s call     test.py::test_mean_with_axis[shape1]
0.02s call     test.py::test_mean_with_ufunc[shape0]
0.01s call     test.py::test_mean_with_axis[shape0]

Obviously I am missing something that will explain why i spent 104.04s in doing simple mean over rather small array .. anyone has ideas/suggestions/improvements.
EDIT:
Have revised mean_with_dont_knows method based on @hpaulj's suggestion which seem to work fine on (500,500,10) shape arrays but with (2000, 2000, 80) shape I am back to looking at 55.5x seconds of compute time.
def mean_with_dont_knows(*argv: np.ndarray) -> np.ndarray:
    arr = np.stack(argv, axis=-1).astype(np.float)
    dont_know_mean = arr.mean(axis=-1).astype(np.int8)

    arr[arr == -1] = np.nan
    arr = np.nanmean(arr, axis=-1)
    arr = (arr >= .5).astype(np.int8)

    arr[dont_know_mean == -1] = -1
    return arr

A: I've streamlined mean_with_dont_knows_from_1d a bit:
def mean_1(arr):
    arr1 = arr[arr!=-1]    # simpler than np.delete
    n = arr1.size
    if n==0:
        return -1
    return int(arr1.mean() >= 0.5)

Applied with:
def foo(*argv):
    temp = np.stack(argv, axis=-1).reshape(-1, len(argv))
    res = np.reshape([mean_1(row) for row in temp], argv[0].shape)
    return res

With reshape I've simplified the 3d iteration to iteration over rows of a 2d array.
For shape = (10,10,5)
In [30]: np.array_equal(expected, foo(mask1,mask2,mask3))
Out[30]: True

timing:
In [31]: timeit foo(mask1,mask2,mask3)
11.8 ms ± 184 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

compared with yours:
In [12]: timeit res = mean_with_dont_knows(mask1, mask2, mask3)
29.5 ms ± 133 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
In [13]: timeit res1 = mean_with_dont_knows(mask1, mask2, mask3, use_ufunc=False)
31.3 ms ± 25.8 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

Most of the improvement comes from the mean_1 function.
def foo1(*argv):
    temp = np.stack(argv, axis=-1).astype(float)
    temp[temp==-1] = np.nan
    res = np.nanmean(args, axis=-1)
    return res >=.5

This takes advantage of np.nanmean one of a collection of functions that mask out np.nan values.  I probably could mask out -1 directly, using ideas from np.nanmean, for now just use the existing code.  The speed improvement is substantial:
In [46]: np.array_equal(foo1(mask1,mask2,mask3), expected)
Out[46]: True
In [47]: timeit foo1(mask1,mask2,mask3)
155 µs ± 217 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

Basically I've avoided iteration 500 times (on a simple 3 element 'mean').


text:
Q: Mapbox can't get last location (Java) I use mapbox for android (java), when it tries to access the device location it gives me an error and closes the application. This problem does not occur when I try to use the app by simulating it.
It seems that this code doesn't work.
private void enableLocationComponent(@NonNull Style loadedMapStyle) {
    if (PermissionsManager.areLocationPermissionsGranted(this)) {
        locationComponent = mapboxMap.getLocationComponent();
        LocationComponentActivationOptions locationComponentActivationOptions =
                LocationComponentActivationOptions.builder(this, loadedMapStyle)
                        .useDefaultLocationEngine(false)
                        .build();
        locationComponent.activateLocationComponent(locationComponentActivationOptions);
        locationComponent.setLocationComponentEnabled(true);
        locationComponent.setCameraMode(CameraMode.TRACKING);
        locationComponent.setRenderMode(RenderMode.COMPASS);

        initLocationEngine();
    } else {
        permissionsManager = new PermissionsManager(this);
        permissionsManager.requestLocationPermissions(this);
    }

}

A: What is the crash message in the logcat?
Are you passing a fully loaded map style through to enableLocationComponent()?
You might have already seen them, but fyi about https://docs.mapbox.com/help/tutorials/android-location-listening/ and https://docs.mapbox.com/android/maps/examples/#device-location


text:
Q: docker container running but not responding to localhost:49153 I am doing POC around using ubuntu, nginx component for which i have below mentioned Dockerfile
FROM ubuntu:14.04
MAINTAINER Paresh Bhavsar "bhavsar.er@gmail.com"
ENV REFRESHED AT "04-06-2015"
RUN apt-get update
RUN apt-get -y -q install nginx
RUN mkdir -p /var/www/html
ADD nginx/global.conf /etc/nginx/conf.d/
ADD nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80

nginx.conf file ---
user www-data;
worker_processes 4;
pid /run/nginx.pid;
daemon off;
events { }
http {
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  include /etc/nginx/mime.types;
default_type application/octet-stream;
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;
  gzip on;
  gzip_disable "msie6";
  include /etc/nginx/conf.d/*.conf;
}

global.conf file
server {
        listen          0.0.0.0:80;
}
root            /var/www/html/website;
index index.html index.htm;

docker container is running showing below mentioned.
CONTAINER ID        IMAGE                      COMMAND             CREATED             STATUS              PORTS                   NAMES
9e32a617896a        pbhavsar211/nginx:latest   "nginx"             15 minutes ago      Up 15 minutes       0.0.0.0:49163->80/tcp   website

I am not able to display the page localhost:49153, tried with ip address too but no luck.
Am i missing something here. Thanks in advance.

A: I believe that root and index statments must be inside the server tag in your global.conf file, as following:
server {
    listen          0.0.0.0:80;
    root            /var/www/html/website;
    index index.html index.htm;
}


text:
Q: Referencing a SASS file from HAML How do I reference a .sass file from a .haml file?
I have the following haml expression that will reference a .css file:
%link{'href' => '/stylesheets/layout.css?cache=1', 'rel' => 'stylesheet', 'type' => 'text/css'}/

How do I reference a .sass file?

A: Sass files compile to CSS files. If you're using Rails, this is done automatically; otherwise, you can use the sass command-line executable. Check out the Sass documentation for more information.
Once you've compiled your Sass files to CSS, you reference the CSS file just like you normally do.

A: try using the stylesheet_link_tag method
stylesheet_link_tag "layout"


text:
Q: Scikit-learn tutorial documentation location I have scikit-learn 0.16.1 installed on Ubuntu 14.04 and am working through the tutorial.  SKL was installed with all default configuration.  The tutorial states

The source of this tutorial can be found within your scikit-learn folder:
  scikit-learn/doc/tutorial/text_analytics/

I've used find on my entire drive and there is no "tutorial" folder. Not anywhere.  Anybody know where these files are really installed?

A: Finding the package contents
Where the packages are installed depends on how you installed scikit-learn

*

*If you used Ubuntu's package system via
sudo apt-get install python-sklearn python-sklearn-doc

(you often need the doc package to get the accompanying documentation), then the tutorial is simply missing. The doc/-folder it is not contained in the python-sklearn-doc-package. See the bug report.
You can find out the contents of the package via
dpkg-query --listfiles python-sklearn-doc

*If you used the Python Package Index to install it via
pip install --user --install-option="--prefix=" -U scikit-learn

, then the installation should be at $HOME/.local/lib/python2.7/site-packages/sklearn. (as also of pip show -f scikit-learn) But a
find . | grep -i tutorial

did not find any tutorial/-folder.

*If you installed it from source, consider reinstalling via pip, as the warning states that

Warning
Packages installed with the python setup.py install command cannot be
  uninstalled nor upgraded by pip later. To properly uninstall
  scikit-learn in that case it is necessary to delete the sklearn folder
  from your Python site-packages directory.

Solution
A solution would be to use the source. Either download the master file or do it via git:
    git clone https://github.com/scikit-learn/scikit-learn.git

The git archive is more than 60 MiB, so you might want to prefer the master zip.


text:
Q: VS 2015 vs. 2017 javascript intellisense (d3.js) I have tested Javascript Intellisense in both Visual Studio 2015 Community and in Visual Studio 2017 Enterprise. The former it's neither context-aware, nor it contains method or argument descriptions.
As an example, the following prompt the Intellisense suggestion only in 2017 (please refer also to the screenshots):

<!DOCTYPE html>
<html>
<body>
    <script src="Scripts/d3.js"></script>
    <script>
        d3.line
    </script>
</body>
</html>

VS 2017 js intellisense working
VS 2015 js intellisense not working
I work at a company where we have VS2015 for other reasons.
Any workaround is appreciated.


text:
Q: Careers 2.0 email check bug? I received an invite to Careers 2.0; I accepted the invite, and signed in using Google.
The next page prompts me for full name, email and location. I fill the name and the location (leaving  the email as-is), and I get the following error:

Hmm, that email already exists on another account. You will need to log out of your existing account and log back in.

It makes no sense to me, since I'm logged in with that email. Do you have any suggestion?

A: Sorry about that - both @juancn and @kubal5003 have been fixed


text:
Q: Why does the compiler invoke a templated copy constructor when assigning? Consider the code below:
#include <iostream>

template<class T>
struct X
{
    X() = default;

    template<class U>
    X(const X<U>&)
    {
        std::cout << __PRETTY_FUNCTION__ << std::endl;
    }

/*
    template<class U>
    X& operator=(const X<U>&)
    {
        std::cout << __PRETTY_FUNCTION__ << std::endl;
        return *this;
    }
*/

};

int main()
{
    X<int> a;
    X<double> b;

    b = a;
}

Live on Coliru
As you can see, the assignment operator is commented out. However, the line
b = a;

compiles fine. I thought it should not compile, as a and b have different types, and the operator=(const X&) that is generated by default by the compiler will be instantiated by the underlying type, so it won't assign an X<int> to an X<double>.
To my surprise, the code compiles, and it seems that the templated copy constructor is being invoked. Why is this? Is it because the compiler tries first to cast the a to a b then invoke the default-generated B::operator=?

A: If T and U are different types, template<class U> X(const X<U>&) is not a copy constructor because it's argument is of different type. In other words, X<int> and X<double> are unrelated types, so this constructor is just a user-defined conversion between them.
Note that this code won't print anything:
X<int> a;
X<int> b { a };

Because in this case the implicitly-declared copy constructor of the form X<int>::X(const X<int>&) will be invoked.

A: The compiler is generating a call to X<double>(const X<int>&) to convert an X<int> into an X<double>. Then it's calling the generated assignment operator X<double>& X<double>::operator =(const X<double>&); to do the assignment.
If you wrote out all the steps explicitly it would be:
b.operator =(X<double>(a));

A: template<class U> X(const X<U>&) is a generalized user-defined conversion -- see Anton Savin's answer.
The rules for implicit type conversions are quite complex, so you should be wary of user-defined conversion functions (More Effective C++ Item 5). This is even more the case with template functions.
The code
#include <iostream>

template<class T>
struct X
{
    X() = default;

    template<class U>
    X(const X<U>&)
    {
        std::cout << "generalized ctor: " << __PRETTY_FUNCTION__ << std::endl;
    }

/*
    template<class U>
    X& operator=(const X<U>&)
    {
        std::cout << "generalized assignment: " << __PRETTY_FUNCTION__ << std::endl;
        return *this;
    }
*/
};

int main()
{
    X<int> a;
    X<double> b;

    b = a;
}

returns

generalized ctor: X::X(const X&) [with U = int; T = double]

But for operator= not commented out, it returns

generalized assignment: X& X::operator=(const X&) [with U = int; T = double].

So you are correct that the implicitly generated operator=(const X&) will be instantiated by the underlying type and won't assign an X<int> to an X<double>. As Scott Meyers (see reference above) explains, your compiler is faced with a call to b.operator= of a X<double>, which takes a
const X<double>, and finds that no such function exists. Therefore, your compiler then tries to find an acceptable sequence of implicit type conversions it can apply to make the call succeed, see rules in the cpp reference. Your compiler finds your generalized user-defined conversion and converts your X<int> to X<double> to have the right argument type for b.operator=.


text:
Q: Cypress - Having trouble asserting on requests using cy.intercept. 'cy.its() errored because the property: request does not exist on your subject.' I'm trying to assert on the request body to ensure the correct new test card is passed as part of the order.
it("User clicks confirm & pay button to complete order", () => {
    cy.intercept("/api/checkout/payandcommit").as("placeOrder");
    cy.placeOrderAndPay();
    cy.wait("@placeOrder")
      .its("response.statusCode")
      .should("eq", 200)
      .its("request.body")
      .should("include", "cardNumber", 370000000000002);
  });

All is good upto verfying the status code then it breaks.
This is the error thrown:
Timed out retrying: cy.its() errored because the property: request does not exist on your subject.

cy.its() waited for the specified property request to exist, but it never did.

If you do not expect the property request to exist, then add an assertion such as:

cy.wrap({ foo: 'bar' }).its('quux').should('not.exist')

If i comment out the status code assertion this new error is thrown: object tested must be an array, a map, an object, a set, a string, or a weakset, but object given.
Any help getting this working would be much appreciated!

A: Chaining the assertions like this doesn't work, because the subject changes inside the chain
cy.wait("@placeOrder")           // yields interception object
  .its("response.statusCode")    // yields number 200
  .should("eq", 200)             // yields it's input (number 200)
  .its("request.body")           // not testing the interception object here
  .should("include", "cardNumber", 370000000000002);

One way that works is to use a callback which gets the interception object
cy.wait('@placeOrder').then(interception => {

  console.log(interception);    // take a look at the properties

  cy.wrap(interception.response.statusCode).should('eq', 404);

  cy.wrap(interception.request.body)
    .should("include", "cardNumber", 370000000000002)  // not sure this should is correct
    .should("have.property", "cardNumber", 370000000000002)  // maybe this is better

})

You may also be able to use chained commands if the subject is maintained, which means you have to tweak the should() in the middle
cy.wait("@placeOrder")
  .should('have.property', 'response.statusCode', 200)
  .should('have.property', 'request.body.cardNumber', 370000000000002);

Check out the logged interception object to make sure you have the correct properties and property value types (e.g is cardNumber a number or a string?).

A: Thank you so much for your help Hiram K! I was able to get it working with:
cy.wait("@placeOrder").then((interception) => {
      console.log(interception);
      cy.wrap(interception.response.statusCode).should("eq", 200);
      cy.wrap(interception.request.body.paymentDetails[0].cardNumber).should(
        "include",
        "370000000000002"
      );
      cy.wrap(
        interception.request.body.paymentDetails[0].defaultPayment
      ).should("eq", false);
    });