text:
Q: What is the actual form of Noether current in field theory? Let us consider $N$ independent scalar fields which satisfy the Euler-Lagrange equations of motion and are denoted by $\phi^{(i)}(x) \ ( i = 1,...,N)$, and are extended in a region $\Omega$ in a $D$-dimensional model spacetime $\mathcal{M}_D$. Now consider the classical Lagrangian density, $\mathcal{L}(\phi^{(i)}, \partial_\mu \phi^{(i)}, x^\mu)$. We apply the following infintesimal fixed-boundary transformation to $\mathcal{M}_D$.
\begin{align*}
x \to \widetilde{x}^\mu &\equiv x^\mu + \delta x^\mu (x), \tag{1} \\
\text{such that, }\ \delta x^\mu\Big{|}_{\partial\Omega}&=0, \tag{2} \\
\text{and the fields transform as: }\ \phi^{(i)}(x) &\to \widetilde{\phi}^{(i)}(\widetilde{x}) \equiv \phi^{(i)} (x) + \delta\phi^{(i)} (x).  \tag{3} \\
\end{align*}
According to my calculations, up to first order in the variation, the Lagrangian density is given by:
$$ \boxed{ \delta \mathcal{L} = \partial_\mu \Big(  \frac{\partial \mathcal{L}}{\partial (\partial_\mu \phi^{(i)} )}\delta\phi^{(i)} - \frac{\partial \mathcal{L}}{\partial (\partial_\mu \phi^{(i)} )}\partial_\nu \phi^{(i)} \delta x^\nu + \mathcal{L} \delta x^\mu \Big) -  \mathcal{L} \partial_\mu (\delta x^\mu) }\tag{4} $$
Therefore, the conserved current is $$ \boxed{ J^{\mu} = \frac{\partial \mathcal{L}}{\partial (\partial_\mu \phi^{(i)} )}\delta\phi^{(i)} - \frac{\partial \mathcal{L}}{\partial (\partial_\mu \phi^{(i)} )}\partial_\nu \phi^{(i)} \delta x^\nu + \mathcal{L} \delta x^\mu - F^\mu } \tag{5}$$
where $F^\mu$ is some arbitrary field that vanishes on $ \partial \Omega$.
However, most textbooks ignore the second and the third terms in the above expression. Compare, for example, with Peskin and Schroeder (p.18) which sets:
$$ J^{\mu} = \frac{\partial \mathcal{L}}{\partial (\partial_\mu \phi^{(i)} )}\delta\phi^{(i)} - F^\mu. \tag{6} $$
For another example, Schweber (p. 208) ignores all terms but the first in the variation of the Lagrangian density, and writes:
$$ \delta \mathcal{L} = \partial_\mu \Big( \frac{\partial \mathcal{L}}{\partial (\partial_\mu \phi^{(i)} )}\delta\phi^{(i)} \Big).\tag{7} $$
So what is going on here? Am I missing something? We seem to have set the same assumptions, but get different results. Am I wrong, or are they?
EDIT: Condition (2) is unnecessary, as it was never used in the derivation of the current. Please ignore its presence in the above text.

A: The purpose of this answer is to elaborate on the answer by Knzhou. We have the following statement:
Theorem: Suppose that $\delta$ is a general (i.e. not necessarily vertical) quasisymmetry of the action $S$. Then there is an equivalent vertical quasisymmetry $\delta^\ast$, under which the action as also quasi-invariant with the same Noether current.
This statement has two caveats:

*

*Although the full Noether currents are equivalent, the distribution of the "bare" Noether current and the "improvement term" are not the same in the two cases. In particular if $\delta$ is an exact symmetry, $\delta^\ast$ will be a quasisymmetry in general.

*The corresponding vertical symmetry $\delta^\ast$ is a generalized symmetry in general, even if $\delta$ is an ordinary symmetry. The difference between the two will be explained in the body in the answer.

Suppose that the action is$$S[\phi]=\int_\Omega\mathcal L(x,\phi(x),\partial\phi(x))d^nx,$$ where $\Omega$ is a compact $n$ dimensional domain of integration, the field is $\phi^i(x)$ with $m$ components and $n$ independent variables $x^\mu$. For simplicity, a first order Lagrangian is assumed, but the result is qualitatively valid for the higher order case as well (i.e. the specific formulae are different, but the overall result is the same).
We first consider a variation $\delta$ given by $$ x^{\prime\mu}=x^\mu+\epsilon\delta x^\mu,\quad\phi^{\prime i}(x^\prime)=\phi^i(x)+\epsilon\delta\phi^i(x). $$ We assume this variation is an off-shell quasisymmetry of the action, i.e. $$ \delta S[\phi]=\int_\Omega d_\mu F^\mu\ d^nx$$ for some improvement current $F^\mu$. Let $L=\mathcal Ld^nx$ be the Lagrangian $n$-form and define the total variation $\delta_T\mathcal L$ of the Lagrangian density to be $$ \delta L=\delta_T\mathcal L\ d^nx. $$
As OP has correctly derived we have $$ \delta_T\mathcal L=E_i(L)(\delta\phi^i-\partial_\mu\phi^i\delta x^\mu)+d_\mu\left[\frac{\partial\mathcal L}{\partial\phi^i_\mu}\delta\phi^i-\left(\frac{\partial\mathcal L}{\partial\phi^i_\mu}\phi^i_\nu-\mathcal L\delta^\mu_\nu\right)\delta x^\nu\right] \\ = E_i(L)(\delta\phi^i-\partial_\mu\phi^i\delta x^\mu)+d_\mu\left[\frac{\partial\mathcal L}{\partial\phi^i_\mu}\left(\delta\phi^i-\partial_\nu\phi^i\delta x^\nu\right)+\mathcal L\delta x^\mu\right] \\ = E_i(L)\delta^\ast\phi^i+d_\mu\left[\frac{\partial\mathcal L}{\partial\phi^i_\mu}\delta^\ast\phi^i+\mathcal L\delta x^\mu\right],$$ where $E_i(L)$ is the Euler-Lagrange expression of the Lagrangian, and $$ \delta^\ast\phi^i=\delta\phi^i-\partial_\mu\phi^i\delta x^\mu $$is the vertical part of the variation.
The full Noether current is then $$ J^\mu=\frac{\partial\mathcal L}{\partial\phi^i_\mu}\delta^\ast\phi^i+\mathcal L\delta x^\mu-F^\mu . $$
Now consider making only $\delta^\ast\phi^i$ as a variation with no horizontal part. The variation of the action is $$ \delta^\ast S=\int_\Omega\left(E_i(L)\delta^\ast\phi^i+d_\mu\left(\frac{\partial\mathcal L}{\partial\phi^i_\mu}\delta^\ast\phi^i\right)\right)d^nx. $$ Comparing this with the integral of $\delta_T\mathcal L$, we find $$ \delta^\ast S=\delta S-\int_\Omega d_\mu(\mathcal L\delta x^\mu)d^nx. $$
It follows that if $\delta$ is a quasisymmetry of $S$ with improvement term $F^\mu$, then $\delta^\ast S$ is also a quasisymmetry of $S$ with improvement term $\bar F^\mu=F^\mu-\mathcal L\delta x^\mu$. The full Noether current from this symmetry is then $$ J^\mu=\frac{\partial\mathcal L}{\partial\phi^i_\mu}\delta^\ast\phi^i-\bar F^\mu=\frac{\partial\mathcal L}{\partial\phi^i_\mu}\delta^\ast\phi^i+\mathcal L\delta x^\mu-F^\mu, $$ which agrees with the previous current.

Remarks:
Clearly, if the improvement term vanishes for $\delta$, i.e. $F^\mu=0$, then the corresponding vertical variation still has an improvement term $-\mathcal L\delta x^\mu$. Thus - as stated in the intro - a non-vertical exact symmetry may only be replaced with a vertical quasisymmetry.
Secondly, the variations that appear in Noether's theorem are such that they are not variations about a specific field $\phi^i$, but rather, the variation of any field can be calculated. In other words, $\delta$ is a "vector field" rather than a single "tangent vector" in field space. Ordinarily, these variations have the functional form $$ \delta x^\mu=\xi^\mu(x),\quad\delta\phi^i(x)=\Xi^i(x,\phi(x)). $$ If the variations have this functional dependency, then they generate projectable flows in the $n+m$-dimensional total space of both dependent and independent variables $(x^\mu,y^i)$ (this point would be made much more understandable in a fibre bundle formulation, which I am not doing for the sake of accessibility).
However for vertical variations we may also consider variations of the form $$ \delta\phi^i(x)=\Xi^i(x,\phi(x),\partial\phi(x),...,\partial^r\phi(x)), $$ and this is called a generalized variation (and if a symmetry, then a generalized symmetry) (further remark: One could in principle consider any functional $\delta\phi^i(x)=\Xi^i[\phi](x)$, however in the spirit of locality, one usually considers finite order functionals only).
Generalized vertical variations do not generate flows in the $(x,y)$-space, but they generate flows in the field space, via the equation $$ \frac{\partial\phi^i_\epsilon}{\partial\epsilon}=\Xi^i(x,\phi_\epsilon(x),...,\partial^r\phi_\epsilon(x)). $$
With this in mind, if $\delta$ is an ordinary, non-vertical variation with $$ \delta x^\mu=\xi^\mu(x),\quad \delta\phi^i(x)=\Xi^i(x,\phi(x)), $$ then the corresponding vertical variation has the form $$ \delta^\ast\phi^i(x)=\mathrm Z^i(x,\phi(x),\partial\phi(x))=\Xi^i(x,\phi(x))-\partial_\mu\phi^i(x)\xi^\mu(x), $$ which shows that $\delta^\ast$ is actually a generalized vertical symmetry.
Thus - as stated in the intro - a non-vertical ordinary variation may only be replaced by a vertical generalized variation in general.

A: The issue is that there are two ways to write an infinitesimal field transformation. As a simple example, let's consider a triplet of fields $\phi_i$ which transform as a vector in space, and suppose we're dealing with a rotational symmetry. We can write this symmetry in two ways:

*

*Your method: the rotation changes the spatial coordinates (your $\delta x^\mu$) and changes the value of the field by rotation (your $\delta \phi^i$).

*The more common method: the rotation only changes the value of the field while holding spatial coordinates constant, i.e. $\delta x^\mu = 0$.

While it looks like your method is more general, the second method works equally well, as any shift in the coordinates by a small $\delta x^\mu$ is equivalent to a shift in the field value by $\partial_\mu \phi^i \delta x^\mu$.
Setting $\delta x^\mu = 0$ in Peskin and Schroeder's answer gives yours, so they agree with you, except that their $\delta \phi$ will be more complicated. The Schweber book is a little more basic and probably dropped the total derivative just to simplify things.

A: *

*Eq. (5) is (up to factors of the infinitesimal parameter $\varepsilon$) the standard expression for the full Noether current. Here:

*

*$\delta x^{\mu}$ is the so-called horizontal component of the infinitesimal variation;

*$\delta \phi -\frac{\partial \phi}{\partial x^{\mu}} \delta x^{\mu} $ is the so-called vertical component of the infinitesimal variation;

