text:
Q: SQL query for top entries using multiple columns I've got a Sqlite Database I want to query. My basic SQL Knowledge enables me to query for most I need but I'm stuck here:
The table looks like this (simplified!):
| Name            | Year | Title   | Musician 1 | Musician 2  |
| --------------- | ---- | ------- | ---------- | ----------- |
| Doe, Jon        | 2007 | Title 1 | Beatles    | The Stooges |
| May, Peter      | 2001 | Title 2 |            | Beatles     |
| Schmidt, Andrea | 1997 | Title 3 | Nick Cave  |             |

I'd like to be able to query for Top Musician in the 2000s and get an output like
| Name        | Count |
| ----------- | ----- |
| Beatles     | 2     |
| The Stooges | 1     |

How would you archieve this? Thanks!

A: If I correct understood, you need this
select  count(*), name from (
    select Musician_1 as Name from table where Year >= 2000
    union all
    select Musician_2 as Name from table where Year >= 2000
) t
group by Name
order by count(*) desc

A: you could use an union all
  select musician, count(*) from (

      select year, musician_1 as musician
      from my_table
      union  all

      select year, musician_2
      from my_table
  ) t
  where t.year between 2000 and 2010
  group by t.musician


text:
Q: Как создать изолированный HttpListener Есть 10 ПК, которые подключаются к терминальной ферме. Хочу в каждой сессии запускать HttpListener с одним и тем же портом, но чтобы они были изолированны друг от друга.
На данный момент, если я попытаюсь запустить данный код на двух ПК одновременно выдаст ошибку что порт занят. Можно ли как то изолированно запустить этот процесс?
   HttpListener listener = new HttpListener();
    listener.Prefixes.Add("http://localhost:8888/");
    listener.Start();
    Console.WriteLine("Ожидание подключений...");
    HttpListenerContext context = await listener.GetContextAsync();
    // остальное содержимое
    listener.Stop();

redpajama_set_name: RedPajamaStackExchange


text:
Q: Math and text font size not the same This is a follow-up question to Switching from PDFLaTeX to LuaLaTeX. Using user187802's answer, I have the following setup:
\documentclass{article}

\usepackage{fontspec}
\setmainfont[
  Extension      = .otf,
  UprightFont    = *-regular,
  BoldFont       = *-bold,
  ItalicFont     = *-italic,
  BoldItalicFont = *-bolditalic,
  Ligatures      = {
    TeX,
    CommonOff
  }
]{NewCM10}

\usepackage[
  math-style   = TeX,
  warnings-off = {
    mathtools-colon
  }
]{unicode-math}
\setmathfont{NewCMMath-Regular.otf}
\setmathfont[
  version  = bold,
  FakeBold = 2
]{NewCMMath-Regular.otf}

\usepackage{polyglossia}
\setdefaultlanguage{danish}

\begin{document}

