text:
Q: How to add space between two elements? Hello I have a project for my studies which is to display data on a dashboard that will be more or less modifiable by the user according to his needs.
I wanted to add space between a parameter icon and a "GV" text. I have tried to use justify-content="space-between" in ".panel-1 .panel-header" (CSS file) but the space between the two elements does not appear. I would like to know where my error comes from?

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

*{
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

:root{
    /* ===== Colors ===== */
    --body-color: #E4E9F7;
    --sidebar-color: #FFF;
    --primary-color: #1c1a1a;
    --primary-color-light: #F6F5FF;
    --toggle-color: #DDD;
    --text-color: #707070;

    /* ===== Transition ===== */
    --tran-02: all 0.2s ease;
    --tran-03: all 0.3s ease;
    --tran-04: all 0.4s ease;
    --tran-05: all 0.5s ease;
}

body{
    height: 100vh;
    background: var(--body-color);
}

/*Paramètres de la sidebar*/
.sidebar{
    position: fixed;
    top: 0;
    left: 0;
    height:100%;
    width: 78px;
    background: var(--primary-color);
    padding: 6px 14px;
    transition: all 0.5s ease;
}

/*Activer l'élargissement de la sidebar*/
.sidebar.active{
    width: 240px
}

/*Paramètre du logo*/
.sidebar .logo_content .logo{
    color: #FFF;
    display: flex;
    height: 50px;
    width:100%;
    align-items: center;
    opacity: 0;
    pointer-events: none;
}

/*Activation de l'affichage du logo*/
.sidebar.active .logo_content .logo{
    opacity: 1;
    pointer-events: none;
}

/*?*/
.logo_content .logo i{
   font-size: 28px;
   margin-right: 5px;
}

/*Paramètre texte logo*/
.logo_content .logo .logo_name{
    font-size: 20px;
    font-weight: 400;
}

/*Paramètre du bouton d'activation de la sidebar*/
.sidebar #btn{
    position: absolute;
    color: #FFF;
    top: 6px;
    left: 50%;
    font-size: 20px;
    height: 50px;
    width: 50px;
    text-align: center;
    line-height: 50px;
    cursor: pointer;
    transform: translateX(-50%);
}

/*Activer le déplacement du bouton en mode toggle*/
.sidebar.active #btn{
    left:90%;
}

/**/
.sidebar .divider{
    margin-top:0px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    color: #707070;
    text-align: center;
}

.sidebar.active .divider{
    margin-top:0px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    color: #707070;
    text-align: left;
}

/*Paramètre de la liste*/
.sidebar ul{
    margin-top: 20px;
}

/*Paramètres pour chaque éléments de la liste*/
.sidebar li{
    position: relative;
    height: 50px;
    width: 100%;
    margin: 0 0px;
    list-style: none;
    line-height:50px ;
}

/*Paramètres des textes de chaque élément*/
.sidebar li a{
    color: #FFF;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.4s ease;
    border-radius: 12px;
    white-space: nowrap;
}

/*Activer un fond par dessus lors du passage de la souris*/
.sidebar li a:hover{
    color: #11101d;
    background: #FFF;
}

/*Paramètres des logos*/
.sidebar li a i{
    height: 50px;
    min-width: 50px;
    border-radius: 12px;
    line-height: 50px;
    text-align: center;
}

/*Désactiver l'affichage des noms*/
.sidebar .links_name{
    opacity: 0;
    pointer-events: none;
}

/*Activer l'affichage des noms*/
.sidebar.active .links_name{
    opacity: 1;
    pointer-events: auto;
}

