Count number of matches of a regex in Javascript

Question: I wanted to write a regex to count the number of spaces/tabs/newline in a chunk of text. So I naively wrote the following:-
numSpaces : function(text) {
    return text.match(/\s/).length;
}

For some unknown reasons it always returns 1. What is the problem with the above statement? I have since solved the problem with the following:-
numSpaces : function(text) {
    return (text.split(/\s/).length -1);
}

Answer: tl;dr: Generic Pattern Counter
// THIS IS WHAT YOU NEED
const count = (str) => {
  const re = /YOUR_PATTERN_HERE/g
  return ((str || '').match(re) || []).length
}

For those that arrived here looking for a generic way to count the number of occurrences of a regex pattern in a string, and don't want it to fail if there are zero occurrences, this code is what you need. Here's a demonstration:

/*
 *  Example
 */

const count = (str) => {
  const re = /[a-z]{3}/g
  return ((str || '').match(re) || []).length
}

const str1 = 'abc, def, ghi'
const str2 = 'ABC, DEF, GHI'

console.log(`'${str1}' has ${count(str1)} occurrences of pattern '/[a-z]{3}/g'`)
console.log(`'${str2}' has ${count(str2)} occurrences of pattern '/[a-z]{3}/g'`)

Original Answer
The problem with your initial code is that you are missing the global identifier:
>>> 'hi there how are you'.match(/\s/g).length;
4

Without the g part of the regex it will only match the first occurrence and stop there.
Also note that your regex will count successive spaces twice:
>>> 'hi  there'.match(/\s/g).length;
2

If that is not desirable, you could do this:
>>> 'hi  there'.match(/\s+/g).length;
1

Comment: You can also protect against the null by using this construction: `( str.match(...) || [] ).length`
Comment: This works as long as you have at least one space in your input. Otherwise, match() annoyingly returns null.
Comment: sfink is right, you definitely want to check if match() returned null: `var result = text.match(/\s/g); return result ? result.length : 0;`
Comment: What's the problem with `('string'.match(/\s/g) || []).length` ?
Comment: @JoãoPimentelFerreira The difference is: if `str` is null, then `str.match()` will fail but `(str || '').match()` will not.
Answer: As mentioned in my earlier answer, you can use RegExp.exec() to iterate over all matches and count each occurrence; the advantage is limited to memory only, because on the whole it's about 20% slower than using String.match().
var re = /\s/g,
count = 0;

while (re.exec(text) !== null) {
    ++count;
}

return count;

Answer: (('a a a').match(/b/g) || []).length; // 0
(('a a a').match(/a/g) || []).length; // 3

Based on https://stackoverflow.com/a/48195124/16777 but fixed to actually work in zero-results case.
Answer: Here is a similar solution to @Paolo Bergantino's answer, but with modern operators. I'll explain below.
    const matchCount = (str, re) => {
      return str?.match(re)?.length ?? 0;
    };

    // usage

    let numSpaces = matchCount(undefined, /\s/g);
    console.log(numSpaces); // 0
    numSpaces = matchCount("foobarbaz", /\s/g);
    console.log(numSpaces); // 0
    numSpaces = matchCount("foo bar baz", /\s/g);
    console.log(numSpaces); // 2

?. is the optional chaining operator. It allows you to chain calls as deep as you want without having to worry about whether there is an undefined/null along the way. Think of str?.match(re) as
if (str !== undefined && str !== null) {
    return str.match(re);
} else {
    return undefined;
}

This is slightly different from @Paolo Bergantino's. Theirs is written like this: (str || ''). That means if str is falsy, return ''. 0 is falsy. document.all is falsy. In my opinion, if someone were to pass those into this function as a string, it would probably be because of programmer error. Therefore, I'd rather be informed I'm doing something non-sensible than troubleshoot why I keep on getting a length of 0.
?? is the nullish coalescing operator. Think of it as || but more specific. If the left hand side of || evaluates to falsy, it executes the right-hand side. But ?? only executes if the left-hand side is undefined or null.
Keep in mind, the nullish coalescing operator in ?.length ?? 0 will return the same thing as using ?.length || 0. The difference is, if length returns 0, it won't execute the right-hand side... but the result is going to be 0 whether you use || or ??.
Honestly, in this situation I would probably change it to || because more JavaScript developers are familiar with that operator. Maybe someone could enlighten me on benefits of ?? vs || in this situation, if any exist.
Lastly, I changed the signature so the function can be used for any regex.
Oh, and here is a typescript version:
    const matchCount = (str: string, re: RegExp) => {
      return str?.match(re)?.length ?? 0;
    };

Answer: ('my string'.match(/\s/g) || []).length;
Comment: I think you put the `|| []` in the wrong place, it should be `('my string'.match(/\s/g) || []).length`
Answer: This is certainly something that has a lot of traps. I was working with Paolo Bergantino's answer, and realising that even that has some limitations. I found working with string representations of dates a good place to quickly find some of the main problems. Start with an input string like this:
'12-2-2019 5:1:48.670'
and set up Paolo's function like this:
function count(re, str) {
    if (typeof re !== "string") {
        return 0;
    }
    re = (re === '.') ? ('\\' + re) : re;
    var cre = new RegExp(re, 'g');
    return ((str || '').match(cre) || []).length;
}

I wanted the regular expression to be passed in, so that the function is more reusable, secondly, I wanted the parameter to be a string, so that the client doesn't have to make the regex, but simply match on the string, like a standard string utility class method.
Now, here you can see that I'm dealing with issues with the input. With the following:
if (typeof re !== "string") {
    return 0;
}

I am ensuring that the input isn't anything like the literal 0, false, undefined, or null, none of which are strings. Since these literals are not in the input string, there should be no matches, but it should match '0', which is a string.
With the following:
re = (re === '.') ? ('\\' + re) : re;

I am dealing with the fact that the RegExp constructor will (I think, wrongly) interpret the string '.' as the all character matcher \.\
Finally, because I am using the RegExp constructor, I need to give it the global 'g' flag so that it counts all matches, not just the first one, similar to the suggestions in other posts.
I realise that this is an extremely late answer, but it might be helpful to someone stumbling along here. BTW here's the TypeScript version:
function count(re: string, str: string): number {
    if (typeof re !== 'string') {
        return 0;
    }
    re = (re === '.') ? ('\\' + re) : re;
    const cre = new RegExp(re, 'g');
    return ((str || '').match(cre) || []).length;
}

Answer: This seems well solved but I hadn't seen this version, which might be a bit more readable, and in-keeping with the style in some codebases:
const numberOfResults = [...str.matchAll(/YOUR_REGEX/g)].length;

Answer: Using modern syntax avoids the need to create a dummy array to count length 0
const countMatches = (exp, str) => str.match(exp)?.length ?? 0;

Must pass exp as RegExp and str as String.
Answer: how about like this
function isint(str){
    if(str.match(/\d/g).length==str.length){
        return true;
    }
    else {
         return false
    }
}


If I boil tap water will it be safe for my iguana would that clear the chlorine oxide out of it

Question: I would like to know if boiling my tap water would clean it for my iguanas
Answer: If you only want to get chlorine out of the water, it is enough to to add the water to a bucket and leave it there for 24 hours. The chlorine will evaporate "willingly".
Boiling is very likely to accelerate the process, while killing some micro-organisms in the process.

While chlorine is fairly easy to remove from the tap water, there might be other substances in the water which might not be easy to remove, and still be harmful for the iguana. If at all possible, have a sample of tap water tested  at a local laboratory, to understand what you are dealing with. Depending on the results, better advice can be formulated.

Obvious caution note: be sure to let the water cool, before mixing it with the iguana :)
Comment: Anyone with a pool can confirm that it is pretty easy to dechlorinate water with direct sunlight.


Is the Apple power adapter exchange program still available?

Question: My USB power adapter (model A1300) that came with my Iphone 4 died on duty today.
Just by coincidence I saw this site right now, that claim Apple will replace all of the A1300 models with the A1400 once free of charge.
I wanted to ask if this procedure is still available in Europe, so I can use it.
Comment: Didn't you see where it said... "The Exchange Process" ... "Bring the affected adapter(s) to an Apple Retail Store or a participating Apple Authorized Service Provider. We will need to verify your iPhone serial number as part of the exchange process so please bring your iPhone with you."?
Comment: @user3439894 I saw it, but didn't know if it's still genuine.
Comment: The fact that the page is still available and without an ending date it's logical to assume it's still valid.  Select your Country from the list box and see what it has to say and follow through.
Answer: Yes - if you have an adapter that might be covered, it would be replaced. Check with AppleCare or visit an Apple Store for service - whatever is your preference. The page has good information on finding service as well as having your iPhone serial number to validate the exchange.
Update June 2016: The "exchange" is r ported to now be handled using a repair procedure.


How To Recover My Data From Not Detected Hard Disk?

Question: I am using Acer Laptop one day before my Hard Disk is not detected in BIOS and not booting it's shows Insert Boot Disk and I am try another H.D.D it's boot perfectly in my Laptop but,I want detect and recover my data on not detected hard disk. I am not experience about Hard Disk please, can any one help me how to recover my data from not detected Hard Disk.
Comment: You need to have it detected, by some computer somewhere.  But this is a tricky area -- cables to be installed, jumpers set, etc -- so you'd best ask a knowledgeable buddy to help (and maybe supply the detecting computer).
Answer: With the information given so far, the only answer with a high probability to work is to employ a commercial data recovery service.
If the data is really valuable, consider doing this.
In this case, trying to solve the problem yourself may do more harm than good.
There are many possible causes, drive's internal hardware, firmware, connector,... . Have you had a look at the Related questions on the right? For example, How do I recover data from my presumably dead hard disk.
Try connecting the drive to a computer that is running a different OS. For example, boot Linux from a disc.
You might get more focused help if you stated the exact model names of both drive and computer, and told us possible reasons why the drive failed to work (impact?).
Answer: I think you can use another device for recover your data. Its hard to connect to another computer that is running Windows. Note: your Hard Drive should be on Slave mode and the other one Hard Drive that the operating system is on it should be Master. Also, if your Hard Drive is not recognized in any way can not access your Data.
Comment: my hdd disk not detected i am try another computer any possible solution for recover my data?
Comment: Your H.D.D damaged and your Hard Drive has a Hardware problem. When you connect the Hard Drive to a Power Supply is turned on? Can you feel?
Comment: yes i am feel hard disk power supply!
Comment: If your hard drive is turned on but is not recognized, maybe your Hard Drive main board has a problem. Your Hard Drive main board must be repair by a professional or corporate guarantee.


