Mismatched entity and/or field definitions

Question: I have no idea how to fix this, I don't even understand what the problem is.
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Taxonomy term

The Term ID field needs to be installed.
The UUID field needs to be installed.
The Language field needs to be installed.
The Vocabulary field needs to be installed.
The Name field needs to be installed.
The Description field needs to be installed.
The Weight field needs to be installed.
The Term Parents field needs to be installed.
The Changed field needs to be installed.
The Default translation field needs to be installed.
The taxonomy_term.field_icon field needs to be installed.
The taxonomy_term.field_link field needs to be installed.
The taxonomy_term.field_meta_tags field needs to be installed.

I tried drush entity-updates but it finishes on error:
Character set 'utf8mb4' is not a compiled character set and is not specified
in the '/usr/share/mysql/charsets/Index.xml' file
PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Component/Serialization/Yaml.php on line 54
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: syntax error, unexpected 'class' (T_CLASS), expecting
identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in
/var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Component/Serialization/Yaml.php,
line 54

EDITED (after fixing drush install) I get the following for drush entity-updates
-sh-4.1$ drush entity-updates
The following updates are pending:

taxonomy_term entity type :
  The UUID field needs to be installed.
  The Language field needs to be installed.
  The Vocabulary field needs to be installed.
  The Name field needs to be installed.
  The Description field needs to be installed.
  The Weight field needs to be installed.
  The Term Parents field needs to be installed.
  The Changed field needs to be installed.
  The Default translation field needs to be installed.
  The taxonomy_term.field_icon field needs to be installed.
  The taxonomy_term.field_link field needs to be installed.
  The taxonomy_term.field_meta_tags field needs to be installed.
Do you wish to run all pending updates? (y/n): y
Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. Cannot add unique key                              [error]
taxonomy_term_field__uuid__value to table taxonomy_term_data: unique key already exists. in
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1470 of
/var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Failed: Drupal\Core\Entity\EntityStorageException: !message in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line    [error]
1470 of /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Cache rebuild complete.                                                                                [ok]
Finished performing updates.

The bizarre thing is that all these things (field_icon, link, meta_tags..) are installed.
The site has many modules (both custom and from the drupal community) and it works alright. Should I export it all and do a clean install and then import it?

