Increasing the timeout value in a WCF service

Question: How do I increase the default timeout to larger than 1 minute on a WCF service?
Comment: What is not clear, but I think you are asking implicitly, is whether or not it is possible to configure on the server side to timeout any calls that take longer than one minute to process. [This is not possible](https://mohundro.com/blog/2011/08/19/wcf-and-service-side-timeouts/)
Answer: Are you referring to the server side or the client side?
For a client, you would want to adjust the sendTimeout attribute of a binding element. For a service, you would want to adjust the receiveTimeout attribute of a binding elemnent.
<system.serviceModel>
  <bindings>
    <netTcpBinding>
      <binding name="longTimeoutBinding"
        receiveTimeout="00:10:00" sendTimeout="00:10:00">
        <security mode="None"/>
      </binding>
    </netTcpBinding>
  </bindings>

  <services>
    <service name="longTimeoutService"
      behaviorConfiguration="longTimeoutBehavior">
      <endpoint address="net.tcp://localhost/longtimeout/"
        binding="netTcpBinding" bindingConfiguration="longTimeoutBinding" />
    </service>
....

Of course, you have to map your desired endpoint to that particular binding.
Comment: How do I map the binding, using 'bindingname' inside the endpoint tag?
Comment: [This is simply wrong](https://www.rauch.io/2015/06/25/all-wcf-timeouts-explained/) The `receiveTimeout` on the server side governs determination of idleness for session based bindings. For example, the server won't use this setting for basicHTTP bindings.[You have to roll your own server side processing timeouts for WCF](https://mohundro.com/blog/2011/08/19/wcf-and-service-side-timeouts/)
Comment: As you can see from the config, it's a NetTcpBinding and not a BasicHttpBinding.
Answer: Under the Tools menu in Visual Studio 2008 (or 2005 if you have the right WCF stuff installed) there is an options called 'WCF Service Configuration Editor'.
From there you can change the binding options for both the client and the services, one of these options will be for time-outs.
Comment: The tool is a great way to go to avoid errors such as wrapping the elements up the wrong way, spelling, etc.  Good call!
Comment: see also here for the other tool to open the log files: https://stackoverflow.com/a/34283667/187650
Answer: You can choose two ways:
1) By code in the client
public static void Main()
{
    Uri baseAddress = new Uri("http://localhost/MyServer/MyService");

    try
    {
        ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService));

        WSHttpBinding binding = new WSHttpBinding();
        binding.OpenTimeout = new TimeSpan(0, 10, 0);
        binding.CloseTimeout = new TimeSpan(0, 10, 0);
        binding.SendTimeout = new TimeSpan(0, 10, 0);
        binding.ReceiveTimeout = new TimeSpan(0, 10, 0);

        serviceHost.AddServiceEndpoint("ICalculator", binding, baseAddress);
        serviceHost.Open();

        // The service can now be accessed.
        Console.WriteLine("The service is ready.");
        Console.WriteLine("Press <ENTER> to terminate service.");
        Console.WriteLine();
        Console.ReadLine();

    }
    catch (CommunicationException ex)
    {
        // Handle exception ...
    }
}

2)By WebConfig in a web server
<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding openTimeout="00:10:00"
                 closeTimeout="00:10:00"
                 sendTimeout="00:10:00"
                 receiveTimeout="00:10:00">
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>

For more detail view the official documentations
Configuring Timeout Values on a Binding
Class WSHttpBinding
Answer: Different timeouts mean different things. When you're working on the client.. you're probably looking mostly at the SendTimeout - check this reference - wonderful and relevant explanation:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/84551e45-19a2-4d0d-bcc0-516a4041943d/
It says:
Brief summary of binding timeout knobs...

Client side:

SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including receiving a reply message in a request-reply case).  This timeout also applies when sending reply messages from a CallbackContract method.
OpenTimeout and CloseTimeout are used when opening and closing channels (when no explicit timeout value is passed).
ReceiveTimeout is not used.

Server side:

Send, Open, and Close Timeout same as on client (for Callbacks).
ReceiveTimeout is used by ServiceFramework layer to initialize the session-idle timeout.

Answer: In addition to the binding timeouts (which are in Timespans), You may also need this as well. This is in seconds.
<system.web>
    <httpRuntime executionTimeout="600"/>

Comment: where client or server ?


Contagem Regressiva com JavaScript

Question: Sou iniciante em JavaScript e preciso criar uma pagina com contagem regressiva.
Preciso pegar uma data futura e que faça a contagem regressiva.
Qual a melhor forma?
Comment: E o seu código? Onde você parou? Posta seu código..
Answer: Fiz uma aplicação parecida em meu projeto para colocar a página em manutenção caso for necessário realizar alguma manutenção.

Para o código funcionar corretamente é preciso de duas coisas: data inicial e final.

Como pode ver no código abaixo é preciso informar a data como new Date(),
new Date(ANO, MES, DIA, HORA, MIN, SEG), lembrando que o mês começa em 0, Janeiro = 0, Fevereiro = 1, Março =2 , ...
Uma breve explicativa, a cada 0,1s ele da um refresh no código para atualizar o tempo, dentro do código ele inicia uma variável now, responsável por controlar o tempo percorrido e a variável porcentagem que é responsável por guardar a porcentagem já percorrida.

dateStart = new Date(2019, 5, 29, 12, 00, 00);
dateEnd = new Date(2019, 5, 29, 14, 00, 0);
var start = dateStart.getTime();
var end = dateEnd.getTime();
var dataFinal = verificaZero(dateEnd.getDate()) + "/" + verificaZero(dateEnd.getMonth() + 1) + "/" + dateEnd.getFullYear();
var horaFinal = " ";
horaFinal += verificaZero(dateEnd.getHours()) + ":" + verificaZero(dateEnd.getMinutes());
var tempoFinal = dataFinal + horaFinal;

function verificaZero(value){
    var result = value < 10 ? "0"+value : value;
    return result;
}