/*Séparation des 2 sous menus*/
.sidebar .menu-bar{
    height: calc(100% - 50px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/*Paramètres de la page des templates*/
.home{
    position: relative;
    height: 100vh;
    left: 78px;
    width: calc(100% - 78px);
    background: var(--body-color);
    transition: var(--tran-05);
}

/*Paramètre texte de la page*/
.home .text{
    font-size: 30px;
    font-weight: 500;
    color: var(--text-color);
    padding: 8px 40px;
}

/*Activer le mouvement de la page*/
.sidebar.active ~ .home{
    left: 240px;
    width: calc(100% - 78px);
}

/*Paramètre d'affichage de la template 1*/
.template-1.active{
    display: none;
}

/*Paramétre d'affichage de la template 2*/
.template-2.active{
    display: none;
}

/*Paramétre d'affichage de la template 3*/
.template-3.active{
    display: none;
}

/*Paramètres de la fenêtre modal*/
.panel-1{
    position: fixed;
    top: 0;
    width: 100vw;
    height: 100vh;
}

/*Paramétre titre du panneau*/
.panel-1 .panel-header h1{
    position: absolute;
    font-size: 12px;
    margin-left: 5px;
    font-family: Montserrat, sans-serif;
    font-weight: 500;
}

/*Paramétre panel header*/
.panel-1 .panel-header{
    display: flex;
    width: 20%;
    height: 3%;
    margin-top: 5px;
    margin-left: 7px;
    border-radius: 5px 5px 0px 0px;
    align-items: center;
    justify-content: space-between;
    padding: 0.1% 0.1%;
    background-color: rgb(91, 91, 91);
    color: rgb(255, 255, 255);
    box-shadow: 0 0 7px rgba(18,18,18,0.5);
}
<!DOCTYPE html>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="style.css">

    <link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>

    <title>Sail Vision</title>

SailVision

.

                Dashboard n°1

                Dashboard n°2

                Dashboard n°3

.

                Template

                  Paramètre

GV

Template n°2

Template n°3

Regards.

A: 2 solutions

*

*solutions
add css to this style left: 25px; class .panel-1 .panel-header h1

*solutions
Delete this position: absolute; style from this .panel-1 .panel- header h1 class And edit this width: 3%; style in this .panel-1 .panel-header class

A: *

*Please remove "position: absolute;" from ".panel-1 .panel-header h1" or change position absolute to relative.

*Then change .panel-1 .panel-header height 3% to auto.

I think you expect this...
and If you want to see icon near gv, please "justify-content: space-between;" Remove from ".panel-1 .panel-header".

A: h1.spaced {
 padding-left: 13px;
}

GV

You can solve this quickly adding a padding left to the h1 and pull apart from the icon.


text:
Q: Regex split on underscore for RewriteURL I am using Isapi Rewrite for IIS, and I want to make SEO friendly URLs for a dynamic product page.
I need to split the SKU from the product name in a single query string parameter. The SKU is always the first part, and is followed by an underscore. Everything that comes after the underscore is the product name. The product name uses dashes between words.
This is what I have so far and it just returns the whole query string in a single parameter. I need to split it on the underscore as below so that I get two values $1 and $2.
RewriteRule ^Store/([^/]+) Store/Product.aspx?sku=$1&name=$2  [QSA,NC]

*

*Store/1234_name-name

*//$1: 1234

*//$2: name-name

*Store/mn98765_name

*//$1: mn98765

*//$2: name

*Store/sk000p9_name-name-name

*//$1: sk000p9

*//$2: name-name-name

A: You want to capture the two groups with two separate parens. Try this:
RewriteRule ^Store/([^_]+)_([^/]+) Store/Product.aspx?sku=$1&name=$2 [QSA,NC]

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to prove this inequality $x^2_{n}\le\frac{8}{3}$ let sequence $\{x_{n}\}$ such $x_{1}=0,x_{2}=1$,and
$$x_{n+1}=\left(1+\dfrac{1}{n}\right)x_{n}-x_{n-1},n\ge 2$$
show that
$$x^2_{n}\le\dfrac{8}{3}$$
This problem it seem interesting,and
$$x_{n+1}-x_{n}=\dfrac{1}{n}x_{n}-x_{n-1}$$
so we have
$$x_{n+1}-x_{1}=\sum_{k=1}^{n}\dfrac{x_{k}}{k}-\sum_{k=1}^{n-1}x_{k}$$
 where $x_{0}=-1$
It seem this problem very interesting,I guess this $\dfrac{8}{3}$ maybe is not best constant,But is stronger constant

A: (Too long for a comment)
Let $S_0 = 0, \ S_n = \sum_{k=1}^n x_k.$ Then applying summation by parts to the formula
$$ x_{n+1}=\sum_{k=1}^{n}\dfrac{x_{k}}{k}-\sum_{k=1}^{n-1}x_{k}$$
yields the equation (for $n\geq 2$)
$$ x_{n+1} = 1 + \frac{S_n}{n} - S_{n-1} + \sum_{k=1}^{n-1} \frac{S_k}{k(k+1)}$$
Adding $S_n$ to both sides of this also gives
$$S_{n+1} = 1 + \frac{S_n}{n} + x_n + \sum_{k=1}^{n-1} \frac{S_k}{k(k+1)}$$
I attempted to use these equations together with an inductive hypothesis of the form $S_{n-1} \in [a,b] , x_n \in [c,d]$ to show that $x_{n+1}, S_{n+1}$ must also lie in the same bounds. While you can get extremely close, it never quite works out and I've convinced myself that this method can not succeed no matter with choices we make for $a,b,c,d.$
However, using an established a bound $|x_n| \leq M$ (such as the one Stefano proved above) then we can prove inductively that $S_n$ is also bounded.
Conjecture - The sequence $S_n$ approaches a limit $L,$ and $$L = 1 + \sum_{n=1}^{\infty} \frac{S_n}{n(n+1)} \approx 1.953053682$$
A corollary of this is that $x_n \to 0,$ which it appears to do so very very slowly.

A: Very interesting problem. A possible approach to the solution is through the theory of dynamical systems considering it as a perturbation of a conservative system. I guess that the solution below might be improved to provide a slightly better constant.
Setting $y_n=x_{n-1}$ the given equation is equivalent to
$$
\left\{
\begin{array}{l}
y_{n+1} = x_n\\
x_{n+1} = \left(1+\frac{1}{n}\right)x_n-y_n
\end{array}
\right.
$$
Consider the following energy function for the system
$$
E_n = (x_n + y_n)^2+3(x_n-y_n)^2.
$$
Using the definition of $x_{n+1}$ and $y_{n+1}$ above, a somehow lengthy, but straightforward computation gives
$$
E_{n+1} = E_n + \frac{4}{n}\left(1+\frac{1}{n}\right)x_n^2 - \frac{8}{n}x_ny_n = E_n + \frac{4 x_n^2}{n^2} + \frac{4}{n} \left(x_n (x_n-y_n) -x_ny_n\right).
$$
Recalling that $x_n-y_n = x_{n+1}-\frac{1}{n}x_n$, this implies that
$$
E_{n+1} = E_n + \frac{4}{n} (x_{n+1}x_n - x_n y_n)
$$
and hence
$$
\begin{align}
E_{n+1} &= E_2 + \sum_{i=2}^n \frac{4}{i} (x_{i+1} y_{i+1} -x_iy_i) = E_2 + \frac{4}{n} x_{n+1} y_{n+1}+\sum_{i=3}^{n} \left( \frac{4}{i-1} - \frac{4}{i} \right)x_{i}y_{i} - 2x_2y_2\\
&=4+\frac{4}{n} x_{n+1} y_{n+1} + \sum_{i=3}^{n} \frac{4}{i(i-1)} x_{i}y_{i}
\end{align}
$$
where in the last passage we used $x_2 = 1$ and $y_2 = 0$.
Observing that $E_{n} \geq (x_n+y_n)^2+(x_n-y_n)^2 = 2(x_n^2+y_n^2)$ we deduce
$$
2(x_{n+1}^2 + y_{n+1}^2) \leq E_{n+1} \leq  4 + \frac{2}{n}(x_{n+1}^2 + y_{n+1}^2)+\sum_{i=3}^{n} \frac{2(x_i^2 + y_i^2)}{i(i-1)}
$$
or
$$
x_{n+1}^2 + y_{n+1}^2 \leq 4 +\sum_{i=3}^{n} \frac{2(x_i^2 + y_i^2)}{i(i-1)}
$$
We now want to apply Gronwall's discrete lemma to this equation (see here). Recalling
$$
\sum_{i=2}^{\infty}\frac{2}{i(i+1)} = 1
$$
we prove $x_n^2 \leq 4e$ which shows that the desired sequence is bounded despite with a worse constant than asked.
P.S.: Numerical inspection in the $(x,y)$ plane above suggests the optimal bound to be $x_n^2 \leq \frac{9}{4}$
P.P.S.: I was asked to add some insights on how the argument was developed. The techniques used are quite common in the analysis of ODEs. A good, undergraduate, introduction to some of the ideas below can be found in "Nonlinear Dynamics and Chaos" by Strogatz (link). I am not aware of thorough accessible works specifically dedicated to multidimensional discrete dynamical systems (which often arise though as Poincarè maps of higher dimensional systems of ODEs) since already the one-dimensional case gives rise to several tough problems.
Concerning the main steps of the argument:

*

*The transformation into a first order system is a common trick.

*Direct inspection of the "unperturbed" system (i.e. the one without the $1/n$ term) shows that all sequences generated by arbitrary $x_1$ and $x_2$ are 6-periodic. Hence the idea to look for an almost conserved quantity for the given case. Some educated guessing supported by simulation led to the definition of the "energy" $E_n$ above which is conserved up to $O(\frac{1}{n})$ terms.

*Gronwall's technique is finally standard tool in the field. However, in this case some pre-work was needed on the energy estimate to leave only converging terms (hence the somehow painful rearrangement and index shift in the latest steps).

A: Just so this question is fully answered (i.e. getting the bound $8/3$) here I add a condensed proof of $x_n^2 \leq \frac{8}{3}$ from the answer given here as Community Wiki.

Define
$$E_n = (x_n - x_{n-1})^2 + F_n\left(x_n + x_{n-1}\right)^2$$
with $F_n = \frac{(n-1)}{3n+1}$. The recurrence relation gives us
$$E_{n+1} - E_n = \frac{(F_{n+1}-F_n)}{F_n}\cdot F_n\left(x_n + x_{n+1}\right)^2 \geq 0$$
since $F_n$ is a positive and increasing function. This shows that $E_n$ is increasing. We also see that
$$E_{n+1} - E_n \leq \frac{(F_{n+1}-F_n)}{F_n}\cdot E_n \implies \frac{E_{n+1}}{F_{n+1}} \leq \frac{E_n}{F_n}$$
so $\frac{E_n}{F_n}$ is decreasing and since $F_n$ converges it follows that $E_n$ converges. To bound $x_n$ from $E_n$ note that the definition of $E_n$ (the equation for an ellipse) allows us to write $x_n - x_{n-1} = \sqrt{E_n}\cos(\phi_n)$ and $x_n + x_{n-1} = \sqrt{\frac{E_n}{F_n}}\sin(\phi_n)$ for some angle $\phi_n$. Thus
$$x_n^2 = \frac{E_n}{4}[\cos(\phi_n) + \frac{1}{\sqrt{F_n}}\sin(\phi_n)]^2$$
Maximizing the right hand side over $\phi_n$ gives us
$$x_n^2 \leq \frac{E_n}{4}\left[1 + \frac{1}{F_n}\right] = E_n\cdot \frac{n}{n-1}$$
Since $\frac{E_n}{F_n}$ is decreasing we have $E_n \leq F_n \frac{E_2}{F_2} = 8F_n$ and
$$x_n^2 \leq \frac{8n}{3n+1} \leq \frac{8}{3}$$
It is possible to improve the constant with a bit of numerical computation (using $n=5$ instead of $n=2$ when bounding $E_n$) to the best possible one $\frac{9}{4}$ (for which we have equality for $n=3$). The best possible asymptotic bound would be slightly smaller than $2$ (best possible in the sense that $x_n^2 \approx 2$ would occur infinitely many times).


text:
Q: strange behavior when passing variadic arguments I thougt, printf would take also a va_list
but when i do so, printf doesn't do what I want printf to do:
void Log(int loglevel, char* string, ...)
{
    va_list args;
    va_start(args, string);

    switch (type)
    {
        case LOGLEVEL_FATAL:
            printf("FATAL: ");
            break;

        case LOGLEVEL_ERROR:
            printf("ERROR: ");
            break;

        case LOGLEVEL_WARNING:
            printf("WARNING: ");
            break;

        case LOGLEVEL_INFO:
            printf("INFO: ");
            break;
    }

    printf(string, args);
    va_end(args);
}

When i now call:
Log(LOGLEVEL_INFO, "testvariable = %f", 16.0);

the output is:
INFO: testvariable = 0.000000

But why?
What's my mistake?

A: The final printf() call should be to vprintf() ("v" for varargs).

A: In C++11 you can do this (in a header file):
template<typename... Args>
void Log(int loglevel, char* string, Args&&... args)
{
    switch (type)
    {
        case LOGLEVEL_FATAL:
            printf("FATAL: ");
            break;

        case LOGLEVEL_ERROR:
            printf("ERROR: ");
            break;

        case LOGLEVEL_WARNING:
            printf("WARNING: ");
            break;

        case LOGLEVEL_INFO:
            printf("INFO: ");
            break;
    }

    printf(string, std::forward<Args>(args)...);
}

which would also, in theory, let you parse string and determine if the args are in fact the right ones, rather than blindly crashing.


text:
Q: Reformat data frame in R for hourly values I have some data in my R data frame like this:
CharDate         loc  t_0h  t_1h       t_2h     t_3h     t_4h     t_5h     t_6h
xyz_20110101     A    2     20.00000    5       12.00000 13.00000 25.00000  2.00000
xyz_20110101     B    3     26.66667    7       14.33333 15.33333 28.33333 14.66667
xyz_20110102     A    4     33.33333    9       16.66667 17.66667 31.66667 27.33333
xyz_20110102     B    5     40.00000   11       19.00000 20.00000 35.00000 40.00000

The first two columns are in character format and the rest are numeric. The columns t_0h.. represents the value at a specific hour.
I want to reformat the above data like this: date, hour (separate column, 0 - 6), hourly values for A and B as separate columns, and so on (next date..).
CharData        Hour t_A  t_B
xyz_20110101    0    2    3
xyz_20110101    1    20   26.6
xyz_20110101    2    5    7
xyz_20110101    3    12   14.3
xyz_20110101    4    13   15.3
xyz_20110101    5    25   28.3
xyz_20110101    6    2    14.6
xyz_20110102    0    4    5
xyz_20110102    1    33.3 40
xyz_20110102    2    9    11
xyz_20110102    3    16.6 19
xyz_20110102    4    17.6 20
xyz_20110102    5    31.6 35
xyz_20110102    6    27.3 40

I have tried the followings:
# A simple transpose
df2 <- data.frame(t(df[-c(1,2)]))
# Melt via data.table
long <- melt(setDT(df), id.vars = c("CharDate"))
and pivot_longer() from tidyr package

but no success so far. Can someone help here (or give hints) to achieve the desired output?
Here is the sample data for reproducibility:
CharDate<- c("xyz_20110101", "xyz_20110101", "xyz_20110102", "xyz_20110102")
loc <- c("A", "B", "A", "B")
t_0h <- c(seq(2,5,length.out=4))
t_1h <- c(seq(20,40,length.out=4))
t_2h <- c(seq(5,11,length.out=4))
t_3h <- c(seq(12,19,length.out=4))
t_4h <- c(seq(13,20,length.out=4))
t_5h <- c(seq(25,35,length.out=4))
t_6h <- c(seq(2,40,length.out=4))

df <- (data.frame(CharDate,loc,t_0h,t_1h,t_2h,t_3h,t_4h,t_5h,t_6h))
df

A: We can use pivot_longer/pivot_wider
library(tidyr)
library(dplyr)
 pivot_longer(df, cols = starts_with("t_"),
    names_to = c(".value", "Hour"), names_pattern = "^(.)_(\\d+)h") %>%
  pivot_wider(names_from = loc, values_from = t)

-output
# A tibble: 14 × 4
   CharDate     Hour      A     B
   <chr>        <chr> <dbl> <dbl>
 1 xyz_20110101 0       2     3
 2 xyz_20110101 1      20    26.7
 3 xyz_20110101 2       5     7
 4 xyz_20110101 3      12    14.3
 5 xyz_20110101 4      13    15.3
 6 xyz_20110101 5      25    28.3
 7 xyz_20110101 6       2    14.7
 8 xyz_20110102 0       4     5
 9 xyz_20110102 1      33.3  40
10 xyz_20110102 2       9    11
11 xyz_20110102 3      16.7  19
12 xyz_20110102 4      17.7  20
13 xyz_20110102 5      31.7  35
14 xyz_20110102 6      27.3  40


text:
Q: Why does the ld terminate with exit code -1? I have installed MinGW through MSYS2 and it worked fine until recently.
Lately on all of my compilations it gives me this message:
 *  Executing task: C/C++: g++.exe build active file

Starting build...

C:\msys64\mingw64\bin\g++.exe -fdiagnostics-color=always -g C:\Users\*USER*\Documents\GitHub\Repo\ProgettoLista\ListaOggetti.cpp -o C:\Users\*USER*\Documents\GitHub\Repo\ProgettoLista\ListaOggetti.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\*USER*\AppData\Local\Temp\ccHqtMdU.o: in function `main':
C:\Users\*USER*\Documents\GitHub\Repo\ProgettoLista/ListaOggetti.cpp:10: undefined reference to `Persona::setNome()'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\*USER*\AppData\Local\Temp\ccHqtMdU.o: in function `nodo::nodo()':
C:\Users\*USER*\Documents\GitHub\Repo\ProgettoLista/lista.h:14: undefined reference to `Persona::Persona()'

collect2.exe: error: ld returned 1 exit status

Build finished with error(s).

 *  The terminal process terminated with exit code: -1.
 *  Terminal will be reused by tasks, press any key to close it.

I have numerous times uninstalled MinGW and MSYS2 and the result is the same.
I have tried a Hello World and it works, but on most if not all cases it gives me the same error.
For instance, the code I am trying to compile is on three files.

*

*Main

#include <iostream>
#include "lista.h"

int main() {
    lista testa = NULL;
    lista nuovoNodo = NULL;
    nuovoNodo = new nodo;
    testa = nuovoNodo;
    nuovoNodo->prev = NULL;
    nuovoNodo->nome.setNome();
    nuovoNodo->next = NULL;

    return 0;
}

*Header

#include <iostream>

using namespace std;

class Persona {
    public:
        Persona();
        string getNome();
        void setNome();
    private:
        string nome;
};

typedef struct nodo {
    struct nodo* prev;
    Persona nome;
    struct nodo* next;
} nodo;

typedef nodo* lista;

*CD

#include <iostream>
#include "lista.h"

Persona::Persona() {
    nome = "a";
}

string Persona::getNome() {
    return this->nome;
}

void Persona::setNome() {
    cout<<"Inserisci il nome della persona: ";
    cin>>this->nome;
}

I have tried compiling from Visual Studio, Visual Studio Code, MSYS2 console, dev c++ and they all give the same results.
The only exception is onlinegdb, which leads me to believe my problem is local.


text:
Q: Use both JSF ajax and setPropertyActionListener tags on the same button

I would like that when the user clicks on a button 2 things happen :

*

*First a setPropertyActionListener is triggered, to update a property of my bean

*Then an ajax call is made to execute a method from the bean

It seems that I must choose between the f:setPropertyActionListener tag and the f:ajax tag to nest inside the commandButton tag.
Is there a way to execute both the ajax call and the property update at the same time?
Thanks a lot!
EDIT : I forgot to mention I don't want a form execution, I want to use the ajax listener, here is my code :
<h:commandLink styleClass="blue-button" value="+">
  <f:setPropertyActionListener target="#{tvShowForm.selected}" value="#{tvShow.externalId}" />
  <f:ajax event="click" listener="#{tvShowForm.add}" />
</h:commandLink>

With this code the f:setPropertyActionListener is not executed.
EDIT 2 :
I modified my code to the folowing, using action form method instead of listener. Now it works only if I don't specify an event attribute on the ajax tag, but when I specify one, the action method is not executed.
<h:commandLink action="#{tvShowForm.add}" styleClass="blue-button" value="+">
  <f:setPropertyActionListener target="#{tvShowForm.selected}" value="#{tvShow.externalId}" />
  <f:ajax event="click" />
</h:commandLink>

A: Works just for me with Mojarra 2.1.3 on Tomcat 7.0.19 and Glassfish 3.1.1.
I used this relevant piece of the view:
<h:form>
    <h:commandButton value="submit" action="#{bean.submit}">
        <f:setPropertyActionListener target="#{bean.value}" value="foo" />
        <f:ajax />
    </h:commandButton>
</h:form>

with this relevant piece of the bean:
private String value;

public void submit() {
    System.out.println("Value: " + value);
}

// Getter/setter.

which prints the following on the ajax submit:

Value: foo

Your problem is caused by something else which you left out the question.

Update: as per your update

I forgot to mention I don't want a form execution, I want to use the ajax listener, here is my code :

I really don't see why you don't want "a form execution". You are submitting the form. You've only left out the action method and you're doing the business job in the ajax event listener instead. The action listener methods aren't intented to do any business job, they're for at highest some self-containing processing or logging job. The model-dependent business job should be done in the action method, there it is for.


text:
Q: Parsing emails for images in signature section have a program which checks the unread email from an inbox, parses and sends the content of the email to a record. If there are any images in the email, those images will be sent as attachments to the record. Now if any email is having an image in the signature part of the email, that image is also being sent as an attachment.
Is there a way that I can check for the images in the signature part of the email and ignore them? or Is there a way around where I can skip the entire signature content from getting parsed?
If it is difficult to parse the signature section of emails coming from different email servers, I would like to know if it is possible for emails coming from outlook?.

A: The signature is incorporated in the message when the message is composed.
After the message is sent, there is no way, in general, to tell apart a signature from something that the sender has typed by hand.
But maybe, if the signatures you refer to always have some common format, you can probably detect that particular format, using a regular expression or something like that.


text:
Q: Does Python's raw_input interfere with socat? I am trying to use this program plus socat to emulate a serial device.
#echo.py
n=0
while True:
    s = raw_input()
    if 'query' in s:
        print n
    n+=1

When I try to link the program to a fake serial port with
sudo socat -ddd -ddd PTY,raw,link=/dev/ttyS32,echo=0 EXEC:"python echo.py"

I don't get anything when reading or writing from the port. If I use READLINE instead of EXEC, serial data is transferred to and from the socat terminal with no problem.  Is raw_input doing something behind the scenes that is preventing socat from providing it a normal stdin?


text:
Q: Is every real a finite linear combination of a proper subset of the reals with rational coefficients? Wolfram Mathworld explains a Hamel basis as "a set of real numbers $\left\{U_\alpha\right\}$ such that every real number $\beta$ has a unique representation of the form:
$$
\beta = \sum\limits_{i=1}^{n}r_i U_{\alpha_i}
$$
where $r_i$ is rational and $n$ depends on $\beta$."
Am I correct to interpret this as meaning that every real number is a unique finite linear combination of real numbers from a proper subset of $\mathbb{R}$ with coefficients in $\mathbb{Q}$? This would be quite a fascinating result to me.

A: Yes, your understanding is correct, but it isn't so surprising.  We could take the proper subset of $\Bbb R$ to be $\Bbb R\setminus \{0\}$.  Then every real except $0$ is representable with $n=1$ and $0=1+(-1)$ Clearly $\{U_\alpha \}$ is uncountable.  Otherwise you could invoke the countable union of countable sets to show the set of sums is countable, which the reals are not.  If the set of $\{U_\alpha \}$ is uncountable, all bets are off.


text:
Q: How do I set a delay before performing an action in UISearchDisplayDelegate? I have a search display controller which hits an API endpoint. My current code will make a request to the API endpoint on every single char. What I want to do it make a request only when the user has stop typing for 500ms.
Here is the code:
In the UISearchDisplayDelegate
Note: searchQueue is an NSOperationQueue object.
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
    [self.searchQueue cancelAllOperations];

    [self.searchQueue addOperationWithBlock:^(){
        [self.AFRequestManager.operationQueue cancelAllOperations];

        NSString *access_token = [[FBSDKAccessToken currentAccessToken] tokenString];

        NSDictionary *params = @{@"name": searchString, @"access_token": access_token };

        NSString *getUrl = [baseUrl stringByAppendingString:@"api/users/search"];
        [self.AFRequestManager GET:getUrl parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
            self.searchedUsers = responseObject;
            [self.searchDisplayController.searchResultsTableView reloadData];

        } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
            NSLog(@"Error: %@", error);
        }];
    }];

    return NO;
}

This delegate method gets called for every character that the user typed in and I would like to wait until the user finishes specifying the name.
I have tried using NSTimer but it's messy. I can definitely pass the searchString to userInfo. However, once I invalidate the NSTimer, it cannot be used again.
I have tried using a dispatch_after but actually that does not work because every time the user enter a char, the search is delayed but it is still making a request for every single character the user enters.
I did not want to overcomplicate but I feel like it should be super easy and I'm missing something.

A: What about calling performSelector:withObject:afterDelay:? It's available to all NSObjects so you could call it from your view controller. The only thing you might have to worry about is not taking on every single event and queuing up 2 minutes worth of delays:
- (void)performSelector:(SEL)aSelector
             withObject:(id)anArgument
             afterDelay:(NSTimeInterval)delay

Example (note: I made up the variable names for the purpose of demonstration):
[self performSelector:@selector(callServer:) withObject:params afterDelay:0.5f];

UPDATE:
It appears as though the first part of my answer won't suffice. Here are some new steps that should help you derive a solution:
1) Create one NSTimer property so that you can access it wherever you need to
2) Move your current logic in searchDisplayController:shouldReloadTableForSearchString: into a new method so that your timer can use it as its selector. For example:
- (void)callServerWithDictionary:(NSDictionary*)params;
3) Whenever searchDisplayController:shouldReloadTableForSearchString: is called, if your timer instance is null, instantiate it and set its time interval to be 500ms and its selector to be the method you created in step 1. If the timer is not null, invalidate it and set it equal to a new timer instance with the same 500ms interval and selector as before.
4) If you are losing the search string, then create a property to hold it and update it every time searchDisplayController:shouldReloadTableForSearchString: is called. Though I believe you should be able to access it with something like searchDisplayController.searchBar.text.

A: You can use GCD dispatch_after. Here is some example.
double delayInSeconds = 3.0;

dispatch_time_t buyTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));

dispatch_after(buyTime, dispatch_get_main_queue(), ^(void)
{
   //code that will be executed after delay
}

You could use this
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_apply(10, queue, ^(size_t index) {
   // block will be executed 10 times
   // number of launch passes to block
});


text:
Q: Can position modifier use a Geometry Reader frame midY offset? I'm trying to layout Text Views so they display properly on various screen sizes of iPhone. I'm using a Geometry Reader's frame midX and midY properties to assign values to x and y of a position modifier. I apply an offset to the midY value to compensate for the screen size in use.
Changing the value of those offsets: languageCategoryPromptOffsetY, questionPromptOffsetY and languageTextOffsetY does not cause the three text views at the top to move at all on an iPhone 8. The first screenshot below shows the app running on an iPhone 11 Pro Max, and the second one on an iPhone 8, where the first 3 text views are to far up the screen.
I'm testing on real devices, not simulators.
var languageCategoryPromptOffsetY: CGFloat {
        switch UIDevice.current.name {
        case "iPhone SE (1st generation)", "iPod touch (7th generation)":
            return 275
        case "iPhone 7", "iPhone X", "iPhone Xs", "iPhone 11 Pro", "iPhone 12", "iPhone 12 mini", "iPhone 12 Pro", "iPhone 13", "iPhone 13 Pro", "iPhone 13 mini":
            return 275
        case "iPhone 8":
            return 225
        case "iPhone 6s", "iPhone SE (2nd generation)", "iPhone SE (3rd generation)":
            return 275
        case "iPhone 6s Plus", "iPhone 7 Plus", "iPhone 8 Plus":
            return 300
        default:
            return 350
        }
    }

    var questionPromptOffsetY: CGFloat {
        switch UIDevice.current.name {
        case "iPhone SE (1st generation)", "iPod touch (7th generation)":
            return 250
        case "iPhone 7", "iPhone X", "iPhone Xs", "iPhone 11 Pro", "iPhone 12", "iPhone 12 mini", "iPhone 12 Pro", "iPhone 13", "iPhone 13 Pro", "iPhone 13 mini":
            return 250
        case "iPhone 8":
            return 215
        case "iPhone 6s", "iPhone SE (2nd generation)", "iPhone SE (3rd generation)":
            return 250
        case "iPhone 6s Plus", "iPhone 7 Plus", "iPhone 8 Plus":
            return 275
        default:
            return 300
        }
    }

    var languageTextOffsetY: CGFloat {
        switch UIDevice.current.name {
        case "iPhone SE (1st generation)", "iPod touch (7th generation)":
            return 225
        case "iPhone 7", "iPhone X", "iPhone Xs", "iPhone 11 Pro", "iPhone 12", "iPhone 12 mini", "iPhone 12 Pro", "iPhone 13", "iPhone 13 Pro", "iPhone 13 mini":
            return 225
        case "iPhone 8":
            return 205
        case "iPhone 6s", "iPhone SE (2nd generation)", "iPhone SE (3rd generation)":
            return 225
        case "iPhone 6s Plus", "iPhone 7 Plus", "iPhone 8 Plus":
            return 250
        default:
            return 250
        }
    }

var body: some View {
    GeometryReader { geometry in
        Text("\(languageToRun) \(subCategoryPrompt?.string.lowercased() ?? "")")
           .font(.system(size: fontSize, weight: .heavy, design: .rounded))
           .opacity(colorScheme == .dark ? 0.8 : 1)
           .lineLimit(1)
           .multilineTextAlignment(.center)
           .position(x: geometry.frame(in: .local).midX, y: geometry.frame(in: .local).midY - languageCategoryPromptOffsetY)
           .padding()

        Text("\(questionPrompt?.string ?? "")")
           .font(.system(size: fontSize, weight: .heavy, design: .rounded))
           .opacity(colorScheme == .dark ? 0.8 : 1)
           .lineLimit(1)
           .multilineTextAlignment(.center)
           .position(x: geometry.frame(in: .local).midX, y: geometry.frame(in: .local).midY - questionPromptOffsetY)
           .padding()

        Text("\(languageText?.string.firstCharacterUpperCase() ?? "")")
           .testTextFormatter(foregroundColor: languageColour, x: geometry.frame(in: .local).midX, y: geometry.frame(in: .local).midY - languageTextOffsetY)
    }
}


text:
Q: Is it possible to adjust the requirements for badges in an SE site according to the number of users in that site? Or should we in the little sites be content with fewer badges?
Many badges are directly dependent on how many users are on the site.
I am not a programmer.  I don't know if it's feasible.  I do know that I would be confusing to change the badge requirements every day.  How about updating every three months?
Remember, I'm asking, not telling.  Please be nice to me.    (This is my first feature request idea)

A: It's true that SO has more users than any other SE site but we have to remember that SO is not a single cohesive community.  Sure, if you compare a small SE to some of the "grand ballrooms" of SO, there is a big disparity in the number of active users.  But if you look at the "storage closets" of SO, you might fight the disparity reversed.
The point I'm trying to make is that there are many small essentially non-overlapping communities in SO in low-view tag areas that are exactly like the smaller SE sites.  The difficulty in getting badges and earning reputation is related to how cohesive a community is, not how large the whole user base is.
There are users in SO, working primary in a few low-view tag areas, who have a much harder time earning reputation and getting badges than others do.  This isn't "fair" or "unfair" but just a reflection of the size of a cohesive voting block.  Mass voting is rare, vote and view based badges are infrequent and users just content themselves with the ecosystem that they have chosen.
Earning power is also related to the voting culture of the group.  If 25% of the viewers vote on MSO and only 5% vote on SO, badges could be easier to earn on MSO than SO, even though there are fewer viewers.
For better or for worse, badges mean the same thing in the nooks and crannies of SO and on the smaller SE sites as they do in highly popular central core of SO.  Arguments can be made for certain special cases, but I don't think scaling all badges by size of user base would be an effective way to even things out.


text:
Q: How to write in DB without racing condition using a web service? I have written a simple web service (asmx) in c#
The clients hit the webservice with post and a title parameter and expect the service to return an object with more details about that title key.
The problem that I am facing is that in the begining of the execution of my webservice I check to see if that title provided to me, exists in my DB. If not I construct the correct object I save it to my DB to have it for future searches in order to avoid reconstructing it (because I use third-party webservices for the construction) and then I send back in json that object that the client asked for.
This however leads to a racing condition because 2 clients may ask for the same title and end up inserting to the database the same object twice because one of them was not fast enough to write the object before the other one asks for it.
I use Mysql database and I am trying to figure out how to avoid this racing condition?
Is the key a stored procedure?
How can I solve this?
Note: The key in my DB is the title column and the year column.
Thanks in advance

A: You could add a SQL Server UNIQUE constraint on the column to force uniqueness. If the race condition occurs, you can handle the error (from the constraint) in your service code by catching it and simply querying for the title again.

A: Put a unique key on the title in the database (or a hash of the title is probably faster).
The second call would get a DUPLICATE KEY exception even if the row didn't exist when first trying to select it.


text:
Q: How to vary a Materialize modal based on trigger button? I'm using the Materialize CSS and have a working modal for creating new model instances. When I click the edit button on an instance, I want to open the same modal only with the fields pre-populated.
In bootstrap I could accomplish this using
$('#exampleModal').on('show.bs.modal', function (event) {
    modal.find('.modal-body input').val('new value')
})

This function doesn't appear to work using Materialize. Is there an equivalent function I can use instead?

A: So this method is not available on the Materialize framework but they do have a callback available for modal open.
In the initialization of the model, you're able to add optional parameters. Instead of:
$(document).ready(function(){
    $('.modal').modal();
});

you can add a modal open callback using:
$(document).ready(function(){
    $('.modal').modal({
        ready: function(modal, trigger) {
            alert("Modal Open");
        }
    });
});


text:
Q: php error accessing double layer array My data is in a second tier of a return value that I am trying to access the individual elements.  Array ( [success] => 1 [return] => Array ( [0] => Array
I tried ['return'] since it is the key of that, is what I need but got the same error or obvious worse.
error:
Array to string conversion in orders.php on line 10

code:
<?php
 $id = $argv[1];  //variable for inbound
 require_once('phpPlay.php');
 $result = api_query("mytrades", array("marketid" => $id));
 foreach( $result as $x) {
                echo $x;
 }

?>

data top 5 rows:
Array
(
    [success] => 1
    [return] => Array
        (
            [0] => Array
                (
                    [tradeid] => 74038377
                    [tradetype] => Sell
                    [datetime] => 2014-11-12 16:05:32
                    [tradeprice] => 0.00675000
                    [quantity] => 22.18670000
                    [fee] => -0.00007488
                    [total] => 0.14976023
                    [initiate_ordertype] => Buy
                    [order_id] => 197009493
                )

            [1] => Array
                (
                    [tradeid] => 73687280
                    [tradetype] => Buy
                    [datetime] => 2014-11-09 03:38:13
                    [tradeprice] => 0.00816988
                    [quantity] => 0.00100000
                    [fee] => 0.00000002
                    [total] => 0.00000817
                    [initiate_ordertype] => Buy
                    [order_id] => 194824864
                )

            [2] => Array
                (
                    [tradeid] => 73684313
                    [tradetype] => Sell
                    [datetime] => 2014-11-09 02:57:41
                    [tradeprice] => 0.00808034
                    [quantity] => 0.00100000
                    [fee] => 0.00000000
                    [total] => 0.00000808
                    [initiate_ordertype] => Buy
                    [order_id] => 194803992
                )

            [3] => Array
                (
                    [tradeid] => 73653019
                    [tradetype] => Sell
                    [datetime] => 2014-11-08 17:53:12
                    [tradeprice] => 0.00793991
                    [quantity] => 0.00010000
                    [fee] => 0.00000000
                    [total] => 0.00000079
                    [initiate_ordertype] => Buy
                    [order_id] => 194559503
                )

            [4] => Array
                (
                    [tradeid] => 73652717
                    [tradetype] => Sell
                    [datetime] => 2014-11-08 17:50:13
                    [tradeprice] => 0.00793989
                    [quantity] => 0.00100000
                    [fee] => 0.00000002
                    [total] => 0.00000794
                    [initiate_ordertype] => Sell
                    [order_id] => 194559596
                )

...

A: The problem is that with the echo $x statement in your code above, $x is an array, not a string.
The echo function requires a string, so the error you're getting is because PHP is automatically trying to convert the parameter passed to echo to a string, but it is failing because you are passing an array.
Try this:
if (isset($result['return'])) {
    foreach($result['return'] as $result_item) {
        echo(var_export($result_item, true));
    }
} else {
    echo 'No results';
}


text:
Q: Send HTML table through PHPmailer I'm trying to send a dynamic HTML table with PHPmailer but i don't know how, is posible get a variable with all table? or something like that ?
Here is my code:
require("inc/class.phpmailer.php");
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->From     = ('compras.co@kantarworldpanel.com');
$mail->FromName = ('Compras CO (KWBTA)');
$mail->AddAddress($_POST['providermail']);
$mail->AddCC("camilo.uribe@kantarworldpanel.com.co");
$mail->IsHTML(true);

 //IF SUBMIT, SEND MAIL
 if (isset ($_POST['send_approve'])) {
$mail->Subject = "Kantar Worldpanel - Solicitud de Cotización";
$contenido =  'Kantar Worldpanel  Perú S.A. Sucursal Colombia desea solicitar a ustedes la cotización correspondiente a los siguientes Items:
';

////////////////////////////////////////////
$contenido .= ' The Table should be here;
///////////////////////////////////////////

$mail->Body    = $contenido;
$mail->Send();
header ("Location: RequestsPA.php");
}

And here is the table code:
<?php
$sqlStr = "SELECT items.CA_id, items.item_id, items.item_Cant, items.CECO_cod, items.item_desc, items.item_enduser
FROM items where CA_id = ".$CA_id;
$sqlStrAux = "SELECT count(*) as total FROM items";

$aux = Mysql_Fetch_Assoc(mysql_query($sqlStrAux));
$query = mysql_query($sqlStr);

if($aux['total']>0){

    echo "

";
    echo "
";
    echo "\t
\n";
    echo "
";
    echo "

        Item
        Cantidad
        CECO
        Descripción de solicitud
        Usuario final

\n";
    echo "
";
        echo "
";
        $r=0;
        while($row = mysql_fetch_assoc($query)){
    echo "\t\t

            ".htmlentities($row['item_id'])."
            ".htmlentities($row['item_Cant'])."
            ".htmlentities($row['CECO_cod'])."
            ".$row['item_desc']."
            ".$row['item_enduser']."

\n";
      if($r%2==0)++$r;else--$r;
    }
    echo "
";
    echo "\t
\n";
    }
    echo "
";
?>

I hope you can understand me, thanks for your help.

A: While you can use echo to output your table and capture it with output buffering, but generally it's easier to assemble the message body in a string, like this:
$contenido = '';
if($aux['total']>0){

    $contenido .= "

";
    $contenido .= "
";
    $contenido .= "\t
\n";
    $contenido .= "
";
    ...

Then just use that string as your message body. If you use the same code to generate web page output as your email content then turn that script into a function you can call from either place.

A: ob_start();

echo 'all my lines of code';

$contenido = ob_get_clean();

The above will capture everything between the first and last lines.


text:
Q: Add worksheet to existing Excel file with pandas # Set the working folder to the same folder as the script
os.chdir(os.path.dirname(os.path.abspath(__file__)))

test = send_request().content
df = pd.read_csv(io.StringIO(test.decode('utf-8')))
writer = pd.ExcelWriter('NHL_STATS_JSB_final.xlsx', \
                        engine = 'xlsxwriter')
df.to_excel(writer, 'Player statistics', index=False)
writer.save()

I don't understand why, but I am trying to add the worksheet Player statistics to my current NHL_STATS_JSB_final.xlsx file, but it is not working. Instead of adding the worksheet to the file, my code use the current file and erase all previous worksheet to add the new one.
How could I add Player statistics to my current Excel file with erasing all other worksheets?

A: As the OP mentioned, xlsxwriter will overwrite your existing workbook. Xlsxwriter is for writing original .xlsx files. Openpyxl, on the other hand, can modify existing .xlsx files.
@Brad Campbell answer using openpyxl is the best way to do this.  Since the OP was using the xlsxwriter engine, I wanted to demonstrate that it is possible to read in your existing .xlsx file and then create a new workbook (of the same name) containing that data from the original sheets and the new sheet that you'd like to add on.
import pandas as pd
import os

xl = pd.ExcelFile('NHL_STATS_JSB_final.xlsx')
sheet_names = xl.sheet_names  # a list of existing sheet names

#the next three lines are OPs original code
os.chdir(os.path.dirname(os.path.abspath(__file__)))

test = send_request().content
df = pd.read_csv(io.StringIO(test.decode('utf-8')))

#beginning the process of creating new workbook with the same name
writer = pd.ExcelWriter('NHL_STATS_JSB_final.xlsx', engine = 'xlsxwriter')

d = {} #creating an empty dictionary
for i in range (0, len(sheet_names)):
    current_sheet_name = sheet_names[i]
    d[current_sheet_name] = pd.read_excel('NHL_STATS_JSB_final.xlsx', sheetname = i)
    d[current_sheet_name].to_excel(writer, '%s' % (current_sheet_name), index=False)

# adding in the new worksheet
df.to_excel(writer, 'Player statistics', index=False)
writer.save()

A: Here is a snippet of code from one of my projects.  This should do exactly what you want.  You need to use openpyxl rather than xlsxwriter to allow you to update an existing file.
writer = pd.ExcelWriter(file_name, engine='openpyxl')

if os.path.exists(file_name):
    book = openpyxl.load_workbook(file_name)
    writer.book = book

df.to_excel(writer, sheet_name=key)
writer.save()
writer.close()

A: # I needed to append tabs to a workbook only if data existed
# OP wants to append sheets to a workbook.
# using mode 'a' appends if the file exists
# mode 'w' creates a new file if failed to append.
# ended up with this:

def create_POC_file_tab(df, sheetname):
    # within function before the 'if' code below, prep data.
    # Like extracting df_SA values from df,
    # building POC_file name using df_SA+date, etc.
    #
    #  might not have data after filtering so check length.
    if len(df_SA) > 0:  # extracted dataframe contains data
        # Have data so finalize workbook path/name
        POC_file = PATH + POC_file # build file path

        try:
            # mode='a' tries to append a new tab if the
            # workbook exists already
            writer_SA = pd.ExcelWriter(POC_file + ' ' +
                process_date + '.xlsx', engine='openpyxl', mode='a')
            print(POC, 'File exists. Appending to POC',POC,sheetname)
        except:
            # mode='w' creates a new workbook if one does not exist
            writer_SA = pd.ExcelWriter(POC_file + ' '  +
                process_date + '.xlsx', engine='openpyxl', mode='w')
            print(POC, ' !!! Creating !!! ', sheetname)

        try:
            df_SA.to_excel(writer_SA, sheet_name=sheetname,
                index=False)
            writer_SA.save()
        except:
            print ("error on writing sheetname: ", sheetname,
                "for: ",POC)

    return
# when I exit the file seems to be closed properly.

# In brief, to append a new tab to a workbook use:
writer=pd.ExcelWriter('filename.xlsx',engine='openpyxl', mode='a')
df.to_excel(writer, sheet_name='my_sheet_name', index=False)
writer_SA.save()


text:
Q: Determine third point of Right Triangle when two points and all sides are known and $A\hat BC=90$ I have two points and all sides of right triangle
I need find A point
\begin{gather*}
|AB| = 1 \\
|BC| = 1 \\
|AC| = \sqrt{1^2 + 1^2} = \sqrt2 \\
A(?,?) \\
B(0,0) \\
C(1,0) \\
 \\
|AB| = 1 \\
|BC| = \sqrt{1^2 + 1^2} = \sqrt2 \\
|AC| = \sqrt{1^2 + \sqrt2^2} = \sqrt3 \\
A(?,?) \\
B(0,0) \\
C(1,0)
\end{gather*}
The angle in $B$ is 90 degrees.
I need a formula to find point $A$.
i need infinity loop that create a chain of triangle not just one  triangle


text:
Q: format mysql timestamp using php i have column named postDate defined as timestamp.
when i print it directly:
echo $result['postDate'];

i do get that what is stored(eg. 2011-03-16 16:48:24)
on the other hand when i print it through date function:
echo date('F/j/Y',$result['postDate'])

i get December/31/1969
what am i doing wrong?
many thanks

A: Why not format the date as needed in your MySQL query?
SELECT DATE_FORMAT(postDate, '%M/%D/%Y') as date from table

A: try this.
date('F/j/Y',strtotime($result['postDate']));

as timestamp is required, not formatted date as second parameter.
or you can also try
SELECT UNIX_TIMESTAMP(postDate) as postDateInt from myTable

instead of SELECT postDate from myTable
and then have this in your code.
date('F/j/Y',$result['postDateInt']);

A: The PHP date function looks for an int time() as the 2nd param.  Try using strtotime()
echo date('F/j/Y', strtotime($result['postDate']) );

A: The PHP `date()' function expects a number for the second parameter - ie a unix timestamp.
You can convert a SQL date string (or virtually any other date string) into a timestamp in PHP by using the strtotime() function. At least two other answers have already suggested this.
However, I would suggest that you'd be better off getting the date out of your database in unix timestamp format in the first place. You can do this by querying using the MySQL UNIX_TIMESTAMP() function, as follows:
SELECT UNIX_TIMESTAMP(mydatefield) AS mydatefield_timestamp FROM mytable

..obviously, replacing the field and table names as appropriate.
Then you will get the date in timestamp format in your returned dataset in PHP, which you can pass directly into the date() function as follows:
echo date('F/j/Y',$result['mydatefield_timestamp']);

Hope that helps.


text:
Q: Perl. shared hash threads in 2 files please help me resolve my problems with shared hash threads in 2 files
my first file "H.pl" contain defined hash (very huge with many levels):
#!usr/bin/perl
use strict;
use warnings;
our %h;
%h= (
        "hd",
                {
                    "0",    {"type",    "fix",  "ln",   "8",    "descr",    "P"},
                    "1",    {"type",    "hex",  "ln",   "2",    "descr",    "H"},
                },
        "hdr",
                {
                    "0",    {"type",    "fix",  "ln",   "8",    "descr",    "E"},
                },
    );

second file "V.pl" contain main code and threads for change hash:
#!usr/bin/perl

use strict;
use warnings;
use threads;
use threads::shared;
use Data::Dumper;
use lib '.';

require 'H.pl';

our %h;
threads->create(sub{

                    print "befor change in threads \n";
                    print Dumper \%h;

                    $h{"hd"}{"0"}{"value"}  = "hello";
                    $h{"hd"}{"0"}{"descr"}  = "R";
                    $h{"hdr"}{"0"}{"value"}  = "hello";

                    print "after change in threads  \n";
                    print Dumper \%h;

                    }
                );

sleep 1;

print "without threads  \n";
print Dumper \%h;

I tried use our %h:shared; in both files, but always get error Invalid value for shared scalar at H.pl
How I can share my hash?
Thanks for help

A: Per the documentation:

Shared variables can only store scalars, refs of shared variables, or
refs of shared data (discussed in next section):

If you want to share a hash that's not shallow, you need to share the inner references first.
You can use the shared_clone function for that. Adding the following line into V.pl below our %h makes the programs work:
%h = %{ shared_clone(\%h) };

Also, store the result of create to a variable $t and instead of sleep, run $t->join.
It's usually better to use a higher level module like Thread::Queue and only send the data you actually need between threads.


text:
Q: Is it possible to use my public IP address to serve a website? (Catalina) I'm a bit new to the topic of servers, ip addresses (public and private), ports, networking, and how all of this stuff ties together.
Playing around, I managed to run apache on my mac and get an html page up and running on localhost. I typed my private IP address into another device and I was able to see this page.
If I understand correctly, a private IP address is an IP address that's specific to my "local network" which I assume is anything connected to my wifi.
Is it possible to make a webpage that is served from my mac and visible from devices not connected to my local network? I expect to be able to type my public ip address into a URL bar and see this page.
I am aware that there is an app from the App store related to this topic, but I feel this should be basic functionality that can be done from the Terminal (correct me if I'm wrong).
Thanks for the help!

A: Much will depend on your network set-up and is beyond the scope of a single answer.
Try with my Miln Beyond application to confirm your primary outgoing IP address, and if a NAT or UPnP device is on your network. This is to test if the devices are configurable and your network is truly publicly accessible.
Use Beyond's Beyond Network window to see your computer and network's assigned IP addresses:

Do you have another computer or device on a separate network, such as a mobile phone with a data (non-wifi) connection? Use this second device to test access to your server. Testing access using the same network can provide misleading results.
If this works, then you can achieve the same via the command line and Apache httpd.
Unverified Address
You commented:

Unverified potentially accessible address. Provided by local Network Address Translation (NAT) or Universal Plug and Play (UPnP) device.

An "unverified" address is potentially accessible from the Internet. It is unverified only because Beyond has not actively checked it (that requires a membership).
The listing also suggests that your router supports NAT or UPnP to open external ports and allow incoming traffic.
Does your Internet router have a web interface? The router is a device often supplied by your Internet Service Provider (ISP). If so, look for NAT or UPnP settings; these may also be called Port Forwarding.
By default, your router should block incoming traffic from the Internet into your network. To offer a server to the wider Internet, your router needs to be told to accept specific incoming traffic and to pass it to the server inside your network.
For short lived servers and services, like video/voice calls, NAT and UPnP are used. This is what Beyond has managed to do on your network.

A: Is it possible? Yes. But there are some caveats:

*

*Your Internet Service Provider may (probably does) block servers of any sort from being hosted behind your network - as listed in their terms of service

*Apache (and therefore websites) generally require constant uptime, hosting it on a Mac is not impossible, by any means, but you'd need to keep the computer turned on all the time. Which can eventually slow your computer down to the point it is unusable by you.

*If you get enough traffic (bots, etc) - it may be considered a Denial of Service (DoS) attack by your ISP. They can suspend your service.

If, for whatever reason, it turns out that your ISP does not block servers on the network, you can use a service like DynDNS to point a hostname to your external IP which makes everything so much easier to remember.
You would also need to port-forward port 80 (and/or 443) via your modem to your internal private IP which may or may not change behind your network.

A: There are several ways to achieve this:

*

*The classic way is to configure your router to do "port forwarding". You tell it that any connection destined to port 80 should be forwarded to your computer, so anyone trying to make an HTTP request to your public IP address would be sent to the HTTP server on your Mac.
You would probably also do the same for port 443 (HTTPS).
Limitations apply: your ISP must not block inbound traffic (explicitly or implicitly because they would be using CGNAT), you can only forward to a single server...
Instead of using your public IP address, you can use a dynamic DNS service which will give you a domain name that maps to your IP address and is updated if your IP address changes. If you have a fixed IP address, you can directly point a DNS name to your IP.

*Another way is to do tunnelling. Something on your Mac connects to a server on the outside, and a tunnel is created inside this connection, which forwards traffic received on the outside server's IP/port to your server.
If you have your own Linux server hosted somewhere, you could use ssh with a remote port forwarding request (-R) to achieve that.
Or you can use a service like Ngrok which will do that for you. You tell it the local protocol and port on your Mac, and it will give you a publicly accessible URL which is forwarded back to the server on your Mac. There are probably tons of alternatives.
There are also more general-purpose VPNs that could be used, but beware of security implications.
The drawback of all these methods is that you depend on "something" out there on the Internet, and that all traffic will go through this device/service before reaching your home server. This can add latency or bandwidth bottlenecks, and of course there's often a direct or indirect cost as you need to pay for this "something".
Note that in both cases, you should be mindful about security: your local network is normally protected from the outside by NAT, but you're opening a "hole". If there are any security issues on the server you run on your Mac, external users may be able to access stuff on your Mac or on the rest of your network they wouldn't usually be able to.


text:
Q: How to deploy a Node.js web role along with a .NET web role in azure cloud service project? I have a cloud service with a web role in .NET. But I am also using socket.io for some functionalities of my project. What i have been doing all this while is that am putting the socket.io node.js file in the .NET web role itself and after publishing to cloud, am then doing RDP into the web role, installing the azure node.js SDK and then manually starting the socket.io server. The biggest drawback of this technique was that whenever the roles restarted, i had to re install the azure node.js sdk and start the socket.io server again.
The only way I could find was by putting the socket.io node.js file in a separate azure project and publishing that using the azure power shell according to this link
Is there a way to put both the .NET and node.js web roles in the same azure project and publish that to cloud? Or what is the best way to publish my azure cloud service consisting of a .NET web role and a node.js web role?
Thanks

A: The development experience probably will be smoother if the Node.js component of the application is deployed as a separate cloud service instance. But it is possible to automate the deployment using startup taks as described in Run Startup Tasks in Windows Azure.
You can create a command batch file to download anything you need and install it on the instance. You can run it with administrative privilege. You can listen to a port and have it set up as a cloud service endpoint. You can even deploy the files as part of your cloud service project and just configure and run them through the startup task. Use RDS to debug this script via logging and system events.


text:
Q: Apply a widget to a DOM element on the fly Is it possible to use a string to generate a jQuery UI widget on the fly?
It's easy to do this:
$(function() {
  $("selector").widget()
})

What I want to do is something this:
ajax.onreadystatechange = function() {
  if (ajax.readyState==4 && ajax.status==200) {
    widget = ajax.responseText // widgetType is a string
    $("selector").widget() // but I want to use the *value* of widget
  }
}

Is there a way to do this?

A: foo.bar is equivalent to foo['bar'].
Likewise, $("selector").widget() is equivalent to $("selector")['widget']().
So you can write this:
ajax.onreadystatechange = function() {
  if (ajax.readyState==4 && ajax.status==200) {
    widgetType = ajax.responseText;
    $("selector")[widgetType]();
  }
}


text:
Q: How can you wear Red's Clothes For Terraria Mobile, how can you wear Red's clothes? Every time I put them on even a mannequin they disappear.

A: Since Red's Clothes are "Unobtainable" on the Mobile Version of Terraria, there are serious glitches with certain items. Red's Clothes have been known to not be wearable in the Mobile Edition. Either their texture (On Body) or their code is missing/unprogrammed, causing it to be unwearable. Either that or they just added an unusable copy of it to troll hackers/modders/cheaters. Also hacked in items don't always work due to glitches. (No offence, but I know you hacked because Red's Clothes are unobtainable without hacks.)
In a nutshell: You can't wear Red's Clothes on Mobile. You just can't.
Hope this helps! =D


text:
Q: Конфликт тем DarkActionBar и Theme.Light Здоровья всем!
Я даже не знаю с чего начать. Есть у меня приложение в котором есть navigation drawer, сейчас я пытаюсь добавить ActionBar tabs с возможностью свайпить.
Конечно же после добавления последних приложение вылетело. После долгих экспрементов выяснилось что с темой Theme.AppCompat.Light.DarkActionBar начинает работать navigation drawer, а с темой Theme.Light - ActionBar tabs.
Надеюсь хоть как-то смог объяснить в чем проблема. Какие могут быть идеи?
вылетаетс такой ошибкой:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.se...
на этой строке (вообще где используется actionBar):
actionBar.setHomeButtonEnabled(false);
Класс Main
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.FragmentTransaction;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;

import net.seosprint.www.seosprint.adapter.TabsPagerAdapter;

public class ManagereklActivity2 extends FragmentActivity implements
        ActionBar.TabListener {

    private ViewPager viewPager;
    private TabsPagerAdapter mAdapter;
    private ActionBar actionBar;
    // Tab titles
    private String[] tabs = { "Top Rated", "Games", "Movies" };

    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Initilization
        viewPager = (ViewPager) findViewById(R.id.pager);
        actionBar = getActionBar();
        mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
        viewPager.setAdapter(mAdapter);
        actionBar.setHomeButtonEnabled(false);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        // Adding Tabs
        for (String tab_name : tabs) {
            actionBar.addTab(actionBar.newTab().setText(tab_name)
                    .setTabListener(this));
        }
        /**
         * on swiping the viewpager make respective tab selected
         * */
        viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

            @Override
            public void onPageSelected(int position) {
                // on changing the page
                // make respected tab selected
                actionBar.setSelectedNavigationItem(position);
            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {
            }

            @Override
            public void onPageScrollStateChanged(int arg0) {
            }
        });
    }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft) {
    }

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        // on tab selected
        // show respected fragment view
        viewPager.setCurrentItem(tab.getPosition());
    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) {
    }

}

