Exchange 2003 Calendar Permissions work, and how to set them from the server?

Question: 1) In general, I don't understand where permissions for Calendars in Exchange 2003 are stored and how that exactly works.  Anyone have a link that explains that well, or want to explain it in a post?
2) More specifically, can I set a user's calendar so nobody can view the contents of each appointment from the server instead of the calendar properties from the client?
I just want people to be able to view when the person is 'busy'.
Comment: So, in essence, you want each appointment marked Private (by default)?
Comment: squillman: Sounds about right...
Comment: Right now someone else can view the calendar, I want to make is so they can't anymore, and if possible, do it from the server
Comment: I guess I don't generally understand how mailbox permissions and calendar permissions relate either.  I see 'mailbox rights' from AD, but nothing about the calendar
Answer: A calendar is a subfolder (if you will) of a mailbox that is set to contain appointment items, just as the Inbox is a folder that is set to contain mail and post items.
Basically, permissions are two-tiered.  You can grant permissions to a mailbox, then you need to specify additional permissions at the folder level.  There is no permissions inheritance.  By default, nobody will be allowed to see the content of calendar items unless the mailbox owner has specifically granted access first to the mailbox and then additionally to the folder istelf.
It sounds like what you're asking is for someone to be able to open this person's calendar and see free-busy information based on a day/week/month type view.  There's no way to do that without marking all items as Private, which I don't know of a way to do by default.
UserX could view someone's free/busy information through Outlook by creating a new appointment/meeting request in Outlook, adding that person to the invite list and looking on the Scheduling tab on the new item.
Here's an MSExchange.org article that explains how the Free/Busy information is created, stored, and used by clients.
Does that cover it?
Comment: Think So, So as long as I removed other users from 'MailBox Rights' under the exchange advanced tab and then go to the users outlook, and removed the other users from 'shared calendars' , I should be good?
Comment: Right, as long as "shared calendars" is a subfolder of the user's mailbox.
Answer: As an addendum, can can make all appointments for a user private by default
http://office.microsoft.com/en-us/outlook/HA011456981033.aspx
Permissions are still required to ensure that no one but yourself can access the calendar using other methods, but it will address the issue going forward for a particular user.
Comment: Yes, this is an option from the client-side.  The question was specifically about doing it server side...
Comment: Short of some sort of powershell scripting, I doubt there is an effective server side solution since, as you noted, the free/busy information is client generated.


Why is MSE of cross validation higher compared to a linear model

Question: I am tuning the lambda parameter of an elastic net with the glmnet package. For this purpose the package provides a cross validation based on the function cv.glmnet. With the function I am able to print the MSE of each tested lambda. I am also able to select a set of variables according to the tuned lambda parameter. These variables can then be put into a linear model. However, when I compare the best MSE of the cross validation results with the MSE of a linear model with the selected variables, the results are quite different.
Question: Why is the MSE of the cross validation higher compared to the MSE of the linear model?
Below, you can find some reproducible code, which shows what I have done so far.
library("glmnet")

set.seed(1234)

# Some example data
N <- 1000
y <- rnorm(N, 5, 10)
x1 <- y + rnorm(N, 2, 10)
x2 <- y + rnorm(N, - 5, 20)
x3 <- y + rnorm(N, 10, 200)
x4 <- rnorm(N, 20, 50)
x5 <- rnorm(N, - 7, 200)
x6 <- rbinom(N, 1, exp(x1) / (exp(x1) + 1))
x7 <- rbinom(N, 1, exp(x2) / (exp(x2) + 1))
x8 <- rbinom(N, 1, exp(x3) / (exp(x3) + 1))
x9 <- rbinom(N, 1, exp(x4) / (exp(x4) + 1))
x10 <- rbinom(N, 1, exp(x5) / (exp(x5) + 1))

data <- data.frame(y, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)

# Cross validation
cv <- cv.glmnet(x = as.matrix(data[ , colnames(data) %in% "y" == FALSE]),
            y = y, alpha = 0.5, family = "gaussian")

# Variable selection
cv_mod <- glmnet(x = as.matrix(data[ , colnames(data) %in% "y" == FALSE]),
             y = y, alpha = 0.5, family = "gaussian", lambda = cv$lambda.min)
vars_mod <- names(cv_mod$beta[ , 1])[as.numeric(cv_mod$beta[ , 1]) != 0]

# Linear model
md_lm <- lm(y ~., data[ , colnames(data) %in% vars_mod])

# Comparison of MSE
cv$cvm[cv$lambda == cv$lambda.min] # MSE of cross validation with best lambda
mean(md_lm$residuals^2) # MSE of linear model

I ran this code several times with different seeds and most of the time the MSE of the cross validation is higher.
Answer: I'd say this is a good example of why validation of a model built on a specific sampled dataset (== any dataset) is extremely important: apparently the sample you have the (bad) luck of drawing influences the mean squared error/model fit. Cross-validation is a way of studying this and provide a less sample specific estimate of the MSE. The reason it is (often) higher is that the original linear regression is probably somewhat overfit. This leads to smaller errors, while this level of performance is less likely to occur in "other" datasets (or subsamples of the entire set).
Further, the reason the crossvalidated MSE is not always higher than the original MSE is the inherent randomness of the procedure.
Comment: Thank you for the clear explanation. That makes a lot of sense!


Dúvida na utilização do for

Question: Preciso fazer um código para resolver a seguinte questão: Tenho uma cesta com capacidade C, tenho 3 tipos de frutas, receberei a quantidade um por linha, para por todas elas na cesta, a coleta dessas frutas se leva 1 minuto.
Por exemplo:
Cesta = 12
A = 4
B = 3
C = 3
Saída: 1
Cesta = 10
A = 5
B = 5
C = 5
Saída = 2(porque precisou de duas viagens, ou seja, dois minutos.)
Como fazer usando for? procuro a forma mais simples.
Segue o início do meu código:
#include <stdio.h>

int main() {

    int c = 0, a = 0, b = 0, c = 0, min = 1, sub = 0;

    scanf("%d\n%d\n%d\n%d", & c, & a, & b, & c);

    int vtl = a + b + c; //valor total das frutas

    if (c >= vtl) {

        printf("%d\n", min);

    } else if (vtl > c) {

        for ()

    }
}

Answer: Para fazer isso basta decrescer a capacidade máxima da cesta no valor total de quantidade de frutas a cada iteração do laço, exemplo:
quantidade de frutas = 12
capacidade da cesta = 6

Primeira iteração: 12 - 6 = 6
Segunda iteração: 6 - 6 = 0

Como foram utilizadas duas iterações o tempo necessário foi 2 minutos.
#include <stdio.h>

void get_input(const char *texto, int *variavel);

int main(void)
{
  int fruta_a, fruta_b, fruta_c, capacidade_cesta;

  // Pega as entradas do usuário
  get_input("Digite a capacidade máxima da cesta: ", &capacidade_cesta);
  get_input("Digite a quantidade de fruta A: ", &fruta_a);
  get_input("Digite a quantidade de fruta B: ", &fruta_b);
  get_input("Digite a quantidade de fruta C: ", &fruta_c);

  // Variáveis para calcular o tempo total
  int tempo_total = 0;
  int total_de_frutas = fruta_a + fruta_b + fruta_c;

  // Calcula o tempo total
  // A cada iteração é decrescido do
  // total a capacidade da cesta
  for(; total_de_frutas > 0; total_de_frutas -= capacidade_cesta)
    tempo_total++;

  // Mostra a quantidade total de minutos
  printf("O tempo total foi de: %d minutos\n", tempo_total);

  return 0;
}

void get_input(const char *texto, int *variavel)
{
  printf(texto);
  scanf("%d", variavel);
}

Dúvida na utilização do for


What is the left hand doing in classical music?

Question: If we take a classical piece on the piano, what is the left hand doing?
I find that figuring out the right hand, the melody, to be easier -- I am mainly playing by ear and improvising. But the left hand, I understand it's harmony. But it seems trickier than pop music. Are they primarily arpeggiating chords? I thought harmony was just chords. Or maybe it isn't? Or are they just randomly picking notes from the scale that sound nice with the melody?
Comment: If you want to learn to play classical piano, you should really get the actual sheet music. The classical world is very much about the actual literature.
Comment: You should not think of classical music as melody + harmony.  Pre-18th century, composers thought of music as several melodies going on at once, and the tradition continues that even 'harmony' parts are structured in a way that they form little melodies of their own.
Comment: I do everything by ear. I avoid sheet music, I find it too boring. But I found that once I get the melody. I can create my own harmony. it doesn't need to sound exactly like the original piece.
Comment: Guess you've never seen a cross-hand piece?  :-)
Comment: Classical music is much more complicated than you think. Once you go through good classical pieces, the harmonies, themes, melodies, and everything intertwine, unlike the simple melody+harmony structure of pop songs. Although I would recommend pop songs to be played by ear, try to appreciate the complexity of classical music by playing the notes on the page. If you play them correctly, I can assure you that they will be more interesting than you think.
Comment: I agree with @Todd Wilcox. Bach's Preludes and Fugues are a good example, or this: http://ks.petruccimusiclibrary.org/files/imglnks/usimg/e/e9/IMSLP309540-PMLP21295-Op.10_7_Morceaux_de_salon_5._Humoresque__Allegro_vivace_.pdf
Answer:
Are actual chords being played in classical music?

Of course they are. But I sense that the title of your question doesn't really show what you're actually asking.

What is the left hand doing? Is it primarily arpeggiating chords, or is it doing something trickier?

This is the better question, but the answer isn't too helpful: the left hand can do whatever the the composer wants it to do.

Sometimes it just provides the harmonies by playing chords in the left hand, like in Beethoven's Piano Sonata Op. 10/2, first movement:

Other times it lends harmonic support by only playing one pitch in the left hand, as in Beethoven's Piano Sonata Op. 13, second movement:

Other times it arpeggiates the harmonies with what we call an Alberti bass, like in Mozart's Piano Sonata K545, first movement:

It can also just play a melodic line, causing the right hand to play the harmonic support, as in Liszt's Consolation No. 4:

Or why not multiple melodic lines at once, like in the first fugue from Bach's Well-Tempered Clavier? Here the melodic line in mm. 4--5 is added in in mm. 6--7 while the earlier line continues.