window.setInterval(function() {
  var now = +new Date;
  porcentagem = (now - start) / (end - start) * 100;
  if (porcentagem > 100) {
    porcentagem = "100";
  }
  if (porcentagem <= 0) {
    porcentagem = "0";
  }
  if (porcentagem <= 100 || porcentagem > 0) {
    $("#progress-bar").text(parseInt(porcentagem) + "%");
        if (porcentagem < 100)
            $("#porcent").html("Aguarde, data de retorno: " + tempoFinal);

        if (porcentagem == 100)
            $("#porcent").html("Aguarde em instantes estaremos online.");
  }
  $('.progress-bar-container').attr('title', parseInt(porcentagem) + "% Completo.");
  porcentagem = porcentagem + "%";

  document.getElementById("progress-bar").style.width = porcentagem;
}, 100);
.manutencao {
    text-align: center;
    border-radius: 10px;
    opacity:0.8;
    filter:alpha(opacity=80); /* For IE8 and earlier */
}
.manutencao .logo {
    background: radial-gradient(circle, #94D2F8, #3A92C8) repeat scroll 0% 0% transparent;
    border-radius:10px;
    padding:20px;
    box-shadow: inset 2px 2px 10px 0px #222;
}
.manutencao a{color: #77dff1; text-decoration: none;}
@font-face {
    font-weight: normal;
    font-style: normal;
}
.manutencao h1 {
    text-transform: uppercase;
    color: #3c8dbc;
    font-size: 80px;
    font-weight: lighter;
    text-shadow: 0px 2px 0px #000;
    margin: 30px 0 0 0;
}
.manutencao h2 {
    text-transform: uppercase;
    color: #3c8dbc;
    font-size: 24px;
    font-weight: lighter;
    text-shadow: 0px 2px 0px #000;
    margin: 15px 0 15px 20px;
    text-align: left;
}
.manutencao p {
    color: #000;
    margin: 0;
    font-size: 16px;
}
.manutencao p.credit {font-size: 12px; margin-top: 40px; color: #ccc;}
.manutencao .hr {
    display: block;
    border: none;
    width: 100%;
    height: 2px;
    margin: 10px 0;
}
.manutencao .clear {
    clear: both;
}
.manutencao .progress {
    height: 70px;
    margin: 50px 10px 10px 10px;
    background: #222d32;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    position: relative;
    width: auto;
}
.manutencao .txt-launch-day-hat {
    width: 117px;
    height: 159px;
    position: absolute;
    top: -120px;
    right: -45px;
}
.manutencao .txt-launch-day {
    width: 112px;
    height: 110px;
    position: absolute;
    top: -80px;
    right: -40px;
}
.manutencao .progress-bar {
    height: 43px;
    background: #3c8dbc;
    position: absolute;
    top:14px;
    left: 0px;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    font-size: 30px;
    align-items: center;
    display: flex;
    justify-content: center;
}
.manutencao .progress-bar-container {
    width: 100%;
    height: 70px;

    position: relative;
}
.manutencao .mailing-list h2 {
    width: 400px;
    float: left;
}
.manutencao .mailing-list form {
    display: block;
    width: 450px;
    float: right;
    margin: 5px 0 0 0;
}
.manutencao .mailing-list input[type=text]{
    width:280px;
    height: 16px;
    border: none;
    color: #c9c9c9;
    font-size: 14px;
    padding: 15px 10px;
    margin: 0;
}
.manutencao .mailing-list input[type=submit]{
    width:90px;
    height: 44px;
    border: none;
    text-indent: -5000px;
    cursor: pointer;
    margin: 0 0 0 -10px;
    text-transform: capitalize;
}
.manutencao .mailing-list input[type=submit]:hover{
    background-position: 0 -44px;
}
.manutencao .mailing-list input[type=submit]:active{
    background-position: 0 -88px;
}
.manutencao .mailing-list input[type=text]:focus {
    outline: none;
}
#porcent{
    color: #3c8dbc;
    font-size: 50px;
    font-weight: lighter;
    text-shadow: 0px 2px 0px #000;
}

Contagem Regressiva com JavaScript


A counting problem involving some cyclic structure

Question: Let $a_i\in \{0,1\}$, and $a_i'=1-a_i$, $i=1,2,\ldots,m$.
We want to obtain an explicit formula of counting from $2^m$ possible $(a_1,a_2,\ldots,a_m)$'s, how many satisfy
$$
\# \{i: a_i=a_{i-1}'=1\}=r,
$$
where $a_0'$ is understood as $a_m'$, $0\le r\le m/2$. It is easy to see that $r=\#\{i: a_i=a_{i-1}'=0\}$.
For example in the following table
$$
a_i \quad 1 \quad 0 \quad 1\quad 1 \quad 0\\
a_i'\quad 0 \quad 1\quad 0 \quad 0 \quad 1
$$
$r=2$.
If $r=0$, there are also only 2.
I have tried to think about placing the $r$ of $a_i=a_{i-1}'=1$'s first, which has$\frac{m(m-2)\ldots(m-2r+2)}{r!}$ ways. But then I found that the placing of $a_i=a_{i-1}'=0$'s depends on your placing of $a_i=a_{i-1}'=1$'s.
For example, when $m=6$ and $r=2$,
if I place  $a_i=a_{i-1}'=1$'s in the following way:
$$
a_i \quad X \quad X \quad 1\quad X \quad 1 \quad X\\
a_i'\quad X \quad 1\quad X \quad 1 \quad X \quad X
$$
then in the middle diagonal $X$'s there has to be an  $a_4=a_{3}'=0$.
But if I place $a_i=a_{i-1}'=1$'s in the following way:
$$
a_i \quad X \quad 1 \quad X\quad X \quad 1 \quad X\\
a_i'\quad 1\quad X\quad X \quad 1 \quad X \quad X
$$
one $a_i=a_{i-1}'=0$ can be $a_3=a_{2}'=0$ or  $a_4=a_{3}'=0$, which has more choices.
Comment: Could you describe what you have attempted so far, so people can see where you are getting stuck.
Answer: This seems to be the number of changes from $1$ to $0$ in the sequence with looping at the end of the sequence.
Consider the sequence to be made of alternating blocks of $0$s and $1$s of length $b_1,\dots,b_k$, $b_1 + \dots + b_k = m$. If $k$ is even, there will be $\frac{k}{2}$ changes and if $k$ is odd there will be $\frac{k-1}{2}$ changes.
Let now $r$ be given. When $k=2r$ there are ${m - 1 \choose k - 1} = {m - 1 \choose 2r - 1}$ ways to choose the lengths of the $b_i$ and $2$ ways to choose whether $b_1$ consists of $0$s or $1$s. Similarly when $k=2r+1$, we get ${m - 1 \choose 2r}$ ways to choose the lengths of the $b_i$.
In total there will then be
$$2{m-1 \choose 2r - 1} + 2{m-1 \choose 2r} = 2 {m \choose 2r} $$
sequences with exactly $r$ changes.
Comment: This seems to be a promising answer. I will think about it carefully later when I have time. Thanks J.J.!
Answer: You get the property your looking for every time a 0 preceeds a 1 in the original string, and considering the string to be circular. So for example if i had m=8 and r=3 i would have either three occurrences of a 0 followed by a 1 or two ocurrences of a 0 followed by a 1, and 0 at the end of the string and 1 at the start (considering the string to be circular).
So imagine i have the first case $\{0,1\},\{0,1\},\{0,1\}.$ Now you can fill the spaces between these to form a string like you suggested with 2 more digits, these can be two 1's, two 0's or a 1 and a 0. You must only make sure you don't distribute them together in the latter case.
Answer: I get the same answer with a slightly different approach but i think the general thinking is  along the same lines.
Take $m$ empty spaces and $k$ markers. Place $k$ markers at random numbered $1$ to $k$ (there are $\binom{m}{k}$ ways in total to do this.) Start at marker one and place either a $1$ or a $0$ in it's place, wlog assume a $1$. Now moving from left to right keep placing $1$'s until we hit marker $2$ in the space occupied by marker $2$ place a $0$. Then keep placing $0$'s until we hit marker 3, and repeat this process cyclically. Now every odd marker contains a $1$ and every even marker contains a $0$. Thus in order to have exactly $r$ occurrences of $0$ followed by a $1$ we require $k=2r$. Finally there are two ways to place the initial marker giving us a total of $2\binom{m}{2r}$ possible ways.
In addition to this there is the task of proving every that every string with $r$ occurrences of $0$ followed by a $1$ can be represented by placing $2r$ markers. This should not be too difficult.
Comment: Thanks, Pavan. Your idea is elegant. I would accept yours if it came in the first place.


Consider the next succession and prove by induction

Question: The exercise says:
Knowing the next succession,

$$a_1=1$$
$$a_{n+1}=\frac{2a_n}{(2n+2)(2n+1)}, n>=1$$

Prove by induction that $a_n=\frac{2^n}{(2n)!}$
What I've done so far is prove for $n=1$

For $n=1$:
$$a_1=\frac{2^1}{(2\times1)!}=\frac{2}{2}=1$$
Which is correct.

Therefore, to prove the induction:

$$a_{n+1}=\frac{2\times a_{n+1}}{(2(n+1)+2)(2n+1)}=$$
$$=\frac{2}{(2(n+1)+2)(2n+1)}\frac{2^{n+1}}{(2(n+1))!}=$$
$$=\frac{2^{n+2}}{(2n+4)(2n+3)}\times\frac{1}{(2(n+1))!}=$$
$$=\frac{2^{n+2}}{4n^2+6n+18n+12}=$$
$$=\frac{2^{n+2}}{4n^2+24n+12}=$$
$$=\frac{2\times2^{n+1}}{2(2n^2+12n+6)}=$$
$$=\frac{2^{n+1}}{2n^2+12n+6}$$

Is this correct? Do I have to simplify even more?
Thanks
Answer: No, it is not correct. What you need to show is that, assuming
$$a_n=\frac{2^n}{(2n)!},$$
then
$$a_{n+1} = \frac{2a_n}{(2n+2)(2n+1)} = \frac{2^{n+1}}{\big(2(n+1)\big)!}.$$
So
$$\frac{2a_n}{(2n+2)(2n+1)} = \frac{2}{(2n+2)(2n+1)}\frac{2^n}{(2n)!}=\dots$$
Try to follow from there.
Answer: When you wrote that$$a_{n+1}=\frac{2\times a_{n+1}}{(2(n+1)+2)(2n+1)},$$I suppose that you meant to write $a_{n+2}$ as the LHS.
Anyway, this is inconclusive. If you were assuming that $a_{n+1}=\frac{2^{n+1}}{(2(n+1))!}$, your conclusion should have been that $a_{n+2}=\frac{2^{n+2}}{(2(n+2))!}$.
Note that$$\frac{a_{n+1}}{a_n}=\frac2{(2n+2)(2n+1)}\tag1$$and that$$\frac{\frac{2^{n+1}}{(2(n+1))!}}{\frac{2^n}{(2n)!}}=\frac{2\times(2(n+1))!}{(2n)!}=\frac2{(2n+2)(2n+1)}=(1).$$Can you take it from here?


How to deal with unevenly spaced time data in time series linear regression

Question: I have a dataset that has a number of instances that look like the following:
id        x                y
a         2015-05-04       1
          18:32:00
a         2015-05-04       1
          18:32:00
a         2015-05-04       1.5
          18:32:00
a         2015-05-05       4
          16:30:00
a         2015-05-08       5
          10:25:00
a         2015-05-10       6
          00:32:00
a         2015-05-11       7
          6:45:00

"id" is an identification variable, of which there are thousands in the data set, and I'm running various forms of linear regressions to predict the dependent variable ("y") over time ("x") within each identification value. Note that for the actual regression, "x" is converted to an integer corresponding to the number of days since the beginning of the data under that identification value.
The issue I'm having relates to the uneven nature of the time element of the regression (the "x"). In this example data set, each observation in an OLS regression would be given equal weight, regardless of when the observation occurred in time. However, I feel that this would cause issues with the predictive power of my model if it gives equal weight to 3 observations that happened at the same time, and then as a result less weight to other observations in time (as more recent observations should have more weight in the regression). This is especially relevant because its possible that the first 3 observations were given that time because of an error in uploading data to our database, and hence were given the same time as soon as they could be uploaded to the database (however, there's no way for me to check whether this actually occurred).
Is there a way to assign, within a regression, each observation within a day a weight of 1/count(observations in that day)? So that if one day has 3 observations, each observation within that day is given 1/3 weight in the regression, and one day corresponds to a weight of 1/count(unique days in data set)?
Or if this isn't the best way of dealing with this issue, what would you suggest I look into to help with this problem to smooth out the time element of the data?
Or, even from a theoretical perspective, is this a problem?
I would appreciate any thoughts and feedback and am happy to answer any questions you may have.
Answer: Yes, you can easily weight observations. If you are using R, in function lm you have an argument weights to that effect (alternatively, argument wt of function lsfit).
There are alternative, more elaborate ways of dealing with this issue. You might want to
use an state-space model to implement a varying parameters regresion: this would yield estimations more precise where you have a higher density of observations in time.
Comment: Thank you for the response. I believe weighting would be the best for this, and I know it's possible to weight regressions, but my question would be how would you weight the regression on this specific issue? I primarily use Python, and WLS gives you the option to weight based on some value, and I'm wondering if I should create a column that corresponds to the number of observations that have occurred in that day (so, for example, creating a column "z" that for the first 3 observations above would have a value of 3, and all others a value of 1). Then weight on that. Does that make sense?
Comment: What you say in your comment is opposite to what you proposed in your question (where 3 observations in a day would be downweighted so as to have the same influence as a single one). Both things might make sense in different settings, you just have to decide which is right for your problem.
Comment: You're right, I wasn't clear in that answer. I meant that the weight would be the inverse of that column, so that if "z" has a value of 3, the weight would be 1/3. And if "z" has a value of 1, it would just be 1/1, or 1. So then "z" values of 1 would be given more weight than "z" values of 3. If that doesn't make sense, I would appreciate feedback as I'm always interested in learning new things in stats!


Float left elements do not stack

Question: I have a problem with some floating elements.
What I want is when you resize the browser window that box 3 is right under box 1
HTML:

box 1

box 1

box 1

box 2

box 2

box 2

box 2

box 2

box 3

box 3

box 3

CSS:
.box {
    width:80px;
    float:left;
    border:1px solid slateGrey;
    margin:0 0 0 10px;
    padding:10px;
}

See Fiddle: Fiddle
I tried something with the clear property but nothing helps.
Comment: This is reqired behavior.
Comment: When u resize the result window on the Fiddle you see that box 3 is going under box 2, but i want it right under box 1 so that there is no gap under it
Comment: @Joum no i will try that, i will let you know
Comment: @joum nope did nothing
Comment: I didn't quite understand the requirement, thats why my suggestion didn't work... sorry
Answer: You can do this dynamic layout only with js. For example with masonry plugin.
Comment: Okey... yes i know that plugin, but i was wondering if there was a CSS only way. but if there is no other way i use that plugin. Thanks.
Answer: If you want to control the layout when you resize the browser and hit certain dimensions, you should probably look into media queries.
http://en.wikipedia.org/wiki/Media_queries
There is a lot of material out there about the subject, so I'm just linking wikipedia for reference.
Comment: all i want is that box 3 is going right under box 1 when there is place for 2 elemets next to each other.
Answer: This is expected CSS behavior. If you resize the browser window while you have the fiddle open, box 3 appears under box 1. If you want box 3 to appear like that at all times, you need to add something like this .clear class:
.clear{
  clear: left;
}

You'll notice that box 3 will appear in the correct place, but a bit lower, just under box 2's bottom border. Because all of the boxes are floated, they are treated by CSS as if they were on one line, that line being as tall as the tallest .box. When you introduce a box that's .cleared, it will appear under that line. You can adjust the position using margin-top, for example change the
 element of box 3 to:

Hope this helped.
EDIT: Oh, also: if you want this to be dynamically added whenever there's no room to display all three boxes side-by-side, figure out how much space you need for the three boxes to be together on one line and then use a media query, like this:
@media all and (max-width: 500px){
    .box.clear{
      clear: left;
      margin-top: -70px;
    }
  }

500px being your required space. I would recommend against using this if the contents of your boxes are going to be changed a lot.
Comment: Yes that workt but i got a dynamic page so the content of those boxes can be diferent every time so margin-top:-70px; could be on a later point margin-top:-120px;
Comment: @user1502014 Unfortunately, nothing you can do about it. There probably are ways to figure this out in JS, but remember that there's such a thing as working too hard to reinvent the wheel. The simplest solution would be designing a better layout that expects dynamic content changes.

Float left elements do not stack


PROXMOX rendomly reboots

Question: I have a Proxmox cluster with two physical servers, pve and pve2.  They are identical Dell R710s with 96GB of memory and 1TB (RAID-10).  For some reason which I have yet to identify, pve2 will power cycle.  I have check HW logs through iDRAC and there are no alarms or errors.
I am fairly new to Proxmox so I don't know where to look for errors logs outside of the usual Linux places like syslog and dmesg.
Here is a snipet of my syslog when the reboot happened: (@ Dec 30 16:54:01)
<code>Dec 30 16:50:00 pve2 systemd[1]: Starting Proxmox VE replication runner...
Dec 30 16:50:01 pve2 systemd[1]: pvesr.service: Succeeded.
Dec 30 16:50:01 pve2 systemd[1]: Started Proxmox VE replication runner.
Dec 30 16:51:00 pve2 systemd[1]: Starting Proxmox VE replication runner...
Dec 30 16:51:01 pve2 systemd[1]: pvesr.service: Succeeded.
Dec 30 16:51:01 pve2 systemd[1]: Started Proxmox VE replication runner.
Dec 30 16:52:00 pve2 systemd[1]: Starting Proxmox VE replication runner...
Dec 30 16:52:01 pve2 systemd[1]: pvesr.service: Succeeded.
Dec 30 16:52:01 pve2 systemd[1]: Started Proxmox VE replication runner.
Dec 30 16:53:00 pve2 systemd[1]: Starting Proxmox VE replication runner...
Dec 30 16:53:01 pve2 systemd[1]: pvesr.service: Succeeded.
Dec 30 16:53:01 pve2 systemd[1]: Started Proxmox VE replication runner.
Dec 30 16:54:00 pve2 systemd[1]: Starting Proxmox VE replication runner...
Dec 30 16:54:01 pve2 systemd[1]: pvesr.service: Succeeded.
Dec 30 16:54:01 pve2 systemd[1]: Started Proxmox VE replication runner.
Dec 30 16:57:42 pve2 dmeventd[492]: dmeventd ready for processing.
Dec 30 16:57:42 pve2 kernel: [    0.000000] Linux version 5.4.73-1-pve (build@pve) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP PVE 5.4.73-1 (Mon, 16 Nov 2020 10:52:16 +0100) ()
Dec 30 16:57:42 pve2 kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.73-1-pve root=/dev/mapper/pve-root ro quiet
Dec 30 16:57:42 pve2 kernel: [    0.000000] KERNEL supported cpus:
Dec 30 16:57:42 pve2 systemd-modules-load[483]: Inserted module 'iscsi_tcp'
Dec 30 16:57:42 pve2 kernel: [    0.000000]   Intel GenuineIntel
Dec 30 16:57:42 pve2 kernel: [    0.000000]   AMD AuthenticAMD
Dec 30 16:57:42 pve2 kernel: [    0.000000]   Hygon HygonGenuine
Dec 30 16:57:42 pve2 kernel: [    0.000000]   Centaur CentaurHauls
Dec 30 16:57:42 pve2 kernel: [    0.000000]   zhaoxin   Shanghai
Dec 30 16:57:42 pve2 systemd[1]: Starting Flush Journal to Persistent Storage...
Dec 30 16:57:42 pve2 kernel: [    0.000000] x86/fpu: x87 FPU will use FXSAVE
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-provided physical RAM map:
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dfff] usable
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bf378fff] usable
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x00000000bf379000-0x00000000bf38efff] reserved
Dec 30 16:57:42 pve2 systemd[1]: Started udev Coldplug all Devices.
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x00000000bf38f000-0x00000000bf3cdfff] ACPI data
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x00000000bf3ce000-0x00000000bfffffff] reserved
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000efffffff] reserved
Dec 30 16:57:42 pve2 systemd[1]: Starting Helper to synchronize boot up for ifupdown...
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x00000000fe000000-0x00000000ffffffff] reserved
Dec 30 16:57:42 pve2 kernel: [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000183fffffff] usable
Dec 30 16:57:42 pve2 kernel: [    0.000000] NX (Execute Disable) protection: active
Dec 30 16:57:42 pve2 kernel: [    0.000000] SMBIOS 2.6 present.
Dec 30 16:57:42 pve2 kernel: [    0.000000] DMI: Dell Inc. PowerEdge R710/0Y7JM4, BIOS 6.3.0 07/24/2012
</code>
Any suggestions on what It may be or where I could check?
Answer: It can be hardware failure, the most common one is faulty RAM.
Run a memtest on your server to find out.