И вспомогательный класс:
import net.seosprint.www.seosprint.GamesFragment;
import net.seosprint.www.seosprint.MoviesFragment;
import net.seosprint.www.seosprint.TopRatedFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class TabsPagerAdapter extends FragmentPagerAdapter {

    public TabsPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int index) {

        switch (index) {
        case 0:
            // Top Rated fragment activity
            return new TopRatedFragment();
        case 1:
            // Games fragment activity
            return new GamesFragment();
        case 2:
            // Movies fragment activity
            return new MoviesFragment();
        }

        return null;
    }

    @Override
    public int getCount() {
        // get item count - equal to number of tabs
        return 3;
    }

}


text:
Q: Checkout Bitbucket Repo Branch in Jenkins I am new with Jenkins and trying to create a pipeline and checkout the private BitBucket repository from Jenkins and then install dependencies and then create build.
But I am having issue in the first step while checkout the repository branch.
I have set the credentials and SSH link as well.
Here is the Error:
The recommended git tool is: NONE
using credential 02cb4299-3a20-424f-a541-1771e5b2e0b9
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe rev-parse --resolve-git-dir C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\SCM-Pipline\.git # timeout=10
Fetching changes from the remote Git repository
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe config remote.origin.url ssh:///git@bitbucket.org:Arsalanakhtar123/etisalat-jenkins.git/ # timeout=10
Fetching upstream changes from ssh:///git@bitbucket.org:Arsalanakhtar123/etisalat-jenkins.git/
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe --version # timeout=10
git --version # 'git version 2.37.0.windows.1'
C:\Users\ahsan.alam\AppData\Local\Programs\Git\bin\git.exe fetch --tags --force --progress -- ssh:///git@bitbucket.org:Arsalanakhtar123/etisalat-jenkins.git/ +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'

