Imagem não flutua com bootstrap 4

Question: Estou tentando fazer com que a imagem fique ao lado do conteúdo em aparelhos maior que large mas isso não ocorre:
Segue meu código:

COMO COMPRAR?

                    Você pode escolher os bolos e doces de nossa linha fixa, que possui mais de 20 sabores e decorações.
                    Clique acima na categoria "Produtos" para conferir as delícias que oferecemos.
                    Os pedidos devem ser feitos por telefone, com pelo menos 24 horas de antecedência, dependendo da ocasião (datas especiais e feriados).

LINHA PERSONALIZADA

                    Caso queira um bolo diferente ou personalizado para sua festa, entre em contato conosco com, no mínimo, uma semana de antecedência.
                    Desenhamos e montamos bolos e doces temáticos para todos os tipos de eventos, festas e feiras.Solicite orçamento.

Comment: Jovem no Bootstrap 4 não exite a medida XS, tipo col-xs-, tem certeza que é a versão 4 que vc está usando mesmo?
Comment: Na verdade é a versão 4 é por força do hábito o `col-xs-*` kkk
Answer: Sua estrutura HTML estava meio desorganizada, segundo os modelos de Grid do Bootstrap. Fiz apenas pequenos ajuste e agora está de acordo com o que eu acredito ser sua ideia. Não foi preciso usar nenhum CSS, só organizando o HTML e usando as classes default do Bootstrap ficou no jeito.
O que foi feito na verdade é um aninhamento do Grid, inclusive conta na documentação Oficial do Grid do Bootstrap https://getbootstrap.com/docs/4.0/layout/grid/#nesting
Veja o resultado, e teste também em diferentes tamanhos de tela!

<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />

LINHA PERSONALIZADA

      Caso queira um bolo diferente ou personalizado para sua festa, entre em contato conosco com, no mínimo, uma semana de antecedência.
      Desenhamos e montamos bolos e doces temáticos para todos os tipos de eventos, festas e feiras.Solicite orçamento.

LINHA PERSONALIZADA

      Caso queira um bolo diferente ou personalizado para sua festa, entre em contato conosco com, no mínimo, uma semana de antecedência.
      Desenhamos e montamos bolos e doces temáticos para todos os tipos de eventos, festas e feiras.Solicite orçamento.

Imagem não flutua com bootstrap 4


gnuplot : How to use values in dat file as destination for arrows?

Question: I have the following data in RecettesInvestissement2017.dat
Excédent de fonctionnement capitalisé FCTVA et TA Caution Emprunt Subvention aménagement RD124 (Amendeuix) Subvention travaux de voirie 2015 Subvention travaux de voirie 2016 Subvention travaux de voirie 2017 Emprunt salle des associations Autofinancement
7.32 1.95 0.07 38.35 11.19 0.76 1.36 0.90 2.87 35.23

Note that words in strings are separated with unbreackable spaces and strings in line one are separed with normal spaces.
My plotting file is like this
clear
set style data histogram
set style histogram rowstacked
set boxwidth 2 absolute
set style fill solid border
set xrange [-2,14]
set yrange [0,110]
unset xtics
unset ytics
unset key
i=0
do for [name in "`head -1 'RecettesInvestissement2017.dat'"]{
i=i+1
set label i name at 6,5+6*i
set arrow i from 5.8,5+6*i to 1,5+6*i}
plot for [C=1:10] 'RecettesInvestissement2017.dat' u C

at the moment the result is the following

I still have to adjust fonts but before I would like to make the arrows arrive at the center of the relevant part of the stacked bar. I need help for that.
Thank you.
Answer: If I understand you correctly, you want to plot arrows to the center of each colored area. You can use a function to calculate the Y position, and plot with vectors:
cumul_Y=0. #cumulative height
f(x)=(cumul_Y=cumul_Y+x, cur_Y=cumul_Y-x/2., cur_Y)
#cur_Y is a Y position
plot for [C=1:10] 'RecettesInvestissement2017.dat' u C, \
for [C=1:10] 'RecettesInvestissement2017.dat' u (5.8):(5+6*C):(-4.8):(f(column(C))-5-6*C) w vectors lc rgb('black'), \
for [C=1:10] 'RecettesInvestissement2017.dat' u (7):(5+6*C):(word(names,C))  w labels left font 'Arial,10'

Then you can add another section in the plot command, to plot with labels.

Here is the full script, it works for me. You have to add at beginning of the first line in data file a character # and space.
set term png size 1024,768
set output 'plot.png'
set style data histogram
set style histogram rowstacked
set boxwidth 2 absolute
set style fill solid border
set xrange [-2:14]
set yrange [0:110]
unset xtics
unset ytics
i=0
names="`head -1 'RecettesInvestissement2017.dat'`"
cumul_C=0.
f(x)=(cumul_C=cumul_C+x, cur_C=cumul_C-x/2., cur_C)
unset key
plot for [C=1:10] 'RecettesInvestissement2017.dat' u C, \
for [C=1:10] 'RecettesInvestissement2017.dat' u (5.8):(5+6*C):(-4.8):(f(column(C))-5-6*C) w vectors lc rgb('black'), \
for [C=1:10] 'RecettesInvestissement2017.dat' u (6):(5+6*C):(word(names,C+1)) w labels left font 'Arial,10'
unset output
reset

Comment: Thank you very much. I think labels are different because the copy paste changed the unbreakable space into a normal space.
Comment: I am trying it. At the moment it doesn't work but I need  to investigate as I am not very used to gnuplot
Answer: Here is what I get with your script
Comment: I tried gnuplot 4.6 an 5.0, it works fine in both versions.
Comment: Version 5.0 patchlevel 5    last modified 2016-10-02
Comment: Have you added # and space in beginning of the line with labels?
Comment: I didn't understand it was in the data file at first. It works now. Thanks again for your patience.


Leitura do JSON retorna vazio

Question: Estou lendo um JSON de uma URL, conforme código abaixo:
$link1 = file_get_contents('http://gwmestampas.com.br/arquivo.json');

$obj = json_decode($link1);
echo $obj->event;
echo $obj["event"];

 foreach($obj as $link){
    $event = $link->event;
    $event2 = $link["event"];
    //$numOrd =  $link->resource->payment->_links->order->title;
    //$tipoPag =  $link->resource->payment->events->type;
    //$numPag =  $link->resource->payment->id;
};

echo $event.'-
';
echo $event2.'-
';
echo $numOrd.'-
';
echo $tipoPag.'-
';
echo $numPag.'-
';