PROXMOX rendomly reboots


simple extension

Question: I am asked to find the simple extension of $\mathbb{Q}(2^\frac{1}{4},i)$. I believe this is equivalent to $\mathbb{Q}(2^\frac{1}{4}+i)$ but I have no idea how to prove that $\mathbb{Q}(2^\frac{1}{4},i) \subset \mathbb{Q}(2^\frac{1}{4}+i)$.
I know how to prove $\mathbb{Q}(3^\frac{1}{2},2^\frac{1}{2})=\mathbb{Q}(3^\frac{1}{2}+2^\frac{1}{2})$ but the same technique doesn't seem to work as easily for the above.
Thanks!
EDIT: Is there no way of simply showing that $i$ or $2^\frac{1}{4}$ is in $\mathbb{Q}(2^\frac{1}{4}+i)$?
Comment: Check your notes. How is the Primitive Element Theorem http://en.wikipedia.org/wiki/Primitive_element_theorem proved? I know only of one proof and the one I know solves this problem easily.
Comment: I don't think my answer below is that complicated. Is there anything I can make more clear? Drop me a line on the answer's comment box.
Answer: The easiest way is probably using Galois theory. Notice that $\mathbb Q(2^{1/4},i)$ is Galois extension whose automorphisms map $2^{1/4} \mapsto i^j 2^{1/4}$, $j=0,1,2,3$ and $i \mapsto \pm i$. Then it's not hard to see, by comparing real components for instance that $2^{1/4}+i$ is not fixed by any non-identity automorphism, so it must generate the entire field.
Comment: Surely you mean the non-identity automorphisms...
Comment: Yes, of course. Fixed.
Answer: Put
$$x=\sqrt[4]2+i\Longrightarrow(x-i)^4=2\Longrightarrow x^4-4x^3i-6x^2+4xi+1=2\Longrightarrow$$
$$(x^4-(6x^2+1))^2=\left(4xi(x^2-1)\right)^2\Longrightarrow$$
$$ x^8-12x^6-2x^4+36x^4+12x^2+1=-16x^2(x^4-2x^2+1)\Longrightarrow$$
$$x^8+4x^6+2x^4+28x^2+1=0$$
Thus, $\,x\,$ satisfies the above irreducible monic polynomial of degree $\,8\,$ (**), so
$$\begin{align*}(1)&[\Bbb Q(\sqrt[4] 2\,,\,i):\Bbb Q]=[\Bbb Q(\sqrt[4] 2\,,\,i):\Bbb Q(\sqrt[4]2][\Bbb Q(\sqrt[4]2\,,\,\Bbb Q]=2\cdot 4=8\\{}\\
(2)&[\Bbb Q(\sqrt[4]2+i):\Bbb Q]\stackrel{\text{from}(**)}= 8\end{align*}$$
But clearly $\,\Bbb Q(\sqrt[4]2+i)\leq\Bbb Q(\sqrt[4]2\,,\,i)\,$ , and since these two are rational linear spaces of the same finite dimension then they're equal.
Comment: I didn't get how you conclude that that polynomial is irreducible over the rationals.
Answer: We have $\mathbb{Q} \preceq \mathbb{Q}(\root 4\of{2}) \preceq \mathbb{Q}(\root 4\of {2}+ i)$.
Therefore $|\mathbb{Q}(\root 4\of {2}+ i):\mathbb{Q}|=|\mathbb{Q}(\root 4\of {2}+ i):\mathbb{Q}(\root 4\of {2})|\cdot |\mathbb{Q}(\root 4\of {2}):\mathbb{Q}|$.
Can you prove that $|\mathbb{Q}(\root 4\of {2}):\mathbb{Q}|=4$?
Let $\alpha = \root 4\of {2} + i$. We have $\alpha = \root 4\of {2} + i \Longrightarrow \alpha - \root 4\of {2}=i \Longrightarrow \alpha ^2 -2\alpha\root 4\of {2} + \sqrt{2}=-1$.
It follows that $\alpha$ is a root of $p(t):=t^2-(2\root 4\of {2}-\sqrt{2}-1)\in\mathbb{Q}(\root 4\of {2})\textbf{[}t \textbf{]}$. So if $p(t)$ is irreducible over $\mathbb{Q}(\root 4\of {2})$, then it will be the minimal polynomial of $\alpha$ over $\mathbb{Q}(\root 4\of {2})$. Obviously $\alpha \not \in \mathbb{Q}(\root 4\of {2})\subseteq \mathbb{R}$, so $p(t)$ is irreducible over $\mathbb{Q}(\root 4\of {2})$.
It follows that $|\mathbb{Q}(\root 4\of {2}+ i):\mathbb{Q}|=8$.
Now let's prove that $|\mathbb{Q}(\root 4\of {2}, i):\mathbb{Q}|=8$.
We know that $|\mathbb{Q}(\root 4\of {2}, i):\mathbb{Q}|=|\mathbb{Q}(\root 4\of {2}, i):\mathbb{Q}(\root 4 \of {2})|\cdot |\mathbb{Q}(\root 4 \of {2}):\mathbb{Q}|$.
Since $m(t):=t^2+1\in \mathbb{Q}\textbf{[}t\textbf{]}\subseteq \mathbb{Q}(\root 4 \of {2})\textbf{[} t\textbf{]}$ clearly is the minimal polynomial of $i$ over $\mathbb{Q}(\root 4 \of {2})$, we get $|\mathbb{Q}(\root 4\of {2}, i):\mathbb{Q}(\root 4 \of {2})|=2$. Therefore $|\mathbb{Q}(\root 4\of {2}+ i):\mathbb{Q}|=|\mathbb{Q}(\root 4\of {2}, i):\mathbb{Q}|=8$
Finally fom $\mathbb{Q}(\root 4 \of {2}+i)\subseteq \mathbb{Q}(\root 4\of {2},i)$ the equality follows.

simple extension


How to loop through numbers, when one of the fields numbers are constructed differently?

Question: I have a bunch of custom fields on one of my post types, that is displayed randomly but in a fixed order. The names of the custom fields are always the same, and for every loop there is an increasing counter added to the custom field names.
Like this:
custom_text
custom_text1
custom_text2

custom_image
custom_image1
custom_image2

custom_video
custom_video1
custom_video2

The problem is, there is one field that begins with the number one, like this:
custom_special1
custom_special2
custom_special3

Right now, it's impossible to change this behaviour. Problem is, this makes the custom_special fields show up in the wrong place of the output, the first one shows up together with the fields with the number 1 at then end, instead of with the empty ones.
I need to tweak the code below with some kind of if statement, that says something like:
if $custom_special . $counter {output the result one step down}
The important thing is that it has to show up in between the other fields, so I can't have a separate function for the special field.
Here's my code, I hope some of you gurus out there can help me with a solution!
// max custom field index
    $number = 40;
    // the counter
    $counter = '';
    // the meta keys to check for
    $keys = array(
        'custom_text',
        'custom_image',
        'custom_video'
    );
    // all our custom field values
    $custom_fields = get_post_custom( get_the_ID() );

// loop over our counter
while( $counter < $number ){
    // loop over each of the keys
    foreach( $keys as $key ){
        // check if a custom field with key + counter exists
        if( isset( $custom_fields[ $key . $counter ] ) ){
            // output the field
            // values will be in an array, 0 is the first index.
            // you can loop over these as well if you have multiple values.
            if (strpos($key, 'custom_text') !== false) {
                $first = '
';
                $second = '
';
                echo $first . $custom_fields[ $key . $counter ][0] . $second;
            }
            if (strpos($key, 'custom_image') !== false) {
                $first = '';
                echo $first . $custom_fields[ $key . $counter ][0] . $second;
            }
            if (strpos($key, 'custom_video') !== false) {
                $first = '
';
                $second = '
';
                echo $first . $custom_fields[ $key . $counter ][0] . $second;
            }
        }
    }
    // increment the counter
    $counter++;
}

I have thought about some different solutions, but still haven't been able to find one. My first idea is some kind of if statement, and the other one is to strip the numbers from the special field before the loop, and then rebuild it the way the other ones are constructed.
Still haven't been able to successfully create this though.
I hope that someone out there have a suggestion! Thanks a lot!
// Jens.
Comment: `$counter++;` should be **inside** your `foreach` loop, not outside
Comment: `else if( isset( $custom_fields[ 'custom_special' . (1 + $counter) ] ) ){ // ...` ?
Comment: @RC. This doesn't seem to work, since the custom_special field needs to be fetched in between the other fields. Problem is, the fields that are fetched are based on the $counter, so the custom_special are recognized one step to late. Understand?

I think I need some kind of function before the loop, that says something like: if custom_special1, remove 1. If custom_special2 or more, subtract by 1. Any ideas on this perhaps?
Comment: I don't see why not, if the proposed `else if` is placed on the outermost `if`, maybe you should provide a complete minimal sample reproducing your issue
Answer: when you want to acecess this
custom_special1
custom_special2
custom_special3

using same counter you have for others you can simple do :
$counter2 = $counter+1;
$custom_fields[ $key . $counter2 ]

so for custom_special1 , you use $counter2 witch is $counter added 1 value.
Just a quick fix code ideea


how to using dynamic database connection with middlewere laravel passport

Question: I removed the database connection information from the env file and database.php file.
And I set the database dynamically with each request from the client.
I do this in main middleware
<code>$origin = $request->header('Origin');
\Config::set(['database.default' => 'mysql']);
\Config::set(['database.connections.mysql.host' => '127.0.0.1']);
\Config::set(['database.connections.mysql.database' => $origin]);
\Config::set(['database.connections.mysql.username' => 'root']);
\Config::set(['database.connections.mysql.port' => '3306']);
</code>
I have no problem with the login and the token is created. But in other actions, I get a 401 error
In fact, the passport calls the connection information to the database from the env file or database.php. But we want to do this through middleware, or we can set the database information for it before checking auth: api.
Answer: By default, Passport access default DB. If you would like to use dynamic database add below code in the boot method of your app/Providers/AppServiceProvider.php:
<code>public function boot()
{

    Config::set('database.connections.pgsql.database', 'newdatabase');

    DB::purge('pgsql');
    DB::reconnect('pgsql');
}
</code>


Spring Security throwing "Reason: Bad credentials" error in UI but correctly finding user during login

Question: I've exhausted every SO post and blog entry I could find trying to figure out what I've done wrong. So, now I'm asking for your help. I'm building a Spring Boot app and leveraging Spring Security for user management/authentication. I think I've set everything up correctly, but during login Spring Security redirects to the login failure URL (/login?error) every time, throwing the error:
Your login attempt was not successful, try again.
Reason: Bad credentials
There is nothing telling or useful in the server logs. As part of debugging, I added a bunch of logging which confirmed that:

The user is being found in the database (via email, with usernameParameter set to email in config
Spring Security's userDetails.User creates the correct user from its new constructor (I've logged the details of the user)

I am new to the framework so it's possible I'm overlooking something, which is where I would really appreciate your help. I've included my security config and user service below (I've cleared out logging to clean it up for your reading)--let me know if any other pieces would be helpful. Thank you in advance!
SecurityConfiguration.java
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

@Resource(name = "userService")
private UserDetailsService userDetailsService;

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()
            .antMatchers("/test").hasRole("USER")
            .antMatchers("/**").permitAll()
            .and().formLogin().usernameParameter("email").defaultSuccessUrl("/register_success");
    http.authorizeRequests()
            .antMatchers("/resources/**").permitAll();
    super.configure(http);
}