*$F^{\mu}$ is an improvement term in case of quasisymmetry.

*The main point is that Schweber (7), Peskin & Schroeder (6) are only considering situations with purely vertical transformations, i.e. situations where $\delta x^{\mu}=0$.

*Let us mention that the last term in eq. (4) gets cancelled by the Jacobian contributions from the integration measure. Hence it is not present in eq. (5).

*Finally, it seems relevant to mention that OP's boundary condition (2) is often not fulfilled in important applications, such as the canonical stress-energy-momentum (SEM) tensor, which is the Noether current for spacetime translations. See e.g. this Phys.SE post. Therefore the boundary condition (2) should be relaxed appropriately. Similarly, the improvement term $F^{\mu}$ is not some arbitrary field that vanishes on the boundary, as OP claims (v3) under eq. (5). Instead the improvement term $F^{\mu}$ is dictated by the quasisymmetry, which fixes $F^{\mu}$ up to a divergence-free term.

A: A Noether current is always connected to some transformation. If you drop the second and third terms in the second box, you have the current for a pure field transformation with no coordinate transformation. Note that the field transformation has two parts: One originates from a given field shift, the other induced by a coordinate transformation. If, for example, you would set the pure field shift to zero and keep only the part induced by the coordinate shift, you would get the energy-momentum tensor of the theory.
Correction: You only get the energy-momentum tensor as Noether current if you set the coordinate transformation to be space-time translations.


text:
Q: Stuck at grub Command Line. Initrd file not found Steps followed image
Unable to boot Ubuntu. Grub screen appears on startup by default.
Tried many approaches and one of the approach I used is

*

*ls (hd0,gpt2)/          //it displayed home partition files

*set root=(hd0,gpt2)

*Set prefix=(hd0,gpt2)/boot/grub

*linux /boot/vmlinuz root=/dev/sda2

*initrd /boot/initrd.img file // this command throws file not found error even though I can i see initrd file.

There is latest version of vmlinuz file which is vmlinuz-5.11.0 but there is no latest version of initrd file.
Even after fifth step failed, i tried to run boot command, But then i got this  error Kernal panic - not syncing: VFS unable to mount root fs on unknown-block(0,0)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ionic refresher conflicts with hide show animation AngularJS I have one page where I wish to use the feature pull to refresh.
In this page I have 2 hide and show sections.
For some reason, my page refreshes everytime I touch to show what is hidden
in the hide/show toogles.
If I remove the code only on controller. My page still pulls to refresh with just the html code, and it works fine with hide/show but in this case, the page after reload, doesn't really stay on the top but a bit below instead.
How to fix this? Seems like a conflict between ionic and angularjs animation with hide/show
code below:
<ion-view has-bouncing="false">
    <ion-content>

            <loader-bcs></loader-bcs>

            <ion-refresher on-refresh="doRefresh()" refreshing-icon="" ng-hide="true">
            </ion-refresher>

{{'IntegratedPosition' | translate}}

...

 ....

    </ion-content>
</ion-view>

and on controller:
        $scope.doRefresh = function () {
            bcsSQLiteStorage.deleteDataDB(EntityIntegratedPositionKey);
            bcsSQLiteStorage.deleteDataDB(EntityFinancialPositionKey);

//this is a call to a service, should I make it synchronous?
            getEntityFinancialIntegratedPosition();
            $ionicScrollDelegate.scrollTop();

        };

this code produces the pull to refresh on toogling the hide/show divs
What is the problem here?


text:
Q: Creating manual anomaly detection in Cloudwatch I realize that Cloudwatch comes with its own anomaly detection alarms, but I was hoping to build my own from scratch rather than relying on a black box algorithm.
I'm looking at time series that should be very stable (the proportion of null values that I read from various external tables), trying to see if there are upward spikes (unexpected increases in nulls)
To that end, I was thinking I would

*

*log the proportion of nulls in each column once a day to cloudwatch

*Programmatically create a metric based on all these proportion metrics that would look like

(null_pct - AVG(null_pct)) / STDDEV(null_pct)

(in Cloudwatch math), across 7-day rolling windows

*Programmatically create alarms if any of the metrics from 2. ever increase beyond the static threshold of X (representing a spike of more than X standard deviations from the week's mean)

Does that make sense / sound doable? Or should I go about it some other way?


text:
Q: Build play! project with maven I am using play 1.2.4 to create a web app. It works together with some other applications which are maven projects: they are compiled and resolved (dependencies) with maven.
Now I need to modify my play app so it can also be compiled and started with maven.
Therefore I download maven (3.0.4), installed the maven modul and did everything according to https://github.com/wangyizhuo/play-maven and http://www.playframework.org/modules/maven-head/home
I manage to automatically create a pom file in my project. The problem is that the jars from the play framework are not copied into the lib-folder and when I try to execute mvn package they are missing.
Is there a way to get the maven module to work properly? If not, is there another possibility to compile and start the project from maven (i.e. intermediate ant-file that can be executed by maven?)
Many thanks in advance!

A: This explains it pretty well. I havnt looked at the module you are refering too, but this shows you how you can create tasks and inculde directories in your build.
Do you need to use maven to build/run it? If not it looks like there is a community contributed extension that allows you to use maven from within play.


text:
Q: Feature detection on a small, noisy image with OpenCV I have an image that is both pretty noisy, small (the relevant portion is 381 × 314) and the features are very subtle.

The source image and the cropped relevant area are here as well: http://imgur.com/a/O8Zc2
The task is to count the number of white-ish dots within the relevant area using Python but I would be happy with just isolating the lighter dots and lines within the area and removing the background structure (in this case the cell).
With OpenCV I've tried Histogram equalization (destroys the details), finding contours (didn't work), using color ranges (too close in color?)
Any suggestions or guidance on other things to try? I don't believe I can get a higher res image so is this task possible with the rather difficult source?

A: (This is not a Python answer, since I never used the Python/OpenCV binding. The images below were created using Mathematica. But I just used basic image processing functions, so you should be able to implement that in Python on your own.)
A very general "trick" in image processing is to think about removing the thing you're looking for, instead of actually looking for it. Because often, removing it is much easier than finding it. You could for instance apply a morphological opening, median filter or a gaussian filter to it:

These filters effectively remove details smaller than the filter size, and leave the coarser structures more or less untouched. So you can just take the difference from the original image and look for local maxima:

(You'll have to play around with different "detail removal filters" and filter sizes. There's no way to tell which one works best with just one image.)


text:
Q: How to Line Plot several columns in Seaborn? I am exploring the FIFA data set.
I would like to see on a single line plot how is the Wage influenced by the variables listed below. How could I achieve this with seaborn?
Composure
Marking
Penalties
Vision
Stamina

Wage should be on the Y axis, while the other attributes should be shown on the X axis.
Each line on the plot should be represented by Composure, Marking..etc.
Stacking one plot over the other is not clean and I don't get the legend, so this is bad way of reporting.
import seaborn as sns
sns.lineplot(x=data.Positioning, y=data.Wage)
sns.lineplot(x=data.Overall, y=data.Wage)
sns.lineplot(x=data.Penalties, y=data.Wage)

A: Did you ask something like this?
import matplotlib.ticker as ticker

columns_plot = ['Composure', 'Marking', 'Penalties', 'Vision', 'Stamina']

fig, ax = plt.subplots(figsize=(14, 9))
ax.yaxis.set_major_formatter(ticker.EngFormatter())
for each in columns_plot:
    sns.lineplot(data = df_final, x = each, y = 'Wage', label = str(each), ci = None)
plt.legend()
plt.show()

Produces:

2nd method, side by side:
fig, axes = plt.subplots(1, 5, figsize=(23, 5), sharey=True)

columns_plot = ['Composure', 'Marking', 'Penalties', 'Vision', 'Stamina']

for i, each in enumerate(columns_plot):
    sns.lineplot(data = df_final, ax = axes[i], x = each, y = 'TransformedWage', ci = None, color = 'g')
plt.show()

Produces:


