Packages dplyr and choroplethr are incompatible

Question: Running the folloing code works
library(dplyr)

mtcars %>%
 group_by(cyl) %>%
 summarise (mean_mpg = mean(mpg))

# A tibble: 3 x 2
 cyl mean_mpg
<dbl>    <dbl>
1     4 26.66364
2     6 19.74286
3     8 15.10000

after loading choroplethr it does not work, even if we load dplyr again
library(choroplethr)

mtcars %>%
 group_by(cyl) %>%
 summarise (mean_mpg = mean(mpg))

mean_mpg
1 20.09062

looks like the two packages are incompatible. I used them before without problems, but after upgrading to a new version of R, RStudio and the two packages, they no longr work together.
Answer: When you load choroplethr, it loads plyr, as well. And as it has been mentioned time and again, don't load plyr after loading dplyr.
In your case, load choroplethr first and then dplyr, and everything should work fine.
library(choroplethr)
Loading required package: acs
Loading required package: stringr
Loading required package: plyr
Loading required package: XML

Attaching package: 'acs'

The following object is masked from 'package:base':

    apply

Though choroplethr only depends on acs, acs depends on plyr; hence when you check the choroplethr CRAN page, it might not be obvious that it also loads plyr
Comment: Thanks, that worked. I loaded it in the other order (dplyr then choroplethr) before without any problems, but now the load sequence has to be reversed.
Comment: Yes, this "feature" of choroplethr was introduced in version 3.5.2: http://www.arilamstein.com/blog/2016/04/04/new-version-choroplethr/. The only good thing I can say about it is that it fixes even worse problems that no on seems to be able to adequately explain. I really hate that choroplethr now depends on acs. But at least at the time, there seemed no other fix to the problems I outline in the blog post.


Pegar link mp3 do arquivo no Soundcloud

Question: Possuo uma ferramenta, onde devo informar o link exato do arquivo mp3 que consta no Soundcloud. No caso, não seria o link do áudio em si e sim onde o arquivo está hospedado.
Atualmente estou utilizando o site http://offliberty.me/ para esse tipo de processo.
Se eu pegar o embed de um arquivo, estará assim:

Tentei usar o que está após o api.soundcloud... e mesmo assim não funcionou.
Answer: Do modo que você quer fazer é possível.
Você precisa obter a seguinte URL que está localizado no iframe
https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/328259811

Você pode verificar direto no browser as propriedades, se a propriedade downloadable estiver marcado como true, automaticamente a propriedade download_url estará definida com o link para download.
Comment: Como eu faço para verificar essas propriedades? Preciso do link direto para o arquivo.
Comment: Depende de como você está obtendo o iframe, você não deixou claro se é de forma dinâmica ou manual.
Comment: Pode ser manual.

Pegar link mp3 do arquivo no Soundcloud


How do i unregister broadcast receiver in this code?

Question: I have dynamically registered my broadcast receiver , now how do i unregister it . i have used unregisterReceiver(this). but i dont think it works.
 IntentFilter filter = new IntentFilter("SENT");

       //---when the SMS has been sent---
       registerReceiver(new BroadcastReceiver(){
           @Override
           public void onReceive(Context arg0, Intent arg1) {
               switch (getResultCode())
               {
                   case Activity.RESULT_OK:
                      Toast.makeText(getBaseContext(), "SMS sent waiting room",
                               Toast.LENGTH_SHORT).show();
                      unregisterReceiver(this);
                       break;
                   case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                       Toast.makeText(getBaseContext(), "Generic failure",
                               Toast.LENGTH_SHORT).show();
                       break;
                   case SmsManager.RESULT_ERROR_NO_SERVICE:
                       Toast.makeText(getBaseContext(), "No service",
                               Toast.LENGTH_SHORT).show();
                       break;
                   case SmsManager.RESULT_ERROR_NULL_PDU:
                       Toast.makeText(getBaseContext(), "Null PDU",
                               Toast.LENGTH_SHORT).show();
                       break;
                   case SmsManager.RESULT_ERROR_RADIO_OFF:
                       Toast.makeText(getBaseContext(), "No Network Detected",
                               Toast.LENGTH_SHORT).show();
                       break;
               }
           }
       }, filter);

Comment: You have to call unregisterReceiver() with the same instance that you registered with
Answer: You can use
unregisterReceiver(nameofyourbroadcastreceiver);

Sample Code
public class MyActivity extends Activity
{
  private final BroadcastReceiver mybroadcast = new SomeBroadcastReceiver();

  public void onResume()
  {
    IntentFilter filter = new IntentFilter();
    filter.addAction("android.provider.Telephony.SMS_RECEIVED");
    registerReceiver(mybroadcast, filter);

  }

  public void onPause()
  {
    unregisterReceiver(mybroadcast);
  }
}

Your code:
IntentFilter filter = new IntentFilter("SENT");

BroadcastReceiver br =  new BroadcastReceiver() {

    @Override
    public void onReceive (Context context, Intent intent) {

        switch (getResultCode())
           {
               case Activity.RESULT_OK:
                  Toast.makeText(getBaseContext(), "SMS sent waiting room",
                           Toast.LENGTH_SHORT).show();
                  unregisterReceiver(br);
                   break;
               case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                   Toast.makeText(getBaseContext(), "Generic failure",
                           Toast.LENGTH_SHORT).show();
                   break;
               case SmsManager.RESULT_ERROR_NO_SERVICE:
                   Toast.makeText(getBaseContext(), "No service",
                           Toast.LENGTH_SHORT).show();
                   break;
               case SmsManager.RESULT_ERROR_NULL_PDU:
                   Toast.makeText(getBaseContext(), "Null PDU",
                           Toast.LENGTH_SHORT).show();
                   break;
               case SmsManager.RESULT_ERROR_RADIO_OFF:
                   Toast.makeText(getBaseContext(), "No Network Detected",
                           Toast.LENGTH_SHORT).show();
                   break;
           }

    }
};

registerReceiver (br, filter);

Comment: you created an anonymous function. Create a broadcast receiver object (global), register receiver and un-register it when you want to with my code above.
Comment: i am trying to create a gloabl object something like
BroadcastReceiver obj = new BroadCastReceiver();
it doesnot works
Comment: in my code i want that as soon as the "RESULT_OK" case comes. the broadcast receiver should unregister
Comment: my friend, create a broadcastreceiver like I mentioned above and pass that reference where you want to unregister.
Comment: Hope it will be helpful.
Comment: oh yeah ....that helped ... unfortunately i lack karma to upvote your answer...thanks again !
Answer: in public abstract void unregisterReceiver(BroadcastReceiver receiver)
you must provide a BroadcastReceiver instance as the first parament.
you can write like this:
BroadcastReceiver mReceiver= new BroadcastReceiver(){
...
}

unregisterReceiver(mReceiver);


Login command for a webpage

Question: I'm trying to put a simple login command for a webpage but it doesn't work.
Upon placing the correct username and password in the login field the page it should direct you to an external website (Amazon.com)
If the username is incorrect the link should default to your first page (homepage.html)

<form><input type=button value="Login!" onClick="LogIn()"></form>

Comment: This will provide no security at all, as the JavaScript code can easily be viewed by anyone in their browser. For real security, you'd need a server-side login (but that comes with a lot of other requirements). Really depends on what exactly you're trying to do
Comment: This looks like a login page of 100 years old app...
Answer: It doesn't work for several reasons:

You store user input in the same variable where you store correct credentials.
You compare these variables with strings "username" and "password". In your example username/password is the correct login.

So a slightly better code would be:
var correctUsername = "admin";
var username = prompt("Username: all lowercase 'username'","");
if (username == correctUsername)...

Also, keep in mind that the approach you are taking is not secure enough to be used in any real web-page.
Answer: From the code I see, You compare string with variable . The condition should be like this way:
if (username=="admin" && password=="pass")

Comment: Wow and so? How does this help? Won't this always return true? `#CommonSenseFail`
Comment: So what's the change from the OP's question?
Comment: he takes username as a string instead of username's value. Thanks
Answer: U were overriding the username and password
so just create 2 variables as
var correctUsername = "admin";
var username = prompt("Username: all lowercase 'username'","");
if (username == correctUsername)

or use the if condition as shown

<form><input type=button value="Login!" onClick="LogIn()"></form>

Login command for a webpage


Vue.filter is not calling while HTML rendering

Question: I am new to Vue.js
While rendering the html, I am invoking a Vue.filter. It should show a date in another format.
Below is my js file :
  var details = new Vue({
  el: '#ajax-article-detail',
  data: {
    message: 'Hello Vue.js!'
  },
  methods: {
   showName: function() {
        console.log('Calling showName...');
        return 'Im Event';
   }
  }
});

      Vue.filter('parseDate', function(date, format) {
      if (date) {
        //console.log(moment(String(date)).format(format));
        return moment(String(date)).format(format);
      }
      });

