Where do I code for the Arduino? How do I decipher the code? I am quite lost for Arduino

Question: How do I make use of the code? Where do I code it?
Answer: Breathe.
Go to Arduino.cc
Click Software
Click Downloads, to install the software on your PC
Connect the Arduino board by USB
Select some code from the Examples folder, and play with it.
It really is so easy that even I can do it. I'm that guy who can code a bit, but I really hate setting up the environment in which to code. It all seems to 'just work'. This is why the Arduino project was started, as a service for those who don't want to load hex files onto the bare metal of an MCU.
Answer: All you need to do is go HERE and download the Arduino IDE.
Once done, plug your Arduino into the computer using a USB cable. You'll be able to then write the code in the IDE environment. Once done, you just click the "Upload" button, and the code will compile and upload it to the Arduino.
If there are any errors in the code, the IDE will flag them up for you to fix before uploading.
The Arduino website is full of tutorials and tips, and Arduino is one of the most well supported beginners devices around, so finding new code to play with or getting help on how to get things working should be easy enough in the Arduino forums, or even here on the Arduino stack exchange.
There are even built in examples you can work from in the IDE too.
Answer: Just go to the arduino website and download the IDE.
Nice and simple. Plug in to your computer with a USB cable and you're good to go.
If you want ideas on how to write your code, you can use the File tab, then go to examples and choose any of them. It will load pre-written code that you can upload to your arduino. You can use these as a base to work from.


Is it likely that galaxy supercluster attractors are all supermassive blackholes?

Question: Really any phenomena about matter pulling into something always results to one thing eventually with enough mass, a black hole. I understand that the Shapely attractor is oftentimes referred to as the largest object in the observable universe, but is that because not enough time has occurred for light to have traveled to us to be able to see other developed attractors in different galaxy clusters? I know that there have been unusually large black holes in the early formation of the universe, I think the biggest one having been formed only one billion years after the big bang with a mass 10 billion times that of the sun. With the earliest stars having been born 200 million years after the big bang, a black hole such as that would have to consume a handful of stars every year. Is it possible that these types of black holes are actually not that uncommon, and are the cause of all attractors in a galaxy supercluster?
Answer: No. If the Shapley Supercluster is acting as a "great attractor", it's because it has a mass of something like $10^{15}$ or more solar masses, which is $10^{5}$ times larger than the largest supermassive black holes we know about. Most of a supercluster's mass is dark matter, with the rest being gas and stars. Black holes are a very small part of it. (Even our own galaxy has a mass of about 50 or 60 billion times the Sun in its stars and gas, with about fifteen or twenty times more mass in the form of dark matter. Supermassive black holes, despite the name, aren't really that massive.)
If black holes with massive of 100 billion or more times the Sun were being routinely created, we know about it: in order to get that mass into the black hole, you would end up putting out enormous amounts of radiation along the way, which would be visible as quasars. And, of course, we've measured the supermassive black holes in over a hundred galaxies in the local universe, and never found anything more than about 15 billion solar masses.
"Really any phenomena about matter pulling into something always results to one thing eventually with enough mass, a black hole."
Possibly, but it would take many, many times the age of the universe for that to happen to galaxy-sized collections of matter.


Simulation of Induction motor using Simulink / Simscape

Question: I wish to generate a training dataset for a Machine Learning system) of Induction Motor operation using the Induction Motor model in Simulink / Simscape. I am observing the Stator Currents and noting that each simulation run is almost identical to the next. Any idea about how to add variability like a real motor?
Answer: In order to see fluctuations, you should change the load in your motor.
Inputs to motors: Electrical power
Outputs of motors: Mechanical power
Motor's input behaves in many cases because of the mechanical load that is connected to it so you should connect variable mechanical loads to the output of your motor.


My Android is Freezing after Factory reset

Question: I am using a Galaxy Note Lte (SHV-E160S) it was working slowly lately so decided to root it to improved it performance. After rooting i Installed an application called SYSTEM APPS REMOVER which help me remove some unwanted apps on my phone because i am not using them and they keep on using my data.
After going through this process i decided to Factory Reset.
Now comes the problem after successfully factory reset it. Went i got to the configuration of language stage the phone keep on freezing and the screen won't respond but the back and menu keys are all working perfectly.
Guys i just wanted to ask is the anyway i can skip that stage or any help will be appreciated.
Thank you
Comment: Welcome to stackexchange, in order to track down your problem you need to add more information. Most important: which system apps did you remove?
Answer: (Just something you can try)
I know what happened to you can be frustrating. It happened to me once when I accidentally uninstalled an android required app. You can try flashing a GApps zip package. That worked for me.


Briggs and Stratton yard machine mower

Question: My 2yr old mower puts too much gas in the carburetor . It fills up behind the air filter. not safe ...
 DO you have a reason why it might do this ?
Answer: If the carb is getting too much fuel, there is one of three reasons, all of them related.

The float isn't working. If the float longer floats, it will allow fuel to keep allowing fuel into the float bowl, and therefore the carburetor even when it shouldn't.
The needle and seat, which are attached to the float, are not sealing correctly. They could be worn out, or deteriorated.
The float may be maladjusted. Most B&S carbs I've seen do not have a float adjustment on them, but this would also allow too much fuel to enter the bowls. (Note: This cause is highly unlikely on a B&S engine, unless there was some kind of physical damage to the carb.)

You can attempt to pull the bowl off of the carb to see if there is anything which can be worked. There should only be one bolt at the bottom of the bowl and then a circular gasket (could be an o-ring) where the bowl meets the carb. Just be careful to understand how the parts come apart and go back together.
You can easily get replacement needle/seat/floats in a carb rebuild kit for your engine, but you'd need to look up your specific model to do so. Replacement of these parts are pretty easy as well.

Briggs and Stratton yard machine mower


Have the NFL MVP and DPOY even been on the same team?

Question: In the NFL, has there's ever been a year where the winners of the Most Valuable Player award and Defensive Player of the Year award were on the same team?
Answer: Yes. This is trivially the case in 1986 when Lawrence Taylor won both the MVP and DPoY.
Answer: Steve Young and Deion Sanders of the San Francisco 49ers did this in 1994. Young was the league MVP, and Sanders was the DPOY. Aside from the league MVP being the same player as the DPOY (Lawrence Taylor in 1986, Alan Page in 1971), this seems to be the only instance.
In 2003, Jamal Lewis won Offensive Player of the Year while his Baltimore Ravens teammate Ray Lewis won Defensive Player of the Year. Though Jamal Lewis was not the league MVP (split between Peyton Manning and Steve McNair), I find this to be an interesting case worth mentioning.
Comment: That 1994 San Francisco team also won the Super Bowl, with Young winning Super Bowl MVP.


How to select polygons located nearest a line feature in QGIS?

Question: I am running QIGS 3.18. I am trying to select features from a polygon layer that run along a given roadway (which is blue in the photo below). How can I go about running a selection of all the features in my parcel layer (which is red) that, in this case, have road frontage along the blue road? Note that the red parcel layer and blue road layer don't actually intersect or touch in the map (so "Select by Location" won't work). And the "Nearest Neighbor" analysis seems to only work for point features as an input.
In my example, only the red parcels with a blue dot (as seen below) should be selected. What's the best way to do this?
Answer: Create a buffer around your line (street) with a distance that it touches the houses bordering the street, but not more. Than overlap the polygons with this buffer.
When doing that with select by expression, you can select the relevant polygons (adapt the value of 3500 at the bottom to you needs):
overlaps (
    $geometry,
    buffer (
        geometry(
            get_feature_by_id (
                'line',
                1
            )
        ),
        3500
))


Would the Red Lotus poison have the same effect on Unalaq

Question: In the Book 3 Finale, Korra was administered a deadly poison that was meant to forcibly induce the Avatar state. Unalaq being the Dark Avatar and the polar opposite to Korra and sharing a kind of spiritual link to Raava through Vaatu, would his body have reacted the same way?
Answer: This depends on why the Avatar enters the Avatar state. Is it an automatic reaction of the human, or an automatic reaction of Raava, or is it Raava's choice? (Aang entered the Avatar State before learning to do so to save his life in ice, and Korra entered the Avatar State while desperately trying not to do so; we can assume the human is not willingly entering the Avatar State when near-death.)
If it is an automatic reaction of the human, then we can assume Unalaq would automatically enter his Dark Avatar state. If it is an automatic reaction from Raava, then we can likewise assume Vaatu would have a similar automatic reaction.
But if Raava is actually trying to keep the human Avatar alive, then we would have to say Vaatu cares enough about his current 'partner' to try and save him. Vaatu may well have let Unalaq die in the hopes that his next incarnation would be stronger, or that the next one would be hidden and rise to power in the background.
All of that being said, Raava would not willingly break the Avatar cycle. If Raava could stop the Avatar State from happening when the Avatar is about to die, we would assume Raava would do so.
While it is never clearly defined, this reasoning makes it a fair assumption that the Avatar state is entered automatically by either Raava or the human, so Vaatu would not have a choice in the matter and Unalaq would therefore automatically enter his equivalent Avatar State when close to death.
Answer: There's obviously no way to be sure, but it seems safe to assume that Unalaq would similarly go into his Avatar State-equivalent when under threat. It's kind of a common-sense reaction: "if you're about to die, pull out your biggest guns."
I don't think there was anything special about that poison, it was just a way of putting her in enough danger to bring out the Avatar State, while also weakening her even while she was in it. It would seem that most poisons would have roughly the same effect.
So yeah, my guess is that if similarly poisoned (or faced with any dire threat), Unalaq's Vaatu spirit would have reacted to defend him, just like Korra's Raava spirit defended her.
Comment: There was one special feature of the poison: it was metal based. As Korra and Unalaq both were powerful waterbenders (and Unalaq in particular could heal with waterbending), any water-based poison would probably not have worked very well. But you are right, the poison was merely the chosen means of bringing imminent death- any suitable danger would have worked.
Comment: It was metal based to prevent the Avatar from being able to easily bend it and remove it. By keeping her instinctively fighting she would be more inclined to fight than remove the poison.
Comment: She could, but she was restrained.  Very powerful benders can sometimes bend without their hands (like Iroh breathing fire), but it's well-known that restraining a bender's hands obstructs their ability to bend.  Even if she could have bent the poison on a good day, she couldn't stop them while she was tied up.
Comment: After she broke lose, she didn't have a lot of time to bend it away. And as noted, she was just starting her metalbending career and wasn't very proficient with it yet. We also don't know that Zaheer was aware of her budding metalbending.
Comment: Korra could bend metal by that point, no? Granted, not as strongly as she could her native element.