text:
Q: Are there non-squib wizards/witches who work 100% in muggle world? This Q/A ( Does Hogwarts teach non magical classes? ) made me realize that I can't seem to remember a single HP wizard/witch who had a Muggle job with a Muggle company, aside from Kingsley's bodyguard cover as the Prime Minister's secretary.
Everyone whom I recall being mentioned as having a job is either employed in some magical company or the Ministry of Magic (which seems to employ more magical people than every other employer combined) or be self-employed - again economically interacting with wizards.
Am I merely forgetting someone, or was Kingsley really the only magically capable person with a paycheck from the Muggle world (which doesn't count since the job was a cover)?
UPDATE: Just to clarify - I didn't necessarily mean "working a Muggle job while using magic to help you" - it could also mean simply doing a Muggle job. So there's not necessarily a concern about Statute of Secrecy (plus, you can use the magic, say, to learn - e.g. Hermione could magick herself to learn how to do dentistry in 1 month or something). So no need to answer how having some wizard doing a Muggle job would be contrary to HP universe rules. I merely want to know if there's an example, NOT why there should't be one.

A: And there are wizards working under cover in Postal System . (As Aunt Petunia was able to deliver a letter to hogwarts) . They should be doing normal muggle jobs right ?

"You didn't think it was such a freak's school when you wrote to the
  head- master and begged him to take you."
Petunia turned scarlet.
"Beg? I didn't beg!"
"I saw his reply. It was very kind."
"You shouldn't have read—" whispered Petunia, "that was my private—how
  could you—?"
Lily gave herself away by half-glancing toward where Snape stood
  nearby. Petunia gasped.
"That boy found it! You and that boy have been sneaking in my room!"
"No—not sneaking—" Now Lily was on the defensive. "Severus saw the
  envelope, and he couldn't believe a Muggle could have contacted
  Hogwarts, that's all! He says there must be wizards working undercover
  in the postal service who take care of—"

A: I think the canonical/textual answer is no.
Enforcement of Clause 73 of the International Statute of Wizarding Secrecy would seem to preclude that possibility, in the UK at least.
Rowlings made a running joke out of the ignorance of wizards about the Muggle world and went to some length to establish that most wizards would never and had never needed to interact with Muggles. How would such persons know what to do to live successfully as a Muggle w/magic by themselves even if such a wrong-thinking idea occurred to them? Even Harry and Hermione did not flee to, say, Manchester or Paris and live life on the run in nice hotels.

A: A JKR Pottermore writing says Sir Cadogan had a Muggle job.
Sir Cadogan, the knight whose portrait hung in Hogwarts, was said to have had a Muggle job. His only mentioned job was being a knight (perhaps a Knight of the Round Table), and he's also armored like a knight would be in his portrait, so presumably that means that being a knight was considered a Muggle job.

Before the wizarding community was forced into hiding, it was not unusual for a wizard to live in the Muggle community and hold down what we would now think of as a Muggle job.
It is widely believed in wizarding circles that Sir Cadogan was one of the famous Knights of the Round Table, albeit a little-known one, and that he achieved this position through his friendship with Merlin. He has certainly been excised from all Muggle volumes of King Arthur's story, but wizarding versions of the tales include Sir Cadogan alongside Sir Lancelot, Sir Bedivere and Sir Percivale. Sir Cadogan (Pottermore)

He did seem to be still using magic despite not having a wizarding job, since he'd taken his wand with him to battle the Wyvern of Wye, and it bit his wand in half - likely meaning he had it out so he could use it in the battle.

Sir Cadogan's most famous encounter was with the Wyvern of Wye, a dragonish creature that was terrorising the West Country. At their first encounter, the beast ate Sir Cadogan's handsome steed, bit his wand in half and melted his sword and visor. Unable to see through the steam rising from his melting helmet, Sir Cadogan barely escaped with his life. However, rather than running away, he staggered into a nearby meadow, grabbed a small, fat pony grazing there, leapt upon it and galloped back towards the wyvern with nothing but his broken wand in his hand, prepared to meet a valiant death.  Sir Cadogan (Pottermore)

However, his job itself wasn't magical in nature.
Another writing says Armand Malfoy had a non-magical job.
According to a different writing on Pottermore, Armand Malfoy was part of the invasion led by William the Conqueror.

Like many other progenitors of noble English families, the wizard Armand Malfoy arrived in Britain with William the Conqueror as part of the invading Norman army. Having rendered unknown, shady (and almost certainly magical) services to King William I, Malfoy was given a prime piece of land in Wiltshire, seized from local landowners, upon which his descendants have lived for ten consecutive centuries. The Malfoy family (Pottermore)

While he most likely used magic in his job, he would have worked among Muggles, and presumably worked in the service of a Muggle (there's nothing that indicates William the Conqueror was a wizard).
This also implies it's less common after the Statute of Secrecy.
The Pottermore writing on Sir Cadogan says that before the wizarding world was forced into hiding (therefore before the Statute of Secrecy) that it wasn't unusual for wizards to live among Muggles and have a Muggle job. This implies that, conversely, after the wizarding world was forced into hiding, it became somewhat more unusual for wizards to live among Muggles and have Muggle jobs. (This doesn't mean it'd never happen, just that it's less common after the Statute of Secrecy was implemented.)

A: Isobel McGonagall, mother of Minerva McGonagall
The Pottermore section on Minerva McGonagall talks at length about her mother, Isobel. After she eloped with a muggle, Isobel kept her magical heritage a secret from her husband, lived in isolation from the wizarding world, and voluntarily chose to lock up her wand.

By the time she was eighteen, [Isobel] had fallen in love with Robert. Unfortunately, she had not found the courage to tell him what she was.
The couple eloped, to the fury of both sets of parents. Now estranged from her family, Isobel could not bring herself to mar the bliss of the honeymoon by telling her smitten new husband that she had graduated top of her class in Charms at Hogwarts, nor that she had been Captain of the school Quidditch team. […]
Missing her family, and the magical community she had given up for love, Isobel insisted on naming her newborn daughter after her own grandmother, an immensely talented witch.

While no occupation is mentioned, it seems that Isobel neither used magic, nor associated with anyone who used magic, since she got married. Even after she revealed to her husband that she was a witch, Isobel kept herself isolated from others in the wizarding community (the fact that she was married to a minister probably influenced that). It's clear that by the time Minerva was accepted to Hogwarts (at least 11 years after they were married), Isobel still hadn't rejoined the magical community.

[Minerva] sensed, too, how much of a strain it was for her mother to fit in with the all-Muggle village, and how much she missed the freedom of being with her kind, and of exercising her considerable talents. Minerva never forgot how much her mother cried, when the letter of admittance into Hogwarts School of Witchcraft and Wizardry arrived on Minerva's eleventh birthday; she knew that Isobel was sobbing, not only out of pride, but also out of envy.

So while Isobel McGonagall didn't necessarily work in the muggle world without magic, she did live 100% in the muggle world without any use of magic or connections to the Wizarding World.

A: I can only think of three possibilities, but two, quite frankly, are a stretch.

*

*The Weasley cousin who is an accountant. It's not outright stated he's a Squib; Ron only says the family doesn't talk about him much.

*The portrait of the "froglike little man wearing a long silver wig who was depicted in a small, dirty oil painting in the far corner of the room" in the Muggle Prime Minister's office. Portraits likely don't receive paychecks, although perhaps they're occasionally reconditioned as special compensation ;)

*Slytherin Blaise Zabini's mother is a "famously beautiful witch" who has had seven husbands, all whom have died mysteriously and left her substantial wealth. I'm not sure if being a Black Widow qualifies as a Muggle profession. Besides, she's referenced as inheriting gold, not pounds, so the assumption is that she has married all wizards.

Like I said, a stretch, but fun to think about. Other that that, I can't think of any non-Squibs who work in the Muggle world. Perhaps I'm forgetting someone, though!

A: One of the recent answers here (in the spoilers):

referenced the fact that Merlin was a Slytherin. As such, he'd have held a wizarding job, but in a Muggle world (he was a court wizard for King Arthur's father and Arthur if I recall my Arthuriana correctly).

A: According to information from Rowling's old site, there is reason to believe Dean Thomas' father might have left the wizard world and lived like a muggle until he was murdered by Death Eaters:

Dean is from what he always thought was a pure Muggle background. He
  has been raised by his mother and his stepfather; his father walked
  out on the family when Dean was very young. He has a very happy home
  life, with a number of half-brothers and sisters.
Naturally when the letter came from Hogwarts Dean's mother wondered
  whether his father might have been a wizard, but nobody has ever
  discovered the truth: that Dean's father, who had never told his wife
  what he was because he wanted to protect her, got himself killed by
  Death Eaters when he refused to join them. The projected story had
  Dean discovering all this during his school career. I suppose in some
  ways I sacrificed Dean's voyage of discovery for Neville's, which is
  more important to the central plot.

Another possible interpretation is that he didn't tell his wife, but kept working in the wizard world until he got killed by Death Eaters.
Btw, not an answer, but interesting enough to mention:

Hookum, Daisy (b. 1962). Author. Wrote bestseller My Life as a
  Muggle, after giving up magic for a year. Married to celebrity
  gardener Tilden Toots.
  JKR's Wizard of the Month for June 2006

A: It would be perfectly possible for a child born to non-magic parents to be denied, or decline, the opportunity to go to Hogwarts. They're still wizards/witches, having the innate ability for magic and spellcasting, but they have chosen not to pursue it. Perhaps if Harry wasn't the wizard he was, and the Dursleys were more likable and/or had taken more care to keep Harry in the dark, Harry might just have said "no thanks". But because the Dursleys were so perfectly horrible to him, Harry jumps at the chance for a different life.
One could imagine an average middle-class family with a child brought up comfortably but not extravagantly, who's been taught that nothing is free and that sweat makes things happen, who upon receiving a letter from this supposed "school of magic" he's never heard of let alone applied to would simply chuck it in the trash with the rest of the "get rich quick" junk mail.
It's also perfectly possible that a child of non-magic parents who gets himself expelled from Hogwarts would simply try to bury that fact and apply to some "normal" secondary school. He'd be behind by however many years he'd spent at Hogwarts, but there are valid explanations.

A: Well, let's see, they wouldn't become an obscurial because they are presumable an adult since their working and the oldest obscurial known is Ariana Dumbledore or Credence Barebone, while Credence's age isn't said from what I can remember, Ariana is 14 when she dies and is hit by a curse so I'm not sure if she could of survived longer but definitely not past 20 or so.
I'm sure there is someone, like Arthur Weasley, who 'likes Muggles so much they snapped their wands in half and joined them' as said by Draco Malfoy. Maybe someone successfully avoided Death Eaters by joining the Muggle Society, then might of stayed in hiding for about a decade before they got wind that Voldemort was gone.
Either way I am sure that there was at least one witch/wizard probably called Matthew the Muggle lover or Maggie the Magic Hater or something, that became a muggle and spent the rest of their life with their wand in the bottom of a lake or in a sharks stomach.
Kingsley does have a job protecting the Prime Minister as Head Secretary or whatever so a witch/wizard can have a muggle job. I think it's very possible that there is a witch/wizard who works and lives like a muggle without magic


text:
Q: Overwrite s3 data using Glue job in AWS I am trying to save my Glue job output to S3 using following code snippet
output_table = glueContext.write_dynamic_frame.from_options(
    frame=table,
    connection_type="s3",
    format="json",
    connection_options={"path": "s3://brand-code-mappings", "partitionKeys": []},
    transformation_ctx="S3bucket_node3",
)

I want to overwrite all the objects that are already present in S3 bucket instead of appending to them.
I have tried making following changes, but nothing seems to work.
table.toDF()
    .write
    .mode("overwrite")
    .format("parquet")
    .partitionBy()
    .save('s3://brand-code-mappings')

table.toDF()
    .write
    .mode("overwrite")
    .parquet("s3://brand-code-mappings")

Please help on how i can overwrite already existing objects in the S3 bucket with the Glue output.
I am using Glue 3.0- which supports Spark 3.1, Scala 2 and Python 3.
Thanks,
Anamika


text:
Q: How can I send an audio stream from webpage to a C++ server? I'm working on a project and I need to send an audio stream from a webpage (through javascript) to a server written in C++. Is this possible? How can I do this? I was thinking on use WebRTC and a WebRTC library for C++ but I don't really know hoy to achieve this.
In general I need some king of webserver in C++, that allows me to send/recieve audio stream and json and works with multiple web clients.
I have worked with Socket.io and once I coded a webserver in Java EE 7, with those I was able to send/recieve json from the webpage but I don't really know if I can send audio stream via websocket or json.

A: The question (or implementation in answer to the question) really consists of two parts, which are:

*

*How to send audio stream from browser in Javascript

*How to receive audio stream on server in C/C++