and in html, I am calling like {{${start_date} | parseDate('ddd, Do MMM YYYY')}}
and as a response, I am getting same statement.
means, I am getting {{${start_date} | parseDate('ddd, Do MMM YYYY')}} as it is in html.
Can anyone please suggest what I did wrong ?
Thank you.
Answer: I have changed your code by adding the filter property within the Vue component creation.
  var details = new Vue({
  el: '#ajax-article-detail',
  data: {
    message: 'Hello Vue.js!'
  },
  methods: {
   showName: function() {
        console.log('Calling showName...');
        return 'Im Event';
   }
  },
  filters: {
    parseDate: function(date, format) {
      console.log('value passed: ' + date); //check the browser console if it is passed
      if (date) {
        //console.log(moment(String(date)).format(format));
        return moment(String(date)).format(format);
      }
    }
});

Then use the filter like this-
{{2018-12-19 16:46:00 | parseDate('<your_date_format>') }}

However, you need to check if you are passing the value correctly. Try passing some hard coded string value first and check the console window.
Comment: Thanks for the update. I have tried the above js. But still output is showing same.
Comment: {{'2018-12-19 16:46:00' | parseDate('ddd, Do MMM YYYY')}} I have hardcoaded the date like this
Comment: One more point I have to mention is, I am using FTL for html generation.
Comment: @Venu I think you are using the filter incorrectly. I will update my answer. Also, can you tell me what is the date format you are passing and have you checked it if it really formats the date in plain JavaScript?
Comment: My actual date is 2018-12-19 16:46:00 , and I am going to convert something like -- Wed, 19th Dec 2018.
Comment: Even showName method is also not invoking. I am not getting the console log
Comment: @Venu Is your Vue component getting compiled and rendered properly? Try re-building the Vue project and refresh the browser. I usually use npm build and VS code for this. You can also install Vue dev tool plugin in your browser to debug more about the problem. For Chrome- https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd?hl=en
Comment: I haven't installed Vue. I just included vue.min.js in my html page


Redirect to view display after form submission

Question: I'm using a form_alter hook to add a custom submit callback. I want to redirect the user to a particular page display of a view. However, I'm having trouble figuring out how to specify the path.
In my custom submit hook, I tried $form_state->setRedirect('/my-view/page/path'); but that didn't work. From searching, I found this question, Redirect after form submission, but the answers indicate to specify the machine name of a path from a routing yaml file.
I'm wanting to redirect the user to a views page display that I built in the UI, so I don't have any routing.yml file (that I'm aware of) where I could glean a machine name of a path from.
How do I set the redirect in a custom submit handler to a page display of a view?
Answer: Routes are not only defined in yaml files, but also dynamically in route subscribers.
Drupal\views\EventSubscriber\RouteSubscriber collects routes from all views displays which implement DisplayRouterInterface::collectRoutes, like the Page display:
PathPluginBase::collectRoutes:
  public function collectRoutes(RouteCollection $collection) {
    $view_id = $this->view->storage->id();
    $display_id = $this->display['id'];

    $route = $this->getRoute($view_id, $display_id);

    if (!($route_name = $this->getOption('route_name'))) {
      $route_name = "view.$view_id.$display_id";
    }
    $collection->add($route_name, $route);
    return ["$view_id.$display_id" => $route_name];
  }

This produces route names like view.my_view.page_1 and you can redirect in a form submit:
$form_state->setRedirect('view.my_view.page_1');


How to represent this concept with a set formula?

Question: This is the first time that I post a question here, I hope it well formed.
I have a set of pairs $(a,b) \in Set$, where $Set \subset A \times B$.
Now, given an element $a' \in A$ and a function $f : A \times A \rightarrow \mathbb R$, I want to get the element $(a_s, b_s)$ where $a_s$ is such that $f(a', a_s)$ is the smallest result between all the elements in $Set$.
I'm having some problems to formalize this concept, can you help me? This is what I came up with.
$$    (a_s, b_s) = (a_i, b_i) \in Set \mid (a', a_i) = \mathop{\rm argmin}\limits_{s(a', a_i)} $$
But I don't know if this is the right way to do so.
Just to give you an example: supposing that $A \times B = \mathbb{N} \times \mathbb{N}$ and $f$ is the sum function and we have that:
$$Set = \{(1,2) , (2,2), (3,3)\}$$
Then with $a' = 1$ the returned result is $(1,2)$ (actually $(1,2)$ is returned for any $a'$ with this toy example).
How do I formalize this?
Answer: Let's call $f'$ the function that returns such a $(a,b)$ given $a'$. Then we can define it as follows:
$$f'(a')= (a,b) \leftrightarrow ((a,b) \in Set \land f(a',a) = b \land \neg \exists a'' \in A \ \exists b'' \in A \ ((a'',b'') \in Set \land f(a',a'') = b'' \land b'' < b)))$$
... I believe that's what you want ...


Como salvar sessão php no MongoDB e recuperar dados em NodeJS

Question: Estou a correr um servidor em php e outro em nodejs tentando buscar uma autenticação simples visto que toda sessão corre em php e nodejs simplesmente processa alguns eventos porém, e necessário autenticação como posso fazer com MongoDB (drive php)?
Tentei com memcache (php e node) porém não obtive sucesso uma vez que memcache dll para php7 ainda esta em status dev (desenvolvimento).
Comment: Presumo que estás a correr PHP e Node na mesma máquina com ambos a aceder ao MongoDB, certo? Podes clarificar isso e também corrigir alguns erros ortográficos? Pergunta interessante, `+1`.
Comment: Sim, exatamente isso. O projeto em si é um website em php e funcionalidades como chat, plugins e apps em nodejs.
Answer: Em lugar de sessão, pode usar o padrão JWT de tokens, já vai encontrar material pronto em diversas linguagens.
Por exemplo, no login você pode gerar o token, e verificá-lo em outra máquina, sem precisar de acesso ao banco. Isso é perfeito para escalabilidade, pois diversos servidores podem validar o token sem conversar entre si. Só é necessário que os dois utilizem a mesma chave.

Documentação, playground e exemplos: https://jwt.io/
Implementação em NodeJS: https://github.com/auth0/node-jsonwebtoken
Implementação em PHP: https://github.com/firebase/php-jwt

O token JWT pode conter informação como o ID do usuário, e também tem uma data de expiração, que será respeitada na hora da validação.
Comment: Usava jwt com socket.io porém agora estou a usar express4 com passport-local e espress-session e a idea não seria mais passar parâmetros como id de usuário ou sessão via query-string e sim um token criado em php e salvo (com php) no banco MongoDB e recuperar isto (usando o token). Node receberia apenas o token via query-string e buscaria a referencia em MongoDB (com mongodb ou mongoose) para buscar esta session e usar em node (express-session).


Ping com Objective-C

Question: Alguém possui alguma classe que faça o teste ping em Objective-C? Tentei diversas e não consegui com nenhuma.
Preciso apenas pegar o IP e fazer o teste, se "pingar" executar a ação, do contra, apenas emitir uma mensagem de host inacessível.
Answer: A melhor forma e mais sofisticada de você fazer um teste para verificar se um host está acessivel no iOS é usando um conceito chamado Reachability.
O Reachability verifica se o dispositivo "alcançar" o destino através de uma determinada rota de rede e também consegue notificar seu app quando esta rede sofre alguma modificação.
Duas referencias que podem te ajudar bastante:

Reachability by Apple
Reachability by Tony Million (baseado em
blocos)

Ping com Objective-C


How can I solve uper bound limits with only lower bound limits - Linear programming

Question: My linear programmer use the Simplex method.
$$\text {max}: c^T x\\
\text{s.t} \\
Ax \leq b \\
x \geq 0
$$
I have heard that it's possible to reforumlate the subject so it will solve for both uper bound limit and lower bound limit only for $Ax$. Can I write my subject too function as:
$$
\text {max}: c^T \begin{bmatrix}
x_0\\
x_1
\end{bmatrix}
\text{s.t}
$$
$$
\begin{bmatrix}
A &0 \\
0 & A
\end{bmatrix}\begin{bmatrix}
x_0\\
x_1
\end{bmatrix} \leq \begin{bmatrix}
b_u\\
-b_l
\end{bmatrix}
$$
But here is the hard part...this will not work.
$$
\begin{bmatrix}
x_0\\
x_1
\end{bmatrix} \geq 0
$$
Any suggestions? Or do you think I can run two simulations after each other? One with $b = b_u$ and one with $b_l$ ?
Comment: Many LP solvers allow both lower and upper bounds on $Ax$, and these are called *range constraints*.  They are handled directly in the simplex method, without explicitly duplicating the number of constraints.
Comment: @RobPratt Johan Löfberg gave me a solution to that problem. I hope thats working :)
Comment: Yes, it works.  But I'm saying that it is inefficient and maybe unnecessary, depending on your solver.
Comment: @RobPratt Hmm Yes I understand. The reason why I selected this solver is because I solve my numerical problems on a "computer" of 20 kB RAM and 64 kB Flash ;) It need to be simple. Tried quadratic programming solver for a year ago. Did not work well onto that machine.
Comment: @RobPratt Look up "linprog" here https://github.com/DanielMartensson/CControl/blob/master/src/CControl/Sources/Algebra.c
Answer: $b_l \leq Ax \leq b_u$ is
$
\begin{bmatrix}
A \\
-A
\end{bmatrix}x \leq \begin{bmatrix}
b_u\\
-b_l
\end{bmatrix}
$
Comment: Good! Thanks. Is there a way to tell the simplex method to ignore the constraints on $x$ vector?
Comment: Oh! See now that that would not be needed! Only change the $Ax \leq b$ constraints.


How might one get a conditional display of tooltip or popup message from a rewritten view field?

Question: The issue concerns a View displaying a partial set of fields from a content type "video record," containing a collection of info about videos. One of those items is a Boolean (checked or not checked) indication of whether or not this video is allowed to be added to a user's shareable lists, generated by the module Flag Lists. If it IS shareable (Boolean was checked in full record) then the View displays a checkbox, allowing it to be added to a list. If it's NOT shareable (Boolean was unchecked) then we want to suppress the checkbox and display something else instead; currently that is just an "X" and that is working. Partial display of this here:

The "X" in the View field, a table cell, is the result of a View field rewrite plus display of the text "X" on the condition of "no results."

However we also want to have some form of tooltip/popup message, for hover on the "X," that explains why it's not allowed to be selected. Ideally, if this View field contains "X" then the tooltip would be active; otherwise it wouldn't. Here is a simulation of that:

This is currently working and the tooltip message is generated by the module "Tipsy." However that requires CSS selectors to associate it with the proper item. The only way we can see to use this is to manually add (to Tipsy config) a unique selector for each and every item in the list where this condition applies. Most problematic is that the selectors (as far as I have been able to understand) merely identify a position in the table – so if the table is resorted, they would get out-of-sync.
Can anyone suggest another path for getting to the desired result? That could be either a different way to get the tooltip/popup message that would only be active on the relevant table cell contents, OR maybe backing up farther and presenting the checkbox/no checkbox option a different way, depending on the full content page's condition of shareable/not shareable.
Answer: You are actually on a good track - and you can use html in the no result text field. An easy solution to just attach the tooltip to the 'X's would be to add the needed info for tipsy there:
X

In the Tipsy module settings you would need to add the appropriate selector in the form of: a.tipsy-tooltip. The selector does not need to be unique - you can use classes instead of ids. That way you can address multiple entries with just one selector.
Selectors are not linked to the position in the table, but rather identify a particular tag. In this case the element the 'a' tag which wraps around X. If the table gets resorted, the tooltip is still attached to the Xs.

Edit 1
The Problem might just be your selector: a.views-field views-field-nothing.
CSS classes are interpreted linearly and the order is important. In this case you are telling tipsy to look for a html element views-field-nothing which itself is nested unter a link a with the class views-field. If you look at the inspector though you will see that the actual mark-up is different and probably looks close to this one:

    X

