Complement of a Cartier Divisor

Question: Let $X$ be a smooth projective scheme and $D$ a Cartier divisor on $X$.
If $U = X \setminus D$ then $\overline{U} = X$?
I just need to know if that's true and if anyone can suggest references where I can find such a result.
Thank you very much.
Comment: Any open and non empty subset of an irreducible scheme is dense.
Comment: @Roland. Thanks.
Answer: You don't need to assume that $X$ is irreducible and you can actually prove that $X\setminus D$ is schematically dense (in particular, take a look at Proposition 9.19), which is more than being dense.
Recall that a Cartier divisor $D$ on a ringed space $X$ admits a representation $\{(U_i,f_i)\}_{i\in I}$, where $X = \bigcup_{i\in I}U_i$ and $f_i\in \Gamma(U_i,\mathcal{O}_X)$ is such that for every point $x\in U_i$ the stalk of $f_i$ at $x$ is not a zero divisor in $\mathcal{O}_{X,x}$.
Now assume that $X$ is a scheme. By passing to some open affine refinement of $\{U_i\}_{i\in I}$, we may assume that $U_i= \mathrm{Spec} A_i$ is affine for every $i\in I$. Clearly $f_i$ is not a zero divisor in $A_i$ for $i\in I$. But this implies that the localization $A_i\rightarrow \left(A_i\right)_{f_i}$ is injective for $i\in I$. Hence the restriction map $\Gamma(U_i,\mathcal{O}_X)\rightarrow \Gamma(U_i\setminus D,\mathcal{O}_X)$ is injective for each $i$. Thus if $j:X\setminus D\hookrightarrow X$ is an open immersion, then the induced map on sheaves $\mathcal{O}_X\rightarrow j_* \mathcal{O}_{X\setminus D}$ is injective. This means precisely that open immersion $j$ is schematically dense.
Now if $j$ is schematically dense, then it is has also dense image. Indeed, pick a nonempty open subset $V$ of $X$. Since $\mathcal{O}_X\rightarrow j_* \mathcal{O}_{X\setminus D}$ is injective, we deduce that the restriction map $\Gamma(V,\mathcal{O}_X)\rightarrow \Gamma(V\cap (X\setminus D),\mathcal{O}_X)$ is injective. Since $V$ is nonempty, we derive that $\Gamma(V,\mathcal{O}_X)\neq 0$ and hence $\Gamma(V\cap (X\setminus D),\mathcal{O}_X)\neq 0$. Thus $V\cap (X\setminus D)\neq \emptyset$ and $X\setminus D$ is dense.
Comment: Hi, Slup. Congratulations. Thank you so much for your answer.
Comment: Hi, @Slup. If two global sections match in this open and dense set, do they match in X? Again, thank you very much.
Comment: @Emanuell if two regular functions $f_1, f_2$ on open subset $W$ of $X$ satisfy ${f_1}_{\mid W\cap U} = {f_2}_{\mid W\cap U}$, where $U$ is a schematically dense open subset of $X$. then $f_1 = f_2$ on $W$. So if I understand your question correctly, then the answer is yes.
Comment: Ok, @Slup. Thank you very much for your attention.
Comment: @Emanuell No problem. I am happy that you find my answer useful.
Comment: Yes, @Slup. I learned a lot from her. I didn't know this concept of schematically dense.  Thank you and success to you.

Complement of a Cartier Divisor


What does "4-universal hash function" mean?

Question: I encountered the notion of 4-universal hash function and I cannot understand what exactly it means.
This article https://en.wikipedia.org/wiki/Universal_hashing did not really help to clarify it.
Thanks!
Comment: what did you not understand ? the concept of universal hash function or the construction of an example of it ?
Answer: Unfortunately, the jargon around this is not consistent. 4-universal hashing is 4-independent hashing.
Note that there is no such thing as a 4-universal hash function - k-independence and k-universality are a function of families of hash functions.
Answer: Actually, there is a pretty standard definition of a k-universal hashing, as stating here.
What is says is that if you pick any K elements in the first set, choosing uniformly a hash function from the reference K-universal family will imply a uniform distribution over all combinations of K elements in the second set.
From an informational-bayesian perspective, this means that observing any k-1 hash results won't give you any information about the k'th value: $P(h(x_k) | h(x_{k-1})...h(x_1)) = P(h(x_k))$.


Calculate the cumulative distribution function F(X=5).

Question: (Old midterms provided by prof to study)
I'm struggling to figure out question 9.
My best guess it that it's all the combined probabilities added together before P(X=6), so: 1 - 0.13 = 0.87. But, as the student who took it got it wrong, I'm not sure. Can someone let me know if I'm right?
If 0.87 is wrong, my other guess is that it would be 0.2 * 5, so 1.
Thanks!
Answer: The notation used by the professor for the cumulative distribution function, $$F(X = 5),$$ is very strange and not standard practice in probability theory or statistics.  It is far more common to write $$F_X(5)$$ which is equivalent to $$\Pr[X \le 5],$$ the probability that $X$ is at most $5$.  The notation $$P(X = 4)$$ is common, in fact, more common than the equivalent $\Pr[X = 4]$ which is my personal preference.
Regarding the answer itself, it is obvious that $$F(X = 5) = F_X(5) = \Pr[X \le 5] = 1 - \Pr[X = 6] = 1 - 0.13 = 0.87.$$  This is because we are given the complete probability mass function for $X$ and the event $X \le 5$ is complementary to $X = 6$.
Comment: Thank you! That totally answers my question brilliantly. Quick follow up though.. if the professor was asking for: 0.2 * 5 (the x*f(x) kind of) at X = 5 as the answer, what would that question look like?


Distribution of cartesian product of two random variables

Question: Suppose there are two random variables, $X$ and $Y$. Each of the random variables subjects to its distribution respectively. Now, I have two approaches of sampling.
Approach 1
Sample $X_1, ..., X_N$ independently and form the set $\{X_j\}^N:=\mathcal{X}$. In the same way we sample and form the set $\{Y_j\}^N:=\mathcal{Y}$. Then, the final samples would be all $NM$ elements in $\mathcal{X} \times \mathcal{Y}$.
Approach 2
Sample $(X_1, Y_1), ..., (X_{NM}, Y_{NM})$ independently.
Is it possible to say something about the distribution of two approaches? Which approach would 'cover' the sample space more reasonably?
Sorry for asking the question in a somehow ambiguous way. How I came up with this question is that I was trying to do some numerical experiments that involves two random variables, and I was trying to figure out which way of sampling would make more sense. Many thanks in advance.
Answer: Edit: Correction to my answer. In the second case the samples are not iid.
We can resolve the ambiguity by stating the problem as:
Suppose that $(X_i,Y_i) \sim P(X,Y)$ where $P(X,Y)$ is the joint probability distribution.
Now consider the following approaches:

Sample $N \times M$ pairs from $P(X,Y)$ independently.
Sample $N$ samples from $P(X)$ independently and $M$ samples from $P(Y)$ independently and get the Cartesian product to get $N \times M$ pairs.

Clearly in the first case we will get $N \times M$ independent and identically distributed (iid) pairs.
How about the second case? In this case the samples are not iid. It actually doesn't depend on $P(X,Y)$; the samples will be dependent.
Proof: We consider the case $P(X,Y)=P(X)P(Y)$. If the pairs are not iid here, then they are not iid for $P(X,Y)$ either; so it is sufficient to show that the pairs are dependent for this case. Next, let $X_1$ and $X_2$ be iid samples from $P(X)$. Let $Y_1$ be a sample from $P(Y)$.  Define the pairs $A:=(X_1,Y_1)$ and $B:=(X_2,Y_1)$. If the pairs are independent then $P(A|B) = P(A)$ holds. $P(A) = P(X_1) P(Y_1)$. On the other hand $P(A|B) = P((X,Y)=(X_1,Y_1) | Y=Y_1)$ which then gives $P(A|B) = P(X_1)$. Clearly $P(A) \neq P(A|B)$ and $A$ and $B$ are not iid. $\blacksquare$


Shell script to identify nodes is available

Question: Linux shell script to identify the node is active or down.
guptime
server1: 17:30:09 up  1:48,  2 users,  load average: 0.20, 0.19, 0.28
server2: 17:30:10 up  1:49,  0 users,  load average: 0.09, 0.11, 0.11
server3: 17:30:13 up  1:49,  0 users,  load average: 0.11, 0.13, 0.12
Server4:
Answer: <code>uptime IPfilename

#!/bin/bash
Command=$(basename $0)
if [ "$1" ]
then
  File=$1
else
  echo -n "File name: "
  read File
fi

for Server in $(cat $File)
do
  echo -n "$Server:"
  Output=$(ssh -o PasswordAuthentication=no -o NumberOfPasswordPrompts=0 -o ConnectTimeout=4 -o StrictHostKeyChecking=no -o GSSAPIKeyExchange=no -q $Server 'uptime' 2>/dev/null)
  echo "$Output"
done
</code>


How to deploy from Github Actions to Digital Ocean Kubernetes?

Question: Github repo: https://github.com/jonesrussell/portfolio-sapper
Here is my Github Action YML:
name: Build and Deploy
on:
  push:
    branches:
      - main

jobs:
  export-docker:
    runs-on: ubuntu-latest
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: jonesrussell/portfolio-app:latest
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}
      - name: DigitalOcean Kubernetes
        uses: firstname.lastname@example.com
        with:
          personalAccessToken: ${{ secrets.DIGITALOCEAN_TOKEN }}
          clusterName: galaxy-k8s

What I can't figure out is how to: kubectl apply -f kubernetes.yml with email@example.com
Cheers
Comment: Did you check this? https://www.digitalocean.com/blog/how-to-deploy-to-digitalocean-kubernetes-with-github-actions/
Answer: What matootie/dokube does is it configures kubectl and adds it to the runner path. After you use it in your workflows you can add any additional steps using the kubectl executable as you would anything else, just as I have added to your original workflow file:
name: Build and Deploy
on:
  push:
    branches:
      - main

jobs:
  export-docker:
    runs-on: ubuntu-latest
    steps:
      ...

      - name: Apply changes
        run: kubectl apply -f kubernetes.yml

Disclaimer: I'm the author of the repository.
Comment: Nice to post formatted code and useful answer. Use the Answer section for code and explanation related to the question. Use comments to elaborate on your credentials and to offer moral support :)


Inverse Laplace Transformation of a heaviside function.

Question: I'm working through an example of an inverse laplace transformation:
$$\mathscr{L}^{-1}[\frac{e^{-3s}}{s+1}] = u_3(t)e^{-(t-3)}$$
I am having trouble seeing how this works. I know that:
$\mathscr{L}^{-1}[Y(s-a)]=e^{at}y(t)$ and that $\mathscr{L}[u_a(t)]=\frac{e^{-as}}{s}$ so $\mathscr{L}[u_a(t-a)]=\frac{e^{-a(s-a)}}{s-a}$.
I can't get the problem to look quite like the shifted $Y(s-a)$ when I let $a=-1$, but I am not sure how else to proceed as I need that term in the denominator:
$$Y(s-1)=\frac{e^{-(-1)(s-(-1))}}{s-(-1)}$$
Answer: The exponential term $e^{-3s}$ merely transforms in the time-domain as a time shift of $3$, while the term $\frac{1}{s+1}$ transforms into a decaying exponential function.
Let's see this as follows.
$$\int_0^{\infty} e^{-(t-3)}u(t-3) e^{-st}dt=e^3 \int_3^{\infty} e^{-(s+1)t}dt=\frac{e^{-3s}}{s+1}$$
So, if the Laplace transform of $e^{-(t-3)}u(t-3)$ is $\frac{e^{-3s}}{s+1}$, then the inverse Laplace transform of $\frac{e^{-3s}}{s+1}$ must be $e^{-(t-3)}u(t-3)$.
Comment: Sure this makes perfect sense, I'm having trouble going the other direction.
Comment: One may either use the integral form of tve inverse transform or learn basic transform pairs along with transform rules.  Here, the rule is that $e^{as}$ transforms into a time shift.