Test.\footnote{`12345' versus `$12345$'}

\end{document}

As can be seen in the output, neither the font size nor the font boldness in text mode and math mode are the same. (It doesn't just occur in footnotes but elsewhere the difference is more subtle.)
How can I get the exact same font size and font boldness for text mode and math mode when using the NewCM10 font?

A: The problem is that LaTeX's Unicode math sets the math Unicode font with ssty font feature by very specific way. It uses +ssty=0 for textstyle, +ssty=1 for script style etc. I used in OpTeX only ssty=0, ssty=1 etc., without the + sign. I am unable to find the documentation of the plus sign in this font feature (the https://learn.microsoft.com/en-us/typography/opentype/spec/features_pt#ssty doesn't mention this) but I see that if it is used then the definitive variant of letters are selected not by the number specified for this feature, but by the size used for the font.
Compare:
LaTeX: [NewCMMath-Regular.otf]:mode=base;script=math;language=dflt;+ssty=0; at 8.0pt
OpTeX: [NewCMMath-Regular]:mode=base;script=math;ssty=0;mathsize=1; at 8.0pt

LaTeX selects script alternative shapes for the digits 1234 in loaded font, OpTeX selects basic shapes scaled to 8pt, which looks better in the footnote size. OpTeX selects script alternative shapes when ssty=1, i.e. only when scriptstyle in math mode is used.

A: Apparently, digits scale differently in NewCM-Math.
You can assign the text font to the digits.
\documentclass{article}

\usepackage{polyglossia}
\usepackage{fontspec}
\setmainfont[
  Extension      = .otf,
  UprightFont    = *-Regular,
  BoldFont       = *-Bold,
  ItalicFont     = *-Italic,
  BoldItalicFont = *-BoldItalic,
  Ligatures = {
    TeX,
    CommonOff
  },
  NFSSFamily=ncm,
]{NewCM10}

\usepackage[
  math-style = TeX,
  warnings-off = {
    mathtools-colon
  }
]{unicode-math}
\setmathfont{NewCMMath-Regular.otf}
\setmathfont[
  version = bold,
  FakeBold = 4,
]{NewCMMath-Regular.otf}

\setdefaultlanguage{danish}

% fix digits
\DeclareSymbolFont{textdigits}{TU}{ncm}{m}{n}
\SetSymbolFont{textdigits}{bold}{TU}{ncm}{b}{n}

\Umathcode`0="7 \symtextdigits `0
\Umathcode`1="7 \symtextdigits `1
\Umathcode`2="7 \symtextdigits `2
\Umathcode`3="7 \symtextdigits `3
\Umathcode`4="7 \symtextdigits `4
\Umathcode`5="7 \symtextdigits `5
\Umathcode`6="7 \symtextdigits `6
\Umathcode`7="7 \symtextdigits `7
\Umathcode`8="7 \symtextdigits `8
\Umathcode`9="7 \symtextdigits `9

\newcommand{\test}{%
  12345 versus $12345$\par
  \sbox0{12345}\the\wd0\ versus \sbox0{$12345$}\the\wd0\par
}

\begin{document}

\test {\bfseries\boldmath\test}

\bigskip

{\footnotesize\test {\bfseries\boldmath\test}}

$a+b=c$

{\boldmath$a+b=c$}

\end{document}

Without the \Umathcode lines, the output is


text:
Q: Alignment of item number in list containing a minipage I would like to have the list number at the beginning of the item, and not centered as is the case for item (b) the example below. If I comment out the \usepackage{nccmath}, I get this, but then the spacing gets messed up. I'd rather keep the nccmath package if possible.
I also do need to keep the [c] for the minipages.
I have looked at Preventing itemize environment to insert initial vertical space and Including an itemized list within a tabular column using the paralist package, but can not get that to work for me.
\documentclass{standalone}

\usepackage{standalone}
\usepackage{paralist}

\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes vertical align, but changes spacing

\newcommand{\MyMiniPage}{
\begin{minipage}[c]{1.0in}
  \begin{align*}
    a &= b\\
    c &= d
  \end{align*}
\end{minipage}
\begin{minipage}[c]{1.0in}
  \begin{align*}
    y &= z
  \end{align*}
\end{minipage}
}

\begin{document}
\begin{enumerate}[(a)]
  \item First item
  \item \MyMiniPage
  \item Third item
\end{enumerate}
\end{document}

I attempted to use \compress as mentioned in the other posts above, but was not able to get it to work.
---------------- Revised posting using \input -------------
This is in the file ListsProblem-Minipage.tex:
\documentclass[preview=false]{standalone}

\usepackage{standalone}
\usepackage{amsmath}

\begin{document}
\begin{minipage}[c]{1.0in}
    \begin{align*}
        a &= b\\
        c &= d
    \end{align*}
\end{minipage}
\begin{minipage}[c]{1.0in}
    \begin{align*}
        y &= z
    \end{align*}
\end{minipage}
\end{document}

This is in the file ListsProblem-Minipage2.tex:
\documentclass[preview=false,fleqn]{standalone}

\usepackage{standalone}
\usepackage{amsmath}

\begin{document}
%\begin{minipage}{3.0in}
\begin{align*}
                (-3)^4 &= 81\\
\frac{5^{23}} {5^{21}} &= 25
\end{align*}
%\end{minipage}
\end{document}

And here is the main file:
\documentclass[fleqn]{standalone}

\usepackage{standalone}
\usepackage{paralist}

\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes align, but changes spacing
\begin{document}
\input{ListsProblem-Minipage.tex}  % These two correctly yields
\input{ListsProblem-Minipage.tex}  % the desired 4 columns

\begin{enumerate}[(a)]
    \item First item
    \item \input{ListsProblem-Minipage.tex}
    \item \input{ListsProblem-Minipage2.tex}  % not in a mini-page
    \item Third item
\end{enumerate}
\end{document}

Note that the item label (b) is not aligned with the top of the two center aligned mini pages. The alignment of the (b) with the mini-pages that I want can be seen by commenting out the \usepackage{nccmath}. But I want a solution that does not require me to abandon the nccmath package.  Commeting this out also screws up the spacing.

A: This may be solved with \valign
\newcommand{\MyMiniPage}{%
  \leavevmode\vtop{\hrule height 0pt \kern-\baselineskip
  \valign{\vfill##\vfill\cr
    \hbox to 1in{$\begin{aligned}
    a &= b\\
    c &= d
  \end{aligned}$\hfill}\cr
  \hbox to1in{$\begin{aligned}
    y &= z
  \end{aligned}$\hfill}\cr}}
}

I put everything into a \vtop, where I care to set the first line aligned with the \item; then it's just a "trivial" \valign. :)
--- Added after having seen the example ---
In the case of an included standalone file the approach is different:
\documentclass{standalone}

\usepackage{standalone}
\usepackage{paralist}

\newcommand{\iteminput}[2][\topskip-1bp]{%
  \leavevmode\vtop{\hrule height 0pt\kern-\dimexpr#1\relax
    \input{#2}}}

\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes align, but changes spacing
\begin{document}
\input{ListsProblem-Minipage.tex}  % These two correctly yields
\input{ListsProblem-Minipage.tex}  % the desired 4 columns

\begin{enumerate}[(a)]
    \item First item
    \item \iteminput{ListsProblem-Minipage.tex}
    \item Third item
\end{enumerate}
\end{document}

The command \iteminput has an optional argument in case the default back up in the \vtop is not correct
\iteminput[<dimension>]{filename}

A: If you want it flush left, then simply use $...$ lines of math code
\documentclass{article}

\usepackage{standalone}
\usepackage{paralist}
\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes vertical align, but changes spacing

\newcommand{\MyMiniPage}{\arraycolsep=1.4pt
$\begin{array}{@{} l l @{\qquad} l l}
    a &= b   & y &=z \\[3pt]
    c &= d
  \end{array}$}

\begin{document}
\begin{enumerate}[(a)]
  \item First item
  \item \MyMiniPage
  \item Third item
\end{enumerate}
\end{document}


text:
Q: de Bruijn sequence and sequence waiting time this is quite a vague question, more of a puzzle than a question. I've spotted that two problems concerning word combinatorics have the same answer. I feel like there should be a connection, but I have none.

*

*Length of 'unwrapped' de Bruijn sequence is (in binary case) $2^{n} + n - 1$ (de Bruijn word is such a shortest word containing all words of length $n$ as subwords, e.g. for $n=2$ the word 00110)

*Imagine an experiment consisting of sequence of coin tosses. We can (and we want to!) stop this truly tedious activity if we spot a predetermined sequence. It's possible to compute an expected time of this, more precisely expected time of the first occurrence of the given sequence. For example for three heads in a row, HHH, it is 14 coin tosses. Let's look at this experiment as the organizers. We have lots of subjects and for each of them we generate randomly and uniformly some $n$-word ($n$ is fixed), we are interested in the average time it takes for subjects to complete their task. More precisely, now even the predetermined sequence is chosen randomly. The answer is again $2^n + n - 1$, as is computed in here.
It works for larger alphabets as well (and more sided coins??). Is there a connection? If not precise, at least some heuristics. Or is it just a pure coincidence? (Coincidences in maths? There's no such thing I want to believe.)


text:
Q: three.js BufferGeometry vs Geometry raycasting performance I've got a three.js project going where I need to be able to pick individual faces upon mouse movement on meshes of around 200,000 - 300,000 triangles.
I'm using a function like this:
function raycast (x, y) {
    //transform mouse coords relative to main window and normalize
    var normalized = normalizeCoordinates(x, y);

    // create a Ray with origin at the mouse position and direction into the scene (camera direction)
    var vector = new THREE.Vector3( normalized.x, normalized.y, 1 );
    projector.unprojectVector( vector, camera );
    raycaster.set( camera.position, vector.sub( camera.position ).normalize() );

    // create an array containing all objects in the list with which the ray intersects
    return raycaster.intersectObject(mesh);
}

Where normalizeCoordinates is just converting mouse page coordinates to normalized device coordinates.
When mesh uses a THREE.Geometry it's workable, albeit a little slow. For a variety of reasons I decided to try out BufferGeometry instead. This sees great results throughout some other aspects of the project but raycasting becomes too slow. When mesh uses a THREE.BufferGeometry (non-indexed) instead the intersectObject method takes around 4.5 times as long to complete.
Firstly, is this expected behaviour with BufferGeometry, and secondly is there any thing I could look at doing to improve raycasting performance in general (whether Geometry or BufferGeometry)? I'm relatively new to shaders but in particular I wondered whether using a shader to perform accelerated raycasting could be doable.


text:
Q: Is there a way to repeat texture on Unity 3D object without specifying amount of tiles? I am trying to make two different objects with the same size of texture / same material, which should be repeating; Without making new material for every new object I create. Below is an example of what I am trying to achieve.
Material A on both objects should look the same, the cube on the right represents how it should look.

A: This is fixed and working!
I had to make a Unity shader, which uses world space instead of local space (default). This is the code of a shader I used:
Shader "Legacy Shaders/Diffuse - Worldspace" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Scale("Texture Scale", Float) = 1.0
}
SubShader {
    Tags { "RenderType"="Opaque" }
    LOD 200

CGPROGRAM
#pragma surface surf Lambert

sampler2D _MainTex;
fixed4 _Color;
float _Scale;

struct Input {
    float3 worldNormal;
    float3 worldPos;
};

void surf (Input IN, inout SurfaceOutput o) {
    float2 UV;
    fixed4 c;

    if (abs(IN.worldNormal.x) > 0.5) {
        UV = IN.worldPos.yz; // side
        c = tex2D(_MainTex, UV* _Scale); // use WALLSIDE texture
    }
    else if (abs(IN.worldNormal.z) > 0.5) {
        UV = IN.worldPos.xy; // front
        c = tex2D(_MainTex, UV* _Scale); // use WALL texture
    }
    else {
        UV = IN.worldPos.xz; // top
        c = tex2D(_MainTex, UV* _Scale); // use FLR texture
    }

    o.Albedo = c.rgb * _Color;
}
ENDCG
}

Fallback "Legacy Shaders/VertexLit"
}

Fixed version:
Fixed
Sources of Knowledge I used:
Video tutorial by PushyPixels
Blocks of code taken from this blog
@derHugo set me on the right track, thank you!!


text:
Q: System.out.Println problems This is written in Java.
This is a two class program (one testing) that checks a String for vowels and keeps a count of how many are present.
Everything seems to be working fine except for the System.out.println()s on the second class (for testing).
I have never come across this problem before, but I think it is only relative to the print lines themselves.
The print lines are at the bottom.
Here are the two classes:
/** Tests the sentence for the vowels
 * @ Jon Kosaka
 */

public class Sentence
{
    String sentence;

    public Sentence(String text)
    {
        sentence = text;
    }

    public boolean isPalindrome()
    {

        int low = 0;

        int high = sentence.length() -1;

        boolean match = true;

        while (low < high && match)
        {
            if (sentence.charAt(low) != sentence.charAt(high))
            {
                match = false;
            }

            low++;
            high--;
        }
        return match;
    }

    public String getSentence()
    {
        return sentence;
    }

    public void setSentence(String newText)
    {
        sentence = newText;
    }

    public int[] getVowelCounts()
    {

        final int A_INDEX = 0;
        final int E_INDEX = 0;
        final int I_INDEX = 0;
        final int O_INDEX = 0;
        final int U_INDEX = 0;

        //              a  e  i  o  u
        int[] counts = {A_INDEX, E_INDEX, I_INDEX, O_INDEX, U_INDEX};
        int i;
        for (i = 0; i < sentence.length(); i++) {
            if (sentence.charAt(0) == 'a')
                counts[0]++;
            if (sentence.charAt(0) == 'e')
                counts[1]++;
            if (sentence.charAt(0) == 'i')
                counts[2]++;
            if (sentence.charAt(0) == 'o')
                counts[3]++;
            if (sentence.charAt(0)  == 'u')
                counts[4]++;

        }
        return counts;
    }

}

Other class:
import java.util.Scanner;
/**
  An application to count the number of each individual vowel
  @ Jon Kosaka
 */

public class WorkingWithStrings
{

    public static void main(String[] args)
    {
        //create a scanner
        Scanner console = new Scanner(System.in);

        //get the input
        System.out.println("Enter a sentence and I will count each vowel: ");
        String input = console.nextLine();

        //Create a vowelCounter and call method to count the vowels
        Sentence sentence = new Sentence(input);
        int[] counts = sentence.getVowelCounts();
    }
    //display the results
    System.out.println("Vowel Count for the sentence: ");
    System.out.println("      " + sentence.getSentence());
    System.out.println("number of a: " + counts[Sentence.A_INDEX]);
    System.out.println("number of e: " + counts[Sentence.E_INDEX]);
    System.out.println("number of i: " + counts[Sentence.I_INDEX]);
    System.out.println("number of o: " + counts[Sentence.O_INDEX]);
    System.out.println("number of u: " + counts[Sentence.U_INDEX]);

}

A: Some of your statements are outside of any method. This won't compile.
import java.util.Scanner;
/**
   An application to count the number of each individual vowel
   @ Jon Kosaka
*/

public class WorkingWithStrings
{

  public static void main(String[] args)
  {
    //create a scanner
    Scanner console = new Scanner(System.in);

    //get the input
    System.out.println("Enter a sentence and I will count each vowel: ");
    String input = console.nextLine();

    //Create a vowelCounter and call method to count the vowels
    Sentence sentence = new Sentence(input);
    int[] counts = sentence.getVowelCounts();
    //}  DELETED HERE
    //display the results
    System.out.println("Vowel Count for the sentence: ");
    System.out.println("      " + sentence.getSentence());
    System.out.println("number of a: " + counts[Sentence.A_INDEX]);
    System.out.println("number of e: " + counts[Sentence.E_INDEX]);
    System.out.println("number of i: " + counts[Sentence.I_INDEX]);
    System.out.println("number of o: " + counts[Sentence.O_INDEX]);
    System.out.println("number of u: " + counts[Sentence.U_INDEX]);
  } //ADDED HERE
}

A: There are many bugs :)
1:
To find and increment vowel counts you have:
for (i = 0; i < sentence.length(); i++) {
 if (sentence.charAt(0) == 'a')
     counts[0]++;
 ...

which checks the character at index 0 in every iteration. So
if (sentence.charAt(0) == 'a')

should be
if (sentence.charAt(i) == 'a')

2:
You've misplaced a } in your main method, as a result some of the code is outside any function. Fix that.
3:
The constants A_INDEX, B_INDEX... are method local in one class and you are accessing them from another class. You need to make them static variables of the Sentence class. Also you've assigned all of them value 0, Since they are used as the index in the array which hold vowel count. so you need:
static final int A_INDEX = 0;
static final int E_INDEX = 1;
static final int I_INDEX = 2;
static final int O_INDEX = 3;
static final int U_INDEX = 4;

4:
Change:
int[] counts = {A_INDEX, E_INDEX, I_INDEX, O_INDEX, U_INDEX};

to
int[] counts = {0,0,0,0,0};

Here is a working program

A: I see two problems with this:

*

*Your System.out.println() is sitting outside your main function

*Sentence.A_INDEX, etc, aren't static class variables, they're declared inside a member function

A: You have to put System.out.print in public static void main
public class WorkingWithStrings
    {
   public static void main(String[] args)
   {
      //create a scanner
      Scanner console = new Scanner(System.in);

      //get the input
      System.out.println("Enter a sentence and I will count each vowel: ");
      String input = console.nextLine();

      //Create a vowelCounter and call method to count the vowels
      Sentence sentence = new Sentence(input);
      int[] counts = sentence.getVowelCounts();

//display the results
      System.out.println("Vowel Count for the sentence: ");
      System.out.println("      " + sentence.getSentence());
      System.out.println("number of a: " + counts[Sentence.A_INDEX]);
      System.out.println("number of e: " + counts[Sentence.E_INDEX]);
      System.out.println("number of i: " + counts[Sentence.I_INDEX]);
      System.out.println("number of o: " + counts[Sentence.O_INDEX]);
      System.out.println("number of u: " + counts[Sentence.U_INDEX]);
  }

}

A: Without knowing the exact problem, here are some suspicions:
counts[Sentence.A_INDEX] etc. references a static field A_INDEX which doesn't exist in Sentence.
If it would exist as a static variable, all of those would still be initialized to 0 so counts[Sentence.A_INDEX] and  counts[Sentence.E_INDEX] would both be translated to counts[0].

A: there are few issues in your code i think this one is exactly right/correct code that you want.
 public class Sentence
{
   String sentence;

   public Sentence(String text)
   {
      sentence = text;
   }

   public boolean isPalindrome()
   {

      int low = 0;

      int high = sentence.length() -1;

      boolean match = true;

       while (low < high && match)
       {
          if (sentence.charAt(low) != sentence.charAt(high))
          {
             match = false;
          }

          low++;
          high--;
       }
       return match;
   }

   public String getSentence()
   {
      return sentence;
   }

   public void setSentence(String newText)
   {
      sentence = newText;
   }

   public int[] getVowelCounts()
   {

       final int A_INDEX = 0;
       final int E_INDEX = 0;
       final int I_INDEX = 0;
       final int O_INDEX = 0;
       final int U_INDEX = 0;

//              a  e  i  o  u
int[] counts = {A_INDEX, E_INDEX, I_INDEX, O_INDEX, U_INDEX};
int i;
for (i = 0; i < sentence.length(); i++) {
 if (sentence.charAt(i) == 'a')
     counts[0]++;
 if (sentence.charAt(i) == 'e')
     counts[1]++;
 if (sentence.charAt(i) == 'i')
     counts[2]++;
 if (sentence.charAt(i) == 'o')
     counts[3]++;
 if (sentence.charAt(i)  == 'u')
     counts[4]++;

}
return counts;
   }

}

import java.util.Scanner;
/**
   An application to count the number of each individual vowel
   @ Jon Kosaka
*/

public class WorkingWithStrings
{

   public static void main(String[] args)
   {
      //create a scanner
      Scanner console = new Scanner(System.in);

      //get the input
      System.out.println("Enter a sentence and I will count each vowel: ");
      String input = console.nextLine();

      //Create a vowelCounter and call method to count the vowels
      Sentence sentence = new Sentence(input);
      int[] counts = sentence.getVowelCounts();

//display the results
      System.out.println("Vowel Count for the sentence: ");
      System.out.println("      " + sentence.getSentence());
      System.out.println("number of a: " + counts[0]);
      System.out.println("number of e: " + counts[1]);
      System.out.println("number of i: " + counts[2]);
      System.out.println("number of o: " + counts[3]);
      System.out.println("number of u: " + counts[4]);

  }

}


text:
Q: If Y dominates X and Y is a CW complex, then X has the homotopy type of a CW complex
Let $f\colon X \to Y$ and $g \colon Y \to X$ be maps such that $g \circ f \simeq \mathrm{id}_X$, and suppose $Y$ ix a CW complex.  Then show that $X$ has the homotopy type of a CW complex

This is an exercise in May's Concise Course in Algebraic Topology that's stumped me.

A: See Theorem 3.6.3 here. The proof is quite long (4.5 pages) and would not be appropriate for reproduction at MSE. (I am well-aware of and, in general, agree with, the policy that one should not provide "link only" answer. However, in this case, link-only seems to be the only reasonable option.)
Edit: See also Proposition A.11 in Hatcher's "Algebraic Topology".

So that the answer is a bit more self-contained, here is a sketch of the proof given in Hatcher's book:
If $X_1 \xrightarrow{f_1} X_2 \xrightarrow{f_2} X_3 \to ...$ is a sequence of composable maps, let $T(f_1, f_2, \dots)$ denote the mapping telescope (aka homotopy direct limit). The proof uses the following three elementary facts about the mapping telescope:

*

*If $f_i \simeq g_i$ for all i, then $T(f_1, f_2, \dots) \simeq T(g_1, g_2, \dots)$;

*$T(f_1, f_2, f_3\dots) \simeq T(f_2, f_3\dots)$;

*$T(f_1, f_2, f_3\dots) \simeq T(f_2 f_1, f_4 f_3\dots)$.

Then:
$$T(fg, fg, fg\dots) \simeq T(f,g,f,g\dots) \simeq T(g,f,g\dots) \simeq T(gf,gf,gf\dots).$$
Since $gf \simeq \operatorname{id}$, $T(gf,gf\dots) \simeq T(\operatorname{id}, \operatorname{id}\dots) = X \times [0, \infty) \simeq X$.
On the other hand, $fg \simeq h : Y \to Y$ where $h$ is a cellular map (cellular approximation theorem), and then $T(fg,fg\dots) \simeq T(h,h\dots)$ is a CW-complex (because $h$ is cellular). So $X$ has the homotopy type of a CW complex.


text:
Q: Problem with git rebase from remote branch I'm working with some big project with million lines of code and on one day I've pushed a commit into my_branch.
Later I've made the additional change & pushed commit through the Web UI (GitLab UI to be precise).
Now I want to pull changes from my_branch to my local env.
If I run git pull --rebase origin my_branch, it gives me a lot of rebase conflicts and leads to files that I have never touched. I have no idea how to merge them and thus resolve all the conflicts... I'm sure that nobody else pushed anything there.
How to overcome this situation?
What am I doing wrong here?
Thanks in advance!

A: One possible solution (and a safer one) is to rename your local branch (and unset its upstream), then fetch the remote one and after that merge one into another locally.

A: Well, you should save contents of your current branch:
git checkout my_branch
git checkout -b by_branch_saved

Then return to my_branch and make hard reset:
git checkout my_branch
git reset --hard my_branch <latest_stable_version_without_your_changes>

After all this you are able to execute rebase without problems.

A: You are getting conflicts in files you have not touched, but others have. Rebasing remerges your local commits against the remote branch. Any changes you have merged must be merged again. If you have many commits locally, and you do not push them, they build up over time. Rebasing becomes harder and harder.
When you have a longer running task, create a new branch from my_branch. Do normal merges instead of rebasing. This prevents you from having to remerge the same changes over and over. When it comes time to merge your personal branch back in to my_branch use a squash-merge to keep the commit history clean:
git checkout my_branch
git pull
git checkout -b your_branch
git commit
git commit
git fetch
git merge origin/my_branch
git commit
git checkout my_branch
git pull
git merge --squash your_branch
git push origin HEAD


text:
Q: How to convert string into byte array and write into text file? There is a question regarding the encoding as in What is character encoding and why should I bother with it. However, I still confuse with the encoding for the Windows system and file.
As I am working C# program on Visual Studio 2017, may I know how to convert the string that is input in the textbox to byte array and write it into a text file?
I am not writing the text to file is because I need the bytes value of the string as compression. For example:
Input : hello world
Bytes array that write to file: 罴讵8?瘈
Thank you for your time!

A: Convert to UTF-8 byte array
var byteArray = System.Text.Encoding.UTF8.GetBytes(mystring);

Convert to UTF-8 string
var utf8string = System.Text.Encoding.UTF8.GetString(byteArray);

Write UTF-8 byte array to file
System.IO.File.WriteAllBytes("from-bytearray.txt", byteArray);

Write string to file
System.IO.File.WriteAllText("from-string.txt", utf8string, Encoding.UTF8);


text:
Q: Testing drag and drop with Leadfoot We are testing a simple drag and drop behaviour with Intern and the excellent new Leadfoot client library. Our requirement is simple:

*

*Find an element and move to it

*Press the mouse button (pick up the draggable item)

*Find another element and move to it (drag)

*Release the mouse button (drop the draggable item)

*Check something happened

I would expect the following example syntax to perform this task:
.findById("MY_DRAGGABLE")
  .moveMouseTo()
  .pressMouseButton()
.end()

.findById("MY_DROP_ZONE")
  .moveMouseTo()
  .releaseMouseButton()
.end()

This doesn't work. I already know that there may be an idiosyncrasy in Selenium and that a couple of 'moves' may be required to pick up something draggable:
.findById("MY_DRAGGABLE")
  .moveMouseTo()
  .pressMouseButton()
  .moveMouseTo(null, 1, 1)
.end()

This still doesn't work and in fact to make the 'pickup' work I have to add a click() as well:
.findById("MY_DRAGGABLE")
  .moveMouseTo()
  .click()
  .pressMouseButton()
  .moveMouseTo(null, 1, 1)
.end()

This part now works and the draggable is picked up, but the move and release doesn't work. In fact to make them do what I want I have to use a rather strange syntax which breaks out of the promise chain:
.findById("MY_DROP_ZONE")
  .then(function(element) {
    browser.moveMouseTo(element)
  })
  .releaseMouseButton()
.end()

So in the end I have:
.findById("MY_DRAGGABLE")
  .moveMouseTo()
  .click()
  .pressMouseButton()
  .moveMouseTo(null, 1, 1)
.end()

.findById("MY_DROP_ZONE")
  .then(function(element) {
    browser.moveMouseTo(element)
  })
  .releaseMouseButton()
.end()

What I'm interested to know is whether or not there is something about object positioning that I'm missing here or whether or not there may be a fault in the commands we are using?
We're testing this on Firefox primarily on a variety of platforms.

A: Unfortunately, Selenium doesn't support HTML5 drag-and-drop, so while the mouse press and release are registered by the browser, the drag operation is not.
One solution is to use JavaScript to simulate the drag-and-drop process. An example of how to do this is the DragAndDrop helper in the dnd branch of Leadfoot.


text:
Q: how to suppress error message in Unix for apache I know that we can suppress error message when the command is ls
ls /usr/tbin/httpd || /home/app/httpd/bin/apachectl 2>/dev/null

However, i want to suppress No such file or directory for the below command. Unfortunately 2>/dev/null does not help.
# /usr/tbin/httpd -v || /home/app/httpd/bin/apachectl -v 2>/dev/null
-bash: /usr/tbin/httpd: No such file or directory
Server version: Apache/2.4.12 (Unix)
Server built:   Apr  7 2015 19:15:22
# echo $?
0

Can you please suggest how can i suppress the error message in the above example ?

A: Better avoid producing the message completely by testing that the first exists before executing it:
{ [[ -x /usr/tbin/httpd ]] && /usr/tbin/httpd -v ; } || /home/app/httpd/bin/apachectl -v

However, if you want to avoid running the second if the first exits with a non-zero return code, you have to "mask" its return code, for instance by putting it in a sub-shell:
{ [[ -x /usr/tbin/httpd ]] && ( /usr/tbin/httpd -v ; exit 0 ; ) } || /home/app/httpd/bin/apachectl -v

Or in a command group:
{ [[ -x /usr/tbin/httpd ]] && { /usr/tbin/httpd -v ; true ; } } || /home/app/httpd/bin/apachectl -v

This said, a plain old if statement can be considered more readable:
if [[ -x /usr/tbin/httpd ]]
then
    /usr/tbin/httpd -v
else
    /home/app/httpd/bin/apachectl -v
fi


text:
Q: How do you pass a value to a directive in AngularJs? How do I pass a value to a directive and display it in the template?
http://plnkr.co/edit/1uFEBi?p=preview
Ultimately, I'm creating an application that allows users to create, edit, and delete things.  I need to be able to pass the ids of things around for this to work.  I'm not sure what the angular way of doing this is.  The plunk is my attempt but its not working.
Any help is greatly appreciated.  Thank you.

A: Change the following in your template

A: here you go:
http://plnkr.co/edit/i5FPqeDuCtTK5zqINtsV?p=preview
you are outputting the wrong thing it should be {{lrBlockId}}

A: I didn't see the template in the actual plunker.  But, I believe it was having issues because the tempalte could not be found.   Here is an updated plunker that works.
I use some JavaScript magic to create a dynamic path to the directive's template:
var scripts = document.getElementsByTagName("script");
var currentScriptPath = scripts[scripts.length-1].src;

var app = angular.module('LaunchRockApp', []);

app.controller("MainController", function($scope){});

app.directive('selectBlock', function(){
    return {
        scope: {
            lrBlockId: '='
        },
        templateUrl: currentScriptPath.substring(0, currentScriptPath.lastIndexOf('/') + 1) + 'select-block-type.html',
    };
});

And I also added a select-block-type.html file:
Template

{{lrBlockId}}

I didn't notice the in-line template.  In that case, just modify it like I did above by removing the '-' inside the variable you want to output:


text:
Q: How do I use javascript control ipad to scroll uniformly (without friction) I would need to listen to onscroll, and know how fast it is scrolling. Any one have any ideas how this should be implemented? By using onmousedown and onmouseup? And how should I calculate the speed?

A: I believe iScroll might be of help. It provides a way to scroll content inside a fixed width/height element. You should be able to disable the change in speed as it nears the end of a scroll.
You can find more information on it here:
http://cubiq.org/iscroll


text:
Q: SQL Server Table Locking I need to create a unique identifier for clients, I'm implementing this using a 9 digit Luhn (9th digit being the checkdigit), so I can validate its authenticity. The numbers I want to generate are random, so I create an 8 digit number and work out the check digit to go with it, that's all great.
My problem is that I need to check that it doesn't already exist in my client table. I have added an index to ensure duplicate values can't be inserted, but am looking for a steer on how to lock the table involved within the transaction I've created to ensure no concurrency issues arise, i.e. can't attempt to insert a duplicate.
Any suggestions on approach or recommendations welcome, I know this is probably a noddy question.

A: The short answer is that you don't have direct control over which type of lock is used and when. You do have the ability, however, to place multiple statements within an explicitly defined transaction.
At the end of the transaction, you can check to see if there were errors in processing or if your data is in an invalid state. Then you would commit if everything is fine or rollback if not. But, beware of leaving transactions open! If you don't commit or rollback your transaction, the affected tables will remain locked and all transactions against those tables will be blocked until you either commit or rollback the transaction.
Here is an example that will hopefully be of help:
DECLARE @Table TABLE
(
    ID INT IDENTITY PRIMARY KEY
    ,Luhn INT
    ,UNIQUE(Luhn)
)

DECLARE @MaxTries INT = 10;
DECLARE @Try INT = 1;

DECLARE @Luhn INT;
DECLARE @IsLuhnAvailable BIT = 0;

BEGIN TRAN;

WHILE @IsLuhnAvailable = 0 AND @Try <= @MaxTries
BEGIN

    SET @Luhn = CHECKSUM(NEWID()); --dbo.GenerateLuhn()

    SET @IsLuhnAvailable = CASE WHEN EXISTS ( SELECT 1 FROM @Table WHERE Luhn = @Luhn ) THEN 0 ELSE 1 END;

    SET @Try +=1;

END

IF @IsLuhnAvailable = 0
BEGIN
    PRINT 'Luhn could not be generated.'
    ROLLBACK;
END
ELSE
BEGIN

    INSERT INTO @Table
    (
        Luhn
    )
    VALUES
    (
        @Luhn
    )
    PRINT 'New Luhn was generated: ' + CAST(@Luhn AS VARCHAR)
    COMMIT;
END

SELECT * FROM @Table


text:
Q: How to make a unique text for each click? When I click on the gray block, I get text. I want to make it different for each block (especially if there are many blocks). I've read something about this.props.children but I can't do it on my own. Can you help me, please?
https://codesandbox.io/s/lucid-browser-fdgv8?file=/src/Main.js

A: Props are values or functions passed down to child components from it's parent, to use it in your case you should change this line in App.js
 {this.state.isClicked ? <Info info={"text"} /> : null}

to
 {this.state.isClicked ? <Info info={this.props.text} /> : null}

And these lines in Main.js
<App/>
<App/>
<App/>

to
<App text="text" />
<App text="2nd text" />
<App text="3rd text" />

This will allow you to display different text on each click.
Going forward you may want to eventually make it somewhat more dynamic.

A: You can simply pass text into the constructor of each block (App class) by creating a Prop attribute.
Main.js
import React from "react";
import "./styles.css";
import App from "./App";

class Main extends React.Component {
  render() {
    return (

        // Create text attributes with your string
        <App text="new" />
        <App text="to" />
        <App text="reactjs" />

    );
  }
}

export default Main;

App.js
import React from "react";
import "./styles.css";
import Info from "./Information";

class App extends React.Component {
  constructor(props) {
    super(props);
    // create text variable and have it equal the text pass in
    this.text = props.text;
    this.state = {
      isClicked: false
    };
  }

  handleClick = () => {
    this.setState({
      isClicked: !this.state.isClicked
    });
  };

  render() {
    return (

CLICK

         // set the info tag to the text variable create within the class
        {this.state.isClicked ? <Info info={this.text} /> : null}

    );
  }
}

export default App;


text:
Q: SignalR connection closed while refreshing the page Im using SignalR for real time notification. My problem is that, after initiating connection to the server HUB, the connection gets disconnected if I refresh the page. Can anybody give me an idea why the connection gets disconnected on every page refreshes.
public class TaskHub : Hub
{
   public void AddSession(string sessionId)
   {
       Groups.Add(Context.ConnectionId, sessionId);
   }
}

A:
DI container  : Hub must work singleton

builder.RegisterType<FeedHub>().ExternallyOwned().SingleInstance();

You manage OnReconnected event in hub.
public override Task OnConnected()
{
      ...
      return base.OnConnected();
}

public override Task OnReconnected()
{
     ...
     return base.OnReconnected();
}

public override Task OnDisconnected(bool stopCalled)
{
     ....
     return base.OnDisconnected(stopCalled);
}


text:
Q: Sax parser with DefaultHandler implementing LexicalHandler I have a handler with this signature:
class XMLReaderHandler extends DefaultHandler implements LexicalHandler

I'm using it with a sax parser ( javax.xml.parsers.SAXParser )
Is it possible that in case of empty tag like <id></id> the parser is not calling the method
characters(char[] ch, int start, int length)
        throws SAXException

It's what I'm getting in debug in presence of an empty tag. I still need to do the characters thing because I want to add an empty string in that case.
PS: don't suggest XPath because I'm already using it, I'm implementing it with Sax in case I need to process big data.
Thanks
EDIT:
So some new info. I'm using in my schema the xs:anyType with processContents="skip". Apparently SaxParser will skip things like that, so I found that I could use something like:
saxParserFactory.setFeature(
"http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace",
true);

but it's giving me org.xml.sax.SAXNotRecognizedException: Feature 'http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace' is not recognized.


text:
Q: How to unit-test this custom UITextField in Swift? I have created a custom UITextField like this
import Foundation
import UIKit

class NoZeroTextField: UITextField, UITextFieldDelegate {
    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.delegate = self
    }

    func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
    if (string == "0" ) {
        //ignore input
        return false
    }
        return true
    }
}

I am trying to write unit test for the class but the problem is with passing NSCoder instance to the constructor. I cannot instantiate it or set it to nil. How can I unit-test this class?

A: I figured this out. Class under test:
import Foundation
import UIKit

public class CustomTextField: UITextField, UITextFieldDelegate{

required public init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    self.delegate = self
}

 public func textField(textField: UITextField, shouldChangeCharactersInRange   range: NSRange, replacementString string: String) -> Bool {
    if (string == "X" ){
        //ignore input
        return false
    }
    return true
}

}

