How can I make method final variable NOT change while entering in lambda

Question: To begin with I am not sure how to express the issue but I am really stuck (I read this Why can I still make changes to this final variable? but it didn't help). I use CodenameOne framework but I am not sure too the issue spurts from it, it could be general java.
In my App I am sending Reports to the server. It works great.
The method is as follows in the Report class:
    public void sendAsync(SuccessCallback<Report> onSuccess) {
      // Update : With a shallow copy it does not work
     // final Report currentReport = this;

     // But with a deeper copy it does
     final Report currentReport = clone(this);

     final MultipartRequest request = new MultipartRequest() {

        @Override
        protected void readResponse(InputStream input) throws IOException {
        // ... Does stuff here on Report's attributes

        // Here the variable currentReport changes during overlapping sendings

      @Override
      postResponse(){

        // The goal is to use some attributes from the current report
        // to be shown in a popup to remind the user what we sent
        // BUT the as written above the currentReport changes during
        // overlapping sendings so that what is shown to the user only
        // deals with the lastest report and does not make sense.

        onSuccess(currentReport);

      }

     }
    } // end of sendAsync

I call it like this when the user presses the send button:
 Report myReport = new Report();
 myReport.photoPath.set(...);
 myReport.id.set(...);
 anotherMethod(myReport); // this passes myReport to sendAsync but never modifies it
 // Here myReport has still the right attributes based on the parameters
 myReport.sendAsync((sentReport) -> {/* does something else */});

The problem is that when the user presses the send button whereas a previous sending is going on, the previous sending takes the attributes of the following one and it is NOT what I want.
So I don't know where to search in my code, the variables are not static. How can I make previous currentReport not change when the sendings overlap ?
February 25th 2018's update
What I don't understand is why I have to create a deep copy of this to make it work (the static Report clone(Report sourceReport) method creates a new Report, sets its attributes with the ones of the passed in sourceReport, and returns the created Report) ?
Moreover when the user presses the button the following is done :
 Report report = new Report();
 report.photoPath.set(the_path_returned_from_the_camera);
 report.otherAttributes.set(values);

 report.sendAsync((sentReport) -> {

     showConfirmationPopup(sentReport);

     // However here report.photoPath returns a different path
     // from sentReport.photoPath which surprises me. Why do they differ ?

     System.out.println(report.photoPath.get()); //prints /home/a.jpg
     System.out.println(sentReport.photoPath.get()); //prints /home/b.jpg

  });

What I don't understand too is why within the lambda, report and sendReport do not have the same content when a deep copy is done (there were the same with a shallow copy) ?
The Report constructor works like :
 public Report() {
    this.location.set(null);
    this.photoPath.set("");
     ...
    this.connectionError = false;
}

Thank you very much in advance, I can provide more details if requested
Comment: is a `new Report` being created every time the user presses the button? where are you getting `parameters`?
Comment: also, I don't get this line `final Report currentReport = this;`
Comment: @AndrewTobilko Thanks for asking! Yes a new Report is created every time the user presses the button. The parameters are retrieved at different stage in the process. They are actually set like this : myReport.id.set(...).
If I print myReport before calling sendAsync it contains the right attributes.

With the line you quoted I "save" the current report to use in a callback later in the sendAsync method. The callback has a form of a lambda and I need to supply the callback with the currentReport so that its photo can be used in a confirmation message when it has been successfuly sent.
Answer: In Java. there is no built-in way to identify which method modify an object or not and thus no way to block those (ex: no equivalent to C++ "const methods"). However, there are design patterns to achieve what you are trying to do, depending on the specifics.
Immutable: simply make an object without setters so it cannot be modified after creation; the reference can still be changed (unless final) however.
Memento (a variant of at least): basically take a snapshot/copy of the object when the event is fired so any modifications being done to the original object after the event is fired doesn't impact the ones from event already fired. Be careful tho, you might need some kind of "deep-clone", if your object contains any other object, doint obj1 = obj2 will only make the two reference the same instance which can still be modified.
Another option around your issue could simply be to prevent event re-submission until the previous event finished (successfully or with Exception/failure.
Comment: While C++ has `const`, Java has `final`
Comment: C++'s const is not EXACTLY the same as Java's final. For example, in C++ a const method means it cannot modify any non-mutable member of the class, with a const object you cannot call non-const method in C++ so it also means that if your method takes in a "const" parameter, it indicates your method has no intention to modify that object."Const" is the C++ concept I miss most in Java since whenever you pass an object to a method in Java, you can never be sure what is going to be done to it.

There is a lot to read about [const-correctness](https://isocpp.org/wiki/faq/const-correctness).
Comment: Thanks @SimonBerthiaume. It works if I prevent re-submission, but it is not user friendly (user has to wait), I prefer to let them the ability to report as quick as they want. What I don't understand is that the method is not static nor is the variable currentReport but it still changes. Shouldn't method variables be independent in one call from another one  ? I don't know where to look at. Regarding the immutable pattern, I use BusinessProperty (kind of beans) with builtin setters and getters so they are inherently mutable.
Comment: @HelloWorld The problem might partially be because of `final Report currentReport = this;`. That statement only copies a reference to `this`, it doesn't copy the object itself, it means that if `this` is modified, so will `currentReport`, it has nothing to do with static or not.
Comment: @SimonBerthiaume I agree with the first part of your comment. But I create new instances of Report so in each one `this` shouldn't be modified, should it ? You must be right because creating a deep copy makes the whole thing work although I don't understand why (I'll update the original post).
Comment: @HelloWorld Just realized you did share that part of your code, sorry. Can you share the Report constructor code? My guess is, within it, you might just be copying references and thus it can keep on changing.
Answer: Every invocation of the method creates a new stack frame and places the variable within hence you have a "new final" object. Both are unmodifiable but both are new.
From reading your description I think you are looking at the wrong thing. I suggest placing a breakpoint on the point in which you invoke addToQueue and also look at the details in the network monitor to gain insight into what is happening in the code. My guess is that you are getting two requests one after the other and your server only accepts the last one due to application state.
Comment: Thanks @Shai for your comment. What is sent to the server looks correct (two requests with different contents in the Network Monitor), for exemple the images of the different reports are also different. What is not is the Report I get in the OnSuccess callback that is processed by the postResponse() method (I'll update my first post to show this). There the Report changes so when I show a popup with the report image, it always shows the latest report image!
Comment: If you show a popup using the Dialog API notice that this is a blocking call and might distort the order of event processing.
Comment: if they were out of order would not matter. However the same report image is shown in all popup (denoting the same Report is used).
Comment: You are doing `sendAsync` then changing the state of the object  while waiting for the popup dialog's invoke and block. The blocking dialog stops event from processing on the current sequence of events which means they will only happen after it's finished. So once the dialog is disposed the original events that were queued behind it process and impact the results you are seeing. You can prove that theory by using a modless dialog instead or wrapping your popup with a `callSerially`.
Comment: Sorry @Shai my previous comment was ill written. You're right it can happen that the order of event processing gets distorted. I just meant it is not a problem in the app, as long as what is displayed is correct.
Comment: OK, in that case it would be hard to say what went wrong without looking at the full code in a debugger.


The relation between the Chebotarev density theorem and Artin $L$-series

Question: In ch. VII, §13, pp. 545-546 of the English translation of Algebraic Number Theory by J. Neukirch, one finds a 1-page proof of the Chebotarev density theorem. This proof seems fairly harmless, and seems to only assume the following two results:
(1) The "class field theoretic isomorphism" between ray class groups and corresponding Abelian extensions (which of course is not itself a trivial result).
(2) What he calls the "generalised Dirichlet density theorem", which he proves on the previous page.
Now I was always under the impression that the Chebotarev density theorem, being what one might call a non-Abelian generalisation of the "generalised Dirichlet density theorem", would essentially depend upon the theory of the (non-Abelian) Artin $L$-series.
But the only place where the Artin $L$-series seem to feature in the proof, is when he proves the non-vanishing of the non-principal generalised Dirichlet $L$-series at $s=1$. The use of Artin $L$-series here is of course purely a matter of convenience, as there are more elementary ways of demonstrating the non-vanishing at $s=1$.
So my question is: Does the proof of the Chebotarev density theorem essentially depend upon the introduction of Artin $L$-series, or can one prove it without them if one demonstrates the non-vanishing of the generalised Dirichlet $L$-series at $s=1$ by other means? Is there some Artinian subtlety that I am missing?
Thank you for your attention.
Comment: You don't need Artin $L$-series to prove Chebotarev density theorem, all you need is Artin Reciprocity and some elementary manipulation on residual degrees.
Answer: The point is that while the Chebotarev density theorem is about how often some element $\sigma$ of a possibly non-abelian Galois group of number fields (or more generally global fields) arises as a Frobenius element at some (unramified) prime ideal, by a trick of Deuring the proof can be reduced to the case of the Galois extension corresponding to the subgroup $\langle \sigma\rangle$ generated by $\sigma$, i.e., to a cyclic Galois extension.
In this process, the base field changes to the fixed field of $\sigma$, so you need to formulate the Chebotarev density theorem over fairly general number fields in order to use this trick.
And once you are in the setting of cyclic Galois extensions, class field theory lets you focus on $L$-functions of finite-order Hecke characters.
Historically, Chebotarev proved his density theorem before class field theory and without Deuring's trick.  In fact he proved his density theorem only for Galois extensions of $\mathbf Q$, so he could not take advantage of a reduction to the cyclic case by increasing his base field. The discussion here has references to the original papers by Chebotarev.


How can i get JSON data from a PUSH notification in Appium?

Question: I am trying to automate a mobile application, using android, java and appium.
I am receiving a PUSH notification, which contains data from a JSON. Is there any way to get that data using appium, or something like that?
Im using this method to get the notifications:
<code>((AndroidDriver) driver).openNotifications();

ArrayList<MobileElement> allnotifications = (ArrayList<MobileElement>) driver.findElements(By.id("android:id/title"));

for (MobileElement m : allnotifications) {
    System.out.println(m.getText());
    if(m.getText().contains("Zona Kit2-P1:  armado totalmente")){
        System.out.println("Notificación de Armado Encontrada Corretamente");
        break;
    }
}
</code>
Is there a way to do this?
Thanks!
Answer: Using Appium, only the UI can be tested. If you want to get your data from a JSON object you can use the rest assured library


Prime numbers of the form $2357111317...$

Question: Let $m_{n}$ be the number we get from putting first $n$ primes together.
$$m_{1}=2$$
$$m_{2}=23$$
$$m_{3}=235$$
$$m_{4}=2357$$
$$m_{5}=235711$$
$$m_{6}=23571113$$
$$m_{7}=2357111317$$
and so on. Only primes i found on this sequence with Mathematica are $m_{1}=2, m_{2}=23, m_{4}=2357.$ For $5\leq n\leq 40$ is composite. Are there any more primes of the form $m_{n}$?
Comment: Note that there is nothing specifically interesting about base $10$ in the context of this question (i.e., one could equally generate such sequence on any other base).
Answer: Yes there are others.
From the corresponding list in OEIS we can find the sublist of primes. Unfortunately, tough,

The next term is the 355-digit number 2357111317192329313741434753...677683691701709719 which is too large to include here.

There other interesting lists linked there, like this one, that is the list of "Numbers $n$ such that the concatenation of the first $n$ primes is a prime."
Answer: These numbers are called Smarandache–Wellin numbers, and if they happen to be prime, they are called Smarandache–Wellin primes. There are many known primes of this form, and the first one after $2357$ is $m_{128}=235711\dots719$ (ending with prime $719$).
Answer: The concatenation of the first $1,2,4,128,174,342,435,1429$ prime numbers are (probable) primes. And these are the only we know as of may 8th $2016$, M.Rodenkirch found no other primes up to the first $78498$ primes. Here http://mathworld.wolfram.com/IntegerSequencePrimes.html. These kind of primes has been called Smarandache-Wellin primes.


scrollTop em FullScrenn jQuery

Question: Na tela em modo normal uso no clique de um botão o direcionamento da tela para uma div no topo:
$('html,body').animate({scrollTop:$('.backTop').offset().top}, 150);
Mas, tendo a tela em Full Screen como fazer esta função funcionar?
https://jsfiddle.net/f6xr93b7/
Comment: Tem uma resposta aqui dá uma olhada nela: https://pt.stackoverflow.com/questions/1855/existe-alguma-maneira-de-ativar-a-tela-cheia-do-navegador-com-javascript
Comment: Boa chefe, mas, meu fullscreen já está funcionando, meu problema é enviar o usuario para uma div no topo da página quando esta tela estiver em fullscreen
Comment: Mas qual seria a dificuldade então sNniffer?
Comment: Isso aqui não funciona `$('html,body').animate({scrollTop:$('.backTop').offset().top}, 150);` em fullscreen
Answer: Para resolver seu problema basta substituir o código:
$('html,body').animate({scrollTop:$('.backTop').offset().top}, 150);
por este $('#leitor').animate({scrollTop:$('.leitor_top').offset().top}, 150);
Pois quem fica em tela cheia é a div chamada "leitor".
Espero ter ajudado!
Answer: Teste isso:
var suaDiv = document.getElementById("leitor");
        suaDiv.scrollTop = 0;

Comment: joia? Testado e sem sucesso ainda
Answer: Resolvido,
Simplesmente ao usar:
$('html,body').animate({scrollTop:$('.backTop').offset().top}, 150);
estava atribuindo ao scroll do body, mas, deveria estar atribuindo ao scroll do div que está em fullscreen, ficando:
$('#leitor').animate({
    scrollTop: $(".backTop").offset().top
}, 150);

scrollTop em FullScrenn jQuery


Why are teams required to submit their batting order before the start of play?

Question: As per laws of the game, a team can send their batsmen to bat in any order. Why then are teams asked to submit the batting order before start of the game?
See the team nomination forms tweeted by ICC ahead of the 2015 World Cup semi-final match between India and Australia.
Comment: There is no law to submit batting order with team nomination form. Both team just need to submit the playing eleven plus four substitute players. The batting order might be just a formality.
Comment: @hims056 While I fully agree there's no Law of Cricket requiring the batting order, the form references the Match Participating Agreement and the Playing Conditions, and I strongly suspect they will require the batting order. Television likes it.
Comment: Perhaps it's yet another case of Cricket copying Baseball, unbeknownst to everyone.  [EvilSarcasticSmirk]
Answer: They're not. The space on the form is optional.
Section 1.2 of the 2015 World Cup Playing Regulations covers nomination of players - batting order is not mentioned.
As someone said in the comments, the TV people like it, but teams can and do change it at will, as it's a tactical weapon.
Comment: Can you find a copy of the Match Participating Agreement?
Comment: Tried, couldn't. You?
Comment: I can't find it either - and I'm not sure we can definitively say it's not required until we do find it.
Comment: We all know the batting order changes, we've seen it in matches in the last day or two. The teams may be asked to submit the batting order, but it's not adhered to. Possibly, if the form is sent back with no numbers, it'll be rejected, but even if it's fully filled in, it's not reliable.
Comment: I would suggest that it would be an intended batting order, as Happy said there is no law to require it.  The laws simply demand that you name your nominated players prior to the toss. There are lots of reasons why a batsmen may bat in a different position from injury to match situation and all things in between.
Answer: Though some answers+comments say that this is optional, there is no source given. So I think this question makes sense.
Here is a possible reason for specifying batting order.
If a batsman is out, and the next batsman has not yet come in within fixed some time, then he is given out. Which batsman is out depends on batting order.
Comment: I didn't downvote, so can't directly say - but 1) the (b) from your original answer wasn't relevant and 2) given that "timed out" is so *incredibly* rare in cricket, it seems unlikely to have a entire protocol just for that reason.
Comment: (A) is actually quite interesting - *who* is timed out if no batsman appears? The [laws](http://www.lords.org/mcc/laws-of-cricket/laws/law-31-timed-out-1/) just state "incoming batsman". (B) is missing the point of the question though - it's about why a *batting order* is nominated, not why 11 players have to be nominated for a match - everybody understands why that is there.
Comment: @PhilipKendall , while filling the form for (B) who is a substitute and who is not , it is simple to just put in the batting order and hence solve (A) at the same. Other wise, two forms would be needed, for (A) and (B) separately. So it is tangentially related. Anyway, I have removed that point.
Comment: @PhilipKendall , if (A) is interesting, why would the answer be downvoted ?
Answer: In all levels of cricket, it's a courtesy to the scorers and the media (if any) to specify a batting order and a wicket-keeper before the match, but it is not binding during the match.  (The designation of the captain, however, is binding.)
The particular example is from the World Cup, where teams operate with a predefined squad of 15.  So the preprinted sheets ensure that the playing XI and the substitutes are chosen from the set of permitted players.  The batting order is an added convenience.
Comment: Could you provide a reference for this?


How to log and display all the users that have edited a node (without revisioning)?

Question: We need to keep the usernames of the latest editors of content, along with the edit date.
How can we do so? Or should we use custom code?
We do not want to enable revisioning, as it is more complex than we want.
Comment: Just use Views (on nodes) with a relationship 'content revision: user'. Else if it is absolutely necessary to have a log, try [Event log](https://www.drupal.org/project/event_log)
Comment: @J.Reynolds ... or use the "Message" module?
Answer: The Activity module does some user activity logging that may covert your need.

The Activity module keeps track of the things people do on your site
  and provides mini-feeds of these activities in blocks, in a
  specialized table, and via RSS. The module is extensible so that any
  other module can integrate with it. The messages that are produced are
  customizable via the admin interface and are context sensitive. Some
  theoretical example messages include:

You wrote a comment in response to "example comment title"
Jim wants to be your friend. Approve this friendship here
Nancy is Phil's latest fan
Comment: For what it's worth, there are still almost the same number of users for D7 as there are for D6 for that module - https://www.drupal.org/project/usage/activity
Comment: Haven't tried it but for Drupal 7, which is what we are using, it is still under development.
Comment: @rooby : looks like your prior comment may need an update about that "number of users" ... apart from that, how about the "Message" module?
Comment: @Pierre.Vriens: I think it's alright, since the comment has a date on it and comments inherently go out of date eventually. Plus I cannot edit it :)
Answer: IMO the Message module would be a perfect fit to answer this question, and which doesn't require revisioning. Using this module, you can create your own custom "Events logging" (to register things that happened in a site).
Specific to this question here, I'd create a so called "Message type" that contains data about:

the usernames (of the latest editors of content).
the edit date.
any data about the actual node you want to track, such as the node's id (of course), its title, author, some fields, etc.

You could even track how those node related data looked like before and after they got updated, a kind of "light" revisioning (only for those node attributes you want to know about).
About Message types: think of them as equivalent to Content types, whereas you create messages (instead of nodes) of a specific Message type (instead of Content type).
Rules integration
A really interesting facility of the Message module is its perfect integration with the Rules module. Have a look at the answer to "How to implement a follow author (or user) function?" for way more details on that.
In your case, you'd simply create a (rather basic) custom rule which uses:

a Rules Event like "Before saving a new node", of "After updating an existing node" (or variations of these events).
a Rules Action to "Create a message" (of a selected Message type).

That's really it ...
Example included in Commerce Kickstart
A great sample of this can be found in Commerce Kickstart, which uses the Commerce Message module, to create such "Events logging". In that case in the format of an Order History, as shown in this screenprint (from this module's project page).
Replicate/replace the Activity module
Should you want to do so, it seems perfectly possible to build a view (report) that contains the data similar to what you can do with the Activity module as shown in this screenprint (from this module's project page).
More info about the Message module
The Message module is an amazing module, it is fully entity based, which implies that it perfectly (out of the box) integrates with modules such as Views and Rules.
Though there is not a lot of documentation about it (which is what makes it a hidden D7 gem ...). A possible way to get started with it, and to get an idea of the kind of things it can be used for, is to have a look at the answers to:

How to create a basic message - notifications system displaying a real time message counter badge?
How to show message view containing own and following activity?
How to integrate messaging into a custom module?
Is there a simple way to notify users about new posts on the site?

Tutorials:

What is Drupal's Message Stack and how do its modules work together?
How to allow users to manage their own Message Stack messages?
What's the purpose of "Replacement tokens" of a Message type?
Answer: One option is the Event Log module:

This module logs specific events. The events are saved in the database
  and can be viewed on the page admin/reports/events. Furthermore, a
  views integration is provided in which you can relate for instance a
  node to its events. You could use this to display the total number of
  views, or the number of times that the node has been modified and by
  which users.
Currently, the following events are supported:

User authentication (login/logout/request password)
Node operations (CRUD)
User operations (CRUD)
Menu operations (custom menu's and menu items CUD operations)
Taxonomy operations (vocabulary and term CUD operations)

The event log can be easily extended with custom events. For more
  information please have a look at the API documentation and the
  available sub modules.

There is no configuration required except for enabling/disabling the sub-modules you require - there is a sub-module for each of the 5 event types in the module description above.
Comment: Interesting alternative also. Not to hijack your answer, but can it be used as a [Rules](https://www.drupal.org/project/rules) action (to create an event log entry)?
Comment: @Pierre.Vriens there is currently no rules integration, there is only an API that developers can use to add their own event logs. It should be possible to develop an add-on rules integration module but I don't think one exists yet. It does come with views integration so you can easily create custom reports of the logged data.
Comment: Hm, you're confirming what I was guessing. However, as per the Views part of it, it seems to me that one might then consider using the "views_rules" module to possibly integrate the current version of this module with Rules. Something like this sample rule: "***If Rules Event X happens, and Y Rules Conditions are true, then perform a Rules Action to loop over all Event Log entries contained in some Views result and for each entry perform Rules Action Z***". THAT opens lots of new IFTTT-like scenarios!


How is the class loader set to load the files containing classes?

Question: I was trying to understand how Drupal 8 initializes the class loader to look for files containing classes in core/lib and modules/*/src.
I found out that the class loader is set to an instance of ApcClassLoader in DrupalKernel::initializeSettings().
  // If the class loader is still the same, possibly upgrade to the APC class
  // loader.
  // ApcClassLoader does not support APCu without backwards compatibility
  // enabled.
  if ($class_loader_class == get_class($this->classLoader)
   && Settings::get('class_loader_auto_detect', TRUE)
     && extension_loaded('apc')) {
    $prefix = Settings::getApcuPrefix('class_loader', $this->root);
    $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader);
    $this->classLoader->unregister();
    $apc_loader->register();
    $this->classLoader = $apc_loader;
  }

Following the methods that are called after that, I cannot find the exact method setting the class loader to correctly find the files containing Drupal classes. I expect it to be done from Drupal code, since the directory layout is very specific for Drupal.
Which method set the class loader to look in the right directories Drupal uses?
Comment: I am trying to port the code to Drupal 7, to use it in a module that would allow modules to use composer.json to load their dependencies and have a class loader that is based on the one Composer uses. I am using the composer.json file Drupal 8 comes with, as base.
Comment: The answer is simple: Magic
Comment: On a serious note: look inside the /core/composer.json file. It contains a class loader class, that is provided by drupal core.
Comment: @Eyal The only reference to a class loader I see there is for symfony/class-loader, which is one of the Symfony components.
Answer: For modules with composer dependencies in 7.x, try https://www.drupal.org/project/composer_manager. If you want to support modules with PSR-4 autoloading, see https://www.drupal.org/project/registry_autoload (integrates with the standard 7.x class loading registry) or https://www.drupal.org/project/xautoload.
That said, the code you pasted is just the APCu wrapper for the class loader. The actually relevant line is this, in \Drupal\Core\DrupalKernel::discoverServiceProviders():
$this->classLoaderAddMultiplePsr4($this->getModuleNamespacesPsr4($module_filenames));

What it does is register a PSR-4 namespace for each module with composer. Below that, everything follows the standard rules.
But composer dependencies is something else, that's handled automatically by composer's autoload.php and all the files that that then loads. Which is basically what composer_manager does, load the generated autoload.php file.
Comment: The Composer manager module does indeed creates the composer.json file from all the composer.json files used by modules; the problem is that does it in the server it is installed, which is not what I need.
Comment: I'm not sure what you mean with "does it in the server it is installed". While it's not the officially recommended approach, you can run composer manager & composer update/install anywhere and commit the result, then it's available everywhere, for everyone.


Solving for $x$ in terms of $y$ for equations involving quadratics, logarithms, and exponentials.

Question: For the equation:
$$y^2 = \frac{\ln(1 - xe^{xy^2})}{1 - xe^{xy^2}}$$
How might one go about solving for $x$ in terms of $y$? First, I attempted solving the equation by first performing the subsitution $u = xe^{xy^2}$, which then reduces the problem to: $$\frac{\ln(\frac{u}{x})}{x} = \frac{\ln(1 - u)}{1-u}$$
Unfortunately, I could not find where to go from there. Secondly, I tried multiplying both sides of the initial equation by $1 - xe^{xy^2}$ to obtain:
$$y^2-xy^2e^{xy^2} = \ln(1 - xe^{xy^2})$$
From here, I could subtract $y^2$ from both sides and divide by -1 to get the equation in a form where the product logarithm could be applied, but unfortunately the right hand side would contain both $x$ and $y$. Exponentiating both sides with base $e$ only seems to make the problem more convoluted and messy than it already is. So how might I go about actually solving this equation for $x$?
Answer: Considering $$y^2 = \frac{\ln(1 - xe^{xy^2})}{1 - xe^{xy^2}}$$ we could start defining $$z=1 - xe^{xy^2}\implies y^2=\frac{\log(z)}z$$ Solving for $z$
$$z=-\frac{W\left(-y^2\right)}{y^2}$$ where $W(.)$ is Lambert function.
So
$$1 - xe^{xy^2}=-\frac{W\left(-y^2\right)}{y^2}$$ and, again, Lambert function
$$x=\frac{W\left(y^2+W\left(-y^2\right)\right)}{y^2}$$
Do not ask me for $y(x)$, please !
Edit
Since you mention the product logarithm, I suppose that you can run Mathematica. If so,ask for the contour plot of
$$f(x,y)=y^2 - \frac{\ln(1 - xe^{xy^2})}{1 - xe^{xy^2}}=0$$ for $-\frac{1}{\sqrt{e}} \leq y \leq \frac{1}{\sqrt{e}}$ and $-1000 \leq x \leq  0$.
Answer: The substitution:
$$u=x\;\exp \left( x~y^{2}\right) =x\;\exp \left( x~v\right) ;\;v=y^{2}$$ is the the correct Ansatz here. This leads to:
$$\frac{\log \left( \frac{u}{x}\right) }{x}=\frac{\log \left( 1-u\right) }{1-u}$$ Application of the functional equation on the left hand side of the equation
leads to:
$$\frac{\log \left( u\right) }{x}-\frac{\log \left( x\right) }{x}=\frac{\log
\left( 1-u\right) }{1-u}$$
Now we substitute  $u$ on the left side of the equation:
$$\frac{\log \left( x\;\exp \left( x~v\right) \right) }{x}-\frac{\log \left(
x\right) }{x}=\left( v+\frac{\log \left( x\right) }{x}\right) -\frac{\log
\left( x\right) }{x}=v$$
and recognize, that the term: $\frac{\log \left( x\right) }{x}$ vanishes.
Now, we can solve for $u$
$$u=\frac{v+W\left( -v\right) }{v}$$
where $W\left( z\right) $ is the Lambert function  [Mathematica]
(http://functions.wolfram.com/ElementaryFunctions/ProductLog/27/02/) or
[Corless] (https://cs.uwaterloo.ca/research/tr/1993/03/W.pdf). In the end we
have to substitute  $u\rightarrow x\;\exp \left( x~v\right) $ and $v$ and
solve the equation for $x$
$$x=\frac{W\left( y^{2}+W\left( -y^{2}\right) \right) }{y^{2}}$$ Numerical comparisons for $y=0.316228$ e.g. $v=0.1$ confirms the result.
Comment: So I was a bit to late!


Loop dentro da Tabela PHP

Question: Bom dia!!!
Estou tentando criar um relatório de notas de alunos utilizando PHP, o fato é que criei uma tabela para que listasse as notas vertical dentro de um loop, porém pra cada aluno é gerado uma tabela, não estou conseguindo tabular o resultado lado a lado . Preciso também que a cada vez que mude o instrutor repita o cabeçalho, ou seja a cada 8 linhas...
Segue o código:
<?php include_once "con_odbc.php" ?>

Selecione o curso
   <form method="get" >
 <select name="data" id="data">

<?php

$tal=0;
$total =0;
$res=0;
$x=0;

$sqlquery=("SELECT apde.CadCrs.idCadCrs,
  apde.CadCrs.Abrev as Data,
  apde.CadCrs.Per,
  apde.CadCrs.DtIni,
  apde.CadCrs.DtFin,
  apde.CadCrs.Flag
FROM apde.CadCrs");
$res = odbc_exec($connect, $sqlquery);

while ($dados =odbc_fetch_array($res)) {
echo("<option value='".$dados['Data']."'>".$dados['Data']."</option>");
}
?>
</select>

 <input type="submit" name="OK" value="Mostrar">

<bgcolor='#FFFFCC'>
<input type='button'   value="IR PARA O FIM">

</form>

<TR bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
    Relatório de Notas

    <tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
    Id
    Curso
    Instrutor
    Critério
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36

<?php

if(isset($_GET["OK"])){
     $Data= $_GET["data"];

$contador = 0;

 $sqlquery=("SELECT Abrev, NomGue, TipAval, Aluno_1, Aluno_2, Aluno_3, Aluno_4, Aluno_5, Aluno_6, Aluno_7, Aluno_8, Aluno_9, Aluno_10, Aluno_11, Aluno_12, Aluno_13, Aluno_14, Aluno_15, Aluno_16, Aluno_17, Aluno_18, Aluno_19, Aluno_20, Aluno_21, Aluno_22, Aluno_23, Aluno_24, Aluno_25, Aluno_26, Aluno_27, Aluno_28, Aluno_29, Aluno_30, Aluno_31, Aluno_32, Aluno_33, Aluno_34, Aluno_35, Aluno_36 FROM APDE.apde.V_AvInstru  where Abrev = '$Data'  order by NomGue asc");
$res = odbc_exec($connect, $sqlquery);

while ($dados =odbc_fetch_array($res) )
{

    if($contador == 8)
    {
?>

        <tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
            ID

            Curso

               Instrutor

            Critério

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36

<?php
        $contador = 0;
    }

?>

        <tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#E4E4E4":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
            <?php echo $contador; ?>

            <?php echo $dados['Abrev']; ?>

               <?php echo $dados['NomGue']; ?>

            <?php echo $dados['TipAval']; ?>

            <?php echo $dados['Aluno_1']; ?>
            <?php echo $dados['Aluno_2']; ?>
            <?php echo $dados['Aluno_3']; ?>
            <?php echo $dados['Aluno_4']; ?>
            <?php echo $dados['Aluno_5']; ?>
            <?php echo $dados['Aluno_6']; ?>
            <?php echo $dados['Aluno_7']; ?>
            <?php echo $dados['Aluno_8']; ?>
            <?php echo $dados['Aluno_9']; ?>
            <?php echo $dados['Aluno_10']; ?>
            <?php echo $dados['Aluno_11']; ?>
            <?php echo $dados['Aluno_12']; ?>
            <?php echo $dados['Aluno_13']; ?>
            <?php echo $dados['Aluno_14']; ?>
            <?php echo $dados['Aluno_15']; ?>
            <?php echo $dados['Aluno_16']; ?>
            <?php echo $dados['Aluno_17']; ?>
            <?php echo $dados['Aluno_18']; ?>
            <?php echo $dados['Aluno_19']; ?>
            <?php echo $dados['Aluno_20']; ?>
            <?php echo $dados['Aluno_21']; ?>
            <?php echo $dados['Aluno_22']; ?>
            <?php echo $dados['Aluno_23']; ?>
            <?php echo $dados['Aluno_24']; ?>
            <?php echo $dados['Aluno_25']; ?>
            <?php echo $dados['Aluno_26']; ?>
            <?php echo $dados['Aluno_27']; ?>
            <?php echo $dados['Aluno_28']; ?>
            <?php echo $dados['Aluno_29']; ?>
            <?php echo $dados['Aluno_30']; ?>
            <?php echo $dados['Aluno_31']; ?>
            <?php echo $dados['Aluno_32']; ?>
            <?php echo $dados['Aluno_33']; ?>
            <?php echo $dados['Aluno_34']; ?>
            <?php echo $dados['Aluno_35']; ?>
            <?php echo $dados['Aluno_36']; ?>

<?php
    $contador++;
}}
?>

Answer: Olá... não tenho como verificar se ficou certo... fiz o possível. Sei que é bastante fácil a gente se perder quando esta trabalhando em um arquivo assim, com PHP e HTML misturado.. Segue o que consegui fazer.. por favor, verifique se ficou correto. E tente cuidar mais a estrutura do seu código. Tinha tags cruzadas, e tr's perdidos e abertura de tables a mais..
<?php include_once "con_odbc.php" ?>

Selecione o curso

<form method="get">
    <select name="data" id="data">
        <?php

            $tal=0;
            $total =0;
            $res=0;
            $x=0;

            $sqlquery=("SELECT apde.CadCrs.idCadCrs,
            apde.CadCrs.Abrev as Data,
            apde.CadCrs.Per,
            apde.CadCrs.DtIni,
            apde.CadCrs.DtFin,
            apde.CadCrs.Flag
            FROM apde.CadCrs");
            $res = odbc_exec($connect, $sqlquery);
        ?>
        <?php  while ($dados =odbc_fetch_array($res)): ?>
        <option value='".$dados[' Data ']."'>
            <?= $dados['Data'] ?>
        </option>
        <?php endwhile; ?>
    </select>
    <input type="submit" name="OK" value="Mostrar">

</form>

 <bgcolor='#FFFFCC'>
<input type='button' value="IR PARA O FIM">

                    <TR bgcolor="<?php echo ($ac_sw1++%2==0)?" #E4E4E4 ":"#FFFFFF "; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">

                                    Relatório de Notas

                    <tr bgcolor="<?php echo ($ac_sw1++%2==0)?" #E4E4E4 ":"#FFFFFF "; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
                        Id
                        Curso
                        Instrutor
                        Critério
                        1
                        2
                        3
                        4
                        5
                        6
                        7
                        8
                        9
                        10
                        11
                        12
                        13
                        14
                        15
                        16
                        17
                        18
                        19
                        20
                        21
                        22
                        23
                        24
                        25
                        26
                        27
                        28
                        29
                        30
                        31
                        32
                        33
                        34
                        35
                        36

                    <?php if(isset($_GET["OK"])): ?>

                    <?php
                            $Data= $_GET["data"];

                            $contador = 0;

                            $sqlquery=("SELECT Abrev, NomGue, TipAval, Aluno_1, Aluno_2, Aluno_3, Aluno_4, Aluno_5, Aluno_6, Aluno_7, Aluno_8, Aluno_9, Aluno_10, Aluno_11, Aluno_12, Aluno_13, Aluno_14, Aluno_15, Aluno_16, Aluno_17, Aluno_18, Aluno_19, Aluno_20, Aluno_21, Aluno_22, Aluno_23, Aluno_24, Aluno_25, Aluno_26, Aluno_27, Aluno_28, Aluno_29, Aluno_30, Aluno_31, Aluno_32, Aluno_33, Aluno_34, Aluno_35, Aluno_36 FROM APDE.apde.V_AvInstru  where Abrev = '$Data'  order by NomGue asc");
                            $res = odbc_exec($connect, $sqlquery);
                    ?>
                        <?php while ($dados =odbc_fetch_array($res) ): ?>
                        <?php if($contador == 8): ?>

                        <tr bgcolor="<?php echo ($ac_sw1++%2==0)?" #E4E4E4 ":"#FFFFFF "; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">
                            ID
                            Curso
                            Instrutor
                            Critério
                            1
                            2
                            3
                            4
                            5
                            6
                            7
                            8
                            9
                            10
                            11
                            12
                            13
                            14
                            15
                            16
                            17
                            18
                            19
                            20
                            21
                            22
                            23
                            24
                            25
                            26
                            27
                            28
                            29
                            30
                            31
                            32
                            33
                            34
                            35
                            36

                        <?php $contador = 0; endif; ?>

                        <tr bgcolor="<?php echo ($ac_sw1++%2==0)?" #E4E4E4 ":"#FFFFFF "; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor=''">

                            <?= $contador; ?>
                            <?= $dados['Abrev']; ?>
                            <?= $dados['NomGue']; ?>
                            <?= $dados['TipAval']; ?>
                            <?= $dados['Aluno_1']; ?>
                            <?= $dados['Aluno_2']; ?>
                            <?= $dados['Aluno_3']; ?>
                            <?= $dados['Aluno_4']; ?>
                            <?= $dados['Aluno_5']; ?>
                            <?= $dados['Aluno_6']; ?>
                            <?= $dados['Aluno_7']; ?>
                            <?= $dados['Aluno_8']; ?>
                            <?= $dados['Aluno_9']; ?>
                            <?= $dados['Aluno_10']; ?>
                            <?= $dados['Aluno_11']; ?>
                            <?= $dados['Aluno_12']; ?>
                            <?= $dados['Aluno_13']; ?>
                            <?= $dados['Aluno_14']; ?>
                            <?= $dados['Aluno_15']; ?>
                            <?= $dados['Aluno_16']; ?>
                            <?= $dados['Aluno_17']; ?>
                            <?= $dados['Aluno_18']; ?>
                            <?= $dados['Aluno_19']; ?>
                            <?= $dados['Aluno_20']; ?>
                            <?= $dados['Aluno_21']; ?>
                            <?= $dados['Aluno_22']; ?>
                            <?= $dados['Aluno_23']; ?>
                            <?= $dados['Aluno_24']; ?>
                            <?= $dados['Aluno_25']; ?>
                            <?= $dados['Aluno_26']; ?>
                            <?= $dados['Aluno_27']; ?>
                            <?= $dados['Aluno_28']; ?>
                            <?= $dados['Aluno_29']; ?>
                            <?= $dados['Aluno_30']; ?>
                            <?= $dados['Aluno_31']; ?>
                            <?= $dados['Aluno_32']; ?>
                            <?= $dados['Aluno_33']; ?>
                            <?= $dados['Aluno_34']; ?>
                            <?= $dados['Aluno_35']; ?>
                            <?= $dados['Aluno_36']; ?>

                        <?php $contador++; endwhile; endif; ?>

Comment: Olá, obrigada pelo empenho e pelas dicas, fiz o teste por aqui e o erro permanece continua repetindo as tabelas para cada aluno...

Loop dentro da Tabela PHP


sending multiple tracking requests at one time

Question: I am tracking some data on mobile so I'd like to save the traffic as much as possible for my users.
Say I want to update 5 tracking information at once, I wrote:
<code>_gaq.push(['_trackPageview', '/item-a']);
_gaq.push(['_trackPageview', '/item-b']);
_gaq.push(['_trackPageview', '/item-c']);
_gaq.push(['_trackPageview', '/item-d']);
_gaq.push(['_trackPageview', '/item-e']);
</code>
I will send 5 requests. Is there anyway to save this by simply changing the way I track, for example, like this:
<code>_gaq.push(['_trackPageview', ['/item-a', '/item-b', '/item-c', '/item-d', '/item-e']]);
</code>
Thanks for any kind of tips!
Comment: Note that you should be careful sending multiple requests to GA at a time. GA limits you to sending 10 requests every 5 seconds per visitor. So if you something like you have above in multiple places, it's increasingly likely you'll hit that limit and your requests will start getting dropped.
Answer: Closest you'll get:
<code>_gaq.push(
  ['_trackPageview', '/item-a'],
  ['_trackPageview', '/item-b'],
  ['_trackPageview', '/item-c'],
  ['_trackPageview', '/item-d'],
  ['_trackPageview', '/item-e']
);
</code>
Comment: Well, it'll push all of those items into the queue to send to Google Analytics in one go. However the data that is sent to GA is still broken out into multiple pings. GA doesn't have a way to compact multiple events into one ping. :(
Comment: Great, thanks! That's already very helpful. Currently no need to save event requests.


$\sum_{n=1}^{\infty} X_n < \infty$ almost surely implies $\sum_{n=1}^{\infty} \mathbb{E}(X_n^2)<\infty$

Question:
Suppose $X_1,X_2,\dots$ are independent random variables such that $EX_n=0$ and $Var(X_n)=\sigma_n^2<\infty$ for all $n\geq 1$. Assume that $\vert X_n(w)\vert \leq K$ for all $n\geq 1$ and all $w\in \Omega$ where $K$ is some non-random positive number. Let $X_0=0, S_0=0, A_0=0$, and $S_n=\sum_{k=1}^n X_k$ and $A_n=\sum_{k=1}^n \sigma_{k}^2$. Suppose $F_n:=\sigma(X_1,\dots,X_n)$ and $F_0=\{\emptyset, \Omega \}$.
Prove the following statement: If $\sum_{n=1}^\infty X_n$  converges almost surely,  then  $\sum_{n=1}^\infty \sigma_n^2 <\infty$.

Firstly, I showed $S_n^2 -A_n$ is a martingale with respect to $F_n$.
Since $S_n^2 = (S_n^2 -A_n) + (A_n)$ and $S_n^2 - A_n$ is a martingale, I could get $ES_n^2 =EA_n$.
By using the property, I also could get $E(A_{min(n,N)}) \leq (K+c)^2$  for some c>0 where $$N:=\inf\{n\geq 1 : \vert S_n \vert \geq c \}.$$
In Hint, the problem can be solved by the propery $E(A_{\min(n,N)}) \leq (K+c)^2$.
I don't know how to apply the property to my problem...
Any help is appreciated..
Thank you!
Answer: Since
$$\mathbb{E}(A_{\min\{N,n\}}) \leq (K+c)^2$$
it follows from Fatou's lemma that
$$\mathbb{E}(A_{N}) \leq (K+c)^2.$$
As the series $\sum_{n \geq 1} X_n$ converges almost surely, we can choose $c>0$ such that $N=N(c)$ satisfies $\mathbb{P}(N=\infty)>0$. For such $c$ we get
$$\mathbb{P}(N=\infty) \sum_{n \geq 1} \sigma_n^2  \leq \mathbb{E}(A_N) \leq (K+c)^2$$
implying
$$\sum_{n \geq 1} \sigma_n^2 \leq \frac{1}{\mathbb{P}(N=\infty)} (K+c)^2 < \infty.$$


Diatonic harmonica: How to play the draw bend with the three semitones down (effectively)?

Question: For the diatonic harmonica, in the 3rd draw position B, how to play the draw bend with the three semitones down (marked in blue rectangle) B, Bb, A?
I could play a semitones down, most easily in the 1st draw position D, for the C#.
If there are illustrative pictures, that will be nice.
Answer: The best method for teaching bends I know of is to imagine drinking through a straw. In normal play, you softly drink water. To bend, you don't need to draw much harder, but you change the drink to milkshake. Drinking the more viscose drink requires tensing the mouth somewhat, even though you drink slowly.
The technique to bend hole 3 is basically the same as bending any of the other holes 1 to 6, but more precision is required.
Some theory might be useful to understand why.
The sound of a harmonica is produced by reeds mounted over reed slots. When air flows over the reed and pulls it into and through the slot, it starts to vibrate and a tone sounds. Each hole has two reeds, one mounted on the outside and one mounted on the inside. During normal play, the inside reed sounds when you blow, pushing it into its slot, and the outside reed sounds when you draw, sucking it into the slot.
A harmonica reed can, however, also be made to sound with air travelling in reverse, pulling the reed out of the sot instead, which produces a note about one half step sharper that produced in normal play.
Additionally, the tone of each reed is somewhat flexible, and can be changed somewhat away from its natural frequency by the player.
When you draw bend in hole 1, the sound comes from both reeds. The D reed sounds a bit flatter than its natural tone, and the C reed is played in reverse to produce a C#. The two reeds work together in a kind of resonance, giving a stable note that is relatively easy to maintain.
Bending hole 3 is a bit different. When you start bending the B down to a B♭, most of the sound comes from the B reed being "brought out of its comfort zone". If you go all the way down to the A♭, most of the sound is produced by the G reed working in reverse. To produce the A, neither reed can work at a frequency where it's "comfortable", and the tone becomes less stable. Bending the tone of a reed far from it's natural frequency is harder than bending it a little bit, especially if your instrument is not well set up, making the A in hole 3 one of the harder notes to play.
Understanding these principles, it becomes clearer why the B♭ is easier to produce than the A, and why you might feel the A♭ is the easiest bend to hold and play cleanly, as the G reed working in reverse actually sounds at its natural frequency.
Comment: Even thought I've never had a milkshake I think that's the perfect analogy. Good answer
Comment: Thanks! So you really can play 3rd draw position B with the three semitones down (marked in blue rectangle) B, Bb, A?
Comment: I feel that the three semitones down seem very challenging...
Comment: @wonderich You absolutely can! My only caveat is that you need a fairly well set up harmonica. A good Seydel, Hohner or Suzuki should work well out of the box, but a 5€ harp bought at the gas station might put up more of a challenge. I personally think bending three semitones down is easier than bending one semitone down, especially if you want to play a clean note, but someone might disagree. Both the B♭ and the A♭ are definitely easier to play cleanly than the A thoug.
Comment: I have a Fender Blues Deluxe 10 in C, also Hohner 64 Chromatica. Does the Fender work? (btw I voted up +1)
Comment: Could you comment also on draw bending hole 2? I can do draw bending for hole 1 and hole 2.
Comment: p.s. I will accept the answer in a week if no better answer. thanks! :)
Comment: @wonderich I've not played The Fender Blues Deluxe, so it might be great, but seeming to be on the cheaper side i wouldn't count on it performing well for the larger bends out of the box. The Chromonica is a chromatic harmonica, which is really a different instrument, I would say it relates to a blues harp more or less like an electric guitar relates to a mandolin. It does have bends, but they are rather different. I touch on that subject in your other question https://music.stackexchange.com/questions/124506/diatonic-harmonica-draw-bends-from-hole-1-to-hole-6-principles
Comment: So I was using Fender Blues Deluxe Harmonica (about $15). Is Hohner Blues Harp Harmonica that you recommended (about $35)? [btw I also like juggling and doing math!] Do you mind naming a precise one Harmonica for capable of doing those bends? Thanks! :)
Comment: How about Lee Oskar? Hohner super 20?
Comment: People always disagree on which models are best, but both Lee Oscar and Hohner Special 20 are good harps. Perhaps the LO's are a bit more controversial, as in that some people love them and some hate them. Starting from somewhere in that price range, most models are decent.


What do I call this type of transition?

Question: I'm a complete novice to composing and music theory, but part of what I'd like to do is acquire the vocabulary to describe subtle changes in sound, especially ones that evoke a distinct emotion.
For instance, this is an orchestration of "Don't Cry For Me Argentina" :
video here, and the main melody at 1:41 goes from a more proud and triumphant sound down into a much more mournful tone at around 1:51. The corresponding lyrics would be "All through my wild days, my mad existence..." The lowest notes especially just sink right into my gut (to wax poetic). What causes this sensation? What kind of harmonics are at work here? What would you call this bittersweet sound, like someone proudly standing to meet their end?
[I know this goes directly against the "please don't ask about X" rules, but I want to at least try, rather than giving up completely. If anyone knows of a more relevant website where I can get these kinds of questions answered without cluttering up this one, I'd appreciate any tips. Thank you for your time.]
Comment: Hi ScherzoCapriccioso. Welcome to the site. IMO, this is a perfectly fine question for us, though I did remove the part of your title that asked for additional resources. That part is considered "off-topic".
Comment: Good to know! Thank you for clearing that up for me!
Answer: Actually, I'd challenge the idea that harmony doesn't have much to do with it. When I read the question before watching the video, I assumed the emotive contrast you described would come with a big change in register, orchestration, or dynamics, but all those are pretty consistent between the time points you mentioned. What does change is: "Don't cry for me Argentina / The truth is I never left you" is all just the "tonic" chord, the "I." This is the "home" chord, the tonality that is most grounded and at rest. Then "All through my wild days" is the dominant (V)—leaving home, as it were, and bringing a degree of unsettledness—followed by the vi for "my mad existence." The dominant is the second most "settled" chord after the tonic, a "home away from home" if you will, and ultimately sets up a desire to get back to the tonic. But instead of "home"—our comfortable major-key major chord—the dominant is followed by vi, a minor chord. If this happened at the end of a phrase, where "I" was even more expected, it would be called a deceptive cadence—we think we're going home and are tricked, wandering into greater tonal instability.
Now, this is reading a lot into three chords, especially within one phrase. (It's interesting to look ahead to the ultimate end of the phrase, "Don't keep your distance," which will still never get back home, but end on IV!) The fact that a little deceptive motion within the phrase strikes you so viscerally suggests that you're sensitive to harmonic motion, in a good way.
It's also true that the things I mentioned at first can have even more emotive impact—a sudden reduction in volume after a sweeping crescendo, or a large change in register. (The final line of the verse, "Don't keep your distance," drops an octave from the previous note.)
Comment: Outstanding association between the functional meaning of the chords and the literal meaning of the lyrics.
Comment: I think what you are describing most closely relates to what I'm attempting to understand here. If you have the time could you tell me a little more about harmonic motion? Thank you.
Comment: @ScherzoCapriccioso There's so much to tell, and this isn't the easiest place for it! I highly recommend starting at the ground level with some tonal theory. If you don't already know the full implications of words like "tonic," "dominant," or "cadence," or the significance of roman numerals I and V compared to, say, IV or vii, then I suggest jumping into a basic theory course. https://www.musictheory.net/ is very thorough (if a bit dry); there are probably also some great youtube resources. Just make sure to start at the beginning, as every concept builds on another (notes -> chords -> keys)
Answer: There's no particular name for what you're hearing, but here are what I interpret as the main contributors:
Melody
In the part corresponding to the lyrics "Don't cry for me, Argentina" (1:41 – 1:51), the notes move primarily upward. An illustration might look like this:

However, in the "All through my wild days" part, the melody moves prominently downward, giving a sense of sinking emotionally.

Rhythm
In the first, "Don't cry for me" part, the lyrics are accompanied by a tango rhythm. There's rhythmic movement, some syncopation ("unexpected" placement of notes) ... a dance-like feel.
In the "All through my wild days" part, the tango goes away and is replaced by long, held notes. This shifts the mood from lighter to darker.
Lyrics
"Don't cry for me, Argentina. The truth is I never left you." The focus here is on Argentina. She's speaking to the whole country.
"All through my wild days, my mad existence, ...." This shifts the focus to Evita and her feelings. It's more inward.
Harmony
I don't find the harmony an especially large contributor here. There is an initial shift lower ("all through my wild days"), which does give a "sinking" feeling, and then to a minor harmony ("my mad existence"), which typically connotes sadness, but I think the harmony here plays primarily a supporting role rather than a driving one.
Answer: how about catharsis?
https://en.wikipedia.org/wiki/Catharsis
In addition to Aaron's answer I'd like to focus on three elements:

Text and form: Verse-Verse-Refrain: I'd assume that we know the tune
of the refrain, and we are longing to hear it finally. The lyrics are
touching: don't cry ... and the mother/father-country! (This is a
myth in everybodys heart.) As we know the tune of the refrain, this is a dejavu  or better a déjà-entendu). That's why we prefere places we have already been, smiling faces  ...  we have know from old days. Recognation=feeling at home.
The art is to write a tune, that evokes this feeling.

Harmony: the parent chord of the tonality (tonic) is very rarely appeared until the refrain. (Relative key, secondary dominants ..) When it finally arises, the melody is circling around it and we feel at home!

The instrumentation: In the refrain the melody is played also in unison by the violoncellis, that gives the impression of a chorus (choir): the whole nation will sing along now.

I know this technique very well from gospel services:
Make the people suffering for the chorus :), speaking longer than needed, the piano or organ is preluding with chords, the preacher is going on preaching, and finally the chorus enters. I think this formal aspect roots back to the plain chant, with introitus, responsorial, credo, halleluja etc. and cantatas with sinfonias, rezitatives,  solo aria and the final choral.
Similar experiences we make when listen to a solo concerto or symphony, and after the climax ... the cadenza ... the original theme enters again. Coming home!
So, you must be a manipulator or a great pretender: create an ear worm as a refrain, then write long verses that contain elements and motifs that keep the musicians and the auditory on the tenterhooks and play with their feelings and longings until you will release and relaxe them by the resolution, like the in the drama the crisis is the point of the climax. (Drama, Rhetoric, Fascism, ...)
Looking for a name  I would say this is a kind of katharsis
https://www.linguee.com/german-english/translation/katharsis.html

What do I call this type of transition?


How to set PYTHONPATH in Windows?

Question: I tried to run a .py file by typing python twitterstream.py > output.txt in the command prompt of windows 10. It then said
fatal python error: Py_Initialize: unable to load the file system codec
File "C:\Python27\Lib\encodings\__init__.py", line 123 raise CodecRegistryError,\
SyntaxError: invalid syntax

From what I saw through a google search, the solution may be to change the PYTHONPATH env variable. However, I had PYTHONPATH set to C:\Python27 for both the user and system variables, but I still get the same error in the command prompt
I also read http://bugs.python.org/issue11288, and tried to change all PYTHONPATH system variable which originally pointed to C:\Python27 and changed it to C:\Python34 but that didn't solve the problem
I then followed https://docs.python.org/3/using/windows.html#python-launcher-for-windows, but when I type py it says Python 2.7.9 .., but for py -3 I get a popup saying python.exe has stopped working and
 fatal python error: Py_Initialize: unable to load the file system codec
File "C:\Python27\Lib\encodings\__init__.py", line 123 raise CodecRegistryError,\
SyntaxError: invalid syntax

also, py hello.py says from python 2.7.9 ..., but changing #! python to #! python3 gives the same error I said before
Even if I set PATH AND PYTHONPATH user variables to C:\Python34;C:\Python27;C:\Python27\Scripts;C:\Python34\Scripts, along with the PythonPath system variable to C:\Python34;C:\Python27;C:\Python27\Scripts;C:\Python34\Scripts, but the error was the same as before
Comment: It seems you have `PYTHONHOME` set to `C:\Python27`. Generally there's no reason to set either `PYTHONPATH` or `PYTHONHOME`, not with the official Python distributions. Unset these variables. There are better ways to manage `sys.path` for a particular installation that don't cause such conflicts.
Comment: i don't see `PYTHONHOME` as an environment variable. And when you say unset, you mean delete them? When I tried that on `PYTHONPATH`, I got the same error as before
Comment: I can reproduce the error if I first enter `set "PYTHONHOME=C:\Python27"`. This overrides Python's default `sys.prefix`, by which it finds its standard library. Python 3 obviously can't use Python 2's standard library. In the command prompt enter `set PYTHON`. Does this list `PYTHONHOME` or just `PYTHONPATH`? If it's just `PYTHONPATH`, that should not cause that error when running `py -3`. Something else is wrong.
Comment: when I enter `set PYTHON` it says `Environment variable PYTHON not defined`
Comment: That means neither `PYTHONHOME` nor `PYTHONPATH` is set. In that command prompt do you get the error for `py -3`?
Comment: no, theres no error anymore when I type `py -3`. I guess changing the `path` user variable to `C:\Python27;C:\Python27\Scripts;` and then restarting helped. However, when I type `twitterstream.py > output.txt`, I don't get the error message anymore. However, I don't think it worked properly because there should be some content in `output.txt`, but it is still blank. The full code is: https://github.com/uwescience/datasci_course_materials/blob/master/assignment1/twitterstream.py. So this is using Py2?
Comment: Yes, that's obviously Python  2 code, since it's using `print` as a statement instead of as a function, and `urllib2` isn't in Python 3's standard library. To ensure it runs with Python 2, add the shebang `#!/usr/bin/python2` on the first line.
Comment: I added that shebang and ran `twitterstream.py > output.txt`, but `output.txt` is still empty
Comment: Create a simple test.py that executes `import sys; print(sys.executable)` and run it as `test.py > test.txt`.
Comment: I tried that, but `test.txt` is empty
Comment: Try `C:\Python27\python.exe test.py > test27.txt` and `C:\Python34\python.exe test.py > test34.txt`.
Comment: the output for `test27.txt` is `C:\Python27\python.exe` and `test34.txt` output is `C:\Python34\python.exe`
Comment: What's the output of `assoc .py`?
Comment: Normally .py files are associated with `Python.File`, a progid that's created by Python's installer. Python 3, when installed for all users, sets this to run `"C:\Windows\py.exe" "%1" %*`, which you can check by entering `ftype Python.File`. In your case, check `ftype PyCharmCE40` to see how your system is configured to run .py files. Note that your per-user setting can be different and will override this system setting.
Comment: I don't know why its set to PyCharm. I don't even use PyCharm as I use Ninja instead. Would un-installing it help? Anyway, `ftype PyCharmCE40` gives `PyCharmCE40=C:\ProgramFiles(X86)\JetBrains\PyCharm Community Edition 4.0.5\bin\pycharm.exe "%1"` and `ftype Python.File` gives `Python.File="C:\Python27\python.exe" "%1" %*`
Comment: Assuming you don't have per-user settings that override this, you should be able to switch to using the py launcher by running `assoc` and `ftype` in an administrator command prompt. First, what's the output of `where py.exe`?
Comment: the output is `c:\windows\py.exe`
Comment: Good, that's the default for an all-users installation. Enter `assoc .py=Python.File` and then `ftype Python.File="C:\Windows\py.exe" "%1" %*`. That should set things right.
Comment: For the first one, I got `access is denied. error occurred while processing .py`. And I got a similar error for your second command
Comment: You need to use an administrator command prompt.
Comment: ok, that works now. However, `twitterstream.py > output.txt` still leaves `output.txt` as empty
Comment: What do you get for `test.py > test.txt`?
Comment: You checked that `assoc .py` and `ftype Python.File` are now correct? If so you probably have a per-user setting that's overriding the system setting. Check Control Panel => Default Programs => Set Association, and try to change .py to use "Python File".
Comment: I don't understand how to do that. In `Set Associations` I see `.py` has a description of `PY File` and Ninja is the current default. I don't see how I can change it to "Python File". Unless you mean have Python Launcher for Windows open it instead of ninja?
Comment: Yes, you configured `Python.File` to open with the py.exe (Python Launcher for Windows); just change your per-user setting to the same.
Answer: For some reason by typing only the "py" file name in the command prompt it worked for me. So I typed myScript.py  and it ran correctly. Before this I typed "python myScript.py" and it produced the same error that you experienced. I have the environment variables set PYTHONPATH=c:\python27 and PYTHONHOME=c:\python27. I hope this helps.
Comment: On Windows, `py` is the Python Launcher. This is specific tool for Windows made and shipped with Windows installers to find and use different versions of Python. Linux uses shebangs to tell the OS what program to use to run a file whereas Windows uses file extensions (this is why in Linux you don't always need a file extension). The launcher helps overcome portability issues when developing code for Linux and Windows (more info is in PEP397). Typing just `python` for you executes `C:\python27\python.exe` because you added it to your path.
Answer: At the start of your program include the line
#!/usr/bin/python3

Windows will use this to run your code in Python 3.4 rather than 2.7
Comment: but even if I try that on `twitterstream.py`, I get the same error. I also got that error for `hello.py` as explained in that python documentation page I linked to
Comment: don't run it as python twitterstream.py, just run twitterstream.py from the command prompt and it should launch python3 instead of the default 2.7
Comment: ok with that, I don't get the error message anymore. However, I don't think it worked properly because there should be some content in `output.txt`, but it is still blank. The code for `twitterstream.py` is https://github.com/uwescience/datasci_course_materials/blob/master/assignment1/twitterstream.py
Comment: do you get the correct output without piping output to your text file?  Windows tends to leave the output file empty until the process finishes, so if it takes a long time it can look like its failed (esp if running from task schedular)
Comment: when I run `twitterstream.py` in Ninja, in the output I see some HTML content, which I assume is the correct output. However, `output.txt` is still empty
Comment: try running it from a windows command prompt to confirm you get the output. Then, still in command prompt, run to output.txt. Then try it in Ninja
Comment: running just `twitterstream.py` in the command prompt, I get no output or anything in the prompt. Could the problem be because I probably have a per-user setting that's overriding the system setting and I need to change .py to use "Python File"?
Comment: possibly - I assumed python3.4 was installed ok - maybe check that first with a simple program and make sure the output gets piped ok.

How to set PYTHONPATH in Windows?


Download file from field instead of going to node page

Question: What I'm trying to achieve is: create a new content of type arquivo, then when accessing the new content url, instead of showing a page with the fields and etc., the file from a field_file is opened/downloaded. Tried to achieve this using a custom template for the content type with no success.
The code for the tpl.php is:
<code><?php
$items = field_get_items('node', $node, 'field_arquivo');
$filepath = $items[1]['uri'];
$path = file_create_url($filepath);
drupal_goto($path);
?>
</code>
Any help is appreciated
Answer: You could make a custom module and put this function in it
<code>/**
 * Implements hook_node_view().
 */
function custom_tweaks_node_view($node, $view_mode, $langcode) {
  if ($node->type == 'arquivo' && $view_mode == 'full') {
    $file = $node->field_file[$langcode][0]['uri'];
    if ($file) {
      $file_uri = file_create_url($file);
      drupal_goto($file_uri);
    }
  }
}
</code>
Comment: A simple change that would make it more portable is changing `'und'` for `$langcode`. In case anyone is dealing with a site with multiple languages.
Comment: Updated the function with a check if there is a file present on the node and to only redirect when the full node is being displayed.
Comment: But ofcourse. I updated the code @rovr138.


How to get the unique row value and return boolean result in python pandas?

Question: I have a dataframe:
Table     A    B    C
Round     0.2  0    1
Triangle  3    3    3
Penta     1    1    1

I wish to get the result like below:
Which mean if the unique value for column A to C is result in only one value then return false, if more than one return true. In conclusion, if the value for column A is equal to B and equal to C, then return false.
Table     A    B    C    Result
Round     0.2  0    1     True
Triangle  3    3    3     False
Penta     1    1    1     False

Anyone have ideas?
Answer: You can compare last 3 columns by last column with not equal by ne (!=) and then add DataFrame.any for check at least one True per rows:
print (df)
      Table    A  B  C  Result
0     Round  0.2  0  1    True
1  Triangle  3.0  3  3   False
2     Penta  1.0  1  1   False

df['Result'] = df.iloc[:, -3:].ne(df.iloc[:, -1], axis=0).any(axis=1)
print (df)
      Table    A  B  C  Result
0     Round  0.2  0  1    True
1  Triangle  3.0  3  3   False
2     Penta  1.0  1  1   False

Detail:
print (df.iloc[:, -3:].ne(df.iloc[:, -1], axis=0))
       A      B      C
0   True   True  False
1  False  False  False
2  False  False  False

If first column is index, solution is simplify and is possible compare all columns with any column:
df['Result'] = df.ne(df.iloc[:, -1], axis=0).any(axis=1)

print (df)
            A  B  C  Result
Table
Round     0.2  0  1    True
Triangle  3.0  3  3   False
Penta     1.0  1  1   False

Comment: @pyd - It is last column, give me a sec for explanation
Comment: why `df.iloc[:, -1]`
Comment: @pyd - Thank you.


help interpret interaction effect in linear mixed effect

Question: I am trying to predict response time (transformed in Log) from Group (a factor with two levels: NS and NNS), and Time of Testing (a factor with three levels: Pretest, Posttest, Delayed-test), using linear mixed effect model. The slope coefficient for Group was (-0.455006) suggesting that NNS (the reference level) had larger RT than NS. The slop coefficient for Time of Testing was: -.25 for from Pretest to Posttest, and -.35 from Pretest to Delayedtest. Both coefficient for Group and Time of testing were signifiant. There was also signifiant interaction. The model output is posted below:
<code>Fixed effects:                           Estimate     Pr(>|t|)
(Intercept)                              8.033121  < 0.0000 ***
GroupNS:                                -0.455006    0.00195 ***
Time_of_TestingPosttest:                -0.252902    0.00 ***
Time_of_TestingDelayedtest:             -0.393049    0.000 ***
Item_TypeAr:                             0.027541    0.459570
Item_TypeCong:                          -0.057590    0.202765
Item_TypeEng :                          -0.056005    0.097206 .
scale(Length) :                          0.056470    0.00000189729 ***
scale(Prof_Voc):                        -0.199754    0.000234 ***
scale(AssocFor):                         0.007124    0.624079
scale(PhraseChoice_Norming_NNS):        -0.030128    0.029637 *
scale(For_Comp_Norming_NNS_PERC):       -0.045862    0.019740 *
scale(Back_Comp_Norming_NNS_PERC):      -0.027450    0.088654 .
GroupNS:Time_of_TestingPosttest:         0.125559    0.00***
GroupNS:Time_of_TestingDelayedtest :     0.128348    0.00 ***
GroupNS:Item_TypeAr :                    0.152143    0.00***
GroupNS:Item_TypeCong:                   0.067548    0.00 **
GroupNS:Item_TypeEng:                   -0.125478    0.000 ***
Time_of_TestingPosttest:Item_TypeAr:    -0.118301    0.00 ***
Time_of_TestingDelayedtest:Item_TypeAr: -0.007223    0.80
Time_of_TestingPosttest:Item_TypeCong:  -0.057250    0.03 *
Time_of_TestingDelayedtest:Item_TypeCong 0.015867    0.56
Time_of_TestingPosttest:Item_TypeEng    -0.066561    0.017 *
Time_of_TestingDelayedtest:Item_TypeEng  0.018056    0.51
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
</code>
1.) My first question, what does the positive sign in the interaction indicate? How can the positive + or negative - be used to understand the interaction effect relationship?
I had difficulty understating what the slope coefficient mean, so I plotted the graph below.

) However, I still don't see any interaction effect in the sense that Group depends on Time, or vice versa. I would really appreciate your kind assistance in interpreting the interaction  coefficient based on the plot
Comment: Can you post your model output in its entirety in your original question?
Answer: What the interaction is saying is that the two lines are not parallel - and they are not. In particular, the difference between pre and post is larger for NNS than for NS.
An interaction is not "that group depends on time" it is that the effect of time is different in the different groups and the effect of group is different at different times.
One point is that the difference between groups is largest at the pretest. Were the subjects assigned at random?  Did you use a multilevel model?
Comment: Thanks a lot Peter for your kind reply and clarification. To answer your question, I have used a multilevel modeling allowing the intercepts of subjects and items to vary. I think the large difference in the Pretest (Pre-treatment) between groups is due to the fact that NS are English native speakers and NNS are non-native speakers, and they are being testing on their response times when they read English words. Just a quick follow up question on your explanation for the interaction, how can we explain the interaction relationship if the slope sign was negative? Thanks again for your help.
Comment: The slope was negative because the scores are going down. But one group is going down less.
Comment: Thanks again Peter for your kind reply, and thanks for your patience. Your kind comment about the negative slope in the interaction captures the trend in the plot clearly,  however,  the coefficient I got for the interaction was not negative, it was a positive +0.125559 for Posttest and a positive +0.128348 for the delayed. Does the symbol (+) or (-) really matter in understating the direction of interaction? Thanks a lot for your assistance  and I do really apologize for the many questions.
Comment: Yes. The + or - indicates which group was slower or faster in decline


Can Reducer read the same order af mapper output instead of group unique keys with values?

Question: I have a basic understanding of how Hadoop order the data from Mapper to Reducer.
I have the following data written to context Mapper. The below data is a key, value pair
abc 1234
cde 2394
dec 8273
abc 2348
cde 8780
dec 6590

Key's abc, cde, dec continuous for n-times with same or different values.
Reducer reads in key with group of values. I.e
abc {1234, 2348, ...} and so on with other keys.

Question: Is there a possibility of reading data into reducer in a same order of Mapper output, instead of unique keys group with values ?
Comment: Are you using combiner in the middle? You won't get abc(1234,2348) without combiner in place.
Comment: What is your requirement?... If need the same order you can skip using reducer and just have the mapper in place
Comment: @madhu, you are right. But, my file contains some header in the beginning, which would be processed by a mapper. Data thereafter is related to the header. I need to process data based on header.
Comment: After reading the header, why can't you use Partitioner, Combiner & Sorter? Sorting the values before Reducer receiving the inputs is more efficient than sorting at Reducer
Answer: If you are required to process the data based on header then i think you can use the below approach:-
Mapper :-
Cut the header and make that as your key and the remaining data as your value.
Now all of the data for that particular header will move to the reducer.
Reducer :-
We will be having these values in reducer without grouping.
abc 1234
cde 2394
dec 8273
abc 2348
cde 8780
dec 6590

Then we will be able to process the data individually.


Docx4j unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"p")

Question: I am trying add html table in to the another word table' cell.

I can add html table in to the another word table' cell. (OK)
I can generated last word document call lastDocument.docx (OK)
I can not load again
WordprocessingMLPackage.load(lastDocument.docx), throw this
exception Docx4j unexpected element
(uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",
local:"p")

this is my code:
<code>Tr workingRow = (Tr) XmlUtils.deepCopy(templateRow);
    List<?> textElements = WMLPackageUtils.getTargetElements(workingRow, Text.class);

    List<Tc> tcList = WMLPackageUtils.getTargetElements(workingRow, Tc.class);
    Tc tc = WMLPackageUtils.getTc(tcList, "${Replace_Tex1}");

    XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
    XHTMLImporter.setParagraphFormatting(FormattingOption.IGNORE_CLASS);
    XHTMLImporter.setTableFormatting(FormattingOption.IGNORE_CLASS);
    for (Object object : textElements) {
        Text text = (Text) object;
        if (!text.getValue().equals("${Replace_Tex1}"))
            continue;
        String replacementValue = (String) replacements.get(text.getValue());
        //text.setValue(replacementValue);
        R r = (R) text.getParent();
        r.getContent().clear();
        r.getContent().addAll(XHTMLImporter.convert(replacementValue, null));
</code>
Answer: I guess your problem is:
<code>  r.getContent().addAll(XHTMLImporter.convert(replacementValue, null));
</code>
Adding w:p (paragraph content) inside a run, which isn't allowed.
You can unzip your docx to look at word/document.xml
Answer: Hello i have fixed my code like that
<code>     R r = (R) text.getParent();
     P paragraphOfText = wordMLPackage.getMainDocumentPart().createParagraphOfText("");
     paragraphOfText.getContent().clear();

     r.getContent().clear();eviewtable.getContent().add(new Tr(new Tc(itemTable, new Paragraph())));
     tc.getContent().addAll(XHTMLImporter.convert(replacementValue, null));
     tc.getContent().add(paragraphOfText);
</code>
it is working :) Thank you @JasonPlutext


Unique factorization fails for Hilbert numbers $1+4\Bbb N$

Question: Somewhat of an unusual homework problem that my professor assigned that I can't wrap my head around.
We are only considering the positive numbers congruent to 1(mod 4), that is, other numbers do not exist in this problem. A number is said to be "primey" if its only positive divisors congruent to 1(mod 4) are 1 and itself (For example: 9 is primey however 9 is not prime). The question is: is it true that every number congruent to 1(mod 4) different than 1 is the product of "primey" numbers uniquely?
I have shown every number different than 1 and congruent to 1(mod 4) can be expressed as a product of primeys. In fact, it was very similar to the proof showing the same for the natural numbers. However, I am having trouble with the uniqueness part. I know that the uniqueness does not hold here, but I do not know why.
Thanks in advance.
Comment: Hint: You cannot prove uniqueness.
Comment: There is a confusion about one point in this question.  There is no such object as $\text{"}1\pmod4\text{''}$.  When one says that $17$ is $\text{"}$congruent to $1$ $\pmod 4\text{''}$, one is saying that $17$ is congruent mod $4$, to $1$.  The object identified by the phrase that includes the words $\text{"mod }4\text{''}$ is the relation of congruence mod $4$. Thus, for example, $17$ and $25$ are congruent-mod-$4$ to each other. ${}\qquad{}$
Comment: $4389=3×7×11×19$ which are all 3 mod 4, but $4389=(3×7)×(11×19)=(3×11)×(7×19)=(3×19)×(11×17)$ so 4389 can be divided into pairs of primes of the form 4n+3 in 3 different ways.
Answer: Hint $ $ Suppose we have primeys (irreducibles) $\,a^2\ne b^2$ where $\,a,b\equiv -1\pmod{\! 4}.\,$ Multiplying yields $\,a^2 b^2 = (ab)^2,\, $ so their product is a square in this number system, since $\,ab\equiv 1\pmod{\!4}.\,$ But the product of two nonassociate irreducibles cannot be a square if factorization is unique.
Remark $ $ This is a famous example Hilbert used to motivate  restoration of unique factorization using ideals (or "ideal factors"). By the Lemma below, if we have unique factorization then coprime factors $A,B\,$ of a square must themselves be squares $\ AB = C^2$ $\Rightarrow$ $A = (A,C)^2.$ Were factorization unique, we'd deduce from $\,9\cdot49 = 21^2\, $ that $\,9 = (9,21)^2\, $ and $\,49 = (49,21)^2.\,$ Adjoining these gcds as new ("ideal") elements eliminates this nonunique factorization since then the two factorizations have the common refinement $\,(9,21)^2\, (49,21)^2 = \color{#90f}{3^2 7^2}.\,$ In effect we have discovered the new ("$\rm\color{#90f}{ideal}$") elements $\, \color{#90f}3= (9,21)\,$ and $\,\color{#90f}7 = (49,21)\,$ needed to restore unique factorization by taking gcds of ("real") elements in our number system $\,1+4\,\Bbb N.\,$
Lemma $\rm\ \ \color{#0a0}{(a,b,c) = 1},\,\ \color{#c00}{c^2 = ab}\ \Rightarrow\ a = (a,c)^2,\,\ b = (b,c)^2\ $ for $\rm\:a,b,c\in \mathbb N$
Proof $\rm\ \ (c,b)^2 = (\color{#c00}{c^2},b^2,bc) = (\color{#c00}{ab},b^2,bc) = b\color{#0a0}{(a,b,c)} = b.\ $ Similarly for $\,\rm(c,a)^2. $
Remark $ $ See here for a generalization to $n$'th powers.


Specify Owner when creating jobs from Jenkins CLI

Question: I have a groovy script that runs the command jenkins-cli create-job and uses an xml template to create a new maven job. In the template, I attempt to specify the owner using the jenkins ownership plugin, but this information is ignored. It appears that jenkins uses the default setting and sets the owner to the creator, which in this case is jenkins and thereby deployman. I'd like to somehow get around this and assign the proper own either by passing it on the command line or telling jenkins to ignore that default setting that sets the owner to the creator. Does anyone know how to do this?
Note: I have inspected the xml file passed on the command line and the config xml file of the new project in jenkins and run a diff between them. The only difference the the owner set to the wrong person.
Comment: Figured it out: Jenkins automatically sets the owner like I thought it did, to fix it, run a jerkins-cli update-job with the same template and it will assign the correct owner.
Answer: https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
Read "Working with Credentials" section.
Also you can validate who is logged in with following jenkins cli command.
who-am-i : Reports your credential and permissions


How to Display Direction list on Google Maps API?

Question: enter image description here
When using directions in Google Maps
I would like to display a list of multiple paths using the api, like the red box in the attached photo, but I do not seem to have a good guide to look for the api document.
I want to know how to implement it.
I would appreciate your help.
Comment: Welcome to Stack Overflow! When asking questions, as per the [ask] guide, you should show what you have tried and try to pinpoint exactly what it is you are struggling with. Are you wanting someone to find the API for you? Do you need to know what javascript code implements it? Where have you already tried to find help before asking the question? Keeping these things in mind will help you build more complete questions, and those are questions that are most likely to be answered. Also see [mcve] for more information.
Answer: This is a pretty complicated endeavor to simply have someone walk you through without having built your own code.  That said the I would recomend reading through the google resource manual.  And here is a walkthrough once you understand some basics of google maps javascript control.
tutorial
There are free resources to figure it out.  Though there are even better paid resources.  Just check out Udemy for a 10$ course (you have to sign in and search a coupon, but you can get access to any great course for $10)
Give it a shot and get back to us when you have tried some stuff specifically.
Comment: Or is it specifically the box listing direction that you want?


how can I add system icons for button in react native

Question: without using any third party library how we can give system icon for button in react native.
<Button
   fontWeight='bold'
   backgroundColor='#3b5998'
   icon={{name: 'facebook', type: 'font-awesome'}}
   title='Connect With Facebook' />

Answer: I am assuming that you are using React Native Button component.
In that case there is no props named icon in React Native Button component.
Please refer the documentation here
Alternate Solution
If you want to add a button with system icon without using any third party library you can do something like
<View style = {{
        flex: 1,
        justifyContent: 'flex-end',
        paddingBottom: 30,
    }}>
        <TouchableOpacity
            style = {{
                justifyContent: 'center',
                padding: 10,
                height: 30,
                width: '100%',
                flexDirection: 'row',
            }}
            onPress = {() => {}>

                <Image src={source to your image} style={{add your style}}/>

        </TouchableOpacity>
    </View>


Sharing single SMTP domain between Postfix and Exchange

Question: Greetings.
I have a working Postfix configuration, but no Postfix admin. Mail is being correctly delivered to all recipients. Spam filtering, etc. all work fine.
I want to configure Postfix to share a single SMTP domain and do the following:
- if the receipient exists locally (e.g. if firstname.lastname@example.com has a local maildrop), continue to deliver mail as it now does
- if email@example.com does not exist, forward the mail to an Exchange server
Suggestions and thoughts on the best way to make this work?
Answer: I'm not a hardcore Postfix admin, but I'm thinking that the "fallback_transport" configuration parameter (see http://www.postfix.org/postconf.5.html#fallback_relay) is what you're probably looking for.
You'll want something like:
<code>fallback_transport = smtp:[x.x.x.x]
</code>
Have a look at the "local_recipient_maps" parameter, too (http://www.postfix.org/postconf.5.html#local_recipient_maps). You're going to want to set that to blank to stop Postfix from rejecting mail from unknown local recipients.
If you want the complementary function on the Exchange side (so that replies from Exchange to emails sent by Postfix recipients "go through") have a look at the "Forward all messages with unresolved recipients to host" setting in Exchange 2003 (see http://technet.microsoft.com/en-us/library/aa998492(EXCHG.65).aspx), or the "Internal Relay Domain" feature in Exchange 2007 (see http://technet.microsoft.com/en-us/library/bb676395.aspx).
You do run the risk of creating mail loops between Exchange and Postfix for messages sent to unknown local recipients from either mail system, but the messages will time out so, unless a lot of users are generating bogus traffic, it probably won't matter too much.


Create destination directory with drush archive-restore?

Question: I'm using this terminal command to restore an archive created on a remote server locally:
drush arr archive.tar.gz default --destination ./newdir --db-url=mysql://user:pass@localhost/db

The archive was created with drush archive-dump, and the restore is on a Mac running the MAMP stack.  The archive is in the current working directory when I run drush arr.
In general, this works fine, but for some reason, the new directory (newdir) isn't created. All files are restored into a folder named "1" (which is created). Drush reports "Archive restored to 1"
Is there some way for me to modify the syntax so that newdir is created, and all files are restored there?
Comment: Try `--destination=./newdir`
Comment: @Clive. That's it. Can't believe I didn't notice that. Thank you.
Answer: Try --destination=./newdir.  Drush always uses --flag=value; without a value specified, the default is 1.
Comment: Thanks, Greg. That was my problem. Using --destination=./newdir, everything works beautifully.


Accuracy of barcode vs qrcode?

Question: I want to develop a supermarket application for checking and billing.
Should I use barcodes or qrcodes? Which will give better accuracy?
Comment: Shouldn't the question be: which of these barcodes is already on the products sold?
Comment: On the "ability to read" side, absolutely, since all scanners that I have worked with present the data as a string, no matter the source.  On the "ability to write" side, it gets a bit trickier as you have to consider things like how much data needs to be encoded and what will be the reading capabilities of the folks who receive the documents.
Answer: The biggest difference here is that a linear barcode (e.g. Code 3 of 9, UPC, EAN, etc.) and a 2-dimensional symbology (e.g. QRCode, DataMatrix, etc.) store data in very different ways.  A linear barcode can be read with a simple laser scanner, while most 2-D symbologies require an imager in order to be read.  In general, imagers can also read linear barcodes, but are also more expensive than laser scanners.
You will want to consider whether your customers may already have linear scanners only, or whether they would be willing to pay the premium for an imager in order to get the benefit of the extra data that can be encoded in the 2-D symbologies.
Answer: Both will be accurate, the question is how much data do you need to store.  QR has much more capacity than something like 3of9 barcode.
Comment: which will be faster for detection?I know that there are ready made
barcode scaner availabe in markets.Are qrcode scanners  avaiable in market?
Comment: I wish this answer also weighed in on which one is quicker/easier to **be processed / read**

Accuracy of barcode vs qrcode?


No module named statistics.distributions

Question: I was trying to use Sympy stats library when i encountered this problem:
>>> from sympy.statistics.distributions import Sample
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named statistics.distributions

The problem is not only in my system as the same happened in their SymPy Live Shell. You can see it here. Can you please help me fix this.
Comment: The live shell runs version `1.0`, the code you're trying to run is from version `0.70`
Comment: I see. Upon further reading i saw that `statistics` has been deprecated. But I cannot find any alternative to find the mean of a list using Sympy.
Comment: I guess thats a different question then. Maybe you should post the actual problem you're trying to solve.
Answer: sympy.statistics has been removed in favor of sympy.stats. Here is the documentation: http://docs.sympy.org/latest/modules/stats.html.
For producing the mean of a list of numbers, you can use DiscreteUniform:
In [8]: from sympy.stats import DiscreteUniform, E

In [9]: X = DiscreteUniform("X", [1, 2, 3])

In [10]: E(X)
Out[10]: 2

Comment: Thanks a lot for your reply, it works. I hope something like `Sample` is brought back as it was very useful.
Comment: Also worth mentioning that for floating point statistics, you are better off using a numeric library like `scipy.stats`.


Get all the nodes in the system

Question: I've found node_load_multiple() which allows me to get all the nodes, but I need to specify some parameters, e.g. the type of node that I'd like to fetch.
I'd like to get all the nodes in the system without the criteria. How can I do that?
Answer: The easiest way would be to use entity_load()
$nodes = entity_load('node');

If you don't provide the second argument ($ids) it will load up all entities of the given type:

$ids: An array of entity IDs, or FALSE to load all entities.

Just for the sake of completeness node_load_multiple() doesn't require the $conditions parameter so you could also grab all of the node ids from the database
$nids = db_query('SELECT nid FROM {node}')->fetchCol();

And then use $nids to load the nodes:
$nodes = node_load_multiple($nids);

Comment: @Eugene admittedly it's a bit confusing but the question was actually _I'd like to get all the notes in the system without the criteria. How can I do that?_ so he's looking for all nodes, not just those of a specific type
Comment: @EugeneFidelin I think we can safely assume he meant 'nodes', as the answer has been accepted :)
Comment: MrFluff asked how to load all nodes of specific type, not all nodes at all
Comment: As i understand "Notes" are not "Nodes" - this is custom content type.
Answer: Just use node_load_multiple(FALSE), and you will get all the nodes present in the site.
Keep in mind that it returns all the nodes, and this would be a problem when there are many nodes: The function takes time to be executed, and each node uses memory to be stored. With enough nodes, you would exhaust all the available memory.
Using the EntityFieldQuery class, you can limit the number of returned nodes.
$query = new EntityFieldQuery();

$query->entityCondition('entity_type', 'node')
  ->propertyCondition('status', 1)
  // It returns the first 10 nodes.
  // Use range(10, 10) to get the next 10 nodes.
  ->range(0, 10);

$result = $query->execute();

if (isset($result['node'])) {
  $nodes = entity_load('node', array_keys($result['node']));
}

I added propertyCondition('status', 1) because you are normally interested on published nodes; if you want to get all the nodes, remove that line.
Notice that the $conditions parameter for node_load_multiple() is not anymore used in Drupal 8. If you need to get some nodes basing on some conditions, you should use the EntityFieldQuery class.
References

How to use EntityFieldQuery
Answer: Here is another way to find all node ids in your website.
$nids = array_values(\Drupal::entityQuery('node')->execute());

Get all the nodes in the system


issue with download pdf with jquery

Question: I am trying to download pdf with ajax response html for that I am using below code

var newPDFAction =  function () {
        $.ajax({
            type: "post",
            url: '{{ route("admin.getCustomerSalesRepTotal") }}',
            success: function(response){
                var doc = new jsPDF();
                var specialElementHandlers = {
                    '#editor': function (element, renderer) {
                        return true;
                    }
                };

                doc.fromHTML(response, 15, 15, {
                    'width': 170,
                        'elementHandlers': specialElementHandlers
                });
                doc.save('sample-file.pdf');
            }
        });

    };

<button onclick="newPDFAction()" >Download Record</button>

in my ajax response I have received html div with table

Customer Sales Rep Sales Totals

                Total Sales
                Order Count
                Customer Account
                Customer Suff
                Sales Rep Id
                Sales Rep Last Name
                Sales Rep First Name
                Sales Rep State

                1000.0000
                2

                0

    Created on: 25-01-2021

but when I run this code I have received below error jsPDF Warning: rendering issues? provide a callback to fromHTML! and it is downloading blank file in pdf there is no content in downloaded html response
can anybody help me in this ?
Answer: I think you need to move the saving command into the fromHtml callback:
doc.fromHTML(response, 15, 15, {
  'width': 170,
  'elementHandlers': specialElementHandlers
}, function() {
  doc.save('sample-file.pdf');
});

Check an adatped fiddle here

issue with download pdf with jquery