Tentei de várias maneiras mas sempre retorna vazio.
Comment: `foreach($obj as $link){` o json retornado não é um array que você possa de cara fazer um `foreach`, chegou a estudar o json de retorno? poderia simplesmente ler o node direto, assim: `$obj->event`
Comment: não sei eu não entendi ou vc, mas no código acima tento fazer a leitura direto, mas não retorna nada e se tento fazer a leitura dentro do foreach também retorna vazio.
Comment: mesmo `$link1` está vazio?
Comment: se estiver, pode ser que o `file_get_contents` não esteja conseguindo ler a url como se fosse um arquivo, então precisa habilitar isso assim antes do comando: `ini_set("allow_url_fopen", true);`. Faça um teste, se funcionar posso explicar melhor numa resposta
Comment: O $link1 recebe os dados normais vindo do $link1 = file_get_contents(.... mas depois disso não vai a diante, depois do $obj = json_decode($link1); por exemplo usando somente o echo $obj->event; deveria pelo menos mostrar algo sabendo que a estrutura é a seguinte {
  "date": "",
  "env": "",
  "event": "ORDER.CREATED",  e ai por diante.
Comment: pegando o resultado da url e validando o json aqui: https://jsonlint.com/ e aqui https://jsonformatter.curiousconcept.com/ reclama que está inválido, pode ser esse o problema
Comment: recebo esse conteúdo do wirecard, vou entrar em contato com eles, mas acredito que não vai resolver, mas vamos tentar. Obrigado
Answer: O JSON retornado é inválido. Ele possui vários objetos "soltos", um seguido do outro:
{"date":"","env":"" ... }{"date":"","env":"", ... }

Repare que depois que o primeiro objeto é encerrado com }, já é iniciado outro objeto com {. Isso não é um JSON válido.
O correto seria esses objetos estarem dentro de alguma outra estrutura, como um array, por exemplo:
[ {"date":"","env":"" ... }, {"date":"","env":"", ... }, ... ]

Aí sim seria um JSON válido. No exemplo acima, temos um array: ele é delimitado por [] e há vírgulas separando os elementos.
O ideal é que a URL retornasse um JSON no formato correto. Se você não tem controle sobre a URL que está acessando, o único jeito é manipular a string manualmente.

Atenção: o código abaixo foi feito especificamente para o JSON em questão. É assumida a premissa de que o JSON sempre vem assim: os objetos sempre começam com {"date": e não há espaços entre eles. Se houver a mínima mudança no formato, ele já não funciona mais (por isso o ideal é que a URL já retornasse um JSON válido).
A ideia é transformar esta string, que contém objetos em sequência, em um array. Para isso precisamos colocar [ no início, ] no fim e uma vírgula entre os objetos:
$link1 = file_get_contents('http://gwmestampas.com.br/arquivo.json');
$obj = json_decode('['. preg_replace('/((?<!^)\{"date":)/', ',$1', $link1). ']', true);

A expressão regular pega a string {"date": (desde que não esteja no início) e coloca uma vírgula antes dela. Também coloco o [ e ] e passo o resultado para json_decode.
Assim, $obj terá todos os objetos, bastando iterar pelo mesmo:
foreach ($obj as $link) {
    echo $link['event'];
    if (array_key_exists('payment', $link['resource'])) // nem todo resource tem payment
        echo ', '. $link['resource']['payment']['_links']['order']['title'];
    echo PHP_EOL;
}

Pelo que vi, o resouce pode ou não ter payment ou outros campos, mas aí basta ir testando se eles existem antes de acessá-los.

Lembrando novamente que esta é uma solução limitada. Se a string mudar (por exemplo, retorna um objeto que não começa com {"date":, ou qualquer outra alteração que não bata mais com nossas premissas), ele não funciona mais. Se tiver alguma propriedade date dentro de outro objeto interno, a regex vai inserir uma vírgula onde não deve (por sorte não tem, é por isso que nesse caso funciona). Claro que, dependendo da mudança, bastaria alterar a regex, mas ficar usando regex para manipular JSON não é o ideal.
O ideal é que o serviço retorne um JSON válido, para que você não precise ficar fazendo essas gambiarras para arrumar a string.
Comment: foi o que comentei, esse json está mal formado. esse Regex foi top pra fazer o fix :D
Comment: Agradeço muito a Resposta, entendo que não é a melhor opção, mas recebo assim e pois é de um serviço externo, vou implementar esse código e fazer uns teste para ver se fica funcional devido eventuais alterações, e como o Ricardo comentou ficou top mesmo o regex
Comment: @FabioJonasZech É, se é de um serviço externo e eles não puderem corrigir, então o jeito é ficar ajustando a regex toda vez que mudar alguma coisa (ou torcer para não mudar nunca) :-)

Leitura do JSON retorna vazio


How to report simple markov transition matrix

Question: I have a beginners question on Markov chains. We found that a Markov chain might be a good way to describe the data we got from our experiment. Let's say we have two simple Markov transition matrix with 3 states.
<code>Markov transition probability matrix 1
   1     2    3
1 0.00 1.00 0.00
2 0.50 0.00 0.50
3 0.00 0.66 0.33

Markov transition probability matrix 2
   1     2    3
1 0.66 0.33 0.00
2 0.50 0.50 0.00
3 0.00 1.00 0.00
</code>
I wonder what would be the best way to report it in an article, e.g. APA. Ideally we would like to look at differences between two different Markov transition matrices. Links to good beginner's introductions would help too. Many thanks!
What would be the most concise way to report the difference between two matrices?
Answer: Do you have a predefined start state ?
It is fairly easy to see that in matrix 2, state 3 has no incoming edges.
And thus over time, the probability of being in state 3 converges to 0.
And if the starting state is not 3, then it is exactly 0.
I think it will be interesting to report the stationary distribution of matrix 1.
One way of comparing Markov proccesses
Usually when dealing with Markov chains, you have a transition matrix $T$ and a reward/cost for being in each state $\vec{r}$
If the stationary distribution $\vec{\pi}$ exists for the two Markov processes, then you have two expected rewards:
$$E_1=\vec{r}\vec{\pi_1}$$
$$E_2=\vec{r}\vec{\pi_2}$$
And you can compare which process is more rewarding / less costly
Loosely speaking, A stationary distribution is the probability of being in each state when repeating the transitions for infinity.
Comment: Thanks your explanation! It's very much appreciated. What about some sort of inferential statistics? My real question would be, are they different enough to be regarded from different samples? The dummy data messed the distribution up a bit, there is better data before edit. To answer, the current matrix does always start with state 1, but I'm not sure if that will truly help with comparison. Thanks again, I'll read up on the stationary distribution in the coming days, but I guess to interpret the results, we don't really want to run it to infinity (the speed of transition would also matter).


Choosing a regression model based on missing values

Question: I'm trying to predict weight change with an intervention from baseline variables. Literature search yields suggests several predictors. Univariate analyses with weight change as dependent and baseline variables give several more predictors.
I've entered both theoretical and GLM univariate predictors into a regression model using forced entry (in blocks according to significance for the GLM univariates).
The problem I'm having is that my models vary hugely depending on how I treat missing variables. My study has 329 cases. I thought that listwise was the best method of exclusion (textbook) however this leaves me with insignificant models and only 196 cases. Pairwise and replacing values leave me with much higher cases naturally and give two models with the same significant predictors.
My issue is that the predictors remaining are ones which make sense in context with the literature. Is it ok to present these? Could somebody please tell me why pairwise and replacing with means are frowned upon?
I know there are other methods of missing value imputation but I have no idea of how to do that in SPSS, so if you're feeling generous and you know, I'd be grateful for any tips!
Answer: There's a body of literature on treating missing data. In your case it sounds as if you had the worst kind of missingness, i.e. missing not at random, where you have to somehow model the missingness. It's tough.


Does Linear Discriminant Analysis / Fisher Discriminant Analysis only generate 2 outputs as a dimensional reduction method?

Question: Is that correct that LDA/FDA can only generate 2 outputs as a dimensional reduction method?
Suppose I have 100 features, I want to reduce to 5 features. Is LDA/FDA not usable?
Answer: Applying LDA to data with $K$ classes allows you to project the data onto a $K-1$ dimensional surface in a way that separates the data by class. You cannot arbitrarily choose the number of "features" that the data gets transformed into.
Comment: Yes! That's right. If you want to do dimensionality reduction, consider applying PCA to get the first 5 principal components of your data, then project the data onto the subspace spanned by those 5 principal components.
Comment: so Let say my original dataset has `2 classes, the output will be 1 dimensionality ( 2 – 1 =1 )`, likewise, if my original dataset has 5 classes, the output will be 4 dimensionality.
Comment: Van de Kluet Thanks. Because also `eigenvalues for dimensions > c−1 will be 0 or imaginary (where c is the classes).`
Comment: I'm not sure what you mean by that, but the eigenvalues in PCA for real-valued data are always real-valued since PCA does not use the classes of the data. Unless two explanatory variables are perfectly correlated, PCA should give you $d$ eigenvalues/eigenvectors where $d$ is the dimensionality of the data.
Comment: sorry, I mean because `in LDA/FDA`, the `eigenvalues for dimensions > c−1 will be 0 or imaginary (where c is the classes).` That is why the output is "c-1" where "c" is the number of classes and the dimensionality of the data is n with "n>c"
Comment: His thoughts are related to [that question](https://stats.stackexchange.com/questions/198437/lda-for-dimensionality-reduction-usage) where you can also use LDA for dimensionality reduction (like a "supervised PCA").
Comment: Do you have some reference/bibliography explaining this and its depiction ways?
Because I come from https://stats.stackexchange.com/questions/637053/two-class-lda-with-multiple-variables-can-we-separate-classes-and-know-the-weig  where the answer is I can draw ellipse, which as far as I know is a 2D representation
Answer: Also, note that you need labels to perform LDA, which is not always available (or relevant). That's why PCA is usually preferred because it's class-agnostic.
The number of output dimensions in LDA is linked to the number of degrees of freedom in the dataset, which is linked to the number of classes $c$: eigenvalues above $c$ will be zero and bear no information (same as with PCA and explained variance).
Comment: thanks. I actually have a dataset `2 classes/labels (c), 50 features/dimensions/attributes (d), 150 samples/instances (n)`. I want to compare `PCA and LDA`. LDA only produce `1 feature` as output because `c-1 = 2-1 =1`.
Comment: @aan compare PCA and LDA for what? Classification? Data distribution? Variance analysis? If possible, you should ask questions about the *goal*, not about the *tools*...
Comment: I want to compare the output of both methods. Just to make sure the output of LDA/FDA is `1 feature` from my `2 classes` of dataset.
Comment: are you familiar with standarised a data in PCA? https://stats.stackexchange.com/questions/466460/what-is-the-meaning-of-standardization-in-lda-fda


"RuntimeException: You have requested a non-existent parameter 'app.root'"

Question: After I clear the cache, I get this message.

Symfony\Component\DependencyInjection\Exception\RuntimeException: You have requested a non-existent parameter "app.root". in Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() (line 37 of /var/www/call/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php).
Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() (Line: 60)
Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() (Line: 30)
Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass->processValue() (Line: 39)
Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process() (Line: 140)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() (Line: 789)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1335)
Drupal\Core\DrupalKernel->compileContainer() (Line: 916)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 477)
Drupal\Core\DrupalKernel->boot() (Line: 707)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Do you have any idea on how to solve this problem?
Comment: The second line says `You have requested a non-existent parameter "app.root".`  Try searching your code base for `app.root` and see where you are requiring it.
Comment: All are related to drupal console
Comment: What version of Drupal console?  Are you sure the version is compatible with 8.9.20?
Comment: "drupal/console": "^1.9",
Comment: Remove Drupal Console and retry.
Comment: same problem, same error
Answer: This error is caused by code using %app.root% as parameter in Drupal 8.
For example:
   cache.backend.apcu:
     class: Drupal\Core\Cache\ApcuBackendFactory
     arguments: ['%app.root%', '%site.path%', '@cache_tags.invalidator.checksum']

This is Drupal 9 code not working in Drupal 8.
The service argument @app.root on the other hand is not causing this error. You find it in Drupal Console or other Drupal 8 code. It was deprecated in Drupal 9, but is still working until you update to
Drupal 10. Then it will be this error "Non-existent service" errors after clearing the cache
See the change record https://www.drupal.org/node/3080612.
Answer: The app.root parameter has been added in Drupal 9 to replace the app.root service. If you are using Drupal 8, that error could possibly be causes by:

A module that says to be compatible with Drupal 8 and Drupal 9, whose code accesses the app.root container parameter when it runs on Drupal 8
Other code that tries to access the app.root container parameter when it runs on Drupal 8

This could happen because:

One of the arguments for a service is '%app.root%' (which requires the container parameter) instead of '@app.root' (which requires the service that exists in Drupal 8.x)
There is code that uses $container->getParameter('app.root') instead of $container->get('app.root')
There is code that checks whether to use the app.root container parameter or the app.root service, but it fails to use the available one

To understand which code causes the error, it should be sufficient to search for %app.root% or ->getParameter('app.root'). Searching for app.root isn't sufficient, as it would return any line that correctly uses the app.root service.
[Symfony 5] Replace app.root and site.path string services with container parameters has been created has been created on August 13, 2019 and marked as fixed on December 23, 2020. (The patch was committed on Drupal 9.x on March 5, 2020.)
Drupal Console 1.9.4 (released on November 11, 2019) should not contain code that accesses the app.root container parameter, as Drupal core didn't even have that container parameter when Drupal Console 1.9.4 was released.


com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException: java.io.StringReader, which is a closeable resource

Question: I have a Intiator and a responder flow in my corda project.
I am sending  a stringified json in my Initiator flow and expecting a string as acknowledgement from counterparty.
String acknowledgment =
counterPartySession.sendAndReceive(String.class,jsonMessage.toString()).unwrap(data -> data);

And in the counter party flow I am trying to retrieve the message and send a string as response.
JSONParser parser = new JSONParser();
String receivedMessage = session.receive(String.class).unwrap(data -> data);
JSONObject jsonObject = (JSONObject) parser.parse(receivedMessage);
String correlationId = (String) jsonObject.get("correlationId");
String response = "received message with correlationId: "+correlationId;
session.send(response);

but In the counter party flow I am getting an error with below stack trace.
com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException: java.io.StringReader, which is a closeable resource, has been detected during flow checkpointing. Restoring such resources across node restarts is not supported. Make sure code accessing it is confined to a private method or the reference is nulled out.
Serialization trace:
zzReader (org.json.simple.parser.Yylex)
lexer (org.json.simple.parser.JSONParser)
dataObject (co.paralleluniverse.fibers.Stack)
stack (net.corda.node.services.statemachine.FlowStateMachineImpl)
    at com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:101) ~[kryo-4.0.2.jar:?]
    at com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer.write(CompatibleFieldSerializer.java:65) ~[kryo-4.0.2.jar:?]
    at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:575) ~[kryo-4.0.2.jar:?]
    at co.paralleluniverse.io.serialization.kryo.ReplaceableObjectKryo.writeObject(ReplaceableObjectKryo.java:85) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
    at com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:79) ~[kryo-4.0.2.jar:?]
    at com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer.write(CompatibleFieldSerializer.java:65) ~[kryo-4.0.2.jar:?]
    at com.esotericsoftware.kryo.Kryo.writeObject(Kryo.java:575) ~[kryo-4.0.2.jar:?]
    at co.paralleluniverse.io.serialization.kryo.ReplaceableObjectKryo.writeClassAndObject(ReplaceableObjectKryo.java:54) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
    at com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer.write(DefaultArraySerializers.java:361) ~[kryo-4.0.2.jar:?]

Answer: When a flow checkpoints, it serializes the current execution stack.
The error says java.io.StringReader, cannot be serialized since it is closable. You should put the piece of code in a separate method, that is not annotated with @Suspendable or a better way would be to put it inside a CordaService.


Help with understanding the theory behind this chord progression - James Blunt

Question: I cannot find an answer to some of the chord relations that are present in this song, so any assistance would be great! Particularly in reference to the harmony and theory behind the progression.
The song is "I'll take everything" by James Blunt. I think it's in the key of G, but perhaps modulates in the bridge? I've bolded the parts I'm unsure of.
Verse:
G -> Bm -> D [I - iii - V]
Prechorus:
Em -> Bm -> D [vi - iii - V]
F# -> Bm -> D [is this the V chord of the Bm scale? then to a iii - V]
Bridge:
F# -> Bm -> D [as above]
G  -> F# -> Em7 -> A -> F#m -> D [Unsure about the progression here]
F#m -> C#7sus4 -> C#7 -> F#7sus4 -> F#7 ->  Bm -> D [Unsure about the progression here]
Chorus
Em -> F#sus4 -> F# -> F#7 -> Bm/D [Unsure about the progression here]
Thank you :D
Comment: I was trying to say that you need to perform tests. People around here seem to make tonality assumptions by looking at note names, without interacting with the music and actually doing anything. Press pause and play a cadence, chords G - C - D - G. Does that feel natural at that point? If G is not the tonic you actually feel, then the G - C - D - G chords should feel foreign or ridiculous. With such indicative tests you strengthen and clarify your feelings about the harmony. You didn't "overlook" anything, it's not about passively looking, it's about actively doing, performing, interacting.
Comment: the intro is:
I III VI V
Comment: G isn't the tonaltiy, The intro is