The test itself:
import UIKit
import XCTest
import TryCustom
import Foundation

class CustomTextFieldTests: XCTestCase {

  func testCustomTextField() {
    //pass in dummy non abstract NSCoder (NSKeyedUnarchiver)
    let cd = NSKeyedUnarchiver(forReadingWithData: NSMutableData())
    let c = CustomTextField(coder:cd)
    let result = c!.textField(c!, shouldChangeCharactersInRange: NSRange(), replacementString: "X")
    XCTAssertFalse(result)
  }
}


text:
Q: remove_action not working for functions within a plugin I'm trying to use remove_action to prevent a part of a plugin from running - don't ask me why :-).
The function within the plugin is:
add_action( 'woocommerce_before_single_product_summary', array( $this, 'show_product_gallery' ), 30 );

and I'm trying to remove it by:
remove_action( 'woocommerce_before_single_product_summary', array( $this, 'show_product_gallery' ), 30 );

For some reason it isn't doing the trick, although this usually works in Wordpress / WooCommerce.
Can anyone shine a light on why this might be please? I have also tried hooking my function to other things e.g.
add_action( 'init', 'remove_it' );
function remove_it() {
remove_action( 'woocommerce_before_single_product_summary', array( $this, 'show_product_gallery' ), 30 );
}