Developing a Rails App

Question: I am trying to learn Rails on my own and have been having difficulty to set it up on windows. I am now trying to dual boot my computer. I would like to ask which Linux flavor is the best to install right now?
Answer: I use Ubuntu 10.10 in a VirtualBox VM and it's great.
See these nice tutorials to install Rails on Ubuntu 10.10.:

Ubuntu, Ruby, RVM, Rails, and You by Ryan Bigg
How to Install Ruby 1.9.2 and Rails 3.0 on Ubuntu 10.10 by Peter Cooper
Answer: I guess that would be Ubuntu. It's easy to use and there's plenty of people using it (even for Rails development).
You can check Rails Development On Ubuntu 10.04 for sample instructions how to get started
http://ascarter.net/2010/05/10/rails-development-on-ubuntu-10.04.html

Developing a Rails App


is Lyall Lupin dead?

Question: Having reread a the new Pottermore moments and chapters I cannot see anywhere JK mentions Remus' father having passed away, and more specifically he refused to return to live with Lyall so as to not endanger him. With that in mind, why did Lupin not let Teddy grow up with his grandfather Lyall, rather than let Harry, who was still 17 or so?
Comment: Well, at the time Teddy's guardianship had to be established, both Remus and Tonks were dead, so Remus would have been unable to revisit a custody agreement. Teddy was raised by his maternal grandmother, Andromeda (Black) Tonks, not Harry. As Lyall is not mentioned in the books there is no way of knowing why he did not have guardianship of Teddy after Remus and Tonks died. I have no idea whether Lyall is dead. Note: I haven't read about Lyall Lupin on Pottermore yet.
Comment: let me know when you've caught up with Pottermore, some really interesting things on there. but you make a valid point, there was no reason to mention lyall in the books and only finding out about him now after the books doesnt really help or leave us with a valid answer
Answer: There's no specific confirmation provided in any of the Potter novels as to whether Lyall Lupin is alive or dead after the end of Deathly Hallows, nor has there been anything released in any of the additional materials to confirm why he was (or wasn't) considered as a guardian for Teddy Lupin.
The latest biography provided on Pottermore sheds very little light on his current whereabouts, nor does the Potter Wikia have any further details to offer on him. Short of asking JKR directly, we may simply never know.
As to the specifics of your question, Teddy didn't grow up in Harry's care. He was, in fact raised by his maternal grandmother; Andromeda Tonks although he did regularly visit the home of his godfather Harry Potter ("at least four times a week") as he was growing up.
Comment: i had forgotten about Andromeda, thanks Richard!

is Lyall Lupin dead?


RCA Socket Pinout

Question: I have been longing online for quite a well for the pinout of an RCA socket, but I can't seem to find the exact pinout.  It only has two pins, a center one, and one right in front of the center pin.  Looks like this, one website said that one of the pins is ground, which left me sort of confused.  What is the exact pinout of the this component?
Answer:
Figure 1. The near pin is obviously connected to the outer ring of the socket. This forms a shield for the signal pin going through the centre to the pin at the rear of the socket. Figure 2. The plug showing the signal pin (centre) and the shield / ground (outer).
Connect ground to the shield pin (the near one in the photo).
Comment: So the center pin is a female connection part?
Comment: Yes, although the shell of the plug (Figure 2) covers the shell of the socket (Figure 1) so the plug goes into the socket which fits into the plug!

RCA Socket Pinout


What's with the "When ~ enters the battlefield, if it's on the battlefield" text?

Question: Some cards like Necromancy, Animate Dead, and Dance of the Dead have text like "When ~ enters the battlefield, if it's on the battlefield, do something". What is the purpose of the "if it's on the battlefield" part of that trigger? It seems like it's there to prevent some form of abuse, but I'm not sure what that abuse would look like.
Answer: The "if it's on the battlefield" clause specifically prevents the triggered ability from resolving if the permanent leaves the battlefield while the ability is on the stack. On each of the cards listed, the triggered ability in question also creates a delayed triggered ability that says "When ~ leaves the battlefield, that creature's controller sacrifices it." If the permanent has already left the battlefield by the time the first triggered ability resolves, that delayed triggered ability will never trigger and you will never be forced to sacrifice the referenced creature.
So, the abuse that clause is intended to avoid is removing the enchantment in response to the triggered ability so that the creature can be reanimated indefinitely without any of the downsides the enchantment applies.
Comment: I am not sure if I am thinking about the same usage of "until ~ leaves the battlefield" you are referring to. If you mean writing "When ~ leaves the battlefield, put target creature card from your graveyard onto the battlefield under your control **until ~ leaves the battlefield**." instead of having "When ~ leaves the battlefield, that creature's controller sacrifices it." the functional difference is that the event that causes the creature to leave the battlefield is no longer a triggered ability and nobody can respond to it.
Comment: Because Wizards avoids doing functional errata whenever possible, and these cards function without it. Plus, even though the rules around moving a card to a zone "until" an event don't exclude the battlefield, objects generally move from battlefield to the graveyard because they are destroyed or sacrificed. Adding that kind of delayed one-shot effect to that increases complexity in a way I assume they want to avoid.
Comment: I'm curious why those cards weren't retemplated to use the "until ~ leaves the battlefield" wording that Banisher Priest *et al* do, since that template is designed to cover the same timing gap.
Comment: @murgatroid99 Both the "until ~ leaves the battlefield" template and the intervening if clause template here seem to have the same effect - if the object is removed from the battlefield before its ETB trigger resolves, nothing happens, so I don't see how this would be a functional errata. Auras are always a bit odd though, and these are three especially odd auras, so there may be a subtlety here I'm missing.

What's with the "When ~ enters the battlefield, if it’s on the battlefield" text?


learning the Kora

Question: Are there any written methods for learning the Kora,  a West African instrument which traditionally is taught only by example and whose repertoire is not notated?
Comment: Best I've found so far, but you really, really want to be able to read German, as the English (and other) translations are sporadic: http://www.kora-music.com/.
Comment: Just a thought - you **might** be able to find and adapt things for the Gravikord, an electric instrument based on the kora. https://en.wikipedia.org/wiki/Gravikord
Comment: Sorry for the delay in response guys snd thanks for the comments.  the Kora website is good,  but their way of notating Kora music seems clumsy and difficult to read.. maybe I'll try devising a new method or adapting two staves of regular notation (one for each hand).
Answer: Resources:
1.) http://www.kora-music.com/e/notationssystem.htm
2.) http://www.derekgripper.com/african-guitar/reading-kora-scores/
3.) A 34 page pdf by William Ridenour
4.) For purchase, a book by Roderic Knight
5.) Several places to purchase African Music Scores
6.) http://www.oscarvandillen.com/kora-music/
Also, Sona Jobarteh is a composer and Kora virtuoso - she has workshops but, the site doesn't explicitly state written resources are provided....
A quick image search for 'kora sheet music' pulls up a lot of material - I did not examine them closely for duplicates, etc...

learning the Kora


Training of SVM classifier using SIFT features

Question: please i like to classify  a set of image in 4 class with SIFT DESCRIPTOR and SVM. Now, using SIFT extractor I get keypoints of different sizes exemple img1 have 100 keypoints img2 have 55 keypoints.... how build histograms that give fixed size vectors with matlab
Answer: In this case, perhaps dense sift is a good choice.
There are two main stages:
Stage 1: Creating a codebook.

Divide the input image into a set of sub-images.
Apply sift on each sub-image. Each key point will have 128 dimensional feature vector.
Encode these vectors to create a codebook by simply applying k-means clustering with a chosen k. Each image will produce a matrix Vi (i <= n and n is the number of images used to create the codeword.) of size 128 * m, where m is the number of key points gathered from the image. The input to K-means is therefore, a big matrix V created by horizontal concatenation of Vi,  for all i. The output of K-means is a matrix C with size 128 * k.

Stage 2: Calculating Histograms.
For each image in the dataset, do the following:

Create a histogram vector h of size k and initialize it to zeros.
Apply dense sift as in step 2 in stage 1.
For each key point's vector find the index of it's "best match" vector in the codebook matrix C (can be the minimum in the Euclidian distance) .
Increase the corresponding bin to this index in h by 1.
Normalize h by L1 or L2 norms.

Now h is ready for classification.
Another possibility is to use Fisher's vector instead of a codebook, https://hal.inria.fr/file/index/docid/633013/filename/jegou_aggregate.pdf
Comment: Ok, no I think I get this. I should create a codebook not for the "input image", but for the whole dataset. And only then create histograms suing the generated codebook.
Comment: Could you explain how testing and training processes should go? I'm trying to implement the approach you've described here and can't understand how to test the model. If I have a labelled dataset of images, firstly, I create a codebook for the test image, right? Then, for each image in the dataset, I calculate histograms using the codebook of the test image. So, I get a bunch of histograms on which I can train my SVM. But how do I test it? How do I get my single input image meant for testing to the format of those histograms, so I can test my trained SVM on it? Or my understanding is wrong?
Answer: You will always get different number of keypoints for different images, but the size of feature vector of each descriptor point remains same i.e. 128. People prefer using Vector Quantization or K-Mean Clustering and build Bag-of-Words model histogram. You can have a look at this thread.
Answer: Using the conventional SIFT approach you will never have the same number of key points in every image. One way of achieving that is to sample the descriptors densely, using Dense SIFT, that places a regular grid on top of the image. If all images have the same size, then you will have the same number of key points per image.


Is there any effort in determining if a duplicate question is better than the original?