A link a nested in a element with the classes views-field and views-field-nothing. Tipsy can't convert the default tooltip to a tipsy tooltip because it doesn't find the link to start with.
The correct selector would look like this: .views-field.views-field-nothing a (The missing space between the first two classes is important, as are the dots before the names which indicate they are classes rather than html elements or ids. If you made a space between the first two, it would look for an a-tag nested in a element with the class views-field-nothing which itself is nested under the element with the class views-field.)
Since views-field is a class applied to all fields views outputs you can as well leave it out though and just write .views-field-nothing a
The Problem with views-field-nothing is that it applies to all views and not even just for fields where 'no result' applies - views also uses the same class for fields of the type custom text. To make sure you just target the links you want to turn into tooltips it is easier addressing them with a class on the link itself - e.g. with the a.tipsy-tooltip selector I suggested. It specifically looks for all links with the class tipsy-tooltip so tipsy can extracts their title attribute and uses it for its tooltip text.
You should also pick the 'HTML Attribute' option in this case (Source: 'HTML attribute', Selector: 'title'). The only time you really need to use the 'Child Element' option is when you want to use HTML in the tooltip as you can't do that with the former. With the 'HTML Attribute' option tipsy uses whatever you put as the links title as the tooltip text - no extra classes needed.
Comment: Zuzuesque, thanks very much for this suggestion! However I have not been able to get it working, no doubt because I am probably missing something or misinterpreting the description. What I have now is a standard tooltip message (small black text, yellow background) rather than a Tipsy tooltip. (Which actually does fulfill the need minimally, but I'm hoping to get the more obvious Tipsy display instead.)

[see next comment for continuation of response]
Comment: This smaller tooltip message is displaying only because of the title applied in the Views field "no results" entry; that is currently:
`X`

[see next comment for continuation of response]
Comment: And in the Tipsy config I have:

`a.views-field views-field-nothing`

as the Selector, which I had concluded (from Firebug inspection) was a class identifying the fields where "no results" applies. Not sure about that, and not sure about how to treat the Tipsy config's Tooltip Content area. With other Tipsy configs I had always selected the "Child Element" rather that "HTML Attribute" option. Also had always put the desired Tipsy tooltip text in a div ``.

What am I missing?
--Thanks--
Comment: I updated my answer to adress your comments. Hope it becomes clearer now.
Comment: It is now working as originally intended. Thank you again for your thorough and instructive explanation of how to get control of the CSS factors. Just one other detail that I had to discover is that the Tipsy config "Tooltip Content > Selector" field needed to have the text `title` entered, in addition to the Custom Selector (left column) field being entered as `a.tipsy-tooltip`. As you mentioned, the desired tooltip text content is now deriving from the title in the Views "No Results" field, not from the Tipsy config as with more typical Tipsy setups.
Comment: Glad it worked for you :) The reason I prefer using the 'HTML Attribute' option is that if (for some reason) a user has disabled javascript he would still get the un-tipsy-fied default tooltip you saw earlier. You could still use the  "Child Element" element option in this case, but you would need to change what you output in the no result field - and since you don't output html there all the extra markup feels a little superficious.


Combobox de horários com intervalo de 5 minutos com PHP

Question: Colegas.
Tenho um combobox onde pretendo armazenar horários das 07:00 até às 22:00 com intervalo de 5 minutos. Veja abaixo:

Como eu faço isso no PHP? Infelizmente não tenho nenhum código pronto em PHP, pois não encontrei uma lógica.

  <select class="form-control" style="width:100px">
          <option value="">07:00</option>
  </select>
  às
  <select class="form-control" style="width:100px">
    <option value="">07:05</option>
  </select>

        <button type="submit" name="Buscar" value="PorAcesso" class="btn btn-primary">+</button>

Answer: $hora = '07:00:00';
echo "<select class='form-control' style='width:100px'>";
echo "<option value=''>$hora</option>";
for($i = 0; $i < 180; $i++){
    $hora = date('H:i:s', strtotime('+5 minute', strtotime($hora)));
    echo "<option value=''>$hora</option>";
}
echo "</select>";

Answer: O PHP nativamente já possui uma class chamada DateTime, e com ela é possivel realizar varias manipulações no objeto de data criado.
Com a ajuda de outro recurso chamado DateInterval, é possivel realizar essas modificações.
Para resolver esse problema, você pode criar um nó de repetição que vai adicionando 5 minutos a cada iteração.
Veja um exemplo abaixo:
$hora = DateTime::createFromFormat('G:i', '07:00');

while ($hora->format('G') <= 22) {
    $hora->add(new DateInterval('PT5M'));
    echo $hora->format('G:I');
}

Nota: O código acima é apenas um exemplo, e não levará em consideração os minutos caso a hora ainda esteja dentro das 22h.


reference for strongly continuous semi-groups

Question: At the moment I am trying to understand the proof of the Fredholm property in Salamon's notes on Floer homology. There I came across the notion of an unbounded operator on a (real) Hilbert space which is symmetric and does not have $0$ as an eigenvalue. It is then claimed that the operator generates strongly continuous semigroups on the respective eigenspaces.
In fact I would like to understand these notions, but I don't seem to  find good introductory texts. Since the topic seems rather old googling mostly gives me very recent result which are in particular much too specific.
Can anyone give me a reference on symmetric unbounded operators on real Hilbert spaces and their corresponding semigroups?
Comment: Engel and Nagel!
Comment: Pazy is also nice, but is more focused on analytic semigroups. By the way, the Ornstein-Uhlenbeck semigroup is very nice and has cute properties. @t.b.: Ping!
Comment: Did you try Yosida's book on functional analysis?
Comment: It would help if you gave a precise reference to Salamon's notes (link + page number) then one could check more easily if a certain result fits.
Comment: The reference is http://www.math.ethz.ch/~salamon/PREPRINTS/floer.pdf, page 17, step 1.
Comment: @ Jonas: Thank you, a very appealing reference. @t.b. I find the book to be somewhat difficult to read because of its age... Sorry!
Comment: No problem it is not *my* book, but I'd say it is definitely worth the effort... @Jonas: Ping!
Answer: You may find it useful to look at Chapter 6 of
"Linear Operators and Their Spectra" by E. Brian Davies,
though he works on Banach spaces.
His book is available online.
Answer: You can try "Semigroups of Linear Operators and Applications to Partial Differential Equations" by Pazy.
Answer: For a first introduction I liked the chapters on Operator Theory and Semigroups in An Introduction to Partial Differential Equations by Rogers and Renardy. It keeps things simple, explicit and gets the main ideas across. After reading these introductory chapters other functional analysis texts will be much easier to read.
Answer: Though Engel and Nagel was mentioned in the comments, the short version
http://www.fa.uni-tuebingen.de/research/publications/2006/a-short-course-on-operator-semigroups/A_Short_Course_on_Operator_Semigroups.pdf
Is a great introduction.
Comment: I actually found Engel and Nagel quite enlightening.


Facetapi combined filter of city and zip code

Question: I am using address field module with search api and facetapi modules.
I want one filter of two fields, city and zip code. Which will be an autocomplete field.
I have used the Search API Combined Fields module. Created a combined fields filter with the following configurations:
<code>Imitate field : Address » Locality (i.e. City)
Contained fields : Address » Locality (i.e. City), Address » Postal code
</code>
But the problem is, in facet settings I can see only links and links with checkboxes widgets. there is no autocomplete widget.
and second when I select one of a widget from links and links with checkboxes, it only displays the city names on the search page.
can anyone know the solution for this?
Answer: I used the search_api_combined.
In the search index, there will be a new tab with the name "autocomplete". Go to that tab and select your view and save the settings.
Then in the view filter, select your desired field and make it expose filter.
And also make that combined field a multivalue field with type full text.


Uniform convergence rate of cumulative distribution functions

Question: Let $\{X_n\}_{n=1}^{\infty}$ be a sequence of random variables such that, for some random variable $X$,
$$|X_n-X| = O(a_n),$$
almost surely, for some sequence of real numbers $\{a_n\}_{n=1}^{\infty}$ converging to zero. That is, $X_n$ converges to $X$ almost surely, at rate $a_n$.
Of course, it follows that $X_n$ converges to $X$ in distribution. My question is whether the cumulative distribution function (cdf) $F_n$ of $X_n$ also converges uniformly to the cdf $F$ of $X$, at rate $a_n$. Specifically, does it hold that
$$\sup_{x \in \mathbb R} |F_n(x) - F(x)| = O(a_n)?$$
This seems true to me, but I do not have a proof. Thank you in advance for any references or suggestions on proving this.
Addendum: You may assume that the $F_n$ and $F$ are absolutely continuous, to avoid issues regarding discontinuity points in the last display above.
Answer: The discontinuous case is false, and I think with a little hand-waving I'd say the continuous case is false also.  The issue is that $|X_n - X|$ is in "units" of $X$, whereas $|F_n(x) - F(x)|$ is in "units" of probability, so you cannot bound both with the same series.
Anyway, counterexample: all the r.v.s are constants and $X = 1, X_n = 1 + b^n$ for some $0 < b < 1$.
Clearly $|X_n - X| = b^n$ surely (not just almost surely).
However, for any finite  $n$, there exists $x = 1 + b^n/2$ s.t. $F_n(x) = 0, F(x) = 1$ so the sup $= 1$.
You see what I mean when I wrote about the "different units"?  Another way to think about this is if you plot $F$ and all the $F_n$ on the same graph, with $x \in (-\infty, \infty)$ as the horizontal axis and $[0,1]$ as the vertical axis, then $|X_n - X|$ is a proxy for the horizontal separation but $|F_n - F|$ is the vertical separation.  My counterexample is just a series of step functions which get closer and closer horizontally but the vertical distance is always $1$ at the max point.
This counter-example is discontinuous but if you want, just use small uniform r.v. to change steps into ramps and you can prove things rigorously, e.g. $X_n = Unif(1, 1+b^n), F_n(1) = 0, F(1) = 1, \sup = 1$, etc.
Comment: Haha, you're right!  I made all the $F_n$ continuous but forgot about $F$ itself!  Lemme see if this can be fixed.  You might have a point re: the everybody continuous case...
Comment: Agreed with your discontinuous example. But in your last paragraph, the limiting cdf $F$ remains discontinuous, so I don't think this is a counter-example to my claim for the continuous case. I do see what you mean about the difference in units. My intuition was that controlling $|X_n-X|$ is typically much stronger than controlling $|F_n-F|$, but I suppose it might not be obvious that the rates are the same.


In the Lydian Chromatic Concept, how are the horizontal scales formed?

Question: In George Russell's The Lydian Chromatic Concept of Tonal Organization, he introduces the notion of "horizontal scales":

They are horizontal because they include the fourth degree in their structure (B♭ in the F Lydian Chromatic Scale). (p. 17)

This is in contrast to vertical scales, which include the Lydian B♮.
But my question is how he derives the four horizontal scales, which are:

F major: F G A B♭ C D E
F major flat seventh: F G A B♭ C D E♭
F major augmented fifth: F G A B♭ C♮ C♯ D E
F Lydian flat seventh: F (G) A♭ A♮ B♭ B♮ C D E♭ (E)

