How do amateur and professional theatres obtain full script and score, along with choir for popular musicals?

Question: In my final year of high school, I took pleasure in working with my fellow students in perfecting The Wizard of Oz, one of my favorite works of all time. I've wanted to understand the composition and structure of all the songs, especially the incidental and background music; I made a lot of effort into finding out which companies provided these scores over the past six years, though not all the time.
Unfortunately, there's just one problem. I am completely blind, and I cannot read print music. I can, however, read braille music whenever I can afford to get it transcribed. I have also tried to use sheet music recognition programs to see if I could extract the material that way, but that, too, proved to be a tedious undertaking.
Comment: Theatre companies pay for the scores. It's part of their cost of putting on the show. If you want to audition to be a musician in such an orchestra, you may be able to request a Braille score or possibly a demo recording if you can play by ear, but it's at least as likely you would have to pay for your own Braille transcription.
Comment: As far as I've been able to find, whatever you can get on amazon.com for musical theatre sheet music is what is available. So any web site that sells sheet music will probably have musical theatre sheet music (including Amazon), and that's all there is unless you actually pay for a performance license.
Comment: I'm not actually auditioning for anything. I think we would like to add that to my collection so that I can learn how to play all of these pieces using Marie, musical instrument digital interface.
Comment: Ouch! Your voice-to-text tool is not working well :-( .     But the answer remains: you'll have to purchase the score because it's almost certainly under copyright.
Comment: I would love to have individual parts for scores to musicals but they just aren't available. Some of them have high quality vocal and piano books available anywhere you can buy sheet music and others have lower quality vocal and piano books available, and that's about it. I haven't quite figured out why you can't just buy full sets of scores, but I think it's because the owners of the musicals want to control how and when their works are performed, and they want to make sure they get paid for every performance.
Comment: And I have, I don't think that exchange is meant to provide product recommendations, but there must certainly be a dealer or distributor out there that allows people to buy her scores. That's exactly what I like to do. I wouldn't mind purchasing it due to copyright. I just need to know where to get it from HealthTap
Answer: I'll answer the question in the title:
"Amateur" theatre groups are commonly called community theatre groups. Anyone who wants to put on a musical, whether it's on-Broadway, off-Broadway, touring, out-of-town, community, school, etc., they all have to pay to license the musical. One of the protections granted by copyright law is the exclusive rights to perform the work, so for anyone who is not the copyright holder, they have to pay for a license.
Licensing is pretty tightly controlled for musical theatre, which I think is because of both the need for the authors of the musical to recoup as much as they can of the investment of time they spent writing it, as well as to make sure there aren't low budget productions competing with more lucrative productions in the same area. For example, right now Hamilton is earning so much money with the Broadway and high-budget touring shows that the licensing fees are certainly very large - to prevent community theatre groups from performing it all over the place for a fraction of the professional ticket prices and saturating the market. If you want to see Hamilton right now, you pay through the nose, and that's largely due to the licensing strategy. After interest in the show starts to wane and the Broadway run closes, licensing costs will come down to make it more accessible to smaller and smaller groups to be able to keep at least a bit of money coming in for the copyright owners.
Buying a license to perform a musical includes both the rights to perform it and the materials necessary to do so, which isn't always limited to just the score and book and parts. For instance, a license for Avenue Q can optionally include copies of the puppets used on Broadway.
After the run, all materials must be returned in their original condition. There's often an "erasing party" for the orchestra at the end of a run where the players go through and erase all the pencil notes they have made in their scores. It's illegal to copy the materials although some musicians memorize their parts and might jot down notes to remember how to play it.
If you want to start playing musical theatre works, the best thing is to get in with a community theatre group. As I mentioned in my comment, you'll probably have to offer to have your own braille transcriptions made, or take care of any other accommodations you might need. I'm sure another orchestra member or cast or crew member will be happy to help with other needs, such as getting to your place for rehearsals and shows, etc. I have generally found musical theatre people to be lovely and kind (a few stressed out producers and directors notwithstanding). In many areas, community theatre groups have a hard time finding capable musicians, especially for certain instruments, so you might not even have to audition.
Your only other option is to get a piano/vocal book from a music shop and try to work out the part for your instrument or what is different from the actual score if you are a pianist.
Comment: I might ask this on the law SE part regarding 17 U.S.C. 121, which permits certain copying of material for use by blind people in an alternative format, and whether that applies to theatre musical conductor scores, piano vocal scores, etc.
Answer: Full scores - with every instrument notated as in an orchestral score - are rare in the Musical Theatre world (excluding opera).  You're more likely to get a Vocal Score, in which all the voice parts are fully notated but the orchestra is reduced to a 'piano-conductor' part.
For some shows, this Vocal Score is published.  You can buy it independently of any production of the show.  For others, you'll only be able to get it along with the rights to perform the show, which may or not be available to amateur productions (the American term is Community productions) depending on whether there are professional productions in your area.  (I suppose it should be mentioned that the vocal scores of most shows have unofficially 'escaped' and may be found in the deep recesses of the Internet.)
Note that the Vocal Scores mentioned are NOT the 'songbook' collections that are published for most shows.  These are just the individual songs, often considerably simplified from how they were performed in the show.
Comment: I've done several community theatre productions and score for each separate part has always been part of the production. A group only licensing conductor/piano and vocals is most likely trying to save money. That doesn't mean the full scores aren't available, they just cost more.
Comment: Confusion over the word 'score' I think.  Yes, the rental will include a set of instrumental books.  But not very often a 'full score' for the conductor.  I think this was clear in my answer?
Comment: Well, through some hard work and a lot of hours spent on-line, I found some stuff on Scribd, and someone had uploaded a piano vocal or rehearsal score on MuseScore, which I was able to translate into MIDI using Music XML programmes.


Does high log-likelihood imply high R^2

Question: Does a high LL value imply that the model has a high $R^2$? I'm a very beginner to statistics so please excuse my naivete.
Answer: No, since for linear regression log likelihood is a sum of squared residuals plus some other terms, log likelihood is scale dependent. So for the same model multiplying the regressors by some constant will change log likelihood but R squared will remain the same.
Comment: to add to mpiktas LL can be more than 1 but Rsquared cant be greater than 1.
Comment: It would be more useful to construe "high likelihood" as meaning high *relative to a saturated model,* because that's the spirit in which the question was asked and it leads to a much more informative analysis.
Answer: If all your models have normally distributed errors and are fit to exactly the same data, then there is a straightforward, increasing relationship between likelihood and R^2, since they're both ultimately about the sum of squared errors. But in general, no, you can't look at a pair of log likelihood values and assume much of anything about overall goodness of fit.
The clearest case of this is when you have models fit to two different data sets. The likelihood of getting exactly two heads and one tail from a fair coin after three flips is a lot higher than the likelihood of getting exactly four heads and two tails after six flips, even though the fit is equally good.

Does high log-likelihood imply high R^2


Interpret regression output using a likert scale IV (using STATA)

Question: I want to run a regression with an binary DV and a likert scale ( 1=strongly disagree, 2=disagree, 3=agree, 4=strongly agree) IV. I think the right model to use is a probit regression, or what would you guys recommend? Or would it be better to code the likert scale as an dummy variable and then use a logistic regression?
If I use the likert scale IV and a run probit regression I am actually not sure how to interpret the results/coefficients of the regression.
It would be great if you help me or give me some hints. I´m really new to this stuff. Thanks in advance!
Answer: Since you have a binary dependent variable, you can use a binary logistic regression. If you ignore the fact that your independent variable is ordinal in nature, you can capture its effect on the DV using dummy variable coding.  In other words, define the following dummy variables:
D2vs1 = 1 if study subject disagrees, 0 else
D3vs1 = 1 if study subject agrees, 0 else
D4vs1 = 1 if study subject strongly agrees, 0 else
and include them in your binary logistic regression model.  The model will be stated as:
$\log(p/(1-p)) = \beta_0 + \beta_1 * D2vs1 + \beta_2 * D3vs1 + \beta_3 * D4vs1$
where $p$ denotes the conditional probability that DV = 1 given the IV and $\log(p/(1-p))$ represents the conditional log odds
that DV = 1 (rather than DV = 0) given the IV.
After fitting this model to the data, you can test whether the IV has an effect on the log odds that that DV = 1 by testing the composite hypotheses:
$H_0: \beta_1 = \beta_2 = \beta_3 = 0$
$H_a:$ at least one of $\beta_1, \beta_2$ and $\beta_3$ is $\neq 0$
If you reject the null hypothesis, you can follow-up with post-hoc multiple comparisons to determine where the differences in log-odds occur between pairs of levels (or categories) of your DV.
How would you interpret the coefficients in your model? First, notice that the following relationships hold.

The log odds that DV = 1 among subjects in your study population who strongly disagree are given by: $\log(p/(1-p)) = \beta_0$;

The log odds that DV = 1 among subjects in your study population who disagree are given by: $\log(p/(1-p)) = \beta_0 + \beta_1$;

The log odds that DV = 1 among subjects in your study population who agree are given by: $\log(p/(1-p)) = \beta_0 + \beta_2$;

The log odds that DV = 1 among subjects in your study population who strongly agree are given by: $\log(p/(1-p)) = \beta_0 + \beta_3$.

So you can work out that:

$\beta_1$ denotes the difference in the log odds that DV = 1 between subjects in your study population who disagree and those who strongly disagree;

$\beta_2$ denotes the difference in the log odds that DV = 1 between subjects in your study population who agree and those who strongly disagree;

$\beta_3$ denotes the difference in the log odds that DV = 1 between subjects in your study population who strongly agree and those who strongly disagree.

You can exponentiate the coefficients $\beta_1$, $\beta_2$ and $\beta_3$ to move your interpretation from the log odds scale to the odds scale.
Comment: Thanks a lot! This is very helpful. But what would happen if I just run the logistic regression in stata without creating the dummy variables? The output is the same, so why should I create the dummy variables? Thanks in advance!


dkim=temperror (no key for signature) then dkim=pass

Question: I published a DKIM record for my niceoldteacher.com domain that is hosted by fatcow.com and sent an email to one of my gmail accounts to see if DKIM was working.  Although the header summary for the received email indicated that SPF, DKIM, and DMARC all passed, I found the following DKIM information in the detailed header and I was wondering about the significance of the dkim=temperror part and if it should be fixed somehow.  If so, what do I need to do to fix it?  I'm a complete novice at all of this authentication business.
ARC-Authentication-Results: i=1; mx.google.com;
   dkim=temperror (no key for signature) email@example.com header.s=dkim header.b=2naFLU6D;
   dkim=pass firstname.lastname@example.com header.s=1557715744.kindoldteacher header.b=OvYU6UvG;

Answer: Obviously your messages are get signed twice for some reason
The first erroneous header, that has not DNS pubkey record
dkim=temperror (no key for signature) firstname.lastname@example.com header.s=dkim header.b=2naFLU6D;
And the second time
dkim=pass email@example.com header.s=1557715744.kindoldteacher header.b=OvYU6UvG;
That latter DKIM-header is valid and everything is fine.
To fix the issue you should remove somehow the first DKIM header with selector dkim.
You should get rid of the ontopic error after that.


Right hand position for mandolin

Question: On a mandolin should the meaty part of you hand below your palm, gently rest on the bridge or the strings behind the bridge, or should it not touch at all?
Answer: If you rest your hand on the strings or the bridge, you will be damping the instrument's sound.  Even the part of the strings behind the bridge has a small contribution to an instrument's sound. It's best to either hold your hand above the instrument, or rest it very lightly on the body.
Answer: Most of the players I've watched play with a floating pick hand. I pulled up a Chris Thile video and am seeing that maybe he rests his forearm on the edge of the body but otherwise floats his picking hand. If you want to mute the strings like a guitarist would, that's fine, but for most cases, it's probably better if it doesn't touch at all.
Answer: I dont' think resting your hand behind the bridge is too bad - a lot of the overtones produced there aren't desirable anyway, and lots of mandolinists use mutes on that side to mute these overtones.
However, if you have pretty small hands/arms (as I do) you will find it is hard to pick closer to the fretboard without muting in front of the bridge.
It is almost always best to have as much flexibility and potential for motion as possible, and planting any part of your picking mechanism is going to limit this.
I use initial contact on the bride on the base of my palm to establish reference, but then I float as much as possible, as VarLogRant mentions.

Right hand position for mandolin


Generalized Gronwall inequality

Question: Let's suppose to have the following inequality
$$f(t)\leq g(t)+\int_s^t\int_s^{t'}f(r) dr dt'\,.$$
Is there a Gronwall's type inequality to bound $f(t)$?
Comment: I don't know if it helps, but the double integral is equal to $\int_s^t (t-r)f(r)dr$.
Comment: Is $s$ just some fixed value?
Comment: @UmbertoP. Yes it is ($s<t$)
Answer: Use the hint from Martin R plus the generalized Gronwall inequality from Lemma 2.7 in G. Teschl, Ordinary Differential Equations and Dynamical Systems.
Comment: How exactly would the Lemma 2.7 apply in this case? As the the comment of Martin R, the integrant contains a dependency in $t$ (the integral bound) in the term $(t-r)$. Such a dependency does not appear in your Lemma.
Comment: You are right, a comment about this is in order! However, note that you can replace the $t-r$ by the maximum over the interval under consideration, say $[0,T]$ (I am using $s=0$ for simplicity of notation). Then you get $f(t) \le g(t) + \int_0^t g(s)(T-s) \exp(\int_s^t (T-r) dr) ds$ for $t\le T$. Now finally note that you can choose $T=t$ which gives $f(t) \le g(t) + \int_0^t g(s)(t-s) \exp(\int_s^t (t-r) dr) ds$.

Generalized Gronwall inequality


Meaning of signed volume

Question: I want to understand the definition of the determinant of a $n\times n$ real matrix $A$ as the signed volume of the image of the unit cube $C'$ under the linear transformation given by $A$, i.e. $x\to Ax$. However I am failing to make sense of the words signed volume. What will be the precise definition of this? Will it be the $\int\int...\int dx_1dx_2\cdots dx_n$ over the image $C'$. I think this is an overcomplicated way to define the signed volume. Can someone suggest another way?
Thanks
Comment: Just in case you think the signed volume is not intuitive, pictures [here](http://en.wikipedia.org/wiki/Determinant#2.C2.A0.C3.97.C2.A02_matrices) might help.
Comment: @Tunococ: Ah. But can a definition of signed volume be given in terms of n-integrals? I want to define the determinant for real square matrices using signed volumes so I want an independent definition of this term.
Comment: @Shahab I believe that the notion of integral follows from our general understanding of the signed volume. The value of the integral relies on chosen axes. Changing axes involves the Jacobian determinant.
Comment: I miss the days when you used to be able to ask simple questions like this without the (today's) maths stack exchange gate keepers bashing you for it
Comment: Signed volume takes into account orientation, as well as the standard notion of volume.
Comment: @AlexYoucis: How do you define (a)volume, (b)orientation?
Comment: The signed volume interpretation is what motivated the definition of determinant. Since the determinant works at an algebraic level, it allows generalization to fields other than $\mathbb R$. However, the signed volume interpretation becomes inapplicable when the field is not totally ordered (in a way that is consistent with addition).
Comment: @Shahab What are $n$-integrals?
Comment: @Tunococ: By $n$-integrals I mean multiple integral in the Riemann sense for a real valued function whose domain is a subset of $\mathbb{R}^n$. I feel that the function ought to be the constant function $1$ in this case.
Comment: let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/10519/discussion-between-shahab-and-tunococ)
Comment: We're dealing with volumes of parallelipipeds. Trying to define these via integrals seems like a step in the wrong direction, to me.
Comment: [Tunococ's answer](http://math.stackexchange.com/a/194592/1551) to another question may be useful.
Answer: This is something traditional linear algebra doesn't handle really well because it's designed to handle only vectors, scalars, and linear maps (sometimes represented by matrices) that act on vectors.  The reason you're having so much trouble understanding what a "signed volume" could be is simple:  signed volumes don't belong as algebraic elements in the same vector space you're used to dealing with, so it's unclear what kind of objects these are and how to describe them.

One solution to this problem is to use the geometric algebra.  The geometric algebra has as part of it a wedge product of vectors that produces not another vector, but something called a 2-vector, or a bivector.
This would be written
$$C = a \wedge b$$
where $C$ is a 2-vector and $a$, $b$ are vectors.
The space of 2-vectors is in itself a vector space.  2-vectors can be added and subtracted or multiplied by scalars.
Geometric interpretation is critical here.  Think of ordinary vectors ("1-vectors") as weighted directions.  Each vector (except the 0 vector) has an associated unit vector (a "direction") and a unit magnitude (a "weight").  Importantly, two vectors that are scalar multiples of each other could be said to have the same direction but different weights.
Another way to think about it is to say that each unit vector represents a 1d subspace through $\mathbb R^n$.
In the geometric algebra, the vector space of 2-vectors also has unit-2-vectors.  We interpret the unit-2-vectors as planes.  Thus, 2-vectors are weighted planes.  Each 2-vector represents an planar (or two-dimensional) subspace of $\mathbb R^n$.
A 2-vector and a 1-vector can be wedged to form a 3-vector, and this is interpreted as a "weighted" or "oriented volume".  In $\mathbb R^3$, this is a vector space consisting of a single unit 3-vector and all its scalar multiples.  Again, I refer to the idea that each unit $k$-vector represents a subspace.  In this case, the unit 3-vector represents a subspace of $\mathbb R^3$ that is, well, $\mathbb R^3$ itself.
When we're in $\mathbb R^n$ instead, the 3-vector represents 3d subspace, but there are many such subspaces that aren't scalar multiples of each other.  However, the $n$-vector has the same quality of all $n$-vectors being scalar multiples of one another, making it suitable to describe a generalized notion of volume.

Now, perhaps the real question is, what is the difference between a unit 3-vector and its additive inverse?  That is, what does it mean for a subspace to be "oriented"?
To answer this question, I return to the case of 1-vectors, or ordinary vectors.
A vector $v$ and its additive inverse $-v$ could be thought to point in opposite directions.  This is easy to visualize, and shouldn't give you any problems.  Still, I want to point out that there is some notion of orientation already present even in this case.  Instead of merely saying $v$ and $-v$ are scalar multiples of each other, we can say that $v$ represents a 1d subspace one particular way, and $-v$ represents the same subspace but oriented in an opposite way.
(Any given subspace usually only admits two orientations in this manner.)
What about a 2-vector?  Usually, when we talk about planes, we cheat and talk about those planes' normal vectors instead, so in some ways, people are already familiar with the idea of oriented planes.  Still, it helps to imagine this intrinsically, without talking about normals.  I usually imagine a sheet of paper with a counterclockwise spiral on it.  The spiral defines the orientation of the sheet.  Another sheet of paper that describes the same subspace could instead have spirals going clockwise.
(Clockwise and counterclockwise:  again, only two orientations.)
What about a 3-vector, the "oriented volume" as it were?  This is usually done using hands.  You've heard of the right-hand rule, I'm sure.  You can choose a 3-vector built from a set of basis vectors according to the right-hand rule, or you can choose one built from a "left-hand rule."  The two represent the same subspace (all of $\mathbb R^3$), but they are nevertheless additive inverses in this system, and we have already identified such inverses for the last two cases as denoting opposite orientations.
(Right and left-hand rules.  Again, only two orientations for a given subspace.)
In a general $\mathbb R^n$, there are many more such $k$-vectors, but the $n$-vector always has the quality of describing the subspace that is the whole space itself.

So far, I've shown how subspaces can be represented algebraically using the geometric algebra (as well as the exterior algebra).  They can also be  using matrices whose kernels are those subspace, but those matrices do not capture the important idea of orientation.
Under the geometric and exterior algebras, algebraic elements describing subspaces also carry information about those subspaces' orientations.  Each subspace has only two orientations.

Now let's talk about linear algebra and the action of linear operators ("square matrices") on $k$-vectors.
There is a natural extension of a linear operator to act on these oriented subspaces.  This is, in GA parlance, called "outermorphism" (after the wedge also being called an "outer" product).
Define the action of a linear map $\underline T$ on a 2-vector $C = a \wedge b)$ as
$$\underline T(C) = \underline T(a \wedge b) \equiv \underline T(a) \wedge \underline T(b)$$
That's fancy math for "$\underline T$ acts on each individual vector and then the two images are wedged".  This gives a meaningful way to talk about "matrices" acting on 2-vectors.
(It's for this reason that GA users seldom talk about "matrices."  The matrix expression is actually different when we talk about $\underline T$ acting on the space of 2-vectors.  Having to compute new matrices for each kind of $k$-vector that might be acted upon is clumsy, and the algebra usually allows for more compact expressions of reflections, rotations, and other common operations.)
As you might expect, this extends to n-vectors also.  Let $i = a_1 \wedge a_2 \wedge \ldots \wedge a_n$ be an $n$-vector, so that
$$\underline T(i) \equiv \underline T(a_1) \wedge \underline T(a_2) \wedge \ldots \wedge \underline T(a_n)$$
Remember, all n-vectors in $n$ dimensions are multiples of the unit n-vector.  Or, we can just as easily say all n-vectors are multiples of $i$.  So we can write
$$\underline T(i) = \alpha i$$
for some scalar $\alpha$.  $\alpha$ is the determinant.  All the determinant is really saying is that any $n$-vector that is put into this linear operator comes out as a scalar multiple of itself.  It could be reversed in orientation.  It could be scaled up or down by some factor.
The determinant is just an eigenvalue.  The "eigenvector" is not a vector but a n-vector.

In summary, I have described how geometric algebra can represent subspaces in some vector space with generalized vectors called $k$-vectors.  I've shown how such objects are built.  I've shown that these objects have orientation associated with them.  I have also described how linear operators can be made to act on these $k$-vectors as a natural, logical extension of how they act on ordinary vectors.  The determinant of a linear operator is then just an eigenvalue, with "eigenvector" being the (unit) $n$-vector of the space.
Comment: If it is of interest, I can also write a section about oriented volumes and their relevance to volume integrals.  In short, when you do line integrals, you usually have a line element $d\ell$ that is a vector tangent to the curve that you integrate over, but for some accident of history, we don't usually keep track of the $n$-vector that is tangent to a manifold. One should distinguish between those tangent $n$-vectors that *should* appear in the integrand and the whole integral that one would use to try to find the volume of a region in the manifold.
Answer: I won't get into a lot of detail here, but there is a sort of "physical" way to at least gain some intuition on signed volumes.
Consider lifting a mass $m$ up to a height $h$.  Clearly, we have imparted $mh$ units of potential energy.
Now, let us reverse the orientation of the picture, so that instead of moving from $0$ to $h$, we move from $0$ to $-h$.  Clearly, in we have done $-mh$ units of work.  In particular, we have done work "in the negative direction".
These quantities are the same as volumes, but one of them "adds" potential energy and the other takes potential energy away.  The sign keeps track of that property.
Answer: A good intuition is the idea of continuous rigid motion, applicable to real inner product spaces.
First, we want our rigid motions to act on tuples of vectors from the space (the number of which is equal to the dimension). Second, as we fix the basepoint of these vectors at the origin, we want our rigid motions to fix the origin. Third, we want rigid motions to preserve distances. Fourth, we want a rigid motion to trace out a path in the configuration space of all ordered tuples of vectors, so our rigid motions must contain the identity map. Fifth, the rigid motion must trace out a "continuous path." Sixth, since the idea of "rotating an object" is independent of the object's actual position, and we also want our motions to be invertible; so, we want our motions to be group actions.
Thus, we can consider continuous maps $[0,1]\to{\rm O}(V)$ with $0\mapsto{\rm Id}_V$. In addition to volume of the associated parallelotopes (which are the higher-dimensional generalizations of parallelograms and parallelepipeds), an ordered tuple of vectors has more information attached to it: namely, which orbit it is in under the action of the path-connected component of the identity in ${\rm O}(V)$. The group acts transitively and there are two such components so there are two orbits. Then we can define the sign of the unit cube's orbit (associated to a chosen ordered orthonormal basis of $V$) to be $+1$ and make the sign of the other orbit $-1$. Multiply the volume and sign for the signed determinant.
Fortuitously, the signed volume can be seen to be multilinear as a function of $n$ vector arguments by examining the geometric effect of elementary matrix operations and considering degeneracy, so not only do "signed volume" and "orientation" admit an intuitive interpretation through this way, but so do does the determinant map. While the machinery is advanced for someone just learning about real vector spaces, the machinery is all very natural and once it is in place this becomes arguably "the" way to understand the idea of signed volume and orientation in this context.
Answer: In this context, signed volume is simply a term that carries slightly more information than volume alone. It's analogous to speed and velocity.
The magnitude of the determinant of a linear transformation is the number that it scales volumes in the space by. We only need to consider the unit ball however, because if you know it scales the unit ball by that number, by linearity we can simply multiply arbitrary volumes by the same number and it will tell us the volume of the scaled volume for the arbitrary figure.
However, we don't need to take the magnitude of the determinant, we can simply work with the determinant. In fact, taking the magnitude is losing some information; namely the sign. The sign actually tells us something interesting: it tells us whether the linear transformation inverts the space. To understand inversion, we can tell if a linear operator has inverted our space if we can't rotate and scale our way back. Think about the plane and the two operators:
\begin{bmatrix}
2 & 0 \\
0 & 2 \end{bmatrix}
\begin{bmatrix}
-2 & 0 \\
0 & 2 \end{bmatrix}
The first one scales any volume by 4. The second one has determinant -4, but if we take magnitudes we see that it also scales volumes by 4. The difference is that volumes have been inverted under the second operator. We can tell it's inverted because even if we re-scale by $1/2$, we cannot rotate our way back to our original coordinate system (We cannot rotate the coordinate system $(-\hat{x},\hat{y})$ to $(\hat{x},\hat{y}))$.
To put it simply, we have the following complete notion:
For a linear operator
$T : V \to V$, $A \subset V$, $B=T(A) $,
$Vol(B) = Vol(A)*|det(T)|$
If $det(T) < 0$, then $T$ inverts the space. If not, $T$ does not invert the space.
The fact that the determinant gives us this extra data of invertedness is the reason why calling it just volume would be a little unfair, so we call it signed volume.
Answer: A matrix defines a linear transformation that changes not only the volume and the shape of objects in space, but also their orientation. The magnitude of the determinant tells you by how much the volume of the object is scaled up / down. The sign of the determinant tells you whether the orientation of the object is preserved (positive sign) or changed (negative sign). A graphical illustration of these concepts can be found at https://www.statlect.com/matrix-algebra/determinant-of-a-matrix.

Meaning of signed volume


What exactly is a cokernel? What's the motivation behind that, and what's its use? And why is it a quotient module?

Question: Having a homomorphism of $R$-modules $f\colon M \rightarrow N$, we say a cokernel is $N/(\operatorname{im} f)$ which is a $R$-module (quotient).
Because $\operatorname{im} f\subset N$, this would mean that $\operatorname{im} f$ is an ideal.
So why is it an ideal?
Also, why do we even bother defining something like a cokernel? What's its use, what's the motivation behind a cokernel?
Comment: So it's not an "ideal", it's a *submodule*. You can easily check that it satisfies the criterion for being a submodule. This object shows up a lot in commutative algebra, pick up any book like Eisenbud for example and you will see it a lot. When things show up a lot in math, it's useful to give them a name. As for why it's called a "co" kernel, it's because it's the "dual" to kernels in category theory, see: https://en.wikipedia.org/wiki/Cokernel
Comment: One trivial motivation for the notion of kernel is that morphism is injective if its kernel is trivial. Similarly, a morphism is surjective if its cokernel is trivial.
Comment: The cokernel is the dual of the kernel, and has the dual universal property: given any other module $Q$ and a homomorphism $g\colon N\to Q$ such that $g\circ f$ is the zero map, then $g$ factors through the cokernel. Just like a morphism is one-to-one if and only if the kernel is trivial, a morphism is onto if and only if the cokernel is trivial; etc.
Comment: What's a dual? We haven't had category theory yet. With zero map you mean that it for any variable I put in I'll always get zero as the result of that map?
Comment: I'm gonna remember that if we actually start category theory, thanks!
Comment: @user: While "dual" has a formal meaning in category theory, you can think of the way that certain concepts seem to come in pairs that are closely related to one another, after a suitable twist: sines and cosines; injective functions and surjective functions (for example, in the latter: if a composition is injective, the first map is injective; if a composition is surjective, the second map is surjective; injective functions have left inverses, surjective functions have right inverses, etc). Kernels and Cokernels are "connected" in that way. Yes, that's what "the zero map" means.
Comment: Ok, so it's kind of like a symmetry, but I still don't see in which kind of symmetry do cokernels stand/exist with respect to regular kernels? Basically what I see is that cokernels are like the complete opposite of kernels. Kernels are those elements from M for which the output of f is equal to zero. Whereas cokernels are elements from N which are cosets of the image of f? I think I kind of see the analogy
Comment: The kernel $N$ of $f$ is the submodule of $M$ such that if $g\colon P\to M$ is such that $f\circ g$ is the zero map, then $g$ "factors through" the embedding $i\colon N\hookrightarrow M$: there exists a unique morphism $G\colon P\to N$ such that $g = i\circ G$. The cokernel of $f$ has the dual property, as I indicated above: given any morphism $g\colon M\to Q$ such that $g\circ f$ is the zero map, then there exists a unique morphism $G\colon \mathrm{Coker}(f)\to Q$ such that $g=G\circ \pi$, where $\pi\colon M\to \mathrm{Coker}(f)$ is the canonical projection.
Answer: First off, $\operatorname{im}f$ is not an ideal but a submodule as $M$ and $N$ are $R$-modules and not rings. As you might recall the image of a ring homomorphism is not necessarily an ideal of the codomain as there is no reason for the image being closed under multiplication from the codomain.

As hinted in the comments the cokernel is fundamentally related to the notion of a kernel. For a more direct interpretation of this analogy we note the following proposition(s).

Fact. Let $M,N$ be $R$-modules and $f\colon M\to N$ be a $R$-module homomorphism. $f$ is injective iff $\ker f=0$. $f$ is surjective iff $\operatorname{coker}f=0$.

I suppose you know the injectivitiy part and the surjectivity part is not that hard to prove either (I would advise you doing so if you haven't already). The crucial thing is that the quotient $N/\operatorname{im} f$ measures how far away $f$ is from being surjective in the same way the kernel measures how far away $f$ is from being injective. And this measurement can be best carried out in quotient form.
However, this quotient is not necessarily the definition of the cokernel. On a more abstract level many algebraic construction may be characterized by certain universal properties. Among those constructions are the kernel and the cokernel. These are related to annihilation of elements in a certain sense.
So consider $f\colon M\to N$ as before. Now take $\alpha\colon K\to M$ and $\beta\colon N\to L$ not arbitrary but such that $f\circ\alpha=0$ (i.e. the image of $\alpha$ is annihilated under $f$) and such that $\beta\circ f=0$ (i.e. the image of $f$ is annihilated under $\beta$). Here $0$ denotes the trivial map sending everything to $0$.
The kernel is then characterized as pair $(\ker f,\iota\colon\ker f\to M)$ so that for any such $\alpha$ there is unique $\overline\alpha\colon K\to\ker f$ with $\iota\circ\overline\alpha=\alpha$. The cokernel on the other hand is a pair $(\operatorname{coker}f,\pi\colon M\to\operatorname{coker}f)$ so that there is an unique $\overline\beta\colon\operatorname{coker}f\to L$ with $\overline\beta\circ\pi=\beta$.
In both cases, any homomorphism with a certain property factors uniquely through these objects. And both definitions share this common core but are somehow mirrored (the word "dual" appeared in the comments). Interestingly enough: kernel and cokernel are uniquely up to unique isomorphism charaterized by these definitions (called universal properties). So they really capture the essence of these objects.
One can show that these charaterizations correspond to our usual definition of kernel and we can show that the cokernel of $f$ is simply the quotient module $N/\operatorname{im}f$! Indeed, take $\beta$ as above at note that $\beta\circ f=0$ implies that $\operatorname{im}f\subseteq\ker\beta$. By the homomorphism theorem this implies that there is a $\overline\beta\colon N/\operatorname{im}f\to L$ so that $\overline\beta\circ\pi=\beta$, where $\pi$ is the usual projection. Moreover, this $\overline\beta$ is unique (the homomorphism theroem really is just another universal property; namely, the one of the quotient). So our quotient really is the cokernel in this more abstract setting.
On a final note: The defining universal property only tells you what an object should do if it actually exists. The quotient construction only works well as $R$-modules always admit quotients. This thing becomes more complicated when considering the case of groups as the image of group homomorphism is not necessarily a normal subgroup and hence the quotient might not be defined to begin with. Cokernels, however, do exists for groups but are defined explictly constructed slightly different (Hint: Is there a way of extending the image until the resulting subgroup is normal; and what does this imply for the ability of cokernels to detect surjectivity?).


which probability inequality to apply in this situation?

Question: Suppose $X_1, X_2,\dots, X_n$ are iid random variable,$P(X_i=-\infty)>0$,$P(X_i>v)< e^{-v}\forall v>0$, $X$ is distributed as $X_i$, if $c$ is  a finite real number such that $E(X)<c$, then show that there is $A>0, r<1$ such that $P(X_1+\dots+X_n>nc)< Ar^n\forall n$. Can apply Chernoff or Hoefding bound here, to apply do I need to know what distribution $X_i$ is following? I am a bit confused. what is the role of $X$ here? Thanks for helping.
Comment: To apply Hoeffding or Chernoff bounds it can be useful to have additional properties on $X$, for example knowing that $X$ is bounded or subgaussian could help
Comment: well, I forgot to mention that $P(X_i>v)< e^{-v}\forall v>0$ is given.
Comment: Hmm $\mathbb P(X=-\infty)>0$ seems impossible since $X$ has finite expectation
Comment: And the condition on $\mathbb{P}(X>v)v)$ or do you have the same inequality $\mathbb{P}(X<-v)<e^{-v}$?
Comment: yes we can assume that too.
Answer: One way to do it would be to say that $X$ is a sub-exponential random variable (check for example Vershynin's book), and to use Bernstein inequality.
Another way is to use ideas from sub-exponential random variables, for example as below.
Let denote $\mu=\mathbb E[X]$. We have, for $\mathbb{P}(X-\mu > v)=\mathbb{P}(X>v+\mu)\leq e^{-\mu}e^{-v}$ and $\mathbb{P}(X-\mu < v)=\mathbb{P}(X<v+\mu)\leq e^{\mu}e^{v}$.
Consequently, for $v\geq0$, $\mathbb{P}(|X-\mu|>v)\leq (e^{\mu}+e^{-\mu})e^{-v}$.
We note $Y\doteq X-\mu$ and $a\doteq (e^{\mu}+e^{-\mu})$. We have $\mathbb{P}(|Y|>v)\leq a \exp(-v)$.
We are interested in computing, noting $b=c-\mu>0$ and taking $\lambda \in (0,1)$,
\begin{align*}
\mathbb{P}(X_1+\cdots+X_n>nc)&=\mathbb P (\sum_{i=1}^n X_i-\mu>nb)\\
&\leq\dfrac{\mathbb E\exp(\lambda\left(\sum_{i=1}^n X_i-\mu\right))}{\exp(\lambda n b)}\\
&\leq \dfrac{\prod_{i=1}^n\mathbb E \exp(\lambda(X_i-\mu))}{\exp(\lambda n b)}\\
&\leq \dfrac{(\mathbb E \exp(\lambda(X_i-\mu)))^n}{\exp(\lambda n b)}.
\end{align*}
Now compute $\mathbb  E \exp(\lambda Y)$.
First, notice that
\begin{align*}
\mathbb E |Y|^k&=\int_{0}^{\infty} \mathbb{P}(|Y|^k\geq u)\mbox{d}u\\
&=\int_{0}^{\infty} \mathbb{P}(|Y|\geq t)kt^{k-1}\mbox{d}t\\
&\leq \int_{0}^{\infty} a\exp(-t)kt^{k-1}\mbox{d}u \\
&\leq ak \Gamma(k)=a\Gamma(k+1)=a k!.
\end{align*}
Consequently,
\begin{align*}
\mathbb E \exp(\lambda Y)&=\mathbb E \sum_{k\geq 0} \dfrac{\lambda^k X^k}{k!} \\
&\leq \sum_{k\geq 0} \dfrac{\lambda^k \mathbb E |X|^k}{k!}
&\leq a \sum_{k\geq0}\lambda^k = \dfrac{a}{1-\lambda}.
\end{align*}
Finally, taking for instance $\lambda=1/2$,
$$
\mathbb{P}(X_1+\cdots+X_n>nc) \leq (2a e^{-b/2})^n.
$$
A better value for $r$ can be found by optimizing on $\lambda$.
Comment: I used this formula : https://en.wikipedia.org/wiki/Expected_value#Formula_for_non-negative_random_variables . The second line is a  change of variable $u=t^k$ and then I used $\mathbb P (|Y|>v)\leq a e^{-v}$. Finally I recognize the expression of the $\Gamma$ function
Comment: I did not understand the $\mathbb E|Y|^k$ calculation part, could you explain a bit.
Comment: okay last question: If the random variables are transformed $Y_i= \log X_i$, will your answer works still?
Comment: You have $\sum_i \log X_i=\log \prod_i X_i$ and then I guess the current answer does not work


Create a custom view, and add a custom sortable column

Question: I want create a view for display a list of contents. (same type)
(its my first fully custom view x) )
I want display the view like this :
<code>//form : the user select a Date field, its an exposed filter field

COLUMN1           COLUMN2_sortable
-----------------------------------
content_title0    "special_value0"
content_title1    "special_value1"
content_title2    "special_value2"
...
content_titleN    "special_valueN"
</code>
First, can you tell me a good web tutorial for learn to create a fully custom view (so, create the user select form (contain exopsed filter) , the content of the view). After several google search, I difficulty finding a good guide...
Second, the COLUMN2_sortable contain a integer data. And this data is calculed via an another custom module (this value depends on the date entered in the exposed filter field). I have no ideas how add a custom column (here, the COLUMN2_sortable) in my view.
Because this is my first try in fully creating of view, can you advise me about the good way for implement that ?
Answer: You can make a column sortable by clicking on your type of view "fields" and check the "make sortable" checkbox.
Comment: yes, you refer to view ui ?
But the data in COLUMN2_sortable are calculate via a custom module.
So, I think I need create a custom view, not use the view ui (but maybe im wrong ?)


Apache 2.2 Slow serving static files on Windows 2003

Question: I'm having problems with a Windows 2003 Server which is running Apache 2.2.
The performance of the server seems really bad and as a test just trying to load a 10kb file takes a while to load in the browser.
Does anyone have any tips for improving the performance?
my httpd.conf has this set:
KeepAlive On
MaxKeepAliveRequests 500
MaxRequestsPerChild 0
KeepAliveTimeout 4
Timeout 60
HostnameLookups off

And the /extras/httpd-mpm.conf
#
# Server-Pool Management (MPM specific)
#

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
# Note that this is the default PidFile for most MPMs.
#
<IfModule !mpm_netware_module>
    PidFile "logs/httpd.pid"
</IfModule>

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#

<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
LockFile "logs/accept.lock"
</IfModule>
</IfModule>

#
# Only one of the below sections will be relevant on your
# installed httpd.  Use "apachectl -l" to find out the
# active mpm.
#

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          30
    MinSpareServers       30
    MaxSpareServers     30
    MaxClients          1000
    ThreadsPerChild 1024
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          30
    MaxClients          1000
    MinSpareThreads      30
    MaxSpareThreads      30
    ThreadsPerChild      1024
    MaxRequestsPerChild   0
</IfModule>

# BeOS MPM
# StartThreads: how many threads do we initially spawn?
# MaxClients:   max number of threads we can have (1 thread == 1 client)
# MaxRequestsPerThread: maximum number of requests each thread will process
<IfModule mpm_beos_module>
    StartThreads            10
    MaxClients              50
    MaxRequestsPerThread 10000
</IfModule>

# NetWare MPM
# ThreadStackSize: Stack size allocated for each worker thread
# StartThreads: Number of worker threads launched at server startup
# MinSpareThreads: Minimum number of idle threads, to handle request spikes
# MaxSpareThreads: Maximum number of idle threads
# MaxThreads: Maximum number of worker threads alive at the same time
# MaxRequestsPerChild: Maximum  number of requests a thread serves. It is
#                      recommended that the default value of 0 be set for this
#                      directive on NetWare.  This will allow the thread to
#                      continue to service requests indefinitely.
<IfModule mpm_netware_module>
    ThreadStackSize      65536
    StartThreads           250
    MinSpareThreads         25
    MaxSpareThreads        250
    MaxThreads            1000
    MaxRequestsPerChild      0
    MaxMemFree             100
</IfModule>

# OS/2 MPM
# StartServers: Number of server processes to maintain
# MinSpareThreads: Minimum number of idle threads per process,
#                  to handle request spikes
# MaxSpareThreads: Maximum number of idle threads per process
# MaxRequestsPerChild: Maximum number of connections per server process
<IfModule mpm_mpmt_os2_module>
    StartServers           2
    MinSpareThreads        5
    MaxSpareThreads       10
    MaxRequestsPerChild    0
</IfModule>

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves
<IfModule mpm_winnt_module>
    ThreadsPerChild      1000
    MaxRequestsPerChild    0
</IfModule>

Answer: Please look for this directives in httpd.conf and uncomment them:
EnableMMAP off
EnableSendfile off

Also set this in httpd-mpm.conf
<IfModule mpm_winnt_module>
    ThreadsPerChild         32
    MaxRequestsPerChild  10000
    Win32DisableAcceptEx
</IfModule>


Dynamically loading chef recipies from URLs

Question: I'm deploying a web app on AWS.
I intend to use chef to build AMIs which I'll then put into production.
I want to have Chef monitor a URL stored in simpleDB. The URL would point to a tarball in S3. There would be different URLs, one for a config tarball, one for a code tarball. When I update the URL in simpleDB, I want chef to spot this and pull in and apply the configs/deploy the code.
Is this possible? Has anything like this been done before or would I need to roll my own code?
I think Chef can monitor URLs, but how would be the best way of getting it to load that URL from simpleDB?
Answer: No problem.  The database is not strictly necessary for this (as I propose you store those settings as node attributes... that way you can change the node settings any time you want to and chef will ensure compliance), however, I'll assume you are using the db for other things and leave it in the basic architecture.  Here's my proposed flow:

Store [:deploy][:configurl] and [:deploy][:codeurl] as attributes on the node
Have chef execute two separate SQL queries to retrieve each URL from your database
Compare the url results from the database to the node attributes
The rest of the items are wrapped in not_if the results match
remote_file the urls if the local tarball does not exist
untar
do all the things necessary to utilize the tar'd files


Performing date/time subtraction in SQL Server

Question: I have four columns in a table:
date entered, time entered, date completed, time completed

I would like to know the difference between date/time ENTERED and date/time COMPLETED
For example
date entered = 1/1/2001
time entered = 10:00
time completed = 1/2/2001
time completed = 11:00

The difference is 25 hours.
How can I perform this computation with a select statement?
I tried this:
DATEDIFF(hh,dateadd(hh,[Time Entered],[Date Entered]),dateadd(hh,[Time Completed],[Date Completed]) ) AS [Hours]

and got the following error:

Msg 8116, Level 16, State 1, Line 2
Argument data type time is invalid for argument 2 of dateadd function.
Comment: This topic is covered here, too. http://stackoverflow.com/questions/700619/how-to-combine-date-from-one-field-with-time-from-another-field-ms-sql-server
Answer: Declare @dateentered date = '20010101'
Declare @timeentered time = '10:00'
Declare @datecompleted date = '20010102'
Declare @timecompleted time = '11:00'

select datediff(hh, @dateentered + cast(@timeentered as datetime),
                    @datecompleted + cast(@timecompleted as datetime))

So, in terms of your tables' columns:
select datediff(hh, [date entered] + cast([time entered] as datetime),
                    [date completed] + cast([time completed] as datetime)) as [Hours]

Comment: +1 This is the correct answer, although I would have casted the "date" field to a datetime instead of the "time".
Comment: You have to be REALLY careful here.  It looks like things are working fine but that's only because of the low resolution times that you're using.  You can get rounding even into the next year if you're not careful.  Please see the following article for more on the subject including two correct methods for combining DATE and TIME columns.

https://www.sqlservercentral.com/articles/combine-date-and-time-to-datetime2-in-sql-server
Answer: select datediff(hour,'1/1/2001 10:00','1/2/2001 11:00')

Answer: Use the DateDiff sql function.
Comment: thank you! i just updated my question can you take a look please
Answer: Try
select DateDiff(ss, [Date Entered] + convert(datetime, [Time Entered]),
                    [Date Completed] + convert(datetime, [Time Completed]))
from myTable

to get the result in seconds.
Here's a standalone example:
declare @dateentered date = '1/1/2001'
declare @timeentered time = '10:00'
declare @datecompleted date = '1/2/2001'
declare @timecompleted time = '11:00'

select DateDiff(ss,
    @dateentered + convert(datetime, @timeentered),
    @datecompleted + convert(datetime, @timecompleted))

And of course you can specify different dateparts as specified for DATEDIFF.
Comment: updated my answer to one that works (if your columns are date or datetime)
Comment: Operand data type date is invalid for add operator.
Comment: Fixed since you're using date and time types.
Answer: DECLARE @StartDate DATETIME
Declare @EndDate DATETIME
declare @startime datetime
declare @endime datetime

SET @StartDate = '2001-01-01'
set @startime = '10:00'
SET @EndDate = '2001-01-02'
set @endime = '11:00'

set @StartDate = @StartDate + @startime
set @EndDate = @EndDate + @endime

--To get only Hours
SELECT DATEDIFF(hh, @StartDate,@EndDate ) AS [Hours];


$f : U \to \Bbb R$ be a differentiable function such that $D f (p) = 0$ for all $p \in U$. Then $f$ is a constant function.

Question: Let $U$ be an open connected subset of $\Bbb R^n$ and $f : U \to \Bbb R$
be a differentiable function such that $D f (p) = 0$ for all $p \in U$. Then $f$ is a constant function.
I am facing difficultly in doing this please help.
Comment: might be helpful: http://math.stackexchange.com/questions/561803/dfx-0-for-a-differentiable-function-f-from-a-subset-rn-to-rm-with
Answer: Let $p \in U$, and let $m=f(p)$.
Then $\{ m \}$ is a closed set in $\mathbb{R}$, so the preimage $f^{-1}(\{m\})$ is a closed subset of $U$, by continuity of $f$.
Let $a \in f^{-1}(\{m\})$. Choose $r>0$ such that $B_r(a) \subset U$. Let $y \in B_r(a)$, and define $\gamma: [0,1] \to B_r(a)$ as $t \mapsto a+(y-a)t$. So $\gamma$ parametrizes a line segment from $a$ to $y$. Then $\frac{d}{dt}f(\gamma(t))=Df(\gamma(t))\gamma'(t) = 0$ for all $t \in (0,1)$, so by Mean Value Theorem $f \circ \gamma$ must be constant. In particular $m=f(\gamma(0))=f(\gamma(1))=f(y)$, so $y\in f^{-1}(\{m\})$. Therefore $B_r(a) \subset f^{-1}(\{m\})$, so $f^{-1}(\{m\})$ is an open subset of $U$.
We showed that $f^{-1}(\{m\})$ is both open and closed in $U$, and thus by connectedness $f^{-1}(\{m\})=U$.


Como configurar um projeto Laravel com VueJs

Question: Saudação, estou um simples projeto Laravel e gostaria de configurar meu projeto para ele aceitar o vue.js, mas estou tendo essa mensagem de erro;
"Use of undefined constant titulo - assumed 'titulo' (View: C:\Users\Wladimir\Documents\projetos php\imoveis\resources\views\imoveis\create.blade.php)"

Poderiam por favor dá uma olhada no meu repositório para ver o que está configurado errado.
Meu Repositório
E assim que está a estrutura do meu projeto
acredito que seja coisa simples;

================================================
Eu fiz assim {{ $titulo }}, mesmo assim não pegou
Answer: Tem que ajeitar essa linha: https://github.com/wladyband/imoveis/blob/master/resources/views/imoveis/create.blade.php#L48
Você está colocando apenas titulo ao invés de $titulo, dessa forma o laravel entende como uma constante.
Fonte: https://laravel.com/docs/5.5/blade#displaying-data
Comment: Funcionou assim `@{{ titulo }}`? Se foi assim é porque o laravel e o vue.js usam chaves duplas pra variáveis, colocando o  `@` na frente evita o conflito do Laravel com o Vue.
Comment: fiz uma atualização na postagem, poderia dá uma olhada, mas só adiantando a sua sugestão gerou o mesmo problema
Comment: Ele pegou com o @, porque será que pegou com o @, existe alguma explicação pra isso.


Roaming Administrator Profile

Question: I have a 2012 R2 AD server running 100%. A certain group of users need to be able to run programs that require elevation and install programs as needed. I have tried making the user a member of Administrators but the UAC prompt still pops up for a Administrator authentication and when the user enters their username and password . The idea here is to have User A log on to any computer and be able to run programs as administrator without having to make that user a local admin on every machine.
Answer: The users should be made a local admin in each machine that they need to administer. You should not add users to Domain Admins to accomplish this.
If you don't want to set this manually on each PC, you should use Group Policy Preferences or Restricted Groups to manage group membership.

Roaming Administrator Profile


SSRS Subscription: Error Saving To File Share

Question: I am attempting to run a Timed Subscription in SSRS 2008 and have the results save out to a file share. The subscription runs great when I have it email it's results but fails with this error when I try to save to a file share:
Failure writing file \ServerName\ShareName\Test.csv : Could not find file '\ServerName\ShareName\Test.csv'.
So Far, this is what I have unsuccessfully tried/confirmed

The subscription runs under my NT context and I've confirmed I have rights to create files in the share
I didn't expect it to matter but I created an empty text file name test.csv in the share. This made no difference
There are quite a few references online regarding write failures but non relate to "Could not find file".
I am the owner of the subject and the report
Emailing the report works fine
I tried leaving the file name blank in the subscription so SSRS would create the file name based on the RDL name (idea based on comments in BOL) but this is now a required field.

This is extremely frustrating. Has anyone had problems with this before? This seems like a slam dunk simple thing to do.
Answer: Are you qualifying your server name with a double backslash?
e.g.
\\ServerName
Not
\ServerName
Answer: Do you have the "Use as Windows credentials when connecting to the data source" box checked in Properties/Data Sources for that specific report?
Comment: I did not but tried changing it without success. I've pulled the logs from the database but am having issues getting the text logs off of the server because of permissions issues.


How to get the desirable symmetric matrix?

Question: How to get a matrix $A$ of order ${n\times n}$ such that one of its eigenvalue $=\frac{1}{2}(1+\sqrt{5})$.Note that, $A$ must be symmetric matrix whose its diagonal entries are zer.
Answer: Create a diagonal matrix $D$ with a required value (as many times as you need).
Take an orthogonal matrix $U$ of the same size . You get what you ask using
$$A=UDU^T$$


User-defined functions vs. Built-in / Pre-defined functions

Question: Which is more preferable? between the two? like for example in sorting arrays, would it be more practical to use pre-defined sorting function than creating your own sorting function?
What are the advantages and disadvantages between using a Pre-defined Function and User-defined function?
Comment: is it just ok to use the pre defined function without having any, or little idea on how its done?
Comment: If you have to code fast and `error proof` the answer could be Yes, but most of the time the answer would be No. See my answer bellow.
Comment: I know, I just used 3 times the word `answer` in the same sentence. This could probably be factorized. An optimization would somehow be required here. May be a built-in function can do it, but would it give me a nicest or even an understandable result ?
Answer: Typically, pre-defined functions are better, if they exist. They usually are optimized to operate in the least amount of time, no matter what the input (they optimize based on input type and size). Really, the only reason you should user-define something is if the functionality of the pre-defined code does not meet some certain requirement that you have. For example, there may be a search function that has been pre-defined and returns a boolean, but you need to know the index of the found item.
Long story short: it's often best to use pre-defined if it's defined.
Answer: Only use user defined functions if the pre defined function doesn't meet your need for a "very good" reason. Never good to reinvent the wheel
Comment: is it just ok to use the pre defined function without having any, or little idea on how its done?
Answer: A diligent programmer always tries to know how built-in functions are implemented. For the reason that he's got to choose among multiple solutions every time and has to make the best choice to fit his needs. Moreover, to know if coding his own feature is pertinent or not compared to existing ones.
Most of the time built-in functions are optimized for the best, but sometimes you will need more accurate or faster implementation, and will have to do your own version.
Example : If you need to compute the intersection between two std::set of integers (C++ STL), you will get very poor performance on large sets. If computing fast is your priority better write your own representation of a set. Here is a sample case where I had to do such a thing.
Note : As mentioned by TGH, it is Never good to reinvent the wheel. So before implementing your own feature, you should also try to find out if a qualitative third party library as not already been written (taking care of the license requirements, of course). Such that you can use it directly, or get some inspiration from it.
Answer: A built in function is a predefined function or statement or operator that supplied along with compiler used i c program.
while user defined function is a self contained building blocks of statement which are written by the user to compute the value or to program a task, they can be called by the main function as per requirement of the called function.


HyperLink in DataGrid: InvalidOperationException

Question: I'm trying to add RichTextBoxes into the cells of a DataGrid. The RichTextBox contains a Hyperlink, but when I click it, it throws the following exception:

'Invalid Operation Exception - Reference is not a valid visual
  DependencyObject'

Why is this happening?
Comment: Please post some more information, like the code you are using for the datagrid column that contains the hyperlink.

I assume this is in C# winforms?
Or is it in asp.net? of perhaps silverlight?
Comment: It may be because of CLICK event itself. I am not sure but I guess this has something to do with BUBBLING effect if it is ROUTEDEVENT
Comment: Is your richtextbox working correctly when it is not in datagrid cell?
Provide code sample please.
Answer: I would say don't use Hyperlink and use HyperlinkButton instead. Something like this:
<code>    var hyperLink = new InlineUIContainer
    {
        Child = new HyperlinkButton
        {
            NavigateUri = myUri,
            TargetName = "_blank",
            Content = myText
        }
    };
</code>


Why does my UIButton delegate have to execute entirely before changes are shown in view?

Question: I'm doing some MonoTouch development, and I really can't figure out an problem I've run into
I'm having an ViewController containing a UIButton. I have added a delegate to the TouchDown event of this button. In this delegate I'm calling a WebService and trying to change the colour and title of the button. However nothing happens to the button before the entire delegate have been executed. The thing is that the webservice is rather slow, so I want to give the users a waiting message by changing the colour and title of the button.
The code:
<code>    public override void ViewDidLoad ()
    {

        View.BackgroundColor = UIColor.Black;

        bookButton = new UIButton( new RectangleF(10,100,this.View.Frame.Width-10 ,40) );

        bookButton.BackgroundColor = UIColor.Clear;
        setButton();

        bookButton.TouchDown += delegate {

            gymClass.book();
            setButton();
            tableView.ReloadData();
            NavigationController.PopViewControllerAnimated( true );

        };

        this.View.AddSubview( bookButton );

    }
</code>
Anyone, please?
Comment: Are you calling a web service on tableView.ReloadData()?
Answer: The delegate is executed on the main thread which is responsible for rendering, so you are blocking the renderer until you return.
Comment: Aha. OK, I resolved this by using the TouchUpInside event instead. Thanx


ES6 Import inside of Android Webview - not a constructor error

Question: I am rendering an html webpage inside of a WebView which uses three.js to render a 3D model. Thus far all of that is working fine. I am now attempting to add touch/drag controls to move the camera around. I found some example code to make this work and I've implemented it. Here are the relevant portions code:
import * as tc from './TrackballControls.js';
//....
controls = new tc.TrackballControls( camera , renderer.domElement);
controls.rotateSpeed = 1.0;
controls.zoomSpeed = 1.2;
controls.panSpeed = 0.8;

On PC in Crome and Firefox everything works perfectly, my model renders and dragging does change the camera view. In Chrome and Firefox on my Android device loading the page via local network everything also works fine.
However in the WebView within my application I am getting this error:
Uncaught TypeError: tc.TrackballControls is not a constructor

It seems that creating the TrackballControls object is failing. Why does it fail in this way inside of the WebView and not in Chrome on the same phone?
This is my html app directory structure:

I have edited three.module.js and TrackballControls.js to account for them being in the same directory like this:
// in index.html js:
import * as THREE from './three.module.js';
import * as tc from './TrackballControls.js';

// in TrackballControls.js:
import {
  EventDispatcher,
  MOUSE,
  Quaternion,
  Vector2,
  Vector3
} from "./three.module.js";

Is there anything I can alter in the html/javascript or Android java code to make it work correctly inside the WebView?
I have tried on 2 different devices, their webview userAgent strings are:
"Mozilla/5.0 (Linux; Android 6.0.1; S60 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.93 Mobile Safari/537.36", source: https://appassets.androidplatform.net/assets/www/cpb_3d_model_wgt/index.html (27)

and
"Mozilla/5.0 (Linux; Android 8.1.0; LM-V405 Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.93 Mobile Safari/537.36", source: https://appassets.androidplatform.net/assets/www/cpb_3d_model_wgt/index.html (27)

EDIT a bit more info:
I was trying to serve my page out of the Assets directory using this:
final WebViewAssetLoader assetLoader = new WebViewAssetLoader.Builder()
            .addPathHandler("/assets/", new WebViewAssetLoader.AssetsPathHandler(this))
            .addPathHandler("/res/", new WebViewAssetLoader.ResourcesPathHandler(this))
            .build();

    wv.setWebViewClient(new WebViewClient() {
        @Override
        public WebResourceResponse shouldInterceptRequest(WebView view,
                                                          WebResourceRequest request) {
           if (!request.isForMainFrame() && request.getUrl().getPath().endsWith(".js")) {
                Log.d(TAG, " js file request need to set mime/type " + request.getUrl().getPath());
               try {
                   return new WebResourceResponse("application/javascript", null, new BufferedInputStream(view.getContext().getAssets().open("www/cpb_3d_model_wgt/three.module.js")));
               } catch (IOException e) {
                   e.printStackTrace();
               }
            }
            return assetLoader.shouldInterceptRequest(request.getUrl());
        }

        @RequiresApi(api = Build.VERSION_CODES.M)
        @Override
        public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
            super.onReceivedError(view, request, error);
            //Log.d(TAG, "error: " + error.getDescription());
            Log.d(TAG, "error: " + request.getUrl());
        }
    });

    wv.loadUrl("https://appassets.androidplatform.net/assets/www/cpb_3d_model_wgt/index.html");

With my page served this way I get the not a constructor error. I've used chrome remote device inspector to look at the network request for the TrackballControl.js file and I see this:

and when the same page is served from my PC using python web server everything works fine (no errors and all functionality works) these are the response headers:

As far as I can tell something about the response or headers is causing some issue with importing which is making the code fail because the imported constructor function isn't getting to exist properly.
Once I noticed this difference in the response headers I ditched the WebViewAssetLoader and starting serving my page with NanoHTTPD and when it's served that way everything works as expected.
Another EDIT: Looking back at my Asset Loader / intercept request code now I can see that I have hard coded the "wrong" js file to get returned for every request that ends with .js which is very likely the reason for the "not a constructor error" My mistake, and I should have included that code when I originally posted the question but I overlooked it.
Comment: Also note that unless you modified the source you need to keep the structure of three.js repo to use `import`. That means `three.module.js` needs to be in `somefolder/build` and `TrackballControls.js` needs to be in `somefolder/examples/jsm/controls/TrackballControls.js` because inside it references `three.module.js` at `../../../build/three.module.js` (https://github.com/mrdoob/three.js/blob/0abe06ef133b8ad38ba2e6c619a116d30de5c588/examples/jsm/controls/TrackballControls.js#L14)
Comment: What version of the Android WebView? (navigator.userAgent)
Comment: I did modify the files to us js files in the root of a dir in my assets. I will post the dir structure and version from user agent tomorrow
Comment: @gman I've added the userAgent strings and some more details about my directory structure and js file modifications.
Comment: Did you check the permissions of the application that shows the WebView?
Comment: What is the configuration settings for the webview?  in android , the webview is hardly configured, with respect to the other browsing apps, and you need to configure it manually.
For example you also need to enable javascript for the webview (maybe it's obvious, but you didn't mention anything about it).
Comment: @Juan I do have javascript on the webview enabled.
Answer: TrackballControls.js wasn't written as a module that you can import. Instead, it assumes the THREE variable is globally available, and it appends it to THREE. To fix this, you might need to copy-and paste its source code into your own file (let's call it TC.js) and make some alterations at the beginning and at the end:
TC.js:
// 1. Import THREE instead of assuming it's globally available
import * as THREE from './three.module.js';

// 2a. Remove "THREE." and make it a stand-alone variable
var TrackballControls = function ( object, domElement ) {

    // ... All 600+ lines of internal content stays the same

};

// 2a. Remove "THREE." at the bottom of the file as well
TrackballControls.prototype = Object.create( THREE.EventDispatcher.prototype );
TrackballControls.prototype.constructor = TrackballControls;

// 3. Export the object to be used in other files
export default TrackballControls;

Now you should be able to use your own TC.js file in your project:
main.js:
import * as THREE from './three.module.js';
import TrackballControls from 'TC.js';

const controls = new TrackballControls(camera , renderer.domElement);

I made an example below to demonstrate how copy-pasting TrackballControls can still work by making it a stand-alone variable The top 600+ lines are literally copy-pasted, with the modifications I mentioned above. The rest of the scene setup is at the end of the JS:

// In your code, you'd import THREE here, instead of via
Comment: I ended up finding a way to work around the issue by serving my existing pages using NanoHTTPD web server and then loading them into the WebView from there. However I do think refactoriong the code this way could help work around the issue from the Javascript side and I appreciate you taking the time to make the sample code and explain the changes. I am awarding you the bounty. Thank you.
Answer: TrackballControls.js is not an ES6 module, and does not export the TrackballControls constructor function. TrackballControls is attached to THREE.
ts is likely just an empty object, and ts.TrackballControls is undefined.
Define controls like the following instead.
controls = new THREE.TrackballControls( camera , renderer.domElement);

My answer is based on this TrackballControls.js on Github.


Let $R=\mathbb{Z}$, $U=17\mathbb{Z}$, two rings. Suppose $U \subseteq V \subseteq R$, and $V$ is a ring. Prove that $V=U$ or $V=R$

Question: If $R$ is the ring of integers, let $U$ be the ideal consisting of all multiples of $17.$ Prove that if $V$ is an ideal of $R$ and $U\subset V\subset R$ then either $V = R$ or $V = U.$
I tried, solving this problem as follows:
First of all, it's given $R$ is the ring of integers. We assume the operations defined on $R$ are the usual addition and multiplication of integers.
If $V=U$ then we are done. If $V\neq U$ then, $\exists $ an $a\in V$ such that $17$ does not divide $a$ i.e $(a,17)=1.$
I tried  to solve  this by using the contrapositive , by contradiction but hit a wall evrytime. My heart says to use $\pmod 17$, well ordering axiom, division algoring and so on ....
Staring at this problem for a while now any hints would be greatly appreciated.
Remark:
I am taking a weird class of abstract were we start out with rings have not even hear about ideals here is for myself.
Definition of a Two-Sided Ideal:
A subring $A$ of a ring $R$ is called a (two-sided) ideal of R if $\forall r \in R$ and $\forall a \in A$ both ra and ar are in $A.$
Ideal Test:

$\hspace{2mm}$ $a-b \in A$ whenever $a,b\in A$ whenever $a,b \in A$

$\hspace{2mm}$ $ra$ and $ar$ are in A whenever $a\in A $ and $r \in R$
Comment: 17 is prime. 'nuff said.
Comment: $U$ is actually an ideal of $R$. Look at $V/U\subset R/U$.
Comment: not sure 'nuff is said. I agree that  prime is a big part of  this problem
Comment: $R$ is a *cyclic ring-any subring $V$ of $R$ necessarily has a cyclic subgroup of $R = \Bbb Z$ as its additive group. Any such subgroup is of the form $n\Bbb Z$ for some non-negative integer $n$. For any two such subgroups $m\Bbb Z \subset n\Bbb Z \iff n|m$.
Answer: Since $V$ is a subring of $\mathbb Z$ it is also an ideal of $\mathbb Z$ (why?), so $V=n\mathbb Z$ for some integer $n$. From $17\mathbb Z\subseteq V$ you get $n\mid 17$. Now you can finish the proof.
Comment: $$ n|17 = \exits k \in \mathbb{Z}: \frac{17}{n}=k  \Rightarrow 17=k*n $$ so n must be 17. $17\mathbb{Z}=V$
Comment: dont understan how i get the other case. showing n is not a multiple of 17. want to say n=1 since v is a ring it has to be closed under addition , ... ultimately $V=Z$
Answer: $17\mathbb{Z}$ is prime ideal in $\mathbb{Z}$ and since $\mathbb{Z}$ is principle ideal domain, which kind of ideal is $17\mathbb{Z}$?
Comment: maximal?  just googled "prime ideal " and "pid ."My teacher only talk about ufd , pid ... for like 10 minutes since semester started. from wiki   " I is a maximal ideal of a ring R if there are no other ideals contained between I and R."
Comment: So there is no ideal beween $\mathbb{Z}$ and $17 \mathbb{Z}$.
Comment: Yes. And that fact is enough for answer to your question.


Como funciona o gerenciamento de dependências/bibliotecas do React?

Question: Olá, galera
Como funciona o gerenciamento de dependências/bibliotecas do React? Tem alguma página na documentação que fala sobre? Importar uma biblioteca que possui, em sua maioria, coisas que não vou usar (ou seja, que eu uso poucas coisas da biblioteca) deixa meu projeto mais pesado?
--
Explicando de forma mais detalhada e com exemplo:
Vamos supor que esteja usando Material-UI no meu projeto. Essa biblioteca possui muitos elementos UI do Material Design. Mas eu só vou usar, por exemplo, os buttons e os cards.
O fato de eu estar usando apenas duas coisas de uma biblioteca que possui várias outros elementos é ruim pro desempenho do meu projeto? O React é inteligente o suficiente pra carregar pro meu projeto apenas o que vou usar? Ou seja, o React carrega, nessa situação, apenas os elementos que vou usar, ou ele carrega a lib toda?

DÚVIDA 2, MAS SEGUINDO O PENSAMENTO DO QUESTIONAMENTO ANTERIOR
No exemplo da importação de icons do Material-UI existe diferença pro React na importação das seguintes formas:
<code>import AccessAlarmIcon from '@material-ui/icons/AccessAlarm';
import { AccessAlarm } from '@material-ui/icons';
</code>

Não sei se fui redundante ou claro o suficiente. Qualquer dúvida adicional, estou a disposição.
Answer: Com relação à primeira dúvida. Sim, o React é "inteligente o suficiente" para carregar apenas os elementos que estão sendo importados.
Quanto à segunda dúvida. O primeiro exemplo vai importar o que estiver sendo exportado como "default" no arquivo "AccessAlarm.js" e será utilizada com o alias "AccessAlarmIcon". O segundo import irá procurá um export específico definido como "AccessAlarm" no caminho especificado.
Answer: Obrigado pelo esclarecimento, Cássio.
Achei essa matéria The Correct Way to Import Lodash Libraries - A Benchmark na qual o autor faz um benchmark de importação com o Lodash. Também responde a minha dúvida. Vale a pena dar uma olhada.


Android - RotateAnimation onClick button restart itself

Question: this is the java code to rotate an image when click on button. Image rotate it's perfect but if I click button again when rotation is not ended the animation restart itself, not end the animation. How can I wait the end of the animation? I found Animation.AnimationListener, I think that onAnimationEnd works great for me, but I'm not be able to integrate it in my code... please help me :-)
package com.example.helloword;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.Button;
import android.widget.ImageView;

public class Rotation_test extends Activity {

    private float statdegree = (float) 0.0;
    private float enddegree = (float) 90.0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rotation_test);

        // ---------------------------------------------------------------------------------------------
        Button buttonRotateCenter = (Button) findViewById(R.id.rotatecenter);
        final ImageView floatingImage = (ImageView) findViewById(R.id.floatingimage);

        // AnimationRotation
        final Animation animationRotateCenter = new RotateAnimation(statdegree,
                enddegree, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        animationRotateCenter.setDuration(5000L);
        animationRotateCenter
                .setInterpolator(new AccelerateDecelerateInterpolator());
        // \AnimationRotation

        buttonRotateCenter.setOnClickListener(new Button.OnClickListener() {

            public void onClick(View arg0) {
                floatingImage.startAnimation(animationRotateCenter);
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_rotation_test, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

}

Answer: You have to take a boolean variable which tracks whether animation is in progress or not. then use this variable in animation listener and button click as below code
buttonRotateCenter.setOnClickListener(new Button.OnClickListener() {

            public void onClick(View arg0) {
if(!anim_in_progress)
                floatingImage.startAnimation(animationRotateCenter);
            }
        });
    animationRotateCenter.setAnimationListener(new anim_listener());

}
boolean anim_in_progress=false;

class anim_listener implements AnimationListener
     {

        @Override
        public void onAnimationEnd(Animation arg0) {
        anim_in_progress=false;

        }

        @Override
        public void onAnimationRepeat(Animation arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onAnimationStart(Animation arg0) {
            // TODO Auto-generated method stub
            anim_in_progress=true;

        }

     }

Answer: Never tried this, but might work
    buttonRotateCenter.setOnClickListener(new Button.OnClickListener() {

        public void onClick(View arg0) {
            if(!floatingImage.hasTransientState())
               floatingImage.startAnimation(animationRotateCenter);
        }
    });


Como remover acentos?

Question: <?php
$string = $_POST["nome1"];
function removeAcentos($string, $slug = false){
    $string = strtolower($string);
    $ascii['a'] = range(224, 230);
    $ascii['e'] = range(232, 235);
    $ascii['i'] = range(236, 239);
    $ascii['o'] = array_merge(range(242, 246), array (240, 248));
    $ascii['u'] = range(249, 252);
    $ascii['b'] = array(223);
    $ascii['c'] = array(231);
    $ascii['d'] = array(208);
    $ascii['n'] = array(241);
    $ascii['y'] = array(253, 255);
    foreach ($ascii as $key=>$item) {
        $acentos = '';
        foreach ($item as $codigo) $acentos .= chr($codigo);
        $troca[$key] = '/['.$acentos.']/i';
    }
    $string = preg_replace(array_values($troca), array_keys($troca), $string);
    return $string;
}
?>

        <form action="" method="post">
            Nome:
            <input type="text" name="nome1">

            <input type="hidden" name="nome2" value='$string'>

            <input type="submit" value="OK">
        </form>
        Nome:
        <?php echo $_POST["nome1"]; ?>

        Nome trocado:
        <?php echo removeAcentos($_POST['nome1']; ?>

Comment: tente desta forma https://pt.stackoverflow.com/a/33035/8939 com esta função, você poderá remover acentuação de todo
Answer: Se o que deseja é substituir os caracteres especiais por seus correspondentes normais, eu uso essa função:
function limpaString($str) {
    $str = preg_replace('/[áàãâä]/ui', 'a', $str);
    $str = preg_replace('/[éèêë]/ui', 'e', $str);
    $str = preg_replace('/[íìîï]/ui', 'i', $str);
    $str = preg_replace('/[óòõôö]/ui', 'o', $str);
    $str = preg_replace('/[úùûü]/ui', 'u', $str);
    $str = preg_replace('/[ç]/ui', 'c', $str);
    return $str;
}

Como remover acentos?


Cannot Login After Drupal 7 migration

Question: Sorry, unrecognized username or password. Have you forgotten your password?

The error above shows even though I have inputted correct credentials in my site(192.168.5.141/doc_monitor). Below are the steps I have tried to solve my problem.

Reset my password in Drupal users table using md5 hash.
Verify mod_rewrite is enabled. mod_rewrite module is loaded as I can view it in phpinfo()
Verify RewriteBase rule in my .htaccess
RewriteBase /doc_monitor
Repair/Truncate sesssions table.
Set (doc_monitor)drupal files to 777 permission.
Run update.php
Clear browser cache and drupal table cache;
Truncate flood table.

I always restarted my Apache in every changes I made. Anymore suggestions? I dont know what to do anymore.
Answer: First thing to do to see if the login is functioning is use drush uli, which will create a login link for user 1. If that works, after logging in, set your password to test123. Logout, then try to log in with that.
You can also set the password with drush, trying to edit the md5 hash etc is not reliable.
https://drushcommands.com/drush-8x/user/user-password/
This doesn't have anything to do with the files directory.
Another thing to do is check your settings file just to ensure you are talking to the right database. Also check the database to see if the user you are logging in as is not blocked (status).
If you had previously set cookie domain in the settings file, verify that the value is correct.

Cannot Login After Drupal 7 migration


Reference Custom Field on User Profile

Question: I'm very close to getting this working right. I created a custom content type with several decimal fields and an entity reference field where you select a user to assign the content to. I am using a computed field to add up the decimal fields and would like to multiply them by a field that I've added to the User profile.
The problem is that I don't know how to reference the field.
This doesn't seem to work:
<code>field_get_items($entity_type, $entity, 'field_percentage_split')[0]
</code>
I'm using Drupal 7. Any ideas?
Thank you!
Answer: You should expand the code in your question a little.
First you need to get the assigned uid with something like:
<code>$assigned_uid = $node->field_assigned_user[LANGUAGE_NONE][0]['target_id'];
</code>
Then you need to load the user object:
<code>$assigned_user = user_load($assigned_uid);
</code>
Then you have access to the value:
<code>$percentage_split = $user->field_percentage_split[LANGUAGE_NONE][0]['value'];
</code>
To help visualize the $node and $user objects and how to access the information, you can put the print_r() function into a php-enabled block in your footer.
EDIT:
I looked at your code, and you should not try to do everything in a single statement. No wonder you are having problems. Break it out step by step like this:
<code>// Get the assigned User ID from the node object

$assigned_uid = $node->field_assigned_user[LANGUAGE_NONE][0]['uid'];
// Load the user object for the assigned User.
$assigned_user = user_load($assigned_uid);
// Get the Percentage Split from the user object for the Assigned User (default to 0).
$percentage_split = (isset($assigned_user->field_percentage_split[LANGUAGE_NONE][0]['value'])) ? $assigned_user->field_percentage_split[LANGUAGE_NONE][0]['value'] : 0;
// Get the remaining values from the node object, defaulting to 0 if not there.
$other_ins = (isset($node->field_other_ins_[LANGUAGE_NONE][0]['value'])) ? $node->field_other_ins_[LANGUAGE_NONE][0]['value'] : 0;
$vb = (isset($node->field_vb[LANGUAGE_NONE][0]['value'])) ? $node->field_vb[LANGUAGE_NONE][0]['value'] : 0;
$finder_s_fee = (isset($node->field_finder_s_fee[LANGUAGE_NONE][0]['value'])) ? $node->field_finder_s_fee[LANGUAGE_NONE][0]['value'] : 0;
$broker_fee = (isset($node->field_broker_fee[LANGUAGE_NONE][0]['value'])) ? $node->field_broker_fee[LANGUAGE_NONE][0]['value'] : 0;
$dlc_franchise_fee_hst = (isset($node->field_dlc_franchise_fee_hst[LANGUAGE_NONE][0]['value'])) ? $node->field_dlc_franchise_fee_hst[LANGUAGE_NONE][0]['value'] : 0;

// Do the math.

$value = ($other_ins + $vb + $finder_s_fee + $broker_fee - $dlc_franchise_fee_hst ) * $percentage_split;
</code>
You also seem to be trying to use D6 data structures (won't work in D7), and it will also not work to try to give a function array keys.
Comment: Thank you for the quick reply. I'm definitely doing something wrong, here is my complete calculation. I have all the isset( because not all the fields will have values, it may be just one or a combination.

http://pastebin.com/u1C3tJPZ
Comment: Also, I'm using decimals and am getting an error about only being able to flip strings or integers.
Comment: The function field_get_items() returns an array, and is not itself an array. "field_get_items($entity_type, $entity, 'field_broker_fee')[0]['value']" is not a valid representation of the field value. get the value of every field the same way I showed you how to get the uid.
Comment: Thank you for the details. Will this fetch the user I'm referencing in my node? I have an entity reference field that references a user. I'd like to fetch the percentage split field from the user that is being referenced.
Comment: $assigned_uid = $node->field_agent[LANGUAGE_NONE][0]['target_id'];
$assigned_user = user_load($assigned_uid);
$percentage_split = $user->field_percentage_split[LANGUAGE_NONE][0]['value'];
$entity_field[0]['value'] = print_r($percentage_split);

That spits out "1.00" regardless of what field I reference from the user profile.
Comment: $user is not $assigned_user, so of course you will not get what you want. I have no idea why you are using print_r in that manner, but if you don't include the second parameter, it will always give you TRUE ("1").
Comment: Thank you so much for walking me through this.

`code $assigned_uid = $node->field_agent[LANGUAGE_NONE][0][uid'];
$assigned_user = user_load($assigned_uid);
$percentage_split = (isset($assigned_user->field_percentage_split[LANGUAGE_NONE][0]['value'])) ? $assigned_user->field_percentage_split[LANGUAGE_NONE][0]['value'] : 0;

$entity_field[0]['value'] = $percentage_split; `

I get no errors but the field is blank.
Comment: Solution for anyone who is interested: $node had to be loaded first and 'uid' was replaced with 'target_id':

`code $node = menu_get_object();
$assigned_uid = $node->field_agent[LANGUAGE_NONE][0]['target_id'];
$assigned_user = user_load($assigned_uid);
$percentage_split = $assigned_user->field_percentage_split[LANGUAGE_NONE][0]['value'];
$entity_field[0]['value'] = $percentage_split;`
Comment: Glad you worked it out.
Comment: Small issue still: this is looking for the NID on the node_save, which results in an error since the NID doesn't exist yet. When I edit + Save again, everything works. Can I put an if NID doesn't exist, node_save, then run the rest of the code above?

Reference Custom Field on User Profile


Connecting to SQL Server 2008 R2 over Azure VPN

Question: 2 Windows Server 2012 VM's on MS Azure and access is via RDP over Azure Point to Site VPN using a client certificate.
I can connect to the VM's fine but I need to connect to SQL Server 2008 R2 which is running on the VM. Connecting now gives me a "cannot generate SSPI context" which I assume is down to my current windows logon not been part of the domain.
I am not able to change the VPN setup to use Username / Password as it always reverts back to certificate.
How can I connect to my instance of SQL ? Can I somehow add the client cert to the sql login ?
Any help would be great.
Answer: It seems like this isn't possible with the Azure P2S VPN. As a workaround, install the Routing and Remote access to one of the VM's with NAT and the user can login using the credentials supplied to the VPN.
But if someone knows different...
Comment: You can set-up Point-to-Site VPN w/ cert auth: https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-howto-point-to-site-resource-manager-portal but to use certificate-based authentication for SQL you would need to leverage Azure Active Directory and join the SQL instance to a specific tenant: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication-configure
Comment: Thanks Mike. The SQL Instance in on a VM and not Azure SQL, can it still be joined ?
Comment: Yes, SQL Server on an Azure VM is a better solution with VPN than is using Azure SQL Database.


Products of differential forms

Question: Let us consider $\mathbb R^n$. Let $\{x_i\}$ be a basis. Let $\{dx_i\}$ be the corresponding basis in the double dual. Do we assign meaning to the symbol $dx_idx_j$, and what does it mean? What do physicists mean when use such symbols?
Furthermore, let $c:I\to\mathbb R^n$ be a smooth line. Let $ds$ denote the line element along the line. What does the symbol $ds$ mean? If we assume $c=c(x)$ is an analytical parameterization of the line, how do we express $ds$ as a linear combination of the basis $\{dx_i\}$? How can we generalize this to higher dimensional surfaces?
(I am familiar with the exterior product of differential forms, and the differential geometry formalism.)
Comment: $dx_i\,dx_i$ is often a shorthand for $dx_i\wedge dx_j$, though is may also be (even more often) the symmetric product; $ds$ is a 1-form on $I$ and so you can't compare it with $dx_i$'s which are on $\mathbb R^n$; at best you can use $c^*dx_i$
Comment: $dx^idx^j$ can also denote a symmetric expression, as in $g_{ij}dx^idx^j$.
Comment: @user8268 By $c^*$ you mean the pullback of $c$, don't you?
Answer: Physicists either use the notation $dx^idx^j$ to denote $dx^i\otimes dx^j$, or to denote $1/2\,(dx^i\otimes dx^j+dx^j\otimes dx^i)$. They are equal if contracted with a symmetric matrix, as in the metric tensor $g_{ij}dx^idx^j$.
Keep in mind that the exterior product, instead, is anti-symmetric: $dx^i\wedge dx^j= dx^i\otimes dx^j-dx^j\otimes dx^i$.
Let $c:I\to\mathbb{R}^n$ be a parametrization. Then beware that $c(t)$, with $t\in \mathbb{R}$, is an element of $\mathbb{R}^n$. $c(x)$ is not well defined!
$c(t)$ is a "vector", the argument of $c$ is simply a real parameter.
In this case, then:
$$
ds = \frac{dc}{dt}dt
$$
is the line element. That is, a 1-form on $\mathbb{R}$ (not globally on $\mathbb{R}^n$). So, you cannot express $ds$ as a linear combination of the $dx^i$. It is linear in $dt$, though.
If you want it of unitary length, choose an affine parametrization, or (equivalently) divide $ds$ by its norm.
What can be a linear combination in the way you ask is tangent vectors. If $v$ is the tangent vector to the curve, then its components $v^i$ are exactly the coefficients of the linear combination $v^ie_i$, where the $e_i$ are the basis of vectors.
This reflects the fact that vectors "push forward", while differential forms "pull back". A map $M\to N$ can "push" vectors in $M$ to vectors in $N$, which will be linear combinations of the basis vectors of $N$.
For differential forms, instead, it's the opposite. Forms on $N$ can be "pulled back" to forms on $M$, just as we did above: $ds$ is the pull-back of the "length" form via the map $c$.
Just as well, if we have a surface $(u,v)\mapsto c(u,v)$, the surface element is:
$$
dA = \frac{\partial c}{\partial u}du\wedge \frac{\partial c}{\partial v}dv,
$$
which is a 2-form on $\mathbb{R}^2$, whose integral is the oriented area of the surface. And so on for higher-dimensional embedded manifolds.
Comment: The usual approach is to regard $ds$ as a density, not a form. This density makes sense on a manifold of any dimension, not just 1.

Products of differential forms


Select All Field Contents using InputMask jQuery Plugin

Question: I'm using the inputMask jQuery plugin, and I'm wanting to select the entire contents of a field when the field comes into focus.
Here is what I've tried so far:
$('.numbers-only').inputmask("numeric", {
  radixPoint: ".",
  groupSeparator: ",",
  digits: 2,
  autoGroup: true,
  prefix: '',
  rightAlign: false,
  positionCaretOnClick: "select",
  oncleared: function () { self.Value(''); }
});

Someone suggested adding:
positionCaretOnClick: "select",

Which did not work. The field contents do not get selected.
I've also tried this:
$(document).on('click, focus', '.highlight-on-focus', function() {
    $(this).select();
});

Which also did not work as intended.
Instead, the caret position is simply going to the end of the string.
How can I solve this problem?
TIA,
Brandon
Answer: Just a small change for the code that you wrote and it should be like this:
$(".numbers-only").focus(function(){
       $(this).select();
});

Answer: When an instance of InputMask is running on an input, it seems like the plugin handles things on focus... Don't ask me what!
But it seems that if you have a setTimeout() as short as 1ms, the select() works.
Have a look the chained .on() method below. ;)

$(document).ready(function(){
  $('.numbers-only').inputmask("numeric", {
    radixPoint: ".",
    groupSeparator: ",",
    digits: 2,
    autoGroup: true,
    prefix: '',
    rightAlign: false,
    //positionCaretOnClick: "select",
    oncleared: function () { self.Value(''); }
  }).on("focus",function(){
    var that = $(this);
    setTimeout(function(){
      that.select();
    },1)
  });
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/css/inputmask.css" rel="stylesheet"/>

<input class="numbers-only" value="2200.23">
Comment: You're welcome... Next time, please care to indicate exactly which plugin you use... You will have faster answers. ;)


Save XML file at custom location

Question: I'm a very beginner with c#.
I write a little XML converter. In the debug mode saves my xml files under bin/debug.
I use:
XmlWriter xw = XmlWriter.Create("Filename.xml")

When I compile the code and run it, the xml are not saved.
What can I do to ensure that the xml is stored at a particular path?
The save Location path comes from a form as a string
Answer: You just need to combine the path and the xml file name, then use XmlWriter to write xml element:
string pathName = Path.Combine(location, "Filename.xml"); // location is the string from your form.
using (var xw = XmlWriter.Create(pathName))
{
    xw.WriteStartElement("myxml");
}

Comment: thank you! I have now done so: using (XmlWriter xw = XmlWriter.Create(savepath+"/filename.xml", writersettings))
Answer: XmlWriter creates a new XmlWriter instance using the filename and XmlWriterSettings object. (Not saving the file!)
When you have the xml you can save it using System.IO:
File.WriteAllText(saveLocationPath, yourXML);

Save XML file at custom location