Question: I was wondering, sometimes the reason for the existence of a duplicate question might be, because the original was not very "findable." Or the duplicate might have better answers, or applicable to more circumstances. Are there any efforts to merge questions in those circumstances?
Comment: Its a good point. Here's an example of where the [original was closed](http://stackoverflow.com/questions/16704/map-vs2008-keyboard-shortcuts-to-eclipse#comment25643366_16704) in favour of the more popular duplicate.
Answer: Less findable original
If the original wasn't very findable then thats exactly when a duplicate is a good thing to make it more findable. Which is the more findable is ultimately irrelevant as one will point to the other. The question is which has the best answers
Less clear original
Again as both questions point to the same answers it doesn't matter (much), the question again is which has better answers
Both have good answers
This is the case in which a merge is appropriate,  flag for moderator attention to suggest this.

Don't take close as duplicate as a bad thing; take it as "hey! Good news! We've found all these ready made answers to your question! "
Answer: When we close a question as duplicate, we do because it is asking for the exact same thing and we judge that it won't get different answers.

Is there any effort in determining if a duplicate question is better than the original?

...If it is closed as duplicate, the effort has been made.
If it is clear that your question is not applicable to the same situations or might get different answers because there is a variant to it, it won't get closed.
I asked this one this morning about a question that was asked many times before but since it is different and there were no reputation tracker before, it is now a different question.
Answer: Merging questions certainly has happened in the past; that would happen only when you had two separate questions, both of which had very good answer(s) worth saving, which were determined to be sufficiently similar to not merit two separate questions.  I'm fairly sure it's quite rare (in particular, a mod would have to do it; there's no 'merge' flag for a regular user, so it would have to come from an 'other' flag or a request from meta).
In general, the reason for the duplicate redirect (as opposed to deletion) is specifically because of what you say: perhaps the duplicate might be more findable, even if the original has answers (or better answers).  Questions closed for Off Topic or other reasons are often deleted eventually; questions closed for Duplicate are not, so that Google/etc. index them and will bring them up in results if they are indeed well written questions.
The "is any effort used" of course varies by question... it takes 5 votes to close something of 3k+ rep users, so hopefully at least one of those users went to some effort.  I would suggest that almost all of the time that is the case, but certainly occasional questions might get 4 robo-reviewers and one initial misguided soul.
Answer: Having been the victim of such overzealous "Duplicate" flagging, I applaud your courage to ask. In my experience there doesn't seem to be any effort at all.
Comment: Re: "Once it's a dupe, it's useless to the world..." That's not exactly true; if it were, dupes would be deleted. Instead, they are left up because they can help people find valuable content using different search keywords.
Comment: Do you have an example?
Comment: @ThisSuitIsBlackNot http://meta.stackexchange.com/questions/212140/community-accepted-answers-after-a-period-of-time-and-tipping-point  If you read further down, you can see I even begin to help one of the original flaggers understand the difference and the logic, but because something was asked that used the same words within less than 5 min it was flagged as a dupe and disregarded.  I went on to have a long discussion with the commenter regardless... and made lots of effort to update the question to suit their complaint.  Once it's a dupe, it's useless to the world regardless of how valid.
Comment: That question is a duplicate. Not because of the same words. But because of the content which is proposing the exact same thing as the question it duplicates.
Comment: @insertcleverxmasname You obviously did the same thing as the others and didn't bother reading the discussion thread.  The original question had no methods or suggestions, mine was actually a suggestion / feature request that included solutions to the problems that were raised in the comments of the original.
Comment: @oucil Meta is different, even if that weren't an identical issue (I don't know, and am not going to get in the middle of that part.)  'Duplicate' on meta not only means 'really a duplicate' but also 'we talked about that a long time ago and don't really want to go over it AGAIN, even if your question and suggestions were interesting', and several other things.
Comment: I actually read both your post and the one that you duplicated. It is asking about the same feature request that was rejected. No matter how you put it up, nothing changed since that first question except for some other propositions you add to see if you can re-ask the question with these minor changes. Your whole post should have been a comment on the first question asked or maybe an answer. This would have brought up the post and maybe, very...*maybe* reopene the discussion.
Comment: @joe Meta is for discussing the Stack sites if I'm not mistaken, it's what the about page says, so if it was the wrong place to bring it up, that's not obvious.  The other issue was that the original was 4 years old, and irrelevant for a number of reasons pointed out by commenters. In any case, I just feel the question raised above shows that in some cases, flagging as a duplicate sometimes hides more valuable questions / ideas in favour of lesser ones. It's everyones right to disagree with me on this, and for that there is a down arrow above :)
Comment: @oucil its been decided (with answers that describe a more general case) that we don't want 'anyone but OP' accept under any circumstances.  The answer is always that whatever the specific circumstances
Comment: @RichardTingle I do understand the necessity of such a hard line, my attempt was only to show there are circumstances where it could both work and be valuable. But I do understand.  With relation to the above question, my frustration was with the efficiency that mine was dispatched without discussion, and that it's one of the reasons people may feel the same as the OP in this case.  There are just too many hawks watching the questions and so they are locked up too fast to answer to the commenters.  I wouldn't necessarily take that view on any other stack site, but meta's different.
Comment: I didn't say it was the wrong place to bring it up; I meant that on meta, the closing reasons are used a little differently.  Just like voting on meta is different (implies agreement/disagreement rather than implying a good/bad answer).  SO/etc. are fact-based, so questions are either duplicates or they aren't.  Meta is about discussion largely, so questions can be not exactly duplicates, but rehashing the same general ground over and over again with various proposals that are similar but not identical is not necessarily valuable to the community, either.
Comment: @Joe Gotcha, fair enough, but don't you think 4 years might be enough time between discussions?  Like I said to Richard, I understand the need for a hard line, but that doesn't mean there aren't CON's to that approach which end up burying good content. We live in a world of grey and it seems that SO is trying to "paint it black" ;) Good luck with that.


Does its gravity field compress when an object travels at almost the speed of light?

