How many numbers between $100$ and $900$ have sum of their digits equal to $15$?

Question:
How many numbers between $100$ and $900$ have sum of their digits
  equal to $15$?

I was wondering if we could derive any direct combinatoric formula to solve problem like this,my strategy is  kind of trying all permutation for $100$ to $200$ then $200$ to $300$ then ...,and finally summing them up to get $62$ (if I there is not mistake)though this may not be very difficult to solve using this approach (as we are dealing with $3$ digits numbers with individual digits not greater than $9$)but is this also the fastest/efficient one?
Comment: @Thijs Laarhoven:Yes you are right,but I am not getting,how could we solve that equations with that constraints?
Comment: There was a mistake in the original formulation. You should be solving $x_1 + x_2 + x_3 = 15$ with $0 \leq x_i \leq 9$, $x_1 \neq 0$ but also $x_1 \neq 9$ (as solutions above $900$ are not allowed).
Comment: (I apologize if I am the reason everyone made this oversight of not allowing $x_1 = 9$. My bad!)
Comment: My fastest solution would be to open a spreadsheet, make column A with the numbers 100 to 900, columns B-D with the various digits (tens by mod(int(a*/10),10), add them up, and if(E*=15,1,0) in column F, add column F.
Answer: This problem can be reduced to solving
$$x_1 + x_2 + x_3 = 15, \quad 0 \leq x_i \leq 9, \quad x_1 \neq 0, \quad x_1 \neq 9$$
First, we solve
$$x_1 + x_2 + x_3 = 15, \quad 0 \leq x_i \leq 15$$
This is a standard stars and bars problem, with solution $\binom{15+3-1}{15} = 136$. Now which solutions are wrong? Well, first of all those with one of them above $10$. But if, say, $x_1 \geq 10$, then we can write $x_1' = x_1 - 10$ and $x_2' = x_2, x_3' = x_3$ to reduce the problem to
$$x_1' + x_2' + x_3' = 5, \quad 0 \leq x_i' \leq 5$$
This is again a standard stars and bars problem, with solution $\binom{5+3-1}{5} = 21$. Since exactly one of $x_1,x_2,x_3$ could be above $10$, this gives $3 \cdot 21 = 63$ wrong solutions in total. So there are $136 - 63 = 73$ solutions to
$$x_1 + x_2 + x_3 = 15, \quad 0 \leq x_i \leq 9$$
Finally, we need to subtract $4$ solutions with $x_1 = 0$ (i.e. $(x_2,x_3) \in {(6,9),(7,8),(8,7),(9,6)}$), but also subtract $7$ solutions for $x_1 = 9$ (i.e. $(x_2,x_3) \in {(0,6),\ldots,(6,0)}$). This gives $62$ solutions in total.
Comment: @Fool: Very true. The numbers $4$ and $7$ come from solving $$x_2 + x_3 = 15, \quad 0 \leq x_i \leq 9$$ and $$x_2 + x_3 = 6, \quad 0 \leq x_i \leq 6$$ respectively, so we're actually solving two more stars and bars problems here. (Three actually, as for the first you have to do a split again of $0 \leq x_i \leq 15$ and subtracting the wrong solutions. For the first you get $\binom{15+2-1}{15} - 2 \cdot \binom{5+2-1}{5} = 4$ and for the second you get $\binom{6+2-1}{6} = 7$.)
Comment: +1,This is a beautiful explanation!,even for the last two counting we could use the same approach as explained in before paragraphs,It seems I understood it completely now.Thanks a lot :)
Answer: This is almost a standard stars-and-bars (or marbles and boxes) problem. You have $15$ marbles, and you want to distribute them amongst $3$ boxes (the digits) in such a way that the first box gets at least one marble and at most $8$ marbles and each of the other two boxes gets at most $9$ marbles. ($900$ is the only allowable $3$-digit number beginning with $9$, and its digits don't sum to $15$, so it can be ignored.) Equivalently, you're looking for non-negative integer solutions to $x_1+x_2+x_3=15$ subject to the constraints $1\le x_1 \le 8, x_2,x_3 \le 9$.
After putting one marble in the first box, you've $14$ left to distribute. Ignoring the upper bounds, this can be done in $\dbinom{14+3-1}{3-1}=\dbinom{16}{2}=120$ ways. The ways that have at least $9$ marbles in the first box are bad, so they have to be subtracted off. After putting $9$ marbles in the first box, you've $6$ left to distribute; this can be done in $\dbinom{6+3-1}{3-1}=\dbinom{8}{2}=28$ ways. Similarly, there are $\dbinom{4+3-1}{3-1}=\dbinom{6}{2}=15$ distributions that have too many marbles in the second box (because after putting one in the first box and $10$ in the second box you've only $4$ left to distribute) and $15$ that have too many in the third box. It's not possible to have too many marbles in two boxes: that would require at least $19$ marbles. Thus, the final count is $120-28-2(15)=62$ numbers between $100$ and $900$ whose digits sum to $15$.
Comment: But brute-force says the answer is $62$?!
Comment: @FoolForMath: You're right: in the last step I carelessly forgot that I still had to put one marble in the first box. I've corrected it now.
Answer: HINT:
$x_1 + x_2 + x_3 = 15, \; x_1 \geq 1, \; x_1, x_2, x_3 < 10$ is very relevant here.
Comment: I can see this before,but what I am not getting how to solve this equations with those constraints?
Comment: What constraint prevents you from being able to solve it?
Comment: $x_1 \geq 1, \; x_1, x_2, x_3 \leq 10$
Comment: There are many solutions... start cranking some out!
Comment: @Fool: those are $all$ the constraints. Are you saying you can't handle either the lower or the upper bounds separately?
Comment: After reading the problem in the first time itself I could see that equation however I only know how to solve it for $x_i \in [0,\infty)$ or for $x_i \in [1,\infty)$ but I never did anything like that with specified upper bound and an individual lower bound,hence I used the other approach.
Comment: You also need $x_1 \leq 8$ which I carelessly overlooked as well.
Comment: Yes, this is true too. I'll omit it in the nature of the hint.
Answer: There is a high mass:volume ratio, so here we go ...
I'll just get you started counting, since other answers are being posted.
$15 = 9 + 6 + 0$. How many permutations of this are between $100$ and $900$?

$15 = 9 + 5 + 1$. How many ...?
$15 = 9 + 4 + 2$...
...

$15 = 8 + 7 + 0$...
$15 = 7 + 7 + 1$...
Comment: I prefer (and +1 to) Brian's answer; this is more for *support* and/or *getting started*.
Answer: I wrote a simple brute force test for this:
<code>[Test]
public void GivenNumbersBetween100And900_WhenCalculatingItsNumbers_ThenPrintThoseWhoEqual15()
{
    var counter = 0;
    for (var hundredth = 1; hundredth <= 9; hundredth++)
    {
        for (var tenth = 0; tenth <= 9; tenth++)
        {
            for (var singles = 0; singles <= 9; singles++)
            {
                if (hundredth + tenth + singles == 15 && 100*hundredth + 10*tenth + singles <= 900)
                {
                    counter++;
                    Console.WriteLine("{0:D3}: {1}{2}{3}", counter, hundredth, tenth, singles);
                }
            }
        }
    }
    Assert.That(counter, Is.EqualTo(62));
}
</code>
And the result is:
<code>001: 159
002: 168
003: 177
004: 186
005: 195
006: 249
007: 258
008: 267
009: 276
010: 285
011: 294
012: 339
013: 348
014: 357
015: 366
016: 375
017: 384
018: 393
019: 429
020: 438
021: 447
022: 456
023: 465
024: 474
025: 483
026: 492
027: 519
028: 528
029: 537
030: 546
031: 555
032: 564
033: 573
034: 582
035: 591
036: 609
037: 618
038: 627
039: 636
040: 645
041: 654
042: 663
043: 672
044: 681
045: 690
046: 708
047: 717
048: 726
049: 735
050: 744
051: 753
052: 762
053: 771
054: 780
055: 807
056: 816
057: 825
058: 834
059: 843
060: 852
061: 861
062: 870
</code>
Comment: which language did you code this in? Would love to use this code to check my answer to a similar problem
Comment: @Lil it was written in C#.
Comment: is this code ready to copy and paste in a c# compiler? It's not working for me.
Comment: @lil It was written as a unit test, so it has a dependency to nUnit. Try to remove [Test]-attribute, and the Assert-line, then it should only depend on the .net framework. Good luck.


What is the purpose of the "Links" field in the "Manage Display" UI?

Question: In admin/structure/types/manage/my_content_type/display, you can hide/show the fields to display.
There is a Links field that you can also hide/show.
What is the purpose of this field? Nothing is changing in my output when I hide it.
Answer: The Links section is used normally in Teaser section/display to display links like add comment, read more, etc.
On Node Full Display, it is depending on configurations we do. Such as "Add new comment" link will only be visible when we disable "Show reply form on the same page as comments" check-box in comment field settings. You can also give a try to Flag Module or other contributed modules which adds links on Node display.
Please check screenshot below (Teaser Display):

The above screenshot is of default Teaser Display of node type article, which is being displayed on site home page. When we hide Links from teaser display, these links are no more visible in node teaser.
Following screenshot shows links working in Node Full Display:
Depending on configuration we do in comment field (check screenshot below), comment link will be visible on Full Display.

Comment link visible, when checkbox is disabled.

Comment link is not visible, when checkbox is enabled.
Comment: ok, but I have a view mode like a teaser. I called it "grid". I was expecting to see the "read more" link in it... I feel I am asking too much. Many thanks for your help!!!
Comment: Many thanks, you are completely right, but I think there is a bug, because it is working for the teaser but not for any other view mode (I just test it)
Comment: No its not a bug, it is depending on your site configuration, I've updated my ans with how it works in Node Full Display mode.
Comment: Many Thanks Yogesh, this is much more clear! But there is still a problem not related to the comment system: why the "read more" link only appears on the Teaser view mode?
Comment: Because Read more link take user to full node view from teaser, and from full node display it can't go to other view.


How do I Clear the Windows Mail Autodiscover Cache?

Question: I am debugging a custom Autodiscover implementation that works fine with MS Outlook and also passes the MS Remote Connectivity Analyzer.
However, I am having trouble with Windows Mail. I attempted to setup an account at a domain that didn't have the correct DNS records yet, and while the web server logs initially showed some remote requests from Microsoft servers to learn the Autodiscover settings, it apparently has decided to remember the protocol failure and never try again. This was days ago, and even now when I try to setup the account again I have found absolutely no Autodiscover activity in the logs. In contrast, MS Outlook and the Outlook iOS/Android app request the settings (also originating from a MS server, not the device) every time an account is being setup.
How can I get Windows Mail (or Microsoft's provisioning service?) to retry Autodiscover like other clients do?
Answer: Toclear the Logs is just like this:
In the from folder %localappdata%\Microsoft\Outlook\ you will find files "numbers_ Autodiscover.xml"
Delete all those files and restart Outlook
Source: https://gothamweb.com/esupport/index.php?/Knowledgebase/Article/View/254/0/clearing-autodiscover-cache-in-outlook
Comment: Thanks, but I already looked there. Windows Mail is not making any entries in the Outlook folder.
Comment: admins might set it here: ```HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\AutoDiscover
source: https://www.howto-outlook.com/howto/autodiscoverconfiguration.htm


Have historians responded to Raju's critique?

Question: C. K. Raju has made some outrageous criticisms of the traditional take on Euclid in particular and Western history in general. Yet he has a book published on the subject with an apparently respectable publisher in India. Have modern historians of the classical period responded to his critique?
Note. One of the responders mentioned a helpful review by Ferreiros here.
Comment: Have these views been published in refereed history of science journals?
Comment: Aren't they all dead now?
Comment: Maybe you can see: José Ferreirós' review of C.K. RAJU, *Cultural Foundations of Mathematics: The Nature of Mathematical Proof and the Transmission of the Calculus from India to Europe in the 16th c. CE*, in [Philosophia Mathematica Volume 17, Issue 3](https://philmat.oxfordjournals.org/content/17/3/378.extract).
Comment: I deeply regret spending half an hour reading Mr Raju's articles. I can only imagine how an historian would feel.
Comment: @MauroALLEGRANZA, I think you should be able to format your *comments* and expand them as an *answer*.
Comment: That link is just a febrile rant, worthy of the worst kind of Social Justice warrior. How can anybody take it seriously?
Comment: This attitude is quite common in India (especially people who have not done serious study of science and mathematics have this view). And most such works or expositions on the superiority of Indians over Europeans in terms of mathematical achievements do not mention anything about Ramanujan. The absence of Ramanujan is a sure shot way to know that author is biased and his purpose is not presenting the truth. I have also seen similar theme in books from Mir Publishers (about Russians).
Comment: Speaking as someone of Indian ethnicity, many Indians have this delusion that all of the great discoveries of mathematics and science happened in India. There is naturally an anti-European, anti-Western flavour to these sentiments. This is natural, of course; it's historical revisionism motivated by nationalism, which happens in many cultures. But this peculiar obsession with mathematics is unique to Indians.
Comment: Not to downplay Indian discoveries in math, of course, but they pale in comparison to what Europe, Russia, perhaps even China, have accomplished
Comment: I am referring to the modern historians who are studying the classical history.
Comment: He has a book published in India. I hasten to add that I do not endorse his views (-4 ??). See http://mathoverflow.net/questions/243126 for a bit more information.
Comment: @Mauro, would you care to format this as an *answer*? Also you could give some snippets from the review in *Philosophia Mathematica*.
Comment: Well, unlike Raju it must be checked *in favor* of facts :-)
Comment: @Hoot, Ferreiros wrote a reasonably balanced review that I wasn't aware of when I posted this question. See link provided by Mauro above.
Comment: I suppose Raju & Co. feel that Ramanujan was a collaborator :-) Still, what puzzles me is not the individual position of C. K. Raju himself but rather the fact that his book is published (and therefore endorsed) by what seems to be a national publisher. @ParamanandSingh
Comment: @MikhailKatz: I really don't know how publishing business works here but perhaps there is lot of influence needed to get things done.
Comment: @ParamanandSingh CK Raju has a PHD from ISI Delhi i think, so perhaps he knows something. Science and all are controlled by those who have power & money. There ample evidences where data have been manipulated by scientists to suit their agenda. Medical science is the best example. There were times when doctors were advertising cigarettes during 1960s. Look up.  Each person has his/her own agenda. I basically take a neutral stand and don't trust anything.
Comment: @ParamanandSingh To know more about agenda in institutions like TIFR/ISI which are just puppets in the hands of the west kindly read this article:  http://ckraju.net/papers/Kosambi-the-mathematician.pdf This is about a mathematician DD Kosambi. And if it's hard to digest what Raju has to say, read Goro Shimura's biography the **Map of my life**. He has a enlisted a of controversies there also.
Comment: @MikhailKatz : Prof. Raju has written about this reviewer in detail. Please see : http://ckraju.net/blog/?p=158
Comment: @ParamanandSingh : Those who have studied Math history without any bias would definitely feel proud. It is unfair to say that Indians who have no knowledge of math and science do this without any knowledge. David Mumford has heaped praises on achievements of Indian mathematics and has even went on to say "greek mathematics shouldn't be only seen as mathematics". Please read his review of the book **MATHEMATICS IN INDIA** by Kim Plofker here: https://www.ams.org/notices/201003/rtx100300385p.pdf
Comment: I don't get the point of your comments on this old thread @C.S. Maybe you can discuss the topic on hsm.stackexchange.com
Comment: @ParamanandSingh Bhai, thanks for responding. Not interested to discuss. Quite boring to keep writing and discussing. However, i felt responding to your earlier comment thats all.
Answer: We can see:

José Ferreirós' review of C.K. Raju, Cultural Foundations of Mathematics: The Nature of Mathematical Proof and the Transmission of the Calculus from India to Europe in the 16th c. CE, in Philosophia Mathematica Volume 17, Issue 3:

In his interest to revise traditional historiography and oppose proofcentred mathematics, Raju devotes a lot of effort to questioning the existence
  of Euclid and insisting that the text of the Elements originates at the
  earliest in 370 CE (with Theon) or perhaps even in the tenth century. In
  my opinion, this is useless and does not help advance the author's main theses. For historical purposes, what is relevant is that Elements represents
  a systematisation of a large portion of geometrical knowledge in the Greekspeaking world before the common era. ('Euclid' is simply the name of
  its otherwise unknown author, whose dates—it is true—are dubious; incidentally,
  an interesting question would be whether philologists find reason
  to think that the text of Elements was written by different authors.) Raju
  insists on the idea that Proclus's views represent the original philosophy
  of mathematics in the Elements (p. 25), and he overemphasizes the connections
  between geometrical proof, Platonism, and Christian religion.

Regarding specifically the possibility that Euclid "the man" was a forgery is totally irrelevant: we know quite nothing about him, but we have "the book": Elements, and its value does not change if it was written by someone else (but in any case by some ancient Greek: we have testimonies...).
If the Elements has been "falsified", this fact does not change of a iota the meaning of its content: the theorems. It is not the same thing as saying that the Holy Bible has not been written by some ancient prophets and in reality is a late Hellenistic forgery.
Regarding in general the approach to history (and history of science as well), my humble opinion is that history is like any other science: conjectures and hypotheses are fundamental, and new insight and a fresh point of view can be useful and necessary, but there is a golden rule: all must be checked with facts.
Comment: Prof. Raju has written about this in detail Please read : http://ckraju.net/blog/?p=158
Answer: The articles by Raju have a conspirational flavor. The history of Indian mathematics is still an uncharted territory. There are more informative unbiased articles, for instance, there are much deeper and less biased studies I've read:
A. Seidenberg, "The Origin of Mathematics," Archive for History of Exact Sciences 18, 301-342 (1978).
S.C.Kak, "Science in Ancient India," in  Ananya:
A Portrait of India, Ed. by S.R.Sridhar and N.K.Matto
(AIA, New York, 1997), pp. 399–420.
Comment: Do you mean to say that what Raju is proposing is a *conspiracy theory*? If so it may be clearer if put that way.
Answer: Euclid is no myth.Applonius of Perga directly refers to him in one of his books on conic sections ( In book 3, an original version of which has survived,in Greek).
I have written an article titled'C.K.Rajus mistake' which is on the net exposing all his false arguments.You can read it.I have introduced a lot of new arguments favouring , an Indian origin to Mathematics, and in the course have introduced some Indian philosophical thoughts,which have influenced greek mathematicians starting from Pythogoras.Independent of whether one agrees to my theory,nevertheless, I have busted Raju's false arguments of Euclid being a myth and many of his arguments against Mathematics(which he calls as formal Mathematics).
My paper was published in the 'Mathematics Teacher', the official publication of the society of Mathematics Teachers of India,located in Chennai,India.
The name of the article is 'Stop the Tirade against Euclid.Why Euclid should be more emphasized in Schools than is currently done'I changed its title to'C.K.Rajus mistake' while posting it on the net,to catch the attention of people who may be following him.
Here is the link to the article.
http://www.vixra.org/abs/1504.0198.
Regards.
Comment: That's interesting. Can you provide a link to your paper?  Is it published?


Quartz.NET scheduler.Interrupt(jobKey) is interrupting all active jobs

Question: Should the method only interrupt the job as defined by the jobKey? I've ran some tests and it seems to interrupt all of the active jobs currently running.
I am using a restful web api to connect to the remote scheduler to create/interrupt/delete jobs.
Api service code:
public void DeleteJob(JobKey jobKey)
{
    var scheduler = _clientQuartzScheduler.GetScheduler();

    var executingJobs = scheduler.GetCurrentlyExecutingJobs();

    if (executingJobs.Any(x => x.JobDetail.Key.Equals(jobKey)))
    {
        scheduler.Interrupt(jobKey);
    }

    scheduler.DeleteJob(jobKey);
}

Quartz remote scheduler app settings are:

<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

<add key="quartz.scheduler.exporter.type" value="Quartz.Simpl.RemotingSchedulerExporter, Quartz" />
<add key="quartz.scheduler.exporter.port" value="555" />
<add key="quartz.scheduler.exporter.bindName" value="QuartzScheduler" />
<add key="quartz.scheduler.exporter.channelType" value="tcp" />
<add key="quartz.scheduler.exporter.channelName" value="httpQuartz" />
<add key="quartz.scheduler.exporter.rejectRemoteRequests" value="false" />

<add key="quartz.jobStore.clustered" value="false" />
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.MySQLDelegate, Quartz" />

<add key="quartz.dataSource.default.provider" value="MySql-65" />
<add key="quartz.dataSource.default.connectionStringName" value="DatabaseConnectionString" />

The api client settings are:
properties["quartz.scheduler.instanceName"] = "RemoteClient";
properties["quartz.scheduler.proxy"] = "true";
properties["quartz.threadPool.threadCount"] = "0";
properties["quartz.scheduler.proxy.address"] = address;

Comment: Hmm, same question, https://groups.google.com/forum/#!topic/quartznet/tmxXvJ19pG8
Answer: To answer such questions it's easier to just look at source code of method in question (if possible). If you look at source code for Interrupt, you will see approximately this:
public virtual bool Interrupt(JobKey jobKey)
{
  var currentlyExecutingJobs = this.CurrentlyExecutingJobs;
  bool interruptedAny = false;
  foreach (var executionContext in currentlyExecutingJobs)
  {
    var jobDetail = executionContext.JobDetail;
    if (jobKey.Equals((object) jobDetail.Key))
    {
      var interruptableJob = executionContext.JobInstance as IInterruptableJob;
        if (interruptableJob != null) {
            interruptableJob.Interrupt();
            interruptedAny = true;
        }
        else {
            // throws here
        }
    }
  }
  return interruptedAny;
}

So it enumerates all current jobs and interrupts any with the matching JobKey (which by the way makes checks in your code unnecessary - you can just do scheduler.Interrupt(jobKey)). So unless all your jobs somehow have matching key - it should not delete them all.
Comment: finally found it, and it was an issue on my end, thanks for the help!
Comment: You can also check what executingJobs.Where(x => x.JobDetail.Key.Equals(jobKey)) returns
Comment: They definitely have different job keys (different name, same group), but they do have same job class and belong to same scheduler
Comment: Well source code should not lie :) If you say they all have different keys, you can just interrupt them explicitly: foreach (var job in executingJobs.Where(x => x.JobDetail.Key.Equals(jobKey)) ((IInterruptableJob)job).Interrupt(). But, this is exactly what Interrupt(jobKey) does. By the way, I use version 2.3.3 of Quartz.
Comment: Hmm, yah that's why I'm so puzzled, I passed the exact job key for one job, yet all jobs were interrupted (with different job keys). I am using same version as well. I'll keep digging. Might have to do with the remote/client based architecture
Comment: @LukeHutton any luck resolving this? Interested myself.
Comment: not yet, I will make sure to you give you an update though! thanks for help.. could be something I've simply overlooked but I've moved onto other api work for now..
Answer: I apologize but I finally found the issue on my end. It turned out to be a misconfiguration with my registration code using a NInjectJobFactory.
Basically, there was only a single job instance running for each job execution so the flag I was setting to stop the job being interrupted was shared amongst all job executions, thereby stopping all the jobs!


Relacionamento de produtos nos models e banco

Question: Vou tentar ser breve na minha dúvida.
Como posso modelar um esquema de classes que me supram em alguns quesitos:
Isso tudo vou fazer no rails 4.1, usando o ActiveRecord como ORM atuando no MySQL.
Vou ter uma entidade Person que terá uma referência (objeto), para meu model de Product, ou seja nenhum ou muitos produtos, o caso é que este será o repositório da empresa, ou seja, todos os clientes terão um cadastro único que quando logado, verifique os produtos disponíveis para esse usuário, o que casa com vários produtos com diferentes propriedades relativas à um produto.
Como por exemplo :
Produto A terá os atributos:

cor
tamanho
peso

Produto B terá os atributos:

tempo_restante
numero_serie

A dúvida é essa como que posso modelar essa abstração de dados?
Já estive pensando, que a cada novo produto que desenvolvermos teríamos que criar uma nova classe e adicionar à esse projeto?
resumindo novamente...
Como criar uma relacionamento de entidades em que cada produto terá os seus próprios atributos? e que um usuário poderá ter vários produtos?
É tudo a mesma dúvida, se não fui claro por favor me peçam que eu edito a questão! muito obrigado desde já!
Comment: O que você quer é uma relação *[many-to-many](http://pt.wikipedia.org/wiki/N_para_M)*? Ou seja: os produtos serão compartilhados entre usuários ou cada produto será pertencente a apenar *um* usuário?
Comment: A segunda opção, um usuário poderá ter vários produtos, só que esses produtos não terão um padrão.
Answer: Acho que uma possível solução seria criar uma tabela de atributos do produto.
Pessoas
-id
-nome

Produtos
-id
-pessoa_id
-nome

Atributos
-id
-produto_id
-nome
-valor

Onde o nome é atributo pode ser, por exemplo, cor e o valor branco.
Comment: Se optar por esta solução, você apenas vai criar três modelos com relações 1-para-muitos (ou 1-N). Leia sobre os tipos de relacionamentos que o Rails suporta aqui: http://guides.rubyonrails.org/association_basics.html
Comment: Valeu por responder, isso tem algum nome em específico ? Como eu disse anteriormente estarei usando rails, junto com o ActiveRecord, gostaria de procurar mais a respeito de como trabalhar com isso lá! :D
Comment: Show de bola, vou testar com certeza! valeuu! :D


Laravel server push

Question: I cannot figure why I cannot implement this in Laravel 5.3
To test I just did pure php and javascript:
The PHP:
<?php

header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
$val = 20;
echo "data: The value is: " . $val . "\n\n";
flush();

And the js:
    var source;
    $(document).ready(function () {
      source = new EventSource("/eventeg.php");
      source.onmessage = function (evnt) {
        document.getElementById("serverevent").innerHTML = evnt.data;
      };
    });

As soon as I change the PHP file the page reflected the push within 'serverevent'.
However simply attempting to convert into Laravel:
PHP:
in routes web.php
Route::any('event', 'Event_c@eventTest');

Then - (to create re-usable code I have a repo as shown by the namespace)
    <?php

namespace App\DD_laravelAp\Controllers;

class RootEvent_c extends RootController_c {

  protected function start($init = null) {

  }

  public function eventTest() {
    header('Content-Type: text/event-stream');
    header('Cache-Control: no-cache');
    $val = 10;
    echo "data: The value is: " . $val . "\n\n";
    flush();
  }

}

And finally the class that Laravel should use:
<?php

namespace App\Http\Controllers;

use App\DD_laravelAp\Controllers\RootEvent_c;

class Event_c extends RootEvent_c {

}

With the js changed to reflect the Laravel url structure:
  source = new EventSource("/event");
  source.onmessage = function (evnt) {
    document.getElementById("serverevent").innerHTML = evnt.data;
  };

The error from the console however is:
Firefox can't establish a connection to the server at http://domain/event

Answer: Upgrade to more recent version of Laravel to solve this issue.

Laravel server push


' List[ Conditional statement ] ' What is this code supposed to do

Question: Please  explain the statement X[y==yi] (after the for loop).
Code:
    :

    for i, yi in enumerate(np.unique(y)):
        Xi = X[y==yi]
        print(Xi)
        plt.scatter(Xi[:,0], Xi[:,1], color=colors[i], marker=markers[i], label=yi)

Answer: the conditional statement will evaluate to True or False.
list[True] works the same as list[1] and list[False] works the same as list[0]
>>> l = [0, 1]
>>> l[False]
0
>>> l[True]
1


SQL select HTML5 datetime-local

Question: Using a datetime-local form field, and inserting its value into a SQL 2014 smalldatetime field. When querying the database to populate the form field for editing, I'm using
SELECT FORMAT(myDate, 'yyyy-MM-ddThh:mm:ss') AS myDate

My form field code is:
<input type="datetime-local" name="myDate"
    id="myDate" required
    value="<cfoutput>#myDate#</cfoutput>">

When populating the above form field with this database value, it returns the correct date and time BUT it always indicates AM. EXAMPLE: the value in the database table is
2016-11-03 13:09:00 but the value in the form shows as 11/03/2016 01:09 AM
How can I change my SQL format to accurately populate the form field? It should be 11/03/2016 01:09 PM?
Thanks
Answer: I would leave the formatting in the front end. However, if you change the hours to uppercase it will give you the time in 24 hour format.
SELECT FORMAT(myDate, 'yyyy-MM-ddTHH:mm:ss') AS myDate

Comment: *I would leave the formatting in the front end* Agreed. Generally it is best to leave dates - as date *objects*. Converting them to strings, for presentation, is the job of the front end app, ie CF.
Comment: Yes, that did the trick, and now my SQL formatting returns AM or PM correctly into the form field. Silly cases!  ;)  Thank you, Sean.

SQL select HTML5 datetime-local


Identifying important interactions between features using machine learning

Question: Let's say I have a set of features: a, b, c, d, e, f. I'm now interested in identifying possible interactions between these features that best predict an outcome. For example, it could be that the features a, f, and the interactions a:b:g, d:f and c:e are the 5 most important factors that predict the outcome. It is not only important for an algorithm to account for feature interactions, but I also want to be able to identify these interactions.
How could I approach this problem with machine learning?
Answer: Seems like you're looking for association rules. One example algorithm for recovering these is Apriori algorithm.
If you want a textbook that covers them, Mining Massive Datasets is one choice (Frequent Itemsets chapter - it contains lots of exercises).


Efficient computation of nth mixed partial derivative of factorized multivariate polynomial

Question: I have a large multivariate polynomial of $n$ variables expressed as a product of terms:
$$P(x_1, x_2, \dots, x_n) = T_1(x_1,\dots,x_n) \times \dots \times T_k(x_1,\dots,x_n)\ .$$
The maximum degree of any $x_i$ in a given term is one, and the number of terms where any $x_i$ appears is at most two. The problem is just the number of variables/terms, which can be very large.
I would like to know if there would exist an efficient (polynomial-time) way to evaluate the following partial derivative at a given point:
$$\frac{\partial^n P}{\partial x_1\dots\partial x_n} \ \text{?}$$
I've tried automatic differentiation with e.g. Torch but it doesn't scale up so well. The coefficients of the polynomial are complex numbers.
This answer asks a similar question for an arbitrary function: Numerical computation of the $n^{\mathrm {th}}$ derivative of a multivariate function but I haven't found anything useful in the only answer.
Answer: I found elements of answer in the following papers:
Multivariate Polynomial Integration and Derivative Are Polynomial
Time Inapproximable Unless P=NP∗, Bin Fu
Approximating Multilinear Monomial Coefficients
and Maximum Multilinear Monomials in
Multivariate Polynomials, Zhixiang Chen, Bin Fu
On testing monomials in multivariate polynomials, Zhixiang Chen, Bin Fu, Yang Liu, Robert Schweller
This problem doesn't seem to have a polynomial-time solution.


How to create a 95% confidence interval?

Question: From December 12 – 14th of 2008, Gallup in conjunction with USA Today, surveyed 1,008 U.S. adults using random digit – dialing about their Christmas practices. 937 of them stated that they celebrate Christmas. You will create a 95% confidence interval for the proportion of all U.S. adults that celebrate Christmas.
I don't know the sample mean, or the standard deviation so I can't create the confidence interval, Can someone please tell me how I can find those? Or how can I calculate the confidence interval ?
Comment: Asked and answered (in abstract terms) at https://stats.stackexchange.com/questions/4756/confidence-interval-for-bernoulli-sampling/6184#6184.
Answer: You are constructing a confidence interval on a proportion. Your sample proportion is $\hat p = \frac{937}{1008} \approx .93$.
The confidence interval for a proportion is: $\hat p \pm z \sqrt{\frac{\hat p(1 - \hat p)}{n}}$
$n = 1008$ and for a 95% confidence interval $z = 1.96$
So $\text{CI}_{95} \approx [.922, .938]$
Comment: Yes. If the range is smaller we are less confident that the range will contain the mean proportion.
Comment: How would you find the sample mean? I got 75 for the sample mean so my CI95 = [.748, .752]
Comment: Also how would you find the margin of error
Comment: The sample mean proportion is $.93$ and the confidence interval _is_ a margin of error.
Comment: So let's say I changed the confidence interval to 90%, that would decrease the margin of error because the confidence interval would be 1.645
Answer: There are various styles of confidence intervals (CIs). The 95% Wald CI discussed in @Jeff's Answer (+1) sometimes have 95% coverage of the true population proportion for large $n.$ But for small $n$ the estimated standard error $\sqrt{\frac{\hat p(1-\hat p)}{n}}$ may not be sufficiently close to the true standard error
$\sqrt{\frac{p(1-p)}{n}}$ to give good results. [Also for observed
proportions near $0$ or $1,$ endpoints of Wald intervals may extend outside
of the interval $(0,1)$ or the intervals may be of length $0.]$
You can read Wikipedia on binomial confidence intervals to see a discussion of various styles of CIs,
some of which give good results for small $n.$
The Jeffreys interval estimate is based on a Bayesian argument starting with a non-information Jeffreys prior $\mathsf{Beta}(.5. .5).$ It also has good
frequentist properties, covering the true proportion $p$ with nearly the 'promised' long-run frequency--for small and large sample sizes $n.$
For your situation with an observed proportion of 937 out of 1008, a 95% Jeffreys CI consists of quantiles 0.025 and 0.975 of
$\mathsf{Beta}(.5+937, .5+1008-937)$ $\equiv
\mathsf{Beta}(937.5, 71.5),$ which is easily computed in R as $(0.913,0.944).$
<code>qbeta(c(.025,.975), 937.5, 71.5)
[1] 0.9125267 0.9441387
</code>
Perhaps no style of confidence interval may be ideal for all purposes,
but it is worthwhile knowing the advantages and disadvantages of
several styles CIs.
Ref: For graphs of coverage probabilities of Jeffreys CIs.


Somando valor com Mysql

Question: Como faço para somar os valores dos tres selects abaixo:
(
SELECT
    (valor1 + valor2 + valor3) AS total SELECT
        SUM(valor) AS valor1
    FROM
        pagamentos
    WHERE
        pagamentos.cliente = '1'
    AND contratosid = '9289'
    AND excluir != '1'
    UNION ALL
        SELECT
            SUM(valor) AS valor2
        FROM
            pagcielo
        WHERE
            pagcielo.confirmado = '1'
        AND contratosid = '9289'
        AND excluir != '1'
        UNION ALL
            SELECT
                SUM(valor) AS valor3
            FROM
                pagboleto
            WHERE
                pagboleto. STATUS = '1'
            AND contratosid = '9289'
            AND excluir != '1'
)

Answer: Há um erro na estrutura da sua query.
Em primeiro lugar, opte por deixar as queries conectadas por UNION com a mesma nomenclatura de campos (não é obrigatório, mas facilita):
SELECT
  SUM(valor) AS valor
FROM
  pagamentos
WHERE
  pagamentos.cliente = '1'
  AND contratosid = '9289'
  AND excluir != '1'

UNION ALL

SELECT
  SUM(valor) AS valor
FROM
  pagcielo
WHERE
  pagcielo.confirmado = '1'
  AND contratosid = '9289'
  AND excluir != '1'

UNION ALL

SELECT
  SUM(valor) AS valor
FROM
  pagboleto
WHERE
  pagboleto. STATUS = '1'
  AND contratosid = '9289'
  AND excluir != '1'

Posteriormente trate as queries anteriores como subselect, somando os três campos. A query final ficaria assim:
SELECT
  SUM(VALOR) AS TOTAL
FROM (
  SELECT
    SUM(valor) AS valor
  FROM
    pagamentos
  WHERE
    pagamentos.cliente = '1'
    AND contratosid = '9289'
    AND excluir != '1'

  UNION ALL

  SELECT
    SUM(valor) AS valor
  FROM
    pagcielo
  WHERE
    pagcielo.confirmado = '1'
    AND contratosid = '9289'
    AND excluir != '1'

  UNION ALL

  SELECT
    SUM(valor) AS valor
  FROM
    pagboleto
  WHERE
    pagboleto. STATUS = '1'
    AND contratosid = '9289'
    AND excluir != '1'
) T

Answer: Dessa forma você consegue somar todos os SELECT juntos
select id, sum(valor) from (
    select id,valor from tabela_1 union all
    select id,valor from tabela_2 union all
    select id,valor from tabela_3
) x group by id

Somando valor com Mysql


I got confused, so how should I call the function to get the outputs

Question:
I'm kinda new to C++ and programming in general. this is for practicing thing that I learn so far.

Create a structure called Exam that includes exam ID (string), name of
the subject (string), registration fee (double) and the number of
students registered during a week (7 days) (int array).
• Write a function called getExamDetails() which is the data type of
Exam that reads the details of the Exam and store them in the variable
of the Exam structure.
Hint: Use the given function prototype as
Exam getExamDetails (Exam e);
• Write a function called calExamFee()
which takes three parameters, registration fee for  the exam, the
number of students registered during a week (7 days) array and the
size of the array. Find the total exam registration fee during the
week and print the total exam  registration to the screen.
• Call the getExamDetails() and calExamFee() in the main function to
print the following

#include <iostream>
#include <string>
using namespace std;

struct Exam
{
    string examID,subject;
    double regFee;
    int numStudent[];
};

Exam getExamDetails(Exam details);
void calExamFee(double regFree,int numStudent[],int size);

int main()
{

}

Exam getExamDetails(Exam details) //reads the details of the Exam and store them
{
    cout<<"Enter Exam ID : ";
    cin>>details.examID;

    cout<<"Enter Subject : ";
    cin>>details.subject;

    cout<<"Enter registration Fee : ";
    cin>>details.regFee;

    for (int i = 0; i <=7; i++) //store number of students registered during a week (7 days)
    {
        cout<<"Enter number of student "<<i+1<<" : "<<endl;
        cin>>details.numStudent[i];
    }
    return details;
}

void calExamFee(double regFree,int numStudent[],int size)
{
    float totalExamFee=0;

    for (int i = 0; i < size; i++)
    {
        totalExamFee+=numStudent[i];
    }

    totalExamFee=totalExamFee*regFree;
    cout<<"Total registration fee during the week:"<<totalExamFee<<endl;
}

Comment: In `Exam getExamDetails(Exam details)` why do you have the details parameter? The signature probably should be `Exam getExamDetails()` and `details` should be a variable local to this function.
Answer: Fixing your code

1. Unbounded Array
Your struct member numStudent does not have its size specified when the struct is defined which in invalid in C++ unlike languages like Java or C#.
You said numStudent holds the data for one week, so you can specify a size of 7:
struct Exam
{
    string examID,subject;
    double regFee;
    int numStudent[7];
};

2. Smaller datatype in calExamFee()
You are accepting the regFee as a parameter of type double. However, you have declared totalExamFee as float which is a smaller/narrower datatype:
float totalExamFee = 0;

Since you are performing this operation:
totalExamFee = totalExamFee*regFree

In which you are multiplying a float with a double, you risk an overflow. Either change the type of totalExamFee to be a double or change the type of regFee to be a float.
3. Illegal array access
One of your for loops read for(i = 0; i <= 7; i++). Since the array is of size 7, the maximum valid index is 6. So change it to i < 7.
4. Your main() function
Your getExamDetails() takes in an exam, performs modification on its copy passed as the parameter and then in turn returns another copy of this copy to the caller(main). That's a lot of unnecessary copying. One copy happens when you pass it as the parameter and another copy when you return it to main. I've kept it as it is since that is the prototype specified in the question and now we're first focusing on fixing your code.
int main()
{
    // Declare the variable
    Exam exam;
    // Call the input function
    exam = getExamDetails(exam);
    // Calculate the exam fee
    calExamFee(exam.regFee, exam.numStudent, 7);
}

This will give you the expected results, but we can make the solution better and optimize it a bit.
A better solution

1. Passing by reference
The purpose of getExamDetails is to populate the fields examID, subject, regFee and the elements of numStudent and that is its only purpose. We don't need the expensive copying while accepting it as a parameter and then again while returning it. We can prevent the copying by accepting a reference to the same exam variable in main to getExamDetails rather than copying it. This is called passing be reference and this is how we can achieve it:
void getExamDetails1(Exam& exam)
{
    cout<<"Enter Exam ID : ";
    cin>>exam.examID;

    cout<<"Enter Subject : ";
    cin>>exam.subject;

    cout<<"Enter registration Fee : ";
    cin>>exam.regFee;

    for (int i = 0; i < 7; i++) //store number of students registered during a week (7 days)
    {
        cout<<"Enter number of student "<<i+1<<" : "<<endl;
        cin>>exam.numStudent[i];
    }
}

In main:
Exam exam;
getExamDetails(exam);

Notice the & after Exam. This tells the function to not copy the variable from main while accepting it. Send me a reference to the same variable as in main. Since it accepts a reference rather than a copy, any change in details will also reflect in main's exam variable. See how the return type is now void instead of Exam. We don't need to return an exam since all the changes have already reflected in main's exam variable.
2. One function, one thing
As per single responsibility principle, each function must do exactly one job. Your calExamFee does two things. Calculates the exam fee and also prints it. Let it just perform the calculation for you and return the result:
double calExamFee(double regFree,int numStudent[],int size)
{
    double totalExamFee = 0;

    for (int i = 0; i < size; i++)
    {
        totalExamFee += numStudent[i];
    }

    totalExamFee = totalExamFee*regFree;
    return totalExamFee;
}

In main:
double totalFee = calExamFee(exam.regFee, exam.numStudent, 7);
cout << "Total registration fee during the week: " << totalFee << endl;

Or even:
cout << "Total registration fee during the week: " << calExamFee(exam.regFee, exam.numStudent, 7) << endl;

The task of printing the result is now delegated to main.
Also, it appears that the array size is always 7, so you don't need to pass it, just hardcode the value:
double calExamFee(double regFree,int numStudent[])

and use i < 7 in the loop.


FIRST OCCURRENCE: Common Language Runtime escalation on critical resource

Question: Recently we have this issue in active node which is part of failover cluster instance. The active node shutdown automatically and transfer all roles to the passive node. Upon checking the sql error log.
<code>Error:
AppDomain 3 (XXX_XX.dbo[runtime].2) is marked for unload due to memory pressure.
AppDomain 2 (XXX.dbo[runtime].1) is marked for unload due to memory pressure.
AppDomain 3 (XXX_XX.dbo[runtime].2) unloaded
AppDomain 2 (XXX.dbo[runtime].1) unloaded.
AppDomain 5 (XXX.dbo[runtime].4) created.
</code>
See dump files created for more details:
<code>   Current time is 16:31:17 06/19/17.
=====================================================================
       BugCheck Dump
=====================================================================

This file is generated by Microsoft SQL Server
version 11.0.5058.0
upon detection of fatal unexpected error. Please return this file,
the query or program that produced the bugcheck, the database and
the error log, and any other pertinent information with a Service Request.

Computer type is Intel(R) Xeon(R) CPU E5-4607 v2 @ 2.60GHz.
Bios Version is HP     - 2
48 X64 level 8664, 2 Mhz processor (s).
Windows NT 6.2 Build 9200 CSD .

Memory
MemoryLoad = 99%
Total Physical = 131037 MB
Available Physical = 235 MB
Total Page File = 162458 MB
Available Page File = 23377 MB
Total Virtual = 8388607 MB
Available Virtual = 8115635 MB
**Dump thread - spid = 0, EC = 0x0000001566B37F40
*
* User initiated stack dump.  This is not a server exception dump.
*
***Stack Dump being sent to F:\MSSQL11.OHREP\MSSQL\LOG\SQLDump0010.txt
* *******************************************************************************
*
* BEGIN STACK DUMP:
*   06/19/17 16:31:19 spid 2320
*
* FIRST OCCURRENCE: Common Language Runtime escalation on critical resource.
*
* Input Buffer 78 bytes -
*       ܧ     SELECT dbo.fn_Guid() AS guid
*
*
*  MODULE                          BASE      END       SIZE
* sqlservr                       000007F761250000  000007F7612A9FFF  0005a000
* ntdll                          000007FEA1FE0000  000007FEA219DFFF  001be000
* KERNEL32                       000007FE9F6C0000  000007FE9F7F6FFF  00137000
* KERNELBASE                     000007FE9F060000  000007FE9F153FFF  000f4000
* ADVAPI32                       000007FEA1B40000  000007FEA1C1DFFF  000de000
* MSVCR100                       000000005DD60000  000000005DE31FFF  000d2000
* MSVCP100                       000000005DCC0000  000000005DD57FFF  00098000
* sqlos                          000000005B130000  000000005B136FFF  00007000
* NETAPI32                       000007FE9D4E0000  000007FE9D4F4FFF  00015000
* pdh                            000007FE95DA0000  000007FE95DEBFFF  0004c000
</code>

opends60                       000000005B040000  000000005B047FFF  00008000
sqlmin                         000007FE72000000  000007FE73F4CFFF  01f4d000
sqllang                        000007FE6E2B0000  000007FE70342FFF  02093000
sqlTsEs                        000007FE79FF0000  000007FE7A876FFF  00887000
sqldk                          000007FE76240000  000007FE766C0FFF  00481000
msvcrt                         000007FEA0250000  000007FEA02F4FFF  000a5000
sechost                        000007FE9FDF0000  000007FE9FE37FFF  00048000
RPCRT4                         000007FEA1C20000  000007FEA1D64FFF  00145000
netutils                       000007FE9DA60000  000007FE9DA6DFFF  0000e000
srvcli                         000007FE9E950000  000007FE9E973FFF  00024000
wkscli                         000007FE9DAC0000  000007FE9DAD4FFF  00015000
USER32                         000007FE9F400000  000007FE9F54BFFF  0014c000
ole32                          000007FE9F800000  000007FE9F97DFFF  0017e000
OLEAUT32                       000007FE9FE40000  000007FE9FF02FFF  000c3000
CRYPT32                        000007FE9F1D0000  000007FE9F3A0FFF  001d1000
Secur32                        000007FE99DC0000  000007FE99DCAFFF  0000b000
PSAPI                          000007FE9FDC0000  000007FE9FDC6FFF  00007000
WS2_32                         000007FEA01F0000  000007FEA0247FFF  00058000
USERENV                        000007FE9F1B0000  000007FE9F1CEFFF  0001f000
AUTHZ                          000007FE9E1A0000  000007FE9E1E6FFF  00047000
WINTRUST                       000007FE9EFD0000  000007FE9F024FFF  00055000
WINMM                          000007FE99ED0000  000007FE99EEFFFF  00020000
GDI32                          000007FEA04D0000  000007FEA0610FFF  00141000
combase                        000007FE9FC10000  000007FE9FDBFFFF  001b0000
MSASN1                         000007FE9EEE0000  000007FE9EEF5FFF  00016000
NSI                            000007FE9F550000  000007FE9F558FFF  00009000
profapi                        000007FE9EF00000  000007FE9EF14FFF  00015000
WINMMBASE                      000007FE99E90000  000007FE99EC2FFF  00033000
SSPICLI                        000007FE9EAB0000  000007FE9EADCFFF  0002d000
cfgmgr32                       000007FE9F160000  000007FE9F1AEFFF  0004f000
DEVOBJ                         000007FE9F030000  000007FE9F051FFF  00022000
LOGONCLI                       000007FE9E650000  000007FE9E683FFF  00034000
SAMCLI                         000007FE9EDE0000  000007FE9EDF5FFF  00016000
SOPHOS~2                       00000000591F0000  0000000059228FFF  00039000
CRYPTBASE                      000007FE9EC90000  000007FE9EC99FFF  0000a000
bcryptPrimitives               000007FE9EC30000  000007FE9EC8BFFF  0005c000
instapi110                     000007FE95B40000  000007FE95B4DFFF  0000e000
CLUSAPI                        000007FE999D0000  000007FE99A2EFFF  0005f000
cryptdll                       000007FE9E7F0000  000007FE9E803FFF  00014000
RESUTILS                       000007FE94EE0000  000007FE94F7CFFF  0009d000
cscapi                         000007FE95EA0000  000007FE95EB0FFF  00011000
sqlevn70                       0000000059420000  000000005969AFFF  0027b000
CRYPTSP                        000007FE9E7D0000  000007FE9E7E9FFF  0001a000
rsaenh                         000007FE9E390000  000007FE9E3DAFFF  0004b000
imagehlp                       000007FE9FDD0000  000007FE9FDE3FFF  00014000
ncrypt                         000007FE9E8D0000  000007FE9E8F6FFF  00027000
bcrypt                         000007FE9E900000  000007FE9E924FFF  00025000
NTASN1                         000007FE9E890000  000007FE9E8C4FFF  00035000
gpapi                          000007FE9E0F0000  000007FE9E10EFFF  0001f000
ntmarta                        000007FE9E1F0000  000007FE9E21DFFF  0002e000
VERSION                        000007FE9D0A0000  000007FE9D0A8FFF  00009000
msv1_0                         000007FE9E5F0000  000007FE9E642FFF  00053000
kerberos                       000007FE9E6F0000  000007FE9E7BEFFF  000cf000
schannel                       000007FE9E420000  000007FE9E488FFF  00069000
MSCOREE                        000007FE990D0000  000007FE9913EFFF  0006f000
mscoreei                       000007FE99030000  000007FE990C8FFF  00099000
security                       000007FE98F10000  000007FE98F12FFF  00003000
clbcatq                        000007FE9FF10000  000007FE9FFA5FFF  00096000
sqlncli11                      000000005A5B0000  000000005A902FFF  00353000
COMCTL32                       000007FE97680000  000007FE97723FFF  000a4000
COMDLG32                       000007FEA1910000  000007FEA19B0FFF  000a1000
SHLWAPI                        000007FE9F3B0000  000007FE9F3FFFFF  00050000
SHELL32                        000007FEA0620000  000007FEA1901FFF  012e2000
SHCORE                         000007FE9D1C0000  000007FE9D254FFF  00095000
SQLNCLIR11                     000000005A570000  000000005A5A7FFF  00038000
DPAPI                          000007FE9DB50000  000007FE9DB57FFF  00008000
netbios                        000007FE90300000  000007FE90309FFF  0000a000
clr                            000007FE8CAF0000  000007FE8D45AFFF  0096b000
MSVCR110_CLR0400               000007FE8DDB0000  000007FE8DE81FFF  000d2000
mscorlib.ni                    000007FE89C10000  000007FE8B209FFF  015fa000
SqlAccess                      0000000055E40000  0000000055EACFFF  0006d000
clrjit                         000007FE85D50000  000007FE85E80FFF  00131000
BatchParser                    000000005AB70000  000000005AB9AFFF  0002b000
ftimport                       00000000591A0000  00000000591C4FFF  00025000
MSFTE                          000000005B340000  000000005B6EDFFF  003ae000
dbghelp                        000000005B6F0000  000000005B885FFF  00196000
mswsock                        000007FE9E690000  000007FE9E6EBFFF  0005c000
ntdsapi                        000007FE9D500000  000007FE9D523FFF  00024000
DSPARSE                        000007FE999C0000  000007FE999CAFFF  0000b000
DNSAPI                         000007FE9E490000  000007FE9E52BFFF  0009c000
rasadhlp                       000007FE997D0000  000007FE997D7FFF  00008000
IPHLPAPI                       000007FE9AFA0000  000007FE9AFC9FFF  0002a000
WINNSI                         000007FE9AF90000  000007FE9AF99FFF  0000a000
fwpuclnt                       000007FE9AE20000  000007FE9AE80FFF  00061000
ncryptsslp                     000007FE997B0000  000007FE997C8FFF  00019000
DSROLE                         000007FE9D260000  000007FE9D268FFF  00009000
Sort00060101                   000007FE97BB0000  000007FE97BC2FFF  00013000
Sort00001000                   000007FE914A0000  000007FE91574FFF  000d5000
System.ni                      000007FE88F40000  000007FE89C06FFF  00cc7000
System.Data                    000007FE797F0000  000007FE79B0DFFF  0031e000
System.Transactions            000007FE8BAE0000  000007FE8BB28FFF  00049000
System.Security.ni             000007FE6B8A0000  000007FE6B98CFFF  000ed000
System.Xml.ni                  000007FE83980000  000007FE84341FFF  009c2000
xpsqlbot                       00000029D0C10000  00000029D0C17FFF  00008000
xpstar                         00000029D0C30000  00000029D0C9FFFF  00070000
ATL100                         00000029D0CB0000  00000029D0CDAFFF  0002b000
SQLSCM                         00000029D0CE0000  00000029D0CEEFFF  0000f000
ODBC32                         000007FE95820000  000007FE958DDFFF  000be000
xpstar                         00000029D0F50000  00000029D0F74FFF  00025000
xplog70                        00000029D0F80000  00000029D0F93FFF  00014000
BROWCLI                        000007FE974A0000  000007FE974B1FFF  00012000
xplog70                        00000029D0EC0000  00000029D0EC2FFF  00003000
COMRES                         000007FE80F40000  000007FE8107DFFF  0013e000
XOLEHLP                        000007FE811C0000  000007FE811D4FFF  00015000
MSDTCPRX                       000007FE912F0000  000007FE913B8FFF  000c9000
MTXCLU                         000007FE91580000  000007FE915E4FFF  00065000
ktmw32                         000007FE9D090000  000007FE9D099FFF  0000a000
System                         00000029D4C10000  00000029D4F61FFF  00352000
System.Security                00000029D3910000  00000029D3955FFF  00046000
System.Xml                     00000029D52D0000  00000029D5563FFF  00294000
WLDAP32                        000007FEA1F80000  000007FEA1FDDFFF  0005e000
SAMLIB                         000007FE9A1F0000  000007FE9A20CFFF  0001d000
sqlvdi                         0000000024DD0000  0000000024DF9FFF  0002a000
dbghelp                        00000029CD430000  00000029CD5C5FFF  00196000

P1Home: 00000029E6094960:  0000000000000000  0000000000000007  0000000000C20000  0000000000000070  00000000
0000005E  000007FEA1FE5710

P2Home: 0000000000000042:
P3Home: 0000000000000000:
P4Home: 0000000000000000:
P5Home: 0000000000D202B8:  0107000801060007  0109000A01080009  010B000C010A000B  010D000E000C000D  010F0010
000E000F  0011001201100011
P6Home: 000007FE6E2BCBF8:  004D515E880FC085  53870FC73B489848  40A037840F004D51  C38B30247C8B4800  90C35B5E
38C48348  000007FE6F145F50
ContextFlags: 000000000010004F:  0007FE763FC2C000  0000000000000000  0000000000000000  0000000000000000  000000
0000000000  0000000000000000
MxCsr: 0000000000001FA0:
SegCs: 0000000000000033:
SegDs: 000000000000002B:
SegEs: 000000000000002B:
SegFs: 0000000000000053:
SegGs: 000000000000002B:
SegSs: 000000000000002B:
EFlags: 0000000000000202:
Rax: 0000000000000070:
Rcx: 000000000000005E:
Rdx: 000007FEA1FE5710:  4100000108C48148  9090C35B5E5E415F  9090909090909090  9090909090909090  44894C20
244C8944  5441575655531824
Rbx: 0000000000000000:
Rsp: 00000029E6094F10:  0000000000000000  0000000000000000  0000001566B37F40  00000029E60951A0  00000000
000042AC  0000000000000000
Rbp: 00000029E6097010:  0000000000000004  00000014AC32B1A0  0000000000000000  000007FE8CB4C56E  00000029
E60970F0  0000000000000000
Rsi: 0000001566B37F40:  0000001566B37F40  0000001566B37020  0000000000000000  0000000000000000  00000015
66B37F60  0000001566B37F60
Rdi: 00000029E60951A0:  0000000002F130D0  0000000000000000  0000000000000000  0000000000000000  00000000
00000000  0000000000000000
R8: 00000029E6094AF1:  3635313030303030  0030344637334236  0000000000000000  0000000000000000  00000000
00000000  0000000000000000

R9: 0000000000000002:
R10: 0000000000000000:
R11: 0000005400000100:
R12: 0000000000000001:
R13: 0000000000000001:
R14: 0000000000000000:
R15: 00000000000005BF:
Rip: 000007FE9F0A7B8C:  000000C0248C8B48  FFFB9954E8CC3348  C3000000D8C48148  CCD6EB0038246483  90909090
90909090  8D485508245C8948

Short Stack Dump
000007FE9F0A7B8C Module(KERNELBASE+0000000000047B8C)
000007FE6F43A01E Module(sqllang+000000000118A01E)
000007FE6F43EF13 Module(sqllang+000000000118EF13)
000007FE6EC405F4 Module(sqllang+00000000009905F4)
000007FE6EC701AF Module(sqllang+00000000009C01AF)
000007FE6EC6FDA0 Module(sqllang+00000000009BFDA0)
000007FE8CE8DE05 Module(clr+000000000039DE05)
000007FE8CE8DC72 Module(clr+000000000039DC72)
000007FE8CE8E2DA Module(clr+000000000039E2DA)
000007FE8CE9A78B Module(clr+00000000003AA78B)
000007FE8CD344D1 Module(clr+00000000002444D1)
000007FE8CAF1AFA Module(clr+0000000000001AFA)
000007FE8CB4C4F3 Module(clr+000000000005C4F3)
000007FE8CB4C56E Module(clr+000000000005C56E)
000007FE8CB4F8B7 Module(clr+000000000005F8B7)
000007FE8CB4F892 Module(clr+000000000005F892)
000007FE8CB4FA3C Module(clr+000000000005FA3C)
000007FE8CB4F917 Module(clr+000000000005F917)
000007FE8CB4F109 Module(clr+000000000005F109)
000007FE8CB51681 Module(clr+0000000000061681)
000007FE2DC89FCD Module(UNKNOWN+0000000000000000)
000007FE2DD747B8 Module(UNKNOWN+0000000000000000)
000000290000000A Module(UNKNOWN+0000000000000000)

Here is the eventlog error:
<code>The computer has rebooted from a bugcheck.
The bugcheck was: 0x0000007a (0xfffff8a019eda6c0, 0xffffffffc000026e, 0x000000097e44b8c0, 0xfffff880196d8060).
A dump was saved in: C:\Windows\MEMORY.DMP.
Report Id: 061917-61343-01
</code>
Here is the function code:
<code>CREATE FUNCTION [dbo].[fn_Guid]()
RETURNS [uniqueidentifier] WITH EXECUTE AS CALLER
AS EXTERNAL NAME
[Gcs.Sys.Data.DatabaseAssembly].[UserDefinedFunctions].[NewSequentialId]
</code>
Does anyone encountered this?
Thanks,
Joel
Comment: can you also check eventvwr log and update question
Comment: What is the source code of dbo.fn_Guid() (included in mem dump) ?
Comment: Hi TheGameiswar, Here is the eventlog error: The computer has rebooted from a bugcheck.  The bugcheck was: 0x0000007a (0xfffff8a019eda6c0, 0xffffffffc000026e, 0x000000097e44b8c0, 0xfffff880196d8060). A dump was saved in: C:\Windows\MEMORY.DMP. Report Id: 061917-61343-01.
Comment: Hi Bogdan Sahlean, Here is the function code:
CREATE FUNCTION [dbo].[fn_Guid]()
RETURNS [uniqueidentifier] WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [Gcs.Sys.Data.DatabaseAssembly].[UserDefinedFunctions].[NewSequentialId]
Comment: @Joel please add the source code for [Gcs.Sys.Data.DatabaseAssembly].[UserDefinedFunctions].[NewSequentialId]. Just wondered why you are not using the SQL Server function for returning a new sequential Guid, namely NEWSEQUENTIALID() rather than writing your own.
Answer: It looks like you may have a memory bug in your CLR function <code>[Gcs.Sys.Data.DatabaseAssembly].[UserDefinedFunctions].[NewSequentialId]</code>. I'm not sure why you are using a CLR function to get a new sequential GUID rather than the built in <code>NEWSEQUENTIALID()</code> SQL Server function:
Why not use:
<code>SELECT NEWSEQUENTIALID() AS Guid
</code>


Show that $\lim_{n \to \infty} \sum_{x\in X} a_n(x) = \sum_{x\in X}\lim_{n \to \infty} a_n(x)$

Question:
Let $X$ be a finite set, let $m$ be an integer, and for each $x \in X$ let
  $(a_n(x))_{n=m}^{\infty}$ be a convergent sequence of real numbers. Show that the sequence $(\sum_{x\in X} a_n(x))_{n=m}^{\infty}$ is convergent, and
$$\lim_{n \to \infty} \sum_{x\in X} a_n(x) = \sum_{x\in X}\lim_{n \to \infty} a_n(x)$$
  (Hint: induct on the cardinality of $X$)

Let's denote the cardinality of $X$ by $k = |X|$.
Base case: $k = 0$.
 Hence, $X$ is an empty set. However, since $X$ is empty then there is no $a_n(x)$ for any $x \in X$, which means that this sequence is empty too. The sum over the empty sequence is equal to $0$ by definition. Therefore, $(\sum_{x\in X} a_n(x))_{n=m}^{\infty}$ converges to $0$. Also for the same reason $\lim_{n \to \infty} \sum_{x\in X} a_n(x) = 0$. However, I have a problem with $\sum_{x\in X}\lim_{n \to \infty} a_n(x)$, because it was never definied (at least I didn't find it) in my book (Terence Tao-Analysis 1) the limit of the empty sequence.
Inductive step: Assume the statement holds for $k$, show for $k+1$.
Can be helpful:
Let $f:X \to R$, such that $f(x) = a_n(x)$, and since $X$ is finite then there exists a bijection $g:$ {$1,2,...,k$} $\to X$. Then by definition of the finite sum $\sum_{x\in X} a_n(x) = \sum_{x\in X} f(x)=\sum_{i=1}^{k} f(g(i))$.
If $(a_n(x))_{n=m}^{\infty}$ is convergent then for any positive real $\epsilon > 0$, there exist $N > m$ such that $|a_n - L| < \epsilon$ for all $n > N$.
By the inductive hypothesis, we know that $\sum_{i=1}^{k} f(g(i))$ is also convergent i.e. $|\sum_{i=1}^{k} f(g(i)) - L'|< \epsilon$. We should show that $|\sum_{i=1}^{k+1} f(g(i)) - L'| = |\sum_{i=1}^{k} f(g(i)) + f(g(k+1)) - L'|< \epsilon$. If it is convergent than using the sum of the limits law we would get that
$$\lim_{n \to \infty} \sum_{x\in X} a_n(x) = \lim_{n \to \infty} \sum_{i=1}^{k+1} f(g(i)) = \lim_{n \to \infty}\sum_{i=1}^{k} f(g(i)) + f(g(k+1)) = \sum_{x\in X}\lim_{n \to \infty} f(g(i)) + \lim_{n \to \infty} f(g(k+1))$$
How to finish the base case and how to show the convergence of the sum of the sequence in the inductive step?
Answer: Hint
One can prove that if $(x_n)$ and $(y_n)$ converges to $x$ and $y$ respectively, then $(x_n+y_n)$ converges to $x+y$. The claim follow by induction.
Comment: Yes I know that but struggle to see how it can be helpful to show the convergence of the sum of the sequence. Though, I used it here (assuming that the sum of the sequence is convergent) $\lim_{n \to \infty}\sum_{i=1}^{k} f(g(i)) + f(g(k+1)) = \sum_{x\in X}\lim_{n \to \infty} f(g(i)) + \lim_{n \to \infty} f(g(k+1))$


Question about the Sharepoint 2010 VHD

Question: I want to install the Sharepoint 2010 image here (http://www.microsoft.com/downloads/details.aspx?familyid=0C51819B-3D40-435C-A103-A5481FE0A0D2&displaylang=en), however, and this is a Sharepoint admin question, how can I handle the following:
-Upgrading SQL Server as new versions are released (I am a Technet member so make the most of the available downloads).
-Is the WCF hotfix installed? This is meant to be installed before Sharepoint installation.
-Is there any limitation, for dev purposes, of having all of these apps on one server/VM? I may want to split the AD to another VM in the future. Apart from the Sharepoint config changes, would this cause any other problems?
As I have licenses for Windows Server, I don't want to get caught in problems with activation. I am assuming I can do an upgrade to another version of Windows Server to avoid the 120 day limit?
Thanks
Answer: I would say that you are misunderstanding the purpose of this VM. It is intended as a quick way to give a demo of Office and SharePoint 2010, and do some high level evaluation.
It sounds like you are wanting to make a full-fledged development machine out of it. If that is the case I would say you are better off creating your own VM from scratch so that you can control what is going on with the install.

Question about the Sharepoint 2010 VHD


Given the characteristic equation of A.Find equation for B.

Question: Given that $\chi_A(x)=x^3-ax^2+bx-c$
Find $\chi_B(x)$ For:
a)B=A-2I
b)$B=A^2$
For a) would you put x+2 in for x in the $\chi_A(x)$. As Det(XI-B)=Det(XI+2I-A)= det((X+2)I-A)
And b: Im not sure how to do but you have to square the eigenvalues?
Comment: Yes: you have to square the eigenvalues, so that you need to find the polynomial whose roots are $\alpha^2, \beta^2 , \gamma^2$, where $\alpha, \beta , \gamma$ are the roots of $\chi_A(x)$.
Comment: See the 11th and 12th slides [at this link](http://www.math.cmu.edu/~mlavrov/arml/13-14/polynomials-02-09-14.pdf) for a hint on how to do it.
Comment: so It would be (x^3−ax^2+bx−c)((x^3+ax^2-bx+c) then replace X^2 with x's?
Comment: Yes: this is exactly what you have to do.
Answer: From $A^3-aA^2+bA-cI=0$ you get
$$
               A(A^2+bI)=aA^2+cI
$$
Squaring both sides,
$$
               A^2(A^4+2bA^2+b^2I)=a^2A^4+2acA^2+c^2I \\
               B(B^2+2bB+b^2I)=a^2B^2+2acB+c^2I \\
                B^3+2bB^2+b^2B-a^2B^2-2acB-c^2I=0 \\
                B^3+(2b-a^2)B^2+(b^2-2ac)B-c^2I=0.
$$


What is a good metric for my item ordering/ranking task?

Question: My dataset is a collection of items with numerical features, and each of them has a score assigned to it as label.
My goal is to predict the ranking/order of the items, so the score prediction accuracy is less of concern, as long as the ranking by predicted socres are correct.
My question is, is there a good metric to evaluate my model on this task? I have checked out some learning to rank metrics, but they tend to emphasize the correct order of top items. However, in my case, it is equally important to put trailing items where they belong.
For example,
rank_metric([A, B, C, D, E], [A, B, C, D, E]) should be perfect
rank_metric([A, B, C, D, E], [B, A, C, D, E]) should be slightly lower
rank_metric([A, B, C, D, E], [A, B, D, C, E]) should be the same as the previous one
rank_metric([A, B, C, D, E], [D, B, C, A, E]) should be punished even more
Thanks in advance!
Answer: Supplementing earlier answer
Keyword:  Learning To Rank ( LTR) problem formulation
Three prominent methods to solve ranking problems.

Pointwise ranking model
Pairwise ranking model
Listwise ranking model
See https://en.wikipedia.org/wiki/Learning_to_rank & links therein. A very rich & matured field of machine learning.
Answer: Since you are not really interested in the correct score label for the members $A, B, ...$ of your dataset $\Delta$, but rather in the ranking, I suggest you do not train a model for the score but rather one for the ranking, by learning to order pairs.
Let $s:\Delta\to\mathbb{R}$ be the score. This defines a map:
$$
r: \Delta^2 \to \{0, 1\}, \quad r(A, B):
\left\{\begin{array}{ll}
0 & \mbox{, if } s(A) \le s(B)\\
1 & \mbox{, otherwise}
\end{array}\right.
$$
You now learn this binary $\Delta^2$ classifier on your training data. Then, to find the ranking of some new set $\Delta_{new}$, you use $\hat r$ in an of-the-shelf sorting algorithm to order your set.
Comment: Hi, thanks for the answer! Just following up, what models would you recommend to consume these feature pairs?
Comment: In principle, any binary classifier would do. It mainly depends on your data and your constraints. E.g. if you need to understand how the classification is obtained from the input, i.e. if you are interested in the "why", you should use a model-based method with an easy model, e.g. logistic regression. If you are only interested in the result, you can also use non-parametric (or "near-nonparametric") methods like random forest, GBM, ...
Comment: Thanks for the answer!
Comment: @MarcZhang You're welcome. If you are satisfied with the answer, please consider accepting it. See: [What should I do when someone answers my question?](https://stats.stackexchange.com/help/someone-answers)


Direct Access on Server 2012

Question: Scenario: Windows Server 2012 with the Remote Access role installed.  IP set to static, registered DNS.  3 domain controllers, all running Server 2003 (I suspect this may be the issue)
Done so far: DNS registered, firewall turned off after IPsec was applied. Able to ping all 3 DC's with no issues
Problem:
Going through the DA wizard generates this error.  I am logged in as a domain admin, verified that I can ping the DC, verified IPsec allows me to contact it.  Since this version hasnt been readily deployed yet, there isnt much help available online from what I can find.

Any assistance ayone could provide would be greatly appreciated.  I am still new to the server world as far as things are considered.  I would fit, user wise, between Superuser.com and serverfault.com (junior admin)
Thanks to anyone who may be able to assist!
Answer: DirectAccess requires at least one Server 2008 or above Active Directory DC with IPv6 enabled.  See http://technet.microsoft.com/en-us/library/ee382305(v=ws.10).aspx for all requirements.
Keep in mind, without a 6to4 NAT Device (Forefront UAG, etc...), DirectAccess only allows access to IPv6 resources.  2003 and XP have limited IPv6 support, and require extra configuration to get working.
Comment: Thanks.  Thats what I figured, but apparently I need more coffee.  Going to put this on our "Why we should upgrade" whiteboard

Direct Access on Server 2012


Security Issues with Write Permissions on Web.config

Question: I currently have a PHP site running on an IIS7.5 server.
I use the built url rewriting tool for IIS in the web.config.
My CMS admin has the ability to allow the user to write their own rewrite. So my admin tool, written in PHP needs write modify permissions for the IUSER in order for PHP to modify the file. However I figured that was probably not good practice for security so I decided to move the rewrites into a rewrite.config file that the web.config references. I then give write/modify permissions to the rewrite file and not the web.config.
The only problem is that IIS caches the external rewrite file and won't reload it unless the web.config's last modified date is cached. I can manually force the server to reload my rewrite.config file by opening the web.config in a text editor, adding a space or something and then clicking save, the server then notices the last modified date has changed and then reloads the rewrite file with the new rewrite.
I can't continue to do this forever though, I need my admin tool to allow users to add their own rewrites without having to call me to make a change in the web.config before their rewrites take effect.
I learned that I can call the touch function in PHP on the web.config file and that solves my problem, because it changes the last modified date on the web.config file. However in order for touch to work PHP needs the IUSER to have write permissions to do so but not modify permissions.
So finally my question is... security wise, is it okay to leave the web.config with IUSER permissions to read and write but not modify? Or is that still a security issue.
If so, what vulnerablities am I creating for this site? And, how can I change my approach to not open myself up to these vulnerablities?
Answer: Answering my own question. It's best practice to avoid giving I_USER permission to the web.config. We ended up rewriting our code to no longer require this.


Suppose $Df(z)^TDf(z) = \lambda(z)I$. Show $f(z)$ is holomorphic or $\overline{f(z)}$ is holomorphic

Question: From an old qualifier:

Let $z=x+iy$, $f=f(z)=u+iv$. Assume $\Omega$ is an open connected
  domain in $\mathbb{C}$, $f\in C^2(\Omega)$. Denote $$Df = \left[
 \begin{matrix} \frac{\partial u}{\partial x} & \frac{\partial
 u}{\partial y} \\ \frac{\partial v}{\partial x} & \frac{\partial
 v}{\partial y} \end{matrix} \right].$$ Suppose for every $z\in
 \Omega$, $$Df(z)^TDf(z) = \lambda(z)I$$ for some $\lambda(z)$, where
  $I$ is the 2x2 identity matrix. Then show that either $f(z)$ is
  holomorphic or $\overline{f(z)}$ is holomorphic.

Ideas: We get $$\left( \frac{\partial u}{\partial x} \right)^2 + \left( \frac{\partial v}{\partial x} \right)^2 = \left( \frac{\partial u}{\partial y} \right)^2 + \left( \frac{\partial v}{\partial y} \right)^2 \quad \text{and}\tag{1}$$ $$\frac{\partial u}{\partial x}\frac{\partial u}{\partial y} + \frac{\partial v}{\partial x}\frac{\partial v}{\partial y} =0\tag{2}.$$
What I've been doing is differentiating (1) and (2) with respect to $x$ and $y$ and trying to cancel. One thing I ended up with is $$\Delta u \left(\frac{\partial u}{\partial x} - \frac{\partial u}{\partial y}\right) + \Delta v \left(\frac{\partial v}{\partial x} - \frac{\partial v}{\partial y}\right)=0.$$
But I need to show relations between $\partial u/\partial x$ and $\partial v/\partial y$ etc.
Comment: Do we know anything about $\lambda(z)$?  Is *it* holomorphic?  Oh, I guess $\lambda(z)$ can't be holomrphic, can it?  The way it is defined, it looks real . . .
Answer: If $A^TA = \lambda I$, then also $AA^T = \lambda I$. Using that, we have
$$Df(z)Df(z)^T = \lambda(z) I,$$
and that translates to
$$\begin{gather}
u_x^2 + u_y^2 = v_x^2 + v_y^2,\\
u_x v_x + u_y v_y = 0.
\end{gather}$$
So the gradients of $u$ and $v$ have equal length everywhere, and are orthogonal, hence
$$\begin{pmatrix} v_x\\v_y\end{pmatrix} = \pm \begin{pmatrix}0&-1\\1&0 \end{pmatrix}\cdot \begin{pmatrix}u_x\\u_y \end{pmatrix},$$
and that means in each point either $f$ or $\overline{f}$ satisfies the Cauchy-Riemann equations.
Answer: What might be termed the "transpose" of Daniel Fischer's argument:
Writing out $DF(z)^TDf(z)$ with
$Df = \left[
 \begin{matrix} \frac{\partial u}{\partial x} & \frac{\partial
 u}{\partial y} \\ \frac{\partial v}{\partial x} & \frac{\partial
 v}{\partial y} \end{matrix} \right], \tag{1}$
as it is defined by the OP Eric Auld, we arrive at a slight modification of his equations (1), (2), viz.
$\left( \frac{\partial u}{\partial x} \right)^2 + \left( \frac{\partial v}{\partial x} \right)^2 = \left( \frac{\partial u}{\partial y} \right)^2 + \left( \frac{\partial v}{\partial y} \right)^2 = \lambda(z) \tag{2}$
and
$\frac{\partial u}{\partial x}\frac{\partial u}{\partial y} + \frac{\partial v}{\partial x}\frac{\partial v}{\partial y} =0\tag{2}.$
Setting $u_x = \partial u / \partial x$, etc., i.e. using the subscript notation for partial derivatives, we then have
$u_x^2 + v_x^2 = u_y^2 + v_y^2 = \lambda(z) \tag{4}$
and
$u_x u_y + v_x v_y = 0. \tag{5}$
Consider the vector fields $(u_x, v_x)$ and $(u_y, v_y)$.  By (4) they are of the same magnitude, and by (5), they are orthogonal.  Thus $(u_x, v_x)$ must be a scalar multiple of
$(v_y,- u_y)$.  By (4), we must then have $(u_x, v_x) = \pm(v_y,- u_y)$; the "$+$" sign gives the Cauchy-Riemann equations for $f(z)$; the "$-$" sign for $\overline{f(z)}$.  Thus either $f(z)$ or $\overline{f(z)}$ is holomorphic.
Hope this helps.  Happy New Year,
and as always,
Fiat Lux!!!
Answer: From (2), $\dfrac{u_x}{v_y}= -\dfrac{v_x}{u_y} = k$(say). (Justification for $u_y\neq0$ and $v_y\neq 0$ later).
Using in (1) ; $(k^2-1)(v_y^2 +u_y ^2) = 0  \implies  k = \pm 1$. Hence either $f$ or $\bar{f}$ is holomorphic.
If $u_y = v_y =0$, then
$Df^TDf = \left[
 \begin{matrix} u_x^2 + v_x^2 & 0 \\ 0 & 0 \end{matrix} \right] = \lambda(z) I$ does not make sense. So both cannot be zero.
If one is zero (WLOG) $u_y =0$: then $v_xv_y = 0$. This means $v_x = 0 \implies u_y = v_x$. Also, $Df^TDf = \left[
 \begin{matrix} u_x^2  & 0 \\ 0 & v_y^2 \end{matrix} \right] = \lambda(z) I \implies u_x = \pm v_y$.
Comment: Small quibble: you showed $u_y$ and $v_y$ are not both zero, but what if one is zero?
Answer: Consider the surface $M \subseteq \mathbb R^2$ parameterized by $$f(x,y)=(u(x,y),v(x,y)). $$ Your condition implies that the first fundamental form associated with this map is scalar, which is also called conformal. Conformal maps preserve angles, and all that is needed to finish is the relationship between conformality and holomorphicity, which is discussed in introductory complex analysis texts, e.g. Ahlfors [p. 73].


Distance between a normed vectorspace and a finite dimensional subspace

Question: I need to prove the following statement:
"$X$ is a normed vectorspace and $Y$ is a finite dimensional subspace. For all $x \in X$ the distance is defined as $d(x,Y)=\inf\{ \|x-y\|:\  y \in Y\}$"
So I need to prove that there is an specific y in Y such that $d(x,Y) = \|x-y\|$.
I used the Corollary that every finite dimensional subspace of a normed vectorspace is also closed, and then I tried to apply the Riesz Lemma. But I am not sure.
Can anyone give me a hint for this exercise?
Comment: In a  finite-dimensional normed vector space (or subspace) every closed bounded subset is compact. Any $n$-dimensional real normed vector space has a linear homeomorphism to $\mathbb R^n.$
Answer: Use the definition of infimum to find a sequence $\left(y_n\right)_{n\geqslant 1}$ of elements of $Y$ such that $\lVert x-y_n\rVert\leqslant d(x,Y)+1/n$ for each $n\geqslant 1$. The sequence $\left(y_n\right)_{n\geqslant 1}$ is bounded (why?) and lies in a normed  vector space of finite dimension: you can extract a converging subsequence.
Comment: What exactly is that showing me? Sorry I don't get the point of doing that,..
Comment: The wanted $y$ will be the limit of the converging subsequence.
Comment: Ah I see, thanks :) the sequence is bounded because it is in a finite space I guess? or is there a better reason?
Comment: No, juse use $||y_n||\leqslant ||y_n-x|| +d(x,Y) \leqslant 1/n+||x|| \leqslant 1+||x ||$.
Comment: How do you get to this inequality?
Comment: There are 3 inequalities in what I wrote. Which one do you mean?
Comment: Could you explain to me why the fact that the sequence is bounded implies that it has a converging subsequence


Selecionar itens que não contenham em uma 2ª tabela

Question: Preciso selecionar dados de uma tabela apenas quando o codigo dessa tabela não constar em uma segunda tabela. Resumidamente seria isso. Possuo a tabela entregaitem com as seguintes colunas (codigo,codigoentrega,codigoestoque) e a tabela retorno onde uma das colunas é (codigoentregaitem). Minha necessidade é criar uma query que selecione todos os itens da tabela entregaitem quando codigo não existir na tabela retorno, Pensei em algo do tipo:
select * from public.entregaitem where NOT EXITS
(select public.entregaitem.codigo, public.retorno.codigoentregaitem
from public.entregaitem,public.retorno
where public.entregaitem.codigo = public.retorno.codigoentregaitem)

Porém assim nada me foi retornado. Devido a existir dados onde os codigo são diferentes
Comment: Possível duplicata de [Como criar pesquisa no MySQL que retorne linhas sem correspondência?](https://pt.stackoverflow.com/questions/109881/70)
Answer: Olá, tente a seguinte consulta:
select * from public.entregaitem where public.entregaitem.codigoentrega not in
(select public.retorno.codigoentregaitem from public.retorno)

Comment: Perfeito, era exatamente o que precisava, assim que ficar disponível já marco tua resposta como correta, obrigado pela ajuda :)
Comment: beleza cara, disponha! boa sorte ai.
Comment: Normalmente eu não obtenho boa performance com `not in`...
Comment: Jefferson, um left outer join também poderia ser uma solução pra este caso?
Comment: Sim, seria. Veja a resposta do CaiqueRomero. Ele deu a resposta que eu queria ter dado =]
Answer: Existem diversas formas de você fazer isso, vou demonstrar 3 aqui mas é importante levar em consideração que o uso de subselect ou subquery podem prejudicar a perfomance por isso sempre que possível opte por evitá-las.
Utilizando NOT EXISTS em conjunto com um SUBSELECT
SELECT item.*
FROM entregaitem AS item
WHERE NOT EXISTS
   (
   SELECT NULL
   FROM retorno
   WHERE retorno.codigoentregaitem = item.codigoentregaitem
)

Veja o exemplo funcionando: SQLFIDDLE
Utilizando NOT IN em conjunto com um SUBSELECT
SELECT item.*
FROM entregaitem AS item
WHERE item.codigoentregaitem NOT IN
   (
   SELECT retorno.codigoentregaitem
   FROM retorno
   WHERE retorno.codigoentregaitem = item.codigoentregaitem
)

Veja o exemplo funcionando SQLFIDDLE
Utilizando LEFT JOIN em conjunto com a condição IS NULL
SELECT item.*
FROM entregaitem AS item
LEFT JOIN retorno
   ON retorno.codigoentregaitem = item.codigoentregaitem
WHERE retorno.codigoentregaitem  IS NULL

Veja o exemplo funcionando: SQLFIDDLE
Comment: Obrigado pela ajuda +1


JBoss 7.1.1 Clustering, JBAS014775:New missing/unsatisfied dependencies

Question: I am following https://docs.jboss.org/author/display/AS71/AS7+Cluster+Howto
I managed to get 2 servers running.
One slave.
One master.
I managed to get to "Dry Run"
I got:
<code>[Host Controller] 11:30:58,636 INFO  [org.jboss.as.domain] (domain-mgmt-handler-thread - 1) JBAS010918: Registered remote slave host "slave", JBoss AS 7.1.1.Final "Brontes"
</code>
But when I try to start server-three, I got this error:
<code>[Host Controller] 12:01:08,499 INFO  [org.jboss.as.host.controller] (HttpManagementService-threads - 11) JBAS010922: Starting server server-three
12:01:08,612 INFO  [org.jboss.as.process.Server:server-three.status] (ProcessController-threads - 6) JBAS012017: Starting process 'Server:server-three'
[Server:server-three] 12:01:10,708 INFO  [org.jboss.modules] (main) JBoss Modules version 1.1.1.GA
[Server:server-three] 12:01:12,064 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.2.GA
[Server:server-three] 12:01:12,293 INFO  [org.jboss.as] (MSC service thread 1-1) JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
[Server:server-three] 12:01:12,612 INFO  [org.xnio] (MSC service thread 1-1) XNIO Version 3.0.3.GA
[Server:server-three] 12:01:12,635 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.0.3.GA
[Server:server-three] 12:01:12,668 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 3.2.3.GA
[Server:server-three] 12:01:16,176 INFO  [org.jboss.as.logging] (MSC service thread 1-1) JBAS011502: Removing bootstrap log handlers
[Server:server-three] 12:01:16,257 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 43) JBAS011800: Activating Naming Subsystem
[Server:server-three] 12:01:16,325 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 56) JBAS010280: Activating Infinispan subsystem.
[Server:server-three] 12:01:16,307 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 37) JBAS013101: Activating Security Subsystem
[Server:server-three] 12:01:16,498 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 33) JBAS015537: Activating WebServices Extension
[Server:server-three] 12:01:16,574 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 60) JBAS016200: Activating ConfigAdmin Subsystem
[Server:server-three] 12:01:16,574 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 42) JBAS011940: Activating OSGi Subsystem
[Server:server-three] 12:01:16,564 INFO  [org.jboss.as.jacorb] (ServerService Thread Pool -- 55) JBAS016300: Activating JacORB Subsystem
[Server:server-three] 12:01:16,532 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 59) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
[Host Controller] 12:01:16,744 INFO  [org.jboss.as.domain.controller.mgmt] (proxy-threads - 4) JBAS010920: Server [Server:server-three] registered using connection [Channel ID 6a098b8c (inbound) of Remoting connection 02ed01c3 to /192.168.100.105:58266]
[Server:server-three] 12:01:16,764 INFO  [org.jboss.as.clustering.jgroups] (ServerService Thread Pool -- 50) JBAS010260: Activating JGroups subsystem.
[Server:server-three] 12:01:16,926 INFO  [org.jboss.as.security] (MSC service thread 1-1) JBAS013100: Current PicketBox version=4.0.7.Final
[Host Controller] 12:01:17,056 INFO  [org.jboss.as.host.controller] (proxy-threads - 4) JBAS010919: Registering server server-three
[Server:server-three] 12:01:18,294 INFO  [org.jboss.as.naming] (MSC service thread 1-2) JBAS011802: Starting Naming Service
[Server:server-three] 12:01:18,297 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
[Server:server-three] 12:01:19,422 INFO  [org.jboss.jaxr] (MSC service thread 1-1) JBAS014000: Started JAXR subsystem, binding JAXR connection factory into JNDI as: java:jboss/jaxr/ConnectionFactory
[Server:server-three] 12:01:19,982 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 56) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.
[Server:server-three] 12:01:20,078 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 56) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.
[Server:server-three] 12:01:20,100 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
[Server:server-three] 12:01:20,698 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-2) JBoss Web Services - Stack CXF Server 4.0.2.GA
[Server:server-three] 12:01:21,214 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Starting Coyote HTTP/1.1 on http--192.168.100.105-8330
[Server:server-three] 12:01:21,297 INFO  [org.apache.coyote.ajp.AjpProtocol] (MSC service thread 1-2) Starting Coyote AJP/1.3 on ajp--192.168.100.105-8259
[Server:server-three] 12:01:21,670 INFO  [org.jboss.modcluster.ModClusterService] (MSC service thread 1-2) Initializing mod_cluster 1.2.0.Final
[Server:server-three] 12:01:21,797 INFO  [org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl] (MSC service thread 1-2) Listening to proxy advertisements on 188.8.131.52:23364
[Server:server-three] 12:01:23,012 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on /192.168.100.105:4697
[Server:server-three] 12:01:23,019 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
[Server:server-three] 12:01:24,535 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
[Server:server-three] JBAS014775:    New missing/unsatisfied dependencies:
[Server:server-three]       service jboss.binding.jacorb (missing) dependents: [service jboss.jacorb.orb-service]
[Server:server-three]       service jboss.binding.jacorb-ssl (missing) dependents: [service jboss.jacorb.orb-service]
[Server:server-three]       service jboss.binding.messaging (missing) dependents: [service jboss.messaging.default]
[Server:server-three]       service jboss.binding.messaging-throughput (missing) dependents: [service jboss.messaging.default]
[Server:server-three]
[Server:server-three] 12:01:24,545 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 15375ms - Started 146 of 280 services (12 services failed or missing dependencies, 121 services are passive or on-demand)
</code>
Any help on the 4 missing items?
Comment: I have figured it out.
Ok.
JBoss 7.1.1 has "server-three" in the "full-ha" profile.

In "domain/configuration/domain.xml" the socket is bound to "ha-sockets".
if you change it from "ha-sockets" to "full-ha-sockets" then everything works out nicely.

Thank you.
Answer: I have figured it out. Ok. JBoss 7.1.1 has "server-three" in the "full-ha" profile. In "domain/configuration/domain.xml" the socket is bound to "ha-sockets". if you change it from "ha-sockets" to "full-ha-sockets" then everything works out nicely. Thank you.


How do you send numbers over python sockets?

Question: I try to send padded numbers of 4 characters, but when I send
<code># sender
number = str(2).zfill(4)
sending_socket.send(number)

# receiver
msg = receiving_socket.recv(4)
print msg
</code>
The msg printed comes out to be 11.
Answer: You have something you aren't showing us wrong:
<code># sender
>>> from socket import *
>>> s=socket()
>>> s.connect(('localhost',8000))
>>> number=str(2).zfill(4)
>>> s.send(number)

# receiver
>>> from socket import *
>>> s=socket()
>>> s.bind(('',8000))
>>> s.listen(1)
>>> c,a=s.accept()
>>> c.recv(4)
'0002'
</code>
Comment: True. I send 1 over and it works, and then 2 comes out to be 11. Is it a buffer problem?
Comment: TCP is a streaming protocol so it has no message boundaries.  Also `send` and `recv` need their return values checked because they may not send or receive the amount requested.  You have to design a protocol that takes this into account, sending the size of the message in the data, for example.
Comment: See another answer of mine for an example: http://stackoverflow.com/a/9968240/235698.  Update your question with an example that demonstrates the problem and I can give a better answer.
Comment: Got it, I'm going to use a sentinel byte. Thanks for your help!
Comment: You're welcome!  If all you are sending is 4-byte formatted numbers, just making sure your messages are exactly 4 bytes will work as a protocol also.


Windows equivalent of Linux Network Namespace

Question: Does windows have an equivalent of the Linux Network Namespace?
I want to create a new interface and have that interface only accessible to specific applications, that interface would not be listening on the standard windows ports (139 445 etc).
Ideally the application would not be able to use the other interfaces either, but that's less important for my use case.
Most importantly the interfaces would not communicate with each other at the OS level, they would need to actually send packets out to a physical/virtual network if they wanted to communicate between each other.  The IP ranges could even be overlapped (of course then they couldn't talk to each other directly).
Comment: some elements here: https://unit42.paloaltonetworks.com/what-i-learned-from-reverse-engineering-windows-containers/
Comment: there could be some informations to dig there: https://docs.microsoft.com/en-us/virtualization/windowscontainers/container-networking/architecture
Answer: The bottom line answer is a flat no.
Windows does not have anything approaching an equivalent to Linux namespaces.
The closest I can think of personally (perhaps there are better answers out there) are job objects but I can't think of a clear way to do what you want. Maybe ACLs? I recommend neither approach, but those are the two things that come to mind as far as isolating specific resources to specific processes.
The problem is network interfaces are handled at a low level in the OS and since windows doesn't expose a way within the kernel to control access on a per user land application basis it's not clear to me how you could generally achieve this without a custom driver of some sort.


How to Access Google Cloud VM from other Google Cloud VM in different region

Question: Is there any way to Access Google Cloud VM from other Google Cloud VM in different region?
I have seen that one of my US-Iowa 10.121.0.4 while Asia-Japan Region is 10.148.0.5
I was planning to host mysql on only 1 server and use it from other machine and host machine both (which are acting as web server). I thought this because my tables has read and write operations both which require simultaneous syncing of databases.
Can I host somehow access mysql on Asia-Japan?
I tried accessing Japan machine using the command on US server:
<code>mysql -h 10.121.0.4 -u test -p
</code>
but nothing is working. Even the ping is not happening to 10.121.0.4.
Not sure what I am missing. I have checked all firewalls access and they are fine.
Logically if everything is on Google Cloud, I should be able to ping any machine and basis authentication I should be able to enter. Isn't it?
Answer: You can't ping internal IP via VM to VM, it is part of a security method of GCP, since it needed a VPN connection.


How to increase integer field in List of objects

Question: well, I have List<HighscoreEntry> In which your class is this:
public class HighscoreEntry {
    private List<String> users;
    private int score;

    HighscoreEntry(List<String> users, int score) {
        this.users = users;
        this.score = score;
    }

    public List<String> getUsers() {
        return users;
    }

    public void setUsers(List<String> users) {
        this.users = users;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }
}

Well, what happens, is because in the other class I have this:
public class ScoreboardItemData {
private final static HighscoreComparator comparator = new HighscoreComparator();
private final List<HighscoreEntry> entries;
private final Map<String, Integer> points;
private int scoreType;
private int clearType;

public ScoreboardItemData(int scoreType, int clearType, List<HighscoreEntry> entries, Map<String, Integer> points) {
    this.scoreType = scoreType;
    this.clearType = clearType;
    this.entries = entries;

    this.points = points;
}

public List<HighscoreEntry> getEntries() {
    return this.entries;
}

public Map<String, Integer> getPoints() {
    return this.points;
}

public void addEntry(List<String> users, int score) {
    synchronized (this.entries) {
        this.entries.add(new HighscoreEntry(users, score));

        this.entries.sort(comparator);
    }
} }

Well, I already can add new entries, but I want to change ONLY THE SCORE and increase it, to existing data.
And I tried some things, but without success:
Example 1:
synchronized (this.entries) {
        for (int i = 0;i < this.entries.size(); i++) {
            if (this.entries.get(i).getUsers() == users) {
                this.entries.get(i).increaseScore(score);
                this.entries.sort(comparator);
            } else {
                this.entries.add(new HighscoreEntry(users, score));
                this.entries.sort(comparator);
            }
        }
    }

This example update the score, but with the loop, he will add more entries and update others, so will always do this loop.
Example 2:
HighscoreEntry entry = (HighscoreEntry) this.entries.stream().filter((x) -> {
        return x.getUsers().equals(users);
    });
    if (entry.getUsers() != null) {
        entry.increaseScore(score);
    } else {
        entry.setUsers(users);
        entry.setScore(score);
    }

And this one, return this error:
java.lang.ClassCastException: java.util.stream.ReferencePipeline$2 cannot be cast to com.heraproject.wired.data.ScoreboardItemData$HighscoreEntry
at com.heraproject.wired.data.ScoreboardItemData.addEntry(ScoreboardItemData.java:45)

Comment: @AntoineB The problem is: I already tried with replaceAll, set and other things to change the existing data, but none of them helped!
Comment: show what you've tried, I can't seem to make sense of what you're asking.
Comment: @Aomine I've added a few examples that I used and did not succeed
Answer: If I understand correctly, all you need is something like this
    // int index, someInt;
    this.entries.get(index).setScore(someInt);

However, looking at your model, I would think "high score" would be calculated by iterating over a list of potential User objects, each having their own unique scores. Then you set the score on the user, not the entity holding a list of users.
Comment: Yes, and to do this 'index' I will need to do an `for (int i = 0;i < this.entries.size(); i++)`, but still not working
Comment: It's not clear what you've done inside the loop or where/when you're looking at the updated score board
Comment: I'll put one example of code on main post to avoid mess here xD
Answer: Well,
Use this method
public void updateEntry(List<String> users, int index) {
    synchronized (this.entries) {
        HighscoreEntry highScoreEntry = this.entries.get(index);

        highscoreEntry.setScore(//Update score);
        entries.add(index, highscoreEntry);

    }
}

Comment: Ya, but will update all entries, I want to update determined score of users I tried the solutions which u guys offered me, but none of them was the right solution
Comment: If you want so please use entry to loop with ArrayList find desired item and update score
Answer: You need to find the right item in the list based on the identifier and looking at HighscoreEntry that identifier is users. This code will update the score for a HighscoreEntry in the list entries if one exists
public void addScore(List<String> users, int score) {
    HighscoreEntry entry = entries.filter( e -> (e.getUsers().equals(users))).findFirst().orElse(null);
    if (entry != null) {
        entry.setScore(score);
    }
}

Comment: Yeah, his is what I want actually, but it did not work for me, because in the `(entry -> (entry.getUsers().equals(users)))` the **entry** return the error: "Variable 'entry' is already defined in the scope". But yeah, you understood what I really want. And tried to change the variable, but doesn't work
Comment: @RaphaLeão, I got that error to but forgot to update my answer before. Fixed now.