What is the minimum over-rate?

Question: We can see many times, the captains and the players of the bowling team were suspended for slow over-rates.

How the over-rate for a fielding team is calculated?
Is it vary between different forms of cricket?
If the batting team delays the match by changing gloves, bat or other things means will it affect the over-rate?
Answer: This is how overrate is calculated for different formats:
ODI: In ODI, 50 overs should be completed in 210 min as per the rules and out of this 10 min is provided for Drinks breaks. So the total time allotted for an over is 200/50 = 4 min. By considering this, the over rate per hour is 15 overs.
T20: For T20, the total time is 75 min and 20 overs has to be completed in 75 mins(Drinks breaks are included in this).
Test: For every test match 90 overs has to be bowled in 6 hours and team can get an additional half an hour at the end of the day if requested. Again 15 overs should be bowled in an hour and 7 overs in half an hour.

Slow overrate rules:
As per ICC's Standard ODI Playing Conditions:

The minimum over rate to be achieved by a team is 14.28 overs per
  hour. However the actual over rate will be calculated at the end of the match
  by the umpires.

The rule regarding slow overrate is:

A fielding team has to adhere to "Minimum Over Rates." If a team is
  short upto two overs in an ODI it is a "Minor Over Rate Offence". A "Serious
  Over Rate Offence" is if a team is more than two overs short in ODIs. It is the
  same for Twenty20 Internationals while in Tests, upto five overs short
  is a "Minor Over Rate Offence." More than five is "Serious Over Rate
  Offence."

As per ICC's rules, a captain will be fined 20% of his match fee per one over for the offence. Each player of the team is also fined 10% per over. If the captain is guilty of "Serious Over Rate Offence", he will be was banned from one match.
Here the important thing is:

While calculating overrate, Umpires will take into consideration
  the time lost during an innings, due to treatment for an injured
  player, a player leaving the field for serious injury, third umpire
  consultations, time wasting by batting side and all other
  circumstances that are beyond the control of the fielding side.

That essentially answers your last question on batting team delaying things.

What is the minimum over-rate?


Edit cloned file from Git on android (Termux)

Question: I have gist and i use git on android with termux. i have cloned this gist. i have txt file and i want to edit this file and then push, but when i edit this file, it doesn't work and file's context is same.file saved but another location and cloned file didn't changed
this is error ->

i have tried with other editor app but result is same.
what is the problem?
Comment: This has nothing to do with Git or GitHub. It seems to relate to your OS, storage media, and/or editor. If different editors give the same result, it's probably OS and/or storage-media.
Comment: Not raelly, no. Does the system have logs? Why is the editor's attempt to open a file for writing being rejected? What error(s) does the editor receive: is the file in some weird state, or is the entire file system marked read-only, or what?
Comment: Where the cloned git is saved ?
Answer: You are trying to work with git at your device storage (/emulated/storage/...). That's not recommended, because termux doesn't have full access to your device files.
Try the steps below, it may help.
1. clone your gist in termux partition:

Do not clone your repo in ~/storage
Instead, create a directory for that. i.e:

~ $ cd ~
~ $ mkdir git-repo
~ $ cd git-repo/
~/git-repo $ git clone email@example.com:ef5d373b7982e0173437f2aaf17fef42.git
Cloning into 'ef5d373b7982e0173437f2aaf17fef42'...
Enter passphrase for key '/data/data/com.termux/files/home/.ssh/id_ed255':
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 9 (delta 0), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (9/9), done.
~/git-repo $

ps.: Be sure you have configured your ssh key. Check it at documentation.
2. make your changes:
Now, you can update your files using vi or other editor inside termux instance. But I believe you want to update your files using some graphic editor app in your phone, right?
In order to do that, you have to grant access to your termux files from your phone. Check the termux documentation here. (look for "Access Termux from a file manager"). Maybe you'll need to run a command like this:
am start -a android.intent.action.VIEW -d "content://com.android.externalstorage.documents/root/primary"

After running this command you should be able to access your termux files inside any app. For instance, in ACode app IDE (below a screenshot showing an app with access to a folder inside termux):

3. send the updates back to your git:
Ok, now you can finally run the commands "git add", "git commit", "git push", etc... Below I'm showing the result of this test in my termux:
~/git-repo/ef5d373b7982e0173437f2aaf17fef42 $ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   gist-test.txt

no changes added to commit (use "git add" and/or "git commit -a")
~/git-repo/ef5d373b7982e0173437f2aaf17fef42 $ git add .
~/git-repo/ef5d373b7982e0173437f2aaf17fef42 $ git commit -m "test changes to gist from termux"
[main 377fb5c] test changes to gist from termux
 1 file changed, 1 insertion(+), 1 deletion(-)
~/git-repo/ef5d373b7982e0173437f2aaf17fef42 $ git push
Enter passphrase for key '/data/data/com.termux/files/home/.ssh/id_ed25519':
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 296 bytes | 296.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To gist.github.com:ef5d373b7982e0173437f2aaf17fef42.git
   406a6d0..377fb5c  main -> main
~/git-repo/ef5d373b7982e0173437f2aaf17fef42 $ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
~/git-repo/ef5d373b7982e0173437f2aaf17fef42 $

Answer: For me gh authentication worked.
Install gh pkg install gh
Then gh auth login fill the prompt with #ssh# for login.
Then do login.
Then for git clone properly check if the address is put right, sometimes with copy-paste the spelling gets lost, so check. And it should work.


Appropriate temperament for violin