This is because sending data over the network only loosely couples the client and the server when they use the same protocol. You could write a server in C++, then write two different clients that communicate with it, one in Javascript, then also a desktop app written in Java.
Javascript on Client Side
For the client side, sending audio from the browser in Javascript should follow the normal libraries available for WebRTC; the WebRTC site has some useful information on this, including a video streaming example here (https://webrtc.github.io/samples/)
Some of the links which might be of interest on that page:

*

*Audio-only getUserMedia() output to local audio element

*Stream from a video element to a video element

There are some StackOverflow answers already about WebRTC and audio in javascript, here are a couple, these (and libraries) will be more plentiful than C++ questions on the topic:

*

*Sending video and audio stream to server

*Sending a MediaStream to host Server with WebRTC after it is captured by getUserMedia
For the C++ Server:
The WebRTC site has a link to the Native API for the libraries here (https://webrtc.org/native-code/native-apis/) and an excellent simple example of a peer connection WebRTC server using them is here (https://webrtc.googlesource.com/src/+/master/examples/peerconnection). It also has an implementation of a C++ client there, which may help in testing the server to get it working first, or see the general principles.


text:
Q: Is there a debugging tool to know what LoC is changing your prop/state in React? I have been going at it the traditional way, by placing breakpoints, but I was wondering if there is a browser extension or a developer tool that tells you what line of code in your React application is changing the value of a prop or a state variable, or the object as a whole.
If this doesn't exist, what are some of the other way people debug their application when they are trying to understand where the value of a prop or state is getting changed?


text:
Q: LWUIT 1.4 Plain commands Vs. Styled commands with LWUITTheme.res I've just started to develope an LWUIT MIDlet with standard LWUITTheme.res. I added 2 commands (Exit, Search) on my first form, but they appear with no style (black on white).

Instead, other 2 commands (Back, Details) on a second form, showed on Search command click, are rendered styled in white on blue, with a blue gradient background.

The first form has a BorderLayout, the second has no particular layout set.
Since I haven't changed commands style in my code, I would expect that their appearance be the same in the first as in the second form, and precisely as they appear in the second form.
Am I wrong?
Regards
--
After @Bhakki first reply, regarding SoftButtons, I've checked the {$LWUIT_FOLDER}/LWUITDemo/src/LWUITTheme.res file.

As you can see, both Command and SoftButton has in the .res file.
It seems that the commands in the first form are styled as Command, and those in the second form are styled as SoftButton.
But I added them in the same way in both forms.
Am I doing something wrong?

A: You created the first form before installing the theme. You need to install the LWUIT theme  before you create components but after Display.init().


text:
Q: Facebook JS SDK vs other modules: Alternatively, why there is Java code difference? Javascript difference: It's basic but most may not know it. I'm trying to called function using onclick event but it works differently on facebook. Look at the two examples.
In usual syntax used in websites;
    <button id="btn" onclick="getscore()">Test</button>
    <script>
    var score = 1;
    function getscore(){
    ++score;
    scorep.innerHTML = score;
    }
    </script>

Facebook syntax;
    <button id="btn">Test</button>
    <script>
    var score = 1;
    btn.onclick = function(){
    ++score;
    scorep.innerHTML = score;
    }
    </script>

So the code in fb test console won't work in my site page & vice verca.

*

*Why is there a difference?

*How do I resolve this?

Thanking in advance to my rescuers ;)

A: Should work
<button id="btn">Test</button>
<script>
var score = 1;
document.getElementById('btn').onclick = function(){
++score;
scorep.innerHTML = score;
}
</script>


text:
Q: FTP bash script for iSeries AS400 from linux I have a bash script in a nodejs back-end application and I need it to execute an Iseries as400 instruction via FTP
#!/usr/bin/bash

host='www.hosting.com'
user='username'
pass='password'

ftp -inv $host << EOF

user $user $pass

QUOTE RCMD CHGUSRPRF USRPRF(USEREXAMPLE) STATUS(*DISABLED)

bye

EOF

The problem is that when executing it, it returns this:
ftp> QUOTE RCMD CHGUSRPRF USRPRF(INT0000279) STATUS(*ENABLED)
**?Invalid command**
ftp>

If i run the script from windows it works, but it fails on linux
Should I install any dependencies on linux for it to run successfully?
I appreciate your help

A: ftp works for me from a bash command line to the ibm i:
steve@DESKTOP-MQ27OQB:/mnt/c/Users/srich/downloads/steve$ ftp 172.16.1.254
Connected to 172.16.1.254.
220 Connection will close if idle more than 5 minutes.
Name (172.16.1.254:steve): srichter
331 Enter password.
Password:
230 SRICHTER logged on.
Remote system type is .
ftp> quote rcmd sndmsg msg(abc) tousr(*sysopr)
250 Command sndmsg msg(abc) tousr(*sysopr) successful.
ftp> quote rcmd chgusrprf usrprf(srichter) status(*enabled)
550-Error occurred on command chgusrprf usrprf(srichter) status(*enabled).
550 *SECADM required to create or change user profiles..

Can you run FTP, outside of the bash script, one command at a time?

A: FTP is a file transfer protocol.  If you want to execute commands you need to use SSH.
Your error isn't a linux or bash error, it's an ftp error.  ftpd (FTP daemon) does not speak AS400.
Connect via ssh, and enter valid commands in the shell you're given on the AS400 machine. Something like:
ssh user@server command

This would connect to the host named 'server' as 'user' and execute 'command'.  You should research ssh, perhaps google man ssh for an online version of the man file.


text:
Q: Underline text while typing in EditText - Android I am new to android development and was working on a project which involved in underlining specific words in the text field while typing I found an example on dribble which achieves the same thing:

Here I have the index of the word in the string which I want to underline. Is there any way to achieve this? Thank you

Please Note: I don't want to know about how to find the substrings as mentioned in the video but I want to achieve the same underline animation as shown in the video

Is there any way that we can have a canvas behind the EditText and then have the underline animation there??


text:
Q: How to show that the summation equal to $(t(n)+1)$ Why is
$$ \sum_{n=1}^{\infty} x^{2n^2} +\sum_{n=1}^{\infty} x^{8n^2} + \sum_{n=1}^{\infty} x^{32n^2}+\cdots = \sum_{n=1}^{\infty}(t(n)+1) x^{2n^2} $$
Where $t(n)$ is the highest power of 2 which divides $n$
My attempt : list $t(n)$ first and make the $t(n)$ table from $1\leq n \leq 20$. And the last, i know the summantion of $x^{2n^2},x^{8n^2},\cdots$ will be equal to summantion $(t(n)+1) x^{2n^2}$ . but my teacher forbids using that method. Can you help me for to find another way?

A: We use the coefficient of operator $[x^n]$ to denote the coefficient of $x^n$ of a series.

We obtain
\begin{align*}
\color{blue}{[x^{2n^2}]}&\color{blue}{\left(\sum_{m=1}^{\infty}x^{2m^2}+\sum_{m=1}^{\infty}x^{8m^2}
+\sum_{m=1}^{\infty}x^{32m^2}+\cdots\right)}\\
&=[x^{2n^2}]\sum_{q=0}^{\infty}\sum_{m=1}^{\infty}x^{2^{2q+1}m^2}\\
&=[x^{2n^2}]\sum_{q=0}^{\infty}\sum_{m=1}^{\infty}x^{2\left(2^{q}m\right)^2}\\
&=[x^{2\left(2^{t(n)}s(n)\right)^2}]\sum_{q=0}^{\infty}\sum_{m=1}^{\infty}x^{2\left(2^{q}m\right)^2}\tag{1}\\
&=[x^{2\left(2^{t(n)}s(n)\right)^2}]\sum_{q=0}^{t(n)}\sum_{m=1}^{\infty}x^{2\left(2^{q}m\right)^2}\tag{2}\\
&=[x^{2\left(2^{t(n)}s(n)\right)^2}]\sum_{q=0}^{t(n)}x^{2\left(2^{q}2^{t(n)-q}s(n)\right)^2}\tag{3}\\
&=\sum_{q=0}^{t(n)}1\tag{4}\\
&\,\,\color{blue}{=t(n)+1}
\end{align*}
and the claim follows.

Comment:

*

*In (1) we use the unique representation $n=2^{t(n)}s(n)$ with $s(n)$ an odd non-negative integer.

*In (2) we set the upper limit of the outer sum to $t(n)$ since higher powers of $2$ do not contribute to $[x^{2\left(2^{t(n)}s(n)\right)^2}]$.

*In (3) we choose $m=2^{t(n)-q}s(n)$ in order to match the coefficient of $x^{2\left(2^{t(n)}s(n)\right)^2}$.

*In (4) we select the coefficient accordingly.


text:
Q: How do i kill a CMD process? This is a simple code line i've made for my application. Basically Button_2 runs the "batchfile.bat." Now, i'm curious how to make Button_1 end the "batchfile.bat" or close CMD because thats what the "batchfile.bat" makes run. Any helps appreciated, thanks.
Public Class Form1
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Handles Button2.Click
        Process.Start("C:\batchfile.bat")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Handles Button1.Click
        (MY DESIRED CODE TO KILL CMD HERE)
    End Sub

End Class

A: When in doubt, read the documentation. You're probably looking for the Kill method.


text:
Q: Is it possible to require authentication on certain path, but not when certain request param is provided? Controller:
@GetMapping(path = "/new")
public String method(@RequestParam(required = false) final String hash) {
        ...
}

Get request on /new without provided hash should be authenticated, but if hash is provided, it does not have to be.
Is there something like this achievable in spring boot security?


text:
Q: Reading a video in OpenCV While working with video in OpenCV using Python, when we are reading the frames using
cap=cv2.VideoCapture(0)
ret,frame=cap.read()

What do the variables ret and frame store?

A: Reference Material: Getting Started with Videos
ret,frame=cap.read()
From the documentation above:

cap.read() returns a bool (True/False). If frame is read correctly, it
  will be True. So you can check end of the video by checking this
  return value.

So in assence,
ret = True or ret = False based on whether a frame was read correctly and frame is the actual frame that was read (provided ret == True)


text:
Q: execute command in nebula studio to create vertex item in database as mentioned in nebula documentation here :
https://docs.nebula-graph.io/1.2.0/manual-EN/2.query-language/1.data-types/data-types/

nebula> INSERT VERTEX school(name, create_time) VALUES hash("new"):("new", "1985-10-01 08:00:00")
error is:

-1005:Storage Error: The data type does not meet the requirements. Use the correct type of data.

and this:

-1005:Wrong vertex id type: hash("new")

A: Please be noted you are referring to NebulaGraph v1.x documentation, in NebulaGraph V1, the vid only supports int64, but now, it supports(since 2.x) string format. And you could define this during the creation of the graph space:
CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
    [partition_num = <partition_number>,]
    [replica_factor = <replica_number>,]
    vid_type = {FIXED_STRING(<N>) | INT[64]}
    )
    [COMMENT = '<comment>'];

for instance if you created space like this:
CREATE SPACE IF NOT EXISTS my_space_2 (partition_num=15, replica_factor=1, vid_type=FIXED_STRING(30));

The vid of "new" is valid and no hash is needed.
ref:

*

*https://docs.nebula-graph.io/3.3.0/3.ngql-guide/9.space-statements/1.create-space/

*https://docs.nebula-graph.io/3.3.0/3.ngql-guide/12.vertex-statements/1.insert-vertex/

A: for your first error please use  1669817257 this format or now() "1985-10-01 08:00:00")
like this:

match (v:school) return v,now() limit 10;

as you mentioned:

this documentation said:

The underlying storage data type is: int64

as you can see in this picture you can define two types of spaces there:

via this form you can create/define new space:

when your id is not int64 your error is the second error message that you reported
when your storage vid is int64 you should use hash


text:
Q: Setup wpf .net proyect works but exe didn´t find I´m tring to instal an app that I create with wpf (.NET 4.8), I used Microssoft Visual Studio Installer Projects and these are the steps that I follow:

*

*I add a new proyect to the solution.

*In Aplication Folder/Add/Project Output...

*Primary output and Localized resorces.

*Finally i Build the solution

I loock for the exe in the folder instalation but only there is a .ddl and a .josn.
Thanks.

A: In sted of Primary outPut, I have used PublishItemsOutputGroup.