@Autowired
public void configureGlobal(AuthenticationManagerBuilder authenticationManagerBuilder)
                            throws Exception {
    authenticationManagerBuilder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
}

// Define this bean so autowired can find and use it (fixes complaining error)
@Bean
PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder();
}

@Bean
BCryptPasswordEncoder bCryptPasswordEncoder() {
    return new BCryptPasswordEncoder();
}
}

UserService.java
@Service("userService")
public class UserService implements UserDetailsService {

private static final String LOG_TAG = UserService.class.getSimpleName();
private Logger logger = LoggerFactory.getLogger(LOG_TAG);

private UserRepository userRepository;

@Autowired
SessionFactory sessionFactory;

@Autowired
public UserService(UserRepository userRepository) {
    this.userRepository = userRepository;
}

// Must provide email address as username argument
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    User user = userRepository.findByEmail(username);
    if (user == null) {
        throw new UsernameNotFoundException("There is no user with this email address.");
    }
    org.springframework.security.core.userdetails.User springUser = new org.springframework.security.core.userdetails.User(
            user.getEmail(), user.getPassword(), getAuthority());
    return springUser;
}

public User findByEmail(String email) {
    return userRepository.findByEmail(email);
}

public User findByConfirmationToken(String confirmationToken) {
    return userRepository.findByConfirmationToken(confirmationToken);
}

@Transactional
public List<User> findAll() {
    Criteria criteria = sessionFactory.openSession().createCriteria(User.class);
    return (List<User>) criteria.list();
}

public void saveUser(User user) {
    userRepository.save(user);
}

//TODO: Figure out how to use this properly
public List getAuthority() {
    return Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"));
}
}

Comment: Are you sure about the password that store in your database ? The password must be store in the database with `BcryptPassword` format. The password should not store as the normal string.
Comment: @Cataclysm Yes, I've logged the password and viewed it directly in the database. It is indeed encoded.
Comment: @Cataclysm I've also now verified that the raw password input matches the decrypted password from the database.
Answer: You need to use PasswordEncoder to encrypt passwords when adding new users.
like this:
@Autowired
private BCryptPasswordEncoder passwordEncoder;
public void saveUser(User user) {
    user.setPassword(passwordEncoder.encode(user.getPassword()));
    userRepository.save(user);
}

Comment: I encrypt the password in the registration controller, when the user is being prepared for save.

`// Set the new password
            user.setPassword(bCryptPasswordEncoder.encode(requestParams.get("password").toString()));`


Prove Inequality with Cauchy Schwarz

Question: Use the Cauchy-Schwarz Inequality to show that for any positive integer n, $\frac{2n}{n+1} \leq 1 + \frac{1}{2} + \cdots + \frac{1}{n}$
I'm having some trouble understanding how the Cauchy Schwarz Inequality can be applied to this. I've tried separating the $\frac{2n}{n+1}$ into two parts, but I'm getting nowhere with that.
Comment: Is it impolite to notice that the inequality is obvious when $n\geqslant4$ since, for every $n$, $\frac{2n}{n+1}<2$ and $1+\frac12+\frac13+\frac14>2$, and that checking it for $n=1,2,3$ takes about 5 seconds? Hence that this must be one of the most *unconvincing* applications of Cauchy-Schwarz one can imagine...
Answer: Hint: Take as vectors in $\mathbb{R}^n$ $\displaystyle u=(1,\frac{1}{\sqrt{2}},\cdots,\frac{1}{\sqrt{n}})$, $\displaystyle v=(1,\sqrt{2},\cdots, \sqrt{n})$, and compute $<u,v>$, $\|u\|$ and $\|v\|$. Recall that $\displaystyle 1+2+\cdots+n=\frac{n(n+1)}{2}$.
Comment: I'm having trouble understanding how that relates to the given inequality.
Comment: The Cauchy-Schwarz inequality say that $||\leq \|u\| \|v\|$. Have you computed these quantities ?
Comment: What I'm getting is $||u|| = \sqrt{\sum{\frac{1}{n}}}$, $||v|| = \sqrt{\sum{n}} = \frac{n(n+1)}{2}$, $ = \sqrt{\sum{1}} = n$.
Comment: For $\|v\|$ this is $\sqrt{\frac{n(n+1)}{2}}$, for $=1+1+\cdots+1=n$ (and $\|u\|=\sqrt{1+\frac{1}{2}+\cdots+\frac{1}{n}}$ )
Comment: Ahh, yes that makes sense now. So it would go $n \leq \sqrt{\sum{\frac{1}{n}}}\sqrt{\frac{n(n+1)}{2}}$. Squaring both sides we get $n^2 \leq \frac{n(n+1)}{2}\sum{\frac{1}{n}}$. Solving we're left with $\frac{2n}{n+1} \leq \sum{\frac{1}{n}}$
Comment: Yes, this is correct.
Answer: $\frac{1}{1}+\frac{1}{2}+\frac{1}{3}+...+\frac{1}{n}\geq \frac{(1+1+1+...+1)^2}{1+2+3+...+n}=\frac{2n^2}{n(n+1)}=\frac{2n}{n+1}$

Prove Inequality with Cauchy Schwarz


Property 'message' does not exist on type 'HttpErrorResponse'

Question: I have imported HttpErrorResponse as :
<code>import { HttpClient, HttpErrorResponse } from '@angular/common/http';
</code>
And have declared a function as :
<code> private handleError(err:HttpErrorResponse) {

    console.log(err.message);
    return Observable.throw(err.message);

}
</code>
But I'm Getting an error regarding the 'message' property...

Property 'message' does not exist on type 'HttpErrorResponse'
Comment: What is the exact error?
Comment: Property 'message' does not exist on type 'HttpErrorResponse'
Comment: That's pretty odd. Which version of Angular are you using? Did you try looking at the source file of HttpErrorResponse to see how it looked? Should be [like this](https://angular.io/api/common/http/HttpErrorResponse).
Comment: Can you show the code where `handleError` is passed please?
Comment: @Jeto ..  Removed the 'readonly' from 'readonly message: string;' inside the source file of HttpErrorResponse ... And the error has been removed.. Did i do anything wrong??
Comment: Does it happen doing this: `return Observable.throw(new Error(err.message));` ?
Comment: It is rather `error.error.message` that you should use ? https://angular.io/guide/http#getting-error-details
Answer: You set error type HttpErrorResponse -  private handleError(err:HttpErrorResponse). And that type really has no propetry "message".
Just use change to: private handleError(err), so no type will be setted by default.


Mirror the Bits of an Integer

Question: How do I mirror the bits of an integer of unknown length in VB.Net?
By mirroring I mean putting the first bit last and so on.
i.E.:
10010100  mirrors to
00101001
The functions construct would be:
Public Function ReveseIntegerBitwise(ByVal initialInteger As Integer)
    Dim reversedInteger As Integer

    ' Do Something with initialInteger and put it in reversedInteger

    Return reversedInteger
End Function