(Plugin Code: https://codedump.io/share/axGWwMwAH0vn/1/linzs-hook-not-working)
Cheers,
Linz
Edited: This question is different to the previous one about remove_action not working, because that was related to the wrong priority - whereas this priority is correct at 30.

A: You need to access the class variable globally. Please try this.
add_action( 'wp', 'remove_it' );
function remove_it() {
 global $WC_Product_Gallery_slider;
 remove_action( 'woocommerce_before_single_product_summary', array( $WC_Product_Gallery_slider, 'show_product_gallery' ), 30 );
}


text:
Q: Obj-C, how do I make my segmented control narrower in IB? I can't seem to make my segmented control, which is within a tableview smaller?
I'm not sure what fixed and the width, which is default to auto does?
I can't change the width from 320 either.
Heres a screen shot.

A: UIKit is going to resize a header view to be the full width of the table. Put the segment control in a view, and make that view the header view.

A: I find that when you put custom controls in a table view header or footer it is often best to place them on top of a separate UIView and make that UIView the actual header/footer.


text:
Q: Asynchronous JSP Tag Is there a JSP tag that allows that part of the page to process asynchronously?  If not is there a way to create one?
Something like the following:
<Util:Asynchronous>
    <%
        DataSource source = ...

    %>
</Util:Asynchronous>
... rest of page

I don't want to have to wait for the data source to finish before processing the rest of the page.
Thanks.

A: You need to use AJAX. Also it is bad coding practice to put your data access commands in your JSP pages. Very susceptible to hacks, not to mention performance hits.

A: The servlet container must wait that you are page is entirely rendered before sending it back to the client. Thus your requirement makes no sense for me.
If a part of the page takes too much time to process, you could use Ajax to load a portion of your page. There is already pages at StackOverflow about Ajax.


text:
Q: Не корректное выполнение примера из книги "Python в системном администрировании UNIX и Linux" Здравствуйте.
В книге есть пример:
for i in range(10):
    !date > ${i}.txt

Который должен показывать взаимодействие ipython с bash, и создавать 10 текстовых файлов с датой, однако у меня создаётся только один файл с именем sh.txt. Что я делаю не так? Версия python 2.7.3, ipython - 0.13.1
Заранее спасибо за ответ.

A: Точно связано с версией IPython.
Начиная с версии 0.10 данный пример не работает (в книге использовалась версия 0.8.4), в случае если возле {i} указан символ доллара:
for i in range(10):
    !date > ${i}.txt

Но без него - действительно получается нужный результат.
В release note не было найдено пояснения этого изменения, возможно, оно связано с чем-то другим.

A: работает вот так (без знака $):
for i in range(10):
  !date > {i}.txt

с чем связано такое расхождение между книгой (возможно, слегка устаревшей) и «реальной жизнью» — не знаю.


text:
Q: How to obtain a google auth token using REST API I am creating a REST API that need to access an external REST API. Calls to external API require an auth token to be included in the HTTP headers. They are using Google Firebase as the authentication backend. We have been given a username and a password to sign in.
I don not have much experience in using external authentication for API using .NET Core(6).
Please can someone provide me a sample solution (in .NET 6 and C#) that will help me to obtain an auth token using REST API and some samples of how to access endpoints passing in the token?


text:
Q: Does someone experienced error 404 slug for /product/ When I sert slug for WooCommerce /product/ then all products in the loop will be generated but clicking on the /product/my-product  will cause a error 404.
I disabled all of the plugins and default theme but still no luck.
I think something in the database is manipulating that.
Any ideas.
Changing slug to /item/ will work


text:
Q: Specifications for SQL "comment" data type Where can I find specifications for the SQL data type called "COMMENT". I am interested to know more about this.

A: I it is not sql server data type, it is user defined data type.
Which is nothing else but: CREATE TYPE COMMENT FROM VARCHAR(500)
Get all user defined data types like: SELECT * FROM sys.Types WHERE is_user_defined = 1
or check them in object explorer:

A: It is not a TSQL datatype. It looks like a user defined datatype. It is all CAPS. You can query user defined types.
select * from sys.types
where is_user_defined = 1

A: The user defined datatype founded on existing data type. Indeed, it can be considered to be nothing more than an alias for the base types already found in SQL server.
Syntax
CREATE TYPE <TYPE NAME>
FROM <BASE TYPE>
[SCALE]
[NULL | NOT NULL]

In your case it might be
CREATE TYPE COMMENT
FROM NVARCHAR(MAX) NULL

For more information: https://www.c-sharpcorner.com/article/create-user-defined-data-types/


text:
Q: return a certain key:value of object I have a array of object like this
AnArray: [
     {   name: 'name1',
         id: 123456,
         arrayOfSomething: [[1], [2], [3]]
     },
     {   name: 'name2',
         id: 123456,
         arrayOfSomething: [[0], [2], [1]]
     }

I need to push just the arrayOfSomething array in the result array, so I do:
SaveMyResult(){
   this.result.push({
    something:this.AnArray})
}

but it pushing me all the object data, How can I do ?

A: If you push AnArray, then yes, the result will be that AnArray is added to the end of your results array. If you don't want that, and you only want one property from each object, use the map method and concatenate the final array it creates:
this.result = this.result.concat(this.AnArray.map(({arrayOfSomething}) => ({arrayOfSomething})));

Here I've used a bit of destructuring to shorten the code, but it's basically going through every element of the array, pulling out its arrayOfSomething property, and replacing the element with a new object that contains only that property.


text:
Q: trying to delete inactive users in django I am writing a site that sends confirmation emails on signup. Until the user clicks the link, the is_active field is set to false. How can I automatically delete any users who do not click the activation link within a certain period of time? Is this even a viable option or is there a better way to work around users who never confirmed their accounts?
Thanks for any help!

A: I had the same problem, what i did was set a celery task that checks for user that hasn't activated their account after a specified period...
your task.py should be like this
@shared_task(name="delete_unactivated_users")
def delete_unactivated_users(self, *args, **kwargs):
    User = get_user_model()         # Get User model

    inactive_users = User.objects.filter(
        date_joined__lt=timezone.now() - timezone.timedelta(seconds=86400),
    )       # Queryset to get users that have created an account but didn't activate them in a day.

    for user in inactive_users:
        # Optional line to log deleted users to a file
        deleted_users_log(user)
        user.delete()

function to write to file
def deleted_users_log(user):
    f = open('/deleted_user_log.txt', 'a')
    opened_file = File(f)
    opened_file.write(f"Unactivated user {user.username} with firstName: {user.first_name}, lastName: {user.last_name}, and email: {user.email} have been flushed down the drain at: {datetime.datetime.now().time()}.\n")
    opened_file.close
    f.close

I am assuming that your token will expire after a day (24hrs)(86400 seconds)
Reference


text:
Q: Why do repeated bind mounts create entries for the source directory? Why does a repeated bind mount create multiple entries in /proc/mounts?
# md -p /mnt/test-mount/{source,target}
# mount --bind /mnt/test-mount/{source,target}
# grep test-mount /proc/mounts
/dev/sda3 /mnt/test-mount/target ext4 rw,relatime 0 0
# mount --bind /mnt/test-mount/{source,target}
# grep test-mount /proc/mounts
/dev/sda3 /mnt/test-mount/target ext4 rw,relatime 0 0
/dev/sda3 /mnt/test-mount/target ext4 rw,relatime 0 0
/dev/sda3 /mnt/test-mount/source ext4 rw,relatime 0 0

After the first bind mount there was one entry mapping the source
volume to the mountpoint. After the second invocation, we have
one additional entry for the mountpoint plus one for the source
prefix.
Likewise, findmnt reports that the source is bind mounted to
itself:
# findmnt |grep test-mount
├─/mnt/test-mount/target                       /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
│ └─/mnt/test-mount/target                     /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
└─/mnt/test-mount/source                       /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime

After another repetition, I end up with three entries for the
source, four for the target:
# mount --bind /mnt/test-mount/{source,target
# findmnt |grep test-mount
├─/mnt/test-mount/target                       /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
│ └─/mnt/test-mount/target                     /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
│   └─/mnt/test-mount/target                   /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
│     └─/mnt/test-mount/target                 /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
└─/mnt/test-mount/source                       /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
  └─/mnt/test-mount/source                     /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime
    └─/mnt/test-mount/source                   /dev/sda3[/mnt/test-mount/source]                ext4            rw,relatime

The progression is 1, 3, 7, 15, …, i. e. n = 1 + 2^(n-1),
causing the number of additional entries to double with each
mount operation.
What's the reason for this?

A: Mount propagation.
This is a specific case of the "mount point explosion problem", which is explained in the "MS_UNBINDABLE example" in mount_namespaces(7)
systemd effectively enables mount propagation by default.  For example, this makes it feasible to run a service in a child namespace where /home is blocked off, as per the systemd.exec option ProtectHome=yes.  By allowing mounts and unmounts to propagate into the child namespace, it lets eject continue to work properly in the main namespace, and so on.


text:
Q: Specific AWS Feature Store Policy for Online Store I am able to successfully call get_record function  from lambda code seen here
       FeatureGroupName=transaction_feature_group_name, RecordIdentifierValueAsString=transaction_id)

this works when using the AmazonSageMakerFullAccess role. I am however trying to identify the specific policy that enables the FeatureStore api functions like get_record , put_record etc action for interaction with the Online Store
I tried using the AmazonSageMakerFeatureAccess but that didn't work. I think that it only grants access to the offline store.
Can anyone assist me with this info?


text:
Q: Text I am drawing to HTML is blinking p5js I am assuming this is because the draw loop is drawing every x amount of seconds.
How can I slow it down or prevent it from updating every frame without slowing down the video refresh rate.
My thought was to add an fps counter and check if (fps_counter >= 60) update html?
See the last block of code 'getResult()'
// see gotResult()
function setup() {
  createCanvas(320, 260);
  // Create the video
  video = createCapture(VIDEO);
  video.size(320, 240);
  video.hide();
  // frameRate(5);

  flippedVideo = ml5.flipImage(video)
  // Start classifying
  classifyVideo();
}

// see gotResult()
function draw() {
  background(0);
  // Draw the video
  image(flippedVideo, 0, 0);

  // Draw the label
  fill(255);
  textSize(25);
  textAlign(CENTER);
}

// I believe the issue is here.
// HTML is noticeably blinking.
function gotResult(error, results) {
    $("#background").html("✅ | " + parseInt(results[0].confidence * 100) + "%");
    $("#cardboard-paper").html(" | " + parseInt(results[1].confidence * 100) + "%");
    $("#plastic").html(" | " + parseInt(results[2].confidence * 100) + "%");
    $("#can").html(" | " + parseInt(results[3].confidence * 100) + "%");

  classifyVideo();
}

A: I'm not quite sure what you mean by blinking, but p5.js has a built-in frame counter, the frameCount variable. You can read more in the reference.
You can use this along with the modulus % operator to trigger some behavior every X frames. Something like this:
// only do the thing once per second
if(frameCount % 60 == 0) {
  // do the thing
}


text:
Q: There are $2^{\omega(a)}$ pairs $(b,c)$ such that $a=bc$ and $\gcd(b,c)=1$ It looks as there are $2^{\omega(a)}$ ordered pairs $(b,c)$ such that $a=bc$ and $\gcd(b,c)=1$, where $\omega(a)$ is the number of different prime factors of $a$.
Proof?
It's also true that there are  $n^{\omega(a)}$ n-tipples $(a_1,\dots ,a_n)$ such that $a=a_1\cdots a_n$.

A: Hint: a pair $\,(b,c)\,$ corresponds to a partition $\, A = B\cup C\, $ of the set of primary factors $\,p_i^{e_i}\,$ of $\,a,\,$ hence mapping $\,b\,$ to its corresponding subset $B$ of the partition bijects these pairs with all subsets of the set $A$ of primary factors of $a$, of which there are $2^n,\,$ since $a$ has $n$ distinct prime factors.
For example if $\,a = 2^i 3^j 5^k$ then $\,A = \{ 2^i, 3^j, 5^k\}$ and the coprime factorization corresponding to the partition $\, A = \{2^i ,3^j\}\cup \{5^k\}\,$ is $\,a = \color{#c00}{2^i 3^j}\times 5^c = \color{#c00}b\times c,\,$ where $\,b\,$ corresponds to the product of the elements in the first set, i.e. $\,\color{#c00}{b = \prod\, \{2^i,3^j\}}$
Equivalently these coprime factorizations correspond to  idempotents of $\,\Bbb Z/a \,\cong\, \Bbb Z/b \times \Bbb Z/c,\,$ elements which govern such ring factorizations. This correspondence between element vs. ring factorizations holds much more generally - as proved here if $R$ is a UFD then proper factorizations of the ring $\,R/a\,$ correspond to coprime (i.e. comaximal) factorizations of the element $\,a = b\times c,\,$ just like in the classical CRT = Chinese Remainder Theorem.

A: Bear with me.  I'm going to introduce components for the sake of lining up my ducks in a row.  And then I will shoot.
(If this whole thing is too long you can skip to the very last paragraph:

LAST PARAGRAPH:
Likewise for each prime factor of $a$ we can either have $p|b$ or $p|c$ so there are two choices for each prime factor of $a$ and so there are $2^{\text{number of prime factors}}$ choices of pairs.

If that is too terse read on for a duck guide:)
let $\omega(a) = n$.  Let $U = \{p_1,p_2,....,p_n\}$ be the distinct prime factors of $a$.  Then we can write the unique prime factorization of $a$ as $a = \prod_{p_i\in U} p_i^{m_i}$ where the $m_i$ are natural numbers (the powers to which the prime factors divide $a$)
Suppose $b, c$ are natural numbers.  And let $B=\{$ the distinct prime factors of $b\}$ and $C = \{$ the distinct prime factors of $c\}$ and $b,c$ have  unique prime factorizations of $b= \prod_{q_i\in B} q_i^{w_i}$ and $c= \prod_{r_i\in B} r_i^{u_i}$

*

*Case 1: If $b|a$ and if $c|a$ then $B\subset U$ and $b=
    \prod\limits_{p_i\in B}p_i^{w_i}$ where $w_i \le m_i$.  And $C
    \subset U$ and $c= \prod\limits_{p_i\in C}p_i^{u_i}$ where $u_i \le
    m_i$.

*Case 2: If $\gcd(b,c) = 1$ then $B\cap C = \emptyset$

*Case 3: If $a = bc$ (then $b|a$ and $c|a$ so Case 1 holds)  then
$B\cup C = U$ and $bc = \prod\limits_{p_i\in
B}p_i^{w_i}\prod\limits_{p_i\in C}p_i^{u_i} = a = \prod_{p_i\in U}
p_i^{m_i}$.  And if $p_i \in B\cap C$ then $w_i + u_i = m_i$.  And
if $p_j\in B\setminus C$ then $w_i = m_i$ and if $p_k \in C\setminus
B$ then $u_i = m_i$.

*So finally Case 4:  If $a = bc$ and $\gcd(b,c) = 1$ then $B\cup C =
U$ and $B\cap C = \emptyset$ so if we consider $U$ as our universal set we have $C = B^c$ and we have $b = \prod_{p_i\in B}p_i^{m_i}$ and $c = \prod_{p_j\in B^c} p_j^{m_j}$.

Now..... bang.
To determine a pair of $b,c$ so that $a = bc$ and $\gcd(b,c) = 1$, I must consider each prime factor, $p_i$ of $a$.
Either $p_i\mid b$ or $p_i \not \mid b$.  If $p_i\mid b$ then $p_i^{m_i}\mid b$.
So $b$ is uniquely determined by which subset $B\subseteq U$ we use. And $c$ is uniquely determined by ... what the complement of $B$ is.
And....
$|\{(b,c): a = bc; \gcd(b,c)=1\}|=$
$|\{b:b\mid a, c=\frac ab; \gcd(b,c) =1\}|=$
$|\{\prod_{p_i\in B} p_i^{m_i}: B\subseteq U\}|=$
$|\{B: B\subseteq U\}|=$
$|\mathcal P(U)|=$
$2^{|U|} = 2^{\omega(a)}$.
Or if you are not that comfortable with set theory:
Remember.  $\mathcal P(U)$ is the set of all subsets of $U$, and the number of subsets of $U$ are determined by considering each element of $x\in U$ and either $x$ may be in the subset or $x$ may not be in the subset.  That is two choices for each element of $U$ so there are $2^{\text{number of elements of U}}$ possible subsets.
Likewise for each prime factor of $a$ we can either have $p|b$ or $p|c$ so there are two choices for each prime factor of $a$ and so there are $2^{\text{number of prime factors}}$ choices of pairs.

A: The easiest way to see this is to use kernels. If $$x=\prod_{i=1}^{\omega(x)}{p_i^{k_i}}$$ then the kernel is defined as $$\ker(x)=\prod_{i=1}^{\omega(x)}{p_i}$$ Plainly, $\omega(x)$ is the same for $x$ and $\ker(x)$. By the well known formula for the number of divisors, there are $2^{\omega(x)}$ divisors of $\ker(x)$.
Each divisor $d_i$ of $\ker(x)$ is the first member of an ordered pair $\Bigl (d_i,\ \frac{\ker(x)}{d_i}\Bigr)$ whose members are coprime. In particular, because $\ker(x)$ is square free, it is always the case that $$d_i\ne \frac{\ker(x)}{d_i}$$
Restoring the ignored exponents $k_i$ of the prime factors of $x$ back into the analysis changes nothing with respect to counting the ordered pairs possible.
Applying this to the question posed, let $a=x$, $b=d_i$ with relevant exponents restored, $c=\frac{\ker(x)}{d_i}$ with relevant exponents restored, and the proof is complete. There are $2^{\omega(a)}$ coprime ordered pairs $(b,c)$ of $a$


text:
Q: How to selectively load/use CSS for YUI modules? I use the following code to load YUI modules.
YUI().use('tabview', 'datatable', 'datasource-local', 'node', 'node-load', function(Y)
{
    ......
});

This would load the modules and ALL of the respective CSS files.
But I want to use the CSS selectively. Let's say I don't want to load CSS for TabView.
How can I achieve that?
I tried the following -
YUI({ fetchCSS: false }).use('tabview', 'datatable', 'datasource-local', 'node', 'node-load', function (Y)
{
    ......
});

Its obvious that the above code would not load CSS files for any module.
How can I disable CSS for tabview so that I can use my own?

A: There is 'override' property in the skin config. That allows you to use differents skin for some modules.
You may create a skin with your own css file, and tell the loader to use this skin for the module you want (tabview in your example).
I'm not sure you can have different source folder for the differents skins though.
http://yuilibrary.com/yui/docs/api/classes/config.html#property_skin
You can also try to define a css module and 'use' it.
http://yuilibrary.com/yui/docs/api/classes/config.html#property_modules
I hope it helps you!


text:
Q: Adding custom vim colorscheme in MacOS Sierra I know this seems simple, but I've never experienced this before and am not sure what to do. I made a custom colorscheme for vim: "mycustom.vim"
The colorschemes are located at /usr/share/vim/vim74/colors
When I do sudo cp from the location of mycustom.vim to the /colors folder it returns the error: cp: /usr/share/vim/vim74/colors/mycustom.vim: Operation not permitted
Even with sudo I'm not allowed to add my colorscheme to the folder! Any ideas on how to add my colorscheme or set it as the default in vim?

A: On Unix there is ~/.vim directory where you should keep user specific settings. You may place your colorscheme to ~/.vim/colors or create ~/.vim/plugins/mycustom/colors directory and add it to your runtimepath doing this set runtimepath+=~/.vim/plugins/mycustom. In order to make your theme as the default one you must add colorscheme mycustom to your ~/.vimrc file.

A: To install a custom colorscheme, put it in $HOME/.vim/colors/.
/usr/share/vim/vimXX/ is off-limits for you. All your customizing is supposed to happen in $HOME/.vimrc and/or $HOME/.vim/ and nowhere else.


text:
Q: Can OpenLayers parse GPX data which is stored as a string in a javascript variable? I have a map site using OpenLayers, which imports and displays GPX data using the following code:
var lgpx = new OpenLayers.Layer.GML(gpxtracktitle, gpxfileaddress, {

  format: OpenLayers.Format.GPX,

  style: {strokeColor: plmapvars.colourarray[i%7], strokeWidth: 5, strokeOpacity: 0.7},

  projection: new OpenLayers.Projection("EPSG:4326")
});

map.addLayer(lgpx);

I'm looking for a way to display gpx data which, rather than being stored as a file, is saved as a string in a javascript variable:
var gpxstring ="<?xml ... </gpx>"

I've tried passing the string into the code above as a data uri, without success.  Is OpenLayers capable of parsing GPX from a string in the way I'm attempting to do it?
Thanks in advance for any help.

A: Maybe there is an easier way, but here you go:
You already know about OpenLayers.format.GPX [docs]. It has a read method, which accepts an XML document and returns an array of features. You can then add those feature to a layer.
How to parse the XML string and create an XML document is described in How to create and use a XML document object properly considering browser compatibility?


text:
Q: Tips to enhance the performance of the following simply SQL query I would like to receive help in enhancing the performance of my SQL query. The query is so simple, but it is taking quite sometime to execute, so I would like some tips on how I can enhance the query:
  SELECT
    *
  FROM
    SOME_DB_TABLE
  WHERE
    SUBSTRING(TIME, 1, 8)
  BETWEEN
    "20110101" AND "20111231"
  AND
    CONDITION_COL = "C"
  GROUP BY
    TIME
  ORDER BY
    TIME ASC

A: The substring function could be slowing your query down.
Would something like the below work?
time >= "20110101"
and time < "20120101"

A: You should index the time column like this:
CREATE INDEX some_index
ON SOME_DB_TABLE (TIME)
This will make a search on this column way faster.
Also, do you really need every columns ? Using SELECT * is

*

*A bad habbit

*Execution time conssuming if you take non-important columns


text:
Q: Problema con el entorno de desarrollo de react estoy teniendo un problema a la hora de arrancar con react, he instalado node y yarn y a la hora de arrcancar el Visual Studio me tira el siguiente error

¿Alguien sabe a que se que puede ser?
Gracias.


text:
Q: How to create a JsonNode chaining two arrays? I'm building a complex JSON object with Jackson and I want to structure the code to display the JSON structure clearly, so I'm trying to use the JsonNode API with chained with, put and set methods. At one place inside all this chained stuff I need to add two arrays one after the other. Here's a simplified excerpt:
com.fasterxml.jackson.databind.ObjectNode json = new ObjectNode(JsonNodeFactory.instance);
json.with("data")
    .set("array1", arrayNode1)
    .set("array2", arrayNode1);

I want it to create this JSON:
{
    "data": {
        "array1": [...],
        "array2": [...]
    }
}

First set is fine because it's called on ObjectNode. The problem is it returns JsonNode, which doesn't have a set method, and so the second set call results in compilation error.
How can I chain setting two arrays?

A: It doesn't really improve readability that much, but if you have Guava on the classpath, you can do the following:
ObjectNode json = new ObjectNode(JsonNodeFactory.instance);
json.with("data")
    .setAll(ImmutableMap.of(
        "array1", arraynode1,
        "array2", arraynode2));

setAll returns the object node.


text:
Q: Standard method for creating file read/write 'library'? I am attempting to create a file read/write 'library' using Excel VBA for an old file format.  Just for info, the format is LIS79, an old oil industry format for writing well-site data to tape - largely streams of wellbore measurements like density, resistance, temperature etc. The full spec is here (PDF doc) - it's pretty long and boring.
As I'm using Excel VBA I guess it's not really a library, but a collection of subs and functions etc.
I have been tapping away for a month or so and am making good progress, though it's becoming increasingly complicated - the number of subs and functions I need to write keeps on growing.
I figure I'm probably not the fist person to try and write a file read/write library from it's specification. So I've been searching StackExchange, searched using Google and browsed programming books at the local university library, to see if any sort of standard process or method might exist that would make the whole task a bit simpler.  Alas I haven't been able to find anything, though I have no formal programming background so it's possible I don't know precisely what to search for.
Does anyone know of a standard method, procedure or guidelines for creating file read/write libraries that you could refer me to?
Or is it just a matter of persevering - file read/write libraries can be long and complicated things to create?
Many thanks.


text:
Q: How to draw a picture background in a PApplet in Java? I want to run this code like this where is my err?
package impractice;
import processing.core.*;

public class MyPApplet extends PApplet {
    private String URL ="F://learn//python//imgages//microarray.jpg";
    private PImage backgroundImg;

    public void setup()
    {
        size(200, 200);
        backgroundImg = loadImage(URL, "jpg");
    }

    public void draw()
    {
        backgroundImg.resize(200, 200);
        image(backgroundImg, 0, 0);
    }
}

The error show The file "F://learn//python//imgages//microarray.jpg" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch
    Is to put this picture to the project 's folder or how what to do?

A: For the loadImage() method to load your microarray.jpg correctly into PImage backgroundImg, the image must be located in the data directory of your project.
For example if your MyPApplet class is located in .../src/impractice/MyPApplet.java
then your image should be located in
.../data/microarray.jpg
Then you can just load it like:
backgroundImg = loadImage("microarray.jpg","jpg");

Or you can try loading an image hosted online, for example:
backgroundImg = loadImage("https://microbenotes.com/wp-content/uploads/2018/09/Steps-Involved-in-cDNA-based-Microarray.jpeg")


text:
Q: How to use collection as a predicate to filter arrays Assuming I have a huge collection of arrays (100K records) lets say(sourceArray). I have a list of another array(matchIds) I need to use to filter from this sourceArray. How do I achieve this with lodash? or plain JavaScript?
var sourceArray = [{
    "id": 123,
  },
  {
    "id": 456
  },
  {
    "id": 789
  },
  {
    "id": 111
  },
  {
    "id": 222
  },
  {
    "id": 333
  }];

var matchIds = [123, 222];

The below filter only matches on a single item
console.log(
      _.filter(sourceArray, function(arr){
         return arr.id === 123;
      })
    );

http://jsbin.com/fegipuwuwa/1/edit?html,js,console
What I would actually expect is arr.id <..in..> matchIds

A: Why not simply
var matchingArray = sourceArray.filter( function(item){
  return matchIds.indexOf(item.id) != -1
});

This will return all the items which are matching from matchIds

A: Well your predicate data structure is not optimum and affects the overall performance negatively by increasing the size. It would be best if you first convert [123, 222] into a hash or map. Once it's done the rest is just O(n).

var matchIds = [123, 222],
        hash = matchIds.reduce((h,id) => (h[id] = true, h),{})
 sourceArray = [{
    "id": 123,
  },
  {
    "id": 456
  },
  {
    "id": 789
  },
  {
    "id": 111
  },
  {
    "id": 222
  },
  {
    "id": 333
  }];
      result = sourceArray.filter(o => hash[o.id]);
console.log(result);


text:
Q: Get data on selection from MongoDb list in Python and HTML I am developing a website in Python based on Flask framework ,using MongoDb .I have a list of medicine on one webpage and the next step i want to do is when I click on one of the medicine I should get detailed description of clicked(selected) medicine.
@app.route('/App_don')
def App_don():
    Approval_don = AppDonReq.find()
    print(Approval_don)
    return render_template('Approval_don_req.html', todos=Approval_don)

As per my understanding  I need to link these two python codes
@app.route('/Sel_App_don/<name>')
def Sel_App_don(name):
    if name:
        for item in name:
            print(item)
            return render_template('Approval_desc.html')

And below is my HTML code:

List

                        {% for todo in todos %}

                                {{ todo.text }}

                        {% endfor %}

A: python:
@app.route('/')
def App_don():
    Approval_don = [{"text": "hallo"}]
    print(Approval_don)
    return render_template('blabla.html', todos=Approval_don)

@app.route('/Sel_App_don/<string:name>')
def Sel_App_don(name):
    if name:
        return render_template('new.html', var=name)

blabla.html:

List

                        {% for todo in todos %}
                        <form action = "/Sel_App_don/{{ todo.text }}">

                                <button type = "submit">{{todo.text}}</button>

                        </form >
                        {% endfor %}

new.html:

 {{ var }}

When clicking on an element, it redirects the user to the new page with the argument from the specific column. These are examples you can customize them, they are just to showcase how it works.


text:
Q: Wrapping a UITableViewController in NSProxy I have a subclass of NSProxy designed to forward messages to either an object instance or to Lua functions if they are defined for the selector. This works in most cases. UITableViewController, however, is a different case altogether. When I set up my proxy object with an instance of UITableViewController (or a stub subclass) it doesn't seem to ever receive any of the UITableViewDelegate or UITableViewDatasource messages that I expect it to.
I have the necessary methods implemented up in Lua, and they respond correctly when called manually, but they never seem to be called when I add the proxy UIViewController view to the hierarchy. What might I be missing?

A: You're probably getting tripped up by the way that some UIKit classes handle their delegate connection.  They keep a set of flags internally indicating what messages the delegate can respond to.  When you set the delegate or datasource outlet, the TableView will send several -respondsToSelector: messages to the object in question, and remember which ones returned TRUE.


text:
Q: WSO2 APIM Build Failure : : am-p2-profile: Cannot generate P2 metadata: P2 publisher return code was 13 - Unable to build wso2 API manager version 2.6.0.
Os : Tried with Windows 10 and Cent OS
Maven & Java version Details:
[root@localhost ~]# mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-17)
Maven home: /usr/share/maven
Java version: 1.8.0_242, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"
maven build error:
[INFO] --- carbon-p2-plugin:1.5.4:materialize-product (creating-gateway-worker-profile)                                                           @ am-p2-profile ---
[INFO] Command line:
        /bin/sh -c cd /root/wso2/APIM/wso2-product-apim/modules/p2-profile/product && /u                                                          sr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre/bin/java -jar /root/.m2/r                                                          epository/org/eclipse/tycho/tycho-p2-runtime/0.13.0/eclipse/plugins/org.eclipse.equinox.                                                          launcher_1.2.0.v20110725-1610.jar -nosplash -application org.eclipse.equinox.p2.director                                                           -metadataRepository file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/t                                                          arget/p2-repo -artifactRepository file:/root/wso2/APIM/wso2-product-apim/modules/p2-prof                                                          ile/product/target/p2-repo -installIU carbon.product.id -profileProperties org.eclipse.u                                                          pdate.install.features=true -profile gateway-worker -bundlepool file:/root/wso2/APIM/wso                                                          2-product-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/compo                                                          nents -shared file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/w                                                          so2carbon-core-4.4.35/repository/components/p2 -destination file:/root/wso2/APIM/wso2-pr                                                          oduct-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/component                                                          s/gateway-worker -p2.os linux -p2.ws gtk -p2.arch x86 -roaming
Installing carbon.product.id 4.4.35.
Installation failed.
One or more certificates rejected. Cannot proceed with installation.
Application failed, log file location: /root/.m2/repository/org/eclipse/tycho/tycho-p2-r                                                          untime/0.13.0/eclipse/configuration/1586643837368.log

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] WSO2 API Manager - Aggregator Module .............. SUCCESS [4.285s]
[INFO] WSO2 API Manager - Styles Parent .................. SUCCESS [0.295s]
[INFO] WSO2 API Manager - Styles ......................... SUCCESS [8.789s]
[INFO] WSO2 Stratos  API Manager - UI styles ............. SUCCESS [9.588s]
[INFO] WSO2 API Manager - Multi Tenant Dashboard ......... SUCCESS [4.142s]
[INFO] WSO2 API Manager - Features Parent ................ SUCCESS [0.126s]
[INFO] WSO2 API Manager - Features Aggregator Module ..... SUCCESS [0.102s]
[INFO] WSO2 API Manager - Styles Features ................ SUCCESS [1.729s]
[INFO] WSO2 API Manager - Multi Tenant Dashboard Feature . SUCCESS [4.649s]
[INFO] Samples ........................................... SUCCESS [2.094s]
[INFO] Clients for samples ............................... SUCCESS [0.409s]
[INFO] Publisher API client .............................. SUCCESS [12.008s]
[INFO] Store API client .................................. SUCCESS [4.289s]
[INFO] Admin API client .................................. SUCCESS [4.047s]
[INFO] Back end Service .................................. SUCCESS [7.122s]
[INFO] Sample Utils ...................................... SUCCESS [7.901s]
[INFO] Sample One ........................................ SUCCESS [47.254s]
[INFO] Sample Two ........................................ SUCCESS [28.712s]
[INFO] Sample Four ....................................... SUCCESS [29.776s]
[INFO] Sample Seven ...................................... SUCCESS [28.981s]
[INFO] Sample Eight ...................................... SUCCESS [30.187s]
[INFO] Sample Nine ....................................... SUCCESS [31.633s]
[INFO] Sample Ten ........................................ SUCCESS [31.590s]
[INFO] WSO2 API Manager - P2 Profile Generation Parent ... SUCCESS [0.096s]
[INFO] WSO2 API Manager - P2 Profile Generation .......... FAILURE [2:21.827s]
[INFO] API Manager : oauth2-grant-types .................. SKIPPED
[INFO] WSO2 API Manager - Distribution Parent ............ SKIPPED
[INFO] WSO2 API Manager - Distribution ................... SKIPPED
[INFO] WSO2 API Manager - API Import Export .............. SKIPPED
[INFO] WSO2 API Manager - Integration Tests .............. SKIPPED
[INFO] WSO2 API Manager - Integration Test Common Module . SKIPPED
[INFO] WSO2 API Manager - Integration Admin Clients Module  SKIPPED
[INFO] WSO2 API Manager - Integration Common Test Module . SKIPPED
[INFO] WSO2 API Manager - Test Artifacts Tests ........... SKIPPED
[INFO] WSO2 API Manager - RestFul Backend Module for Integration Tests  SKIPPED
[INFO] WSO2 API Manager - ArtifactDeploymentMonitor WebApp  SKIPPED
[INFO] org.wso2.am.framework.extensions .................. SKIPPED
[INFO] WSO2 API Manager - Integration Extensions Module .. SKIPPED
[INFO] WSO2 API Manager - Integration UI Pages Module .... SKIPPED
[INFO] WSO2 API Manager - Integration New Test Module .... SKIPPED
[INFO] WSO2 API Manager - Based on product backend Test Module  SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7:26.537s
[INFO] Finished at: Sat Apr 11 18:24:10 EDT 2020
[INFO] Final Memory: 81M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wso2.maven:carbon-p2-plugin:1.5.4:materialize-product                                                           (creating-gateway-worker-profile) on project am-p2-profile: Cannot generate P2 metadata                                                          : P2 publisher return code was 13 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the fo                                                          llowing articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :am-p2-profile

LOG FROM  1586643837368.log
[root@localhost configuration]# cat 1586643837368.log
!SESSION 2020-04-11 18:23:56.569 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_242
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -application org.eclipse.equinox.p2.director -metadataRepository file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/p2-repo -artifactRepository file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/p2-repo -installIU carbon.product.id -profileProperties org.eclipse.update.install.features=true -profile gateway-worker -bundlepool file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/components -shared file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/components/p2 -destination file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/components/gateway-worker -p2.os linux -p2.ws gtk -p2.arch x86 -roaming
Command-line arguments:  -application org.eclipse.equinox.p2.director -metadataRepository file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/p2-repo -artifactRepository file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/p2-repo -installIU carbon.product.id -profileProperties org.eclipse.update.install.features=true -profile gateway-worker -bundlepool file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/components -shared file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/components/p2 -destination file:/root/wso2/APIM/wso2-product-apim/modules/p2-profile/product/target/wso2carbon-core-4.4.35/repository/components/gateway-worker -p2.os linux -p2.ws gtk -p2.arch x86 -roaming

!ENTRY org.eclipse.equinox.p2.engine 8 0 2020-04-11 18:24:09.869
!MESSAGE One or more certificates rejected. Cannot proceed with installation.
[root@localhost configuration]# pwd
/root/.m2/repository/org/eclipse/tycho/tycho-p2-runtime/0.13.0/eclipse/configuration
[root@localhost configuration]# cat 1586643837368.log^C
[root@localhost configuration]#


text:
Q: Eclipse doesn't work after update In eclipse all functionality missed. There are only 5 tabs left in properties:
General,
Help,
Install/Update,
Run/Debug,
Team.
And Eclipse opens all *.java and *.xml files as txt(without highlight)
I'm new in Eclipse and it can be something simple.
But I think it happened because of one of plugins. I don't know how to check it. Before it happened I updated Android plugin and restarted. I don't remember, may be i updated something else too.
Ubuntu 12.04,
Eclipse 3.7.2

A: Try this first: start Eclipse with the -clean command line argument, which will clear out cached plugin information. Startup will take longer, but you have to do this only once.
If that doesn't help, go to Help/About. Click on the Installation Details button. The window that pops up has an "Installation History" button, where you can see what changed. You can also revert the changes back out.


text:
Q: Dynamically creating vertically grouped radio buttons with jQuery I'm dynamically creating several vertically grouped radio buttons using jQuery mobile 1.0 for a multiple choice quiz.
When I paste this code from the JQM Radio Button Docs in it styles the controlgroup properly.
<fieldset data-role="controlgroup">
    <input type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" checked="checked" />
    Cat
    <input type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2"  />
    Dog
</fieldset>

When I dynamically inject my markup on pageshow() it injects the proper markup but it doesn't style the control group at all.
$.getJSON("assets/json/aircraft.json", function (data) {
    var maxQuestions = 10;
    var maxChoices = 4;

    var randomsorted = data.aircraft.sort(function (a, b) {
        return 0.5 - Math.random();
    });

    var quiz = $.grep(randomsorted, function (item, i) {
        return i < (maxQuestions * maxChoices);
    });

    var arr_quiz_markup = [];
    $.each(quiz, function (i, item) {
        var q = Math.floor(i / maxChoices);
        var c = i % maxChoices;

        if (c == 0) arr_quiz_markup.push("
Image for question " + q + " goes here...
<fieldset data-role='controlgroup' data-question='" + q + "'>");

        arr_quiz_markup.push("<input type='radio' name='q" + q + "' id='q" + q + "c" + c + "' data-aircraftid='" + item.id + "' />");
        arr_quiz_markup.push("" + item.name + "");

        if (c == maxChoices - 1 || c == quiz.length - 1) arr_quiz_markup.push("</fieldset>
");

    });

    $("#questions").html(arr_quiz_markup.join("")).controlgroup("refresh");
});

I tried $("#questions :radio").checkboxradio("refresh"); but throws "cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'".
My Live Quiz Demo (Sorry, jsfiddle doesn't have jQuery Mobile listed)
What am I doing wrong? How do I refresh this to properly get JQM to style the controlgroup correctly?

A: You will get more information about the dynamic in this jQuery Forum thread.
The jQuery Mobile default styles will be applied once you use the following code. That's what I found and it's working for me.
$("input[type='radio']").checkboxradio().checkboxradio("refresh");

A: Add this line
$("#quiz").trigger("create");

after
$("#questions").html(arr_quiz_markup.join("")).controlgroup("refresh");

This code snippet will force a rebuild of the quiz page so that jqm styles will be applied to the page contents.

A: This works for me (I'm using jQuery Mobile 1.4.0):
HTML

JS
$.ajax({
    ...
    success: function(data, textStatus, jqXHR) {
        // Hide loading message
        $.mobile.loading("hide");

        // Build page
        $("#location-page").trigger("create");

        // Clear another previos radio options
        $("#locations").controlgroup("container")["empty"]();

        // Read XML response
        var rows = $("Row", data);

        $(rows).each(function(index, value) {
            var locationId = $("LocationID", this).text();
            var locationName = $("LocationName", this).text();
            var $el = $("" + locationName + "<input type=\"radio\" name=\"location\" id=\"location" + index + "\" value=\"" + locationId + "\">")
            $("#locations").controlgroup("container")["append"]($el);
            $($el[1]).checkboxradio();
        });
        $("#locations").controlgroup("refresh");

        // Change to locations' page
        $.mobile.changePage("#location-page", {transition: "flip"});
    },
    ...
});


text:
Q: Get with a API data from JSON-file with PHP Im using a API for a tournament service but I don't know how I should get the data from my json-text to php variables.
This is the php code that makes the json text:
$header_size    = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header         = substr($output, 0, $header_size);
$body           = json_decode(substr($output, $header_size));

And here is my json text:
array(8)
{
    [0]=> object(stdClass)#1 (12) {
        ["id"]=> string(24) "5666e0ef150ba051458b456b"
        ["discipline"]=> string(16) "counterstrike_go"
        ["name"]=> string(18) "A csgo tournament #1"
        ["full_name"]=> string(18) "A csgo tournament #1"
        ["status"]=> string(9) "completed"
        ["date_start"]=> string(10) "2015-12-12"
        ["date_end"]=> string(10) "2015-12-13"
        ["online"]=> bool(false)
        ["location"]=> string(19) "Online"
        ["country"]=> string(2) "SE"
        ["size"]=> int(32)
        ["archived"]=> bool(false)
    }
    [1]=> object(stdClass)#2 (12) {
        ["id"]=> string(24) "5652cc7c150ba0e3568b4567"
        ["discipline"]=> string(15) "leagueoflegends"
        ["name"]=> string(16) "A csgo tournament #1"
        ["full_name"]=> NULL
        ["status"]=> string(5) "setup"
        ["date_start"]=> string(10) "2015-12-11"
        ["date_end"]=> string(10) "2015-12-12"
        ["online"]=> bool(false)
        ["location"]=> string(8) "Online"
        ["country"]=> string(2) "SE"
        ["size"]=> int(16)
        ["archived"]=> bool(false)
    }
    [2]=> object(stdClass)#3 (12) {
        ["id"]=> string(24) "555dd064140ba040588b456e"
        ["discipline"]=> string(16) "counterstrike_go"
        ["name"]=> string(30) "A csgo tournament #1"
        ["full_name"]=> string(30) "A csgo tournament #1"
        ["status"]=> string(7) "running"
        ["date_start"]=> string(10) "2015-06-05"
        ["date_end"]=> string(10) "2015-06-05"
        ["online"]=> bool(true)
        ["location"]=> string(12) "#Online"
        ["country"]=> string(2) "SE"
        ["size"]=> int(128)
        ["archived"]=> bool(false)
   }
}

A: To loop and print every tournament do something like
for ($i = 0; $i < count($body); $i++) {
    echo "$body[0]->'name'";
}

Hope that helps!


text:
Q: Why has pip/python/pyinstaller started throwing errors? I'm not sure if this is the right site to be asking this on, so sorry if it's a little off topic.
Anyway, for some reason, the pip and python commands have both stopped working in the Command prompt, as well as pyinstaller and are throwing 'pip' is not recognized as an internal or external command, operable program or batch file. error. They were working fine earlier, so I have no idea why they suddenly stopped working. I did not update my python version, but now py works instead of python. I have installed a few modules today, using pip, but I don't know why that would affect them. I can still run python files.
Any ideas on why this might be happening?


text:
Q: Переменная в классе хранит одно и тоже значение Python Переменная с рандомным числом в классе хранит одно и то же при вызове метода класса. Как это решить?
Вот участок кода:
class User:
    def __init__(self, carts_List, your_cart_list):
        self.carts_List = carts_List #Атрибут который выводит список карт с колоды
        self.your_cart_list = your_cart_list #Атрибут который выводит список карт пользователя

    #Метод отвечающий за роздачу карт игрокам
    def give_cards(self):
        while True:
            random1 = randint(0, len(self.carts_List) - 1)
            random2 = randint(0, len(self.carts_List[random1]) - 1)

            self.your_cart_list.append(self.carts_List[random1][random2])
            self.carts_List[random1].pop(random2)
            if len(self.your_cart_list) == 6:
                break
            else:
                pass

A: Не уверен, что правильно вас понял, но попробуйте:
from random import randint

class User:
    def __init__(self, carts_List, your_cart_list):
        self.carts_List = carts_List
        self.your_cart_list = your_cart_list

    #Метод отвечающий за роздачу карт игрокам
    def give_cards(self):
        while True:
            random1 = randint(0, len(self.carts_List) - 1)
            self.your_cart_list.append(self.carts_List[random1])
            self.carts_List.pop(random1)

            if len(self.your_cart_list) == 6:
                return self.carts_List

carts_List = [
    'p6', 'p7', 'p8', 'p9', 'p10', 'p11', 'p12', 'p13', 'p14',
    't6', 't7', 't8', 't9', 't10', 't11', 't12', 't13', 't14',
    'b6', 'b7', 'b8', 'b9', 'b10', 'b11', 'b12', 'b13', 'b14',
    'c6', 'c7', 'c8', 'c9', 'c10', 'c11', 'c12', 'c13', 'c14',
]

user1 = User(carts_List, [])
carts_List = user1.give_cards()
print('user1: ', user1.your_cart_list)

user2 = User(carts_List, [])
carts_List = user2.give_cards()
print('user2: ', user2.your_cart_list)

user3 = User(carts_List, [])
carts_List = user3.give_cards()
print('user3: ', user3.your_cart_list)

user4 = User(carts_List, [])
carts_List = user4.give_cards()
print('user4: ', user4.your_cart_list)

print('колода: ', carts_List)


text:
Q: Covering compact subsets of plane with certain rectangles Suppose $\{F_n\}$ is sequence of compact subsets of the half-plane $\mathbb H=(0,+\infty)\times(-\infty,+\infty)$ with positive area such that $F_n\subset F_{n+1}$ and $\cup_n F_n=\mathbb H$. Do there exist a sequence of positive numbers $\{a_n\}$ and positive constants $\delta,\delta',\delta''$ such that
$$[\frac{1}{a_n},a_n]\times[0,a_n]\subset F_n\subset[\frac{\delta}{a_n},\delta'a_n]\times[-\delta'' a_n,\delta''a_n]$$
for $n>n_0$?

A: No. Let $c_n$ be a monotone increasing sequence. For convenience let $d_n = \frac{c_n}{c_n-1}$. Then set
$$F_n = \bigg(  [c_n^{-1},c_n]\times[-c_n, c_n] -  [d_n^{-1},d_n]\times[-d_n, d_n] \bigg) \cup \{1\}\times [-c_n, c_n] $$
Each $F_n$ is closed, bounded, so compact. It looks like a large rectangle with a smaller rectangle punched out and a line strung across the removed smaller rectangle. (The line there means that the $F_n$ indeed converge to $\Bbb{H}$.) As $n$ increases, the large rectangle lets larger and the removed rectangle gets smaller.
Because the inner rectangle you propose has $(1,\varepsilon)$ in its interior for small $\varepsilon$, whereas $(1,\varepsilon)$ is on the boundary of $F_n$ for each $n$, containment can never hold.


text:
Q: Do we have a name for this space? Let $\Omega$ be a bounded domain in $\mathbb{R}^{n}$. Consider the class
$$
\mathcal{F}=\{f\in L^{1}(\Omega):\exists C>0 \text{ s.t. } \int_{U}|f|\leq C\sqrt{|U|},\text{ for any }U\subset \Omega.\}
$$
Here $U$ runs over all open subsets of $\Omega$.
It is clear that $L^{2}(\Omega)\subset \mathcal{F}$.
My question: do we have a name for this class $\mathcal{F}$? Did anyone study it before?
Thanks.

A: $\newcommand{\Om}{\Omega}
\newcommand{\F}{\mathcal{F}}$Prompted by a comment by Nate Eldredge, I found this in Wikipedia :

For any $0<r<p$ the expression
  $$\||f|\|_{L^{p,\infty}}=\sup_{0<\mu(E)<\infty}\mu(E)^{-1/r+1/p}\Big(\int_E
|f|^r\,d\mu\Big)^{1/r}$$
  is comparable to the $L^{p,w}$-norm.

Taking here $r=1$ and $p=2$, we conclude that

$\mathcal F$ is the weak $L^2$ space $L^{2,w}$.

Let us also provide a direct proof of the latter statement. Recall that
\begin{equation*}
 L^{2,w}=\Big\{f\in L^0(\Om)\colon\;\exists C\in(0,\infty)\ \forall t\in(0,\infty)\  P_f(t)\le C/t^2\Big\},
\end{equation*}
where $$P_f(t):=\big|[|f|>t]\big|$$ and $[|f|>t]:=\{x\in\Om\colon|f(x)|>t\}$.
On the other hand, as was shown in my other answer on this web page,
\begin{equation*}
\F=\Big\{f\in L^1(\Om)\colon\;\exists C\in(0,\infty)\ \forall t\in(0,\infty)\,\int_{[|f|>t]}|f|\le C\sqrt{P_f(t)}\Big\}. \tag{0}
\end{equation*}
Take any $f\in L^0(\Om)$ and any $t\in(0,\infty)$. Then
\begin{align*}
 \int_{[|f|>t]}|f|&=\int_\Om 1_{[|f|>t]}\,|f| \\
 &=\int_\Om 1_{[|f|>t]}\int_0^\infty ds\,1_{[|f|>s]} \\
 &=\int_0^\infty ds\,\int_\Om 1_{[|f|>t]}1_{[|f|>s]} \\
 &=\int_0^t ds\,\int_\Om 1_{[|f|>t]}
 + \int_t^\infty ds\,\int_\Om 1_{[|f|>s]} \\
 &=tP_f(t) + \int_t^\infty ds\,P_f(s). \tag{1}
\end{align*}
If now $f\in\F$ then, by (1),
\begin{equation*}
 tP_f(t)\le \int_{[|f|>t]}|f|\le C\sqrt{P_f(t)},
\end{equation*}
so that $P_f(t)\le C^2/t^2$ and hence $f\in L^{2,w}$. Thus,
\begin{equation*}
 \F\subseteq L^{2,w}. \tag{2}
\end{equation*}
To prove that $\F\supseteq L^{2,w}$, take any $f\in L^{2,w}$, so that
\begin{equation*}
 P(t):=P_f(t)\le C/t^2 \tag{3}
\end{equation*}
for some real $C>0$ and all real $t>0$. The function $P$ is nonincreasing and right-continuous on $(0,\infty)$, with $P(\infty-)=0$. Consider the generalized inverse $P^{-1}$ of $P$ given by the formula
\begin{equation*}
 t_u:=P^{-1}(u):=\inf\{s\ge0\colon P(s)\le u\}=\min\{s\ge0\colon P(s)\le u\}
\end{equation*}
for $u\in(0,P(0))$. Then for all real $s\ge0$ and all $u\in(0,P(0))$ we have
\begin{equation*}
 s<t_u\iff u<P(s). \tag{4}
\end{equation*}
So, for any real $t>0$
\begin{align*}
 \int_t^\infty ds\,P_f(s)&=\int_t^\infty ds\,\int_0^{P(s)}du \\
 &=\int_0^{P(t)}du \int_t^{t_u} ds\,\\
 &=\int_0^{P(t)}du\, (t_u-t)\,\\
 &\le\int_0^{P(t)}du\,t_u.
\end{align*}
By (3), for any real $u>0$ we have $P(\sqrt{C/u})\le u$, whence, by (4), $t_u\le\sqrt{C/u}$. Now the latter multi-line display yields
\begin{equation*}
 \int_t^\infty ds\,P_f(s)\le2\sqrt C\,\sqrt{P_f(t)}.
\end{equation*}
Also, (3) is obviously equivalent to $tP_f(t)\le\sqrt C\,\sqrt{P_f(t)}$.
So, by (1),
\begin{align*}
 \int_{[|f|>t]}|f|\le3\sqrt C\,\sqrt{P_f(t)},
\end{align*}
so that, by (0), $f\in\F$.
Thus, indeed $\F\supseteq L^{2,w}$. Now (2) yields
\begin{equation*}
 \F=L^{2,w},
\end{equation*}
as claimed.

A: $\newcommand{\F}{\mathcal F}\newcommand{\Om}{\Omega}$Take any $f\in L^2(\Om)$. Then for any measurable subset $U$ of $\Om$, by Hölder's inequality we have
$$\int_U|f|\le\|f\|_{L^2(\Om)}|U|^{1/2},
$$
so that $f\in\F$. Thus, $\F\supseteq L^2(\Om)$, as you noted.
The purpose of this partial answer is to show that $\F\not\subseteq L^2(\Om)$. Indeed, let $\Om=(0,1)$ and $f(x)=1/\sqrt x$ for $x\in\Om$. Take any measurable subset $U$ of $\Om$ with $u:=|U|\ne0$, so that $u\in(0,1]$. Let $U_t:=\{x\in\Om\colon f(x)>t\}=(0,u)$, where $t:=1/u^2>0$. Then
$$\int_U|f|-\int_{U_t}|f|=\int_U f-\int_{U_t}f
=\int_{U\setminus U_t} f-\int_{U_t\setminus U}f
\le\int_{U\setminus U_t}t-\int_{U_t\setminus U}t=0.
$$
So,
$$\int_U|f|\le\int_{U_t}|f|=\int_0^u\frac{dx}{\sqrt x}=2\sqrt u=2\sqrt{|U|},
$$
so that $f\in\F$. However, $f\notin L^2(\Om)$.

It also follows from the above reasoning that (generally, for any $\Om$)
$$\F=\Big\{f\in L^1(\Om)\colon\;\exists C\in(0,\infty)\ \forall t\in(0,\infty)\,\int_{[|f|>t]}|f|\le C\big|[|f|>t]\big|^{1/2}\Big\},
$$
where $[|f|>t]:=\{x\in\Om\colon|f(x)|>t\}$. That is, in the definition of $\F$, instead of arbitrary open or, equivalently, arbitrary measurable subsets $U$ of $\Om$, one may consider the subsets of $\Om$ of the special form $[|f|>t]$.