A: @ michu. According to your description, there may be a problem with your steps. Please check if the following steps are same with you .
1.Download and install Microsoft Visual Studio Installer Projects.
【Click Extensions in Visual Studio to search for Microssoft Visual Studio Installer Projects to download and install】
2.Create a Setup Project named Setup.
3.Add WPF software primary output DLL file into installer.
【Right-click Setup and select Add/**Project Output...**and modify the "Add Project Output Group" page as follows:】

4.Add installer setup icon file.
【Right-click Setup and select Add/File... and add the APP.ico file as application icon: (I did not add an application icon here.)】
5.Create WPF software shortcut for Desktop.

【Right-click on the generated file and rename it to apptest and drag it to User's Desktop. Then right-click apptest in User's Desktop and select Properties Window…:】

6.Configure the details of WPF software properties.

7.Build Setup Installer.
【Click Build and select Batch Build and modify as follows:】

8.Install.
After the installation is complete, you can see the exe in the installation path.


text:
Q: corona sdk fails to load images--- all of them my code runs fine on simulator but when its on my device it wont load any of the images and on my log it says "failed to load ( image name)"????
I have all the images being called in the folder that "lua.main" is in.
heres the code---------------
--local physics = require("physics")
--physics.start()
--physics.setGravity( 0, 6 )
--system.activate( "multitoch" )
--physics.setDrawMode( "normal" )

centerX = display.contentCenterX
centerY = display.contentCenterY
--secCounted = 0
--W = display.contentWidth

--display.setStatusBar( display.HiddenStatusBar )

--timer.performWithDelay( 1000, secCounter, 0 )

--local leftwall = display.newRect(0, 0, 1, 9000)
--local rightwall = display.newRect(W, 0, 1, 9000)
--local top = display.newRect(0, 0, 9000, 160)

--physics.addBody(leftwall, "static")
--physics.addBody(rightwall, "static")
--physics.addBody(top, "static")

local brickwall = display.newImage( "wall.png", centerX, centerY )

--local blackbar = display.newImage( "bar.png", centerX, 0 )

--local direct = display.newText( "Don't let the balloon touch", centerX, centerY, nil, 57         )
--local direct2 = display.newText( "the bottom or top.", centerX, centerY + 55, nil, 57 )
--local direct3 = display.newText ( "You exit through the sides!", centerX, centerY + 110,  nil, 57 )
--direct:setTextColor( 0, 0, 0 )
--direct2:setTextColor( 0, 0, 0 )
--direct3:setTextColor( 0, 0, 0 )

--local ground = display.newImage("floor.png", centerX, 1315 )
--physics.addBody( ground, "static", { friction = 1, bounce = .1 } )

--local function directions( event )
--  direct.text = ""
--  direct2.text = ""
--  direct3.text = ""
--end

--timer.performWithDelay( 9000, directions, 1 )

--local function addBalloon( event )
    --  local bballoon = display.newImage( "bbl.png", centerX, 300 )
    --  physics.addBody( bballoon, { friction = 3.0, bounce = .2 } )

    --function moveBalloon( event )
        --bballoon:applyLinearImpulse( 0, -3, event.x, event.y )
    --end

    --bballoon:addEventListener( "tap", moveBalloon )
--end

--timer.performWithDelay( 10000, addBalloon, 0 )

--local function secCounter( event )
    --  secCounted = secCounted + 1
    --  local blackbar = display.newImage( "bar.png", centerX, 0 )
    --  local myText = display.newText( secCounted, centerX, 50, nil, 100 )
--end

--timer.performWithDelay( 1000, secCounter, 0 )

------------------that was all of it.
ignore all of the commented parts i did that to see if it would just display the brick wall but it didnt!
I feel helpless.

A: maybe your image has embedded ICC profile?
See Image Guidelines
http://docs.coronalabs.com/api/library/display/newImage.html

A: I finally found a solution and just thought I would share what I learned.
It turns out that in order to display a image it cant be renamed to a .png file if the image was edited. I had to leave the image as a .jpeg file
I hope that helped if anyone else was stuck!


text:
Q: floating point precision issue In c++17, let's consider the following.
float num1 = 3.1005;
float num2 = 1.0005, num3 = 2.1000;
float res = num2 + num3;

Then, I would imagine res = 3.1005 and consequently res == num1 -> TRUE. But that is not the result I get.
More confusingly,
cout << res; --> output: 3.1005
cout << (res == num1); --> output: false

Furthermore,
cout << fixed;
cout.precision(3);
cout << res; --> output: 3.100
cout << num1; --> output: 3.101

Can someone, please, explain to me why this is happening.


text:
Q: Vba code to open file from a specific path that works for every user except temp Workbooks.Open Filename:="C:\Desktop\VBA\Phase 1\A.xlsx"

How do I open the file from desktop or documents of any user.

A: Multiple ways you can do that, pick the one that works for you-
Option Explicit
Public Sub Example()
    Dim FilePath As String
    FilePath = CreateObject("WScript.Shell") _
                  .specialfolders("Desktop") & "\VBA\Phase 1\A.xlsx"
    Debug.Print FilePath
End Sub

Option Explicit
Public Sub Example2()
    Dim FilePath As String
    FilePath = Environ("USERPROFILE") & "\Desktop\VBA\Phase 1\A.xlsx"
    Debug.Print FilePath
End Sub


text:
Q: How can I dynamically update the bound of a for loop with OpenMP ic C? I am building a parallel version of a program that I initially wrote in a serial fashion. This function reads a file to create the input vector needed for following operations. Since OpenMP particularly likes for loops, I converted what was initially a while loop into this, that basically is a "dynamic" for loop, where the upper bound (limit?) of the loop is continuously updated until the file is over.
As a serial code, this works with no issues, even on very big files (1M+ lines). However, when I implement the OMP pragmas, it won't work. From my troubleshooting it appears that using the omp pragmas the upper bound (vec_size) cannot be dynamically updated. Is there a work-around for this issue? Thank you in advance.
int readfile(double complex** vec, char* filepath)
{
FILE* filePointer;
char line[50] = {0};
filePointer = fopen(filepath,"r");
double complex* v;
int n=0, i=0, vec_size=VEC_SIZE;                        //number of elements in the vector

v = malloc(VEC_SIZE*sizeof(complex));
//read file and store elements in vec
float tmp;

#pragma omp parallel
{
#pragma omp for ordered
for(i=0; i<n; i++){
    #pragma omp ordered
    fgets(line, 50, filePointer);
    printf("for %d\n", omp_get_thread_num());

    if(n==(vec_size-1) && !feof(filePointer)){              //check if size is exceeded
        printf("if %d\n", omp_get_thread_num());
        vec_size=2*vec_size;
        v = realloc(v, vec_size*sizeof(complex));           //double initial allocated space
        printf("vec_size if %d\n", vec_size);
    }
    printf("vec_size for %d\n", vec_size);
    sscanf(line,"%f",&tmp);
    v[n] = tmp + 0*I;
    n++;
}
}
fclose(filePointer);
*vec = v;
return n;
}


text:
Q: reactjs Uncaught SyntaxError: Unexpected token < with django
I am trying to deploy my django-react in azure vm.
when i am using
python manage.py runserver 0.0.0.0:8000

it is working fine.
but,
when i am using .
gunicorn --bind 0.0.0.0:8000 settings.wsgi

This is is showing above error in console.
Please have a look

A: That is probably because the static files are not being loaded. gunicorn does not serve static contents.
So, you can use whitenoise to serve these static contents. You can install it via pip install whitenoise. Then you can enable it like this:
MIDDLEWARE = [
  # 'django.middleware.security.SecurityMiddleware',
  'whitenoise.middleware.WhiteNoiseMiddleware',
  # ...
]

More information can be found in their documentation regarding using whitenoise on django.
Alternatively, you can use reverse proxy server like NGINX or Apache or Varnish to serve static contents as well.


text:
Q: Add SeekBar value to initial value AndroidHere i I have a initial Time value of 10:30. I also have two SeekBar one for number of hours and other for number of minutes.
When I slide the SeekBar to a certain value, for example for the Hour SeekBar, the number of hours get added to the initial time of 10:30. This works fine.
Further if I again drag the SeekBar to a new value, that value should be added to the initial value and not the value I obtain after the first drag.
ie. If at first I drag the SeekBar to 1 hour and leave the SeekBar, the time is 11.30.
If again I drag the value to 3 hours, the 3 hours get added to 11.30 making the time 2:30 whereas I want the time to be 1:30
Here is my code:-
String initialTime = "10:30"
cal = Calendar.getInstance();

        DateFormat sdf = new SimpleDateFormat("hh:mm:ss");
        Date date;
        try
        {
            date = sdf.parse(initialTime);
            cal= Calendar.getInstance();
            cal.setTime(date);

            txtReachingBy.setText("Reaching By:"+" "+ cal.get(Calendar.HOUR_OF_DAY)+":"+cal.get(Calendar.MINUTE));
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
seekLateBy.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
        {

            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
            {
                progressChangedHours = progress;
                if(progressChangedHours==0 && progressChangedMins!=0)
                {
                    lblLateBy.setText("Late By (Hrs):"+" " + String.valueOf(progressChangedHours) +":"+String.valueOf(progressChangedMins));
                }
                else
                lblLateBy.setText("Late By (Hrs):"+" " + String.valueOf(progressChangedHours) +":"+String.valueOf(progressChangedMins));

            }

            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub
            }

            public void onStopTrackingTouch(SeekBar seekBar)
            {
                if(progressChangedHours==0)
                {
                    timeString = cal.get(Calendar.HOUR_OF_DAY)+":"+cal.get(Calendar.MINUTE)+":"+today.second;
                }
                else
                {
                cal.add(Calendar.HOUR_OF_DAY, progressChangedHours);

                timeString = cal.get(Calendar.HOUR_OF_DAY)+":"+cal.get(Calendar.MINUTE)+":"+today.second;
                }
                txtReachingBy.setText("Reaching by:"+" "+timeString);
            }

        });

How can I do this/

A: For your requirement you need one another variable to store the previous value of your progress change.
Check the code below:
    int previousval=0;
    seekLateBy.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
    {
  public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
        {

            progressChangedHours = progress;
       // DO this code if previousval==0
          if(previousval==0){
             previousval = progress;
            if(progressChangedHours==0 && progressChangedMins!=0)
            {
                lblLateBy.setText("Late By (Hrs):"+" " +   String.valueOf(progressChangedHours) +":"+String.valueOf(progressChangedMins));
            }
            else
            lblLateBy.setText("Late By (Hrs):"+" " + String.valueOf(progressChangedHours) +":"+String.valueOf(progressChangedMins));

        }
     }else{
    // Value is already there.add with the new value
            if(progressChangedHours==0 && progressChangedMins!=0)
            {
                lblLateBy.setText("Late By (Hrs):"+" " +   String.valueOf(progressChangedHours+previousval) +":"+String.valueOf(progressChangedMins));
            }
            else
            lblLateBy.setText("Late By (Hrs):"+" " + String.valueOf(progressChangedHours+previousval) +":"+String.valueOf(progressChangedMins));

        }
    }


text:
Q: Ant build.xml only replacing one instance of token Im using the replace task to replace a token in my html pages but it only appears to be replacing the token in 1 file and skipping the rest.
<replace dir="${basedir}" token="@CDN" value=""${cdnUrl}"">
  <include name="*.html"/>
</replace>

Any ideas why its only replacing this value in one of the html files in this directory?

A: Maybe you should do something like this?
<replace dir="${basedir}" token="@CDN" value=""${cdnUrl}"">
    <include name="**/*.html"/>