How to connect the Arduino with Twitter via GSM/GPRS?

Question: I know there are tons of projects that use WIFI or simple LAN shields to send sensor data from the Arduino as Twitter messages. How could this work with a mobile phone connection? Are there libraries or handware layers that enable TCP via GSM or GPRS? If not with Twitter, could I email the data or send to other APIs which would be HTTP requests?
Answer: You can get a gsm/gprs module from sparkfun.  It looks like that'd be pretty easy to get going.  You would, of course, need data service to run it.
Answer: Along with what Dustin stated take a look at Arduino Twitter Examples for possible ideas or inspiration.
Answer: I connected an Arduino to a Telit GM862 (GPRS/GPS) module. It's a breadboard setup but I know that shields are coming for these modules.
There is a bit of code the lets you connect to twitter via GPRS. Not really a library but maybe a starting point.
http://tinkerlog.com/2009/05/15/interfacing-arduino-with-a-telit-gm862/
Answer: I found a shield that uses a virtual serial port to communicate to the modem. I think the store is from Chile, here is the link Arduino GM862 Shield.


can my phone company still track what i search useing my data

Question: I have just found out about the wonderful world of Tor. I have it on my PC, but my question is: Can my internet company and/or phone service see what I'm searching? I understand that it is encrypted but what can they see  and if they can would a company just randomly say "oh he is encrypted lets find out what he is doing?" Also I have an Android LG K7 non rooted. What good apps are there that will help secure my phone?
Answer: The point of your communications being encrypted is that your ISP cannot see what you are doing. Your data is encrypted using cryptographic keys that only you and the Tor network know.
Your ISP would be able to tell, if they cared to look, that you are in fact using Tor. But they would not be able to see what you're using it for. Chances are, they will never care to look.
Answer: Yes, they can even mangle and censor your data usage: the "exit node: for your connection is your phone, and it's logged in and routed through their network.
Comment: So you're saying Tor doesn't do its job.
Comment: @SuperSluether as it asked: the ISP/"company" **can** say that *it's encrypted* and they **can** try *"lets find out what he is doing"*. And - yes - ISP can censor and/or mangle the Tor traffic they see. That's what the pluggable transports are for. I don't say that they will 100% succeed in MitMing your HTTPS and will be able to see the contents, but blocking is a form of censorship by mangling network path


What is the physical significance of the Dual Space in QM?

Question: In studying the math of Quantum Mechanics, I came across the idea of the Dual Space, and how we need it to take scalar products. If a Hilbert space of kets represents state vectors/wavefunctions, what does the dual space of that Hilbert space represent in a physical sense? What exactly does a ket's corresponding bra represent?
Comment: I'm not sure how detailed an answer you were looking for, but a space of bras also represents state vectors. An inner product $\langle \psi|\phi\rangle$ can be thought of as the action of a linear functional ($\langle \psi$) on the ket $|phi\rangle$. When you write $|\psi\rangle\langle\phi|$, the fact that $\langle \phi|$ belongs to the dual Hilbert space is important. In a matrix representation, the ket is represented by a column vector and a bra by a row vector (so that $|\psi\rangle\langle\phi|$ is a matrix).
Comment: I am not writing an answer because I am not sure of this, but something that could hint a solution to your answer would be to consider the Non-Hermitian case. In the Non-Hermitian case, the dual space is not the ket space of the Hamiltonian itself but the ket space of the the Hermitian conjugate of it.
Answer: Kets do not represent wave functions, so this may contribute to your idea of there being an imbalance between bras and kets. Instead, we do not get a wave function associated with a state (ket, $\left|\alpha\right>$) until we project it onto a basis, such as the position- or momentum-space bases, revealing that the wave function is actually a scalar:
$\psi(x) = \left<x|\alpha\right>$, $\phi(p) = \left<p|\alpha\right>$.
This can be likened to the scenario of a vector, $\vec{v}$, which has an existence and meaning independent of any basis, as can be seen geometrically with an arrow. It is only when we choose a particular basis, such as $\hat{i}, \hat{j}, \hat{k}$, that we can specify the vector by its (scalar) components. Similarly, the wave functions (in $x$, $p$, or some other basis) merely specify the components of a given ket (for a nice discussion related to this, see the opening chapter of Shankar's Principles of Quantum Mechanics). There is nothing stopping us from projecting a bra onto a basis:
$\psi^*(x) = \left<\alpha|x\right> = \left<x|\alpha\right>^*,\ \phi^*(p) = \left<\alpha|p\right> = \left<p|\alpha\right>^*$.
What this gives us, though, is the complex conjugate of our previous wave functions. The physical meaning of why the complex conjugate shows up with the bra here is related to our conception of probability being a non-negative measure:  since quantum mechanics necessitates the use of complex numbers, in order to guarantee that $\left<\alpha|\alpha\right> \ge 0$, the dual to a ket has to involve complex conjugation ($z^* z \ge 0$ in general). As previous comments have indicated, the only remaining difference is that between column vectors and row vectors, which is arguably a convention.
Answer: The dual space concept describes the Hilbert space, which is by definition, a complete inner product space. The duality is a property of the vector spaces. That particular is essential to define our Hilbert space to be complete. That is it helps us to make any measurements we are allowed to ask in the vector space.
A definite state of a physical system is represented as a state ket (or a state vector) in the complex vector space. It can be visualized as a vector in the ket space. Corresponding to that particular state ket in the ket space, there exists a mirror image of the vector (mathematically and more precisely called a dual) in some other space called the bra space, so that there is a one-to-one (linear) mapping between any vector in the ket space with it's dual in the bra space.
Together with these bras and kets, we could make physical information about the system and these  information lies in the Hilbert space. For example, you have a
state ket $|\alpha\rangle$, which belongs to the ket space. Then there exists a corresponding dual- a state bra $\langle\alpha|$- in the bra space, so that we could know physically relevant information about the system by combining them somehow. In short, a state ket as such, even though represent the physical system and is postulated to be containing all the physical information about the system that are allowed to ask, we cannot derive the information from it unless we make use of it's dual in the bra space.
In short, the state ket as such is of no importance if it cannot give us any relevant information about the system. It becomes physically meaningful if it could give values of the measurement of observables, which is by taking the inner product of the ket and bra vectors. That means, any measured value should be contained in the space where we do the operation. A dual space guarantees that. Also, if you operate with your state ket some operator corresponding to a physical observable, it is postulated that the result will be a state ket. Hence our dual space must satisfy the completeness or closure property.
Answer: The bra also represents the state. Each bra is associated with exactly one ket, so the two contain exactly the same information.
I think it's easiest to see this when we consider finite-dimensional systems. Say we have a ket $| \psi \rangle = [a, b]$. The corresponding bra is the object which brings $| \psi \rangle$ to its norm: in this case, $\langle \psi | = [a*, b*]^T$. I.e. for finite-dimensional systems the kets are just the (conjugate) transpose of the bras!
So no new information is added. We need nevertheless to distinguish between the bras and the kets in order to coherently form inner products.
Comment: So would it be right to say that there is a symmetry in the sense that quantum mechanics could have been formulated by interchanging the bras and kets?
Comment: Well I wouldn't exactly call it a "symmetry", but sure you could do that. This is sort of like saying that Newtonian physics could equally well be formulated using either row or column vectors.


What profilers and analyzers are there for Erlang/OTP?

Question: Are there any good code profilers/analyzers for Erlang? I need something that can build a call graph (eg gprof) for my code.
Answer: For static code analysis you have Xref and Dialyzer, for profiling you can use cprof, fprof or eprof, reference here.
Answer: The 'fprof' module includes profiling features. From the fprof module documentation:
fprof:apply(foo, create_file_slow, [junk, 1024]).
fprof:profile().
fprof:analyse().

fprof:apply (or trace) runs the function, profile converts the trace file into something useful, and analyse prints out the summary. This will give you a list of function calls observed, what called them, and what they called, as well as wall-clock timing info.
Answer: Try this one: https://github.com/virtan/eep
You could get something like this https://raw.github.com/virtan/eep/master/doc/sshot1.png


about Session.rollBack() in JMS

Question: All,
  i am new to JMS and i have a question about Session.rollBack() method in JMS. AFAIK, this method is used to roll back all operations to JMS server (sending/receiving) by the session when using *SESSION_TRANSACTED* acknowledge mode. Now suppose I am calling this method in a catch block of a receiving/processing operation (is reasonable?), to tell JMS server to redeliver the message for processing, But even if it is redelivered the processing still throws the same exception which cause the JMS server to redeliver the message again, so it seems a infinite process. How to handle this problem? or are there any other JMS features that is designed for it? Thanks in advance!
Answer: The rollback method in JMS will rollback any message sends and receives in that "transaction". Transaction here is local to the JMS session.
Whether a redelivery will cause a problem really depends on why the exception occurred. If it was due to some transitory issue then a redelivery may work. If you have the kind of problem that is once it occurs will always occur (an example of this would be a JMS TextMessage whose body should contain XML, but doesn't).
The JMS API doesn't provide any solution to this itself. This is typically taken care of by the JMS provider and how it behaves will depend on which one you use. WebSphere MQ for instance will redeliver up to a configurable maximum at which point it will move it off to a queue for bad messages. The Service Integration Bus in WebSphere Application Server has similar behaviour. I suggest you consult your JMS provider documentation to determine exactly how it behaves in this situation.
If you are running in an application server rollback typically doesn't do anything because the application server will be managing transactions for you.

about Session.rollBack() in JMS


Is there a maximum to the amount of paragon/renegade points in Mass Effect 2?

Question: My "paragon bar" appears to be full but I continue to receive paragon points. Is there a maximum amount of paragon/renegade points you can receive? If not, is there any benefit in obtaining any more once you have filled the bar?
Answer: The Paragon / Renegade system in Mass Effect 2 is a bit different than that of Mass Effect 1. In the earlier game, Renegade / Paragon actions were available explicitly based on your charm / intimidate score.
Mass Effect 2 removed both alignment based skills, and instead calculates available dialog paths based on earned paragon/renegade points / total potential paragon/renegade points up until that point.
I'll quote directly from the mass effect wiki:

The morality system of Mass Effect 2
  works on percentages rather than the
  total points earned. There is a set
  number of morality points available in
  the game. Shepard's current
  "effective" morality score at any
  given point is the number of points
  earned out of the number of points
  available from the areas he has
  explored so far. It is possible to
  have Shepard's Paragon/Renegade
  scale(s) maxed out, but still not have
  the percentage required for certain
  dialog options.

So even though you are no longer filling the bar, you must continue to act as a paragon, or else your percentage will decrease over time, eventually locking you out of some paragon dialogs entirely, as you continue to miss out on potential paragon points.
The Paragon / Renegade points carried over from a ME 1 save file are an exception to this rule: For instance, if you start the game with 50 paragon points from mass effect 1, your paragon score is 50 / 0 (ignore the  potential divide by zero) instead of 50/50if you had accrued those 50 paragon points through normal ME 2 gameplay.
Comment: Nicely said! :)
Answer: The maximum amount of renegade/paragon is unlimited. This means you can continue to gain renegade or paragon points indefinitely without any affect on the game.
80% full is the maximum worth you can gain out of both paragon and renegade, upon reaching that point it provides no more value (so at that point it helps to level the other one)
Here is some reading material if you want to know more.
Hope this helps!
Comment: Just to add to Aardvark's reply - 80% Para/Rene in ME1 equates to 190 or 200 Para/Rene points when you load the save I think.


Best human plan vs best computer plan

Question: Suppose that in a given strategic position, every grandmaster agrees that plan A is better than plan B, and for the first few minutes the strongest computer engines calculate that A is best and B is second best.  But then at, say, depth 30 or so (at a depth beyond any human calculation), the engines find that plan B actually leads to better positions than plan A (even though there are no tactical refutations), with say, a +1.00 advantage over plan A.  Would the grandmasters still insist that plan A is a better plan than B, or would the 4000 Elo rating of the chess engine make them rethink this?  What would objectively be the best plan, A or B, if following the best line of play in plan B leads to a strong position dozens of moves down the road, while following the best line of plan in Plan A does not after dozens of moves (again, beyond what a human would be able to calculate)?
Comment: I don't think "objectively better" is a meaningful concept. Objectively, there are only 3 kinds of moves: a move wins (assuming subsequent perfect play by both sides), draws, or loses. You could say one winning move is "better" than another if it forces mate in fewer moves, but I'm not sure how reasonable that is. Anyway, what could it mean to say that one non-losing move is "objectively" better than another in a level position? The best move is the one that leads to positions where my opponent is most likely to make mistakes which I have the skill to take advantage of, and not the reverse.
Comment: @ bof  So your answer disagrees with Inertial Ignorance's answer below?
Comment: @prestokeys I wouldn't say we're in disagreement, the main point bof's trying to make is about how "objectively better" isn't well-defined. E.g., after 1.e4, is 1...a6 objectively worse than 1...e5, if we assume that 1...a6 can draw with perfect play? In any case, whatever reasonable definition (or general "feeling") you choose to use for objective strength, an engine should be far better than humans in all of them.
Answer: Any grandmaster worth their salt would then assume B is in fact better, and if they wanted to know why they could analyze it out with the engine. Being objective is an important quality for any strong player, and I'd find it hard to imagine a grandmaster would continue to truly believe their plan is objectively best, if an engine disagrees. The grandmaster might continue to believe that their plan would offer the best practical chances, or that it suits their own style best, but these are more subjective claims that they would recognize as such.
If the engine at depth 30 suggests plan B, then it's likely that it's better than plan A. Although note that at even higher depths, engines can still change their minds, so it's not always certain what plan it'll settle on way down the road. And then there's the issue that we don't know how close engines are to "objectively perfect" play. But still, current Stockfish at depth 30 is pretty damn good (like really good). Any opinion of a GM that agrees/disagrees with the engine's evaluation usually has no weight on what the objective evaluation is. Again, GMs can be good at deciding which plans give the best practical chances, but they don't hold a candle to engines in figuring out which moves are objectively best.
Answer: What GMs do - and I imagine most players - is force the computer to look at plan A and see what the result is.
For example, take this position with Black to move:
<code>[FEN "rnbq1rk1/pp1nbppp/4p3/2ppP3/2PP3P/P2B1N2/1P1N1PP1/R1BQK2R w KQ h3 0 9"]
</code>
White obviously threatens Bxh7+ with the Greek Gift sacrifice. Black has two ways to stop it, ...g6 and ...h6. Which plan do you choose? Stockfish at d=23 says ...h6 is +0.8, while ...g6 is +0.9.
If a GM wants to get more sense of this position, then what he'd do next is input ...h6 and ...g6 and let Stockfish compute White's best move. This works because by inputting the move, Stockfish will focus on that move and that move only. If you do this, then Stockfish at d=24 says 1...g6 2. O-O or Nb3 is +1.0, while 1...h6 2. Bb1 is +0.7. Clearly Stockfish is becoming more convinced that 1...h6 is the best move. Is it right though? Well you can play through Stockfish's principal variation, check out more suggested moves (what exactly is White's plan after 1...g6 2. O-O? What about 1...g6 2. Nb3? Do the two moves transpose?) etc.
Then after you check out all the lines to whatever depth satisfies you, you decide if ...h6 is better than ...g6. Maybe it is, maybe it isn't.
Correspondence chess players do this to great depth all the time.
Comment: "Correspondence chess players do this to great depth all the time." Isn't that considered cheating though?
Comment: @David not in no-holds-barred correspondence chess. For no-engine correspondence chess then yes, it's cheating.