As far as I can tell, there is no explanation for how these scales are formed, which seems really odd for someone basing his entire theory on the acoustical properties of the harmonic series.
How are these scales formed? Frankly, it almost seems as if (especially in the final scale) he just threw some darts at a board until he decided he was done creating his scale.
Comment: I'm glad you're asking because I've also had questions about that book. I wonder if there's at least some amount of learning to improvise by ear over common jazz chord progressions is part of where the scales are from, at least from the authors perspective.
Comment: Without being familiar with this concept as a whole the best I can figure is horizontal scales contain a P4 instead of a #4. As for that final scale, i saw a source that calls it the "African American Blues Scale". It's not as random as it appears, it is basically what is commonly referred to as the blues scale, a minor pentatonic with a #4/b5 chromatic passing tone with a major pentatonic scale superimposed over it. Without knowing this was in his book I have always felt like this actually is the complete blues scale because it contains the elements of both major and minor tonalities.
Comment: …although the E natural is not included in my description it allows double chromatic approaches to the tonic amd is also the leading tone. BTW, why are there parentheses on the G and E?
Comment: @JohnBelzaguy He also calls this the "African-American Blues Scale," but I don't believe he explains the parentheses. But even though this scale has a name, my question is ultimately: why this scale? Why not any other scales that have that perfect fourth scale degree?
Comment: Actually I saw that name in an online "Cliff Note" explanation of his concept. I haven't read the book although I probably unknowingly apply some of its concepts to my playing from other things I've learned. This is the article I read: https://www.thejazzpianosite.com/jazz-piano-lessons/modern-jazz-theory/lydian-chromatic-concept/ There is no explanation on how he arrived at these scales, only that there is a hierarchy for using them from consonance to dissonance over a given chord.
Comment: @JohnBelzaguy - yes, that last one is an amalgamation of major blues and minor blues scales, (include G), but the E escapes me. It could almost do with Gb, so the tonic could be approached chromatically from either direction - commonplace in jazz.
Comment: @Tim I believe no note in the chromatic scale is completely useless in blues. The thing is to be selective about WHICH notes you use. Using them all at once will sound like you're practicing scales as I'm sure you know.. I might start on the major pentatonic, switch to the tonic minor pentatonic on the IV chord, etc.
Comment: @JohnBelzaguy - I lost count of the number of students I told 'there's a scale (whatever one they're learning), and those notes will work *best* in those cicumstances - but - all 12 are up for grabs in any key. All are quite usable - go away and find where the 'odd' ones come out to play.' And that's without considering the 'quarter-notes' we use in the blues. Maybe not so much on bass, though? Yes, my path through for students was often maj. pent,> min. pent.>maj.blues,>min blues, one verse each, gradually getting 'grittier' for want of a better word.
Comment: Horizontal scales are formed by turning the score sideways.
Comment: @Tim Minor comment, in the U.S. (not sure where you're from) we use the term 'quarter tones' to refer to microtones that are one half of a half-step.
Comment: @user3235 - stone me, I used another anagram of the correct word !! Blues uses just about any fraction of a tone - 3/4 gets used a lot too. Profile says England. Yes, microtones have been discovered there too...
Answer: As explained by him. Vertical gravity has to do with the gravitational pull of harmony (within chords) while the horizontal gravity has to do with the gravitational pull of melody. Here he is talking about it:
Comment: Can you explain the gravitational pull concept a bit? What is pulled by what to where? In what circumstances can this pull be observed, how? What kind of an experiment can I do to notice the existence of this alleged phenomenon? Physical gravity is quite easily demonstrated in practice.
Comment: @user3235 Ok thanks, that seems to make some sense. Though I don't particularly like the way these "resolving tendencies" are explained as if they were some kind of laws of nature, when it all depends on this one culture and practice where movements like that are done so often that composers, players, listeners take them for granted. There are other cultures and conventions and practices.
Comment: I don't know to be honest... Found the video and thought to share
Comment: @piiperiReinstateMonica  In theory, the even intervals, 2nds, 4ths and to a lesser degree 6ths, are unstable and typically resolved downward.
This is most likely what he is calling 'gravity'.
This is true for pure major an minor scales, but if those degrees are sharpened, they will normally act as upward leading tones.  There are exceptions to that, as an augmented 4th is resolved downward fairly frequently.
Comment: @piiperiReinstateMonica  I'm not sure what to tell you. I grew up in the U.S. and studied Western music theory, the same as Russell, and that has been the prevailing theory in Western music for the last 700 years or so.  Also, please keep in mind that only Western music dealt with polyphony, so there were no other music theories that needed to address the concept of dissonance.
Comment: @user3235 I mean, instead of saying that a note "is a tension" and "has a tendency", say that _composers_ and _players_ in certain circles have a tendency of thinking of that note as a tension and the _people_ have a tendency to "resolve" it. In blues, you have dominant sevenths all over and you don't think of that as a tension that has to be resolved. If you "resolve" the dominant seventh in blues chords, you break the whole thing. It's about what people are used to doing and expecting. What else could there be than what there is - your own mind and cultural fixations are the limiting factor.
Comment: @piiperiReinstateMonica  It is not isolated notes that are in tension, but intervals.
I agree that minor seventh intervals and dominant sevenths are considered dissonant per classical harmony.  However, non-altered chords have relatively low dissonance and today unaltered 7ths, 9ths, 11ths and 13ths are considered acceptable without resolution. But I don't think anyone would consider a chord with 2 stacked minor 9ths as acceptable. So, yes, exposure makes a difference, but there are auditory effects that can't be ignored.
Answer:
The first scale is just the standard F major scale:
F G A B♭ C D E F

The reason the standard F major scale is used over the lydian mode for horizontal playing is that the B♮, unless resolved upwards, can sound out of place against other chords in the key.

Russell's F major flat seventh 'scale' is the mixolydian mode relative to Bb.
In the key of B♭, the seventh degree is F. The seventh chord built off of F in Bb consists of F A C Eb, and so the most consonant scale choice will use E♭ instead of E♮.
B♭ C D Eb F G A B♭ C D E♭ F G A B♭

The F major augmented fifth scale is a bit peculiar for a couple of reasons.
F G A B♭ C♮ C♯ D E

Clearly, the C♯ is is going to fit better with chords with a raised 5th.
Something that is obvious but should be stated is that a scale or mode to be played over a chord or sequence of chords depends upon the specific chords and how dissonant your soloing is intended to be.
The first peculiarity for me is that while plain augmented triads, and less rarely, augmented major seventh chords are used in jazz, the most common variety of chords with augmented 5ths found are dominant (flatted) sevenths.
The second peculiarity is that Russell has a chromatic progression in the scale between the C♮ and D♮. I assume that he intended this scale to sound 'bluesy'.
Since most augmented chords are also dominant 7ths, and that contiguous chromatic notes tend to "stick out", a more practical scale for dominants with raised 5ths might be the ascending melodic minor beginning from the 4th degree.
This contains the root, major 3rd, augmented 5th and flatted 7th, without any contiguous successions of minor 2nds.
C D Eb F G A B C D E♭ F G A B C
Another alternative to the F major augmented fifth scale is a whole tone scale starting from F.

The lydian flat seventh scale.
F (G) Ab A Bb B C D Eb (E)

As others have correctly pointed out, Russell is just listing the most commonly used tones played to create a 'blues' sound.


Writing XML file with HTML

Question: I am trying to use a XML file, and write out the information on my website using HTML. This if for a school project, and the teacher spesifically told us to use XML and HTML. My HTML already contains code, pictures, text etc, and this works perfectly. So i tried to put the XML code inside a  tag, and write it out. The XML file is just a table with some information about my favourite basketballball players.
I have searched through the internet for a couple of days now, and I couldnt find any information about this topic. I visited the W3Schools site and I tried using the information given there.
The problem is when I use what they have done there, try to expand it, and make it work with my own tags, it wont work, at all! For example, when i have two tags in the XML file, and try to write that out, it works. Then i try to add just one more tag, and the whole thing just shuts down. The only that appears is a little black square.
Here is my XML code:
<?xml version="1.0" encoding="UTF-8"?>

<basketballplayers>
<player>
  <name>Steve Nash</name>
  <college>Santa Clara</college>
  <team>La Lakers</team>
</player>
<player>
  <name>Ricky Rubio</name>
  <college>Did not attend</college>
  <team>Minnesota Timberwolves</team>
</player>
<player>
  <name>Michael Jordan</name>
  <college>North Carolina</college>
  <team>Chicago Bulls</team>
</player>
</basketballplayers>

And here is my HTML code, with just the XML stuff:

Comment: don't use `document.write`. Once page is loaded it will wipe everything out!
Comment: Huh? No it won't. Anyway... change your first `document.write("");` to `document.write("");`
Comment: @rjdown it won't? Then explain what happens in this demo  http://plnkr.co/edit/NNvJgW7uCXM7r1rksEXy?p=preview
Comment: If you check Pureiya's example, you'll see it's inline (note the closing div), so it will write to the current document. In your plnkr example, your use of setTimeout means the call is being used after the document has closed, and therefore a new one is created instead. More info here https://developer.mozilla.org/en-US/docs/Web/API/document.write
Answer: Utilizing jquery js library ,
Try
$.get("proving.xml", null, null, "xml")
.done(function (xml, textStatus, jqxhr) {
    $("body").append("

");
    $(xml).find("player *").each(function (i, el) {
        $("#result").append("
" + el.textContent + "
")
    })
})

jsfiddle http://jsfiddle.net/guest271314/w6nx71pd/

Writing XML file with HTML


Linear Regression with Ordered Categorical Outputs

Question: Say I want to create a model to predict outcomes of an emergency room, where the outputs are:

Stroke
Seizure
Overdose

Why can't I run a linear regression model that assigns 1, 2, and 3 to Stroke, Seizure, and Overdose instead of creating a classification model? ISL (Friedman) makes the point that:

Unfortunately,
  this coding implies an ordering on the outcomes, putting drug overdose in
  between stroke and epileptic seizure, and insisting that the difference
  between stroke and drug overdose is the same as the difference between
  drug overdose and epileptic seizure.

However, why does the "difference", or "distance", matter? Can't I just take the output of the regression and round to the nearest integer and call that my guess?
Answer: I'm sorry, but I think there are a lot of issues here.
First, I'm not sure these are even ordered. They certainly aren't mutually exclusive. The third one should not be "overdose". And there need to be more categories - certainly there needs to be "death" and "nothing". Also, overdose of what? Some drug given in the hospital or a drug the patient took on his or her own? In the latter case, it's not an outcome.
Second, if you assume they are ordered, then an OLS model will violate the assumptions about the distributions of the residuals. And the output could be anything. Not only could it be in between 1 and 2, but it could be negative or above 3.
Third, if the responses are ordinal then rounding to the nearest integer is impossible (at least technically) because "nearest" has no meaning. Since you don't know the size of the gaps (much less what's in those gaps) you don't know what's closest to what.  (This might be arguable if there was some underlying continuum, but here, there is not).


Txtfile search not working

Question: Ok so i have inputted a number of records to a text file and i can both write to and read from this file, but i am now attempting to search through this textfile and have encountered a problem.
package assignmentnew;

// Import io so we can use file objects
import java.io.*;
import java.util.Scanner;

public class SearchProp {
    public void Search() throws FileNotFoundException {
        try {
            String details, input, id, line;
            int count;
            Scanner user = new Scanner(System.in);
            System.out.println();
            System.out.println();
            System.out.println("Please enter your housenumber: ");
            input = user.next();
            Scanner housenumber = new Scanner(new File("writeto.txt"));
            while (housenumber.hasNext())
            {
                id = housenumber.next();
                line = housenumber.nextLine();
                if (input.equals(id))
                {
                    System.out.println("House number is: "  + id + "and" + line);
                    break;
                }
                if(!housenumber.hasNext()) {
                    System.out.println("no house with this number");
                }
            }
        }
        catch(IOException e)
        {
            System.out.print("File failure");
        }
    }
}

No matter what value i enter i am told that the house number is not present in the file, but obviously it is, any ideas?
Addendum:
File Structure in textfile.
27,Abbey View,Hexham,NE46 1EQ,4,150000,Terraced
34,Peth Head,Hexham,NE46 1DB,3,146000,Semi Detached
10,Downing Street,London,sw19,9,1000000,Terraced

Comment: how does the input file look like? (Paste it and format it as code in your question.)
Comment: Can you give the structure of the house number files ?
Comment: Could it be that one of user.next() and housenumber.nextLine() have trailing whitespaces / line separator, and not the other ? Maybe a comparision that ignores whitespaces would help ...
Comment: i have pasted the file structure in the textfile under addendum, thanks
Answer: The default delimiter for a scanner is white-space, and not ,.
Answer: You have to use housenumber.useDelimiter(","); and the code will work.
EDIT:
Set it before the while.
And that is what I get for example for 27.
Please enter your housenumber:
27
House number is: 27 and ,Abbey View,Hexham,NE46 1EQ,4,150000,Terraced

Comment: @Darren Burgess exactly what changes did you do to your code? I have put the useDelimeter just after ceation of the scanner and before the while loop, and that is waht I get, see EDIT in my answer.
Comment: i just removed the commas when entering my values into the textfield meaning that there was no need to change the delimiter of the scanner. Understand what you mean though, thanks

Txtfile search not working


jsTree - Closing nodes on a specific level

Question: I have a jstree with 5 levels of nodes.  I want to iterate through all nodes to close those nodes for which the level is 4 so that one doesn't see level 5 unless 4 is clicked to expand.  If there is a better approach than iterating, I'm all ears!
<code>$("#mytree").bind('ready.jstree', function(event, data) {
  var $tree = $(this);
  $($tree.jstree().get_json($tree, {
    flat: true
  }))
  .each(function(index, value) {
     var node = $("#mytree").jstree().get_node(this.id);
     var lvl = node.parents.length;
     if (lvl = 4) {
       node.close_node(this, true);
     }
  });
});
</code>
Answer: I found an answer, in case anyone else is looking to do the same.
Instead of opening all and then closing some, I started with all closed and opened the ones I wanted:
<code>$("#mytree").bind('ready.jstree', function(event, data) {
   var $tree = $(this);
   $($tree.jstree().get_json($tree, {
    flat: true
   }))
  .each(function(index, value) {
     var node = $("#mytree").jstree().get_node(this.id);
     var lvl = node.parents.length;
     if (lvl <= 3) {
        $('#mytree').jstree().open_node({"id":node.id});
     }
   });
});
</code>
Answer: If you want to open the nodes of first level, you may try this.
<code>           $('#myTree li').each( function() {
           var node=$("#myTree").jstree().get_node(this.id);
           var level = node.parents.length;
             if(level<=1){
             $('#myTree').jstree().open_node({"id":node.id});
             }
           });
</code>
It works for me, when I want to display the folders of an azure container. In my case, container is the root node.


Is the natural map $L^p(X) \otimes L^p(Y) \to L^p(X \times Y)$ injective?

Question: Let $X,Y$ be $\sigma$-finite measure spaces, and let $L^p(X) \otimes L^p(Y)$ be the algebraic tensor product.  The product has a natural map into $L^p(X \times Y)$ which takes $\sum a_{ij} f_i \otimes g_j$ to the function $F(x,y) = \sum a_{ij} f_i(x) g_j(y)$.  A moment's thought shows that this map is well-defined.  Is it also injective?
It seems that this should be true, but I can't see how to prove it.  Intuitively, one needs to show that if $\sum a_{ij} f_i(x) g_j(y) = 0$ a.e., then one should be able to cancel all the terms in the sum using bilinearity.  It is not quite clear how to do this without knowing anything about the terms.
Comment: OMG! this is as good as it gets, we got LaTeX in question's title!!
Comment: Could you imagine if we had to wait for our recreational math site to load?! The horror!
Comment: Actually, it's not.  It lags the loading of the main page, which is why we decided against it on MO.
Answer: EDIT: Here is a cleaned-up and corrected version of this answer, based on Pierre-Yves' suggestion (thanks!).  His answer above contains a much more complete version.
If $\sum_{i=1}^n a_{i} f_i \otimes g_i$ is not the zero element of $L^p(X) \otimes L^p(Y)$, we may assume without loss of generality that the $f_i$ are linearly independent.  We can also assume that $a_1 \ne 0$ and $g_1 \ne 0$.
Suppose that the corresponding function $F(x,y) = \sum_{i=1}^n a_{i} f_i(x) g_i(y) = 0$ a.e.  Since $g_1 \ne 0$, there is a measurable $B \subset Y$ of positive finite measure such that $\int_B g_1 \ne 0$ (the integral is finite by Hölder).    Then by Fubini's theorem, for a.e. $x$ we have
$$
0 = \int_{B} F(x,y)dy = \sum_{i=1}^n a_i \left(\int_{B} g_i\right) f_i(x).
$$
This contradicts the assumed linear independence of the $f_i$.
Comment: Wonderful!!! You can even assume $a_i=1$ for all $i$. By definition a tensor is a finite sum $\sum f_i\otimes g_i$.
Answer: The previous version of this answer was incorrect. It has generously been accepted by Nate Eldredge on the ground that "it definitely contains the right idea". This previous version has better remain forgotten forever. The reader should consult Nate's answer, which is correct and complete. I'll just try here to spell out the underlying linear algebra lemma (which is trivial, but which I failed to see).

UNDERLYING LEMMA. Let $U,V,W$ vector spaces over some field $K$, and $\alpha:U\otimes V\to W$ a linear map. Assume that for each nonzero vector $u_0$ in $U$ there are linear maps $\beta:W\to V$ and $\gamma:U\to K$ such that $\gamma(u_0)\not=0$ and
  $$\beta(\alpha(u\otimes v))=\gamma(u)v\ \forall\ u,v.$$ Then $\alpha$ is injective.

The proof can be very easily extracted from Nate's answer. Here is the most standard application:
APPLICATION. Let $U,V,W$ be respectively the spaces of $K$-valued functions on the sets $X,Y,X\times Y$, and $\beta,\gamma$ are given by $(\beta(w))(y)=w(x_0,y)$, $\gamma(u)=u(x_0)$ where $x_0$ is chosen so that $u_0(x_0)\not=0$.
EDIT. Here is a mild generalization.
Let $X$ be a measure space, let $\mathcal V(X)$ be the vector space of all measurable complex valued functions on $X$, let $\mathcal N$ be the subspace of functions vanishing almost everywhere, and let $V(X)$ be the quotient. [Is there a standard notation for these spaces?]
Let $Y$ be another measure space. The bilinear map from $\mathcal V(X)\times\mathcal V(Y)$ to $\mathcal V(X\times Y)$ sending $(f,g)$ to $(x,y)\mapsto f(x)g(y)$ induces a linear map $\Phi$ from $V(X)\otimes V(Y)$ to $V(X\times Y)$.

THEOREM. Assume $X$ and $Y$ are $\sigma$-finite. Then $\Phi$ is injective.

This slightly more general than the statement proved in Nate's answer because no integrability assumptions are made on the functions.

LEMMA. Let $f_i,\dots,f_n$ be in $\mathcal V(X)$, and $S\subset X^n$ the set of $x\in X^n$ such that $\det(f_i(x_j))\not=0$. Then the $f_i$ are linearly independent in $V(X)$ if and only if the measure of $S$ is positive.

Denote by $|A|$ the measure of $A$, and by $S_g$ the support of the function $g$, that is the set of points where it is nonzero. Put $d(x):=\det(f_i(x_j))$ for $x\in X^n$. The above set $S$ is now $S_d$.
To prove the if part of the lemma, assume the $f_i$ are linearly dependent in $V(X)$ and check $|S_d|=0$ as follows. Let $\lambda$ be a nonzero vector of $\mathbb C^n$ such that $g:=\sum \lambda_i f_i$ satisfies $|S_g|=0$. Denote again by $\lambda$ the 1 by $n$ matrix formed by the $\lambda_i$, and by $A(x)$ the matrix $(f_i(x_j))$. For $x$ in $(S_g^c)^n$, where the superscript c mean "complement", we have $\lambda A(x)=0$. Multiplying on the right by the adjugate of $A(x)$ we get $d(x)=0$. This shows that $S_d$ is contained in the measure zero subset $((S_g^c)^n)^c$ of $X^n$.
To prove the only if part of the lemma, assume $|S_d|=0$ and check that the $f_i$ are linearly dependent in $V(X)$ as follows. Expand $d(x)$ as $$d(x)=\sum\ d_i(x')\ f_i(x_n)$$ with $x':=(x_1,\dots,x_{n-1})$. Arguing by induction, we can assume $|S_{d_i}|>0$ for all $i$. Let $U$ be the union of the $S_{d_i}$. Denoting by $d(x',\bullet)$ the function $x_n\mapsto d(x)$, we have
$$S_d=\bigcup_{x'\in X^{n-1}}\ \{x'\}\times S_{d(x',\bullet)}.$$ Fubini yields
$$0=|S_d|=\int_{X^{n-1}}\ |S_{d(x',\bullet)}|\ dx'.$$
If the $f_i$ were linearly independent in $V(X)$, we would have $|S_{d(x',\bullet)}|>0$ for all $x'$ in $U$, a contradiction. The lemma is proved.
Let's prove the theorem. In the next lines, $i,j,k$ will lie between 1 and $m$, whereas $p,q,r$ will lie between 1 and $n$.
Let $f_1,\dots,f_m$ be in $\mathcal V(X)$; let $g_1,\dots,g_n$ be in $\mathcal V(Y)$; and put $F_{ip}(x,y):=f_i(x)g_p(y)$.
The theorem is equivalent to the statement that the linear independence of the $f_i$ and $g_p$ in $V(X)$ and $V(Y)$ implies that of the $F_{ip}$ in $V(X\times Y)$.
Let $S\subset X^m$ and $T\subset Y^n$ be defined by the conditions $\det(f_i(x_j))\not=0$ and $\det(g_p(y_q))\not=0$. Embedd $U:=S^n\times T^m$ into $(X\times Y)^{mn}$ in the obvious way, and denote the $(i,p)$-th coordinate of $z\in(X\times Y)^{mn}$ by $z_{ip}=(x_{pi},y_{ip})$. Then $z$ is in $U$ iff $x_p\in S$ and $y_i\in T$ for all $(i,p)$, that is iff
$$\det\Big(f_j(x_{pk})\Big)_{jk}\not=0\not
=\det\Big(g_q(y_{ir})\Big)_{qr}$$
for all $(i,p)$. We claim that the validity of this double nonequality for all $(i,p)$ implies the nonequality
$$\det\Big(f_i(x_{qj})\ g_p(y_{jq})\Big)_{(i,p)(j,q)}\not=0.$$
In view of the lemma, the theorem is equivalent to the claim. But the claim doesn't depend on the measures defined on $X$ and $Y$. As the theorem holds when $X$ and $Y$ are equipped with the counting measure (see the application of the "underlying lemma" at the beginning of the post), we are done.
Comment: $V(X)$ is sometimes denoted $L^0(X)$, cf. e.g. [here](https://math.stackexchange.com/q/266216/92038) or in "An Introductory Course in Functional Analysis" (2014) by Adam Bowers, Nigel J. Kalton, p. 90 and 125.  I like to write down references for things that are somewhat related (although, different context), so let me cite "Basic Theory of Algebraic Groups and Lie Algebras" (GTM 75, 1981), Gerhard P. Hochschild, Lemma 1.1 and Proposition 1.2 p. 1-2


Gaps between the primes

Question: I had this question at the start of my number theory class so I think it is supposed to be an easy one but I did not receive a solution. Here is the problem:
Let $n\in \mathbb{N}$ be arbitary. Prove that there exists a number $k\in\mathbb{N}$,
such that $k + 1, k + 2, k+3, . . ., k+n\;$ are not primes.
I read somewhere that the gaps between the consecutive primes do not tend towards infinity so is this not a wrong statement? This is what confused me. Can someone shed some light on this?
Comment: Take $k=(n+1)!+1$.
Comment: Insofar as the real question here is what's asked in the final paragraph, I would say this is *not* a duplicate. Even if you know how to solve the assigned problem, one might still be confused by an apparent conflict with the notion that the gaps between primes do not tend to infinity.
Comment: This smells like Wilson's Theorem: https://en.wikipedia.org/wiki/Wilson%27s_theorem
Comment: "Terry Tao, Ph.D. Small and Large Gaps Between the Primes" https://www.youtube.com/watch?v=pp06oGD4m00
Answer: Let $g_n$ be the sequence of gaps between consecutive primes. The problem posed is to show that $\limsup_{n\to\infty}g_n=\infty$. The Twin Prime conjecture, on the other hand, says that $\liminf_{n\to\infty}g_n=2$. The 2013 breakthrough theorem of Yitang Zhang says that $\liminf_{n\to\infty}g_n\le70{,}000{,}000$ (and follow-up work by others has reduced the upper bound to $246$). Conjecturally, $g_n$ takes every even value infinitely often, but Zhang's theorem alone is enough to show that $g_n$ does not tend to infinity, even though its limsup does.
Added later: Just to be clear, I am answering what I take to be the OP's main question, which is why the assigned problem does not conflict with their having read that the sequence of gaps does not tend to infinity. As the OP surmised, the assigned problem is a relatively easy one (and as such would be a duplicate).
Comment: @Peter, thanks for your comment. My best guess is that the downvoters thought I was  posting an unnecessarily advanced comment instead of a solution to an elementary problem. As indicated, one person undid their downvote after my edit (and may have changed it to an upvote); I like to think the other two simply haven't seen the edit.  I don't normally comment on downvotes (and certainly not on upvotes!), but since three of them came quite quickly, I made an exception this once.
Comment: My thanks to the downvoter who reversed their opinion of the answer. (There were three downvotes before the edit, now only two.)
Comment: I do not understand the downvotes for this excellent answer. (+1)

Gaps between the primes


How to pull twitter feed in content type?

Question: I need to create content type(twitter content ) where i can pull twitter feeds so that i can use that content type for entity reference and print the twitter feeds.
Can any one please help or assist me how pull twitter feeds in custom content type?
Answer: For this you have twitter block module in drupal 7 , but you want content type for this make node--twitterfeed.tpl.php  template  and put your api script like this
Tweets by @InstaSnapShop

also check https://www.drupal.org/project/twitter_block


Measure numbers in alternating time signature with dotted barlines

Question: A piece has an alternating 7/8 and 8/8 pattern a la this answer's second example, notated as 7+8/8 with dotted barlines between.
For the purpose of numbering, does the full 15-beat pattern count as one measure or two?
Answer: You can number measures with dotted barlines in any way that's convenient for you and the people playing your music. Just make sure the numbering you choose is consistent and clear in all the parts.
Probably ignoring the dotted barlines and counting the whole 15-beat pattern as one measure would be clearest.
Answer: What Gould says
In Elaine Gould's Behind Bars, it's made clear that dotted barlines designate divisions of a measure and not measures in themselves (all emphases mine).

Where possible, bar division is indicated by beam grouping or by the particular division of longer notes and rests. Otherwise, divide bars by adding dotted barlines. (page 178)

In an instrumental part, dotted barlines are very helpful, especially in complex music or long bars, since the player may well mark in the divisions of the bar in any case. (page 178)

Dotted barlines may separate the different portions of the bar. (page 180)

And the below example (page 628) shows the use of a dotted barline, which is clearly not part of the measure numbering.

Labeling bar divisions
In a situation where bar divisions are complex or need to be easily specified (say, by a conductor), each division could be labeled (a), (b), (c), etc. Thus the second subdivision of measure 37 would be bar 37b.
This is just a suggestion, not an "official" practice.
Answer: I'd argue that dotted barlines aren't real barlines, so they don't indicate the start of a new measure and won't add to the count.
Alternatively, if you think that each 7/8 and 8/8 pattern is a complete measure of its own, then why are you using dotted barlines?
Comment: I'm not certain it is or isn't, but if I were, it would be because marking where the pattern starts makes it easier to read.


Login Using Facebook and im facing FBSDKLoginManagerLoginResult as IsCancelled true always in IOS 11

Question: I have Used Login using Facebook Feature in My App and Im getting FBSDKLoginManagerLoginResult as IsCancelled always. This Issue occurs only in IOS 11. Is there any possibilities to solve this issue and Im Currently using Xcode 9 Beta with Facebook SDK 4.1.0. Thanks in advance.
Comment: Can you upgrade to the latest facebook SDK? There's a notice about a bug fix: `Fixed login bug that treated a request for no new permissions as a cancellation.` in the v4.9.0 release.
Comment: Thank you @petesh i will try now with 4.9.0
Comment: Im getting the following Error:-  The operation couldn't be completed. (com.facebook.sdk.core error 8)
Comment: Hi, I am facing this issue too, i am having latest version '4.29.0'
Answer: I have fixed the issue by updating my FacebookSDK to 4.22.0
<code>pod 'FBSDKCoreKit', '4.22.0'
pod 'FBSDKLoginKit', '4.22.0'
pod 'FBSDKShareKit', '4.22.0'
</code>
Now it works fine with the Xcode 9 beta and IOS 11-developement version. And in IOS 11 safari will handle the login with facebook feature because from IOS 11 the default facebook, twitter are removed.
Answer: On iOS 11, be sure, that you don't set
<code>    FBSDKLoginManager *facebookLoginManager = [FBSDKLoginManager new];
    [facebookLoginManager setLoginBehavior:FBSDKLoginBehaviorSystemAccount];
</code>
because system account is no longer available.


unexpected identifier on a mysql query in nodejs

Question: I have the following code:
 connection.query("SELECT * FROM accounts_data WHERE new_username LIKE '%" + username + "%';", function (error, results, fields) {

});

and I am getting the following error
SELECT * FROM `accounts_data` WHERE `new_username` LIKE '%preloved_bys%'
                               ^^^^^
SyntaxError: Unexpected identifier
    at wrapSafe (internal/modules/cjs/loader.js:1054:16)
    at Module._compile (internal/modules/cjs/loader.js:1102:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)

what is wrong with the query? when i execute it via phpmyadmin it works just fine
Comment: Can you show more code?
Comment: Did you try with backticks ` ?
Comment: Could you please provide a https://stackoverflow.com/help/minimal-reproducible-example including version of installed deps ? Thank you
Comment: Can you provide `npm view mysql version`, `npm -v`, `node -v`?
Comment: Do you have any other code? If you have, does the other code(s) execute without error? I'm guessing this is a part of some other codes.. if so, could you please post the whole code so that we can see the bigger picture?
Comment: I think this is coming from the node version you're using, you might have to rollback to a more stable version. Which one are you using?
Comment: 1. Pay attention that the error message is produced by node.js, not by MySQL. I.e. the query even was not sent to MySQL, the error was detected before. 2. Pay attention that object names are not enclosed into backticks in query text in code but are enclosed in the error message. Totally: looks like node.js parser issue.
Answer: i get success with do following :
var value = 'sc188203395acc255';
connection.query('SELECT * from emp where empid like ?', '%' + value + '%', ...)

Turn on debugging in the driver (pass debug:true as argument to mysql.createConnection ), it doesn't escape the percent sign
One More Way to Slove this Error :
"SELECT * FROM emp WHERE name empid " + connection.escape('%'+value+'%')

use connection.escape alternate way to do same things
One More Way to Solve this Error :
reinstall module on your project because sometimes error can be solved by reinstalling it
delete node_modules and package-lock.json and last run npm install
Answer: It seems there is nothing wrong with the following code.
but fyi, SyntaxError: Unexpected identifier occurs due to some reasons, mentioned below:

SQL is case-sensitive language when you pass any parameter into it like 'new_username'. Recheck it should be correct.
use of unwanted special character like ' or "
using an invalid identifier.

Give a try with the following code:

    let str = '%'+username+'%';
    let sql = "SELECT * FROM accouts_data WHERE new_username LIKE ?";

        connection.query(sql, str, function(err, result) {
            if(err) throw err
        });

Just in case, if it doesn't work, update your node_modules with `npm install`. Or just remove version number from all modules in `package.json` file like `"mysql": "^2.18.1"` just remove `^2.18.1`. and Then, Run:
npm install

 It'll update every module with their latest version automatically.
Answer: Nothing wrong with the query, tested it with mysql and mysql2 and it gives the expected result.
It must be related to nodejs, try removing node_modules directory and package-lock.json  file and run npm install
Comment: yes this is a js issue, i am aware .. how does removing node_modules help though ?
Comment: I had an issue related to `internal/modules/cjs/loader.js` not with mysql though, reinstalling my app dependencies helped
Answer: I think you should use proper escaping provided by mysql lib:
connection.query(
  "SELECT * FROM accounts_data WHERE new_username LIKE ?; ",
  ['%' + username + '%'],
  function (error, results, fields) { ... }
);

Also check your mysql version both on client (npm package) and server side.
For debugging, I often use console.log(connection.format(query, values));
Answer: You can use concat
example
connection.query("SELECT * FROM accounts_data WHERE new_username LIKE concat('%',?,'%');", [username],(error, results, fields)=>{console.log(result)})


Law of large number in the proof of linearity of expectation

Question: One of the proofs for linearity of expectation is using simulation (Introduction to Probability, Dr. Blitzstein, p143). There are three columns containing simulated values of random variables, $X, Y$, and $X+Y$. It says that

Taking the arithmetic mean of all the numbers in the third column. By the law of large numbers, this is very close to $E(X+Y)$,
Taking the arithmetic mean of the first column and the arithmetic mean of the second column, then adding two column means. By the law of large numbers, this is very close to $E(X)$ and $E(Y)$.

I think the mean of the arithmetic means becomes close to $E(X+Y)$, not individual arithmetic mean. Could you let me know what I missed in understanding the law of large numbers?
Comment: i don't think simulation is the way to prove linearity of expectation.
Comment: i think the *sum* of individual means approaches the mean of the sum...
Comment: My question is not about the validity of the proof but about the statement that refers to the law of large numbers.
Answer: The law of large numbers tells us that for a bunch of draws (each draw denoted $x_i$) from a distribution with mean $E(X)$, the arithmetic mean $\frac{1}{n}\sum_{i=1}^n x_i$ of those draws approaches $E(X)$.
What the book is trying to demonstrate is that $E(X+Y)=E(X)+E(Y)$. To do this, it takes a bunch of draws from the random variable $X+Y$. The arithmetic mean of these is close to $E(X+Y)$ by the law of large numbers. It then takes a bunch of draws from $X$ and from $Y$ and estimates the mean by invoking the law of large numbers again.
Now we have estimates of $E(X),E(Y),E(X+Y)$ and indeed for these estimates the relationship $E(X+Y)=E(X)+E(Y)$ should be approximately true.
Comment: What I understand is that the average (expected value) of the arithmetic means approaches E(X). The individual arithmetic mean can be far away from the E(X).


Solving Linear ODE using matrices

Question:
What I don't understand here is where or how the operator for this solution is formed. Shouldn't the values of the operator be A=(1,0,0,1)? (in the form a11, a12, a13, a14 respectively).
Any help on this topic is hugely appreciated. Thank You
Comment: it means that $\begin{pmatrix}\dot x\\\dot y\end{pmatrix}=A\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}y\\x\end{pmatrix}$
Answer: Hint:
If we set $X'=\begin{pmatrix}
  x'(t)\\
  y'(t)
\end{pmatrix}$ and consider the following system $$ \left\{
        \begin{array}{ll}
            x'(t)=\color{blue}{0}\cdot x(t)+\color{red}{1}\cdot y(t)\\
            y'(t)=\color{red}{1}\cdot x(t)+\color{blue}{0}\cdot y(t)
        \end{array}
    \right.$$ as $$X'(t)=A~X(t)$$ in which $$A=\begin{pmatrix}
  \color{blue}{0} & \color{red}{1} \\
  \color{red}{1} & \color{blue}{0}\\
  \end{pmatrix}$$ then you can find why that matrix selected.
Comment: Nice use of color! +1
Comment: @BabakS.: Nice answer =1

Solving Linear ODE using matrices


How is the tail of a distribution defined (about heavy-tailed distributions)?

Question: Some distributions are said to be heavy-tailed. It seems that one definition of a heavy-tailed distribution is that its tails are heavier than the tails of an exponential distribution. However, how does one exactly define the tails, since the different distributions have different numbers of parameters?
I suspect that the cumulative distribution function is somehow used here, though I am not sure.
Comment: The answers [here](http://stats.stackexchange.com/questions/86429/which-has-the-heavier-tail-lognormal-or-gamma) discuss a number of possible ways of defining heaviness of tail, and whuber's answer explains why (in relation to the right tail) one definition makes particular sense.
Comment: A good working definition is the one you mention; that is, a heavy-tailed distribution is one that decays at a speed that is less than exponential.  This agrees with the formal definition from Wikipedia as well: https://en.wikipedia.org/wiki/Heavy-tailed_distribution which says a distribution is "right" heavy-tailed if $\lim_{t \to \infty} e^{\lambda t} P(X > t) = \infty$ for all $\lambda > 0$.
Comment: MRE, "mean residual lifetime" $\equiv \ E( X - x | X \geq x )$
is an intuitive thing to look at: what's my remaining life expectancy if I'm $x$ years old ?
Bryson, "Heavy-tailed distributions: properties and tests" (1974) says
"increasing MRE provides a reasonable way of describing the heavy-tail phenomenon"
and considers MRE constant, $X$ exponential, vs. $a + bx$.
(He calls MRE "CME", conditional mean exceedance.)
Answer: We distinguish what distributions are heavy tailed by first limiting our discussion to those tails that are long, that is, there is always an $\epsilon>0$, no matter how small, for which $f(x)>\epsilon>0$ for any $x<M$ no matter how large $M$ (for right tails), or $x>M$ for $M$ large magnitude negative (for left tails). In other words, $f(x)$ is non-zero no matter how large $|x|$ is. A random variable rather than density function definition for long tailed would be equivalent.
Then (using the right tail) $\lim_{x\rightarrow \infty} 1-F(x)\rightarrow 0$, that is, the long heavy-tailed survival function, i.e., $1-F(x)$, A.K.A. $1-\text{CDF}$, can then be used to construct the ratio of two candidate survival functions, which ratio will go to zero as $x\rightarrow \infty$ if the lighter tail is in the numerator. In practice, it is often easier to compare the limiting logarithm of the ratio of survival functions, but this is actually not different, if properly interpreted. For long left tails, we would compare the limiting (logarithm of) the ratio of the CDF's themselves as $x\rightarrow -\infty$, rather than the survival functions.
Why use the CDF or 1-CDF for this? Why not use the (e.g., logarithm) of the ratio of the pdf's? In many cases we could use the pdf's, however, for actual random variables (observations), and for some pdf's with nasty properties like non-smooth derivatives, this would be less revealing than comparison of the limiting areas under the pdf's.
What is the big deal with tail heaviness of exponential functions? Exponential functions have the same rate everywhere so that they are memoryless. Thus, exponential distributions form a natural cut point for measuring heaviness of tails.


Let $\phi: V \rightarrow \mathbb{A}^n$ be a finite regular map. Does this imply the map is finite-to-one?

Question: Let $k$ be a field, $V$ be an algebraic set.
Suppose I have a regular finite map $\phi: V \rightarrow \mathbb{A}^n$.
Here by finite I mean that $k[V]$ is a finite $k[x_1, ..., x_n]$-algebra.
I was wondering does this imply that $\phi$ is finite-to-one map?
I would greatly appreciate explanation! Thank you very much!
Comment: Yes. Short answer: being finite is preserved by base change (in particular, computing fibers), and a finite algebra over a field has finitely many prime ideals (all of which are maximal). (A finite $k$-algebra is Artinian.)
Comment: @Johny T. Okay I gave an answer. You don't really need the schemy stuff I remark about, and this can be done explicitly (its somewhere in Shaferevichs Projective Varieties book), but maybe it provides motivation for learning that language.
Comment: @AreaMan I know you wrote "Short Answer", but would it be possible to give more explanation by any chance? as I am not really sure how it answers the question (because of my lack of background in algebraic geometry)... Thanks!
Answer: There are two basic facts at play here, the general formula for computing fiber products, and the fact that finite $k$-dimensional $k$-algebras correspond to finite spectra. Both of these are clarified by thinking about schemes as the "correct" objects, since otherwise you will leave the category of varieties, but if you know the spec functor it is sufficient - if you don't just keep in mind that for $A$ a finitely generated, reduced $k$-algebra, $Spec A$ "is" the variety with coordinate ring $A$.
About computing fibers:
If $f : X \to Y$ is a regular map, which induces a morphism $f^* : B \to A$ on the level of coordinate rings, then the fiber over a maximal ideal $m$ in $Y$ has coordinate ring $A \otimes_B B/m$. In other words, the ideal of functions that vanish on $f^{-1}([m])$ is generated by the pullbacks by $f$ of the functions that vanish at $[m]$ (the ideal $m$).
The categorical way to think about this is in terms of universal properties - you can verify that in the category of $B$-algebras $A \otimes_B B/m$ is the coproduct of $A$ and $B/m$, hence on the side of varieties the variety $\operatorname{Spec} A \otimes_B B/m$ is the product. (Really it is just finite type $k$-scheme in general, because it can have nilpotents.) Now, the fiber over a point should be the largest subvariety that maps down to that point, and this is what the universal property says if you unravel it. (I can say more if you like, but it is worth playing with this on your own.)
Geometrically, certainly the pullbacks of functions vanishing at $[m]$ vanish at $f^{-1}([m])$. For some geometric intuition, you can assume $V$ is affine and embed $V \subset A^m$, and assume that the point whose preimage you are considering is the origin in $A^n$... so that the fiber in $V$ above $[m]$ is given as the (scheme-theoretic) intersection of $V$ with some hypersurface cut out by $(f_1, \ldots, f_n)$, where these $f_i$ define $f : A^m \to A^n$. Then the $f_i$ cut out the fiber in $V$, and these are pulled back from the coordinate functions on $A^n$. (Behind the scenes here is that the scheme theoretic intersection is also given by a fiber product.)
Okay, so ... if you compute the coordinate ring of a fiber over $[m]$, which is $A := \phi^{-1}([m]) = k(V) \otimes_k L = k[x_1, \ldots, x_n] / f^*(m)$, where $k(V)$ the coordinate ring of $V$ as a $k$-algebra, you will get some finite $k$-dimensional algebra $A$ over $L = B/m$. (If $k$ is algebraically closed, then $k = L$).
(Note that $A$ need not be reduced - this means that it will not be a variety, but a scheme. As an example, consider the map $z \to z^2$ from $A^1$ to itself. Then the fiber above any point away from the origin is two points, but as you move towards the origin, these two points collide to make a non-reduced "fuzzy" point.)
We will show that the minimal primes of $A$ are also maximal. (That $A$ has minimal primes follows from $A$ being finite dimensional - either in the Krull sense or as a $k$ vector space.) Let $P$ be a minimal prime, and consider $A/P$. This is a domain, and a finite $k$-dimensional $k$-algebra. It is a good exercise to show that if finite $k$-dimensional domain is a field. Hence $P$ was maximal.
Moreover, by considering the chain $P_1 \supset P_1 \cap P_2 \supset \ldots$, and using that $A$ is artinian because it is finite dimensional, and using prime avoidance one can conclude that there are finitely many prime ideals in $A$. (Exercise.)
Hence the variety corresonding to $A / Nil(A)$ has finitely many points, or anyway $spec A$ is a finite set.


Disabling the 'Aero Blur' from the Windows 7 taskbar (using C++?)

Question: I found a small program a while back that let me disable the Aero Blur while keeping the transparency that came with the theme. The program worked on literally everything, except for the taskbar which still appears to blur everything that happens to be underneath it.
This curious behavior led me to experimenting with the DWM api, in C++. Sadly, this didn't really help me at all, since no matter what functions I'd use - like DwmEnableBlurBehindWindow() -, none of them would actually affect the taskbar in a way that I wanted them to. I even tried turning the alpha levels of the taskbar's owner "window" down, but sadly that didn't work either - It made the taskbar icons transparent too which is a no-no for me, and it didn't actually remove the blur it just made the effect weaker.
As it seems that my skills are not enough to accomplish this task, I'm asking you - how can I remove the Aero blur from the Windows 7 taskbar? (Possibly using C++)
Comment: Well, taking into account that I've searched for _a while_ already and I've never seen a way to accomplish this, I'd say that it'd be a huge addition for example to the Windows theming community, and to a lot of people who are interested in customizing their Windows.
Comment: Even the Microsoft programmers working on Windows 8 didn't manage to do this.  While glass is gone everywhere else.  Good enough for me to guess that this just can't work.
Comment: I don't know the answer, but there's an interesting observation over on super user, as to [the aero theme not blurring when the magnifying glass is used](http://superuser.com/q/466048/214257).  You might be able to use that info as the basis for a bit of a hack...
Comment: While this seems like a good (well structured) question, does it have any real use beyond personal interest? If this is for a commercial app, the task bar is not yours to change. I'm voting to close as too localised (when the bounty is over)
Comment: That's a pretty interesting effect. I just tried using the Magnifier tool on my taskbar, and it seems that the blur does not disappear completely but it does seem to weaken the effect quite a bit. Sadly I don't think I'll be able to figure out a way to effectively use this knowledge to my advantage..
Answer: Remove Transparency that will do, else go to
Personalize by right clicking on desktop.
There go to theme, personalize the theme,
and find transparency/opacity. if you want with no blur and enabled transparency make it 100%
else disable transparency.
this you can do using c++ by doing twiks with Registry.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"Composition"=dword:00000000
"CompositionPolicy"=dword:00000000
"ColorizationColor"=dword:6b74b8fc
"ColorizationColorBalance"=dword:00000008
"ColorizationAfterglow"=dword:6b74b8fc
"ColorizationAfterglowBalance"=dword:0000002b
"ColorizationBlurBalance"=dword:00000031
"ColorizationGlassReflectionIntensity"=dword:00000032
"ColorizationOpaqueBlend"=dword:00000000
"EnableAeroPeek"=dword:00000001
"AlwaysHibernateThumbnails"=dword:00000000

this are the values for Windows 7,
if you will change here, you will get the result. it contains all things you need to change.
you may change values for this three
ColorizationBlurBalance, ColorizationGlassReflectionIntensity, ColorizationOpaqueBlend
I think that will do :)
Comment: I'm not looking to disable transparency, since the effect that I want to accomplish is a transparent taskbar without _blur_, and those registry keys you gave me, don't actually remove the blur, they just make it a bit less noticeable with the use of certain colors.
Comment: ColorizationOpaqueBlend is the main conflict, make it zero and you will see the difference, some are percentages for your information
Comment: I already had `ColorizationOpaqueBlend` at 0, and it's not even nearly sharp. I don't think you can accomplish this via registry editing.
Comment: I will get back to you after I will try something else, running busy
Answer: I found a small program that will remove the blur.
Link to DeviantArt


Forwarding IPv6 traffic

Question: How can I forward IPv6 traffic from my tun0 interface to the eth0 interface?
ifconfig:
eth0      Link encap:Ethernet  HWaddr 00:16:3E:12:77:54
          inet addr:188.8.131.52  Bcast:220.127.116.11  Mask:255.255.255.0
          inet6 addr: 2607:f740:0:3f::eda/64 Scope:Global
          inet6 addr: fe80::216:3eff:fe12:7754/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:65590 errors:0 dropped:499 overruns:0 frame:0
          TX packets:40111 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:13246038 (12.6 MiB)  TX bytes:28807669 (27.4 MiB)
          Interrupt:29

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.8.0.1  P-t-P:10.8.0.2  Mask:255.255.255.255
          inet6 addr: 2607:f740:44:22::8/64 Scope:Global
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:16876 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16504 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:2235766 (2.1 MiB)  TX bytes:7680377 (7.3 MiB)

I have forwarding enabled:
[root@baobei ~]# sysctl net.ipv6.conf.all.forwarding
net.ipv6.conf.all.forwarding = 1

Firewall:
ip6tables -F INPUT
ip6tables -F FORWARD
ip6tables -F OUTPUT
ip6tables -F

ip6tables -P INPUT ACCEPT
ip6tables -P FORWARD ACCEPT
ip6tables -P OUTPUT ACCEPT

echo -n "1" >/proc/sys/net/ipv6/conf/all/forwarding
echo -n "1" >/proc/sys/net/ipv6/conf/all/proxy_ndp
echo -n "0" >/proc/sys/net/ipv6/conf/all/autoconf
echo -n "0" >/proc/sys/net/ipv6/conf/all/accept_ra
ip6tables -A INPUT -p icmpv6 -j ACCEPT
ip6tables -A FORWARD -m state --state NEW -i tun0 -o eth0 -s 2607:f740:44:22::/64 -j ACCEPT
ip6tables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

Routes:
unreachable ::/96 dev lo  metric 1024  error -101
unreachable ::ffff:0.0.0.0/96 dev lo  metric 1024  error -101
unreachable 2002:a00::/24 dev lo  metric 1024  error -101
unreachable 2002:7f00::/24 dev lo  metric 1024  error -101
unreachable 2002:a9fe::/32 dev lo  metric 1024  error -101
unreachable 2002:ac10::/28 dev lo  metric 1024  error -101
unreachable 2002:c0a8::/32 dev lo  metric 1024  error -101
unreachable 2002:e000::/19 dev lo  metric 1024  error -101
2607:f740:0:3f::/64 dev eth0  proto kernel  metric 256
2607:f740:44:22::/64 dev tun0  proto kernel  metric 256
unreachable 3ffe:ffff::/32 dev lo  metric 1024  error -101
fe80::/64 dev eth0  proto kernel  metric 256
fe80::/64 dev tun0  proto kernel  metric 256
default via 2607:f740:0:3f::1 dev eth0  metric 1

However ipv6 packets which arrive at the tun0 interface are not routed to the eth0 interface. Thanks for any help, suggestions.
Comment: Do you have routes that would make sense here?  What is your route table look like?  `ip -6 route show`
Comment: It's not really a duplicate, no mention of OpenVPN and this is a very specific question, the other very general.
Comment: added route show to main question
Comment: It's exactly the same issue; you should have updated your existing question rather than start a new one.
Comment: If you successively get it shut down i'll have to. But as I said this is a narrow question, I would have to delete all the configs and logs from the other question which would make it not make sense to those who already replied.
Comment: This is exactly the detail that you should have provided originally. So go right ahead.
Comment: @user66779, If this is the same issue, you could also close other question, and just make it go away.
Comment: I'll close the other, one of the comments in that question solved a major problem, which just leaves the one in this question, lol.
Comment: Old question closed.
Answer: This is a simple question of routing.  Your routing table, doesn't have any routes to direct traffic over the tun0 interface, so nothing gets forwarded that way.
I gather you are using OpenVPN.  As far as I know right now, the IPv6 support for OpenVPN doesn't include an IPv6 equivalent of the redirect-gateway option.  You probably need to add your own routes with route-ipv6 statements pushed from the server.
Comment: adding this fixed it: push "route-ipv6 2607:f740:44:22::/64"
push "route-ipv6 2000::/3" but i have no idea why. What does 2000::/3 mean?
Comment: Well for starters, the '::' means this is a sequence of zeros. /3 means netmask for the route. 2000 is a routing prefix. See simipledns.com/private-ipv6.aspx for your own ipv6 routing prefix.
Comment: According to the manual, --route-ipv6 ipv6addr/bits [gateway] [metric], so i'm guessing route-ipv6 2607:f740:44:22::/64 eth0 1
Comment: @user66779, no, that is not how you route.  Check your route table, a route for `2607:f740:44:22::/64` already exists.   What you probably need is a **default route**, or something like what the `def1` option to the ipv4 redirect gateway does for you, by sending a few routes.
Comment: Like this?: ip -6 route add / via  dev ]
Comment: Also found: route -A inet6 add / gw  [dev ]
Comment: both of those are commands that add routes, but you are missing the point, the `route-ipv6` openvpn option to set a route is perfectly fine, what you need to figure out is **the correct route(s)** to add.

Forwarding IPv6 traffic


To Add a record with expected values: Pymongo-Json

Question: Trying to insert: {'db001.v064.net': 0.07} in mongodb using pymongo in python 2.7
I'm getting an error:

'Invalid Document: key 'abc.def' must not contain '.'
Comment: @pikkupr user3100115 linked to the description which explicitly says that you cannot use the dollar sign or a period. So the only option left is replace the period with a dummy character (MongoDB suggests the use of unicode codepoint ff0e) when writing and replacing the dummy with the period when reading. There are no other options.
Comment: What is not understandable that abc.def contains a forbidden period ?! The error message *shows exactly the source of the error*.
Comment: Key of records contain periods.. So how to insert such values to MongoDB?
Comment: @pikkupr Can you show sample documents. so I can edit my answer?
Comment: @user3100115 One such record: {'db001.v064.net': 0.07}
Comment: Can you show us how your document should look like in your collection?
is `{'db001': {'v064': { 'net': 0.07}}}` what you want?
Comment: No, exactly like this - {'db001.v064.net': 0.07}
Answer: This is because there are  restrictions on field names in MongoDB
collection.insert({'abc': {'def':'some value'}})


Matching case classes in scala: ~(a,b) match{case a~b=>...}

Question: I have a case class
case class ~[a,b](_1:a, _2:b)

When I want to do pattetn matching
new ~("a", 25) match{
  case "a" ~ 25 =>
}

I can use it this way because "a" ~ 25 and ~("a", 25) are equivalent. But if I want to match new ~("a", new ~("b", 25)) by {case "a" ~ "b" ~ 25 => } troubles begin. I understand that this statements aren't equivalent. So, how  new ~("a", new ~("b", 25)) can be presented? By what rules?
Answer: This works:
new ~("a", new ~("b", 25)) match {
  case "a" ~ ("b" ~ 25) =>
}

So, you'll have to put the parentheses the same way they are in the initial clause. Otherwise the tilde is left-associative, therefore the type of the pattern will be different and it won't compile.
case "a" ~ "b" ~ 25

is the same as
case ("a" ~ "b") ~ 25

which would be wrong in your case.
Appendix
You can get right-associativity by having a colon as the last character in your class/method name. The following compiles and matches without parentheses (and you can drop the new as the compiler won't be confused anymore by $tilde$colon):
case class ~:[a,b](_1:a, _2:b)

~:("a", ~:("b", 25)) match {
  case "a" ~: "b" ~: 25 =>
}

Responses
1) Without the new keyword, the case class ~ is shadowed by unary_~ which gives the bitwise negation of the argument. An expression like ~ 2 is internally evaluated to unary_~(2) and the same goes for the case of ~ ("a", 1) – however unless you define unary_~ on that tuple, this will give an error. With the new keyword you advise the compiler to explicitly look for a class with that name, so it won't get confused.
(Technically, you could work around this by using $tilde("a", 1) which is the internal name for your case class ~, but since this is a compiler detail, you should probably not rely on it.)
2&3) The right-associativity is referenced in the Scala Language Specification. Section 'Infix Operations'

The associativity of an operator is determined by the operator's last character. Operators ending in a colon ':' are right-associative. All other operators are left-associative.

By the way, right-associativity is the trick that allows for creating lists with Nil. (Nil is the empty List and has the right-associative concatenation operator :: defined.)
val l: List[Int] = 1 :: 2 :: 3 :: Nil

which is evaluated as follows
val l: List[Int] = (1 :: (2 :: (3 :: Nil)))

or, more precisely, since 3 :: Nil ≡ Nil.::(3), as
val l: List[Int] = ( ( Nil.::(3) ).::(2) ).::(1)

Comment: I don't understand

1)Why compiler is confused when class name is '~' and I don't put 'new' keyword?
2)>>You can get right-associativity by having a colon as the last character in your class/method name.
That's creepy :3 Where can I read about this unobvious behavior?
Comment: You can already avoid new by using ~ like an infix operator, as done in the Scala parser combinator libraries. That is, `a ~ b` should work fine (not retested though).