Here is the code:
pipeline {
 agent any
  stages {
  stage('Git Checkout') {
  steps {
    git branch: 'master',
        credentialsId: '<credentialIdsHere>', // changed
        url: 'ssh://git@bitbucket.org:company/repo.git/' // changed
   }
  }
 }
}

Also I have specify the git.exe path

A: Assuming SSH is working, meaning you can execute manually a git ls-remote (for instance) to that SSH URL, I would recommend the syntax (for said SSH URL):
ssh://git@bitbucket.org/company/repo.git
                      ^^^ (/, not :)
# or
git@bitbucket.org:company/repo.git/
                ^^^ (OK, but no ssh:// prefix)


text:
Q: Create a list from selected list items I have a fiddle here: my fiddle. What I am trying to do is create a list of items from a separate group of lists. I cannot seem to get a grasp on what I am doing wrong, but here is whats happening:

*

*I have a group of lists based on tabular data

*Each list has the name of the column and a selection checkbox

*If I select an item, it needs to be added to the selected columns area (vertical list)

*There are 14 unique tabular items with checkboxes

*(PROBLEM -->) When I select an item, it gets added 14 times in the selected columns section

code
(html):
I tried ti insert HTML but is not working right. Please look at the fiddle listed above.
(jquery):
var dte = // drag table elements
{
init: function() {
    var chkbx = $('.group input[type="checkbox"]:checkbox');
    //var chkbx = $('#accordion');
    for (var i = 0, ii = chkbx.length; i < ii; i++) {
        $(chkbx).bind("click", dte.adjustList);
    }
},

adjustList: function(event) {
    var list = [];
    var str = '';
    var eleval = event.currentTarget.value;
    var eleid = event.currentTarget.id;
    if (eleval == 1) {
        list.push(eleid);
        str = '
' + eleid + '
';
    }
    $('#vertical ul').append(str);
/*
    //var ele = event.currentTarget.id;
    var allVals = [];
    var str = '';
    //var obj = $("#"+ele);
    var ele = $('#accordion');
    $(obj+': checked').each(function(){
        allVals.push($(this.val()));
        dte.list.push($(this.val()));
        str += '
'+$(this.val())+'
';
    });
    $('#verticle').text(str);
    alert('List: ' + toString(list));
    */
}
};
dte.init();

A: init: function() {
    $('.group input:checkbox').bind("click", dte.adjustList);
},

A: you only need to bind once based on your selector.
init: function() {
        var chkbx = $('.group input[type="checkbox"]:checkbox');
        $(chkbx).bind("click", dte.adjustList);
 },

fiddle

A: I have edited your fiddle, I removed the for loop. Here is the link updated fiddle
You only need to bind the click event once.

A: You are binding events multiple time. You can do something like this:
init:function(){
  $('.group input[type="checkbox"]:checkbox').bind('click',dte.adjustList);
},

Edited your fiddle:
http://jsfiddle.net/emphaticsunshine/tPAmc/


text:
Q: When a user Like my page embeded in my site some functions should call I have a simple site, I want to code that when ever a user on my site Like my Page which is embeded in it another button should appear below it saying "Proceed to Next Step"
Hope so you got my idea.

A: So, in essence, you have to use the FB API to achieve what you want. Here is the example:
$(document).ready(function()
{
    window.fbAsyncInit = function() {
    FB.init({ status: true, cookie: true, xfbml: true });
    FB.Event.subscribe('edge.create', function(href, widget)
    {
        //Liked event - do something here
        $('#something').show();
    });
    };

    (function() {
    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
    }());

});


text:
Q: How to make Title READONLY in custom list If I set the title field to Read only (since I will calculate it based upon other values) in the ListAdded Event handler, when i open up a form for creating a new item i get an error.
Event handler..
public override void ListAdded(SPListEventProperties properties)
   {
       //Set Title column as READ ONLY

       SPField f = properties.List.Fields[new Guid("{fa564e0f-0c70-4ab9-b863-0177e6ddd247}")];
       f.ReadOnlyField = true;
       f.Update();
       base.ListAdded(properties);
   }

This works, as the Title field no longer shows up in the new item form, but when debugging in get a JS error , and I think it is due to the form trying to focus that field.  If instead i set INHERIT=FALSE on the content type, title dissappears fro mthe form, but so does another site column i aded ot the content type, Assigned To.  Assigned To is still in the custom content type, but it does not show up on the new form when adding an item to the list.
Any ideas on how ot get the Assigned To field back in the form?

A: To extend on what Vedran suggested, the following should be equivalent to setting the Title column's settings to Hidden (Will not appear in forms) when editing the list's content type in the UI:
SPField f = properties.List.Fields[SPBuiltInFieldId.Title];
f.Required = false;
f.Hidden = true;
f.Update();

A: There are properties on SPField meant to specifically control when a field is presented to the user.  You may also want to set a DefaultValue and turn off EnforceUniqueValues:
        SPField f = properties.List.Fields[SPBuiltInFieldId.Title];
        f.ShowInNewForm = false;
        f.ShowInEditForm = false;
        f.EnforceUniqueValues = false;
        f.DefaultValue = "some default value so required check(s) don't fail";
        f.Update();


text:
Q: Transform schedule to comprehensive report with Python I'm trying to turn a schedule with the following format into a report format.
Currently the data is stored as follows:
Person Name    Jun 1    Jun 2    Jun 3   Jun 4   Jun 5   Jun 6   Jun 7   Jun 8   Jun 9   Jun 10   ...
John Smith       X        X        X       X       O       O       O       X       X       X      ...
Aaron Roberts    O        O        X       X       X       X       O       O       O       O      ...
Jess Lewis       O        O        O       O       X       X       X       X       X       X      ...
Edgar Blue       X        X        X       X       X       O       O       O       O       X      ...
Lara Irvin       X        X        O       O       O       O       X       X       X       X      ...

The X represent days that they're "ON" and the O represent days that they're off.
What I want is to run a python script that summarizes the schedule in a report of this format:
Person Name          From:          To:
John Smith           Jun 1          Jun 4
John Smith           Jun 8          Jun 10
Aaron Roberts        Jun 3          Jun 6
Jess Lewis           Jun 5          Jun 10
Edgar Blue           Jun 1          Jun 5
Edgar Blue           Jun 10         Jun 13
Lara Irvin           Jun 1          Jun 2
Lara Irvin           Jun 7          Jun 10

What I've tried is to create a unique names list
names = ["John Smith", "Aaron Roberts", "Jess Lewis", "Edgar Blue", "Lara Irvin"]

And then do
for name in names:
    df.iloc["Person Name"] == name

Then I'm not sure how to proceed, I'm trying to look if the i position is an X or an O, then look if the i-1 position is an X or an O
Then...
if i == "X" && i-1 == "O"

Populate that header date in the other table's "From:" column
and...
if == "O" && i-1 == "X"

Populate that header date in the other table's "To:" column
Then repeat the same process using a nested for loop across all "Person Name" and all dates.
Thank you in advance for any help.

A: This will need the cumsum create the subgroup then we stack , groupby with agg
df=df.set_index('PersonName')

s1=df.eq('O').cumsum(1).stack().reset_index()

s=s1[df.stack().ne('O').values].groupby(['PersonName',0])['level_1'].agg(['first','last']).reset_index(level=1,drop=True)

s
              first   last
PersonName
AaronRoberts   Jun3   Jun6
EdgarBlue      Jun1   Jun5
EdgarBlue     Jun10  Jun10
JessLewis      Jun5  Jun10
JohnSmith      Jun1   Jun4
JohnSmith      Jun8  Jun10
LaraIrvin      Jun1   Jun2
LaraIrvin      Jun7  Jun10


text:
Q: Sqlce {"There was an error parsing the query. [ Token line number = 1,Token line offset = 27,Token in error = CONTAINS ]"} I have a field in Plant table SeedStartMonths as nvarchar that contains 1 2 4 11.  I'm trying to SELECT * FROM Plant WHERE CONTAINS(SeedStartMonths, '11') and it giving me error.
    string tmp = ( (int) thisMonth ).ToString();
            using (SqlCeCommand com = new SqlCeCommand("SELECT * FROM Plant WHERE CONTAINS(SeedStartMonths, '" + tmp + "')", con))
            {
                SqlCeDataReader reader = com.ExecuteReader();

                while (reader.Read())
                {
                    try
                    {

                        AddReaderToGardenEntityList(gardenEntities, reader);
                    }
                    catch (Exception)
                    {
                        //unable to parse datas
                    }
                }
            }

A: SQL-CE does not support the CONTAINS predicate function. However it does support the LIKE operator, you must rewrite your query like so:
SELECT * FROM Plant WHERE SeedStartMonths LIKE '%11%'


text:
Q: What can i do to made "Rock, papper, scissors" work? i'm very new to js, and it's my first code on it. i'm trying to make a game "rock, papper, scissors". please, look at my code, my funcrion playRound doesn't wor, i need it to return scores.
please, give me advises how to change my code, but i don't want you to solve all for me. thank you.

function computerPlay() {
    let computerAction = Math.floor(Math.random() * choises.length);
    let computerSelection = choises[computerAction];
    return computerSelection;
}

function userPlay() {
    let playerSelection = prompt(choises).toLowerCase();
    return playerSelection;
}

let choises = ['rock', 'paper', 'scissors'];

let Score = new Map([
    ['userScores', 0],
    ['computerScores', 0]
]);

function playRound(playerSelection, computerSelection) {
    if (playerSelection === choises[0] && computerSelection === choises[0]) ||
    (playerSelection === choises[1] && computerSelection === choises[1]) ||
    (playerSelection === choises[2] && computerSelection === choises[2]){
        return Score = ['userScores' + 1, 'computerScores' + 1];
    } else if (playerSelection === choises[0] && computerSelection !== choises[0]) ||
    (playerSelection === choises[1] && computerSelection !== choises[1]) ||
    (playerSelection === choises[2] && computerSelection !== choises[2])
        return Score = ['userScores' + 1, 'computerScores'];
    } else if (playerSelection !== choises[0] && computerSelection === choises[0]) ||
    (playerSelection !== choises[1] && computerSelection === choises[1]) ||
    (playerSelection !== choises[2] && computerSelection === choises[2])
    {
        return Score = ['userScores', 'computerScores' + 1];
    }
}

