text:
Q: \centering table does not work I do not know where the problem is but I have issues centering tables. I have tried \centering and \begin{center} but they are still left-aligned. Does someone of you know where the problem lies?
  \documentclass[paper=a4, pagesize, fontsize=11pt]{scrartcl}

\usepackage[utf8]{inputenc}  % Eingabekodierung
\usepackage[T1]{fontenc}       % Fontkodierung
\usepackage[ngerman]{babel}    % deutsche Sprachenunterstützung; Doku: "gerdoc"
\usepackage{tabularx, siunitx,booktabs, float}

\setkomafont{captionlabel}{\small\sffamily\bfseries} % kleinere Beschriftungen
\addtokomafont{caption}{\small}
\renewcommand{\arraystretch}{1}

\begin{document}

 \begin{table}[H]
    \centering
    \caption{Ergebnisse des Martin-Loef-Tests}
    \label{tab:mltest}
    \footnotesize
    \begin{tabular*}{0.7\textwidth}{
        @{\extracolsep{\fill}}% fill the space between columns
    l % one left aligned column
    *{3}{c} }
    \toprule
        {Dimension}&{\emph{LR}} & {\emph{df}} & {$p$}\\ \midrule
        UEBE & {331.48} & {255} & {.001}\\
        SOUE & {161.92} & {143} & {\phantom{0}.13}\\
        ERDR & {211.74} & {319} & {\phantom{0}.99}\\
        UNZU & {167.18} & {255} & {\phantom{0}.99}\\
        UEFO & {\phantom{1}95.37} & {143} & {\phantom{0}.99}\\
        MANG &{\phantom{1}99.40}& {63}& {.002} \\
        SOZS &{103.71}&{143}& {\phantom{0}.99}\\
        SOZI &{115.44} &{143}& {\phantom{0}.96}\\
        SORG &{\phantom{1}68.28}& {63}& {\phantom{0}.30} \\
        \bottomrule
    \end{tabular*}
    \scriptsize{
        \begin{tablenotes}
            \item UEBE: Arbeitsüberlastung; SOUE: Soziale Überlastung; ERDR: Erfolgsdruck; UNZU: Arbeitsunzufriedenheit;

            \item UEFO: Überforderung; MANG: Mangel an sozialer Anerkennung; SOZS: Soziale Spannungen; SOZI: Soziale Isolation; SORG: Chronische Besorgnis

    \end{tablenotes}}

 \end{table}

\begin{table}[H]
\centering
    \begin{threeparttable}
        \caption{Schätzung der Itemparameter für UEBE -- MANG}
        \label{tab:itempar}
        \setlength{\tabcolsep}{0pt}
        \footnotesize
        \begin{tabular*}{0.75\textwidth}{
                @{\extracolsep{\fill}}% fill the space between columns
                l % one left aligned column
                *{2}{S[table-format=1.2]S[table-format=-1.2]}S[table-format=0.3,table-space-text-pre=$<{}$]}
            \toprule
            Items & {Lokalisation} &{$\tau_{i1}$}& {$\tau_{i2}$} &{$\tau_{i3}$}& {$\tau_{i4}$}\\
            \midrule

            \textbf{\emph{UEBE}} &&&&&\\ \midrule
            TICS 1   &1.08 &-0.82 & 0.04 & 1.89 & 3.20\\
            TICS 4  &0.96 &-1.81 & 0.14 & 2.13 & 3.37\\
            TICS 17  &0.79 &-1.76 & 0.02 & 1.97 & 2.92\\
            TICS 27  &0.91 &-1.09 & 0.78 & 1.19 & 2.75\\
            TICS 38  &0.80 &-1.94 &-0.11 & 1.87 & 3.40 \\
            TICS 44  &0.55 &-1.58 &-0.48 & 1.28 & 2.96\\
            TICS 50  &0.72 &-1.95 &-0.03 & 1.53 & 3.35\\
            TICS 54  &0.47 &-1.75 &-0.51 & 1.44 & 2.72\\
            \addlinespace
            \textbf{\emph{SOUE}}&&&&&\\ \midrule
            TICS 7  & 0.17 &-1.23 &-0.03 &0.74 & 1.18\\
            TICS 19 & 0.83 &-0.76 &0.83  &0.95 & 2.29 \\
            TICS 28  &0.64  &-1.14 &0.45  &1.38 & 1.85\\
            TICS 39 &-0.05  &-2.03 &-0.55 &0.87 & 1.49\\
            TICS 49 &0.43   &-1.23 &0.18  &1.42 & 1.35 \\
            TICS 57 &0.98   &-0.92 &0.54  &1.77 & 2.52\\
            \addlinespace
            \textbf{\emph{ERDR}}&&&&&\\ \midrule
            TICS 8  & 0.54  &-1.67 &-0.05 &1.63 &2.25\\
            TICS 12 & 0.81  &-1.73 & 0.35 &2.09 &2.54\\
            TICS 14 & 0.75  &-1.21 & 0.25 &1.82 &2.16\\
            TICS 22 & 0.38  &-1.86 & 0.54 &0.61 &2.24\\
            TICS 23 & 0.22  &-1.44 & -0.30&0.57 &2.04\\
            TICS 30 & 0.61  &-1.94 & -0.07&1.58 &2.86\\
            TICS 32 &1.27   &-0.76 & 0.76 &2.07 &2.99\\
            TICS 40 &0.98   &-1.05 & 0.54 &1.54 &2.88\\
            TICS 43 &0.41   &-2.15 & 0.08 &1.46 &2.26\\
            \addlinespace
            \textbf{\emph{UNZU}}&&&&&\\ \midrule
            TICS 5  &0.21 &-1.25 &-0.53 &1.00 &1.61\\
            TICS 10 &0.30 &-1.41 &-0.69 &1.44 &1.85\\
            TICS 13 &-0.13&-3.04 &-0.54 &1.41 &1.63\\
            TICS 21 &0.84 &-0.84 &0.44  &1.89 &1.89\\
            TICS 37 & 1.49&0.24  &1.32  &2.14 &2.26 \\
            TICS 41 &0.79 &-1.24 &0.61  &2.16 &1.64\\
            TICS 48 &0.34 &-1.59 &-0.23 &0.88 &2.30\\
            TICS 53 &0.45 &-1.27 &0.27  &1.80 &0.99\\
            \addlinespace
            \textbf{\emph{UEFO}}&&&&&\\ \midrule
            TICS 3    & 0.91   & -2.24 & 0.73 & 2.69 & 2.45\\
            TICS 20   & 1.31   &-1.41  & 1.42 & 2.47 & 2.74 \\
            TICS 24  &0.87      &-1.32  & 0.38 & 2.31 & 2.10\\
            TICS 35 & 0.58      &-2.63  & 0.20 & 2.64 & 2.11\\
            TICS 47 & 0.09      &-2.49  &-0.17 & 0.85 & 2.20\\
            TICS 55 & 0.63      &-2.12  &0.57  & 1.86 & 2.21\\
            \addlinespace
            \textbf{\emph{MANG}}&&&&&\\ \midrule
            TICS 2   &0.34  & -3.16 &-0.48 & 1.72 & 3.29\\
            TICS 18  &1.37 &-1.64  &0.82  & 2.56 & 3.75\\
            TICS 31  &1.13 &-1.85  &0.53  & 2.59 & 3.27\\
            TICS 46  &0.84 &-2.00  &0.10  & 2.35 & 2.91\\
            \bottomrule
        \end{tabular*}

    \end{threeparttable}
    \scriptsize{
        \begin{tablenotes}
            \item UEBE: Arbeitsüberlastung; SOUE: Soziale Überlastung; ERDR: Erfolgsdruck; UNZU: Arbeitsunzufriedenheit; UEFO: Überforderung; MANG: Mangel an sozialer Anerkennung; SOZS: Soziale Spannungen; SOZI: Soziale Isolation; SORG: Chronische Besorgnis
    \end{tablenotes}}

\end{table}

\end{document}

Thank you very much for your help.

A: You have to give \centering before threeparttable, modified MWE is:
\documentclass[paper=a4, pagesize, fontsize=11pt]{scrartcl}

\usepackage[utf8]{inputenc}  % Eingabekodierung
\usepackage[T1]{fontenc}       % Fontkodierung
\usepackage[ngerman]{babel}    % deutsche Sprachenunterstützung; Doku: "gerdoc"
\usepackage{threeparttable,tabularx, siunitx,booktabs, float}

\setkomafont{captionlabel}{\small\sffamily\bfseries} % kleinere Beschriftungen
\addtokomafont{caption}{\small}
\renewcommand{\arraystretch}{1}

\begin{document}

 \begin{table}[H]
\centering
\begin{threeparttable}
    \caption{Ergebnisse des Martin-Loef-Tests}
    \label{tab:mltest}
    \footnotesize
    \begin{tabular*}{0.7\textwidth}{
        @{\extracolsep{\fill}}% fill the space between columns
    l % one left aligned column
    *{3}{c} }
    \toprule
        {Dimension}&{\emph{LR}} & {\emph{df}} & {$p$}\\ \midrule
        UEBE & {331.48} & {255} & {.001}\\
        SOUE & {161.92} & {143} & {\phantom{0}.13}\\
        ERDR & {211.74} & {319} & {\phantom{0}.99}\\
        UNZU & {167.18} & {255} & {\phantom{0}.99}\\
        UEFO & {\phantom{1}95.37} & {143} & {\phantom{0}.99}\\
        MANG &{\phantom{1}99.40}& {63}& {.002} \\
        SOZS &{103.71}&{143}& {\phantom{0}.99}\\
        SOZI &{115.44} &{143}& {\phantom{0}.96}\\
        SORG &{\phantom{1}68.28}& {63}& {\phantom{0}.30} \\
        \bottomrule
    \end{tabular*}
    \scriptsize{
        \begin{tablenotes}
            \item UEBE: Arbeitsüberlastung; SOUE: Soziale Überlastung; ERDR: Erfolgsdruck; UNZU: Arbeitsunzufriedenheit;

            \item UEFO: Überforderung; MANG: Mangel an sozialer Anerkennung; SOZS: Soziale Spannungen; SOZI: Soziale Isolation; SORG: Chronische Besorgnis
    \end{tablenotes}}
\end{threeparttable}
 \end{table}