Comment: What do you mean with "unknown length"? An Integer has certain length. The "built-in" Integer in .NET has 32 bits or 4 bytes ALWAYS. Another thing are the Int16, Int32 or Int64 from C.
Comment: Possible duplicate of [Binary Converter to Decimal with .NET](https://stackoverflow.com/questions/21250855/binary-converter-to-decimal-with-net)
Answer: You can do:
Function Foo (value as Integer) as String
     Return new String(Array.Reverse(Convert.ToString(value,2).ToCharArray()))
End Function

and it returns a string with the reversed bits.
Comment: `Array.Reverse` is not a function, so it doesn't return a value and so that code won't compile with Option Strict On. You could use `Return New String((Convert.ToString(value, 2).Reverse().ToArray()))`.
Comment: hm...If I enter in this function 148 (10010100) it returns a string with "00101001". If I enter 8 (1000) it returns "0001"...I think that's what he wants...
Comment: The OP wants to return an `Integer` from the function, so you should convert it _back_ to one as well.
Comment: @VisualVincent But how to get the leading zeros on an integer?
Comment: @AndrewMorton : My comment was mainly directed to Gomez, but I imagine that the binary number that the OP wrote was just an example, since based on his function he wants to return the reversed bits as an Integer. You can write as many leading zeros as you like, it doesn't affect the outcome.
Comment: unless you want to preserve the leading zeros in case you want to mirror it again - in which case returning an integer wont work properly

Mirror the Bits of an Integer


character degree and solvability

Question: There is an unsolved problem in Berkovich's book "Characters of Finite Groups Part 2" I state here:

Is $G$ solvable if $\chi(1)^2$ divides $|G|$ for all $\chi \in \operatorname{Irr}{(G)}$?

Can any one tell me some latest progresses for this? Maybe you can tell me some latest research papers. Thank you.
Comment: If you get no responses within 24 hours then you could try asking it on MathOverflow.
Comment: Problem 119 on page 303, for anyone who wants to look it up.
Comment: I do remember seeing this problem (though I think it was in a paper of Berkovich, rather than in the book). Unfortunately, as far as I am aware, none of those experts who work a lot with these sort of problems frequent MSE. I think Jack Schmidt is close, but his field of work is not quite this (as far as I know), and Alexander Gruber did some work recently with two of those experts, so we can hope those two see this (meaning Jack and Alexander). I have also worked on some similar problems myself, but not enough to be that familiar with the recent literature.
Comment: I would ask Marty Isaacs. Although he has retired as a professor from Madison, Wisconsin, he is still active on MathOverflow. See http://mathoverflow.net/users/9694/marty-isaacs. Or try to contact him directly.
Comment: Posted on MO: http://mathoverflow.net/questions/144192/character-degree-and-solvability
Answer: Steve Gagola and I have a paper where we address this very question. I am away from home and so I don't have the reference handy. It was in the Communications in Algebra in the late 90's. I think 1998. Mark Lewis
Also, the example Marty gave was in that paper. Marty and I found that example while I was still working on my PhD.
Comment: Probably one of: http://www.ams.org/mathscinet-getitem?mr=1649885 or http://www.ams.org/mathscinet-getitem?mr=1669104 -- the latter is most clearly relevant: if $\chi^2(1) | [G:\ker(\chi)]$ for all irred $\chi$, then $G$ is nilpotent.
Comment: Yes.  This is the correct paper.

character degree and solvability


Find integral of $\frac{e^x}{1+e^x}$

Question: I found $\displaystyle\int\displaystyle\frac{e^x}{1+e^x}dx= -\ln\left|1+e^x\right|+C$ in my text book, but I want to know how the minus sign comes there.
Please anybody explain to me.
Comment: Use $$u = 1 + e^x.$$
Comment: There shouldn't be a minus sign there.
Comment: Try to use Latex. It makes questions readable. You can check @Nameless' comment for how to use it.
Answer: There is not a minus sign in the integral; rather, we have
$$\int \frac{e^x}{1 + e^x} dx = \ln(1 + e^x) + C$$
This can be checked by differentiating:
$$\frac{d}{dx} \ln(1 + e^x) = \frac{1}{1 + e^x} \frac{d}{dx} (1 + e^x) = \frac{e^x}{1 + e^x}$$ as desired.
Answer: Hint
You could notice that the numerator $e^x$ is just the derivative of the denominator ($1+e^x$) so you have to integrate $\frac{u'(x)}{u(x)}$ and then the result.

Find integral of $\frac{e^x}{1+e^x}$


A question about $G_\delta$ sets.

Question: How does one show that for any $E \subset \mathbb{R}^n$, there is a $G \in G_\delta$ such that $E \subset G$ and $m_* (E) = m_*(G)$?
$m_*$ stands for outer measure and $G_\delta $ set is re sets that are the countable intersection of open sets.
I was thinking since we don't know anything about $E$, we could look at its $int(E)$ which is open and maybe construct something along the lines of $E \subset \bigcap_{r} int(E) \cup B_{r}(0)$.
I am mostly having trouble coming up the reasons for the existence of $G$.
Comment: $E$ does not have to be measurable, since we are showing $m_*(G) - m_*(E) = 0$, not $m_*(G - E) = 0$.
Comment: @Xiao, how do you know that $m_∗(E)$ exist? If E is not measurable, $m_∗(E)$ may not exist.
Comment: @Hawk, you better use standard symbol for outer measure, which is $m^∗(E)$. $m_∗(E)$ is normally inner measure.
Comment: @hermes By the usual definition, the outer measure is defined on  $2^{\mathbb{R}^n}$, so  it is defined to ANY set $E \subseteq  \mathbb{R}^n$.
Comment: @hermes  Outer measures have $\inf$ taken over a subset of $[0,+\infty]$. Such $\inf$ always exists.  (It exists even in the case of the empty subset, however such case does not happen in $\mathbb{R}^n$).
Comment: @hermes There is not just one Vitali set. Each choice  of representatives of the equivalence classes for relation on $\mathbb{[0,1]}$ given by $y−x\in \mathbb{Q}$ yields **a** Vitali set. All Vitali sets (contained in $[0,1]$) have outer Lebesgue measure greater than $0$ and less or equal to$1$.
Comment: @hermes Learn the definitions.
Comment: @hermes I hope this helps to make it clearer for you. Let $V\subseteq[0,1]$ be **a** Vitali set. Since $V\subseteq[0,1]$,
$$ \{\sum_{n=0}^\infty m(I_n) \,|\, V \subseteq \bigcup I_n\} \supseteq \{m([0,1])\}$$
So we have:   $ 1 \in \{\sum_{n=0}^\infty m(I_n) \,|\, V \subseteq \bigcup I_n\} \subseteq [0,\infty] $. So
$$ 0 \leqslant \inf\{\sum_{n=0}^\infty m(I_n) \,|\, V \subseteq \bigcup I_n\} \leqslant 1$$
So $0 \leqslant m^*(V) \leqslant 1 $. We can exclude $m^∗(V)=0$ because $V$ is non-measurable. So we have $0 < m^*(V) \leqslant 1 $.
Comment: @hermes No, we don't need to prove that $m(V)$ is the $\inf$.  The $\inf$ exists and it is, by definition of outer measure, $m^*(V)$. You seem to be confusing "outer measure" with some kind of "outer regular measure".
Answer: EDIT: When I wrote this answer I mistakenly thought the question was about outer measure on $\Bbb R$, not $\Bbb R^n$. Things are not quite so trivial in $\Bbb R^n$. There will be a version for $\Bbb R^n$ appearing here when I have time. Thanks to Nate Eldrege for pointing out the problem.

This is obvious. Say $m_*(E)=\alpha$. By definition $\alpha$ is the infimum of the measure of $V$ such that $V$ is an open set with $E\subset V$. Hence there exist open sets $V_n$ with $E\subset V_n$ and $m(V_n)\to\alpha$.
Let $G=\bigcap V_n$. Then $G\subset V_n$ for every $n$, so $m_*(G)\le m_*(V_n)$ for every $n$, hence $m_*(G)\le\lim m_*(V_n)=
\alpha$. On the other hand, $E\subset G$ so $\alpha=m_*(E)\le m_*(G)$.
Comment: You're trying to solve problems about this stuff even though you don't know the definitions. That's impossible.
Comment: @Hawk the Lebesgue outer measure is defined on all power set of $\mathbb{R}^N$.
Comment: Gonna sound dumb, but how do we know $\alpha$ exists? Is having a measure and being measurability not really the same?
Comment: ??? We _defined_ $\alpha$ to be $m_*(E)$ is how we know it exists...
Comment: I mean how do we know $m_*(E)$ exists?  Isn't that only after we know $E$ is measurable?
Comment: @DavidC.Ullrich I believe that in the last sentence of your answer you meant: "... so $\alpha=m_*(E)\le m_*(G)$".
Comment: @Ramiro thanks...
Comment: As to your "by definition", this is only one possible definition of Lebesgue outer measure. Some books define it as the infimum over covers of E by countable unions of closed rectangles, or something similar, in which case one has to do more work to show your statement. (Actually, since one commonly uses outer measure to define measure, your definition risks being circular.)
Comment: @NateEldredge All excellent points, sadly. It seems at least _possible_ you're curious how I came to say such moronic things. I missed the fact that the problem was about $\Bbb R^n$, assumed it was about $\Bbb R$, where things are much less problematic. Will revise post when I have time. (When I do this stuff, on $\Bbb R$, I define $|V|$ for open sets $V$ to be the sum of the lengths of the components, emphasizing that we shouldn't call it $m(V)$ yet, then I define $m_*(E)$ to be the inf of $|V|$. No problem there - yes, in $\Bbb R^n$ things are not quite that simple.)

A question about $G_\delta$ sets.


Can I view my MSSQL connection string from within SQL Server Management Studio?

Question: I'm using SQL 2005, and was helping someone debug a connection issue today.  I thought that I could view my current connection string from inside SQL Management Studio, but can't seem to figure out how to make it happen.
Is this possible?  Google hunting has been fruitless.
Thanks!
Answer: You can. From Stack Exchange:
<code>SELECT
       'data source=' + @@servername +
       ';initial catalog=' + db_name() +
        case type_desc
           when 'WINDOWS_LOGIN'
                then ';trusted_connection=true'
           else
                ';user id=' + suser_name()
        end
FROM sys.server_principals
WHERE name = suser_name()

</code>
Comment: Data Source / Server in Connection String != @@servername. Local host entries, SQL Client Aliases, and DNS mappings will all report something other than the what is in the Connection String. (Which is good, because none of those should change the nominative server [AD] + instance name, and also means that it can't be used to provide a guaranteed valid CS - ie, AD name might not be exposed - much less the actual CS..)
Comment: This is incredibly frustrating.  @@servername reports a server name that's different from the one I am connected to. Microsoft really made a hot pile of mess with something that should be simple and straightforward.
Answer: You can't view your current SQL Management Studio connection string from within SQL Management Studio.
You could whip up your own connection string pretty quickly using the same details as when connecting to your SQL instance. Here's a resource with examples which might be helpful: http://www.connectionstrings.com/sql-server-2005
Hopefully I understood your question correctly...?
Comment: This sucks. Why not?
Comment: If you know for sure that I can't, then that's my answer.  Finding a connection string isn't my issue - I just thought they'd have made it easy to see my current connection string in SSMS, like you can in Visual Studio.  Odd.
Answer: this may be too late, but there seems to be a better answer for this question.
I was searching for the same thing; how do I view the connection string to a particular SQL Server database.  I read you cannot do it within SQL Server Management Studio, but you can retrieve the connection string Visual Studio uses, as suggested by another user.
In Visual Studio, go to Server Explorer and choose to create a new connection by right clicking on Data Connections and browsing to the SQL Server to which you wish to connect.  I am connecting to both SQL Server and MySQL so I would note this down for myself and others who might be in the same boat, so to speak.
When choosing a new Data Source, specify Microsoft SQL Server for your SQL connection, but MySQL needs a connector.  You will need to have a MySQL/Oracle account to download the connector for MySQL.
http://dev.mysql.com/downloads/connector/net
Once this is installed, you will have an option of Oracle database when you are creating a new data connection for MysQL.  You can now configure and connect to your data source and view the connection string for each data source.  To do so, right click on the new Data Connection and select Properties.  In the Connection String, you can copy and paste this for your Visual Studio connection string.
Again, since this came back in my search results, I am adding this note for myself in the future and possible others may find this useful.
Keenan


transform pdfminer bbox coordinates to iOS screen

Question: I am doing an iPad application project in swift where I need to extract pdf word bbox coordinates and transform it to the iPad screen coordinates. The goal is that I be able to detect when a word is being touched.
I am using a webview to display the pdf, and I am using pdfminer library in python to extract word bboxes (I extract character bboxes and I can get words by separating from spaces between words). But I do not know how to transform pdfminer word coordinates to iOS screen.
I can explain more or dd code and screenshots if needed. Any help will be very much appreciated!
Answer: I solved this by modifying and using pdfkitten instead of pdfminer.


How do I make an inline element take up space when empty?

Question: I have an h1 and h3 tag that will erase itself and type, using theater.js. The problem is that when it erases itself to empty, the height of the div it's in get smaller, then snaps bigger when it has content again.
I want to make the h1 and h3 tag (or change the tag completely) keep its height even while empty.
Any idea?
Comment: ...also headings are not inline elements...they are block level.
Comment: Can you post some codes or something that you have tried please
Answer: Just wrap your h2/h3 tag in a div with display: inline-block; like this:

ABCD

and then add this to your css:
    .header2 {
      min-width: 100px;
      width: auto;
      min-height:45px;
      background-color:#333;
      color:#FFF;
      display:inline-block;
      padding:10px;
    }

Here's a jsfiddle of two h2 tags with the above properties: https://jsfiddle.net/AndrewL32/e0d8my79/21/
Comment: It would be better to use an `em` value rather than a fixed pixel one.
Comment: You can remove the min-width if that is unnecessary. I kept it there just to show that the button even the button width can be kept too
Comment: @Paulie_D Agreed but this fiddle is just for showing the way to go around adding a space to an empty header tag so I just kept some random pixels just for explanatory purposes :)
Comment: "Just"? There must be easier ways.
Comment: @DavidSpector lol what?
Answer: two possible solutions:
1) you can set min-height to the div
For example:
div{min-height:50px;}

2) or to set min-height of h2 and p1 tags
h1,p1 {
min-height:5px;

}
Demo for 2nd approach :

h1{
    background:yellow;
    min-height:5px;
}

Note: as paulie_D mentioned, h1 ,p and div are block level elements by default
Comment: Well I didn't downvote but your answer does nothing to solve the underlying problem.
Comment: @Paulie_D he want that the div should retain its height even when the h1 and p are erased. so min-height will work. correct me if i am wrong
Comment: No...he want's the empty element to retain it's height, not the parent.
Comment: @Paulie_D what i read was { the height of the div "it's"  in get smaller...keep "its" height even while empty}.
Comment: you properly mean     .header2 {min-height:50px; }
Comment: @Paulie_D check the html he posted...there is nothing but the header inside this div
Comment: Check his last line...he want's the **heading** to retain it's height
Comment: @HatemAhmed the other answerer posted the code, paulie_d is right about the content of div
Comment: @Paulie_D you are right ^_^ yet the html contain only the H1
Comment: Sounds good, but how do you know the height of the H element under all browser conditions?
Answer: You may use a pseudo element to force an empty space within the element and swip it away with text-indent

h1.fixed:before {
  content:' ';
  display:inline-block;
  width:1em;
}
h1 {
  background:lightgray;
  box-shadow:inset 0 0 0 1px;
  }
h1.fixed {
  text-indent:-0.8em; /* swip off the pseudo element */
  }

else, use the :empty pseudo-class

h1:empty:before {
  content:'|';
  }

Comment: I haven't seen this approach before. I'll try it out, and see if it work well.
Comment: @SimonS you can also use the :empty pseudo class to add some content, so it's never empty (see snippet up here)
Answer: Instead of erasing the content of an H1 element, set it to   . This is the entity that is rendered as a space. This should hide the element, but still take up the same vertical space as desired. Hopefully, it will not confuse screen readers (for blind users), either.


Bass guitar solfeggietto adapted from guitar tab

