Right-handed newbie with dodgy left index finger tip (knuckle) - What to do?

Question: I have never played guitar or had any lessons in my life, and at the ripe old age of 40, I just decided I wanted to learn how to play.
So this week I just bought a Yamaha F310 as it seemed to be quite well rated for beginners. The potential problem I have is that, I am right handed, and the tip of my left index finder can't bend over at the last joint as I had an accident when I was younger, snapping the tendon that enables you to bend the tip over. This means my left index finger only bends at the middle joint, but from there up, it remains flat - cannot bend the tip over.
Is this likely to make the road ahead a tricky one for me? I've just been trying to play the A, D & E chords and am noticing that I'm having to really get my wrist underneath the neck so as to keep the flat part of that index finger off the surrounding strings and also angle my left index finger in from the end of the guitar direction, rather than from below (to lessen the chance of that flat finger touching strings below) - this in itself then feels like it hampers my hand position for the rest of the finger placements.
I don't know if this initial awkwardness is just general beginner awkwardness, or if perhaps it's slightly worse because of this finger.
I'm wondering, if it is likely to be a bit of an issue to play cleanly going forward, whether I should return the right-handed guitar, and before I get too used to learning that way, get a left-handed guitar so my dodgy index finger is only used for gripping the pick and strumming?
I presume it's no harder to learn left-handed vs right-handed (if you've never played an instrument before and don't yet have that muscle memory etc)?!
Any thoughts/advice would be much appreciated.
Thanks
Comment: Just a word of encouragement: Django Reinhardt, one of the greatest Jazz guitarists of all time, had his left hand almost entirely disabled in a fire when he was young. He had little to know mobility in his ring and pinky fingers. It prompted him to create his own style, which is still emulated and admired today.
Comment: In my experience I had a student who was left-handed and trying to play right-handed because he didn't have a left-handed guitar. He was a beginner and it was more difficult to learn.  But if you are looking to play basic chords, it may be worth a try if the finger in cooperating. But don't give up.
Comment: As well as Django, look for Graham Oliver - a guitarist with metal band Saxon - he lost the end of his same finger decades ago and it didn't stop him... (I've heard him say he uses it fine for barre chords, and uses his other three fingers more to compensate).  I think I would stay with the right hander for at least six months to give it a fair trial... You could always reverse the strings to "try out" leftie playing later (this affects setup and tuning accuracy though)
Comment: You'll find it harder to achieve standard guitar technique if your LH can't do all the usual things. If you go left-handed some picking techniques may need modifing. Great things have been achieved by guitarists considerably more handicapped than you! But there's no virtue in overcoming obstacles that can be easily avoided. I suggest you give left-handed a try.
Answer: Well that's an interesting dilemma.  But you can overcome your limitation!
As you suggested you have two options:
Option one is to switch to lefty guitar so your right hand becomes your fretting hand.  Option two is to learn to adapt your fingering to compensate for your handicap. Let's explore both options.
I don't see any reason why it would be any harder to learn to fret with your right hand to play a "left hand" guitar.  Many left handed folks learn right handed guitar because they know right handed guitars are easier to come by and don't have to be special ordered and can be found used etc.  So they learn to play right handed guitar from the beginning - which for them is like a right handed person learning left handed.  I have never heard any complaints from the folks I have known who are left handed but play the guitars that right handed people play.
Either way you learn, you must train your brain to get your fingers to do very awkward and unnatural things and contort into strange shapes.  I can't think of any reason why a right handed person would find this easier to do with the left hand and have often wondered who decided that right handed folks should use their left hand as the fretting hand to begin with.
The key may be in your ability to maintain a consistent strumming rhythm with your left hand and arm.  If you can master some basic rhythmic in time strumming with your left hand, as easily as you can with your right hand, there is no reason you should expect the learning curve to be any different starting from ground zero - regardless of which hand you use for fretting.  Of course, now is the time to make the change if you do go that route.
The other option is to learn to adapt.  Certainly there will be some open chords that will be more difficult to play in the typical fashion if you can't bend the last knuckle in your index (first/trigger) finger.  One that comes to mind is the C chord which is usually played with the index finger fretting the second string (b string - next to skinniest string) on the first fret.
One solution would be to learn to form most chords with your pinkie, ring finger and middle finger and leave off your index finger.  Since the pinkie is usually the finger that most beginner's find to be the least controllable, most beginning guitar students tend to avoid using the pinkie in the beginning.  But as you become more advanced, the pinkie becomes very important.  So why not start developing it now.
Your inability to bend the fingertip knuckle will not impair your ability to play barre chords.  And if you learn to play most open chords with the other three fingers, it will be easier for you to play barre chords which often require the use of the other three fingers.  You will probably even find yourself making great use of the C shaped barre chords and D shaped Barre chords in addition to the more common E shaped and A shaped barre chords.
To play an A major chord in first position you can use a mini barre with your middle finger or ring finger - so you use just one finger to play it.  I play a G chord with pinkie, ring and middle finger as a matter of course.  I play an F chord as a barre chord with a straight index finger.  I often play an E chord with my pinkie, ring and middle finger so I can simply slide that same shape up the fretboard to play other E shaped barre chords.
I think the most difficult challenge for you would be to try to play a C7 or G7 in open position without the ability to bend the finger tip knuckle of your first finger. So perhaps you might have to play those as barre chords on the  occasions when you need to play a C7 or G7 in a song.
You will be able to make it work either way - if you have a strong enough desire!  Remember that learning guitar takes a great deal of determination and commitment born out of a strong desire.  That does not change whether you learn to fret with your left hand or right hand.  And it does not change if you are forced to alter your fretting technique and fret some chords in a manner that some might call unconventional.
There are many examples of folks who have learned to play with only two fingers.  I saw a YouTube vid of a guy playing with his toes.  So if the desire is there, you will find a way to adapt.
I gave up guitar as a teenager because I broke my pinkie on my fretting hand and it grew back crooked and weaker.  At the ripe old age of 40 I decided to try again - this time with more passion and desire and determination.  I was able to overcome my limitation and learn to play quite well.  I now get paid to play guitar and sing at local venues and private parties.  I am so happy that I decided to give it another shot.  There are a few chords I can't play like other folks but I have learned to substitute other chords or play a different fingering.  It has not held me back.
Regardless of which direction you go from here - enjoy the journey.  It will be worth the effort in the end.
Answer: I say that you can find a way to make it work. I would define the knuckle in question as a locked finger to my students, and I am always telling them not to do it. It may get in the way on occasion but many students will do it not realizing that they weren't supposed to and manage to do pretty well. often they lock the other joint, but it is not a complete obsticle.
For your other fingers, the reasons not to lock your finger are ...

it reduces your speed in positioning and releasing a note.
it reduces your accuracy.
it reduces the leverage of your muscles.
it gives the muscle in question a vacation, making he other muscles on the team work harder for the same result.

I'm having to really get my wrist underneath the neck so as to keep the flat part of that index finger off the surrounding strings and also angle my left index finger in from the end of the guitar direction, rather than from below (to lessen the chance of that flat finger touching strings below) - this in itself then feels like it hampers my hand position for the rest of the finger placements.

I am not exactly sure what your wrist looks like from your description, but you are ahead of the game to realize that your wrist position effects your fingers and can cause part of the muting of strings unintentionally. Guitarists without your difficulty still will have this problem. The wrist should be away from the guitar, controlled but relaxed, and either straight or bent slightly forward. It may need to move from that good home position for certain chords.


How do I record system sounds in Audacity?

Question: How do I record the music, that is being played on my PC, in Audacity? I searched through the internet and found no answer, except a tip to use a screen recorder like OpenShot and separate the audio track? Is there a more efficient way?
NOTE: OS = MacOS Catalina 10
Audacity Version: 3.0.2
NOTE: This question has been closed since I found out how to do it... Thanks for your help :)
Comment: What  "Audacity" is this?  The only one I know is this one  https://www.audacityteam.org/download/  and it has menu items to export the tracks into the audio format of your choice.
Answer: This works for me (Linux) to record what the sound card is playing using Audacity:

open Audacity
click the Audio Host button (mine says 'ALSA') and select the input (in this case 'pulse')
click the red record button

On other operating systems there might be some difference.
Answer: There are 4 dropdowns at the top of the Audacity GUI.  Adjust as seen below, I just tested this on Windows 10 PC with Audacity 2.3.1

First dropdown = Windows WASAPI
Second dropdown = Speakers (Conexant HD) (loopback)
Third dropdown = Stereo recording
Fourth dropdown = Speakers (Conexant HD)

Start the music source first, then press record.
Comment: The options you find in this menu are determined by the sound drivers installed on your PC, not by Audacity.
Comment: DV cause this doesn't really answer anything
Answer: Audacity lets you select the audio source to record from. There are drop-downs around the mic icon at the bottom of the toolbar that lets you do so. The exact source of the sound you intend to record is pointed to by the use of two separate options.
You need to select the primary audio source[1] first: that is done by selecting an option in the drop-down to the left of the mic icon. Examples are: Windows WASAPI & Windows DirectSound.
Next, you need to select the secondary (or sub) source[1] from the drop-down to the right of the mic icon. An example would be: Microphones (not necessarily your mic).
You may have to try multiple combinations of these two options to see which one works for your platform and audio source (it can vary with different audio sources on the same platform as well). The only way to find out is by trial and error: select a combination, start playing the audio you want to record, and start recording a track in audacity.