\begin{table}[H]
\centering
    \begin{threeparttable}
        \caption{Schätzung der Itemparameter für UEBE -- MANG}
        \label{tab:itempar}
        \setlength{\tabcolsep}{0pt}
        \footnotesize
        \begin{tabular*}{0.75\textwidth}{
                @{\extracolsep{\fill}}% fill the space between columns
                l % one left aligned column
                *{2}{S[table-format=1.2]S[table-format=-1.2]}S[table-format=0.3,table-space-text-pre=$<{}$]}
            \toprule
            Items & {Lokalisation} &{$\tau_{i1}$}& {$\tau_{i2}$} &{$\tau_{i3}$}& {$\tau_{i4}$}\\
            \midrule

            \textbf{\emph{UEBE}} &&&&&\\ \midrule
            TICS 1   &1.08 &-0.82 & 0.04 & 1.89 & 3.20\\
            TICS 4  &0.96 &-1.81 & 0.14 & 2.13 & 3.37\\
            TICS 17  &0.79 &-1.76 & 0.02 & 1.97 & 2.92\\
            TICS 27  &0.91 &-1.09 & 0.78 & 1.19 & 2.75\\
            TICS 38  &0.80 &-1.94 &-0.11 & 1.87 & 3.40 \\
            TICS 44  &0.55 &-1.58 &-0.48 & 1.28 & 2.96\\
            TICS 50  &0.72 &-1.95 &-0.03 & 1.53 & 3.35\\
            TICS 54  &0.47 &-1.75 &-0.51 & 1.44 & 2.72\\
            \addlinespace
            \textbf{\emph{SOUE}}&&&&&\\ \midrule
            TICS 7  & 0.17 &-1.23 &-0.03 &0.74 & 1.18\\
            TICS 19 & 0.83 &-0.76 &0.83  &0.95 & 2.29 \\
            TICS 28  &0.64  &-1.14 &0.45  &1.38 & 1.85\\
            TICS 39 &-0.05  &-2.03 &-0.55 &0.87 & 1.49\\
            TICS 49 &0.43   &-1.23 &0.18  &1.42 & 1.35 \\
            TICS 57 &0.98   &-0.92 &0.54  &1.77 & 2.52\\
            \addlinespace
            \textbf{\emph{ERDR}}&&&&&\\ \midrule
            TICS 8  & 0.54  &-1.67 &-0.05 &1.63 &2.25\\
            TICS 12 & 0.81  &-1.73 & 0.35 &2.09 &2.54\\
            TICS 14 & 0.75  &-1.21 & 0.25 &1.82 &2.16\\
            TICS 22 & 0.38  &-1.86 & 0.54 &0.61 &2.24\\
            TICS 23 & 0.22  &-1.44 & -0.30&0.57 &2.04\\
            TICS 30 & 0.61  &-1.94 & -0.07&1.58 &2.86\\
            TICS 32 &1.27   &-0.76 & 0.76 &2.07 &2.99\\
            TICS 40 &0.98   &-1.05 & 0.54 &1.54 &2.88\\
            TICS 43 &0.41   &-2.15 & 0.08 &1.46 &2.26\\
            \addlinespace
            \textbf{\emph{UNZU}}&&&&&\\ \midrule
            TICS 5  &0.21 &-1.25 &-0.53 &1.00 &1.61\\
            TICS 10 &0.30 &-1.41 &-0.69 &1.44 &1.85\\
            TICS 13 &-0.13&-3.04 &-0.54 &1.41 &1.63\\
            TICS 21 &0.84 &-0.84 &0.44  &1.89 &1.89\\
            TICS 37 & 1.49&0.24  &1.32  &2.14 &2.26 \\
            TICS 41 &0.79 &-1.24 &0.61  &2.16 &1.64\\
            TICS 48 &0.34 &-1.59 &-0.23 &0.88 &2.30\\
            TICS 53 &0.45 &-1.27 &0.27  &1.80 &0.99\\
            \addlinespace
            \textbf{\emph{UEFO}}&&&&&\\ \midrule
            TICS 3    & 0.91   & -2.24 & 0.73 & 2.69 & 2.45\\
            TICS 20   & 1.31   &-1.41  & 1.42 & 2.47 & 2.74 \\
            TICS 24  &0.87      &-1.32  & 0.38 & 2.31 & 2.10\\
            TICS 35 & 0.58      &-2.63  & 0.20 & 2.64 & 2.11\\
            TICS 47 & 0.09      &-2.49  &-0.17 & 0.85 & 2.20\\
            TICS 55 & 0.63      &-2.12  &0.57  & 1.86 & 2.21\\
            \addlinespace
            \textbf{\emph{MANG}}&&&&&\\ \midrule
            TICS 2   &0.34  & -3.16 &-0.48 & 1.72 & 3.29\\
            TICS 18  &1.37 &-1.64  &0.82  & 2.56 & 3.75\\
            TICS 31  &1.13 &-1.85  &0.53  & 2.59 & 3.27\\
            TICS 46  &0.84 &-2.00  &0.10  & 2.35 & 2.91\\
            \bottomrule
        \end{tabular*}
    \scriptsize{
        \begin{tablenotes}
            \item UEBE: Arbeitsüberlastung; SOUE: Soziale Überlastung; ERDR: Erfolgsdruck; UNZU: Arbeitsunzufriedenheit; UEFO: Überforderung; MANG: Mangel an sozialer Anerkennung; SOZS: Soziale Spannungen; SOZI: Soziale Isolation; SORG: Chronische Besorgnis
    \end{tablenotes}}
    \end{threeparttable}
\end{table}

\end{document}

A: your second table is to tall that can be fit on one page. Therefore I suggest to use xtabular where width of columns in your tables with numbers are determined  by column headers containing X column type. In both tables I suggest to use S column that numbers are aligned at decimal points, so you can remove all phantom commands in the first table.
For legend below tables you not need threeparttable table, it can be in minipage environment:
Second table is manually break onto two pages. By this you can (after first compilation) decide, where is the most appropriate place for this.
\documentclass[paper=a4, pagesize, fontsize=11pt]{scrartcl}

