Not able to build ionic project using cordova, it shows Task 'cordova' not found

Question: I am new to android, cordova and ionic. I  have created a simple ionic hybrid application and trying to build to android platform and it gives the following error
"grunt cordova" from the application directory is giving
"Warning: Task "cordova" not found, Use --force to continue.
Aborted due to warnings.
When I tried "cordova platform add android" it is giving
Error: command failed with exit code ENOENT
Please help me to get this solved.
Following is my system and software details, and also included some diagnostics
Operating System: Windows 8, 64-bit
Installable
    • Java: jdk22.214.171.124, 64-bit
    • Ant: apache-ant-1.9.4
    • Android SDK: android-sdk_r24.0.2-windows, 64-bt
    • Cordova: 4.2.0
PATH Environment Variable
    • Java : C:\Program Files\Java\jdk1.8.0_31\bin
    • Ant: C:\Program Files\apache-ant-1.9.4\bin
    • Android
        ○ Tools: C:\Program Files\Android\tools
        ○ Platform-tools: C:\Program Files\Android\platform-tools
        ○ Build Tools: C:\Program Files\Android
    • npm: C:\Users\<>\AppData\Roaming\npm
HOME Environment variables
    • JAVA_HOME: C:\Program Files\Java\jdk1.8.0_31
    • ANT_HOME: C:\Program Files\apache-ant-1.9.4
    • ANDROID_HOME: C:\Program Files\Android
Grunt Version - grunt-cli v0.1.13, grunt v0.4.5
Diagnostics
1) c:\IonicTut\firstProject>grunt cordova
Warning: Task "cordova" not found. Use --force to continue
Aborted due to warnings
2) c:\IonicTut\firstProject>cordova platform add android
Error: Command failed with exit code ENOENT at ChildProcess.whenDone ...
3) Then I went to user .cordova and executed check_reqs.bat, it gave the following error, even though android sdk installed and PATH and ANDROID_HOME was set as listed earlier.
Error: Please install Android target 19 . Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.]
4) As instructed in the above message I have tried executing android from the command prompt, then it gave me the following message and saying suitable java not found, I have installed Java SDK and set PATH to JDK bin and JAVA_HOME to JDK folder.
Error: No suitable Java found. In order to properly use the Android Developer Tools, you need a suitable version of Java JDK installed …
Comment: The answers in this thread will help you solve this issue. http://stackoverflow.com/questions/23721611/cordova-add-platform-error-executing-command-ant
Comment: Could you show your code instance, aren't you exposing any API with the cordova?
Answer: Due to whitespaces throwing errors in naming conventions,  it is good practice to use file names with not "gaps" between them.
By changing C:\Program Files\  to C:\Progra~1\ you can correct the Environment Variables need to compile the various resources.
Answer: What you can do instead of opening the SDK manager in CMD prompt, with the command android, is open a file explorer window and simply search for SDK Manager.exe. Once found double click to launch the .exe file from there you will need to select Android 4.4.2(API 19) and install.
SDK Manager.exe is usually located at C:\Users\[user]\AppData\Local\Android\android-sdk - Just keep in mind that the AppData directory is usually hidden so you can either type this into your address bar or you can unhide all files and folders. (Unhiding is not advised for safety as you may forget to hide again when finished the task.)


Android, OnItemClickList com ListView variável

Question: Nesse código eu tenho uma lista que fica atualizando é adiciona mais uma linha na listview, entretanto, eu preciso da posição dela para poder excluir ela do vetor. Ocorre que está dando erro com a classe OnItemClickList....
package com.example.projeto.carrinho;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.HashMap;

import static com.example.projeto.carrinho.Constants.FIRST_COLUMN;
import static com.example.projeto.carrinho.Constants.FOURTH_COLUMN;
import static com.example.projeto.carrinho.Constants.SECOND_COLUMN;
import static com.example.projeto.carrinho.Constants.THIRD_COLUMN;

/**
 * Created by victor on 26/02/17.
 */

public class ActivityList extends ActionBarActivity implements AdapterView.OnItemClickListener {

    private ArrayList < HashMap < String, String >> list;

    String[] nome = {
        "Darth Vader",
        "Fake Vader",
        "Objeto não identificado",
        "Objeto não identificado",
        "Objeto não identificado",
        "Objeto não identificado",
        "Objeto não identificado",
        "Objeto não identificado",
        "Objeto não identificado",
        "Objeto não identificado"
    };
    String[] item = {
        "Quantidade:01",
        "Quantidade:02",
        "Quantidade:Ilimitado",
        "Quantidade:Ilimitado",
        "Quantidade:Ilimitado",
        "Quantidade:Ilimitado",
        "Quantidade:Ilimitado",
        "Quantidade:Ilimitado",
        "Quantidade:Ilimitado",
        "Quantidade:Ilimitado"
    };
    String[] preco = {
        "Preço: R$999,00",
        "Preço: R$1,00",
        "Preço: Grátis",
        "Preço: Grátis",
        "Preço: Grátis",
        "Preço: Grátis",
        "Preço: Grátis",
        "Preço: Grátis",
        "Preço: Grátis",
        "Preço: Grátis"
    };
    String[] imgs = {
        String.valueOf(R.drawable.darth_vader2),
        String.valueOf(R.drawable.darth_vader2),
        String.valueOf(R.drawable.cinco),
        String.valueOf(R.drawable.cinco),
        String.valueOf(R.drawable.cinco),
        String.valueOf(R.drawable.cinco),
        String.valueOf(R.drawable.cinco),
        String.valueOf(R.drawable.cinco),
        String.valueOf(R.drawable.cinco),
        String.valueOf(R.drawable.cinco)
    };
    int i = 0;

    ListView listView = (ListView) findViewById(R.id.listView);

    @Override
    protected void onCreate(Bundle savedInstanceState) {

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

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView << ? > parent, View view, int position, long id) {

                int itemPosition = position;

                // ListView Clicked item value
                String itemValue = (String) listView.getItemAtPosition(position);

                // Show Alert
                Toast.makeText(getApplicationContext(), "Position :" + itemPosition + "  ListItem : " + itemValue, Toast.LENGTH_LONG).show();

            }
        });

    }

    public void botao(View v) {

        populateList();
        ListViewAdapter adapter = new ListViewAdapter(this, list);
        listView.setAdapter(adapter);

    }

    int j = 1;

    private void populateList() {

        if (i != 0)
            list.clear();

        list = new ArrayList < HashMap < String, String >> ();

        for (int j = 0; j <= i; j++) {

            HashMap < String, String > temp = new HashMap < String, String > ();
            temp.put(FIRST_COLUMN, nome[j]);
            temp.put(SECOND_COLUMN, item[j]);
            temp.put(THIRD_COLUMN, imgs[j]);
            temp.put(FOURTH_COLUMN, preco[j]);
            list.add(temp);

        }
        i++;

    }

    @Override
    public void onItemClick(AdapterView << ? > parent, View view, int position, long id) {

    }
}

Answer: Você deve fazer a ligação do seu ListView com o XML dentro do método onCreate desta forma abaixo:
ListView listView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    listView = (ListView) findViewById(R.id.listView);


How to notate glissando over multiple measures

Question: For the violin I'd like to notate a glissando over multiple measures. But there's two things that are unclear to me:

do I just put a semi-breve in the first and last measures and rests in the measures in between? Like this:

if the glissando will require re-bowing, do I use a tremolo for the first note? Or can I leave it to the musician's own judgment? Come to think of it a tremolo of eights is way too fast for what I want to achieve.

Ok, let me re-formulate: how do I notate a very slow glissando over multiple measures?
Comment: @Creynders - Ignore the naysayers. If someone doesn't like your 12-beat gliss, make it a 24-beat gliss.
Comment: No, the idea is that the audience does not hear it. And obviously I don't expect an exact rendering. It's more for a disonnant effect/feeling.
Comment: You really expect someone to *portamento*  (not gliss -- pianos do gliss) a half step over 12 beats?    Or for that matter, your audience to hear the difference?   I'd take a step back and decide where you really want pitch transitions to matter.
Answer: I would use first and last note with gliss. between them (as you did), but would delete the rests between them. You can leave the (re)bowing to the violinists, they're used to doing it. :)
Comment: So, do you mean to leave the intermediate measures blank? No rests, nothing?
Comment: Just with the "gliss." line, yes.
Comment: I don't think so -- a measure has to have *something* in it.
Comment: @carlwitthoft Just false. And anyway, the measures will have the gloss line in them.
Comment: Sam is correct here: keep what you have; delete the rests. Sound *is* occurring through those measures: the gliss you've written. It's just that the actual result is indeterminate. Either leave the bowing alone or talk to a violinist to put in specific bowing indications.
Answer: You can also fill the measures that you want the glissando to cover with quarter note headless stems to mark the beats. You can find that option under notations/ note types.
Hope you find this helpful.
Answer: While I heartily disapprove of such a long and minimal portamento,  my recommendation is to use microtonal notation. First measure E, second measure E+1/8,  third measure E + 1/4 or E+3/8, fourth measure F .
One such set of symbols:

edit:
As Creynders pointed out, I was misusing 'portamento'.  Referring again to the Dolmetsch online dictionary,
Glissando

also glissato, glissicando or glissicato, a continuous slide in pitch.
On the violin, the left hand finger is placed on the string and then,
as the note is played, the finger slides up or down the finger board.
The beginning and end note of the glissando are written and connected
by either a straight or a wavy line. Usually the word gliss. or
glissando will be written above. This is what some writers call 'a
true glissando' on the piano, to run the nail or a finger or the back
of the thumb along the keyboard over many notes, see glissant,
glisser. This is what some writers call 'an effective glissando', in
that the change in pitch is by discrete steps rather than through a
continuous and steady shift.

portamento

on stringed instruments, an expressive device, a slide from one pitch
to another, usually stopping for moment either above or below the
destination pitch, which was very popular in the 19th- and early
20th-centuries, but has more recently fallen into disuse.  a smooth
glide between the two notes, including all the pitches in between. For
some instruments, like violin and trombone, this includes even the
pitches in between the written notes. For other instruments, such as
guitar, it means sliding through all of the possible notes between the
two written pitches. Although unusual in traditional common notation,
a type of portamento that includes only one written pitch can be found
in some styles of music, notably jazz, blues, and rock. The proper
performance of scoops and fall-offs (the latter also called drops or
spills) requires that the portamento begins (in scoops) or ends (in
fall-offs, drops or spills) with the slide itself, rather than with a
specific note.
Comment: Erm, I'm pretty sure you can have a glissando on a violin too. And my comprehension was that a portamento uses a glissando, but not necessarily the other way round
Comment: Carl, I don't think it's nice or valuable to get so judgemental about this musical idea. Personally I find it an interesting and exciting idea. It's not too far away from sounds often made in synthesizer based music and the overall concept of notating unusual sounds beings to mind Penderecki. To me there is nothing wrong with this idea.
Comment: I suppose, Carl, you've never heard Scelsi's string quartets? Microtonal notation is a good suggestion if the composer has specific ideas about guide notes throughout the glissando (as might be appreciated due to it's length), or if they just want to get super finicky about notation.


Backing up server before upgrading PHP

Question: What's the easiest way to back up my server so in the event we run into issues during our PHP 5.3 upgrade we can revert back to PHP 5.2?
update
I guess a better question is, do I NEED a backup of our original setup, or is PHP plug'n play enough that I can just remove 5.3 and revert to 5.2 if it fails for whatever reason.
Comment: Totally depends on how you installed it in the first place.
Comment: We need a lot more information. This question is tagged "ubuntu", but if you are upgrading your PHP version, I assume you aren't using the packaged PHP. Are you using the packaged Apache? Also, it's good practice to have a backup/restore plan in place no matter what.
Comment: Absent any other information, shut the system down and take a binary image of the hard drive with Ghost or something similar.
Comment: I have no idea if I'm using the packaged apache/php... does it matter?
Answer: We could use some more information.
However, I can only assume you are concerned about this upgrade because you have an application on there that you think could break in some unexpected way.  In which case I have to wonder why you have not set up a vm and tried this application there as a test.
Next, I also have to wonder how you are backing up your server in the first place, and why you don't already have a DR solution thought through.
Barring that, you can do as others have suggested and clone the machine, using Ghost or similar depending on what Operating System you are using.
Really though, there is zero penalty for failure in a test scenario, I don't understand why you haven't started there.
There are other ways out of this jam, but they all require you tell us more.
Answer: rdiff-backup seems to be quite easy backup tool, I also recommend using etckeeper for tracking config file changes in /etc

Backing up server before upgrading PHP


Include javascript in node

Question: myjavascript.js:
    function initialize() {

        var waStyle = [
            {
                featureType: "all",
                stylers: [
                    { saturation: -100 }
                ]
            }
        ];

        var mysiteMap = new google.maps.StyledMapType(waStyle,{name: "Nuance"});

        var img = new google.maps.MarkerImage("/themes/nuance/img/pin.png");

        var myLatlng = new google.maps.LatLng(41.061833,28.997948);

        var mapOptions = {
            zoom: 16,
            center: myLatlng,
            disableDefaultUI: true,
            mapTypeControlOptions: {
                mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'mysite_map'],
            }
        };

        var map = new google.maps.Map(document.getElementById('mainmap'), mapOptions);

        var point = new google.maps.LatLng(41.061833,28.997948);
        var marker = new google.maps.Marker({
            position: point,
            map: map,
            animation: google.maps.Animation.DROP,
            icon: img
        })

        map.mapTypes.set('mysite_map', mysiteMap);
        map.setMapTypeId('mysite_map');
    }

    function loadScript() {
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize";
        document.body.appendChild(script);
    }

    window.onload = loadScript;