Question: I want to adapt the Solfeggietto by C.P.E. Bach, to play on my bass, like seen here.
First of all, I'm not a musician but a software developer. I've been playing bass for fun since I was a teenager and I've now decided to learn the notes on my fretboard.
I have found the Solfeggietto absolutely beautiful and would like to learn it on my bass, but I havent found a tab for the Solfeggietto just for guitar .
So how will I play the notes from the two strings from the guitar that are not on my 4 strings bass?
<code>bass:   E A D G

guitar: E A D G B E
</code>
I am just starting to learn about music theory [which is more complex than coding haha]
But what would be the equivalent of the B and E string on my strings?
Comment: It's "more complex than coding"... I took two years of calculus before I switched majors and took two years of music theory, and for me, music theory was more difficult than calculus.
Answer: I think this can help you.
But notice, that making a bass tab from guitar tab is like covering sb's cover of sb's cover :) It probably will work, but can be unplayable and inaccurate. The best adaptation would be the one you'd do from original music sheet.


Prove that the following sequence is a binary splittting

Question: A binary splitting is a sequence of random variables  $(X_n )$ such that for each $n \ge 1$ there exists a Borel measurable random variable $f_n: \ \mathbb {R } ^{n-1 } \times \{-1, 1 \}  \to \mathbb R$, and a $\{-1 , 1 \} $- valued random variable $D_n $ such that
$$X_n = f(X_1, \dots , X_{n-1 } , D_n )$$

I want to prove that given a random variable $X$, the sequence $(X_n)$ of random variables defined by
$$D_1 = \begin{cases}
    1, & \text {if } X \ge E[X] \\
    -1 & \text {otherwise }
    \end{cases}
$$
$\mathcal{F}_1 = \sigma(D_1) $,  $X_1 = E[X| \mathcal{F}_1 ] $. And for $n \ge 2 $,
$$
D_n = \begin{cases}
    1, & \text {if }  X \ge X_{n-1 } \\
    -1, & \text {otherwise}
        \end {cases}$$
$\mathcal{F}_n = \sigma(D_1, \dots , D_n ) $  and $X_n = E[X| \mathcal{F}_n ]$
Is a binary splitting.

My first fist question would be: Is the definition of a binary splitting equivalent to: for each $n$ there exits a $\{-1, 1 \} $-valued random variable $D_n $ such that $X_n $ is $\sigma(X_1, \dots , X_{n-1 } , D_n )$ measurable?
I have seen a proof that $(X_n )$ is a binary splitting, but a couple of things remains impenetrable for me. The proof proceeds as follows:
Since $X_n := E[X|\sigma(D_1, \dots , D_n)]$ it is the case that $X_n$ is $\sigma(D_1, \dots , D_n)$-measurable and thus may be written as $X_n = g_n(D_1, \dots, D_n)$ for some $g_n : \ \{-1,1 \} ^n \to \mathbb{R}$.
We now prove that for each $n $: $D_n $ is a function of $X_1, \dots X_n$. This is done by induction.
For $n=1 $ the function $h_1$ such that  $D_1 = h_1(X_1)$ may be defined explicitly as the map that sends the value of $X_1 $ on $\{D_1 = 1 \} $ to $1$, and ditto on $\{D_1 =-1 \} $ to -1.
For the case $n>1$, assume that for $ k \le n-1 $ it is the case that there exists a functions $h_{k } $ such that $D_k = h_k(X_1 , \dots , X_k)$.
Since $X_n := E[X|\mathcal{F}_n ]$ and $\mathcal{F}_n$ is generated by finite unions of sets $\{D_k = i_k$ for $i_k \in \{-1, 1 \} $ and $1 \le k \le n$, we may write
$$X_n = \sum_{i_1, \dots , i_n \in \{-1, 1 \}} c_{i_1, \dots , i_n } 1_{\{D_i = i_1, \dots , D_n = i_n \} }  $$
We may then define a function $\xi_1$ that maps
$$\{D_i = i_1, \dots , D_{n-1 }  = i_{n-1 }  \}$$
to  $c_{i_1, \dots , i_n }$ for every $ c_{i_1, \dots , i_n }$ with $i_n = 1$. And similarly define a function $\xi_2$ for $\{D_n = -1 \} $.
Thus we may write
$$X_n = \xi_1 1_{\{D_n = 1 \} } + \xi_2 1_{\{D_n = -1 \} } $$
If we inductively assume that $D_1, \dots D_{n-1 } $ are functions of $X_1, \dots , X_{n-1 } $ then this last expression gives us
$$X_n = f^{(1)} _{n-1 } (X_1, \dots, X_{n-1 } )1_{\{D_n = 1 \} } + f^{(2)} _{n-1 } (X_1, \dots, X_{n-1 } )1_{\{D_n = -1 \} }$$
for some $f^{(1)} _{n-1 }, \, f^{(2)} _{n-1 } \, ,\{-1, 1 \} \to \mathbb R $.
The two things that remains unclear to me is:

Does the last equation above imply that $D_n $ is a function of $X_1, \dots , X_n$?
How do we go from knowing that each $n $, $D_n $ is a function of $X_1, \dots X_n$ to that $X_n = f_n(X_1, \dots , X_{n-1 } , D_n)$?

Most grateful for any help provided!
Comment: did you provide the whole proof?
Answer: The last equation implies
$$ D_n = \begin{cases}
1 & \text{if } X_n = f^{(1)}_{n-1}(X_1,\ldots,X_{n-1}), \\
-1 & \text{if } X_n = f^{(2)}_{n-1}(X_1,\ldots,X_{n-1}).
\end{cases}$$
Clearly, the only potential issue is if $f^{(1)}_{n-1}(X_1,\ldots,X_{n-1}) = f^{(2)}_{n-1}(X_1,\ldots,X_{n-1})$. Let us show that cannot be the case. Since $\{D_n=1\} = \{X \ge X_{n-1}\}$, one has
$$ X_n1_{\{D_n=1\}} = E[X1_{\{D_n=1\}}|\mathcal F_n] \ge X_{n-1}1_{\{D_n=1\}},$$
and similarly $X_n1_{\{D_n=-1\}} \le X_{n-1}1_{\{D_n=-1\}}$; in this latter case, the inequality is strict on $\{D_n=-1\}$. It follows that
$$f^{(1)}_{n-1} (X_1,\ldots,X_{n-1}) > f^{(2)}_{n-1} (X_1,\ldots,X_{n-1})$$
with probability one. Thus, one can indeed write $D_n$ as a Borel measurable function of $X_1,\ldots,X_n$. Let us call that function $h_n$. Then
$$ X_n = g_n(D_1,D_2,\ldots,D_{n-1},D_n) = g_n\Big( h_1(X_1), h_2(X_1,X_2),\ldots,h_{n-1}(X_1,\ldots,X_{n-1}),D_n\Big),$$
which is obviously a Borel measurable function of $X_1,\ldots,X_{n-1},D_n$.
Comment: Remember $f_{n-1}^{(i)}$ is a function of $X_1,\ldots,X_{n-1}$ for $i=1,2$. So one cannot compare $f_{n-1}^{(1)}$ and $f_{n-1}^{(2)}$ for different values of $X_{n-1}$ and deduce anything meaningful. I am NOT claiming, for instance, that $\min f_{n-1}^{(1)} > \max f_{n-1}^{(2)}$, but we do not need this to be true.
Comment: Thank you! Great answer! Just one question: how do you go from $X_n 1_{\{ D_n =1 \} } \ge X_{n-1 } 1_{\{D_n = 1 \} } $ and $X_n 1_{\{ D_n = -1 \} } < X_{n-1 } 1_{\{D_n = -1 \} } $ to $f^{(1)}_{n-1} (X_1,\ldots,X_{n-1}) < f^{(2)}_{n-1} (X_1,\ldots,X_{n-1})$?
Comment: This was a sign error - the inequality was meant to be the other way around. From your last equation, $X_n = f^{(1)}_{n-1}$ if $D_n=1$, and $X_n = f^{(2)}_{n-1}$ if $D_n=-1$. But we just showed that $X_n \ge X_{n-1}$ if $D_n = 1$, and $X_n < X_{n-1}$ if $D_n = -1$. This shows the inequality.
Comment: I must be dense but I can only see that $f_{n-1 } ^{(1) }  > X_{n-1 } $ on $\{D=1 \} $ and $f_{n-1 } ^{(2) }  < X_{n-1 } $ on $\{D=-1 \} $ but not how $f_{n-1 } ^{(1) }$  AND $f_{n-1 } ^{(2) } $ compare on $\{D=-1 \} $ or on $\{D=-1 \}  $. Do you see what I mean?
Comment: Note that $f_{n-1}^{(1)}$ (respectively, $f_{n-1}^{(2)}$) is only defined on $\{D_n=1\}$ (respectively, $\{D_n=-1\}$). If you like, you can define $f_{n-1}^{(1)} = X_{n-1} + 1$ on $\{D_n = -1\}$ and $f_{n-1}^{(2)}= X_{n-1} - 1$ on $\{D_n = 1\}$.
Comment: What I mean is this. Suppose $f_{n-1 } ^{(1) } = a $ on some part of $\{D_n=1 \} $ and $f_{n-1 } ^{(2) } = a $  on some part of $\{D_n = -1 \}$. If $X_{n-1 } = a - 1 $ on that same part of $\{D=1 \} $ and $X_{n-1 } = a + 1 $ on the same part of $\{D_n=-1 \} $ then we could still have $f_{n-1 } ^{(1)}  > X_{n-1 } $ on $\{D_n=1 \} $ and $f_{n-1 } ^{(2)}  < X_{n-1 } $ on $\{D_n=-1 \} $ but not $f_{n-1 } ^{(1) } > f_{n-1 } ^{(2) }$ .  Or what makes this impossible?
Comment: Last shot, is your argument as follows? Suppose for some $\omega_0 \in \{D_n=1 \} $ and some $\omega_1 \in \{D_n=-1 \} $ that $f^{(1)}_{n-1}(X_1(\omega_0),\ldots,X_{n-1}(\omega_0)) = \alpha = f^{(2)}_{n-1}(X_1(\omega_1),\ldots,X_{n-1}(\omega_1)) $. Then knowing that the value of $X_n(\omega)$ is $\alpha$ we cannot deduce whether it is $\omega_0 $ or $\omega_1 $ that has happened, i.e. whether $\omega $ really is in $\{D_n=1 \} $ or $\{D_n=-1 \} $. But looking at whether $\alpha \ge X_{n-1 } (\omega)$ or $\alpha < X_{n-1 } (\omega)$ we may deduce whether $\omega_0 $ or $\omega_1 $ has happened?
Comment: I'm not totally sure what you mean, but you certainly don't need to introduce any $\omega$ - $f_{n-1}^{(i)}$ is a *deterministic* function of $X_1,\ldots,X_{n-1}$. My argument shows $f_{n-1}^{(1)}(x_1,\ldots,x_{n-1}) \ge x_{n-1}$, and $f_{n-1}^{(2)}(x_1,\ldots,x_{n-1}) < x_{n-1}$. Clearly, this implies the two functions are never equal.
Comment: Got it! Thanks for being so patient!
Answer: (1) Yes. Clearly if $X_n = f(X_1,\dots,X_{n-1},D_n)$, then $X_n$ is $\sigma(X_1,\dots,X_{n-1},D_n)$-measurable. So suppose $X_n$ is $\sigma(X_1,\dots,X_{n-1},D_n)$-measurable but that, for some $\omega,\omega' \in \Omega$, $(X_1(\omega),\dots,D_n(\omega)) = (X_1(\omega'),\dots,D_n(\omega'))$ but $X_n(\omega) \not = X_n(\omega')$ (if there are no such $\omega,\omega'$, then defining $f(x_1,\dots,x_{n-1},d_n)$ to be $0$ when there is no $\omega$ with $X_1(\omega)=x_1,\dots,X_{n-1}(\omega)=x_n,D_n(\omega) = d_n$ and to be $X_n(\omega)$ otherwise, we see $f(X_1,\dots,X_{n-1},D_n) = X_n$ and thus $f$ is Borel, since $f^{-1}(U) = X_1^{-1}(U)\cap \dots \cap X_{n-1}^{-1}(U)\cap D_n^{-1}(U)\cap X_n^{-1}(U)$). Let $a = X_n(\omega), b = X_n(\omega')$. Then $X_n^{-1}(a) \not \in \sigma(X_1,\dots,X_{n-1},D_n)$, since $\omega \in X_n^{-1}(a)$ but $\omega' \not \in X_n^{-1}(a)$, and any set in $\sigma(X_1,\dots,X_{n-1},D_n)$ containing $\omega$ also contains $\omega'$ since $X_1,\dots,D_n$ agree on $\omega$ and $\omega'$.
I don't see why $D_1$ is a function of $X_1$, so I can't help further.