Best human plan vs best computer plan


How to resume a render that got interrupted?

Question: I was rendering a video and my computer turned off because of electricity problem. Is there any way I can resume the render from where I left off, without having to start all over again?
Comment: No, it's not bashing, it's just an answer that lots of people know off-hand, and is a pretty consistent rule. I'm not seeing any insults, just lots of answers.
Comment: If you have the front of the video somehow intact, you can continue rendering from that frame (please save as .pngs first), then sequence it together in the Video Sequence Editor, covering the corrupted parts
Comment: If I were this person I would feel that the comunity felt more interested in bashing me for doing it wrong than helping…
Comment: ...in fact many of the answers include sympathy over having experienced this very problem.
Answer: If you were rendering out frames as individual images, then you should be able to just set the "begin" frame to the last rendered frame, and go from there.
If you were rendering to a video file, then no... there is no way to you probably can't get all that work back. The file that got created (if it got created at all) is probably corrupt and unrecoverable. It's possible that the video file will still open in the VSE, and just have an unexpected end, or be shorter than it should be. I've never been able to, but IF you can open it, you can determine the end frame, render the remaining animation (to images), and stitch the two animations together after the fact. Furthermore, rendering the partial video file to individual frames might make that stitching process easier, but it will be critical to get the frame rate correct, or you'll end up with odd timing issues.
This is why it's a good idea to always render to individual frames, and then use the VSE to put those frames together into a video file. Once you have the frames rendered, rendering them into a video file is a very fast process.
Comment: If you are rendering as an image sequence there is no need to alter the range of frames to be rendered. Just uncheck the **overwrite** box and blender will preserve the existing frames and only render the missing ones
Comment: @MDNahidHasan See http://blender.stackexchange.com/q/15142/599
Comment: I don't think that's entirely true. I'm sure if I've had video files that will play up to the point the render was cancelled, in which case you could just start rendering from that point and edit together the videos.
Comment: Yes, the file may have an unexpected end and behave erratically but information may still be recoverable. Some players may still be able to read the file and the information might still be recoverable.
Comment: As I'm a beginner, can you please tell me how to render template to individual frames and how to put those together into a video file ? @Matt
Comment: Sure, post a new question asking "How to handle frames as images?" and I'll answer it there ;-)
Comment: ...or something along those lines
Comment: Yup, that's exactly what I'd answer ;-) @MDNahidHasan, the question they're asking there ^^ is a little different, but the answer is exactly what you need.
Answer: The best way to render an animation is to save each frame as a.jpg or .png file. Then you use Blender Video Sequence editor to make it in to one single movie. This probably can't solve your problem right now, but is good to keep in mind for the future. Also see: https://www.blenderguru.com/tutorials/rendering-animations/
Comment: That ship has sailed. This doesn't help answer his question.
Comment: I might as well add to your answer, and highlight that if you're doing any compositing after the fact--even if it's a simple denoise--saving to OpenEXR can preserve the different render layers which you will be using in the final image. (They're very big files, though.)
Answer: You may have lost a significant chunk of the data you were rendering. We have all been there lost some renders because of having done just this, it is one of those things that will eventually happen. Its not so nice to notice having lost a multiday render because of power loss or drive malfunction. (Personally I lost a ~12 day render job once because the RAID failed). So learn your lesson, prepare for possibility of failure and you will save time in the future.*
It might be possible to recover some of the data. You may have lost more data than you have expected since some of the data may have been cached and not in the video file and the last I frame may be further back than expected. Like others have explained take a video editor and cut the data at last good frame that was commited to disk (incidentally this may be nothing for certain codecs). Continue from this point and graft the pieces later. However, you might now decide to re-render the whole thing again. So make a small scale test of the process before you commit yourself.
The reason why you never render directly to video files is not really the crash proof nature of things. The recoverable nature and ability to interupt your job for hardware maintenance are just a side effects of a much better workflow. The primary reason is that compression is a bit of a hit and miss game. So you really want to have a uncompressed source out of your renderer so you can recompress the data if your initial compression had a lot of artefacts. So be sure that you are happy with your compression quality before you go further. See this may have been a blessing in disguise.
For similar reasons avoid rendering in future to formats like jpg as they discard data on save and you may need it later whan deciding to change a part of your animation.
* at this point you may feel pople are being rude pointing this out. However in my experience one can not appreciate the facts without experiencing them first hand. So the pain may be in fact useful.
Answer: Has already stated here never ever ever render from a 3D scene directly to a video file. Always render to separate image files like a png or jpg sequence.
Now that the mistake was made all you can do is open your video file and see if it is playable and the information recoverable. If so you are in luck.
See what was the last good recoverable frame from the video and extract the information with some video editing software like Blender VSE or other into an image sequence.
You can then continue rendering from the last good frame into an image sequence and then combined the new frames with the old ones using the VSE or any other software you like into a video after rendering.
Answer: If rendered directly into a video file format it's difficult to recover your work. Depending on what format you've been rendering it might use encoding and compression, which in that case is only one of your problems. You'll also need to figure out on which point exactly the process stopped.
Video compression in short is done by saving pixels, thus reducing the amount of data. The best method to save pixels is to reduce them to the ones that change between similar images. The common method is to have keyframe images (I-Frames) which contain full renders and between them you have a "prediction" of the changes that might happen in the next frame. Those frames are called P-Frames (P for prediction. See, there's a pattern here). These are followed by images that contain both the resulting P-Frame and a prediction to the following I-Frame, thus they are bidirectional and called B-Frames.
The sequence is "I-Frame -> P-Frame -> B-Frame ->I-Frame". Since you want to have the most valuable Information in the last picture you'll need to cut the interrupted video on the last I-Frame and (if you manage to find out where the interruption happened in the process) resume your render process from there. The resulting video can then be "glued" to the end of the first video. This most commonly results in another encoding process where you also most possibly will lose data again.
In general I go with what Duarte said. One does not simply render into a video file format ever.
Answer: I would get an external single-file-targeted editor like VirtualDub or Avidemux and use it to identify the last good I-frame/keyframe in the file and trim past it, as @metaphor_set was hinting at. These programs all have commands to jump to the next/prev I-frame, so it should be pretty quick.
You can then get the length of the trimmed video in frames, which lets you figure the frame number to continue from.


Testing before distilling

Question: I had m'y fermentation going in 2 different 25liter pales. One stop fermenting 2 days before the other did, now I'm doing a test with the hydrometer and I'm reading 1.014 on both is taht okay to still run my mash ?? Also my refractometer is showing 30% alcohol on fermenting only is that even posisble ? Or it's it off
Answer: A final gravity of 1.014 is quite high for a wash intended to be distilled. So off-hand I'd say you've got an incomplete fermentation on your hands. Taste it. Does it still have a residual sweetness? Unless it's quite dry and tart without any sweetness you've got unfermented sugars left in there.
Unfortunately you don't say what you were fermenting, but if it is a sugar wash, the most likely problem is either yeast nutrient or wash acidity.
Sugar has nothing that the yeast can use as a nutrient. So when the yeast runs out of its internal nutrient reserves it falls flat on its face. This is why any fermentation other than full grain ones should have a good yeast nutrient added to it. (Grains already contain most or all of the required nutrients.)
Another main suspect is acidification of the wash during fermentation. When you ferment sugar in water using yeast (and nothing else) the yeast produces organic acids, and when the wash becomes too acidic (a pH of 4 or lower) most yeasts throw in the towel. This is especially the case with generic yeasts, beer yeasts and baking yeasts (which are all basic Cerevisiae strains); specialized yeasts such as rum yeast or selected wine strains may be able to go a bit lower, but eventually acidity becomes a problem. That's why turbo yeasts have a pH buffer mixed in to keep the acidity in check.
Finally, a high stress fermentation (i.e. a sugar wash) needs oxygen as well. Make sure to aerate the wash well prior to pitching the yeast.
Personally I hate refractometers because unless you use them exactly for their intended purpose (which is to measure the amount of pure sucrose in pure water) they give you an incorrect gravity more often than not. Since fermented products (wash, beer, wine etc.) have other ingredients as well, you're not simply measuring sucrose-in-water, so your reading will be off.
That said, a 30% alcohol content in a fermented wash is extremely unlikely in anything other than very specialized and very finicky fermentations, so I'd disregard that reading entirely.
So in summary, when fermenting a sugar wash:

Add a good yeast nutrient
Pitch plenty of yeast
Use a pH stabilizer
Aerate well

Good luck!
Comment: just a nitpick, but refractometers exist that are designed to measure alcohol content in distilled spirit, although they obviously don't work for undistilled washes.
Comment: Not only do they not work for undistilled washes, but they are only accurate for ethanol in water. Vodka, in other words. Anything else in there (e..g flavour compounds carried over during potstill distillation, compounds picked up from oaking during maturation, etc. will trow off your reading.
Answer: Really hard to answer this question as there isn't really any information here. It's completely impossible for the anyone to to determine if 30% is possible considering there is no information provided on your grist, yeast, fermentation timeline, etc. I can say it's very unlikely you'll hit 30% even with distillers yeast.
Your refractometer is primarily used for reading starting gravity and you won't get an accurate read of gravity once there is alcohol in the solution without doing some math. Use a hydrometer to measure FG and determine your alcohol by comparing this number to your SG.
Is it "fine" to run your mash? Of course. You can distill a mash with 0% alcohol if you really wanted to. Most home distillers try to run mashes down to 0.000 so they can maximize output.
Without meaningful details this question cannot be answered with any more detail.
Answer: Well, a couple things: you say you have a couple Pales fermenting, and for a Pale Ale an FG of 1.014 is OK (a bit toward the high end perhaps).  I'm not sure what you mean by 'run my mash' after you have fermented it out.  Please clarify.
Also, your refractor showing 30% alcohol -- how is it showing that?  There's no way a Pale Ale batch would reach 30%.  All the yeast would die off long before that.
However, based on your hydrometer readings of 1.014, I'd say it was ready to package.
Comment: I believe OP means a Pale as in a Bucket- not a pale ale. This is a distilling question.
Comment: A 'pail" then. Please try to use the correct words.

Testing before distilling


Can a comet orbit a planet?

Question: Given that moons commonly orbit planets, why do we never encounter a comet orbiting a planet?
What would happen (exactly, in detail) if a large one did settle into a stable orbit around the Earth?
Sorry... just making the question a bit clearer!  The accepted answer will describe where all the water ends up.
Comment: If the planet is large enough it can happen easily.  Shoemaker Levy-9 was a comet that was captured by Jupiter and orbited it at least once, perhaps more than once, but given the highly eccentric orbit, perhaps only once.
Comment: I have downvoted as while I think the core of your question is ok, your focus on your final point and the comments you have made on the answers shows the misunderstanding you have around water from comets. I'd suggest removing this point, and perhaps asking another question on how much water from comments ends up on Earth, or something like that.
Comment: Partial answer here (not a duplicate question though): http://astronomy.stackexchange.com/questions/2357/what-would-happen-if-an-ice-cube-is-left-in-space
Comment: Just for clarity, is your question essentially where would the water end up if a comet was to orbit the Earth?   Which is an event that's unlikely to happen, but theoretically if it did happen, where would the water end up?
Comment: @userLTK I'm working on the obviously true assumption that smaller orbital objects are routinely hoovered up by larger ones, including comets, although most of those in planetary orbits in our solar system have been sucked up by now.  what I'm really interested in is how that looks to us if we were present as it happens.  Where does the water go and what do we experience?  Suppose it's a big one with a lot of water.
Comment: You really have to specify "a lot of water". If it's comparable to a large lake (like the great lakes in North America), we probably wouldn't notice much. If it's a significant fraction of the total liquid water on earth, we would burn up and die :P
Comment: If the comet actually orbits the Earth, then that is where the water ends up: in orbit. Since it's part of the comet.
Comment: @RoryAlsop There's a strong hypothesis that Earth's water was delivered by comets. Clearly before they were all swept up by planets, the comets which have deliverer water to the planets would most likely have been the comets traveling slower and with closer orbits to the sun; that's just basic physics. The question I really want to get at is; what would that look like to man when it happened, if there was some major event? Would water be delivered unnoticed. Would there be some huge injection of superheated steam from the sky; if the comet settled into orbit, would water steadily fall as rain?
Comment: I know the hypothesis well. That is not the issue. A single comet is not going to give you something viewable. Either splat! and destruction, or millions of years of smaller bombardment (or both) - these scenarios don't really fit with the first half of your question - hence my request to split it out. The answers here give some good info on whether orbit is possible, so why not try that separate question on comet water?
Comment: @RobertFrost comets that impact the Earth look like fireballs.   It looks like a great big kaboom in the sky or, if big enough, into the ground.  The heat generated turns any water in the comet into steam and plasma, but since the remaining ingredients are still there, the Hydrogen and Oxygen from any water in the comet that impacts the Earth remains water on the Earth however, heating in the upper atmosphere likely leads to some atmospheric escape, so there's a trade-off.  For more specifics, I'd do what Rory Alsop recommends and ask a new question.
Answer: Its very unlikely for a comet to become a satellite of an inner solar system planet. Much less likely than it is for an asteroid. Most asteroids are on fairly circular orbits, and so the relative velocity between asteroids and planets is quite low. In comparison comets have very elliptical orbits, and their relative velocities to the planets are much larger.
For an asteroid to be captured it must lose momentum. This is possible, though rare. For example, a binary asteroid can be captured if it is separated by tidal forces. For an comet with much more momentum, the chance of being captured is much much lower. Asteroids are captured by the Earth moon system, but not into stable orbits, they don't stay long.
If it did occur, the comet would still be active, with a coma of gas, which would be visible just like a very nearby comet. It wouldn't be particularly bright, since the surface brightness of a comet doesn't depend on distance from the Earth.
Over time the comet would run out of volatiles and become more or less indistinguishable from a captured asteroid. If it were in the Earth's orbit it probably wouldn't last that long, as there are not many orbits that are stable in the long term around the Earth, due to perturbations from the moon.
The dust and gas, including water vapour, will initally remain in orbit, forming a faint ring. It will, over time, be disrupted, and either end up in the atmosphere, on the moon, or ejected from the system. A comet doesn't contain enough water to make a difference to the Earth's ecosystem.
Answer:
Given that moons commonly orbit planets, why do we never encounter a comet orbiting a planet?

By definition, it would no longer be a comet, but rather a moon (or more properly a satellite). Comets are icy bodies that orbit the Sun, satellites are any body which orbits a larger body than itself, other than the Sun. There are many examples of asteroids and comets that have been captured and become satellites, although it is not easy to prove with 100% certainty that a satellite is indeed captured and did not form in place. Some familiar (potential) examples might be Phobos and Deimos, around Mars, or the various moons around Pluto such as Nix, Hydra, Kerberos, and Stix.

What would happen (exactly, in detail) if a large one did settle into a stable orbit around the Earth?

I have to take exception to this question by pointing out that it is impossible for a comet to "settle into a stable orbit" around the Earth. Even basic physics will tell you conservation of energy and momentum disallow capturing comets by them "settling". In order for one body to capture another, you need a third body in the system to conserve angular momentum. What are the chances that two comets come by Earth at the same time and with exactly the correct orbital properties such that they can interact and cause one of them to be captured? I'm not going to do the math but I can guarantee the chances are diminishingly small. The moon could play the role of the third body, but again, you need precise orbital characteristics which seems unlikely to me.
But we disregard that point and just say that somehow a comet has been put into orbit around the Earth, be it a nearly miraculous capture or else put there by human intervention or by some other effect. What would happen to it?
The answer to that depends on where its orbit is. It seems unlikely to me that a comet could survive for long in some orbits. If it was very close to the Earth, it would eventually fall onto the planet through friction with our atmosphere. If it was farther out, you'd have to consider how the Earth-Moon system affected its dynamics. Possibly there could be some stable resonant orbit between the Earth, Moon, and comet. It is hard to say what the long term results would be as an analytical solution to the three body problem is impossible. The only way to answer this is through a simulation.
Comment: @RobertFrost: you say "all that water" -- the mass of comet 67P/Churyumov–Gerasimenko is within 10% of 10^13 kg. If was all water (it isn't), that'd be enough to cover the earth to a depth of 0.02mm. Put it all in one place and you have a lot of water, 1/50 of the smallest of the great lakes, Lake Erie. Scatter it around the Earth, and it's not much.
Comment: I'm specifically looking to determine where all the water would end up.
Comment: @RobertFrost: presuming that significant water was added to the early Earth from other bodies, then it was likely a series of impacts. Earth has too low an escape velocity, to capture anything that isn't in an orbit pretty similar to its own. Then others have explained that the Moon, being so large, prevents Earth from really having stable orbits, so anything like that which might have been captured early on is not going to last 4 billion years.
Comment: So what it "looks like to us", for large contributions of water, is a crust-melting impact and we die. Just as well this all happened before we were around. Sure, bodies in orbits close to Earth's can be captured: https://en.wikipedia.org/wiki/Claimed_moons_of_Earth, and small impacts are not catastrophic. Any water on it could be vaporised on impact and join Earth's water cycle, or could be part of hydrated minerals that make it to the surface. For a "just right" impact, the core of an icy meteorite could probably make it to the surface unmelted.
Comment: @RobertFrost Well, one of the competing theories is that a series of impacts brought water to Earth. Not necessarily *comet* impacts - in fact, there's significant evidence that the source corresponds to outer belt *asteroids*, rather than comets. But during extensive analysis of Moon samples, a better fitting theory shaped out - Earth had its water long before it finished forming, mostly in hydrated rocks and even in oceans (with temperatures ~200 °C). In any case, nobody suspects a single comet in orbit. Why do you focus on orbits so much, when a direct impact is much more likely?
Comment: I guess a small comet could orbit the moon. One way it could settle into an orbit is by means of impacting something, perhaps if it impacted the moon or another planet, or passed close enough to another planet to be slowed down and pulled into a planetary type orbit.  Then over time it stands to reason it would move closer to a nearby planet.
Comment: I don't understand how a comet could impact another body such as the Moon, and then continue to orbit the Earth. Once it hits the Moon, its done. And it can't "pass close to another planet and be slowed down and pulled into a planetary type orbit". The physics just don't allow for such a scenario to possibly happen.
Comment: @RobertFrost If it impacts the Earth, nearly all of the water would stay on the Earth, unless it was large enough to hurl debris into space.   As pointed out, a comet orbiting the Earth is hugely unlikely and if it improbably did happen, it's unlikely to be stable for long, but for the water to get to Earth it would either need to hit the Earth (this happens from time to time) orbit into the Earth's Hill Sphere and break apart, (unlikely), but if that happens, some water would be lost to the solar wind, some would fall to Earth, just as some of Saturn's rings falls onto Saturn as rain.
Comment: @zephyr: I don't know if that's true. Wasn't Shoemaker–Levy 9 designated a comet despite being discovered in orbit around Jupiter? Maybe it *shouldn't* have been so-designated, but nobody seemed to have any difficulty at the time with the idea that once something's a comet it remains a comet until it crashes...
Comment: @zephyr Clearly the reason there are no comets and asteroids in the inner solar system is that any of these smaller objects straying into the planetary zone have already been hoovered up by the planets.  In fact a leading theory for where the Earth got its water, is that it came from a comet.  This is one area of research in relation to What I'm really interested in is, suppose one way or another it is the Earth doing the hoovering on some occasion, and the comet is pretty large, what does that look like to us?
Comment: @SteveJessop I'm thinking there are big and small ones.  Given the system in which they are steadily hoovered up by larger bodies, the law of probability dictates that the number of large ones will decrease over time. So it stands to reason that in the past there were more, and larger ones around.
Comment: @zephyr *Even basic physics will tell you conservation of energy and momentum disallow capturing comets by them "settling". In order for one body to capture another, you need a third body in the system to conserve angular momentum. What are the chances that two comets come by Earth at the same time and with exactly the correct orbital properties such that they can interact and cause one of them to be captured?*  Why two comets (which wouldn't interact noticeably anyway), why not, say, *the Moon*? Capturing a comet still is unlikely, but that's more due to the enormous momentum change involved.
Comment: @RobertFrost *suppose one way or another it is the Earth doing the hoovering on some occasion, and the comet is pretty large, what does that look like to us?* This sounds like you should ask a separate question. In any case, I'm unclear on exactly what you mean. Do you mean to ask how the comet would appear in the sky from our vantage on Earth?
Comment: @zephyr I mean what does the whole process look like... Comet approaches... settles into similar orbit around Sun... occasionally interacts with moon and earth... settles into orbit around Earth / moon... heats up due to tidal forces... turns to water / vapor... cloud of water/vapour orbits Earth & moon... slows down due to turbulence... starts to fall on to Earth and Moon as rain.  What exactly is a realistic process ?
Comment: @zephyr the third body does not need to leave the system, it just needs to absorb the leftover momentum. The moon would speed up/slow down and change orbit a tiny bit, but otherwise won't budge. If capture always required the ejection of other bodies, it would be *exchange*.
Comment: @Chieron Sorry, you are correct.
Answer: Yes.  See Split comet Shoemaker-Levy 9 became a satellite of Jupiter Ríse hvezd, Vol. 74, p. 224-225
and The Century of Space Science

comet Shoemaker-Levy 9 which was probably captured into a Jupiter-centric orbit and thus, temporarily, became a satellite of Jupiter before splitting into at least 21 piece and crashing into Jupiter's atmosphere

And according to Disintegration of fragments Q1 and Q2 of comet Shoemaker-Levy 9 during the fall to Jupiter Astronomy Letters, Volume 22, November 1996, pp.771-779:

The comet was captured by Jupiter and became its satellite in 1929 ± 9 according to Chodas and Yeomans (1995) and in 1959 according to the calculations Chemetenko and Medvedev (1994).
Answer: It is absolutely possible for a planet to 'capture' a comet, Mars has already captured two asteroids and the only difference between the asteroids and comets are what they are made of. Plus, there are theories that believe that Saturn's rings were formed by a captured comet that strayed too close to the gas giant and thus, was ripped apart into millions of pieces of rock and ice (Assuming theory is accurate). Note that this is much more likely to happen to the outer planets due to their immense gravitational influence and their distance from the sun. Distance matters because comets generally go faster when they get nearer to the sun which makes it harder for a planet to capture comets.
Although, technically it wouldn't be a comet anymore but a satellite.
Comment: @RobertFrost I'm not sure that's true, though, assuming our theories of comet formation are correct. Comets are anything but stable, so it's not like there's a pool of comets that kept orbiting inside the Solar system for billions of years, slowly being culled by planetary interactions. Rather, it seems that the "injection" of a new comet is "accidental" - a result of complex gravitational interactions changing orbital characteristics of a body (that might have very well been on an extremely slow circular orbit at a very far distance) - less massive ones are more likely to be "injected".
Comment: I agree, what you say is obvious.  I'm just wondering what happens when a big whopper with a lot of water gets hoovered up by the Earth.  Where does the water end up and what does that look like to us?
Comment: Mars' satellites were most likely already on an orbit very similar to Mars' own. That's completely different from a trans-neptunian object passing by - neither Mars nor Earth have anywhere near enough gravity to capture something with so much relative velocity. Yeah, planets can capture comets (at least temporarily), but as you noted, this is much more likely for an outer planet with lots of mass than for an inner planet with (relatively) tiny mass.
Comment: @Luaan Thanks for your comment.  I'm permitting in this question, the notion of some comet a long time ago which was perhaps not traveling as fast as those which remain nowadays. It would seem obvious that the solar system has been around a long time and consequently the slower ones have now all been filtered out by the planets.
Comment: It has been suggested that Titan, the second largest moon, is a captured comet. It is still outgassing, but other volatiles than water. If it came close to the Sun it would have a tail. I suppose at Earth orbit, it would outgas quickly and the gasses would drift out with the solar wind until they can refreeze.

Can a comet orbit a planet?


Effect of FIR filter on the time resolution of the signal

Question: Let's say I have a noisy raw signal with 1GS/s sampling rate (That means the time resolution is 1 ns). Now I apply a FIR lowpass filter (window filter) of 25 MHz on it. The length of Window filter will be 40 ns in time domain. Since it is doing convolution in time domain, does it mean that I get one "non-correlated" point every 40 points? Should I discard those points and get the filtered signal with actual time resolution 40 ns?
Comment: No, doesn't mean that, strictly, unless you can build an infinitely good filter with finite length. Why do you choose to restrict yourself to filters that are of this particular length? Do you have a specific type of filter in mind
Answer: If the noise itself is white noise this by definition means every sample is uncorrelated. When each sample is independent of every other sample, all samples will be uncorrelated and the frequency spectrum will have a constant power spectral density. If we then filter the signal with such noise with a low pass filter, then yes adjacent samples will be correlated and if the filtering is sufficient as detailed below, can be discarded. Considering a simple example of an FIR filter makes it clear how the correlation occurs: In an N-tap lowpass FIR filter, the output depends on the current sample plus a weighted average of the $N-1$ samples, and thus there must be a correlation in each sample at the filter output with the prior $N-1$ samples. If we shift by 1 sample, the next output will still have $N-1$ samples that we had in the previous output in the weighted sum. The adjacent samples in this case are no longer necessary and can optionally be discarded.  This is the fundamental property used in multirate signal processing and the decimation process: we low pass filter and then after filtering we can discard all correlated samples with no consequence to the signal quality, since now at the output each sample contains all the info we need within the memory depth of the filter. The "info we need" is implied to be in a much narrower bandwidth.
The ideal filter and the amount we can decimate is best viewed in the frequency domain with a clear understanding of sampling and aliasing as described further by Hilmar in his post, and depicted in the graphic below showing the ideal decimation filter for a decimate by 4.

Below shows the low pass filter that would allow for perfect decimation. Because the alias regions are restricted to specific zones, filters with selective stopbands (multi-band) can also be used resulting in more efficient structures.  The graphic says that "perfect decimation" is not achievable. But on practical terms, and knowing the regions that would alias into our main passband after down-sampling, we can design our filters so that the rejection of this aliasing is well enough below a noise floor of interest to be considered sufficient for our application.
Comment: Not sure that I agree with "yes adjacent samples will be correlated and can be discarded." If I make brown noise by filtering white noise with a 1st order lowpass filter, I can't discard samples without creating significant aliasing. So it really depends on the type and purpose of the low pass filter.
Comment: @Hilmar Yes agreed, to be strict the filter would need to completely attenuate the upper portions of the spectrum that alias and in that case adjacent samples can be discarded. If we mean by "Low Pass" that we wish to attenuate the higher frequencies to our requirements, we will have adjacent sample correlated to the degree that matters to us.  Even with the first order low pass, if our sampling rate was high enough and our lower frequencies were low enough, we can discard adjacent samples with no consequence depending on req'ts. Best clarified by understanding aliasing and the freq domain.
Answer: The sampling theorem states that in order to avoid aliasing your sampling rate needs to be higher than twice the highest frequency in your signal.
In practice this is a little more complicated: in the physical world there is no such thing as a "bandlimited signal" and sampling always introduces some amount of aliasing. Hence the sampling parameters are typically chosen based on the properties of the signal and the requirements of the application to keep this error "sufficiently small".
Applying a low pass filter will reduce energy at higher frequencies. Whether that reduces the bandwidth of your raw signal sufficiently to allow reducing the sample rate as well depends again the details: The properties of the filter, signal and application requirements. Specifically you want to look at "stop band frequency" and "stop band attenuation". The filter length is not relevant in itself (but related to the other quantities).
Assuming that stop band attenuation is good enough for an acceptable aliasing error you can indeed reduce the sample rate to something that's slightly higher than the stop band frequency.
This whole process is called "down sampling": use a low pass filter to reduce bandwidth and then throw a away a certain number of samples (that are independent anymore). Obviously this only makes sense if there is extra bandwidth in your raw signal that you don't need for your application.
Comment: Reply to Hilmar: I understand that. But what is confusing me is that when I apply FIR filter, in time domain it is basically convolution between the signal and the filter. Right? With the example I posted in y question, the first point of the filtered signal is convolution of filter and first 40 points of the raw signal; the second point of the filtered signal comes from convolution between the filter and 2nd till 41st points of the raw signal and so on. It seems that two consecutive points of the filtered signal is correlated to each other. I am having trouble with understanding this part. Ar


Extract elevation values from WMS DEM to points

Question: I have a points feature class that I am trying to get elevation values for the state of texas. ArcGIS Online conveniently has a DEM for the entire state as a WMS. I am wondering if there is a way to extract the elevation values from the WMS to a field in my points feature class. In QGIS I have tried using the point sampling tool but it does not seem to recognize the pixel values in the WMS. When I id a pixel the elevation is displayed through an html element. Is there any possible way to extract this value?
Answer: What you want is not possible. The info or id tool you use to get a single value for the point you clicked on the map is sending a GetFeatureInfo Request for this coordinate to the server and the server sends back an xml/html file(which is in general optional, as well as the "elevation-awareness" of this wms from ESRI). But only for this single point. Even if you could extract it from the displayed element you would have to click each point (or write some program that does this, which is unlikely to work as they would block you pretty fast from the server). A WMS is not a DEM or any other data, its only a picture to look at. It is desgined that way to not give out the data... if that would be the idea you would have another service for it.
Answer: I'm sorry but I'don't agree with you a wms layer is not a simple picture, is a vector without the geometry. If you click with info on a wms layer you can see the value of the field that show the layer.
Nowadays in Italy we get info from wms of cadastral but with QGIS, I'm looking for the same solution for Arcgis.
You can see there, also if it is in italian
https://www.youtube.com/watch?v=Fu-i0zfxndY
thanks


Connect SAP data from SharePoint 2010

Question: If we want to create a custom connector to connect SAP data from SharePoint 2010 ... how to do that? what steps are involved?
Answer: why create a custom connector when you have Duet Enterprise created by SAP and Microsoft?
Creating a connector is pretty straight forward. You have a project type in Visual Studio, Busines Data Connectivity Model under SharePoint 2010 project group, and good tutorials on MSDN, but since accessing SAP through BAPI must be done in the right way, both in terms of licensing and performance, whrer you risk shooting yourself in the foot in several ways, I would strongly recommend using Duet Enterprise that was created by SAP and MS developers who hopefully knew what they were doing:)
Comment: Can we write custom connector through WCF or custom service application?

in fact WinShuttle & some others are good connector.

if wcf what are steps to create custom connector?
Comment: Are we talking integrating en existing WCF service in  custom connector, or creating a custom WCF service to beconsumed by BCS? The later is explained in a 4 part series on MSDN [here](http://msdn.microsoft.com/en-us/library/gg318615(v=office.14).aspx). Consuming a WCF service in a custom connector is straight forward like in any .NET application -just another data source instead of XML or SQL?
Answer: Exposing SAP content in SharePoint is not straight forward if the content is protected using SAP proprietary permissions. We have analyzed requirements for indexing SAP content using SharePoint 2013, and concluded that effort required in both SP and SAP would not give enough value for the money, poor ROI. You would need custom BAPIs and logic, depending on how you have structured your SAP content using hierarchy and DIR characteristics.
I recommended a thorough analysis of effort, benefit, maintainability, information security and more. Connecting to open/public info in SAP may be much simpler.

Connect SAP data from SharePoint 2010


How to view hex contents in a registry file without importing it

Question: I have a registry file which I exported, and I need to retrieve the PATH from it, but I do not want to import it. When I open it via any text editor, PATH is in hex format, so unable to read it. Is there any way to see the contents without importing it, and without installing any third party tools ? For example, I can do a reg query in the full registry path, but it seems like I cannot do that to an exported registry file. Is it possible ? The exported registry is from a Windows Server 2008 R2.
Answer: Instead of importing it to the regular registry, import it into a registry hive that you load for the purpose. Then when you're done you can just delete the new hive.


If man has been created for olam haba, why shouldn't man desire death?

Question: If man's existence in olam haba is man's goal, shouldn't he wish to die? If you say that olam hatze is a preparation for olam haba, and that dying would prevent him from preparing himself, then shouldn't that produce death anxiety? Because what tzadik can consider himself to be prepared?
Comment: [Welcome to MiYodeya](https://judaism.meta.stackexchange.com/a/3887/11501) and thanks for this first question. Great to have you learn with us!
Comment: https://www.sefaria.org.il/Pirkei_Avot.4.17?ven=Mishnah_Yomit_by_Dr._Joshua_Kulp&vhe=Torat_Emet_357⟨=bi
Comment: It is not clear that *olam ha'zeh* and *olam habah* are separate "places" experientially. See for example the Gra at the end of Shir Hashirim.
Comment: Thanatos is a known desire
Comment: https://judaism.stackexchange.com/questions/109190/why-are-we-afraid-of-death-and-dont-rush-to-the-world-to-come
Answer: The Midrash Tanchuma (Naso 16) explains that when G-d created the world, He longed for a place to abide, in Chassidic philosophy we call this דירה בתחתונים:

R. Samuel bar Nahman said, "When the Holy One, blessed be He, created the world, He longed to have an abode below just as He had on high

It is our job to make this world a dwelling place for G-d. In a similair vein, the Mesilat Yesharim states:

The matter of holiness is dual. Its beginning is service [of G-d] while its end is reward; its beginning is exertion while its end is a [divine] gift. That is, its beginning is that which a man sanctifies himself, while its end is his being sanctified. This is what our sages, of blessed memory, said: "if a man sanctifies himself a little, he becomes much sanctified. If he sanctifies himself below, he becomes sanctified from above" (Yomah 39a).

Similary, the Mesilat Yesharim explains that by doing mitzvot, which G-d commanded us, it serves as a sort of corridor to the world-to-come:

The means that lead a person to this goal are the commandments which the blessed G-d commanded to us. The place of the performance of these commandments is only in this world. Therefore, man was first placed in this world so that through these means prepared for him here, he will be able to reach the place prepared for him, namely, the World to Come, there to be sated with the good which he acquired through these means. This is what our sages of blessed memory said "today to do them, and tomorrow to receive their reward" (Eruvin 22:1).

We should fulfill G-ds mitzvot out of love, not because we know that by doing them, we get a reward. As the Rebbe writes (Hayom Yom, Kislev 18):

The Tzemach Tzedek writes: The love expressed in "Beside You I wish for nothing,"1 means that one should desire nothing other than G‑d, not even "Heaven" or "earth" i.e. Higher Gan Eden and Lower Gan Eden, for these were created with a mere yud

And the famous expression:

I want nothing at all! I don't want Your gan eden, I don't want Your olam haba... I want nothing but You alone.

So, we come to your question:

If man's existence in olam haba is man's goal, shouldn't he wish to die?

I personally do not think that's why we are here in this world, as mentioned above. We need to make this a dwelling place for the shechina. As the Mesilat Yesharim writes "It's beginning is service of G-d". Then..... the end is reward, they are both connected through each other.
As brought by Joel K in the comments, Avot 4:17 states:

He used to say: more precious is one hour in repentance and good deeds in this world, than all the life of the world to come; And more precious is one hour of the tranquility of the world to come, than all the life of this world.

On this Mishnah, the Ikar Tosafos Yom Tov explains something interesting:

"The world to come": The beginning is not a [contradiction] to the end, as this world is for action and the world to come is for payment and enjoyment

This world is for "action"- for doing mitzvot, the world-to-come is for the reward of the actions we did in this world. This can also be found in the commentary of the Bartenura on this very same Mishnah:

"than all the time in the world to come": Because at that time, repentance and good deeds do not benefit a person, as the world to come is only for the receiving of reward for that which he observed in this world. (emphasis mine)

If man has been created for olam haba, why shouldn’t man desire death?


Just how (un)welcome is creationism here?

Question: It's well established that creationism has no place here. I completely agree, but I came across a question which, so far as I can tell, is asking for examples of situations where evolution is an unlikely explanation. The question seems quite popular, which is surprising given its lack of clarity and the fact that it's asking for a list of things that don't exist. Should such questions be closed?
Comment: What exactly is the problem with asking questions of evolutionary theory? This does not need to imply any sort of creationism. I agree that the question is not well put and is rather vague, but we should not discourage people from asking questions of our scientific paradigms.
Comment: Fair enough, it's a bit speculative of me to assume this has any ties to creationism. But it did more or less ask "why / how is evolution wrong?" in a way that doesn't allow the answer "it isn't". These sorts of questions tend to get undue attention. I'm not advocating censorship or scientific dogma, I'm asking how far we need to go to control them.
Comment: @Shep - also, from someone who comes from physics background, I would strongly suggest an inoculation against self-smug "We know everything" attitude in the form of Lord Kelvin's infamous "two minor clouds" [speech](http://physics.about.com/od/physicshistory/p/KelvinsDarkClouds.htm). It's one of the more fascinating events in history of science IMHO.
Comment: hmm, the question was closed 2 minutes after I posted this... I guess that answers that.
Comment: @Shep - I'd strongly advise not jumping to conclusions. There are plenty of people with zero relationship to/belief n creationism who would be greatly interested in areas where evolutionary explanations are not currently known, from those like me who are laymen generally like reading about evolution but are more fascinated with unexplained than well known; to  - hopefully - serious evolution researchers looking for interesting topics of study.
Answer: I've closed it as not constructive now, I remember voting to close that question, but that was before I became a moderator and the close vote decayed as we didn't reach 5 votes.
The "most difficult to explain" is a very vague and subjective criterium, that question is just not a good fit for a Q&A site.
Comment: I was a bit surprised by the lack of close votes, actually, but I guess close vote decay explains it.


Why is the sky blue: For a 3-year old

Question: My nephew asked me yesterday why the sky was blue. I tried to explain it to him as best and as dumbly I could, but I failed. I tried to explain the concept of scattering of light using an analogy of colliding marbles, but I wasn't really successful. Can someone give this to me in a way suitable for explaining to my inquisitive 3-year old nephew?
Comment: I have to say that now that [parenting.se] is a thing there is a pretty good argument that these questions belong on that site, because what they are mostly about is choosing language and presentations that will satisfy the kid and foreclose the Endless Whys (tm), rather than being about the physics at anything like the level we allege this site functions.
Comment: I'm voting to close this question as off-topic because it does not belong to this site but rather is more competent at [Parenting beta](http://parenting.stackexchange.com) as remarked by Chris White. OP's nephew is suffering from ADHD & so it can be relevant to the question at that site. Though it seems to be of physics, but questions asked by a 3yr old child cannot be given accurate or nearly-accurate good answers in order to get conceived by him. How these queries like `why` from a toddler should be dealt is the core-topic of Parenting as linked by Chris.
Answer: I would keep any explanation to a three year old in wholly immediate, phenomenological terms; let him do the following experiment.
As you know, the blueness of the sky's orb is a mostly scattering rather than transmission phenomenon, but this is probably too much detail. I think you need to keep the explanation along the lines of "stuff changes the light that passes through or off it" and do it with something like the following.
Get hold of several different colored cellophanes or other transparent, colored plastics and a torchlight (flashlight or candle). A brilliant white modern LED flashlight will make the experiment more vivid. Show him how matter colors light as it is travels through matter. White without the medium present, colored with.
Something I recall being fascinated by at that small age was blood red of a torchlight shone through fingers, particularly the webbed skin between the fingers when one cups one's hand over a powerful torchlight (this works beautifully for a child's delicate fingers). This is the same phenomenon as the cellophane coloring the light.
He should be able to then accept that the air is a very "thin" kind of stuff, but there's a great deal of it. Tell him how high he would need to walk upwards to get through the air (in terms of walking to the house of someone whom he kens well and is 10 or 20 kilometers away). So, like the cellophane, you expect it to change the light that passes through it.
The color of the sky is the change that the stuff of the sky works on the light passing through or bouncing off it, just like the cellophane.
This approach also shows him that the phenomenon is no more mysterious - but also importantly that it is no less mysterious - than why anything around him is colored. The sky is not special or complicated in any way that his colored toys or dolls are not. The mystery is all around him, and it may encourage him to think about what color itself means and not take it for granted.
Comment: @CuriousOne also told the same. +1:)
Comment: Wet, this is highly admirable but it's only about transmission. (Your opening sentence underplays this; unfortunately regarding your answer, it should be prefaced by: "It's too hard to explain scattering. Instead, make a demo of transmission.  At least this gets the kid thinking about colors.")  While, as I say, the answer here is highly admirable pedagogy, it unfortunately completely sidesteps the issue.  Indeed: the question might well be phrased this way: **It's easy enough to demo colour transmission to small kids. But how the heck would you explain scattering??!"**
Comment: @JoeBlow I think one needs to conflate transmission and scattering here and think of them under the heading the change wrought by matter on light when the latter passes through or bounces off the latter. Also, Mie theory shows that the strict difference between the two is not always clear cut. One needs to think about what is color first; perhaps the most important thing here is to convey that there is nothing special about the sky - it's blueness is no more mysterious than why does your dolly have brown hair.
Comment: @Wet - I agree with what you say; but there's such a difference ("only recently clarified in science") between the two, I think it's great to introduce one or the other. Fortunately, it's **remarkably easy** to explain scattering. (Actually, I understand scattering completely. But "glass" is an utter mystery to me in spite of fancy majors; I explain glass to kids and myself as saying "God makes it" or "it's pure magic".)
Comment: BTW precisely what you say (the sky's blueness is no more or less mysterious than my shirt's blueness) is why user7027's answer is the best, as well as being the most scientifically correct and precise. The downvotes only reflect the brilliance and subtlety of that answer.
Answer: You'd explain it the same way you'd explain it to a fifty year old person.
What about this...
"As you know, there are different colours  ... red, green and so on. The air likes to bounce around these colours.  Amazingly enough, the air most likes to bounce around blue.  The other colours don't get bounced around as much ... they just go away.  So when you look up at the sky, we see all the blue being bounced around. The air is bouncing the blue around!"
(Older children may then ask, "Awesome! But why does the air bounce around blue and not some other colour?" The best answer then is something like, "It's because of the different size and speed of the different colours. It turns out that air is best at bouncing around blue. The others just pass through - they go away.  Look up at the sky, and you see all the blue bouncing around!")
Further, for three year olds, there's nothing at all wrong with introducing the colours as "little balls"1 within this explanation, if desired.
Looking to the other superb answers, also talk about how big the air is.  (It's possible that three year olds know what the "space station" or "satellites" are these days, with endless Netflix and iPad. Using the techniques in the other answers, you could show how much air there is, "all the way to the space stations!" "where it is black" because there is "no air to bounce the colours around" up there.)
Secondly from the other answers, you can make the excellent point about sunset. "When you're looking more at the sun, at sunset, the red balls make it through the air to you - the air bounces away the blue balls."  (Of course, this is getting less and less precise - let us say more and more 19th century - by and by.)
So that's how you explain the sky being blue to anyone, including three year olds. You explain it by explaining how it is. The air bounces blue around. But first!...

But first!!!!
Critically, as a pedagogical matter I would preface the whole explanation like this: this is more important than the actual explanation.
"That is a REALLY HARD question. It's important that you know, nobody had a clue about this until very recently. Like, when your grandmother {whatever} was alive. There was this great man called Einstein who figured it out {I'm not totally sure if three year olds know from TV the cliché of "Einstein" as our great scientist - if so, bingo, that's good enough}. Before that it was really a mystery. It's still a mystery."
I'm not quite sure of the best way to express it to a three year old, but it is critical to impress on the three year old, in terms they can understand, that

humans presently know almost nothing

it's only since the Enlightenment - very recently - that we have tried to figure things out. (Give a quick synopsis of the Enlightenment, starting with the renaissance in Italy)

don't forget we only had electricity, phones, visited the moon, etc very recently ("you're grandmother got them")

many many questions you can ask are very very difficult - your Mom doesn't know the answer, even your Aunty who works at the Big School with the 30 km tunnel underground doesn't know the answer

when you're a little older, you, too, can start trying to figure out these questions, along with Mr Einstein, your Aunty etc

This "little speech" will dwarf in life significance any explanation of why the sky is blue. (BTW asking "why the sky is blue" is astounding for a three year old, I'm sure the kid is almost four!)
Trials
Unfortunately I don't have a three year old on hand at the moment - that is awfully young - but testing shows this is perfectly understandable to 7, 8 year olds.
The bottom line three year old explanation is: "air likes to bounce around the different colors.  But mostly it likes to bounce around blue.  So when you look up at the air, you see all this blue."
(The other colours "pass through" or "go away" ... "pass through" is too complicated a concept for three year olds, so wing it there.)

1 given that currently, our base understanding of the fundamental nature of energy and matter is: Utterly Nothing Whatsoever: there's nothing wrong at all with talking about "little balls!" to a THREE year old!
Comment: One word: Amazing! +1;
Comment: Fun too in your answer!
Comment: on the contrary, I just "stood on the shoulders of giants" building on the other answers, but thanks!
Answer: None better than a local university can answer this question with their statement:

A clear cloudless day-time sky is blue because molecules in the air scatter blue light  from the sun more than they scatter red light. When we look towards the sun at sunset, we see red and orange colours because the blue light has been scattered out and away from the line of sight.

Source: http://math.ucr.edu/home/baez/physics/General/BlueSky/blue_sky.html
I think the only way to make it clearer for a young individual that has no concept of molecules would be to explain as follows:
In the day time, the sky is blue because small balls of energy move blue light more than other colours.
This may also need the explanation that those small balls of energy (a simple way of saying a particle or baryonic matter) exist at all times. That is only if you decide to use that way of explaining it, but I'm sure you'll adjust it. Nonetheless, I hope this helps you.
Comment: I tried that already, but it didn't help much. Thanks, I'll try again.
Comment: Why is the sky not purple then?
Answer: Based on the first 2 answers, I tried to kill 2 birds with 1 stone:
I capitalised on my explanation to give him a life lesson going forward, as he is sometimes bullied in kindergarten.
I showed him a variation of the filter experiment suggested, and then went as such:
Imagine the dust particles of the air to be bullies (as scattering agents) to the little light particles (just like that, I told him they were called photons). We can say that blue light is more determined to achieve success in the face of bullying (more energetic) while red light is less so.
Then, with time, the red light can show their achievements either early or late, when they haven't been bullied as much, out the blue light has been bullied (scattered) too much (the sky is red at dawn and dusk), but the blue light is determined to keep going on, and stands up in the face of much bullying and their achievements can be seen as long as light is there other than when it is red (the sky is blue during the day).
I told him finally that he should strive to be like the blue light who succeeds in the face of adversity. As such, he seemed to accept it.
I know that this is not theoretically appropriate to any extent, but please forgive any transgressions on my part. I also told him that I would try to explain it more literally to him as he got older and learned more of Physics, which he now seems to be very interested in.
I'm looking forward to posting a few of his next questions. Thank you.

Why is the sky blue: For a 3-year old


Double Cosets - Groups

Question:
Let $G$ be a group and let $H,K$ be fixed subgroups of $G$. For each $g \in G$, any set of the form $HgK = \{hgk \ : \ h \in H, k \in K \}$ is called an $(H,K)$ double coset or simply a double coset if $H$ and $K$ are understood. Prove that every element of $G$ lies in some $(H,K)$ double coset, and that any two $(H,K)$ double cosets either coincide or are disjoint.
Let $G$ be a finite group. Which of the following three statements are true, and which are false? Justify your answers.
(i) The size of a double coset divides the order of $G$.
(ii) Different double cosets for the same pair of subgroups have the same size.
(iii) The number of double cosets divides the order of $G$.

Attempt so far is that I've tried using the Lagrange theorem but i'm having problems in showing the first result about the double cosets. In regards to the last three statements, I'm completely stumped. Any help will be appreciated. thanks.
Comment: Hint: what is the double coset $HeK$? Can you think of a group of order $6$ with a double coset of cardinality $4$? Investigate some double cosets of subgroups of $S_3$ of order $2$.
Answer: If $A\to B$ is an onto map and $\Gamma$ a set partition of $B$, then the preimages of cells of $\Gamma$ form a set partition of the domain $A$. Consider the map $G\to G/K$ and partition $G/K$ into $H$-orbits; this proves the set of double cosets $H\backslash G/K=\{HgK:g\in G\}$ partitions $G$. Alternatively one can have the product $H\times K$ act on $G$ via $(h,k)g:=hgk^{-1}$ and then $G$ mod $H\times K$ is in fact the double coset space $H\setminus G/K$.
(1) The simplest double coset is $HK$. Its size is $|H||K|/|H\cap K|$. What if $|H\cap K|=1$ and the product $|H||K|$ has too many of $|G|$s prime factors (counted with multiplicity) to divide $|G|$?
The easiest way to arrange for that is if $H,K$ are distinct cyclic groups of prime order $p$ (hence trivially intersecting) and $p^2\nmid |G|$. The smallest prime is $p=2$, so let's use that. We need a nonabelian group; the smallest is $S_3$. What happens with distinct cyclic subgroups of order $2$?
(This is in fact the example hint given in David Wheeler's comment.)
(2) Here's a trick: $|HgK|=|HgKg^{-1}|$. Using the previous counting formula again, the question reduces to if $|H\cap gKg^{-1}|$ depends on $g$. What if $H,K$ are conjugate but unequal?
(3) Might as well check the example in (1) just in case you get lucky. In fact, one could just as easily invoke the example of (1) in problem (2) as well!

As $HK=\bigcup_{h\in H}hK$ is a union of left cosets of $K$, we can form the coset space $HK/K$ on which the group $H$ acts transitively from the left. The stabilizer of $K$ is $H\cap K$, so there is an equivariant bijection $HK/K\to H/(H\cap K)$ given by $hK\mapsto h(H\cap K)$. (Orbit-stabilizer!) This is what justifies the numerical equality between the two, even without restrictions on finiteness.
Answer: In general, whenever you have to show that every element of a set lie in a given family of its subsets and those subsets are mutually disjoint this indicates that you are dealing with equivalence relations/partitions.
So what is the relation involved? Let $a,b \in G$, define a relation from $G \longrightarrow G$ as follows:
$$a \equiv b \qquad \iff \qquad \exists g \in G \, \text{ such that } a \in HgK \text{ and } b \in HgK.$$
This is same as saying
$$a \equiv b \qquad \iff \qquad \exists h \in H, k \in K \text{ such that } a=hbk.$$
Try proving that this is an equivalence relation.
Comment: sure thats a nice approach, I can do that, any insight for the last part?
Answer: Two years late to the party, but this came up in my homework, so here you go.
One intuitive way to prove that a certain relation determines a partition on a set is to prove that the relation in question is an equivalence relation. Equivalence relations defined on the elements of a set partition the set.
Let $G$ be a group and let $H$ and $K$ be subgroups of $G$. Let $a, b \in G$ and define the following congruence relation: $$a \equiv b\ \ \text{if}\ \ b = hak \ \text{ for some } h \in H \text{ and some } k \in K. $$
To show that this relation is an equivalence relation, we need to verify the defining properties. Assume all elements are elements of $G.$

Transitivity:

Suppose $a \equiv b $ and $b \equiv c,$ so $$b = hak \text{ and } c = h'bk'$$ for some $h, h' \in H$ and some $k, k' \in K$.
Substituting for $b$ yields $$c = h'hakk'.$$
Since $H$ and $K$ are groups, $h'h \in H$ and $kk' \in K$, so $a \equiv c.$

Symmetry

Suppose $a \equiv b$, so $$b = hak \text{ for some } h \in H, k \in K,$$
then $$a = h^{-1}bk^{-1},$$
where $h^{-1} \in H$ and $k^{-1} \in K,$ so $b \equiv a$.

Reflexivity

Finally, $$a = 1a1,$$ where $1 \in H$ and $1 \in K,$ so $a \equiv a.$
As you might have noticed, each of these follows from a property of a subgroup.
Comment: glad to have you at the party
Comment: @Raul What did you end up doing with your math undergrad?

Double Cosets - Groups