</replace>

It's hard to say. Are the other HTML files in the directory or subdirectories?
I discourage my developers to use <replace> because you end up replacing files that are checked into the source control system. The developers commit their changes, and the files that were modified with <replace> end up getting updated with the parameters gone. We usually end up with multiple commits as developers try to untangle the mess (which usually gets caught in production deployments).
I recommend to copy the files, and use <filterset> and <filter> to do the replacement:
<mkdir dir="${basedir}/target"/>  <!-- Or whatever you call your build directory -->
<copy todir="${basedir}/target">
    <fileset dir="${basedir}">
        <include name="**/*.html"/>
    </fileset>
    <filterset prefix="@" suffix="@">
        <filter token="CDN"
             value=""${cdnUrl}""/>
    </filterset>
</copy>

This copies your HTML files into the target directory (which is the build directory). When the developer runs the clean target, it merely deletes that target directory.


text:
Q: Question about 'improving' and 'consuming'
This year's drought in Brazil has left the state of Sao Paolo with its lowest-ever water level.
The Cantareira water system, the largest of six in the area, has reservoirs at less than 15 percent of their normal level.
Wagner Ribiero, a professor at the University of Sao Paolo, warns that if the drought continues, the Cantareira system may not able to meet the demands of the 2014 FIFA World Cup period.
"Currently, the extraction and processing of drinking water has consumed about 20 percent of the water, and this can be improved. On the other hand, we should enhance industrial water usage and recycling," Ribero explained.
Source

I'm wondering what the words "consume" and "improve" really mean in this context.
My perception:
Currently, the extraction and processing of drinking water has destroyed about 20 percent of the water and this can be fixed.
Another possible interpretation:
Currently, the extraction and processing of drinking water has provided / supplied about 20 percent of the water and this can reach to a higher percentage 30 or 40 percent.
In other words, what can be improved? The amount supplied (which can improve by going up), or the amount lost (which can improve by going down)?

A: Consumed: In this context, it means 'used up'. It's similar in meaning to how you would normally use the word. It can also mean 'wasted'.
Improved: The first part of the sentence describes the current situation. It is this situation that needs to be 'improved'. The situation is improved when a better solution is found: in this case, when less than 20% of the water has been used up.
Note: When consumed is used in this context, it tends to describe something negative, as 'consuming' something is similar to wasting the resource by using to much of it. Your perception is perfectly correct.


text:
Q: Has the whole world gone crazy? Quotient rule, exponential function, curvature. Attempting to find the maximum curvature of the curve $e^x$ I have to differentiate kappa
$$k(t)=\frac{e^t}{(1+e^t)^{3/2}}$$
of course, I use quotient rule and chain rule to find the derivative;
$$k^1(t)=\frac{e^t*(1-e^{2t})^{3/2}-e^t*3/2(1-e^{2t})*2e^{2t}}{((1+e^{2t})^{3/2})^2}$$
and simplify etc.
However, multiple sources including an exam key, and even a highly upvoted post on Stack Exchange Math has the derivative of kappa as
$$k^1(t)=\frac{e^t*(1-e^{2t})^{3/2}-e^t*3/2(1-e^{2t})*2t}{((1+e^{2t})^{3/2})^2}$$
Notice the blatant abuse of chain rule to get the last factor in the numerator.
Why are they doing this? am I missing something? are these people blatantly wrong? please help
If you don't believe me look at these pages:
question # 4
http://www.math.washington.edu/~conroy/m126-general/exams/mt2SolMath126Win2006.pdf
And look at chris' post:
How to find the point where the curvature is maximum
fixed the typos, thanks to Lee and Mattos for pointing them out~


text:
Q: count of every day (mysql) I want get something like this
Mysql data
(dat_reg)
1.1.2000
1.1.2000
1.1.2000
2.1.2000
2.1.2000
3.1.2000

I want to get:
   (dat_reg)  (count)
    1.1.2000 -   3
    2.1.2000 -   5
    3.1.2000 -   6

What I tried is this:
SELECT COUNT( * ) as a , DATE_FORMAT( dat_reg, '%d.%m.%Y' ) AS dat
FROM members
WHERE (dat_reg > DATE_SUB(NOW() , INTERVAL 5 DAY))
GROUP BY DATE_FORMAT(dat_reg, '%d.%m.%Y')
ORDER BY dat_reg

but I get:
 1.1.2000 - 3 | 2.1.2000 - 2 | 3.1.2000 - 1

Some tips how create query for this?

A: A subquery counting the rows where the registration date is less than or equal to the current registration date could help you out.
SELECT m2.dat_reg,
       (SELECT count(*)
               FROM members m3
               WHERE m3.dat_reg <= m2.dat_reg) count
       FROM (SELECT DISTINCT m1.dat_reg
                    FROM m1.members
                    WHERE m1.dat_reg > date_sub(now(), INTERVAL 5 DAY)) m2
       ORDER BY m2.dat_reg;