Adding multiple table rows into table layout using onClickListener dynamically

Question: I'm using onClickListener to create a new table row in my table layout.
I've defined all the values to my table row and it's working fine though I would like to add multiple rows.
    final TableLayout tl=(TableLayout)findViewById(R.id.tbl);
    final TableRow tr1 = new TableRow(this);
    final TextView textview1 = new TextView(this);
    final TextView textview2 = new TextView(this);
    final Button btn = (Button) findViewById(R.id.btn);
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            textview1.setText("B");
            textview1.setBackgroundResource(R.color.darkgrey);
            textview1.setGravity(Gravity.CENTER);
            textview1.setPadding(50, 50, 50, 50);
            textview2.setText("A");
            textview2.setBackgroundResource(R.color.darkgrey);
            textview2.setGravity(Gravity.CENTER);
            textview2.setPadding(50, 50, 50, 50);
            tr1.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
            tr1.addView(textview1);
            tr1.addView(textview2);
            tl.addView(tr1);
        }
    });

XML
<TableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="*"
    android:id="@+id/tbl"
    android:layout_below="@+id/btn">

    <View
        android:layout_height="2dip"
        android:background="#FFFFFF" />
</TableLayout>

So I've clicked the button once and the new table row appears and after another click the app crashes.
How can I add multiple table rows into my table layout dynamically? I've thought using for loop, though I'm not sure about the right approach to apply it.
EDIT:
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.none.myapplication, PID: 9775
                  java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

Answer: It's hard to tell without the exact error message, but I feel it's because you create final variables and then try to add them a second time. Have you tried creating the new table row and text views inside the OnClickListener?
Using a for loop would not be useful in your case as you really want the row to be created when it's clicked.
Comment: You may look on the edit I have just made, it has error message there.
Comment: I just used another function to create row and it worked, thanks.


Execute bash script via PHP

Question: I need to execute a bash script via a front end Ajax/PHP Site.
I have looked into SSH2 and for the life of me can not get it installed.
Now, I know you can use shell_exec but this throws up problems such as authenticating password etc, I can not use SSH keys as the point is it will be deployed in an environment were there are too many servers to event contemplate doing that.
I need a way to create a PHP variable and assign the value of that variable to the output of a bash script on a remote server (IP/Pass) are user input  (Security is not a concern, this will be on a locked down local intranet machine only accessible from 1 IP)
I did try sshpass, but that does not seem to return any output.
Does anyone know of a way of doing this?
Comment: If you have a lot of servers you should be using configuration management like Ansible to manage their keys.
Answer: sshpass should work, but it (in my experience) takes some fiddling with to make it do what you want. That being said, it is a hacky solution in this context. You'd probably be better off trying to get ssh2 installed and running - it provides for precisely what you want to do.
Comment: Also, sshpass does some tricks with the tty, which is probably why you're having trouble getting the output. Depending on the details of your installation, this may or may not be insurmountable. I would recommend playing with sshpass from the command line
Comment: SSH2 is a nightmare to install with PHP 7. I did try this https://stackoverflow.com/questions/14050231/php-function-ssh2-connect-is-not-working and have the library, but still says unknown object when try call it ><

Execute bash script via PHP


show that sequence $(a_n)$ is convergent

Question: Let $(a_n)$ be a sequence of real numbers. If $$|a_{n+1} − a_n | ≤ \frac{1}{2}\  |a_n − a_{n−1} |,  \qquad \forall n \in \{2, 3, \dots\}$$
then show that $(a_n)$ is convergent.
Comment: [Related](http://math.stackexchange.com/questions/570989/convergence-of-a-n1-a-n-le-cqn).
Answer: First step: $$|a_{n+1} - a_n| \leq \frac{1}{2^{n-1}}|a_2 - a_1|$$
Second step:
$$|a_n - a_m| \leq \sum_{k=m}^{n-1}|a_{k+1} - a_k| \leq \sum_{k=m}^{n-1}\frac{1}{2^{k-1}}|a_2 - a_1| \leq |a_2 - a_1|\sum_{k=m}^{+\infty}\frac{1}{2^{k-1}} = \dfrac{|a_2 - a_1|}{2^{m-2}}$$
Now conclude $a_n$ is a Cauchy sequence, so it converges
Answer: Hint: $$|a_{n+1}-a_n|\le\frac{1}{2^{n-1}}|a_2-a_1|$$
Comment: I don't think your reasoning is sufficiently accurate for $a_n$ = $\sum^n_{i=1} 1/i$
Comment: @Pieter21 Yes, you are very correct. I did not show that it is a Cauchy sequence, as I should. I will leave only the hint.


BigQuery Error: Cannot parse regular expression

Question: I don't understand what is wrong with my syntax.
relevant portion of query:
COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), ''', '') = 'TAP_RIGHT') AS is_view_ctx_tap_right, COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), ''', '') = 'TAP_LEFT') AS is_view_ctx_tap_left

Error:
Cannot parse regular expression: unexpected ): , '') = 'TAP_RIGHT') AS is_view_ctx_tap_right, COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'),

Answer: Try below instead
COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), "'", '') = 'TAP_RIGHT') AS is_view_ctx_tap_right,
COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), "'", '') = 'TAP_LEFT') AS is_view_ctx_tap_left