i III VI V. So start with Bm = i and yes F# is the dominant.
Comment: Funny, the version I heard starts on Cm.
Comment: How did you try to verify your guessed tonality? For example G being the tonic in the beginning - **what tests did you perform to verify that assumption**?
Comment: Of course...how did I overlook that minor tonality...and yes forgot to mention that the song actually has a capo on 1, but regardless the chordal relations will the 'same'.
Comment: @piiperiReinstateMonica  To me at first listen G sounded like the tonality, especially with that sad G to Bm change. and given that F# is the dominant of Bm, i thought it was the classic secondary dominant trick. But looking now at Bm tonality I can see how i overlooked it all.
Comment: @piiperiReinstateMonica agreed, thanks for the thoughts and comments :)
Answer: The recording of this song is actually a half step higher as @Tim pointed out. It starts with a Cm pickup on beat 3. However I will make all my comments in your key since you asked the question and wrote out the chords in that key. This song is very interesting because the main chord is G but the melody is largely based on the notes B C# D E F# G which makes it sound like Lydian mode. It's a bit nebulous, almost as if the G is a IV chord in the key of D or a bVI chord in the key of Bm that doesn't resolve. Because it revolves around the G chord so much I would say the song is in G but I wouldn't debate someone who has a different opinion.
The Bm and D chords are quarter note pickups into a G (Gmaj7 on the choruses) downbeat which lasts a full 6 beats like so:
Bm D ||:G ///|//Bm D:||
After 4 repeats of this with the the vocal it uses the same 2 chords to go to Em like you showed in the pre-chorus, then the same pickups to F#7, which is the V of Bm. You can also think of the F#7 as a VII7 of G since the Bm goes by so quickly. The choruses are similar to the verses except you can clearly hear the maj7 in the guitar part.
Your bridge chords basically look good except the first chord of the second line should have a C# in the bass: F#m/C#. Analysis of the bridge sounds like a brief modulation to D And a few secondary dominants to get back to the home key.
You labeled the last section as "chorus" but I think you meant "coda" this also looks good. The last chord, Bm/D adds to the ambiguity (intentional I'm sure) of this very interesting tune.
Comment: Thanks for the very helpful analysis John. It confirms that I wasnt going too crazy thinking that the tonality is G, but as others have pointed out, Bm is also valid; however, it almost sounds more like an unresolved 'G' to me! :)
Comment: @BOER777 my pleasure, I'm a bass player so if I'm playing a G for 70% of the time the tune is in G! But seriously, I'm glad you hear it that way too. The #4 and major 7th melody notes give it a very floating quality. Funny, in my answer  I mentioned the G as a IV chord in the key of D that never resolves but it sort of does, in the bridge and also the last Bm/D chord.
Answer: The song is very simple If you start with Bm as key tonality:
It is not always clear whether a song is in major or in its relative minor key and which is the tonic.
I haven't listened to this song yet but havin a look at the chords and lyrics it becomes obvious:
https://tabs.ultimate-guitar.com/tab/james-blunt/ill-take-everything-chords-583215
(Notice this sheet is in a - minor!)
Intro:
i  III VI V
It seems as if you understand enough of basic chord theory to finish now the adjustment in your analysis.
Comment: I only hear three chords at the beginning. Cm Eb Ab. Sheet is in Am, but capo on fret 3 puts the chords into concert Cm Eb Ab.


How to to choose approximation for calculus/integral calculation? (example for surface of revolution)

Question: To calculate the surface of a revolution (spinning around the x axis), we usually use the surface of a circular truncated cone (labeled $A$) to approximate the infinitesimal of the surface of the revolution.