And include in my node via field. (text format: php code)
<?php include('themes/mytheme/scripts/maps/myjavascript.js'); ?>

But get error.
On site:
 function initialize() { var waStyle = [ { featureType: "all", stylers: [ { saturation: -100 } ]
    ...

What's my problem and how can i fix it?
Answer: The Drupal way is to add js on the go is drupal_add_js
drupal_add_js($data = NULL, $options = NULL)

Examples:
  drupal_add_js('misc/collapse.js');
  drupal_add_js('misc/collapse.js', 'file');
  drupal_add_js('jQuery(document).ready(function () { alert("Hello!"); });', 'inline');
  drupal_add_js('jQuery(document).ready(function () { alert("Hello!"); });',
    array('type' => 'inline', 'scope' => 'footer', 'weight' => 5)
  );
  drupal_add_js('http://example.com/example.js', 'external');
  drupal_add_js(array('myModule' => array('key' => 'value')), 'setting');

There is a better way to add a library file drupal_add_library
Parameters

$module:
The name of the module that registered the library.
$name:
The name of the library to add.
$every_page:
Set to TRUE if this library is added to every page on the site. Only items
with the every_page flag set to TRUE can participate in aggregation.
Comment: @user1213807, try `drupal_add_js(drupal_get_path('theme', 'MYTHEME') .'/mytheme.js', 'file.js');`
Comment: Thank you. E.G. can i include drupal_add_js('misc/collapse.js'); in my node?
Comment: if its in core you can try `drupal_add_library('system', 'ui.autocomplete');` + See my edit
Comment: No, it's not in core, custom javascript codes.

Include javascript in node


ReactiveForms with custom input

Question: I'm getting the following error when trying to create a form using a custom component.

Error: No value accessor for form control with name:
  'nomeEmpresaAerea'
  Error: No value accessor for form control with name: 'nomeEmpresaAerea'
  Stack trace:
  _throwError@webpack-internal:///./node_modules/@angular/forms/esm5/forms.js:2510:11
  setUpControl@webpack-internal:///./node_modules/@angular/forms/esm5/forms.js:2380:9
  FormGroupDirective.prototype.addControl@webpack-internal:///./node_modules/@angular/forms/esm5/forms.js:6736:9
  FormControlName.prototype._setUpControl@webpack-internal:///./node_modules/@angular/forms/esm5/forms.js:7386:45
  FormControlName.prototype.ngOnChanges@webpack-internal:///./node_modules/@angular/forms/esm5/forms.js:7299:13
  checkAndUpdateDirectiveInline@webpack-internal:///./node_modules/@angular/core/esm5/core.js:12581:9
  checkAndUpdateNodeInline@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14109:20
  checkAndUpdateNode@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14052:16
  debugCheckAndUpdateNode@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14945:55
  debugCheckDirectivesFn@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14886:13
  View_EmpresaCadastroComponent_0/<@ng:///EmpresaModule/EmpresaCadastroComponent.ngfactory.js:80:5
  debugUpdateDirectives@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14871:12
  checkAndUpdateView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14018:5
  callViewAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14369:21

this is my reactive form:
import { Component, OnInit, Input } from '@angular/core';
import { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http';

import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';

@Component({
  selector: 'app-empresa-cadastro',
  templateUrl: './empresa-cadastro.component.html',
  styleUrls: ['./empresa-cadastro.component.css']
})
export class EmpresaCadastroComponent implements OnInit {

  @Input() empresa = {};

  empresaForm: FormGroup;

  constructor(private route: Router, private http: HttpClient, private fb: FormBuilder) {
    this.createForm();
  }

  createForm() {
    this.empresaForm = this.fb.group({
      nomeEmpresaAerea: '',
      status: 'S',
    });
  }

this is my html:
<form [formGroup]="empresaForm" (ngSubmit)="onSubmit()">

          <button type="submit" [disabled]="empresaForm.pristine" class="btn btn-success">Cadastrar</button>
          <button type="button" (click)="limpar()" [disabled]="empresaForm.pristine" class="btn btn-danger">Limpar</button>

          Nome:
            <input class="form-control" >
            <app-pf-input-text formControlName="nomeEmpresaAerea" ></app-pf-input-text>

      </form>

pf-input-text.componente.ts:
import { Component, OnInit, Input } from '@angular/core';

@Component({
  selector: 'app-pf-input-text',
  templateUrl: './pf-input-text.component.html',
  styleUrls: ['./pf-input-text.component.scss']
})
export class PfInputTextComponent implements OnInit {

  @Input() id: string;
  @Input() name: string;
  @Input() value: string;
  @Input() placeholder: string;

  //falta trim

  @Input() maxlength: string;
  @Input() minlength: string;

  @Input() disabled: boolean;
  @Input() required: boolean;

  constructor() { }

  ngOnInit() {
  }

}

pf-input-text.component.html

  <input
      type="text"
      id="{{id}}"
      name="{{name}}"
      placeholder="{{placeholder}}"
      attr.maxlength="{{maxlength}}"
      class="form-control"
      disabled="{{disabled}}"
      required="{{required}}">

Answer: try this in reactive form component
this.empresaForm = new FormGroup({
     'nomeEmpresaAerea': new FormControl(null, Validators.required)});

ReactiveForms with custom input


Consumo de dados de internet usando Vue.Js ou similares

Question: Bom dia,
Tenho uma aplicação em Vue, onde o nav superior e lateral estão estáticos, e o conteúdo (body) é carregado conforme as requisições feitas nos links do nav. O Vue acelera muito a utilização, carregando só o centro, mas isso significa que o consumo de dados de internet é menor por só estar carregando o body? Ou ele carrega tudo novamente sem que a gente perceba?
Exemplo: Se existirem dois sistemas iguais visualmente, um escrito em html tradicional, e outro utilizando o Vue.Js, o vue consumiria menos internet? (sabendo que o html carrega novamente a página completa a cada requisição)
Answer: de maneira geral, uma pagina SPA após está carregada vai consumir menos banda que uma aplicação tradicional (Multi Page), porem dependendo de como esteja a implementação, você terá que baixar uma grande quantidade de dados na primeira requisição. Porem é possível contornar este problema utilizando algumas técnicas.
Lazy Loading
A ideia aqui é que o componente referenciado pela rota seja carregado sobre demanda. Então ao invés de fazemos isto.:
import SomePage from 'pages/SomePage'

const routes = [
  {
    path: '/some-page',
    component: SomePage
  }
]

podemos declarar a rota da seguinte forma.:
const routes = [
  {
    path: '/some-page',
    component: () => import('pages/SomePage')
  }
]

PWA
PWA veio parar tonar a experiencia na WEB o mais próximo possível de se está utilizando um aplicativo. E uma aplicação PWA deve ser.:

Progressiva - Funcionar bem em qual quer browser.
Responsiva - Se adaptar a qual quer tela
Indepedente de Rede - Funcionar mesmo estando offline
Parecer com um Aplicativo - A experiencia de uso deve ser parecida a de um aplicativo instalado.
Sempre Atualizado - não precisa de comentario.
Segura - Sempre utilizar HTTPS
Indexável - Permitir a indexação por paginas de pesquisa (Google, Binq, etc).
Engajável - Permitir que o continue facilmente uma tarefa ou seja notificado caso algo novo apareça (Push).
Instalável - Permitir adicionar um atalho na area de trabalho.
Compartilhável - Compartilhar apenas usando um Link.

Para se chegar a este resultado, é preciso usar tudo que está ao nosso alcance, Services Workers para manter a aplicação sempre atualizada, Push API para notificar o Usuario, LocalStorage ou IndexedDB para armazenar dados localmente (conteúdo dinâmico) e Cache API para armazenar assets (imagens, fontes, etc).
SSR
Basicamente é permitir que as suas paginas possam ser renderizadas também no servidor. como estamos falando de VueJS, você terá de usar o Nuxt.js
Quasar Framework
Acredite, você pode utilizar tudo de uma vez, Lazy Loading, PWA, SSR e ainda fazer deploy para Android e iOS usando Cordova e Windows, Mac, Linux usando o Electron, e o Quasar Framework vai lhe ajudar a manter todos estes mundos unidos sem criar um pandemônio.


Relating Integration by Substitution to Change of Variables Theorem

Question: I'm having trouble relating the change of variables theorem from measure theory to the integration by substitution formula taught in Calculus.  I've always thought they were basically saying the same thing, but I can't quite see it.  Below I assume everything that needs to be integrable is integrable.

Change of Variables Theorem: (Wiki)  Let $(X_1, \Sigma_1, \mu)$ be a measure space and $(X_2, \Sigma_2)$ be
  a measurable space.  Let $f: X_1 \to X_2$ be measurable and let $f_*[\mu]$ be the pushforward measure on $X_2$.  Finally let $g$ be a measurable function on $X_2$.  Then
  $$
\int_{X_1} g \circ f \, \mathrm{d}\mu = \int_{X_2} g \, \mathrm{d}(f_*[\mu]).
$$
Integration by substitution: (Wiki) Let $f: [a,b] \to I$ be continuously differentiable for some interval $I \subset \mathbb{R}$ and let $g: I \to \mathbb{R}$ be continuous.  Then
  $$
\int_a^b (g \circ f)(t) \cdot f^\prime(t) \, \mathrm{d}t = \int_{f(a)}^{f(b)} g(x) \, \mathrm{d} x.
$$

My attempt at relating the two, starting from change of variables theorem:
Let $(X_1, \Sigma_1) = ([a,b], \mathcal{B}([a,b]))$ and $(X_2, \Sigma_2) = (I, \mathcal{B}(I))$.  Let $f$ be continuously differentiable and increasing and let $\mu = \mu_f$ be the Lebesgue-Stieltjes measure for $f$ on $[a,b]$.  Then $f^\prime = \frac{\mathrm{d} \mu_f}{\mathrm{d} \lambda_1}$, the Radon-Nikodym derivative of $\mu_f$ w.r.t. the Lebesgue measure $\lambda_1$ on $[a,b]$.  Finally, the pushforward measure $f_*[\mu_f] = \lambda_2$, the Lebesgue measure on $I$.  Hence
\begin{align*}
\int_a^b (g \circ f)(t) \cdot f^\prime(t) \, \mathrm{d}t & = \int_{[a,b]} (g \circ f) \cdot f^\prime \, \mathrm{d}\lambda_1 \\
& = \int_{[a,b]} g \circ f \, \mathrm{d} \mu_f \\
& = \int_I g \, \mathrm{d} (f_*[\mu_f]) \\
& = \int_I g \, \mathrm{d} \lambda_2 \\
& = \int_{f(a)}^{f(b)} g(x) \, \mathrm{d} x.
\end{align*}
The first line is because $(g \circ f) \cdot f^\prime$ is continuous and so the Riemann and Lebesgue integrals coincide, the second is because $f^\prime = \frac{\mathrm{d} \mu_f}{\mathrm{d} \lambda_1}$, the third is the change of variables theorem, the fourth is because $f_*[\mu_f] = \lambda_2$, and the last line is again because $g$ is continuous and so the Riemann and Lebesgue integrals coincide.
So assuming the above is correct, I can relate the two for monotone increasing $f$, but not for more general continuous $f$.  How can I show this?
Comment: Great question, thank you for having put the details.
Answer: Using the identity (or defintion)$$\int_b^af(x)dx=-\int_a^bf(x)dx,$$you can use your argument to prove the theorem for monotone decreasing $f$. Then, given a general (continuously differentiable) $f$, divide your segment to smaller segments on which $f$ is monotone.
Note that segments on which $f$ is constant have $0$ contribution to your integral.


Why doesn't my custom library load?

Question: I am trying to load libraries in my Drupal 8 site, but it does not seem to be working. Here is my library yaml, is this correct? Why can't I load dexp.slides?
dexp.slides
  version: 1.x
  css:
    theme:
      css/plugins/font-awesome/css/font-awesome.min.css: {}
      css/admin.style.css: {}
      css/plugins/rs-plugin/css/settings.css: {}
  js:
    js/dexp.layerslider.js:  {}
    js/plugins/rs-plugin/js/jquery.themepunch.revolution.min.js:  {}
    js/plugins/rs-plugin/js/jquery.themepunch.tools.min.js:  {}
  dependencies:
    - core/jquery
    - core/jquery.ui.draggable
    - core/jquery.ui.dropable
    - core/jquery.ui.sortable
    - core/jquery.ui.dialog
    - core/jquery.ui.tab

I am trying the above way but the dependencies are not being loaded.
Comment: There are other ways to include custom js files in D7. The one that I prefer is context_add_assets (https://www.drupal.org/project/context_addassets). This will allow adding css/js based on context.
Comment: Question is for Drupal 8 though
Comment: @clive english is my second language and it will take some time before my questions matches the required standard, at the same time answer by kevin helped me .
Comment: If it fixed your issue, please vote/accept so others who land here can see that it helped.
Answer: You are missing a colon after depx-slides:
dexp.slides:
  version: 1.x
  css:
    theme:
      css/plugins/font-awesome/css/font-awesome.min.css: {}
      css/admin.style.css: {}
      css/plugins/rs-plugin/css/settings.css: {}
  js:
    js/dexp.layerslider.js:  {}
    js/plugins/rs-plugin/js/jquery.themepunch.revolution.min.js:  {}
    js/plugins/rs-plugin/js/jquery.themepunch.tools.min.js:  {}
  dependencies:
    - core/jquery
    - core/jquery.ui.draggable
    - core/jquery.ui.dropable
    - core/jquery.ui.sortable
    - core/jquery.ui.dialog
    - core/jquery.ui.tab

The YAML is pretty strict about format. You can run it through a linter like YAML Lint - that is how I noticed the colon was missing.
After making that change, clear your cache and require your library (either in the info file or by attaching it with #attached or attach_library in a twig file) it should work.
The official docs page has all the info you need about attaching libraries, but the YAML must always be correctly formatted.
That YAML Lint tool, by the way, works for any YAML. If you ever work on a routing, permission or other YAML files, it can check if it is valid or not which is the first step to debugging YAML - simply eyeballing it is not good enough - use the tool that will just tell you. There is an npm package available to run it from command line (I do recommend).

Why doesn't my custom library load?


Inequalities question

Question: I've been having trouble solving these kind of inequalities ;
$\sqrt { -7x+1 } - \sqrt {x+10}  \gt \  {7}$
Attempt at a Solution; We first find the official boundaries of the inequality; x is limited to the section:  $\ -10 \le x \le \frac{1}{7} $
Then, squaring both sides we get:
${-7x+1} -2 \sqrt{(x+10)}\sqrt{(-7x+1)} +x+10 \gt 49  $
$-2 \sqrt{(x+10)}\sqrt{(-7x+1)}  \gt 38+6x $
squaring again eventually yields:
$ -28x^2-276x+40\gt 1444+456x+36x^2 $
$-64x^2 -732x -1404 \gt 0 $
binomial roots are as specified below.
since the parabola is concave and in order this inequality is to be satisfied,
x must assume the values:$\ -9 \lt x \lt  -2.4375 $ upon intersecting this with the range we get the same result and this is the (apparent) final solution.
We then resume to the usual manipulation of the inequality; squaring both sides, factoring etc. We get two roots; $-9$,$ -2.4375$ . The parabola we get after these manipulations is concave, so we get the solution:  $\ -9 \lt x \lt  -2.4375 $ .  We then intersect this solution with the range for x, yielding the final solution  $\ -9 \lt x \lt  -2.4375 $. Upon testing it we find it does not fulfill the inequality we tried to solve, so we cancel it as a solution, leading to that there are no solutions to this inequality, as a final answer. Official answers state otherwise.
Any help?
Comment: The inequality is certainly true for $x=-10$, so there must be _some_ solution..
Comment: Note that for $x=-9$, the LHS will evaluate to 7 exactly, thus there may be something to be said for testing values on each side to see if as x is increased or decreased does it pass by this point.
Comment: You're saying I should test the entire range even if it does not come up as a solution by it's own?
Comment: No, testing all numbers is not a viable approach, but it is usually a good idea to test some numbers in order to get a feeling for the problem. Since there are many possible ways to do the manipulations you describe, could you show exactly how you do?
Comment: This is correct. However I decided to take a more direct approach perhaps? After I get the solution and rule it out, I check the remaining sections of the range of x to see if they fit my inequality. If they do I take them, if they dont I discard them, and then I unite all those that were ok together for the final solution. Is this OK?
Comment: After the step $-2 \sqrt{(x+10)}\sqrt{(-7x+1)}  \gt 38+6x$, you square both sides.  But the LHS is clearly negative, which means you need to reverse the inequality sign.  Doing that, your parabola becomes **convex**.  The problem is, you have squared already earlier without checking signs.  Note if you square $-2 < 1$ you get $4 < 1$ which is obviously not correct.
Comment: How do I suppose to check signs in this type of questions?
Comment: No general rule, though you should be able to figure from case to case.  For e.g. $(...)^2, \sqrt{..}$ etc. are certainly positive forms.
Answer: From $\sqrt{-7x+1} - \sqrt{x+10}  \gt 7$, your assessment of the interval $x \in [-10, \frac{1}{7}]$is clearly right.
Let us make sure we have positive quantities on both sides first, so rewrite as
$\sqrt{-7x+1}  \gt 7 + \sqrt{x+10} $
Squaring,  $- 7x + 1 > 49 + x + 10 + 14\sqrt{x+10}  $
or $-4x -29 > 7\sqrt{x+10} $
Now it is easier to see that the LHS is positive only when $x < -\frac{29}{4}$, so the allowable values have shrunk to $x \in [-10, -\frac{29}{4}]$.  In this interval, we have assurance of both sides being positive, so squaring again, we have
$16x^2 + 232x + 841 > 49(x+10) \implies 16x^2 + 183x + 351 > 0$  So we have
$$16\left(x+\dfrac{183}{32}\right)^2 > \dfrac{11025}{64} \implies x +\dfrac{183}{32} \not \in \left[- \frac{105}{32}, \frac{105}{32} \right]  $$
Thus the allowable values are further shrunk to $x \in [-10, -9)$.
Comment: And how about this approach?  After I get the solution and rule it out, I check the remaining sections of the range of x to see if they fit my inequality. If they do I take them, if they dont I discard them, and then I unite all those that were ok together for the final solution. Is this OK?
Comment: If you have been careful each step (in this case being careful about squaring only positives), the "remaining" sections should **not** have any case which satisfy the inequality.  Perhaps you should post the steps you did also as an addendum to the question, it may be easier to spot if any mistake is being made.
Comment: @Macavity...I added a few more details..
Answer: First of all, before squaring the initial inequality, it seems appropriate to note that $\sqrt{-7x+1}-\sqrt{x+10}$ has to be greater that zero (i don't know, perhaps this is redundant, but i'd do that just to make sure...)
Then, after squaring both parts, i got $3x+19 + \sqrt{(-7x+1)(x+10)} < 0$, which gives us $\sqrt{(-7x+1)(x+10)} <-(3x+19)$, if i'm not mistaken. This yelds the condition $3x+19 < 0$, or $x < -\frac{19}{3}$. Then i squared everything, and got almost what you got - $x < -9$ or $x > -\frac{78}{32}$. So now it is enough to intersect all inequalities properly... Will the answer be correct?
And my final answer seems to be $[-10,-9)$ (after calculations)... Is it correct?
Comment: Yes - that looks good. I posted my working before seeing your answer, matches exactly.
Comment: This is correct. However I decided to take a more direct approach perhaps? After I get the solution and rule it out, I check the remaining sections of the range of x to see if they fit my inequality. If they do I take them, if they dont I discard them, and then I unite all those that were ok together for the final solution. Is this OK?
Comment: frankly speaking, i've never heard of checking solutions of inequalities of _such_ types before... Well, the inequalities of this kind: $(x-x_1)...(x-x_n) < 0$ are done like that, the real line is divided onto the respective number of segments, and the way to solve the inequality is to check one point from the leftmost segment (or any of them, whatever) and the rest of the segments are ruled out or included automatically - this is what i know... but here you can have some extra solutions due to the fact that you square both parts of the inequality, and who knows how it can behave...
Comment: for instance, the solution after squaring might turn out to be, say, $[0,2]\cup [3,5]$, but to maintain equivalence, you had to add the inequality which would give you the restriction, say, $[1,4]$, So the solution would be $[1,2]\cup[3,4]$, but with this method of ruling out, if you chose points 0 and 5 to check the segments, you'd rule out everything...
Comment: Have i got your method right?
Comment: I do but that's ok, isn't it? I mean if one value doesn't fit we can be almost certain that the entire segment isn't fit...that's what I've been told at least...
Comment: well, i don't know, but i'm not sure that this method is good for _all_ types of inequalities... The better strategy as for me seems to be adding the respective conditions (if necessary) which provide that your transformations preserve the equivalence (i.e. the inequality becomes equivalent to a system of inequalities in fact). i can't come up with any counterexample to your strategy though, as well as with its validation...

Inequalities question


Unequal sample sizes for two-way repeated measures

Question: I have 3 different treatments with the observations of 6 different repetitions. However, all these different treatments (groups) have different numbers of patients. The first group has 26 patients, the second group has 28 patients and the third group has 19 patients. Thus, I can say that I have unequal sample sizes for two-way repeated measures anova.
When I do the analysis by using SPSS, it calculates the sum of squares and degrees of freedom by using the minimum sample size of the third group, which is 19.
Solving the problem and doing the comparisons by hand is time consuming. I would like to know how to handle this kind of problem, which is unequal sample sizes in each groups, by using the computer. Is there any other program, (SAS or R?) that deals with that, apart from SPSS, which obviously can not?
Answer: Look into linear mixed effects modelling, it can handle missing repeats which the standard anova linear modelling approach cannot.
Comment: I have no idea how to use it and its property about handling the two-way repeated measures and main effects and interaction term. Can you be more specific or can you give some papers for these models handling unequal sample sizes in repeated measures (not unequal or missing repetitions)?
Comment: Is this even an issue of missing data? It just sounds like Uneven sample sizes.
Comment: @Oceansoul linear mixed models have many advantages over ANOVA in its various forms. See, for example, Gelman's [A psychology researcher asks: Is Anova dead?](http://andrewgelman.com/2011/09/03/a-psychology-researcher-asks-is-anova-dead/). For an intro to rANOVA —> mixed models see [Repeated Measures
ANOVA, R.I.P.?](http://www.tandfonline.com/doi/abs/10.1080/09332480.2005.10722732).
Answer: GraphPad Prism can handle one-way ANOVA in this situation. It cannot handle missing observations for any patient, but has no trouble with different number of patients in different treatment groups. Try the free demo.
Answer: SAS proc mixed can to this. See their documentation. Unequal and unknown covariance matrices as well as unequal sample sizes are supported there. (I would recommend UN as covariance structure unless you are sure about a different structure, see the repeated statement.)


For não percorre a lista inteira

Question: Estou com um problema ao percorrer uma lista.
Meu for esta assim:
 for (int i = 0; i < listaCaixaAbertos().size(); i++) {
                listaCaixaAbertos().get(i).setFechado(Boolean.TRUE);
                salvar(listaCaixaAbertos().get(i));
            }

Minha lista esta assim:
 public List<LancamentoCaixa> listaCaixaAbertos() {
    Query q = em.createQuery("FROM LancamentoCaixa As a WHERE a.fechado = false");
    return q.getResultList();
}

A cada vez que percorro a lista quero setar false à  variável fechado.
Porem a ele Não altera todos os dados desta lista, para alterar todos tenho que clicar varias vezes dependendo a quantidade de itens.
Answer: Acho que é isto que deseja:
for (LancamentoCaixa lancamento : listaCaixaAbertos()) {
    lancamento.setFechado(true);
    salvar(lancamento);
}

Coloquei no GitHub para referência futura.
Sempre que possível é melhor o for que percorre toda a coleção. Isto por si só já elimina os problema. Estava mandando listar tudo para pegar o tamanho, depois listar de novo para pegar o item e alterá-lo, e depois listar de novo para salvar. Isto não só é semanticamente errado, como pode criar efeitos colaterais indesejados, condição de corrida e a performance vai sofrer.
Comment: Isso mesmo que eu precisava! Problema resolvido, muito obrigado.

For não percorre a lista inteira


ESET Remote Administrator Console showing infected files on a client, but threat log is empty

Question: We recently deployed ESET NOD32 Antivirus on our small domain network and use the Remote Adminstrator to manage everything remotely.
On a recent full system scan, one of the clients shows 10 infected files of which 4 have been cleaned in the scan log. The strange thing, however, is that the threat log is empty.

Is there any reason why the threat log is empty?
What has happened to the 6 remaining uncleaned files?
Where can I view information on what files are infected and what they have been infected with? I know this can be done through the scan log properties screen, but with 958790 files scanned, I obviously do not want to browse through this list.

Any help is appreciated.
Answer: Not an answer (sorry!) but have you tried the Official ESET Support Forum? The community there is very active.
Comment: Thanks for the tip; I have asked the same question there now but so far I have not gotten an answer yet. Usually SF is faster than any support forum :)


Understanding python subprocess popen asynchronous

Question: My understanding is that subprocess.popen is an asynchronous call and appending .wait() to the call will make it synchronous.  Will the second of these popen calls execute after the first call completes?
proc1 = subprocess.Popen(first_command, stdout=subprocess.PIPE, shell=True)
proc2 = subprocess.Popen(second_command, stdin=proc1.stdout, stdout=self.fw, shell=True)

I'm trying to determine when it's necessary to use wait() and why it causes errors when used in the above example popen statements, for example:
proc1 = subprocess.Popen(first_command, stdout=subprocess.PIPE, shell=True).wait()  # throws exception
proc2 = subprocess.Popen(second_command, stdin=proc1.stdout, stdout=self.fw, shell=True).wait()  # seems ok

Answer: After lots of trial and error and re-reading other posts and the docs, this is what works.
proc1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE, shell=True)
# don't put wait here because of potential deadlock if stdout buffer gets full and we're waiting for proc2 to consume buffer then we're deadlocked
proc2 = subprocess.Popen(cmd2, stdin=proc1.stdout, stdout=self.fw, shell=True)
# ok to wait here
proc2.wait()
# ok to test return code after proc2 completes
if proc2.returncode != 0:
    print('Error spawning cmd2')
else:
    print('Success spawning cmd2')

Hopefully this will help someone else.


Getting node view mode in field preprocess

Question: I am trying to get the view mode of a node to use it in a field twig file by writing this function in my_theme, but it doesn't work:
function MY_THEME_preprocess_field(&$variables, $hook) {
 if ($node = \Drupal::routeMatch()->getParameter('node')) {
  $variables['view_mode_2'] = $node->view_mode;
 }
}

I don't know if the variable is correct, but when I write some echo code I see that already the if condition isn't fulfilled.
EDIT: the if condition is only fulfilled when the node is open, but not when its teaser is shown as part of a view on the front page.
Answer: In a field template the view mode is stored here:
$variables['element']['#view_mode']

So you could check in preprocess, if the node is not displayed as teaser:
function MY_THEME_preprocess_field(&$variables) {
  if ($variables['element']['#view_mode'] != 'teaser')  {
    // node is not displayed on the front page
  }
}

The same condition in a field twig:
field.html.twig
{% if element['#view_mode'] != 'teaser' %}
  node is not displayed on the front page
{% endif %}

Comment: Ah, thank you, that's what I was searching! If anybody wants to know why this could be useful: My content type article has a text field for a subheadline. In order to wrap this headline with h-tags I created a custom field-xxx.html.twig file, but the problem is that the subheadline needs h3 tags in a teaser context, but h2 tags when showed as a full page. So the twig template is now checking the view mode and giving h2 or h3 tags depending on the view mode.
Comment: You can use the same condition in a field twig. I add this to the answer.
Comment: So you don't need the preprocess anymore?
Comment: Yes, you've asked about preprocess, but for what you've described in the comment you don't need preprocess.
Comment: Cool, good to know!


Need of '$p$ is prime' in proof of Cauchy's theorem by McKay

Question: This is outline of James McKay's proof of Cauchy's theorem by Dummit Foote Abstract Algebra:

I need explanation for part (e), where they say: every equivalence class has order $1$ or $p$, and here they claim that $p$ is prime. But, I think that even if $p$ was not prime, every equivalence class would have order $1$ or $p$. For example, in $\Bbb Z/4\Bbb Z$, when we form similar $\mathcal S$, then tuples like $(2,2,2,2)$ have order $1$ but tuples like $(1,2,3,2)$ have order $4$. So, where do we use the fact that $p$ is prime?
Answer: For $p=4$ you have tuples such as $(1,2,1,2)$ which have order $2$.
The point is that the cyclic group of order $p$ acts on the set of $p$-tuples
by cyclic permutations.
When $p$ is prime, the size of each orbit of this action is a factor of $p$,
so is $1$ or $p$. When $p$ is not prime, then one gets orbits whose size is
a proper factor of $p$, and the argument collapses.
Comment: $1+2+1+2=6$ is not $0$ mod 4
Comment: oh! 0,2,0,2 works


What does Remote SSH install on the remote machine?

Question: I need to be very careful with the remote machine that i'll be interacting with. It's a Red Hat 6, and I don't want to install anything extra or redundant. The remote machine isn't mine and I need to be very careful/delicate with it. What are the things that VSCode remote SSH will install on that machine?
Comment: The answer in https://stackoverflow.com/questions/56718453/using-remote-ssh-in-vscode-on-a-target-machine-that-only-allows-inbound-ssh-co details the component required
Answer: VSCode installs the server side executable in your home directory. Unfortunately, it looks like VSCode requires RedHat 7, so Remote SSH might not even be an option for you.
https://code.visualstudio.com/docs/supporting/requirements
If you are worried about inadvertently causing an issue on the Red Hat 6 server, you could try it out on a VM to make sure there are no issues.


Walter Rudin's proof: countable union of countable sets is countable

Question:
The capture is from Rudin's Principles of Mathematical Analysis, and I've seen similar proof for this theorem but with a different technique. It uses a single arrow to throw all the elements, the arrow can wiggle and turn around, this kind of proof I could understand.
Q1: When I see Rudin's proof, I was confused about how those arrows have bijections with $\mathbb{N}$. It said arrange in sequence, it seems that the sequence's terms are increasing(e.g $2$nd term is a two-element tuple, $3$rd term is a three-element tuple, etc.) can a sequence have terms for different types?
Comment: Think of ordering the arrows (and the elements $x_{i,j}$ that the arrows intersect) in order of increasing arrow length.
Comment: You could also suppose that at the head of each arrow you add a line joining the head of the arrow to the tail of the arrow below it. Now you have one zig-zag path starting at the upper left. Follow that path, collecting all the terms you pass over while moving upward to the right and not collecting terms while moving downward to the left.
Answer: A sequence can be whatever you want - but in this case, that's making things unnecessarily complicated. Just flatten the sequence-of-sequences down into a single sequence by following the arrows and concatenating the elements you pass by together in order. That is, trade the semicolons in (17) for commas, and discard the repeated entries.
Comment: "Countable elements" seems to be the wrong framing. Think about the entire set; your job is to place the set in a bijection with the natural numbers (or a surjection from them). As for whether this is admissible as a proof, this depends entirely on context. (Is it for a journal article? For a teacher? Which teacher, since they don't all agree? Etc.)
Comment: Note that arrow number $n$ covers $n$ elements. Does that answer your question, or have I misunderstood?
Comment: @LJNG "how should I convince myself that each arrow only covers countable elements?" – Consider any arrow. That arrow covers at least one element, $x_{ab}$. Notice that all of the elements that an arrow covers have the same sum of indices. (For example, there is an arrow that covers $x_41$, $x_32$, $x_23$, and $x_14$. The sums of indices here are $4 + 1$, $3 + 2$, $2 + 3$, and $1 + 4$, all of which equal $5$.)
Comment: @LJNG So the only other elements that our arrow can cover are elements $x_cd$, where $c$ and $d$ are positive integers such that $c + d = a + b$. There are only finitely many such pairs of numbers $(c, d)$. Therefore, this arrow covers only finitely many elements.
Comment: Following this diagram proof, how should I convince myself that each arrow only covers countable elements? Also, is a diagram proof really admissible in analysis? Or this is just a sketch of the proof
Comment: The diagram itself isn't the proof; the proof is the words that follow below, and the diagram is meant to make those words clearer.
Comment: Regarding the arrows, clearly the $1^{\text{st}}$ arrow covers $1$ element, and the $2^{\text{nd}}$ arrow covers 2 elements... and the $n^{\text{th}}$ arrow covers $n$ elements... Regarding "diagram proofs", proofs in more advanced textbooks often assume that the student has the ability to fill in set theoretic details themselves.
Comment: @TannerSwett Thank you for your reply. That's true from finite case observation. My question can go like "how do you know there is no arrow covering a countable infinite number of elements?" Is that because the argument that each element has been indexed, so it must be finite?
Comment: @LJNG "how do you know there is no arrow covering a countable infinite number of elements?" – Isn't that exactly what I just gave a proof of?
Answer:
it seems that the sequence's terms are increasing(e.g $2$nd term is a
two-element tuple, $3$rd term is a three-element tuple, etc )

This is incorrect.
Rudin is referring to the following sequence, which is a bijection of $\mathbb{N}$:
$x_{1,1}$  is the first term, $x_{2,1}$ is the second term, $x_{1,2}$ is the third term, $x_{3,1}$ is the forth term, $x_{2,2}$ is the fifth term, and so on.
A Bijection between this sequence and $\mathbb{N}$ can be seen because:

For each of the elements of the union of the all the $E_n,\ $ for example $\ x_{3,1},\ $ the arrows do not go over this element twice and the arrows do not miss out any of these elements.
In other words, for each element $x_{i,j}\ $ in Rudin's "arrow sequence": $x_{1,1},\ x_{2,1}\ x_{1,2}\ x_{3,1}\ x_{2,2}\ \ldots,\ $ there exists a unique positive integer $n$ such that $x_{i,j}\ $ is the $n$-th element of this sequence. Furthermore, for every integer $m,$ there exists a unique pair $(i,j)$ such that $x_{i,j}\ $ is the $m$-th element of the sequence. Thus the sequence is a bijection of $\mathbb{N}$.
Answer: The proof shows that there is a surjection from $\mathbb{N}\times\mathbb{N}$ to $S$(map each pair $(n,k)$ to $x_{nk}$), this means that there is an injection from $S\to \mathbb{N}\times\mathbb{N}$, since $\mathbb{N}\times\mathbb{N}$ is countable there is an injection $S\to T$ where $T$ is a subset of the naturals.


Customizing Windows Server images from Linux

Question: We have an environment where we have blasted a prepped Windows image out to multiple machines. We now need to customize the networking settings on each image en masse.
What tools exist to modify that image and customize the IP address/netmask/gateway post-imaging?
I would also look at a commercial solution that is able to deploy and customize Windows images as long as it runs on Linux and is fully scriptable.
To clarify, my order of operations is:

Server PXE boots
Various Things are done to the hardware to prep it
Image is copied onto the hard drive
Image is customized (network settings)

(Naturally, if such a deployment tool exists that can do the last two in one step, I'll take that)
Comment: I don't get it. You prepare multiple Windows servers but only want to do so from Linux? Why can't you do it from a Windows machine, for which the tools are readily available?
Comment: @John: Most of the deployed images are Linux, but a requirement has come up to do the same with Windows. (Trust me, it makes sense given what we're doing)
Comment: Are you talking about changing the settings post image? Or do you have a lot of Windows images you need to make changes to settings before you push the image?
Comment: The latter - I've clarified the question.
Answer: You could use WinExe from the linux box. That would let you do things a la psExec on a windows box. Combine that with the netsh static ip commands and you should be good. Another option would be to use wbemcli to do the same thing via WMI. Both of those should be easy enough to script up.
Comment: @MikeyB: Ahh I've got it now. I think the answer is "it can't be done" then...
Comment: Ah - let me clarify (again). Linux is running on the server being deployed - I need manipulate the offline image. No Windows is actually running, and I'd like to keep it that way if possible.
Answer: While I'm not quite directly modifying the Windows image from Linux, I've taken a slightly different approach that works great.
I'm writing the various netsh and wbemcli commands to a script that gets run once on Windows bootup.


$e^x$ defined $a^x$

Question: I have read the chapter up and down but I do not see how, I would like to not take anything from the book but start on e fresh example as I think that would help me to realise what is going on.
Im struggling to see how
$e^x$
is defined for all real x to define the arbitrary exponential
$a^x$
(where a>0) for all real x
Could someone show the connection
This is what is stated:
I have been shown this in the book: If r is rational $\text{Ln}\left(a^r\right)=r \text{Ln}(a)$, therefore: $a^r=e^{\text{rLn}(a)}$, I understand the first part($\text{Ln}\left(a^r\right)=r \text{Ln}(a)$), but I do not understand:
therefore $a^r=e^{\text{rLn}(a)}$
Answer: $a^x=e^{x(\ln a)}$. This is how $a^x$ is defined in general.
Comment: If $\ln x= y$ then $x= e^y$- this is by the definition of $\ln$.
Comment: I have been shown this in the book: If r is rational $\text{Ln}\left(a^r\right)=r \text{Ln}(a)$, therefore: $a^r=e^{\text{rLn}(a)}$, I understand the first part($\text{Ln}\left(a^r\right)=r \text{Ln}(a)$), but I do not understand therefore .....

$e^x$ defined $a^x$


What mode does this guitar solo use?

Question: I'm trying to learn this amazing guitar solo from W.C. Fields played by Gabor Szabo.
It starts at 02:00. I learned this first section which is in the key of G major.
At 02:20–02:32 it switches to something else. It sounds very modal but I'm not good with modes yet so I hope someone can take a listen and let me know what mode it is.
Comment: Not a mode as such, simply a 'key change' temporarily. Shades of 'Up Up and Away'.
Comment: 2:15 the melody note is a D = so in G, and modulates to D = mi in Bb
Comment: @Tim Talk about modulations, "Up Up and Away", whew! Blink and you'll miss one! Still, it's an amazing and very cohesive song, the way the common tones in melody tie them all together.
Comment: @AlbrechtHügli - 'common tone modulation' in the trade!
Answer: I've roughly written out the guitar solo below. It's not 100% accurate but it's near enough there (I stopped a little into the C major section because it doesn't modulate anymore in the solo after that):

You can see that the solo starts in G major, then modulates to Bb major around bars 9-10 and then modulates again to C major around bars 17-18.
The section you have asked about is in the Bb section, where the harmony implied underneath the solo switches between the chords Bb major and Ab major every two bars. The solo itself basically outlines those chords with variations on Bb and Ab arpeggios - it's not that modal, just changing scales/arpeggios to match whatever chord is underneath (play Bb major scale/arpeggio over Bb, Ab major scale/arpeggio over Ab, etc).
If you want to play a mode over this during your own improvisation, the mixolydian mode could be a good place to start (it's just the major scale/ionian mode with a b7) since the chords underneath the solo are switching between I and bVII. If you want to play like this solo though, just following the chords is a really easy technique to sound "modal" or "jazzy".

If you want the actual tab for what I wrote above, here you go:

I didn't write this with a guitar in front of me so you might find an easier/more natural way to play it. It was written more for the notation than for the guitar fingering.
Answer: At that point in the solo the song goes to Bbmaj7 and Abmaj7, 2 bars each twice but the Abmaj7 is only one bar the second time before transitioning back to the key of G.
So regarding modes, he just plays Bb and Ab natural major (Ionian) scales over the Bb and Ab chords respectively. He plays a lot off the 5th, 7th and 9th notes of those chords as well.
Comment: 'Natural' major? Does it need that word?
Comment: @Tim since the OP asked about modes and there are 3 major modes I thought it wouldn't hurt.
Comment: It wasn't a criticism, just a rarely heard term. It works well, comparing it to the 'natural minor'!
Comment: @Tim the term "natural minor" is why it occurred to me to use it, naturally.
Answer: 1: The harmony is A# ang G#, and they use different scales each one
2: as the solo doesn't use 7 notes, we can't determine if it's Ionian, Lydian or Mixolydian. On A# chord the solo uses notes a#, c, d, f, a. On G# chord the solo uses g#, a#, c, d#, g
3: in both chords+melody, the guitar uses the I, II, III, V and VI of the A# and G# major scales on Ionian mode OR I, III, IV, V and VII of F and D# major scales on Lydian mode.
4: it can't be D# Mixolydian and C# Mixolydian because on A# chord it should have an Ab instead of A, and in G# chord it should have a Gb instead of G
Comment: A bit confusing with note names!

What mode does this guitar solo use?


How do I save username and password using a "Remember me" checkbox in the login form?

Question: I want to save username and password using a Remember me checkbox. If I click it, the username and password should be save for future. In Drupal I am using Persistent login module to do this but I am not able to save the username and password.
Comment: Welcome to Drupal Answers! You are merely listing your requirements, without asking any explicit question. (The title doesn't count as explicit question.) You should at least say what you tried and why it didn't work as expected. Did you look for any module on drupal.org? Keep in mind that module requests are off-topic for us, so questions asking to recommend or find a module are closed.
Answer: I think Remember me module doing the same job which you wants.
Comment: the username and password is not get saved if clicked on Remember me checkbox in Remember me module


How to create a new column with the continent names of each country?

Question: I have a list of countries in a column and I need to get their continent in a new column.
My list has 180 different countries

country
Switzerland
France
Denmark
China
Argentina

and I need to get their continents like the following one

country -continent
Switzerland - europe
France - europe
Denmark - europe
China - asia
Argentina - america

I read something about pycountry-convert, but my apologies I couldn't find good documentation or examples.

You can see my code and the data frame here
Answer: As far as I get your question, you first need to convert the country name to the alpha2 format and then check for the continent. This is one approach. You need to do the following :-

traverse through each item in your country's column and apply the following transform

country_name_to_country_alpha2(cn_name, cn_name_format="default")

Then you need to apply the transform on the above generated column

country_alpha2_to_continent_code()

This is the basic idea behind doing this. If you need any more clarifications please reach out.
Comment: Thank you capt2101akash.
I converted the each country name to an alpha2 format, using the following.

`import country_converter as coco;
names = df.index.tolist();
names = ['GR' if (x == 'EL') else x for x in names];
names = ['GB' if (x == 'UK') else x for x in names];
iso3 = coco.convert(names=names, to='ISO3', not_found=None);
`

But I don't know how to do the rest, do you mind giving me an example?
Comment: You just have to use pycountry-convert package of python. In that package you have a function called `country_alpha2_to_continent_code()` you need to apply that in order to get the continent code of each country.


How do I use residues to evaluate this integral

Question: I had a question in the exercises of a complex analysis course I couldn't solve, It asked me to evaluate this integral $$\int_{-\pi}^{\pi}\frac{dx}{\cos^2(x) + 1}$$
I tried to evaluate it without using residues, the antiderivative of this function contains tan, which is not defined at $\pm \pi/2 $
all the examples I have worked with so far are rational functions (a polynomial over another)
Answer: First start by:
$$\int _{-\pi }^{\pi }\:\frac{dx}{\left(\cos \left(x\right)\right)^2+1}=4\int _{0\:}^{\frac{\pi }{2}\:}\:\frac{dx}{\left(\cos \:\left(x\right)\right)^2+1}=4\int _{0\:}^{\frac{\pi \:}{2}\:}\:\frac{\left(\sec \left(x\right)\right)^2dx}{2+\left(\tan \left(x\right)\right)^2}$$
Then using substitution $$u\sqrt{2}=\tan \left(x\right)$$
We get:
$$2\sqrt{2}\int _0^{\infty }\:\frac{du}{1+u^2}=\pi \sqrt{2}$$
Answer: Here's an answer using residues.
Using
$cos(x) = \frac{1}{2}\left(e^{ix} + e^{-ix}\right)$
and defining $z=e^{ix}$ which implies $dz = izdx$, we write the integral as
$$\int_{-\pi}^{\pi} \frac{1}{(cos(x))^2+1} dx$$
$$=\int_{-\pi}^{\pi} \frac{4}{z^2+6+1/z^2} \frac{dz}{iz}$$
$$=\frac{1}{i}\int_{-\pi}^{\pi} \frac{4z}{z^4+6z^2+1} dz. $$
We so obtained an integral along the unit circle!
Next, we need to find all residues inside the unit circle.
For this, we define $g(z) = z^4+6z^2+1$. Factoring out gives
$$g(z) = (z^2 + 3 + 2\sqrt{2})\ldots\\ \ldots\left(z-i\sqrt{3-2\sqrt{2}}\right) \left(z+i\sqrt{3-2\sqrt{2}}\right). $$
Hence, there are two roots inside the unit circle,
$$z_1 =i\sqrt{3-2\sqrt{2}}$$
and
$$z_2=-i\sqrt{3-2\sqrt{2}}$$
(and two outside coming from the first bracket but we don't have to care about those). And it is for these two roots that we have to find the residues.
Defining $f(z) = 4z$, we see that our integrand is a rational function, $f/g$. Moreover, $z_1$ and $z_2$ are poles of order 1 of $f/g$. For this case, there is a well known result giving us the residues for $f/g$ at these poles, namely
$$Res\left(\frac{f}{g}, z_k\right)=\frac{f(z_k)}{g'(z_k)}$$
where $k\in\{1, 2\}$.
Since $g'(z) = 4z^3 + 12z$, we obtain:
$$Res\left(\frac{f}{g}, z_k\right)=\ldots=\frac{1}{z_k^2 + 3}=$$
$$\ldots=\frac{1}{2\sqrt{2}}$$
(yep, the same for both $k$).
We conclude by applying the residue theorem:
$$\frac{1}{i}\int_{-\pi}^{\pi} \frac{4z}{z^4+6z^2+1} dz$$
$$=\frac{1}{i}\left(2\pi i \sum_{k=1}^{2}Res\left(\frac{f}{g}, z_k\right)\right) $$
$$=\frac{1}{i}\left(2\pi i \frac{2}{2\sqrt{2}}\right)$$
$$=\pi \sqrt{2}. $$


Como deixar o texto alinhado com a imagem

Question: Estou criando um portfólio pra mim e estou tentando deixar o texto reto como nesse site https://blackrockdigital.github.io/startbootstrap-agency/# (na área about) se vocês perceberem o texto fica retinho nos primeiros parágrafos parece que foi feito com régua, e os do meu site estão quebrando linhas esta tipo assim:
Lorem ipsum dolor sit
  amet, consectetur adipiscing elit.
Integer dolor lorem,
  eudapibus. Mauris eget laoreet
augue, quis sodales dolor.

.tudo {
  width: 30%;
  background-color:#009;
}
.tudo img {
  float: left;
}
.tudo p {
  padding-left: 100px;
}

 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer dolor lorem,
    efficitur sed gravida sed, congue id magna. Vestibulum tincidunt eu sapien
    eu dapibus. Mauris eget laoreet augue, quis sodales dolor.

Comment: Coloca o código.
Comment: calma ae que deu ruim vou postar jfiddle
Comment: https://jsfiddle.net/ppgcdL4p/
Comment: Não precisa, Ctrl + K você formata o código ou clicando no { } na edição.
Comment: **Relacionada**: [Como alinhar o texto na frente de outro elemento?](http://pt.stackoverflow.com/q/169300/4808)
Answer: Entao pessoal e o seguinte uma coisa tao simples de ser resolvida e o idiota aqui usando bootstrap acabou me atrapalhando mais que ajudando e eu tinha esquecido do poderoso text-align:left  no paragrafo o my god, deixa o topico aberto ae pq nos outros topicos nenhum citou o text-align:left


Composite variation or standard deviation without common means for more than 2 samples

Question: I know the formula for pooled variance is  if the mean for all samples are equivalent and I know that if I want to combine the sigma of two samples with different mu, then the formula is , but what would I do if I wanted something like the second formula with more samples? I'm working with 51 samples. I suppose I could use the second formula to combine 2 samples at a time until I got all 51, so I'd do the same thing 50 times, but that sounds terribly cumbersome and while that's work I'd be willing to do, I would strongly rather not if there happens to be an easier way to do this.
I also have access to LibreOffice Calc, which should relieve me of some of the workload.
To summarize, I have the mus and sigmas of 51 different samples and need to find the sigmas of all of the samples combined in the most efficient manner possible.
Answer: Well, Charles Zaiontz answered my question! ^_^
http://www.real-statistics.com/descriptive-statistics/measures-variability/measures-variability-detailed/#comment-848425


tcp syn checking

Question: I have a WatchGuard Firebox that I've recently configured.  All of the policies look fine and all appropriate services seem to be working correctly.
However, one or two (seemingly) random nodes keep getting blocked from making HTTP requests to a 1:1 NATed host that everyone else makes just fine.
The firewall log tells me that tcp syn checking failed, and these requests use destination port 64 for clients behind the appliance, and port 50 for clients on the outside.  I've finally found this option and disabled it under the Global Settings (which leaves a bad taste in my mouth), and that seems to have done the trick.
The documentation is uber thin on the topic, though.  Can anyone explain to me exactly what tcp syn checking does/is, and how I might make an appropriate allowance for it in my policies rather than globally disabling it (assuming, of course, there is a more graceful solution than a global rule)?
Answer: From Watchguard:
TCP SYN checking
The global TCP SYN checking setting is:
Enable TCP SYN checking
This feature makes sure that the TCP three-way handshake is done before the Firebox allows a data connection.
So I imagine the watchguard isnt seeing the usual syn/syn ack/ack happen for whatever reason and killing the connection.
Comment: Additionally, SYN checks on firewalls are typically done to prevent SYN floods, a denial of service attack using a flood a of TCP syn packets.
Answer: I work for WatchGuard. The SYN check is just to ensure that a TCP handshake has taken place before allowing other traffic. Even if this is turned off, we still ensure TCP handshakes that we do observe complete correctly, and does not impact our TCP SYN Flood protection. It is safe to turn off.
It will often trigger due to TCP timeouts on the WatchGuard being shorter than the timeouts on the server/client connection. When the server/client talk again, the WatchGuard assumed the connection was closed and likes to see the TCP handshake again.
Comment: If TCP SYN checking is safe to turn off, what value does it provide?

tcp syn checking


Solve the integral $ \int{y^2dl}$ where L:$x^2+y^2+z^2=a^2;$ $x+y+z=0$

Question: Solve the integral $ \int{y^2dl}$ where L:$x^2+y^2+z^2=a^2;$ $x+y+z=0$.
I tried to apply a 2 parametrizations:
1)
$x= \sqrt{\frac{2t^2}{-3t-\frac{a^2}{2}}}$
$y= \sqrt{-\frac{3}{2}t-\frac{a^2}{4}}$
$z= \sqrt{-6t-a^2}$
From this (using $\int{f \sqrt{(\frac{dx}{dt})^2+(\frac{dy}{dt})^2+(\frac{dz}{dt})^2}}$ i got something like $\int f(t^2) \sqrt{\frac{p(t^2)}{g^3(t)}}dt$
which I don't know how to solve.
2)
Moving to spherical coordinates (r, fi, theta):
$r=a$
and there is an equation with fi and theta (from $x+y+z=0)$ which seems too complex do deal with.
Now I hope to find the parametrization that will be more fitting.
Answer: I think $\int{x^2}d l$=$\int{y^2}d l$=$\int{z^2}d l$ by the symmetry of $L$,so
$$\int{y^2}d l=\frac{1}{3}\int{(x^2+y^2+z^2)}d l=\frac{1}{3}\int{a^2}d l$$
And
$$x=\frac{\sqrt{2}}{2}a\cos{t}-\frac{\sqrt{6}}{6}a\sin{t},\,\,y=\frac{\sqrt{6}}{3}a\sin{t},\,\,z=-\frac{\sqrt{2}}{2}a\cos{t}-\frac{\sqrt{6}}{6}a\sin{t}$$
where $t\in[0,2\pi]$ will be a good parametrization.
Comment: Damn, that's a badass solution! How did you come up with this parametrization?
Comment: Consider the projection of $L$ on $xOy$: $x^2+xy+y^2=\frac{a^2}{2}$, which is also $(x+\frac{y}{2})^2+\frac{3}{4}y^2=\frac{a^2}{2}$.
Comment: Oh, I see. Thank you!


Aproveitar cache do navegador não funciona

Question: A ferramenta do Google PageSpeed está exibindo o erro:

Aproveitar cache do navegador.

Meu site: buscaempresas.com.br.
Eu ativei em meu servidor os módulos expires e headers, depois eu adicionei no htaccess a configuração abaixo:
#Força a utilizar Cache-Control e Expires header
<IfModule mod_headers.c>
  Header unset ETag
</IfModule>
FileETag None
<IfModule mod_expires.c>
 ExpiresActive on
 ExpiresDefault "access plus 1 month"
 ExpiresByType text/cache-manifest "access plus 0 seconds"
 # Html
 ExpiresByType text/html "access plus 0 seconds"
 # Data
 ExpiresByType text/xml "access plus 0 seconds"
 ExpiresByType application/xml "access plus 0 seconds"
 ExpiresByType application/json "access plus 0 seconds"
 # Feed
 ExpiresByType application/rss+xml "access plus 1 hour"
 ExpiresByType application/atom+xml "access plus 1 hour"
 # Favicon
 ExpiresByType image/x-icon "access plus 1 week"
 # Media: images, video, audio
 ExpiresByType image/gif "access plus 1 month"
 ExpiresByType image/png "access plus 1 month"
 ExpiresByType image/jpg "access plus 1 month"
 ExpiresByType image/jpeg "access plus 1 month"
 ExpiresByType video/ogg "access plus 1 month"
 ExpiresByType audio/ogg "access plus 1 month"
 ExpiresByType video/mp4 "access plus 1 month"
 ExpiresByType video/webm "access plus 1 month"
 # HTC files
 ExpiresByType text/x-component "access plus 1 month"
 # Webfonts
 ExpiresByType application/x-font-ttf "access plus 1 month"
 ExpiresByType font/opentype "access plus 1 month"
 ExpiresByType application/x-font-woff "access plus 1 month"
 ExpiresByType image/svg+xml "access plus 1 month"
 ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
 # CSS / JS
 ExpiresByType text/css "access plus 1 year"
 ExpiresByType application/javascript "access plus 1 year"
 ExpiresByType application/x-javascript  "access plus 1 year"
</IfModule>
#Força o IE a sempre carregar utilizando a última versão disponível
<IfModule mod_headers.c>
  Header set X-UA-Compatible "IE=Edge,chrome=1"
  <FilesMatch "\.(js|css|gif|png|jpeg|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
    Header unset X-UA-Compatible
  </FilesMatch>
</IfModule>

Mesmo assim o erro continua sendo exibido. Já testei diversas coisas mas não consegui arrumar esse erro.
Answer: Os recursos que apresentam o problema são externos:
http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js (60 minutos)
https://pagead2.googlesyndication.com/pagead/osd.js?137237720 (60 minutos)
https://www.google-analytics.com/analytics.js (2 horas)

Você não tem controle sobre eles, como eu disse nesta resposta:

https://pt.stackoverflow.com/a/124656/3635

Não tem como resolver, mas não é um problema grave de fato.

Já a outra mensagem de erro não tem nada haver com cache, o problema é no bloqueio de renderização:

Remova o JavaScript de bloqueio de renderização:

Para resolver leia isto:

https://pt.stackoverflow.com/a/115240/3635
https://pt.stackoverflow.com/a/211913/3635

Não é só um copy+paste, leia e entenda as propostas e aplique conforme necessário.


Postfix qmgr[]: warning: connect to transport private/test: No such file or directory and mail transport unavailable

Question: I added to Postfix the following options:
master.cf:
test unix - - n - - smtp

main.cf:
transport_maps = hash:/etc/postfix/transport_maps
test_destination_rate_delay = 5s
test_destination_recipient_limit = 1

transport_maps:
domain.com  test:
domain2.com test:[smtp-server.com]:587

After postmap and restart postfix I got that information in logs:
qmgr[]: warning: connect to transport private/test: No such file or directory
error[]: ..... status=deferred (mail transport unavailable)

In this path: /var/spool/postfix/private I dont see a file: test
What am I doing wrong ?
Comment: If your service did not start, postfix would have mentioned so in the logs. Check the logs around the time you restarted the server. (also: smtp clients are commonly chrooted - `y` in 4th column, you have `n` - did you mean to do that / is that different from your default `smtp` line?)
Comment: What exactly are you trying to do?
Answer: Problem has been solved. After reboot everything has repaired.
Missing file "test" from /var/spool/postfix/private has been created. But reset all services related to mail did not work only after fully reboot machine it worked.


htaccess rewrite subdomain and requests uri

Question: Having trouble with a rewrite condition within my htaccess. I need to redirect the request from a subdomain. However, there are three subdomains for each language: en.foo.com, es.foo.com, www.foo.com. If they have a request they must persist the according subdomain.
E.g:
Requested:
fdsfds.foo.com/test
Desired:
www.foo.com/test
Currently:
www.foo.com
.htaccess file:
# BEGIN .net to .com redirect
RewriteEngine On
RewriteCond %{HTTP_HOST} foo.net$ [NC]
RewriteRule ^(.*)$ http://www.foo.com/$1 [R=301,L]
# END .net to .com redirect

# BEGIN force www on non-www requests
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# END force www on non-www requests

# BEGIN .net to .com redirect (english)
RewriteCond %{HTTP_HOST} ^en\.foo\.net$ [NC]
RewriteRule ^(.*)$ http://en.foo.com/$1 [R=301,L]
# END .net to .com redirect (english)

# BEGIN .net to .com redirect (spanish)
RewriteCond %{HTTP_HOST} ^es\.foo\.net$ [NC]
RewriteRule ^(.*)$ http://es.foo.com/$1 [R=301,L]
# END .net to .com redirect (spanish)

# BEGIN .net to .com redirect (spanish)
RewriteCond %{HTTP_HOST} ^www\.foo\.net$ [NC]
RewriteRule ^(.*)$ http://www.foo.com/$1 [R=301,L]
# END .net to .com redirect (spanish)

# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^es\. [NC]
RewriteCond %{HTTP_HOST} !^en\. [NC]
RewriteRule ^ http://www.foo.com/ [L,R=301]

Answer: Well, I think you just need to modify the last RewriteRule, which redirects every other request (i. e. the ones that do not start with es or en or www) to http://www.foo.com/. Could you try something like this instead:
RewriteRule ^(.*)$ http://www.foo.com/$1 [L,R=301]

and please let me know if it does the right thing.


Random vs. fixed effect in glmer binomial model

Question: I'm using a binomial glmer mixed effects model using and I have two questions.
One variable that I have, 'stimulus' has 12 levels. The levels were not randomly selected, so I have used it as a fixed variable in the basic model but R seems not to like it (at least this is my interpretation) given the way the output looks and the amount of time R takes to process it.
m0.1 <- glmer(match ~ Listgp + stimulus + (1|Listener), data = PATdata, family = "binomial")

summary(m0.1) Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [ glmerMod] Family: binomial ( logit ) Formula: match ~ Listgp + stimulus + (1 | Listener) Data: PATdata
 AIC      BIC   logLik deviance df.resid
5154.3 5259.5 -2562.2 5124.3 8193

Scaled residuals: Min 1Q Median 3Q Max -25.0764 -0.2706 -0.1939 0.2472 10.5131

Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.743 1.32
Number of obs: 8208, groups: Listener, 228

Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.7561 0.2657 10.371 < 2e-16 * ListgpTA 0.1741 0.3147 0.553 0.580128
ListgpTQ 0.0810 0.2575 0.315 0.753094
stimulushaaDD -5.4415 0.2071 -26.272 < 2e-16 stimulushad -4.2953 0.1822 -23.569 < 2e-16 stimulushaDD -5.4946 0.2086 -26.337 < 2e-16 stimulushid -5.1519 0.1994 -25.832 < 2e-16 stimulushiDD -0.6708 0.1801 -3.724 0.000196 stimulushiid -5.8124 0.2186 -26.593 < 2e-16 stimulushiiDD -5.5101 0.2091 -26.353 < 2e-16 stimulushud -0.2016 0.1915 -1.053 0.292345
stimulushuDD -5.6188 0.2123 -26.462 < 2e-16 stimulushuud -5.6107 0.2121 -26.450 < 2e-16 *

stimulushuuDD -5.3207 0.2038 -26.109 < 2e-16 ***

Signif. codes: 0 '' 0.001 '' 0.01 '' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects: (Intr) LstgTA LstgTQ stimulushaaDD stimulushad stimulushaDD ListgpTA -0.613
ListgpTQ -0.755 0.636
stimulushaaDD -0.394 -0.007 0.004
stimulushad -0.440 -0.006 0.005 0.605
stimulushaDD -0.392 -0.007 0.003 0.555 0.601
stimulushid -0.407 -0.007 0.004 0.572 0.624 0.569
stimulushiDD -0.414 0.000 0.001 0.534 0.606 0.530
stimulushiid -0.376 -0.006 0.003 0.536 0.578 0.533
stimulushiiDD -0.391 -0.007 0.003 0.554 0.600 0.551
stimulushud -0.386 0.000 0.000 0.497 0.564 0.493
stimulushuDD -0.385 -0.007 0.003 0.548 0.592 0.545
stimulushuud -0.386 -0.007 0.003 0.548 0.593 0.545
stimulushuuDD -0.400 -0.007 0.004 0.564 0.613 0.561
stimulushid stimulushiDD stimulushiid stimulushiiDD stimulushud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD 0.554
stimulushiid 0.549 0.506
stimulushiiDD 0.568 0.529 0.533
stimulushud 0.516 0.569 0.471 0.492
stimulushuDD 0.562 0.521 0.527 0.544 0.484
stimulushuud 0.562 0.522 0.528 0.545 0.485
stimulushuuDD 0.579 0.543 0.542 0.560 0.505
stimulushuDD stimulushuud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD
stimulushiid
stimulushiiDD
stimulushud
stimulushuDD
stimulushuud 0.539
stimulushuuDD 0.554 0.554

So, my question is, can I consider 'stimulus' as a random effect instead?
m0.1 <- glmer(match ~ Listgp + (1|stimulus) + (1|Listener), data = PATdata, family = "binomial") summary(m0.1) Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [ glmerMod] Family: binomial ( logit ) Formula: match ~ Listgp + (1 | stimulus) + (1 | Listener) Data: PATdata
 AIC      BIC   logLik deviance df.resid
5218.3 5253.4 -2604.2 5208.3 8203

Scaled residuals: Min 1Q Median 3Q Max -21.9276 -0.2804 -0.2059 0.2740 9.4275

Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.676 1.294
stimulus (Intercept) 4.949 2.225
Number of obs: 8208, groups: Listener, 228; stimulus, 12

Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.3754 0.6792 -2.025 0.0429 * ListgpTA 0.2284 0.3073 0.743 0.4572

ListgpTQ 0.1432 0.2513 0.570 0.5687

Signif. codes: 0 '' 0.001 '' 0.01 '' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects: (Intr) LstgTA ListgpTA -0.235
ListgpTQ -0.288 0.636

Comment: What is your exact research question?
Comment: Thanks Roland for the response. I'm testing whether the perceptions of three listener groups (Listgp; T, TA and TQ) would match already predicted perceptions based on corpus data. 'Match' is a binary predictor (match,mismatch) and is calculated by matching listener's response vowels to predicted vowels. Hope this makes sense.  I'm confident about the variable 'listener' being a random effect but not sure about 'stimulus'.
Comment: I don't see any reason here that would prohibit using `stimulus` as a crossed random effect.
Comment: Thanks again Ronald. My understanding about random effects is that they should have +100 levels and it should be sampled from a larger population. This is not the case in my data, as 'stimulus' has only 12 levels which are also selected intentionally for the purpose of the study., i.e., were not selected randomly.
Comment: Much appreciated Roland. I guess I needed to hear this line - "The question is not if the subjects were sampled randomly from a distribution, but if modeling them as a random sample results in a useful and sensible model" to ascertain my intuition. I already posted it in stackexchange.com but received no answer but that's ok for now. I will use stimulus as a random effect since indeed the 2nd model is more useful and sensible!
Answer: Since there is no interest in the individual estimates for stimulus,and with 12 levels, it makes sense to fit random intercepts in for these data.
From the question comments:

My understanding about random effects is that they should have +100 levels and it should be sampled from a larger population. This is not the case in my data, as 'stimulus' has only 12 levels which are also selected intentionally for the purpose of the study., i.e., were not selected randomly.

You understanding is wrong - there is absolutely no requirement to have 100+ levels. While there is no black and white rule, a number around 6 is often considered the minimum.
While the random selection criterion is also a good reason for choose to fit random intercepts, it is not a requirement. There are often conflicting reasons for choosing either and the ultimate choice is usually whatever suits the research question best.
Comment: Does this answer your question ? If so please consider marking it as the accepted answer. If not please let us know why so that it can be improved.


How to use traditional (national/native) dates and calendars?

Question: How can use non-Gregorian dates and calendars?
I adjust Drupal setting to my native language (fa) and native location (Asia/Theran) but month name and number of years also in Gregorian yet (however there are translated to my native language-persian).
I already use format_date() or date() in theme files, but this function is not locale-aware, which means that it always outputs English language data, such as day and month names and ordinal number suffixes.
I want to show the month names in the native language (e.g. Chinese, Islamic, Hebrew, Farsi/Persian) and use the national calendar (e.g. Irani, Shamsi, Jalali).
I want to understand is there any module or hardcoding solution in Drupal to show dates and calendars in other non-Gregorian calendars.
Any suggestions?
Comment: `format_date` is deprecated anyway, don't use it - use `\Drupal::service('date.formatter')->format()` instead. That's a service, which you can replace, so nothing stopping you from 'replacing' this with your own or a different class. You'll need to make sure it stays compatible with the rest of Drupal, of course
Comment: Have you tried passing in a $langcode? What are you system.date settings in configuration?
Comment: This change record may be helpful: https://www.drupal.org/node/1834108
Answer: I'm hoping that someone else can Optimize this solution and make it better.
I'm ready to receive Any suggestion or criticism or any Other solution for this Challenge.
Features:

Does not requires any hacking or patching core /frontend solution
,display when dates are rendered
Does not change any date in database
Compatible and tested with PHP versions 5.3 and hereinafter
Supports Iranian/Persian/Shamsi/Jalali , Arabic/Hijri/Islamic, Thai, Hebrew...
Calendar systems
Better Performance becuse Doesn't outbreak the drupal core

Method 1, Using "IntelDateFormatter" Class:
First of all you must be sure that version of your php that installed is Newer than 5.3 and 'IntlDateFormatter' Extension was exist.
For use Traditional(National/Native) Date/Calender in Drupal 8 in nodes and Posted Comments with use of IntlDateFormatter class, add below codes to "THEME_NAME.theme":
For Nodes:
function THEME_NAME_preprocess_node(&$variables) {
    $locale = "fa_IR@calendar=persian";
    $dateType = IntlDateFormatter::NONE;//type of date formatting.
    $timeType = IntlDateFormatter::NONE;//if time format setting to none, will give you date itself
    $timezone = 'Asia/Tehran';
    $calendar = IntlDateFormatter::TRADITIONAL;//Non-Gregorian Calendar
    $pattern = 'y/M/d';

    $fmt = new IntlDateFormatter($locale, $dateType, $timeType, $timezone, $calendar, $pattern);
    $date = $variables['node']->getCreatedTime();
    $variables['date'] = $fmt->format($date);
}

For Comments:
function THEME_NAME_preprocess_comment(&$variables) {
    $fmt = new IntlDateFormatter(
    "fa_IR@calendar=persian",
    IntlDateFormatter::NONE,
    IntlDateFormatter::NONE,
    'Asia/Tehran',
    IntlDateFormatter::TRADITIONAL,
    'y/M/d'
    );

    // Getting the node creation time stamp from the comment object.
    $date = $variables['comment']->getCreatedTime();
    $variables['created'] = $fmt->format($date);
}

Information about "IntlDateFormatter" Parameters:
locale: Locale to use when formatting or parsing or NULL to use the value specified in the ini setting, Link:http://www.w3.org/International/articles/language-tags
datetype:Date type to use (NONE, FULL, LONG, MEDIUM, SHORT). This is one of the IntlDateFormatter constants.
timetype:
Time type to use (NONE, FULL, LONG, MEDIUM, SHORT). This is one of the IntlDateFormatter constants.
timezone:
Time zone ID, default is system default,
Link:http://www.php.net/manual/en/timezones.php.
calendar:
Calendar to use for formatting or parsing; default is Gregorian. This is one of the IntlDateFormatter calendar constants.
The calendars ICU allows you to play with include:

Japanese (@calendar=japanese)
Buddhist (@calendar=buddhist)
Chinese (@calendar=chinese)
Persian (@calendar=persian)
Indian (@calendar=indian)
Islamic (@calendar=islamic)
Hebrew (@calendar=hebrew)
Coptic (@calendar=coptic)
Ethiopic (@calendar=ethiopic)

Link:http://userguide.icu-project.org/datetime/calendar
pattern:
Optional pattern to use when formatting or parsing. Possible patterns are documented at: http://userguide.icu-project.org/formatparse/datetime

METHOD 2,Using External Functions (like "jdf" for persian language):
First download this function form: http://jdf.scr.ir/download/
and then put downloaded file to your theme folder and add this code to above of "Theme_Name.theme"
include ('jdf.php');

and then add below code to appropriate place:
function Theme_Name_preprocess_node(&$variables) {
   $date = $variables['node']->getCreatedTime();
   $variables['date'] = jdate("l j F Y", strtotime($date));
}

I'm hoping that someone else can build on this and make it better.
Answer: Taarikh module will help you use the Islamic calendar as a field formatter and widget for display with the ability to translate month names, I used it and works very well, it's the best for Islamic calendar.
You could patch the module to add support for other calendars "i could help"
Comment: https://github.com/mgomma/taarikh
Comment: Sure you could patch the module and push your code, I could add you as a contributor on github and work with you on that issue, By the way the module maintainer have another approach to add any calendar system but not working yet and I contacted him to contribute and publish it, let me know your mail address.
Answer: You can use this Modules:
Calendar Systems
Module page: Calendar Systems
Support: Iranian (jalali) , Arabic/Islamic/Hijri , Thai and Gregorian (Using PHP's built-in)
Version: Drupal 7
BY: Sina Salek
Description:

Advances Drupal's already awesome localization support one more big step ahead by Adding support for different calendar
  systems like Iranian , Jalali , Hijir , Thai , Hebrew etc. This
  support is currently limited to display and data entry for date fields
  and the back-end date is always Gregorian (Timestamp).

Datex
Module page: Datex
Support: only Iranian (Hijri Shamsi/ jalali)
Version: Drupal 7
By: Drupalion
Description:

Datex and related module will help to create a better multilingual
  website for languages needing a Jalali (Or in near feature of datex,
  any) calendar instead of default Gregorian calendar.

Hijri
Module page: Hijri
Support: Only Hijri Date (Islamic, Hijri Ghamari)
Version: Drupal 7, Drupal 8 (Development releases)
By: Abdullah Bamelhes
Description:

This is a smart module that basically extends Drupal's display date to
  provide Hijri Date integration with Drupal core date field and with
  other Drupal contributions.
This module is integrated very well with Views module

Taarikh
Module page:Taarikh
Support: Only Hijri Date (Islamic, Hijri Ghamari)
Version: Drupal 7, Drupal 8 (Development releases)
By: Husain Inad
Description:

Taarikh is a field formatter and widget module to display and input
  hijri dates using the fields defined by the date module. The formatter
  can work with all the fields defined by the date module, i.e., Date,
  Date (ISO format) and Date (Unix timestamp). The widget, however, does
  not work with Date (Unix timestamp).
Comment: The question is about drupal 8 and you suggest drupal 7 modules !!!


Technical question about Strichartz estimate's proof.

Question: I was studying the proof of Strichartz estimates from the book "Semilinear Schrödinger equation" of T. Cazenave. The proof is divided in several steps.
Here we can assume
$$\Theta_{t,f}(t)=\Phi(t)=\Phi_f(t)=\int_0^t e^{i(t-s)\Delta}f(s)ds.$$
I have to prove the following Strichartz estimate:
$$\left\|\Phi_f\right\|_{C\left(0,T;L^2(\mathbb{R}^n)\right)}\leq\left\|f\right\|_{L^{q'}\left(0,T;L^{r'}(\mathbb{R}^n)\right)},$$
where $(q,r)$ is any admissible pair, i.e. $-\frac{2}{q}=n\left(\frac1r-\frac12\right)$, and $f\in L^{q'}\left(0,T;L^{r'}(\mathbb{R^n})\right)$.
In the following picture I see that in order to use Fubini theorem to exchange the integrals I need to prove that $\Phi_f\in L^2$. I don't understand how to prove it.
Answer: I don't understand which part of the argument uses Fubini's theorem. Given $v\in H$ and $g\in C([0,T],H)$, where H is a Hilbert space, then $$ \left(\int_0^t g(s)ds, v\right)_H = \int_0^t (g(s),v)_H ds.$$
The key observation seems to be that $C_c([0,T), L^{r'}\cap L^2)$ is actually dense in $L^{q'}((0,T),L^{r'})$. But if you assume that $f\in C_c([0,T), L^2)$, then also $$g: t\mapsto \int_0^t T(t-s)f(s)ds \in C([0,T],L^2)$$
and you can perform the calculation as Cazenave writes.


Why do I have a validation error?

Question: My page in http://validator.w3.org show me an error in line:
$("<input type='text' />")

Why?
Isn't my code valid?
I present a piece of code. Please help.
<form action="{$smarty.const.APP_URL}user/login/" method="post">

            <input type="text" size="25" name="user_login" value="Twój login" onfocus="javascript:if(this.value=='Twój login')this.value='';" onblur="javascript:if(this.value=='')this.value='Twój login';" />
            <input type="password" size="25" name="user_password" id="password" />
            <input type="submit" class="btnLogin" value="" />

utwórz konto | zapomniałem hasła

</form>
{/if}
{literal}

{/literal}

Comment: `$` is missing in `("")`
Comment: Also, are you passing PHP/Smarty code to the validator by any chance?
Answer: You have a $ missing:
$(document).ready(function() {
    ("<input type='text' />")
---^

Replace it with:
$(document).ready(function() {
    $("<input type='text' />")

May be, the {/if}, {literal} smarty PHP tags might not get parsed by JavaScript, if they come without getting parsed by Smarty!
Comment: it should be a comment, you are not answering the question
Comment: @Pawel_W Actually I answered the question. Please check. I just asked a question in the end.
Comment: this is smarty template (notice other similar tags) so I don't know why you are asking about that {/if}
Comment: @Pawel_W Updated it. :) Please check. I know it is Smarty template.
Answer: it's not about missing $, it is that validator doesn't parse JS - when it sees "" it treats it like a html node - try to move your javascript to external file
Answer: According to the DOCTYPE you have, the JavaScript code might need to be wrapped like this:

This will effectively tell the HTML validator to ignore the contents.

Why do I have a validation error?


Create a cron job to automatically clear cache

Question: I'm trying to clear cache automatically with a cron job but it didn't work.
I'm debugging simply on the browser at this link website-url/cronjob.php.
I think it's a problem with the syntax, I have tried to truncate the tables from database.
As you can see in the code attached below, I've tried two methods, but neither one works.
<code>\Drupal::database()->truncate('cache_config')->execute();
mysql_query('TRUNCATE TABLE yqxq_cache_config');
mysql_query('TRUNCATE TABLE yqxq_cache_container');
mysql_query('TRUNCATE TABLE yqxq_cache_data');
mysql_query('TRUNCATE TABLE yqxq_cache_default');
mysql_query('TRUNCATE TABLE yqxq_cache_discovery');
mysql_query('TRUNCATE TABLE yqxq_cache_dynamic_page_cache');
mysql_query('TRUNCATE TABLE yqxq_cache_entity');
mysql_query('TRUNCATE TABLE yqxq_cache_menu');
mysql_query('TRUNCATE TABLE yqxq_cache_render');
mysql_query('TRUNCATE TABLE yqxq_cache_toolbar');
?>
</code>
What do I need to change to make this script work?
This is an example of query from the statistics view, which doesn't update if I don't run clear cache.
<code><?php
$count_users_tot = db_query('SELECT COUNT(uid) FROM {users}')->fetchField();
print $count_users_tot;
?>
</code>
Comment: Don't flush everything, bad practice. What exactly are those db queries doing anyways? Drupal 8 should be automatically invalidating cache if a field value changes.
Comment: Like sssweat already mentioned, it is bad practice to clear caches. Once a day can have valid cases, but every few minutes, and then all that is in your query you are taking huge performance penalties. If you only need to refresh database queries you better have a look at drupal tag based caching mechanisms https://www.drupal.org/docs/8/api/cache-api/cache-tags
Comment: @NoSssweat is right: Completely emptying the cache tables is not necessary. Also, Drupal doesn't use any cache for the executed queries; the question should make clearer the relation between executed query and which data is cached.
Comment: Drupal has build in mechanisms to clear caches. One of them can be found on the status page. Another way is to use drush.
Comment: I know that, but I don't need these options. I'm the developer for my client's website and I need to run clear cache automatically every x minutes to refresh some database queries...
Comment: I edited the question and added one query from my view. It's calculating the users that are staying longer than 60 minutes without premium membership.
Comment: Ok, so I need somehow to refresh the query.
Comment: It's not the query that needs to be refreshed. If the query were executed from a controller when rendering a page, then it would be the page to be cached. Since you are executing the query from an external script, there isn't any cache involved. Are you sure the cron task is not "visiting" a Drupal page which is executing the query and returning a value? The question doesn't make that clear, and they are two different cases.
Comment: The query is executed inside the view. The results are not refreshed until I will clear the cache, that's why I've tried to create a cron job.
Answer: Thanks to @No Sssweat, @kiamlaluno, @Rick B, I've got an answer.
Firstly, I learned that is not a good practice to clear cache automatically every minute or so often.
Secondly, I figured out that I can solve this problem without using a cron job at all, but I have to understand these tag based caching mechanisms.
The problem was as in the image attached below, Page-Caching was Tag Based, so selecting None option solved my issue.


Silverlight Object Display in Winform Application

Question: Is this possible? If so, how?
Answer: Silverlight is a client side browser plugin.  The only way to have it in a WinForm app would be for the WinForm to host a browser control.


$\frac 1 {1 + \epsilon} \le 1 - \frac \epsilon 2$ for $\epsilon \in (0, \frac 1 2)$

Question: How can we show that the following holds for $\epsilon \in (0, \frac 1 2)$?
$$
\frac 1 {1 + \epsilon} \le 1 - \frac \epsilon 2
$$
I thought, maybe it would be more convenient to try to show somehow that $\frac 1 {1 + \epsilon} + \frac \epsilon 2 \le 1$. And maybe use the fact that $\frac {1 + \epsilon} {1 - \epsilon} > 1 + 2 \epsilon$.
Best regards
Comment: As a rule of our community, I request you to please show your efforts in solving it. Thanks.
Comment: Edited at your request.
Answer: You can show this directly (and even for a wider interval for $\epsilon$) by rearranging the inequality:
$$\frac 1 {1 + \epsilon} \le 1 - \frac \epsilon 2 \Leftrightarrow 1\leq 1+\epsilon - \frac \epsilon 2(1+\epsilon) = 1 + \frac 12 \epsilon(1-\epsilon)$$
Since $\epsilon(1-\epsilon) \geq 0$ for $\epsilon \in [0,1]$, you are done.


I can't log in after removing the user login left bar

Question: I removed the user login block on the left of my default drupal instalation (7.21) and now i can't login.
When i try: mysite/drupal/?q=admin
It gives me "access denid".
I Don't feel like reinstalling my drupal just for this there has to be a simple way to fix this?
Answer: Simply go to http://yoursite/user or if you don't have clean url enabled http://yoursite/?q=user