Question: Since gravity propagates at the speed of light, what happens to an object's field of gravity if the object travels very near to the speed of light (like 99.99999%)? Does it stop propagating forward, and only propagates to the sides and behind? And is this also what happens to the tiny gravity of a photon? And wouldn't this mean that the gravity of near-lightspeed objects and photons does not fully (but only partially) join the cumulative and continuous effect of gravitation on a cosmic scale, since no gravity is projected ahead of them...? And finally, are there any popular science books that go into these things: fundamental properties of objects travelling very close to lightspeed, and the specific gravitational properties of photons? Thank you.
Comment: It may be a good idea to separate out the last part of your question (popscience books) into  a separate thread. Check out our [policy for resource recommendations](https://physics.meta.stackexchange.com/questions/4697/are-resource-recommendations-allowed/4698#4698). If you do that, you'll need to add the [tag:resource-recommendation] and make it a community wiki.
Comment: And this isn't to deter you or anything, but sometimes we tend to be a bit hostile about the quality and reliability of popsci books. You'll frequently find that the math in real textbooks isn't as excruciating as it looks (though it isn't easy, or at least for me it isn't).
Answer: to your question, let's take the case of particles with rest mass first.
Let's take a neutrino, and see what happens to the gravitational field it (its stress-energy) creates and how it propagates to its sides, behind it and forward.
Well, actually to the sides and behind was not your question, but as per SR, massless particles (photons) seem to travel at c from all inertial reference frames, regardless of the speed of the frame.
In this case, thought the neutrino travels at almost light speed, it still creates a gravitational field around it, and the gravitational field as you say propagates with speed c.
From the inertial frame of reference of the neutrino, it will seem as the gravitons (or the gravitational field propagates with speed c) forward.
So although the neutrino itself travels near speed c, it will see the gravitational field in front of it propagate with speed c.
This is like to say that since gravitons are massless, and travel at speed c, SR rules apply to them the same way as to photons.
So gravitons will seem (or the gravitation effects) to propagate at speed c from all inertial reference frames.
Comment: Unless I've overlooked something, those references only discuss gravitons in a rest frame.  I think the question is really directed at the apparent *shape* of the gravitational field of a particle moving at relativistic speed relative to an observer: whether or not the gravitational field appears radially symmetric.  It's a good question: does the gravitational field appear distorted due to Lorentz contraction, same as the electric field around a charged particle?  I assume it does, but don't know.
Comment: Please provide a reference--
Comment: https://arxiv.org/pdf/gr-qc/0607045.pdf
Comment: https://www.researchgate.net/publication/243311274_Gravitons_in_Minkowski_space-time_Interactions_and_results_of_astrophysical_interest
Answer: It is important to note that in special relativity, all objects that travel at the speed do so in every inertial reference frame, including other inertial frames that are themselves traveling at the speed of light. The photon "observes" gravitons radiating away from it (if indeed that picture is accurate) at the speed of light, because in it's reference frame it is at rest. Likewise the gravitons that affects it coming from other objects, are "seen" to approach it at the speed of light. And so it's response to gravity in its reference frame is identical to an object experience gravity at rest. It is only when observing the photon interacting with the graviton from an outside reference frame that any peculiarity is noticed.


Which is right on number agreement?

Question:
"And what are Slytherin and Hufflepuff?"  "School houses. (1)
  There's four. Everyone says Hufflepuff (2) are a lot o' duffers, but --"  (Harry Potter and the Sorcerer's Stone)

I guess, there're is grammatically proper instead of (1)-there's; but I'm not sure for (2)-are. Because are can be used except when Hufflepuff is regarded as a collective noun, I think. Would you let me know how to use the verb grammatically right?
Comment: This is a question of dialect. (1) _There's four_ is the way native Anglophones use the language. Of course it's grammatically incorrect, but it's idiomatic spoken & informal written English: idiom (oil) & grammar (water) don't mix. (2) _Everyone says Hufflepuff **are** a lot o' duffers_ is unexceptional in British English, but it'd more than likely not be said or written in American English. We'd say _Everyone says Hufflepuff **is/has** a lot of duffers_. It's a Q of how one perceives Hufflepuff: as a singular collective (use **is**) or a collection of individuals (use **are**). Both are OK.
Comment: @Bill Franke: It's not obvious to me that *there's = there are* is any more "grammatically incorrect" than *ain't = **am** not*, as in *"I ain't convinced"*.
Comment: @Fumble: If you get a choice on the IELTS between "**There's** ten men in the room" & "**There are** ten men in the room", the correct answer is clear: "**There are**". What's _grammatically correct_ is based on the standard dialect, which means the prestige dialect, which means the dialect that's tested by the TOEFL, TOEIC, & IELTS. They don't test for knowledge of local, regional, or substandard dialects. I don't teach local, regional, or substandard dialects except to explain that stuff like "There's 10 men in the room" & "I ain't misbehavin'" are idiomatic somewhere or other & informal.
Comment: @Fumble: And don't forget that my prime concern is with **formal written prose** (standardized English tests, academic journals, high-quality books that actually get copy edited, dissertations & theses, & perhaps the business reports in a few companies around the world), because that's the only linguistic arena that comes with style manuals & rules galore. The spoken language & the informal written language is much like the Roman Colosseum in its Lions versus the Christians heyday: bloody awfully unregulated & grammatically gory ("Murder most foul, as in the best it is.").
Answer: As said in the answers for this question, there's is often used in spoken English to mean there are.
Hufflepuff (which is the name of a school house) is used in that sentence to mean all the people who go to that school.

Which is right on number agreement?


Help understanding bridge settings

Question: I can't understand how to best tune my slicer settings in order to get better bridges...
I've downloaded a simple test off thingiverse and printed at different speeds.
Here are the results, bridging tests (youtube link).
On the left we can see that going at a slow (10 mm/s) speed results in a very poor first layer.
On the right at Slic3r Auto setting which I believe is 60 mm/s is better but there are still a few strings hanging...
The middle one is printed at 30 mm/s and looks the best.
On the one hand I was expecting faster = better because the plastic wouldn't have time to fall, but I once saw a video somewhere off a printer bridging at 10 mm/s and it came out flawless!
So I decided to do some testing of my own and now I'm more confused than before.
Why did the 30 mm/s turn out better than the others and how can I improve my bridging?
Comment: Nice video... I edited your question to try to inline the video, but, unfortunately, it doesn't appear to work. see on Meta - [Is the "inlining videos" capability turned off on this site?](https://3dprinting.meta.stackexchange.com/questions/226/is-the-inlining-videos-capability-turned-off-on-this-site).
Answer: The engineering approach is that if 30mm/s is working best on your equipment (at least on that day), you should use it; at least until it doesn't work so well for you. You might also try more different speeds (closer to 30 than to 10 or the assumed 60) in case one works even better than 30mm/s - though you might also want to question the assumed 60 (or test a set 60) since assumptions can bite you.
There's not going to be a fixed speed that's always best independent of the printer - everything is dependent on the printer, and its environment - if the temperature of the room varies a lot, it could change the "best setting" on days of different room temperatures. Perhaps the "10mm/s" that you saw working well was using a more effective cooling fan while bridging, or had other differences from your particular unit - or had different settings (other than speed - nozzle temperature, for instance) which impacted the result.
(note that I have limited tolerance for videos, and have not actually looked at yours, so if you're going to come back with "but I don't have a cooling fan", please post a picture of the printer or results that does not involve needing to sit through a video. And perhaps add a cooling fan...)
As for "understanding how to best tune your slicer settings" - far more testing, and keep track of the results. So, do tests (without altering other parameters) at 20, 25, 35, 40, 45, 50, 55 mm/s.
Depending on the results of those tests, say you find the best results at 35-40mm/s, perhaps you try 47 and compare that. Perhaps there's no real difference between the 3, so it's in that range, but not picky.
Then alter one other thing (nozzle temperature comes to mind first, but perhaps it's "fan speed for bridging" or some other, single, item) and do more testing - likely the best speed will change, so you'll need to re-run a range of speeds at the new setting. And keep track of which results (test prints) go with which settings, so you can go back to the ones that work best. Then alter that parameter more, or alter another parameter.
For the most part, there comes a point where it's good enough, or at least where you're sick of testing for a while and results are good enough until you want to test / tune some more.
If you change many things at once, it's hard to isolate cause and effect. If you test many settings but lose track of which settings were used for what result, it can be hard to progess towards better results consistently. When you find a range that seems to make no difference (and it's as good as it gets), be happy that the parameter is not too sensitive, and tend towards the middle of it.
Comment: While I would generally agree with your comment about videos, to be fair to the OP, the video is actually quite interesting, as it has three simultaneous prints shown, side by side.It makes for an interesting watch. Also, there doesn't appear to be a cooling fan, but it is a bit hard to tell as the video is quite dark.
Comment: I filmed against the light on purpose, so the filament dropping would be as clear as possible. Also it has a cooling fan and a ring shaped air duct I got off thingiverse.
Comment: Even though I tried my best to describe the video, I put it on the question for a reason, which was to give as much information as possible. Your answer seems to be very much "30 mm/s works better because it works better". So even though you give some tips on how to improve bridging the "why" part of the question doesn't seem answered...
Comment: One more thing, could you please elaborate on what is a "more effective cooling fan for bridging"? Size, speed, orientation, etc
Comment: A "more effective cooling fan" is not some specific set of specs standing in a field by itself - it's one that does *a better job* than *whatever you are currently using* - if, indeed, there's even any benefit to bridging 3 times slower than a relatively slow 30mm/s. When tuning a complex system with many variables, (which a typical 3D printer is) many factors impact the outcome. You varied one parameter (rather coarsely), but you had many other parameters - and the fact remains that 30mm/s worked best (of the settings you have tested so far) for where those other parameters were set.
Comment: Changing other parameters (nozzle temperature, size, etc.) will most likely alter where the "best" behavior sets in your printer, and would entail further experiments to find those best settings with the changed parameter. You may be running into things like "how fast will the extruder extrude (at a given temperature, with a given filament) as limits in your "faster should be better" direction. But it may also be that "faster is better" is simplistic and not a good hypothesis. I'm improving print quality on my cheap-junk printer by by limiting acceleration, to limit shaking.

Help understanding bridge settings


Why is the swelling of bread when placed in water not considered to be caused by osmosis?

Question: Why is bread swelling up when placed in water not considered to be caused by osmosis?
Is there a property of water that should make it leave the bread instead of enter?
Comment: Osmosis refers specifically to the diffusion of water across a semi-permeable membrane.
Comment: I'm not sure what your last sentence means. The bread is absorbing the water.
Answer: The phenomena that you are describing, where bread, which is a porous material, similar to a sponge, absorbs water, is the absorption of water by capillary action.
As @Joel mentioned, osmosis is specifically the flow of a fluid across a semipermeable membrane, such as the plasma membrane of a cell or dialysis tubing, that occurs in such a way as to cause a flow from an area of low concentration to an area of high concentration. This flow eventually leads to a state of equilibrium when the concentration on both sides of the membrane is the same.
The wikipedia article on Osmosis gives this definition:

Osmosis is the spontaneous net movement of solvent molecules through a semi-permeable membrane into a region of higher solute concentration, in the direction that tends to equalize the solute concentrations on the two sides. It may also be used to describe a physical process in which any solvent moves across a semipermeable membrane (permeable to the solvent, but not the solute) separating two solutions of different concentrations. Osmosis can be made to do work.
- Wikipedia: Osmosis

- By OpenStax College [CC BY 3.0 (http://creativecommons.org/licenses/by/3.0)], via Wikimedia Commons
The bread is not selectively permeable, and it will continue to absorb liquid until it is fully saturated. This isn't actually an equilibrium, because additional water would do nothing to change the concentration on one side of the bread or the other. If you added more water to one side of a semipermeable membrane in equilibrium, by Le Chatelier's principle, you are will force the reaction (in this case, you change the concentration) to one side, then the liquid would again flow from the area of low concentration to the area of high concentration.
Capillary action is the result of water flowing into the small spaces, such as the air bubble that form in bread when it bakes, in the absence of a force "pushing" it into those spaces, or against the force of gravity. The liquid accomplishes this through intermolecular forces that cause adhesion of the molecule to the surface of the material that is absorbing it and cohesion of the molecules in the liquid keep them associated to one another, and as the liquid moves into the spaces, it is able to pull the other liquid molecules along into the space.


How does a gentile annul a vow?

Question: How does a gentile annul a vow? Also, do gentiles have equal laws of oaths to Jews? Thank you
Comment: @JoshK https://judaism.stackexchange.com/a/44668/15256 ?
Comment: We have this question as "how does a Ben Noach annul an oath" and the answer reached (if memory serves) is "keeping an oath is not one of the 7 Noahide laws". I am unable to find that question now, however
Comment: I remember seeing a teshuva from Rav Yitzchak Zilberstein, that brought a proof that even gentiles are bound by their vows from Jonah 1:16, where it says that the gentiles on the ship made vows. He explains that the verse would not have mentioned their vows if they had no halachic significance. Not sure If I'll be able to find that teshuva, though.
Answer: Encyclopedia Talmudis [volume 3 page 357 beginning of page, and page 310 last paragraph of 1st column] brings that some authorities want to say that gentiles are obligated to keep their vows.
This answers the second half of our question - do gentiles have equal laws of oaths to Jews?
However, the first part is - How does a gentile annul a vow? That is not answered. The reason it's not answered is that even if they are not absolutely obligated in keeping an oath, it's obviously very immoral not to. The Rambam actually implies [Melachim, 10, 10. (That's in Shoftim which is in his Mishneh Torah)] that it is praiseworthy for a gentile to keep as many of the mitzvos as he can. (Besides for a few which he may not - Shabbos, maybe learning most parts of Torah.)
The Talmud Yerushalmi in Nazir 9;1 brings a dispute if Gentiles can annul vows. R' Yonah says no and R' Yosi says yes.
According to the opinion that they can annul, it's the same process as by Jews. As the Rambam quoted above writes, a Gentile who does mitzvos, does them כהלכתה - the same as a Jew. Although we find some exceptions, wherever we don't find that there is an exception, we have the Rambam that says it is the same.

How does a gentile annul a vow?


can a flame raise the temperature of an object higher than itself?

Question: For example, propane burns in air at 1980 deg C. If an ingot of metal is placed in an insulated container with a hole in the side and a propane flame is directed through that hole, then the metal will heat up. Eventually the metal will approach the temperature of the flame. One might argue that radiative loss of heat out through the hole will equal input of heat when the temperature inside the chamber is equal to the flame. However, the combustion of propane has a certain velocity and the reaction that generates the heat is being 'pumped' into the chamber. Can the temperature inside the chamber rise above the temperature of the combustion reaction since kinetic energy is being continually added to the molecules in the chamber?
Comment: The heat flow would decrease as the two temperatures approached one another, if somehow the ingot was hotter than the flame, heat would be flowing back toward the flame, which demonstrates that the temperature cannot cross that threshold. If you're compressing the gas continually into the chamber the work done would indeed further raise the temperature but this is a separate energy being added
Answer: Temperature doesn't have an inertia; you can't "gain" on heat transfer induced by a temperature difference to make the lower-temperature system get hotter than the higher-temperature system.
Here, the higher temperature (i.e., the adiabatic flame temperature) is determined by the need to heat the combustion products of propane; this energy use is intrinsic to the burning process and can't be avoided as long as the propane continues to burn in air.
(Note that I'm assuming that the bulk gas velocity is negligible, as would be the case with a typical propane torch. In other words, I'm not considering the stagnation temperature increase from some type of very high-speed jet because it doesn't seem to be the focus of your question. If you wish, however, you can estimate that temperature increase using the link; it appears that the bulk gas velocity would have to be very large indeed for a temperature increase of just a few degrees.)
Comment: wow, the stagnation temperature is the concept i was imagining. I was surprised to discover that T(stag)/T(static) is a function of the square of the Mach number. but then again the velocity of burning propane is ~50 cm/s =~ 1800 kilometer/h  = Mach 1.4 So, yes, the temperature of the ingot would rise above the temp of the burning propane. Thank you for the reference


AC power fluctuation microwave oven

Question: I think this is an electricity question:  When I start my microwave, it starts normally the motor revs down drastically, then back up to normal, then stops.  ..a total of about 10-15 seconds.  Thinking the microwave was shot, I bought a new one.  Same results.  What could be the cause?
Comment: That it stops and starts during operation is actually normal. Does it start again when you let it continue?
Answer: What you are observing is the klystron (or other magnetron) tube (the microwave generator) being cycled on and off.  Most home microwave ovens cycle the generator on and off to allow the heated regions of the food to disperse the heat more evenly throughout the entire mass.    In fact, on those models where you select "%heating" the duty cycle changes, not the actual output power.
Next time,  before tossing your microwave, observe the results: does it boil a cup of water as quickly as it did when new?  Basically, unless it doesn't heat the water at all, it's still working.

AC power fluctuation microwave oven


Will high voltage but low current glow a bulb?

Question: Suppose I increase the voltage supplied to a building from a constant power source substantially by putting a transformer. Doing this would reduce the current substantially as well. So will the building's electronics still work?
Comment: You've gone from a bulb in the title to an entire building in the detail. But that aside, did you really mean a *constant **power** source* because if so then I have an answer that's very different to the ones already there (not got time to write it just yet though). If you meant the power supply was a constant **voltage** source (with negligible source impedance) then see Elio's answer.
Answer: $\def\Ip{I_{\rm pr}} \def\Is{I_{\rm sec}}$
You're doing a very common mistake. It's totally false that to

increase the voltage supplied to a building from a constant power
  source substantially by putting a transformer[...] would reduce the
  current substantially

The effect would be to burn every electrical equipment connected to
that building's mains.
You're not alone in holding the false belief that if a transformer
increases voltage than it decreases current. Things are rather
different. It's true that in an upward transformer
$V$(secondary) $>$ $V$(primary) and $I$(secondary) $<$ $I$(primary).
But if voltages are given, currents are determined by load.
Assume a simple load, a resistor $R$. If you connect it to primary
source $V_1$ the current will be $I=V_1/R$. Now install your
transformer, say with an upward ratio $V_2/V_1=k>1$. If $R$ is
connected to secondary, current will become
$$\Is = V_2/R = k\,V_1/R = k\,I.$$
It will increase, not decrease!
As to primary current you'll have
$$\Ip = k\,\Is = k^2 I.$$
Let's compute the dissipated power $W=I^2 R$.

without transformer $W = V_1^2 / R$
with transformer $W = V_2^2 / R = k^2 V_1^2 / R.$

If $k$ is substantially greater than 1 (say 1.2) the power will
increase by a factor $k^2 = 1.44$. Very few appliances - if any - would withstand the test.
Answer: There are some pieces of electronics that need an alternated current to work, so they would not work anymore with a constant voltage. The electronics that uses a transformer already will work if you can connect it without its transformer and if you can provide the exact voltage they need.


How to get original user token? UAC, manifest, installer

Question: We have a program with manifest attached and option "level="requireAdministrator".
After program launched under standard user(not as admin), its elevating to admin user and from that moment SHGetFolderPath(0,CSIDL_LOCAL_APPDATA,0,SHGFP_TYPE_CURRENT,@buf)) returns admin local directory but not user's where it was originally started.
Of course we could pass standard user token as third parameter to SHGetFolderPath but how we can get it in elevated program? Is there any way to do it?
Of course because of this problem we have another question. How to start another program with ShellExecute not as admin in elevated program? Of course we could use CreateProcessWithTokenW  but still the problem with token exists(how to get this token).
Right now we looking for IShellDispatch2 interface and try to start application not as administrator using explorer, but something tells me that this is wrong way.
I know that we have to start program as standard user then using com objects elevate only parts of code which should be executed with admin's rights. But still, the main question is with token.
Also there was an idea to make manifest with "level="asInvoker" and start first program as standard user, detect all local user paths and pass it as parameters to ShellExecuteEx with runas and SEE_MASK_NOCLOSEPROCESS options and run the same program but as admin. After the elevated program will exit we can execute any program from not elevated program not as admin. Is this right way?
Answer: From Raymond Chen:

How can I launch an unelevated process from my elevated process and vice versa?
Going from an unelevated process to an elevated process is easy. You can run a process with elevation by passing the runas verb to ShellExecute or ShellExecuteEx.
Going the other way is trickier. For one thing, it's really hard to munge your token to remove the elevation nature properly. And for another thing, even if you could do it, it's not the right thing to do, because the unelevated user may be different from the elevated user.
The solution here is to go back to Explorer and ask Explorer to launch the program for you. Since Explorer is running as the original unelevated user, the program will run as the original unelevated user.

i tried to translate the code out of C++, but it got too hairy to manage.
The short version is: it's very hard.
Answer: Maybe a little late, but your alternative option is the right way to go. Once the program is elevated, there is no reliable way of starting yet another program but without the elevation, or even know what user started it, if it was done with different credentials.
The general solution to all those problems is to split the program in 2 different processes (which may be implemented in 1 or 2 different .EXEs, as you like). The "main" program, the one that the user runs, runs without elevation, manifested as asInvoker, and it in turn launches the second "worker" process, manifested as requireAdministrator. The main one can pass the data from the original user to the second by means of command line, unnamed pipes, window messages or any other form of IPC while the worker process does all the admin-only stuff. Possibly you may want to notify back to the main process when it's time to spawn another non-elevated program.


How high of a structure can I build for growing hops

Question: I would like to grow hops for home brewing and can't find any information on how high of an agricultural structure I can build without a permit, the people I am getting the rhizomes from say "16-18ft", Can I build something that high legaly? Safely? Would 2x4s anchored into the ground and set up in a tripod be smart?
Answer: This is probably a Local Authority Having Jurisdiction (LAHJ) question - ie, your town or county or (heaven help you if subject to) homeowners association.
In my town agricultural structures (they intend barns and silos but say agricultural structures..) are exempt from height restrictions (I suppose the FAA would horn in if somebody built a silo more than 200 feet tall, and make them put a light on top of it. Hasn't been an issue yet.)
They can be built safely. I don't know if you can built one safely, only you know that, or you will eventually, anyway.
For what it's worth, one of the simplest to build structures is also pretty functional - the "flagpole/maypole" approach where you put up a central pole and circle it with plants. Trying to replicate the commercial hopyard high-wire grid is a lot more complicated. Tettnang, Saaz, Halletaur, Fuggles here (I managed to kill a Cascade, somehow...)
Pulleys on the eaves of a two story house with the plants out in front can also work with no real structure building called for.


Drag down while sketching toggles layer?

Question: Sorry if it seems like a simple(stupid) question, but when I'm sketching or doing anything with a brush or any tool, Drag down, Drag up, Left, and Right all toggle my layers. it is a VERY annoying problem. I've searched for the answer but have found nothing. I looked in Krita settings and didn't find it there or on my tablet settings as well.
Comment: Hi. Welcome to GDSE. Unfortunately I can't replicate the problem. How are you navigating around the document?  There are a couple of ways to move around a document while drawing, either use the Space bar and then drag, or use the centre mouse button to drag (or it's equivalent if you are using a graphics tablet).
Answer: I found the problem. It was a Windows setting dealing with flicks. I turned flicks off in the Pen and Touch options.


How to check if a sample is representative of a population, across several criteria.

Question: I have a total population of several hundred houses, which have different sizes, prices, and ages.
I want to be able to select a random sample, of a few dozen or so houses, and test how representative they are of the entire portfolio. Critically, I want the comparisons to be across all the variables, not just comparing prices for example. Is there some sort of test which will give me a P value on how confident I am that my random sample is representative of the portfolio?
I'm sure this is probably a trivial question, but I'm a novice statistician, and was hoping for some advice on the best way to do this.
Thank you kindly.
Answer: You have several choices:  multivariate analysis of variance (MANOVA), logistic regression, and discriminant analysis might all work.  Using any of these you could test how well the features (size, price, age, etc.) can discriminate between each subset of houses.  You will be able to obtain a p-value telling to what extent group differences exist that are unusual given the fact that both groups were chosen randomly from the same population.
[EDIT]  It's not as if that p-value will help you decide whether chance was at play -- you'll know that it was, having sampled randomly.  But in your case, the p will, indirectly, say something about the magnitude of the differences.  Problem is, it'll be highly affected by sample size, so you might be better off assessing the magnitude of those differences directly.  I.e., you can simply ask how large is the group difference in mean size, price, age, etc. -- probably in terms of an effect-size indicator such as Cohen's d.  This will express a mean difference while taking into account the within-group variability.
You might also want to look into measures of similarity or of distance.  There are many methods of characterizing distance in multivariate space.


How can I delete ALL of my For Glory Stats?

Question: This includes my wins, loses, everything that is saved after a finished For Glory match. I do not however want any data that has to do with the Wii U itself, just data for the game that is stored on the Wii U.
Answer: You can't erase specific datas. It's an all-inclusive dataset.
Answer: In Super Smash Brothers for Wii U (and 3DS) there is only the nuclear option, which is going into system settings and deleting game data. This would wipe all earned characters, stages, everything.
You cannot erase For Glory data unless you also erase everything else.


How to complete the puzzle in the "Highest Point" room?

Question: I am trying to complete the puzzle on the highest point room to get the red gun. I think I'm controlling the yellow gun wrong. Is there a way to drag through glass that I'm not getting?
Answer: You need lots of cubes since you cannot drag through glasses.
The yellow gun has a cool ability:

aim at a yellow block,
press and hold middle-click,
aim at a place where there is no block,
finally release all the keys pressed,
the connected yellow blocks will behave like a 3D snake
the snake will try to move in a straight line to the position you had indicated.

Make sure the snake enters through a big hole in the glass and then drag it using the tail of the snake, which should still be hanging out of the glass window through the entry hole.
An interesting property of the middle-click action is that while you hold it, you can move your cursor from one yellow block to another, and what matters is only the yellow block your cursor is on when you release the key pressed.
In summary:

make sure you have a sufficiently long snake
aim at a block outside the pane window
drag your cursor to a block inside the pane window
move this block to a new position
Answer: The trick is to change which block you are "pulling on"

aim at a yellow block on the tail sticking out
press and hold middle-click
aim at another yellow block
focus will now change to pull on that block (see the rings)
aim where you want them to go and release.
Comment: It is important to note that while the first block can not be behind glass, the second can.
Answer: Im at the same point and i think i have just figured it out. You want to get close to the glass so you aim slightly behind it. You need to aim at an available yellow block, then drag your mouse to the one closest the wire you are trying to activate.
You then drag the yellow blocks into a circle to create new ones. Tricky.


Is this correct to say : "This country's economy is at stake with its oil revenues"

Question: I have searched Google and there are more than 200.000 cases using "at stake with". But, I'm dubious about the phrase "at stake with", here I want to say that the economy is depended gravely on the oil revenues.
Comment: We can say "Falling oil revenues put the country's economy at stake".  That is, the economy is put at risk by the falling revenues.  But the economy is not "at stake with" the revenues.   IMO, the quoted sentence is not idiomatic.
Comment: Why are you dubious? And if you want to say the economy is dependent on its oil revenues, why not just say exactly that?
Comment: In my Analytical Writing GRE, I'm behooved to use many different structures.  So,  I wanted to know whether this structure is correct.
Answer: "At stake" would imply that their revenues are in danger of failing in the near future…

The country's economy is at stake if falling oil revenues continue

You perhaps want "staked in" which still implies some kind of gamble..

The country has staked all its investments in oil production

If you simply want to say they are highly dependent on oil, with no immediate danger of that revenue going away any time soon, then

The country is highly dependent on its oil revenues

would feel a much calmer statement, though still acknowledging that if in the unlikely event of those revenues failing, they would still be in some trouble.
Answer: Is there anything wrong with saying your meaning?  That is: "The country's economy depends gravely on its oil revenues"?  Gravely is an odd word choice but the sentence makes perfect sense.  A more common word for the sentiment you're trying to get across would probably be "heavily".
Using "at stake with" implies an immediacy to the statement and also leads to questions to fully understand the meaning, which requires information not present in your original statement.
To explain that, "at stake" can mean "at risk" or "could be lost", so if you substitute that meaning into your opening statement: "The country's economy is at risk." someone listening would want to know "Why is the economy at risk?".  However, "Its oil revenues" doesn't fully answer that question and just leads to another question: "What about the oil revenues?".  You could say "The oil revenues are dropping." or that they're too low and that would complete the statement.  Saying "The country's economy is at stake, with its oil revenues dropping" works, though it feels a bit clunky to American English.  Inverting it to say "With its oil revenues dropping, the country's economy is at stake." flows much more naturally from cause to effect.
You could say "the economy is staked on oil revenues" or "The country has staked the economy on its oil revenues", which implies that the country has wagered its economy on oil and now depends on it.  Using "staked" also implies the economy would be lost if oil revenues were ever lost.
However, it's the wrong statement to make if you just want to say the economy depends on oil revenues as the original statement that the economy depends on oil revenues has a much weaker link between the two and implies far less dire consequences.
Comment: +1 *At stake* is a metaphor derived from gambling: the *stakes* in a game or wager is whatever money or value may be lost or won, which is said to be ***at** stake **in*** the game.
Answer: It's not the only interpretation, but I read "This country's economy is at stake with its oil revenues" to mean, "This country's oil revenues are at stake, and the economy is at stake along with them".
That is to say, there is some risk/peril to the oil revenues, allegedly the risk was entered into through a specific decision in hope of gain (since otherwise it's not "at stake", the gambling analogy doesn't apply, it's merely "under threat"). Also, the economy as a whole will be won or lost along with the oil revenues.
If the oil revenues aren't "at stake", merely "under threat", then I'd say it's better not to say something is "at stake with them". Granted, this is a pedantic point, because the difference between "being at stake" and "being threatened" is often negligible. But if you want to be really precise in what you're saying, then you'd have to account for it.
If you mean to say that the economy depends on the oil revenues, and that allowing that dependency to exist is a knowing risk, then you could say "The county's economy is staked on its oil revenues".
Answer: First, I agree with you. This is an awkward construction--one that seems as if it ought to work, but doesn't. You need to have either an agent that's placing the economy at stake (use "due to" or "from" and indicate what has changed to place the economy at stake) or you need to switch from "is at stake" to "has been staked".  Examples:
   "This country's economy is at stake due to (rising?  falling?) oil revenues"  or  "This country's  economy has been staked on oil revenues."
However, I'm seeing another issue: the use of the word "revenues." If you're talking about the U.S., I suspect you mean oil prices.  Revenue refers to income. Oil companies receive revenues from the sale of oil. The U.S. as a whole does not.  Example of one way to change this:
   "This country's economy has been placed at stake by rising oil prices."
If you're referring to another country, one with a government that directly receives income from the sale of oil, you still need to say what's happening to the revenue to place the economy at stake:
   "This country's economy is at stake due to the steep decline of oil revenue"  or  "The steep decline in oil revenue places the entire economy at stake."


Can I use the VHS Logo for a commercial Artwork?

Question: I'm planning to make an artwork as a spotify sonng cover with a VHS style and I was wondering if I could have used this logo for this job:
https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/VHS_logo.svg/1200px-VHS_logo.svg.png
Comment: I'm voting to close this question as off-topic because it's a legal question.  Sorry about that.
Answer: I would say no.
The VHS logo seems to be registered as a trademark under JVC - a japanese company later purchased by Panasonic.
Not sure how the review process works on Spotify, but they will likely not publish artwork which would include recognizable logos.


It is possible to receive an alert when we have an action planified?

Question: I would like to receive a notification when I plan a future action in Civicase ? For exemple, if I plan to call a prospect next monday, is it possible to have at 9 am an alert on the following monday telling me that I have to do this specific call ? It is possible ? It is possible to receive the alterts on Slack or Google Agenda ?
Should I had an extension ?
Thank you for your answer
Answer: Have you tried scheduled reminders? It can be based on activities. See https://docs.civicrm.org/user/en/latest/email/scheduled-reminders/
Answer: Another option for sending reminders where Scheduled Reminders do not apply is via CiviRules


Handling Dependent Source in an RLC Circuit

Question:
Confused on how to handle a dependent source in an RLC parallel circuit. This questions asks me to find the function that describes v(t) and hints that it is an over damped system.
Answer:
Confused on how to handle a dependent source in an RLC parallel
  circuit

This answer mistakenly saw the current controlled voltage source as a current controlled current source so apologies on that and thanks to stretch for pointing y blindness out. I should have realized when R2 didn't come into things. It's the same hint with a hint of a modification.
Hint: -
Start with the voltage source of 80 volts in series with R1. Convert this to a current source in parallel with R1. Now parallel that with the 80i current source. Now you have two current sources in parallel that are additive and hence combine into a single current source in parallel with R1.
I reckon the combined current source has a value of 25.92 amps (80x81/250). Finally, convert back to a voltage source in series with R1. I reckon the voltage source is 6480 volts.
So now you have got rid of the dependent source and replaced it and the 80 volt source with a single voltage in series with a resistor.
Comment: The dependent source is a current controlled *voltage* source.
Comment: @stretch oops. I was never any good on these symbols. OK the thing to do is convert that to a current source in parallel with R2 then add the two current sources and convert to a voltage source using R1 and R2. Basically it's the same methodology.
Comment: I had to look up the symbol. As luck would have it, CircuitLab had it. Like you, I was puzzled by the 80 ohms, and that's what made me look. It's also in Wikipedia.
Answer: The hangup is mostly intuitive, I think. Calculating the Thevenin equivalent of all the circuitry left of the switch is straightforward but seems funny. You're interested in finding, first, a circuit with the same open circuit voltage. i in that case flows backwards through the dependent source. The loop current is 195 ma. and Voc is 31.2.  Then you want to find the short circuit current. It's 80/250 from the left source and resistor, plus (80/250 * 80)/80 from the right (dependent) source and 80 ohm resistor: 640 milliamps total. Solving for the equivalent resistance: 31.2/.64 = 48.8 ohms.

simulate this circuit – Schematic created using CircuitLab
Comment: When there is no load, the dependent voltage source still has a voltage, therefore the open circuit voltage Vth is not 80V.
Comment: @rioraxe I'm not sure it's exactly what you meant, but the values *are* wrong. I assumed that current flowing backwards through the dependent source would cause its voltage to oppose/stop it. Faulty intuition. I corrected the answer.


Adding Pages on One Note

Question: Is it possible to add pages within Pages on OneNote. I have added a Certain Section and within that section I have a certain Page that I would like a page two, or another page within that page to where I do not have to add another page under the section itself....if that makes sense.
Answer: I'm not quite sure if that is what you meant, but you can create some kind of "subpages" in the sidebar, just like this example: "Chapter 1.2" and "Chapter 1.2.1" (the numeration to clarify). Just drag the page in the sidebar a bit to the right and it will automatically indent.
Comment: To better Clarify my issues: Ok I am creating a Training in OneNote for my  IT company. I have a section named Troubleshooting, within that section I have a page named Gaming I have multiple subpages with different games and how to resolve said issues. But what I want is to add more information in the Gaming Page but not to where its all clustered. I am needing to add a page 2 inside the Gaming page, rather than creating more subpages.
Comment: @Brandy Just like "tabs" inside the page? I'm sorry I do not know such a thing. Why are you using OneNote? Maybe there is such a feature, but probably I would have used other tools. OneNote is a great tool for taking and sorting notes, handwriting and other informations but creating complex structures is difficult
Comment: It a company site that is why we use OneNote but I was just wondering if it was possible lol but thank you for the advice

Adding Pages on One Note


Is helping others grasp difficult ideas, concepts or theories not considered giving an answer?

Question: I know you could just leave a comment, but not in this case I couldn't. I just found this awesome app while researching on my passion, physics. I stumbled across a question about time dilation, not the easiest concept to grasp, and a commenter had his own question within his comment, just wasn't  looking at the answer correctly. So, I stared at this screen, going to different links forever and it was impossible since I have no, "points", since I just signed up. I clicked on, "answer" and FINALLY, it let me speak. Intellectual curiosity is an amazing thing. Well, next thing I know, I got my first comment and flag all in one. All you scientists know how important it is for more and more people to have a scientific world view if we're planning on living on this planet for much longer. So I gave him an easy layman's answer to fully understand the answer.  We all know you don't have to know the math to have that burning curiosity of the unknown, and the want to understand and wrap your mind around things you had no idea was wrappable. I believe I gave this user a just as valid answer as the mathematical answer. Do you?
Comment: The way to progress on this site , i.e. to get enough reputation not to have difficulties, is two fold. a) you can ask questions about some physics subject or b) answer questions on physics subjects ( not just comment) or both.
Comment: @Nicolle: Your question has been moved to Meta.Physics.SE, which is where discussions about the site occur. Here, votes (up or down) do not affect your reputation but represent agreement (upvote) or disagreement (downvote) with your statement.
Answer: Anything which answers the posted question should be posted as an answer; anything which does not, should not. It's that simple. (Although there are cases in which it's debatable whether a post answers the question.)
The post you made here (which I'm guessing is the one you are asking about) does not answer the question, and should not have been posted as an answer. The fact that you addressed your post to someone who is not the asker is a dead giveaway.
Answer: I don't know why you are making a non-issue an issue. I probably guess that you have answered to the asker who haven't actually asked the question & a question that actually wasn't matching the OP's question. You have every right to explain the physics to a layman _ we are not having a problem with that, nor we discourage anyone to answer anyone's question. However, since the question was not the same to that of OP, you could probably comment to him/her; oh! you are a new user - then you have to bid your time:)
Comment: @Nicolle Dransfeldt: I on behalf of the community apologise for anything that has vexed you, but there are some rules which you have to follow here. I am reiterating that we don't discourage anyone to ask nor anyone to answer, after all we are here for that. Just answer one good question or ask some & earn the point to help those sideby-commenters. This is quite easy as there are many naive questions to be answered for earning decent votes. So, I don't think this predicament can make you hate such an excellent community:>
Comment: Okay obviously you're the one who likes issues. And it I'm just talking. I've never been on this site before, ever. I found it by researching the topic of that question I stumbled upon. I noticed that someone didn't understand the answer the math equation gave and so I explained it. Now that I've been bitched at over and over again I realize this place is nothing like reddit, which is what I was thinking based on the one page I was at. I was under the impression that it was a place to talk about interests and/or professions. everybody freaking out about a discussion I was trying to have.
Comment: It's clearly not a place to discuss stuff, everybody takes it so seriously. I don't get what is so bad about explaining something to a side commenter through an answer when I wasn't "allowed"  to comment. Here's some basic psychology: since I'm a human being, I saw someone that needed some help understanding something, and since I figured an easy way for them to get it, and I get so excited to talk about physics, I'm going to school for 8 years for it for God's sake. OF COURSE I'M GONNA FIND ANY WAY I CANNOT TO EXPLAIN IT TO THEM! I have a human brain, and a very strong passion,youdothemath
Comment: @Nicolle Dransfeldt : It is not your fault though. If anyone has problem , he can ask his very own question. If you remain here, you will comprehend easily why everyone should follow the rules of the site; after all they are for the sake of the development & well-being of the site-the community. Thank you , nevertheless, for sharing your feedback.


Why do US lawmakers attach amendments to the US Constitution instead of directly changing its text?

Question: The US Constitution now has 27 amendments. I noticed that these amendments are "attachments" to the original US Constitution. Why don't the constitutional amendments directly modify the text of the original US Constitution? This seems to be different from how other laws are modified, where bills propose to modify the text of existing laws. Is there a legal or historical reason for this?
Comment: @NateEldredge There's at least four direct changes: the 20th Amendment changes the start date of Congress. The original text in Article I, Sec. 4, says first Monday in December, the amendment changes it to Jan 3rd. The 17th Amendment changes elections of senators, the original text says "chosen by the Legislature" of each state, and the amendment changes it to "elected by the people". The 12th Amendment makes major changes from the VP being the runner up of the electoral college vote to a separate choice. Finally, the 16th eliminates apportionment of capital gains taxes as direct taxes.
Comment: I don't think any of the 27 amendments would even make sense as modifications to existing text.  They add brand-new provisions instead of changing those that were already there.  For instance, how would you enact the Third Amendment by altering existing text?
Comment: So the only oddity, if any, is that the term "amendment" in this context includes additions to existing text as well as changes, and all amendments to date happen to have been of the "addition" variety.  Surely there could be an amendment such as "Article II, Section 2 is hereby amended by striking the word 'Treaties' and inserting in its place the word 'Cookies'."  But there's never been any call for one.
Answer: The best explanation is "tradition", followed by "Congress does not actually rewrite laws" (it passes laws whose effect changes what counts as the law). Traditionally, Congress would enact some law, then it could later enact a law which effectively modifies existing laws. That modification could be implicit, by stating a new legal fact, which "corrects" some earlier legal fact. For instance, the 6th Congress enacted a law (session I, p. 4: Ch. III in second volume) entitled "An Act supplementary to the act, intituled 'An Act to provide for the valuation of Lands and Dwelling Houses, and the enumeration of slaves, within the United States'", which was enacted by the 5th Congress Ch. LXIX, p. 580. The amendment added a power to the commissioners created by the first act "to revise, adjust and vary valuations". This is done by simply stating a new power, and does not require re-writing the entire earlier text – it was understood that the new act "overrides" the old act.
Contemporary statutory practice (as opposed to constitutional practice) is that congressional acts which revise older laws will state, in some fashion, how the previous law should be edited. Officially speaking, the law "is" the historical sequence of acts of Congress and therefore Congress does not actually rewrite laws (except on some occasions where it does).
An example of an editing instruction enacted by Congress is an amendment to the Immigration and Nationality Act which states that

(n) IMMIGRATION AND NATIONALITY ACT.— (1) Section 411(b) of the
Immigration and Nationality Act (8 U.S.C. 1521(b)) is amended by
striking "and under the general policy guidance of the United States
Coordinator for Refugee Affairs (hereinafter in this chapter referred
to as the 'Coordinator')" and inserting "the Secretary of State".

It is very difficult to keep track of the hundred of thousands of acts of Congress making up the Statutes at Large, therefore we also have the US Code system which effectuates the various historical changes. For the most part, the codified (re-written) laws accurately reflect the complex sequence of statutes passed by Congress. though there was a whoops-moment when
The Act of Sept. 7, 1916, 39 Stat. 753 §92 was omitted from inclusion of the US Code because it was mistakenly thought that that section had been repealed (sorted out in 1993).
Given how few and how autonomous the amendments to the US Constitution have been, there is no compelling need to adopt a "wholesale rewrite" model of amendments for the Constitution, though the election of POTUS is one area where it might make sense to delete previous text (still, it's not difficult to read the whole document, as opposed to reading the entirety of the Statutes at Large).
A wholesale rewriting of the US Constitution is possible, and happened in 1787. This is still a possibility, but not one which gains sufficient popular support. Until there is a sufficiently large call for an actual rewriting of the US Constitution, we will followed this particular method of amending the Constitution.


Can someone Hack my phone personal data using my IP address?

Question: There is "My wifi router" Installed in one of my office PC's. I once connected my nokia lumia 925 to it. That software  "my wifi router" Shows our IP when we get connected. Is there any possibility then any person can hack my phone personal data using my IP address?
Answer: On the mobile side, unless you specifically asked your provider for it, IPs are normally private (NATed) which makes it quite difficult to reach from outside that network.
With the wifi connection, again your connection gets NATed by your router, making the device unreachable directly too.
Finally note that an IP address is a publicly available information and not an attack vector by itself.
Answer: An IP alone is not enough for hacking your phone. And while it doesn't slow an attacker down, the same time it does absolutely nothing to help attacking you.
IP addresses are no secrets, quite the opposite. It's just necessary for any (internet) connection to work. And even if this particular software wouldn't show the address, there are plenty opportuninties to get your IP.
Just don't worry about it.


Application specific users table or mysql.users

Question: I am using a mysql installation that handles an application with multiple users. These users have varying permissions for table access, but also need to be referenced within tables in the application database. For example, I have a manufacturer table that stores the person who manufactured a batch, but different manufacturers have different access to the tables.
If I weren't referencing them within the application tables I would use the mysql.users table to handle permissions, and if I weren't giving users variable permissions then I would use a local users table.
Is there a standard and secure way of handling this sort of situation?
Answer: You want a feature like Oracle Virtual Private Database. Unfortunately MySQL does not have this. There is a similar question with answers at https://stackoverflow.com/questions/5527129/mysql-how-to-do-row-level-security-like-oracles-virtual-private-database.
Comment: @Marco, will be helpful if you edit your answer and add some other information not only the link, so, if others have the same problem, they could easily find the answer.


Does Luke still have his green lightsaber?

Question: I'm referring to his second lightsaber, which he built himself after Episode V, and then used in Return of the Jedi. Does he still have it?
Comment: In case anyone thought Luke [lost it (when he threw it) in RotJ](http://www.jodocast.com/wp-content/uploads/2015/04/I-Am-a-Jedi-Like-My-Father-Before-Me.jpg), Luke [has it on his belt](http://i.stack.imgur.com/wSnG5.png) at the ewok party later on.
Comment: Considering that the events in *Return of the Jedi* happened "long, long ago" — which I guess is at least thousands or maybe millions of years ago — I'd say, no, he doesn't still have it.
Comment: As of the last time we saw him in Legends continuity (Crucible), he still had it. No idea about Disney canon, though.
Answer:
They very deliberately showed Luke above the waist in the film. ALL through that scene. I'm not suire quite what they're trying to hide, but absence or presence of the lightsaber might be a possibility.
WGA Script doesn't say

Rey stares, knowing exactly who it is. But she just stares
  for what seems like forever. Until he finally TURNS, SLOWLY,
  to her. Pulls back his hood.
  IT IS LUKE SKYWALKER.
  Older now, white hair, bearded. He looks at Rey. A kindness
  in his eyes, but there's something tortured, too. He doesn't
  need to ask her who she is, or what she is doing here. His
  look says it all.
  In response, Rey pulls something from the pack.
LUKE'S LIGHTSABER.
  And she holds it out to him. An offer. A plea. The galaxy's only hope.
  HOLD ON LUKE SKYWALKER'S INCREDIBLE FACE, amazed and conflicted at what he sees, as our MUSIC BUILDS, the promise  of an adventure, just beginning...

Foster novelization doesn't say (neither does Epilogue of Junior novelization by Kogge, which is worded differently but has same idea)

Whether motivated by her stare or by something unknown, the figure finally turned toward her and pulled back his hood.
  Luke Skywalker.
  His hair and beard were white, and his countenance was haunted. He did not speak, nor did she.
  Remembering, Rey reached into her pack and removed his lightsaber. Taking several steps forward, she held it out to him. An offer. A plea. The galaxy's only hope.

TL;DR: We don't know for sure.

Speculations:

They didn't tell us by design. Because Luke's Jedi robe seems to be open, which means had we looked at his waist we'd have seen it.
She OFFERS HIM the lightsaber in both texts. That seems to signify he doesn't have one of his own now but not sure. It could simply be symbolic; OR it could be a callback to Obi-Wan offering him that lightsaber in Episode IV to call him to the adventure.
Both texts very clearly call it his/Luke's lightsaber.
Not "hers" despite the fact that earlier the implication was that it destined for her.
Comment: *They very deliberately showed Luke above the waist in the film. ALL through that scene. I'm not suire quite what they're trying to hide...*  Probably three decades worth of beer gut.  He'll hit the gym before they start filming Episode VIII.
Answer: We don't know yet - it isn't mentioned in the movie, the script, or the novelization.  There is no reason to believe that he lost it, or that it was destroyed, but he may have thrown it away when things went awry.  We won't know until Episode VIII is released in 2017.
Answer: Here's a possible additional clue: the packaging for much of the Last Jedi merchandise has just been unveiled today, and it shows Rey with the blue lightsaber, holding it like she means it.

This strongly suggests that Rey keeps the Anakin/Luke hot potato blue lightsaber and uses it, which in turn strongly suggests that Luke still has his green one.
It's also worth pointing out that even if we did see all of Luke's outfit in the film, that wouldn't disprove the presence of the weapon because, post-Order-66, it's common for Jedi to conceal their lightsabers within their robes.  Remember in Episode IV, how Obi-Wan had his the whole time and you never would have known until he whipped it out in the cantina?  I suspect Luke is doing the same.
Comment: [Also Sidious](https://www.youtube.com/watch?v=R3oSAVwcD4U).  I presume he had it the whole time.
Comment: And her hair is different. So you know she's super-serious...
Comment: @Valorum, yep, the silly, innocent scavenger hairdo is definitely gone.  Also, it appears that Finn is wearing the same old jacket (I wonder how much work it took to repair that thing.).   We'll definitely know more once the teaser drops this weekend!
Comment: Or not… *sigh*   Only one shot of Luke, and it's a silhouette.  The teaser did just that—it teased.
Answer: Spoilers for The Last Jedi:

 The last time we see Luke with the green lightsaber, he is activating it in an effort to kill Ben Solo. He realizes the error of his ways immediately after activating it, but it is too late and Solo tries to kill him.

Using the canon book Bloodline, which is set six years before The Force Awakens, we know that

 Ben Solo had not yet turned to the Dark Side. However, due to the combination of the revelation that Darth Vader was his grandfather (Bloodline) and that his uncle/master may have wanted to kill him, The Last Jedi, Ben turned to the Dark Side. So to answer the question, Luke had his lightsaber as close as six years before the events of The Force Awakens, and most likely lost it during the destruction of his new Jedi order.
Answer: Probably, but unconfirmed
In the novelization of The Last Jedi, the island caretakers on Ahch-To collect Luke's possessions after his death, including "his weapon":

Alcida-Auka verified that one of the daughters had cleaned the Outsider's robes and put them away in the storage hut, along with his woolens, pack, and boots. She directed another daughter to take his weapon, his star compass, and his strange other gear to the repository, where it would join other items gathered over the generations.
(Source: The Last Jedi: Expanded Edition, page 383 of Kindle edition, emphasis added)

Luke's green lightsaber isn't seen or mentioned at any other time outside of the flashback, but he isn't seen to use any other non-illusory weapon in the Sequel Trilogy, unless you count his fishing spear or an antenna he pulls off a hut while fighting Rey. Therefore, his lightsaber seems like the most obvious candidate for what this could be.
Note, however, that it's officially unconfirmed as of the 2019 edition of Ultimate Star Wars:

In the coming years, Luke continues to wield his blade as he rebuilds the Jedi Order. After sensing the dark side in his nephew, Ben Solo, Luke activates his saber above the young man while he sleeps, fully intent on killing him. Ben awakens and attacks his uncle, who immediately feels remorse. This moment leads to Ben wiping out the fledgling Jedi Order. After the Order's destruction, the whereabouts of Luke's second lightsaber are unknown.
(Source: Ultimate Star Wars (2019), page 282, entry: "Luke Skywalker's Green Lightsaber", emphasis added)


Cleaning contacts

Question: How do I identify the contacts who haven't opened any mailings in the last 3 years?
I'm unsure which are the appropriate fields in the Advanced Search to make this process as easy as possible.
Answer: Welcome to SE civicrm. There isn't an easy way to do it, but you do it with some extra clicks.
Step 1:
You can use Mailing Open report(/civicrm/report/Mailing/opened?reset=1), find the mailing opened in the last 3 years, and Add all those contacts into a group using the action drop-down appearing on left side of the report.
Step 2:
Using Adv Contact Search(/civicrm/contact/search/advanced?reset=1), find for contacts with Activity type => Bulk Email, Activity date => last three years =>> Search =>> Add contact to Smart group
Using Include / Exclude Search(Search >> Custom Search) => Find for contacts from group created at step2 and excluding from group created at step 3.
HTH
Pradeep
Answer: We have used the Synopsis extension to generate a tab like this

An example of the json involved is
{
"Label": "Total Emails opened in last 90 days",
"MName": "Total_Emails_opened_in_last_90_days",
"DataType": "Integer",
"SelectRef": "none",
"existing_field": "0",
"Query": "SELECT  count(*) as opened\n            FROM\n              civicrm_mailing_event_queue q\n              INNER JOIN civicrm_mailing_event_opened o ON o.event_queue_id = q.id\n            WHERE\n              q.contact_id =  {contact_id}\n\t\t\tand CAST(o.time_stamp AS DATE)  BETWEEN DATE_SUB(NOW(), INTERVAL 90 DAY) AND NOW()\n\n",
"Optgroup": "undefined",
"Remove": false,
"Hidefield": false,
"CFID": 200,
"Weight": "9",
"column_name": "total_emails_opened_in_last_90_d_200",
"table_name": "civicrm_value_synopsis_28"
}
Comment: And being synopsis you should then be able to search those fields, filter, add in reports etc. probably even make smart groups
Answer: You can easily do this using GDPR extension https://github.com/veda-consulting-company/uk.co.vedaconsulting.gdpr
Navigate to Contacts >> GDPR Dashboard or navigate to civicrm/gdpr/settings
Comment: good to know - hmm actually i do not see 'when was mail opened' in my settings. perhaps i am on old version?

Cleaning contacts


Django: no such table: django_session under Apache, but works with manage.py runserver

Question: I am essentially getting the same error described in this article, but the solution doesn't work for me because I think my root cause is different.
I have my database path absolutely defined:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '/var/www/myapp/database.db',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

Still, I get the no such table: django_session.
When I run manage.py runserver, I do not get the error.
I have done a few other things just to try anything, but didn't help:

manage.py reset sessions
I deleted the db and let it get recreated with syncdb
I tried chown apache:apache database.db and also to the parent directory chown -R apache:apache myapp/
I tried chmod 777 database.db

My apache config looks like this:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/html/
</VirtualHost>

<VirtualHost *:80>
  ServerName myserver.mydomain.local
  ServerAlias myserver.mydomain.local

  DocumentRoot /var/www/myapp

  WSGIScriptAlias / /var/www/myapp/myapp/wsgi.py

  <Directory "/var/www/myapp/">
    Allow from all
  </Directory>
</VirtualHost>

The reason that I write /myapp twice is because the first one just contains the DB file and manage.py.  The folder under that contains the app, including wsgi.py
I also note that I must add two lines to my wsgi.py to make this run on Apache, that I do not have to add when running the app from manage.py:
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + "/../"))

Answer: i had the exact same error ..... mine being a windows environment.
just had to copy and place the database.db file under apache folder.
you could try doing the same and see if it helps.