(If you got days, on which no one registered and don't want to have gaps in the result, you need to replace the subquery aliased m2 with a table or subquery, that has all days in the respective range.)

A: I would suggest using variables in MySQL:
SELECT d.*, (@sumc := @sumc + cnt) as running_cnt
FROM (SELECT DATE_FORMAT(dat_reg, '%d.%m.%Y') as dat, COUNT(*) as cnt
      FROM members
      WHERE dat_reg > DATE_SUB(NOW() , INTERVAL 5 DAY)
      GROUP BY dat
      ORDER BY dat_reg
     ) d CROSS JOIN
     (SELECT @sumc := 0) params;

If you want an accumulative from the beginning of time, then you need an additional subquery:
SELECT d.*
FROM (SELECT d.*, (@sumc := @sumc + cnt) as running_cnt
      FROM (SELECT DATE_FORMAT(dat_reg, '%d.%m.%Y') as dat, dat_reg, COUNT(*) as cnt
            FROM members
            GROUP BY dat
            ORDER BY dat_reg
           ) d CROSS JOIN
           (SELECT @sumc := 0) params
      ) d
WHERE dat_reg > DATE_SUB(NOW() , INTERVAL 5 DAY)

A: I believe you can use the window functions to do the work:
mysql> SELECT employee, sale, date, SUM(sale) OVER (PARTITION by employee ORDER BY date) AS cum_sales FROM sales;
+----------+------+------------+-----------+
| employee | sale | date       | cum_sales |
+----------+------+------------+-----------+
| odin     |  200 | 2017-03-01 |       200 |
| odin     |  300 | 2017-04-01 |       500 |
| odin     |  400 | 2017-05-01 |       900 |
| thor     |  400 | 2017-03-01 |       400 |
| thor     |  300 | 2017-04-01 |       700 |
| thor     |  500 | 2017-05-01 |      1200 |
+----------+------+------------+-----------+

In your case you already have the right groups, it is only a matter of specifying the order in which you want the data the be aggregated.
Source: https://mysqlserverteam.com/mysql-8-0-2-introducing-window-functions/
Cheers

A: Here is a solution using rank and a continuous count variable:
WITH ranked AS (
  SELECT m.*
    ,ROW_NUMBER() OVER (PARTITION BY m.dat_reg ORDER BY m.id DESC) AS rn
  FROM (
    select id, dat_reg
    ,@cnt := @cnt + 1 AS ccount from members
    ,(SELECT @cnt := 0) var
   WHERE (dat_reg > DATE_SUB(NOW(), INTERVAL 5 DAY))
  ) AS m
)
SELECT DATE_FORMAT(dat_reg, '%d.%m.%Y') as dat, ccount FROM ranked WHERE rn = 1;

DB-Fiddle


text:
Q: deleted select photos previously synced to my phone but not the whole folder How can I delete select photos from my iphone 8 that were previously synced from my computer but I can't find the folder on my computer, a microsoft tech guy helped me get photos from the Microsoft photos opp onto my phone after I dropped my iphone 7 and couldn't get the pics off of it.

A: I would turn on iCloud sync of photos so you can use a computer to ohotos to be deleted or just delete them from a larger screen.
For me, using a computer via photos is even better, but you might not have a Mac but just about everyone can borrow a computer to organize things easier than tapping on an iPhone.


text:
Q: Ruby: call initialize method before others in class I have a file with the following code
and i want the initialize method to run first and then call
class Lol < Redstone

    def initialize
        super 2013
    end

    call "/" do |headers|
        "headers"
    end

end

But when i execute this, the method call is first called.
how to fix this?

A: initialize is an instance method in this class, so the def initialize is just setting up the constructor for the class. call.. is calling the class's call method at the time the class definition is parsed. This code is equivalent to
class Lol < Redstone
  def initialize
    super 2013
  end
end

Lol.call "/" do |headers|
  "headers"
end

(assuming call is a public class method)
Ruby doesn't really have the idea of a class constructor, other than the code in the actual class definition (like the call method). If you need to do something, you could do:
class Lol < Redstone
  def self.init
    #do class setup
  end
  init
  def initialize
    super 2013
  end

  call "/" do |headers|
    "headers"
  end
end

However, depending on the way you are wanting this to work, that may not do what you want.


text:
Q: Apple apns push notification i iOS 6 i'm trying to set push notifications for my new app and i have heard that in ios 6 device token changes  each time the app is launched !
Is it true ?
Can someone tell me what i've changed to Apns in iOS 6 ?
Thanks a lot for any help. (i've google it do not worry)

A: That's not true.
Device Token rarely changes (it usually only changes if you change your iOS version or restore your device from a backup).
In fact, all the applications on the same device have the same device token.
And these things haven't changed in iOS6.

A: Regardless if the device token changes or not, it's best to re-register each time the app is launched to handle the possibility of a change (which CAN happen in some circumstances).
In your application:didFinishLaunchingWithOptions: you should use this code to avoid any problems that may arise due to the device token changing:
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types != UIRemoteNotificationTypeNone){
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
}


text:
Q: ember.js Need to see if I can write Ember model items to a file then download I am new to ember (and stackOverflow) and have an issue that I am trying to work through. I have a model for a list of items that I am able to add into, update, and delete and everything on that end works fine. What I would like to do is to try and take the items in the model and write them into a formatted text file to download.
The model data is fine.
I know I can use this code to download a file from a url: < a href="urlFile" download="filename">
I just don't see any guides that can get me from the model to the download and I was wondering if anyone has any suggestions that could point me in the right direction.  Thanks.

A: I could recommend FileSaver.js.
It's a really handy tool to download stuff, we're using it in our company in our ember application.
https://github.com/eligrey/FileSaver.js/
Simply include it in your vendor folder and in the ember-cli-build.js
ember-cli-build.js
app.import('vendor/FileSaver.js');

Project Structure
/app
/build
.
.
.
/vendor
  FileSaver.js

Then you can call it from anywhere with
saveAs(new File([file], filename, additionalParameters))

and it will download the file.
For further documentation you can look at the github page.


text:
Q: Can I pull in the Data Categories for an Article into a custom field that would allow me to sort by Data Category in a list view? I know there can be multiple data categories, but if I could pull them into a custom field, I could at least do a "contains" filter for the articles.
What formula in a custom field on the Knowledge object would pull in the data categories?

A: Try using KnowledgeArticleVersion instead of KnowledgeArticle. From the Object Reference:

Use this object to:

*

*Query or search generically across multiple article types.

*Filter on a specific version.

*Update standard fields, those fields that are updateable, in draft versions.

When you query on the archived article, the results include both the article and the article's archived versions.

Also, use KnowledgeArticleVersion with describeDataCategoryGroups() and describeDataCategoryGroupStructures() to return the category groups and the category structure associated with Salesforce Knowledge.
You can filter by PublishStatus='online' to get only the current version available.

A:
First of all, formula field will not going to work in this scenario.

Knowledge Article Version can have multiple DataCategories.Refer this data model. Salesforce Knowledge Objects

Secondly, trigger is not supported on Article Types.

Solution

*

*Create a Custom Field Data_Categories__c Text (255) in the Article Type (e.g. Help Document is Article Type)

*Create an @invocable method like this which will retrieve data categories based on the Article Type Version and finally update those in the Custom field:
Code
public class ArticleAction {
    @InvocableMethod
    public static void updateArticleTypeForDataCategories(List<Id> articleTypeIds)
    {
        List<Help_Document__kav> lstArticleType = [SELECT Id, Title, Data_Categories__c FROM Help_Document__kav WHERE Id IN:articleTypeIds
                                                    AND PublishStatus = 'draft'];

        List<Help_Document__DataCategorySelection> lstDC = [SELECT ParentId, DataCategoryName   FROM Help_Document__DataCategorySelection
                                                            WHERE ParentId IN:articleTypeIds];

        Map<Id, String> datacategoryNameMap = new Map<Id, String>();

        for(Help_Document__DataCategorySelection dcObj:lstDC)
        {
            if(datacategoryNameMap.containsKey(dcObj.ParentId))
            {
                String str =  datacategoryNameMap.get(dcObj.ParentId);
                datacategoryNameMap.put(dcObj.ParentId, str + ',' + dcObj.DataCategoryName);
            }
            else
            {
                datacategoryNameMap.put(dcObj.ParentId, dcObj.DataCategoryName);
            }
        }

        for(Help_Document__kav artObj:lstArticleType)
        {
            if(datacategoryNameMap.containsKey(artObj.Id))
            {
                artObj.Data_Categories__c = datacategoryNameMap.get(artObj.Id);
            }
        }

        update lstArticleType;
    }
}

*

*Call this invocable method from Process builder. You will see dataCategories will be saved in Comma delimited way.

*

*For Archived articles, make those as draft and finally call this method from DeveloperConsole or other batch process.


text:
Q: downloads_path_provider_28 ? When I execute the fluent run command, I will be prompted for downloads_ path_ provider_ 28 has been deprecated.
I want to know the updated version of the plug-in that can replace this plug-in.


text:
Q: Is this floating point behavior or a bug in PHP? CLARIFYING: This isn't asking why I'm getting rounding errors.  I understand this is a mistake or an oversight.  The question asks why it prints as whole in the first var_dump, but casting acts as if it were 57916.9repeating and truncates said .9repeating.
The following occurs:
You take a string (or float -- does not matter) that contains the value 579.17 and multiply it 100.  It var_dumps the expected 57917.  Not 57916.99999999999999999999999 or similar. var_dump should not be rounding anything as a debugging function in my opinion. It may have to truncate, but rounding is unexpected in a debugging function.
However, if one then casts that to an integer, you get an unexpected 57916 from var_dump.
I'm aware of issues with floating point numbers, but the act of casting a floating point number that prints as exactly 57917 in PHP apparently effectively subtracts 1.  This is a very small number.
This only appears to happen for some numbers, such as 579.17.  It does not occur for others I've tested. All we're doing is multiplying a number by 100 to send to an API that expects cents. The API library understandably casts to integer since the API doesn't accept fractional cents.
Test case:
php -r '$n = ("579.17" * 100); var_dump($n, (int)$n);'

Output:
float(57917)
int(57916)

Environment:
x86-32,
x86-64 both.

A: Use round() instead of int(). The actual value of 579.17 * 100 is something like 57916.99999. var_dump() shows this as 57917, but when you use int() it truncates the fraction. Using round() will go to the nearest integer, rather than always truncating down.

A: var_dump uses precision from php.ini to display float value. You could raise it to see what happens.
php -r 'ini_set("precision", 20); $n = ("579.17" * 100); var_dump($n, (int)$n);'
// double(57916.999999999992724)
// int(57916)

Also. There is no matter x86 or x64. PHP uses 64 bits for floats.
http://php.net/manual/en/language.types.float.php

A: I believe this is because hardware cannot truly and accurately express floating point numbers. So what appears as 579.17 is actually more like 579.16999999. So when you multiply it and cast it as an int it truncates the decimal leaving you with 57916.


text:
Q: Mysql, get data between two dates, if there is not data at the starting date, I need to get data from last entered date? I have a table with following entries

Created at
tax

2020-01-05
300

2020-06-10
350

2020-09-15
400

2020-09-28
320

If I try to get data between 2020-02-01 to 2020-10-30 I need to get output as following

Created at
tax

2020-02-01
300

2020-03-01
300

2020-04-01
300

2020-05-01
300

2020-06-01
300

2020-06-10
350

2020-07-01
350

2020-08-01
350

2020-09-01
350

2020-09-15
400

2020-09-28
320

2020-10-01
320

A: In MySQl 8 you can generate the missing records recursively. Otherwise, a temporary table is required.
WITH RECURSIVE dates (created_at) AS (
  SELECT '2020-02-01' as created_at
  UNION ALL
  SELECT DATE_ADD(created_at, INTERVAL 1 MONTH)
  FROM dates WHERE created_at <= '2020-10-30'
), result_table AS (
  SELECT created_at, tax FROM taxes
  UNION
  SELECT created_at, (
      SELECT tax FROM taxes t
      WHERE t.created_at <= d.created_at
      ORDER BY t.created_at DESC LIMIT 1
    ) AS tax
  FROM dates d
)
SELECT * FROM result_table
WHERE created_at BETWEEN '2020-02-01' AND '2020-10-30'
ORDER BY 1

db<>fiddle


text:
Q: PHP set global variable as handle for class For some reason, when defining:
 function __construct() {
    if(!isset($_GLOBALS["className"])) {
      $_GLOBALS["className"] = new className;
    }
    return true;
  }

 $_GLOBALS["className"]->classMethod();

PHP for some reason states that $_GLOBALS["className"] is undefined.
Oh, and the same also occurs even if I set the global value to something else, from within that class.  I can test the value of the global through the construct or some other method, but not outside - it seems that the global is lost outside the class for some reason.
Is there a way to retain the global after declaring it from within an external class?
Any help is sincerely appreciated!

A: You want to use $GLOBALS and not $_GLOBALS:
http://php.net/manual/en/reserved.variables.globals.php
$_GLOBALS will just be available in your function scope.


text:
Q: CSV separated by space to separated by comma in terminal I have a CSV file like this:
$ head file.csv
22.87333333 22.87333333
22.87944444 89.84361111
22.89722222 89.8425

I want to transfer it to comma separated using terminal. Like this;
$ head file.csv
22.87333333,22.87333333
22.87944444,89.84361111
22.89722222,89.8425

What are the ways of doing this?

A: And an awk solution as well:
$ awk -v OFS=',' '{$1=$1}1' file.csv

A: Simply use tr (translate) command
tr " " "," <file

awk equivalent
$ awk '{OFS=","; $1=$1}1' file

Output:
22.87333333,22.87333333
22.87944444,89.84361111
22.89722222,89.8425

A: Sed has a transliteration command, y:
$ sed 'y/ /,/' file.csv
22.87333333,22.87333333
22.87944444,89.84361111
22.89722222,89.8425

A: Assuming your file is actually space-separated values, this sed command:
$ sed -i 's/ /,/g' file.csv

will inplace (-i) replace each occurrence (globally) of space with comma, using the ssubstitute command.


text:
Q: Parsing XML using XSLT? How can I parse a XML document using XSLT? May be I am wrong, Is it possible to parse a XML document using XSLT?
Here is XML document:
<?xml version="1.0" encoding="utf-8" ?>
<cart>
  <item id="1">
    <name>Tyres</name>
    <cost>20</cost>
  </item>
  <item id="2">
    <name>Front Glass</name>
    <cost>30</cost>
  </item>
  <item id="3">
    <name>Vanity Mirror</name>
    <cost>10</cost>
  </item>
  <item id="4">
    <name>Brake Pads</name>
    <cost>50</cost>
  </item>
  <item id="5">
    <name>Brake Oil</name>
    <cost>40</cost>
  </item>
</cart>

and the XSLT page:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="shopping_cart">
      <root>
        <xsl:apply-templates select="cart"/>
      </root>
    </xsl:template>
  <xsl:template match="cart">
    <cart>
      <xsl:attribute name="name">
        <xsl:value-of select="name"/>
      </xsl:attribute>
      <xsl:attribute name="cost">
        <xsl:value-of select="cost"/>
      </xsl:attribute>

    </cart>
  </xsl:template>
</xsl:stylesheet>

Any way to do that? Please guide as I don't know much about parsing concept.

A: If there is only one XML document used by the stylesheet, the normal mechanism is to make it the "principal input document". Depending on the API to your processor, you can typically supply the source document in either parsed or unparsed form; if you supply it in unparsed form (for example as an InputStream) it will automatically be parsed and presented to the stylesheet as a tree of nodes.
If your stylesheet uses multiple documents, you can access (and parse) the secondary input documents using the document() function.


text:
Q: Verify data in JOptionPane before it is closed I have a JOptionPane in which I have a JPanel with some text fields. When you click on "ok" something should happen with the values of the text fields. But before something happen, I want to check if a text field is empty. If so the dialog should not dismiss and I want to show a message that all fields are required.
If I do it like this:
int result = JOptionPane.showConfirmDialog(null, dialogPanel, "Neuen Kunden anlegen", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if(result == JOptionPane.OK_OPTION){
    ...
}

the dialog is already dismissed when I check the pressed button. Is it possible to handle the button click before the dialog dismiss?

A: A JOptionPane's button press will close the dialog -- you can't change that. And so your options are to either re-show the JOptionPane or create and display your own modal JDialog and have their button's listeners behave as you desire.


text:
Q: Unable to exclude dependency from a jar Unable to exclude dependency from a jar, how should I go about doing this.
compile ('com.amazonaws:aws-java-sdk:1.11.+') {
    exclude module: 'aws-java-sdk-machinelearning'
}

gradle dependencies still shows this as well and the above exclude always get downloaded as well.

A: I have similar situation but i did like below .if it helps .. please select as answered.
  dependencies {
    classpath "gradle.plugin.net.foragerr.jmeter:jmeter-gradle-plugin:1.0.5-2.13"
    classpath "org.codehaus.groovy:groovy-all:2.4.3"
    classpath(group: 'kg.apc', name: 'jmeter-plugins-extras-libs', version: '1.3.1') {
        exclude group: 'commons-math3', module: 'commons-math3'
        exclude group: 'commons-pool2', module: 'commons-pool2'
    }

  }
}


text:
Q: How to make the Eureka server strong? I am new to Spring Cloud. Currently, I want to build a new micro service based on Spring Cloud. It is very easy to build a new Eureka server. But my question is that how to make it high availability ? For example I create two Eureka server and a load balancer. When one of the Eureka server is down, the system still works well. But I don't know to to consist registered information in the two Eureka server.

A: I have already asked something similar in the spring cloud gitter channel.
Because of the CAP theorem, something as a distributes Service discovery has to decide, either to provide availability, or more consistency, with a trade off to the other one.
in short, by quoting Spencer Gibb:

Eureka favors availability over consistency

so it is very available, while registred services may be not acutal anymore.
As Spencer suggested, if consistency is something you need more then availability, try Consul together with spring cloud consul intead


text:
Q: How to use React-bootstrap Modal with typescript I am using react, react-bootstrap and typescript.  I get the following error:
JSX element type 'Modal' does not have any construct or call signatures.  TS2604
The code is pretty boilerplate from the react-bootstrap website which works if I use javascript:
import React, { Component } from "react";
import Modal from 'react-bootstrap';

class InfoModal extends Component{
    state = { show: true }

    render(){
     <Modal show={show} onHide={handleClose}>
        <Modal.Header closeButton>
          <Modal.Title>Modal heading</Modal.Title>
        </Modal.Header>
        <Modal.Body>Woohoo, you're reading this text in a modal!
        </Modal.Body>
        <Modal.Footer>
          <Button variant="secondary" onClick={handleClose}>
            Close
          </Button>
        </Modal.Footer>
      </Modal>
    }
}

A: There were a few issues so I hope this helps anyone with the same issue:

*

*The import was wrong it should have been: import { Modal, Button } from 'react-bootstrap';

*onHide={() => { this.handleClose() }}


text:
Q: phpdocumentor/reflection-docblock package issue I have this problem on server CLI, the project in Laravel 6 and server is in ubuntu
Problem 1
        - Installation request for phpdocumentor/reflection-docblock 5.0.0 -> satisfiable by phpdocumentor/reflection-docblock[5.0.0].
        - phpdocumentor/reflection-docblock 5.0.0 requires ext-filter ^7.1 -> the requested PHP extension filter has the wrong version (7.2.28-3+ubuntu16.04.1+deb.sury.org+1) installed.
      Problem 2
        - phpdocumentor/reflection-docblock 5.0.0 requires ext-filter ^7.1 -> the requested PHP extension filter has the wrong version (7.2.28-3+ubuntu16.04.1+deb.sury.org+1) installed.
        - phpspec/prophecy v1.10.2 requires phpdocumentor/reflection-docblock ^2.0|^3.0.2|^4.0|^5.0 -> satisfiable by phpdocumentor/reflection-docblock[5.0.0].
        - Installation request for phpspec/prophecy v1.10.2 -> satisfiable by phpspec/prophecy[v1.10.2].
      To enable extensions, verify that they are enabled in those .ini files:
        - /etc/php/7.2/cli/php.ini
        - /etc/php/7.2/cli/conf.d/10-mysqlnd.ini
        - /etc/php/7.2/cli/conf.d/10-opcache.ini
        - /etc/php/7.2/cli/conf.d/10-pdo.ini
        - /etc/php/7.2/cli/conf.d/15-xml.ini
        - /etc/php/7.2/cli/conf.d/20-calendar.ini
        - /etc/php/7.2/cli/conf.d/20-ctype.ini
        - /etc/php/7.2/cli/conf.d/20-dom.ini
        - /etc/php/7.2/cli/conf.d/20-exif.ini
        - /etc/php/7.2/cli/conf.d/20-fileinfo.ini

      You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

A: For me as phpspec/prophecy version works with earlier version, ignoring the platform requirements worked fine.
composer install -n --ignore-platform-reqs


text:
Q: Magento 2: Zendframework dependency not installed We're running Magento2 v2.2.10. And we're deploying the repo using Capistrano but it fails during bin/magento tasks.
An abstract factory could not create an instance of magentoframeworkappdeploymentconfig(alias: Magento\Framework\App\DeploymentConfig).
The issue and simply appears to be that it is missing the Zendframework (the folder and its sub-packages do not exist in vendor).
We've tried to include it in our composer.json manually but without luck. Copying the Zendframework folder from a backup into /vendor solves the issue. If we manually run composer update/install in the release folder it works (after deleting the vendor folder). We've tried to play around with composer flags but it didn't care.
What the hell is going on? >=(
==
The composer.json file:
{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.2.10",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/product-community-edition": "2.2.10",
        "composer/composer": "@alpha",
        "mollie/magento2": "^1.9",
        "mageplaza/magento-2-german-language-pack": "dev-master",
        "mageplaza/magento-2-french-language-pack": "dev-master",
        "mageplaza/magento-2-dutch-language-pack": "dev-master",
        "olegkoval/magento2-regenerate-url-rewrites": "^1.5",
        "sendcloud/sendcloud": "^1.1"
    },
    "require-dev": {
        "allure-framework/allure-phpunit": "~1.2.0",
        "magento/magento2-functional-testing-framework": "2.4.5",
        "phpunit/phpunit": "~6.2.0",
        "squizlabs/php_codesniffer": "3.2.2",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.5.2",
        "friendsofphp/php-cs-fixer": "~2.2.1",
        "lusitanian/oauth": "~0.8.10",
        "sebastian/phpcpd": "2.0.4"
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": [
                "app/code/",
                "generated/code/"
            ]
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ],
        "exclude-from-classmap": [
            "**/dev/**",
            "**/update/**",
            "**/Test/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "stable",
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],
    "extra": {
        "magento-force": "override"
    }
}