A: Refer to this:

function computerPlay() {
    let computerAction = Math.floor(Math.random() * choises.length);
    let computerSelection = choises[computerAction];
    return computerSelection;
}

function userPlay() {
    let playerSelection = prompt(choises).toLowerCase();
    return playerSelection;
}

let choises = ['rock', 'paper', 'scissors'];

let Score = {
    user: 0,
    computer: 0
}

function playRound(playerSelection, computerSelection) {
    if (playerSelection === computerSelection){
        Score.user = Score.user + 1;
        Score.computer = Score.computer + 1;
    } else if ((playerSelection === choises[0] && computerSelection === choises[2]) ||
    (playerSelection === choises[1] && computerSelection === choises[0]) ||
    (playerSelection === choises[2] && computerSelection === choises[1])) {
        Score.user = Score.user + 1;
    } else {
        Score.computer = Score.computer + 1;
    }
}

let computerChoice = computerPlay();
let userChoice = userPlay();
playRound(userChoice, computerChoice);
console.log('computer hand', computerChoice);
console.log('user hand', userChoice);
console.log(Score);


text:
Q: How to resolve Splash 405 https://www.controller.com/listings/aircraft/for-sale/list>: HTTP status code is not handled or not allowed i am trying to access a website Using Scrapy-Splash but i get error 405 Ignoring response <405 https://www.controller.com/>: HTTP status code is not handled or not allowed
The Code i use
import scrapy
from scrapy_splash import SplashRequest