And then some composers just said screw it and put the whole damn piece in the left hand.
Comment: Typically it's a chord tone in the left hand, yes. And you're right on it: we just call it "melody harmonization" when we add chords to a given melody!
Comment: thanks for your great answer. when you say it "lends harmonic support"  does that mean it's a single one of the notes of a chord that could be played with that melody. or if it's not one of those chord notes. is there a musical term for that that I could investigate further how to harmonize melody notes. or do you just wing it and play "whatever sounds good" with that melody note (assuming you're harmonizing it with one of the notes of that scale that would only have 7 options).
Comment: In the late 19th century, composers started doing what we may equate with "whatever sounds good." (That's a gross oversimplification!) But in the late 1700s/early 1800s, harmony was pretty "by the book," and there weren't too many surprises with weird bass pitches.
Comment: Another common texture has the left hand doubling the right usually with octaves, thirds, or sixths. The right hand may have additional decorative notes. Examples: Mozart K 283, 1st mv. starting m.16, or K 332, 3rd mv. m.3-4. With this texture there is less chord, more scale.
Answer: I once went through "The International Library of Piano Music" studying left-hand patterns. There were several; in fact,  most pieces had several.

Block chords
Bass and block chords
Bass and arpeggiated chords (bass being heavier)
Arpeggiated chords (Alberti bass)
Counterpoint (more complex that a bass line)
Several part counterpoint (including some in the right hand)
The melody itself with the other mentioned ideas in the right hand.
Rests.
A (perhaps modified) copy of the melody.
An organ point (or pedal point), a long held note usually the tonic or dominant note or both.

All of these can be blended into each other; they all can be played smoothly or percussively. Parts can be exchanged among "voices" in either hand.
Examples can be found at IMSLP.
http://imslp.org/wiki/Category:Frescobaldi%2C_Girolamo
http://imslp.org/wiki/Sonate_per_pianoforte_(Beethoven,_Ludwig_van)
http://imslp.org/wiki/Category:Chopin%2C_Fr%C3%A9d%C3%A9ric
http://imslp.org/wiki/Category:Brahms%2C_Johannes
Answer: Ravel and Prokofiev both wrote piano concertos for the left hand only.  So, in those cases, the left hand was doing everything.
Both were written for the same pianist, Paul Wittgenstein, who lost his arm in the First World War but he did not ever play the Prokofiev.  I used to have it on vinyl but I have given up all of my vinyl and hence I have not heard it for a long time.
Ravel Piano Concerto for the Left Hand at Wikipedia
Prokofiev Piano Concerto 4 at Wikipedia


k-Fold Cross-Validation across classes

Question: Suppose I want to do k-fold cross-validation across a set of data points.  Each of these data points is a member of exactly one of n classes.  (For example, suppose each of the data points is a person and the class they belong to is their age in years.)  I want the distribution across classes of each of my k test sets to (as closely as possible) 'match' the distribution of classes across all the data points.  (And I want each data point to be in exactly one of the k test sets.)  The number of points in each of the n classes need not be a multiple of k.
Is there some well-known algorithm, or, better yet, Python library for doing this?
Answer: I believe you are looking for Stratified K-Fold Cross Validation, which preserves the distribution of classes across folds of the data.
Scikit-learn has a StratifiedKFold function for Python users!

k-Fold Cross-Validation across classes


VBA to verify if text exists in a textbox, then check if date is in the correct format

Question: I have an excel form that I created in combination with VBA. In the form I have a textbox in which the user is to type in a date.
I have created this VBA clause to ensure the user types in a date that supports the format xx/xx/xxxx.
If Not IsDate(textboxDate1.Text) Then
  Call MsgBox("Please select a correct Date format", vbOKOnly)
  Exit Sub
End If

However, with this VBA code, the user is required to enter a date, whether the user needs to or not. So when I have a 4 other textboxes to input a date in my form, and the user only needs to enter in 1 date, and not 5, I have the problem where the user is required to put in a date for the other four textboxs in order submit the form.
So my question:
What VBA code is available to first determine whether text exists in the textbox, and then second to determine whether the date is in the correct format or not.
I was trying something similar to this:
 If textboxDate1.ListIndex = -1 Then

but I couldn't get it to work with the IsDate clause.
Many thanks in advance.
Answer: If (Len(Trim(textboxDate1.Text)) <> 0)  And Not IsDate(textboxDate1.Text) Then
  Call MsgBox("Please select a correct Date format", vbOKOnly)
  Exit Sub
End If

Comment: + 1 :) However a suggestion. You might want to use `Len(Trim(textboxDate1.Text)) <> 0` instead of `textboxDate1.Text <> ""`
Comment: +1 however, you can optimize this by checking length first. If `Len = 0` there is no point in checking `IsDate`.


What is the difference between connection.Close() and connection.Dispose()?

Question: I noticed that the SQLiteConnection object in System.Data.SQLite owns two similar methods :

Close()
Dispose()

Same for the SQLiteDataReader object.
What is the difference ?
Comment: Maybe this helps: http://stackoverflow.com/questions/61092/close-and-dispose-which-to-call
Comment: Thank you, I didn't see this post !
Answer: Dispose also closes the connection if it hasn't been closed, but when calling Close, you can reopen the connection again. This is not possible when the connection is disposed.
In general, don't call Close, but simply call dispose implicitly by wrapping the creation of a connection in a using block:
using (var connection = new SqlConnection(...))
{
    // use connection here. e.g.:
    connection.Open();
    using (var command = connection.CreateCommand())
    {
        ...
    }
} // connection gets closed and disposed here.

Comment: Taking a look at the [source](http://system.data.sqlite.org/index.html/artifact/31b823606b81d72d120bdd8dca8de8421b9abb16) ...can show that `Dispose()` calls `Close()` internally.
Comment: Thank you for the answer (sorry for the duplicate)
Comment: @Steven did I say it was?
Answer: Connection.Close() will simply close the connection to the server as defined in the connection string. The Connection can be used/re-opened after this point.
Connection.Dispose() will clean up completely, removing all unmanaged resources preventing that Connection from being used again. Once disposed is called you shouldn't try to use the object any more. Within Dispose(),Close()` will all most certainly be called too.
I would recommend using the using syntax like so if possible, to ensure things are cleaned up correctly:
using(SqlLiteConnection conn = new SqlLiteConnection(...))
{
   // Do work here
}

This will automatically dispose of the connection for you, regardless of an exception being thrown.
Comment: One subtle difference is `Close` will not call the `GC.SuppressFinalize` method on that connection, while `Dispose` does call that method. Not disposing a connection will therefore keep the connection object alive for much longer. This has no effect on the connection pool, but does have on memory. The difference -in case of a `SqlConnection`- will however be neglectable.
Comment: Thanks, it's more clear for me now (sorry for the duplicate)


Como ler o que o usuário digitou em um formulário?

Question: O código está assim:
<form method="post" action="pagina.php"/>
<?php
$c= 1;
$neg = 0;
    while($c <=3){
        echo "Digite um numero: <input type='number' name='$num' min='1'/>";
            if($num < $neg){
                $total++;
                }
            $c++;
            }
?>
<input type='submit' value='Resultado'/>

Não estou sabendo como fazer o que o usuario digitou, se torna uma variável para eu poder usar a estrutura de controle nele. Tentei colocando uma variável direto no name ($num), mas parece que não deu certo ou não é assim. Ou esse tipo de coisa é para JavaScript ?
Comment: Sugeriria ler as paginas introdutórias do manual do PHP. Não faz nenhum sentido seu código. PHP não é uma linguagem que naturalmente interage com usuário quando usada via HTML e navegador. PHP só monta coisas estáticas. O cliente recebe o conteúdo, e se quiser interagir, tem que chamar um novo PHP (ou o mesmo, mas numa nova execução). Comece por aqui, com atenção aos detalhes: http://us3.php.net/manual/pt_BR/getting-started.php - Se tiver facilidade com inglês, melhor ainda, a documentação em português tem menos qualidade (mas para o básico já serve)
Comment: se você quer saber o que está escrito no formulário, basta usar javascript,

$("form").val();

Caso queira pegar em php, basta enviar o formulario via ajax ou pra uma pagina e transformar em variavel, usando metodos POST ou GET
Answer: Um exemplo simples de formulário gerado dinamicamente com PHP:
pagina_um.php
<form method="post" action="pagina_dois.php">
<?php
    for( $c = 1; $c <= 3; ++$c) {
        echo "   Digite um numero: <input type='text' name='input_$n'>";
    }
?>
   <input type='submit' value='Resultado'>
</form>

pagina_dois.php
<?php
    $total = 0;
    for( $c = 1; $c <= 3; ++$c) {
        $total = $total + $_POST["input_$n"];
    }
    echo "O total é $total";
?>

Note que são duas etapas. A primeira, gerando o formulário. A segunda, recebendo o resultado do formulário.
Não fiz nenhuma proteção para verificar se os dados fazem sentido, por ser apenas um exemplo elementar. Numa aplicação prática, precisa de uma série de cuidados extra.
Basicamente, quando você tem um form com método POST, tem que pegar usando a variável global $_POST['nomedocampo'].
Answer: Caso queira pegar o que o usuário digitou na pagina.php, basta usar os métodos GET ou POST do PHP! Como você declarou o metodo POST no formulário, basta chamar a função $_POST[''] na pagina.php.
Também pode fazer isso com JavaScript, mas, na mesma página, criando intervalos de alguns segundos, dá para criar um preview do texto que o usuário fez.

Dica

Remova o código php do seu formulário, não faz sentido esse código!
E crie um input normal em HTML, e o name, coloque de sua preferência. Como "number" por exemplo.
Exemplos
PHP (pagina.php)
$number = $_POST['number'];
echo ($number);
//vai aparecer o que o usuário digitou ao clicar no Resultado.

JavaScript (página do formulário)
$("#butaum").click(function() {

  var number = $('#number').val();

  $("#resultado").html(number);

});

<form>
  <input type='number' id="number" name='number' min='1'>
</form>

<button id="butaum" >Resultado</button>


How to set a yml sequence config value via drush cset

Question: When the drupal config value (as defined in .schema.yml) is a sequence what is the correct syntax for drush config-set so that the value is a sequence not a simple string? For example, with the devel module
drush config-get devel.settings error_handlers returns
'devel.settings:error_handlers':
  1: 1
So what is the syntax to set the value to 4: 4. I have tried lots of combinations, such as 4:4  [4:4]. error_handlers.4 4 but have not hit on the right way yet. I could not find any examples or documentation, so asking here. Thanks.
Answer: Uh, I love riddles like this! And finally found a way!

You first have to delete the error_handlers config key.
$ drush -y cdel devel.settings error_handlers

And then set it again.
$ drush -y cset devel.settings error_handlers.4 4

Let's check.
$ drush cget devel.settings error_handlers
'devel.settings:error_handlers':
  4: 4

Yeah!

Just drush -y cset devel.settings error_handlers.4 4 without deleting it first would just append it and you'd end up with 1: 1 and 4: 4 both.
Comment: Thank you @leymannx you are right. I am sure I tried that! I have also confirmed your second point, adding another gives both. Then `cdel devel.settings error_handlers.1` will remove the unwanted one after.


Realtime progress of AJAX call (asp.net)

Question: I'm trying to make a progress bar that updates the user on the progress of the AJAX call.
My immediate thinking was that I need an AJAX call to start a thread on the server, allowing the starting AJAX call to finish, and allowing the thread to send updates back to the user.
For the purpose of simplicity, disregard the actual progress bar functionality (I was thinking of implementing one of those JS bars, with fancy colors and effects ;), but if I can get an update from the thread, then updating a simple JS progress bar becomes trivial ;) )
I just need a few pointers on how to accomplish this, if anyone could oblige me? ;)
Answer: Crux of the problem is to get the % of work completed from the server. The only way out is to poll the server every x seconds. There are couple of approaches,