A: When in doubt, delete everything. Cache and vendor folder included and things might turn out ok again.


text:
Q: jquery on ready keypressed My page have elements loaded with ajax, i need use enter to go next input, textarea or select.
some inputs have a function to format numbers but the solution above run more that once.
$(document).on('keypress',function(){
    var inputs = $('input, select, textarea').on("keypress", function(e) {
    if (e.which == 13) {
        if ($(this).attr('data-format')) {
            formatNumber($(this));
        }
        e.preventDefault();
        var nextInput = inputs.get(inputs.index(this) + 1);
        if (nextInput) {
            nextInput.focus();
        }
    }
});
});

A: This works for me
$(document).on('keypress',function(){
var inputs = $('input, select, textarea').one("keypress",function (e) {
  if (e.which == 13) {
    if($(this).attr('data-format')){
        formatNumber($(this));
    }
    e.preventDefault();
    var nextInput = inputs.get(inputs.index(this) + 1);
    if (nextInput) {
      nextInput.focus();
    }
  }
});

});

A: As Rory and Jason mentioned, you're probably looking for event delegation.  This will allow any new inputs that didn't initially exist still respond to the keypress event once they appear.  Here's a good article on the subject: https://learn.jquery.com/events/event-delegation/ and your code should look something like this:
UPDATE:
$(document).on('keypress', 'input, select, textarea', function(e){

  var inputs = $("input, select, textarea");

  if (e.which == 13) {
    if($(this).attr('data-format')){
      formatNumber($(this));
    }
    e.preventDefault();
    var nextInput = inputs.get(inputs.index(this) + 1);
    if (nextInput) {
      nextInput.focus();
    }
  }
});


text:
Q: Is is OK to use a non-zero return code for a process that executed successfully? I'm implementing a simple job scheduler, which spans a new process for every job to run. When a job exits, I'd like it to report the number of actions executed to the scheduler.
The simplest way I could find, is to exit with the number of actions as a return code. The process would for example exit with return code 3 for "3 actions executed".
But the standard (AFAIK) being to use the return code 0 when a process exited successfully, and any other value when there was en error, would this approach risk to create any problem?

Note: the child process is not an executable script, but a fork of the parent, so not accessible from the outside world.

A: What you are looking for is inter process communication  - and there are plenty ways to do it:

*

*Sockets

*Shared memory

*Pipes

*Exclusive file descriptors (to some extend, rather go for something else if you can)

*...

Return convention changes are not something a regular programmer should dare to violate.

A: The only risk is confusing a calling script.  What you describe makes sense, since what you want really is the count.  As Joe said, use negative values for failures, and you should consider including a --help option that explains the return values ... so you can figure out what this code is doing when you try to use it next month.

A: I would use logs for it: log the number of actions executed to the scheduler. This way you can also log datetimes and other extra info.
I would not change the return convention...

A: If the scheduler spans a child and you are writing that you could also open a pipe per child, or a named pipes or maybe unix domain sockets, and use that for inter process communication and writing the processed jobs there.
I would stick with conventions, namely returning 0 for success, expecially if your program is visible/usable around by other people, or anyway document well those decisions.
Anyway apart from conventions there are also standards.


text:
Q: Orchard CMS, OWIN, OpenID Connect, and Azure Website We have deployed Orchard to an Azure Website. However, when we enable a module we created that enables OWIN OpenID connect, we are getting this resulting error:

The data protection operation was unsuccessful. This may have been caused
  by not having the user profile loaded for the current thread's user
  context, which may be the case when the thread is impersonating.

It only happens when I enable our custom auth module, but it works fine locally and on our dev server.  The issue only occurs in Azure.
Stack Trace:

[CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.]
   System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) +514
   System.Security.Cryptography.DpapiDataProtector.ProviderProtect(Byte[] userData) +75
   Microsoft.Owin.Security.DataHandler.SecureDataFormat`1.Protect(TData data) +93
   Microsoft.Owin.Security.OpenIdConnect.d__c.MoveNext() +1342
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Microsoft.Owin.Security.Infrastructure.d__b.MoveNext() +531
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Microsoft.Owin.Security.Infrastructure.d__8.MoveNext() +631
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Microsoft.Owin.Security.Infrastructure.d__5.MoveNext() +318
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +13877209
   Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +1371
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   System.Runtime.CompilerServices.TaskAwaiter.GetResult() +28
   Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +1107
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   Orchard.Mvc.Routes.d__7.MoveNext() in c:\Users\jphillips\code\ifb-blue-orchard\src\Orchard\Mvc\Routes\ShellRoute.cs:181
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +69
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +611
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137

A: So I figured out using a combination of this Generating reset password token does not work in Azure Website and telling OWIN to use the custom MachineKeyProtectionProvider class using this extension method.
app.SetDataProtectionProvider(new MachineKeyProtectionProvider());

Once I set that OWIN started using the machine key and everything in Azure is know cool and it works.  I also wrote a post about it.