Question: I'm new to violin (and music in general). I am learning through the Suzuki method, but after I get down the fundamentals I hope to learn Irish and American fiddle tunes. I recently discovered an IPad app, called Sing inTuna that I thought would help me develop my intonation. With the app, the IPad displays the pitch of what it receives through its microphone and marks it as out of tune or in tune.
The setting allow for a just or equal temperament scale. Which is more appropriate my instrument and musical interests?
Comment: Neither. Forget about apps like that. If you take what's "correct pitch" from any kind of display it'll greatly obstruct you in getting a proper _feel_ of what pitch is right in a given musical context. And what's correct does depend on context: there's no such thing as a single "just scale". Just intonation always needs a particular key and harmonic relationship to be well-defined. OTOH, equal temperament _is_ always well-defined (it's a sort of one-size-fits-all approximation to just intonation), but apart from being not ideal it doesn't really help you in understanding intervals etc..
Comment: @Tim: "Any particular interval in any key is now the same as that same interval in a different key" that absolutely holds for just intonation as well. Which is my point: there is not one single just-intonation pitch for a given note name, each key requires different fine tunings (hence that app can't possibly work for just intonation). Hardly any musician _knows_ exactly how to do that, but they can _feel_ it while playing. There is no problem here that equal temperament would fix (though it does fix problems which can arise from [comma pumps](http://en.wikipedia.org/wiki/Comma_pump) etc.).
Comment: @leftaroundabout - it may not be ideal (to whom?), but it solves the problems that just intonation make. It's been around long enough to justify its existence and it  works for millions of tunes, in any key.Any particular interval in any key is now the same as that same interval in a different key, unlike in just tuning, so that's an improvement, surely? So, it would help more in defining and understanding intervals than the alternative.
Comment: Possible duplicate of [What frequencies should the violin and viola be tuned to?](http://music.stackexchange.com/questions/11943/what-frequencies-should-the-violin-and-viola-be-tuned-to)
Comment: See this question for discussion on tuning the instrument: http://music.stackexchange.com/questions/11943/what-frequencies-should-the-violin-and-viola-be-tuned-to?rq=1
Answer: If you are planning to play with piano in future, I would definitely use equal temperament. To be honest, to learn to play in tune with the widest range of other musicians, equal temperament would be most useful too. And initially, as a beginner, you are unlikely to notice the difference much, so this would be another reason to choose equal temperament.
EDIT: It is just worth noting a couple of things though. Violinists usually tune their open strings in just fifths (which have an exact 2:3 ratio). Although I have suggested using equal temperament for learning to play in tune with your app, the most important thing is that you try to play exactly in tune, whichever setting you use. As a beginner violinist, the initial difficulties of playing in tune at all far outweigh the slight differences between just and equal temperament.
Comment: @BobRodes a just major third is 386 cents, that's 14 cents below an equal tempered major third. The minor third is even worse at 316 cents, 16 cents above an equal tempered minor third. Even a beginner should be able to hear the differences between these quite clearly.
Comment: To put Bob's comment into perspective, the difference between an equal-tempered fifth and a just fifth is two cents, or 2/100 of a semitone.  When you find that you can consistently make, say, an E on your A string with a two-cent distinction, one way or the other at will, then this might become a practical consideration.  On the other hand, if you are accompanying a piano, you might want to tune to the piano
Comment: @BobRodes: actually, there is a third (plus two octaves) between the viola's C-string and the violin's E. The outer strings of each instrument make up a twelfth. That already _does_ make for a notable difference between Pythagorean tuning (what you get from tuning all neighbouring strings in perfect fifths) and just or 12-edo tuning. — But apart from that: I was under the impression that the OP indeed asked about fingered notes. It is most certainly possible to differentiate between equal temperament and just intonation here, and good players will in fact do that (even if not consciously).
Comment: @BobRodes: it is relevant because whereas a perfect fifth sounds really good in 12-edo, the pitch relation this tuning gives for a major third sounds less than pleasing if played on, say, two string instruments (though vibrato and lush emsemble unisono can mostly obscure this).
Comment: I guess I'm still not seeing the point.  There aren't any thirds on open strings in stringed instruments, are there?  I'm not a string player, but isn't the rest all a matter of where you put your finger on the string?  I wouldn't think that someone would attempt to differentiate between equal temperament and just intonation with one's finger positions.
Comment: Aha.  That's what I was missing.  Thank you for persisting!  :)  As for the fingered notes, I'm quite sure that it's not only possible but common to make that differentiation (I see I am contradicting myself now, so I take back what I said before on this), but I would think that it isn't  the sort of thing that a beginner (I note your "good players") can do.
Comment: Tuning to a=440 gives a viola low C of 130.37 Hz for Pythagorean fifths or 130.81 Hz for equal-tempered fifths. An open C therefore might be so out of tune with a piano so as to pulse with a period of about 2.25 seconds (1/0.44).  It's about the same for the G above that, the lowest string of a violin (195.56 vs. 196.00) and about 3 seconds for the D above that (293.33 vs 293.66).  I don't think that would be "notable" in most contexts.  Period string players tend to tune each string to the keyboard, when there is one, because the fifths are farther out of tune in historical temperaments.
Comment: I would think anyone with a good ear could hear a difference of 14 cents (or two, for that matter), but it's not clear to me why this is relevant to my comment.  Can you explain?
Answer: I recommend equal temperament, in particular with Suszki:

When you learn to play in more and more keys it will be easier because they will sound and "feel" more similar to the keys you are playing in as a beginner. If you use just temperament you will get overly attached to Keys like G, D, and A major because the violin will be more resonant due to sympathetic vibrations.
It will be harder to play in tune with a piano and/or ensemble.

Use the Tuner to Train you Ear to Equal Temperament
Every day, try tune your strings by hear from the an A440 generated by the app. Then see if you got the A to match. If you didn't correct it. Then tune the other strings by ear by listening for relative fifths (Tune E from A, tune D from A, tune G from D). Then use the tuner to see if you were off (using equal temperament).
When in an ensemble (or orchestra) you will generally tune your as a group to A440, which corresponding to violin's second highest string, the A string. From that, by ear, you then proceed to tune your other strings relative to that A (unless you happen to have absolute pitch, which I will choose to mostly ignore for this post).
Understanding the difference
If you use tempered fifths (equal temperament), you end up with the following tuning:
G3=196Hz, D4=293.7Hz, A4=440Hz, E5=659.3Hz
If you use perfect fifths, you will end up with the following tuning:
G3=195.55Hz, D4=293.33Hz, A4=440Hz, E5=660Hz
Your G and D string will be flat and your E string will be sharp in just tuning (from a equal temperament perspective). This will be more noticeable in certain keys (when you are start to learn stuff with more sharps and flats).
What about fiddle music?
Ya will use a lot of double stops, open strings, and harmonics. You will also often play in those keys that the violin likes (G, D, A for example). So just tuning is probably right for this, in particular when playing alone. However, I'm sticking to my guns and recommending equal temperament for the reasons mentioned. When you are ready for a lot of real fiddle playing, you can tune those nice open fifths, but learn Suziki with the equal temperament.
Whatever you do, understand the difference, tune by ear and verify with the tuner (not the other way around), and have fun!
Fingered Tuning
When working on your intonation while playing (not tuning the instrument), I would focus less on the tuning system and instead focus on consistency. This means that regardless of what tuning system your note actually is, make sure that the note stays the same throughout a section or passage. When the same note changes in pitch and isn't consistent, this usually what most makes something sound out of tune. There can be subtitles to this with different keys when not using equal temperament, so when learning using equal temperament will help you with the most important aspect of good intonation - consistency.
Comment: Your answer is quite right, but that's not what the OP is asking for. Tuning the _open strings_ in 12-edo is certainly fine because 12-edo fifths are extremely close to perfect (3:2) fifths. This question is about whether you should tune the _fingered_ notes in 12-edo or just intonation. — @Codeswitcher: western fiddle music is generally played in a hard-to-define "dynamic intonation", where each note is tuned individually as the player sees fit. That's a big part of the expressiveness in these styles. Indeed the pitches will normally be closer to 12-edo or Pythagorean than just intonation.
Comment: Is it actually common practice to tune fiddles to just intonation for trad folk?  I was of the impression that Western traditional fiddle musics are all played in equal temperament.  I mean, pianos, accordions and harmonicas are all in equal temperament unless told otherwise, right?
Comment: @leftaroundabout: Updated my answer with thoughts on that aspect.
Comment: It should be noted that orchestras do not generally tune at 440, if that was the case, anymore. There seems to have been a movement towards 442 these last years
Comment: @FélixGagnon-Grenier everywhere?  I'll try to remember to bring my tuning fork to the next orchestra concert or rehearsal I attend.
Answer: The standard tuning is tuning A to a reference, and tuning perfect fifths from there.  That's what you need for double stops, and it's pretty standard when playing with others to avoid empty strings in slow playing, also because long notes are usually played with vibrato (actually, you can even play an empty string "with vibrato" by doing the vibrato on a related note, like playing G on the D string one octave above the actually played G string).
Tuning perfect fifths from A means that your G string will be four cents too low when compared to equal-tempered tuning.  Four cents on a G3 string is a beating at less than 0.5Hz and pretty harmless, and everything else can be played fingered when playing long notes, short of double stops.  The E string, when tuned as a perfect fifth to A, is two cents too high compared to equal temperament which is a beating of about 0.75Hz.  Still mostly harmless at that pitch.
So in general the additional trouble of going to equal temperament is not worth the trouble, and professional orchestras don't do it either.
Comment: By "empty string" I think you mean "open string" (that is, one that is not stopped).
Answer: Many recommendations regarding intonation replied to this thread are wrong.
You're supposed to play the notes in accordance tho their context. For chords and double stops, you use either just intonation or equal temperament - otherwise they'll sound off. For solo melodies, you use mostly Pythagorean tuning and adjust expressively when needed. When playing in a polyphonic ensemble, you choose the temperament that rings the best with the rest of the ensemble - usually just intonation or equal temperament.
The main difference between Pythagorean tuning and just intonation is that within just intonation the 3rds and 6ths are tuned to perfect, small fractions, while Pythagorean tuning relies on stacked fifths and makes those intervals sour. That's why when soloing double stops you often apply just intonation over staying strictly in Pythagorean.
It's violin, not piano. You're not supposed to play it like piano. You're free, and expected, to adjust your intonation in accordance to the piece and performance context.
Comment: I upvoted your answer because it is correct on how to play the violin at an advanced level, but it is actually two advanced for a beginner I would say.
Comment: Yes, you're probably right that it's missing the beginner vantage point. As a beginner, it's paramount to play with an accompaniment, live or recorded, and learn to play by ear by practicing intonation and developing one's ear while doing it if needed. Visual aids in 12TET will only hold this process back. Also, one can use some reference intervals for just and 12TET intonation practice, but a decent teacher will be the best guide one can get.

Appropriate temperament for violin


How do I dynamically create a local variable in Ruby?

Question: I am trying to dynamically create local variables in Ruby using eval and mutate the local-variables array. I am doing this in IRB.
eval "t = 2"
local_variables # => [:_]
eval "t"
# => NameError: undefined local variable or method `t' for main:Object
local_variables << "t".to_sym # => [:_, :t]
t
# => NameError: undefined local variable or method `t' for main:Object

Comment: Why are you trying to do that? What's the purpose?
Comment: @SergioTulentsev i asked myself exactly the same question. Most probably the original problem can be solved in a much simpler way.
Answer: You have to synchronize the evaluations with the same binding object. Otherwise, a single evaluation has its own scope.
b = binding
eval("t = 2", b)
eval("local_variables", b) #=> [:t, :b, :_]
eval("t", b) # => 2
b.eval('t') # => 2

Comment: I was just curious why it was not getting set.  Your probably right there is a more efficient way to do it.  Getting an answer to this question, helps me understand Ruby somewhat better.
Comment: @ppone: again, what are you trying to accomplish with that?
Comment: He means why you are trying to dynamically set local variables at all. Your problem can probably be solved differently, without setting local variables dynamically and, above all, without using `eval`.
Comment: I still don't see an answer anywhere here as to how, in general, to dynamically create a local variable in the existing context/binding, since `binding` always creates a new context.
Comment: Thanks.   How do I get the binding for main Object.   Everytime you run b = binding; it gives back a different binding object.
Comment: I was look for the outer binding to change.  Not the b binding.  When I type in t, it not part of the binding.  I have to always type in eval(dosomethingwitht,b)
Comment: Please see Stefan answer.
Comment: @PeterAlfvin `binding` does not create a new context. It refers to the current context.
Comment: So why does `eval('var=1',binding)` not create a new local variable `var`?  (I saw you're most recent answer referring to Ruby 2.1 ...)
Comment: @PeterAlfvin It does create `var`. I do not understand the relation to  another answer of mine that you mention.
Comment: @PeterAlfvin I thought you were.
Comment: Anyway, in your answer to this question, `t` remains undefined in the current context (i.e. in the context the `eval` calls are being made).
Comment: @PeterAlfvin That answer is correct, but is irrelevant to my answer. It is using `eval` without passing the binding argument, which is what the OP of this question is doing.
Comment: Just wanted to make sure you hadn't missed my earlier comment about `t` not being defined in the current context in your answer. :-)
Answer: You have to use the correct binding. In IRB for example this would work:
irb(main):001:0> eval "t=2", IRB.conf[:MAIN_CONTEXT].workspace.binding
=> 2
irb(main):002:0> local_variables
=> [:t, :_]
irb(main):003:0> eval "t"
=> 2
irb(main):004:0> t
=> 2

Comment: What about out of IRB? `ruby myfile.rb`?
Comment: @SergioTulentsev I'm not sure, `TOPLEVEL_BINDING` and other binding instances in ObjectSpace don't seem to work.
Answer: You could set instance variables like this:
instance_variable_set(:@a, 2)
@a
#=> 2

Comment: The question is not about instance variables.
Comment: That's true but maybe this could also solve the problem the OP has. As already said in my comment on the original question, i expect a much simpler solution to be feasible for the original problem.
Comment: also as an alternative method don't forget about `define_method`.


Fazer um projeto Netbeans que roda em pasta compartilhada VirtualBox não fazer upload

Question: Tenho uma VirtualBox rodando um servidor web Ubuntu/Apache/PHP.
Configurei a pasta de aplicação no apache como /var/sf_www/
esta é uma pasta compartilhada com a minha máquina host.
Configurei Run Configuration no Netbeans como Remote Web Site, para acessar o ip da minha máquina virtual.
Sempre que rodo a aplicação no Netbeans ele executa o upload dos arquivos alterados para o servidor de aplicação, mas isso não é necessário, pois eu edito os arquivos na minha máquina local, que são compartilhados pela pasta de aplicação do meu servidor web.
Como fazer o Netbeans executar o servidor remoto sem fazer upload dos arquivos?
Answer: Para fazer isto, vá nas configurações de sua maquina virtual e crie uma pasta compartilhada.
Settings dialog > Shared Folders

Neste exemplo nomeie a pasta compartilhada como "Server". Na opções deixe marcado apenas "Tornar permanente".
Agora rode a maquina virtual e instale os programas adicionais do virtualbox no linux
Devices > CD/DVD Devices > VBoxGuestAdditions.iso

Monte o CD com o comando
sudo mount /dev/cdrom /cdrom

execute o comando abaixo para baixar alguns pacotes necessários para a instalação das ferramentas do virtualbox
sudo apt-get install build-essential linux-headers-`uname –r`

Logo em seguida vamos para a instalação das ferramentas
Para 32bit: sudo /cdrom/VBoxLinuxAddition-x86.run
Para 64bit: sudo /cdrom/VBoxLinuxAddition-amd64.run

Reinicie a maquina
sudo reboot

Para que o não tenha trabalho para mudar ou criar virtualhosts no apache, monte sua pasta compartilhada em /var/www
sudo mount -t vboxsf -o rw,uid=33,gid=33 Server /var/www;

Preste atenção para a parte uid=33,gid=33 isso representa o código do usuário e o grupo em que o apache roda. Normalmente www-data. Altere caso o apache esteja configurado para usar outro usuário, pois caso contrário terá problemas com permissão ao rodar seus scripts.
Para que não precise montar sua pasta compartilhada toda vez que iniciar a maquina virtual, adicione um script de inicialização.
cd /etc/init.d/
sudo vi sharedfolder.sh

cole o código abaixo no arquivo e salve apertando ESC > :wq > ENTER
#!/bin/bash
sudo mount -t vboxsf -o rw,uid=33,gid=33 Server /var/www;

Agora você pode permitir que o Netbeans rode seus projetos diretamente de uma pasta local. Assim ele não irá fazer upload do projeto.
Para configurar o XDebug na maquina virtual e possibilitar o Netbeans executar normalmente o debug altere as configurações do XDebug no php.ini da seguinte maneira
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host={IP da maquina virtual}
xdebug.remote_port=9000
xdebug.remote_autostart=0

Pronto, ambiente configurado.
Answer: Você pode mudar o upload para manual nas propriedades do projeto, conforme o link (em inglês)
https://blogs.oracle.com/netbeansphp/entry/remote_synchronization
Comment: Mesmo que este link seja uma boa sugestão, esta resposta não terá validade se um dia o link deixar de funcionar. Por isso, e porque é importante para a comunidade ter conteúdo aqui mesmo, seria melhor você responder com respostas mais completas. Você pode elaborar mais sua resposta? Um resumo do conteúdo do link já ajudaria bastante! Saiba mais sobre o assunto neste item do nosso FAQ da Comunidade: [Respostas que apenas contêm links são boas?](http://meta.pt.stackoverflow.com/questions/705/respostas-que-apenas-contem-links-sao-boas)


doubly linked list implementation c++

Question: I'm testing my doubly linked list and it doesn't display anything.
I'm inserting a student data then trying to display it.
I've only worked on the push function and display just to take it by steps.
I'm new to doubly linked lists.
#include <iostream>
#include <string>
#include "stdlib.h"
#include "time.h"
#include <ctime>
#include <cstdlib>
#include <time.h>
using namespace std;

 class student
{
 public:
int id;            //student ID number
string name;       //student's name
string university; //student' university
double GPA;         //student' GPA
};

//student list is a doubly linked list of students.
class studentList
{
private:
    class node
{
public:
    student data;
    node * next;
    node * prev;
};

node * head;

public:
studentList()
{

    head = NULL;

}

//be sure to free all dynamically allocated memory!
~studentList()
{
    delete head;
}

//return true if the list is empty, false if not
bool empty()
{
    if ( head == NULL)
    {
        return true;
    }
    else
        return false;

}

//insert student s into the front of the linked list
void push(student s)
{
    node *tmp;
    tmp = new node;

    tmp->data = s;
    tmp->next = head;
    head = tmp;
}

//remove and return the student at the front of the list
student pop();

//locate and remove the student with given ID number
void removeStudent(int id);

//locate and return a copy of the student with given ID number
student getStudent(int id);

//locate the student with given ID number in list and set their GPA to gpa
void updateGPA(int id, double gpa);

//arrange students into increasing order based on either ID, name, or GPA.  If
//variable 'field' has value "id", sort into increasing order by id.
//If 'field' has value "name", sort into alphabetical order by name.
//If 'field' has value "GPA", sort into order by GPA.
void sort(string field);

//a test function to simply display the list of students to the screen
//in the order they appear in the list.
void display()
{
    node *current = head;

    while (current!=NULL)
    {
        cout << &current->data << endl;
        current = current->next;
    }
}

};
int main()
{
studentList *my;
student *edwin;
edwin->name = "edwin";
edwin->university = "lsu";
edwin->GPA = 4.0;
edwin->id = 33;
my->push(*edwin);
my->display();

return 0;
}

Comment: How is it _double_-linked? I'd say it's a _single_-linked list.
Comment: What does the constructor of `node` do?
Comment: It would be easier if you showed a complete program, not just bits of it.
Answer: Your problem exists here, cout << &current->data << endl;
what exactly is data? is it some encapsulated structure? I am assuming it is the entire student struct. If that is the case, then you need to get at that struct and then cout it's various members.
i.e.
cout << &current->data->name << endl;
That is if data is of type student* if it is not, then you need to dereference the pointer to your student struct and then cout it's members.
Also what you have here is not a doubly-linked list, but is infact a single linked list. Doubly-Linked lists have a both next and prev pointer to the next and previous nodes in the list.
Answer: You are not initializing edwin properly. The line
student *edwin;

just declares a pointer to a student struct. It does not allocate memory for it. Using edwin->name immediately after that is incorrect.
Just use struct instead of a pointer to it student edwin; edwin.name="...";.
Your push copies the struct anyway.
As noticed by 40two, you are not initializing my either. I'd advise you to try to find the correct way to initialize it yourself.
Another place that is likely wrong:
cout << &current->data << endl;

Can you explain this line? Why don't you do cout << current->data.name?
Also note that you never set prev pointer in node (although you have this field). So it's not a correct double-linked list (it's single-linked, essentially).
Comment: Actually he is not initializing it at all. Nor does initialize `my`.

doubly linked list implementation c++


Criando um foreach com resultado de uma query vinda do Entity

Question: Olá, estou tentando fazer um foreach com um resultado da query,  o campo que preciso percorre é uma string, porem na hora que passo para o foreach ele está sendo transformado em outro valor.
Preciso comparar duas data, no caso a conversão do campo String para DateTime está dando erro, por que como citado acima o campo esta sendo modificado na hora que passa no foreach.
Segue abaixo o código na PageModel:
var tp = _context.TarifasPrecosItens.Where(p => p.TarifasPrecosId == tx.Id).First();

foreach(var hora in tp.De)
{
    DateTime horaInicial = Convert.ToDateTime(hora);
    DateTime horaCliente  = Convert.ToDateTime(totalPermanencia);

    if (horaCliente > horaInicial)
    {
        PagamentoTarifaUsada = tx.Descricao + " Acima de " + hora;
        Tarifa = tp.Valor;
        Total = tp.Valor;
    }
}

Comment: Desculpa... Não entendi o que quer fazer, se o campo "01:00" e você passa ele pelo `foreach`, vai retornar **"0", "1", ":", "0", "0"**, ou seja, vai retornar cada char separado, [Veja aqui](https://dotnetfiddle.net/8pPklU)
Comment: O que é **De**? é uma lista? se sim, do que é? o erro acontece em qual das duas conversões do `foreach`? de onde vem a variável **totalPermanencia**?
Comment: O De é um campo que vem da tabela, no caso ele tem um valor de "01:00" só que depois que passa para o foreach ele é transformado em "48" ai no caso o erro da conversão.
Comment: ` var tp = _context.TarifasPrecosItens.Where(p => p.TarifasPrecosId == tx.Id).First();`
Você não está pegando apenas um registro?
Comment: @mba, redija sua pergunta da forma na qual você quer resolver seu problema. Você já sabe que o `foreach` não é o problema que você quer resolver, mas sim pegar propriedades de `TarifasPrecosItens`. **Quais** itens de `TarifasPrecosItens`? **Quais** propriedades? **O que** você quer fazer com elas? **Para que** elas serão usadas?
Comment: Lucas, no caso tp recebe vários registro da tabela, no caso tp.De e um campo, porem em tem vários valores retornado da consulta.
Comment: Barbertta, verdade vc está certa, preciso tranformar em uma lista antes de passar para o foreach, porem também preciso pegar o valor de um outro campo, na posição onde parar no if. Sabe como posso fazer isso?
Answer: Eu acredito - veja bem, eu creio, porque, pela descrição, não dá pra entender o problema - que o que você quer fazer é o seguinte:
var tp =
    _context
        .TarifasPrecosItens
        .Where(w => Convert.ToDateTime(w.TotalPermanencia) > Convert.ToDateTime(w.De));

foreach (var item in tp)
{
    item.PagamentoTarifaUsada = $"{item.Descricao} acima de {item.De}";
    item.Tarifa = item.Total = item.Valor;
}

_context.SaveChanges();

Comment: Fala @Marcelo Uchimura, como você pegou a conversa andando ai ficou meio estranho mesmo. Mas a duvida inicial era sim do foreach, por que ele estava mudando o valor, mas como você mesmo disse já resolvi, não marquei a resposta da Barbertta como resposta por que foi um comentário. Mas estarei excluindo esse post para que ninguém mais tente resolver está questão. Obrigado pela resposta. Abraços.
Answer:  Não deixei resposta antes porque estava muito corrido.
O problema ocorre porque você está retornando um único item de valor "01:00" e ao passar esse valor pelo foreach irá retornar cada char da string, você pode ver um exemplo aqui.
Para retornar uma lista, remova o First()
var tp = _context.TarifasPrecosItens.Where(p => p.TarifasPrecosId == tx.Id);

Outra coisa que faria é utilizar o TryParse para fazer a conversão, como ele é possivel fazer um tratamento caso ocorra algum erro, você pode usa-lo mais ou menos assim:
foreach (var item in tp)
{
    DateTime horaInicial;
    if (!DateTime.TryParse(item.De, out horaInicial))
    {
        //Tratamento erro
    }

}

A partir do C# 7 é possível simplificar o TryParse da seguinte forma
DateTime.TryParse(item.De, out DateTime horaInicial)


Regex skipping to next match

Question: I am using PHP/Regex to parse some data for an application.  The pages I am parsing have table formats that include a header followed by a bunch of items.  What I am trying to do is get the header for each table, along with all of the items so that I can label each item as part of that group (defined by the header).
I currently have it set up with an expression matching each header, and then everything up to the next header.  I then use a loop on the header count to match the additional data from the second match in the first expression.
So basically:
preg_match_all ('#table-header.*?>(.*?)<\/td>(.*?)table-header#s', $url, $gr, PREG_PATTERN_ORDER);

for($i = 0; $i < count($gr[0]); $i++) {
  preg_match_all ('#type_id.*?(.*?) ... #s', $gr[2][$i], $info, PREG_PATTERN_ORDER);
  $group = trim($gr[1][$i]);

  for($ii = 0; $ii < count($info[0]); $ii++) {
    $name = trim($info[1][$ii]);
    ...
   }
 }

My issue is that it is skipping every other group, what I can only assume is because it matches table-header to table-header, and then skips to the next table-header instead of starting the next match with the ending table-header of the first match.  How can I get it to start the next match with the end point of the previous match?  Unfortunately the pages do not have enough unique items near the beginning/end points to use something different to match.  The code looks similar to this:

    Header

...items...

    Header 2

I tried using the colspan as the start of my expression, and grabbing everything up to the next table-header, but it just breaks.
Thanks for any suggestions.
Comment: Use an HTML parser and all of your problems go away.
Answer: You should have a look to this class instead:
http://simplehtmldom.sourceforge.net/

Regex skipping to next match


Advance Search form $form is not the same when invoked a second time?

Question: I Want the users to have an expanded advance search form if no results are returned from a search. The advance search form on the search page always defaults to collapsed.

I found that I can check whether I have results in two different ways: theme or module, depending on the hook I want to use, I chose module because it fires earlier than the theme's.
I also can effect the advanced search form's attributes (whether it's collapsed, or maybe display other data inside of the advanced search form, etc) with drupal's hook_FORMID_form_alter() with MYTHEME_form_search_form_alter's first call. The issue I have is MYTHEME_form_search_form_alter() gets called before results are returned.
So I can alter the advance search form first, then I can check if we returned any results from the search... which doesn't help me, because I need it to be vice versa - If I know I have no results then I know to expand the advanced search form's collapsible form.
My quick solution was to invoke drupal_get_form() with drupal_get_form("search_form", "no_results"); inside of my module's preprocess search hook MYMODULE_search_preprocess_search_results(&$variables) and just pass in the variable "no_results". This (as most of you probably know) will invoke hook_form_search_form_alter again, where I can edit the advance search form now and I will alter the advance search form only if my variable "no_results" comes through.
Here is my crux though! Even though I am invoking that theme hook again and checking for the variable, when I go to edit the $form's "advanced" entry... its gone now. So it's clearly there when theme's hook is called, and I can indeed effect the arrays, but if I try to effect the advanced array when I invoke the theme's hook (inside of my module's hook) it's not there. Where would I invoke this theme's hook if not on the module layer? Hell, the theme's preprocess hook is fired AFTER the module's and has proven to be the same circumstance, seems in either of the two ways of checking my results I cannot invoke the form_alter hook and get the exact same form back.
This is before I check results when THEME's alter hook is first being called:
This is after I check results in my module's hook and invoke the THEME's alter hook once more:
You can see my new variable denoting that we have no result (in this case it's LarryU) under the action key, but there is no advanced key. I tried just remaking it but it doesn't to the form.
Answer: As I understood from your question you need to add additional style when no results found.
The file search-block-form.tpl.php in search module folder is responsible about displaying the form you could copy it to your theme folder and alter the markup as you need (You have to clear cache in order to flush theme registry).
Also take a look at the two files search-result.tpl.php and search-results.tpl.php the same could be done depending on your needs and use case.
For more clarification about theme suggestions read
Comment: I have solved with jQuery, but If the advanced search form has a key called '#collapsed' and when I set it to 0 it will automatically add the class for me. To me, this seems cleaner to adjust it on the backend instead of on the front, but I think perhaps your solution is still better than my jQuery one. Mine is dirty I feel, I grab all h1 tags, see if any of them have a no result string, if they do then I use jquery to click on the advance search link to expand the form. But .tpl sounds like it may be cleaner, ill just add the class to the form in the .tpl file. Ill let you know if it works.
Comment: So My issue with `search-result.tpl.php` and `search-results.tpl.php` is that they are not triggered if users just search without any text in the input field. With jQuery technique I can check if 1/2 strings are within a h1 tag - `var error_result = ['Error message', 'Your search yielded no results'];` and then I check if the array of h1 tags has either of these entries, if they do then expand the advanced search form. I really wish I could change the `'#collapsed'` to 0 if I get no results, but damn it `drupal_get_form` returns an augmented form by the time I get to see if I got a result :-(.


Set Focus inside the text box of a tool strip

Question: I put a toolstrip on the form, added some controls to it such as buttons, labels and a text box...now I want the text input focus be inside abd blinking in the text box of that toolstrip,
I tried with these two commands in a form_load evet but didn't work:
toolStripTextBox1.Focus();
// or
toolStripTextBox1.Select();

Comment: Not sure why you got all these downvotes.  I upvoted you, because I've hit the exact same issue, and this post solved my problem.  Thanks.
Comment: I'm not sure if it will work or not, but try focusing the tool strip itself, and then focus the tool strip textbox.
Answer: Try the following
Me.ActiveControl = toolStripTextBox1.Control

Comment: His control is not TextBox2.Control that will generate an Error..it's TextBox1
Comment: Can you please provide solution in C#? Thanks.
Answer: Have you tried doing the following
Me.ActiveControl = toolStripTextBox1.Control

Answer: Add the event handler for your form's Shown event and you can try with this code:
static bool first = true;
private void Form1_Shown(object sender, EventArgs e)
{
       if (first)
       {
            toolStripTextBox1.Focus();
            first = false;
       }
}

Comment: awesome. It fixed my other focus question that I had asked and you had answered too .
Comment: @BDotA Glad I could help. I'm sure you know that other answers also work for this particular question.


Webpack postcss loader, what's its purpose?

Question: I am trying to find out, what the postcss-loader is good for.
On the github page
https://github.com/postcss/postcss-loader
it says:
Loader for webpack to process CSS with PostCSS
I dont't get that: So, PostCSS is a a WP-Loader to process CSS with PostCSS?
IMHO, that's a circular definition.
So what is PostCSS, is it a CSSLoader? Or, since it's called Post CSS is it a loader to run after some other CSS-loader?
Answer: Actually, it isn't a direct plugin for PostCSS, it works inside Webpack. if you use Webpack in your project for module bundling, then for using PostCSS as CSS Preprocessor you must use postcss-loader and add configs of it.
For example, you can see THIS REPO, in webpack folder, there is two configuration file for development and production environment, open one of them, no different, and search the postcss-loader  word in it, see a complete example of this usage.
Comment: the repo can't be reached via "Access denied"
Comment: @AmirhosseinEbrahimi, this repo is public, but your IP in under USA sanctions, so use a VPN to pass the sanction.
Answer: PostCSS: use JavaScript plugin to transform CSS.
PostCSS Loader: process CSS with PostCSS inside Webpack
Example 1
/* Before */
.example {
  display: flex;
}

/* After */
.example {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

Example 2:
/* Before */
:root {
  --green: #00ff00;
}

.example {
  color: var(--green);
}

/* After */
h1 {
  color: #00ff00;
}

Answer:
So, PostCSS is a a WP-Loader to process CSS with PostCSS?

No.
PostCSS-loader is a WP-Loader so you can process CSS with PostCSS inside Webpack.
i.e. It loads PostCSS into Webpack.

IMHO, that's a circular definition

It isn't because PostCSS and PostCSS-loader are different things.

So what is PostCSS, is it a CSSLoader?

No. PostCSS is:

a tool for transforming styles with JS plugins. These plugins can lint your CSS, support variables and mixins, transpile future CSS syntax, inline images, and more.


how to add tags to article pages

Question: I'm new to Drupal. I accidentally deleted the Tag feature on our article page. Could someone explain how I can add it back to that page.
It also populated on a specific page.
Comment: Do you use Drupal 7?
Answer: in Drupal 7

Go to admin/structure/types/manage/article/fields and add a new field named "Tags" with the type "Term reference" and the widget "  Autocomplete term widget (tagging)"
in the setting field page, configure it to reference the vocabulary named "Tags" (if the vocabulary doesn't exist, just add it in admin/structure/taxonomy/add)

how to add tags to article pages


Transaction Log modelling suggestions

Question: I have a data set from a popular online retail site. The customer looks at three different products say product 1, product 2 and product 3 repeatedly over a period of time.  The customer checks for prices over the same period  and decides to buy product 1 and product 2 and product 3 is not brought. Although the  price is the most important factor it's not the only factor that influences his decision.  Assuming that I have the log information on the customer, like how many times the customer did a search for the product or similar type of product and I can group them all together. Can you guys give me a suggestion on how to model this kind of data?
If a new search is done I want to predict the likelihood of it turning into a purchase. And I am assuming that the likelihood increases as the number of searches increase until a certain point and then it decreases and eventually the interest in the product wanes off.
Thanks for all your help. Let me know I have to elaborate more.
here is a sample dataset
[Sample data][1]
<code># Creating the dataset
Product<- c('Guess','LG-TV','Sony-TV','Guess','LG-TV','Sony-TV','Termostat','of men and mice','of men and mice','of men and mice','of men and mice','iphone6','samsung','moto','iphone6','iphone6')
ID<-c(1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3)
Price <- c(25,850,600,26,850,620,40,12,12,12,12, 234,268,400,230,260,)
Date<- as.Date(c('2016-01-1','2016-01-1','2016-01-1','2016-01-02','2016-01-02','2016-01-02','2016-03-14','2016-03-15','2016-03-16','2016-03-17','2016-03-17','2016-01-07','2016-01-07','2016-03-09','2016-03-09','2016-03-10'))
timespent<-c(45,46,32,25,160,20,20,20,11,15,24,8,45,120,26,40)
count<-c(1,1,1,2,2,2,1,1,2,3,4,1,1,1,2,3)
eventually_purchased<-c(0,1,0,0,1,0,0,1,1,1,1,1,0,0,1,1)
status<-c("Interest","Interest","Interest","InfomationSearch","InfomationSearch","InfomationSearch","Interest","Interest","InfomationSearch","Evaluation","Buy","Interest","Interest","Interest","InfomationSearch","Buy")
Log.data <- data.frame(ID, Product, Date,Price,count,timespent,status,eventually_purchased)
# Finding the difference between the search dates
Log.data<-ddply(Log.data,.(ID,Product),transform,Days=Date-min(Date))
</code>
Things I have tried so far.
I tried to link the count data to customer buying lifecycle i.e I grouped the data into 4 states "Interest", "Information search","Evaluation" and "buy" so that I have 4 progressive states and I can do something like a survival analysis using Mstate package in R. I couldn't get it to work as many of the items are searched for and bought on the same day.
I hope I have elaborated enough. Thanks for all your help.
Comment: you've got any code to show what you've tried?
Comment: I tried the BTYD package in R. But that gives me the rate at which the customers buy and doesn't tell me the likelihood of a transaction turning successful. I am sorry I don't have any code yet as this is a generalization of the problem I have.
Answer: I'd try a randomForest model. ?randomforest
You can use it as a classification model by passing your last column as a factor. Note that dates could be converted to factors as well, or to numerics.
<code>RF <- train(as.factor(last_col) ~., data=training,method="rf",trControl=trainControl(method="cv",number=5),prox=TRUE,allowParallel=TRUE)
</code>

Transaction Log modelling suggestions


Solve ODE using Fourier series.

Question:
I have that
$$f(x)=\frac{4}{3}+\frac{2}{\pi^2}\sum_{n\in\mathbb{Z}}\frac{(-1)^n(1+i\pi
 n)}{n^2}e^{i\pi n x}, \quad n\neq0\tag1$$
and I want to find a 2-periodic function $y(x)$ that solves the
  following diff-equation
$$2y''-y'-y=f(x).\tag{2}$$

Since $(1)$ is a linear ODE I know that it's solution is of the form $y(x)=y_h+y_p.$ Finding $y_h$ is trivial and done by solving the characteristic equation. I found it to be $y_h=C_1e^x+C_2e^{-x/2}.$
For $y_p$, I need to use $f(x)$ somehow, I could not find any good example in the book on how to do this. I only found one video on youtube but it does not really seem to be that similar to my problem.
I want to follow the answer in this thread but I can't seem to grasp the mechanics of what he means. Can someone show me how to go about this?
Comment: Write the solution in its series form and plug it into the ODE to obtain a system of algebraic equations in terms of the Fourier coefficients. You already have $f$ in series form so this should be fairly straightforward
Comment: @Dylan - How do I write the solution in series form if I don't know the solution yet?
Comment: You write it as an unknown series, and derive the coefficients from the resulting equations. See my answer.
Answer: A $2$-periodic function has the form
$$ y(x) = c_0 + \sum_{n=\pm 1}^{\pm\infty} c_n e^{in\pi x} $$
where $c_n$ are unknown coefficients. Plug this expression into the ODE (differentiating term-wise)
$$ 2y'' - y' - y = - c_0 - \sum_{n=\pm1}^{\pm\infty} (n^2\pi^2 + in\pi + 1)c_n e^{in\pi x} $$
Comparing coefficients gives
\begin{align}
-c_0 &= \frac43 \\
-(n^2\pi^2+in\pi+1)c_n &= \frac{2}{\pi^2}(-1)^n \frac{1+in\pi}{n^2}
\end{align}
The homogeneous solution is not periodic so it isn't needed.
Comment: The first series does include a constant term. What is $e^{inx}$ when $n=0$?
Comment: This is great, thank you! I have a question, what is meant by "2-periodic"? and how does one see that the substitution for $y(x)$ is 2-periodic?
Comment: $2$-periodic means it has a period of $2$, i.e. $y(x+2)=y(x)$. How did you obtain the Fourier series of $f(x)$ in your earlier question? How did you know it has terms in $e^{in\pi x}$? How did you get through that question without knowing what it means?
Comment: Okay, maybe my question was a bit misleading. I know what periodicity refers to, however in my book it says that one can express a function $f$ on the form $$f(x)=\sum_{-\infty}^{\infty}c_n e^{i n x},$$ so I'm wondering why you substituted $$y(x)=c_0+\sum_{-\infty}^{\infty}c_ne^{in\pi x}.$$ Why do you latch on the $c_0$ when they excluded it in my book?
Comment: Ok I got it now! Thanks.

Solve ODE using Fourier series.


How to re-enable drive based sharing? (\\hostname\e$)

Question: I have a drive on a remote machine that I want to share at the root (E:) so that I can just connect via the run prompt using <code>\\<hostname>\e$\</code>, however, when I share the drive with "Everyone" and try Read and Read/Write access and try to connect from my workstation I get the "Enter network credential" prompt. Previously the drive was shared and this wasn't an issue but a while back I turned off sharing while troubleshooting an issue and now need to re-enable it.
How do you properly share a drive without requiring the network credential prompt for everyone? A quick google returned "add guest account to share" which didn't work and the other alternative is to disable password protection on the client which isn't desirable. The server is 2008 R2 Standard.
Comment: If you're giving 'Everyone' permission to E$, make sure 'Everyone' also has permission to the actual E: folder.   Alternately you could mount the drive locally with credentials to a user with access on the server?  `net use Z: \\HOSTNAME\E$ /user:DOMAIN\USERNAME PASSWORD`
Comment: I don't want to have to go to my bosses machine and map the drive, it's worked before without having to do that junk by just going into the run prompt and type "\\server\e$\.
Comment: Just as an FYI: you shouldn't be doing this anyway.  The drive root share is known as the administrative share... and is not something you want everyone to be able to access without a credential prompt.
Answer: If you are the administrator of the remote machine or your username and password is the same as the administrator of the local machine, you will connect to the e$ share without prompts.


Alterar a cor do texto ao clicar em um botão

Question:

<meta charset="utf-8"/>

<title></title>

 texto qual quer

<input id="botao" type="button"  value="Mudar de cor "/>

Pessoal estou fazendo uma pagina html basico e preciso fazer que ao clicar em um botão o texto fique vermelho e justificado.
alguém pode ajudar ?
Comment: Cara coloque o que vc já tem de código ai. É para ser só com HTML e CSS ou pode usar script?
Comment: Coloquei, sim pode usar script
Answer: Uma opção só com html e css é usando o seletor ~ com ele quando o checkbox estiver checked vc troca a cor to texto e muda o alinhamento.
Aqui vc pode ler mais sobre esse combinador de seletor adjacente ~ https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_combinator
OBS: Se vc quiser esconder o checkbox coloque no ID dele display:none, ai vc clica direto só no texto da label

#muda:checked ~ .box {
    color: red;
    text-align: justify;
}
.box {
    width: 300px;
    border: 1px solid #000;
}
<input type="checkbox" name="" id="muda">
muda cor e justifica

     Lorem ipsum dolor sit amet consectetur, adipisicing elit. Minima odio qui, dolore, doloremque deleniti labore iure sit nulla totam adipisci optio quo! Dolor, deserunt! Delectus assumenda eos dicta quasi dignissimos.

Comment: Obrigado hugo, ajudou bastante!
Comment: @DiogoSerravalle Sem problemas meu caro, eu fico feliz em ter ajudado
Answer: Boa noite Diogo, tem várias maneiras de fazer isso:
A mais simples imagino que seria criando uma função em javaScript que altere a cor do texto desse modo e chama-la no html:
...

 texto qual quer

<input id="botao" type="button" value="Mudar de cor " onclick="mudarCor()"/>

É possível fazer isso sem alterar o html de sua página, apenas adicionando um listener (escutador) para o botao, em javascript. Desse modo:

 texto qual quer

<input id="botao" type="button" value="Mudar de cor"/>

Comment: Obrigado Rafael ajudou bastante, se eu precisar criar um outro botão mas nesse outro  a formatação seja: identado 20px apenas na primeira linha , tamanho 130% e negrito como ficar no script ?
Answer: Uma maneira de utilizar um botão e trocar o texto da div é utilizar o pseudo-elemento :target e colocar um elemento a dentro do botão e manipular a div pelo seu id:

a{
    text-decoration: none;
    color: #000;
}
.box{
    width: 300px;
    border: 1px solid #000;
}
.box:target {
    color: red;
    text-align: justify;
}
<button>Mudar Cor</button>

     Lorem ipsum dolor sit amet consectetur, adipisicing elit. Minima odio qui, dolore, doloremque deleniti labore iure sit nulla totam adipisci optio quo! Dolor, deserunt! Delectus assumenda eos dicta quasi dignissimos.

Esta maneira só funciona ao clicar uma vez, se desejar que ao clicar novamente o texto fique com estilo inicial, o mais recomendado é como o Hugo fez utilizando checkbox
Answer: Pode usar o método .classList.add('nome da classe') que irá adicionar a classe .alterar ao elemento selecionado quando o botão for clicado. Pode colocar o código dentro de um atributo onclick:
onclick="document.querySelector('h1').classList.add('alterar')"
         ↑__________________________↑ ↑______________________↑
                      |                           |
            seleciona o elemento         adiciona a classe

Vale notar que o document.querySelector('h1') irá selecionar apenas o primeiro elemento h1 que encontrar. Portanto, se você tiver mais de um
 na página, será necessário identificá-lo com um id específico para aquele elemento, inserindo um atributo id:

 texto qual quer

    ↑↑↑↑↑↑↑

E colocar a id do elemento do document.querySelector para que o click no botão seja direcionado somente àquele elemento:
<input id="botao" onclick="document.querySelector('#h1').classList.add('alterar')" type="button" value="Mudar de cor" />
                                                   ↑↑↑

Exemplo:

.alterar{
   color: red;
   text-align: justify;
}

 texto qual quer

<input id="botao" onclick="document.querySelector('#h1').classList.add('alterar')" type="button" value="Mudar de cor" />
Answer: Deve colocar um id no h1:

 texto

Adicionar um onclick no botão
<input id="botao" type="button"  onclick="trocarCor()"value="Mudar de cor "/>

E no javascript:
var titulo = document.getElementById('texto')

function trocarCor() {

     titulo.style.color = 'red'

     titulo.style.textAlign = 'justify'

}

Comment: Obrigado lvr7, ajudou bastante!
Comment: lvr7 se for para deixar em negrito seria assim : texto.style.fontWeight = 'bold';  ??
Comment: Exato, pode usar as mesmas propriedades do css.


SOQL issue when querying ActivityHistory as a subquery..

Question: I'm querying ActivityHistory, and it seems that you can only query it as the object of a SUBQUERY against some other object.  That's fine - I changed my query to query against the Account object, with ActivityHistory in a subquery.  Seemed to work fine.  But in testing, I found a case where the ActivityHistory subquery returned MORE than 200 results.  I started getting this error:

    FATAL_ERROR|System.QueryException: entity type ActivityHistory does not support query
... in the debug logs.  It seems to be only an issue where an Account has more than 199 related entries in the ActivityHistory object.  To see if this was the cause, I tried putting a LIMIT 199 and a LIMIT 200 clause in the subquery.  Sure enough, when I use 199 (or anything lower) it works fine.  Using 200 (or anything higher) results in the error above.

My code is below.  One thing to note is that the query is in a FOR loop.  One theory I have as to why it's producing the error for high values of the LIMIT clause is that perhaps 200 is the point where the FOR loop is batching the query into separate chunks - maybe the second chunk doesn't qualify as a 'subquery' (since it's running separately?) - and SalesForce isn't liking that.

Oh, and one more thing:  The same code seems to run fine in the Anonymous Apex editor (though I had to make a few modifications - replacing the inline variables with explicit values).  Weird that the anon editor is perfectly happy with it, but the SFDC servers don't like it.

Anyway, I'm off to do some more troubleshooting.  Anyone have any insights?

Thanks!

Code:

    //  ActivityHistory's on Account
    for (Account a : [  //  you can't query ActivityHistory directly; only in a subquery against another object type
        SELECT
             Id
            ,Name
            ,( SELECT
                    ActivityDate
                   ,ActivityType
                   ,CRM_Meeting_Type__c
                   ,Description
                   ,CreatedBy.Name
                   ,Status
                   ,WhatId
                FROM ActivityHistories
                WHERE ActivityType IN :included_activity_history_types
                //LIMIT 200
            )
        FROM Account WHERE Id = :accountId
    ]) {
     for (ActivityHistory ah : a.ActivityHistories) {
        if ( ah.WhatId==null ) { continue; }  //  skip adding activities without a WhatId

        if (((string)ah.WhatId).startsWith('001')) { //  only add ActivityHistory's tied directly to an Account (the query above pulls back all ActivityHistory's on related Oppty's as well)
            activities.add(new ActivityWrapper(ah));
        }
     }
    }
Answer: Great question; I'm not entirely sure why it would be working in Execute Anonymous, but not in your Apex class.
However, I do have some recommendations. I've found that it's helpful to split out SOQL queries from the for loop, then use the getSObjects method to get the subquery data that was returned. Using this method, I have successfully retrieved more than 200 ActivityHistory records in an Apex class.
Note: one difference (between your code and the previous way I got this working) is that I did not filter by ActivityType in the ActivityHistories WHERE clause. So, if the code below throws the same error, I would check that next.
List<Account> AccountsWithActivityHistories = [
    // you can't query ActivityHistory directly; only in a subquery against another object type
    SELECT
         Id
        ,Name
        ,( SELECT
                ActivityDate
               ,ActivityType
               ,CRM_Meeting_Type__c
               ,Description
               ,CreatedBy.Name
               ,Status
               ,WhatId
            FROM ActivityHistories
            WHERE ActivityType IN :included_activity_history_types
            //LIMIT 200
        )
    FROM Account WHERE Id = :accountId
];

// ActivityHistories on Account
for (Account a : AccountsWithActivityHistories) {
  for (ActivityHistory ah : a.getSObjects('ActivityHistories')) {
    // skip adding activities without a WhatId
    if ( ah.WhatId==null ) { continue; }

    if (((string)ah.WhatId).startsWith('001')) {
        // only add ActivityHistory's tied directly to an Account
        // (the query above pulls back all ActivityHistory's on related Oppty's as well)
        activities.add(new ActivityWrapper(ah));
    }
  }
}

Answer: This might be outdated but I hit this issue and wanted to throw my solution out there that I found on another forum.
The activityhistory object is just a Task or an Event that is set to "Closed". Therefore you can query for the object that is sitting behind the "Activity History" and attach this underneath a new contact or lead and this will store the same object as a new "Activity History" object.
list<Task> activityHistory = [SELECT Id,WhoId FROM Task t WHERE t.WhoId = 'randomID' and t.Status != 'Open'];

for(Task currentAH : activityHistory){
    system.debug(currentAH.Id);
}

The code above brought back all the "Task" activity history objects and allows me to reparent them using the WhoId to another contact/lead.


Help understanding copula version of Spearman rank correlation

Question: I'm reading through this article (http://www.sciencedirect.com/science/article/pii/S0047259X06000662) where they have a population version of the Spearman rank correlation. I'm having a little bit of trouble understanding the author's derivation, which I reproduce as follows:
"For a two-dimensional random vector $X$ $=(X_{1},X_{2})'$ with distribution function $F$, univariate marginal distributions $F_{X_{1}}$, $F_{X_{2}}$ and a copula $C$ is defined by
$\rho_{S}=\frac{cov(F_{X_{1}}(X_{1}), F_{X_{2}}(X_{2}))}{\sqrt{var(F_{X_{1}}(X_{1}))}\sqrt{var(F_{X_{2}}(X_{2}))}}=$
$= \frac{cov(U_{1},U_{2})}{\sqrt{var(U_{1})}\sqrt{var(U_{2})}}=$
$=\frac{\int_{0}^{1}\int_{0}^{1}uv dC(u,v)-(\frac{1}{2})^{2}}{\sqrt{\frac{1}{12}}\sqrt{\frac{1}{12}}}=$
$=12\int_{0}^{1}\int_{0}^{1}C(u,v)dudv-3$
I understand every step with the exception of the last one. Where did  the 3 come from? And why were they able to change the integrand from $uvdC(u,v)$ to $C(u,v)dudv$?
I'm trying to teach myself some basic copula theory so there are a few holes in my knowledge here and there.
Comment: Maybe integrating $\int\int uv \text{d}C(u,v)$ by parts (two times, in both integrating variables) can show that it is equal to $\int\int C(u,v)\text{d}u\text{v}$
Comment: But the "3" is obvious: $\frac{(\frac12)^2}{\sqrt{\frac{1}{12}}\sqrt{\frac{1}{12}}}=\frac{12}{4}=3$.
Comment: The second but last line is incorrect, the denominator should be $\sqrt{\frac{1}{12}}\sqrt{\frac{1}{12}}$ instead of $\sqrt{\frac{1}{2}}\sqrt{\frac{1}{2}}$.
Comment: Oh! You're totally right. Sorry about that, my mistake. Do you have any idea about my question regarding the last step? I can see that this is a very common way to define the Spearman rank correlation but nobody really explains where the 3 and the change of integrand came from.
Comment: D'oh! It has been staring at me all the time. You're right! Thanks! Any ideas about the change of integrand? Do you think it's like StijnDeVuyst said?
Answer: I came to your question after looking for the same proof and not finding it anywhere. Following StijnDeVuyst suggestion, I managed to prove it using integration by parts. I will omit the integration limits, just keep in mind they exist.
$$\int \int uv \ dC(u, v) = \int\int uv C'(u,v) \ dudv,$$ where $C'(u,v) = \frac{\partial^2}{\partial u \partial v}C(u,v)$.
\begin{equation}
\tag{1}
\label{main}
\int\int uv C'(u,v) \ dudv = \int v \left(\int u C'(u,v) du \right) dv.
\end{equation}
Solving the inner integral
\begin{align*}
\int_0^1 u C'(u,v) du &= u\frac{\partial}{\partial v}C(u,v) \big\rvert_{u=0}^1 - \int_0^1 \frac{\partial}{\partial v} C(u,v) \ du\\
&= 1-\int_0^1 \frac{\partial}{\partial v} C(u,v) \ du\\
\end{align*}
where the first equality is integration by parts on $u$ and the last equality comes from the fact that $C(1, v) = v$.
Substituting in \ref{main} we have
\begin{align*}
\int \int uvC'(u,v) \ dudv &= \int v \left(1-\int \frac{\partial}{\partial v} C(u,v) \ du \right)dv\\
&= \int_0^1 v \ dv - \int\int v \frac{\partial}{\partial v}C(u,v) \ dudv\\
&= \frac{1}{2}-\int\left(\int v \frac{\partial}{\partial v} C(u,v) \ dv \right) du. \tag{2}\label{segunda}
\end{align*}
Solving the inner integral with integration by parts on $v$ we get
$$ \int_0^1 v \frac{\partial}{\partial v} C(u,v) \ dv = u - \int_0^1C(u,v) \ dv$$
and substituting in \ref{segunda} we have (now including the integration limits)
\begin{align*}
\int_0^1\int_0^1 uv \ dC(u,v) &= \int_0^1 \int_0^1 uvC'(u,v) \ dudv\\
 &= \frac{1}{2} - \int_0^1 u \ du + \int_0^1 \int_0^1 C(u,v) \ dv du\\
&= \int_0^1 \int_0^1 C(u,v) \ du dv
\end{align*}
which proves the identity
\begin{align*}
\rho_S &= 12\int_0^1 \int_0^1 uv \ dC(u,v) - 3\\
&= 12\int_0^1\int_0^1 C(u,v) \ dudv - 3.
\end{align*}
This proof assumes that the copula $C$ has density given by $\frac{\partial^2}{\partial u\partial v}C(u,v)$. When this is not the case, check Theorem 5.1.1 and Corollary 5.1.2 from An Introduction to Copulas by Roger B. Nelsen.


Trabalhando com position de elemento na vitrine

Question: Olá! Eu tenho um problema que em teoria é simples mas eu não consigo mais achar uma possível solução para ele. Meu cliente é vtex e eu tenho um selo de Últimas Oportunidades que é configurado quando o produto está configurado nessa coleção específico. O selo está aparecendo perfeitamente, então meu problema é só com seu posicionamento.
Os selos vem por sua natureza na parte de cima do produto (como o ♡ do add aos favoritos), e o selo em questão funciona perfeitamente, alterando seu tamanho conforme a tela e mantendo sua posição, porém o cliente quer que esse selo em específico fique na parte de baixo.
Eu já tentei modificar o atributo top tanto da  quanto da , só que em ambos os casos quando a largura da tela altera, esse atributo top acaba desconfigurando a posição do selo. Como faço para ele ficar "fixo" na parte de baixo?

A estrutura do código (que eu não posso alterar) é:

A classe da div está com position relative e a imagem com position absolute
Answer: Seu código não esta executando aqui no stackoverflow, então vou dar uma resposta menos específica por isso ok? Quando você usa position e espera ter adaptação, você precisa usar medidas relativas. A tela não pode ser relativa e a posição em medidas fixas como pixel. Portanto você deve se basear em algo que também seja relativo e usar medidas relativas como %, vh e etc...
Agora falando em específico do seu problema, você pode dar top 100% no selo pra ele ultrapassar o fim do container da modelo, e depois usar a propriedade transform: translateY(-100%) pra ele voltar o próprio tamanho completo. Assim, ele sempre vai estar colado no fim do container da modelo independente de quanto isso ajuste. Aqui vai o código de exemplo, só clicar em executar para ver:

#box{
  position: relative;
  background-image: url('https://images-americanas.b2w.io/produtos/1823791448/imagens/modelos-de-roupas-vestidos-para-festa-casamento-formatura/1823791456_1_large.jpg');
  width: 500px;
  height: 500px;
}
#selo{
  position: absolute;
  width: 100px;
  height: 100px;
  top: 100%;
  transform: translateY(-100%);

}


Nilpotent Operators over Vector Spaces

Question: Exercise Prove that if $S:V \to V$ (a vector space) is nilpotent, then $I_V-S$ in invertible.

An operator $S: V \to V$ is nilpotent if there some some natural number $k$ such that $S^k = \underbrace{S \circ S \circ \dots \circ S}_{k \, times}$ is the zero map.

$I_V$ simply refers to the identity matrix/mapping with respect to $V$

The author provides a hint by asking us to consider the product of $I_v - S$ and $(I_V +S + S^2 + \dots + S^{k-1})$

Proof.
Suppose $S: V \to V$ is nilpotent. Then
$$\exists \, k \in \mathbb{N},  S^k(v) = 0 \hspace{0.3cm} \forall v \in V$$
We now consider the product
$$\Big[ I_v - S \Big] \cdot \Big[ I_v + S+ S^2 + \dots + S_{k-1}\Big]$$

I'm not exactly seeing here how considering this product is helpful. Does anyone have any advice on where to go from here? Is there some property of matrices that would be helpful?
Comment: Have you tried expanding the brackets? That seems like an extremely natural next step. Granted, it isn't always the right way to go when solving problems, but it's almost always worth a shot.
Answer: Expanding the brackets shows that
$$\Big[ I_V - S \Big] \cdot \Big[ I_V + S+ S^2 + \dots + S^{k-1}\Big]=I_v-S^k=I_V,$$
which shows that $I_V-S$ is invertible.
Answer: Expanding the product yields
$$
\Big[ I_v - S \Big] \cdot \Big[ I_v + S+ S^2 + \dots + S^{k-1}\Big] = \\
\Big[ I_v + S+ S^2 + \dots + S^{k-1}\Big] -
\Big[ S+ S^2 + \dots + S^{k-1} + S^k\Big].
$$
Note that this sum can be simplified.

Nilpotent Operators over Vector Spaces


Copy sent mail to shared mailbox

Question: We have a Microsoft Exchange Server 2007 running. I have granted certain users Full Access Permission to a specific mailbox. This mailbox also contains contacts, shared by all users who have access to that mailbox.
If a User clicks on a contact in that mailbox and sends a mail, the mail appears in the Users own sent Mails Folder.
I am looking for a solution where mails to one of the shared contacts mail adress will also appear in that mailboxes sent or inbox folder, so everyone can track what messages have been sent.
Answer: Microsoft has released an Outlook 2007 hotfix package dated June 30, 2009 to resolve certain issues and this issue is addressed in that list

Hotfix: Description of the Outlook 2007 hotfix package (Outlook.msp): June 30, 2009
http://support.microsoft.com/kb/970944/
Set below registry key to enable this functionality.

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Preferences]
"DelegateSentItemsStyle"=dword:00000001
Answer: That's the default way when working with Outlook/Exchange and shared mailboxes.
Check out this fix.

Copy sent mail to shared mailbox


Are single coil pickups better at catching picking dynamics?

Question: I've seen mention of dynamics on the Internet generally associated with single coil pickups, and it seems that people assume that those have more dynamics.
However, there is an interesting forum topic  in which someone argues about that with convincing arguments.
And there seems to be consensus on the fact that the word dynamics may be used with different meanings, that people tend to repeat stuff they read on the Internet which leads to unsubstantiated rumors...
Dynamic range definition
What I'm talking about is the way the pickup outputs low volume when I pick gently and huge volume when I slam hard. I've seen mentions of dynamic range and I think this is it. Is this correct?
For instance, my friend has this Telecaster with a single coil, and it is remarkable how much he can play softly them strum harder and get a huge volume difference (huge dynamic range). On the other hand, my SG is equipped with humbuckers and I don't get that much of a difference. Even strumming very hard, I don't get that volume increase (low dynamic range).
The enemy of dynamic range would be compression. Compression increases the volume on low level signals so that everything is loud.
Pickup and amp influence
We've been swapping amps for the sake of testing. His amp (Powerball, 100 W) is much louder than mine (Ironball, 20 W), and it seems the difference is attenuated but his guitar still wins with the dynamic range contest.
Those tests would indicate that the pickups do matter, but in this comment, user Gnobuddy says that pickup answer can be considered linear and lack of dynamic range is due to compression in the amp only.
Maybe a way to conciliate both theories is to say that high gain humbuckers  tend to reach max volume earlier while single coils exploit the lower volume range. Basically what is developped here.
Does this mean I should get more dynamics by just lowering the gain on my amp?
In other words, would using lower gain pickups help just because I would get a lower gain, which I could achieve just the same by lowering the gain on the amp?
Right now, I play with master at 100% but a relatively low gain on the clean channel to avoid crushing on the arpeggios. I don't think I can lower the gain any more. I would like to get more expression by having some notes sound louder, for instance get a huge boom when strumming the lower string, and I'm thinking of getting a single coil or P90 neck pickup.
Comment: Interesting stuff [here](http://www.thefretboard.co.uk/discussion/112006/are-single-coils-less-responsive-to-picking-dynamics/p2).
Answer: First note that, amplification completely aside, guitars have different dynamic range. To name the extremes, a Tele with high action and .012 strings will not respond strongly to gentle stroking, but allows you to put in really a lot of mechanical power if you want. Whereas a Les Paul with low action and .009 strings plays like butter, but is quickly "saturated" in terms of power when the flabby strings hit the fretboards (leaving only transversal motion, which all magnetic PUs are bad at picking up). So that's something you should always keep in mind: even electric guitars are actually acoustic instruments; the mechanical aspects are in many situations more important than the electric ones.
For a fair comparison, you should therefore stick to a single guitar and compare different pickups on it. That's easily possible on a superstrat with humbuckers that allow coil splitting†.
Even there, I'd agree from experience that the single-coil option tends to, subjectively, "feel more dynamic". The main reason for this is probably that dynamics are frequency-dependent: quiet notes are not so much "softer" in an amplitude sense as they are mellower, because the higher harmonics are proportionally more excited by heavy picking. The fundamentals are already convincingly brought in action by gentle finger-stroking, so a high-inductance humbucker already puts out a pretty strong amplitude when you're playing mezzopiano.A low-inductance single coil puts out a much lower amplitude in that situation (it has a lower voltage-amplitude in general), however it can in a sense make up for that with a strong resonance above 4 kHz, which sounds in principle a lot more present / agressive than the <1 kHz stuff that the humbucker is so good at transmitting. Only, those frequencies require more strong playing to get out at all. With a humbucker, they'll not be so strikingly twangy because the fundamentals already dominate the signal level.
Add to this the amp's compression characteristics and the upshot is

A high-Z humbucker is always loud, and it doesn't get very much louder with forte playing because this usually just saturates‡ the amp with unspectacular low-mid frequencies. Nice fat/bluesy singing, but hardly agressive. To make a humbucker sound agressive, you need to cascade multiple stages of distortion as is usually done in rock/metal – that works very well thanks to the PU's high signal-to-noise ratio, but it reduces the dynamic range even further.
A low-Z single coil is generally quieter, however it can transmit some really in-the-face higher frequencies which only arise when you play forte. Even if you saturate the amp: when done with these higher frequencies it results in a very different sound, not just smooth compression but piercing crackup.

All this applies only under the assumption that the humbucker has a high inductance and the single coil a lower one. That's a typical situation but not universal. You can get low-impedance humbuckers as well; in fact you can hack one yourself by wiring the coils of a normal humbucker in parallel rather than series. (You'll find that this sounds indeed much brighter and probably also feels more dynamic; however standard-size humbuckers can sound rather unpleasantly harsh in a low-inductance configuration – probably because the overtone cancellation falls in a critical frequency range.)
Conversely, single coils with higher inductance won't give you the dynamic twang of a Tele either. In particular the old fat jazz-guitar models sound tame, and also a P90 is probably not a sensible choice if you want lots of dynamic range.
Instead, I'd recommend to try and get out more of the pickup configuration you already have. A coil split is a very effective simple option. But you can also  make the signal more SC-agressive after the guitar – a classic option is a wah-wah pedal. Less obvious but very effective is a low cut filter, which prevents flooding the amp with fundamentals. You can do that with any EQ pedal.
The best option would be to include all of that as an active circuitry in the guitar.

†One might argue that a split humbucker is not in every regard the same as a single coil; in particular, it still has the extra magnets. I don't think these are an important aspect here, but ideally, you'd literally test a guitar with a humbucker, then take that out and put a single coil in its position and test again. I would be interested whether such a test gives much different results from a coil split of a single PU; I rather doubt it.
‡Even if you have the gain very low, you may get compression from the power stage.
Comment: Thanks you for this very detailed answer. I understand that this (SC being > to HB regarding dynamics) is a general assertion that assumes HB is high gain / high Z and SC is low gain / low Z, therefore it doesn't apply to exceptions to this rule (low Z HB, high Z SC). I suspected P90 would fall into the not so low Z SC category. Thanks also for the pointing out frequency issue. I have a wha pedal, I shall try using it as a low-cut filter.
Comment: Another way of comparing without having to mechanically change the pickups would be to use a [P-Rails](https://www.seymourduncan.com/pickup/p-rails-set): it allows to switch between CS, P-90 and HB.
Answer: Dynamics is only part of the issue, but yes, single coil pickups should give you a better response for a couple of reasons:

single position on the string as opposed to two positions energising the pickup means you don't have interference between frequencies: hence faster response, better highs etc
only one magnet set rather than a pair means better sustain, as magnets in pickups damp string vibration

However humbuckers do provide noise reduction (hum bucking) and greater signal strength, as well as a bit of perceived boost to lower frequencies. If, however, you can reverse one of the pair (phase shift) you can bring out those transients and dynamics once again.
Comment: How does this adress the question?
Comment: @leftaroundabout question asks "are single coil pups better at it" -  my answer says "yes," and explains why plus some other associated info.
Comment: Doesn't look like it to me; question asks "are single coils better at _X_" and you write "_X_ is only part of the issue [_what issue_?], but single coils are better at _Y_ and _Z_".
Comment: Sentence 1 - I don't know how to write "yes" any simpler, I'm afraid.
Answer: The way to find the "true" answer to this is to compare a single-coil pickup vs a double-coil pickup Having Identical Sensitivity.  Even knowing that two different pickups have the same Impedance isn't going to be conclusive.  Different pickups even using the same exact coil(s) are likely to have different magnets (of different gauss ratings).  The question is therefore, IMHO, Too General to have a deterministic answer.  Pickup "specs" generally don't even list an impedance; you're stuck with "subjective" terms like "Hot" and "Mellow".  Assuming an identical magnetic field, a coil with a larger # of turns (same size wire) will generally produce a higher max output voltage (i.e. will appear to have a larger "dynamic range", in your terms).  Short of having detailed specs, you're unfortunately stuck with trial-and-error comparisons or folklore to drive your choice.
Comment: This speaks to an important point: there is a dramatic range of possible output voltages between individual humbucker designs. It is not true that all humbuckers are hotter or output higher voltages merely because they are humbuckers. It is also not to be expected that every single coil pickup design has the same voltage output.


Should a REST API return exception in response body?

Question: What is the best practice in .NET with Web API? Especially Web REST API. Should a REST API return exception in response body when an exception happens?
For sure I will return a 500 or similar HTTP status. But when I response with this error code what are the best practice? Or even better what is the specification or REST API about this?

return the exception (what I do)
return en empty response body? (yes but we lose information that can help for debuging)
return an empty of default JSON object? (I find this confusing)
something else?
Comment: A status code 500 is 'Internal Server Error', which means that something went wrong in the application and the consumer should try again later because it is nothing they can directly resolve. Returning the exception itself is not a good thing to do because it'll expose information about the software and implementation of that software, returning a false-hope to the consumer such as a 200 with an empty JSON object will trick the consumer into thinking it's all fine. I'd just return a 500 with nothing, or an error message that says "Please try again later".
Comment: 2: Exceptions shouldn't be returned from the application itself, I think, they should be dealt with when the exception occurs and then have a global exception handler that returns a 500 status code for any uncaught error. If the issue is caused by user input then you should return one of the 4xx status codes with a message similar to what user3051475 describes in his answer paragraph 2.
Comment: My REST API is only used by a client also created by one of our team. This is not a perfect dogmatic REST API. Actually, I don't have time to test all now so I like the idea of letting the system create and send original exception. It is more easy for the client team to understand the error. But yes, in production I should override this.
Comment: If you want to keep this in development environments then you could always feature toggle this.
Comment: I find this question super interesting, but I don't get why the programmation language used behind is mentioned in the question itself. It shoudl be decorrelated.
Answer: return the exception (what I do)
-> You should not return the exception as is because: 1) It may contain information that you would not want to be exposed to the users of your REST API. For instance consider file paths in case of an IO exception or sql server information in case of an sql exception, so on. 2) You will be sending information that is not needed by the clients of REST API, thus wasting bandwidth and serializing unnecessary information.
return en empty response body?
-> No.
return an empty of default JSON object?
-> No.
something else?
-> Return a very specific error message (plus any other information that you think could be helpful for the developers who are integrating that REST API for resolving that error or for you to trace that error if you are provided with that error message. After all you will have to look into some issue at some point so make sure that the information you pass is enough to give you an idea about what went wrong).
Comment: I moved your solution to something else... yes. Is it correct?
Comment: So I can create my own exceptions but I never re-throw an exception and I never put information in my inner exception. And if possible I clean the stack trace. For now the "plus any other information you think could be helpful for developers" is the exception itself. Of course later I should improve this.
Answer: I have this suggestion.

The error needs to be handled by some Filter in your application (API). This Filter will get the unexpected error, transform the error in a JSON with http status code equals 500.
The returned error needs to have the same JSON format, like this:
{
    code: 12321312,
    message: "A fatal error occurred",
    details: "An unexpected information was passed as parameter to the API."
}

The error format needs to be something informative. When you get the error in the Filter, you can save the error in database with a generated code (the error code, like an UUID) and return the code in the JSON. To have a nice API, the use of error codes will be a good feature and will help you to identify the problems.
Answer: By all means YES you should include a representation of the exception in the body of the response.  The exception will be the best explanation of what is wrong, and it will be the most helpful to aid the user in correcting whatever went wrong.   I recommend a response code of 400 for all errors, however any number in the 400 range is acceptable.
I did some research and found that the most common/standard uses a JSON structure of this form:
{
   "error": {
      "code": "400",
      "message": "main error message here",
      "target": "approx what the error came from",
      "details": [
         {
            "code": "23-098a",
            "message": "Disk drive has frozen up again.  It needs to be replaced",
            "target": "not sure what the target is"
         }
      ],
      "innererror": {
         "trace": [ ... ],
         "context": [ ... ]
      }
   }
}

Many of these are optional, but there in case you need them.   The important thing about this structure is that the error is described in an object under the member "error".
This is the format proposed by the OASIS data standard OASIS OData and seems to be the most standard option out there, however there does not seem to be high adoption rates of any standard at this point.
The details are discussed in my blog post on Error Handling in JSON REST API