Initiate a httphandler(sync or async) call with ajax.
[Polling] Use ASP.NET timer control to refresh the update panel every x seconds.

OR
http://encosia.com/2007/07/25/display-data-updates-in-real-time-with-ajax/
OR use jquery for polling.
Poll the server at 't' interval and get the status. For that we need to call a function at 't' interval that would initiate an AJAX call to a HTTPHandler to get the status.
<code>$(function() {
  setInterval(update, 't');
});

function updateStatus() {
  $.ajax({ type: "POST",  url: "GetStatusHandler.ashx",
       contentType: "text/html; charset=utf-8",
       dataType: "html",
       success: function(data) { UpdateStatus - Update some progressbar plugin }
       });
}
</code>
So you will have two httphandlers, one to start the process other to get the status.
You can research on these and see what suits you better.


Variável que tem uma variável em seu nome

Question: Em um exercício:

Uma empresa deseja saber em quantos meses houve lucro, ou seja, o saldo maior que zero.

O código para resolução foi este:
function quantidadeDeMesesComLucro(umPeriodo){
  let quantidade = 0;
  for(let mes = 0; mes < umPeriodo.length; mes++){
    if(umPeriodo[mes] > 0)
    quantidade += 1;
  }

return quantidade;
}

A dúvida é em relação à 4ª linha do código em que se expressa:
if(umPeriodo[mes] > 0)
Como entender umPeriodo[mes]? Não consigo visualizar como funciona, levando em consideração que umPeriodo = [100, -1, 10, 0].
Answer: Ali recebe um array. Além de ver o link anterior seria bom entender bem O que é uma variável?.
Então um array sendo variáveis dentro de variáveis, você tem que ter uma forma de dizer qual é o array (é o nome da variável principal, no caso umPeriodo), e a outra parte que pega a variável interna no array, portanto é um índice, normalmente numérico, como em um matriz (em JS é possível que o índice seja diferente, mas parece que nesse caso é numérico e sequencial).
Então você pode acessar umPeriodo[0] que é o primeiro elemento do array umPeriodo. Pode acessar umPeriodo[1] que é o segundo elemento, e assim por diante.
No lugar do literal pode usar uma variável, então em cada execução que passa por ali o índice a ser usado será o valor da variável, então vamos pegar o exemplo:
mes está valendo 0, portanto umPeriodo[mes] na verdade é o elemento umPeriodo[0], e quando mes mudar para 1, então teremos umPeriodo[1], e assim por diante.
Você tem um laço ali que faz o valor de mes ir mudando em cada passo de execução, em cada uma ele pega o elemento correspondente. É assim que se faz para varrer todo o array (tem outras formas como o for of).
Comment: Obrigado. Super entendi!!!


Powershell Win32_NetworkAdapterConfiguration Not "seeing" PPP Adapter

Question: I am trying to get the IP of a PPP VPN network connection, but Win32_NetworkAdapterConfiguration does not seem to "see" it.
If I interrogate all adapters using my script, it will see everything but the PPP VPN adapter. Is there a specific filter or something I need to enable, or do I need a different class?
My Script:
$colItems = Get-wmiobject Win32_NetworkAdapterConfiguration
foreach ($objItem in $colItems) {
    Write-Host Description: $objItem.Description
    Write-Host IP Address: $objItem.IPAddress
    Write-Host ""
}

Script Output:
Description: WAN Miniport (SSTP)
IP Address:

Description: WAN Miniport (IKEv2)
IP Address:

Description: WAN Miniport (L2TP)
IP Address:

Description: WAN Miniport (PPTP)
IP Address:

Description: WAN Miniport (PPPOE)
IP Address:

Description: WAN Miniport (IPv6)
IP Address:

Description: WAN Miniport (Network Monitor)
IP Address:

Description: Intel(R) PRO/Wireless 3945ABG Network Connection
IP Address: 192.168.2.5

Description: WAN Miniport (IP)
IP Address:

ipconfig /all output:
PPP adapter My VPN:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : My VPN
   Physical Address. . . . . . . . . :
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 10.1.8.12(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.255
   Default Gateway . . . . . . . . . : 0.0.0.0
   DNS Servers . . . . . . . . . . . : 10.1.1.3
                                       10.1.1.2
   Primary WINS Server . . . . . . . : 10.1.1.2
   Secondary WINS Server . . . . . . : 10.1.1.3
   NetBIOS over Tcpip. . . . . . . . : Enabled

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : Belkin
   Description . . . . . . . . . . . : Intel(R) PRO/Wireless 3945ABG Network Connection
   Physical Address. . . . . . . . . : 00-3F-3C-22-22-22
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.2.5(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : 25 May 2010 20:33:19
   Lease Expires . . . . . . . . . . : 22 May 2020 20:33:17
   Default Gateway . . . . . . . . . : 192.168.2.1
   DHCP Server . . . . . . . . . . . : 192.168.2.1
   DNS Servers . . . . . . . . . . . : 192.168.2.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Thanks in advance,
Ben
Comment: get a copy of MoW's powershell script "WMI Explorer". As the name implies, it is a GUI for exploring WMI. His blog where I would normally download it seems to be down, but this technet site has a copy of it: http://gallery.technet.microsoft.com/ScriptCenter/en-us/89c759b7-20b4-49e8-98a8-3c8fbdb2dd69
Answer: This is a bug that was present in Vista and hasn't gotten fixed through Windows 7 or Windows 8. You have to call the .NET API directly from Powershell to get this information.
$nics = [System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces()
foreach ($nic in $nics) {
    write-host $nic.name
    $props = $nic.GetIPProperties()
    $addresses = $props.UnicastAddresses
    foreach ($addr in $addresses) {
        write-host "IP Address: $($addr.Address.IPAddressToString)"
        write-host "IPv4 Mask: $($addr.IPv4Mask.IPAddressToString)"
    }
    write-host "Gateway: $($props.GatewayAddresses.Address.IPAddressToString)"
    write-host "DNS Server(s): $($props.DnsAddresses.IPAddressToString)"
    write-host ""
}

See also the NetworkInterface class documentation.
Answer: I know that this is a very old thread, still I'll post the way I manage it so it could help someone like me, as I couldn't find a ready solution.
What this does is loop through several hosts and their NICs. It shows ALL NIC IPs but not a default one.
Get-wmiobject Win32_NetworkAdapterConfiguration -filter IPEnabled=TRUE -computername localhost,127.0.0.1 | ForEach-Object -Process {
    Write-Host Server: $_.__SERVER
    Write-Host Adapter name: $_.Description
    Write-Host IP Addresses: $_.IPAddress
    Write-Host ""
}

Answer: Use the MSFT_NetIPAddress class instead.
Powershell Example:
gwmi MSFT_NetIPAddress -Namespace 'root/standardcimv2' | format-list -Property InterfaceAlias,IPAddress

Comment: This is the only method to look up a VNP "PPP adapter" of Windows 10. When _connection is established_, the adapter is present (as listed with DOS command `IPConfig`) and `InterfaceAlias` holds the name it was given in Windows. When the _connection is down_, the adapter is gone, thus will not be listed.


EAS Build stuck at the level of compressing files

Question: I am new to react-native and using expo.
I am trying to build an apk for the app I made. I have tried ESA build but once I run the build command it gets stuck hours  at compressing project files and uploading to expo servers and eventually fails.
I have tried creating a blank project to build but it still takes hours and sometimes a blank project (default expo app) compresses the files to a size of 66Gb and start uploading then fails shortly after.
Have been stuck with this issues for weeks.
Terminal Error
Answer: I finally fixed this issue.  I am using VS code but it showed no error.  when I ran the build command in the Mac terminal instead it showed an error that I could then debug.  it turned out that I needed to do a git init on the project folder.  This resolved the issue and my project is building fine now.
Answer: yes as it was rightly answered doing a git init will solve the issues, the problem was the code was trying to compress all files in your project including node_modules and other heavy folders so, it will work when you just git init
Comment: As it's currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Hyperthreading when using Vienna Ensemble and Reaper

Question: I'm not sure if there are computer experts on this platform, but this board seemed more reasonable to choose than a pure "computer hardware forum" on StackExchange. :)
Do you think or know whether a CPU providing hyperthreading (I'm eyeing the Intel Core i7-6700) is a must-have when sequencing using Vienna Ensemble (and Reaper)?
RESULT
For the ones interested: I went for the following main components.
Mobo: Gigabyte GA-Z170-HD3P
CPU:  Intel Core i7-6700K
RAM:  16GB DDR4
Answer: Digital instruments based on large sample libraries should not require vastly more CPU than an ordinary sampler.  However, they are extremely heavy on memory and disk use.  I would therefore say that large/fast memory and a fast hard-drive (e.g. SSD) is more important.
For example, I don't know about how Vienna works, but the Play sampler (EastWest/QL) keeps the first fraction of a second for every note/articulation/velocity in memory, and when that note is played it then has that fraction of a second to read the rest of the sample from the disk.  (SSDs are particularly great because not only are they fast in general, but they don't have a long "seek time" when reading from a new location.)
In contrast, instruments such as the Roland V-Piano don't use samples but use physical simulation to produce the sound - this takes more CPU but they don't need to constantly read from the disk.
Nerd Time: the strongest benefit of hyperthreading for digital audio is when you have lots of multiple completely independent effects that are CPU/memory heavy (i.e. not limited by the disk).  Certain calculations use multiple areas of the CPU in sequence, so if your synth uses each calculation's result in the next calculation, it has to wait for each calculation to go through all the stages before starting the next one.  Hyperthreading is a way to fill in the gaps, so it will interleave the calculations for multiple synths through a single CPU, a bit like a production line.
Answer: I don't know either piece of software, so this is going to be very generic, however...
Clock speed is raw power [though comparing clock speed across CPU generations is not a good guide, due to many factors]
Core count will give you more simultaneous plugins.
Hyper threading does not add any more raw power to a core, as it is a "job sharer" rather than a "job doubler" & so is only useful if the core still has spare time.
So...
For a high speed, low thread task, clock speed is everything.
For a high-thread task, multiple plugins or virtual instruments, cores count.
So long as a core is not 100% busy, HT will enable another task to be run on that core, i.e., another plugin thread.
Comment: Agreed on the first part. --- "high speed-low thread" is kind of the rendering scenario, isn't it. The live usage and composition/process is a "high thread" task, so I guess, that's a plus for HT. I'm swaying between the Intel Core i5-6600 and the i7-6700.
Comment: It's not really a plus for HT, it's a plus for cores. HT assists in task sharing, it's almost useless if the CPU is actually very busy. I'd go i7 over i5 every time, but Xeons are prime for a DAW, whatever OS. My recommendation for a Mac Pro wasn't so much for the OS, as for the sheer grunt of a pair of Xeons on a server-grade mobo. You can easily run Windows on one, if you prefer. 2nd hand, fully loaded, under 2 grand.
Answer: I don't know specifically, but I sincerely doubt it. Computer performance depends on a lot more than a CPU. It's a harmony between the OS, RAM, CPU, hard drive, and bus speeds. You will certainly want a CPU in the i7 family and not an i5. I would try to get as much RAM & CPU horsepower as you can afford, as well as a solid-state drive.
Comment: OK, I stand corrected. I will edit the response accordingly. But I will add that you probably don't want an i5. I was assuming you would be looking at the higher-end processors, so you would definitely want to go with an i7 as that will certainly make a difference in many circumstances where an application can put the hyperthreading and extra cores to use. Also, you definitely want an SSD as well, if that was not already obvious!
Comment: According to the processor lists differentiating between physical and logical cores, you find for the i5 product line 4/4 (no hyperthreading) and for the i7 4/8 (hyperthreading). And so say the Intel data sheets of the respective processors. (hyperthreading =/= multithreading...)
---
Harmony is a more critical bottle neck than CPU, that's for sure, but given the components all work well together and are of equal performance, multitasking could come in handy...
Comment: See http://ark.intel.com/products/88188/Intel-Core-i5-6600-Processor-6M-Cache-up-to-3_90-GHz and http://ark.intel.com/products/88196/Intel-Core-i7-6700-Processor-8M-Cache-up-to-4_00-GHz at the "advanced technologies" tab.
Comment: Yep to the SSD. I'll ask that in the comment (and maybe put it into a new or this question): Do you have some quick recommendations about the motherboard (spec wise, not an actual product)?
Comment: As far as motherboard specs, I would buy a whole system and not futz with trying to put it together or customize it yourself. It will be cheaper, will run better, and save you a lot of headache. The people who assemble these are pretty good at combining things properly so the system runs smoothly. Also, I would recommend a Mac over a Windows machine.
Comment: Honestly - you could do far worse than an uprated Mac Pro 4,1/5,1 - after upgrade, dual 6-core Xeon 3.46GHz, max 96 GB RAM. No, it's not as fast as a *very* high end 2016 machine... but it will smoke a single i7
Comment: As this is not for commercial use I just want to do the hobby justice, not build or get the ultimate system. Those designated machines are beyond the budget I'm willing to spend (and over the top). --- Mac is no option for me. :) --- I was just interested, if there's something very special about the mobo, most things will be handled by an dedicated audio card/interface, anyways.
Comment: The interface only handles i/o. The CPU has to do the heavy lifting.


How to calculate fuel cost and mpg?

Question: A car has a mileage of "5 miles per litre" and traveled a distance of 573 miles.  The cost of fuel is £1.09 per litre.  How do I compute the miles per gallon(mpg) and the total cost of fuel for the trip?
A formula or example would be great, so that I can refer to it, when I have this problem again.
Comment: Try to work it out yourself using cross multiplication.  https://en.wikipedia.org/wiki/Cross-multiplication  Write 5 miles/per litre as 5 miles divided by one litre.  So if you travel 573 miles, and you go 5 miles on one litre, then you have to divide 573 by 5 to get the number of litres.
Comment: You would require $573/5=114.6$ litres. You should be able to calculate the cost now.
Comment: when multiplying  `114.6 litres` with `£1.09`, do i convert `£1.09` to `pence` and then divide the result by 100?
Comment: also is `114.6 litres` the mpg?
Comment: To compute the mpg you have to use the conversion from litres to gallons in the cross-multiplication.  Write the cross-multiplication on a sheet of paper.  It's not hard.  Also the units of measure can help you a great deal to work out what to multiply and divide.
Comment: honestly, this would make more sense if i had an example with the values?
Comment: @user892134 We've established you need $114.6$ litres of fuel at $109$ pence **per litre** so for every $1$ litre you pay $109$p. You need $114.6$ of these, so....
Answer: You can find first Total fuel required which you can get by dividing 573 by 5. Then multiply the fuel which you found out in litres by cost per litre to get total cost

How to calculate fuel cost and mpg?


adding videos to a website

Question: Alright I´m gonna try to be a bit more specific.
The website is not yet up and running, but I will be using a hosting site such as youtube.
What I meant to say is that I tried adding a video using the following code
<video width="320" height="240" controls="controls">
<source src="parklane.mp4" type="video/mp4" />
<object data="parklane.mp4" width="320" height="240">
<embed src="parklane.swf" width="320" height="240">

Comment: what do you want to do ? what is your markup ? what have you done so far ? what do you want do add ? what do you want to do with that ?
Comment: Considered HTML5? http://www.w3schools.com/html5/html5_video_dom.asp
Comment: If you're using YouTUbe or similar, they'll provide you with a nice cross-browser and cross-device embed code.
Comment: If you will be using youtube, why don't you start by embedding a you tube video?
Comment: I want to upload both small and large videos. Some will be high-definition and others might be low. I thought that html alone would not be a strong enough dev to handle so many videos.

I´m not sure embedding videos via youtube is the way to go. I mean for instance, if you take a look at a site as IGN.com  they both have thumbnail videos as well as full sized ones. Is that possible using YouTube? Or do I need another solution?

And also, videos used via YouTube limits you when it comes to advertisement.
Answer: If you're using YouTube then they provide a nice embedding code for you to add to your page.
e.g
This will embed the video from this page http://www.youtube.com/watch?v=teHfyby_veU on your site at 420px wide and 315px high.
If you want to dynamically add them from a database or list of video ids you just need to change the id in the embedding code.
e.g http://www.youtube.com/watch?v=**teHfyby_veU**

You can adjust the dimensions by changing the width and height of the iFrame.
If you need anything more than these basics then you might want to have a look at the youtube api - http://code.google.com/apis/youtube/overview.html

adding videos to a website


Evaluating the time average over energy

Question: For more info see the article equations 37
Edit: The $\varepsilon ^3 $ has vanished due to time average. But how to get the 4th order?
Let us define some function for scalar field
$$\phi= \sum_{k=1}^\infty\varepsilon^k \phi_k \tag{1}=\varepsilon^1 \phi_1+\varepsilon^2 \phi_2  +\varepsilon^3 \phi_3 ...$$
position scaling
\begin{equation}\tag{2}
\zeta^i=\varepsilon x^i
\end{equation}
time scaling
\begin{equation}\tag{3}
\tau=\omega(\varepsilon) t
\end{equation}
\begin{equation}
\Delta S -S +S^3=0\,,\quad S=p_1\sqrt{\lambda} \,.
\end{equation}
\begin{equation}
p_3=\frac{1}{\lambda^2\sqrt{\lambda}}\left[
\left(\frac{1}{24}\lambda^2-\frac{1}{6}\lambda g_2^2+\frac{5}{8}g_5
-\frac{7}{4}g_2g_4+\frac{35}{27}g_2^4\right)Z
-\frac{1}{54}\lambda g_2^2S(32+19S^2)
\right]
\end{equation}
the solutions  for equation (1) can be written as,
\begin{eqnarray}
\phi_1&=&p_1\cos \tau \tag{4}\\
\phi_2&=&\frac16 g_2p_1^2\left(\cos(2\tau)-3\right) \tag{5}\\
\phi_3&=&p_3\cos \tau+\frac{1}{72}(4g_2^2-3\lambda)p_1^3\cos(3\tau)\tag{6}
\end{eqnarray}
My intention is to determine the time average energy density
The energy corresponding can be written as
\begin{equation}
E = \int d^{D}x\,{\cal E}\,, \quad
{\cal{E}} = \frac{1}{2} \left(\partial_t \phi\right)^2
+ \frac{1}{2} \left(\partial_i \phi\right)^2
+U(\phi)\,,
\end{equation}
where ${\cal{E}}$ denotes the energy density.
\begin{equation}
E = \frac{1}{\varepsilon^D}\int d^{D}\zeta\,{\cal E}\,, \quad{\rm where}\quad
{\cal{E}} = \frac{1}{2} (1-\varepsilon^2)\left(\partial_\tau \phi\right)^2
+ \varepsilon^2\frac{1}{2} \left(\partial_i \phi\right)^2
+U(\phi)\,.
\end{equation}
Because of the periodic time dependence we shall compute
the energy density averaged over a period,
\begin{equation}
\bar{E}=\frac{1}{2\pi}\int_0^{2\pi}d\tau E\,,
 \end{equation}
The bar over a quantity will denote its time average.
Using the results of the $\varepsilon$ expansion,
Eqs. (4-6)
the time averaged energy density,
 $\bar{{\cal E}}$, up to fourth order in $\varepsilon$ can be written as
(My problem is here that how will this term arise)
\begin{eqnarray}
\bar{{\cal E}}&=&\frac{\varepsilon^2}{2\lambda}S^2
-\frac{\varepsilon^4}{216\lambda^3}\biggl[
\lambda S^2(64g_2^2+27\lambda)(S^2+2)
-54\lambda^2(\nabla S)^2
\nonumber\\
&&-SZ(135g_5-378g_2g_4+280g_2^4-36\lambda g_2^2+9\lambda^2)
\biggl] \,.
\end{eqnarray}
For more info see the article equations 37

If you have problem to get the question then ask me please, I will
  edit for you.  Thanks advance,
Comment: I still don't see your own work. What have you tried?
Comment: What does this have to do with dynamic programming?!!
Comment: I have included the information to get the result's. I am trying to get the idea that how they did the solution and how they used this equation.
 \begin{equation}
E = \int d^{D}x\,{\cal E}\,, \quad
{\cal{E}} = \frac{1}{2} \left(\partial_t \phi\right)^2
+ \frac{1}{2} \left(\partial_i \phi\right)^2
+U(\phi)\,,
\end{equation}
Answer: Look,
$$
{\cal{E}} = \frac{1}{2} \left(\partial_t \phi\right)^2
+ \frac{1}{2} \left(\partial_i \phi\right)^2
+U(\phi)$$
Now fill in the expansion
$$\phi= \varepsilon^1 \phi_1+\varepsilon^2 \phi_2  +\varepsilon^3 \phi_3 + \ldots$$
this should give
$${\cal{E}} = \frac{1}{2} \left(\varepsilon^1 \partial_t\phi_1+\varepsilon^2 \partial_t\phi_2  +\varepsilon^3 \partial_t\phi_3 + \ldots \right)^2
+ \frac{1}{2} \left(\varepsilon^1 \partial_i\phi_1+\varepsilon^2 \partial_i\phi_2  +\varepsilon^3 \partial_i\phi_3 + \ldots\right)^2
+\frac{1}{8}\left(\varepsilon^1 \phi_1+\varepsilon^2 \phi_2  +\varepsilon^3 \phi_3 + \ldots\right)^2\left( \varepsilon^1 \phi_1+\varepsilon^2 \phi_2  +\varepsilon^3 \phi_3 + \ldots -2\right)^2$$
This is to second order in $\varepsilon$
$${\cal{E}}=\varepsilon^2 \left[\frac{1}{2}(\partial_t \phi_1)^2+\frac{1}{2}(\partial_i \phi_1)^2+\frac{1}{2}(\phi_1)^2\right] + O(\varepsilon^3)$$
Filling in $\phi_1 = p_1 \cos \tau$, you get
$${\cal{E}}=\varepsilon^2 \left[\frac{1}{2}(p_1 \omega(\varepsilon)\sin\tau)^2+\frac{1}{2}(\partial_ip_1 \cos\tau)^2+\frac{1}{2}(p_1 \cos\tau)^2\right] + O(\varepsilon^3)$$
or
$${\cal{E}}=\varepsilon^2 \left[\frac{1}{2}p_1^2+\frac{1}{2}(\partial_ip_1 \cos\tau)^2\right] + O(\varepsilon^3)$$
With the rescaling of the spatial coordinates introduced in the paper, the second term is proportional to $\varepsilon^2$ and thus as a whole to $\varepsilon^4$. Then using $S=p_1\sqrt{\lambda}$ we get
$${\cal{E}}=\varepsilon^2 \frac{1}{2\lambda}S^2 + O(\varepsilon^3)$$
So, if you continue working diligently in the same fashion, you should be able to find out what the fourth order correction is.
Comment: Got it. I'm trying for the next step.
Comment: I have been expanded up to 4th order and got extra  terms $-\frac{1}{2} \epsilon ^3 \phi _1^3+\frac{1}{8} \epsilon ^4 \phi _1^4+\epsilon ^3 \phi _1 \phi _2-\frac{3}{2} \epsilon ^4 \phi _1^2 \phi _2+\frac{1}{2} \epsilon ^4 \phi _2^2$
but in the desired equation there is no term of $\varepsilon^3$ but in my expresion I got. How to get rid of it?
Comment: do you get the point?
Comment: Probably, the 3rd order expressions cancel out. You haven't used all relations yet.
Comment: But it's not vanishing :-(
Comment: Got for the 3rd order because, over the full period Time average density is  for $\cos \tau $ zero.
Comment: Can you check the $\varepsilon^4$ order?

Evaluating the time average over energy


Automated vehicle movements with 9 barcodes

Question: Of late, I have seen some AGV's working on the model of QR based navigation. However, I saw that the number of barcodes they use is many i.e. 9 (3x3 grid). I am wondering the reason for 9. I can understand the usage of 1 which would give the information about the current location, angle etc.
Answer: Might be difficult to get accurate location angle etc from one QR.  If there are many with known coordinates, it is likely more possible to determine the current orientation of the observer in relation to them.


How do I include curl library in my C project in Code Blocks (Windows)?

Question: The question seems straight forward. I tried a lot of things just to include curl in my C project using the code::blocks ide but to no avail.
I would like to use cURL's library for my console app project that needs http capabilities.
If anyone had successfully done so, then your help is very much appreciated. :)
What happened previously:
-I copied all cURL files to my project and linked the libraries (the ones with .a or .lib ext.)
-Then when I build the project. A lot of undefined reference showed up.
This is the code I was testing:
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>

    int main()
    {
     curl_global_init( CURL_GLOBAL_ALL );
     CURL * myHandle;
     CURLcode result;
     myHandle = curl_easy_init ( ) ;

     curl_easy_setopt(myHandle, CURLOPT_URL, "http://www.example.com");
     result = curl_easy_perform( myHandle );
     curl_easy_cleanup( myHandle );
     printf("LibCurl rules!\n");
     return 0;
    }

Here are the errors:
||=== Fa, Release ===|
obj\Release\main.o:main.c|| undefined reference to `_imp__curl_global_init'|
obj\Release\main.o:main.c|| undefined reference to `_imp__curl_easy_init'|
obj\Release\main.o:main.c|| undefined reference to `_imp__curl_easy_setopt'|
obj\Release\main.o:main.c|| undefined reference to `_imp__curl_easy_perform'|
obj\Release\main.o:main.c|| undefined reference to `_imp__curl_easy_cleanup'|
||=== Build finished: 5 errors, 0 warnings ===|

Comment: you need to actually tell us what the error is
Comment: It's a lot of "Undefined reference to "
Comment: You *include* it right, what you need is to *link* your program with appropriate version of libcurl.lib (or perhaps libcurl.a, dont't know for sure how Code Blocks works)
Comment: See my answer in another [post](http://stackoverflow.com/questions/6035360/codeblocks-and-lapack/9347181)
Answer: Go to your project "Build Options" -> "Linker" tab and so you have two choices:

If your library is (correctly) installed system-wide, write in "other linker options" the libs as if you were using your compiler directly.
For GCC you'd write -lcurl. You may also use this with a path instruction like Wl,-rpath,/path/to/your/library -lMyLib. Obviously it depends on the compiler and system setup.
Add the library in "Link libraries" on the left. Click the "Add" button and browse to your library file.

Take a look at this A.3 — Using libraries with Code::Blocks for some pictures.
Googling around will show you more.
Comment: -lcurl in "other linker options" worked for me on ubuntu
installed libcurl-dev (openssl) package.
Thanks
Answer: The following steps are for windows 32 users. And the following steps worked for me after several hours. This may or may not work for you as I got it after several trial and errors. So thats why I am writing the steps in elaborate manner.
step1: start code blocks
create an empty project with name proj_curl
step2: Open on this url www.paehl.com/open_source/?CURL_7.50.0

in this site download

a) click Download without ssl
b) click Download libcurl.dll (all versions) only
c) click Download the Libray (all version) only
step3: open on this url curl.haxx.se/download/curl-7.50.1.zip
 - a zip file will be downloaded automatically.
(sorry folks this site is not allowing me to insert more than 2 links, bear with me.)
Note: Now Totally You have 4 zip files downloaded

curl_750_0.zip (which contains curl.exe file)
curl_DLL_ONLY.7z(which contains folders such as nossl, RTMP, ssh...etc.)
Curl_lib.7z(which contains lib folder)
curl-7.50.1.zip(which contains curl-7.50.1 folder)

step4: create a folder in c drive(c:\libs\curl)
extract all the folders files of the 4 zip files into the curl folder in c.
Make sure to create each subdirectory for each zip file.
step5:(Very important)
In the curl folder of C drive,
- click on curl.exe(a command prompt just appears for few millisecs.)
- Go to code blocks -> Settings -> Compiler...  -> Linker settings tab -> Add
"C:\libs\curl\lib\nossl\libcurl.a"
"C:\libs\curl\lib\nossl\libcurldll.a"
then -> search directories tab -> Compiler

then -> search directories tab -> Linker

Click ok
Step6:
- open the folder "nossl" which came in the curl_DLL_ONLY.7z file.

copy the libcurl.dll file to the bin\debug folder of the code blocks project.

Step7: Now test the working of the curl library with your c program.
Note: if you encounter an error "The program cant start because zlib1.dll is missing from your computer. Try reinstalling the program to fix this problem."
Solution:
- copy and paste the url sourceforge.net/projects/mingw/files/latest/download

install the mingw-get-setup.exe by marking all the libraries.(takes about 10 min to install)
after installation, open C:\MinGW\bin, copy the zlib1.dll to the same directory as you did in step6 for libcurl.dll.

Thats it...


How to use Angular JS to get values from multi-select checkbox

Question: I would like to create check box for the multiple file download purpose. There is a list of many files and each file has the checkbox for itself. I want to select 4 of them and press download button only once then all the names of the files checked will be send as a list to controller(Angular JS). But I don't have any idea about how to start it and how to send the list of parameter back to Angular JS controller.What I want to do is to send the list back to controller and call a multiple download method written in JAVA.
Comment: What have you you tried?
Comment: I have tried to bind the value I have got from JSON and set it to each checkbox. I try to tick multiple checkbox and press submit but nothing happen. I observed from Firebug and it shows that nothing send back to AngularJS controller. Actually, I try to look for the hint or the guide on how to do like that. What I have found on the internet is just update the value from checkbox in the client side but mine is sent those value(s) as a list and send back to controller which will call another method on server side...
Answer: You can just use ng-model to assign the property to put the value in. It will automatically put it in an array. Here is a fiddle
And here's the code:
<code>  <select multiple="multiple" ng-model="value"
    ng-options="option for option in ['bananas', 'rice', 'applesauce', 'toast']"></select>
  <hr/>
  value: {{value}}
</code>
Comment: I do not quite understand why this answer is not enough for you.  You just have to put button and push event handler to access '$scope.value', don't you?  See 'ng-click' for how to add click handler if not yet.
Comment: Thank you so much. It is closed to what I try to do. I already assigned each checkbox to hold individual value that I got from JSON. However what I need to do is click check on each button and send it back to controller not just show it in client side. Because I need to perform multiple download by checked some checkbox and press only one button to download them.


Limits from the right and left

Question: Evaluate the limits below,
$$\lim_{x\to2^+}\frac{x-2}{x^2-4} $$ and
$$\lim_{x\to2^-}\frac{x-2}{x^2-4} $$
Alright, I know that the limit from the right will equal positive infinity and the left will equal the negative infinity, by graphing.
Now, how do I solve this problem without graphing??
1)How would I solve if it approaches from both direction? Do I substitute the value?
2)How would I solve from the right/left side? How would I know without graphing?
I want to use this as an example to all my related questions.
How would I solve for both side, and right/left side without graphing?
Will there be any certain value showing later?
Are there any useful theorems?

After factorized into,
$$ \frac{1}{x+2}$$
How is answer going to be different when approaching from right and left? or both sides?
Comment: Hm,

$$\frac{x-2}{x^2 - 4} = \frac{1}{x+2}$$
Comment: factor the denominator. Remember that (a+b)(a-b)=a^2-b^2
Comment: I think you misinterpreted the graph you mentioned. The +/- infinity limits you described occur at $x=-2$, not $x=2$.
Comment: I think you should rather GRAPH the function _before_ you declare you know the limits and ask how to calculate them _without_ graphing... :)
Answer: Note that the limit exists
$$\lim_{x\to2}\frac{x-2}{x^2-4}=\lim_{x\to2}\frac{x-2}{(x-2)(x+2)}=\lim_{x\to2}\frac{1}{x+2}=\frac14.$$
Answer: Hint;
$\displaystyle a^2-b^2=(a+b)(a-b)$
Answer: HiNt:
$$\frac{x-2}{x^2-4} = \frac{x-2}{(x-2)(x+2)} = \frac{1}{x+2}$$

Limits from the right and left


How do I write this in spherical coordinates?

Question: $$z=\sqrt{2x^2+2y^2}$$
I know that this is $\tan\phi=\frac{1}{\sqrt{2}}$ but the arctan of that number is 0.6154797, so I'm confused with what to put as the spherical coordinate.
Comment: It is plane in $(r, \phi, \theta)$ space.
Answer: Spherical co-ordinates are described by $$x=r\sin\theta\cos\phi$$ $$y=r\sin\theta\sin\phi$$ $$z=r\cos\theta$$
You have:$$2(x^2+y^2)=z^2\implies2(r^2\sin^2\theta(\cos^2\phi+\sin^2\phi))=r^2\cos^2\theta$$
$$\implies2r^2\sin^2\theta=r^2\cos^2\theta\implies\sin^2\theta=\frac13,\cos^2\theta=\frac23\implies\tan^2\theta=\frac12$$ as you got.
Comment: How do I find the bounds of $\phi$ for my integral?


Attribute "editable" of SVG  not working

Question: I want to make a svg text editable. After some research, I found that editable attribute can specifies whether the contents of svg elements can be edited in place (http://www.w3.org/TR/2004/WD-SVG12-20041027/text.html).
So I tried:

<text editable="true" x="0" y="20" font-size="18" font-family="Arial" fill="#000080">Name:</text>

However, I still could not edit it! (I used latest version of Google Chrome, Firefox and IE)
Answer:

<text contenteditable="true" x="0" y="20" font-size="18" font-family="Arial" fill="#000080">Name:</text>

just replace editable with contentEditable :)
Comment: Replace editable by contentEditable only works with IE (contenteditable not works, typo?).
Comment: Works in other arrangement: https://stackoverflow.com/a/49341091/3559690

Attribute "editable" of SVG  not working


Cannot run the macro. The macro may not be availabe in this workbook

Question: Having an issue with VBA error 'run time 1004'. Using the following code. The macro is called from a button in Row 5, hence the subtraction. There are other buttons in rows 6, 7, 8 etc. all calling the same macro (to subsequently call a specific userform), hence the variable.
Sub Export()
    i = RowNumber - 4

    Reinstated = "ReinstateR" & i

    Application.Run Reinstated

End Sub

The macros 'ReinstateR1', 'ReinstateR2' etc. are all stored in a separate module.
Sub ReinstateR1()

'Macro function etc.

End Sub

For some reason, though, when I click the button, I get the following error message:
"Cannot run the macro 'ReinstateR1'. The macro may not be available in this workbook or all macros may be disabled."
All macros are enabled, the macro is in the same workbook, etc. Trust centre settings are set to disable all macros with notification, etc.
I'm stumped. I can call the macro without the variable, but that's not the point...
Comment: There's your problem. Trying to run Reinstater1 will fail because the module and routine have the same name. You either need to add the module name: `Application.Run "Renstater1." & Reinstated` or, preferably, give the module a different name to the routines.
Comment: What is the name of the module that the macros are in?
Comment: The Export macro is in a module called 'Exporter', whilst the ReinstateR# macros are in a module called 'Reinstater1'.
Comment: That never crossed my mind, thanks for pointing it out.
Comment: @Rory That should be an answer...
Answer: If you have a module with the same name as a routine it contains, you need to prefix any call to it using Application.Run with the module name as well (or change the name of either the module or the routine), so in this case it's:
Application.Run "Reinstater1." & Reinstated


How do I copy over rows of data to a specific starting row?

Question: I've got the following bit of code that copies rows from one sheet to another if it is the same region that has been selected in a combo box. The problem I have is that it is copying into row 5 rather than row 6 and copying over the column titles. Do you know why this might be happening? I thought the fourth line starting "Worksheets("NLE_").Range("A")... would pick the first empty row i.e. A6, but it picks A5?
If chkNLE.Value = True And cboLA = "All" Then
LastRow = Worksheets("NLE_").Range("A" & Rows.Count).End(xlUp).Row *– clears any data that is already in the worksheet*
Worksheets("NLE_").Range("A6:W" & LastRow).Clear

For Each i In Sheets("NLE").Range("NLEregion") *– NLEregion is a named range for the column with region in it in the sheet when the data is being copied from*
    If i.Value = cboRegion.Value Then
        i.EntireRow.Copy
        Worksheets("NLE_").Range("A" & Rows.Count).End(xlUp).Offset (1)
        Sheets("NLE_").Visible = True
        Sheets("Front Page").Visible = False
        UserForm1.Hide
    End If
Next i

End If

Comment: Where is your "Paste" code
Comment: Also you can use [AUTOFILTER](http://stackoverflow.com/questions/11631363/how-to-copy-a-line-in-excel-using-a-specific-word-and-pasting-to-another-excel-s) to copy the data in one go to the destination sheet.
Comment: @Siddharth Rout thanks but I'm not quite sure how to change the code to add in a paste code. I'm assuming it would have to change all of the third and 4th lines (actually these are both on the same line in my code)? Column A has numbers 1 -5 in the first 5 rows so that excel knows there is something in those cells so I thought that would work but it doesn't.
Answer: Thanks for the suggestion @Siddarth Rout. I went away and worked out how to use Autofilter to do this and it is much quicker than my previous code, which at work was a little slow becasue we are on a thin client.
There maybe a more efficient way of doing this as I am new to VBA but this does work.
If chkNLE.Value = True And cboLA = "All" And cboLA <> "" And cboRegion <> "All" Then
Application.ScreenUpdating = False 'stops the screen from updating while copying and pasting

LR = Sheets("NLE").Range("A" & Rows.Count).End(xlUp).row ' sets LR to the last cell number in A
Set rng = Sheets("NLE").Range("A5:V" & LR) ' Sets rng from A5 to the last cell in column V - includes second row of titles

    With rng
        .AutoFilter
        .AutoFilter Field:=13, Criteria1:=cboRegion.Value 'filters on the region selected in the drop down box
        .SpecialCells(xlCellTypeVisible).Copy 'copies just the filtered data
    End With

Sheets("NLE_").Range("A5").PasteSpecial xlPasteAll 'pastes just the filtered data into NLE_
Sheets("NLE").AutoFilterMode = False

Application.CutCopyMode = False
Sheets("NLE_").Range("A5:V5").AutoFilter 'Adds the filter back to NLE_
Sheets("NLE").Range("A5:V5").AutoFilter

Application.ScreenUpdating = True 'allows the screen to update


View function php procedural

Question: In my module there will be a link that displays the counted duplicate data of every user.
Here is my query for counting duplicates of each user.
<code>if ($_POST['submit']){
$query=$db_operation->query("SELECT `lname`,`fname`,`mname`,`bday`,`gender`, COUNT(*) c FROM `user` WHERE `status` = 'ACTIVE' GROUP BY `lname`,`fname`,`mname`,`bday` HAVING c > 1 LIMIT 10"); }
</code>
Below is the sample output of count for each user:
Output
Now, using the link for another page view. I need to view the rows counted by the duplicate data.
Below is the sample output for the counted rows:
Output
I am using php language and MYSQL for database.
What query should I use to view the rows of count duplicate?
Answer: All you need to do is fetch the associative array of the duplicate rows and loop over them.
<code>$query = mysql_prepare($db_operation, "SELECT `lname`,`fname`,`mname`,`bday`,`gender`, FROM `user` WHERE `status` = 'ACTIVE' GROUP BY `lname`,`fname`,`mname`,`bday` HAVING COUNT(*) > 1 LIMIT 10"
$query->execute();
$query->get_result();
$query->fetch_assoc();

var_dump($query);
</code>
Change to suit your needs, this is just pseudo code.

View function php procedural


Retirar tudo após ? no nome do arquivo

Question: Olá!
Estou tentando renomear uma quantidade grande de arquivos no linux, porém não estou conseguindo acertar o comando. O caso é o seguinte:
Tenho diversos arquivos dentro de um diretório e seus subdiretórios que possuem o seguinte formato de nome nome_do_arquivo.ext?alguma_coisa e eu preciso renomear todos eles mantendo apenas nome_do_arquivo.ext, ou seja, retirar tudo o que estiver após o ? e inclusive o ?.
Já tentei tudo quanto é comando que achei na internet, pesquisei a documentação de rename, find, mv, etc, mas não consegui fazer o que preciso.
Listar eu até consigo com find e com ls, mas na hora de renomear é que não consigo.
Answer: Você pode utilizar o utilitário find para percorrer todos os arquivos da árvore de um determinado diretório recursivamente:
find ./xyz -type f

Cada arquivo encontrado teria seu nome alterado com o utilitário cut:
cut -f1 -d"?"

E depois renomeados com o utilitário mv.
Colocando tudo junto:
$ find ./xyz/ -type f -exec bash -c 'f=$(cut -f1 -d"?" <<< {}); mv "{}" "${f}"' \;

Exemplo ANTES:
$ tree ./xyz/
./xyz/
|-- alpha?k=5&x=3
|-- kwy
|   |-- apples?t=3
|   |-- bananas?q=1
|   `-- oranges?q=7
|-- omega?k=5&x=3
|-- qwerty?k=5&x=3
`-- teste?x=1&y=2

1 directory, 7 files

Exemplo DEPOIS:
$ tree ./xyz/
./xyz/
|-- alpha
|-- kwy
|   |-- apples
|   |-- bananas
|   `-- oranges
|-- omega
|-- qwerty
`-- teste

1 directory, 7 files

Answer: Bom dia.
O que você pode fazer é criar um bash e executar dentro da pasta que quer renomear os arquivos, percorrendo os arquivos e cortando a string.
Arquivo bash (rename.sh):
#!/bin/bash

for file in * ; do
newName=$(echo $file| cut -d'?' -f 1)
mv -v $file $newName
done

Modo de execução:
./rename.sh
Answer: Você pode tentar substituição de parâmetros no bash.
Se não houver '?' em 'alguma_coisa'. Remova de $f o caminho mais curto até encontrar o padrão ?
for f in *; do mv -v "$f" "${f%\?*}" ; done

Se não houver '?' em 'nome_do_arquivo.ext'. Remova de $f o caminho mais longo até encontrar o padrão ?
for f in *; do mv -v "$f" "${f%%\?*}" ; done

Perceba que não estou verificando se f é um arquivo. Ele vai fazer a mesma coisa com diretórios e links.

Retirar tudo após ? no nome do arquivo


How to get the dynamically-set ID of the button that is clicked in ASP.NET

Question: I've created a button dynamically that has ID and name, I now want to make a click event using the 'btnCategoryClick' method, that return the ID of that particular clicked button.  this is my code
 protected void Page_Load(object sender, EventArgs e)
    {
        MySqlConnection con = new MySqlConnection(connection);
        MySqlDataAdapter sda = new MySqlDataAdapter("SELECT * FROM category", con);
        DataTable dt = new DataTable();
        sda.Fill(dt);

        foreach (DataRow row in dt.Rows)
        {
            //responsive paneel
            Panel resPanel = new Panel();
            resPanel.CssClass = "category-panel all-category category-content";

            // een paneel voor de categorieen
            // categorie verschijnt in een vorm van een button
            Panel categoryPanel = new Panel();
            Button btnCategory = new Button
            {

                // attributen meegeven aan de categorie buttons id, naam, class
                ID = row["category_id"].ToString()
            };
            btnCategory.Text += row["categoryName"].ToString();
            btnCategory.CssClass = "category-name";
            // een klik event meegeven aan de buttons
            btnCategory.Click += new EventHandler(btnCategoryClick);

            // voeg button toe aan de paneel
            // #categoryPanel is de paneel in backend
            categoryPanel.Controls.Add(btnCategory);
            resPanel.Controls.Add(categoryPanel);

            // koppel de backend paneel aan de frontend paneel
            // pnlCategory is de frontend(html/aspx) id
            pnlCategory.Controls.Add(resPanel);

        }
    }

    private void btnCategoryClick(object sender, EventArgs e)
    {

    }

Answer: The sender of the click event will be the Button. In the event handler, just cast sender to the Button type, and grab its ID:
private void btnCategoryClick(object sender, EventArgs e)
{
     Button btn = (Button)sender;
     string categoryId = btn.ID;
}


TelephonyManager detect voicemail on outgoing call

Question: thanks again for all the help I have received here!
I have written a Listener that detects when a call has ended.
Furthermore I want to detect wheter the receiver picked up or I ended up on the mailbox.
However, I just can't figure out how to it and can't find anything on the internet (probably searching for the wrong term, as is the case most of the time).
Help would be much appreciated.
Thanks again!
Chr0n
Answer:
Detect when a call has ended is possible: Use PhoneStateListener. A CALL_STATE_IDLE state means hang up.
Picked up/dropped call: not possible.

The closest thing would be to look at the call log and figure it out from the call duration. A call duration of zero means the other end didn't pick up the phone. But this is not real time, it's after the fact. Moreover it won't tell you if the person went to voicemail; what if he hung up...
I hope this helps a little bit...


implementation using analytics for incident management

Question: i like to know if i get any
knowledge in R(predictive analysis) regarding Incident
Management..Like if an application don't load a file from source or an
alert pop up and ticket is issued for the event so on it normally get
collected in a database ,   i assume these data may be text format or
so on, which can be analysed on monthly basis ...so we will create a
predictive model using any of algorithm's used.
Comment: yes you can. But for a more specific question you should specify a bit better what your desires are regarding "create a predictive model using any of algorithm's used". Your question seems like 'we have data (about incidents), what can we do with it?'. Such question is very broad.  If specification is difficult then you might possibly be helped by first by going trough some introduction texts on business intelligence or flip trough examples of dashboards https://en.wikipedia.org/wiki/Dashboard_(business) for instance https://plot.ly/
Comment: Thanks ... usually the incident reports will collection of text and numerical values ..so classifications and segregating is important  ... in ML we can use LDA algorithms for text analysis with knn or random forest algorithms for prediction ,which will help to detect root cause of incident from the incident logs
Comment: so your question is?
Comment: Have anyone  has experience in creating R script for Predictive analysis of tickets(Incidents, Alerts) in IT service management etc If so kindly confirm...since i am working in a project based on it ...so i can confirm , which algorithm willbe  best fitted for analysis and prediction
Comment: "Predictive analysis of tickets", this is the title for a book not a simple question.

https://www.google.com/search?q="predictive+analysis+of+tickets"
Answer: Not sure if you are asking a question here. Share some data or how your data actally looks like.
As far as i know for predicting the incidents we first need to know how the data is distributed such as poission, exponential, linear or non-linear. If its machine data, they are usually exponential or poisson. In such cases, you can do curve fitting for prediction. If tge data is nonlinear, then Nonlinear regression, SVM or Neural networks can be used. If its linear, linear regression can be used.
By the way, if your data is time series, then time series forecasting would be another approach you could use. The functions for the above mentioned models are availabe in R.


Strange strptime error in python 3.5 and 3.6

Question: The following code
from datetime import datetime
dt = '2019-07-21T08:54:32.115285+00:00'
datetime.strptime(dt, '%Y-%m-%dT%H:%M:%S.%f%z')

throws the following exception in Python 3.5.3 and 3.6.8
ValueError: time data '2019-07-21T08:54:32.115285+00:00' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'

but works fine in Python 3.7.3.
I checked the 3.5 documentation but couldn't spot any changes. Any ideas?
Answer: The %z directive only allows for a colon in the time zone starting with python 3.7.
See also here


How to work with Swing timer

Question: I'm trying to stop the program for a second using Swing Timer.
Timer timer = new Timer(10000,
   new ActionListener(public void actionPerformed(ActionEvent e) {}));

didn't work
public class Card extends JButton implements ActionListener {

    int numberClick = 0;

    public card() {
        addActionListener(this);
    }

    public void actionPerformed(ActionEvent e) {
        numberClick++;

        if(numberClick == 2) {
            Timer timer = new Timer(10000, );
            timer.start();
            numberClick = 0;
        }
    }
}

Answer: You seem to lack basic understanding of how the Timer works. Please read How to Use Swing Timers. The concept is fairly simple.
The first argument in the Timer constructor is the delay. Seems you have that part down. The second argument is the ActionListener that listens for the "Timer Events" (actually ActionEvents). An event is fired each delayed time. The callback (actionPerformed) contains what should be performed after that delay (tick). So whatever you want to happen after that second, put it in the actionPerformed of the timer's ActionListener.
Also if you only want it t occur once, you should call timer.setRepeats(false);. Also note, you are using 10000, which is in milliseconds, so it's 10 seconds, not 1. You should change it to 1000
Example Flow
JButton button = new JButton("Press Me");
button.addActionListener(new ActionListener(){
    @Override
    public void actionPerformed(ActionEvent e) {

        Timer timer = new Timer(1000, new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent e) {
                System.out.println("Print after one second");
            }
        });
        timer.setRepeats(false);
        timer.start();
    }
});

Press Button → Wait One Second → Print Statement

How to work with Swing timer


Running docker exec command with a shell string and parameters in bash script

Question: I'm trying to run the following docker exec command in a bash script where I'm passing 2 parameters into the bash script.  The command is supposed to delete directories that begin with a certain string.  I don't seem to be passing in the parameters correctly:

$container is set to $1

$database is set to $2

$currdate is set internally in the bash script
docker exec $container sh -c 'rm -rf /path/to/directory/${database}-${currdate}-*/'
Comment: 1.  use your variables inside double-quotes. 2. variables inside single quotes do not interpolate. hope it will help.
Answer: You have to use double quotes to interpolate variables. Single quotes won't interpolate anything, but double quotes will.
docker exec $container sh -c "rm -rf /path/to/directory/${database}-${currdate}-*/"

From Bash manual:

220.127.116.11 Single Quotes

Enclosing characters in single quotes (') preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

126.96.36.199 Double Quotes
Enclosing characters in double quotes (") preserves the literal value of all characters within the quotes, with the exception of $, `</code>, <code>\</code>, and, when history expansion is enabled, <code>!</code>. The characters <code>$</code> and <code>` retain their special meaning within double quotes (see Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: $, `, ", \, or newline. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ! appearing in double quotes is escaped using a backslash. The backslash preceding the ! is not removed.

The special parameters * and @ have special meaning when in double quotes (see Shell Parameter Expansion).


File monitoring using syslog

Question: Can rsyslog, syslog-ng programs monitor change of file? I want to monitor files and receive the changes made to the file by syslog on server. Thank you.
Comment: What type of changes do you want to monitor?
Comment: Lines added on that file etc.
Comment: Do you need to see the actual content changed or just a notification that the file changed?
Comment: It was enough clear to be _not_ closed, imho it was closed unfairly.
Answer: Generally speaking knowing that a syslog file is been written isn't very helpful. It's more lightly that you will be looking for certain entries, e.g root authentication or web access on certain URLs. This kind of monitoring is achieved using a log monitor. Something like Swatch or LogAnalyzer. Both have a will check the syslog for patterns & inform you when a pattern is found.
Hope this was helpful.

File monitoring using syslog


Single reed mouthpieces: How do Facing Lengths, Tip Openings, and Chamber Sizes affect playing?

Question: When buying a new mouthpiece for a clarinet/saxophone - you're faced with a whole table of information on facing lengths, tip openings and chamber sizes. How do all these specifications relate to how a mouthpiece plays?
I'm interested in where each of these features are in a mouthpiece (as in, what's the 'facing', and why's it important), and how each would affect volume, tone, and control - or anything else relevant.
Comment: That's really only part of the story.  Yes, more gap leads to more sound power, but matching a mouthpiece to your embouchure (as well as your axe) is what matters.  You gotta play on the mouthpieces to figure out which one(s) work for you.
Comment: @CarlWitthoft - I realise that's a big part of it, but I'm not particularly looking at buying, I'm happy with what I have. I'm just interested in what all of specifications mean.
Comment: This is, to be honest, a very big question. The best brief online resource that I've found for this is Theo Wanne's site, under the knowledge section. http://theowanne.com/knowledge/mouthpiece-facings
Answer: What makes this complicated is that different brands of mouthpiece makers use different labeling methods for these characteristics.  Generally speaking though, you can make the following deductions:
Tip Opening:
This is the distance from the tip of the reed to the tip of the mouthpiece (when a reed is in place).  The wider the tip opening (or higher the number), the brighter the sound (think jazzy).  It is also harder to play (reed has to travel farther to vibrate), but it can help you play louder without the reed choking.
Facing Lengths: The facing is the length of the reed that is not touching the mouthpiece (again, when it's in place). The longer the facing, the higher the amount of the reed is vibrating when you play.  This means it may require more muscle to play with a long facing, but it will produce a fuller sound (better tone quality).
Chamber Sizes: The chamber size the how hollow the mouthpiece is.  The wider (or hollower) the chamber size, the warmer and fuller the sound - but it can also sound dull if it is too wide.  The narrower, the brighter and crisper.
The reason there is so much on mouthpiece specifications is because it is the most important part of your instrument (aside from the reed itself).  I've seen many people make huge improvements simply by investing in a quality mouthpiece.  Small changes to each of these variables can help you attain the particular tone you're looking for.
Which to Choose?
Many of the most commonly recommended mouthpieces have a medium facing.  Most of them also have a medium or close tip opening (for classical playing).  Chamber sizes are generally not advertised, but are usually in this medium zone as well.  The moral of the story? Choose medium, medium, medium.  But the best way to find a mouthpiece that's right for you is to go to a music store and ask to play test what they have/recommend.


Node JS - Função com return não passa os dados

Question: Estou tentando fazer uma API bem básica, para aprender, mas não consigo entender porque o return de uma função que pega dados do BD não os retorna para o outro módulo.
Estou usando Knex e ES6:
Este módulo (Controle) chama a função AtividadesTodas(), que está no módulo models:
// Seleciona todas as atividades
    async todosRegs(req, res){
        var listaAtiv = await Atividades.AtividadesTodas();
        if(listaAtiv != undefined){
            res.json(listaAtiv);
        }else{
            console.log('lista vazia');
        }

    }

No módulo Models, nesta função, os dados ficam armazenados na variável data, tanto que podem ser exibidos no console, mas, aparentemente, estes dados não retornam, pois cai sempre no else, ou seja variável undefined:
 async AtividadesTodas(){
        await knex('Atividades').select('AtividadeDesc').orderBy('AtividadeDesc').then(data => {
            console.log(data);
            return data;
        }).catch(err => {
            console.log(err);
        });

Answer: A maneira correta e utilizada é da seguinte forma retornando o promise e no node resolver e trazer a resultado, exemplo:
AtividadesTodas() {
    return knex('Atividades').select('AtividadeDesc').orderBy('AtividadeDesc');
}

e no node:
async todosRegs(req, res) {
    try {
        const listaAtiv = await Atividades.AtividadesTodas();
        if(listaAtiv != undefined) {
            res.json(listaAtiv);
        } else {
            console.log('lista vazia');
        }
    } catch (e) {
       // error
       console.log(e);
    }
}

Faça uma boa leitura nessa resposta: Quando "return" é diferente de "return await" em uma função assíncrona no JavaScript?
Comment: Muito bom. E parece aquele problema que muitos cometem de misturar `await` com `callback`. Só faltou um `try/catch` para tratar possiveis erros  do `AtividadesTodas`.
Comment: Adicionado @CmteCardeal ...
Comment: Vale lembrar que nesse caso o `return await` é redundante (é o mesmo que `return`). [Referir a esta outra pergunta.](https://pt.stackoverflow.com/a/482034/69296)
Comment: Se a função não utilizar `await` em nenhum outro lugar (apenas retornando a promessa), não é necessário não. :-)
Comment: vlw @LuizFelipe retirei e deixei retornando somente a `builder` pra resolver o `promise` fora
Comment: Verdade @CmteCardeal ...
Comment: Então @luizfelipe até o async é desnecessário?


how to overwrite the search box?

Question:

  <form action="/"  accept-charset="UTF-8" method="post" id="search-theme-form">
    <input  name="search_theme_form" id="edit-search-theme-form-1" size="15" value="" class="form-text" />

  </form>

The above code is generated by the Drupal Search module. I want to add this code to the form.
<select class="search_l" onchange="selectSearch(select)">
  <option value="0">whole site search</option>
  <option value="1">google search</option>
</select>

How do I do this?
Answer: I would rather implement hook_form_FORM_ID_alter() to alter the form returned by search_box(). If mymodule.module is the name of your module, then you should add the function mymodule_form_search_box_alter(&$form, &$form_state). You need also to replace the form submission handler with your own.
function mymodule_form_search_box_alter(&$form, &$form_state) {
  $form['submit']['#weight'] = 10;

  $form['search_type'] = array(
    '#type' => 'radios',
    '#options' => array(t('Whole site search'), t('Google search')),
    '#default_value' => 1,
    '#weight' => 5,
  );

  // Replace the search.module handler with your own.
  if (in_array('search_box_form_submit', $form['#submit'])) {
    $key = array_search('search_box_form_submit', $form['#submit']);
    unset($form['#submit'][$key]);
  }
  array_unshift($form['#submit'], 'mymodule_search_box_submit');
}

You could also show the form field containing the text to search inline with the radios you add.
The code I reported replaces the form submission handler with mymodule_search_box_submit() that must be implemented from your own module. This is the code executed from the submission handler implemented by search.module; I report it as reference.
function search_box_form_submit($form, &$form_state) {
  // The search form relies on control of the redirect destination for its
  // functionality, so we override any static destination set in the request,
  // for example by drupal_access_denied() or drupal_not_found()
  // (see http://drupal.org/node/292565).
  if (isset($_REQUEST['destination'])) {
    unset($_REQUEST['destination']);
  }
  if (isset($_REQUEST['edit']['destination'])) {
    unset($_REQUEST['edit']['destination']);
  }

  $form_id = $form['form_id']['#value'];
  $form_state['redirect'] = 'search/node/' . trim($form_state['values'][$form_id]);
}

As reference, I report here the code of the search.module function that builds the search box form.
function search_box(&$form_state, $form_id) {
  $form[$form_id] = array(
    '#title' => t('Search this site'),
    '#type' => 'textfield',
    '#size' => 15,
    '#default_value' => '',
    '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
  );
  $form['#submit'][] = 'search_box_form_submit';

  return $form;
}

Comment: `search_box()` is the function that builds the form, and it is defined in search.module; it doesn't need to be replaced. The code that replaces the form submission handler is doing exactly that: it replaces the submission handler defined from the Search module with `mymodule_search_box_submit()` (change the function name with the name of the function defined from your module). What you need to do is to create your own module that implements `hook_form_search_box_alter()` and the submission handler.
Comment: which file should i put the function search_box(){} in. i can't understand the code under Replace the search.module handler with your own.well, could you give me an explaination .thank you
Comment: If the name of your module is, e.g., custom_module then you need to replace `mymodule_` in the code I reported with `custom_module_`.
Answer: The best way to do this, IMO, would be to simply use hook_form_alter().
Answer: I think you are better off using hook_form_alter() than editing the template (no offense, but that is really bad practice).
You probably want to add a new form element and a submit handler to the search form, so you can handle the submit action and process the value of the new element.
Comment: beat me to it by a couple seconds :)
Comment: I agree!! Will delete my answer to not keep bad solutions around, not sure why theme override came to my mind first.
Answer: There is a search-block-form.tpl.php template:
https://api.drupal.org/api/drupal/modules!search!search-block-form.tpl.php/7
In that template it's important to have hidden fields. Mine currently looks like:
<form action="" method="post" class="search_form">
      <?php print $search['hidden']; ?>
        <input type="text" name="search_block_form" class="input" />
        <input type="submit"  id="edit-submit--3" name="op" value="" class="submit" />
</form>

Answer: This is great for just the search box but the results displays on the main search page, which I need to override. For that reason I want to be able to use the search-result(s).tpl.php and block files. But I can't seem to get the code correct in my template file. I tried using the code on this page changing obviously the theme template but the changes I made to the tpl.php shows they are not being used. What am I doing wrong?
function dove_preprocess_search_results(&$variables) {
  $variables['search_results'] = '';
  if (!empty($variables['module'])) {
    $variables['module'] = check_plain($variables['module']);
  }
  $index = 0;
  foreach ($variables['results'] as $result) {
    $variables['search_results'] .= theme('search_result',
      array(
        'result' => $result,
        'module' => $variables['module'],
        'extra_classes' => $index % 2 === 0 ? ' even' : ' odd',
      )
    );
    ++$index;
  }
  $variables['pager'] = theme('pager', array('tags' => NULL));
  $variables['theme_hook_suggestions'][] = 'search_results__' . $variables['module'];
}

I just thought I'd add the reason I need to edit the files is I'm using custom search module which is great but in the result it's giving me the type:allthecontenttypes in the input form plus the search results. U G L Y.

how to overwrite the search box?


Quadratic forms in quadratic fields

Question: Can we find any reference or introductory notes on the topic quadratic forms in quadratic fields?
Thanks in advance
Comment: The classic reference is *Rational Quadratic Forms* by J. W. S. Cassels, but I'm not sure it discusses quadratic fields.
Comment: Thank you. I will find out
Answer: Let $K=\mathbb Q( (-1+\sqrt(1-4c))/2 )$ be a number field. $K$ is a quadratic number field, and the norm form of $K$ is $N=x^2+xy+cy^2$. This is the simplest norm form. Suppose $jk=c$. Then $jx^2+xy+k^2$ is another representable norm form of $K$. In particular, if $h$ is the class number of $K$, then there are exactly $(h-1)/2$ unique representable norm forms of $K$ is $h$ is odd. The class numbers of quadratic fields are extensively studied and I would recommend starting there.
Comment: I tried an answer, see if you agree with it
Answer: There is what I know about this :
Let $d \in \mathbb{Z}_{<0}$ and $K =\mathbb{Q}(\sqrt{-d})$.
For each ideal class $c \in C_K$ pick a representative ideal $I_c$, a free $\mathbb{Z}$-module of rank $2$ so $I_c = u_c \mathbb{Z}+v_c \mathbb{Z}$.
Look at the positive definite integer valued quadratic form $$q_{I_c}(n,m) = N(u_cn+v_cm)= |u_cn+v_cm|^2=|u_c|^2n^2+2Re(u_c\overline{v_c})nm+|v_c|^2m^2$$
Then $N(I_c)$ is the $\gcd$ of the values taken by the $N(\alpha), \alpha \in I_c$ so $$Q_c(n,m) = \frac{q_{I_c}(n,m)}{N(I_c)}$$ is a primitive integer valued binary quadratic form.
Let $\widehat{Q_c} = \{ Q_c \circ \gamma, \gamma\in GL_2(\mathbb{Z})\}$ the class of $\mathbb{Z}$-equivalent quadratic forms. Then $\widehat{Q_c}$ depends only on $c$.
Also its discriminant doesn't depend on $c$ (up to sign it is the area of the fundamental domain of the lattice $\frac{u_c\mathbb{Z}+v_c \mathbb{Z}}{N(I_c)^{1/2}}$) so $\Delta(Q_c) = \Delta(Q_{(1)}) = \Delta_K$ which is a negative integer and a fundamental discriminant.
The complex conjugaison descends to an $Aut(C_K)$ and
$\widehat{Q_c} = \widehat{Q_{c_2}}$ iff $c = c_2$ or $c = \overline{c_2}$ .
All the primitive positive definite integer valued binary quadratic forms of discriminant $\Delta_K$ arise this way ($q$ is positive definite means $q = q_L$ for some lattice in $O_F$ with $F$ a quadratic imaginary number field, and if $L$ is not a fractional ideal then $q_L = q_{L O_F} \circ \beta$ for some $\beta \in M_2(\mathbb{Z})$ so $q_L$ is not primitive).
For non-primitive positive definite quadratic forms we'd probably develop something similar in an order of a quadratic field.
I'm not sure how to adapt all this to non-positive definite quadratic forms.
Comment: For ideal classes, there should be $h$ total, where $h$ is the class number of $K$. Except for the principal ideal class, there are $(h-1)/2$ different ideal classes, because any two can be conjugate and have the same representative ideal. This is also the number of binary quadratic forms you are looking for.
Comment: Now on the other hand, determining $I_c$ seems to be a difficult problem in general, and it is one I am currently trying to solve for cyclotomic fields $K$. But cyclotomic fields are of much more magnitude difficult to solve than quadratic fields. The hardness of this problem will depend on the class number $h$ of $K$. The larger, the more difficult.
Comment: @J.Linne In quadratic fields, for prime ideals thus for all ideals : $I \overline{I}$ is a principal ideal so $\overline{c} = c^{-1}$ and the number of quadratic forms is then $a+ \frac{h-a}{2}$ where $a = \# \{ c \in C_K, c^2 = (1)\}$. If $h= |C_K|$ is odd then $a=1$, otherwise $a = 2^n$ where $C_K \cong G \times G_2$ where $|G| $ is odd and $G_2$ is a product of $n$ cyclic groups of order a power of $2$.

Quadratic forms in quadratic fields