class ProxySpider(scrapy.Spider):
    name = "proxyss"

    def start_requests(self):
        urls = [
            'https://controller.com/',
        ]
        for url in urls:
             yield SplashRequest("https://www.controller.com/listings/aircraft/for-sale/list", self.parse,args={"http_method":'GET','wait': 5,'proxy': 'http://xxxxxxxxxx'})

    def parse(self, response):
        page = response.url.split("/")[-2]
        filename = 'proxy.html'
        with open(filename, 'wb') as f:
            f.write(response.body)
        self.log('Saved file %s' % filename)

LOGS
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://www.controller.com> (failed 1 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://www.controller.com/listings/aircraft/for-sale/list> (failed 1 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://www.controller.com> (failed 2 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://www.controller.com/listings/aircraft/for-sale/list> (failed 2 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://www.controller.com> (failed 3 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://www.controller.com/listings/aircraft/for-sale/list> (failed 3 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Gave up retrying <GET https://www.controller.com> (failed 4 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.core.engine] DEBUG: Crawled (405) <GET https://www.controller.com> (referer: https://www.controller.com/listings/aircraft/for-sale/list)
2020-08-17 21:30:55 [scrapy.downloadermiddlewares.retry] DEBUG: Gave up retrying <GET https://www.controller.com/listings/aircraft/for-sale/list> (failed 4 times): 405 Method Not Allowed
2020-08-17 21:30:55 [scrapy.core.engine] DEBUG: Crawled (405) <GET https://www.controller.com/listings/aircraft/for-sale/list> (referer: https://www.controller.com/listings/aircraft/for-sale/list)
2020-08-17 21:30:56 [scrapy.spidermiddlewares.httperror] INFO: Ignoring response <405 https://www.controller.com>: HTTP status code is not handled or not allowed
2020-08-17 21:30:56 [scrapy.spidermiddlewares.httperror] INFO: Ignoring response <405 https://www.controller.com/listings/aircraft/for-sale/list>: HTTP status code is not handled or not allowed
2020-08-17 21:30:56 [scrapy.core.engine] INFO: Closing spider (finished)
2020-08-17 21:30:56 [scrapy.statscollectors] INFO: Dumping Scrapy stats:

A: Could just be a retry issue. Add this to your settings.py file and see if it helps:
RETRY_ENABLED = True
RETRY_TIMES = 3
RETRY_HTTP_CODES = [405]


text:
Q: How do I make a button that resorts data on a page? I have a page that lists all the events in my database of events. I want to create a button that says "my events" that when pressed reloads the page but then only displays events that belong to the current_user. I tried doing something like this:
<%= button_to "My Events", events_path(:my_events => true) %>

and then I was going to add an if statement to the events_controller index that filters @events if my_events is true. However, this button just creates a new event for some reason.
Is there a better way of doing this?

A: this will do what you want:
add an action find_my_events in your events controller:
find_my_events
@events = current_user.events(:all)
render :action => 'index'
end
Now, in your view, create a form_tag and associate it with find_my_events:
(you can either create a new route in your routes.rb or use :controller => 'events', :action => 'find_my_events', i prefer the former)
Add a submit_tag to your form.
So, now when you submit the form, the page refreshes and fetches events for the current user.
You can also submit a form to your index action with a boolean hidden field.  Now in your index action check if that boolean field is set to true, if yes, display events for the current_user or all events otherwise.


text:
Q: Migration WSO API Manager 1.4.0 to 1.8.0 I need to migrate from WSO2 API Manager 1.4.0 to 1.8.0. I executed all instructions from 'wso2am_1.8.0/dbscripts' (how it was possible)

