Menu fixo se esconde mesmo com z-index

Question: Tenho o seguinte código:

   <meta charset=utf-8/>
   <title>
    Inicio
   </title>

        <input type=text style=width:100%;/>

Lorem ipsum ... dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

{{ Alguma }}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Pois bem, é um menu  fixo no topo. No entanto, quando o conteúdo da div id=conteúdo passa pelo menu, sempre passa por cima, escondendo os ícones.
Answer: Está correto o comportamento do conteúdo, de acordo com seu CSS ele deve vir por cima do menu.
Por padrão o z-index dos elementos é zero, e a ordem de renderização quando os valores "empatam" é desenhar primeiro o pai, e sobre este, o elemento filho.
Quando você quer mover um elemento para cima (mais "perto do usuário") de outro, deve usar um z-index maior que o elemento que vai ficar oculto/encoberto.
Fica mais confuso quando o z-index trata de elementos em "galhos" diferentes de hierarquia, o que não é seu caso, as divs estão no mesmo nível.
Quem quiser se aprofundar mais nos "contextos de empilhamento", use este link e leia esta resposta.
Analisando seu problema específico:
Acontece que no seu CSS o conteúdo tem z-index:3:
#conteudo{
   position:absolute;
   text-align:justify;
   width:100%;
   z-index:3;        /* <------- */
   margin-top:3em;
   margin-left:3em;
   margin-right:1em;

... e o menu z-index:1 :
#menu{
   position:fixed;
   z-index:1;        /* <------- */
   width:100%;
}

...portanto o menu deve ficar atrás do conteúdo.
A solução:
Se deseja o #menu encobrindo o #conteudo, precisa que este o primeiro tenha um z-index maior que o último.
Ou seja:
#menu{
   position:fixed;
   z-index:4;        /* <------- maior que o 3 do #menu */
   width:100%;
}

Poderia eventualmente deixar o conteúdo sem z-index, mas aí pode começar a bagunçar outras partes do projeto.
Demonstração:
Clique no "executar" abaixo para ver o CSS em funcionamento. Aproveitando, vale dizer que precisa dar uma arrumada no seu código, pois tem muitas coisas sem aspas, e tags XML misturadas com HTML (fechadas com />).

      <meta charset="utf-8">
      <title>
         Inicio
      </title>

         <input type="text" style="width:100%">

Lorem ipsum ... dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum ... dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum ... dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum ... dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Lorem ipsum ... dolor sit amet, consectetur adipiscing elit. Nullam ac semper est. Donec sit amet justo nec nibh pulvinar gravida sed nec nulla. Vestibulum nec porttitor enim, ut ultrices erat. Nam ut sapien ac dui luctus fermentum ut tristique eros. Vivamus condimentum odio massa, eget congue metus tincidunt id. Pellentesque consectetur lacus nec gravida fringilla. Nulla facilisi. Nunc ac turpis tristique, suscipit orci non, blandit sapien. Phasellus ut lectus id est venenatis scelerisque. Quisque dictum id metus sed molestie. Curabitur elit nisl, congue finibus dui vitae, eleifend rutrum nulla. Vestibulum vitae nibh ac orci feugiat malesuada. Aliquam leo mi, volutpat quis ex quis, consectetur blandit arcu. Praesent diam quam, ullamcorper pulvinar cursus tincidunt, elementum eu lectus. Nunc in elit malesuada quam varius condimentum sit amet sed lacus. In sagittis turpis quis quam pulvinar dictum.

Morbi sed diam sed turpis tempus condimentum id laoreet dolor. Quisque pretium, nisi quis pretium varius, metus ante efficitur dolor, eget pharetra enim leo quis mauris. Integer suscipit elementum quam, eu viverra odio dictum quis. Cras justo dui, elementum quis rhoncus rhoncus, semper ut dui. Pellentesque non ullamcorper augue. In ornare, sapien quis dignissim ultrices, ante nunc auctor purus, et sollicitudin risus lorem vel erat. Sed iaculis pharetra purus.

Maecenas et consequat neque. Proin a eros nisl. Nullam a arcu urna. Sed odio libero, auctor a consequat vel, efficitur vel tellus. Morbi efficitur nisi ut fringilla vulputate. Mauris neque sapien, venenatis eu velit a, porta tincidunt orci. Praesent commodo egestas dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed bibendum gravida nulla. Integer vitae efficitur lectus. Integer ac sapien purus. Donec vulputate leo id risus lobortis, molestie pretium magna ullamcorper. Sed efficitur placerat enim, sit amet vehicula ex tempor sed. Nam finibus feugiat arcu, sed venenatis tellus facilisis vitae.

Integer tincidunt, nisi luctus tincidunt interdum, erat risus mattis odio, at ultricies velit ex at erat. Nunc vitae enim ac orci vestibulum semper. Suspendisse pulvinar dolor nisi, et vulputate nisl volutpat non. Quisque ac leo vitae dui ornare porta. Aliquam erat volutpat. Nulla facilisi. Praesent congue nisl varius metus facilisis, id mattis quam euismod. Mauris vestibulum turpis ut lacus lobortis, in ultrices odio bibendum. Phasellus eu pellentesque tellus. Nulla vitae ligula non ante faucibus volutpat a mattis odio. Mauris erat nibh, mollis ac mauris quis, dignissim auctor orci. Nullam accumsan nibh vel augue ornare, quis cursus leo finibus. Morbi vel ante a sem feugiat mollis quis condimentum odio.

Vivamus vitae maximus leo, sed pretium urna. Curabitur congue dapibus nibh id tincidunt. Integer sed velit in mi consequat varius. Cras sed sagittis lectus. Sed sed sapien non nisl bibendum laoreet et eget risus. Fusce sem lectus, fringilla sit amet nisi nec, cursus efficitur sem. In hendrerit quis quam eu tristique. Sed nec posuere sem, vel placerat ligula. Phasellus tristique facilisis sodales. Sed eget tortor placerat libero feugiat pulvinar sit amet quis metus. Phasellus fermentum pharetra nulla sed lacinia.

Menu fixo se esconde mesmo com z-index


Hierarchical labelling for independent variable in training data

Question: I have data where the objective is to use supervised learning to predict 4 different outcomes.
Say the classes are 1, 2, 3, 4. Though discrete, they are also hierarchical, where class 2 is of an extreme 'nature' than say class 1.
My question is how do I redefine the label column in such a way that it incorporates the hierarchical/weighting nature of the label classes?
I tried to redefine the label space into a (0,1) space where I can the map the classes to 1, 0.3,0.67 and 1 in in the space. This way, the problem becomes a regression problem. Is this a feasible route?
Another route is to fashion it as a straight multi-label problem but this does not reflect the hierarchical nature of the label.
I've had a look at How to conduct a multilevel model/regression for panel data in Python? but not much headway.
Suggestions on how to address the problem are welcome.
Answer: I saw a research paper "The Synthetic Data Vault: Generative Modeling for Relational Databases" that assisted with the definition of the label feature.
It suggested the following:

Sort the categories from most frequently occurring to least.

Split the interval [0, 1] into sections based on the cumulative probability for each category.

To convert a category, find the interval [, ] ∈ [0, 1] that corresponds to the category.

Chose value between and by sampling from a truncated Gaussian distribution with at the center of the interval, and = (−)/ 6 .