[1] This is not how audacity identifies these options. I used the names to illustrate the idea.
Answer: Multiple people have suggested changing the input source which is the way to go. But what is available there will still be limited by what your audio drivers allow you to. Sometimes they don't include any loopback sources. Or you might want to separate output from multiple applications into multiple channels. Or whatever.
In that case I can recommend another tool which can solve all these problems and then some - The Voicemeeter Banana. Basically it can create both virtual soundcards and virtual microphones and redirect sounds any which way among them. In real time. They also have paid (but cheap) versions with more channels if you really need that. (Disclaimer: I'm not affiliated with them in any way, I just think their software is very neat and haven't found any other similar programs)
Comment: OP mentions MacOS; I think [Blackhole](https://existential.audio/blackhole/) is approximately equivalent there.
Comment: @npostavs - Ahh, that edit only appeared 1 hour ago. I assumed that "PC" most likely means Windows.  Fair enough. I'll let the answer stay, it might help someone anyway.
Answer: (disclaimer: I'm sacrificing correctness for understandability here)
You need to make sure that your sound card is treated as a loopback device.
A soundcard takes an input signal, transforms it and outputs it as a different signal. E.g. it takes an analogue signal and will transform it to a digital one (or vice versa).
When a system sound is a triggered it is sent as a digital signal to your soundcard, which will turn it into an analogue one before output. If you hit "record" in audacity it will try to record the analogue source, but there is no analogue source, hence your audio wave will be flat (i.e. no signal)
So, to be able to record the system sound your sound card needs to actually do 2 actions: transform it to an analogue signal and then record that signal. I.e. it needs to loop back the result of the transform to itself before it can record it. That's why it's called "loopback device".
So, what you need to do in audacity is to select Windows WASAPI as your audio host and select your soundcard as a loopback device. E.g.

Depending on your machine it might have other options than Realtek(R) Audio (As you can see I also have an external soundcard a Focusrite, which I'd be really using if I'd want to record system sounds)
Realtek Audio is the standard sound card driver which comes out of the box with Windows 10.
Comment: I don't think the loopback needs to have any "analog" step.  You're recording a digital signal after all.  Hi-Fi virtual audio cable, for example, simply sends the digital data from one end to the other.  Your sound card could do the same.
Comment: I use a mac and I do not see any thing other than Mac Air Microphone in the dropbox @Creynders
Comment: You may need additional software if your pc does not already have a suitable driver.  Try adding virtual audio cable (there is a Mac version as well)
Comment: Realtek doesn't have anything to do with Windows, it's the cheapo chipset brand that provides most of audio and network chips for PCs.


Jupyter: How do I prevent matplotlib figures from being automatically shown?

Question: I like to only show a matplotlib figure with an explicit show(fig). But Jupyter automatically shows all created figures.
This link has a workaround, but it is essentially just capturing all the output of a cell. I don't want to do that.
Related:

https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.show.html#:~:text=auto-show%20in%20jupyter%20notebooks

PS: I am actually using seaborn, not matplotlib directly.
Comment: You can also specify the magic command ```%%capture``` at the beginning of the Jupyter cell. This will prevent all output from that cell
Comment: Have you tried `plt.ioff()` before defining any figure object? This might help: https://stackoverflow.com/a/35949684/7789963
Answer: Using plt.ioff disables interactive mode and storing figure in a variable won't display any output:
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

plt.ioff()
sns.set_theme(style="darkgrid")

# Load an example dataset with long-form data
fmri = sns.load_dataset("fmri")

# Plot the responses for different events and regions
fig = sns.lineplot(x="timepoint", y="signal",
             hue="region", style="event",
             data=fmri)

But using plt.show() reverses the effect and show the output figure:
# Import modules here
plt.ioff()

# Set theme and load data here
fig = sns.lineplot(x="timepoint", y="signal",
             hue="region", style="event",
             data=fmri)

plt.show()

How the Jupyter Notebook output looks like when the above code is used:

The code for plotting the Timeseries plot comes from here.


Joomla "pretty urls" with nginx allow index.php/pretty/url as well as index.phppretty/url (notice the absence of slash)

Question: I am trying to install my first LEMP stack and, after a lot of hours and reading, it's working pretty well (Damn, the www-data group write permissions issue was a tough one).
Anyway, my Joomla site is now working and performing better than ever, but I have noticed a strange issue with the pretty urls:
If I access to www.mysite.com/index.php/some/content/alias/ everything is good. However, it's also OK if I access www.mysite.com/index.phpsome/content/alias/ (notice the absence of the slash after index.php).
Is that the expected behavior? I know end users won't access those anyway, but its mere existence is driving me nuts, because it should throw a 404, right?
This is my config:
server {
    listen       80;
    server_name  domain.bla;
    return       301 http://www.domain.bla$request_uri;
}
server {
    listen 80;

    server_name www.domain.bla;

    root /home/domain/public_html;
    index index.php index.html index.html;

    #Specify a charset
    charset utf-8;

    # Custom 404 page
    error_page 404 /404.html;

    # Include the basic h5bp config set
    # The error remains if I comment this out, so that's not the problem
    include h5bp/basic.conf;

    # Enable PHP-FPM
    include fastcgi_php.conf;
}

fastcgi_php.conf:
location / {
    try_files $uri $uri/ /index.php?q=$request_uri;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /var/www/html;
}
location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    # fastcgi_intercept_errors on;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

... and fastcgi_params:
fastcgi_param   QUERY_STRING        $query_string;
fastcgi_param   REQUEST_METHOD      $request_method;
fastcgi_param   CONTENT_TYPE        $content_type;
fastcgi_param   CONTENT_LENGTH      $content_length;

fastcgi_param   SCRIPT_FILENAME     $request_filename;
fastcgi_param   SCRIPT_NAME     $fastcgi_script_name;
fastcgi_param   REQUEST_URI     $request_uri;
fastcgi_param   DOCUMENT_URI        $document_uri;
fastcgi_param   DOCUMENT_ROOT       $document_root;
fastcgi_param   SERVER_PROTOCOL     $server_protocol;

fastcgi_param   GATEWAY_INTERFACE   CGI/1.1;
fastcgi_param   SERVER_SOFTWARE     nginx/$nginx_version;

fastcgi_param   REMOTE_ADDR     $remote_addr;
fastcgi_param   REMOTE_PORT     $remote_port;
fastcgi_param   SERVER_ADDR     $server_addr;
fastcgi_param   SERVER_PORT     $server_port;
fastcgi_param   SERVER_NAME     $server_name;

fastcgi_param   HTTPS           $https if_not_empty;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS     200;

By the way, cgi.fix_pathinfo is set to 0.
Any clue? Thanks in advance!
Answer: Both URLs hit your final try_files clause: /index.php?q=$request_uri
As the file does not exist and the only location block that matches is "/". The regex location block does not match initially, as it does not end with ".php", that is until rewritten by the try_files directive mentioned above.
Also, your fastcgi_split_path_info directive does not really do anything, as URLs with path info cannot match that location block.
Comment: Oh, I see. I'll give it a shot and try to come up with a solution. Thanks!


Checking an "equivalence of products" in the notes on deformation quantization by Allen C. Hirshfeld and Peter Henselder

Question: These notes are a great introduction to deformation quantization but I failed to check the validity of the statement p.9, right before (5.18).
Context: let $(\mathcal{A},+,\mu)$ be an algebra. $\mu:\mathcal{A}\times \mathcal{A} \to \mathcal{A}$ standing for multiplication. Deformation consists in considering a family (paramatrized by $\nu$ in a yet to be chosen space) of product on $\mathcal{A}[[\nu]]$ (formal power series with coefficients in $\mathcal{A}$) generically given by
$$ \forall\ f,g\in \mathcal{A},\quad  \mu_{\nu}(f,g) := \mu(f,g) + \sum_{k=1}^{+\infty} \nu^k \mu_k (f,g) \label{1}\tag{1}$$
i.e. by a family of bilinear maps $\mu_k:\mathcal{A}\times \mathcal{A} \to \mathcal{A}$ satisfying some conditions and extended to elements $F, G\in \mathcal{A}[[\nu]]$ of the form $F=\sum_{k=1}^{+\infty} \nu^k f_{k},\ f_k \in \mathcal{A}$ by $\mathbb{K}[[\nu]]$-bilinearity. (the idea behind formal power series, as far as I understand, is to ignore convergence issues but still have a structure where one can compare terms of the same degree in $\nu$").
Two of these star-product are equivalent if there exists an invertible algebra isomorphism (transition map) $T:(\mathcal{A}[[\nu]],+,\mu_{\nu}) \longrightarrow (\mathcal{A}[[\nu]],+,\rho_{\nu})$, i.e. a map such that
$$ \forall\ F,G \in \mathcal{A}[[\nu]], \quad T\big(\mu_{\nu}(F,G)\big)= \rho_{\nu}(T(F),T(G))$$

Question: Let $\mathcal{A}=\mathcal{C}^{\infty}(\mathbb{R}^2)$ and denote $(a, \overline{a})$ or $(b, \overline{b}$) the variables of the functions. I want to check that the normal product ( (5.4) p.8; with the more usual notation for products)
$$f \ast_N g := \sum_{k=0}^{+\infty} \frac{\hbar^k}{k!} \frac{\partial^k f}{\partial a^k} \frac{\partial^k g}{\partial \overline{a}^k} = f\, e^{\hbar \overleftarrow{\partial}_a \overrightarrow{\partial}_{\overline{a}}}\, g \label{2}\tag{2}$$
is equivalent to the Moyal product ((5.15) p.9, one can consider $\hbar$ as the deformation parameter... although there is usually the factor as in (\ref{5}))
$$ f \ast_M g := \sum_{k=0}^{+\infty} \left(\frac{\hbar}{2} \right)^k \frac{1}{k!}  \left. \left( \frac{\partial }{\partial a} \frac{\partial }{\partial \overline{b}} - \frac{\partial }{\partial \overline{a}} \frac{\partial }{\partial b}\right)^k f\big(a, \overline{a}\big) g\big(b, \overline{b}\big)  \right|_{\genfrac{}{}{0pt}{1}{a=b}{\overline{a}=\overline{b}}} = f\, e^{\frac{\hbar}{2}\big( \overleftarrow{\partial}_a \overrightarrow{\partial}_{\overline{a}} - \overleftarrow{\partial}_{\overline{a}} \overrightarrow{\partial}_{a} \big)}\, g \label{3}\tag{3}$$
i.e.
$$ T\big(f \ast_N g \big) = T(f) \ast_M T(g)\quad \text{with}\quad T = \genfrac{}{}{0pt}{0}{"}{}\!\!\exp\left(-\frac{\hbar}{2} \frac{\partial^2}{\partial a\, \partial \overline{a}} \right)\genfrac{}{}{0pt}{0}{"}{} \label{4}\tag{4}$$
Remarks:

In fact I already checked (\ref{4}) up to second order in $\hbar$ but it did not work at order 3 (although I'm not sure as the calculations were quite tedious...). It was not a priori clear that (\ref{4}) hold, one could have the other way round $ T\big(f \ast_M g \big) = T(f) \ast_N T(g)$ instead but this seems to fail at order 1. I only want to check the first few orders, but I would gladly take a proof for all order. I will soon write what I have done, but as I mentionned, it's tedious.
The Moyal product is first defined in the text (3.5-3.6) p.5 by
$$ f \ast_M g := \sum_{k=0}^{+\infty} \frac{\nu^k}{k!} \underbrace{\left(\frac{\partial }{\partial q_1} \frac{\partial }{\partial p_{2}} - \frac{\partial }{\partial p_{1}} \frac{\partial }{\partial q_2} \right)^k f(q_1,p_1)\, g(q_2,p_2)}_{\mu_k(f,g)}\left.\vphantom{\frac{T}{T}}\right|_{\genfrac{}{}{0pt}{1}{q_1=q_2}{p_{1}=p_{2}}}\quad \text{with}\quad \nu = \frac{i\hbar}{2} \label{5}\tag{5}$$
and it does coincide with (\ref{3}) via (these are the correct $\sqrt{2}$ factors...)
$$ \left\lbrace \begin{aligned}
 a & := \frac{1}{\sqrt{2}} \left(q  + i\hspace{.5pt} p \right) \\
 \overline{a} & := \frac{1}{\sqrt{2}} \left( q - i\hspace{.5pt} p \right)
 \end{aligned} \right. \enspace \Longrightarrow\quad
 \left\lbrace \begin{aligned}
 \frac{\partial}{\partial\hspace{.7pt} q} & = \frac{\partial\hspace{.7pt} a}{\partial\hspace{.7pt} q} \frac{\partial}{\partial\hspace{.7pt} a} + \frac{\partial\hspace{.7pt} \overline{a}}{\partial \hspace{.7pt} q} \frac{\partial}{\partial\hspace{.7pt} \overline{a}} =\frac{1}{\sqrt{2}} \left( \frac{\partial}{\partial\hspace{.7pt} a} +  \frac{\partial}{\partial\hspace{.7pt} \overline{a}} \right) \\
 \frac{\partial}{\partial\hspace{.7pt} p} & = \frac{\partial\hspace{.7pt} a}{\partial\hspace{.7pt} p} \frac{\partial}{\partial\hspace{.7pt} a} + \frac{\partial\hspace{.7pt} \overline{a}}{\partial \hspace{.7pt} p} \frac{\partial}{\partial\hspace{.7pt} \overline{a}} = \frac{i}{\sqrt{2}} \left( \frac{\partial}{\partial\hspace{.7pt} a} - i\, \frac{\partial}{\partial\hspace{.7pt} \overline{a}}\right)
 \end{aligned} \right. $$
To make (\ref{3}) (same for (\ref{5})) more explicit, let me write the $k=2$ term: (notation $\displaystyle \partial_a=\frac{\partial}{\partial a},\ \partial_{ab}= \frac{\partial^2}{\partial a \partial b}$ etc.)
$$\begin{split}
 \mu_2(f,g) &= \Big(\partial_{aa\overline{b}\overline{b}} - 2 \partial_{a\overline{a}b\overline{b}} + \partial_{\overline{a}\overline{a}bb} \Big) f(a,\overline{a})g(b,\overline{b})\left.\vphantom{\frac{T}{T}}\right|_{\genfrac{}{}{0pt}{1}{a=b}{\overline{a}=\overline{b}}}\\
 &= (\partial_{aa}f)(\partial_{\overline{a}\overline{a}}g) - 2 (\partial_{a\overline{a}}f)(\partial_{b\overline{b}}g) + (\partial_{\overline{a}\overline{a}}f) (\partial_{aa}g)
\end{split} \label{6}\tag{6}$$
One can also use the $\overleftarrow{\partial}$ or $\overrightarrow{\partial}$ notations or a tensorial notation.
Comment: Your reference borrows the move from [its reference 26](https://link.springer.com/chapter/10.1007/978-94-010-0720-7_16), or [else](https://arxiv.org/pdf/hep-th/0008010.pdf). Hot tip: if you find the action of your operators on generic exponentials of $ma+n\bar a$, you got your identity from Fourier analysis....
Answer: Your reference has this explained in its ref [26], namely Zachos (2000) J Math Phys 41, 5129–5134, hep-th/9912238.
In any case, it is straightforward to prove your (4) through elementary Fourier analysis. That is, use test/sample functions
$$
f=\exp (ma+n\bar a), ~~~~ g=\exp (ka+s\bar a),
$$
so  (4) presents as
$$
\exp (\hbar ms -\hbar(m+k)(n+s)/2) ~ \overset{?}{=}  ~ \exp (-\hbar mn/2-\hbar ks/2 +\hbar(ms-nk)/2),
$$
indeed, an identity.
You might, or might not, appreciate the geometrical features associated with it.
For the mainstream review of all such moves, see this booklet.
Comment: In had in fact downloaded this book a while a go... I should have time to read it during the new confinement!! I also stumbled upon the survey on deformation quantization by Martin Bordemann, also a great text which gave me the idea to test the equality for polynomial functions. But in fact exponentials will also do.
Comment: Yes, it is a *theorem* that one-parameter ($\hbar$) associative generalizations of Poisson Brackets lead to antisymmetrizations of *equivalent* star products. In the 1990s, people had not appreciated the theorem, and were "inventing" "new" star products by the dozens; and only providing the explicit T-dressing maps would slow them down, if that. It's so wonderful they've calmed down since...
Answer: It is in fact possible to prove
$$\begin{split} T\big(f \ast_N g \big) = T(f) &\ast_M T(g)\quad \text{with}\quad T = \genfrac{}{}{0pt}{0}{"}{}\!\!\exp\left(-\frac{\hbar}{2} \frac{\partial^2}{\partial_{a}\, \partial_{\overline{a}} } \right)\genfrac{}{}{0pt}{0}{"}{} \\
\Longleftrightarrow \quad e^{-\frac{\hbar}{2} \partial_{ a\, \overline{a}}} \left(f\, e^{\hbar \overleftarrow{\partial}_a \overrightarrow{\partial}_{\overline{a}} }\, g \right) & = \left(e^{-\frac{\hbar}{2} \partial_{ a\, \overline{a}}} f\right)  e^{\frac{\hbar}{2}\big( \overleftarrow{\partial}_a \overrightarrow{\partial}_{\overline{a}} - \overleftarrow{\partial}_{\overline{a}} \overrightarrow{\partial}_{a} \big)} \left(e^{-\frac{\hbar}{2} \partial_{ a\, \overline{a}}} g\right)
\end{split}\tag{4}$$
by brute force. The idea is to reckognize the simplification that occurs for the exponents of exponential functions suggested by Cosmas but in terms of series:
$$\begin{split}
\text{L.h.s.} &= e^{-\frac{\hbar}{2} \partial_{ a\, \overline{a}}} \left(f\, e^{\hbar m s }\, g \right) = e^{-\frac{\hbar}{2} \partial_{ a\, \overline{a}}} \left( e^{\big(ma + n\overline{a} \big) + \hbar m k  + \big(ka + s\overline{a} \big)} \right)\\
& = e^{-\frac{\hbar}{2} (m+k)(n+s)} \left(f\, e^{\hbar m s }\, g \right)\\
&= \left( e^{-\frac{\hbar}{2} m(n+s)} f\right) e^{\hbar m s } \left(\,e^{-\frac{\hbar}{2} k(s+n)} g \right)
\end{split} \label{4L}\tag{4L}$$
$$ \begin{split}
\text{R.h.s.} &= \left(e^{-\frac{\hbar}{2} mn\ + \big(ma + n\overline{a}\big)} \right)  e^{\frac{\hbar}{2}\big( \overleftarrow{\partial}_a \overrightarrow{\partial}_{\overline{a}} - \overleftarrow{\partial}_{\overline{a}} \overrightarrow{\partial}_{a} \big)} \left(e^{-\frac{\hbar}{2} ks\ + \big(ka + s\overline{a}\big)}\right) \\
&= \left(e^{-\frac{\hbar}{2} mn\ + \big(ma + n\overline{a}\big)} \right)  e^{\frac{\hbar}{2}\big( ms - nk \big)} \left(e^{-\frac{\hbar}{2} ks\ + \big(ka + s\overline{a}\big)}\right)
\end{split} \label{4R}\tag{4R}$$
The simplification for the exponents to go from L.h.s. to R.h.s. $-\frac{\hbar}{2} ms + \hbar m s -\frac{\hbar}{2} kn = \frac{\hbar}{2} (ms-nk) $.
Remark: One could probably exploit this argument by decomposing a certain class of functions in terms of exponentials, probably with a Laplace transform in analogy with the case of complex exponentials: a tempered distribution can be written $u =\mathcal{F}^{-1}(\hat{u})=\genfrac{}{}{0pt}{0}{"}{}\!\!\frac{1}{(2\pi)^2}\int_{\mathbb{R}^2}\hat{u}(k,\overline{k})\, e^{ika +i\overline{k}\overline{a}}\, dk\, d\overline{k}\, \genfrac{}{}{0pt}{0}{"}{}$.
Notice that Leibniz' rule can be written: $\partial^j_{a}(fg) =f \left(\overleftarrow{\partial}_a +\overrightarrow{\partial}_a \right)^j g$ and similarly with two variables: $\partial^j_{a\overline{a}}(fg)=f \left(\overleftarrow{\partial}_a +\overrightarrow{\partial}_a \right)^j \left(\overleftarrow{\partial}_{\overline{a}} +\overrightarrow{\partial}_{\overline{a}} \right)^j g$. Hence
$$\begin{split}
\text{L.h.s.} &=\sum_{j=0}^{+\infty} \frac{1}{j!} \left(-\frac{\hbar}{2} \partial_{ a\, \overline{a}}\right)^j \left(\sum_{k=0}^{+\infty} \frac{\hbar^k}{k!} \partial^k_a f\, \partial^k_{\overline{a}} g\right)\\
&= \sum_{j=0}^{+\infty} \left(-\frac{\hbar}{2}\right)^j \frac{1}{j!} f\left(\overleftarrow{\partial}_a +\overrightarrow{\partial}_a \right)^j \left(\overleftarrow{\partial}_{\overline{a}} +\overrightarrow{\partial}_{\overline{a}} \right)^j \left(\sum_{k=0}^{+\infty} \frac{\hbar^k}{k!} \overleftarrow{\partial}^k_a \, \overrightarrow{\partial}_{\overline{a}} ^k \right)  g \\
&= f \left( \sum_{j=0}^{+\infty} \left(-\frac{\hbar}{2}\right)^j \frac{1}{j!} \left(\sum_{0\leq i\leq j} {j\choose i} \overleftarrow{\partial}_a^{j-i} \overrightarrow{\partial}_a^i \right) \left(\sum_{k=0}^{+\infty} \frac{\hbar^k}{k!} \overleftarrow{\partial}^k_a \, \overrightarrow{\partial}_{\overline{a}} ^k \right)  \left(\overleftarrow{\partial}_{\overline{a}} +\overrightarrow{\partial}_{\overline{a}} \right)^j \right) g \\
&= f \left( \sum_{\genfrac{}{}{0pt}{1}{j,k=0}{i+l=j}}^{+\infty} \left(-\frac{\hbar}{2}\right)^i \!\! \frac{1}{i!}  \overleftarrow{\partial}_a^{i}\ \left(-\frac{\hbar}{2}\right)^l\!\! \frac{1}{l!} \overrightarrow{\partial}_a^l \left( \frac{\hbar^k}{k!} \overleftarrow{\partial}^k_a \, \overrightarrow{\partial}_{\overline{a}} ^k \right)  \left(\overleftarrow{\partial}_{\overline{a}} +\overrightarrow{\partial}_{\overline{a}} \right)^{i+l} \right) g \\
&=f \underbrace{\left( \sum_{i=0}^{+\infty} \left(-\frac{\hbar}{2}\right)^i \!\! \frac{1}{i!}  \overleftarrow{\partial}_a^{i} \left(\overleftarrow{\partial}_{\overline{a}} +\overrightarrow{\partial}_{\overline{a}} \right)^i \right)}_{"e^{-\frac{\hbar}{2} m(n+s)}"}  \underbrace{\left(\sum_{k=0}^{+\infty} \frac{\hbar^k}{k!} \overleftarrow{\partial}^k_a \, \overrightarrow{\partial}_{\overline{a}} ^k \right)}_{"e^{\hbar ms}"} \underbrace{\left( \sum_{l=0}^{+\infty}  \left(-\frac{\hbar}{2}\right)^l\!\! \frac{1}{l!} \overrightarrow{\partial}_a^l  \left(\overleftarrow{\partial}_{\overline{a}} +\overrightarrow{\partial}_{\overline{a}} \right)^{l} \right)}_{"e^{-\frac{\hbar}{2} k(s+n)}"} g
\end{split}$$
Now it suffices to check the equivalent of $e^{-\frac{\hbar}{2} m(n+s)} = e^{-\frac{\hbar}{2} mn} e^{-\frac{\hbar}{2} ms},\ e^{-\frac{\hbar}{2} ms} e^{\hbar ms}= e^{\frac{\hbar}{2} ms}$ and $e^{\frac{\hbar}{2} ms} e^{-\frac{\hbar}{2} nk}= e^{\frac{\hbar}{2} (ms-nk)}$. Since they are all similar, let us just write the first one:
\begin{equation}
\begin{split}
& f \left( \sum_{i=0}^{+\infty} \left(-\frac{\hbar}{2}\right)^i \!\! \frac{1}{i!}  \overleftarrow{\partial}_a^{i} \left(\overleftarrow{\partial}_{\overline{a}} +\overrightarrow{\partial}_{\overline{a}} \right)^i \right) g\\
&= f \left( \sum_{\genfrac{}{}{0pt}{1}{i=0}{0\leq h\leq i}}^{+\infty} \left(-\frac{\hbar}{2}\right)^{i-h+h} \!  \overleftarrow{\partial}_a^{i-h+h} \, \frac{1}{(i-h)!} \overleftarrow{\partial}^{i-h}_{\overline{a}}\, \frac{1}{h!}  \overrightarrow{\partial}_{\overline{a}}^h  \right) g\\
&= f \left( \sum_{\genfrac{}{}{0pt}{1}{i=0}{h +l =i}}^{+\infty} \left(-\frac{\hbar}{2}\right)^{l} \! \frac{1}{l!} \overleftarrow{\partial}^{l}_{a\overline{a}}\ \left(-\frac{\hbar}{2}\right)^{h} \! \frac{1}{h!}  \overleftrightarrow{\partial}^h_{\overline{a}}  \right) g\\
&= f \left( \sum_{l=0}^{+\infty} \left(-\frac{\hbar}{2}\right)^{l} \! \frac{1}{l!} \overleftarrow{\partial}^{l}_{a\overline{a}}\right) \left(\sum_{h=0}^{+\infty} \left(-\frac{\hbar}{2}\right)^{h} \! \frac{1}{h!} \overleftarrow{\partial}^h_a \overrightarrow{\partial}_{\overline{a}}^h  \right) g
\end{split}
\end{equation}

I also thought about the fact that a linear map from certain classes of functions of $\mathbb{R}^n$ (different versions, e.g. $\mathcal{C}^{\infty}_c(\mathbb{R}^n)$) which commutes with translations is a convolution operator (there is also a continuity condition, so one has to specify the topology on the space of functions, and this will constrain the convolution operator: convolution with what kind of function or distribution). Unfortunately, a quick computation shows that it would be a convolution with the Fourier transform of $e^{\frac{\hbar}{2}k^2}$ which does not make sense...
$$ \begin{split}
T(f) &= e^{-\frac{\hbar}{2} \partial_{ a\, \overline{a}}} \frac{1}{(2\pi)^2} \int_ {\mathbb{R}^2} \hat{f}(k,\overline{k})\, e^{ika +i\overline{k}\overline{a}}\, dk\, d\overline{k} = \frac{1}{(2\pi)^2} \int_ {\mathbb{R}^2} \hat{f}(k,\overline{k})\,e^{\frac{\hbar}{2} k\overline{k}}\, e^{ika +i\overline{k}\overline{a}}\, dk\, d\overline{k}
\\
&= \frac{1}{(2\pi)^2} \int_ {\mathbb{R}^2} \left(\int_ {\mathbb{R}^2} f(b,\overline{b})\,e^{-ikb -i\overline{k}\overline{b}} db\, d\overline{b}\right) e^{\frac{\hbar}{2} k\overline{k}}\, e^{ika +i\overline{k}\overline{a}}\, dk\, d\overline{k}\\
&=  \frac{1}{(2\pi)^2} \int_ {\mathbb{R}^2} f(b,\overline{b}) \left(\int_ {\mathbb{R}^2}  e^{\frac{\hbar}{2} k\overline{k}}\, e^{ik(a-b) +i\overline{k}(\overline{a}-\overline{b})}\, dk\, d\overline{k}\right) db\, d\overline{b}
\end{split}$$
Writing things differently also leads to the same result:
$$\begin{split}
T(f) &= \mathcal{F}^{-1}\circ\mathcal{F}\left(\sum_{j=0}^{+\infty} \frac{1}{j!} \left(-\frac{\hbar}{2} \partial_{ a\, \overline{a}}\right)^j f\right) \\
&=\sum_{j=0}^{+\infty} \frac{1}{j!} \left(-\frac{\hbar}{2}\right)^j (ik)^j (i\overline{k})^j f
\end{split}$$
Way out: $T$ seems to be unbounded but one can always imagine that its "inverse" (we didn't define its domain and target space...) could be convolution by a Gaussian. Another possibility would be to take a modified Fourier transform, $ \hat{f}(k,\overline{k}) := \int_ {\mathbb{R}^2} f(a,\overline{a})\, e^{- ika +i\overline{k}(\overline{a}-\overline{b})}\, da\, d\overline{a}$ or as remarked, take a Laplace transform. cf. also Inverse Weierstrass transform


Como passar uma URL no Parâmetro de uma API

Question: Como passar uma URL para um API
public class HTTPController : ControllerBase
{
    [HttpGet("URL={URL}")]
    public JsonResult GETURL(string URL)
    {
    }
}

No entanto ao passar por exemplo https://google.pt isto não interpreta como parâmetro
Eu tentei passar assim "http%3A%2F%2Fgoogle.pt" mas nao funciona na mesma
Comment: Esqueci de perguntar controller? Cara coloque mais informações ...
Comment: Como está passando?
Comment: http://localhost/HTTP/GETURL/URL=http://google.pt
Comment: chama-se http eu actualizei o codigo
Comment: tentei assim mas nao funciona localhost/HTTP/GETURL/URL=http%3A%2F%2Fgoogle.pt
Answer: A rota gerada pelo seu código será:
/http/URL={paramêtro}

Passar o parâmetro https://google.pt não funciona porque não é possível passar parâmetros com / via rota, caso queira fazer isso, terá que encodar o parâmetro de alguma forma.
De qualquer forma recomendo passa-lo via query string. Seu código ficaria assim:
[HttpGet("[action]")]
public JsonResult GETURL([FromQuery] string URL)

Rota gerada:
/http/geturl?URL={paramêtro}

Comment: Encodei assim http%3A%2F%2Fgoogle.pt mas nao funcionou
Comment: Testei aqui e funcionou normal encodando. Fique atento a rota da sua action pra ver se ta batendo certinho. Na minha resposta eu coloquei a rota que seu código gera.
Comment: usei Base64 Encode e funciounou cetinho


XSL:fo capsules table rows and cells

Question: Hey guys is there a way in XSL:FO to capsule the rows and cells of a table or must capsule tables into tables to get a solution.
Here is a picture how the table should look like:
Comment: You can certainly set individual borders like border-left and border-top
Comment: nice it works but one Question if i want to indent my text i Use start-ident='2mm' It only works for the first block (in the block into block statements its always the same
Comment: Use either margins or padding on cells or the blocks in the cells.
Comment: I posted answer below for you including margin/padding showing how to indent contents
Comment: With the padding it works good for the design but if i want to insert text the rows must be the same ; I need the same row level :(
Answer: You can certainly set individual borders like border-left and border-top. To indent text content as requested you can set padding on cell for entire content or margin on block inside the cell.
<code>            <fo:table width="100%">
            <fo:table-column column-width="33%"/>
            <fo:table-column column-width="33%"/>
            <fo:table-column column-width="33%"/>
            <fo:table-body>
                <fo:table-row>
                    <fo:table-cell padding-left="1in" border-left="1px solid red">
                        <fo:block>padding on cell</fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-left="1px solid red">
                        <fo:block margin-left="1in">margin on block</fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-left="1px solid red">
                        <fo:block>No padding</fo:block>
                    </fo:table-cell>
                </fo:table-row>
            </fo:table-body>
        </fo:table>
</code>
NOTE: Your results will depend on the renderer you are using. Apache incorrectly renders this overlapping the text in the last cells, other formatters do not. You would need to play with it to ensure you are OK with FOP.

XSL:fo capsules table rows and cells


Smartphone emulation software

Question: With the new Exchange boxes going in, I'd like to do some thorough testing on smartphone features, as well as being able to provide salesman-proof documentation (I'm a dreamer).  We've got drastic smartphone-creep, and people have been allowed to expect connectivity on everything from iPhones to Q's to Blackberries.  (thanks, boss!)
Rants aside, has anyone else out there been cursed with supporting every smartphone on the planet, and are there good emulators out there to allow testing/documentation?
So far, what's out there seems aimed at developers, and I suspect this would make more sense if I were starting with the SDK and working my way outward.  Currently, I seem to be in this repeating pattern of downloading & installing a lot of square pegs & round holes.
(using the beginner tag as I have zero idea about these things...)
post-RTFM edit - is this doable without installing Visual Studio and the SDK?  I truly don't want to develop, just test.  I'm a big Google-fail on this one.
Comment: You can avoid VS but you'll have to install the SDK to get them to work. Worst case, you can always do this all in a virtual machine so your not installing random developer tools on your computer. That's what I usually do.
Answer: Here's some info on windows mobile devices;
This one has a 'free login' wall, you gotta reg to see it but its free -> http://searchmobilecomputing.techtarget.com/tip/0,289483,sid40_gci1263217,00.html
Some more information as well, that doesn't require an account -> http://myitforum.com/cs2/blogs/mnielsen/archive/2009/06/04/windows-mobile-6-5-device-emulators-and-more-6-5-information.aspx
Its the WinMo 6.5 (and other versions prob) available from microsoft. 6.5 is available here -> http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=20686a1d-97a8-4f80-bc6a-ae010e085a6e
5.0 emulator here -> http://www.microsoft.com/downloads/details.aspx?familyid=52fed581-8f8d-4c46-9966-4832098191b7&displaylang=en
Even though these are SDKs, you CAN get network connectivity to them (look at the bottom of the second link I gave you) so you can test exchange connectivity.
Enjoy
Answer: You need to install the windows mobile 6 SDK
This will give you an emulator to run a virtual winmobile phone.  The problem is it's a generic windows mbile phone and almost no manufacturers/carriers can resist screwing around with it to put thier own features on it or remove ones they don't like.  Having been through the "we'll support anything" phase I'd encourage you to document how much time you spend on various devices and push to pick one standard device connection type (blackberry or activesync) at a minimum.
Comment: I couldn't agree more on standardizing - unfortunately I'm the only one here who agrees...
Comment: that's why I say document time spent screwing with devices. As an example if you can show that each blackberry cost the company $10 a day in support costs whereas each activesync device costs $0 (because OWA supports mobile for free so any troubleshooting is billed to the OWA systems) you can make a pretty good busines case for standardizing- that being said once a "C" level gets a bee in his bonnet about something it's usually hopeless.
Answer: The HTC Hero running android has Exchange support apparently.
For android there is the SDK with an emulator, you will need to load a hero rom, which you can get from xda-devs. I heard it is possible, I do not know how unfortunately.

Smartphone emulation software


Knockout data-bind doesnot work on div element

Question: I am following one of the tutorials of knockout The code works fine when i bind "foreach:lines" to "tbody" element. However, if i try binding "foreach" to a div element, it fails and throws an error.
working code

            <select data-bind="options:$parent.products,value:product,optionsText:'shortDescription', optionsCaption:'Select a product ...'"></select>

However, if i wrap the tr with a div and move data-bind="foreach:lines" to the div element:

            <select data-bind="options:$parent.products,value:product,optionsText:'shortDescription', optionsCaption:'Select a product ...'"></select>

With above code it throws error

Uncaught Error: Unable to parse bindings.Message: ReferenceError: $parent is  not defined;Bindings value:

Please let me know how is binding foreach to div different from tbody element
Comment: Knockout can only work on valid HTML. Your code is not valid HTML because use cannot put a `div` directly inside the `tbody` and the browsers are just removing the `div` element from the DOM that is why your inner bindings are not working...
Answer: A div is not a valid child of a table or tbody, no browser will actually render it that way.  Chrome for instance will place that div before the table (and not within your table as you wanted).

                <select data-bind="options:$parent.products,value:product,..."></select>

In the context of the select element, $parent does not exist, hence the error.
Use valid html and knockout will work.

If you wanted to repeat those rows that way, you would have to use containerless controls.  Comments can be placed almost anywhere, like here.

                    <select data-bind="options:$parent.products,value:product,..."></select>


Should forecasts from a neural network regression model be constant?

Question: Quick question -
I have built an LSTM RNN model for some data I am trying to forecast.
I've noticed that if I feed my model the same data (after training in order to get a forecast) over and over it generates a different prediction each time. In my head, it SEEMS reasonable that this would happen - I'm not training the model so every time I feed it the data point it hasn't "seen" the data before, and will generate a new (and likely different) prediction each time.
However, I am wondering why. Intuition usually isn't enough for me, and it also seems that if you're traing an LSTM RNN for regression, given a y the regression equation should give you the SAME result, not a different one each time. Is there a reason I am noticing this behavior? Could someone link me to some articles or show me why I would be noticing this - perhaps mathematically?
For reference, I am using Tensorflow to generate the model. Since I am still pretty new to the Tensorflow API, I have some doubt due to the different predictions given the same data, and this would go a long way in clearing up my confusion.
Thank you!
Answer: While I've never used LSTM RNN or TensorFlow, from my experience using FFNN for forecasting, the weights for initialization are random each time you run it. This leads to different results for each time you run the model and forecast. You could build the models many times (like 30+ depending on runtime) and average them to get a mean of how the different initialization results produce different models. In R, the way this is avoided is using set.seed()


resultado api azure diferente do resultado do meu local

Question: Criei uma API C# no azure onde ela me retorna um array passando os seguintes paramentos:
tccapiwebservice.azurewebsites.net/api/Algoritimos/PostAlgoritimo?_funcobjetiva=5,00;3,50&_maxmin=true&_restricoes=1,5;1.1;0.0;1&_sinalres=2;2;2&_valoruni=400;150;300&_tipo=true

Essa versão é a mesma que esta rodando no meu local, só que quando passo os mesmos parâmetros para a API local ele me traz resultados diferentes, segue os mesmos:
API azure (resultado inesperado)

API local (resultado esperado)

Não sei o porque estão dando resultados diferentes.
Comment: repare que o separador decimal no azure é `.` e no local é `,` se você não está tratando isso corretamente, certamente terá problemas
Comment: muito obrigado, era exatamente isso! Para arrumar eu coloquei no meu webconfig a tag globalization como padrão culture pt-BR!
Answer: Verifique a configuração de culture pois no azure o separador decimal está o ponto (.) e local está vírgula (,).
Como nos parâmetro você passa valores com separadores, pode estar acontecendo erro ao tratar esses valores.
Como informado pelo colega, ele resolveu colocando a tag globalization no web.config como padrão PT-BR


Getting data from a backend server side file and displaying it on a client side html site

Question: I have an AWS server that continually runs a program on the background updating a txt file. I want to make calculations with the latest file data and display it on an html page.
(I will also be using systemctl to host the html on the server)

I tried using fs but it's just not possible to access since it's a client side I think, I also tried searching for the situation I'm in but just can't find anything on it.
(Note: First time trying something like this and using a server so not sure what I can/can't do)
Comment: Well, a server running something like php/python that can open and serve the file combined with the website running javascript websockets would be the best option. However, a backup option is using javascript and accessing the file via fetch on a timer would work too although not the best option
Comment: If you want to modify the data from the txt file and have it be written back to the txt file, then you will need something on the server to take that data and write it to the file.
Comment: Also, another thing to take into consideration is the update schedule of the txt file. If its constant like every few seconds web sockets would be the best option. If its something updated less regularly like daily etc.. then fetch would be the better option
Comment: You can use `fetch()` to download the file into the client application.
Comment: @imvain2 The only one making modifications to the file is the program thats running on the background i just want to look, make a few calculations and display it to the client side.
Also it runs each 30m Should have written it better , edited now
Answer: I think AJAX can help you, fetch function to be more specific
I suggest following solution
If this script works on your server you can make asynchronous function in javascript, that will fetch data from server once in a while and then using JS update table on frontend
Or, as It was suggested in comments - use WebSockets with its JavaScript API


Need help understanding puppeteer node async functions

Question: Hey I guys I'm having a hard time understanding the behavior of my puppeteer code
const puppeteer = require("puppeteer");
const sleep = require("sleep");

const runPuppeteer = () => {
  puppeteer
    .launch({
      headless: true,
      args: ["--no-sandbox", "--disable-setuid-sandbox"],
    })
    .then(async (browser) => {
      const page = await browser.newPage();
      await page.setViewport({ width: 1200, height: 800 });
      await page.goto("https://www.chevrolet.co.kr/chevy/as.gm?");

      dataHolder = [];

      for (let i = 0; i < 84; i++) {
        inventoryTransferTableTags = await page.$$(".list");
        for (let i = 0; i < 5; i++) { // **** Loop #1 ****
          console.log(i);
          i = inventoryTransferTableTags[i];
        }
        console.log("--------------");
        sleep.sleep(3);
      }
    });
};

runPuppeteer();

From loop #1, I was expecting to to see
console.log(i) -> 0,1,2,3,4 but I get an output of
0
--------------
it seems that
i = inventoryTransferTableTags[i]
has an async issue, but I have no idea how to deal with it - should I make a promise for this single line?
Thanks for help in advance!
Answer: You're successfully logging the value of i on the first iteration of the loop:
console.log(i);

But look at what you do immediately afterward:
i = inventoryTransferTableTags[i];

So what's the value of i now?  Clearly, whatever it is, i < 5 is now false because the loop terminates and your next operation is performed:
console.log("--------------");

When you modify the loop iterator value, you can terminate the loop.


Autocorrelation of a constant function

Question: I have to compute the autocorrelation function (see here) of a signal $X_t$
$${\displaystyle {\hat {R}}(k)={\frac {1}{(n-k)\sigma ^{2}}}\sum _{t=1}^{n-k}(X_{t}-\mu )(X_{t+k}-\mu )}.$$
My problem is that the function always takes the same value for all times, i.e. it is constant. This would lead to $\sigma^2 = 0$ and $X_t=\mu$ for all $t$, i.e. a "$\frac{0}{0}$ situation".
How is the autocorrelation defined in such a situation?
My attempt at resolving this would be $\hat R(k)=0$ since the numerator is always $0$. However, the signal is always perfectly correlated with itself so should we have $\hat R(k) = 1$?
Answer: Same as with regular correlation, it is undefined. Same as with correlation with a constant variable, if a function is constant, there is no point in calculating autocorrelation.

Autocorrelation of a constant function


If a holomorphic function $f$ has modulus $1$ on the unit circle, why does $f(z_0)=0$ for some $z_0$ in the disk?

Question: I don't understand the final step of an argument I read.
Suppose $f$ is holomorphic in a neighborhood containing the closed unit disk, nonconstant, and $|f(z)|=1$ when $|z|=1$. There is some point $z_0$ in the unit disk such that $f(z_0)=0$.
By the maximum modulus principle, it follows that $|f(z)|<1$ in the open unit disk. Since the closed disk is compact, $f$ obtains a minimum on the closed disk, necessarily on the interior in this situation.
But why does that imply that $f(z_0)=0$ for some $z_0$? I'm aware of the minimum modulus principle, that the modulus of a holomorphic, nonconstant, nonzero function on a domain does not obtain a minimum in the domain. But I'm not sure if that applies here.
Comment: "I'm aware of the minimum modulus principle, that the modulus of a holomorphic, nonconstant, nonzero function on a domain does not obtain a minimum in the domain. But I'm not sure if that applies here."  Yes, it applies here.  Why wouldn't it?  If $f$ had no zeros in the unit disk then that theorem would be contradicted.
Comment: If $f$ has modulus 1 on the entire unit _disk_, then the function has to be constant. However, what you write in the body of the question just requires $|f(z)=1|$ on the unit _circle_.
Comment: Dear @HenningMakholm, thanks, I accidentally used the wrong word. I've now changed it to circle.
Answer: If not, consider $g(z)=\frac 1{f(z)}$ on the closure of the unit disc. We have $|g(z)|=1$ if $|z|=1$ and $|g(z)|>1$ if $|z|<1$. Since $g$ is holomorphic on the unit disk, the maximum modulus principle yields a contradiction.
Comment: Thanks. So the key point is that if $f(z)\neq 0$ for any $z$ in the disk, then $g$ is well-defined and this argument works? So we must have $f(z)=0$ for some $z$ somewhere in the interior.
Comment: Yes, that's indeed the key point.


Compute $I = \int_0^{2\pi} \frac{ac-b^2}{[a \sin(t)+ b \cos(t)]^2+[b \cos(t)+ c \sin(t)]^2}dt$

Question: How do you compute
$$I = \int_0^{2\pi} \frac{ac-b^2}{[a \sin(t)+ b \cos(t)]^2+[b \cos(t)+ c \sin(t)]^2}dt = 2 \pi \ \mathrm{sign}(ac-b^2) $$
which comes up when computing the Poincare index? Wolfram does not work out at all or give the steps :(
It comes from Courant/John volume 2 page 357-358
https://i.stack.imgur.com/5kexM.png
Comment: I don't think your RHS is right, but you may find many details below.
Answer: I will show you an overkill, but a useful one (at least, IMHO). If the quadratic form
$$ q(x,y) = A x^2 + 2B xy + C y^2 $$
associated with the matrix
$$ M_q=\begin{pmatrix} A & B \\ B & C\end{pmatrix}$$
is positive definite, i.e. (by Sylvester's criterion) $A>0$ and $AC-B^2>0$, then the integral
$$ I_q = \iint_{\mathbb{R}^2}\exp\left(-q(x,y)\right)\,dx\,dy $$
is convergent and its value equals $\frac{\pi}{\sqrt{\det M_q}}=\frac{\pi}{\sqrt{AC-B^2}}$. The proof relies on the spectral theorem, Fubini's theorem and the fact that the determinant of $M_q$ is the product of its eigenvalues. What happens if we perform a change of variables, for instance if we switch to polar coordinates? We get:
$$ I_q = \int_{0}^{2\pi}\int_{0}^{+\infty}\rho\exp\left(-\rho^2 q(\cos\theta,\sin\theta)\right)\,d\rho\,d\theta=\frac{1}{2}\int_{0}^{2\pi}\frac{d\theta}{q(\cos\theta,\sin\theta)}.$$
In your case, the coefficients of the quadratic form $q$ are:
$$ A=2b^2,\qquad B=ba+bc,\qquad C=a^2+c^2.$$
Can you guess now what the value of your integral has to be? I got:

$$ \int_{0}^{2\pi}\frac{dt}{(a\sin t+b\cos t)^2+(b\cos t+c\sin t)^2}=\color{red}{\frac{2\pi}{\left|b\right|\cdot\left|a-c\right|}}$$
  under the assumptions $b\neq 0$ and $a\neq c$.
Answer: The response by Jack is undoubtedly the swift and elegant way to solve the problem, but presumes some linear algebra and multivariable calculus knowledge. For giggles, I thought I'd provide a solution accessible to first year calculus students based on the tangent half-angle substitution. As Jack noted, the problem statement in its current form is incorrect.
Given $0<a^{2}+c^{2}\land0<b^{2}+d^{2}\land0<\left(ad-bc\right)^{2}$, we have
$$\begin{align}
I{\left(a,b,c,d\right)}
&:=\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{\left[a\sin{\left(\theta\right)}+b\cos{\left(\theta\right)}\right]^{2}+\left[c\sin{\left(\theta\right)}+d\cos{\left(\theta\right)}\right]^{2}}\\
&=\small{\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{\left[a^{2}\sin^{2}{\left(\theta\right)}+2ab\sin{\left(\theta\right)}\cos{\left(\theta\right)}+b^{2}\cos^{2}{\left(\theta\right)}\right]+\left[c^{2}\sin^{2}{\left(\theta\right)}+2cd\sin{\left(\theta\right)}\cos{\left(\theta\right)}+d^{2}\cos^{2}{\left(\theta\right)}\right]}}\\
&=\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{\left(a^{2}+c^{2}\right)\sin^{2}{\left(\theta\right)}+2\left(ab+cd\right)\sin{\left(\theta\right)}\cos{\left(\theta\right)}+\left(b^{2}+d^{2}\right)\cos^{2}{\left(\theta\right)}}\\
&=\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{\left(a^{2}+c^{2}\right)\left(1-\cos^{2}{\left(\theta\right)}\right)+2\left(ab+cd\right)\sin{\left(\theta\right)}\cos{\left(\theta\right)}+\left(b^{2}+d^{2}\right)\cos^{2}{\left(\theta\right)}}\\
&=\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{\left(a^{2}+c^{2}\right)+2\left(ab+cd\right)\sin{\left(\theta\right)}\cos{\left(\theta\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\cos^{2}{\left(\theta\right)}}\\
&=\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{\left(a^{2}+c^{2}\right)+\left(ab+cd\right)\sin{\left(2\theta\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\left(\frac12+\frac12\cos{\left(2\theta\right)}\right)}\\
&=2\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{2\left(a^{2}+c^{2}\right)+2\left(ab+cd\right)\sin{\left(2\theta\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\left(1+\cos{\left(2\theta\right)}\right)}\\
&=2\int_{0}^{2\pi}\frac{\mathrm{d}\theta}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)+2\left(ab+cd\right)\sin{\left(2\theta\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\cos{\left(2\theta\right)}}\\
&=\small{\int_{0}^{4\pi}\frac{\mathrm{d}\varphi}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)+2\left(ab+cd\right)\sin{\left(\varphi\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\cos{\left(\varphi\right)}}};~~~\small{\left[2\theta=\varphi\right]}\\
&=\int_{0}^{2\pi}\frac{\mathrm{d}\varphi}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)+2\left(ab+cd\right)\sin{\left(\varphi\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\cos{\left(\varphi\right)}}\\
&~~~~~+\int_{2\pi}^{4\pi}\frac{\mathrm{d}\varphi}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)+2\left(ab+cd\right)\sin{\left(\varphi\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\cos{\left(\varphi\right)}}\\
&=2\int_{0}^{2\pi}\frac{\mathrm{d}\varphi}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)+2\left(ab+cd\right)\sin{\left(\varphi\right)}+\left(b^{2}+d^{2}-a^{2}-c^{2}\right)\cos{\left(\varphi\right)}}\\
&=\small{2\int_{-\pi}^{\pi}\frac{\mathrm{d}\psi}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)-2\left(ab+cd\right)\sin{\left(\psi\right)}+\left(a^{2}-b^{2}+c^{2}-d^{2}\right)\cos{\left(\psi\right)}}};~~~\small{\left[\varphi-\pi=\psi\right]}\\
&=\int_{-\infty}^{\infty}\frac{2}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)-2\left(ab+cd\right)\left(\frac{2t}{1+t^{2}}\right)+\left(a^{2}-b^{2}+c^{2}-d^{2}\right)\left(\frac{1-t^{2}}{1+t^{2}}\right)}\\
&~~~~~\times\,\frac{2}{1+t^{2}}\,\mathrm{d}t;~~~\small{\left[\tan{\left(\frac{\psi}{2}\right)}=t\right]}\\
&=\small{\int_{-\infty}^{\infty}\frac{4}{\left(a^{2}+b^{2}+c^{2}+d^{2}\right)\left(1+t^{2}\right)-2\left(ab+cd\right)\left(2t\right)+\left(a^{2}-b^{2}+c^{2}-d^{2}\right)\left(1-t^{2}\right)}\,\mathrm{d}t}\\
&=\int_{-\infty}^{\infty}\frac{2}{\left(a^{2}+c^{2}\right)-2\left(ab+cd\right)t+\left(b^{2}+d^{2}\right)t^{2}}\,\mathrm{d}t\\
&=\small{\int_{-\infty}^{\infty}\frac{2}{\left(a^{2}+c^{2}\right)-2\left(ab+cd\right)\left(u+\frac{ab+cd}{b^{2}+d^{2}}\right)+\left(b^{2}+d^{2}\right)\left(u+\frac{ab+cd}{b^{2}+d^{2}}\right)^{2}}\,\mathrm{d}u};~~~\small{\left[t=u+\frac{ab+cd}{b^{2}+d^{2}}\right]}\\
&=\int_{-\infty}^{\infty}\frac{2}{\frac{\left(ad-bc\right)^{2}}{b^{2}+d^{2}}+\left(b^{2}+d^{2}\right)u^{2}}\,\mathrm{d}u\\
&=\int_{-\infty}^{\infty}\frac{2}{1+\frac{\left(b^{2}+d^{2}\right)^{2}}{\left(ad-bc\right)^{2}}u^{2}}\cdot\frac{\left(b^{2}+d^{2}\right)}{\left(ad-bc\right)^{2}}\,\mathrm{d}u\\
&=\frac{2}{\left|ad-bc\right|}\int_{-\infty}^{\infty}\frac{\mathrm{d}x}{1+x^{2}};~~~\small{\left[\frac{\left(b^{2}+d^{2}\right)u}{\left|ad-bc\right|}=x\right]}\\
&=\frac{2\pi}{\left|ad-bc\right|}\\
\end{align}$$
Setting $d=b$, we find
$$I{\left(a,b,c,b\right)}=\frac{2\pi}{\left|a-c\right|\cdot\left|b\right|};~~~\small{b\neq0\land c\neq a}.\blacksquare$$
Comment: @Thramo The formula printed in Courant is incorrect. Try plugging in values for $a,b,c$ into Courant's formula and comparing the LHS and RHS numerically. For example, setting $a=2,b=1,c=-2$ the integral on the LHS will equal $-\frac52\pi$, but the expression on the RHS is $-2\pi$.
Comment: Hi, thank you! But I don't think it's mis-stated:
http://i.stack.imgur.com/5kexM.png
(Courant/John volume 2 page 357-8) If you replace $d = c$ and $c = b$ in your solution it gives the answer in this link right? Unfortunately I don't see why the other post works, I do know Gaussian integrals but... Thanks!
Comment: @Thramo: I agree. Even giants make mistakes, sometimes.


SQL Server 2008 error - Incorrect syntax near '%'. [SQLSTATE 42000] (Error 102). The step failed

Question: I have a SQL query that fails with the above error when used in a SQL job designed to email the query results.  The syntax is fine when running a normal query.
I see that other people have had this issue when using non-standard characters in server names, but my issue is with the % signs in my query I think and the other solutions don't work for me :
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQL-Server',
@recipients = 'XXXXX',
@subject = 'Missing Essence File Check',
@query = N'SELECT *   FROM ([omnibus].[dbo].[OmniBus_CLP_Clips] CLP
inner join [omnibus].[dbo].[OmniBus_CLD_ClipDetails] CLD on CLP.FLE_ID = CLD.FLE_ID)
inner join [omnibus].[dbo].[OmniBus_FLE_Files] fle on clp.FLE_ID = fle.fle_id
where CLD_user_data  like '%.mov%'
and CLD_user_data  not like '%.m2v%'
and CLD_user_data  not like '%.wav%'
and fle.FLE_file_deleted = 0;',
@attach_query_result_as_file = 1,
@query_attachment_filename = 'Missing Essence File Check.txt'

Can anyone advise on how to overcome this error?
Thanks,
Rob
Comment: Look at the syntax highlighting.
Comment: You need to escape your single quotes by doubling them.   Any good dynamic sql tutorial should demonstrate this.
Answer: You can change this line.
where CLD_user_data  like '''%.mov%'''
and CLD_user_data  not like '''%.m2v%'''
and CLD_user_data  not like '''%.wav%'''

Comment: This worked, but you've put 3 single quotes around each file extension and it should actually be two.


Jquery modal dialog and form submit

Question: I have a form where I need to display a confirm dialog to the user before saving.
I have done this by intercepting the form submit function as follows:
$("#my_form").submit(function(e) {
    if ($("#id").val() > 0) {
        var $dialog = $('

')
            .html('Are you sure?')
            .dialog({
                autoOpen: false,
                title: 'Save New Invoice',
                modal: true,
                buttons: {
                    "OK": function() {
                        $dialog.dialog('close');
                        $("#my_form").submit();
                    },
                    Cancel: function() {
                        $(this).dialog("close");
                    }
                }
            });
        $dialog.dialog('open');
        e.preventDefault();
        return false;
    }
});

However, the OK button does not function correctly - the dialog does not close and the form is not submitted.
If I change the OK function as follows, then the dialog is closed and the alert is shown.
"OK": function() {
  $dialog.dialog('close');
  alert('form will be submitted');
},

So, I am guessing that this is something to do with the $("#my_form").submit(); method.
Comment: You're posting another form (#invoice_edit_form) when the form (#my_form) is being submitted?
Answer: Isn't this like calling your form submit function again and again. I see you are attaching the function to submit functionality, and when you call the submit again,it is invoking the same function.
Your $("#invoice_edit_form") is some other form.Is it like asking one form to submit other form?
Comment: Sorry, that was a typo on my part, which I have corrected. All form references should be $("#my_form")
Comment: Well, duh, of course its resubmitting the form again and again. How stupid of me. And its not even a Monday. Thanks for pointing that out.
Answer: The problem you've got is that your submit handler always returns false and has e.preventDefault() too for good measure. Both of these will stop the form being submitted, regardless of whether the user clicked OK or Cancel.
You need to change the logic so that your modal confirmation is shown on a button click (or any other event), not on the form submission. Then, if the user clicks ok you can call the forms' submit() method.
$("#submitButton").click(function(e) {
    if ($("#id").val() > 0) {
        var $dialog = $('

')
            .html('Are you sure?')
            .dialog({
                autoOpen: false,
                title: 'Save New Invoice',
                modal: true,
                buttons: {
                    "OK": function() {
                        $dialog.dialog('close');
                        $("#my_form").submit();
                    },
                    Cancel: function() {
                        $(this).dialog("close");
                    }
                }
            });
        $dialog.dialog('open');
    }
});

Comment: I'm looking for the same answer. I tried this solution on jsFiddle. It validated and it worked, sorta. Pressing the button causes a dialog that flashes then disappears. Here's the link http://jsfiddle.net/mjstelly/xfYgV/5/

Jquery modal dialog and form submit


Evaluate the relative importance of variables using PCA

Question: I have a large set (100+) of variables on which I'm performing PCA. The PCA returns me a list of components, each of which is in turn a list of the weights to be placed on my variables in a linear combination.
What I want to do is use these numbers to evaluate the relative importance of each variable in describing the dataset. I don't want to just look at the absolute values of the weights in the first principal component, as that would ignore all the other components. However I also don't want to just sum the weights of each variable in all the principal components, since that doesn't take into account the fact that earlier components are more important than later ones.
One idea I've been told is to, for each variable, do a weighted average of the weights, where each weight is multiplied by the variance that the corresponding component represents. The logic is that that does make the earlier components (i.e. the ones with larger variance) have greater importance than the later ones (the ones with smaller variance). Would this be a sound idea? Is there another, better solution?
Comment: The *measure* of importance depends on what you *mean* by importance. *Why* do you want to evaluate importance? What is your underlying purpose?
Comment: Sorry to be pedantic. What is the meaning of *'critical'*?
Comment: What do you mean by *importance*? Some average or other function of correlation of one variable with the others, is importance?
Comment: That is exactly my question. What is a good measure of the importance and effect of a variable in describing the data set, with regards to PCA?
Comment: I want to look at which variables are most critical and which are least critical. In my specific case my variable matrix is a TFIDF matrix constructed from a textual dataset.
Comment: Ah, I see. Basically, I want to apply feature selection on the original features and not the transformed ones (the components), using the loadings/weights as my selection criteria.
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/61924/discussion-between-martijn-weterings-and-bluefire).
Answer: A problem with your question is illustrated in the example below.
The points vary mostly in two directions (it is roughly a disk shape) and so the data may be reduced into two dimensions without loosing lot's of information (in terms of variance, possibly that tiny bit of variation may be important, first determine whether that viewpoint of amount of variance=information/importance applies).
Rather than selecting the largest PC's, PC1 and PC2 (which are transformations of x1, x2 and x3), one may consider instead to choose a set of the original parameters that also describes a large amount of the variation. Reducing the number of x's, for instance because it requires time to measure or space to store the information. This seems to be your goal.
Note in this example that x1 and x2 correlate strongly with the PC's and have high weights. Yet, it is better to select x1 + x3 or x2 + x3. This is because x1 and x2 correlate strongly with each other and after selecting one of x1 and x2 as important, the other one does not provide much more value. The contrast X1-X2 correlates only with the small variance of PC3).
What the PCA does is just showing you a structure perpendicular components generated in order of maximum variance. The goals of a PCA is to observe an underlying structure in a complex system of many variables. It does not give you an answer to reduce the dimensionality by selecting less variables (instead, it allows you to reduce the dimensionality by transformation, but this still requires all of the original variables).
What you could better do is write an algorithm selecting and switching variables until a maximum explained variance is achieved.

R code to generate the image
<code>#generating three random PC's
set.seed(1)
PC1 = rnorm(100,0,1)
PC2 = rnorm(100,0,0.5)
PC3 = rnorm(100,0,0.1)

#transformation back into underlying parameters
x1 = PC1 - PC3
x2 = PC1 + PC3
x3 = 0.2*PC1 + PC2

#plotting
library("plot3D")
for (theta in c(0:120)*3) {
  if (theta < 10) {n = paste0('000',theta)}
  if (theta < 100 && theta >= 10) {n = paste0('00',theta)}
  if (theta >= 100) {n = paste0('0', theta)}

  name=paste0("~/Desktop/gifs/image_",n,".png")
  png(name)
  scatter3D(x1,x2,x3,xlab="x1",ylab="x2",zlab="x3",col=1,pch=19,theta=theta,phi=30)
  dev.off()
}

system("convert ~/Desktop/gifs/image*.png -delay 1 -loop 0 ~/Desktop/gifs/3D.gif")
</code>
Comment: That's a really insightful take, thank you for putting in the time to do this?
Comment: The given example and suggestion for an alternative method are based on a model (with reduced number of variables) that 'maximizes the explained variance in the other variables'. Possibly you wish to optimize a model that 'maximizes the success of a prediction of some kind' (for instance predicting a classification).
Comment: The latter is true, but would the former not achieve the same goal?
Comment: You can also approach the problem in reverse, finding out which variables are less needed, using techniques such as _battery reduction_.
Comment: Using the example. Imagine that an important classification has only a *small* effect on the variation, in the contrast X1-X2. Yet some other effect (not seen as important, possibly noise) is causing a *large* variation on the variables X1+X2. If the effect, classification, has only a small effect on the measured variables than PCA may not reveal this. Or actually, PCA may reveal this by showing that a small PC component can be used as a significant factor for some model. In this way you could use PCA as a filter, although there may be better methods for this. ie LDA, or non-linear techniques.


Calculations concerning the Gudermannian function

Question: I did calculations to get some simple expressions involving the Gudermannian function $$\text{gd}(x)=\int_0^x\frac{dt}{\cosh t}.$$
I don't sure if these statements are rights, but I know how do the calculations, thus my mistake should be a little detail.

Question 1. One has $$\lim_{x\to\infty}e^{-x}\int_0^xe^t\text{gd}(t)dt=\frac{\pi}{2},$$ and defining $$F(x)=\int_0^xe^t\text{gd}(t)dt,$$ then $$F''(x)-F'(x)=e^x(\text{gd}(x))'.$$
Are rights these claims? Only is required a yes, or where was my mistake.

And for the following, I know that there is a relationship satisfied by the Gudermannian function and the inverse tangent function (see in previous link to Wikipedia), then when I was exploring the calculation of the following integral with Wolfram Alpha $$\int_0^1\left(\frac{\pi}{2}+\text{gd}(x)\right)dx$$ I've asked to me

Question 2. Can you provide us hints to calculate $$\int_0^1 \arctan(e^x)dx?$$

Here is the code for previous online calculator

int arctan(e^x) dx, from x=0 to x=1
int arctan(e^x) dx

Many thanks.
Comment: i have found $$-C+\frac{1}{2} i (\text{Li}_2(-i e)-\text{Li}_2(i e))$$
Comment: C is the Catalan-constant and LI the polylog-function
Comment: Yes I compute it with previous code, but I don't know how calculate this, if it is a well known identity, you can add only some hints: how one can start to explore and deduce the statement? Very thanks much @Dr.SonnhardGraubner
Answer: Here is a solution to question 2. To evaluate
\begin{equation}
I = \int\limits_{0}^{1} \tan^{-1}(\mathrm{e}^{x}) \mathrm{d}x
\end{equation}
we begin by expressing the inverse tangent as logarithms:
\begin{equation}
\tan^{-1}(z) = \frac{i}{2} [\ln(1-iz) - \ln(1+iz)]
\end{equation}
thus our integral becomes
\begin{align}
I &= \frac{i}{2} \int\limits_{0}^{1} \left(\ln(1-i\mathrm{e}^{x}) - \ln(1+i\mathrm{e}^{x}) \right) \mathrm{d}x \\
&= \frac{i}{2} (I_{1} + I_{2})
\end{align}
To evaluate $I_{1}$ we make the substitution $z = i\mathrm{e}^{x}$
\begin{align}
I_{1} &= \int\limits_{0}^{1} \ln(1-ie^{x}) \mathrm{d}x \\
&= \int\limits_{i}^{i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z \\
&= \int\limits_{0}^{i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z - \int\limits_{0}^{i} \frac{\ln(1-z)}{z} \mathrm{d}z\\
&= \mathrm{Li}_{2}(i) - \mathrm{Li}_{2}(i\mathrm{e}) \\
&= i\mathrm{G} - \frac{\pi^{2}}{48} - \mathrm{Li}_{2}(i\mathrm{e})
\end{align}
To evaluate $I_{2}$ we make the substitution $-z = i\mathrm{e}^{x}$
\begin{align}
I_{2} &= \int\limits_{0}^{1} \ln(1+ie^{x}) \mathrm{d}x \\
&= \int\limits_{-i}^{-i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z \\
&= \int\limits_{0}^{-i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z - \int\limits_{0}^{-i} \frac{\ln(1-z)}{z} \mathrm{d}z\\
&= \mathrm{Li}_{2}(-i\mathrm{e}) - \mathrm{Li}_{2}(-i) \\
&= \mathrm{Li}_{2}(-i\mathrm{e}) - \left(-i\mathrm{G} - \frac{\pi^{2}}{48} \right)
\end{align}
Putting the pieces together, we obtain our final result
\begin{align}
I &= \frac{i}{2} (I_{1} + I_{2}) \\
&= \frac{i}{2} [\mathrm{Li}_{2}(-i\mathrm{e}) - \mathrm{Li}_{2}(i\mathrm{e})] - \mathrm{G} \\
&= \int\limits_{0}^{1} \tan^{-1}(\mathrm{e}^{x}) \mathrm{d}x
\end{align}
Notes:

$\mathrm{G}$ is Catalan's constant
$\mathrm{Li}_{2}(z)$ is the dilogarithm.
Expressions for $\mathrm{Li}_{2}(\pm i)$ can be found here.
Comment: Very thanks much for your answer.


How to open WebView in Popup Window in AsyncTask

Question: Editing code as per Armaan suggestion : Calling ImageView inside onPostExecute crashing application
Details : If i put close button and call its onClickListener inside onPostExecute it would crash, not sure what could be reason :
public class Async extends Activity {

/** Called when the activity is first created. */

ListView _rssFeedListView;
List<JSONObject> jobs;
List<RssFeedStructure> rssStr;
private BlogAdapter _adapter;
TextView textview;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listview);
    _rssFeedListView = (ListView) findViewById(R.id.rssfeed_listview);

    textview = (TextView) findViewById(R.id.loading);
    RssFeedTask rssTask = new RssFeedTask();
    rssTask.execute();

}

private class RssFeedTask extends AsyncTask<String, Void, String> {

    String response = "";
    PopupWindow popupWindow;
    ImageView image;

    @Override
    protected void onPreExecute() {
    }

    @Override
    protected String doInBackground(String... urls) {
        try {
            String feed = "http://someurl";
            XmlHandler rh = new XmlHandler();
            rssStr = rh.getLatestArticles(feed);
        } catch (Exception e) {
        }
        return response;

    }

    @Override
    protected void onPostExecute(String result) {
        if (rssStr != null) {

            _adapter = new BlogAdapter(Async.this, rssStr);
            _rssFeedListView.setAdapter(_adapter);
            textview.setVisibility(View.INVISIBLE);

            _rssFeedListView.setOnItemClickListener(new OnItemClickListener() {

                        @Override
                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                            LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
                            View layout = layoutInflater.inflate(R.layout.new_popup_layout, null);

                            popupWindow = new PopupWindow(layout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
                            WebView web = (WebView)layout.findViewById(R.id.webView1);
                            image = (ImageView) findViewById(R.id.closebutton);

                            web.getSettings().setJavaScriptEnabled(true);
                            web.getSettings().setLoadWithOverviewMode(true);
                            web.getSettings().setDefaultFontSize(10);
                            web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
                            web.setScrollbarFadingEnabled(true);

                            String text = " %s ";
                            String summary = rssStr.get(position).getEncodedContent();

                            Log.d("String", summary);
                            web.loadDataWithBaseURL(null, String.format(text, summary), "text/html", "UTF-8",null);
                            popupWindow.showAtLocation(view,Gravity.CENTER, 0, 0);

                            image.setOnClickListener(new OnClickListener() {
                            public void onClick(View v)
                     {
                            popupWindow.dismiss();
                     }
             });

                      }
            });

        }

    }

}

}

Answer: Try this:
Create Popupwindow Like this
LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
            View layout = layoutInflater.inflate(R.layout.new_popup_layout, null);
            final PopupWindow popupWindow = new PopupWindow(
                    layout,
                       LayoutParams.WRAP_CONTENT,
                             LayoutParams.WRAP_CONTENT);

WebView web = (WebView)layout.findViewbyId(R.id.webView1);
popupWindow.showAtLocation(view,Gravity.CENTER, 0, 0);

and create new_popup_layout layout file with webview like this:
         <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:orientation="vertical" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="right" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_dialog" />
    </TableRow>

    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_margin="10dp" />

</LinearLayout>

Hope it Helps!!
Comment: Armaan, onClick of back button it is exiting application. Is there any way if i press back button it would remain on same activity ?
Comment: This is my listview and onClick of ListItem I am showing this dialog, now after reading content in dialog, generally user would want to go back and see other list item but in this case if i press back button it would close activity and exit application. I know how to get back button event but m not sure what is the ideal solution to get what i want. Any idea ?
Comment: or can we have close button as it is shown in this image : http://i.stack.imgur.com/97aJX.png
Comment: Oops it is messing up webview layout...I guess something wrong with properties of
Comment: try this edited answer. and if it doesn't work then do inform.
Comment: Nop it didn't work :) This was even more messy. Can you please check from your side first and then suggest. Thanks
Comment: i have made the change. its woking fine for me. try yourself. if it doesn't work then do change in gravity and height width and other things.do some modifications yourself.
Comment: Ya thanks Armaan, I will do those change, but what is the code you call onClick of this ImageView ?
Comment: popupWindow.dismiss(); to dissmiss the popup.
Comment: Thanks Armaan, the UI issue got resolved. Now if i am putting this listener inside "onPostExecute" it won't work because it is calling immediately after creation of popup window. Then where else i can put this ? Updating code in Question. Thanks
Comment: create one function in activity for showing popup. means put all code from post execute to that function and call that function from postexecute. try that.
Answer: You can use custom dialogs, all you need to do is in your custom dialog's layout file put a WebView and then in your code give a source URL to your WebView according to the selected item in your ListView. For how to make a custom dialog take a look at here
http://www.mkyong.com/android/android-custom-dialog-example/
Comment: Onur, I tried as u suggested from that example but it didn't work. I have edited my code and placed error in question, please confirm it
Comment: your code for custom layout seems to much completed but apparently you found the solution
Comment: Yes Onur, thanks for your time and looking into it. Appreciate your efforts


Jenkins is not reachable if using prefix

Question: I am currently experiencing the problem that Jenkins is not reachable if I start it with a prefix. The prefix is necessary to get Jenkins available under myurl.de/jenkins (instead of myurl.de:8101).
My configuration file for apache2 /etc/apache2/sites-available/000-default.conf contains:
    ProxyPass /jenkins http://localhost:8101/ nocanon
    ProxyPassReverse /jenkins http://localhost:8101/
    ProxyRequests     Off
    AllowEncodedSlashes NoDecode

like described in https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache. If I run Jenkins solely with: java -jar jenkins.war --httpPort=8101 everything works fine, except a call to myurl.de/jenkins only creates a defect side, because the context path is wrong and other parts of the side, e.g. images, are loaded from wrong locations (from myurl.de/image.png instead of myurl.de/jenkins/image.png).
So like described in the link above, I've started Jenkins with java -jar jenkins.war --httpPort=8101 --prefix=/jenkins. Unfortunately, it says:
Running from: /home/dgr/jenkins2/jenkins.war
webroot: $user.home/.jenkins
Jan 29, 2016 2:25:50 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Jan 29, 2016 2:25:50 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-winstone-2.9
Jan 29, 2016 2:25:52 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: NO JSP Support for /jenkins, did not find org.apache.jasper.servlet.JspServlet
Jenkins home directory: /home/dgr/.jenkins found at: $user.home/.jenkins

and only responds with 404 both from :8101 and /jenkins. Is this a known bug? I could not find any other description of this behaviour.
Same happens when running Jenkins from the Docker container and setting JENKINS_OPTS --prefix=/jenkins). I am using latest Jenkins which is 1.646 and also latest Docker image. Different solutions like setting the path in the UI under Configure -> Jenkins URL like suggested in https://stackoverflow.com/questions/9089566/jenkins-website-root-path does not work either.
Answer: The proxy configuration and context path must match.
The proxy configuration example in the document you referenced assumes the context path is the default /.
You changed the context path for Jenkins to /jenkins.  To access it via localhost you would use the URL http://127.0.0.1:8101/jenkins.
The proxy configuration needs to be updated:
ProxyPass /jenkins http://localhost:8101/jenkins nocanon
ProxyPassReverse /jenkins http://localhost:8101/jenkins

Comment: Thanks, changing this (with adding tabs instead of spaces) and restarting apache did it!


React works in production but white screen in build

Question: I have a react app implemented with create-react-app. When I view the site locally using npm run start, it works fine. But when I build it using npm run build and view the built site, it's just a blank white screen with the following errors.
When I go into the compiled build/index.html and look at the links, they're all missing . before them, such as <link href="/static/css/main.60d8d896.chunk.css". and   Adding . before the / fixes many of the errors and makes the site no longer a blank white screen, but even after doing that to all of the links I can find many of the SVG icons on my site are completely missing and the console logs these errors.
It seems that for some reason the build is just messing up all of the links, which has never happened before and is unexpected considering the production version works fine.
Here's a gist of the compiled build/index.html, and here's the source code to the entire react app.
Comment: I just deleted all of the build files in my remote nginx and resent it with `scp` and it is working now, so I guess I just messed that part up. Thanks for your help!
Comment: Yes, just nginx on a VPS.
Comment: Does it work when you serve on your local machine using a static server like [serve](https://create-react-app.dev/docs/deployment/#static-server)?
Comment: I just tried that, and yes it works. That means the problem must be with my remote nginx server, but when I do sudo systemctl status nginx it shows it's actively running..
Comment: And when I stop the nginx server, the site doesn't load at all, meaning the white screen IS being served by nginx.
Answer: The problem turned out to be that I just wasn't serving the files correctly on my remote nginx server. I must have sent the files using scp incorrectly, because when I deleted all of the files and re-scp'd it, it worked properly.


Will the SHA256Managed Class return different results when run on different machines?

Question: I am attempting to build an authentication mechanism using API keys for access.
As a precaution against relay attacks, I am hashing the API key with the current DateTime and checking on the server side.
Using the same code to hash on both the client and server, I get different results from each of the two calls.
I.E: the Client hashes its API key and sends the hashed key and the datetime "salt" to the server.
The server takes the expected api key and hashed with the datetime sent from the client.
My hashes never match(Client hash != server hash).
This only occurs when I am running the client and server on seperate machines(actually another developer is attempting to write the client portion)
Everything works fine when I test on my local machine(running both client and server portions and attempting the authentication).
Question
Given the same input, will the .NET SHA256Managed class ComputeHash method return different results when run on different computers?
Comment: Could you provide a reproducible example?
Comment: Create a random salt (as bytes) and send that to the server instead. I you require text, encode the salt as a hexadecimal string.
Comment: `SHA256Managed` not thread-safe, so it could produce different results if you are calling the same instance from different threads
Answer:
Given the same input, will the .NET SHA256Managed class ComputeHash method return different results when run on different computers?

No. If it does than the implementation is broken (unlikely), or the input is different.
Answer: Take care if you use string because the encoding, current culture... might differ between different computers and that will give you different results (because the input is different byte-wise).
Comment: Thanks for the tip. You may have saved us some headaches. Testing some theories now...
Answer: The hash should always be the same. Your problem is likely because you are using the string representation of the date as the salt, and the string representation is different on each machine due to locale settings.
Comment: Is the string representation of date time different even within the same timezone/country. I.e both of us are in the eastern us(different states though)
Comment: It doesn't matter where the machines are _physically_ - it only matters where they think they are. Verify the system wide locale.


Import another modules is not working after updated the android studio

Question: I updated android studio to "Android Studio Bumblebee | 2021.1.1".
After this update, I created a new module and I want to add another module into the newly created module but I have an error. How can I fix this?
Answer: I found a solution:
we can use both, api() or implementation().
implementation(project(mapOf("path" to ":components:preference")))
or
implementation(project(":components:preference"))
https://docs.gradle.org/current/userguide/kotlin_dsl.html#:~:text=implementation(project(%22%3Adomain%22))


Erro ao fazer chamada REST com o AngularJS

Question: Estou usando o $http do angular para fazer chamadas REST no meu servidor, porém estou com um problema:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Já tentei várias coisas, mas nada ainda me resolveu, alguém sabe como resolver?
Meu Código:
<code>.factory('CotacaoService', ['$http', function($http){
var cotacao = [];
$http({
  method: 'GET',
  url: 'http://192.168.254.8:8084/CotacaoREST/recursos/cotacoes/1/991'
}).then(function successCallback(response) {
    cotacao = response.data;
  }, function errorCallback(response) {
    console.log(response);
  });
return cotacao;
</code>
}]);
Comment: O que você está usando no backend? SpringRest, Jersey? Qual tecnologia?
Comment: Estou usando Jersey
Comment: eu não conheço profundamente o Jersey. No caso do Spring a anotação `org.springframework.web.bind.annotation.CrossOrigin` resolve. Pesquisando rapidamente eu encontrei algo falando para incluir no header do response o seguinte atributo: `"Access-Control-Allow-Origin", "*"`. Veja se este [link](http://www.codingpedia.org/ama/how-to-add-cors-support-on-the-server-side-in-java-with-jersey/) te ajuda.
Comment: Você está testando no navegador ou em um emulador?
Comment: josivan valeu, vou testar com esse exemplo. andre, estou testando no navegador, no Console do Chrome ou do Firefox me retorna esse erro
Comment: No navegador tem que dar uns comando para habilitar. Estou fazendo um projeto também que só rola no emulador ou no próprio aparelho, no chrome e firefox da o mesmo erro. Tem umas dicas neste link http://stackoverflow.com/questions/4819060/allow-google-chrome-to-use-xmlhttprequest-to-load-a-url-from-a-local-file
Comment: Fiz os testes aqui com a mudança no jersey e rodando esse comando no chrome e mesmo assim ainda dá o mesmo problema, até estava olhando um tutorial para adicionar três parâmetros no header, e também não funcionou, o estranho é que só acontece com o angular, tenho um projeto em android que consome o webservice e funciona normal, alguém tem alguma ideia?
Answer: Tente criar um filtro pra trabalhar com o CORS:
<code>import java.io.IOException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;

@Provider
public class CORSFilter implements ContainerResponseFilter {

    @Override
    public void filter(ContainerRequestContext request,
            ContainerResponseContext response) throws IOException {
        response.getHeaders().add("Access-Control-Allow-Origin", "*");
        response.getHeaders().add("Access-Control-Allow-Headers",
                "origin, content-type, accept, authorization");
        response.getHeaders().add("Access-Control-Allow-Credentials", "true");
        response.getHeaders().add("Access-Control-Allow-Methods",
                "GET, POST, PUT, DELETE, OPTIONS, HEAD");
    }
}
</code>
Fonte: https://stackoverflow.com/questions/28065963/how-to-handle-cors-using-jax-rs-with-jersey
Outra solução seria essa.
Comment: Eu tinha feito dessa Forma, porém agora encontrei o problema, essa método resolve no servidor, porém no angular tive que tirar o headers, assim resolvendo meu problema. Obrigado pela ajuda.


Javadoc not being used within NetBeans Gradle Build

Question: I have a gradle project in netbeans.  I defined the dependency to RxJava in the build file and everything went as expected there.  Coding work fines, etc.
The problem is that it does not use the javadoc for RxJava from within the IDE (NetBeans).
I checked and the javadoc jar is cached.  It is just not being used.  I've went through and tried to find an option to link it in the IDE but could not find one.
I've done some searching and the things I've found say that when you specify a dependency from a remote location everything is supposed to sync up automatically.
Hopefully, it's something simple that I'm missing.  Thanks.
Comment: Are you using this plugin http://plugins.netbeans.org/plugin/44510/gradle-support?
Comment: I am using 188.8.131.52 which I believe is the latest version.
Answer: Try adding this code to the script:
<code>apply plugin: 'idea'

idea{
    module{
        downloadJavadoc=true
    }
}
</code>
Then refresh the project and check if the javadoc is being used.
Comment: This is only a comment (troubleshooting suggestion), not an actual answer :(
Answer: It seems that Javadoc from sources is preferred over downloaded Javadoc, but is not something that can be served and viewed in a browser as it is not HTML. The issue has been opened since Sep 23, 2017 but has not been addressed yet.