De Finetti: equivalence a.s. according to which measure

Question: In Zen`s answer at
What is so cool about de Finetti's representation theorem?
that is concerned with De Finetti's 0 -1 representation theorem, he says that "De Finetti's law of large numbers" states that it holds that for an exchangeable sequence of RVs $\{X_i\}_{i \in \mathbb{N}}$
$$\lim_{n \to \infty }\overline{X}_n=\Theta \quad \quad \text{almost surely}$$
where $\Theta$ is the Random Variable that arises out of De Finetti`s representation theorem.
However it is not clear to me for which measure this equivalence holds almost surely. Is the relevant measure the measure $\mu$ such that  $\mu[\Theta]$ is the prior probability measure?
Answer: The analysis ought to be taking place in a general probability space $(\Omega, \mathscr{U}, \mathbb{P})$ with a sample space that encompasses both the observable exchangeable sequence $\mathbf{X}:\Omega \rightarrow \mathbb{R}^\infty$ and the parameter $\Theta:\Omega \rightarrow \mathbb{R}$.  The statement of interest is then taken with respect to the probability measure $\mathbb{P}$, so it can be stated more formally by defining an event positing equivalence, and then saying that this event occurs with probability one under the measure $\mathbb{P}$.  Formally, this is:
$$\mathbb{P} ( \mathcal{E}) = 1 \quad \quad \text{where} \quad \quad\mathcal{E} \equiv \left\{ \omega \in \Omega \Bigg| \lim_{n \rightarrow \infty} \frac{1}{n} \sum_{i=1}^n X_i(\omega) = \Theta(\omega) \right\} \in \mathscr{U}.$$
O'Neill (2009) argues that the best way to form the parameter $\Theta$ in this analysis is to define it as the Banach limit of the sequence $\mathbf{X}$, which means that it exists for all possible real sequences (i.e., it is well-defined) and it corresponds to the Cesàro limit of the sequence when that exists.  That way, the parameter is equal to the Banach limit of the sequence for all $\omega \in \Omega$ (which is stronger than almost sure equivalence), and $\mathcal{E}$ is the event that the Cesàro limit of the observable sequence exists, which occurs with probability one under the condition of exchangeability.
The prior measure $\mu_\Theta$ for the parameter $\Theta$ is formed from the overall measure $\mathbb{P}$ by restricting attention to events relating to the parameter only.  If we take $\mathscr{U}$ to be the class of all Borel sets in $\mathbb{R}^\infty$ (in order to describe events pertaining to the whole observable sequence) then the domain of the measure $\mu_\Theta$ would be the subspace of Borel sets in $\mathbb{R}$ (to describe the parameter).  The event $\mathcal{E}$ would not be in this domain, and so it would not make sense to try to apply the prior measure $\mu_\Theta$ to describe a probability for this event.
Comment: Not really.  Remember that random variables are mappings from the domain $\Omega$ to some codomain.  The probability measure $\mathbb{P}$ is a set-function whose domain is the class $\mathscr{U}$, which is a sigma-field of subsets on $\Omega$.  The probability measure operates on *events* in the sample space (which are sets in $\mathscr{U}$), not random variables (which are mappings from the sample space to a codomain).  The probability measures for random variables are formed from the overarching measure $\mathbb{P}$ by looking at the sigma-field of events for that random variable.
Comment: With $\mathbb{Q}:=X_k(\mathbb{P})$ I refer to the measure that is defined via: $\mathbb{Q}(A)= \mathbb{P}(X_k^{-1}(A))$
Comment: I was similarily confused when my professor used this notation :D
Comment: Thanks again for this clarifying answer. If we define with $X_k: \Omega \to \mathbb{R}^k$ the outcome of the first $k$ experiments, then
$\mathbb{P}(X_k)$ (the push-forward measure) is the agent`s believe about the first $k$ outcomes. and $\mathbb{P}(\Theta)= \mu_\Theta$, right?
Comment: ah i meant $X_k(\mathbb{P})$ and  $\Theta(\mathbb{P})$ of course
Comment: That notation also does not make sense to me, since $\mathbb{P}$ is not an element of $\Omega$, so it is not clear how it could be an argument for a random variable.
Comment: (To understand this well, it is necessary to learn a bit of "measure theory". If you have not already done so, have a read up on probability measures and sigma-fields and have a look at how probability spaces are formed on sub-sigma-fields within a larger probability space.)
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/83312/discussion-between-0rangetree-and-ben).
Comment: More specifically, $\mu_\Theta(A) := \mathbb{P}(\lbrace \omega \in \Omega \mid \lim_{n \to \infty} \sum_{i=1}^nX_i/n \in A\rbrace)$.  This prior is a defined by the properties of the exchangeable sequence $\mathbf{X}$.  For example, if $X_i = 1$ a.s. then $\mu_\Theta(A) = \delta_{\{1\}}(A)$.  More generally if $X_i = 1$ with a fixed probability $\gamma$ (i.e., the sequence is i.i.d.) then $\mu_\Theta(A) = \delta_{\{\gamma\}}(A)$ which recovers the frequentist case. Generally speaking it is not impossible to infer $\mu_\Theta$ from a realization $\mathbf{X}(\omega)$, even if infinitely long.


getActivity() it's not working with adapter

Question: This is my code. In the section of on itemClickListener i have a calling of an adapter, but i guess it's requiering another parameter, the problem is i don´t kmow what it is

public class Lista_Activity extends Activity implements OnItemClickListener {

ArrayAdapter<String> listAdapter;
ListView listView;
BluetoothAdapter btAdapter;
Set<BluetoothDevice> devicesArray;
ArrayList<String> pairedDevices;
ArrayList<BluetoothDevice> devices;
public static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
protected static final int SUCCESS_CONNECT = 0;
protected static final int MESSAGE_READ = 1;
IntentFilter filter;
BroadcastReceiver receiver;
String tag = "debugging";
Handler mHandler = new Handler(){
 @Override
 public void handleMessage(Message msg){
  // TODO Auto-generated method stub
  Log.i(tag, "in handler");
  super.handleMessage(msg);
  switch(msg.what){
  case SUCCESS_CONNECT:
   // DO something
   ConnectedThread connectedThread = new ConnectedThread((BluetoothSocket)msg.obj);
   Toast.makeText(getApplicationContext(), "CONECTADO", 0).show();
   String s = "Conexion realizada";
   connectedThread.write(s.getBytes());
   Log.i(tag, "Conectado");
   break;
  case MESSAGE_READ:
   byte[] readBuf = (byte[])msg.obj;
   String string = new String(readBuf);
   Toast.makeText(getApplicationContext(), string, 0).show();
   break;
  }
 }
};
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.lista);
    init();
    if(btAdapter==null){
     Toast.makeText(getApplicationContext(), "No se detectan dispositivos Bluetooth", 0).show();
     finish();
    }
    else{
     if(!btAdapter.isEnabled()){
      turnOnBT();
     }

     getPairedDevices();
     startDiscovery();
    }

}
private void startDiscovery() {
 // TODO Auto-generated method stub
 btAdapter.cancelDiscovery();
 btAdapter.startDiscovery();

}
private void turnOnBT() {
 // TODO Auto-generated method stub
 Intent intent =new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
 startActivityForResult(intent, 1);
}
private void getPairedDevices() { //AGREGAMOS LOS DISPOSITIVOS CERCANOS A LA LISTA
 // TODO Auto-generated method stub
 devicesArray = btAdapter.getBondedDevices();
 if(devicesArray.size()>0){
  for(BluetoothDevice device:devicesArray){
   pairedDevices.add(device.getName());

  }
 }
}
private void init() {
 // TODO Auto-generated method stub
 listView=(ListView)findViewById(R.id.listView);
 listView.setOnItemClickListener(this);
 listAdapter= new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,0);
 listView.setAdapter(listAdapter);
 btAdapter = BluetoothAdapter.getDefaultAdapter();
 pairedDevices = new ArrayList<String>();
 filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
 devices = new ArrayList<BluetoothDevice>();
 receiver = new BroadcastReceiver(){
  @Override
  public void onReceive(Context context, Intent intent) {
   // TODO Auto-generated method stub
   String action = intent.getAction();

   if(BluetoothDevice.ACTION_FOUND.equals(action)){
    BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
    devices.add(device);
    String s = "";
    for(int a = 0; a < pairedDevices.size(); a++){
     if(device.getName().equals(pairedDevices.get(a))){
      //append
      s = "(Agregado)";
      break;
     }
    }
    listAdapter.add(device.getName()+s+"\n"+"Dirección MAC: ("+device.getAddress()+")");
   }
   else if(BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(action)){
    // run some code
   }
   else if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)){
    // run some code
   }
   else if(BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)){
    if(btAdapter.getState() == btAdapter.STATE_OFF){
     turnOnBT();
    }
   }
  }
 };
 registerReceiver(receiver, filter);
  filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
 registerReceiver(receiver, filter);
  filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
 registerReceiver(receiver, filter);
  filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
 registerReceiver(receiver, filter);
}

@Override
protected void onPause() {
 // TODO Auto-generated method stub
 super.onPause();
 unregisterReceiver(receiver);
}

 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  // TODO Auto-generated method stub
  super.onActivityResult(requestCode, resultCode, data);
  if(resultCode == RESULT_CANCELED){
   Toast.makeText(getApplicationContext(), "Bluetooth must be enabled to continue", Toast.LENGTH_SHORT).show();
   finish();
  }
 }
 private void cargarLista(){
 Adapter_lista adapter = new Adapter_lista(getActivity());

    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new OnItemClickListener() {
     @Override
 public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
   long arg3) {
  // TODO Auto-generated method stub

  if(btAdapter.isDiscovering()){
   btAdapter.cancelDiscovery();
  }
  if(listAdapter.getItem(arg2).contains("Agregado")){
   BluetoothDevice selectedDevice = devices.get(arg2);
   ConnectThread connect = new ConnectThread(selectedDevice);
   connect.start();
   Log.i(tag, "in click listener");

  }
  else{
   BluetoothDevice selectedDevice = devices.get(arg2);
   ConnectThread connect = new ConnectThread(selectedDevice);
   connect.start();
   Log.i(tag, "in click listener");
   Toast.makeText(getApplicationContext(), "Agregando dispositivo...", 0).show();
  }
  }
     });
    }

 private class ConnectThread extends Thread {

  private final BluetoothSocket mmSocket;
     private final BluetoothDevice mmDevice;

     public ConnectThread(BluetoothDevice device) {
         // Usa un objeto temporal que despues se asigna a mmSocket,
         BluetoothSocket tmp = null;
         mmDevice = device;
         Log.i(tag, "construct");
         // Get a BluetoothSocket to connect with the given BluetoothDevice
         try {
             // MY_UUID es el UUID string de la app, tambien usado por el server code
             tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
         } catch (IOException e) {
          Log.i(tag, "get socket failed");

         }
         mmSocket = tmp;
     }

     public void run() {
         // Cancel discovery because it will slow down the connection
         btAdapter.cancelDiscovery();
         Log.i(tag, "connect - run");
         try {
             // Connect the device through the socket. This will block
             // until it succeeds or throws an exception
             mmSocket.connect();
             Log.i(tag, "connect - succeeded");
         } catch (IOException connectException) { Log.i(tag, "connect failed");
             // Unable to connect; close the socket and get out
             try {
                 mmSocket.close();
             } catch (IOException closeException) { }
             return;
         }

         // Do work to manage the connection (in a separate thread)

         mHandler.obtainMessage(SUCCESS_CONNECT, mmSocket).sendToTarget();
     }

  /** Will cancel an in-progress connection, and close the socket */
     public void cancel() {
         try {
             mmSocket.close();
         } catch (IOException e) { }
     }
 }

 private class ConnectedThread extends Thread {
     private final BluetoothSocket mmSocket;
     private final InputStream mmInStream;
     private final OutputStream mmOutStream;

     public ConnectedThread(BluetoothSocket socket) {
         mmSocket = socket;
         InputStream tmpIn = null;
         OutputStream tmpOut = null;

         // Get the input and output streams, using temp objects because
         // member streams are final
         try {
             tmpIn = socket.getInputStream();
             tmpOut = socket.getOutputStream();
         } catch (IOException e) { }

         mmInStream = tmpIn;
         mmOutStream = tmpOut;
     }

     public void run() {
         byte[] buffer;  // buffer store for the stream
         int bytes; // bytes returned from read()

         // Keep listening to the InputStream until an exception occurs
         while (true) {
             try {
                 // Read from the InputStream
              buffer = new byte[1024];
                 bytes = mmInStream.read(buffer);
                 // Send the obtained bytes to the UI activity
                 mHandler.obtainMessage(MESSAGE_READ, bytes, -1, buffer)
                         .sendToTarget();

             } catch (IOException e) {
                 break;
             }
         }
     }

     /* Call this from the main activity to send data to the remote device */
     public void write(byte[] bytes) {
         try {
             mmOutStream.write(bytes);
         } catch (IOException e) { }
     }

     /* Call this from the main activity to shutdown the connection */
     public void cancel() {
         try {
             mmSocket.close();
         } catch (IOException e) { }
     }
 }

 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position,
   long id) {
  // TODO Auto-generated method stub

 }
}

the line is Adapter_lista adapter...
Comment: What's your logcat ??
Comment: MWE https://en.m.wikipedia.org/wiki/Minimal_Working_Example You may find that making one will help you find the solution.
Answer: I think error lies in
Adapter_lista adapter = new Adapter_lista(getActivity());
change it to
Adapter_lista adapter = new Adapter_lista(Lista_Activity.this);
Hope it solves your problem. Also please check your adapter constructor and its parameter.
Answer: Change the getActivity() to Lista_Activity.this
getActivity() is used in Fragments


BeautifulSoup: TEXT I WANT

Question: I am trying to extract the string enclosed by the span with id="titleDescription" using BeautifulSoup.

        Customer Choice Award Winner

            Intel Core i7-3770K Ivy Bridge 3.5GHz (3.9GHz Turbo) LGA 1155 77W Quad-Core Desktop Processor Intel HD Graphics 4000 BX80637I73770K
            Intel Core i7-3770K Ivy Bridge 3.5GHz (3.9GHz Turbo) LGA 1155 77W Quad-Core Desktop Processor Intel HD Graphics 4000 BX80637I73770K

Code snippet
f = open('egg.data', 'rb')
content = f.read()
content = content.decode('utf-8', 'replace')
content = ''.join([x for x in content if ord(x) < 128])

soup = bs(content)

for itemText in soup.find_all('div', attrs={'class':'itemText'}):
    wrapper = itemText.div
    wrapper_href = wrapper.a
    for child in wrapper_href.descendants:
        if child['id'] == 'titleDescriptionID':
           print(child, "\n")

Traceback Error:
Traceback (most recent call last):
  File "egg.py", line 66, in <module>
    if child['id'] == 'titleDescriptionID':
TypeError: string indices must be integers

Comment: http://pastebin.com/2Gf1h8RL (for the entire file)
Comment: http://pastebin.com/HZNiRtkA (entire python script)
Comment: pastes aren't loading anymore btw
Answer: spans = soup.find_all('span', attrs={'id':'titleDescriptionID'})
for span in spans:
    print span.string

In your code, wrapper_href.descendants contains at least 4 elements, 2 span tags and 2 string enclosed by the 2 span tags. It searches its children recursively.
Comment: there was a reason i choose my method: I need to parse multiple such chunks of HTML. I have uploaded the full original file to pastebin. I didn't do this earlier because bpaste.net was treating it as spam and the CAPTCHA didn't work (Internal Server Error). Anyway, using your method works nicely but for some reason it won't parse all the 'span'+attrs tags in that file - just the first one it finds.
Comment: It should just find the first one for I select the span with attribute id. The id is unique. If you want to select more spans choose a right attribute or no.@paleywiener
Comment: \n 30180
Comment: how can I get 30180 value ?
Answer: wrapper_href.descendants includes any NavigableString objects, which is what you are tripping over. NavigableString are essentially string objects, and you are trying to index that with the child['id'] line:
>>> next(wrapper_href.descendants)
u'\n'

Why not just load the tag directly using itemText.find('span', id='titleDescriptionID')?
Demo:
>>> for itemText in soup.find_all('div', attrs={'class':'itemText'}):
...     print itemText.find('span', id='titleDescriptionID')
...     print itemText.find('span', id='titleDescriptionID').text
...
Intel Core i7-3770K Ivy Bridge 3.5GHz (3.9GHz Turbo) LGA 1155 77W Quad-Core Desktop Processor Intel HD Graphics 4000 BX80637I73770K
Intel Core i7-3770K Ivy Bridge 3.5GHz (3.9GHz Turbo) LGA 1155 77W Quad-Core Desktop Processor Intel HD Graphics 4000 BX80637I73770K

Comment: i liked this answer better and it seemed to fit my problem. thank you.
Answer: from BeautifulSoup import BeautifulSoup
pool = BeautifulSoup(html) # where html contains the whole html as string

for item in pool.findAll('span', attrs={'id' : 'titleDescriptionID'}):
    print item.string

When we search for a tag using BeautifulSoup, we get a BeautifulSoup.Tag object, which can directly be used to access its other attributes like inner content, style, href etc.

BeautifulSoup: TEXT I WANT


Failing to recover correlation parameter from a linear fixed effects model with correlated errors simulation

Question: I am trying to simulate some data from a linear fixed effects model with correlated errors. The model is quite simple, inspired in a pre-post study.
$$Y_i|X_i=x_i\sim N(x_i\beta,\Sigma_i)$$
where $Y_i=(y_{i,pre},y_{i,post})^T$, $x_i=\begin{pmatrix}
 1 & 0  \\
 1 & 1 \\
\end{pmatrix}$, $\beta=(\beta_0,\beta_1)^T$ and
$$\Sigma_i=\begin{pmatrix}
 \sigma_{pre}^2 & \sigma_{pre,post}  \\
 \sigma_{pre,post} & \sigma_{post}^2 \\
\end{pmatrix}$$
$i$ is indexing the subject from which there are two measures available: pre and post measures.
I am ussing the fact that $\Sigma_i=\Lambda_iR_i\Lambda_i$ where $\Lambda_i=diag(\sigma_{pre},\sigma_{post})$ and $R_i$ is the correlation matrix, which in this case depends only on $\rho_{pre,post}$. Note that $x_i$ and $\Sigma_i$ are equal for all $i$.
Finally a general formulation equation is stated for the model:
$$Y|X\sim N(X\beta,\Sigma)$$
where $Y=(Y_1,\cdots,Y_n)^T$, $X=1_{n \times1} \bigotimes x_i$ and $\Sigma=I_{n \times n}\bigotimes \Sigma_i$ where $\bigotimes$ is the Kronecker Product.
Now let us give some arbitrary values for the model parameters:
$\beta_0=100$, $\beta_1=-30$, $\rho_{pre,post}= -0.8$, and $\sigma_{pre}=\sigma_{post}=9$
Next I present the R code to simulate some data from this model:
library(pacman)
p_load(tidyverse)
p_load(MASS)
p_load(nlme)
p_load(mvtnorm)

##number of subjects
my_n<-500
##correlation between measures inside each subject
my_rho<- -0.8
## sd inside each subject
my_sd<-9
#subject level correlation matrix
sl_mcor<-matrix(c(1,my_rho,my_rho,1),nrow = 2,byrow=T)
#subject level variance (diagonal) matrix
sl_diag_v<-matrix(c(my_sd,0,0,my_sd),nrow = 2,byrow=T)
#subject level covariance matrix
sl_mcov<-sl_diag_v%*%sl_mcor%*%sl_diag_v
#general correlation matrix
mcov<-kronecker(diag(my_n),sl_mcov)
#design matrix for pre-post measures for each subject
z0<-expand.grid(id=(1:my_n) %>% factor,trt=c("pre","post")) %>% as.data.frame()
# fixed effects parameters
my_bts<-c(100,-30)
#model matrix
z0_mat <- model.matrix(~ trt, z0)
# expected values
my_mu<-z0_mat%*%my_bts
#simulate data from Multivariate Normal dist with my_mu and mcov
y<-rmvnorm(1,my_mu,mcov)
z0$y<-y %>% t
#descriptive
z0 %>% ggplot(aes(x=trt,y=y))+geom_boxplot()

#fitting model
m0<-gls(y~trt,correlation=corCompSymm(form=~1|id),data=z0)
summary(m0)
#> Generalized least squares fit by REML
#>   Model: y ~ trt
#>   Data: z0
#>        AIC      BIC    logLik
#>   7257.624 7277.247 -3624.812
#>
#> Correlation Structure: Compound symmetry
#>  Formula: ~1 | id
#>  Parameter estimate(s):
#>       Rho
#> 0.1305259
#>
#> Coefficients:
#>                 Value Std.Error   t-value p-value
#> (Intercept) 100.02863 0.4081594 245.07248       0
#> trtpost     -29.84501 0.5382365 -55.44962       0
#>
#>  Correlation:
#>         (Intr)
#> trtpost -0.659
#>
#> Standardized residuals:
#>          Min           Q1          Med           Q3          Max
#> -2.772941799 -0.698851160 -0.003973076  0.710269078  2.923039822
#>
#> Residual standard error: 9.126722
#> Degrees of freedom: 1000 total; 998 residual
intervals(m0,which = "var-cov")
#> Approximate 95% confidence intervals
#>
#>  Correlation structure:
#>          lower      est.     upper
#> Rho 0.04368246 0.1305259 0.2154116
#>
#>  Residual standard error:
#>    lower     est.    upper
#> 8.731751 9.126722 9.539558

Created on 2022-09-19 by the reprex package (v2.0.1)
The concerning issue here is that I am having a hard time recovering the correlation parameter ($\rho_{pre,post}= -0.8$). Estimation for this parameter is quite far from the true parameter set in the simulations. Other parameters are recovered much better than this. What could be the explanation for this? (set aside multiple runs of the simulation and checking the distribution of estimations which I have done already but, this is not shown in the code).
The fact that only two measures per subject are available could be a cause for this? is sample size an issue here? $n=500$ is not enough?
As a side question related to this, in the beginning, I was using a positive value for  $\rho_{pre,post}= 0.8$ but then I realized that this could be not realistically compatible with the fixed effects parameters $\beta=(100,-30)$, because this fixed effects parameters mostly for sure would induce a negative correlation between $y_{i,pre}$  and $y_{i,post}$ for a given subject. Thus, I am having some doubts about the possible effects on the fixed effects component of the model on the correlation structure itself.
Edit: on the last thought, if we think that residuals are correlated (rather than observations on variable $y$), then fixed effects parameters shouldn't have any effects on the correlation structure.  I mean after all $cor(y_{i,pre},y_{i,post})=cor(\epsilon_{i,pre},\epsilon_{i,post})$
Comment: (+1, generally well-posed question) I fixed two mistakes and one inexact expression in your model formulation. Your $\LaTeX$ code could still benefit from some clean-up. What causes your problem is just a small programming error, not an estimation issue (see my answer).
Answer: Note that expand.grid() generates a data.frame in which the first factor varies fastest.Therefore, you need
z0 <- expand.grid(trt = c("pre", "post"), id = 1:my_n %>% factor)

to match the structure of your covariance matrix mcov.
Comment: indeed the correlation matrix does not fit the structure of the data, I did not care about it too much since I was using the `model.matrix` function to specify the mean structure of the model, but forgot to take care in the same way for the correlation matrix. Is a good exercise to work this out. ty for your feedback.
Comment: @NicolasMolano You're welcome. The way you've specified the statistical model suggests that your code generates a wrong representation of the design matrix $X$, not of the covariance matrix $\Sigma$. That's why I suggested to change the way `z0` is generated.
Comment: solved, covariance matrix construction for any layout of `z0`: `Z<-model.matrix(~-1+ id, z0);C0<-Z%*%t(Z);mcorr<-(my_rho)*C0+(1-my_rho)*diag(nrow=nrow(C0));mcov<-diag(my_sd,nrow=nrow(C0))%*%mcorr%*%diag(my_sd,nrow=nrow(C0))` just in case any one finds this useful


What is the Spider 2 Y Banana?

Question: In a Jon Gruden interview on ESPN, he calls a play Spider 2 Y Banana.
I have no idea what to make of this. What do the words even reference, and what do they mean?
Answer: This is an example of play calling in the West Coast Offense.  The play call itself could be called something else in another offensive scheme.  Here is a breakdown of the playcall and terms:

Spider refers to the protection or blocking scheme depending on if it is a run or pass.  In this case, spider means a slide in the pass protection.
2 refers to the series of plays.  Each series has different characteristics as well as being designated as run or pass series.  In this case, 2 means a play action pass.
Y Banana refers to a route combination.  This designates the routes for the receivers to run.  In this case Y Banana means the "Y" receiver (tight end in this case, but not always) will run a "Banana" route (similar to a rounded off corner route, looks like a banana).

This play would be preceded by calling out a formation.  An example is "Green Right Strong Slot Spider Y 2 Banana".  Green right strong slot is the formation that the offense will line up in.

The play unfolds as a play action power run with the halfback, the full back shows block and continues into the flat and is the primary receiver.  The secondary receiver is the tight end (Y receiver).

The video shows the play that unfolds with the quarterback throwing to the tight end on the banana route.
Answer: Spider 2 Y Banana within itself is a just a concept. Meaning slide protection with a play action pass to the tailback or halfback depending on terminology with the y the tight end running a banana similar too a corner route. The play within itself will have other options built into the route which could change depending on the coverage shown where hot routes, blocking assignments, and sight adjustments could all come into play. If the team would line up in what could be called a pro right formation with 21 personnel meaning 2 backs and 1 te with a flanker (z) and split end (x)the play as a whole could be called pro right z slant x go spider 2 y banana on whatever the cadence may be. The other receivers may have a predetermined route combination as well. I have done most of my limited study on Charlie Weis and his tenure with the patriots as OC under his system which is more of a combination of the west coast and erhardt Perkins systems which deals more with route naming combinations as opposed to the west coast system which deals more with individual assignments. Gruden was the play caller for the eagles as OC and the raiders and bucs as head coach where the spider 2 y banana was a staple concept of his offense that lead to Gannon having great success and the bucs winning super bowl 37 with brad Johnson albeit they had a great defense. If you ever watch grudens qb camp he discusses this with most quarterbacks especially those few in college that still run a pro style offense and most of the time the fullback in the flat is the guy the ball should go to regardless of the coverage. Hope this gives some kind of answer never done this before wanted to sound knowledgeable
Comment: could you please format it so it looks cleaner and add a few sources if you can. And that last line is not necessary as the answer speaks itself, you could remove that before it gets edited.

What is the Spider 2 Y Banana?


Lang's proof on Corollary 3.2, $\mathbb{Q}(\zeta_n) \cap \mathbb{Q}(\zeta_m) = \mathbb{Q}$

Question: I am learning about cyclotomic fields (hoping to understand the basics of Iwasawa theory) using Washington, Introduction to Cyclotomic Fields. I was reading this proposition, it seems to be using "quite advanced" results such as
If $K$ is a number field and $d_K$ is the discriminant of $K$, then
$$ p|d_K \text{ if and only if } p \text{ ramifies in } K$$
and
$$ |d_K| > 1 \text{ if } K \neq \mathbb{Q}$$
which follows from Minkowski's bound according to Wikipedia.

According to Lang (the bottom image),

which somehow magically proves the same statement from
$$ \mathbb{Q}(\zeta_n) \mathbb{Q}(\zeta_m) = \mathbb{Q}(\zeta_{mn}) $$
Am I missing something, or is it just a typo? Thank you in advance.
Answer: Here is what I think Lang had in mind: earlier in the same chapter, Lang proves that if $F$ and $K$ are extensions of a field $k$ with $K$ Galois over $k$, then $KF$ is Galois over $F$ and $K$ is Galois over $K\cap F$, with $\mathrm{Gal}(KF/F)\simeq \mathrm{Gal}(K/K\cap F)$. In particular,
$$ [KF:F]=[K:K\cap F]$$
In your problem, let $K=\mathbb{Q}(\zeta_m)$, $F=\mathbb{Q}(\zeta_n)$, and $k=\mathbb{Q}$. Then $KF=\mathbb{Q}(\zeta_{mn})$, hence the above equality becomes
$$ [\mathbb{Q}(\zeta_{mn}):\mathbb{Q}(\zeta_n)]=[\mathbb{Q}(\zeta_m):\mathbb{Q}(\zeta_m)\cap\mathbb{Q}(\zeta_n)]$$
Now the left-hand side is equal to
$$ \frac{[\mathbb{Q}(\zeta_{mn}):\mathbb{Q}]}{[\mathbb{Q}(\zeta_{n}):\mathbb{Q}]}=\frac{\phi(mn)}{\phi(n)}=\phi(m)$$
by the tower rule, hence the right-hand side must also be $\phi(m)=[\mathbb{Q}(\zeta_m):\mathbb{Q}]$. But this implies that $\mathbb{Q}(\zeta_m)\cap\mathbb{Q}(\zeta_n)=\mathbb{Q}$.
Comment: Thank you for the reference. (Theorem 1.12 in the same chapter)


How to redirect form submit to an external URL and also open it in a new tab

Question: In D9 we have a custom form that needs to redirect the user to an external URL and also have it open in a new window/tab.
We have the external redirect working using TrustedRedirectResponse but there doesn't seem to be a way to have it open in a new tab.
What is a working solution to redirect to an external URL and also have it open in a new tab?
<code>public function submitForm(array &$form, FormStateInterface $form_state) {
  $url = "https://somewebsite.com";
  $response = new TrustedRedirectResponse(\Drupal\Core\Url::fromUri($url)
    ->toString());
  $metadata = $response->getCacheableMetadata();
  $metadata->setCacheMaxAge(0);
  $form_state->setResponse($response);
}
</code>
Comment: I think this is impossible with PHP alone. There is no HTTP response that would induce a browser to open a tab.
Comment: Thanks cilefen, that's what I suspected and explains why there is no documentation on how to achieve this.
Comment: Although there may be a way to return a page that only contains JavaScript, which contains redirect code.
Answer: This answer indicates that you can add a formtarget attribute to the submit action in order to open it in a new tab: https://drupal.stackexchange.com/a/307453
That worked for me:
<code>$form['actions']['submit'] = [
  '#type' => 'submit',
  '#value' => 'Search',
  '#attributes' => [
    'formtarget' => '_blank'
  ]
];

public function submitForm(array &$form, FormStateInterface $form_state) {
  $response = new TrustedRedirectResponse($url);
  $metadata = $response->getCacheableMetadata();
  $metadata->setCacheMaxAge(0);
  $form_state->setResponse($response);
}
</code>


É possível abrir um arquivo com o IDLE a partir to terminal?

Question: O IDLE permite abrir um arquivo para escrever os nossos programas (carregando CRTL + N, se não me engano), mas, devido a um problema com o IDLE do Python 3.4.1 ou 3.4.0, eu não posso usá-lo corretamente. Posso usar o Python só através do terminal.
É possível abrir um arquivo com o IDLE a partir to terminal?
Comment: Ok Rinzler, obrigado por esclarecer. Espero que a pergunta e as respostas ajudem mais alguém!
Comment: A pergunta era como abrir/criar um arquivo no IDLE a partir do terminal? Editei e respondi considerando que era.
Answer: O interpretador Python só roda programas Python, ele não vem com uma interface de edição embutida. O que você pode fazer é usar um editor de texto para escrever seu programa (qualquer um menos o Word serve: Notepad++, Scite, Gedit, Emacs, Vim, etc...) e depois passar o arquivo que você criou para o interpretador python usandl a linha de comando.
Se você criar um arquivo meuprograma.py você pode rodar ele no terminal usando
python meuprograma.py

Se você quiser carregar o seu programa dentro de um loop interativo do Python você pode usar a flag -i
python -i meuprograma.py

Answer: Você pode abrir qualquer arquivo (inclusive um novo, já dando um nome para ele), simplesmente digitando no terminal:
idle arquivo.py


Java GUI: paintComponent method in the JComponent class

Question: So, first I created a JFrame object, then a class that extends JComponent with an appropriate overridden version of the paintComponent method.
Finally, I add an object of this class to the JFrame object.
Here's the code for reference:
import java.awt.*;
import javax.swing.*;

public class MyFrame {

    public static void main(String[] args) {
        JFrame frame = new JFrame("My Frame");
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setSize(screenSize);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
        MyComponent comp = new MyComponent();
        frame.add(comp);
    }

}

class MyComponent extends JComponent {

    public void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        Rectangle r = new Rectangle(0,0,100,100);
        g2.draw(r);
    }
}

My question is...the paintComponent method takes a Graphics2D object as it's argument, but who is passing this coz I'm not.
Comment: It is a contract between the `Component` API and the painting subsystem
Answer:
My question is...the paintComponent method takes a Graphics2D object as it's argument, but who is passing this coz I'm not.

The paint system passes it in when a paint event is processed on the EDT.
In many ways, paintComponent is like other event handlers (actionPerformed, itemStateChanged, etc.) in that you don't call it explicitly. The system prepares the object passed to you (Graphics in this case) and calls it when it needs to.
Excerpts from Painting in AWT and Swing:

[If] the paint request originates on the first heavyweight ancestor (usually JFrame, JDialog, JWindow, or JApplet):

the event dispatching thread invokes paint() on that ancestor

The default implementation of Container.paint() recursively calls paint() on any lightweight descendents

[If] the paint request originates from a call to repaint() on an extension of javax.swing.JComponent:

JComponent.repaint() registers an asynchronous repaint request to the component's RepaintManager, which uses invokeLater() to queue a Runnable to later process the request on the event dispatching thread.

The runnable executes on the event dispatching thread and causes the component's RepaintManager to invoke paintImmediately() on the component, which [...] invokes paint() on the root component.

(And paintComponent is called by paint.)
Answer: The graphics object originates in Java's GUI framework.  Any* GUI application you program in Java is built on this GUI framework.  So, for instance, you don't have to program all the code that controls what a basic window looks like, that controls how a GUI program starts up, or that controls how user interactions via peripheral hardware (i.e., keyboard and mouse) are processed.
The Graphics object is just one of many classes that come with Java and that get instantiated and passed around for you in the GUI applications you create in order to make the program a full-blown GUI program.
[*] Technically, you could write a GUI program that doesn't use Java's pre-built GUI framework.  But for the most part, no one does that.


manipluate data inside an array object

Question: I am wanting to loop through an object and make some changes to the data. Im not 100% if im actually dealing with an object or an array that contains multiple object so any help appreciated.
Here is my object:
var screening = {
    source: "jacket",
    value: {
        Cyan: {
            dotshape: "C",
            frequency: 120,
            angle: 67.5
        },
        Magenta: {
            dotshape: "C",
            frequency: 120,
            angle: 37.5
        },
        Yellow: {
            dotshape: "C",
            frequency: 120,
            angle: 82.5
        },
        "PANTONE 3528 C": {
            dotshape: "C",
            frequency: 120,
            angle: 7.5
        },
        "PANTONE 293 C": {
            dotshape: "C",
            frequency: 120,
            angle: 7.5
        },
        "PANTONE 2748 C": {
            dotshape: "C",
            frequency: 120,
            angle: 7.5
        },
        Varnish: {
            dotshape: "C",
            frequency: 120,
            angle: 0
        }
    }
}

Inside i want to essentially do a find and replace of the 'keys'(again not sure on the terminology) based on 2 lists.
Old = [Cyan, Magenta, Yellow]
new = [changedName1, changedName2, changedName3]

Ideally i want the loop to look at the current object, if it has a match to something in the array Old then rename it as per the New. If there is no match to something in the array Old then just ignore it and leave it as it is.
Thanks in advance
Answer: Use delete to delete the old properties, and use [] (square bracket notation) and indexOf to get the old ones and create new ones:

var screening = {
  source: "jacket",
  value: {
    Cyan: {
      dotshape: "C",
      frequency: 120,
      angle: 67.5
    },
    Magenta: {
      dotshape: "C",
      frequency: 120,
      angle: 37.5
    },
    Yellow: {
      dotshape: "C",
      frequency: 120,
      angle: 82.5
    },
    "PANTONE 3528 C": {
      dotshape: "C",
      frequency: 120,
      angle: 7.5
    },
    "PANTONE 293 C": {
      dotshape: "C",
      frequency: 120,
      angle: 7.5
    },
    "PANTONE 2748 C": {
      dotshape: "C",
      frequency: 120,
      angle: 7.5
    },
    Varnish: {
      dotshape: "C",
      frequency: 120,
      angle: 0
    }
  }
};

function oldToNew(oldNames, newNames) {
  Object.entries(screening.value).forEach(([key, prop]) => {
    if (oldNames.includes(key)) {
      screening.value[newNames[oldNames.indexOf(key)]] = screening.value[key];
      delete screening.value[key];
    }
  });
}

oldToNew(["Cyan", "Magenta", "Yellow"], ["Blue", "Purple", "Orange"]);

console.log(screening.value);

Note: The properties will not be in order, because as shown in the ECMAScript Specification:

An ECMAScript object is an unordered collection of properties
Comment: Hi JackThats brilliant thansk so much. Im extremely new to JS but learnign all the time. I can follow the IF statement but i cant make sense of the line before
Object.entries(screening.value).forEach(([key, prop]) .. what is the prop doing?

When i run the code i get the following error even though it seems to work perfectly above

1 error :6: ReferenceError: Invalid left-hand side in assignment
1 info (from 42 to 43):   Object.entries(screening.value).forEach(([key, prop]) => {
1 info ReferenceError: Invalid left-hand side in assignment
1 error Script Execution Error

manipluate data inside an array object


Make a custom drawable blink

Question: I have a custom drawable which I want to make it blink.Currently I can see the drawable being shown next to the text but no blinking affect
public class CustomDrawable extends Drawable {
private Context mContext;
private int mColor;

public CustomDrawable(Context context, int color) {
    mContext = context;
    mColor = color;
}

@Override
public void draw(Canvas canvas) {
    int x = 30;
    int y = 30;
    int radius = 15;
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(mContext.getResources().getColor(R.color.transparent));
    paint.setAntiAlias(true);
    canvas.drawPaint(paint);
    paint.setColor(mColor);
    canvas.drawCircle(x / 2, y / 2, radius, paint);
}

@Override
public void setAlpha(int alpha) {

}

@Override
public void setColorFilter(ColorFilter cf) {

}

@Override
public int getOpacity() {
    return 0;
}

}
How can I make the custom drawable so that it blinks I tried changing the alpha but there was no effect on it.
 mTextView = (TextView) findViewById(R.id.textView);
    AnimationDrawable drwable = new AnimationDrawable();
    drwable.addFrame(new CustomDrawable(this, Color.RED), 50);
    drwable.setAlpha(255);
    drwable.setEnterFadeDuration(500);
    mTextView.setCompoundDrawables(null, drwable, null, null);
    drwable.start()

Comment: http://stackoverflow.com/questions/28806879/animating-drawable-alpha-property
Answer: Use xml animation for your drawable.
create a folder anim in res folder. Then create blink.xml file.
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha android:fromAlpha="0.0"
        android:toAlpha="1.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="600"
        android:repeatMode="reverse"
        android:repeatCount="infinite"/>
</set>

Then use it as below:
Animation blink;
.
.
// load your animation
animFadeIn = AnimationUtils.loadAnimation(getApplicationContext(),
                R.anim.blink);
.
.
// set animation listener
blink.setAnimationListener(this);

mydrawable.startAnimation(blink);

Comment: There is no `startAnimation()` method on Drawable.

Make a custom drawable blink


If $n$ is an odd positive integer, then $2^{n!} − 1$ is divisible by $n$

Question: Prove that if $n$ is an odd positive integer, then $2^{n!} − 1$ is divisible by $n$.
Progress so far: Let $n=2k+1$. The desired result becomes $2^{(2k+1)!} − 1$
By Euler's totient function theorem, we have that
$2^{\phi(2k+1)}=1\mod(2k+1).$ I cannot seem to rigorously prove that this is true also for $(2k+1)!.$
Comment: Well...$\varphi(n)<n$, clearly.  Hence $\varphi(n) \,|\,n!$.
Comment: The above hint should be sufficient to write an answer. If you are convinced, then please attempt an answer below.
Comment: Is this the case because now we have that $2^{k\phi(n)}=1\mod(n)$?
Answer: If $n=\prod\limits_{i=1}^rp_i^{e_i}$, then $\;\varphi(n)=\prod_{i=1}^rp_i^{e_i-1}(p_i - 1)\;$ is clearly a divisor of $n!$ since each of its factors is less than $n$ and they're all distinct, so
$$2^{n!}=\bigl(2^{\varphi(n)} \bigr)^{\tfrac{n!}{\varphi(n)}}\equiv 1\mod n$$
by Euler's theorem.


Let $f$ integrable over $E$ and $C$ a measurable subset of $E.$ Show that $\int_{C} f = \int_{E} f. \chi_{C}.$

Question: I am trying to prove the following result for characteristic functions first and then simple functions:
"Let $f$ integrable over $E$ and $C$ a measurable subset of $E.$ Show that $\int_{C} f = \int_{E} f. \chi_{C}$"
Here is a trial in case of Characteristic functions:
Define $$ \chi_C(x) = \begin{cases}
      1 & \text{if } x \in C \\
      0 & \text{if } x \in E \sim C.
   \end{cases}.$$
Then, $$\int_E f. \chi_C = \int_C f. \chi_C + \int_{E \sim C} f. \chi_C = \int_C f. 1 + \int_{E \sim C} f. 0 = \int_C f $$
My question is: Is my proof correct?
Here is a trial for simple functions:
For each $i$ where $1 \leq i \leq n,$ let $a_i$ be the distinct values taken by $\psi$ and $E_i = \psi^{-1}(a_i) = \{x \in E | \psi (x) = a_i \}$ are disjoint, Thus $\psi = \sum_{i=1}^{n} a_i \chi_{E_i} = \sum_{i=1}^{n} a_i \chi_{E_i \cap C} + \sum_{i=1}^{n} a_i \chi_{E_i \cap C^c}.$ But then $\int_E \psi = \sum_{i=1}^{n} a_i . m(E_i \cap C) + \sum_{i=1}^{n} a_i . m(E_i \cap C^c).$
My question: I am confused how the integration of $\psi$ will look like if $a_i's$ took negative values? Also, How will I go to the case of bounded function defined on a set of finite measure ?Could anyone clarify this to me please?
Answer: Yes, your proof for characteristic functions case is fine.
I guess that you're trying to use the standard machine to extend that result to all bounded measurable functions. It usually goes like this :

Step 1 : Prove the property for all characteristic functions.
Step 2 : Using linearity, extend the property to all simple non-negative functions
Step 3 : Using the Monotone Convergence Theorem extend the property to all bounded measurable non-negative functions
Step 4 :  Extend the property in question to all bounded measurable functions $h$ by writing $h=h^+ - h^−$ and using linearity of Lebesgue integral.

You are at step 2, you thus only need to prove the result for non-negative simple functions first, so take all your $a_i$'s to be non-negative.

Edit to address the comments:

why I am extending the property to all simple non-negative functions only ?

As I said, this is just step 2 out of 4 in the standard machine, which will then allow you to extend the property to all measurable functions. If you're not familiar with this approach, it is a very effective and thus very popular way to generalize results which are true for simple functions to general bounded measurable functions.
The idea is that, instead of trying to prove directly a result for all measurable functions, you first prove it for characteristic functions, which are generally much easier to deal with, and from there progressively generalizing to non-negative simple functions, non-negative measurable functions and finally arbitrary measurable functions. You have examples of this method being used to solve a some measure theory problems e.g. here, here or here.
Lastly, here is a quote from Chapter 3 of Prof. Gordan Žitković's lecture notes on probability theory, which essentially restates what I just wrote (some more examples are given in the notes) :

The Lebesgue integral is very easy to define for non-negative simple functions and this definition allows for further generalizations. In fact, the progression of events you will see in this section
is typical for measure theory: you start with indicator functions, move on to non-negative simple
functions, then to general non-negative measurable functions, and finally to (not-necessarily-nonnegative) measurable functions. This approach is so common, that it has a name - the Standard
Machine

I suggest you read further on the topic to familiarize yourself with the idea.

How to prove the property for all non-negative simple functions ?

As you wrote, if $\psi$ is a non-negative simple function, it can be written as $ \psi = \sum_{i=1}^{n} a_i \chi_{E_i}$. And similarly
$$ \psi\cdot\chi_{C} = \sum_{i=1}^{n} a_i \chi_{E_i}\cdot\chi_{C} $$
So using the linearity of Lebesgue integral and the fact that you have proven the property for characteristic functions
$$\begin{align}
\int_E \psi\cdot\chi_C &= \int_E \sum_{i=1}^{n} a_i \chi_{E_i}\cdot\chi_{C}\\
&=\sum_{i=1}^{n} a_i \int_E \chi_{E_i}\cdot\chi_C\tag1\\
&= \sum_{i=1}^{n} a_i \int_C \chi_{E_i}\tag2\\
&=  \int_C \sum_{i=1}^{n} a_i \chi_{E_i} = \int_C \psi \tag3\\
\end{align} $$
Where I used the linearity of Lebesgue integral in $(1)$ and $(3)$, and the fact that the property is true for characteristic functions (which you have proven) in $(2)$.
Comment: I edited my answer to address your questions, hope that helps ! Oh and of course in your proof of the statement for characteristic functions, you have to assume that $f$ is a characteristic function, otherwise it's kind of pointless.... I thought that was what you did.
Comment: should not $f$ be a characteristic function also in my proof of the statement in case of characteristic functions?
Comment: Also, I do not know how can I complete the proof for non-negative simple function. Any help in this please?
Comment: Also, why I am extending the property to all simple non-negative functions only?
Comment: How this statement $$\int_{C} f = \int_{E} f. \chi_{C}$$should look like in case of simple functions? what is $ \psi . \chi_{C}$?


Baritone clefs, difference between these two

Question: I am using the Clefs app from the Google Play store.
I would like to know, why are there two baritone clefs and what is the difference between them?
If they are different, then why haven't they been named differently (also, to avoid confusion)?
Comment: Its surely sufficent, to know where to look up anything under the *other keys* section, since I have never encountered them in real life (but singers may have a different experience).
Comment: Just learn the four most common clefs and forget the rest: you're unlikely to ever come across them. And if you ever do, then **that** is the time to learn them.
Comment: Echoing @PiedPiper here, yes you will get through 99% of your music life only knowing treble and bass clef, plus maybe alto if you're a violist.
Comment: I'd argue that you don't need to know any clef unless/until you want to read music in it. It's good to have a general idea that there's more than one but if you ever only use treble, why bother learning even bass. But really it's just "middle of spiral is G, ball and two dots is F, beak is C" and then you either build up fluency as you're using it, or you don't because there's no reason to.
Answer: From Wikipedia:

When the F-clef is placed on the third line, it is called the baritone clef. Baritone clef was used for the left hand of keyboard music (particularly in France; see Bauyn manuscript) and for baritone parts in vocal music. A C-clef on the fifth line creates a staff with identical notes to the baritone clef, but this variant is rare.
Answer: This is the alto clef.

It is used for the viola most of the time and frequently encountered in orchestral scores.  As you have probably already learned, the clef points to middle C.  In this position, C is on the middle line.
It is one of the many positions that the C clef can occupy.  The C clef, often called the "movable" clef, appears in several different positions in several circumstances.  First, many older (1600s) choral scores will use it in many different positions.  Soprano clef (middle C on the bottom line) for sopranos, alto clef for altos, and so on.  The thinking was, I believe, that composers would use these clefs to avoid ledger lines.  Anything that fit on the staff was roughly within the range of that voice type.  During the classical period, three trombone parts in would be printed in alto, tenor, and bass clefs, to be played on alto, tenor, and bass trombones.  Also, several tenor-ish instruments in the orchestra currently use this movable clef when the instrument is supposed to play higher notes.  Trombone, bassoon, and cello parts will often use the tenor clef, for example, especially in solos.
As for this clef,

I have seen it in theory books and orchestration books but I haven't seen it elsewhere.  Since this clef points to F on this middle line, and the other version of baritone clef points to C on the top line, they are interchangeable and equivalent.  You are unlikely to see either clef very often, however.
Answer: The bass-like one places F to the third line. The alto-like one places C to the fifth line (counting from the bottom up, in case it's done the other way around in your country). So clearly they're equivalent to one another.
As for how come there are two in existence, they were probably invented independently.


Hadoop 2.8 NodeManager is shutting down on windows

Question: I have followed all the steps from this website. On my PC all are running perfectly but on my laptop nodeManager is shutting down.
https://muhammadbilalyar.github.io/blogs/How-to-install-Hadoop-on-Window-10/?fbclid=IwAR3u_-xwIulzm9KJ7ivsPD_JyQWI0jPvV9s_Fhp1RpPFupY3LWvrulzRr_4
Following is my nodeManager status after running start-all.cmd command.
r class org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.Res
ourceLocalizationService$LocalizerTracker
19/11/27 12:42:00 INFO containermanager.AuxServices: Adding auxiliary service ma
preduce_shuffle, "mapreduce_shuffle"
19/11/27 12:42:00 INFO monitor.ContainersMonitorImpl:  Using ResourceCalculatorP
lugin : org.apache.hadoop.yarn.util.ResourceCalculatorPlugin@2b72cb8a
19/11/27 12:42:00 INFO monitor.ContainersMonitorImpl:  Using ResourceCalculatorP
rocessTree : null
19/11/27 12:42:00 INFO monitor.ContainersMonitorImpl: Physical memory check enab
led: true
19/11/27 12:42:00 INFO monitor.ContainersMonitorImpl: Virtual memory check enabl
ed: true
19/11/27 12:42:00 INFO util.ProcfsBasedProcessTree: ProcfsBasedProcessTree curre
ntly is supported only on Linux.
19/11/27 12:42:00 INFO monitor.ContainersMonitorImpl: ContainersMonitor enabled:
 true
19/11/27 12:42:01 WARN util.SysInfoWindows: Expected split length of sysInfo to
be 11. Got 7
19/11/27 12:42:01 WARN monitor.ContainersMonitorImpl: NodeManager's totalPmem co
uld not be calculated. Setting it to -1
19/11/27 12:42:01 INFO nodemanager.NodeStatusUpdaterImpl: Nodemanager resources:
 memory set to 8192MB.
19/11/27 12:42:01 INFO nodemanager.NodeStatusUpdaterImpl: Nodemanager resources:
 vcores set to 8.
19/11/27 12:42:01 INFO nodemanager.NodeStatusUpdaterImpl: Initialized nodemanage
r with : physical-memory=8192 virtual-memory=17204 virtual-cores=8
19/11/27 12:42:01 INFO util.JvmPauseMonitor: Starting JVM pause monitor
19/11/27 12:42:01 INFO ipc.CallQueueManager: Using callQueue: class java.util.co
ncurrent.LinkedBlockingQueue queueCapacity: 2000 scheduler: class org.apache.had
oop.ipc.DefaultRpcScheduler
19/11/27 12:42:01 INFO ipc.Server: Starting Socket Reader #1 for port 51483
19/11/27 12:42:01 WARN util.SysInfoWindows: Expected split length of sysInfo to
be 11. Got 7
19/11/27 12:42:01 INFO pb.RpcServerFactoryPBImpl: Adding protocol org.apache.had
oop.yarn.api.ContainerManagementProtocolPB to the server
19/11/27 12:42:01 INFO containermanager.ContainerManagerImpl: Blocking new conta
iner-requests as container manager rpc server is still starting.
19/11/27 12:42:01 INFO ipc.Server: IPC Server Responder: starting
19/11/27 12:42:01 INFO ipc.Server: IPC Server listener on 51483: starting
19/11/27 12:42:01 INFO security.NMContainerTokenSecretManager: Updating node add
ress : annupc:51483
19/11/27 12:42:01 INFO ipc.CallQueueManager: Using callQueue: class java.util.co
ncurrent.LinkedBlockingQueue queueCapacity: 500 scheduler: class org.apache.hado
op.ipc.DefaultRpcScheduler
19/11/27 12:42:01 INFO pb.RpcServerFactoryPBImpl: Adding protocol org.apache.had
oop.yarn.server.nodemanager.api.LocalizationProtocolPB to the server
19/11/27 12:42:01 INFO localizer.ResourceLocalizationService: Localizer started
on port 8040
19/11/27 12:42:01 INFO ipc.Server: Starting Socket Reader #1 for port 8040
19/11/27 12:42:01 INFO ipc.Server: IPC Server listener on 8040: starting
19/11/27 12:42:01 INFO ipc.Server: IPC Server Responder: starting
19/11/27 12:42:01 WARN localizer.ResourceLocalizationService: Permissions incorr
ectly set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-xr-x,
 actual value = rwxrwxr-x
19/11/27 12:42:01 INFO localizer.ResourceLocalizationService: Attempting to init
ialize /tmp/hadoop-anwar/nm-local-dir
19/11/27 12:42:02 WARN localizer.ResourceLocalizationService: Permissions incorr
ectly set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-xr-x,
 actual value = rwxrwxr-x
19/11/27 12:42:02 WARN localizer.ResourceLocalizationService: Failed to setup lo
cal dir /tmp/hadoop-anwar/nm-local-dir, which was marked as good.
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Permissions incorrectly
set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-xr-x, actua
l value = rwxrwxr-x
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkLocalDir(ResourceLocalizationService.java:1560)

        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1528)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService$1.onDirsChanged(ResourceLocalizationService.java:271
)
        at org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.registe
rDirsChangeListener(DirectoryCollection.java:197)
        at org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService.reg
isterLocalDirsChangeListener(LocalDirsHandlerService.java:242)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.serviceStart(ResourceLocalizationService.java:371)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerM
anagerImpl.serviceStart(ContainerManagerImpl.java:490)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceStart(No
deManager.java:369)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNod
eManager(NodeManager.java:637)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManage
r.java:684)
19/11/27 12:42:02 INFO service.AbstractService: Service org.apache.hadoop.yarn.s
erver.nodemanager.containermanager.localizer.ResourceLocalizationService failed
in state STARTED; cause: org.apache.hadoop.yarn.exceptions.YarnRuntimeException:
 Failed to setup local dir /tmp/hadoop-anwar/nm-local-dir, which was marked as g
ood.
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to setup local di
r /tmp/hadoop-anwar/nm-local-dir, which was marked as good.
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1533)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService$1.onDirsChanged(ResourceLocalizationService.java:271
)
        at org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.registe
rDirsChangeListener(DirectoryCollection.java:197)
        at org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService.reg
isterLocalDirsChangeListener(LocalDirsHandlerService.java:242)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.serviceStart(ResourceLocalizationService.java:371)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerM
anagerImpl.serviceStart(ContainerManagerImpl.java:490)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceStart(No
deManager.java:369)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNod
eManager(NodeManager.java:637)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManage
r.java:684)
Caused by: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Permissions i
ncorrectly set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-
xr-x, actual value = rwxrwxr-x
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkLocalDir(ResourceLocalizationService.java:1560)

        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1528)
        ... 13 more
19/11/27 12:42:02 INFO ipc.Server: Stopping server on 8040
19/11/27 12:42:02 INFO ipc.Server: Stopping IPC Server listener on 8040
19/11/27 12:42:02 INFO ipc.Server: Stopping IPC Server Responder
19/11/27 12:42:02 INFO localizer.ResourceLocalizationService: Public cache exiti
ng
19/11/27 12:42:02 INFO service.AbstractService: Service org.apache.hadoop.yarn.s
erver.nodemanager.containermanager.ContainerManagerImpl failed in state STARTED;
 cause: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to setup
local dir /tmp/hadoop-anwar/nm-local-dir, which was marked as good.
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to setup local di
r /tmp/hadoop-anwar/nm-local-dir, which was marked as good.
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1533)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService$1.onDirsChanged(ResourceLocalizationService.java:271
)
        at org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.registe
rDirsChangeListener(DirectoryCollection.java:197)
        at org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService.reg
isterLocalDirsChangeListener(LocalDirsHandlerService.java:242)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.serviceStart(ResourceLocalizationService.java:371)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerM
anagerImpl.serviceStart(ContainerManagerImpl.java:490)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceStart(No
deManager.java:369)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNod
eManager(NodeManager.java:637)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManage
r.java:684)
Caused by: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Permissions i
ncorrectly set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-
xr-x, actual value = rwxrwxr-x
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkLocalDir(ResourceLocalizationService.java:1560)

        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1528)
        ... 13 more
19/11/27 12:42:02 INFO ipc.Server: Stopping server on 51483
19/11/27 12:42:02 INFO ipc.Server: Stopping IPC Server listener on 51483
19/11/27 12:42:02 INFO ipc.Server: Stopping IPC Server Responder
19/11/27 12:42:02 INFO service.AbstractService: Service NodeManager failed in st
ate STARTED; cause: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Fail
ed to setup local dir /tmp/hadoop-anwar/nm-local-dir, which was marked as good.
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to setup local di
r /tmp/hadoop-anwar/nm-local-dir, which was marked as good.
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1533)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService$1.onDirsChanged(ResourceLocalizationService.java:271
)
        at org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.registe
rDirsChangeListener(DirectoryCollection.java:197)
        at org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService.reg
isterLocalDirsChangeListener(LocalDirsHandlerService.java:242)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.serviceStart(ResourceLocalizationService.java:371)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerM
anagerImpl.serviceStart(ContainerManagerImpl.java:490)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceStart(No
deManager.java:369)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNod
eManager(NodeManager.java:637)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManage
r.java:684)
Caused by: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Permissions i
ncorrectly set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-
xr-x, actual value = rwxrwxr-x
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkLocalDir(ResourceLocalizationService.java:1560)

        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1528)
        ... 13 more
19/11/27 12:42:02 WARN nodemanager.NodeResourceMonitorImpl: org.apache.hadoop.ya
rn.server.nodemanager.NodeResourceMonitorImpl is interrupted. Exiting.
19/11/27 12:42:02 INFO impl.MetricsSystemImpl: Stopping NodeManager metrics syst
em...
19/11/27 12:42:02 INFO impl.MetricsSystemImpl: NodeManager metrics system stoppe
d.
19/11/27 12:42:02 INFO impl.MetricsSystemImpl: NodeManager metrics system shutdo
wn complete.
19/11/27 12:42:02 FATAL nodemanager.NodeManager: Error starting NodeManager
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to setup local di
r /tmp/hadoop-anwar/nm-local-dir, which was marked as good.
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1533)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService$1.onDirsChanged(ResourceLocalizationService.java:271
)
        at org.apache.hadoop.yarn.server.nodemanager.DirectoryCollection.registe
rDirsChangeListener(DirectoryCollection.java:197)
        at org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService.reg
isterLocalDirsChangeListener(LocalDirsHandlerService.java:242)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.serviceStart(ResourceLocalizationService.java:371)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerM
anagerImpl.serviceStart(ContainerManagerImpl.java:490)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.service.CompositeService.serviceStart(CompositeServ
ice.java:120)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceStart(No
deManager.java:369)
        at org.apache.hadoop.service.AbstractService.start(AbstractService.java:
193)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNod
eManager(NodeManager.java:637)
        at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManage
r.java:684)
Caused by: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Permissions i
ncorrectly set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-
xr-x, actual value = rwxrwxr-x
        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkLocalDir(ResourceLocalizationService.java:1560)

        at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.
ResourceLocalizationService.checkAndInitializeLocalDirs(ResourceLocalizationServ
ice.java:1528)
        ... 13 more
19/11/27 12:42:02 INFO nodemanager.NodeManager: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NodeManager at annupc/192.168.1.103
************************************************************/

Answer: Did you get the following bin files in HADOOP directory
https://github.com/s911415/apache-hadoop-3.1.0-winutils
also, try to clean datanode files and remove temp from C:\
Answer: I had the same issue which I think is caused because of permission of the folders required to run Hadoop. When I tried the same commands in Administrator command prompt(opened through run as administrator), It worked for me.
And if you are working in ubuntu, typing sudo before the command might help.
Answer: It clearly states the reason for shut down.
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Permissions incorrectly
set for dir /tmp/hadoop-anwar/nm-local-dir/usercache, should be rwxr-xr-x, actual value = rwxrwxr-x
chmod -R 755 /tmp/hadoop-anwar/nm-local-dir/usercache

should solve the issue.


Why is Stratocaster Low E-String Intonation at Limit?

Question: I recently got an American Standard Stratocaster and I've been working on setting it up.
I have tightened the intonation adjustment screw for the low E string to its limit and now the tension spring is fully compressed.
Despite this, the intonation is just barely correct. (The intonation for this string had been way off, that's why I kept on tightening the intonation adjustment screw.)
The other strings don't really seem to be suffering from the same problem.
Why is this happening? Is it an indication of a bigger problem?
Comment: This is either the result of a low quality build or some other setup metric is out of normal parameters. Before setting the intonation, make sure the neck relief (set via the truss rod adjustment), neck angle, and saddle height are not too unusual. Also make sure the gauge for that string is a normal gauge. And also make sure you're actually checking the intonation correctly. Also as Tetsujin mentioned, an unusual bridge height could be a problem.
Comment: How high does the bridge sit? We could do with a pic from the side too. If it's got plenty of room you could tighten the springs around the back, or add another spring [they tend to have room for 5 but only come with 3.] Sometimes people angle the outer 2 to give a bit more tension.
Comment: @Sharp questions I have are "new strings?" and "string gauge!" You have to put it back father the bigger the string, which shouldn't be too much of an issue with 9s or 10s, but might get worse with beefier. Old, worn and gunky strings don't behave right. Also, shimming the neck might get your action in a more adjustable range.
Comment: I haven't personally done a lot of this, but I've recently watched a lot of YouTube about setups. Your two points of attack appear to be: modify/replace the saddle piece so it pulls farther back, or possibly resetting the neck pocket with a shim to add length to all the strings.
Comment: Ocassionally one can get a bad string, so it could be just that. .
Comment: @Tetsujin in terms of the bridge, the saddles are set as low as possible because I like a low action. I set the floating tremolo to Fender specs (1/8" float). And, the action is still higher than I'd like.
Comment: @Todd Wilcox yeah no doubt. Everything looks fairly good to my eye, but I'm not a pro. I'm probably going to end up taking the guitar in for a pro setup provided I can find a top-quality technician.
Comment: There is value to bringing your guitar to a tech, but most things are well within your skill set. Here's the Fender setup guide.
httpss://fendercustomersupport.microsoftcrmportals.com/en-us/knowledgebase/article/KA-01901
Comment: It's not a bad string and it's unfortunately common if the saddle is already close to the end from the factory. I've had this happen more with basses when changing from round to flats. Twice this happened with Ibanez Mikro and the factory said 'It was ok when it left, so?'
Answer: Assuming your A and D strings are intonated correctly, the length of that E looks about right, maybe even a little too far back.
As in the comments, check the neck relief and the action, and get those about right before checking the intonation. Intonation needs strings to be pressed down - I use 12th 19th and 24th fret (if there!) to check. Harmonics will always work, but the strings need to be fretted to check, and if they're high, they stretch out of tune, so intonation is well nigh impossible.
That E looks very low in comparison to the A and D, can't understand why, even with a cambered fingerboard. Check all string heights first.
Since one part of the set-up will affect another, keep checking: neck relief; action/string height; intonation; neck relief; action/string height;, etc. And in between all this, there's the springs on the vibrato to consider...
If you do find that E saddle needs to go back further, and I'm a little sceptical, remove either the spring or some meat off the end of the saddle. Another slight problem may be unusual strings. Heavy gauge will need longer speaking length, but adjustment is available to a good .048"+. I guess before the set up you put new strings on? If not, it's the next move!
Comment: I'm not a pro but I think I did a decent job with the setup. Still, we all know Strats are indeed finicky and one adjustment tends to affect all the others (nut height, string height, neck tension, intonation, and above all the tremolo spring tension). There does seem to be some issue with the action which is still a little high (probably) even after all my efforts to keep it low. They are new strings, yes (light gauge). And it could be a bad string, or it could be because during the setup I replaced the (broken) nut and the strings were repeatedly tensioned to tune and then slackened. Thx!
Answer: This is a common problem.  I run into this issue probably 10 to 15 percent of the time.  The solution is to shorten (cut) the spring and sometimes also replace the screw with a shorter one (Don't want it hitting the string!)
Answer: If nothing works that is easy, you can always shim the neck to creat more length. Based on the photo, you're running flat on 12 and you can't back it up anymore. If the truss rod solution doesn't work nor the cutting the spring, then the scale might be off by what may be as small as a few mm. StuMac has neck shims that you can insert between the neck heel and the body to lengthen the scale if it's too short.  Your other saddles will need to be adjusted accordingly.
Answer: There might be many reasons. Some things to consider:

The thicker (higher gauge) the string is, the more compensation on bridge is needed.

Could it be that the low E string arcs over the nut, rather than break clean and straight? Seems unlikely to me with a standard tuning guitar... but maybe it is the case, especially with strings through body. This would explain both problems with intonation, and high action. You can easily bend the string to correct shape with your fingers. See this video:
Answer: I know this is an old post but this is a typical issue with all 25-1/2" scale, 22 fret, electric guitars. I've owned a bunch and even the high end ones, with excellent setups, need the Low E string to be stretched way out. A couple of them are maxed out and still ring out a tiny bit sharp, on the 12th fret, while they are perfectly in tune (open). I've seen videos where professional guitar players will mention this same issue. Some going as far as taking that spring completely out, and playing without it, which I don't recommend.
The guitar I currently use the most is the exact same way and its setup is otherwise perfect. The neck is dead straight, it has great action, and a high end Gotoh bridge and Gotoh locking tuners. (It also has a bone nut.) So it's definitely not a quality issue. It's a 2022 model, which I got new, so it's never been tampered with or modded. Just set-up. I also use D'Addario NYXL 09-42 strings, and know when to change them, so there is no issue there.
It's not strings, it's not truss, it's not action, and it's not a hardware issue.
The Number 1 fix is to replace the spring with a shorter one (which is very simple). My guitar still had 3/16" of a gap when the original spring was fully compressed. The saddle only needed another 1/4 turn of the screw to hit intonation, as well, so the saddle still has plenty of room to keep going with the shorter spring in place (not that it needs to).
Also, you shouldn't need to replace the intonation screw since you should have more than enough space to extend the saddle further without the string being near the end of the screw.
The reason this issue happens to many guitars is because they get manufactured in different areas of the world which have different climates and different gravitational pulls (which apparently affect intonation in some way). (Yes, gravity differs, to some degree, depending on where in the world you are.) So, a guitar might have perfect intonation in one area of the world while in a different area will need further adjustment. And with this scale, and this number of frets, the Low E string will already be pretty far extended even if it is keeping intonation.
Answer: I've had that happen on a lot of guitars but just lived with it since it's not that consequential in that I don't play the low E string that much.  But what comes to mind is that the only way you could possibly affect it is to change your relief by adjusting the truss rod.  If you adjust the truss rod to get less relief it would help out with the problem.
Answer: Remove saddle, cut the spring in half, reassemble and re intonate.
Comment: Would be worth explaining how this might resolve the problem...
Answer: neck is to strait,more relief will fix it.
Comment: I'm confident that this is not it.  A high action (often confused with too much relief) could push the intonation sharp.  OP has intonation that is *too* sharp, so more relief would, in the best case, not help.  If OP does not also adjust action at the same time, it would make the problem worse.


Brook's theorem. Where I make a mistake?

Question: please explain me one thing:
According to Brook's theorem $ \chi(G )  \le \deg(u) $
But it can't be true. After all, there are $\deg(u) + 1 $ colors and I'm enclosing a draw.
https://i.stack.imgur.com/mmw6K.png
$\deg(u) = 5 $ and there are six colors, and graph isn't complet and it not odd-cycle. I don't understand.
What mistake I do?
Answer: The chromatic number of a graph isn't defined from any colouring you want, but from the optimal colouring. Your graph can be coloured using only two colours (one for vertex $u$ and one for all the rest). Therefore $\chi(G) = 2$, and the theorem still holds.


Changing the initial value of an exposed view filter

Question: I'm trying to programmatically set the starting value of an exposed view filter (so that it initially loads the view with data matching that value).
I've managed to change the filter field value with this code in a views_pre_build hook (doesn't work in pre_execute or pre_render):
<code>$view->display[$view->current_display]->handler->handlers['filter']['field_year_value']->value['value'] = $year;
</code>
But the view still loads with the value from the view filter's config value.  How can I get my change reflected in the view when it loads?
Answer: For some reason a site I was adding a feature to had a years taxonomy vocabulary, with a number of terms, one for each year in a range. So I wanted to auto set the exposed filter to the current year, but to do so needed to set the filter value with the tid of the right term.
I implement hook_views_query_alter().
check if the view is the right name and if the view doesn't have any user selected input (this view only had one filter).
You have to alter the value for the filter's query value
You have to unset the exposed filter area markup and regenerate it.
<code> function mymodule_views_query_alter(&$view, &$query) {

      if($view->name == 'executive_committee' && empty($view->exposed_input)) {
        $current_year = date('Y');
        // find year term id
        $term_query = new EntityFieldQuery();
        $tids = $term_query->entityCondition('entity_type', 'taxonomy_term')
          ->propertyCondition('name', $current_year)
          ->propertyCondition('vid', 3)
          ->execute();

        if(!empty($tids['taxonomy_term'])) {
          $tids = array_keys($tids['taxonomy_term']);
          $current_year_tid = reset($tids);

          // set values to the views object and query objet
          $view->exposed_data['field_year_tid'] = $current_year_tid;
          unset($view->exposed_widgets);
          $view->exposed_raw_input['field_year_tid'] = $current_year_tid;
          $query->where[1]['conditions'][2]['value'] = $current_year_tid;
          // rebuild the exposed form
          $form_state = array(
            'view' => $view,
            'display' => $view->display_handler->display,
            'exposed_form_plugin' => $view->display_handler->get_plugin('exposed_form'),
            'method' => 'get',
            'rerender' => TRUE,
            'no_redirect' => TRUE,
            'always_process' => TRUE, // This is important for handle the form status.
          );
          $form = drupal_build_form('views_exposed_form', $form_state);
          $form['field_year_tid']['#value'] = $current_year_tid;
          $view->exposed_widgets = drupal_render($form);

        }

      }
    }
</code>
Comment: You didn't say which Drupal version, but this is for D7
Comment: It is 7, thought I'd put that in the tittle but I guess not...
Comment: This  is looking good, thanks!  The only thing was it wasn't updating the field's value, just the view's output.  I poked around a bit and managed to do that with this code:  $view->display_handler->display->handler->view->display[$view->current_display]->handler->handlers['filter']['field_year_value']->value['value'] = $year;
Comment: That of course goes before declaring the form_state
Comment: Scratch that, I'm dumb.  I copy/pasted your code and forgot to change one of your fieldname instances to mine.  Works perfectly once I drilled down to where the value's stored in the form.


Theme changes not showing up in liferay

Question: I'm relatively new to CSS and very new to Liferay. I have a custom theme I'm trying to build. Just for testing, I was trying to change the title text color for portlets on the page. In my custom.css, I have
.portlet-title {
   float: none;
   font-weight: bold;
   min-width: 50%;
   padding: 5px;
   text-shadow: 1px 1px #FFF;
   color: #800000;
}

I'm assuming this is the correct class, because adding the color in the firefox inspector under this class changes the color. However, when I deploy the theme, it reverts back to
.portlet-title {
      float: none;
      font-weight: bold;
      min-width: 50%;
      padding: 5px;
      text-shadow: 1px 1px #FFF;
}

if I ftp to the folder for the theme, the changes I made are still in the custom.css. For some reason, when the theme renders in Liferay, it reverts back to the css from before I made the changes. I've tried everything I know to try including clearing the browser cache. Any thoughts?
Comment: Pl make sure that u are making the changes in the _diff folder.
Comment: Possible duplicate: http://stackoverflow.com/questions/26037640/liferay-when-i-build-the-war-my-changes-are-removed/26037992#26037992
Answer: It sounds like you're updating the files on the webserver directly ("ftp the folder for the theme") instead of changing it properly, e.g. in development environment, building a new theme.
Liferay minifies the CSS (and javascript), concatenating all CSS files into one and eliminating the whitespace. There's also SASS processing. All this is cached, so the odds are that Liferay will not detect your changes without redeploying a new theme.
Use the "raw" development version of your theme, make your changes there (in the _diffs folder) and build an updated theme plugin. Deploy that to Liferay, and the changes will be picked up.
Answer: Things that could be the cause + remedies for each:

Assure developer properties are in use and fast.load.css and and fast.load.js properties are in place in your portal-ext.properties:
E.g. - In {tomcat}/bin/setenv.sh :
-Dexternal-properties=portal-developer.properties as mentioned, and
In portal-ext.properties set: theme.css.fast.load=false and javascript.fast.load=false.
Be sure you are building from your IDE / Liferay SDK, based off of changes you made to the _diffs folder and deploying those changes to your Liferay node(s). Hot deploy can be accomplished by pushing your theme.war file to the Liferay /deploy directory. Be sure to deploy the changes to all nodes of your cluster, if more than on application server is in use behind a load balancer.
You may need to stop Liferay, then clean the /temp and /work folders of your application server. This further assures that some pre-cached files are not being presented to the client.
CDN enabled? Is there a Varnish (or some other) cache mechanism in front of your application layer? - Are you using the Liferay CDN feature (Liferay Portal Settings main screen) to cache .js, .css, images, and other files to alleviate that strain off of Liferay? Disable the CDN feature or review your method of caching to be sure your latest files are being 'seen' as the new version to be cached. Some set up a www tier in front of Liferay and copy their theme (and other) files to that www tier to be delivered by it. If that is your architecture, you will need to assure a copy of your new theme files are also copied to the www tier.
Clean the cache of any browser you are testing with, or use "Private browsing" or "Incognito" windows to assure you aren't loading anything from the browser cache.
Answer: Add the below property to your JAVA_OPTS and check?
JAVA_OPTS="-Dexternal-properties=portal-developer.properties"

Theme changes not showing up in liferay


Will synthetic data (e.g. from a generative model) produce valid statistical inference?

Question: Especially with chatGPT now, there is a lot of interest in generative models for healthcare for creating synthetic patient data to amplify patient counts, e.g. for rare diseases. These are then supposed to be used for purposes of statistical inference, e.g. to compare patient outcomes, estimate risk ratios etc.
My question is whether synthetic data can, in theory and practice, produce valid statistical inference, e.g. confidence intervals.
Edit: Adding some more detail, assume we have some measured data $X$. We are interested in estimating some statistics (mean, variance) based on this sample of data. Assume the data $X$ has $n$ observations, and we have a very flexible way of learning the joint distribution of the data using some state-of-the-art methods (e.g., GANs, sample sitting) which we can then use to simulate some artificial data $\hat{X}$. If we augment actual data with this simulated data, can we still validly estimate statistical quantities like means and variances for any/every possible scientific question/target of inference?
Comment: At least philosophically, how different is it to generate data to add to the sample in a frequentist approach and to use a prior distribution in a Bayesian approach?
Comment: *"These are then supposed to be used for purposes of statistical inference, e.g. to compare patient outcomes, estimate risk ratios etc."* I do not understand this use. The important part that is left away is *how* synthetic data is used for statistical inference. Is the synthetic data used like Monte Carlo stimulations, which seems fine to me (although there might be technical issues) or is the synthetic data used to replace real data, which I would not understand how that works.
Answer: If you run a statistical analysis on synthetic data, you will get out what you put in.  That is, the results of the analysis will reflect the assumptions that went into your generative model.  This can be very useful for testing an analysis method; for example, you could test the sensitivity of the method to model misspecification.  However, you will not learn anything about the real world because there is nothing of the real world in your data.  In science there is no substitute for actually going out and gathering observations.
By the way, there is no need to use an AI program like GPT to generate synthetic data, nor is there any particular advantage in doing so.  People have been doing it for years (e.g., SynPUF).  For most purposes, using an opaque model like an LLM is actually a disadvantage because you don't know what assumptions are built into it, nor what the "correct" answer is for a model run on the simulated data.  In simulation studies you want to be able to compare your model's results to the theoretical values that you know based on how you set up the simulation.
Answer: Must it produce a valid inference? No!
In the simulation below, I generate a sample of size $10$ that serves as the data. Then I generate synthetic data, based on the mean and variance from the sample. I combine the data and the synthetic data and calculate a confidence interval for the combination. I also calculate a confidence interval for the original data.
set.seed(2023)
N <- 10    # Sample size
S <- 1000  # Sample size wen synthetic data are added, so S - N synthetic points
R <- 10000 # Number of replications of the simulation
mu <- 0    # Population mean that will be estimated

level <- 0.95  # Confidence level

contained <- rep(1, R) # Does the forthcoming confidence interval contain mu?
                       # 1 for yes, 0 for no
contained_regular <- rep(1, R)

for (i in 1:R){

  # Simulate N-many points from N(mu, 1) to serve as original data
  #
  x <- rnorm(N, mu, 1)

  # Simulate synthetic points from an assumed Gausian distribution that has
  # the empirical mean and standard deviation
  #
  y <- rnorm(S - N, mean(x), sd(x))

  # Combine the synthetic and original data
  #
  d <- c(x, y)

  # Calculate a confidence interval for the mean
  #
  ci <- t.test(d, mu = mu, conf.level = level)$conf.int

  # Check if mu is below the lower or above the upper limit of the interval
  #
  if (ci[1] > mu){
    contained[i] <- 0
  }
  if (ci[2] < mu){
    contained[i] <- 0
  }

  # Check if the regular confidence interval (without the synthetic data)
  # contains mu
  #
  ci_regular <- t.test(x, mu = mu, conf.level = level)$conf.int
  if (ci_regular[1] > mu){
    contained_regular[i] <- 0
  }
  if (ci_regular[2] < mu){
    contained_regular[i] <- 0
  }

}

# Calculate the coverage of the confidence intervals: how many times they
# contain the true mu
#
mean(contained)
mean(contained_regular)

The confidence intervals from the real data contain the true parameter value in about the desired $95\%$ of cases ($95.11\%$). However, augmenting the data with synthetic data leads to the confidence intervals containing the true value in only $13.94\%$ of cases. That is, you think you're calculating a $95\%$ confidence interval but actually get a $13.93\%$ confidence interval. Ouch!
What's happening is that the synthetic data are generated to be similar to the data, not the data-generating process. Each time data are generated, they are generated using the estimated mean and variance, which are not the true mean and variance. This drags the synthetic data away from the true population of interest, distorting the statistical inference.
I hope this demonstrates potential dangers of using synthetic data. Philosophically, I do not see much of a difference between using synthetic data in frequentist methods and using an informative prior in Bayesian methods, and Bayesian methods can be very powerful, but if you pick a bad prior (or a bad way of generating synthetic data), you can wind up in trouble.
EDIT
Amazingly, the story doesn't even get much better for N <- 10000 and S <- 100000. I would have though that the estimated mean and variance would be so close to their true values with a sample size of 10000, but they appear not to be close enough to give confidence intervals that function as they should.


Rebuild form in AJAX callback

Question: I've got a simple form which I've added a little AJAX to. The form simply let's people add users to a list. That is, I've got a textfield where people can enter an e-mail address, and that e-mail address gets added to the list.
Now, the "Add" button is AJAX enabled, meaning that the add request gets posted as an AJAX request. However, I would then like the AJAX callback function to render the form again so that the newly added user appears in the list. However, I can't really see how I should do this.
I've tried to build the form ("from scratch") using drupal_get_form() in the AJAX callback function and then return that form, but that does not work. It just gives me the error :
Notice: Undefined index: form_build_id in /home/playground/www/public_html/includes/ajax.inc on line 320

How should I go about when I would like to rebuild the form from the very scratch as a part of the AJAX request, and then return that form?
Answer: In your AJAX callback, use $form_state['rebuild'] = TRUE; (drupal_rebuild_form).
$form_state['rebuild'] is very useful in multistep forms, but it can also be handy in Ajax callbacks.
I recommend checking out the Examples project as well.  Both the Form examples and the AJAX examples.
If you will add the relevant snippets of your code I will try to add more details.
Comment: Thank's for that! I have built multistep forms before, and I've often used the $form_state['rebuild'], but I what I did not remember was that i needed to set it in the submit callback and not in the ajax callback :-)

Thanks for pointing me onto the right track!
Comment: I realize this answer is quite old, but I wonder: How is setting $form_state['rebuild'] in an AJAX callback supposed to have any effect? If you look at [ajax_form_callback](https://api.drupal.org/api/drupal/includes%21ajax.inc/function/ajax_form_callback/7) you can clearly see that the form has already been processed once the callback gets invoked.
Comment: Downvote because @ciss is right - the ajax callback is called to late to have any effect.
Answer: Looks like you're trying to do it old way.
In D7 your form building code runs on initial form display and on subsequent ajax calls. You can make use of $form_state parameter there to render the form according to freshly entered data.
You attach a '#callback' attribute to ajaxified elements. Most examples show returning one particular element in a callback. But it's just a convenient special case. There is a powerful Ajax Commands API, it can be used to request execution of a wide range of operations on a client from a server.
No need to manually rebuilding forms or something like that. Just look at the examples on http://api.drupal.org/api/drupal/includes!ajax.inc/group/ajax_commands/7.

Rebuild form in AJAX callback