This way, I'm able to redefine into the (0,1) space but also consider the weighting of each class in the definition.


DBPedia spotlight docker returning curl: (56) Recv failure: Connection reset by peer

Question: I'm trying to set a local dbpedia spotlight server with the docker image by calling:
sudo docker run -i -p 2222:80 dbpedia/spotlight-english spotlight.sh

the image runs and I get this when prompting sudo docker ps:
CONTAINER ID        IMAGE                       COMMAND             CREATED              STATUS              PORTS                  NAMES
02282289ae64        dbpedia/spotlight-english   "/bin/sh"           About a minute ago   Up About a minute   0.0.0.0:2222->80/tcp   sleepy_meninsky

but when I send a simple request as:
curl http://0.0.0.0:2222/rest/annotate?text=COOPER+Has+the+FBI+said+anything+about+a+reward+or+anything+%5C%3F+Because+there+was+that+there+was+a+reward+for+finding+her&confidence=0.5

or even one with a header set:
curl -X POST http://localhost:2222/rest/annotate -H 'accept: application/json' -H 'content-type: application/x-www-form-urlencoded' --data-urlencode "text=President Obama called Wednesday on Congress to extend a tax break for students included in last year's economic stimulus package, arguing that the policy provides more generous assistance" --data-urlencode "confidence=0.35"

I get the same error:
curl: (56) Recv failure: Connection reset by peer

Can anyone help? Is this related to the need for sudo when I run docker?
Thank you for you time and attention.
Answer: Checking Spotlight's Dockerfile at https://github.com/dbpedia-spotlight/spotlight-docker/blob/master/v1.0/english/Dockerfile, it hasn't an entry-point configured.
Please add spotlight.sh at the end of your docker command like:

docker run -d -p 2222:80 dbpedia/spotlight-english spotlight.sh

Also, maybe you want to run it as a service using -d parameter instead of interactive mode -i.
All the best,
Comment: thanks for the -d flag, it does help :) but i still get the same errors when I add spotlight.sh at the end...
Answer: Thanks to Sandro for pointing out the need to run spotlight.sh when running the docker and also for the very useful -d flag, but what made the docker work and stop returning the curl error 56 was the --restart unless-stopped flag indicated as needed here
Running this work for me:
sudo docker run -itd --restart unless-stopped -p 2222:80 dbpedia/spotlight-english spotlight.sh

Apparently, if that flag is off, the docker goes down. I've personally haven't observed that behavior on the ubuntu 18.04 I was running this through ssh, but when I've decided to install the docker locally on a mac machine, the image wouldn't stay running for longer than a minute. Adding this flag made the spotlight requests work on both environments.
Hope this helps someone else facing the same problem.


Dialog Window Gets Lost Behind Other Windows

Question: I'm new to WPF so this is probably a pretty easy problem.  I open a dialog window using ShowDialog().  Then, if I click into another window that's fullscreen or just covers my dialog, it's difficult to get back to the dialog.  The icon that shows up in the taskbar takes me back to the main WPF window but the dialog stays hidden behind the other window.  I either have to minimize the blocking window or Alt-Tab back into my application (which will show the dialog but leave the main window hidden).
The definition for the window looks like:
<Window x:Class="MyProject.MyWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        ResizeMode="CanResizeWithGrip"
        ShowInTaskbar="False"
        WindowStartupLocation="CenterOwner"
        Width="750"
        Height="565"
        Title="MyWindow">

I'm opening it like:
var dlg = new MyWindow();
if (dlg.ShowDialog() != true)
    return;

Answer: You should set the owner of your dialog window. Something like this.
var dlg = new MyWindow();
dlg.Owner = this;
if (dlg.ShowDialog() != true)
    return;

Comment: Is there any way that's more automated? Passing it as a parameter could be one, but there might be a better one?


Do not show a drop down menu until there's at least one character on the select box

Question: I have been using the select 2 jquery plugin by including the "select2-rails" gem.
The only changes I did to make it work is to just initialise the plugin when the html page loads:

Then I assigned the e2 value to my select_tag input in the view file:
<%= select_tag :skills, options_for_select(Skill.all.collect{|e| [e.name,e.id]}, @skills), {:id => 'e2', :multiple => true } %>

When the user clicks on the input it automatically shows a drop down list with options for the user to choose from. I thought that it will be way better if the user started typing first before the drop down list would appear (as the Chrome browser).
I checked the documentation and did not find anything that would be helpful for that. I am sure there must be something I am missing. Any idea?
Answer: You can accomplish that by using the option minimumInputLength, like this:


Selecionar registros de uma tabela onde o registro de uma tabela relacionada seja um valor específico