Note the proposed fix: "'" instead of '''
Comment: I tried the proposed fix and am now receiving a python error:
`SyntaxError: unexpected character after line continuation character`
Comment: i answered your original question and most likely your issue in that question is now fixed. The new issue you have is something different and you need (if you want) to post new question with all new relevant details so it can be further addressed. Meantime, I consider this current question is answered, so consider voting up and accept the answer :o)
Comment: btw, meantime try `''''` instead of your current `'''` - this can potentially address conflict in your python code


Position Enlarged Image On Hover

Question: Please see: http://silverbacksport.com/rugby_collection.html
Here is the HTML I am using:

Is there a way I can position the enlarged image onmouseover so that it stays within the limits of the vertical borders of the page?
Answer: You can use max-width for this.
img {
  max-width: 300px;
}

This way, you will control the extent to which the image will expand. You can use this max-width to the container of the image, and use width: 100% to the image. This way, browser will automatically check the resolution which will be best for the current container size.
Comment: Thank you Afzaal Ahmad Zeeshan but, sorry if I am appearing a bit dim:
Comment: Thank you @Afzaal Ahmad Zeeshan but, sorry if I am appearing a bit dim: when you say add max-width to the container of the image, is the container the ?. And, where can I add width:100% to the image given: onmouseover="this.src='Images/LM CAP (2013).jpg'" ?
Comment: Sure thing I mean to say `td`. And no this is a CSS property, so you will add it inside .css file.
Comment: One more query please @Afzaal Ahmad Zeeshan? The pages with thumbnail images expanding on hover now work great. But now, the max-width CSS property also is applied to the images in the slider on the Home Page, which I want to be full original size. Is there a way to fix? CSS:.rotating-item {
 display: none;
 position: absolute;
 top: 0;
 left: 0;
}
Comment: The CSS for the slider images:                                       .rotating-item {
 display: none;
 position: absolute;
 top: 0;
 left: 0;
}
Comment: Then you can try to seperate them out, using a class so that they are different. And then you can use a seperate class or id to do the onmouseover change, this way only the images with exact class will get the change and others will be neglected! Can I get a fiddle? @user2909454..
Comment: No fiddle yet :-). I just cannot figure it out. See: http://silverbacksport.com/ and  http://silverbacksport.com/rugby_collection.html. CSS:
#content {
 float: left;
 width: 646px;
 padding: 15px;
 overflow: auto;
 background-color: #fff;
 margin: 0px;
 position: relative;
}
#content img {
 display: block;
 max-width:400px;
}
#rotating-item-wrapper {
 position: relative;
 width: 540px;
 height: 512px;
}
.rotating-item {
 display: none;
 position: absolute;
 top: 0;
 left: 0;
}                          Sorry, you are dealing with a newbie here!
Comment: Fiddles: http://jsfiddle.net/NevNic/6Hn6X/5/ and http://jsfiddle.net/NevNic/5rNPe/

Position Enlarged Image On Hover


How can I use postsave method extending WebformHandlerBase for submitting to account fields

Question: I created a webform handler class extending from WebFormHandlerBase: The method, postsave has the following code:
<code>public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
    $account = \Drupal::currentUser();
    $user = \Drupal\user\Entity\User::load($account->id());
    $user->addRole('example');
    $user->save();
  }
</code>
A boolean and photo value are submitted by the webform submission.  I need to submit the boolean and photo to account fields.  How do I do it?
Comment: get the data from the webform_submission object and then save it to whatever properties? It may help you tremendously to rely on a IDE (such as phpstorm, netbeans, visual studio code) to inspect and debug code.
Answer: $account = \Drupal::currentUser();
    $user = \Drupal\user\Entity\User::load($account->id());
    $data = $webform_submission->getData();
    $photo = $data['picture'];
    $user->set('field_photo', $photo);
    $user->save();
  }
The above code, for example, will take a webform element, key is 'picture' and set it to an account field, 'field_photo'.


constexpr bug in clang but not in gcc?

Question: Let's take this simple example:
#include <iostream>

namespace foo {
    constexpr int main(int argc, char* argv[]) {
      // code
    }
}

int main(int argc, char* argv[])
{
    return foo::main(argc, argv);
}

Depend on what code is, clang will complain or no. If code is:
cout << "Hello!";
return 0;

clang complains:

error: constexpr function never produces a constant expression
  [-Winvalid-constexpr]
constexpr int main(int argc, char* argv[]) {

note: non-constexpr function 'operator<< >'
  cannot be used in a constant expression
    std::cout << "Hello!";

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ostream:530:5:
  note: declared here
operator<<(basic_ostream<char, _Traits>& __out, const char* __s)

Fair enough, constexpr functions can't contain any cout statements, as we know. But what happens if we do this?
  for (int i = 0; i < argc; i++)
    std::cout << argv[i];

clang allows it! OK, but this can't possibly be a constexpr function even though it is marked constexpr, let's try to use it in constexpr context.
int arr[foo::main(argc, argv)];

It works! So it must be clang bug? Reason I say clang because gcc complains:

error: body of constexpr function 'constexpr int foo::main(int,
  char**)' not a return-statement

So my conclusion is clang is wrong and gcc is right.
Comment: @ToryWebster So why are you tagging this `c++11`? The answer to your question depends on it.
Comment: Produces "statement not allowed in constexpr function" on clang 3.4.
Comment: What version of clang are you using?
Comment: I am using clang 3.5 `std=c++1y`
Comment: I didn't even think clang allowed constexpr in general
Comment: @Gmercer015, Clang has been C++11-complete for a while now and more recently, C++14-complete.
Answer: Clang is correct here.
First example
Here, the code is:
constexpr int foo::main(int argc, char* argv[]) {
  std::cout << argv[i];
  return 0;
}

In C++11, this code is ill-formed, because the body contains an expression-statement, which is not permitted in a constexpr function definition.
In C++1y, this code is ill-formed with no diagnostic required, because a call to foo::main can never produce a constant expression (because it always calls operator<<(std::ostream&, const char*), which is not constexpr).
Second example
In this case, the code is:
constexpr int foo::main(int argc, char* argv[]) {
  for (int i = 0; i < argc; i++)
    std::cout << argv[i];
  return 0;
}

In C++11, this code is ill-formed, because it contains a for-statement.
In C++1y, this code is valid. In particular, foo::main(0, 0) is a constant expression (with value 0). Since foo::main is usable in a constant expression, Clang is not permitted to reject it, and does not do so.
Third example
int arr[foo::main(argc, argv)];

The array bound here is not a constant expression (because it reads argc and argv, which are not constant). However, Clang supports variable-length arrays as an extension by default. You can specify -pedantic-errors to put clang into strictly-conforming mode, and in that mode it will reject this code.
GCC's diagnostic:

error: body of constexpr function 'constexpr int foo::main(int, char**)' not a return-statement

is incorrect in both C++11 and C++1y. In C++11, it's incorrect because the rule is more subtle (the body of a constexpr function can contain typedefs and a few other constructs, not just return-statements). In C++1y, the rule no longer exists at all.
Answer: You compile your code in C++1y mode which contains wording to relax constexpr restrictions including all looping statements.
Have a look at N3652 which introduced these changes.
Comment: Where is the specific place that allows it to use `operator<<` on `cout`?
Comment: @Griwes I ignored the body of the for-loop, because I thought that OP is specifically wondering about the loop. But yes, that is odd.
Answer: So gcc 4.8.1 does not implement relaxed constexpr restraints, but clang 3.5 does. My mistake was that clang and gcc both have variable length array extensions. if I had used std::array instead, both compilers would reject the code. What I still don't understand is if clang allows relaxed constexpr, then why is it not a constexpr?
Comment: Because `operator<<` is not constexpr.
Comment: I suggest compiling with at least `-pedantic` to avoid this.

constexpr bug in clang but not in gcc?


Converting polar equations to cartesian equations.

Question: Where $$r=\sin(3\theta)$$ and $$y=r\sin(\theta),~x=r\cos(\theta),~r^2=x^2+y^2$$ I have started by saying that $$ r=\sin (2\theta) \cos (\theta) +\sin (\theta) \cos (2\theta) \\  r=2\sin (\theta) \cos ^2 (\theta) +\sin (\theta) (1-2\sin ^2 (\theta)) \\r=2\sin (\theta) \cos ^2 (\theta) +\sin (\theta)-2\sin^3(\theta) $$ simply making the substitutions $$\sin(\theta)=\frac{y}{r},~\cos(\theta)=\frac{x}{r}$$ noting also that I can square both sides of the above to be substitutions we then can write down $$r=\dfrac{2yx}{r}\cdot \dfrac{x^2}{r^2}+\dfrac{y}{r}-\dfrac{2y^3}{r^3}$$ then multiplying through by $r^3$ we obtain $$r^4=2yx^3+yr^2-2y^3$$  then replacing $r^2$ with $x^2+y^2$ we get $$(x^2+y^2)^2=2xy^2+yx^2+y^3-2y^3 \\(x^2+y^2)^2=y(3x^2-y^2)$$
However I am unsure of where I have made a mistake as the true answer is$$(x^2+y^2)^2=4x^2y-(x^2+y^2)y$$ working backwards I've so far gotten to the point of asking how I would rearrange$$r=\sin (3\theta) \Rightarrow r=4\cos ^2 (\theta) \sin (\theta) -\sin (\theta)$$ so that $$\sin(3\theta)=4\cos ^2 (\theta) \sin (\theta) -\sin (\theta)$$ which I am afraid I'll have to ask help for the next steps. Thanks.
Comment: Your answer is the same as the "true" answer
Comment: Oh, I didn't realise, thank you so much.
Answer: $$\begin{align}r&=\sin(3\theta)\\r&=\sin\theta\cos2\theta+\cos\theta\sin2\theta\\r^2&=r\sin\theta\cos2\theta+r\cos\theta\sin2\theta\\x^2+y^2&=y\cos2\theta+x\sin2\theta\\r^2(x^2+y^2)&=yr^2(1-2\sin^2\theta)+2xr^2\sin\theta\cos\theta\\(x^2+y^2)^2&=y(x^2+y^2)-2y^3+2x^2y\\(x^2+y^2)^2&=3x^2y-y^3\end{align}$$
I don't see a difference so far.
$$\begin{align}r&=\sin(3\theta)\\r&=3\sin\theta-4\sin^3\theta\\r^4&=3r^3\sin\theta-4r^3\sin^3\theta\\(x^2+y^2)^2&=3y(x^2+y^2)-4y^3\\(x^2+y^2)^2&=3x^2y-y^3\end{align}$$
No difference here either. Your answer looks good.
Answer: or you use $$\sin(3x)=3\sin(x)-4\sin(x)^3$$
Comment: Which too also brings me to the same answer as I have at the bottom. @David Quinn has brought to my attention that the model answer and my answer are indeed equivalent. Thank you.
Answer: $$r=\sin (3t)=Im ((\cos (t)+i\sin (t))^3) $$
$$=3\cos^2 (t)\sin (t)-\sin^3 (t) $$
$$=3\sin (t)-4\sin^3 (t) $$
$$=3y/r-4y^3/r^3$$
thus
$$r^4=3yr^2-4y^3$$
now replace $r^2$ by $x^2+y^2$.
Answer: $$r=sin(3\theta )$$
$$ r=3sin(\theta)-4(sin^3(\theta))$$
$$ r^2=3rsin(\theta)-4rsin(\theta)sin^2(\theta)$$
$$x^2+y^2=3y-4y(y^2/(x^2+y^2))$$


Como ajustar toda a tela de acordo com a resolução do monitor?

Question: Como ajustar toda a tela de acordo com a resolução do monitor?
 Vejam a imagem abaixo:

O meu dashboard esta ficando como na imagem B como eu poderia fazer para ficar como a A.
Estou usando php + mysql + bootstrap + html.
Segue código:
<!DOCTYPE html>

        <link rel="shortcut icon" href="../img/favicon.ico"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="refresh" content="30">
        <title>PAINEL DE MONITORAMENTO</title>

        <link rel="stylesheet" href="bootstrap/style.css">
        <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="bootstrap/css/datatables.css">

 PAINEL DE MONITORAMENTO - TI

CHAMADOS FECHADOS HOJE:

<?php echo"$fechados";?>

AGUARDANDO ATENDIMENTO

EM ATENDIMENTO

EM ATRASO

Comment: Pode adicionar o código na pergunta?
Answer: Comparando as imagens só falta definir o height da row principal em cada tabela da imagem B
 row {
      height: numero+vw;
 }

"vw" é uma propriedade relativa do CSS que se adéqua com o height portanto o layout irá acompanhar o resize do navegador
Comment: Com base no meu código acima poderia me dar um exemplo ?, pois não entendi bem
Comment: aplique ao container 'container-fluid' um widht:100%; e as rows filhas um height 50vw;
Comment: Consegui,Obrigado.


Is it possible to filter and modify the contents of a Javascript array in one go?

Question: As the title states, I am wondering if it is possible to filter and array and then modify the values in one go? However, this is better explained with an example.
Imagine I have an array of numbers and I want to filter that array to include only positive numbers, then do some sort of calculation on the remaining numbers, say multiply by 10. Do I have to filter the array and then do an iteration to modify the values or can I do something like this?
const ages = [-243, -132, 112, 40, -96];
const filtered = ages.filter((number => (number > 0)) * 10);

Comment: _"on the remaining numbers"_ - doing the modification in the filter will do it to all numbers. Filter also expects a boolean return value, so even if you did the modification I'm not sure it would affect the array.
Answer: I don't think so.. I would do:

const ages = [-243, -132, 112, 40, -96];
const filtered = ages.filter(number => number > 0).map(x => x * 10);

console.log(filtered);
Comment: This is basically what I was looking for, I will mark your answer as accepted when the timer expires.
Comment: You CAN filter and modify using the filter command without using `map` though: see [this section in the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter#affecting_initial_array_modifying_appending_and_deleting).  The advantage would be not looping through the array twice.  Obviously it makes almost no difference with such a small array so the accepted answer is cleaner.
Comment: You don't need to filter and then map, instead use reduce and do all stuff in single function
Answer: You do this with single reduce function

const ages = [-243, -132, 112, 40, -96];

const result = ages.reduce((arr, num) => {
  if (num > 0) arr.push(num * 10);
  return arr;
}, []);

console.log(result);

or with single line function using flatMap

const ages = [-243, -132, 112, 40, -96];

const result = ages.flatMap((num) => (num > 0 ? [num * 10] : []));

console.log(result);
Answer: Short answer is Yes, you can.

You can filter and modify the array in only one go.

  console.log(
  [243 * 10, -132, 112, 40, -96]
  .filter((age, index, arr) => {
         arr[index+1] *= 10;
         return age > 0;
 }))

But I think we should avoid it as much as we can. Because it mutates the original array.


Personalizando a apresentação de post no looping do wordpress

Question: Estou querendo personalizar o looping do meus posts para exibir os posts da seguinte maneira, o primeiro para a esquerda e  o segundo para a direita e assim sucessivamente. Deu errado(e eu sabia que ia dar), mas fiz um teste da seguinte maneira:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php the_title( '
', '
' ); ?>
            <?php the_time( $d ); ?>
            <?php the_category( ' ' ); ?>

<?php the_title( '
', '
' ); ?>
            <?php the_time( $d ); ?>
            <?php the_category( ' ' ); ?>

        <?php endwhile; else : ?>

<?php _e( 'Sem posts para exibição' ); ?>

        <?php endif; ?>

Isso foi só um teste para ver se dava certo, bom, não deu...
Gostaria de uma ajuda dos crânios, porque não achei o que eu queria na documentação...
Obrigado...
Answer: Para fazer coisas do tipo "uma vez isso, uma vez aquilo", você pode usar o operador módulo. Este operador funciona retornando o resto de uma divisão. De tal maneira, basta que você tenha um contador para controlar cada vez que você passa pelo loop, e checar o resto da divisão por 2, algo como $resto = $contador % 2;. O resto da divisão por 2 te diz se um numero é par ou ímpar, visto que 0 e 1 são os únicos valores possíveis para esta operação. Fazendo essa checagem (if ($resto == 1)) você pode realizar ações vez sim, vez não. Veja este snippet em JS que exemplifica melhor a situação:

var count = 0;

for(var i = 0; i <= 10; i++){
  var resto = count % 2;
  if(resto == 1){
    $('.target').append("
" + i + " é impar
");
  }
  else{ //resto == 0
    $('.target').append("
" + i + " é par
");
  }

  ++count;

}

É possível fazer a mesma coisa no seu loop. De uma maneira simplificada, você pode fazer:
<?php

$count = 0;

if ( have_posts() ) : while ( have_posts() ) : the_post();

    if ($count % 2 == 1){
        $align = "left";
    } else{
        $align = "right";
    }

    ?>

    <p align="<?php echo $align?>"><?php the_title( '
', '
' ); ?>
        <?php the_time( $d ); ?>
        <?php the_category( ' ' ); ?>

    <?php ++$count; ?>

<?php endwhile; endif; ?>

Assim, a casa passagem do loop, você vai alinhar ou à esquerda, ou à direita.
Mas veja,
 ou
 vão apenas justificar o texto à direção especificada. Se você quiser fazer algo como um grid, ou cada post flutuando de um lado diferente, minha recomendação é de que use coisas como float: left e um certo comprimento para cada container do post. Mas isso, claro, é um chute. Tudo depende do que você está tentando fazer!
Comment: A respeito do css eu manjo man, vlw! Fiz desse jeito só para teste mesmo... Mas pedi uma ajuda e Recebi uma aula! Muito obrigado!


Is it necessary to perform a transformation on proportion data if it's reasonably well behaved?

Question: If you're modelling a proportion response against numerous predictors that are also proportions, is it necessary to transform the response if the standard OLS model is seemingly well behaved?
By well behaved I mean:

None of the fitted values are outside the range [0,1] (In fact they are fairly accurate)
Residuals look good

I believe arcsine transform is typically used in this scenario to make the data look normal, but what if this is not needed?
Also, say the data wasn't normal, would a transform still be necessary if one were modelling the proportions with the Random Forest technique?
Cheers
Answer: It depends. If your goal is prediction, then you may not need to do any gymnastics to get a more theoretically sound model if the one in hand does well. But of course you should be always be aware that a good-fitting model to present data may not perform well on new data. You can try to get a feel for that using cross validation, although you simply might not have important aspects of the distribution represented in your sample.
If you want to make inferences using some of the parameters in the model then that model should be motivated by the problem at hand.
Anyway, a first step is to just look at the response. Is it roughly bell-shaped? Did you try the arcsine transform? Does the transformed distribution look (much) different? If the distribution of the proportions is fairly tight and located somewhere in the middle the transformation might not do much. And then, of course, does the transformation make a difference in the regression?
Comment: I see. CV performance is pretty good in the example I mentioned above. Does the shape of the response really matter if the residuals look fairly normal?
Comment: Probably not, but histograms are cheap :) Comparing the transformed/untransformed response might give you some insight into the data & anticipate some questions of your analysis.