UPDATE
I did not manage to fix this and it was giving very weird problems out of the blue, although the already created content types and nodes worked fine. After 24h+ of non stop working I reset the stype up from a clean install and copied content manually (tried doing the Configuration > Configuration synchronization with single items, but it didn't work very well).
I can report now that the problem is gone. I have no idea what could have caused it or even when.
Comment: There seem to be a few things very wrong. Apparently the PHP version that you have with drush is too old. And you don't have the utf8mb4 character set in MySQL that drupal needs. Try to figure out those problems first. But something went very, very badly with that site.
Comment: You are right, I fixed the problem and drush was able to execute a whole lot better, mind helping me out with the new error messages?
Comment: This happens all the time (to me).
Comment: @Kevin , you mean the 'mismatched' error with the Taxonomy terms?
Answer: I got the above errors but with the node table. I am not sure if this is a safe thing to do but I executed the following MySQL command at the prompt:
ALTER TABLE node DROP INDEX node_field__uuid__value;

After that the entity updates executed without any problem.
For the author's problem I suppose you could adapt the command to:
ALTER TABLE taxonomy_term_data DROP INDEX taxonomy_term_field__uuid__value;

The key should be generated the next time you run that entity updates Drush command.
Answer: I had the same problem.
The table structure changed.
It was:
CREATE TABLE `taxonomy_term_data` (
    `tid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `vid` VARCHAR(32) NOT NULL COMMENT 'The ID of the target entity.' COLLATE 'ascii_general_ci',
    `uuid` VARCHAR(128) NOT NULL COLLATE 'ascii_general_ci',
    `langcode` VARCHAR(12) NOT NULL COLLATE 'ascii_general_ci',
    PRIMARY KEY (`tid`),
    UNIQUE INDEX `taxonomy_term_field__uuid__value` (`uuid`),
    INDEX `taxonomy_term_field__vid__target_id` (`vid`)
)
COMMENT='The base table for taxonomy_term entities.'
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2157
;

And now:
CREATE TABLE `taxonomy_term_data` (
    `tid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `vid` VARCHAR(32) NOT NULL COMMENT 'The ID of the target entity.' COLLATE 'ascii_general_ci',
    `uuid` VARCHAR(128) NULL DEFAULT NULL COLLATE 'ascii_general_ci',
    `langcode` VARCHAR(12) NOT NULL COLLATE 'ascii_general_ci',
    PRIMARY KEY (`tid`),
    INDEX `taxonomy_term_field__vid__target_id` (`vid`)
)
COMMENT='The base table for taxonomy_term entities.'
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2157
;

So uuid line changed and UNIQUE INDEX removed.
I applied those changes in the database and after that I could use the drush entity-updates.


Finding solutions to the wave equation wich vanish on an interval

Question: This question is about an exercise in Shubin's invitation to PDE. I want to show that the only solution to the one-dimensional wave equation $u_{tt} = a^2 u_{xx}$, $x\in\mathbb{R},t\in\mathbb{R}$, such that $u(x,t)$ vanishes on a certain interval $(x_1-\epsilon,x_1+\epsilon)$ is $u\equiv 0$.
I tried to tackle the problem by first reducing to the case where $x_1=0$. We know that the general solution is $f(x+at)+g(x-at)$ for some $f,g\in C^2(\mathbb{R})$. What I understood so far is that the vanishing condition imposes a certain symmetry on the solution: if we have $(x_0,t_0)$ in the x-t plan, then the line $x_0-at_0=x-at$ must intersect $x=0$ at some point (precisely at $(0,\frac{-x_0}{a}+t_0))$. At that point, the vanishing condition on the solution tells us that $f(-x_0+at_0)=g(x_0-at_0)$. Since $x_0$ and $t_0$ where arbitrary, this should hold at any point and we rewrite $u(x,t)=f(x+at)-f(-x+at)$.
I've been stuck here for a couple of days now. Any help would be appreciated. Thank you.
Answer: I think it's way easier than you think! if $u(x_0,t)=0$ for any $t \in (-\infty,+\infty)$, then
$$
f(x_0-at)+g(x_0+at)=0 \quad \forall t\in (-\infty,+\infty). \tag{1}
$$
since $u$ is always zero on this interval and $\epsilon >0$ :
$$
\left\{ \begin{array}{l}
u_t(x_0,t)=0 \\
u_x(x_0,t)=0
\end{array}\right.
 \Longrightarrow
\left\{ \begin{array}{l}
-f'(x_0-at)+g'(x_0+at)=0 \\
f'(x_0-at)+g'(x_0+at)=0
\end{array}\right.
$$
and since this is for all $t \in \mathbb{R}$, therefore $f(\xi)=C_1$ , $g(\eta)=C_2$ for all $\xi ,\eta \in \mathbb{R}$ for some $C_1,C_2 \in \mathbb{R}$.
And finally by equation (1) we deduce that $f(x)=-g(x')=C \in \mathbb{R}$ for all $x,x' \in \mathbb{R}$.
so for any $(x,t) \in U \times \mathbb{R} \subset \mathbb{R}^2$:
$$
u(x,t) = f(x-at)+g(x+at) = C-C = 0.
$$
Comment: Physical intuition of this solution is also interesting. constant pattern of wave (shape of $f(x)$ and $g(x)$) moving at constant speed ($a$) at one direction ($f(x)$ moving toward positive $x$ and $g(x)$ moving toward negatives). so for any $x$ at any time $t$, there is a time at past or future which pattern of $u(x,.)$ at $(x-\epsilon',x+\epsilon)'$ (for $0<\epsilon' \leq \epsilon$) was or will be inside $(x_0 - \epsilon, x_0 + \epsilon)$ which is zero function. so $u=0$!


Gerar dados aleatórios dentro de um intervalo

Question: Não consigo retornar nenhum número. Ex: Se usar "menor 1500" e "maior 5000", era para aparecer nesse intervalo caso não tivesse entrava no while, só que não está retornando nada.
public int aleatoriar(int maior, int menor) {
    int retorno = 0;
    Calendar lCDateTime = Calendar.getInstance();
    int datarecebe = (int) (lCDateTime.getTimeInMillis());
    int recebe = datarecebe % 10000;

    if (recebe > maior || recebe < menor) {
        while(recebe >= maior && recebe <= menor) {
            retorno = recebe;
        }
    } else {
        retorno = recebe;
    }
    return retorno;
}

Comment: Se você quer gerar um número aleatório, existe algum motivo para não usar o que o Java tem pronto? Até porque o que você está fazendo não é exatamente aleatório.
Comment: Cara, você não tá alterando o recebe, como alterar o retorno?
Comment: Existe algum forte motivo para não usar os pacotes da linguagem !?
Answer: Faça uso do que já está pronto (Random) e seja feliz. Funciona melhor e dá menos trabalho:
import java.util.*;

class Main {
    public static void main (String[] args) {
        System.out.println(aleatoriar(1500, 5000));
    }
    public static int aleatoriar(int minimo, int maximo) {
        Random random = new Random();
        return random.nextInt((maximo - minimo) + 1) + minimo;
    }
}

Veja funcionando no ideone. E no repl.it. Também coloquei no GitHub para referência futura.
Mas se o seu problema não precisa de um número aleatório de fato e quiser insistir na sua forma:
import java.util.*;

class Main {
    public static void main (String[] args) {
        System.out.println(aleatoriar(1500, 5000));
    }
    public static int aleatoriar(int minimo, int maximo) {
        Calendar lCDateTime = Calendar.getInstance();
        return (int)(lCDateTime.getTimeInMillis() % (maximo - minimo + 1) + minimo);
    }
}

Veja funcionando no ideone. E no repl.it. Também coloquei no GitHub para referência futura.
Comment: @Rodolfo está pegando o horário da máquina. Para o que você deseja na outra pergunta não precisa disto, é só usar o exemplo de cima. Na verdade pode até simplificar, porque quando começa em 0 não precisa de esse nego´cio de `minimo` e `maximo`, isso é feito para deslocar o número inicial que não é necessário para você.
Comment: você pode me explicar o que 'lCDateTime.getTimeInMillis()' faz no código.
Answer: Você não está alterando o valor de retorno, pois não altera o valor de recebe, para alterá-lo deveria muda o while para o seguinte:
while(recebe >= maior && recebe <= menor) {
    datarecebe = (int) (lCDateTime.getTimeInMillis());
    recebe = datarecebe % 10000;
    retorno = recebe;
}

Daí sim você não criará um loop infinito.
Answer: A partir de Java 7 você deveria usar ThreadLocalRandom
Segundo Effective Java, terceira edição, página 268:

A partir de Java 7 você não mais deve usar Random. Para a maioria dos usos,
  o gerador de números aleatórios preferido é ThreadLocalRandom. Esta classe produz números randômicos de maior qualidade, e é muito rápida.

Em consequência, o código sugerido é
/**
 * Gera número pseudo-aleatório na faixa fornecida.
 *
 * @param primeiro O primeiro valor da faixa.
 * @param ultimo O último valor da faixa.
 * @return Um número contido na faixa indicada, incluindo os limites.
 *
 * @throws IllegalArgumentException Se a faixa for inválida, ou seja, o
 * valor {@code ultimo} é menor que o {@code primeiro}.
 */
public static int aleatorioNaFaixa(final int primeiro, final int ultimo) {
    Random rnd = ThreadLocalRandom.current();
    return rnd.nextInt(ultimo - primeiro + 1) + primeiro;
}


My LoadCharacter() Script Isn't Working Properly

Question: I am trying to make a LoadCharacter() script, but when it runs it makes the player load several times before they actually load.
Here is the code:
game.Players.PlayerAdded:Connect(function(player)
    game.ReplicatedStorage.Remotes.LoadCharacter.OnServerEvent:Connect(function()
        player:LoadCharacter()
    end)
    player:LoadCharacter()
end)

BTW I disabled CharacterAutoLoad.
Answer: Your issue is that your connection is inside the PlayerAdded event. It is causing the event to register callbacks every single time a player joins. So when any player fires the event, it is causing EVERYONE to reload their character.
So just move the connection outside it, and get the player object from the RemoteEvent. The first argument from OnServerEvent is always the player that called FireServer so you don't need to make any changes to your LocalScript.
game.Players.PlayerAdded:Connect(function(player)
    player:LoadCharacter()
end)

game.ReplicatedStorage.Remotes.LoadCharacter.OnServerEvent:Connect(function(player)
    player:LoadCharacter()
end)

Comment: This solution didn't work.


How to get calculations on json simple datasource (grafana)?

Question: Is it possible to add calculations to a json simple datasource?
On graphite datasource I can add some calculation to a value e.g. avg or total of two targets or I can add an alias for some target.
On json simple datasource specs, there are no suggestions.
Comment: were you able to connect the json datasource for raw data? How did you do that?
Comment: It was quite easy. Start with static json instead of dynamic results
Answer: That would have to be implemented in the webapp that simple-json-datasource is getting the data from. There are no plans for adding any math calculations within the plugin but we have been considering adding support to do math on any result within grafana itself. https://github.com/grafana/grafana/issues/3677


Move ASP.NET test Startup class outside of project root directory?

Question: I have a Blazor (ASP.NET Core 3.0) application (the default template) and I want to write some integration tests using Selenium. For this, I need to launch the web application before the tests run.
I do this by running
CreateHostBuilderWithStartup<Startup>(new string[0]).UseContentRoot(contentRoot).Build().RunAsync();

private static IHostBuilder CreateHostBuilderWithStartup<TStartup>(string[] args) where TStartup : class
    {
        return Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<TStartup>();
            });
    }

where contentRoot is the path to the project under test. This works fine, the server runs as expected.
My solution contains 2 projects - The application code and the test code.
However, if I try to use a Startup class from the test project which inherits from startup (i.e. CreateHostBuilderWithStartup<TestStartup>) then the server returns a 500 internal server error for every request. The error in the console output for the server is:
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware: Error: An unhandled exception has occurred while executing the request.

System.InvalidOperationException: Cannot find the fallback endpoint specified by route values: { page: /_Host, area:  }.
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DynamicPageEndpointMatcherPolicy.ApplyAsync(HttpContext httpContext, CandidateSet candidates)
   at Microsoft.AspNetCore.Routing.Matching.DfaMatcher.SelectEndpointWithPoliciesAsync(HttpContext httpContext, IEndpointSelectorPolicy[] policies, CandidateSet candidateSet)
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g__AwaitMatch|6_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.0.0-preview6.19307.2\Microsoft.AspNetCore.Http.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

If I move the TestStartup into the main code project, this works fine, but ideally I want to keep the test code in the test project. I need to use this TestStartup class so that I can override the ConfigureServices method to change the injected dependencies.
So the core of this question is, can I have the Startup class outside of the root directory of the ASP.NET Core project that I am running?
Any help with this would be much appreciated!
Comment: Probably you need to use [ApplicationParts](https://learn.microsoft.com/en-us/aspnet/core/mvc/advanced/app-parts?view=aspnetcore-2.2)? Not that I have done this yet.
Answer: From a lot of experimenting and research, it seems it is currently not possible to move the Startup class, due to a bug with it not respecting the ContentRoot path set using the UseContentRoot method. This bug is tracked by issue #11921 on AspNetCore GitHub.
A very hacky workaround if you need to be able to inject dependencies from a test project, is to create a static class Dependencies in your main project, with a static Action<IStartupConfiguration> RegisterDependencies field, which you then call in the Startup class:
public void ConfigureServices(IServiceCollection services)
{
    services.AddRazorPages();
    services.AddServerSideBlazor();
    Dependencies.RegisterDependencies(services);
}

Then, in Program.cs set RegisterDepenedencies to register the dependencies you need:
public static void Main(string[] args)
{
    Dependencies.RegisterDependencies = s =>
    {
        s.AddSingleton<IWeatherForecastService, WeatherForecastService>();
    };

    CreateHostBuilder(args).Build().Run();
}

You can now change this method in the test project to configure different dependencies when running integration tests. In your test project:
Dependencies.RegisterDependencies = s =>
{
    s.AddSingleton<IWeatherForecastService, MockWeatherForecastService>();
};

This is very hacky, hopefully the ContentRoot issue is fixed, then changing the content root to the main project should be used instead
Comment: might be a silly question but why haven't you been using like so: `Program.CreateHostBuilder(new string[0]).Build().RunAsync();` works at least for me. I got both projects binded together by a `.sln` file. Am I missing any details why this is not working for your case? Where program is from my blazor server.
Answer: For me the following worked:
Program.CreateHostBuilder(new string[0]).Build().RunAsync();

while I had to create a .sln which binds the project with the test folder like shown in this guide


Calculadora Em Linha Aplicando Multa e Desconto

Question: Nesse meu código a baixo ele faz uma soma entre campos por linha. O que não estou sabendo fazer, é quando ao clicar em um checkbox ele realizar o desconto em porcentagem e no outro checkbox somar uma multa em porcentagem .
a baixo segue a imagem como ele esta hoje
Como não entendo muito de javascript peço uma ajuda de como fazer isso funcionar

<?php

        $valor1   = '1000,00';
        $iptuf    = '250,00';
        $rateiof  = '300,00';
        $gas      = '50,00';
        $cb       = '50,00';
        $multa    = '2';  //% porcento
        $desconto = '10'; // porcento
        $totalf = '1650,00';

 $i = 1;
 while ($i <= 10) {
 $id_finan = $i++;
 ?>

        <input type="text" class="valor" name="valor[]" class="valor" id="<? echo $id_finan?>valor"  value=" <?echo $valor1?>" />
        <input type="text" name="iptu[]"         class="iptu"   size="8"   style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?echo  $iptuf?>"    id="<?echo $id_finan?>iptu"      />
        <input type="text" name="rateio[]"  class="rateio" size="8"   style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?echo  $rateiof?>"  id="<?echo $id_finan?>rateiof"   />
        <input type="text" name="gas[]"     class="gas"    size="8"  style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?echo $gas?>"                 id="<?echo $id_finan?>gas"   />
        <input type="text" name="cb[]"      class="cb"     size="8"  style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?echo $cb?>"                 id="<?echo $id_finan?>cb"   />
        Multa<input type="checkbox" name="multa[]"    class="multa"    value="<?echo $multa?>"      id="<?echo $id_finan?>multa" />
            Desconto<input type="checkbox" name="desconto[]" class="desconto" value="<?echo $desconto?>"   id="<?echo $id_finan?>desconto" />

        <input type="text" class="total" size="10" name="total[]" value="<?echo $totalf?>"  />

   <?}?>

Answer: Editado
Vamos la. Bom, dei uma revisada no seu código e entendi melhor como ele funcionalva.
Aqui está o resultado.

<?php

    $valor1   = '1000,00';
    $iptuf    = '250,00';
    $rateiof  = '300,00';
    $gas      = '50,00';
    $cb       = '50,00';
    $multa    = '2';  //% porcento
    $desconto = '10'; // porcento
    $totalf = '1650,00';

 $i = 1;
 while ($i <= 10) {
 $id_finan = $i++;
 ?>

    <input type="text" class="valor" name="valor[]" class="valor" id="<?php  echo $id_finan?>valor"  value=" <?php echo $valor1?>" />
    <input type="text" name="iptu[]"         class="iptu"   size="8"   style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?php echo  $iptuf?>"    id="<?php echo $id_finan?>iptu"      />
    <input type="text" name="rateio[]"  class="rateio" size="8"   style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?php echo  $rateiof?>"  id="<?php echo $id_finan?>rateiof"   />
    <input type="text" name="gas[]"     class="gas"    size="8"  style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?php echo $gas?>"                 id="<?php echo $id_finan?>gas"   />
    <input type="text" name="cb[]"      class="cb"     size="8"  style="height: 20px;"  style="width: 20px; margin: 0 auto;" value="<?php echo $cb?>"                 id="<?php echo $id_finan?>cb"   />
    Multa<input type="checkbox" name="multa[]"    class="multa"    value="<?php echo $multa?>"      id="<?php echo $id_finan?>multa" />
        Desconto<input type="checkbox" name="desconto[]" class="desconto" value="<?php echo $desconto?>"   id="<?php echo $id_finan?>desconto" />

    <input type="text" class="total" size="10" name="total[]" value="<?php echo $totalf?>"  />

<?php }?>

Explicação
Eu mantive a sua estrutura. Mas mudei os eventos das suas var classMulta e var classDesconto para change.
Também criei duas variaveis de verificação "aplicarMulta" e "aplicarDesconto". onde verifico se os inputs checkbox estão checados.
O resto é só calculo. Revisando o código você vai entender todas as modificações sem problemas! ;)
Comment: Alan Obrigado pela Ajuda, mais agora nesse script não funciona mais os cálculos dos outros campos
Comment: Revisei seu código e fiz algumas alterações. Dê uma olhada em como ficou. ;)
Comment: Perfeito agora ..


PowerBuilder 12 how to determine encoding of input file

Question: I'm new to PowerBuilder 12, and would like to know is there any way to determine the encoding (e.g. Unicode, BIG5) of an input file. Any comments and code samples are appreciated! Thanks!
Answer: From the PB 12.5 help file :
FileEncoding ( filename )
filename : The name of the file you want to test for encoding type
Return Values
EncodingANSI!
EncodingUTF8!
EncodingUTF16LE!
EncodingUTF16BE!
If filename does not exist, returns null.
Answer: Finding Unicode is pretty easy, if you assume the Unicode file has a BOM prefix (although reality is that not all Unicode files do have this). Some code to do this is below. However, I have no idea about Big5; it looks to me (at first glance at the spec, never had occasion to use it) like it doesn't have a similar prefix.
Good luck,
Terry
<code>function of_filetype (string as_filename) returns encoding

integer li_NullCount, li_NonNullCount, li_OffsetTest
long ll_File
encoding le_Return
blob lblb_UTF16BE, lblb_UTF16LE, lblb_UTF8, lblb_Test, lblb_BOMTest, lblb_Null

lblb_UTF16BE = Blob ("~hFE~hFF", EncodingANSI!)
lblb_UTF16LE = Blob ("~hFF~hFE", EncodingANSI!)
lblb_UTF8 = Blob ("~hEF~hBB~hBF", EncodingANSI!)
lblb_Null = blobmid (blob ("~h01", encodingutf16le!), 2, 1)

SetNull (le_Return)

// Get a set of bytes to test
ll_File = FileOpen (as_FileName, StreamMode!, Read!, Shared!)
FileRead (ll_File, lblb_Test)
FileClose (ll_File)

// test for BOMs: UTF-16BE (FF FE), UTF-16LE (FF FE), UTF-8 (EF BB BF)
lblb_BOMTest = BlobMid (lblb_Test, 1, Len (lblb_UTF16BE))
IF lblb_BOMTest = lblb_UTF16BE THEN RETURN EncodingUTF16BE!

lblb_BOMTest = BlobMid (lblb_Test, 1, Len (lblb_UTF16LE))
IF lblb_BOMTest = lblb_UTF16LE THEN RETURN EncodingUTF16LE!

lblb_BOMTest = BlobMid (lblb_Test, 1, Len (lblb_UTF8))
IF lblb_BOMTest = lblb_UTF8 THEN RETURN EncodingUTF8!

//I've removed a hack from here that I wouldn't encourage others to use, basically checking for
//0x00 in places I'd "expect" them to be if it was a Unicode file, but that makes assumptions

RETURN le_Return
</code>
Comment: Thanks Terry! I will try that out.


Need help to understand Uniqueness of Lifts theorem's proof.

Question:
Theorem: Let $p:E \to B$ be a covering map. Fix $b_0 \in B$ and $e_0 \in p^{-1}(b_0)$. Let $f: X \to B$ be a continuous map with $f(x_0)=b_0$ and $X$ is connected. Suppose $g_1,g_2: X \to E$ are two continuous maps such that $p \circ g_1= p \circ g_2 = f$ and $g_1(x_0)=g_2(x_0)=e_0$, Then $g_1=g_2$.

For proving this theorem, my teacher first considered a set $S=\{x \in X |g_1(x)=g_2(x)\}$. The theme of proof was showing $S$ to be both open and closed in $X$ and then using connectedness of $X$ to show that $S=X$.
Now, the part of proof I am not able to understand is proving that $S$ is open. It is as follows:

Fix $x_1 \in X$ arbitrarily. Let $V_{f(x_1)}$ be any evenly covered neighbourhood of $f(x_1)$. Since $f$ is continuous, there exists a neighbourhood $W_1$ of $x_1$ such that $f(W_1) \subseteq V_{f(x_1)}$.
  Put $e_1=g_1(x_1)=g_2(x_1) \in E$. Let $U$ be the slice over $V_{f(x_1)}$ containing $e_1$.
  Since $g_1,g_2$ are continuous, there exist open neighbourhoods $W_2,W_3$ of $x_1$ in $X$ such that $g_1(W_2) \subseteq U$ & $g_2(W_3) \subseteq U$.
  Let $W_0=W_1 \cap W_2 \cap W_3$.
  Now, since $p \circ g_1 = p \circ g_2 = f$, therefore $f(x)=p(g_1(x))=p(g_2(x)) \forall x \in W_0$ where $g_1(x),g_2(x) \in U \forall x \in W_0$.
  But $p|U: U \to V_{f(x_1)}$ is a bijection $\Rightarrow g_1(x)=g_2(x) \forall x \in W_0$. Hence $W_0 \subseteq S \Rightarrow S$ is open.

Last line of the proof i.e. getting $S$ to be open is clear to me. But how we get $g_1(x)=g_2(x) \forall x \in W_0$is not clear to me.
Answer: As $p$ is a bijection in $U$, in particular is injective, so $p(a)=p(b)$ implies that $a=b$ in $U$. In particular, take $a=g_1(x)$ and $b=g_2(x)$.
Edit:
Pick $x_1\in X$. We want to see that $g_1(x_1)=g_2(x_1).$ Well, given this $x_1$ we can find an open set $W_0$ containing $x_1$ with the particular property that $f(x)=p(g_1(x))=p(g_2(x))$ for every $x\in W_0$. But moreover, we have chosen $W_0$ in such a way that $p$ in bijective (in particular, injective) when restricted to $g_1(W_0)$ and $g_2(W_0)$, which are both contained in $U$. Therefore, if we pick any $x\in W_0$, we have $g_1(x)=g_2(x)$ due to the injectivity of $p$. In particular, it works for $x=x_1$. If you now pick a different $x_2\neq x_1$, we follow the same process to find a possibly different $W_0'$ where to apply our hypothesis.
If you choose $x_1\neq x_2$, of course that you need not have $g_1(x_1)=g_2(x_2)$, for the very reason that a map usually takes different values at different points (unless it is constant). For a concrete example, pick $p:X\to X$ to be the identity on the connected space, say $\mathbb{R}$, and any map, say the inclusion $[0,1]\to \mathbb{R}$, playing the role of $g_i$.
Comment: Why can't $a = g_1(x_1)$ and $b = g_2(x_2)$ for $x_1 \neq x_2 \in X$ in that case ?
Comment: Given $x_1\in X$, we have found a distinguished open set $W_0\subseteq X$ containing $x_1$, with the particular property that for every $x\in W_0$, $f(x)=p(g_1(x))=p(g_2(x))$. Moreover: we have obtained this open set $W_0$ with the property that $p$ is injective over $g_1(W_0)$ and $g_2(W_0)$ , which gives that for this particular $x$ fixed, $g_1(x)=g_2(x)$. If you choose different points $x_1\neq x_2$, it is usually the case that $g_1(x_1)\neq g_2(x_2)$. I'm sorry if I'm not explaining well, I can try again.
Comment: I think I've realized my over-thinking about this proof. Your explanation helped me in this. Thanks a lot.


Ratio of two independent standard normal random variables is Cauchy : a pathwise explanation?

Question: The ratio $N/N'$ of two independent standard (mean 0, variance 1) Gaussian variables is Cauchy distributed.
The computational proof is nice and fine, but does not explain why this happens; is there a pathwise/intuitive explanation to this fact ?
I know that Cauchy is the intercept of a standard BM started at $(1,0)$ when it hits the line $y=0$, or that Cauchy is the intercept of a random line passing by (1,0) and whose angle with the line $x=0$ is uniformly distributed on $(-\pi/2, \pi/2)$.
Answer: Think of picking a pair of independent standard normal r.v. and looking at their ratio as picking a random point in the plane according to a bivariate normal distribution with parameters $(\mu_1=0,\mu_2=0,\sigma_1=1,\sigma_2=1,\rho=0)$ and looking at the slope of the line through (0,0) and your point. Since you're only interested in the ratio of the variables/slope of the line and because of the rotational symmetry of your distribution, this is equivalent to picking a point on the circle of radius 1, the angle with respect to the X-axis chosen randomly from let's say $[0,2\pi)$. This is equivalent to your second characterization of a Cauchy random variable if you think about it for a while.
Comment: Nice and clean indeed; rotational symmetry of the random point is indeed sufficient (when the constraint that the two coordinates are independent is added, then it forces them to be gaussian).


Python Loop with sinus and two variables

Question: I would like to set up a loop with two variables from two arrays. Inputs are geographical coordinates and I want to calculate their distance to a certain point location (X0, Y0).
So far, I have:
x = open('Long.txt','r').read().splitlines()
y = open('Lat.txt','r').read().splitlines()

### Convert to array
x_array = np.array(x)
y_array = np.array(y)

### Define location of origin
Y0 = -21
X0 = 170

sin0=sin(Y0)
cos0=cos(Y0)

### Calculate distance for each geographical coordinate pair (x_array,y_array)

for i, j in zip(x_array, y_array):
    distance = arccos(sin0*sin(j)+cos0*cos(j)*cos(X0-i))
    print distance

However, I get the following error:

TypeError: ufunc 'sin' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

If someone could please help me with this one, that would be great! Thank you so much in advance!
Isi
Comment: You should show the relevant import statements, because while it may be clear from the error message, from the code itself, it is not possible to tell whether `sin` refers to `math.sin` or `numpy.sin`.
Comment: Could you post the values of `x_array` and `y_array`?
Comment: You should also post the full traceback, because there are multiple calls to `sin`, so strictly, it is not possible to determine at which point the `TypeError` is raised (presumably not in the first call, but strictly speaking, this can't be certain).
Comment: Please use Python 3. Python 2 is abandoned, and should not be used for any new code.
Answer: You never convert your input values to numbers: x_array and y_array will be NumPy arrays of strings, not arrays of numbers. You can't perform sin operations on arrays of strings. Convert the strings to numbers first:
x_array = np.array(x).astype(np.float)

and similar for y_array.
Answer: To calculate distance, something needed to do firstly:

convert string value of x, y to float
use math or numpy to calculate trigonometric functions, here for math.
convert angle to radian

Example:
import math

x = ['12.5', '33']
y = ['33.5', '11.3']

Y0 = -21
X0 = 170

X = map(float, x)
Y = map(float, y)

sin0 = math.sin(Y0/180*math.pi)
cos0 = math.cos(Y0/180*math.pi)

for i, j in zip(X, Y):
    distance = math.acos(sin0*math.sin(j/180*math.pi)+cos0*math.cos(j/180*math.pi)*math.cos((X0-i)/180*math.pi))
    print(distance)

Comment: Updated as above.
Comment: Note that the OP doesn't state their input needs conversion (it may already be in radions), although the 170 is a giveaway it does require a conversion to radians.
Comment: Revised from list to map for X and Y


SAS: ID variable based on several conditions

Question: I have following dataset:
ID      Status
1       cake
1       cake
1       flower
2       flower
2       flower
3       cake
3       flower
4       cake
4       cake
4       cake

Basically, I am only interested in the observations that, grouped by the ID, include at least one flower. Also I want an indication of whether the observation grouped by ID only has flower or if it was cake too. E.g. I would ideally like something like:
ID      Status      Indicator
1       cake        1
1       cake        1
1       flower      1
2       flower      2
2       flower      2
3       cake        1
3       flower      1
4       cake        0
4       cake        0
4       cake        0

I have tried to subset the dataset in multiple ways and merge together, conditional on the ID, but it does not seem to be working.
Comment: please include your code, what have you tried?
Answer: proc sql comes to mind:
proc sql;
    select t.*, tt.indicator
    from t join
         (select id, sum(case when status = 'flower' then 1 else 0 end) as indicator
          from t
          group by id
         ) tt
         on tt.id = t.id;

proc sql also has a "remerge" extension to SQL.  That allows you to do:
proc sql;
    select t.*, tt.indicator,
           sum(case when status = 'flower' then 1 else 0 end) as indicator
    from t j
    group by id;

Answer: This SAS data step based on your input (which I called test here) will return that indicator value by ID group.
proc sort data=test;
by ID descending status;
run;

data result(drop=status);
set test;
by ID;
retain indicator;
if first.ID then indicator=0;
if status='flower' and indicator=0 then indicator=2;
if status='cake' and indicator=2 then indicator=1;
if last.ID then output;
run;

You could join that result with the source data to get the result as you provided it in your post.
NOTE: I don't have enough reputation to comment on the answer provided by Gordon Linoff but I just want to point out that there the indicator will not take three values (0='no flower',1='cake+flower',2='only flower') but will instead be a count of the number of 'flower' entries per ID, which I don't think is quite what the poster is asking for.
Rewritten as follows will give the expected result with indicator values 0='no flower',1='only flower',2='cake+flower'
proc sql;
  select t.*,
         (count(distinct status))*(sum(case when status = 'flower' then 1 else 0 end)>0) as indicator
  from test t
  group by id;
;
quit;

Comment: I did something similar to this earlier, but the problem is that it only gives the indicator variable a value if last.id=1, so the rest of the observations are given 0 as value although they should be categorized as 1 or 2.
Comment: @Karen Larsen Like I mentioned, joining this result with your source table will give you the result as you listed it in your original post. Otherwise, I added an edit with the "corrected" version of Gordon Linoff's answer (where the meaning of  values 1 and 2 of indicator are swapped from what you posted).
Comment: Thank you a lot!
I am running the code now, but it seems like my computer is having problems, which is probably related to the dataset containing 2,5 mio. observations.
By any chance, do you know a code that requires less of the computer?
Comment: @KarenLarsen I personally get better performance by running the "data step" solution and joining with the source than by running the "proc sql" solution; but they were both pretty efficient on my local machine. If you are running the SQL solution, you might want to add a `create table` statement at the beginning of the query as SAS otherwise creates a report output which takes significantly longer than creating a table output.
Answer: If your data is already sorted by ID then you could use a double DOW loop. The first loop will check for the presence of the values. Then you can use another loop to write back all of the detail rows for that group.
data want ;
  do until (last.id);
    set have;
    by id;
    if status='flower' then _flower=1;
    else if status='cake' then _cake=1;
  end;
  if _flower and _cake then indicator=1;
  else if _flower then indicator=2;
  else indicator=0;
  do until (last.id);
    set have;
    by id;
    output;
  end;
run;

This should be fast assuming the data is already sorted.


Equivalence Classes of a Markov Chain with Transition Matrix

Question: I have the following transition probability matrix for a markov chain with state space S={0,1,2,3,4,5,6}:
$\begin{bmatrix}
\frac13 & \frac13 &0 & 0 & \frac16 & 0 & \frac16\\
0 & \frac13 & 0 & \frac13 & 0 & \frac13 & 0\\
0 & 0 & \frac13 & 0 & \frac23 & 0 & 0\\
0 & \frac14 & 0 & \frac14 & 0 & \frac12 & 0 \\
0 & 0 & \frac12 & 0 & \frac12 & 0 & 0\\
0 & \frac12 & 0 & \frac12 & 0 & 0 & 0\\
\frac13 & \frac14 & \frac14 & 0 & 0 & \frac16 & 0
\end{bmatrix}$
Problem:
Find the equivalence classes (recurrent and transient states)!
My attempt:
{0} transient
{1,3} transient
{2,4} recurrent
{6} transient
I think this is wrong, there should only be 3 transient states.
Can someone check it please?
Answer: Here's a graph depiction of the Markov chain (including all possible transitions, but ignoring loops [transitions from a state to itself]).

So there are three equivalence classes (0 and 6 should be together, and 5 was missing from the original attempt).  Also states in $\{1,3,5\}$ should be recurrent.


Tail bounds on a function of normally distributed variables

Question: I am looking for tail bounds (both at $0$ and at $\infty$) for
$$ Z:=\exp \left(\frac{\alpha}{4}(X-Y)^2+\frac{\alpha}{2}(X+Y)\right)$$
where $\alpha$ is a positive real and $X,Y$ are i.i.d. normal with mean $0$ and variance $\sigma^2 >> 1$. I would like to control the probability of $Z$ being outside an interval $[a,b]$ in the limit of small $a$ and large $b$.
My first approach was characteristic functions, I managed to compute
$$ E[\exp(i\omega \log Z)] = \frac{1}{\sqrt{1+i\alpha\sigma^2\omega}}\exp\left(-\frac{1}{4}\alpha^2\sigma^2\omega^2\right)$$
but i could not find an inverse Fourier transform or do something useful with it.
Comment: (+1) Welcome to the site, Sven. First, you might note that $X-Y$ and $X+Y$ are actually iid $\mathcal N(0,2\sigma^2)$ random variables and $\exp z$ is a monotonic function, so your problem reduces to finding tail bounds on $\beta \sigma^2 Z_1^2 / \sqrt{2} + \beta \sigma Z_2$ where $Z_1$ and $Z_2$ are iid standard normal. (Here $\beta = \alpha / \sqrt{2}$ and $Z_1^2$ is, of course, a $\chi^2$ random variable with one degree of freedom, independent of $Z_2$.)
Comment: First of all, thank you for the welcome and your answer. The $\alpha$ (no squares) is correct in both cases.
I also head the idea to split it into chi-squared and normal, actually that is how i computed the characteristic function. But unfortunately I couldn't do any more.
Regarding your question what would be 'good enough', I will have to think about that, first. I will post something about that later. But in general, the sharper, the better, obviously...
Comment: Instead of considering $X-Y$ and $X+Y$ as iid normal random variables, perhaps something like $$P\{Z>z\}=P\{aX^2+bY^2+cXY+dX+eY > \ln z\}$$ where the right side is the probability that the random point $(X,Y)$ lies outside an ellipse might work. A lower bound on the tail probability is thus the probability that $(X,Y)$ is outside the rectangle bounding the ellipse might work. An upper bound would be the probability of being outside an inscribed rectangle. Note that because of the circular symmetry, the ellipse can always be taken as having major and minor axes parallel to the $x$ and $y$ axes.
Comment: I like the idea of approaching the problem from geometry. However one problem is, that in the above case, $b^2-4ac = 0$ and we have a parabola instead of an ellipse - bounding by rectangles is probably not an option, maybe by perturbing the problem $b\rightarrow b-\varepsilon$ and then let $\varepsilon\rightarrow 0$, but somehow, I doubt this works. I will still give it a try.
To answer cardinal's question what I need it for: I want to sandwich the expression $Z\in [K^{-1},K]$ "in distribution" between two __i.i.d.__ Bernoulli variables.
Comment: I find it interesting that you have $\alpha$ in front of both terms. Is that correct, or should the first term have $\alpha^2$? Also, for tail bounds, one is usually interested in achieving at least some particular rate of convergence. What would be "good enough" for the problem you are considering?
Comment: @SvenStodtmann Yes, I realized that we have a parabola to contend with, not an ellipse, and have posted an answer discussing how the problem might be approached.
Answer: Using the idea suggested by @cardinal, let $a$ and $b$ denote positive numbers and
consider a random variable $Z$ defined as $Z = \exp(aX^2 + bY)$ where $X$ and $Y$
are independent standard normal random variables.  Then, for $K > 1$,
$$\begin{align*}
P\{Z > K\} &= P\{\exp(aX^2 + bY) > K\}\\
&= P\{aX^2 + bY > \alpha\} & \text{where}~\alpha = \ln K\\
&= \int_{-\infty}^\infty \phi(x)P\{aX^2 + bY > \alpha\mid X = x\}\,\mathrm dx\\
&= \int_{-\infty}^\infty \phi(x)P\left\{Y > \frac{\alpha-ax^2}{b}\right\}\,\mathrm dx\\
&= \int_{-\infty}^\infty \phi(x)Q\left(\frac{\alpha-ax^2}{b}\right)\,\mathrm dx\\
&= E\left[Q\left(\frac{\alpha-aX^2}{b}\right)\right]
\end{align*}$$
where $\phi(\cdot)$ is the standard normal density function and $Q(\cdot)$ is the
complementary cumulative probability distribution function of a standard normal
random variable. I suspect that this integral cannot be computed
analytically, but its value might be computable very fast by numerical integration
(cf. this answer by whuber
for a different problem.
Now, $Q((\alpha -ax^2)/b)$ is an even function of $x$
with asymptotic value $1$ as $x \to \pm\infty$ and a minimum value of
$Q(\alpha/b) <\frac{1}{2}$ at
$x=0$. So, we get the obvious lower and upper bounds
$$Q(\alpha/b) < P\{Z > K\} < 1.$$
Tighter upper bounds can be obtained by bounding $Q((\alpha - ax^2)/b)$ from
above by $1$ for $|x| > \beta$ for some suitable $\beta$; and by straight
lines through $(-\beta,1)$ and $(0,Q(\alpha/b)$, and through
$(0,Q(\alpha/b)$ and $(\beta, 1)$ for $|x| \leq \beta$. Since $x\phi(x)$ is
a perfect integral, the expected value of this upper bound can found
as something like $2Q(\beta) + f(\beta)$ where $f(\cdot)$ is an
exponential function of $\beta$, and one could even choose the value
of $\beta$ to minimize this upper bound.
Alternatively, note that $Q(t) \leq \frac{1}{2}\exp(-t^2/2)$ for $t \geq 0$,
and so for $-\sqrt{\alpha/a} \leq x \leq \sqrt{\alpha/a}$, we have
$$Q((\alpha - ax^2)/b)\leq \frac{1}{2}\exp(-((\alpha - ax^2)/b)^2/2)$$
which might lead to a better bound since $\phi(x)$ is large only when
$|x|$ is small and that is exactly where we have a better upper bound
that the straight-line bounds mentioned above.


How to get source code of native C language library used in java 1.4?

Question: I want to see implementation of java.util.zip.CRC32. But within this class its using native c library functions for core implementation.How can I get the native source code. I can see the java.util.zip.CRC32 source code, but this doesn't have the actual implementation.
Comment: __Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.__ It is perhaps unwise to post this code in a public forum.
Comment: This is proprietary code. You cannot get the source code because it is not open source. Sun includes some of the source code with the JDK, but that doesn't make it open source. Only later versions of Sun's JDK are available as open source. http://www.opensource.org/
Comment: its not containing actual core implementation.Thats why i did.But thanks for advice.
Answer: You must ask SUN, I mean Oracle about having the source code...  :-/
You can try the source code for Java 6 at this download page. CRC32 should not have changed much between Java 1.4 and 6.
Answer: Sun Java 1.4 is not open source.


message and title are not moving into Firebase DB

Question: I was writing a PHP Curl Code to send data from website to Firebase.
But It's is not saving in Firebase Database.
I had wrote below code for that ....
<?php
$message = 'msg_1';
$title = 'title_1';
$url = 'https://fcm.googleapis.com/fcm/send';
$server_key = 'SERVER_KEY';

$key = 'db_key';

$headers = array
(
    'Authorization:key ='. $server_key,
    'Content-Type: application/json'
);

$fields = array
(
    'to' => $key,
    'users'=>array
    (
        'username' => $title,
        'message' => $message
    )
);

$payload = json_encode($fields);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
echo $result;

?>

It response me below line
    {"multicast_id":5950089806102679843,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
My FireBase DB
Kindly tell me the problem
Answer: If saved to a firebase database, write this.
<?php
// Constants
$FIREBASE = "_YOUR_FIREBASE_URL_";
$NODE_SAVE = "users.json";

$message = 'msg_1';
$title = 'title_1';

$data = array(
    'username' => $title,
    'message' => $message
);
// JSON encoded
$json = json_encode( $data );
// Initialize cURL
$curl = curl_init();

curl_setopt( $curl, CURLOPT_URL, $FIREBASE . $NODE_SAVE );
curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, "PUT" );
curl_setopt( $curl, CURLOPT_POSTFIELDS, $json);
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );

// Close connection
$response = curl_exec( $curl );
curl_close( $curl );
// Show result
echo $response . "\n";
?>

But your code. It means sending FCM.

Do you want to send an FCM or firebase database record?
Comment: Thanks.
Sir, It's replacing the previous one. and also not saving as it should be save.
Comment: No problem, we are happy to help


Real Analysis: Series and Converges of sequences

Question: a) For all $n\in\mathbb{N}$ and $a\neq0$, show that
$$\sum_{k=1}^{n} \frac{a-1}{a^k}=1-\frac{1}{a^n}$$
b) For a sequence $(x_n)$ in $\mathbb{R}$, suppose that there exists an $b\in(0,1)$ such that
$$|x_{n+1}-x_n|\leq b^n,\text{ for all $n\in\mathbb{N}$}$$
Use part (a) to prove that $x_n\to x$ for some $x\in\mathbb{R}$. Note: if $0<b<1$ then $b=\frac{1}{a}$ for some $a>1$. Then use part (a), since $a>1\neq 0$
My Concern: I already proved the part (a). In part (b), I don't know how to prove it. Does anyone can prove and explain the part (b)?
Comment: b) is  a very popular question on this site and it has been answered  many times.
Comment: Wow really?!
I will try to search it and study their solution Thank You
Answer: We have for $n>m$,
$$\begin{align}
|x_{n}-x_m|&=|x_{n}-x_{n-1}+x_{n-1}-x_{n-2}+\cdots +x_{m+1}-x_m|\\\\
&=\left|\sum_{k=m+1}^{n}(x_{k}-x_{k-1})\right|\\\\
&\le \sum_{k=m}^{n-1} b^{k}\\\\
&=\frac{b^{m}-b^{n}}{1-b}
\end{align}$$
Since $b<1$, then we have that for all $\varepsilon>0$, $|x_n-x_m|<\varepsilon$ whenever $m$ and $n$ are sufficiently large.  Inasmuch as $x_n$ is a Cauchy sequence, it converges.  And we are done!
Comment: I really understand your solution, thank your for this!!
Comment: Pleased to hear.  You're welcome.


In Excel, is it possible to create a hyperlink by combining two cells?

Question: Example:
Cell 1: http.standardlink/
Cell 2: [idnumber]
Result: http.standarlink/[idnumber]

Can I make the result a clickable hyperlink, so that I can quickly create a bunch of buttons to links made up of cell 1 and ID numbers?
I know you can manually make each one a clickable link, but I'm looking for a solution where I can simply put in the ID in one cell, and get a clickable link in the next.
I've previously been able to create the text version of a link by combining the values of a cell, but the actual link would have to be copied and pasted into your browser to access.
Answer: Yes, you can make. Use HYPERLINK formula with concatenated cells (&) as an argument: =HYPERLINK($A$2&B2)
Result:
Comment: That is beautiful, can't believe I didn't figure that myself. Can I make it only show the ID in the cell, while still linking to the generated link? (The reason I ask is because the "LINK" feature grays itself when I use this formula)
Comment: You should check HYPERLINK manual. Second argument is for name: =HYPERLINK($A$2&B2,B2)
Comment: Thank you, turns out I was making a mistake by using US formatting instead of EU for the second argument. Really appreciate the help!


Overflow with animation won't work

Question: I'm trying to prevent overflow on my website, even though i have divs that flows outside with animation.
You can see it at this link.
I did overflow-x:hidden
overflow-y:hidden
on the body, html, headers, footer and the cloud divs.
It works just fine on desktop browsers, but on mobile you can scroll both vertical and horizontal.
Why is that? there is nothing odd in my code. the animations start at -200px and end on 2000px (left).
This is my HTML:
> <!DOCTYPE html>

        <meta charset="utf-8">
            <meta name = "viewport" content = "width=device-width, height=device-height, minimum-scale=1, maximum-scale=1">
            <meta name = "apple-mobile-web-app-capable" content = "yes" />
            <link type="text/css" rel="stylesheet" href="css/normalize.css">
            <link type="text/css" rel="stylesheet" href="css/style.css">
        <title>Tweezers</title>

we're working on our awesome website

meanwhile you can reach us via:

What I'm missing?
Thanks, Boaz.
Answer: In which mobile device are you checking your page and in which browser?
There is a similar issue in firefox 18 Android device. Please refer this : http://jbkflex.wordpress.com/2013/04/04/css3-transformations-showing-content-outside-overflowhidden-region-in-firefoxandroid/
Comment: I tried on Safari (iPhone 4&5) and Chrome (Nexus). will check it! thank you.
Answer: Try adding the following meta tag in your HTML page,
<meta name="viewport" content="width=device-width,height=device-height">

Comment: I have it (edited the question, added the html code).. and it still have this weird overflow on mobile. strange :(
Comment: sure, I have overflow:hidden on all of my containers. I even did overflow-x and overflow-y hidden.

Overflow with animation won't work


Erro em NamedQuery

Question: Boa noite pessoal, estou querendo criar uma namedquery com uma consulta no banco.
Segue:
@NamedQuery(name="ListagemProdutosMesa",query="select Produto p FROM Produto p, Pedido pe, Conta c, Pedido_produto pp  where pe.id = pp.pedido_id and pp.produto_id = p.id and c.id = pe.conta_id and c.id=:idConta")

Onde essa tabela Pedido_produto é a tabela criada só para referenciar as chaves estrangeiras( acho que o problema esta aí).
O engraçado é que essa query roda de boa direto no Postgres e no Java está dando erro. Alguém poderia me ajudar???
Comment: Qual erro? Como está mapeada sua tabela de Produto no Java?
Comment: Amigo, obrigrado por responder. Consegui resolver já. Como eu estava mapeando em java eu nao estava pensando como objetos, segue a query: @NamedQuery(name="ListagemPedidoMesa",query="select pe.produto from Pedido pe, Conta c where c.id = pe.conta.id and c.numeroMesa =:nMesa and c.situacao = false")
Comment: Coloca como resposta da sua própria pergunta :)
Answer: Já consegui resolver!
Como eu estava mapeando em Java eu nao estava pensando como objetos, segue a query:
@NamedQuery(name="ListagemPedidoMesa",query="select pe.produto from Pedido pe, Conta c where c.id = pe.conta.id and c.numeroMesa =:nMesa and c.situacao = false")

Erro em NamedQuery


Can't get current user context in page panager

Question: I'm using page manger with panel, and Rng module.
I want a custom page for the registration page (the page to see the registrant information, provided by the Rng module) depending of the current user's role.
So i added a registration page with page manager with this path:
/registration/%
It work, but when i want to set the role has a selection criteria, it's not in the drop down, because there is no current user in the context.
How can i had the current user (not a specific user) in the context?
Comment: In the 'contexts' tab is Current User not in the dropdown next to 'add new context'?
Comment: No i haven't. I only had  "user" for adding specific user in the context, not the current one.
Comment: Is this Drupal 8?
Answer: And i'm answering myself, again:
it seem to be a bug in the alpha24.
I updated with the current dev version (2017-Jan-18), and now i've got the current user in the context, and in the criteria !


How to control layout of UIBarButtonItem controls on an iOS toolbar?

Question: On my toolbar I am trying to properly lay out three buttons.  One in the middle that should remain centered horizontally, and then one aligned left and one aligned right.  But because the text for the left button is longer than either the middle button or the right one, the spacer items won't seem to produce the desired spacing effect.  I've tried both fixed and flexible, but of course using the fixed type will not dynamically respond to different screen widths, and the the flexible width ones (UIBarButtonSystemItemFlexibleSpace) will not keep the middle button centered.
I've defined the layout both in Interface Builder and programmatically and I get the same effect, what you see here.  For example an iPhone 6s looks like:

and an iPhone 11 Pro looks like:

As you can see the "Mid" button is not centered.  By using UIBarButtonSystemItemFixedSpace instead of UIBarButtonSystemItemFlexibleSpace I could define the width of the spacers exactly, but in order to calculate it properly I would need to know the width of each UIBarButtonItem and also the right delegate method to do this in.  Is this even possible, or must I do a custom view (or something else) to make this UIToolbar look like I want?
Comment: Maybe [this answer](https://stackoverflow.com/a/46581264/1987726) helps?
Comment: Reinhard, thx.  Yes, I read that before I posted, since it is linked to my question in the sidebar at right.  For that reason I acknowledged in my question that I might have to use a custom view, but am also asking for an alternative.
Answer: Try adding leading spaces to the Shorter title OR using the following items:
Longer-Text Button, Flexible Space, Mid Button, Flexible Space, Fixed Space, Shorter Button
The fixed space would be a hard coded value to match the width delta between the two buttons.
Comment: Brody, yes, I could do that, but would have to do it for each and every type of device, right?  I alluded to this in my question.  But let me know if I'm wrong and missing something here in your answer.
Comment: I'm not sure I understand your comment.  You could identify a way to calculate the difference in width between your left and right buttons to determine the size of the additional fixed space item.
Comment: But how to obtain the width value you speak of, both in your question and your comment?  Can you be specific as to how?
Comment: There's no way I can find to do that.


set max transaction duration in DB2

Question: Is there a way to set a max duration for transactions in DB2 10.1?
My application makes a query that lasts for about 10 minutes on the database. My application though waits only for 240 seconds for an answer, so after that the transaction will time out.
But on my db monitor I see that the query is still running and is using a lot of CPU.
I would like to stop that query also, because my application is not going to see the results anyway (with the current configuration). Is there a way to config DB2 to stop such long running queries?
In my application I run this:
List<MyData> result = query.getResultList();

And in my SystemOut.log I end up with this:
0000000b TimeoutManage I   WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[WebContainer : 305,5,main]. The stack trace of this thread when the timeout occurred was:
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:140)

The query command though is not interrupted but waits until the db is finished and I get a transaction exception. So the connection is still intact but my transaction was timed out before.
(The application is running on WAS 8.0)
Answer: I guess the reason for the query continuing to execute is that, while the connection running it is returned to the pool, it is not closed.
DB2 for LUW includes the Workload Manager feature that allows you to define various thresholds for specific identifiable workloads and perform some actions when the thresholds are exceeded, including stopping the running activity. You will find examples of how to define a threshold and the associated work action in the manual.
Note that most Workload Manager features require the Advanced Enterprise Edition license for DB2.

set max transaction duration in DB2


active_record 5.1 pointing to earlier version?

Question: I have upgraded a rails application to Rails 5.1 and see a strange issue.
When I check the mysql2_adapter.rb for the active_record gem I that the top 3 Line are
require "active_record/connection_adapters/abstract_mysql_adapter"
require "active_record/connection_adapters/mysql/database_statements"

gem "mysql2", ">= 0.3.18", "< 0.5"

however when I check the active_record gem on GitHub for the version 5.1 I see that the lines are different
https://github.com/rails/rails/blob/5-1-stable/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb

require "active_record/connection_adapters/abstract_mysql_adapter"
require "active_record/connection_adapters/mysql/database_statements"

gem "mysql2", ">= 0.3.18", "< 0.6.0"

Can anyone please help as to why the active_record 5.1 on my local machine has different code compared to what's on GitHub.
may be I missed something during rails upgrade.
Comment: What does `gem active_record -v` return?
Comment: Can you force the upgrade with `gem update active_record`?
Answer: The version you see on Github was the outcome of this pull request being merged on 2018-03-18. After that date, only Ruby on Rails 5.1.6 and 5.1.7 were released.
But when I look at the stack trace of your question from yesterday, it feels like you are running Ruby on Rails 5.1.0.
That means your Ruby on Rails version is about one year older than the latest Ruby on Rails 5.1.x version on GitHub.
I suggest updating your Rails version at least to 5.1.7 by adding
gem 'rails', '~> 5.1.7'

to your Gemfile and then running bundle install again.


`Coercible` for uni-constructor types and `()`

Question: This type can be coerced to ():
newtype Foo = Foo ()
f :: Foo -> ()
f = coerce

But the following cannot:
data Foo = Foo
f :: Foo -> ()
f = coerce  -- Fails: Couldn't match representation of type 'Foo' with that of '()'

GHC says,
    • Couldn't match representation of type 'Foo' with that of '()'
        arising from a use of 'coerce'
    • In the expression: coerce
      In an equation for 'f': f = coerce
   |
69 | f = coerce

Is there a way to make that second Foo coercible to ()? They are both isomorphic after all. Failing this, what is the way to automatically create these isomorphisms? For a larger context, see this question (where the constructor's product type is coercible to the NS's type-level list element type).
@Iceland_Jack's suggestion
Trying Jack's suggestion in comments to go via generic Rep:
class (GHC.Generic a, GHC.Generic b, Coercible (GHC.Rep a ()) (GHC.Rep b ())) => HasSameRep a b where
  coerceViaRep :: I a -> I b

instance
  ( Generic a
  , Generic b
  , Coercible (GHC.Rep a ()) (GHC.Rep b ())
  ) =>
  HasSameRep a b
  where
  coerceViaRep = I . GHC.to @_ @() . coerce . GHC.from @_ @() . unI

data T = T

proof :: T -> ()
proof = unI . coerceViaRep . I

This fails, however:
src/Ema/Route/Generic/Sub.hs:122:15-26: error:
    • Couldn't match representation of type: GHC.U1 @Type ()
                               with that of: GHC.Rep T ()
        arising from a use of 'coerceViaRep'
    • In the first argument of '(.)', namely 'coerceViaRep'
      In the second argument of '(.)', namely 'coerceViaRep . I'
      In the expression: unI . coerceViaRep . I
    |
122 | proof = unI . coerceViaRep . I

It doesn't look like the underlying generic representation is in fact equal?
Comment: Coercion isn't just about isomorphism, but bit for bit equality in the runtime representation.
Comment: Yes, if the types are generic you can roundtrip through the generic representation. For example `Rep ()` and `Rep Foo` (from `GHC.Generics`) have different metadata but their generic representations are equal at runtime. With the assumption `Coercible (Rep a ()) (Rep b ())` you can travel: `a` --from-> `Rep a ()` --coerce-> `Rep b ()` --to-> `b`.
Comment: @SridharRatnakumar Uh, you didn't derive `Generic` for `T`. That's why the error message contains the suspiciously stuck type family application `Rep T ()`, because that's not been defined. If you write `data T = T deriving Generic` instead then the `Generic`-based solution works. (Also, I am mystified what good the `I`s are doing here.)
Comment: Try `deriving stock Generic` ;) I make this error all the time. There is no reason to use identity constructors or making your own type class for this, you can define ``coerceViaRep :: Generic a => Generic b => Rep a () `Coercible` Rep b () => a -> b; coerceViaRep = to @_ @() . coerce . from @_ @()`` as a top-level function where `proof = coerceViaRep @T @()`.
Comment: Interesting. Is there a type class that is like `Coercible` but doesn't care about equality of runtime representation? That's probably what I want.
Comment: @Iceland_jack That's interesting, but it doesn't seem to be true? See my updated question.
Comment: Ah, yes, you are right! By the way, I used `I` (and a typeclass) only so it can be used in `generics-sop` code.
Comment: One thing I do not understand is why is the error message on `proof` not spotting the lack of `Generic` instance? Shouldn't it say `No instance 'Generic T'` or some such thing? The `HasSameRep` class afterall has that constraint.
Answer: Applying @Iceland_Jack's suggestion (also see this answer) in the comments here's what I came up with:
{- | Types `a` and `b` are isomorphic via their generic representation

  Unlike `Coercible` this constraint does not require that the two types have
  identical *runtime* representation. For example, `data Foo = Foo` is not
  coercible to `()` (they have different runtime representations), but they are
  both isomorphic via their generic representation.
-}
class (Generic a, Generic b, GHC.Rep a () `Coercible` GHC.Rep b ()) => GIsomorphic a b where
  giso :: Iso' a b

instance (Generic a, Generic b, GHC.Rep a () `Coercible` GHC.Rep b ()) => GIsomorphic a b where
  giso =
    iso
      (GHC.to @b @() . coerce . GHC.from @a @())
      (GHC.to @a @() . coerce . GHC.from @b @())

data T (s :: Symbol) = T
  deriving stock (Generic)

proof :: T "foo" -> ()
proof = view giso

You could eliminate the typeclass and define giso as a top-level function, but in my case I need a constraint for use with generics-sop's trans_NS. https://github.com/EmaApps/ema/pull/81/commits/760fd793104ae4235055ad49c94ac014f014496e


How to assign multiple values to an int?

Question: For my assignment, I need to assign one int variable with numbers 1 to 31. It's going to represent the number of days in a month. Are there any ways to do this without creating a second variable?
Comment: you can use a array for this.
Comment: do you mean like using an array of `int`s? - one variable can only contain one value at a time so...
Answer: My recommendation is that you use an array/list to do this. They are handy for storing multiple elements, in your case, numbers.


Raspberry pico cannot compile due to Nmake error

Question: I was trying setup enviorment to develop some program for new PICO, but only compile one time, after I haved this error:
[main] Building folder: pico-examples
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/pico/pico-examples/build --config Debug --target blink --
[build] Scanning dependencies of target bs2_default
[build] [  0%] Built target bs2_default
[build] [  0%] Built target bs2_default_padded_checksummed_asm
[build] [  0%] Performing build step for 'ELF2UF2Build'
[build]
[build] Microsoft (R) Program Maintenance Utility Version 14.28.29337.0
[build] Copyright (C) Microsoft Corporation.  All rights reserved.
[build]
[build] [100%] Built target elf2uf2
[build] [  0%] No install step for 'ELF2UF2Build'
[build] [  0%] Completed 'ELF2UF2Build'
[build] [  0%] Built target ELF2UF2Build
[build] Scanning dependencies of target blink
[build] Consolidate compiler generated dependencies of target blink
[build] blink\CMakeFiles\blink.dir\compiler_depend.make(4) : fatal error U1033: syntax error : ':' unexpected
[build] Stop.
[build] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\Nmake.exe"' : return code '0x2'
[build] Stop.
[build] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\Nmake.exe"' : return code '0x2'
[build] Stop.
[build] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x86\Nmake.exe"' : return code '0x2'
[build] Stop.
[build] Build finished with exit code 2

The blink application that I´m compiling it´s standart example from Raspberry SDK:
#include "pico/stdlib.h"

int main() {
    const uint LED_PIN = 25;
    gpio_init(LED_PIN);
    gpio_set_dir(LED_PIN, GPIO_OUT);
    while (true) {
        gpio_put(LED_PIN, 1);
        sleep_ms(250);
        gpio_put(LED_PIN, 0);
        sleep_ms(250);
    }
}

I´ve installed VS code already and after installed VS 2019 for this PICO. I followed step by step the documentation from Raspberry(getting started with Raspberry PICO). Also started by Command prompt from VS2019.
I have tried to install separetlly last Windows SDK, also I reinstalled Visual Studio. but still same.
Someone can help me on this topic? I cant sleep with this issue :(
Autogenerated file what its the problem example:
# CMAKE generated file: DO NOT EDIT!
# Generated by "NMake Makefiles" Generator, CMake Version 3.20

blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C:\pico\pico-sdk\src\common\pico_sync\critical_section.c
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_sync\critical_section.c
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_sync\include\pico\critical_section.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_sync\include\pico\lock_core.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\_default_types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\features.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_newlib_version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_intsup.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdbool.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stddef.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\config.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\config_autogen.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\pico\pico-sdk\src\boards\include\boards\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\common\pico_sync
...

blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_intsup.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdbool.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\config.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-examples\build\generated\pico_base\pico\config_autogen.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\boards\include\boards\pico.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float\float_init_rom.c.obj: C\:\pico\pico-sdk\src\rp2_common\pico_platform\include\pico\platform.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_float.
...
.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\_default_types.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\features.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_newlib_version.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_intsup.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\_stdint.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\stdio.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_ansi.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\newlib.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\config.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\ieeefp.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\cdefs.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stddef.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\lib\gcc\arm-none-eabi\10.2.1\include\stdarg.h
blink\CMakeFiles\blink.dir\C_\pico\pico-sdk\src\rp2_common\pico_printf\printf.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\reent.h

blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\pico_platform\include\pico\platform.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\cdefs.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\types.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\platform_defs.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\addressmap.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\assert.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\assert.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\_ansi.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\newlib.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\sys\config.h
blink\CMakeFiles\blink.dir\blink.c.obj: c\:\progra~2\gnuarm~1\102020~1\arm-none-eabi\include\machine\ieeefp.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_base\include\pico\error.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\pico_stdio\include\pico\stdio.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\common\pico_time\include\pico\time.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\hardware_timer\include\hardware\timer.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\timer.h
blink\CMakeFiles\blink.dir\blink.c.obj: C\:\pico\pico-sdk\src\rp2_common\ha
C:\pico\pico-sdk\src\rp2_common\hardware_vreg\vreg.c:

C\:\pico\pico-sdk\src\rp2_common\hardware_vreg\vreg.c:

C\:\pico\pico-sdk\src\rp2_common\hardware_vreg\include\hardware\vreg.h:

C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\vreg_and_chip_reset.h:

C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\vreg_and_chip_reset.h:

C:\pico\pico-sdk\src\rp2_common\hardware_watchdog\watchdog.c:

C\:\pico\pico-sdk\src\rp2_common\hardware_watchdog\watchdog.c:

C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\watchdog.h:

C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\watchdog.h:

C\:\pico\pico-sdk\src\rp2040\hardware_structs\include\hardware\structs\psm.h:

C\:\pico\pico-sdk\src\rp2040\hardware_regs\include\hardware\regs\psm.h:

C\:\pico\pico-sdk\src\rp2_common\hardware_xosc\xosc.c:

C\:\pico\pico-sdk\src\rp2_common\pico_stdio_uart\stdio_uart.c:

C\:\pico\pico-sdk\src\rp2_common\pico_bootrom\bootrom.c:

C\:\pico\pico-sdk\src\rp2_common\pico_bootrom\include\pico\bootrom.h:

C\:\pico\pico-sdk\src\rp2_common\pico_double\double_init_rom.c:

Thanks in advance.
Best regards
Comment: Welcome to SO! The error is stated: `[build] blink\CMakeFiles\blink.dir\compiler_depend.make(4) : fatal error U1033: syntax error : ':' unexpected` so you have a typo in your code. Please include the code so that users may see what is causing the error.
Comment: @fth: Not likely. The file where the error occurs is auto-generated, so shouldn't contain any syntax errors. I'd try a clean build.
Comment: Yes, I updated with the File auto generated content , thanks for help
Comment: No problem @NachFenix
Answer: Okey, solution was erease the content from autogenerated file, save file and build again...,
After several builds error appear again, and same procedure was success :D
Thanks all that tried to helped me if knows about root issue will be great!
Answer: I have had the same problem myself trying to compile in VS Code, the first pass works fine any recompiles fail with the same error.
The cause of the error are the compiler_depend.make files containing incorrectly escaped paths. It is trying to escape the : after the Windows drive letter. It does not do this though to the first entry in each section though that entry is duplicated with the incorrect path as the second entry in each section.
For example
blink\CMakeFiles\blink.dir\D_\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: D\:\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c

Should be
blink\CMakeFiles\blink.dir\D_\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c.obj: D:\projects\pico\pico-sdk\src\common\pico_sync\critical_section.c

The current quick fix I have so far is to a replace "\:" with ":"  in all compiler_depend.make files
Comment: @NachFenixI have since found it the root cause, itapears the release candidate of CMake 3.20.0 is at fault. I uninstalled this and installed CMakle 3.19.6 and found the initial build and rebuilding in VC works 100% with no errors. The bad escaping of file paths is not present.
Answer: Here's the already mentionned solution (deleting the contents of /build) as a rebuild DOS command for those not too savvy with it. Run it from the build folder.
del /q /s * && cmake .. -G "NMake Makefiles" && nmake
Answer: Uninstall the current CMAKE version nd install the version 3.20 from here:
https://cmake.org/files/v3.20/
Do not forget to add CMAKE to path
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Drupal 8 - Use the current node ID (on node edit form) to filter an entity-reference view as a contextual filter

Question: I've got this view I just created, which lists all the events && publications related to a program (field_program, an entity-reference field) on my website (Drupal 8). Call it "view_program_related_contents".
I've got this content type (program), with a entity-reference field (field_promoted_contents). About this field, I want to use a view, because I don't want the webmaster to be able to promote events|publications related to any program but the one he's editing, so I have to filter the results based on the field_program field.
I did set a contextual filter (field_program) on my view. When this filter is not available, I fill it whith a default value : "Content ID from URL".
I can't manage to get my field_promoted_contents field populated with the well-related contents. If I set a static value (node id 1) in the contextual filter, it works, I only have the contents related to this first program. But when I set this "Content ID from URL".. I get no results :(
Do I have to pass a token (such as [node:nid]) as an argument to the view in the entity-reference field configuration ? Is there a module for that ?
Comment: When you manually type in the ID on the View edit preview screen, does it work?  Test on the Views edit screen first and make sure it works there before you try to troubleshoot the entity reference.
Comment: Absolutely, it works in the view UI.
When I type "1" in the contextual-filter field, it filters my contents with the field_program #1.
Comment: PS: The XHR looks like this when I type in the field-reference field : `http://www.my-project.loc/en/entity_reference_autocomplete/node/views/OMRoUtYGplS-duIcL-ZiN1HhmPx8SM3WrLogk-LkilA?q=test` .. So I suppose that the view is not aware of the current node ID. I'm missing something in the field config I think, am I ?
Answer: This might not be THE answer.
But for my specific need, and because we already are late on this project.
I found a "quick-fix" solution.. waiting for a more drupalistic one.
Assuming that this entity-reference-1 view display is always called from a node/:nid/edit page, I should always have a HTTP_REFERER on each request to the view (I guess ^^). Well, I check that for insurance.
Inside a hook_views_pre_view hook, I pass the node-id from the HTTP_REFERER to the view, like this :
<code><?php

use \Drupal\node\Entity\Node;

/**
 * Implements hook_views_pre_view()
 *
 * Alter the contextual filters for my view :
 *
 * When the HTTP_REFERER is a node/:nid/edit pattern and the view-display is an entity-reference
 *  then I fetch the node ID from the URL, I load the node to check the node type
 *  and I pass this nid to the view as an arg
 */
function MYMODULE_program_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
  if ($view->id() == 'view_program_related_contents' && $display_id == 'entity_reference_1') {
    if (isset($_SERVER['HTTP_REFERER'])) {
      $referer_url = parse_url($_SERVER['HTTP_REFERER']);
      $path = htmlspecialchars($referer_url['path']);
      if (preg_match('/node\/(\d+)\/edit/', $path, $matches)) {
        $node = Node::load($matches[1]);
        if ($node instanceof Node) {
          if ($node->getType() == 'program') {
            $args[] = $node->id();
          }
        }
      }
    }
  }
}
</code>
Again, I think I'm missing something in my entity-reference field definition, or my view configuration.. but I don't have enough time to spend on this.
I hope this helps..
Answer:
Do I have to pass a token (such as [node:nid]) as an argument to the view in the entity-reference field configuration?

Yes.

Is there a module for that?

No, but this will work in core with a patch from Dynamic Views Arguments via Tokens.
If you'd like the depending field to update automatically whenever the dependent field changes, see Add AJAX support to fields using Dynamic Views Arguments via Tokens.


Gallery with jQuery 1.6.4

Question: How do I implement a gallery like the following one with jQuery 1.6.4 and Drupal 7?
Answer: There is more than one way to do it - for instance, it depends on where the images are coming from. You could do it with Views for instance, creating a list of images, adding the correct classes, and applying the js from your custom theme.
Comment: If you really need jQuery 1.6.4, you can use multiple jQuery versions simultaneously. See http://drupal.org/node/1309382#comment-5115386 for some helpful code and explanation.
Comment: I created view with all necessary fields and field classes. I applied all js files needed, but the slideshow did not work. Only difference was version of jQuery. By default Drupal has v.1.4.4. I installed module jQuery update, and got v.1.5.2. Slideshow does not work.

Gallery with jQuery 1.6.4


Mixture Model Distribution and Single Model Distribution Comparisons

Question: I have two groups of subjects (healthy & patients).  Each subject's data (>70000 samples) were displayed using a histogram.  For some, it appeared to be a mixture of two Gamma function, whereas for others it appears to be that a Gamma function would be sufficient for modelling.
I am working on a Matlab script to apply mixture Gamma modelling.  I have a question on how to deal with the fact that some of the subjects' data may be modelled using mixture modelling, but not others.
My plan is to apply the mixture modelling to all datasets, then discard the model with a small probability.  Would that suffice?
For comparing the two groups, what would you recommend for comparing the alpha & gamma values from the modelling results?
Say, group A has 10 subjects: 4 of them were modelled successfully by mixture modelling, i.e., the probabilities corresponding to two models are similar.  For the rest, the histogram can be described by a single Gamma function, i.e., the probability corresponds to one of the distribution is small. Group B has something similar too.  In that case, how could I compare the coefficients between two groups?
Answer: This may not answer all your concerns but at least you can build upon it.
I would say that yes, use mixture modeling for everything. You can see a single Gamma function as a mixture of two Gamma functions, with one having a weight of 0 and the other one a weight of 1 for example.
Distances between mixture models exist, like the KL-divergence.
This paper: Approximating the Kullback Leibler Divergence between Gaussian Mixture Models, by John R. Hershey and Peder A. Olsen, presents many different ways of computing it for the Gaussian case. However, most of the presented approximations are also valid for the Gamma distribution and are rather easy to compute (the one presented in section 7 especially).
As I understand you problem, I would represent each group by a mixture (with more components than 2 maybe). However, not knowing the output you are looking for I cannot say it for sure.


Select com like detalhado

Question: Como realizar uma select tendo em vista que pode não ser uma comparação exata no banco de dados. Eu sei que existe o LIKE, mas eu já tentei e não surtiu o efeito desejado.
O problema é  seguinte, tenho que pesquisa no banco por um nome que pode faltar uma letra no fim ou no inicio, por exemplo, no banco pode está assim JOSIVAN SOUSA mas a entrada da pesquisa pode ser:

JOSIVAN SOUS
JOSIVAN DE SOUSA
OSIVAN SOUSA

E por aí vai.
Comment: Relacionada: [Consulta inteligente com MySQL](https://pt.stackoverflow.com/questions/167184/consulta-inteligente-com-mysql)
Answer: Não tem segredo.
Select * from suatabela
where seucampo like '%OSIVAN SOUSA%'

Comment: isso é gambiara...
Comment: Esse select não me dá o resultado desejado
Comment: O termo pesquisa pode ser JOSIVAN DE SOUSA e o que está no banco pode ser JOSIVAN SOUSA
Comment: Seguindo sua descrição do problema, onde pode faltar um carácter no fim ou no inicio do nome completo. A única solução viável é do @MarconcilioSouza. Pois se não qual seria o padrão de busca? :S
Answer: select *
  from suatabela
 where seucampo like '%_OSIVAN SOUSA_%'

Comment: Não funciona para o meu problema
Comment: `_` diz que necessita ter algum caracter naquela posição, não atende a pergunta.
Answer: MySQL possui um conjunto de funções que podes usar para trabalhar com String, por exemplo SUBSTRING.

SELECT * FROM users  WHERE 1=1
      AND
      ( SUBSTRING(name,2,16) = "OSIVAN DE SOUSA"
       OR
       SUBSTRING(name,1,15) = "JOSIVAN DE SOUS"
       )

Select com like detalhado


Graph of root of quadratic function

Question: This is a problem new to me. I need some guidance on what I should study/understand to be able to solve such problems.

Sketch the graph of the following absolute functions on $\mathbb{R}$ and state the range.
  $$g:x \rightarrow \sqrt {x^2 + 2}$$

I have done graphs of quadratic equations and square root functions. How do I do a graph of root function of a quadratic function?
Thanks for your help.
Edit: Clarified question.
I have tried plotting points. I got a curve that resembles the parabolic curve of a quadratic function. The quadratic function has a vertex formula, is open/closed parabola, etc.

I was wondering if there were any thing I need to study on the lines of the quadratic function? What if it is the nth root. Is there a way to figure this out for (fractional)powers of a quadratic?

The other approach I was looking at was via graph transformations.
$$g(x) = \sqrt{x^2 + 2}$$
Let, $$h(x) = \sqrt{x}$$
Then, $$g(x) = h(x^2 + 2)$$
I not sure where to go further with this idea.
Comment: How have you sketched the graphs of the functions whose graphs you *have* sketched? It is not unthinkable that the same strategy will work with these functions too!
Comment: Try some values first, just to see.
Answer: It sort of depends on how detailed a graph you want.  Note first of all that the graph is symmetrical about the $y$-axis.  This observation immediately cuts our work in half! Just do the graph for $x$ positive, and reflect the picture across the $y$-axis.
So we take $x \ge 0$.  Near $x=0$, we have that $y \approx \sqrt{2}$.  As $x$ increases, $\sqrt{x^2+2}$ increases.
For $x$ at all large positive, we have that $\sqrt{x^2+2}\approx x$.  More precisely, it is a little bigger than $x$, but awfully close to $x$ when $x$ is large. (You may want to do a small number of calculations, using a calculator.)
Draw the half-line $y=x$, for $x \ge 0$.  To say that $\sqrt{x^2+2}$ is awfully close to $x$, when $x$ is large, means that the curve $y=\sqrt{x^2+2}$ hugs the half-line $y=x$, for $x \ge 0$, when $x$ is large.  So for large values, your curve will be roughly indistinguishable from $y=x$.
In technical language, the half-line is an (oblique) asymptote to the curve $y=\sqrt{x^2+2}$.
With this information, you should be able to get a good idea of the first-quadrant part of the curve.  Then don't forget to reflect across the $y$-axis.
Wish I could supply a picture.  There are (free) graphing calculator programs, or more generally graphing programs, available for download.
Look up also Wolfram Alpha.  It will draw the curve for you.  But first do it yourself.
Comment: That helped a lot, Thanks. Good tip about Wolfram Alpha, excellent site.
Answer: I realize you've accepted an answer.  I just thought it might be helpful if you were to compare the equations:
$$y = \sqrt{x^2 + 2}$$
with
$$y^2 = x^2 + 2 \quad\iff\quad y^2 - x^2 = 2$$
and their corresponding graphs.  Do you see a relationship?

They are certainly related, but the range of the first equation (the graph of which is  entirely above the $x$-axis, since $y\geq 2$ for all $y$) is half that of the first equation (entire graph of hyperbola includes both the negative and positive values in the range $y$).
I encourage you to explore with graphing the equations at WolframAlpha.
Have you studied conic sections or worked with graphs of conics such as parabolas, hyperbolas, ellipses and circles?  If not, you might want to check out Wikipedia on Conic Sections for a sneak preview of what's to come!
Comment: @user6312: thanks.  BTW: I've been wanting to tell you that I am heartened by your efforts to interact with OPs, taking them and their questions seriously, and gearing your answers to their varying levels of knowledge.  It can get discouraging to come across, time and again, sarcastic comments/answers, and/or answers assuming far more background than the OP has...Anyway, keep up the good work!
Comment: Thank you, one tries. Presumably the idea is to take account of a student's level of experience, and try to guide them towards a more structured point of view.  Answers on this site generally stay clear of sarcasm, but they can be unsuitable from a teaching point of view, since they present a highly polished product.  And the student is left to wonder how (s)he could ever "come up with that." The intuition behind arguments is not given often enough. But the format is constraining, communication at the right level is much easier with live person and blackboard.
Comment: I think it is very often to post an answer even after one has been accepted. There is frequently, as in this case, useful material to add.
Comment: Thanks @amWhy. I have been peeking at wikipedia occasionally. It is overwhelming at times to see the amount of ground I have yet to cover, but then at least the roads I have to take are well documented. :)
Comment: @amWhy: Even a nice picture! =1
Comment: @Sami It happens. Oh, well ;-)

Graph of root of quadratic function


jquery selector executed on DOM sub-tree (as in backbone)

Question: Be default, jQuery's object $ allows you to run selectors over entire DOM tree. However, Backbone (which relies on jQuery) allows you to run the selector not on entire (global) DOM, $, but also on local backbone view (this.$ in backbone views). It's just faster, since we don't traverse entire DOM tree, but just its part.
The question is: how to achieve that in pure jQuery (no backbone)? A code example would be appreciated.
Comment: for all downvoters - it's unprofessional to downvote with no comment on what is wrong with the question.
Comment: If you look at Backbone's source (and docs), you'll see that Backbone does nothing on its own and it's only jQuery in the background. So the downvotes are probably related to a lack of research effort and possibly a lack of a [mcve].
Comment: @EmileBergeron so now I want to delete this question, if it doesn't conform to the regulations - and it says my account might get banned for deleting answered questions. Nonsense.
Comment: Right now, the best thing to do is to try and improve the question to contribute to the quality of the site. There's a chance that upvotes will balance downvotes over time.
Comment: @EmileBergeron improve the quality of a question that has already been answered precisely? :-) I have overlooked the docs, can't undo it, can see nothing to improve.
Answer: You use find:
$(someElement).find("selector").doSomething();