Question: Tenho uma tabela de chamados técnicos e uma tabela de atendimentos.
Cada 'CHAMADO' possui vários 'ATENDIMENTOS' e é nos atendimentos que fica o campo que define o status do chamado (Aberto, Fechado, Em andamento, Suspenso, etc...)
Atualmente, quando preciso listar apenas chamados abertos, eu estou buscando TODOS os chamados e pra cada chamado eu faço uma nova consulta verificando se o ultimo atendimento é fechado ou não. Essa pratica não é correta.
Como posso, numa query só, buscar apenas os chamados nos quais os ultimo atendimento não seja FECHADO?
Comment: Quais são seus campos de relação de tabela? atendimento nº 5 do chamado º 45
Answer: Sem a definição de suas tabelas pode-se apenas sugerir um caminho para a solução. Algo do tipo:
SELECT chamados.* FROM chamados
WHERE NOT EXISTS (SELECT * FROM atendimentos WHERE atendimentos.cliente = chamados.cliente AND atendimentos.status = 'Fechado';

Answer: Utilize o inner join.
SELECT c.* FROM chamados c INNER JOIN atendimentos a USING(id_chamado) WHERE a.status <> "Fechado";

No caso acima, nas duas tabelas tem que existir o campo "id_chamado" ou o campo que utilizas para fazer a ligação entre as duas tabelas.
Answer: http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
/\ teoria sobre todos os joins.
usando :
select campos
from tabelapai
inner join tabelafilha
on tabelapai.campo = tabelafilha.campo
and tabelapai.campo = tabelafilha.campo
where tabelapai.campo = xx
  and tabelapai.campo = yy;

você esta passando 1 comando ao MySQL "selecione campos da tabelapai E ADICIONE A TABELA FILHA quando campos da tabela pai e filha forem iguais ( chaves de identificação ), ONDE O CAMPO DA TABELA PAI SEJA X)
select chamados.dados, atendimentos.dados(atendimentos.situacao,chamados.cliente)
from chamados
INNER JOIN atendimentos
ON atendimentos.codigo_chamado = chamados.codigo_chamado;
WHERE chamados.situacao = x ;

Basta alterar para o código que bem entender, fácil de entender, recomendo a leitura para diferentes tipos de JOIN ( eu usaria leftjoin no seu caso para trazer APENAS os chamados que possuem situação fechada MAS NÃO DEIXAR DE TRAZER CHAMADOS QUE ESTEJAM SEM SITUAÇÃO ALGUMA).


Gravar somente um campo no banco de dados

Question: Como faço pra gravar somente um dos campos desse select?
Statement stmt = con.createStatement();
ResultSet RS = null;
RS = stmt.executeQuery("select codplpag, descricao from pcplpag ORDER BY 1,2");

while(RS.next()){
    //  ListaBox.addItem(RS.getString("codplpag")+" / " + RS.getString("descricao"));
    ListaBox.addItem(RS.getString("codplpag" )+" / " + RS.getString("descricao"));
}

Update:
int registro = stmt.executeUpdate("update pcpedc set codplpag =" +ListaBox.getSelectedItem().toString()+
                    "where numped=" + consPCPEDC);

Comment: Falta um espaço antes do WHERE, será que é só isso?
Comment: pior que não @bfavaretto, ele me traz o item selecionado e tudo mais, amis quando eu boto pra salvar ele salva a descrição junto com o numero "codplpag"+ a descrição "descricao" ai ele da erro
Comment: A melhor coisa que você pode fazer é usar `PreparedStatement` e evitar criar sua *query* concatenando variáveis.
Comment: Meu conselho seria não usar duas informações distintas como um item do `ListBox`. Mas se quiser insistir nisso você teria que separar os dois dados para usar só o que interessa. Esse `codplpag` tem tamanho fixo garantido? Qual é?
Comment: tem o tamanho de 2 campos
Comment: como eu faço pra separar os dados?
Comment: Você pode obter uma substring do item selecionado, pegando os primeiros caracteres ou contando com o separador que você usou (" / "). Mas pode ficar melhor que isso. Qual é o tipo/classe de `ListaBox`?
Comment: O que é tamanho de 2 campos? Seria 2 caracteres?
Answer: Eu recomendaria você não juntar duas informações em um item do ListBox. Mas se quer insistir nisto dá para ter uma solução.
Se não souber o tamanho do campo pode fazer isto:
String codPlPag = ListaBox.getSelectedItem().toString();
int posicaoBarra = codPlPag.indexOf(" /");
if(posicaoBarra != -1){
    int registro = stmt.executeUpdate("update pcpedc set codplpag ='" +
                       codPlPag.substring(0, posicaoBarra) + "' where numped=" + consPCPEDC);
} else {
    //deu erro
}

Tentei pegar só a parte que interessa e arrumei o problema da falta de aspas e falta de espaço antes do where denunciado pelo bfavaretto.
Tenho minhas dúvidas se o consPCPEDC também não precisa de aspas. Em condições normais deveria.
Se souber o tamanho, se for 2 caracteres garantido, pode fazer mais simples:
String codPlPag = ListaBox.getSelectedItem().toString();
int registro = stmt.executeUpdate("update pcpedc set codplpag ='" +
                       codPlPag.substring(0, 2) + "' where numped=" + consPCPEDC);

Coloquei no GitHub para referência futura.
Note que isto que está fazendo é perigoso e inseguro, não faça.
Comment: cara muito bom eu realmente ia ficar morrendo nesse treco muito obrigado. abraço


The condition $\det(I)=1$, and the uniqueness of the determinant

Question: The third condition for the definition of a determinant is given as $\det(I)=1$ (multi-linear and alternating are the first two conditions). Why is this important? Does it relate to the uniqueness of the determinant? What exactly is meant by uniqueness?
Answer: It is necessary to have $\det(I)=1$ in order for $\det$ to be not totally trivial ($0$ for every matrix) and still satisfy the property $\det(AB)=\det(A)\det(B)$. Observe that if $\det(I)=a$ for some number $a\neq 0,1$, then
$$\det(I^2)=\det(I)=a\neq a^2=\det(I)\det(I)$$
The property $\det(AB)=\det(A)\det(B)$ is extremely important, both theoretically (it makes the function $\det:\mathrm{GL}_n(K)\to K^\times$ a group homomorphism) and computationally.
With regards to your question about uniqueness: one common way of defining the determinant (which it sounds like is the way it's the way you're using) is to first propose considering functions $f:\mathrm{M}_{n\times n}(K)\to K$ that are (a) multilinear, (b) alternating, and (c) have $f(I)=1$; and then showing that in fact there is a unique such function, and we give that function the name "determinant".
Comment: Thanks for the explanation Zev! Is it then this property that is then referred to as uniqueness.


Alternative formula for the Bernoulli pmf?

Question: If I understand correctly, a Bernoulli pmf just needs to assign a probability $p$ if there is a success $(x=1)$, and $1-p$ otherwise $(x = 0)$. Rather than the usual formula, can't the following function also satisfy this condition and represent a the pmf of a Bernoulli RV?
$
f(x) = xp + (1-x)(1-p).
$
So if $f(x=1) = p, f(x=0) = 1-p.$
What would be wrong in formulating it this way?
Comment: In fact you can go with $p^x(1-p) ^{1-x}.$ There is nothing wrong in writing like that.
Comment: There's nothing wrong with this. In fact, you'll often see the log-likelihood of logistic regression (with binary outcomes) written as [the log of what you describe](https://en.wikipedia.org/wiki/Cross_entropy#Cross-entropy_loss_function_and_logistic_regression).
Comment: It is also important to state along with the formula that $x \in {0,1}$. The formula is a simplification of $$f(x)=\begin{cases} p & \text{if $x=1$} \\
                   1-p & \text{if $x=0$}
      \end{cases}$$ and for that case the support is less ambiguous (actually, it can still be ambiguous, but it is conventional to leave out the 'else f(x) = 0 cases').
Comment: Steve, could you tell why you think it is wrong?
Comment: The formulation in the comment by @User1865345 is far more useful for working with likelihoods.
Comment: I prefer
$$f(x) = p  \sin\left( \frac{x\pi}{2} \right) + (1-p)  \cos\left( \frac{x\pi}{2} \right) $$
Comment: The trouble with writing $f(x) = xp + (1-x)(1-p)$ is that it makes it look like $f$ is a continuous function of the real numbers, with nonzero values for $x$ in the interval $(0,1)$. The density function of a Bernouilli variable needs to either not be defined, or be equal to 0, where $x$ is not $0$ or $1$.
Comment: The reason I am questioning it is just because it is not the usual derivation, rather the x and 1-x in  the exponents are what are typically used. So I guess I assumed the reason we dont see it the way I wrote it is because there is something I am missing - like it violates a property of probabilities or some sort.
Answer: There's nothing wrong with it as it evaluates the values, it should evaluate. The usual formulation however uses powers so it becomes a case of binomial distribution with $n=1$ sample size. Recall that the probability mass function of binomial distribution is
$$
{n \choose x} \,p^x (1-p)^{n-x}
$$
Where we have $n$ independent Bernoulli distributed with $x$ successes observed, hence $p^x$, and $n-x$ failures. The ${n \choose x}$ corrects for the fact that we want to account for the successes and failures appearing in any possible combination. With $n=1$ and $x \in \{0,1\}$ it reduces to Bernoulli distribution formulated with the powers
$$
\,p^x (1-p)^{1-x}
$$
Answer: Your alternative form is often written braced form as
$$
f(x)=\begin{cases} p & \text{if $x=1$} \\
                   1-p & \text{if $x=0$}
      \end{cases} $$
and there is nothing wrong with that. It might be useful, for instance, for programming and for elementary exposition.
But if you want to do any form of algebra or calculus, it is inconvenient, so the other form is preferred. But both forms are equally valid, it is only a pragmatic question of what works best for whatever you are doing with it.
Comment: And $f(x)=0$ otherwise.
Answer: This is fine, assuming that the domain of $f$ is $\{0,1\}$.
This is also true of the formulations in the other answers.
A different formulation involving the Iverson bracket is
\begin{align*}
f(x) = (1-p)[x=0]+p[x=1].\tag{1}
\end{align*}
One defines
\begin{align*}
[P] &= \begin{cases}
1, & \textrm{if $P$ is true}, \\
0, & \textrm{else.}
\end{cases}
\end{align*}
The Iverson bracket has many interesting algebraic properties that capture the logic of the statement $P$. One interesting difference with formulation (1) is that the domain of $f$ can be thought of as all of $\mathbb{Z}$ (or indeed all of $\mathbb{R}$).
This allows one to be loose with notation in a way that is totally rigorous.
For example, the expected value of $g(x)$ is
$$\sum_x g(x)f(x),$$
where the sum is typically understood to be over all of $\mathbb{Z}$, with the result
$$g(0)(1-p) + g(1)p.$$


Disable Grails Spring Security Plugin

Question: I am a newbie on Grails. I installed Spring Security plugin but I would like to disable temporarily. What is the most simplistic way to disable this plugin (or any other Grails plugin).
Comment: there is no generic answer for **all** grails plugins, but to comment out the plugin in the `BuildConfig`, rebuild and hope the best. Some like Spring Security had the foresight to include a killswitch.
Answer: The plugin has an active config property that you can use for this, e.g.
grails.plugin.springsecurity.active = false

Read the fine manual for more info.
Comment: Could you point me towards a resource, or explain, why cfrick's comment/answer is _totally_ ineffectual?

Disable Grails Spring Security Plugin


How to write a form using Bootstrap 4 without affecting the background of the body?

Question: I am using Bootstrap 4 in order to style my website but the problem is that I already have a CSS file that includes the background color and image in the background, and after I link the bootstrap 4 it ruins the style and the background becomes white like the original background is hidden.
How can I create a form without affecting the background of it?
In the image below, the original background color was skyblue but once I include the Bootstrap link it partially overrides the color.
Answer: maybe you can show some of your code. here an example of the bootstrap form that i put inside a container. and the Codepen link is available below if you want take a look:

<form>

      Email
      <input type="email" class="form-control" id="inputEmail4" placeholder="Email">

      Password
      <input type="password" class="form-control" id="inputPassword4" placeholder="Password">

      City
      <input type="text" class="form-control" id="inputCity">

      State
      <select id="inputState" class="form-control">
        <option selected>Choose...</option>
        <option>...</option>
      </select>

      Zip
      <input type="text" class="form-control" id="inputZip">

      <input class="form-check-input" type="checkbox" id="gridCheck">

        Check me out

  <button type="submit" class="btn btn-primary">Sign in</button>
</form>

Here an example Bootstrap form on sky blue background
Comment: this is not what i am asking for . thank you for your time


Verify $E(n)=\{(A,x)\mid A\in O(n)$ and $x\in \Bbb R^n\}$

Question: Verify that $E(n)=\{(A,x)\mid A\in O(n)$ and $x\in \Bbb R^n\}$.
Ok, What does $E(n)$ mean?? I have looked all through my text book and I have found nothing, I have also searched google for an extensive amount of time.
Can someone help me understand what it is asking?? I understand what is stated inside the brackets : $E(n)=\{(A,x)\mid A\in O(n)$ and $x\in \Bbb R^n\}$ where $A$ is Orthogonal and $x$ is in the Reals. What is $E(n)$???
Comment: With the help of @stressed-out, here is a [link](https://en.wikipedia.org/wiki/Euclidean_group).
Answer: $E(n)$ is the group of rigid motions in the Euclidean geometry. Namely, translations, rotations and reflections and combinations of these basic geometric rigid motions. The Euclidean geometry here is thought to be the study of the group of transformations that preserve the Euclidean inner product (metric) on $\mathbb{R}^n$: $\langle \vec{x}, \vec{y} \rangle=x_1y_1+\cdots+x_ny_n$
First, show that any inner product preserving linear transformation in the $n$-dimensional Euclidean space has to be an orthogonal transformation (of course, done at the origin because it's a linear transformation). Then see how every transformation in the plane can be done by first a translation to the origin, then applying a rotation/reflection and then translating back. It's a regular exercise. You need to know about semi-direct products and normal groups too, I guess. At least, in the approach I know, you need to show that $E(n)$ is the semi-direct product of translations with orthogonal transformations. Then you can show that any transformation in this group can be represented by an $(n+1)\times(n+1)$ matrix and $(n+1)$-dimensional vector of the form $(x_1,\cdots,x_n,1)$
You can learn about all of the mentioned material in the video lectures of the Abstract Algebra class taught at Harvard by Benedict Gross which is available for free here. You can also read more about this stuff in Michael Artin's Abstract Algebra which is the main reference book for the course.


Why can we calculate trigonometric limits by substitution?

Question: I have always wondered why something like these $\displaystyle \lim_{x\to 0} \sin x=0$ and $\displaystyle \lim_{x\to 0} \cos x=1$ are true.
Why should this happen?
Can anyone explain this to me with rigor?
Thanks.
Comment: How does the title matches the main content? What do you mean by "substitution"? Like, "just substitute" zero? This happens because both $\sin$ and $\cos$ are [continuous functions](http://en.wikipedia.org/wiki/Continuous_function).
Comment: How do you define $\sin$ and $\cos$? The limits are trivial if you use the power series definition.
Comment: I don't quite know.
Comment: As Ian said, the direct substitution property applies on them as they are continuous functions. If you want to rigorously prove that they are uniformly continuous, this may help: http://math.stackexchange.com/questions/268758/prove-sin-x-is-uniformly-continuous-on-mathbb-r
Answer: The fact that $\sin x\to 0$ is easily seen geometrically if you know the statement: "The shortest curve from the point $(x,y)$ to the $x$ axis is of length $|y|$."
This can be used to show that $|\sin x|\leq |x|$, since the arc of the circle from $(\cos x,\sin x)$ to the point $(1,0)$ if length $|x|$ is a path to the $x$-axis, and that has to be at larger than $|\sin x|$. This in turn shows that $\sin x\to 0$ as $x\to 0$.
For $\cos x$, use $\cos^2 x + \sin^2 x = 1$ and that $\cos x$ is positive for $x$ small. Since $\sin x\to 0$, we have $\cos ^2 x\to 1$. Since $\cos x$ is positive for small $x$, this means that $\cos x\to 1$.
Comment: can you please comment on my writeup ?
Answer: For the first limit, it follows from inequality $|\sin x|\leq| x|$  as you can deduce by a geometric argument on the unit circle.
The second limit will follows from the first since $\cos x=\sqrt {1-\sin^2 x} $ in a neightborhood of 0.
Answer: Let me try to answer this question myself with the hints given above.
Theorem: $\sin x$ is continuous on $\mathbb{R}$
Proof: For a circle of radius 1, the length of the circumference is $2\pi$ and so the length of the arc subtended by the angle $x$ is $\displaystyle \frac{2\pi}{2\pi}x=x$. $|x|\ge |\sin x|$ as evident from the diagram.
For $\sin x$ to be continuous on $\mathbb{R}$,we need to show that for $a\in \mathbb{R}$, given $\epsilon>0 \exists , \delta>0:|x-a|<\delta\implies |\sin x-\sin a|<\epsilon$.
$$|\sin x-\sin a|=|2\sin\frac{x-a}{2}\cos\frac{x+a}{2}|\leq |2\sin\frac{x-a}{2}|\leq|2\frac{x-a}{2}| $$ uing the above result.
Take $\delta=\epsilon$.
QED.
Using this,$$\lim_{x\to 0}\sin x=0$$
Is my answer correct?
Comment: That works, but seems backwards to me. $|\sin x|\leq |x|$ can be used directly to show that $\lim_{x\to 0}\sin x = 0$. Then the general continuity follows from there.


Ansible: Run 1 task on 1 host under several users

Question: I have 1 VM, there are several applications on it. Each app is working under it's own user.
host:
– host1
users:
– app1
– app2

They have similar configuration files, the difference is in names and some sensitive data. So, is there any way to run 1 task for several users on 1 host with ansible in parallel.
smth like this.
inventory:
[webservers:children]
app1
app2

[app1]
127.0.0.1
[app2]
127.0.0.1

group_vars/app1/vars.yml:
---
app_user: app1
var2: value

group_vars/app2/vars.yml:
---
app_user: app2
var2: value

tasks/test.yml:
---
- hosts: webservers
  tasks:
  - name: Copy config
    become: true
    become_user: {{ app_user }}
    template: ....

So invoking task in this way, works only with first app. I understand that I can make a playbook for every app_user or write one playbook with sequence of tasks for each app_user, but is there a way how to do what I want?
Answer: I would try to create a role and call it multiple times giving there different variables (users).
---

- hosts: webservers
  roles:
    - common
    - { role: foo_app_instance, dir: '/opt/a',  app_port: 5000 }
    - { role: foo_app_instance, dir: '/opt/b',  app_port: 5001 }
Taken from here.
In this way you will reuse your code (if tasks are really similar).
Comment: yes, that's also a good idea. But it will not run roles in parallel. I think will use the solution in next comment. Put configs under root account, then change permissions for each user and then run restart commands separately.
Answer: That won't work, because:

Within any section, redefining a var will overwrite the previous instance. If multiple groups have the same variable, the last one loaded wins. If you define a variable twice in a play's vars: section, the 2nd one wins.

Ansible doc: playbooks_variables
In my understanding of the documentation app_user under group_vars/app2/vars.yml should overwrite app_user under group_vars/app1/vars.yml.
What should work would be to call each hostgroup in a separate play:
---
- hosts: app1
  tasks:
  - name: Copy config
    become: true
    become_user: {{ app_user }}
    template: ....

- hosts: app2
  tasks:
  - name: Copy config
    become: true
    become_user: {{ app_user }}
    template: ....

Also:
It is not necessary or a good practise to use becom_user for a template task. Use the template module like this:
---
- hosts: app1
  tasks:
  - name: Copy config
    template:
      src: template.j2
      dest: /some/remote/path
      owner: "{{ app_user }}"
      group: "{{ app_user }}"
      mode: 0755

Comment: hmm, i didn't think in that way))) thank you! I can put all configs under root and then change owner to app_user. Good idea.


Why does jslint prefer splitting variable declarations in javascript?

Question: Why does jslint suggest splitting variable declarations in JavaScript. Is there any benefit doing that? What I understood until today was both below option 1 and option 2 are same. What is the difference?
Option 1
var element1, element2;

Option 2
var element1,
var element2;

Comment: This is a style choice thing. If you have the option of using `const` (or `let`), consider those instead as they are block level so can be more tightly related to the logic which actually uses them. They also throw sane errors if you try to re-`const`/re-`let` something, rather than quietly permitting it.
Answer: These declarations are technically the same, and, really, a matter of preference. The difference comes from the human factor. jslint's rule prefers consistency and readability, especially for the long term of a project.
Consider the following code:
var variable1 = "value 1", variable2 = "value 2";

This doesn't look too bad, but even with two variables, its a bit harder to read than if the declarations were split over two lines.
Now imagine that the project grows over a few months, and the same line also grows accordingly:
var variable1 = "value 1", variable2 = "value 2", variable4 = "value 4",
    variable5 = "this";
var variable6 = "starts";
var variable7 = "to get", variable8 = "hard", variable9 = "to read";

Without any particular enforcement, developers can choose where to declare their variables however they want, which means that they could add them to an existing
declaration line, or add a new declaration. This choice is, generally, completely subjective. As demonstrated above, the code becomes increasingly harder to read compared to:
var variable1 = "value 1";
var variable2 = "value 2";
var variable4 = "value 4";
var variable5 = "this";
var variable6 = "starts";
var variable7 = "to get";
var variable8 = "hard";
var variable9 = "to read";

(I even made a mistake typing this answer out because I lost track of the variable numbers, and I only noticed when I split the declarations into lines.)
With this rule in place, developers don't need to think about whether variable declarations should be grouped and when to start a new declaration, which eliminates some mental burden and improves consistency across the codebase. Single-declarations-per-line also make it easier to move them around when needed, especially in editors with keybindings that cut and paste whole lines.
Ultimately, this is still a personal decision. We can disable the rule if desired. Choose the approach that works best for your project.
Answer: Other than readability and avoiding repetition, There is no actual practical advantage of one over another.
You will write less and clean code if you dont use multiple var statements but there is an interesting discussion about it in this article where they show some cases in which for instance you can forget to insert a comma and use
var element1
    element2;

which could cause the second variable to be declared globally due to automatic semi-colon insertion.
Although using a single var may be more error prone and impractical to maintain(e.g., indentation, moving the variable declaration to somewhere else in the code), I think it is a purely personal decision.


Mutliple async rest paginated calls using webclient and flux

Question: I need to call the rest paginated api using webclient and flux. I have tried in blocking way (one by one), but I want to make it parallel.Lets say 10 parallel calls at a time. Every call fetches 1000 records.
I am already calling the 0th request to get the total records count from the header.
After the completion of request I need to call POST api to sent this response (1000 records).
If any request completed then 11th request will be sent and so on.
I have already seen other examples of asyncRestTemplate and listenable futures but asyncRestTemplate is already deprecated and alternative is  spring-webflux
Also
As rest template is going to be deprecated
What I have done.

Divide the total-count/1000 -> gives the total pages
loop in till 5 ( if i change to totalpages count then its giving me 500 Internal server error)
call the service which returns the Mono>
subscribe each request

ObjectMapper objmapper = new ObjectMapper();

HttpHeaders headers = partsService.getHeaders();
long totalCount = Long.parseLong(headers.get("total-count").get(0));
log.info(totalCount);
long totalPages = (long) Math.ceil((double) totalCount / 1000);
log.info(totalPages);
// List<Mono<List<Parts>>> parts = new ArrayList<>();
for (long i = 1; i <= 5; i++) {
    partsService.fetchAllParts(1000L, i).log().subscribe(partList -> {
        try {
            // post each request response to another API
            log.info(objmapper.writeValueAsString(partList));
        } catch (JsonProcessingException ex) {
            ex.printStackTrace();
        }

    });
    log.info("Page Number:" + i);
}

I want to execute in parallel without any outOfmemoryerror and not to put much burden to calling api.
Also I have tried to fetch all the pages at once but I am getting 500 Internal server error.
I am new to Flux (project reactor)

Implemented below solution

Its not running parallel ,single request is taking ~2min time which means all 10(concurrency level) should complete at same time.
try {
        fetchTotalCount().log()
                .flatMapMany(totalCount -> createPageRange(totalCount, 1000)).log()
                .flatMap(pageNumber -> fetch(1000, pageNumber), 10).log()
                .flatMap(response -> create(response))
                .subscribe();

        } catch (Exception e) {
            e.printStackTrace();
        }

Logs

2019-07-29T09:00:14,477 INFO  [scheduling-1] r.u.Loggers$Slf4JLogger: request(10)
2019-07-29T09:00:14,478 INFO  [scheduling-1] r.u.Loggers$Slf4JLogger: request(10)
2019-07-29T09:00:14,479 INFO  [scheduling-1] r.u.Loggers$Slf4JLogger: request(unbounded)
2019-07-29T09:00:14,679 INFO  [scheduling-1] c.o.q.l.Logging: fetch() execution time: 546 ms
2019-07-29T09:00:17,028 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(74577)
2019-07-29T09:00:17,042 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(1)
2019-07-29T09:00:17,068 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,1) execution time: 24 ms
2019-07-29T09:00:17,078 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(2)
2019-07-29T09:00:17,080 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,2) execution time: 2 ms
2019-07-29T09:00:17,083 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(3)
2019-07-29T09:00:17,087 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,3) execution time: 2 ms
2019-07-29T09:00:17,096 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(4)
2019-07-29T09:00:17,098 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,4) execution time: 1 ms
2019-07-29T09:00:17,100 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(5)
2019-07-29T09:00:17,101 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,5) execution time: 1 ms
2019-07-29T09:00:17,103 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(6)
2019-07-29T09:00:17,106 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,6) execution time: 3 ms
2019-07-29T09:00:17,108 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(7)
2019-07-29T09:00:17,110 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,7) execution time: 2 ms
2019-07-29T09:00:17,113 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(8)
2019-07-29T09:00:17,115 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,8) execution time: 1 ms
2019-07-29T09:00:17,116 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(9)
2019-07-29T09:00:17,118 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,9) execution time: 1 ms
2019-07-29T09:00:17,119 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(10)
2019-07-29T09:00:17,121 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,10) execution time: 1 ms
2019-07-29T09:00:17,123 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onComplete()
2019-07-29T09:09:03,295 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-29T09:09:03,296 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(11)
2019-07-29T09:09:03,296 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,11) execution time: 0 ms
2019-07-29T09:09:03,730 INFO  [reactor-http-nio-1] c.o.q.s.Scheduler: 200 OK
2019-07-29T09:09:03,730 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-29T09:09:05,106 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(// data print)
2019-07-29T09:09:05,196 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-29T09:09:05,196 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(12)
2019-07-29T09:09:05,198 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,12) execution time: 1 ms
2019-07-29T09:09:05,466 INFO  [reactor-http-nio-1] c.o.q.s.Scheduler: 200 OK
2019-07-29T09:09:05,466 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-29T09:09:09,565 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(//  data print)
2019-07-29T09:09:09,730 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-29T09:09:09,730 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(13)
2019-07-29T09:09:09,731 INFO  [reactor-http-nio-1] c.o.q.l.Logging: fetch(1000,13) execution time: 0 ms
2019-07-29T09:09:10,049 INFO  [reactor-http-nio-1] c.o.q.s.Scheduler: 200 OK

Update

After correcting the calling API ,the records are coming but after getting the last page(75) i am getting the 404 Not found error.
2019-07-30T14:07:50,071 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(75)
2019-07-30T14:07:50,075 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onComplete()
2019-07-30T14:07:50,322 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(200 OK)
2019-07-30T14:07:50,323 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-30T14:07:51,973 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(//data)
2019-07-30T14:07:52,440 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(200 OK)
2019-07-30T14:07:52,440 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-30T14:07:54,522 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(//data)
2019-07-30T14:07:54,699 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(//data)
2019-07-30T14:07:55,075 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(200 OK)
2019-07-30T14:07:55,076 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-30T14:07:55,371 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onNext(200 OK)
2019-07-30T14:07:55,371 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: request(1)
2019-07-30T14:07:55,471 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: cancel()
2019-07-30T14:07:55,472 INFO  [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: cancel()
2019-07-30T14:07:55,473 ERROR [reactor-http-nio-1] r.u.Loggers$Slf4JLogger: onError(java.lang.Exception: 4XX received from API)
2019-07-30T14:07:55,473 ERROR [reactor-http-nio-1] r.u.Loggers$Slf4JLogger:
java.lang.Exception: 4XX received from API

Answer: Flux.flatMap has a parameter to set the concurrency level which lets you coordinate the parallelization.
In the below example I used dummy URLs, some fragments from your example and some additional simple code to demonstrate how you can achieve this:
public static void main(String[] args)
{
    fetchTotalCount()
            .flatMapMany(totalCount -> createPageRange(totalCount))
            .flatMap(pageNumber -> fetch(pageNumber), 5) // 5 is the concurrency level = how many pages we query concurrently
            .flatMap(response -> process(response))
            .subscribe();
}

private static Mono<Integer> fetchTotalCount()
{
    return webClient.get()
                    .uri("http://www.example.com/get-total-count")
                    .exchange()
                    .map(ClientResponse::headers)
                    .map(headers -> headers.asHttpHeaders().get("total-count").get(0))
                    .map(Integer::valueOf);
}

private static Flux<Integer> createPageRange(int totalCount)
{
    int totalPages = (int) Math.ceil((double) totalCount / 1000);

    return Flux.range(1, totalPages);
}

private static Mono<Response> fetch(int pageNumber)
{
    return webClient.get()
                    .uri("http://www.example.com/fetch?page=" + pageNumber)
                    .retrieve()
                    .bodyToMono(Response.class);
}

private static Mono<Response> process(Response response)
{
    // todo send other http request for the post api here
    return Mono.just(response);
}

private static class Response
{
}

Comment: thanks for the solution however i am getting the error `reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response`
Comment: version using spring-boot-starter-webflux":2.1.6.RELEASE
Comment: Did you get this error with your original version as well? You can check out this issue or open a new one: https://github.com/spring-projects/spring-framework/issues/22464
Comment: yea i have seen this ,and do the changes as per the suggestion ,its working .but its slow as 1 single request is taking ~2 mins ,then this means all 10(concurrency level) should complete at the same time ? if that's so then its not happening.
Comment: you could add some logs for the start of each request (doOnSubscribe operator) and completion of the request (one of doOnComplete or doOnNext operators ) and share them, maybe we can spot something
Comment: Checked. Is it possible that the service you call is slower than you expect? Based on the logs even the fastest request needs ~9 minutes to complete. Concurrency looks fine to me. Although, the code you shared doesn't contain all log statements.
Comment: thanks I am checking the calling API , i want to put the delay of 500ms while calling the GET API. how to delay the calling?
Comment: https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#delayElements-java.time.Duration-
Comment: i have added the logs, concurrency level is fine ,but after the last call i am getting the 404 not found
Comment: That doesn't look like a reactor specific error. Logging the URLs might help you.
Answer: Use the overloaded version of .flatMap() in which you can specify the concurrency level. Normally, .flatMap() subscribes eagerly to all the inner streams - it won't wait for any stream to complete before subscribing to the next one (unlike .concatMap()). But one you specify the concurrency level, it will subscribe only to that many inner streams eagerly at max (at once). In your case, the 11th inner stream will be subscribed to only when at least one of the initial 10 inner streams has finished. This solves exactly your problem.
Comment: which flat map you are talking about ? i have used suggested by @yossarian , but its taking time as single request is taking around < 2 mins ,which means all 10( concurrency level) should complete at the same time,and thats not happening
Comment: The overloaded flatmap should do what you want to. Needs further debugging. Can you use concatMap once and record how much time each request is taking? concatMap subscribes to only one inner stream at once, and waits for it to complete before subscribing to the next. This will help us in debugging.


Absolute convergence of a power of an absolutely convergent series

Question: If $\sum_{i\geq0}a_i$ converges absolutely, ie,
$$
\sum_{i\geq0}\vert a_i\vert<\infty,
$$
what about the series
$$
\sum_{i\geq0}b_i\ :=\left(\sum_{i\geq0}a_i\right)^p,\qquad p\in \mathbb{N},
$$
is it absolutely convergent?
I should prove that:
$$\sum_{i\geq0}\vert b_i\vert<\infty.$$The difficulty is that I can't write $b_i$ explicitly. Any help will be appreciated.
Comment: What series are you talking about. I don't understand your question.
Comment: $\sum b_i$  is it absolutely convergente?
Comment: Define $b_i$. I don't see the definition in your question.
Comment: I edited the question.
Comment: The question makes no sense. Tell us what the n-th term of your new series is.
Comment: The power of an absolutely convergent series is it an absolutely convergent series? This is my question. As regard to $b_i$ I can't define it.
Comment: Maybe you meant the following: given $\sum_{i\geq0}|a_i|<\infty$, then is $\left(\sum_{i\geq0}|a_i|^p\right)^{1/p}$ finite for all $p\in\mathbb{N}$? The answer to that question is yes, as far as I can remember from some standard summation inequalities (like Young's or Holder's)
Comment: @ RMWGNE96, no, I meant, the power of an absolutely convergent series is it an absolutely convergent series
Comment: The power is in the wrong place. You don't want to  calculate $\sum  a_i$ and then take the power.
Answer: I don't think this is a well-posed question.
The $b_i$ are not defined in terms of the $a_i$.
Since $\sum a_i$ exists, it is just a constant and can be raised to any power.
Then just define the $b_i$ so they sum to this.

(added after the question was edited)
The problem is that
the computation of the
$b_i$
is not specified -
only what
$\sum b_i$
is.
For example,
if you wrote
$\sum_{0 \le i \le n}b_i\
:=\left(\sum_{0 \le i \le n}a_i\right)^p
$
then we would know
how to compute the $b_i$
(in this case,
$b_n
=\left(\sum_{0 \le i \le n}a_i\right)^p-\left(\sum_{0 \le i \le n-1}a_i\right)^p
$)
and could try to
answer your question.
But,
until you specify
how to compute
each $b_i$,
there is nothing
we can do.
Comment: I edited the question.
Comment: Still not enough.
Answer: Since $\sum_{i\geq0}a_i$ converges, there is $s \in \mathbb R$ such that $\sum_{i\geq0}a_i=s.$ Thus
$$\left(\sum_{i\geq0}a_i\right)^p=s^p.$$
Comment: Yes, this is trivial. What about absolute convergence?


How to incorporate meaningful and purposeful technology into math lessons.

Question: A big part of today's learning is centered around technology. As a math teacher, I sometimes find it difficult to incorporate meaningful and purposeful technology into my lessons. Are there any things that you've tried in the past that you think would be beneficial or that you've felt has worked well? I am a teacher at the middle school and high school level, so I'm open to all suggestions.
Comment: We have a Mathematics Educators Stack Exchange.
Comment: I'm voting to close this question as off-topic because it is a far more appropriate post on [matheducators.se]
Answer: There are many many ways to do this.  How to do it depends on the level of math that you're teaching.  But looking at the Ted Talk by Dan Meyer is probably a great way to start:
https://www.ted.com/talks/dan_meyer_math_curriculum_makeover?language=en
My preference is to teach math with programming.  There are very simple things you can do.  Design a computer and have that computer perform a Taylor series calculation of sin(x), cos(x), exp(x).  Have your students find the roots of polynomials.  Have your students determine the minimum of interesting functions in several different ways.  Have your students solve linear systems.
Here is a website of a high school class teaching students to do some of those things:  http://nicholasdwork.com/teaching/si2016/session2/


How to rasterize svg to png without aliasing effect with "data:image/svg+xml" with Inkscape?

Question:
I have a problem while export svg to png with svg which includes some element image objects using Inkscape.
Example:
<image  xlink:href="data:image/svg+xml;base64,PD94bWwgdm....Zz4=" x="-312" y="-139" width="624" height="278"></image>

Notes:
- When I open svg in web browsers, when zoom in browser images are nice, and not have aliasing effect.
- But using Inkscape command : /Applications/Inkscape.app/Contents/Resources/bin/inkscape /test/test.svg -e /test/test.png -d 300 --> image is aliasing.
Here is result on browser and output png file:

Here is my files:
1. https://drive.google.com/open?id=1Wjt-QnX4iPL3QYHfYLI7wVfq26yBCe3e --> svg file which include  with svg data "data:image/svg+xml"
2. Exported png using inkscape with dpi 300
https://drive.google.com/open?id=1k171_ARwnw0-5iyM7vwJsH_h6tFWpb1v

Please help me!
Thank you!
Answer:
Use a raster file that uses the correct export dpi
Scale it to the correct size in Inkscape
Position it at a full pixel value

(untested, but should work)
In (future) Inkscape 1.0, you can also uncheck the antialiasing functionality in the export dialog, but not sure how that affects raster images. It might not look good.


Appending to CSS property

Question: The CSS animation property can be given a list of multiple animations.  I want to create a logical subclass in a CSS file that adds an animation to the logical superclass's list of animations.  Here's what I have, but I want to do this without duplicating the fade-in animation:
.enter, .enter-left, .enter-right, .enter-top, .enter-bottom {
  animation: fade-in 2s ease-out;
}

.enter-left {
  animation: fade-in 2s ease-out, enter-left 1s ease-out;
}

How can I accomplish this, ideally without jquery?  Is there a way to essentially append to a property?
Answer: Use CSS variable like below. The trick is to have multiple animations defined as variable with default values (use a null animation that will do nothing) then you simply adjust the values inside the sub classes:

.enter, .enter-left, .enter-right, .enter-top, .enter-bottom {
  animation: fade-in 2s ease-out, var(--anim1,null),var(--anim2,null);
}

.enter-left {
  --anim1:enterleft 1s ease-in;
}
.enter-top {
  --anim1:entertop 1s linear;
}

@keyframes fade-in {
  from {opacity:0;}
}
@keyframes enterleft {
  from {transform:translateX(-100px);}
}
@keyframes entertop {
  from {transform:translateY(100px);}
}

@keyframes back {
  from{background:blue;}
}

@keyframes null{
  0%,100%{font:inherit}
}

.box {
  width:100px;
  height:100px;
  background:red;
  display:inline-block;
}

Comment: Thanks!  Could be a little cleaner though:

.enter, .enter-left, .enter-right, .enter-top, .enter-bottom {
  animation: 1s ease-in fade-in, var(--directional);
}

.enter-left {
  --directional: 1s ease-in-out enter-left;
}

Appending to CSS property


Unable to locate DHCP Server

Question: I am supporting a mixed Mac OSX and Windows environment. There is a rogue DHCP Server which seems to be providing the IP-addresses to Mac systems on the network. I have used both ZenMap and Wireshark to locate this IP-address and suspected Mac.
The problem is that when I access this suspected Mac, I cannot find any trace of any DHCP server. Yet this particular rogue DHCP Server influences ability to use a particular network shared printer.
The additional weird thing is that "the Mac" (which ZenMap/Wireshark) which serves as the host of the rogue DHCP server ends up having a "self-assigned IP address" [wait is it not supposed to have the IP address of the DHCP Server]
In an attempt to manage that rogue DHCP Server, I proceeded to install ServerAdmin tools from Apple.  This tools did not find any Server at the IP address (of the server) which I obtained via Zenmap/Wireshark - basically it seems that particular server does not exist as far as the tools are concerned.
Even if those tools confirm the existence of the server, I still have another problem that I do not have the login details for that server.
Does anyone have any ideas on how to solve this weird scenario being able to access this rogue DHCP server (using details found via ZenMap/Wireshark) and manage the server.
Comment: It's not clear how you're looking for the DHCP service on the suspect Mac. Note that Apple's server app is only one of a number of things that might set up & run the DHCP/bootp server on a Mac, so checking that won't tell you if e.g. the Internet Sharing has started DHCP service. What I'd do is run `sudo lsof -i:bootps` on the Mac, and see if that shows a process listening for DHCP/bootp requests. If it sees a process, report back with its info and we can go from there. Oh, and one more question: what version of OS X is this Mac running?
Comment: Version is 10.6.4
Comment: good to hear that Server does not see all DHCP/bootp. at least it gives hope of getting resolution that beyond wipe/rebuild
Comment: COMMAND PID USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
bootpd   55 root    0u  IPv4 0x07cca2e8      0t0  UDP *:bootps
Comment: @GordonDavisson kindly see above the result of the command ... seems it was a "bootp" process ...
Comment: Hmm, the low process ID number (55) means bootpd is being started pretty early in the OS X startup process, and I don't think any of the "standard" ways of enabling it would do that. So, I'm pretty sure you're looking for something a bit weird & nonstandard. Can you ask the user if they've installed any special network software/done any custom config on the Mac? Failing that, try `ps -j 55` and see what the parent process's ID (PPID) is -- my guess is it'll be 1 (the system instance of launchd), but if it's something else find out all you can about that parent process.
Comment: If the PPID is 1 (well, actually even if it isn't), try `grep -Eir "bootp|dhcp" /Library/LaunchDaemons /Library/StartupItems /System/Library/LaunchDaemons` and see if it finds matches other than in /System/Library/LaunchDaemons/bootps.plist (which is the normal way of starting bootpd, and not what you're looking for).
Answer: If you have the MAC address of the system which is serving DHCP, you should attempt to find where it's physically plugged into your network by logging into your network switches and checking their MAC address tables (on Cisco devices, show mac address-table).
That will show you which interface on that switch the MAC address is apparently connected from - if you have multiple switches, you'll need to follow that trace though to the switch that the device is actually connected to.
Comment: Thanks would have a good at your suggestion and see what comes up ...
Comment: I have done as suggested (ala Cisco CLI) and the following were ascertained: 1. The Mac  identified as the host for the rogue DHCP server, still remains the host. 2. The mac address of the port (via which the DHCP broadcasts) is also the same as that of the Mac host. Consequently, what is needed now is how to access that rogue DHCP Server on this machine seeing that Apple's own tools cannot even see this DHCP Server.
Comment: @Sysuser So you've identified the physical device that's serving DHCP, or?
Comment: Yes I have identified the physical device serving DHCP
Comment: @Sysuser So are you still missing login information - and is this a server that's actually serving services your business needs? If you need to keep the system around but don't have credentials, you should [reset the password](https://discussions.apple.com/docs/DOC-4101).
Comment: This system is a normal "workstation" not a server - hence the surprise to find there is a DHCP server on it. I have administrative access to the system, yet this does not make any different whatsoever as even my admin access still does not allow for locating the rogue DHCP on the system.
Comment: @Sysuser In that case, yank it from the network, wipe and rebuild; or if you need to do forensics on what that service is and how it got there, then reset passwords, log in, and see what process is listening on UDP 67.
Comment: Why not just unplug it?
Comment: I'd certainly unplug it, as @ward suggests, and see what happens from there.
Comment: Yes ... unplugging is an option ... was just hoping a non-bruteforce approach is possible. Nerds love trying difficult things ... Thanks I now see that wiping and reinstalling might be only option left.
Comment: @Sysuser If you need to determine what the cause is, you should log into the system and check what process is listening on UDP 67.
Comment: @ShaneMadden thanks. I have been able to see that a "bootp" is running via the terminal command "sudo lsof -i:bootps" suggested by GordonDavisson
Answer: on the mac that is hosting the rogue DHCP service.
sudo launchctl unload -w /System/Library/LaunchDaemons/bootps.plist
This will turn off bootpd, which is the DHCP server. You might also check the internet sharing settings in system preferences (which is the other common user of DHCP on the system besides Mac OS X Server)
To see if Mac OS X Server is running check for a listener on port 311, or ps ax | grep servermgrd
HTH
- Leland

Unable to locate DHCP Server


How to auto purge old unapproved comments?

Question: I would like to know if there is any way to automatically purge old unapproved comments on cron run.
The requirement is -- I have turned on email notification on new comments. I would like to approve only the genuine comments and leave the rest for auto-delete on passing certain time.
Of course I already have mollom, captcha and http:BL to fight spam.
Answer: I'm not sure if there is a module which does that. However, you could do that with the help of some custom coding inside hook_cron:
function MODULE_cron() {
  // Find out the comment ids of the comments that are unpublished
  // and are older than 30 days.
  $comments = db_query('SELECT cid FROM {comment} WHERE status = :status AND created < :created', array(':status' => 1, ':created' => strtotime('today - 30days')))->fetchAll();
  $cids = array();
  foreach($comments as $comment) {
    $cids[] = $comment->cid;
  }
  comment_delete_multiple($cids);
}

You can change the time to fit your requirements. This will ensure that on cron run the comments which are older than 30 days and are still unpublished get deleted.
Comment: BTW, to make the code even better. The SQL query could have "ORDER by created ASC" and db_query can be replaced with db_query_range($query, 0, 200); to delete the oldest first.
Comment: @AjitS: Shouldn't it be created < :created if you want the comments posted *before* the specified creation date.
Comment: Sure will do! Thanks for the code snippet. In fact this is what I had thought before posting this question. Want to check if any contrib module is already there as not to duplicate the effort.
Comment: @wimvds Good catch! Answer edited.
Comment: I needed that for Drupal 6, so ported and wrapped it into a D6 module: https://gist.github.com/amr/cc76bbfbac380996965f