\usepackage[T1]{fontenc}       % Fontkodierung
\usepackage[ngerman]{babel}    % deutsche Sprachenunterstützung; Doku: "gerdoc"
\usepackage{booktabs, xltabular}
\newcommand\mcx[1]{\multicolumn{1}{>{\centering\arraybackslash}X}{#1}}
\usepackage{siunitx}

\setkomafont{captionlabel}{\small\sffamily\bfseries} % kleinere Beschriftungen
\addtokomafont{caption}{\small}

\begin{document}
\begin{table}[ht]
    \centering
    \caption{Ergebnisse des Martin-Loef-Tests}
    \label{tab:mltest}
    \begin{tabularx}{0.7\textwidth}{
        l % one left aligned column
        S[table-format=3.2]
        S[table-format=3.0]
        S[table-format=1.4]
                    }
        \toprule
    Dimension& \mcx{\emph{LR}}
                        & \mcx{\emph{df}}
                                & \mcx{$p$}\\
    \midrule
        UEBE & 331.48   & 255   & .001  \\
        SOUE & 161.92   & 143   & .13   \\
        ERDR & 211.74   & 319   & .99   \\
        UNZU & 167.18   & 255   & .99   \\
        UEFO &  95.37   & 143   & .99   \\
        MANG &  99.40   &  63   & .002  \\
        SOZS & 103.71   & 143   & .99   \\
        SOZI & 115.44   & 143   & .96   \\
        SORG &  68.28   & 63    & .30   \\
        \bottomrule
    \end{tabularx}

    \begin{minipage}{0.7\linewidth}\scriptsize
    \textbf{Legende:}\\
UEBE: Arbeitsüberlastung; SOUE: Soziale Überlastung; ERDR: Erfolgsdruck; UNZU: Arbeitsunzufriedenheit; UEFO: Überforderung; MANG: Mangel an sozialer Anerkennung; SOZS: Soziale Spannungen; SOZI: Soziale Isolation; SORG: Chronische Besorgnis
    \end{minipage}
\end{table}

\newpage
\begingroup
    \begin{xltabular}{0.75\textwidth}{l
                               *{3}{S[table-format=-1.2]}
                               *{2}{S[table-format= 1.2]}
                                    }
    \caption{Schätzung der Itemparameter für UEBE -- MANG}
    \label{tab:itempar} \\
        \toprule
    Items    & \mcx{Lokal.}
                    & \mcx {$\tau_{i1}$}
                            & \mcx{$\tau_{i2}$}
                                  & \mcx{$\tau_{i3}$}
                                         & \mcx{$\tau_{i4}$}\\
    \midrule
\endfirsthead
    \caption[]{MSchätzung der Itemparameter für UEBE -- MANG (cont.)} \\
    \toprule
    Items    & \mcx{Lokal.}
                    & \mcx {$\tau_{i1}$}
                            & \mcx{$\tau_{i2}$}
                                  & \mcx{$\tau_{i3}$}
                                         & \mcx{$\tau_{i4}$}\\
    \midrule
\endhead
    \midrule
\multicolumn{6}{>{\footnotesize\itshape}r}{continue on the next page}\\
\endfoot
    \bottomrule
\endlastfoot
% table body
    \textbf{\emph{UEBE}} &&&&&\\
        \midrule
    TICS 1   & 1.08 &-0.82 & 0.04 & 1.89 & 3.20\\
    TICS 4   & 0.96 &-1.81 & 0.14 & 2.13 & 3.37\\
    TICS 17  & 0.79 &-1.76 & 0.02 & 1.97 & 2.92\\
    TICS 27  & 0.91 &-1.09 & 0.78 & 1.19 & 2.75\\
    TICS 38  & 0.80 &-1.94 &-0.11 & 1.87 & 3.40\\
    TICS 44  & 0.55 &-1.58 &-0.48 & 1.28 & 2.96\\
    TICS 50  & 0.72 &-1.95 &-0.03 & 1.53 & 3.35\\
    TICS 54  & 0.47 &-1.75 &-0.51 & 1.44 & 2.72\\
        \addlinespace
    \textbf{\emph{SOUE}}&&&&&                  \\
        \midrule
    TICS 7   & 0.17 &-1.23 &-0.03 & 0.74 & 1.18\\
    TICS 19  & 0.83 &-0.76 & 0.83 & 0.95 & 2.29\\
    TICS 28  & 0.64 &-1.14 & 0.45 & 1.38 & 1.85\\
    TICS 39  &-0.05 &-2.03 &-0.55 & 0.87 & 1.49\\
    TICS 49  & 0.43 &-1.23 & 0.18 & 1.42 & 1.35\\
    TICS 57  & 0.98 &-0.92 & 0.54 & 1.77 & 2.52\\
        \addlinespace
    \textbf{\emph{ERDR}}&&&&&                   \\
        \midrule
    TICS 8   & 0.54 &-1.67 &-0.05 & 1.63 & 2.25\\
    TICS 12  & 0.81 &-1.73 & 0.35 & 2.09 & 2.54\\
    TICS 14  & 0.75 &-1.21 & 0.25 & 1.82 & 2.16\\
    TICS 22  & 0.38 &-1.86 & 0.54 & 0.61 & 2.24\\
    TICS 23  & 0.22 &-1.44 &-0.30 & 0.57 & 2.04\\
    TICS 30  & 0.61 &-1.94 &-0.07 & 1.58 & 2.86\\
    TICS 32  & 1.27 &-0.76 & 0.76 & 2.07 & 2.99\\
    TICS 40  & 0.98 &-1.05 & 0.54 & 1.54 & 2.88\\
    TICS 43  & 0.41 &-2.15 & 0.08 & 1.46 & 2.26\\
        \addlinespace
    \textbf{\emph{UNZU}}&&&&&                  \\
        \midrule
    TICS 5  & 0.21  &-1.25 &-0.53 & 1.00 & 1.61\\
    TICS 10 & 0.30  &-1.41 &-0.69 & 1.44 & 1.85\\
    TICS 13 &-0.13  &-3.04 &-0.54 & 1.41 & 1.63\\
    TICS 21 & 0.84  &-0.84 & 0.44 & 1.89 & 1.89\\
    TICS 37 & 1.49  & 0.24 & 1.32 & 2.14 & 2.26\\
    TICS 41 & 0.79  &-1.24 & 0.61 & 2.16 & 1.64\\
    TICS 48 & 0.34  &-1.59 &-0.23 & 0.88 & 2.30\\
    TICS 53 & 0.45  &-1.27 & 0.27 & 1.80 & 0.99\\
        \pagebreak
    \textbf{\emph{UEFO}}&&&&&                   \\
        \midrule
    TICS 3  & 0.91  & -2.24 & 0.73 & 2.69 & 2.45\\
    TICS 20 & 1.31  &-1.41  & 1.42 & 2.47 & 2.74\\
    TICS 24 & 0.87  &-1.32  & 0.38 & 2.31 & 2.10\\
    TICS 35 & 0.58  &-2.63  & 0.20 & 2.64 & 2.11\\
    TICS 47 & 0.09  &-2.49  &-0.17 & 0.85 & 2.20\\
    TICS 55 & 0.63  &-2.12  & 0.57 & 1.86 & 2.21\\
        \addlinespace
    \textbf{\emph{MANG}}&&&&&                   \\
        \midrule
    TICS 2  & 0.34  & -3.16 &-0.48 & 1.72 & 3.29\\
    TICS 18 & 1.37  &-1.64  & 0.82 & 2.56 & 3.75\\
    TICS 31 & 1.13  &-1.85  & 0.53 & 2.59 & 3.27\\
    TICS 46 & 0.84  &-2.00  & 0.10 & 2.35 & 2.91\\
    \end{xltabular}\vspace{-2ex}

\noindent\hfil\begin{minipage}{0.75\linewidth}\scriptsize
    \textbf{Legende:}\\
Lokal.: Lokalisation; UEBE: Arbeitsüberlastung; SOUE: Soziale Überlastung; ERDR: Erfolgsdruck; UNZU: Arbeitsunzufriedenheit; UEFO: Überforderung; MANG: Mangel an sozialer Anerkennung; SOZS: Soziale Spannungen; SOZI: Soziale Isolation; SORG: Chronische Besorgnis
    \end{minipage}
\endgroup
\end{document}


text:
Q: How to ping IP Address in Angular 7 I want to ping IP Address to get response either it is alive or not by getting some sort of response or hack.
ping() {
    return this.http.get('http://192.168.2.101')
}

this.deviceService.ping().subscribe(result => {
    console.log(result)
})

but I am getting this error.

A: Here is an example if anyone has to do it from the client, one use case could be if you must know wether the client is online or not, for example in a Ionic app.
Please see full working example in this StackBlitz (You can check the console also to see each ping attempt).
import { HttpClient } from "@angular/common/http";
import { first } from "rxjs/operators";
import { Subscription } from 'rxjs';
...

private source = interval(3000);
...

this.source.subscribe(() => {
  this._http.get('https://www.google.com', { observe: 'response' })
  .pipe(first())
  .subscribe(resp => {
    if (resp.status === 200 ) {
      console.log(true)
    } else {
      console.log(false)
    }
  }, err => console.log(err));
});

first() is important to take only first value, since interval will make new request this is how we avoid memory leaks.
{ observe: 'response' } is how we tell httpClient to return the full http object instead of the body alone, this way we can acces status code.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Textbox css with info I want to create a textbox for the username But once he starts typing i need a small image with the requirements of username to be displayed dynamically ..
can anyone help me ??

A: You can use the :focus psuedo class on the textbox to add styling when the box has focus.
You cannot do what you are asking without javascript though.

A: Lets say A1 is your text box and X1 is your image:
<script>
    function txtChange(){
        a1=document.getElementById(a1);
        x1=document.getElementById(x1);
        if(a1.value.length>0) {
           x1.style['display'] = true;
        }
    }
</script>

protected void Page_Load(object sender, EventArgs e)
{
    a1.Attributes["onchange"] = "txtChange()";
}

Oh and I guess it's worth mentioning if you want it just when they focus (click on it) not when they add text you can change "onchange" to "onfocus"

A: Depending on the location of the image, can you do something like this:
html
<input class="my_textbox"><img src=""/>

and then, using ":focus" and css sibling selector:
css
input.my_textbox + img {
  display:none;
}
input.my_textbox:focus + img {
  display:block;
}


text:
Q: Classification of bilinear forms: operator $A^{-1} A^T$ for bilinear form $A$ I would like to understand a classification of non-degenerate (not necessary symmetric or skew-symmetric) bilinear forms over an algebraically closed field via an operator $\kappa=A^{-1} A^T$ for a bilinear form $A$, or invariantly, $A(x,y)=A(y,\kappa x)$.
I have heard on a seminar that there is only one series $U_i$ of unipotent bilinear forms, and some other series we are not interested in, and that it directly follows from Jordan normal form for the operator $\kappa$. Could you help me with proof or references?
For $BAB^T$, the second is $B^{-T}A^{-1}A^TB^T=B^{-T}\kappa B^T$, so it is indeed an operator. The operator $\kappa=E$ iff $A$ is symmetric, and $\kappa=-E$ iff $A$ is skew-symmetric. For a direct sum $A \oplus B$, $\kappa(A \oplus B)=\kappa(A) \oplus \kappa(B)$, so we need indecomposable matrices. In dimension $2$, $A$ can be written as $$\begin{bmatrix}1 & k \\ 0 & 1\end{bmatrix} \text{, then } \kappa=\begin{bmatrix}1 - k^2 & -k \\ k & 1\end{bmatrix},$$ so its characteristic polynomial $x^2+(k^2-2)x-1$ has two different roots. Alas, I am stuck.


text:
Q: create dynamic Confirm dialog in jsf I need create dynamic confirmDialog. I have a dynamicallly created CommandButton. So when it press, confirmDialog will show. I do not know how to show it on CommandButton pressed.

A: Your button should be like this:
<p:commandLink oncomplete="confirmation.show()"
  action="#{campagneComtroller.messageDeleteCam1(c)}"
  update=":frmDlgDel:confirmDialog">
  <p:graphicImage value="/image/delete.png" height="20" width="20"/>
</p:commandLink>

Your confirmDialog should be like this:
<h:form id="frmDlgDel">
            <p:confirmDialog id="confirmDialog"
                    message="#{campagneComtroller.messageDeleteCam1}"
                       header="#{bundles.messages['message.SupprimerGeneral']}" severity="alert" widgetVar="confirmation">
               <p:commandButton id="confirm" value="#{bundles.messages['message.OuiSure']}" oncomplete="confirmation.hide()" update=":formCam :frmDlgDel"
                        actionListener="#{campagneComtroller.deleteCam1()}" />
               <p:commandButton id="decline" value="NonPasEncore" onclick="confirmation.hide()" type="button" />
           </p:confirmDialog>
        </h:form>

Your java code should be like this:
   public void messageDeleteCam1(Cam cam) {
conditionVerified = true; // ... you can put here your treatments
            if (conditionVerified) {
                messageDeleteCam1 = "this cam is bla bla bla ";
            } else {
                messageDeleteCam1 = "are you sure to delete this cam ?";
            }
        }

NB: we have used here oncomplete + update, that's why we could see the difference in the confirmDialog after java treatments.


text:
Q: Interview Question on Algorithms regarding Matrices
You are provided with an N*M matrix containing Integer values. Your task is to select one integer from each row such that the sum of these integers is maximum. However, you are not allowed to select two integers from adjacent rows in the same column.

How can I do this problem in less than O(N^M) (or O(M^N))?

A: I came up with two possible solutions: 1. using recursion, 2. using DP.
1. Using Recursion
I think you already have this solution. I made a recursive function that goes through each row in matrix and calls recursion for each column. As you mentioned, the time complexity would be O(M^N) where N is the number of rows and M is the number of columns.
int getMaxSum(int[][] matrix) {
    return getMax(matrix, 0, -1);
}

int getMax(int[][] matrix, int row, int prevCol) {
    if (row >= matrix.length) return 0;

    int result = Integer.MIN_VALUE;
    for (int i = 0; i < matrix[row].length; i++) {
        if (i == prevCol) continue;

        int sum = getMax(matrix, row+1, i) + matrix[row][i];
        result = Math.max(result, sum);
    }

    return result;
}

2. Using DP
Instead of recursively going through all rows and columns, I can use DP to keep track of maximum sum for each column up to a certain row. For example, DP[r][c] can have a maximum possible sum at column c up to row r. To implement this, I need to go through all rows and columns in the input matrix, and at each index, I also need to go through maximum possible sums at previous row (excluding the same column). This would result in time complexity of O(N*M^2) where N is the number of rows and M is the number of columns.
int getMaxSum(int[][] matrix) {
    if (matrix.length == 0) return 0;

    int[][] maxSumsDP = new int[matrix.length+1][matrix[0].length];
    for (int r = 1; r <= matrix.length; r++) {
        for (int c = 0; c < matrix[r-1].length; c++) {
            int maxPrev = Integer.MIN_VALUE;
            for (int i = 0; i < maxSumDP[r-1].length; i++) {
                if (i == c) continue;

                maxPrev = Math.max(maxPrev, maxSumsDP[r-1][i]);
            }
            maxSumsDP[r][c] = maxPrev + matrix[r-1][c];
        }
    }

    int result = maxSumsDP[maxSumsDP.length-1][0];
    for (int i = 1; i < maxSumsDP[maxSumsDP.length-1].length; i++) {
        result = Math.max(result, maxSumsDP[maxSumsDP.length-1][i]);
    }
    return result;
}


text:
Q: Mailing list sign up box I'd like to add a sign-up box with name and email fields to my site. I'll want to add a title so people know it's for my mailing list, and a note to say that i only send mails out occasionally.
What would be an easy and solid way to add this?
With a plugin?
If a plugin is the way to go, waht would be a good plugin for this?
I'd like the sign-up-box to appear in the right-hand column on every page -- the non-blog pages as well as the blog pages.
It's for this site: http://richardclunan.com/
(I'll need to alter the margins on the non-blog pages.)

A: I'm a big fan of MailChimp for managing and sending email lists. As long as you stay under 2k subscribers and 12k emails / month, their service is free.
They have a tool that allows you to create and customize an HTML form you can embed in a widget that automatically adds people to your mail list.
http://kb.mailchimp.com/article/how-can-i-add-my-signup-form-on-my-website

A: If you're serious about this, and willing to pony up a little bit of dough, I strongly recommend Gravity Forms. It's powerful and very adaptable. You can have it tie into a Mailchimp or Constant Contact account with first or third party plugins (respectively). I got a developer license for Gravity forms a year ago and haven't regretted it once. If you're using it for just yourself, I imagine they sell that license too.
Otherwise you could use Contact Form 7, then you'll have to keep a list yourself. Either one should have a widget where you can just plug it in. If you don't want widgets to show up on your front/home page, make those pages have a one-column (no sidebar) template. Good luck.

A: You can use FeedBurner if you just want to send out mails everytime you create a new post. Just turn on their Publicize option after setting up your RSS feed and you'll be fine. They will provide you with a code that you can copy and paste in a text widget that you can place in your sidebar which will let people subscribe to your blog.


text:
Q: How do I add a new keyserver to upload my PGP keys I want to add a new destination server to appear as an option to publish my PGP key to in Seahorse. How do I do this in Ubuntu?
View of Seahorse possible keyservers:

I successfully did so under Arch Linux by adding the keyserver to
~/.gnupg/gpg.conf

which doesn't exist in Ubuntu. Should I create the file or can I do it directly from Seahorse?
Any help is appreciated as I can't find any solutions for Ubuntu on the Web. Thanks!

A: You can set up key servers in ~/.gnupg/gpg.conf, but those settings are not considered by Seahorse as it forces GnuPG to use the key server configured in seahorse instead. With other words, if you set up key servers in gpg.conf, they will be used when you manually run gpg on the command line or within other applications interfacing GnuPG, but not Seahorse.
Instead, press the "Add" button to add a new key server in seahorse (in the configuration panel you posted as screenshot) and afterwards select it in "Publish keys to:".
Most of the OpenPGP key servers are organized in the SKS synchronizing key server network. Uploading to any of those is sufficient, the changes are then propagated to the other servers automatically (which will usually take some minutes).


text:
Q: How to set url or email or special character to cookie in Asp.net core 3.0? I want to set cookie using asp.net core. i use this code to add cookie
CookieOptions options = new CookieOptions();
options.Expires = DateTime.Now.AddDays(5);
Response.Cookies.Append("email", "hello@gmail.com", options);

But in cookie email is not store as it is . its like hello%gmail.com . I can store the url and email into cookie.
Any help. Thank you

A: As far as I know, if you store the cookie in the response, it will use url encrypt the cookie by default.
When you checked the client cookie, it will store as below:

This will not affect reading cookie in your asp.net core backend codes.
The source codes will decrypt the cookie value by default to let you see the result.
More details, you could refer to below example:
        var re = Request.Cookies["email"];

Result:

I try to read the cookie using Javascript and it seems it not show as it should

If you want to read the cookie from js, you should use decodeURIComponent
method to decode it.
More details, you could refer to below codes:
    $(document).ready(function () {

        var read_cookies = document.cookie;
        var split_read_cookie = read_cookies.split(";");
        for (i = 0; i < split_read_cookie.length; i++) {
            var value = split_read_cookie[i];
            value = value.split("=");
            if (value[0] == " email" ) {
                alert(value[1]);
                alert(decodeURIComponent(value[1]));
            }
        }
                  });

Result:


text:
Q: Laravel routes does not work when I write this Route::get('/', 'Login@index');
and use url
"http://localhost/laravel-4.2.11/blog/" it works,
but when I use this Route::get('home', 'Login@index');
and url "http://localhost/laravel-4.2.11/blog/home" it gives 404 error

A: Try changing your route with a preceding /, like so:
Route::get('/home', 'Login@index');
While this isn't how it's documented, this works for me on a number of projects.

A: If you want to use both / and /home for homepage,
Route::get('/{home?}', 'Login@index');

Or you can write it into two,
Route::get('/', 'Login@index');
Route::get('home', 'Login@index');

A: Frist
You should check what do you have in the error log file, usually in

storage/logs/laravel.log

https://laravel.com/docs/5.4/errors
This should give you the information about why this URL can not find it.
Second
Please check the configuration on your web server:
https://laravel.com/docs/5.4/installation#web-server-configuration
Apache
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Nginx
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Third
Please report the result of this test...


text:
Q: Is it possible to disable a USB port through the Android SDK or NDK? Is there a way of disabling a USB port on an Android enabled device using the Android SDK or NDK?

A: This applies to a USB accessories port (i.e. not for ADB)...
If you have a rooted device, you can try this as it worked for me...find the file indicating devices authorized for your port and clear it as follows
(Note the path will be specific to your system so it may take a bit of searching - I have a platform based on Freescale HW & BSP)  You can try this from a shell session but ultimately it can be done from a script or shell commands executed from within an application
$su
#cd /sys/devices/platform/fsl-ehci.0/usb1/
#echo 0 > authorized

If you need to re-enable, just do
#cd /sys/devices/platform/fsl-ehci.0/usb1/
#echo 1 > authorized

Settings changed in this way worked for me to enable & disable both a USB keyboard and a mass storage device (thumb drive).  NOTE: What you set this way may not persist through a reboot or power cycle (it did not in my case) so plan accordingly.


text:
Q: Android Studio:How I can manage different exercises in each chapter? I am working on a book app, main menu contains 10 chapters, now each chapter contains different number of exercises, 4, 7, 10 like this.
1) What I want is when user taps on a chapter it loads its exercises, like exercise 1, exercise 2 etc. and when user taps on an exercise it shows a scanned copy of exercise.
how can I do that?
By creating different xml for each chapter?
2) how can I use same imageview to display the selected exercise or  I would have to create imageview for each exercise?

A: I would suggest you to go with HTML files or web contents on this(To make the app more dynamic),How ever if you only want the java approach you can Make use of fragments

*

*Create an Activity for all the fragments to be used as a base

*Add a list fragment to load the list of chapters from the local database or server or storage etc.

*On clicking the chapter,Create another fragment with the list of exercises by passing the ID of the user pressed Chapter from Db or Server

*Create a third fragment for showing the Scanned copy of exercise,when tapped on the list for exercises create it by passing the exercise id and show it on the activity


text:
Q: sharepoint online not showing in office 365 E3 trial plan I have created Office 365 Trial Account but after account creation, it shows only admin center in app launcher and not showing SharePoint online and other option.

A: It will take sometime to create the set up for the SharePoint Admin Center.

Try to register  for the Below Program, so that we can get one year subscription.
Join the Microsoft Office 365 Developer Program
Get virtual and in-person learning opportunities, benefits to help you become more innovative and successful, and access to connect with other developers.

*

*One-year, FREE Office 365 developer subscription

*Access to online training's

*In-person office hours with Microsoft engineers

*Chances to win tickets to Microsoft conferences and industry events

*Opportunities to participate in virtual hackathons to build modern
productivity solutions with Office

*Opportunities to meet with other developers in your area

*Previews of and insights into Office Extensibility announcements


text:
Q: Statically add content to database in Rails I'm new to Ruby on Rails and have a question about it's database.
I have a basic site in which I want to save and disply some basic details of a list of people. I created a model named Person and a controller named PersonController which has two basic methods :
def list
    @person = Person.find(:all)
end

def show
    @person = Person.find(params[:id])
end

I also have a migrate file, declaring the field in each column in the table (for example - :name, :string :address, :string.)
My quetion is, how can I add my myself new people to the database, without and UI-form in the site? Currently there are none people in the list, and I, as a programmer, want to add them. How can it be done?
Thanks

A: use the rails console
with this commands:
at CMD:
Rails c

Person.create!(:name => "yourname", :email=> "youremail")

Now if you want to instance that method in the console you can do this:
@person = Person.last
@person.name
@person.email

or something like this:
@person = Person.find_by_email("youremail")
@person.name
@person.email


text:
Q: I'm having an error running 'pod install' after having 'ejected' an expo project Installing unimodules:
 expo-app-auth@10.2.2 from ../node_modules/expo-app-auth/ios
 expo-application@3.2.0 from ../node_modules/expo-application/ios
 expo-barcode-scanner@10.2.2 from ../node_modules/expo-barcode-scanner/ios
 expo-constants@11.0.2 from ../node_modules/react-native-unimodules/node_modules/expo-constants/ios
 expo-error-recovery@2.2.0 from ../node_modules/expo-error-recovery/ios
 expo-facebook@11.3.1 from ../node_modules/expo-facebook/ios
 expo-file-system@11.1.3 from ../node_modules/expo-file-system/ios
 expo-font@9.2.1 from ../node_modules/expo-font/ios
 expo-image-loader@2.2.0 from ../node_modules/expo-image-loader/ios
 expo-image-picker@10.2.2 from ../node_modules/expo-image-picker/ios
 expo-keep-awake@9.2.0 from ../node_modules/expo-keep-awake/ios
 expo-location@12.1.2 from ../node_modules/expo-location/ios
 expo-modules-core@0.2.0 from ../node_modules/expo-modules-core/ios
 expo-permissions@12.1.1 from ../node_modules/expo-permissions/ios
 expo-splash-screen@0.11.4 from ../node_modules/expo-splash-screen/ios
 expo-structured-headers@1.1.1 from ../node_modules/expo-structured-headers/ios
 expo-updates@0.8.5 from ../node_modules/expo-updates/ios
 expo-updates-interface@0.2.2 from ../node_modules/expo-updates-interface/ios
 unimodules-app-loader@2.2.0 from ../node_modules/unimodules-app-loader/ios
 unimodules-core@7.1.2 from ../node_modules/react-native-unimodules/node_modules/@unimodules/core/ios
 unimodules-react-native-adapter@6.3.9 from ../node_modules/react-native-unimodules/node_modules/@unimodules/react-native-adapter/ios
 unimodules-task-manager-interface@6.2.0 from ../node_modules/unimodules-task-manager-interface/ios

Found some duplicated unimodule packages. Installed the ones with the highest version number.
Make sure following dependencies of your project are resolving to one specific version:
 expo-constants, unimodules-react-native-adapter, unimodules-core

Auto-linking React Native modules for target `appalm`: RNCAsyncStorage, RNCMaskedView, RNFS, RNGestureHandler, RNReanimated, RNSVG, RNScreens, react-native-fetch-blob, react-native-maps, react-native-safe-area-context, react-native-webview, and stripe-react-native
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

### Command

/usr/local/bin/pod install

### Report

* What did you do?

* What did you expect to happen?

* What happened instead?

### Stack

CocoaPods : 1.11.2
Ruby : ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
RubyGems : 3.0.3.1
Host : macOS 12.0.1 (21A559)
Xcode : 13.1 (13A1030d)
Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

### Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

### Podfile

```ruby
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'appalm' do
  use_unimodules!
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # Uncomment to opt-in to using Flipper
  #
  # if !ENV['CI']
  #   use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
  #   post_install do |installer|
  #     flipper_post_install(installer)
  #   end
  # end
end

Error
LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/ffi_c.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:5:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:2:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon.rb:3:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/cdn_source.rb:284:in `ensure_versions_file_loaded'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/cdn_source.rb:208:in `search'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:165:in `search_for'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:267:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:267:in `sort_by'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:267:in `sort_by!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in `activate_new_spec'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:416:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:161:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=dlopen%28%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.4%2Flib%2Fffi_c.bundle%2C+0x0009%29%3A+tried%3A+%27%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.4%2Flib%2Fffi_c.bundle%27+%28mach-o+file%2C+but+is+an+incompatible+architecture+%28have+%27x86_64%27%2C+need+%27arm64e%27%29%29%2C+%27%2Fusr%2Flib%2Fffi_c.bundle%27+%28no+such+file%29+-+%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.4%2Flib%2Fffi_c.bundle&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
Searching for inspections failed: undefined method `map' for nil:NilClass
[!] <PBXResourcesBuildPhase UUID=13B07F8E1A680F5B00A75B9A> attempted to initialize an object with an unknown UUID. ED137CF7B90C44E29996C133 for attribute: files. This can be the result of a merge and the unknown UUID is being discarded.```
someone could help me?

A: I have the same problem when running pod install on Mac M1.
It looks like you are using the default ruby that comes with Mac OS and installing some library with Rosetta mode (x86_64). At this time, we can use native M1 for installing libraries.
In my case, following these steps have me solve this problem:

*

*Uninstall current ruby: brew uninstall --ignore-dependencies ruby

*Show installed cocoapods: gem list --local | grep cocoapods . It will show a list of cocoapods installed in your computer.

*Uninstall each cocoapods showed step above: sudo gem uninstall cocoapods, sudo gem uninstall cocoapods-core, ...

*Install ruby with brew: brew install ruby

*Recheck ruby is using: gem env. In my case, all lines have ruby version 3 from brew

*Install ffi without arch x86_64 or Rosetta: sudo gem install ffi

*Install cocoapods: sudo gem install cocoapods
Make sure you exported PATH in your environment. I'm using zsh:

*

*open file config: open ~/.zshrc

*add these lines:

if [ -d "/opt/homebrew/opt/ruby/bin" ]; then
  export PATH=/opt/homebrew/opt/ruby/bin:$PATH
  export PATH=`gem environment gemdir`/bin:$PATH
fi

*

*save the file and make it effective: source ~/.zshrc
Hope it will help someone face this problem


text:
Q: C# - Prevent animation of a showing form Is there any way of stopping the default opening animation of a form from Windows? I mean stopping it just for one form, not all of them. I need the showing of a form to be instantly, without that growing effect.
I tried to document about WinApi, but I couldn't find anything. Thank you!

A: You have to take a couple of steps to achieve this:
In the constructor, set your BorderStyle to None. This will prevent the animation:
public Form1()
{
   InitializeComponent();
   this.FormBorderStyle = FormBorderStyle.None;
}

Of course, now you want to show the border again, so you have to set it back as soon as your form is shown, so the user never sees this. Therefore create a method:
private void Form_Loaded(object sender, EventArgs e)
{
   this.FormBorderStyle = FormBorderStyle.Sizable;
}

Now you have to set the Shown event of your form to your Form_Loaded method. You can do this from the form designer event properties window.
If you want to do it for the entire application you can change it using the SystemParametersInfo Method.

A: I had to set the location property after showing the form. It works!
this.Hide();
this.Size = this.Size;
this.Location = this.Location;
this.Show();


text:
Q: How do I prove that $\ker(T)$ is the subspace of $V?$ How do I tackle this question? I am really struggling to understand how matrices work and don't completely understand what a skew-symmetrical vs. symmetrical matrix means.

Let $ V = \operatorname M_{ n \times n } ( \mathbb R ) $ and let $ T : V \to V $ be the mapping defined by $ T ( A ) = \frac {A + A^{ \mathrm t} } 2 $ for $ A \in V $. ($ A^{\mathrm t} $ is the transpose of $ A $.)
Prove that $ \ker( T ) $ is the subspace of all skew-symmetric matrices in $ V $ and $ \operatorname{Im} ( T ) $ is the subspace of all symmetric matrices in $ V $.

A: *

*For $A \in V$ we have:

$$T(A)=0 \iff A+A^t=0 \iff A^t=-A.$$

*If $A \in V$ is symmetric, then $T(A)=A$, hence $A \in Im(T).$

*Let $B \in Im(T)$. Then there is $A \in V$ such that $B=\frac{1}{2}(A+A^t).$ Is $B$ symmetric ?


text:
Q: zsh: no matches found: push[dev1] I am running a script like ./ci.sh push[dev1] and I get the response like zsh: no matches found: push[dev1]. I have tried to place alias into .zshrc but not jolly joy.
My .zshrc file:
alias push='noglob push'
alias git='noglob git'
alias jake='noglob jake'
alias task='noglob task'
alias branch='noglob branch'
alias gp='git push'`

Also the the task from the jakefile.js:
desc('Push commits to integration machine for validation.');
   task('push', ['status'], (branch) => {
     if (!branch) {
    console.log(
      'This command will push your code to the integration machine. Pass your\n' +
      'branch name as a parameter (e.g., \'push[workstation_name]\').\n'
    );
    fail('No branch provided');
  }
  run([
    'git push origin ' + branch
  ], () => {
    console.log('\nOK. Current branch has been copied to integration machine.');
    complete();
  });
}, { async: true });

and the file ci.sh contains:
#!/bin/sh
. build/scripts/run_jake.sh -f build/scripts/ci.jakefile.js $*

Thanks for your help.

A: Simply just escape the brackets
./ci.sh push\[dev1\]


text:
Q: Having a number go through 3 numbers in an array I am currently trying to do an assignment for my programming class and the assignment requires I create a range between 1-10 and input a number in that range. After the input is given the number will be multiplied by the first number in an array of 3 numbers (19, 85, 2). so say I put in the number 2. It would than be multiplied by 19. After the first calculation it will subtract the second element in the array from the total of the first calculation, and after that it will divide the second calculation by the third element in the array. I do not know how to have a number go through separate elements of the same array. Right now I can get the number I input to multiply but it multiplies with all 3 numbers in the array instead of the first.
def multiply( array , n ):
    unumb = 0
    while 1 > unumb or 10 < unumb:
     try:
         unumb = int(input("Please enter a number (1 - 10) : "))
     except ValueError:
        print ("That wasn't an integer in range")
    for i in range(n):
        unumb = unumb * array[i]
    return unumb

array = [19, 85, 2]
n = len(array)

print(multiply(array, n))

Output:
Please enter a number (1 - 10) : 2
6460

A: Since you're doing a different thing with each element of the array, it doesn't really make sense to iterate over it -- just access the elements with [0], [1], and [2]:
while True:
    try:
        x = int(input("Please enter a number from 1 to 10: "))
        if x not in range(1, 11):
            raise ValueError("That wasn't an integer in range")
        break
    except ValueError as e:
        print(e)

a = [19, 85, 2]
print(f"Result: {(x * a[0] - a[1]) / a[2]}")

A: As you have to do three different calculations you don't need to iterate, also I noticed that you used a function structure, so I wrote something similar to your code.
def multiply(array):

    #Getting the input.
    unumb = int(input("Please insert a number between 1 and 10: "))

    if 1 <= unumb <= 10:

        unumb*=array[0]
        unumb-=array[1]
        #unumb/=array[2] #If you want a float result.
        unumb = int(unumb/array[2]) #If you want a int result.

        return unumb

    else: print("Not a number between 1 and 10.")

array = [19,85,2]
print(multiply(array))


text:
Q: WebApi POST method with string parameter is always null I have a POST method in my WebApi that takes json string as parameter.
[HttpPost]
public HttpResponseMessage GetOrderDataBySessionId([FromBody] string json)

I tried hitting it using RestClient with URL: localhost:56934/api/Home/GetOrderDataBySessionId
and specifying following json string in the Body:
{
  "ListSessionId": [
    "180416073256DGQR10",
    "180416091511DGQR10"
  ]
}

setting the body/content type as application/json. But when it hits my method, the json string parameter is always null.
Is it because I need to use a complex type in parameter?
Can we never have input in string?

A: By sending this content:
{
  "ListSessionId": [
    "180416073256DGQR10",
    "180416091511DGQR10"
  ]
}

You're sending a JSON represented with a proprerty ListSessionId typed as an array of string so your Web API action should be:
public HttpResponseMessage GetOrderDataBySessionId([FromBody] List<string> listSessionId)

Just change the string json to List<string> listSessionId.

A: I have resolved this problem.
Code in client:
$.ajax({
            url: "/api",
            type: "post",
            data: "p1=1&p2=2"
        });

code in server:
[HttpPost]
public string Post([FromForm] string p1, [FromForm] string p2)
{
    return p1+p2;
}

There are three key points:

*

*The parameter name must be the same both in client and server.

*In the client, there must be [FromForm] instead of [FromBody] in front
of the parameter.

*You can add multiple parameters even, but the parameter names must correspond.


text:
Q: How to convert DFM into dataframe BUT keeping docvars? I am using the quanteda package and the very good tutorials that have been written about it to make various operations on paper articles.
I obtained the frequency of specific words over time by selecting them in a mainwordsDFM and using
textstat_frequency(mainwordsDFM, group = "Date") , then converted the result into a dataframe, and plotted with ggplot.
However, I now try to plot the frequency of a word over time and by paper.
The solution I used on my previous operation does not work in this case, because it is only possible to include one variable to group the result of the frequency analysis.
I was therefore wondering if it is possible to convert the mainwordsDFM to a dataframe, but when I do so with convert(mainwordsDFM, to = "data.frame") , the docVars, which are included in the dfm, disappear, leaving only the occurrences of the selected word.
Is there a way to convert this dfm into a dataframe without losing the docVars ?
As you may have understood, I am interested in converting the dfm because it allows me to keep specific words, when my original dataframe (from where I made the corpus, then token, then dfm) had entire texts.
I doubt of its utility but here is the dput of the head of my dfm :
new("dfm", settings = list(), weightTf = list(scheme = "count",
    base = NULL, K = NULL), weightDf = list(scheme = "unary",
    base = NULL, c = NULL, smoothing = NULL, threshold = NULL),
    smooth = 0, ngrams = 1L, skip = 0L, concatenator = "_", version = c(1L,
    5L, 2L), docvars = structure(list(Date = structure(c(9132,
    9136, 9136, 9141, 9141, 9142), class = "Date"), Journal = c("Libération",
    "Libération", "Libération", "Libération", "Le Monde", "La Tribune (France)"
    ), Titre = c("Autriche, Finlande et Suède, trois nouveaux prêts à jouer les bons élèves",
    "La Suède fait ses débuts dans l'Union européenne en passant par Paris",
    "1994: Année gay?", "\"\"\"\"Le Péril jeune\"\"\"\" fait table rase des années 70",
    "OLYMPISME   Un comité contre la discrimination des athlètes musulmanes a été créé  \"\"\"\"Atlanta Plus\"\"\"\" lutte pour l'exclusion des J.O. de 1996 des délégations exclusivement masculines",
    "La démonstration de force des eurodéputés"), Auteur = c("MILLOT Lorraine",
    "MILLOT Lorraine", "REMES Erik", "PERON Didier", "AULAGNON MICHELE",
    NA), Year = structure(c(9131, 9131, 9131, 9131, 9131, 9131
    ), class = "Date"), mois = structure(c(9131, 9131, 9131,
    9131, 9131, 9131), class = "Date")), row.names = c("1", "2",
    "3", "4", "5", "6"), class = "data.frame"), i = 2:4, p = c(0L,
    1L, 2L, 3L, 3L), Dim = c(6L, 4L), Dimnames = list(docs = c("1",
    "2", "3", "4", "5", "6"), features = c("sexisme", "féminisme",
    "droitsdesfemmes", "égalitédessexes")), x = c(1, 2, 1), factors = list())

And here is the str :
Formal class 'dfm' [package "quanteda"] with 15 slots
  ..@ settings    : list()
  ..@ weightTf    :List of 3
  .. ..$ scheme: chr "count"
  .. ..$ base  : NULL
  .. ..$ K     : NULL
  ..@ weightDf    :List of 5
  .. ..$ scheme   : chr "unary"
  .. ..$ base     : NULL
  .. ..$ c        : NULL
  .. ..$ smoothing: NULL
  .. ..$ threshold: NULL
  ..@ smooth      : num 0
  ..@ ngrams      : int 1
  ..@ skip        : int 0
  ..@ concatenator: chr "_"
  ..@ version     : int [1:3] 1 5 2
  ..@ docvars     :'data.frame':    16014 obs. of  6 variables:
  .. ..$ Date   : Date[1:16014], format: "1995-01-02" "1995-01-06" "1995-01-06" "1995-01-11" ...
  .. ..$ Journal: chr [1:16014] "Libération" "Libération" "Libération" "Libération" ...
  .. ..$ Titre  : chr [1:16014] "Autriche, Finlande et Suède, trois nouveaux prêts à jouer les bons élèves" "La Suède fait ses débuts dans l'Union européenne en passant par Paris" "1994: Année gay?" "\"\"\"\"Le Péril jeune\"\"\"\" fait table rase des années 70" ...
  .. ..$ Auteur : chr [1:16014] "MILLOT Lorraine" "MILLOT Lorraine" "REMES Erik" "PERON Didier" ...
  .. ..$ Year   : Date[1:16014], format: "1995-01-01" "1995-01-01" "1995-01-01" "1995-01-01" ...
  .. ..$ mois   : Date[1:16014], format: "1995-01-01" "1995-01-01" "1995-01-01" "1995-01-01" ...
  ..@ i           : int [1:14822] 2 10 13 14 18 19 20 24 25 26 ...
  ..@ p           : int [1:5] 0 2935 8389 14690 14822
  ..@ Dim         : int [1:2] 16014 4
  ..@ Dimnames    :List of 2
  .. ..$ docs    : chr [1:16014] "1" "2" "3" "4" ...
  .. ..$ features: chr [1:4] "sexisme" "féminisme" "droitsdesfemmes" "égalitédessexes"
  ..@ x           : num [1:14822] 1 2 1 1 1 1 1 1 1 1 ...
  ..@ factors     : list()

Thank you very much,
Regards

A: Assuming your dfm is called test, you can just do:
library(magrittr)
test %>%
  convert(to = "data.frame") %>%
  cbind(docvars(test))

Or without the pipe:
cbind(convert(test, to = "data.frame"), docvars(test))

As far as I know this is the only way as convert does not extract document variables.


text:
Q: How can I use VS2019 Files in VS2022 and vice versa? In my school they use VS 2019. I installed the same because that was what was available at the time (community version for me, I think the same for my school).
I had a couple of issues with VS2019 so I uninstalled everything and installed 2022 version instead. I then began to use this for the last 2 weeks but when I tried to open my old files, I couldn't.
I did install framework 3.1 again and the code will enter runtime successfully, but I still can't see the code that I wrote. I don't want to re-install VS2019 because it kept on giving me issues with intellisense which I just couldn't fix.
Is there any way I will be able to open my old 2019 files in 2022? Also, will 2019 be able to open 2022 files?

A: The generic answer to this is mostly yes but maybe no depending on your specifics.  That's not a helpful sentence, so let me explain.
For the most part, Visual Studio solutions and projects are cross-compatible1.  This means that if you have a project from one version, you can usually open it in another version without issue.  The major caveat to this is the range of frameworks supported by each VS version may be different.  VS will often be able to open the project, but might not be able to build and run it.
(Because you tagged this with vb.net, I'm limiting this to .NET versions.  The same concepts may apply for other platforms.)
For example, VS2019 supports:

*

*.NET version 5 (Visual Studio 16.8 or later)

*.NET Framework versions 4.8, 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, and 4.0

*.NET Core 3.1, 3.0, 2.2, 2.1, and 1.1.

And VS2022 supports:

*

*.NET Framework versions 4.8, 4.7.2, 4.7.1, 4.7, and 4.6.2

*.NET Core 6.0 Preview, 5.0, 3.1, 3.0, 2.2, and 2.1.

Note how VS2022:

*

*DOES NOT support .NET Framework versions 4.0-4.6.1, or .NET Core 1.1

*DOES support .NET (Core) 6.0 - which VS2019 does not

It is reasonable to expect that the next version of VS will stop supporting some versions while it adds support for new ones again, so this compatibility range will change with each VS release.
1: Each different type of project requires a Project System to support it.  Occasionally, these may be dropped out of support like with the frameworks described above, but with the more severe consequence that VS will not be able to open the project at all.  Some examples over time: Silverlight and Windows Phone projects, Setup projects, DNX (early .NET Core) projects, etc.


text:
Q: Transform not working in GeomectryDrawing in xaml <Style x:Key="ICON" TargetType="Rectangle">
<Setter Property="Fill">
  <Setter.Value>
    <DrawingBrush TileMode="None">
      <DrawingBrush.Drawing>
        <DrawingGroup>
          <GeometryDrawing Brush="Gray" Geometry="F1M19.5625,0.999954C29.8144,0.999954 38.125,9.31053 38.125,19.5625 38.125,29.8142 29.8143,38.1249 19.5625,38.1249 9.31073,38.1249 1,29.8142 1,19.5625 1,9.31053 9.31064,0.999954 19.5625,0.999954z">
            <GeometryDrawing.Pen>
              <Pen DashCap="Square" EndLineCap="Flat" LineJoin="Round" MiterLimit="10" StartLineCap="Flat" Thickness="2">
                <Pen.Brush>
                  <LinearGradientBrush EndPoint="0.849422,0.849423" StartPoint="0.150577,0.150578">
                    <GradientStop Color="#FF657783" Offset="0"/>
                    <GradientStop Color="White" Offset="0.146"/>
                    <GradientStop Color="#FF2C4758" Offset="1"/>
                  </LinearGradientBrush>
                </Pen.Brush>
                <Pen.DashStyle>
                  <DashStyle/>
                </Pen.DashStyle>
              </Pen>
            </GeometryDrawing.Pen>
          </GeometryDrawing>

          <DrawingGroup>
            <GeometryDrawing Brush="Gray" Geometry="F1 M0,25 L25,50, 50,25 25,0z">
              <GeometryDrawing.Pen>
                <Pen DashCap="Triangle" EndLineCap="Flat" LineJoin="Bevel" MiterLimit="10" StartLineCap="Flat" Thickness="5">
                  <Pen.Brush>
                    <LinearGradientBrush>
                      <GradientStop Color="#FF657783" Offset="0"/>
                      <GradientStop Color="White" Offset="0.5"/>
                      <GradientStop Color="#FF2C4758" Offset="1"/>
                    </LinearGradientBrush>
                  </Pen.Brush>
                  <Pen.DashStyle>
                    <DashStyle/>
                  </Pen.DashStyle>
                </Pen>
              </GeometryDrawing.Pen>
            </GeometryDrawing>

            <DrawingGroup.Transform>
              <TranslateTransform X="0.2" Y="0.2" />
            </DrawingGroup.Transform>
          </DrawingGroup>
        </DrawingBrush.Drawing>
      </DrawingBrush>
    </Setter.Value>
  </Setter>
</Style>

The inner icon should dominate the outer icon but here, its happening the reverse. My initial guess is that transform is not working but on further observation, I feel that the code is written correctly. Can anyone point out whats the mistake here?

A: It's working, but you should adjust it properties a little. So the code should look like this. Also I've added code for scaling romb.
<DrawingGroup.Transform>
    <TransformGroup>
        <TranslateTransform X="12" Y="12" />
        <ScaleTransform ScaleX="0.75" ScaleY="0.75" />
    </TransformGroup>
</DrawingGroup.Transform>


text:
Q: Compute characteristic function of $Y:= \sum_{k=1}^T X_k$ Let $(X_n)_{n \geq 1}$ be a sequence of independent and identically distributed random variables such that $X_n \sim Poisson(\lambda)$. Let $T$ be another random variable, independent of  $(X_n)_{n \geq 1}$, and such that $T-1 \sim Geometric(p)$ i.e. $\mathbb{P}(T=n) = p(1-p)^{n-1}$ for all $n \in \mathbb{N}_{>0}$. We define:
$Y:= \sum_{k=1}^T X_k$.
I have to compute the characteristic function of Y.
I don't understand what the sum up to $T$ should mean since $T$ is another random variable?

A: Hint
Since $$\mathbb E[e^{itY}\mid T=n]=\mathbb E[e^{itX_1}]^n=\exp\left\{n\lambda (e^{it}-1)\right\},$$
you have that $$\mathbb E[e^{itY}\mid T]=\exp\{T\lambda (e^{it}-1)\}.$$
Therefore $$\varphi _Y(t)=\mathbb E\left[\exp\left\{T\lambda (e^{it}-1)\right\}\right]=...$$


text:
Q: Spring Security Login return 404 i've searched tons of google pages but i still can't find solution for this. I'm using Spring MVC with Hibernate and Security. I've followed this tutorial but when i submit login form it goes for 404.
NOTE
login url is : localhost:8080/Portfolio/login after submit it is: localhost:8080/login
CONFIG
package com.portfolio.config;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

import java.util.Locale;

@Configuration
@ComponentScan(basePackages = "com.portfolio")
@EnableWebMvc
public class Config extends WebMvcConfigurerAdapter{
    @Bean
    public ViewResolver setupViewResolver()
    {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/views/");
        resolver.setSuffix(".jsp");
        resolver.setViewClass(JstlView.class);

        return resolver;
    }

    @Bean
    public MessageSource messageSource()
    {
        ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
        messageSource.setBasename("messages");

        return messageSource;
    }

    @Bean
    public LocaleResolver localeResolver()
    {
        CookieLocaleResolver resolver = new CookieLocaleResolver();
        resolver.setDefaultLocale(new Locale("pl"));
        resolver.setCookieName("locale");
        resolver.setCookieMaxAge(86400);

        return resolver;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
        interceptor.setParamName("locale");
        registry.addInterceptor(interceptor);
    }
}

HIBERNATE CONFIG
package com.portfolio.config;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;
import java.util.Properties;

@Configuration
@EnableTransactionManagement
@ComponentScan({ "com.portfolio.config" })
@PropertySource({ "classpath:application.properties" })
public class Hibernate {
    @Autowired
    private Environment environment;

    @Bean
    public LocalSessionFactoryBean sessionFactory()
    {
        LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        sessionFactory.setDataSource(dataSource());
        sessionFactory.setPackagesToScan("com.portfolio.entity");
        sessionFactory.setHibernateProperties(hibernateProperties());

        return sessionFactory;
    }

    @Bean(name = "dataSource")
    public DataSource dataSource()
    {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
        dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
        dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
        dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));

        return dataSource;
    }

    private Properties hibernateProperties()
    {
        Properties properties = new Properties();
        properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
        properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
        properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));

        return properties;
    }

    @Bean
    @Autowired
    public HibernateTransactionManager transactionManager(SessionFactory s)
    {
        HibernateTransactionManager txManager = new HibernateTransactionManager();
        txManager.setSessionFactory(s);

        return txManager;
    }
}

SECURITY CONFIG
package com.portfolio.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;

import javax.sql.DataSource;

@Configuration
@EnableWebSecurity
public class Security extends WebSecurityConfigurerAdapter {
    @Autowired
    @Qualifier("customerUserDetailsService")
    UserDetailsService userDetailsService;

    @Autowired
    public void configAuthentication(AuthenticationManagerBuilder auth) throws Exception
    {
        auth.userDetailsService(userDetailsService);
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception
    {
        http.authorizeRequests()
                .antMatchers("/").permitAll()
                .antMatchers("/admin/**").access("hasRole('ROLE_ADMIN')")
                .and()
                    .formLogin().loginPage("/login")
                    .usernameParameter("ssoId").passwordParameter("password")
                .and()
                    .csrf()
                .and()
                    .exceptionHandling().accessDeniedPage("/403");
    }
}

SECURITY WEB APP INITIALIZER
package com.portfolio.config;

import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;

public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
}

SPRING MVC INITIALIZER
package com.portfolio.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class SpringMvcInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[] { Config.class };
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return null;
    }

    @Override
    protected String[] getServletMappings() {
        return new String[] { "/" };
    }
}

Controller
package com.portfolio.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class DefaultController {
    @RequestMapping("/")
    public String index() {
        return "index";
    }

    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public ModelAndView loginPage() {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("login");

        return mv;
    }

    @RequestMapping(value = "/admin", method = RequestMethod.GET)
    public ModelAndView adminPage()
    {
        ModelAndView mv = new ModelAndView();
        mv.addObject("user", getPrincipal());
        mv.setViewName("admin");

        return mv;
    }

    private String getPrincipal()
    {
        String username = null;
        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();

        if (principal instanceof UserDetails) {
            username = ((UserDetails) principal).getUsername();
        } else {
            username = principal.toString();
        }

        return username;
    }
}

login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>

    <title>Spring Security Example</title>

Spring Security - JDBC Authentication

    Tutorial
    Download

<form action="/login" method="post">

            <input type="text" class="style-4" name="ssoId" id="username"
                   placeholder="User Name" />

            <input type="password" class="style-4" name="password" id="password"
                   placeholder="Password" />

            <input type="submit" value="Sign In" class="button red small" />

    <input type="hidden" name="${_csrf.parameterName}"
           value="${_csrf.token}" />
</form>

pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.portfolio</groupId>
  <artifactId>Portfolio</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Portfolio Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <properties>
    <spring.version>4.2.5.RELEASE</spring.version>
    <spring.security.version>4.0.4.RELEASE</spring.security.version>
    <mysql.connector.version>5.1.31</mysql.connector.version>
    <hibernate.version>4.3.6.Final</hibernate.version>
    <joda-time.version>2.9.3</joda-time.version>
    <jstl.version>1.2</jstl.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>${spring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
      <version>${spring.version}</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-web</artifactId>
      <version>${spring.security.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-config</artifactId>
      <version>${spring.security.version}</version>
    </dependency>

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>${mysql.connector.version}</version>
    </dependency>

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>${hibernate.version}</version>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>5.1.3.Final</version>
    </dependency>

    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
      <version>${joda-time.version}</version>
    </dependency>

    <dependency>
      <groupId>org.jadira.usertype</groupId>
      <artifactId>usertype.core</artifactId>
      <version>3.0.0.CR1</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-taglibs</artifactId>
      <version>${spring.security.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>javax.servlet.jsp-api</artifactId>
      <version>2.3.1</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>Portfolio</finalName>
  </build>
</project>

A: As mentioned in comments - you are currently posting to an incorrect URL.
In the linked tutorial you see in the view they have the code:
<c:url var="loginUrl" value="/login" />
<form action="${loginUrl}" method="post" class="form-horizontal">

But you are posting directly to "/login" - I assume from your other info that "Portfolio" is the application context, so by posting directly to /login tries to find another context on your app server called "login".
The JSP tag c:url is probably working out the application specific URL based on your context (so you don't have to hardcode the name of your app into the view).
In the very least, switching to that approach as per the tutorial you will no longer get this experience:

NOTE login url is : localhost:8080/Portfolio/login after submit it is:
  localhost:8080/login

as it will start posting to your application.  Once you have that change, and are posting to your app URL, you may still get other errors, but you should at least start getting Spring logging (as the request will make it to the Spring app now) - so if it still fails after that, then add the logs/error you get in that case.


text:
Q: how to trigger off an alert when the values of 3axis changes in the accelerometer? i have this code below:
import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends Activity implements SensorEventListener {
private SensorManager sensorManager;

TextView xCoor; // declare X axis object
TextView yCoor; // declare Y axis object
TextView zCoor; // declare Z axis object

@Override
public void onCreate(Bundle savedInstanceState){

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    xCoor=(TextView)findViewById(R.id.xcoor); // create X axis object
    yCoor=(TextView)findViewById(R.id.ycoor); // create Y axis object
    zCoor=(TextView)findViewById(R.id.zcoor); // create Z axis object

    // add listener. The listener will be HelloAndroid (this) class
    sensorManager.registerListener(this,
            sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
            SensorManager.SENSOR_DELAY_NORMAL);

    /*  More sensor speeds (taken from api docs)
        SENSOR_DELAY_FASTEST get sensor data as fast as possible
        SENSOR_DELAY_GAME   rate suitable for games
        SENSOR_DELAY_NORMAL rate (default) suitable for screen orientation changes
    */
}

public void onAccuracyChanged(Sensor sensor,int accuracy){

}

public void onSensorChanged(SensorEvent event){

    // check sensor type
    if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER){

        // assign directions
        float x=event.values[0];
        float y=event.values[1];
        float z=event.values[2];
// to display the
        xCoor.setText("Accelerometer X: "+ x);
        yCoor.setText("Accelerometer Y: "+ y);
        zCoor.setText("Accelerometer Z: "+ z);
    }
}

i need to trigger off an alert when one of axis changed its values.... let said when there is an accident and my x axis changed and will trigger off the video upload event.... is there anyone who know and willing to guide me?

A: You will need something like this (Note that this is more of an example than functional Android specific code):
float foo = 100f;//Some default value

public void compareX(float x) { //Call this from your onSensorChanged and pass it the X value
float diff = x - foo;
if(diff>threshold) //threshold is the baseline value for your sudden change
{
uploadVideo();
}
else{
foo = x;
}

This will most likely not work in practice as the sensor gives you new values quite fast and the diff is unlikely to higher than the threshold. Instead, you'll need to edit it to store the maximum and minimum values from the sensor in a short period of time, and check their difference against the threshold. For example, record the maximum and minium in a 3 second period, and compare those. If their difference is greater than the threshold, which you should have precalculated from some accident test data, then you upload the video or whatever you want to do.


text:
Q: htpasswd: cannot create file /etc/nagios/htpasswd.users I just installed nagios on CentOS 6.5. While creating the default auth. user:
htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Here is what I got:
htpasswd: cannot create file /usr/local/nagios/etc/htpasswd.users

The command was run as root, /usr/local/nagios/etc/ exists, and SELinux is enabled. What might be the problem?

A: I managed to solved the problem by first creating the file manually. Here is what I did: my apache2 files are in /usr/local/apache2/ . So I created a directory mkdir passwd in /apache2/ directory and created a file in that passwd directory by running touch passwords. Then I finally ran htpasswd -c /usrl/local/apache2/passwd/passwords flicker . Please note that flicker is the username.

A: Just create all the subsequent folders and the final file manually and then try the command again. I did the same and it worked.

A: In my case, on Ubuntu 14.04, I found that the directory that the htpasswd file was supposed to be created in didn't exist. Simply creating the folder and changing ownership to Nagios did the trick. Note also that the same problem affected creation of the config file, so running make install-config before restarting Nagios might be necessary:
$ ls -al /usr/local/nagios/
total 28
drwxr-xr-x  7 root   root   4096 May 30 20:34 .
drwxr-xr-x 11 root   root   4096 May 30 20:34 ..
drwxrwxr-x  2 nagios nagios 4096 May 30 20:34 bin
drwxrwxr-x  2 nagios nagios 4096 May 30 20:34 libexec
drwxrwxr-x  2 nagios nagios 4096 May 30 20:34 sbin
drwxrwxr-x 14 nagios nagios 4096 May 30 20:34 share
drwxrwxr-x  5 nagios nagios 4096 May 30 20:34 var

$ sudo mkdir /usr/local/nagios/etc
[sudo] password ...
$ sudo chown -R nagios:nagios /usr/local/nagios/etc
$ sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:

$ sudo service nagios start
Configuration file /usr/local/nagios/etc/nagios.cfg not found. Exiting.
$ sudo make install-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg

*** Config files installed ***

Remember, these are SAMPLE config files.  You'll need to read
the documentation for more information on how to actually define
services, hosts, etc., to fit your particular needs.
$ sudo service nagios start
Starting nagios: done.


text:
Q: unable to import android.os.UEventObserver package in android studio My Android application listens to the UEventObserver, for that, I thought it needs the below packages:
import android.os.UEventObserver;
import android.os.UEventObserver.UEvent;

But when I try to import these two packages in Android Studio project, packages are not visible, why?
How to compile Android application with the above packages
 (public void onUEvent(UEvent event))?


text:
Q: How to Fix Mouse position relative to parent of canvas? I am trying to use the Vuejs Draw Canvas of this Codepen as a component. Everything works great but the mouse position is relative to the window I think. So when drawn it works perfectly fine only if the canvas is window size ( width, height) if not there is a huge difference in the cursor and draw position.
I have tried setting the canvas width and height to offset instead of window like
setSize() {
   this.c.width = this.c.offsetWidth;
   this.c.height = this.c.offsetHeight - 60;
}

and mouse positions with below code as in this SO answers
function getMousePos(canvas, evt) {
    var rect = canvas.getBoundingClientRect();
    return {
        x: (evt.clientX - rect.left) / (rect.right - rect.left) * canvas.width,
        y: (evt.clientY - rect.top) / (rect.bottom - rect.top) * canvas.height
    };
}

but it did not change the result. So reverted back and added in code sandbox. If anyone can help me find out what the issue here? I know it's with mouse position but not sure exactly where.
Here is codesandbox link of the demo im trying to fix.

A: I use these two methods (not sure without further digging why they are not the same):
canv = document.getElementById("id-of-canvas-object")

function mouseLocation(e)
{
 if (e.preventDefault)
    e.preventDefault();
 var x = e.PageX; var y = e.PageY;
// in one instance
 var relativeX = x - canv.offsetLeft;
 var relativeY = y - canv.offsetTop;
// in another instance
  var rect = canv.getBoundingClientRect();
  relativeX = x - rect.left;
  relativeY = y - rect.top;
}

A: On the example you shared you are not taking in count the offset when re positioning the cursor and you're substracting a 60px offset that is unnecessary because of the fixed positioning of the controls.
There are just 2 differences on lines: 234 & 239
setSize() {
  this.c.width = this.c.offsetWidth;
  this.c.height = this.c.offsetHeight; // <--- HERE i removed the -60px offset
}

moveMouse(e) {
  let x = e.offsetX;
  let y = e.offsetY + 60; // <--- HERE i added the 60px offset
  // the ´e.offsetY´ is relative to the canvas but you have an offset
  // for the controls that is moving the cursor (the little dot) to the top

  var cursor = document.getElementById("cursor");

  cursor.style.transform = `translate(${x}px, ${y}px)`;
}

Heres the example fixed: Fixed codesandbox
Note: I recommend to change the fixed positioning of the controls and manage everything with fixed height and width values or use flexbox to grow the canvas as it needs to.


text:
Q: Session Vars in database search error Parse error: syntax error, unexpected I have a simple login for my site.
When they login , a session variable is created
$_SESSION['username'] = $myemail;

On another page, i want to
search  through the database where email = the users email
 $sql = "SELECT * FROM work where Email = '.$_SESSION['Susername'].'  ";

I am getting an error
Parse error: syntax error, unexpected '"', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) on that line
Also Subline Text 2 is highlighting the username in purple if that is any help
![enter image description here][1]
Can somebody spot some syntax error ?

A: Your problem is you're trying to concatenate with . without actually exiting the current "double quotes", single quotes don't exit into "normal space" from within a double-quoted string.
Also, you should quote the value going into the SQL statement. Then, you should either have:
$sql = "SELECT * FROM work where Email = '{$_SESSION['username']}'";

Or otherwise:
$sql = "SELECT * FROM work where Email = '" . $_SESSION['username'] . "'";


text:
Q: What does it mean when we let a trait inherits 'static? Rust supports trait inheritance, as follows:
pub trait A {}
pub trait B: A {}

B: A means that if some type T implements B, it also needs to implement all the methods in A.
But today I see the following code:
trait Display: 'static {
    fn print(&self);
}

What does it mean? It doesn't seem to be trait inheritance.

A:
Rust supports trait inheritance, as follows [...] B: A means that if some type T implements B, it also needs to implement all the methods in A.

Technically, that is not inheritance but requirement. It is a trait bound not entirely dissimilar to one you'd have in a function: it constraints the type on which B is implementable to only types on which A is already implemented.
With that change in wording, the second version is much easier to understand: it's a lifetime bound, meaning it constraints the type on which B is implementable to only types with 'static lifetime, meaning if you're trying to implement B on a type, that must either have no lifetime at all, or have a 'static lifetime (or the implementation must have a lifetime bound aka only work for some uses of the type).
You can see that if you try to implement the trait on a lifetime-generic structure:
struct A<'a>(&'a str);
trait Display: 'static {
    fn print(&self);
}

impl <'a>Display for A<'a> {
    fn print(&self) { todo!() }
}

will yield

error[E0478]: lifetime bound not satisfied

That is because 'a can be anything, so implementing Display for A<'a> means it is also implemented for non-'static instances, which is not valid.
By adding the relevant lifetime bound on the impl, and thus limiting the implementation to A<'static> instances:
struct A<'a>(&'a str);
trait Display: 'static {
    fn print(&self);
}

impl <'a: 'static>Display for A<'a> {
    fn print(&self) { todo!() }
}

the requirements of the trait are satisfied, and the impl is valid (nb: the 'a is not necessary here you can just impl ... for A<'static>, I'm showing it for regularity).
And if your struct has no lifetime it works by default, because no lifetime ~ 'static:
struct A(String);
trait Display: 'static {
    fn print(&self);
}

impl Display for A {
    fn print(&self) { todo!() }
}

A: Rust doesn't have inheritance.
What it has is a way to define constraints. For example a trait may be constrained to only be implemented by types which implement another trait.
In your case the constraint is a lifetime bound.
To implement your Display trait, an object may contain references but in this case their lifetime must respect this constraint.
Let's suppose you have this type:
struct S<'a> {
    s: &'a str,
}

Then you can't implement the trait for any lifetime, but only 'static.
impl Display for S<'static> {
    fn print(&self){}
}

fn main() {
    let s1 = "test";
    let a = S { s: s1 };
    a.print(); // compiles

    let s2 = "test".to_string();
    let a = S { s: &s2 };
    a.print(); // doesn't compile because s doesn't live long enough
}


text:
Q: scan and edit img width height through php before output this might be a funky question, but I wonder if anyone could think of a way how to take a chunk of html, scan it for  tags and if the tag has no width+height value apply it with list($width, $height, $type, $attr); ?
More in detail, I have a php page that includes another page with html only.
I would want the html to be changed before output to browser.
This is a simplified version of what I am looking at:
<!DOCTYPE HTML>

<?php
include_once("client-contributed-text-and-images.php");
?>

after some input below I came up with following:
<!DOCTYPE HTML>

<?php
$dom = new DOMDocument();
$dom->loadHTMLFile("client-contributed-text-and-images.php");

foreach ($dom->getElementsByTagName('img') as $item) {

    $item->setAttribute('width', '100');
    echo $dom->saveHTML();
    exit;
}
?>

The problem is that it generates a complete html4 file in the middle, while only changing the first img tag and seemingly not outputting the code afterwards:
<!DOCTYPE HTML>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

header

some text

some link

so I switched gears and tried fopen() instead and got it to work partly:
<!DOCTYPE HTML>

<?php
$root = realpath($_SERVER['DOCUMENT_ROOT']);
$file = $root."/client-contributed-text-and-images.php";
$f = fopen($file, 'r');
$contents = fread($f, filesize($file));
fclose($f);

$new_contents = str_replace("<img ", "

which gave:
<!DOCTYPE HTML>

header

some text

some link

Now I just need some help with figuring out how to implement list($width, $height, $type, $attr); to include right with and height (and obviously only when it is not already set).

A: Yes, this is entirely possible.

*

*Use a DOM parser to load your HTML and find your image tags.

*Use cURL to download images (if you don't already have them locally)

*Use GD to get the image sizes

*Use that DOMDocument to modify the HTML

*Output modified HTML.

Note that all of this will take a long amount of processing time.  It probably isn't worth it.  At least, cache the results.

A: YOu can try
$url = 'http://yahoo.com';
$dom = new DOMDocument();
@$dom->loadHTMLFile($url);

$imgs = $dom->getElementsByTagName("img");

foreach ( $imgs as $img ) {
    $attrs = array();
    // only load large images
    if ((int) $img->getAttribute("height") < 80)
        continue;

    for($i = 0; $i < $img->attributes->length; ++ $i) {
        $node = $img->attributes->item($i);
        $attrs[$node->nodeName] = $node->nodeValue;
    }
    print_r($attrs);
}

Output
Array
(
    [src] => http://l3.yimg.com/nn/fp/rsz/031913/images/smush/ucf-thwarted_635x250_1363714489.jpg
    [class] => fptoday-img
    [alt] => Quick thinking helped thwart UCF massacre plan (AP)
    [title] => Quick thinking helped thwart UCF massacre plan (AP)
    [width] => 635
    [height] => 250
)
Array
(
    [src] => http://l.yimg.com/os/mit/media/m/base/images/transparent-95031.png
    [style] => background-image:url('http://l2.yimg.com/ts/api/res/1.2/8hS1Q3v9rmaW8yI0eXEPHw--/YXBwaWQ9eWhvbWVydW47cT04NTtzbT0xO3c9MjUwO2g9MTU5/http://media.zenfs.com/en_us/News/Reuters/2013-03-19T120925Z_1_CBRE92I0XS100_RTROPTP_2_USA-SHOOTING-OHIO.JPG');
    [width] => 129
    [height] => 82
    [alt] =>
    [title] =>
    [class] => lzbg
)
Array
(
    [src] => http://l.yimg.com/os/mit/media/m/base/images/transparent-95031.png
    [style] => background-image:url('http://l3.yimg.com/ts/api/res/1.2/wcwLlp6sGVdOT7WXfkGEkQ--/YXBwaWQ9eWhvbWVydW47cT04NTtzbT0xO3c9MTg2O2g9MjUw/http://l.yimg.com/os/publish-images/lifestyles/2013-03-19/d9f10733-ee09-4e1f-a363-e3b9cd66078f_garygoldsmith.jpg');
    [width] => 82
    [height] => 110
    [alt] =>
    [title] =>
    [class] => lzbg
)

 ..........


text: Q: Getting device token when user clicks "Don't Allow" and then later turns notification switch on in Apple Settings If a user taps "Don't allow" when I prompt them to allow push notifications and then later goes into apple settings and switches the "allow notifications" Boolean from off to on, how can I now get the device token to send them push notifications?