*

*migration 1.4.0 to 1.5.0

*migration 1.5.0 to 1.6.0

*migration 1.6.0 to 1.7.0

*migration 1.7.0 to 1.8.0

But the very last ant script 'swagger-doc-migration' (from 1.7.0 to 1.8.0)  failed and showed exception like this:
2015-01-20 16:32:47,142] ERROR - RPCMessageReceiver Resource does not exist at path /_system/governance/apimgt/applicationdata/api-docs/SOME_API-1.0-xxxxxxxx-AT-xxxxxxxxx.com/1.2
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)...

It seems scripts 1.6.0 to 1.7.0 doesn't migrate swagger docs completely because 'swagger-doc-migration' script (1.7.0->1.8.0) can't find path /_system/governance/apimgt/applicationdata/api-docs/SOME_API-1.0-xxxxxxxx-AT-xxxxxxxxx.com/1.2.
So, how can I make "swagger-doc-migration" from "migration 1.7.0 to 1.8.0" work?

A: There was an issue in swagger resource migration script and it was fixed in the latest patch.
Please use the scripts from following location : https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/products/apimgt/1.8.0/modules/distribution/resources/migration-1.6.0_to_1.7.0/

A: have the same issue with migration. I try to migrate 1.6.0 -> 1.7.0 -> 1.8.0 and swagger-doc-migration fails for the step 1.7.0 -> 1.8.0. But if I setup 1.7.0 and then migrate to 1.8.0 swagger-doc-migration succeed.
Seems like swagger-doc-migration from 1.6.0 -> 1.7.0 fails to migrate api docs correctly.
Note: I've tried https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/products/apimgt/1.8.0/modules/distribution/resources/migration-1.6.0_to_1.7.0/ from Abimaran Kugathasan's answer.


text:
Q: Align a ListView in the middle of the screen (layout-large) I am having troubles aligning a listview in the middle of the screen like that:

I created a tablet layout (layout-large) and I cannot figure out why the layout looks like that:

This is my list_item layout:
<?xml version="1.0" encoding="utf-8"?>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/degree_circle_container">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_heighta="wrap_content"
            android:id="@+id/circleImageView"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@mipmap/bg_temperature"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/temperatureLabel"
            android:layout_alignTop="@+id/circleImageView"
            android:layout_alignBottom="@+id/circleImageView"
            android:layout_alignLeft="@+id/circleImageView"
            android:layout_alignRight="@+id/circleImageView"
            android:gravity="center"
            tools:text="100"
            android:textColor="#f25019"/>
    </RelativeLayout>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/iconImageView"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/degree_circle_container"
        android:layout_toEndOf="@+id/degree_circle_container"
        android:src="@mipmap/clear_day"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/dayNameLabel"
        android:layout_toRightOf="@+id/iconImageView"
        android:layout_centerVertical="true"
        android:textColor="#ffffffff"
        tools:text="Wednesday"
        android:textSize="20sp"/>

This is the "Daily" layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="10dp"
            android:gravity="center"
            android:paddingBottom="10dp"
            tools:context="koemdzhiev.com.stormy.ui.DailyForecastActivity"
            android:background="@drawable/bg_gradient">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/no_daily_forecast_data"
    android:id="@android:id/empty"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:textColor="#ffffffff"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="This week's weather"
    android:id="@+id/thisWeekLabel"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:textColor="#ffffffff"
    android:textSize="30sp"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/developer_email"
    android:textSize="@dimen/abc_text_size_small_material"
    android:id="@+id/developer_email"
    android:textColor="@android:color/white"
    android:paddingBottom="7dp"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"/>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/daily_swipe_refresh_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@android:id/list"
        android:layout_marginTop="18dp"
        android:layout_marginBottom="8dp"
        android:divider="@null"
        android:dividerHeight="0dp"/>
    </android.support.v4.widget.SwipeRefreshLayout>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:text="v 2.0"
    android:id="@+id/appVersion"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"/>

A: try adding android:layout_centerHorizontal="true"
or/and android:layout_centerInParent="true" at the ListView.

A: To have your app looks like the image that you give :
1 - First add layout_below = "@id/yourViews" so the listview would be under << YourViews >>
2- Try android:layout_centerHorizontal="true" inside your Listview too
If any trouble leave a comment

A: You want your content to be aligned in center , then android:gravity="center" should work . Hope it helps.

A: Add android:layout_centerHorizontal="true" to the android.support.v4.widget.SwipeRefreshLayout because this is the Layout which is nested in the parent RelativeLayout.
Also you should add the layout_below = "@id/yourViews" as minos23 told you.


text:
Q: Split string at every nth linebreak using javascript I'm looking for a solution to split a string at every nth linebreak.
Lets say i have one string that has six lines
"One\nTwo\nThree\nFour\nFive\nSix\n"

So splitting at 3rd line break would give me something like
"One\nTwo\nThree\n" and "Four\nFive\nSix\n"

I've found solutions to do it at nth character, but i can't be definite of at what character length the nth break would occur.
I hope my question is clear.
Thanks.

A: Instead of using the String.prototype.split, it's easier to use the String.prototype.match method:
"One\nTwo\nThree\nFour\nFive\nSix\n".match(/(?=[\s\S])(?:.*\n?){1,3}/g);

demo
pattern details:
(?=[\s\S]) # ensure there's at least one character (avoid a last empty match)

(?:.*\n?)  # a line (note that the newline is optional to allow the last line)

{1,3} # greedy quantifier between 1 and 3
      # (useful if the number of lines isn't a multiple of 3)

Other way with Array.prototype.reduce:
"One\nTwo\nThree\nFour\nFive\nSix\n".split(/^/m).reduce((a, c, i) => {
    i%3  ?  a[a.length - 1] += c  :  a.push(c);
    return a;
}, []);

A: Straight-forward:
(?:.+\n?){3}

See a demo on regex101.com.

Broken down, this says:

(?:  # open non-capturing group
.+   # the whole line
\n?  # a newline character, eventually but greedy
){3} # repeat the group three times


text:
Q: WileyNJD-v2.cls is not printing the exact math equation I typed \documentclass[AMA,STIX1COL]{WileyNJD-v2}
\begin{document}
    \begin{equation}
    \dot{x}=\tilde{x}+\hat{x}
    \end{equation}
\end{document}

gives me the following pdf view
Is anyone experiencing the same problem? This only happens if I use this class of document, which I must. Noticed it on October 10th.
The template for this class can be found on the link below:
https://onlinelibrary.wiley.com/page/journal/14678640/homepage/custom_copy.htm

A: I can reproduce the issue with a minimal example:
\documentclass{article}
\usepackage{ulem}
\usepackage{stix}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\dot{x}=\tilde{x}+\hat{x}
\end{equation}

\end{document}

The culprit is the ulem package loaded before stix and amsmath. It's not at all clear what's causing the issue, but it's certainly linked to \dot and the other math accent commands having become robust in the last LaTeX release (2019-10-01).
The problem is that ulem redefines the kernel command \MakeRobust.
Workaround until ulem is fixed:
\expandafter\def\csname ver@ulem.sty\endcsname{3000/12/31}

\documentclass[AMA,STIX1COL]{WileyNJD-v2}

% if you really need ulem
\expandafter\let\csname ver@ulem.sty\endcsname\relax
\let\kernelMakeRobust\MakeRobust
\usepackage[normalem]{ulem}
\let\MakeRobust\kernelMakerobust

\begin{document}
    \begin{equation}
    \dot{x}=\tilde{x}+\hat{x}
    \end{equation}
\end{document}

UPDATE January 2020
The release of ulem dated 2019-11-18 (and included in TeX Live on 2020-01-11) fixes the issue. The OP's original code now should work.


text:
Q: Load file from folder spring boot Apache Maven 3.5.4
jdk-10.0.1
Spring Boot 2.0.4.RELEASE
Win 10
I have images in the src/main/resources/images/ folder. When I run the application in the intelli J it works fine but when I create a jar of the application. It cannot find the image files. I tried followings neither worked. Any idea how I can retrieve the image files? Thanks.
    dogImageFile = new File("src/main/resources/images/dog.png");
    dogClick = new Image(dogImageFile.toURI().toString());

    dogImageFile = new File("\\images\\dog.png");
    dogClick = new Image(dogImageFile.toURI().toString());

    //Tried via @Value("classpath:dog.png") and ResourceLoader

    //Also tried

    dogClick= new Image(getClass().getClassLoader().getResource("src/main/resources/images/dog.png").toString(), true);

A: This has nothing to do with the version of java and the version of springboot. You need to care about the path of the compiled class files and resources files.

A: InputStream stream = getClass().getClassLoader().getResourceAsStream("static/xxx.pdf");
File targetFile = new File("xxx.pdf");
FileUtils.copyInputStreamToFile(stream, targetFile);

Hi,you can read file in jar with this code!

A: This does it.
dogClick = new Image("/images/dog.png");


text:
Q: Substr in Oracle SQL Both the below queries return the same result. Can you please let me know why and which is more appropriate?
select substr('87731000',0,8) from dual;

select substr('87731000',1,8) from dual;

A: This version is more appropriate:
select substr('87731000',1,8) from dual;

The second parameter is the start position. In oracle, the start position for a string is always 1.
Both statements work just fine, but that's only because the database is being helpful and assuming that if you enter '0', you mean to start at the beginning of the string.
From the oracle docs:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions162.htm

If position is 0, then it is treated as 1.


text:
Q: Determine the meaning of a gradient of a graph How do you determine the gradient of a graph in physics, such as how with a velocity-time graph, the gradient is acceleration.
I want to know the general method for figuring out what the differential of a graph means.

A: It really depends on the specific situation.  The general meaning of gradient is the spatial rate of change in a quantity.  For example in a temperature field $T(x,y)$, the gradient $\vec {\nabla T}$ tells you the direction of greatest change in the temperature, which physics says will be the direction of greatest heat flow.
In addition, your example of acceleration is not a gradient in typical usage of the word. Acceleration is the time derivative of velocity
$$a = \frac {dv}{dt} $$
A time derivative is usually referred to as a rate.  A spatial derivative is referred to as a gradient.


text:
Q: Gmail HTML Issues - (mail.google.com) So, I am having quite a few issues when trying to get an HTML email working seamlessly in Gmail.
Issue we are having, not even sure if it's fixable, is on the mail web app version of Gmail and not the app. - mail.google.com.
Once of my HTML emails contains a header (logo, links etc) and will hide and show a second table row for a mobile version.
We use media queries and classes for these table rows, it all works perfectly on: Outlook, Mail, Browser, Android Web just not (mail.google.com).
We had stripped back all of the CSS so the code simply looked like:

 web stuff here

 mobile stuff here

With the media queries looking like:
@media only screen and (max-width:475px) { .web {display: none;} .mobile {display: block} }

Now the web mail version ignores all of this and even removes our Style tags and Media queries. So if this is the case, can you even create a responsive email in the web version or is this simply just not supported?
Image below of the broken HTML Email header (600px) With the mobile header below the web version.
https://imgur.com/a/e5PvMxr