The result is all known
$$
S=2\pi \int_a^b f(x) \sqrt{1+{f'}^2(x)}dx
$$
But if we choose a cylinder to approximate the infinitesimal, the result will be a wrong equation
$$
S=2\pi \int_a^b f(x) dx
$$

So my question is, is there a rigid principal to choose the approximation? How can we be sure that the approximation is correct, how to validate?
Answer: We have the same problem in the simpler situation of a graph $$\gamma:\quad y=f(x)>0\qquad(a\leq x\leq b)\ .$$
When we want to approximate the area under this graph we can take rectangles cut off horizontally at the top, but for the length of $\gamma$ we have to stay with hypotenuses, which then lead to the nasty square root under the integral sign.
The reason can be seen in the following figure: When we split a rectangle vertically in half the relative area-error committed by neglecting the triangles is halved as well, and therefore goes to zero in the limit. But with the hypotenuses it's different: There is always a factor $${1\over\cos\theta}=\sqrt{1+\tan^2\theta}$$ between the width of the rectangle at stake and the length of the corresponding hypotenuse. This factor does not go away in the limit.
Comment: Thank you so much! Brilliant!


Two salts, One password

Question: If I have two different MD5 password hashes with two different salts (the salts are known), is there any way to cryptographically deduce if the two passwords match? Other than brute force password cracking, that is.
Comment: I'm voting to close this question as off-topic because it is about cryptography, not server-admin. This question maybe suited for the Crypotgraphy SE site (https://crypto.stackexchange.com/), but check with their question requirements before posting.
Comment: Brute force password checking with MD5 is so fast the *functional* answer here is "yes, with fairly minimal time/resources". Use a better hashing algorithm.
Answer: It's obviously not possible. The salts are used mainly so that your question could be answered: NO, the attacker knowing a pool of passwords and their hashes (and their salts) cannot easily cross-check my hash.
Comment: This answer, IMO, is functionally inaccurate because a pretty decent MD5 rainbow table can be generated in a matter of hours for any particular salt for a few bucks on AWS.
Comment: @ceejayoz Multi-VPS  is "brute force" which OP specifically excluded from the question.
Comment: Which is a silly exclusion. Brute forcing bcrypt will take you millennia. Brute forcing MD5 takes minutes.
Comment: Preventing exactly this is the entire reason for salts.
Comment: @DavidSchwartz Yes, but a weak algorithm like MD5 means salting doesn't really save you. You can generate a custom rainbow table for the salt quickly enough as to still heavily compromise the security. The hard rule is *don't use MD5 for password hashing*. Period.
Comment: @ceejayoz Scratching my head over your comments and a downvote, as you have twice my reputation here. I regarded rainbow tables as an example of brute force approach, but it looks I could be wrong about that categorization. I think it's best for OP to clarify. I *do* understand that brute force *will* be quick if you have a weak hash, really.
Comment: @kubanczyk Rainbow tables are a brute-force approach, yes. I'm pointing out people frequently *incorrectly* believe that salting MD5 makes it safer. The *speed* at which MD5 can be brute-forced makes brute-forcing a valid approach. Any "is MD5 safe if you do foo" question really needs an answer of "it is **never safe to use MD5 for password hashing, no matter what you do**". There's no real point discussing it beyond that.
Comment: I'm sorry but I don't buy it. Sure, MD5 is not considered a secure MAC and there are issues regarding collisions etc. BUT it's not as insecure as you guys make it sound. MD5 provides 127 bits of security. That means that if you use a good password and your cpu tries 100k attempts per second, then it will take 5.4e25 years to successfully crack the password.
Comment: @kubanczyk ^---

Two salts, One password


Para que serve ~ (til) e ^ (acento circunflexo) no esquema de versionamento do Composer?

Question: Em alguns casos, vejo que algumas bibliotecas que usam o Composer, colocam ~ ou ^ no início da versão da biblioteca, assim:
"orchestra/testbench" : "^3.6"

Ou
"phpunit/phpunit"    : "~7.0"

Eu queria saber qual é a finalidade de cada um deles.
Comment: A quem interessar, segue a [documentação](https://getcomposer.org/doc/articles/versions.md#next-significant-release-operators), só peço, por gentileza, não apenas copiar e colar como resposta.
Comment: Só pra comentar, alguns devs não seguem o semver.org, ai vem aquilo, da versão 1.0.1 para 1.0.2 tem algo que muda bruscamente o comportamento, ai vai e falha tudo no teu projeto, tenho tanto receio que só uso "x.x.x", sem range :P
Comment: @AndersonCarlosWoss você pegou o espírito da coisa. Procurei algum conteúdo sobre isso na internet, em português, e não achei nada muito interessante.
Comment: Se não me engano e igual ao do cocoapods, seja lá qual for
Comment: Eu sei que o [NPM](https://github.com/npm/node-semver) usa a mesma notação. Só não sei se seria pertinente adicinar isso à reposta.
Comment: Realmente, existem subtilidades entre NPM e Composer. [Deviation from npm/semver in tilde range constraint](https://github.com/composer/semver/issues/14).
Answer: Resumo
Considere o modelo de versionamento semântico: MAJOR.MINOR.PATCH
O operador til (~) permite que último digito seja incrementado
~MAJOR.MINOR.PATCH  >=MAJOR.MINOR.PATCH e < MAJOR.(MINOR+1).0

Ou seja, todos os PATCHs da versão MAJOR.MINOR
exemplo: ~ 1.2.3 irá corresponder a todas os PATCHs lançados depois da versão 1.2.3. >1.2.3 e <=1.3.0
Outros exemplos:
"vendor/package": "~1.3.2", // >=1.3.2 <1.4.0
"vendor/package": "~1.3", // >=1.3.0 <2.0.0

O operador circunflexo (^)  procura a versão maior (MAJOR) mais recente.
Há uma exceção se a versão maior é zero. Neste caso o comportamento é buscar até a versão menor mais recente. Essa exceção existe para respeitar a regra 4 do versionamento semântico:

No início do desenvolvimento, a versão Maior DEVE ser zero (0.y.z). Qualquer coisa pode mudar a qualquer momento. A API pública não deve ser considerada estável."

exemplo: ^ 1.2.3 corresponderá a qualquer versão 1.x.x, incluindo 1.3.0, mas suspenderá no 2.0.0.
Outros exemplos
"vendor/package": "^1.3.2", // >=1.3.2 <2.0.0
"vendor/package": "^0.3.2", // >=0.3.2 <0.4.0 // exceção se a versão maior (MAJOR) é 0

Explicando os exemplos da questão:
"orchestra/testbench" : "^3.6" - indica que pacote tem uma dependência com esta biblioteca e garante a compatibilidade com todas a versões igual ou superiores à versão 3.6, mas menores que a versão 4.minor
"phpunit/phpunit"    : "~7.0" - indica que pacote tem uma dependência no mínimo igual a 7.0, mas permite todos os 7.minor.patch
Documentação
Segundo a documentação do Composer:

Tilde Version Range (~)
The ~ operator is best explained by example: ~1.2 is equivalent to >=1.2 <2.0.0, while ~1.2.3 is equivalent to >=1.2.3 <1.3.0. As you can see it is mostly useful for projects respecting semantic versioning. A common usage would be to mark the minimum minor version you depend on, like ~1.2 (which allows anything up to, but not including, 2.0). Since in theory there should be no backwards compatibility breaks until 2.0, that works well. Another way of looking at it is that using ~ specifies a minimum version, but allows the last digit specified to go up.
Caret Version Range (^)
The ^ operator behaves very similarly but it sticks closer to semantic versioning, and will always allow non-breaking updates. For example ^1.2.3 is equivalent to >=1.2.3 <2.0.0 as none of the releases until 2.0 should break backwards compatibility. For pre-1.0 versions it also acts with safety in mind and treats ^0.3 as >=0.3.0 <0.4.0.
This is the recommended operator for maximum interoperability when writing library code.

Traduzindo:
Faixa de Versão com operador Til (~)
O operador ~ é melhor explicado pelo exemplo: ~ 1.2 é equivalente a> = 1.2 <2.0.0, enquanto que ~ 1.2.3 é equivalente a> = 1.2.3 <1.3.0. Como você pode ver, é mais útil para projetos que respeitam versões semânticas. Um uso comum seria marcar a versão secundária mínima da qual você depende, como ~ 1.2 (que permite qualquer coisa até, mas não incluindo, 2.0). Como, em teoria, não deve haver intervalos de compatibilidade com versões anteriores até o 2.0, isso funciona bem. Outra maneira de ver isso é que usar ~ especifica uma versão mínima, mas permite que o último dígito especificado suba.
Faixa de Versão com operador Circunflexo(^)
O operador ^ se comporta de maneira muito semelhante (ao operador ~), mas fica mais próximo de versões semânticas e sempre permitirá atualizações sem interrupções. Por exemplo, ^ 1.2.3 é equivalente a> = 1.2.3 <2.0.0, já que nenhum dos lançamentos até o 2.0 deve quebrar a compatibilidade com versões anteriores. Para as versões pré-1.0, ele também atua com a visando a segurança e trata ^ 0.3 como> = 0.3.0 <0.4.0.
Este é o operador recomendado para máxima interoperabilidade ao escrever o código da biblioteca.


Vue app custom scss file - change font across entire app?

Question: I'm trying to change the app across the entire vue app, I have a custom scss file that is imported into main.ts in the app. So far I have this but don't think its working any suggestions?
$theme-colors: (
  "primary": #5e72e4,
);
$vue-slider-mark-label: (
  "font-size": 18px,
);

@import url('https://fonts.googleapis.com/css?family=Montserrat&display=swap');

$body-font-family: 'Montserrat';
$font-size-root: 14px !default;

v-app {
  font-family: $body-font-family !important;
}

@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/bootstrap-vue/src/index.scss";

Comment: also tried: @import url("https://fonts.googleapis.com/css?family=Maven+Pro:400,500,700,900&display=swap");
$body-font-family: "Maven Pro" !important;
Answer: What you trying to do can be achieved by importing your google font inside of your


Mostrar dias da semana

Question: Montei esse código para mostrar o dia da semana. Funciona, mas gostaria de saber se tem outro jeito com menos linhas/comandos que poderia usar. Ou um jeito mais 'limpo' por assim dizer.
import datetime

# Pega a data atual
dia = datetime.date.today().day
ano = datetime.date.today().year
mês = datetime.date.today().month
sem = ("Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo")
ds = ("Segunda", "Terça", "Quarta", "Quinta", "Sexta")

# Verifica que dia é hoje de acordo com o padrão de data em inglês ex:(2021/05/10)
num = datetime.date(ano, mês, dia).weekday()
p = (sem[num])

# De acordo com o número que 'p' tiver, é setado um dia da semana conforme o correspondente na lista 'ds'
# 'ds' é abreviação de Dias da Semana

# Verifica se o dia atual é dia útil, se não for é considerado 'fim de semana'
if p in ds:
    h = 'dia de semana'
else:
    h = 'fim de semana'

# Termina o código mostrando que dia é hoje
if h == 'dia de semana':
    print(f"Tenha uma boa {sem[num]} =D")
else:
    print(f"Tenha um bom {sem[num]} =D")

Answer: Primeiro, não tem porque usar datetime.date(ano, mês, dia) se já esta usando today()
E para checar se é sábado ou domingo basta checar se o valor de weekday é maior que 4, se for menor que 5 é dia de semana, não precisa de num in (5, 6) (tuple) e nem de num in {5, 6} (set), basta fazer num < 5, já que como disse, os "finais" são 5 e 6, então você sabe que os dias "de semana" são de 0 a 4:

Valor
Dia da semana

0
Segunda

1
Terça

2
Quarta

3
Quinta

4
Sexta

5
Sábado

6
Domingo

Usando a própria biblioteca que já esta usando em seu código:
from datetime import date

num = date.today().weekday()

sem = ("Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo")

if num < 5:
    print(f"Tenha uma boa {sem[num]}-feira =D")
else:
    print(f"Tenha um bom {sem[num]} =D")

Comment: Caramba, como compliquei uma coisa tão simples de fazer kkkkk Agradeço a ajuda mano<3
Answer: Tem bastante código não utilizado no seu algoritmo. Pelo que deu pra entender você quer dar um print em "Tenha uma boa XXX-Feira" ou "Tenha um bom Sábado/Domingo" mas você cria e não utiliza variáveis ou cria desnecessariamente.
Um exemplo de como poderia ser feito mais concisamente:
from datetime import date

dia_semana = date.today().weekday()
nomes = ("Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo")

if dia_semana in {5, 6}:
    print(f"Tenha um bom {nomes[dia_semana]} =D")
else:
    print(f"Tenha uma boa {nomes[dia_semana]} =D")

Como você não vai usar o objeto "hoje" criado com date.today(), não estou salvando em lugar nenhum pois só preciso qual é o dia da semana. Depois basta checar se é fim de semana e printar o nome correto.
Comment: Sou iniciante ainda em programação, por isso essa bagunça no meu código kk mas a sua resolução me ensinou mt, obrigado msm
Answer: Sim, dá para ser mais simples.
Veja que você cria 3 vezes a data de hoje (date.today() é chamado 3 vezes), mas só precisaria chamar uma vez.
E depois você pega o dia, mês e ano da data de hoje e cria outro date com esses valores. Pra que? date.today() já retorna um date com exatamente esses valores, então é completamente desnecessário criar outra data com o mesmo dia, mês e ano.
E para formatar a data, basta usar strftime, usando o formato "%A" que corresponde ao dia da semana (veja mais sobre os formatos na documentação). E para que esteja em português, você precisa setar o locale:
import locale
# setar locale para português
locale.setlocale(locale.LC_ALL, 'pt_BR.utf8')

from datetime import date

hoje = date.today() # data de hoje
if hoje.weekday() in (5, 6): # se o dia da semana é sábado ou domingo
    msg = 'um bom'
else:
    msg = 'uma boa'

print(f'Tenha {msg} {hoje.strftime("%A").title()} =D')

Como weekday() retorna um número entre 0 e 6 (sendo segunda=0, terça=1, ..., sábado=5, domingo=6), basta usar este valor para verificar se é fim de semana ou não. Depois você seta a mensagem de acordo, e use strftime para obter o nome do dia da semana. Também usei title() porque o dia da semana estava sendo retornado com letra minúscula.
E também criei outra variável para a parte que varia ("um bom"/"uma boa"), aí eu só imprimo a mensagem uma única vez (como parece ser sempre a mesma mensagem, mudando apenas esses detalhes, achei melhor assim).

Vale lembrar que para o código acima funcionar, o locale pt_BR deve estar instalado no sistema, conforme explicado aqui (neste link também explica como verificar isso).
Mas caso o locale não esteja instalado (e você não quer/não sabe como instalar), aí o jeito é ter a lista de nomes mesmo:
from datetime import date

nomes = ["Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"]
ds = date.today().weekday()
if ds in (5, 6): # se o dia da semana é sábado ou domingo
    msg = 'um bom'
else:
    msg = 'uma boa'

print(f'Tenha {msg} {nomes[ds]} =D')

Comment: No fim minha resposta nem é mais necessária, a sua explica mais e acabamos com um código quase igual. hahahaha
Comment: @fernandosavio Eu só respondi pra falar sobre `strftime`, que a sua não tinha. Mas acho que não precisa apagar a sua não, até porque vc respondeu antes...
Comment: Por incrível q pareça, com o uso do locale, vc acaba de me ajudar em outro código que dava erro 'non-utf8' KKKKKK e ainda de quebra me ajudou com esse código, nem sei como agradeçer <33333
Answer: Como responderam, você pode usar o weekday para buscar na tupla, sendo 0 segunda e 6 domingo.
    from datetime import date
    diadasemana = ('Segunda', 'terça', 'quarta', 'quinta', 'sexta', 'Sábado',
    'Domingo')
    print("fim de semana" if (diadasemana[date.today().weekday()]) in (5, 6) else "dia
    de semana")
    print(f'Tenha uma boa {diadasemana[date.today().weekday()]} :)!')

Comment: Gostei de como usou o if e else na mesma linha, ficou bem limpo de ver kkk vlw a ajuda mano =D
Comment: @Nerean O problema é que ele está verificando se `diadasemana[date.today().weekday()]` é 5 ou 6 (ou seja, se o **texto** é 5 ou 6, e nunca será, pois os textos são "Segunda", "Terça", etc). O certo é ver se o valor do `weekday` é 5 ou 6: `if date.today().weekday() in (5, 6)`. E também não haveria necessidade de chamar `date.today().weekday()` duas vezes, esse é um caso em que valeria a pena guardar o valor em uma variável (não vale a pena "economizar uma linha", sendo que pra isso vc teve que criar o mesmo objeto duas vezes)
Comment: Opa, testei ontem e hoje. Está correto :) Não estou buscando o texto, qdo coloco date.today().weekday dentro da chave, estou to indo na tupla diadasemana e pegando o índice dela pra validar meu "if". Abs
Comment: @CristianoMenezesSilva Eu sugiro que teste no sábado ou domingo então, e aí vai entender o que eu disse: vc verifica se `diadasemana[date.today().weekday()]` é 5 ou 6 (faça `print(diadasemana[date.today().weekday()])` e veja que ele imprime o texto, não o índice, então o `if` está vendo se o **texto** é 5 ou 6, portanto vai falhar no fim de semana). Na verdade nem precisa esperar pelo fim de semana, basta trocar `date.today()` por `date(2021, 5, 15)` (sábado) e veja o que acontece (vai dizer que é dia de semana, e não fim de semana).
Comment: Outro detalhe é que faltou ajustar o texto "uma boa" para "um bom" quando for sábado ou domingo (ou seja, ficará "Tenha um**a** bo**a** Domingo")
Comment: Show!! Muito obrigado pela resposta! :) abs

Mostrar dias da semana


Difference between DL380 rails for different generations?

Question: I just got an HP Proliant DL380 G5 server (it's actually Cisco branded, but I don't think that matters), without the rack rails. I'm trying to learn some server architecture and use it as a basic server. I am looking for some rails to mount it in my rack.
What are the differences of the rails between generations? I see a lot of G6 rails with the cable management arm for sale; is it backward compatible with the G5? Or, do I need to seek out a G5 rail specifically?
If the differences are minor enough, could I simply mod the rails? (e.g. drill my own holes).
Comment: There are actually a number of different rails and rail kits for that model of HP.  What's the part number of the rails in question?
Answer: HP DL380 Rail Kits:
G1 327310-001
G2 228894-B21
G3 300605-001
G4 359254-001
G5 359254-001
G6 574765-001
G7 616992 001
G8 663480-B21 (LFF) or 663478-B21 (SFF)
Note: only G4 and G5 are the same.
Comment: I'd highly recommend against drilling holes in the chassis. Also, local resellers typically haves piles of rails sitting around they'd love to get rid of.
Answer: I would just pick up a third-party rail kit at this point. Otherwise, get the G5 specific rails from eBay. They are not interchangeable between recent generations.
See: http://www.racksolutions.com/hp


Cannot instantiate interface DrupalStreamWrapperInterface

Question: I am trying to replace drupal_realpath with realpath. What I did is
$stream_wrapper = new DrupalStreamWrapperInterface();
$file_path = $stream_wrapper->realpath($img_path);

But it gives me this error: Cannot instantiate interface DrupalStreamWrapperInterface. Any idea how do I use DrupalStreamWrapperInterface::realpath?
Answer: The error is because you are trying to create an object of a PHP Interface, which is not allowed in PHP. You can only create objects from a PHP Class.
To solve your issue, something like this might work:
$wrapper = file_stream_wrapper_get_instance_by_uri($img_path);
if (is_object($wrapper)) {
  $file_path = $wrapper->realpath();
}


Way to support Cert and non Cert traffic at Istio

Question: My Istio Ingress Gateway is configured in tls mode MUTUAL, and is decrypting traffic so that I can do http based routing for different services based on a query param in the http request.
I have a scenario where I need to support both Cert based and AAD based authentication. AAD Auth is being taken care at the service side, I just need to ensure I pass through traffic with Authorization header as it is (without terminating them even if they do not have a certificate) and authenticate cert based requests as well.
Similar to this issue : https://github.com/istio/istio/issues/25067
Any pointers on required config?
Comment: Can you give an example of what you tried already? Setting tls mode to `PASSTHROUGH` may help here.
Answer: Configuring TLSMode to SIMPLE at the gateway solved the problem. To Ensure we still validate client certificate, we have put some custom logic in code.


Index gymnastics with the Riemann tensor

Question: We would like to obtain the Ricci tensor from the Riemann tensor.
In most books are contracted the first index with the third one, the second index with the fourth one. Following the same convention, I have obtained these identities. $$g^{ia}g^{lm}{R^k}_{lam}=g^{ia}{R^k}_a=R^{ik}$$ $$g^{im}g^{la}{R^k}_{lam}=-g^{im}g^{la}{R^k}_{lma}=-g^{im}{R^k}_m=-R^{ik}$$ Are they correct?
Answer: I am not sure why you want the Ricci tensor to have upper indices. If you don't insist on that, but use the more natural version with two lower indices,things become easier: You have to contact the (unique) upper index into one of the two-form indices of the curvature. (Here I am using the interpretation that the Riemann tensor is a two-form with values in endomorphisms of the tangent bundle, which evan available for linear connections without a Riemannian metric.) This fixes Ricci up to sign. The sign is indeed a subtle issue and needs writing out the conventions you use for the Riemann-tensor.
Comment: In the context, the final result is in the $R^{ik}$ form.
Comment: This may be the case, but then just form the Ricci as I have described it and then raise the two lower indices with an inverse metric.


Id class membership in R poLCA

Question: I am running a latent class analysis in R with and all runs fine and I get my final class model. Now I need to look at class membership, so I used the following code:
<code>  round(lca.raq2 $posterior[1:3413,],2)
</code>
The problem is R eliminated cases from my original file (potentially problem cases for the model?) so I have no way of identifying which probabilities correspond to each case in my original database.
Is there anyway to include my id_variable in the $posterior command??
I tried merging the ID with the dataset produced by poLCA but it doesn't merge and gives me this error:

merge(lca.raq, homdata$idnumber)
  Error in as.data.frame.default(x) :
    cannot coerce class '"poLCA"' to a data.frame

Any suggestions are welcome - I really need to be able to identify the specific cases in each class to run further analysis with the classes.
Comment: From the documentation it seems na values are removed. Possibly your dataset contains missing if null values. In this case `homdata[complete.cases(homdata),]` would be the data used during estimation.
Answer: you can get the row names from lca.raq2$y. Like @Oliver said, NA values are taken out, so you are left with a subset of your values. You can see below example to see how to get the id or observation names out. I suggest naming the rows of your input data after your id.
<code>library(poLCA)
set.seed(123)
data(values)
#introduce some random NAs
# here it set the rownames of the matrix to be id
# in your case it might be homdata$idnumber
rownames(values) = paste("row",1:nrow(values),sep="")
for(i in 1:ncol(values)){
 values[sample(1:nrow(values),10),i]<-NA
 }
 f <- cbind(A,B,C,D)~1
M1 <- poLCA(f,values,nclass=2)

POST = round(M1$posterior,2)
rownames(POST) = rownames(M1$y)

# we can check that the rownames of posterior values are indeed those complete values in original data
table(rownames(values)[complete.cases(values)] == rownames(POST))
TRUE
 183
</code>

Id class membership in R poLCA


Has a team in a multi-stage cycling races ever had to drop out because they no longer met a minimum racer count requirement?

Question: In the ongoing Tour de France, UAE Team Emirates only has 4 cyclists remaining: their lead racer Pogacar and 3 of his team mates. I'm wondering: is there a minimum racer count requirement for competing teams in the Tour de France (or any other significant multi-stage race)? And did any team ever have to drop out because they no longer met that requirement?
Answer: Essentially, no - riders race as individuals, the team is just for tactics and support and has no direct bearing on the results.
The exception to this is the (now dropped from the Tour de France) team time trial, where a team needed (I think) at least 5 riders to finish the stage. However, to avoid any issues with this the team time trial was always run in the first week of the race when it was incredibly unlikely that a team would have fewer than 5 riders available.
Comment: _Whenever a team has less than 5 riders to compete in the TTT, the time of the final rider counts._, from [What happens with a team time trial when a team does not have enough riders?](https://sports.stackexchange.com/a/10660/11439)
Comment: What do you mean by "(now dropped from the Tour de France)", have they said they'll never have one again?


rawurlencode() and urlencode() not working in CodeIgniter

Question: I am trying to encode a string into a safe url for generic purposes, and neither rawurlencode() nor urlencode() work when using CodeIgniter. I have used them and they work pefectly fine with straight PHP, but for whatever reason, it doesn't work. I haven't been able to find any others with this problem and thus no solution.
Code:
<a href="/search/degree/<?=rawurlencode($row->degree)?>" class="element_link"><?=$row->degree?>

It just gets passed as plain text with spaces unescaped and everything.
I was expecting the outcome I was able to get with this:
<?php echo rawurlencode('http://kchason.com'); ?>

Merited: http%3A%2F%2Fkchason.com
But:
<a href="/search/degree/<?=rawurlencode($row->degree)?>" class="element_link"><?=$row->degree?>
Gives me for example: 'localhost/http://kchason.com' which obviously isn't safe and doesn't work.
Comment: Want to post a code sample so we can see what context this is happening in? both are built in php functions and CI does not interfere with straight PHP, so I would guess you're not passing it a string where you would notice a difference... without seeing the example, that is.
Comment: Please define "don't work". What is the output of the above snippet and what would you expect?
Comment: Some reasons? just one: your code; somewhere in your code you're doing something not right, because CI or not, those are native php functions and CI is built USING php, it's not an alternative php interpreter with its own rules. Are you sure you're not calling it inside a CI's url helper?
Comment: `rawurlencode('http://kchason.com')` correctly gives me `http%3A%2F%2Fkchason.com`. Your link is supposed to point to `/search/degree/...`, but your example says `localhost/...`. Are you sure you're looking at the right link?
Comment: Yes, I have done it properly in other capacities, but for some reason, with CI, it is no longer working.
Comment: I am aware that it is a PHP framework and thus should not affect the native PHP functions. In terms of your url helper comment, I have the url helper autoloaded but it is not called at this time. Does that have something to do with it?
Comment: Something else I found: `$website_link = rawurlencode($website);` merits the correct output and when I echo it in plain text it works. But when I try to use it in an anchor tag `">$website` It creates a link without the encoding.
Comment: We need a bit more context to see what is going on here. Can you provide us more of the code?  echo out `$row->degree` and `rawurlencode($row->degree)` by themselves and let us see the output.
Answer: I know this is an old question. But I was dealing with the same issue. What I have done is:
Encode
<?php echo urlencode(base64_encode('http://kchason.com')); ?>

Decode
<?php echo urldecode(base64_decode('http://kchason.com')); ?>

You use base64_encode to get rid of any URL parts that will cause problems with Codeigniter, and then you use urlencode to encode any = that base64_encode adds to the end of its output.
Comment: `base64_encode` still creates `==` at the end of some strings and `urlencode` swaps it with `%3D%3D` which contains `%`, a problematic CI character. So I don't think this is the correct answer.


Problem understanding a solenoidal vector field that is not a curl.

Question: Problem
In Apostal's calculus volume 2 , there is an example which shows that a solenoidal vector field that is not a curl. Example states that proof is difficult at this stage . Can anyone please me some understanding why this can happen. That is on what kind of open sets a solenoidal vector field is always a curl of some other vector field in that set?
NB-Currently a sophomore .
Comment: Can you share Apostol's example of the solenoidal vector field that is not a curl? (P.S. Apostol is also misspelled in the question.)
Comment: @hardmath thanks for pointing that out.
Answer: I suppose that a solenoidal field is defined as a field whose divergence is null.
The Poincaré Lemma says  that a divergence-free field is the curl of some vector field only if it is defined on a contractible set. ( You can see : What does it mean if divergence of a vector field is zero? )
A classical example is the field:
$$
\bf {V} = \left(\frac{x}{\left(\sqrt{x^2+y^2+z^2}\right)^3},\frac{y}{\left(\sqrt{x^2+y^2+z^2}\right)^3},\frac{z}{\left(\sqrt{x^2+y^2+z^2}\right)^3} \right)
$$
that is divergence-free but not a curl of any vector field.
Comment: I think there is a slight mistake: the divergence of your $V$ is $2/||(x,y,z)||$. However, $V = (x,y,z)/||(x,y,z)||^3$ does the job.
Comment: Thank you @AlexProvost. I forgot an exponent !  I edit :)


Kue - TypeError: Cannot read property 'zcard' of null

Question: TypeError: Cannot read property 'zcard' of null
    at Queue.card (/Users/narain/Sites/integrity-automation/node_modules/kue/lib/kue.js:513:14)
    at Queue.inactiveCount (/Users/narain/Sites/integrity-automation/node_modules/kue/lib/kue.js:616:17)
    at _ (/Users/narain/Sites/integrity-automation/node_modules/kue/lib/http/routes/json.js:318:19)
    at exports.stats (/Users/narain/Sites/integrity-automation/node_modules/kue/lib/http/routes/json.js:41:3)
    at Layer.handle [as handle_request] (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/route.js:131:13)
    at /Users/narain/Sites/integrity-automation/node_modules/kue/lib/http/middleware/provides.js:11:36
    at Layer.handle [as handle_request] (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/layer.js:95:5)
    at /Users/narain/Sites/integrity-automation/node_modules/express/lib/router/index.js:277:22
    at Function.process_params (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/index.js:330:12)
    at next (/Users/narain/Sites/integrity-automation/node_modules/express/lib/router/index.js:271:10)
    at SendStream.error (/Users/narain/Sites/integrity-automation/node_modules/serve-static/index.js:120:7)
    at emitOne (events.js:77:13)
    at SendStream.emit (events.js:169:7)
    at SendStream.error (/Users/narain/Sites/integrity-automation/node_modules/send/index.js:245:17)
    at SendStream.onStatError (/Users/narain/Sites/integrity-automation/node_modules/send/index.js:356:12)
    at next (/Users/narain/Sites/integrity-automation/node_modules/send/index.js:630:16)
    at onstat (/Users/narain/Sites/integrity-automation/node_modules/send/index.js:619:14)
    at FSReqWrap.oncomplete (fs.js:82:15)

I 'm getting this error pretty consistently under the following conditions:

Have kui-ui dashboard open in a browser window
perform graceful shutdown

I'm not certain if it is expected for Queue.client to be null. If it is, then Queue.prototype.card should first check if this.client exists before calling this.client.card. Same with Queue.prototype.cardByType
Here's my api route dashboard/stop code (i.e., stops the process and flush the cache):
exports.stop = function(success, failure) {

  let shutdown = new Promise((resolve, reject) => {
    debug('shutting down queue');
    queue.shutdown().then(() => {
      client.flushdb(); // flushing the redis server
      debug('redis is flushed');
      resolve({success: true});
    },
    (err) => {
      reject(err);
    });
  });

  return shutdown;

};

Note: queue is an instance of Kue and client is of redis:
let queue = require('kue').createQueue({prefix: '', redis: config.get('redisurl'), jobEvents: false});

let client = require('redis').createClient({
  'url': config.get('redis') // redis-url
});

Same question (issue) have also been raised on github:

https://github.com/Automattic/kue/issues/825
https://github.com/StreetHub/kue-ui/issues/23

And have no response yet..
Any Idea/thoughts! How to get this fix..?
Answer: Issue was causing because of Queue.prototype.shutdown implementation destroy client (i.e., redis) instance that's why when it call Queue.prototype.cardand Queue.prototype.cardByType then it throws that error..
As for as my aim was to somehow stop (pause) the queue process and then resume it again.. so i have done something like that instead of using Queue.prototype.shutdown i have rather used Worker.prototype.shutdown which pauses the worker's (process)..
queue.js (sample):
this.queue = kue.createQueue({prefix: opts.prefix, redis: opts.redis, jobEvents: false, disableSearch: false}); // kue instance

stopAllWorkers() {
    return new Promise((resolve, reject) => {
      var length = this.queue.workers.length;
      this.queue.workers.forEach((worker) => {
        worker.shutdown(() => {
          if (--length === 0) {
            resolve();
          }
        });
      });
    });
  }

serverRunner.js (sample):
var queue = require('./queue');

exports.start = function(success, failure) {
    // resume the queue process
}

exports.stop = function(success, failure) {
  return new Promise((resolve, reject) => {
    queue.removeAllListeners();
    queue.stopAllWorkers().then(() => {
      debug('Queue All workers stopped!!');
      resolve({success: true});
    });
  });
};

That's it!
Hope this help others!!
Cheers.


In triangle ABC, Find $\tan(A)$.

Question:
In triangle ABC, if $(b+c)^2=a^2+16\triangle$, then find $\tan(A)$ . Where $\triangle$ is the area and a, b , c are the sides of the triangle.

$\implies b^2+c^2-a^2=16\triangle-2bc$
In triangle ABC, $\sin(A)=\frac{2\triangle}{bc}$, and $\cos(A)=\frac{b^2+c^2-a^2}{2bc}$,
$\implies \tan(A)=\frac{4\triangle}{b^2+c^2-a^2}$
$\implies \tan(A)=\frac{4\triangle}{16\triangle-2bc}$. But the answer is in the form, $\frac{x}{y}$ where $x$ and $y$ are integers.
Any help is appreciated. Thanks in advance.
Comment: What is given? All the sides a,b and c?
Comment: yes sides are given a, b ,c
Answer: $$b^2+c^2-a^2=16\Delta - 2bc \Rightarrow \frac{b^2+c^2-a^2}{2bc}=\frac{8\Delta}{bc}-1 \Rightarrow \cos A=4\sin A-1$$
$$\Rightarrow 2\cos^2\frac{A}{2}-1=8\sin\frac{A}{2}\cos\frac{A}{2}-1 \Rightarrow \tan\frac{A}{2}=\frac{1}{4}$$
Hence,
$$\tan A=\frac{2\cdot \frac{1}{4}}{1-\frac{1}{4^2}}=\boxed{\dfrac{8}{15}}$$
Answer: HINT:
$$16\triangle=(b+c+a)(b+c-a)$$
$$\iff16rs=2s(b+c-a)$$
$$8r=b+c-a$$
Using this and $a=2R\sin A$ etc.,
$$8\cdot4R\prod\sin\dfrac A2=2R\cdot4\cos\dfrac A2\sin\dfrac B2\sin\dfrac C2$$
$$\implies4\sin\dfrac A2=\cos\dfrac A2$$  as $0<B,C<\pi,\sin\dfrac B2\sin\dfrac C2\ne0$
Answer: You have: $\dfrac{\sin A}{\cos A} =\tan A = \dfrac{4\triangle}{16\triangle - 2bc} = \dfrac{2bc\sin A}{8bc\sin A-2bc} = \dfrac{\sin A}{4\sin A-1} \Rightarrow \cos A = 4\sin A -1 \Rightarrow \cos^2A = \left(1-4\sin A\right)^2 = 1 - 8\sin A + 16\sin^2A \Rightarrow 1 - \sin^2A = 1 - 8\sin A + 16\sin^2A \Rightarrow \sin A\left(8 - 17\sin A\right) = 0 \Rightarrow \sin A = 0 \text{ or} \text{ }\sin A = \dfrac{8}{17}$. But $\sin A > 0$, so $\sin A = \dfrac{8}{17} \Rightarrow \cos A = 4\sin A -1  = 4\cdot \dfrac{8}{17} - 1 = \dfrac{15}{17} \Rightarrow \tan A = \dfrac{\dfrac{8}{17}}{\dfrac{15}{17}} = \dfrac{8}{15}$.
Comment: The step where you equated $4 \sin(A)-1$ and $\cos(A)$ was a real trick!
Answer: We have $16\triangle=(b+c+a)(b+c-a)$
$\iff16r\cdot s=2s\cdot2(s-a)$ where $r$ is the in-radius & $2s=a+b+c$
Using this, $\tan\dfrac A2=\dfrac r{s-a}=\dfrac14$
Finally use $\tan2x$ formula

In triangle ABC, Find $\tan(A)$.


Adding id automatically on adding products to array

Question: I am trying to build an ec-ommerce website so the issue i am facing is that when in my form i am entering my values then on clicking the save button my values are being adding in an empty array which is declared in my services but i  also want to add id automatically to each product when it gets added to the array in the  services .How do i do that ?
html file

 <form (ngSubmit)="onsubmit()" #f="ngForm">

 <input mdbInput type="text" class="form-control"
 id="formGroupExampleInputMD" placeholder="Title"
 ngModel name="title" required #title="ngModel"
 >

<input mdbInput type="text" class="form-control"
id="formGroupExampleInput2MD" placeholder="Price"
ngModel name="price" required #price="ngModel">

<select class="browser-default custom-select"
ngModel name="select" required #select="ngModel">
  <option value=""></option>
  <option *ngFor="let c of category|async" [value]="c.$key"> .
{{c.name}}</option>
</select>

  <input mdbInput type="text" class="form-control"
id="formGroupExampleInput2MD" placeholder="imageurl"
  ngModel name="imageurl" required #imageurl="ngModel"
  >

<button type="submit" mdbBtn color="primary"
mdbWavesEffect>Save</button>

</form>

component.ts
import { Component, OnInit, ViewChild } from '@angular/core';
import { CategoryserviceService } from
'src/app/sevices/categoryservice.service';
import { NgForm } from '@angular/forms';

@Component({
selector: 'app-newproducts',
templateUrl: './newproducts.component.html',
 styleUrls: ['./newproducts.component.scss']
})
export class NewproductsComponent implements OnInit {
@ViewChild('f') form:NgForm
category
constructor(private ctservice:CategoryserviceService) {

}

ngOnInit() {

 }
 onsubmit(){
// console.log(this.form.value)
this.ctservice.addtocards(this.form.value)

}

}

service file
import { Injectable } from '@angular/core';

@Injectable({
providedIn: 'root'
})
export class CategoryserviceService {
cards:any[]=[]

constructor() {

}

addtocards(values){
this.cards.push(values)
console.log(this.cards)
}

}
Answer: If you want to add some unique id to each item, you can make use of the length of the cards array.
addtocards(values){
values['id'] = this.cards.length;
this.cards.push(values)
console.log(this.cards)
}

So, initially the length is 0. So, it becomes the id for the first product.
For nth product, the id would be n - 1


Create RSS feed for content type = news?

Question: I created a content type called news items in drupal 7.  How do I tell D7 to create an RSS feed of ONLY news items?
When I go to /rss.xml, it displays all content types, which is too much.  I only need news items.
Answer: You can use the Views module to create feeds.  Simply add a new display of type "Feed" and customize the view to contain only the content you want.  Be sure to choose a path for your feed so that it can be accessed.
To add a "Feed" display:
Go to your views administration and select the view you want to edit. Towards the top of the page you will see the "Displays" heading with an "+ Add" button.  Click that and select "Feed" (See image below).  You will then have a Feed display that is using the Default Display's settings.
Comment: I already have a view that pulls news, but I forgot to include an RSS feed.  How do I edit the view to include one now?  I don't see that option when editing
Comment: oh i see it now.  Afte ryou edit view, there's an "Add" button beside the "Page" underneath "Display" header.  Use it.
Comment: Yep, just made an edit describing how
Comment: Thanks, but can you tell how images can be handled here?, because i'm not able to get image field data in the rss feeds.


Gaussian Process predictive gradient with GPML

Question: Given a Gaussian Process $f(x) = \mathcal{GP}\big( m(x), k(x,x') \big)$ with $x\in\mathbb{R}^d$, I would like to calculate $\mathbb{E}\left[ \frac{\partial f}{\partial x_i} \right]$; that is, the $i^\mathrm{th}$ coordinate of $\mathrm{grad} f$.
For short, I use the notation $\partial_i \bullet$ for the $i^\mathrm{th}$ gradient coordinate below. Following the GPML book by Rasmussen and Williams p.16, I think this can be done as follows:
$$
\mathbb{E}\left[ \partial_i f_*\ \big| X, f, X_* \right]
  = \partial_i \mathbb{E}\left[ f_*\ \big| X, f, X_* \right]
  = \partial_i K(X_*, X) K(X,X)^{-1} f
$$
where $X$ are coordinates with known function values $f$, $X_*$ is a matrix of coordinates with unknown function values $f_*$, and we want the $i^\mathrm{th}$ coordinate of the gradient at these points $\partial_i f_*$.
In short, we simply need the derivative of the covariance function with respect to that coordinate. For example with the (isotropic) squared-exponential covariance:
$$
\partial_i k_\mathrm{SE}(x,x')
  = \partial_i k_\mathrm{SE}(r = \|x -x'\|_2)
  = -\frac{2r (x_i - x_i')}{L^2}\exp\left(-\frac{r^2}{2L^2}\right)
$$
I was able to program this, but I don't want to reinvent the wheel and it seems likely that there would be a way to compute this with the GPML toolbox already. The help for covFunctions indicates that the second output dK is the "linear directional derivative function", which can apparently be called with dK(Q); but I am not sure what this means, or how to use it. Hence my questions:
Q1. Is it correct that the gradient of a GP with respect to its variables (not its parameters, as often found elsewhere in the context of GP training) is simply obtained as above, given the gradient of the covariance function?
Q2. How can one obtain these predictions using the GPML toolbox (if at all possible)?
Comment: have you found your answer how to do this? Or did you find that you just don't need it? :-)
Answer: First, let's start with a note: you call X matrix of "coordinates"; these are rather covariates, in general.
Next, you came to the $\partial_i K(X_*, X) K(X,X)^{-1} f$, which seems correct. But in the further text you are just considering the derivation of $K$, while you still need the derivation of $K^{-1}$ and $f$ as well, which I guess will be much more complicated.
So the answer to Q1 is NO, you are still missing much more pieces of the equation.
Regarding the Q2 and the $\partial K \over \partial x_i$ (i.e. your $\partial_i k(x,x')$) ... first, I cannot wrap my head around this, it seems like there is some principial problem there... since when you derive $k(x,x')$ by $x$ then by which $x$: $x$ or $x'$? Second, I am not user of gpml and matlab, but every GP software package needs to have  implemented $\partial K \over \partial l_i$ (you can e.g. see the R implementation here) but I doubt it has implemented the $\partial K \over \partial x_i$, because of the difficulties I mentioned in the previous points.
EDIT: Q2: I actually found the computation of $\partial K \over \partial x_i$ ! Not in GPML, but in another Matlab software, GPstuff: see function gpcf_exp_ginput():
%    DKff = GPCF_EXP_GINPUT(GPCF, X) takes a covariance function
%    structure GPCF, a matrix X of input vectors and returns
%    DKff, the gradients of covariance matrix Kff = k(X,X) with
%    respect to X (cell array with matrix elements). This subfunction
%    is needed when computing gradients with respect to inducing
%    inputs in sparse approximations.


Windows Server 2008 dropping connections

Question: Possible quite similar to this post but I wonder if someone can help me with this issue.
Home Server specs:
Windows Server 2008 Standard (Non-R2)
2 NICs, external one(Realtek) has a firewall on it. The internal one(Nvidia) runs NAT for my home computers.
Cable modem issuing an internal ip to my server (192.168.178.10)(Modem is not the issue, problem was there before this setup)
The problem is that sometimes programs that require a connection to my server either fail to setup a working connection, or that connections get dropped randomly.
Afflicted programs:
- Mumble(Voice program like teamspeak) - gets disconnected after a few seconds and then reconnects automatically every minute.(reconnecting is a program setting, the disconnecting is not)
- Self programmed apps in VS2010 - Can at first not connect to my SQL Server 2005 DB on the server, but after some time (minutes) they can
- FTP Server on the Server itself - Remote clients can either not log in, or the download stops and the connection gets dropped? after a few seconds of transferring
This problem occurs only with some applications, all other traffic like Squeezebox, file transfer, RDP and http traffic to the server and the internet from clients works fine.
In the beginning I thought the problem was an incorrect firewall setting, but I have allowed all ports and traffic in the config between server and clients. Now im beginning to suspect NAT of being at fault here, but I don't know for sure.
After examining the problem in the question linked above, I checked my servers config and it looked similar to that one. Can anyone see any problematic settings in the ipconfig below which might explain the problem?
Output ipconfig /all

Windows IP Configuration

Host Name . . . . . . . . . . . . : Server
Primary Dns Suffix  . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : Yes
WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Internet NIC:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : Realtek RTL8169/8110 Family PCI Gigabit E
thernet NIC (NDIS 6.0)
Physical Address. . . . . . . . . : 00-11-6B-97-D8-20
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::4d4e:d07d:1b3:3139%13(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.178.10(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : vrijdag 13 april 2012 10:47:27
Lease Expires . . . . . . . . . . : donderdag 19 april 2012 10:18:21
Default Gateway . . . . . . . . . : 192.168.178.1
DHCP Server . . . . . . . . . . . : 192.168.178.1
DHCPv6 IAID . . . . . . . . . . . : 419434859
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-11-D4-40-5D-00-10-A7-02-20-B3

DNS Servers . . . . . . . . . . . : 188.8.131.52
                                    188.8.131.52
NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Thuisnetwerk NIC:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : NVIDIA nForce 10/100/1000 Mbps Ethernet
Physical Address. . . . . . . . . : 00-24-8C-76-7D-5B
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::29e1:cbe0:aded:4918%11(Preferred)
IPv4 Address. . . . . . . . . . . : 10.10.10.10(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 0.0.0.0
DHCPv6 IAID . . . . . . . . . . . : 268444812
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-11-D4-40-5D-00-10-A7-02-20-B3

DNS Servers . . . . . . . . . . . : 10.10.10.10
NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter Local Area Connection* 8:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : isatap.{76229E8E-F1F4-49AD-83AE-7CD4AABB2
A2B}
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes

Tunnel adapter Local Area Connection* 9:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : isatap.{A2CF8243-DD8B-407C-A8AF-292D0E410
A03}
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes

Tunnel adapter Local Area Connection* 11:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
Physical Address. . . . . . . . . : 02-00-54-55-4E-01
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fd:2454:1613:abe0:cd40(Pref
erred)
Link-local IPv6 Address . . . . . : fe80::2454:1613:abe0:cd40%12(Preferred)
Default Gateway . . . . . . . . . : ::
NetBIOS over Tcpip. . . . . . . . : Disabled

Output route print 0.0.0.0
===========================================================================
Interface List
 13 ...00 11 6b 97 d8 20 ...... Realtek RTL8169/8110 Family PCI Gigabit Ethernet
 NIC (NDIS 6.0)
 11 ...00 24 8c 76 7d 5b ...... NVIDIA nForce 10/100/1000 Mbps Ethernet
  1 ........................... Software Loopback Interface 1
 14 ...00 00 00 00 00 00 00 e0  isatap.{76229E8E-F1F4-49AD-83AE-7CD4AABB2A2B}
 15 ...00 00 00 00 00 00 00 e0  isatap.{A2CF8243-DD8B-407C-A8AF-292D0E410A03}
 12 ...02 00 54 55 4e 01 ...... Teredo Tunneling Pseudo-Interface
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination  Netmask          Gateway       Interface       Metric
0.0.0.0              0.0.0.0          On-link       10.10.10.10     266
0.0.0.0              0.0.0.0          192.168.178.1 192.168.178.10  10
===========================================================================
Persistent Routes:
Network Address      Netmask          Gateway Address               Metric
0.0.0.0              0.0.0.0          10.10.10.10                   Default
===========================================================================

IPv6 Route Table
===========================================================================
Active Routes:
None
Persistent Routes:
None

Comment: all the adapters are set to auto for speed/duplex correct?
Comment: Yes they all have the default values, except the Thuisnetwerk(Internal network) NIC. This one has a static ip of 10.10.10.10 and subnetmask of 255.255.255.0. This is the one that does NAT.
Comment: well auto for speed/duplex has nothing to do with ip address stuff so are the adapters set to auto and the switch ports set to auto?
Comment: Yes its all set to auto negotiate, the connected switch aswell.
Comment: Questions about home systems are off topic on Server Fault - You would do better asking this question on our sister site for enthusiast/home users: [Super User](http://www.superuser.com)
Answer: Try turning off the TCP Chimney and the receive window autotuning.
From an Administrative command prompt:
netsh int tcp set global chimney=disabled

netsh int tcp set global autotuninglevel=disabled

Answer: Hate to say it but have you tried disabling the firewall to eliminate it from the search ? I have had all kinds of crazy issues with the 2008 firewall.
Comment: Yeah that was my first idea aswell, but that didn't solve the problem. The firewall is also not activated on the internal network, so shouldnt even be a problem. I've spent many hours trying to fix the problems with a different firewall setup, but to no avail. I'm thinking of disabling the firewall and NAT on the server totally, and reenabling NAT/Firewall/DHCP on my modem to circumvent the problem.
Comment: Tried doing a pathping to your router from a client or a pingtest.net from a client ?
Comment: Pathping is not showing anything out of the ordinary, 100% succes and all in one hop, like it should be. Pingtest.net shows 15ms, which is good but cant test the packetloss. In the description it is said this might be due to outgoing firewall blocking, which is strange in this case as there shouldnt be any.
Comment: Update of last comment: After updating java it was ok, it now shows 0% loss. Still can't figure out what the problem might be.
Comment: Does the Nvidia adapter have the admin interface if you connect to it ? I have had issues with them in the past.


Matrix for polynomial linear map

Question: I am looking to represent $T(f) = 2f + f'$ as a matrix $B$ with respect to the basis $\{1, 1+x, x^2\}$. I am used to this type of question only when the basis involves vectors in $\mathbb{R}^n$. My guess was to think of the basis $\{1, x, x^2\}$ in terms of the standard $\mathbb{R}^3$ basis.
So the 'change of basis' matrix would be
$C = \begin{bmatrix}1&1&0\\0&1&0\\0&0&1\end{bmatrix}$
and I found that $T(1) = 2(1)$; $T(x) = 1(1) + 2(x)$; $T(x^2) = 2(x) + 2(x^2)$. So according to my earlier guess, the matrix for T with respect to the basis $\{1, x, x^2\}$ is
$A = \begin{bmatrix}2&1&0\\0&2&2\\0&0&2\end{bmatrix}$
Which gives me the answer
$B = C^{-1}AC = \begin{bmatrix}2&5&2\\0&2&2\\0&0&2\end{bmatrix}$
Is this correct and do I have the right/wrong idea?
Comment: [Actually](https://math.stackexchange.com/q/3499836/242) $3^{11}\not\equiv -1$ (typo), but still $3^{22}\equiv 1.\ $ I coudn't fix it because you deleted it. Also $\, 1541 = 23(67)\,$ is not prime.
Comment: If you undelete it I can show you a simple way.
Answer: I do not think you have taken the conjugate correctly, as you should obtain
$$
B
=
C^{-1}AC
=
\begin{bmatrix}
2 & 1 & -2\\
0 & 2 & 2\\
0 & 0& 2
\end{bmatrix}.
$$
Let us check
$$
\begin{cases}
T(1) &= 2 \cdot 2 + 0 = 2,\\
T(1 + x) &= 2 (1 + x) + 1,\\
T(x^{2}) &= 2 x^{2} + 2 x = 2 x^{2} + 2 (1 + x) - 2 \cdot 1.
\end{cases}$$
Comment: Thanks, it was an error computing $C^{-1}AC$ on my part.
Comment: @AzamatBagatov, of course s*** happens. Note that you could have caught the error by also calculating the matrix directly, as above, and noting the the two answers did not match.
Answer: Yes, it is correct.
You cound also solve the problem without a change-of -basis matrix. Just compute $T(1)$; it is $2$. Now, which are the coordinates of $1$ in the given basis? Since $2=2\times1+0\times(x+1)+0\times x^2$, they are $2$, $0$, and $0$. So, now you have the first column of your matrix. You'll get the second and the third columns if you do the same thing with $x+1$ and with $x^2$ respectively.

Matrix for polynomial linear map


Magento 1.8 redirect product child to parent product

Question: In magento 1.8.1, how can you redirect the child products to an associated parent bundled product?
It seems options I have found for past versions are not working.
For example, clicking on child product a while doing a search will take you to the parent item showing all of the options available.
Answer: I wrote a simple extension yesterday that does exactly this in 1.8. Set up an observer for the event controller_action_predispatch
My observer file looks like this
class CommerceExtensions_GroupedProductRedirect_Model_Observer extends Varien_Event_Observer
{
  public function redirectProductView($observer)
  {
    $id = Mage::app()->getRequest()->getParam('id');
    $product = Mage::getModel('catalog/product')->load($id);
    if($product->getTypeId() == 'simple' && $product->getVisibility() == 1){
      $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
      if(!empty($parentIds)){
        $parentProduct = Mage::getModel('catalog/product')->load($parentIds[0]);
        Mage::app()
          ->getResponse()
          ->setRedirect($parentProduct->getProductUrl(), 301)
          ->sendResponse();
      }
    }
  }
}

This is what I have in my config.xml
  <controller_action_predispatch_catalog_product_view>
    <observers>
      <commerceextensions_groupedproductredirect_observer>
        <class>CommerceExtensions_GroupedProductRedirect_Model_Observer</class>
        <method>redirectProductView</method>
      </commerceextensions_groupedproductredirect_observer>
    </observers>
  </controller_action_predispatch_catalog_product_view>

It will only redirect if the child product is set to Not Visible Individually and it has a parent grouped product. This can easily be adapted to work with configurable or bundle products, I just dont use those types on my own site but as long as you can get the parent product id, there is no problem.
You should be able to just add these two parts to your module and it will work perfectly. I also ended up doing one for the review pages of those child products. Its essentially the same code with some adaptations.
Comment: When i added this code to the Observer file I get: Parse error: syntax error, unexpected T_CLASS, expecting T_FUNCTION in /home/unicohom/public_html/app/code/core/Mage/Admin/Model/Observer.php on line 107
Comment: you probably added an extra }. Give me a moment and I will give you an edited answer exactly as you need it.
Comment: If this answer works for you, please accept it so that I can get the credit. Thanks!
Comment: @user3315004 Did this answer work for you? If so, please mark it as accepted so that I can get credit for it. Better late than never. Thanks!
Comment: When using this in your site, remove this part Mage::getStoreConfig('groupedproductredirect/active/overall') as it is just from my custom module in which I set a master on/off switch for the extension.


Characterization of $C^{k,\alpha}$ (functions with Hölder continuous derivatives) through Taylor estimates

Question: For $k \in \Bbb{N} = \{1,2,3,\dots\}$ and $\alpha \in (0,1)$, let us define
$$
C^{k,\alpha} := \{ f : \Bbb{R} \to \Bbb{R} \,:\, f \in C^k \text{ with } f, f', \dots, f^{(k)} \text{ bounded and } [f^{(k)}]_{C^\alpha} < \infty \},
$$
where
$$
[g]_{C^\alpha} := \sup_{x,y \in \Bbb{R}, x \neq y} \frac{|g(x)-g(y)|}{|x-y|^\alpha} \, .
$$
It is not hard to see by using Taylor's formula for $f \in C^{k,\alpha}$ that for each $x \in \Bbb{R}$, there is a polynomial $P_x$ of degree $k$ (namely, the Taylor polynomial of $f$) satisfying
$$
|f(x+h) - P_x (h)| \leq C \cdot |h|^{k+\alpha} \qquad \forall h \in \Bbb{R} \text{ with } |h| \leq 1, \tag{$\circledast$}
$$
with a constant $C$ independent of $x,h$ (but depending on $f$).

It is claimed in Exercise 13.31 of certain notes by Martin Hairer that also the converse holds, i.e., if $f : \Bbb{R} \to \Bbb{R}$ and if there is a constant $C>0$, such that for each $x$, there is a polynomial $P_x$ of degree at most $k$ such that $(\circledast)$ holds, then $f \in C^{k,\alpha}$.

I would like to know a solution to this exercise, and even the case $k=1$ would be interesting to me.
To simplify the question a bit, let us assume that we already know $f$ to be $k$-times differentiable, with $f,f', \dots, f^{(k)}$ being bounded (I think this boundedness does not actually follow "automatically"), so we only need to establish $\alpha$-Hölder continuity of $f^{(k)}$.
After the fold, I discuss some of my ideas towards this problem. It might be better, however, to at first not read these ideas, since given that this is an exercise, they seem overly complicated (they refer to Campanato spaces, which are probably not known to everyone doing the exercise). Thus it might be better to start afresh instead of getting spoiled by my stupid thoughts :)

My thoughts only apply to the case $k=1$. Here, one can more or less easily show that necessarily $P_x (h) = f(x) + f'(x) h$.
Then we get
\begin{align*}
& |f(x+h) - f(x-h) - 2h \cdot f'(x)| \\
& = |f(x+h) - f(x) - f'(x) h - (f(x-h) - f(x) - f'(x) \cdot (-h))| \\
& \leq 2C |h|^{1+\alpha}
\end{align*}
for $|h| \leq 1$. But using the fundamental theorem of calculus to write $f(x+h) - f(x-h) = \int_{x-h}^{x+h} f'(s) ds$, and writing $g = f'$, we thus get
$$
\left|
- \int_{x-h}^{x+h} g(s) - g(x) ds
\right|
\leq 2C \cdot |h|^{1+\alpha}. \tag{$\dagger$}
$$
Now, it is known (see Lemma 0.0.15 in Some notes on Campanato spaces) that the norm
$$
\| g \|_\ast = \|g\|_{L^1} + \sup_{x \in \Bbb{R}, 0 < h \leq C} \,\, \inf_{c \in \Bbb{R}} \,\, h^{-(1 + \alpha)} \int_{x-h}^{x+h} |g(t) - c| \, dt
$$
is an equivalent norm for the Campanato space $L^{1,1+\alpha}_C (\Bbb{R})$. Strictly speaking, I am cheating a bit here, since $\Bbb{R}$ is not a bounded domain.
Thus, if in $(\dagger)$ above, we would have the absolute value inside the integral instead of outside, we would get a Campanato condition on the function $g = f'$. But it is known (see Wikipedia, or Theorem 0.0.22 of the notes I linked above) that $L^{1, 1+\alpha}_C = C^{0,\alpha}$ is the space of $\alpha$-Hölder continuous functions.
Thus, my hope is (I am currently investigating this) that one can adapt the arguments from the lecture notes above to also work in the case where the absolute value is outside of the integral.

As I said above, I don't think that this is the right solution, since it seems overly complicated :) I would be happy about any thoughts!
Comment: If I understood well you would like to know why the existence of polynomial implies the Holder regularity?
Comment: @GuyFsone: Yes, indeed. I want to know why/if existence of the polynomials implies $\alpha$-Hölder regularity of the $k$-th derivative of $f$.
Answer: We have
$$
|f(x+h)-P_{x}(h)|\leq c|h|^{k+\alpha}%
$$
for all $x\in\mathbb{R}$ and all $h$ with $|h|\leq1$. Write
$$
P_{x}(h)=\sum_{n=0}^{k}\frac{1}{n!}a_{n}(x)h^{n}.
$$
Taking $h=0$ you get $f(x)=a_{0}(x)$ so
$$
\left\vert f(x+h)-f(x)-\sum_{n=1}^{k}\frac{1}{n!}a_{n}(x)h^{n}\right\vert \leq
c|h|^{k+\alpha}.
$$
Next, by the triangle inequality
\begin{align*}
\left\vert f(x+h)-f(x)-a_{1}(x)h\right\vert  & \leq\left\vert f(x+h)-f(x)-\sum
_{n=1}^{k}\frac{1}{n!}a_{n}(x)h^{n}\right\vert +\sum_{n=2}^{k}|a_{n}%
(x)||h|^{n}\\
& \leq c|h|^{k+\alpha}+\sum_{n=2}^{k}\frac{1}{n!}|a_{n}(x)||h|^{n}%
\end{align*}
and so%
$$
\left\vert \frac{f(x+h)-f(x)-a_{1}(x)h}{h}\right\vert \leq c|h|^{k-1+\alpha
}+\sum_{n=2}^{k}\frac{1}{n!}|a_{n}(x)||h|^{n-1}\rightarrow0
$$
as $h\rightarrow0$, which shows that $f$ is differentiable with $f^{\prime
}(x)=a_{1}(x)$.
%%%%%This part feels wrong but I cannot find the mistake%%%%%%%%%%%%
Hence, for $k=1$,
$$
\left\vert f(x+h)-f(x)-f^{\prime}(x)h\right\vert \leq c|h|^{1+\alpha}.
$$
In turn, replacing $x$ with $x-h$ we get
$$
\left\vert f(x)-f(x-h)-f^{\prime}(x-h)h\right\vert \leq c|h|^{1+\alpha}%
$$
while replacing $h$ with $-h$ gives
$$
\left\vert f(x-h)-f(x)+f^{\prime}(x)h\right\vert \leq c|h|^{1+\alpha}.
$$
Now
\begin{align*}
|f^{\prime}(x)-f^{\prime}(x-h)|  & \leq\left\vert \frac{f(x-h)-f(x)}
{h}+f^{\prime}(x)\right\vert +\left\vert -\frac{f(x-h)-f(x)}{h}-f^{\prime
}(x-h)\right\vert \\
& =\left\vert \frac{f(x-h)-f(x)}{h}+f^{\prime}(x)\right\vert +\left\vert
\frac{f(x)-f(x-h)}{h}-f^{\prime}(x-h)\right\vert \\
& \leq2c|h|^{\alpha}.
\end{align*}
This proves that $f^{\prime}$ is Holder's continuous.
%%%%%%%%%%%%%%%End funny part %%%%%%%%%%%%
For $k\geq2$ we first prove that all the functions $a_{n}$ are bounded in
$[a,b]$. We will use the following fact about polynomials. Given
$k\in\mathbb{N}$, let $V$ be the vector space of all polynomials
$P:[-1,1]\rightarrow\mathbb{R}$ of degree less than or equal to $k$. Given
$P\in V$, let $\Vert P\Vert:=\max\{|a_{0}|,\ldots,|a_{k}|\}$, where
$P(t)=a_{0}+\cdots+a_{k}t^{k}$, $t\in\lbrack-1,1]$. Then $\Vert\cdot\Vert$ is
a norm in $V$.
Since the vector space $V$ has finite dimension $k$, all norms are equivalent.
In particular,%
$$
c_{1}\Vert P\Vert_{L^{\infty}([-1,1])}\leq\Vert P\Vert\leq c_{2}\Vert
P\Vert_{L^{\infty}([-1,1])}%
$$
for all $P\in V$ and for some constants $c_{1}>0$ and $c_{2}>0$.
Now let $P\in V$ be such that $\Vert P\Vert_{L^{\infty}([-1,1])}\leq L$. Then
by the previous inequality,%
$$
\Vert P\Vert:=\max\{|a_{0}|,\ldots,|a_{k}|\}\leq c_{2}\Vert P\Vert_{L^{\infty
}([-1,1])}\leq c_{2}L,
$$
which implies that $|a_{n}|\leq c_{2}L$ for all $n=1, \ldots, k$.
Since $f$ is continuous, there exists
$$
M=\max_{[a-1,b+1]}|f(x)|<\infty
$$
and so for $-1\leq h\leq1$ we have
\begin{align*}
\left\vert \sum_{n=1}^{k}\frac{1}{n!}a_{n}(x)h^{n}\right\vert  &
\leq\left\vert f(x+h)-f(x)-\sum_{n=1}^{k}\frac{1}{n!}a_{n}(x)h^{n}\right\vert
+\left\vert f(x+h)-f(x)\right\vert \\
& \leq c|h|^{k+\alpha}+2M\leq c+2M.
\end{align*}
Hence,
$$
\left\vert \sum_{n=1}^{k}\frac{1}{n!}a_{n}(x)h^{n}\right\vert \leq c+2M
$$
for all $h\in\lbrack-1,1]$. It follows from the property about polynomials
above that there exists a constant $C=C(a,b,M,c)>0$ such that%
$$
|a_{n}(x)|\leq C
$$
for all $x\in\lbrack a,b]$ and all $n=1,\ldots,k$.
We can now apply Theorem 3 in Oliver's paper to conclude that $a_{n}%
(x)=f^{(n)}(x)$.
Comment: Yes, I think so. One could work with partial derivatives. I cannot see a problem, although I would need to sit down and check.
Comment: Thank you very much for your answer! I will have a detailed look at it this evening.
Comment: You can try using the Lagrange reminder of the Taylor series.
Comment: Maybe there is a wrong minus sign in the "funny" part when you add and subtract the increment. Apart from this it seems correct: in fact you see that you do not get continuity of the derivatives if $\alpha \in \mathbb{N}.$ This corresponds to the difference between Holder and Zygmund spaces.
Comment: I cannot see the sign mistake. Where is it exactly? Thanks!
Comment: @Gio67: I am sorry that it took me so long to come back to your answer. I think that everything is correct. Also the reference to the paper by Oliver is interesting, since it shows that the notion in question has a name. If I understand correctly, what you show implies that 1) if $k=1$, then $f \in C^{k,\alpha}$, as desired. 2) if $k > 1$, then $f$ is $k$-times differentiable, and the polynomial $P_x$ is in fact the Taylor polynomial of $f$.
Comment: Do these claims also show $f \in C^{k,\alpha}$ for $k > 1$? At least I do not easily see at the moment that they do... Note: Even if not, I will award the bounty to you if no other answer comes up. Thank you :)
Comment: correct. I have not proved that the higher order derivatives are Holder
Comment: @PhoemueX, would you all mind to take a look of this [post](https://math.stackexchange.com/questions/2718164/lifchitz-functions-form-a-banach-space-and-analyzing-its-dual)? I wish to find a dense subset of $\text{Lip}$ but I failed.
Comment: Can your proof be extended to general $\mathbb{R}^n$? The part ('funny part') of dividing the equalities by $h$ might need more illustrations in  $\mathbb{R}^n$ as $n \geq 2$.
Comment: @Gio67 The subtle difference is that (by copying your method to $\mathbb{R}^n$, $n \geq 2$), after doing triangle inequality, one may end up with $\vert (\nabla f^{T}(x)-\nabla f^{T}(x-hd)) \cdot hd\vert \leq 2c \vert h \vert^{1+\alpha}$, where $d$ is a unit vector of any direction. Then $\vert (\nabla f^{T}(x)-\nabla f^{T}(x-hd))\cdot d\vert \leq 2c \vert h \vert^{\alpha}$. With this we can show Holder continuity of partial derivatives along only one direction (taking $d = e_i$). But I can't show that's true for other directions. Would you mind illustrating this a little bit? Thank you.
Comment: There is a book called "Manifolds, Tensor Analysis, and Applications" by Ralph Abraham , Jerrold E. Marsden , Tudor Ratiu. On Page 99 they have a supplement called "The converse to Taylor's theorem". The proof is not easy though.


Azure storage queue max concurrent clients

Question: I have an azure function with a servicebus trigger. I only want x numbers og function instances to run concurrently. This is done with the maxConcurrentCalls=x in the host file. Can this also be achieved with Azure Storage Queues?
Answer: Make sure you have installed latest nuget package(e.g Microsoft.Azure.WebJobs.Extensions.Storage) and try following settings.

If the function is on Consumption plan, in Application settings, set WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT to 1 to avoid adding host instances. For dedicated App service plan, we could fix instance count to 1.
In host.json, configure queue batch size according to runtime version(Find in portal, Platform features> Function app settings).
Runtime ~1
{
    "queues": {
      "batchSize": x,
       "newBatchThreshold": 0
    }
}

Runtime ~2
{
  "version":"2.0",
  "extensions": {
    "queues": {
      "batchSize": x,
      "newBatchThreshold": 0
     }
   }
}