There's also a likely-to-be-deprecated-at-some-stage form you'll sometimes see people using that looks like this:
$("selector", someElement).doSomething();

...but literally all jQuery does with that is turn around and call find.
Example looking within a div for a span with a given class:

// Get the div
var div = $("#the-div");

// Find the span within it, turn it green
div.find(".foo").css("color", "green");

  Not this one.
  This one.

  Not this one.
  Not this one either, despite it having the class; it's in the wrong div.

Comment: The [Backbone docs](http://backbonejs.org/#View-dollar) even say as much: "It's equivalent to running: `view.$el.find(selector)`".


porque se usa .build no fim dos comandos

Question: Sempre vejo o ".build ou .builder no final das linhas em java.
Por exemplo:
ProductDTO.builder(); ou .build();
Qual a explicação para isso?
Obrigado!
Comment: Por favor, edite a pergunta para limitá-la a um problema específico com detalhes suficientes para identificar uma resposta adequada.
Answer: Acredito que esteja se referindo ao padrão .builder() ou .build() que é associado ao padrão de projeto chamado Builder. Este padrão é usado para construir objetos complexos com muitos parâmetros, onde a criação direta através de um construtor pode se tornar confusa ou ineficiente. Aqui vc pode ver mais sobre o padrão de projeto Builder
Em Java, o padrão Builder é frequentemente implementado usando uma classe interna estática (ou interface) chamada Builder dentro da própria classe que estamos tentando construir. O método builder() retorna uma instância dessa classe Builder, e em seguida, métodos chamados no objeto Builder são usados para configurar os valores desejados, e finalmente, o método build() é chamado para criar o objeto final.
A principal vantagem desse padrão é a clareza na leitura e na criação de objetos com muitos parâmetros opcionais. Em vez de ter vários construtores ou métodos setter, o padrão Builder permite um código mais legível e fácil de entender.
Comment: Muito boa a resposta, obrigado.


What is this instrument that is audible first in this Music video?

Question: What is this instrument that is audible first in this Music video? is is like some flute?
Comment: https://img.devrant.com/devrant/rant/r_1379774_h8mc8.jpg
Answer: Cool sound!  I think it's someone humming while playing a flute.
If you try to whistle and hum at the same time, you can also get that same kind of interference sound.
If you recorded a flute sound and vocal separately, I don't think you'd get the same effect.  Unless I'm a sucker, this person performs it live just like it sounds.
Comment: Yep.  It's a bog-normal modern Boehm transverse flute, played while humming at the same time, with generous echo and probably other electronic enhancement.