How much nitrogen would you need to replace all oxygen in a room of 1,000 cubic feet?

Question: Imagine a room of 10x10 feet in size with a 10 feet high ceiling. The air in the room consists of roughly 78 percent nitrogen and 21 percent oxygen. The windows are shut closed and the gap under the door is sealed. How much nitrogen would you need to add, in order to reduce the oxygen level to less than 5%? For the sake of simplicity lets assume that the pressure in the room should stay the same as before, and that the surplus air just escapes.
Comment: This isn't Earth science, this is a homework question. Boo.
Comment: Do you know a better place to ask that? It is not a homework question, its just an interesting thought.
Comment: I am voting to reopen this question because I believe this isn't a homework question. He says: "For the sake of simplicity lets assume that the pressure in the room should stay the same as before." If this were a homework question, the teacher clearly wouldn't give that (the problem gets harder, not simpler : )
Answer: Your assumption about constant pressure can't actually exist while everything is closed. I am not using this assumption here because it is more correct and a bit easier:
$$\pu{10 feet} = \pu{3.048 m}$$
$$(\pu{10 feet})^3 = \pu{28.3 m^3} = \pu{28300 L}$$
We can calculate the amount of substance using ideal gas equation:
$$pV = nRT$$
$$n = \frac{pV}{RT} = \frac{101.325\cdot 28300}{8.31\cdot 293.15}\text{ mol} = \pu{1177 mol}$$
There is 78 percent nitrogen, 21 percent oxygen and 1 percent of other gases:
$$n(\ce{N2}) = 0.78\cdot n = \pu{918.06 mol}$$
$$n(\ce{O2}) = 0.21\cdot n = \pu{247.17 mol}$$
$$n(\text{oth.}) = 0.01\cdot n = \pu{11.77 mol}$$
The amount of oxygen is constant, but we want to reach 5%. Thus, the total amount of substance after the insertion of nitrogen is:
$$n'(\text{together}) = n'(\ce{N2}) + n'(\ce{O2}) + n'(\text{oth.}) = \frac{n'(\ce{O2})}{0.05} = \frac{n(\ce{O2})}{0.05} = \frac{\pu{247.17 mol}}{0.05} = \pu{4943.4 mol}$$
Also, $n'(\text{oth.}) = n(\text{oth.})$, thus:
$$n'(\ce{N2}) = n'(\text{together}) - n'(\ce{O2}) - n'(\text{oth.}) = \pu{4943.4 mol} - \pu{247.17 mol} - \pu{11.77 mol} = \pu{4684.46  mol}$$
So the solution is $\pu{4684 mol}$, but we can't imagine that easily. Mass of $\pu{4684 mol}$ of nitrogen is:
$$m'(\ce{N2}) = M(\ce{N2}) \cdot n'(\ce{N2}) = 2 \cdot 14.007 \cdot \pu{4684.46 g} = \pu{131.23 kg}$$
Also, the volume of such nitrogen at normal pressure is equal to:
$$V'(\ce{N2}) = \frac{n'(\ce{N2})\cdot RT}{p} = \frac{4684.46\cdot 8.31\cdot 293.15}{101.325}\text{ L} = \pu{112600 L} = \pu{112.6 m^3}$$
Thus, we need to add $\pu{112.6 m^3}$ of nitrogen to reach 5% concentration of oxygen. The answer seems reasonable because we need to add approximately 4 times of the original volume in order to lower the concentration 4 times.
Comment: @uhoh Thank you, corrected in the text (I replaced liters with cubic meters).
Comment: Can "112.6 L" possibly be correct? (10 feet/3.281)³ is 27.83 m³ or 27,830 liters, and 21-5=15% of that is still 4,452 liters. Am I missing something?
Comment: Wow thats an awesome and very detailed answer, thanks so much for taking the time!
Comment: Wouldn't the Oxygen in a real world scenario simply be pressed "out" of them room by the Nitrogen? If the room only holds 28.3m3 of total volume and you release 28.3 m3 of Nitrogen you should start to force out the normal room air with your new gas and lower the oxygen level. So while your answer is correct for a closed system one with a pressure exhaust would need a much lower amount right?
Comment: @TimMenser Imagine a bottle filled with nitrogen and oxygen. If you add the nitrogen, the mass of oxygen stays the same. I imagined that scenario because closed room with possible gas escape doesn't exist. (Closed room = no interchange, oxygen escape = interchange -> contradiction). But yes, with a pressure exhaust we would need lower amount.


How accurate must my gauge be?

Question: Is there a general rule of thumb for how accurate a gauge should be in compared to the parts being checked? In my chemistry class, I remember making standards where the instrument needed 1 more significant figure in compared to the standard solution we were creating. Is it the same rule for gauges?
Comment: Remember that accuracy and sensitivity are not the same thing - for accuracy, you need calibration. I wouldn't trust the last decimal point on a set of digital calipers for something 'mission critical'. The bigger question here, is what's the acceptable tolerance on the 'parts being checked'?
Comment: @JonathanRSwift that depends on the calipers,: my son looked at the calipers I bought (for 10 bucks) and said he could do better with a ruler :) - his set of calipers he uses for work are calibrated to 3 dp but cost SIGNIFICANTLY more...
Comment: I still wouldn't trust the last decimal point, if it were actually critical that you hit say 7.00mm+/-0mm. A screen that says that could be anywhere from 6.995 to 7.0049. Whether that matters or not, is up to OP to decide...
Comment: Please see this question and answer here: https://engineering.stackexchange.com/a/22340/2559
Answer: A measuring device will have as two main contributions to its accuracy and precision, a calibration uncertainty and a scale uncertainty.
Consider a ruler. It expands and contracts as it is heated and cooled. Consider a beam that is being measured by that ruler. The beam does not expand and contract at the same extent as the ruler. The measurements at two different temperatures will give two different lengths. This is the calibration uncertainty. It causes readings to be inaccurate.
Consider a ruler marked in millimeters and one marked in inches. The former has a scale (device) uncertainty of $\pm 0.5$ mm. The latter has a device uncertainty of $\pm 0.5$ in $\approx 13$ mm. Device uncertainties affect the precision of the measurements, not the accuracy.
The best approach to obtain a rule of thumb is to use relative uncertainties rather than absolute.
Consider that you will measure a beam that is EXACTLY 1 m long regardless of temperature. You measure on a cold day and on a hot day using a ruler that expands and contracts by ... say ... 100 microns. Your relative calibration uncertainty is $100/10^6 = \pm 100$~ppm. Using the millimeter ruler, your relative device uncertainty is $0.5/10^3 =  \pm0.05$%. Using the inch ruler, your relative device uncertainty is $13/10^3 = \pm 1.3$%.
As a rule of thumb, I routinely teach (in a colloquial manner) that better than $\pm 0.5$% is national labs standards, better than $\pm 1$% is calibration standards, better than $\pm 5$% is highly regarded, better than $\pm10$% is routinely reproducible, better than $\pm15$% is engineering seat of the pants, and anything higher than $\pm20$% is gossip.
Are these rules codified in some resource? Yes, in my hand-written or print out notes for some of my classes. Otherwise, no. The requirements for measurement tolerance (overall uncertainty) may be codified in a document that defines how the component is to be used. At that point, your job is to find a measuring device (gauge) that has no more than that overall uncertainty, presumably being better.
In summary, it is NOT about the "extra" number of significant digits. It is about the extent that you accept that you will have an uncertainty and will need to define/control it.
Comment: This also brings up a side-point about analogue vs digital measurements - with the ruler, the scale may be sensitive to only $\pm 0.5 \text{mm}$, but you have the advantage when reading it to be able to see *which end of that 0.5mm* it's at, i.e. is it closest to 7.0, or 7.5? A digital measuring device may offer less insight in the real world, even with an identical level of sensitivity.
Comment: What you "see" is irrelevant in the expression of the uncertainty. The valid report of a measured value of something that is with the given range of 7 in length will always be $7.0 \pm 0.5$ with any device that measures only to that degree of precision. The word "sensitivity" seems to be a colloquial for precision; I have never seen it in used in literature standards.
Comment: It's irrelevant in a statistical analysis/report, sure, but I was merely highlighting that in some situations, when offered an analogue or a digital scale, with the same sensitivity, it may be preferable to use the analogue scale, if you don't have access to a tool with greater sensitivity.
Comment: Sensitivity means how small the gradations on a scale are. A micrometer is more sensitive than a ruler. Precision means how closely grouped the measurements are each time, i.e. it's applied to the *measurements*, not the measuring tool. A broken micrometer with a dodgey ratchet spring that triggers when it's not touching the part may produce measurements that are extremely imprecise, where the ruler is more reliable here...
Comment: @JonathanRSwift Let's see what is said in [the GUM](https://www.bipm.org/utils/common/documents/jcgm/JCGM_100_2008_E.pdf). Sensitivity is a partial derivative the defines how one factor changes due to another with all else constant. What you call sensitivity is defined as precision. It is NOT dependent on time. What you call precision is better called frequency of measurement. A micrometer is _more precise_ than a millimeter ruler, not more "sensitive". I agree with the use of reliability and take issue with (incorrectly) calling a _broken_ micrometer imprecise rather than just unreliable.

How accurate must my gauge be?


How blockchain consensus verify the transaction?

Question: So many blockchain documentation tell that the blockchain uses the consensus to verify transactions. But what I understand the consensus only generate the hash to create the new block. I don't know why the documentation says that the consensus verifies the transaction while the transaction has been created (made) before the consensus run for creating the new hash for new block. The consensus flow does not care about the input (group of transactions), it doesn't know the transactions group are valid or not. Why the blockchain documentation say that?
Answer: I think part of the confusion here is the fact that the word "consensus" is used in two different meanings here.
Bitcoin has a concept of "consensus rules", which are the rules that all blocks and transactions must obey to be considered valid. They are called this way, because all nodes must implement them exactly the same way. If two nodes differ in their implementation of consensus rules, they risk ending up on permanently distinct chains (if both have hashrate and get blocks mined that are mutually inacceptable to the nodes).
In this sense, transactions are indeed verified according to the consensus rules before they end up in a block. Because transactions that do not follow these rules are simply ignored by nodes and dropped on the floor.
Yet, there is no consensus about these transactions. They're not in a block yet, so nodes have no way of knowing whether or not other nodes consider them part of the best chain. All they know is that they are valid, and eligible for inclusion in a block.
Answer: Every full node, such as a wallet like Bitcoin core, verifies all data independently.
Because all full nodes apply the same verification rules, they arrive at the same conclusion about the validity of the data.
Because these rules are the same in every node, they are called the consensus rules.
We say that the Bitcoin network reaches a consensus about the contents of the blockchain.

So the consensus is an emergent property of the network. It isn't a thing that performs actions. It is wrong to say

"the blockchain uses the consensus to verify transactions" (WRONG).

the blockchain is just data, it isn't an active agent that does things.
The consensus is just an emergent property, it isn't something that is used to perform actions.

"the consensus verifies the transaction" (WRONG)

the consensus isn't a thing that can perform actions.
nodes verify transactions

"the consensus only generate the hash" WRONG

the consensus isn't a thing that can perform actions.
miners calculate the block hash but so do all nodes that verify the block.

"before the consensus run for creating the new hash for new block." (WRONG)

There's no such thing as a "consensus run"
Hashes are not really created they are calculated from block data or transaction data that has been created. This may seem a minor distinction but I think it is important to be careful with words if we want to avoid confusion.
Answer: The consensus protocol is the guarantee for stable operation of blockchain system. Nodes or computer on the network agree on a certain value or transaction through consensus protocol.
Comment: The consensus flow encodes the transactions with the nonce for generating a hash string for the block only, that mean the transactions should be verified before the consensus, isn't it?


Find longest "binary gap"

Question: I'm doing a few challenges and I found this one on Codility:

A binary gap within a positive integer N is any maximal sequence of
consecutive zeros that is surrounded by ones at both ends in the
binary representation of N.
For example, number 9 has binary representation 1001 and contains a
binary gap of length 2. The number 529 has binary representation
1000010001 and contains two binary gaps: one of length 4 and one of
length 3. The number 20 has binary representation 10100 and contains
one binary gap of length 1. The number 15 has binary representation
1111 and has no binary gaps. The number 32 has binary representation
100000 and has no binary gaps.
Write a function:
function solution(N);
that, given a positive integer N, returns the length of its longest
binary gap. The function should return 0 if N doesn't contain a binary
gap.
For example, given N = 1041 the function should return 5, because N
has binary representation 10000010001 and so its longest binary gap is
of length 5. Given N = 32 the function should return 0, because N has
binary representation '100000' and thus no binary gaps.
Write an efficient algorithm for the following assumptions:
N is an integer within the range [1..2,147,483,647].

I have 3 solutions (one I found, another I wrote, and the 3rd was based on improvements made to mine)
function solution1(N) {
  const binaryString = N.toString(2);
  const start = '10';
  const end = '01';
  let startIndex = binaryString.indexOf(start);
  let endIndex = -1;
  let binaryGap = 0;
  // Remember that N is the
  // input number, and when you iterate over its binary representation, its always
  // log(N).
  while (startIndex >= 0) {
    endIndex = binaryString.indexOf(end, startIndex);
    if (endIndex < 0) {
      break;
    }
    const tempGap = endIndex - startIndex;
    binaryGap = tempGap > binaryGap ? tempGap : binaryGap;
    startIndex = binaryString.indexOf(start, endIndex + 1);
    endIndex = -1;
  }
  return binaryGap;
}

function solution2(n){
    const results = n.toString(2).split("1").slice(1)
    return results.reduce((acc,next,index)=>(next.length>acc && index<results.length-1  ? next.length : acc) ,0)
}

const solution3 = (n) => n.toString(2).split("1").slice(1,-1).reduce((acc,next,index)=>(next.length>acc ? next.length : acc) ,0)

All seem to be correct (and the solution 2 and 3 passed the test), and the solution 1, according to JSBench is slightly better, but because in the real-world every time we write code we don't test it to see which version is faster, I am curious about which solution is the most elegant and which one would you pick on a real-world scenario (if any one of them fails the challenge you can explain why, but I would love to still hear which one is the best and why, is it because is simpler to maintain/understand, more readable, declarative vs imperative, etc).
Answer: All your solutions involve converting the number to a string.  That is more likely to impact performance than any of the other operations you perform.
If you keep the input as a number, you should be able to avoid allocating any new objects, including strings, which will improve your code's performance.

Find longest "binary gap"


If I want to make a website of a long bike tour, should I make my own website or pay some one to do it for me?

Question: I am planning on going on a long distance bike tour, and I want to have a good website to blog on, post photos, twitter tweets, and videos. Does anyone have any advice for whether I should build it myself, or pay someone else. Is it worth it or should I just keep a personal journal? I do feel like it would be cool to communicate online, but there are a lot of blogs online about that stuff and it seems pointless to add another.
Comment: As per our [faq], soliciting discussion is not the right format for this site.  Perhaps defining what you're after, rather than asking whether it's worth it, would be a better approach.  Really only you can decide if it's worth it.  Some like the challenge of building everything and tinkering for hours, others not so much.  You may even get better answers in http://webapps.stackexchange.com/ ?
Comment: Have you tried the usual suspects? Like http://www.blogspot.com, http://www.livejournal.com, http://www.makeuseof.com/tag/5-blog-sites-wordpress-blogger/
Comment: Designing a theme for general purpose blogging software is not to hard if you have some experience with web development (without it, you're in for a ride). However, general purpose blogging software is hardly optimal for travel blogging, where you would likely want to include, for example, some maps and a dedicated photo gallery.
Comment: I was hoping to make something a little more custom, and perhaps have a go at designing something myself. Although I need to do some research on quality travel blogs.
Comment: Then you might want to specify the criteria in a little more detail.
Answer: Allow me to recommend traveljournal.net. It is developed by me, while traveling the world and optimised for use on the road.
It has all the usual features: blog, photo albums, map (you can upload GPS-logs), secure document vault, etc.
One of the things that really sets it apart from other options? no advertisements whatsoever and designed to work wherever you are, even when the internet connection is slower than sending a postcard.
It is continuously updated/developed by someone who actually travels around and uses the service himself. I eat my own dogfood, so to say : )
Update
The answer from unor talks about ownership of the content. With TravelJournal.net, the writers are and will always be the owner of all content they publish (provided they do not republish copyrighted materials offcourse).
Also, because many traveller manage their journals over insecure, often publicly shared networks (wifi, etc) every journal comes standard with SSL/TLS security build in. So, whenever you login or otherwise perform any sensitive action, your connection is secured with the same level of encrypted as web shops use (or at least, they should) to secure payment transactions.
Comment: It depends on what you are after. *traveljournal.net* is optimised for use while on the road. An enourmous amount of efforts has been put into making sure it 'just works' even on the most crappy internet connection you can imagine. The hosting and support is all done for you, so you don't have to worry about any of the technical aspects. I also try to continuously develop new or improve existing features, many times on request of people using the site. (I like your suggestion of wordpress import/export functionality).
Comment: However, if you are looking for the latest sexy interface and beautifull design, you may find *travejournal.net* lacking (I'm not a designer and I don't have the budget to hire one). Wordpress has designs in every flavour and many plugins try out. Unfortunately, as a result wordpress is not 'light weight' by any means. The other thing, offcourse, is tha you'll have to take care of the hosting and technical stuff yourself.
Comment: whats the benefit of traveljournal.net over standard wordpress + plugins? Can I import content I already wrote so far into traveljournal.net e.g. migrate to it?
Comment: thanks for the honesty. Will check out your site. Probably need something more custom though.
Answer:
but there are a lot of blogs online about that stuff and it seems pointless to add another.

There are never enough blogs on any topic.
See http://the-pastry-box-project.net/chris-coyier/2013-january-2/.
What things to consider especially for travel blogs?

the backend (where you create your content and config your blog) should be accessible from mobile devices; if it's no fun / not easy, you'll probably don't post so much
if a problem occurs, you should be able to handle/fix it on tour (or contact someone who can do it for you)
backups should be done automatically (e.g. send a database dump daily to a separate mail account)
if you use internet cafés and/or untrusted networks, your password could be stolen; don't use an admin account to post/edit content; but have admin login available for emergencies (e.g. to delete compromised user accounts)
good suggestion by Andra: functionality to add new posts by email

Self-hosting vs. 3rd party service
Self-hosting
advantages

you get exactly what you want
it's your content, you have full control, you can backup it (some services allow this, too, but not all)
no policies, no censorship, no rules, no service terms
you can fix any problems yourself (and don't have to wait for the provider to do it)
you can create/use accounts with lesser privileges (security)

disadvantages

costs more time
costs money (hosting)
need to know that stuff (resp. dig into it)
you have to update the software yourself (security)
you need to fix any problems yourself ;)

3rd party service
advantages

no setup, no configuration, no updates
(usually) no costs

disadvantages

might not offer exactly what you need; customization possibilites are limited
you don't "own" your content; (often) no backup possibility
you have to respect their service terms
(often) ads
you can't do anything if it goes down
(often) you have only one account; if your password is stolen, your account is lost
risk of being deleted (for no reason), risk that the service might shut down forever
Comment: "*you have only one account; if your password is stolen, your account is lost*" The issues with stolen passwords are the same, if not worse, for self hosting.
Comment: @Jacco: If you use an account *without* admin privileges, the thief can only post/edit/delete blog posts. Because you are hosting it yourself you also have the admin account, so you can change password/email for the compromised account. If you'd use a 3rd party service, you'd have to persuade the provider that *you* are the real owner, which would take time; depending on the service, it might not be possible at all. Combined with no built-in ability for backups this is a bad situation.
Comment: ah. You make two false assumptions here. 1) only 1 account per blog. This is not true for many services. 2) no build in backup, again not true for many services.
Comment: @Jacco: 2) at 3rd party disadvantages I wrote "(often) no backup possibility". 1) You are right, I'll add "(often)" to it, too. It's probably most of the time true for services which host an own installation per user (e.g. wordpress.com), but rare for services that provide a ready-to-go solution without much configuration possibilty (e.g. tumblr.com).
Answer: I would go for an "email approach". Different blog platforms seem to support this feature, where you can provide the content for your blog by email. I am an avid user of Posterous. , but I was told that wordpress plugins exist that do the same.
The workflow is easy, you post a blog by posting it to firstname.lastname@example.com. Photo's, films and the like are added as attachment to the mail. You register by sending an initial mail. On the first email, your emailaddress is registered and you will get a respons explaining the following email.
Personally I dislike custom made blog platforms, for the simple reason that they often requires instant and good internet access, an asset not alway available while traveling.
With an email approach you can blog while being offline, by just writing an email in an offline email client such as Outlook, mail, eudora, thunderbird, etc. The moment you have access, posting your content is just as simple as pressing "submit" or "send".
Especially in the case you need to buy internet time on an hourly base (internet cafe, paid wifi), you don't want to lose that time on writing blog content.
Weather or not it is worthwhile, definitely! You are right that there are many blogs around, but there is no such thing as "the" traveler, so the more blogs the merrier. I am saying this because I am getting a lot if not most inspiration and information form personal blogs.
Answer: Jekyll, or similar.
This generates the website on your computer, which means you can write and edit everything offline, like in your tent anywhere, and then upload it when a connection is available. It also means you can write with a proper text editor, not some textbox in a webpage.
Answer: There's a third-party solution out there that's specific to bike touring journals: Crazy Guy on a Bike is a solution for touring cyclists to post journals.
It's also a community of touring cyclists. There are forums and classified ads, and, most importantly, thousands of journals already hosted. You can host photos there, and embed videos and maps.


Adding Sounds and Slowing Pronunciation for "Proper Speech"

Question: I routinely hear a relative add syllables to words to sound more "correct."  "menu" becomes "men-a-you." "Daily" becomes "day-uh-lee."  It seems to be coupled with a slowing of the pronunciation in imitation of a register of English "higher" than the casual Midwestern dialect. The subject is from Iowa and Minnesota, and has spoken German fluently, but English is the first language. What is this?
Comment: Pure speculation, but the speaker could be breaking unstable segments down into syllabic units. You'd need to show me more examples, but both [mɛ.nʌ.ju] and [de.jʌ.li] involve the syllabification of a sonorant which might be otherwise 'absorbed' into another segment, i.e. [mɛ̃.ju~mɛ̃ɲu], [deɪ̯.li]. If they're trying to speak 'more clearly', this syllabification might be a means the speaker is using to avoid the loss of underlying segments.
Answer: There is the term hypercorrection for this kind of phenomena, although I am not sure if it is applicable to your example.
A typical example for hypercorrection is the following: A native speaker of the palatinate dialect (rheinfränkisch) does not discriminate the sounds /i/ and /y/ in dialectal pronunciation. So High German kümmern becomes kimmern in the dialect. Trying to speak High German, by analogy, forms like *schwümmen for schwimmen come up.
Comment: This came to mind for me too, but I agree it could have another explanation — some phonotactic trouble in their idiolect...


Why Do we consider the serial connection between routers a subnet?

Question:
The image attached was included in a question where I was required to design the network f0r the classful network address 172.16.0.0, and it says that each circle represents a subnetwork. My question is why would we consider the connection between 2 routers as a network? Does a connection between 2 routers even need an IP address?
Comment: Typically in a point to point connection you will always need two IP addresses, one on each physical interface. The subnet used could for instance be a /30.
Answer: Just a comment about terminology and how it colours our view.
"Subnet" is a word which really suggests there are classful, "full", networks which are divided into portions called subnets.  (See for example the diagram on p6 of RFC 950 "Internet Standard Subnetting Procedure").  This hasn't been real life for decades.
The current classless mechanism (RFC 4632) just recognises the network portion and the host portion of the address.  We don't have subnetworks, just networks of various sizes.
With this modern view, the network with just two things on it is merely a small network.
What is the internet? It's an "interconnected network of networks" -- the normal definition of "internetting" (wiki).  So pretty much all networks are connected at their edges.  Your example drawing is four networks joined together by two routers.  It happens that there are no endpoint hosts on one of them.
The dominance of the internet has meant that we think of connecting our things to the internet -- inherently an assymetric view of the world.  Technologically though, what we actually have are small networks (an office, say) joining a big internetwork by making a new two-router network in between.

Does a connection between 2 routers even need an IP address?

No, you can run IP point-to-point links unnumbered, and many people do.  It's a little known fact that in principle, routers don't need any IP addresses on any interfaces.  This is because when a host forwards to a next-hop router, it sends the packet inside a suitable layer-2 frame such as ethernet or PPP, and that packet has the ultimate target's IP address as destination.  The IP address of the next-hop router was only used to find the layer-2 address.  In practice, however, IP routers always have at least one address, so you can connect to it for configuration, and (as far as I know) there are no operating systems for hosts or routers which permit ethernet addresses as the address of the next-hop router.  A secondary reason is that ICMP packets from the router (eg time exceeded etc) normally come from the nearside address.
Answer: Forward traffic by gateway IP address is router's function, every network(such as VLAN) has gateway IP address on router(or third layer switches) , the router every port has different network's IP.
And the two routers border to each other should in one network, then they can communicate, because they are transfer data in layer 2 by MAC address as source and target address, router is the 3rd layer device, between two routers there is no device for forwarding networking traffic.
Comment: "every network(such as VLAN) has gateway IP address"  ... that is an oversimplification I would dare to call dangerous.  There are countless IP networks that have no gateway of any form, because the design does not want them to. For example private inter-host networks that should never become reachable from anywhere else at all - sometimes even implemented on separated switches. IP networks they are -  routers or gateways, they have not.


Filtering Long-duration Signal

Question: I have a long-duration EMG signal (~4 hours long) with a sampling frequency of 1 kHz. If I want to filter the data with a low-pass filter in 10 Hz in MATLAB, should I filter the signal with moving window? I am using Butterworth (4th order) IIR filter.
Comment: What is the sample rate?
Comment: 1000 Hz @DanielKiracofe
Comment: If you use an IIR filter (rather than an FIR), what advantage do you expect to get by using a moving window as well? As you said, a moving window is just another type of filter.
Comment: could you maybe comment on why you want to apply a moving window? Is it because of memory or CPU considerations? Or is is supposed to run "on-line" so you do not have the complete signal in one point in time?
Answer: First, I'm assuming that by "moving window", you mean breaking the signal up into smaller chunks and filtering each chunk separately.  In the signal processing word, "moving window" would often mean an FIR filter (e.g. fir1() in matlab), but because you explicitly said you are using butterworth filter, which is an IIR filter, I assume that is not what you are talking about.  If I am wrong, please edit the question to clarify.
Now, 4 hours at 1000 S/s would occupy about 100 Mb of ram.  That's big, but not outlandish.  Assuming you have a 64 bit processor and a decent amount of RAM (2 GB or more), there is no reason to break this up into smaller chunks.  I filter vectors of 100 MB in one single pass (i.e. without breaking them up) all the time. Any computer built within the past 3 or 4 years should be able to handle this just fine.  10 years ago the answer would have been different.
Answer: The short answer is you should not use a moving window because the moving window itself creates a low-pass-ish filtering effect.
But as @DanielKiracofe already stated you could slice the signal up into smaller segments and filter those. Of course you need to be careful that the your window size fits your low-pass filter.
However, in order to circumvent the problem of stitching the slices together I would use a short segment (duration: 10s) of the signal to test your code and and than run filtfilt on the whole signal to reduce phase-shifting.

Filtering Long-duration Signal


Can somebody explain "leveraged debt investment positions" and "exposures" in this context for me, please?

Question: "The strong bond performance has led to a surge in leveraged debt investment positions that are ultimately funded by the banks' interbank exposures and WMPs. But nobody really knows how levered these positions are, who has financed them, and by how much," S&P said. "The contagion risks for the financial sector could be high."
source: http://www.cnbc.com/2016/03/16/china-banks-face-credit-risks-from-ties-to-wealth-management-products-other-banks.html
Comment: could you link the origin please?
Answer: Exposure is the amount of money that you are at risk of losing on a given position (i.e. on a UST 10 year bond), portfolio of positions, strategy (selling covered calls for example), or counterparty, usually represented as a percentage of your total assets.
Interbank exposure is the exposure of banks to other banks either through owning debt or stock, or by having open positions with the other banks as counterparties.
Leveraging occurs when the value of your position is more than the value of what you are trading in. One example of this is borrowing money (i.e. creating debt for yourself) to buy bonds. The amount of your own funds that you are using to pay for the position is "leveraged" by the debt so that you are risking more than 100% of your capital if, for example, the bond became worthless). Another example would be buying futures "on margin" where you only put up the margin value of the trade and not the full cost.
The problem with these leveraged positions is what happens if a credit event (default etc.) happens. Since a large amount of the leverage is being "passed on" as banks are issuing debt to buy other banks' debt who are issuing debt to buy debt there is a risk that a single failure could cause an unravelling of these leveraged positions and, since the prices of the bonds will be falling resulting in these leveraged positions losing money, it will cause a cascade of losses and defaults. If a leveraged position becomes worth less than the amount of real (rather than borrowed or margined) money that was put up to take the position then it is almost inevitable that the firm in that position will default on the requirements for the leverage. When that firm defaults it sparks all of the firms who own that debt to go through the same problems that it did, hence the contagion.


Gauss Law - tangential component discontinuity at dielectric boundary

Question: Let's say we have a dielectric slab $x < a, z > -1$ and a plane $z=-1$ with a surface charge of $\sigma$. Gauss law states that: $$\oint_S D dA = Q_{free}$$
Dielectric has no free charge so electric displacement field can be expressed as electric displacement field of a plane:
$$D = \frac{\sigma}{2}$$
Where $\vec{D}$ points in positive $z$ direction for $z > -1$. Then electric field along the x axis can be expressed as:
$$\vec{E(x)} = \left\{\begin{array}{ll}
\frac{\sigma}{2\epsilon_0}\hat{z} & \textrm{for $ x > a $}\\
\frac{\sigma}{2\epsilon_0\epsilon_r}\hat{z} & \textrm{for $ x < a $}\\
\end{array}\right.$$
Which causes a discontinuity at $x = a$ at the surface of a slab $x < a, z > -1$ but tangental component of $E$ field should be continious across the interface. What part of electrostatic theory am I missing?
Comment: What is D supposed to be? If there is surface charge then D is discontinuous.
Comment: I don't have time to type out an answer. But if you have access to Griffith's Introduction to Electrodynamics, check out chapter 4.
Comment: If your surface is $z=-1$, whose normal is $\hat{z}$, then how is $\vec{E}$ along $\hat{x}$?
Comment: I'm talking about discontinuity of electric field across the boundry of dielectric slab and free space. Edited question a bit to add versors.
Comment: Isn't this the typical example of showing the dangers of applying Gauss's law for the electric displacement across a discontinuous boundary?
Comment: Maybe it is, I haven't been taught about those dangers. Can you give me some sources that explain why you can't do that?
Comment: There are 3 objects in this example, charged plane $z=-1$ dielectric slab $x−1$ and vacuum everywhere else.
Answer: So there is two surface $x=a$ and $z=-1$, so the surface integral can't simply be ordinary integral and in that way it is not that straight forward expression of $\vec{E}.$
Comment: I'm talking about discontinuity of electric field across the boundry of dielectric slab ($x < a, z > -1$) and free space.
Comment: Oh yes I see, then you can't simply evaluate the Gauss integral, as there is two surfaces. One $x=a$ and other $z=-1$. So the simplification of surface integral into proper integral will not be valid.
Comment: Dielectric doesn't have any free charges so it shouldn't affect the D field, is the equation for E field incorrect?
Comment: D is also a vector quantity, so you should figure out what is the direction of that vector. I think you can't or it is difficult because of the surface integral. The expression of $\vec{E}$ is correct, if $\vec{D}=\sigma/2\hat{z}$, but it think its not. $\sigma/2\hat{z}$ is when you have an infinite plane $x=a$, but its not.
Answer: I think your equations for $\bf E$ do not apply at the edge the dielectric in this situation, owing to the polarization being in a direction different to $\bf D$ near the edge. However I have not worked it out fully so am not quite sure.
Answer: The tangential component of the electric field across the interface at $x=a$ is continuous, so your expressions for the E-field are incorrect.
If there is an intersection of a charged plane with a dielectric, then you cannot assume there is no field tangential to the charged plane as you would for a plane in a vacuum. There will be a tangential component to the conducting plane (i.e. a normal component to the dielectric plane) because the symmetry of the usual infinite charged plane problem is broken.


Find all instances of a type associated with another type

Question: I have some classes that look like this:
class User {
    boolean enabled
    String username
}

class ExampleClass {
    User firstUser
    User secondUser
}

My end goal is to find all instances of User where enabled == true OR the instance of User is associated with ExampleClass.
Where this code is running I don't have access to the variable names firstUser or secondUser.
With that said, I need to be able to find all instance of User associated with ExampleClass, disregarding which variable (firstUser or secondUser) the association was made through.  How do I do this?
UPDATE:
The best I can come up with is this method in my User domain class.  I the example I gave above I have an ExampleClass which has multiple fields of the User type.  In fact I have multiple classes with multiple fields of the User type.  This is why I get the domain class from the object being passed in instead of just typing ExampleClass.
static List findAllEnabledOrAssociatedWith( Object obj = null ) {
    if( obj?.id ) { // Make sure the object in question has been saved to database.
        List list = []
        obj.domainClass.getPersistentProperties().each {
            if( it.getReferencedPropertyType() == User ) {
                def propertyName = it.getName()
                list += User.executeQuery( "SELECT DISTINCT ${propertyName} FROM ${obj.class.getSimpleName()} obj INNER JOIN obj.${propertyName} ${propertyName} WHERE obj =:obj", [ obj: obj ] )
            }
        }
        list.unique()
        return User.executeQuery( "SELECT DISTINCT users FROM User users WHERE users.enabled=true OR users IN(:list)", [ list: list ] )
    } else {
        return User.executeQuery( "SELECT DISTINCT users FROM User users WHERE users.enabled=true" )
    }
}

Answer: def sql = '''
    from
        User u,
        ExampleClass ex
    where
        u.enabled = 1 or (u = ex.firstUser or u = ex.secondUser)'''
def users = User.findAll(sql)

Comment: "Where this code is running I don't have access to the variable names `firstUser` or `secondUser`." <-- quote


Estimating unknown weights of various parameters in an equation

Question: I have an equation which has some unknown weights attached to various parameters.  None of the weights are known. However, I have a history of data available with me which can be used to predict the unknown weights (at least approximately), may be after some trial and error and then one can use various optimization measures to improve upon the unknown weights. Is there any particular mathematical approach or software that can help to predict the weights in the least amount of time? (The number of data points is huge so that solving the equations for the unknown weights is not possible as the weights, which are the solutions of the equations, might be different for different sets of data points. So, getting an approximate estimate of the weights is the only choice)
Answer: You are referring to multidimensional minimization.  You are minimizing the error of a model depending on your weights (parameters).  The error is usually the sum of the squares of the  differences between the model prediction and the actual data. There are whole books on the subject, and introduction is in any numerical analysis text.  I haven't read many, but like Numerical Recipes.  Obsolete versions are free online.


How can I get the number of customers that bought a product?

Question: I am in product view page, and I want to display the number of customers that bought that particular product.
Answer: If you want to know how many different customers bought an item, you can try this (guest orders are summed as one customer):
<code># $product = Mage::registry('current_product');
$product = Mage::getModel('catalog/product')->load(450);
$orders = Mage::getResourceModel('sales/order_item_collection')
    ->addFieldToFilter('sku', $product->getSku());
$orderIds = $orders->getColumnValues('order_id');

$collection = Mage::getResourceModel('sales/order_collection')
    ->addFieldToFilter('entity_id', array('in' => $orderIds));

$countByDifferntCustomers = count(array_count_values(array_map(function($v) {
    return (is_null($v)) ? "?" : $v;
}, $collection->getColumnValues('customer_id'))));

if ($countByDifferntCustomers) {
    echo $countByDifferntCustomers . ' customers bought this product';
}
</code>
Comment: Updated answer.
Comment: Thanks its working fine!!!
evry time you come to help me...Thanx @sv3n
Comment: I also make condition here, if that product is already brought by someone. If not, then dont show this text. How could i achieve this?
Answer: <code>$productId = 123; // enter your product ID here
$product = Mage::getResourceModel('reports/product_collection')
    ->addOrderedQty()
    ->addAttributeToFilter('id', $productId)
    ->setOrder('ordered_qty', 'desc')
    ->getFirstItem();

echo 'Total number of brought '.(int)$product->ordered_qty;
</code>
Let me know if it does not work for you.
Comment: No such option :(
Comment: I have edited my answer please check it.


How to keep endermen in an arena?

Question: I'm making an arena minigame, and I realized a problem with the endermen: they would teleport out of the arena if left alone too long. I cannot fill in the area around the arena because the lobby is right next to it, and I really don't want to disable all the command blocks summoning the endermen. If the endermen cannot be kept in the arena, can they at least, through commands, be convinced to teleport back into the arena?
Comment: Use boats. Then they wander in the boats and get stuck. Or use water.
Comment: I'm sure Mojang added a command to summon them without teleportation.
Answer: The rm parameter allows you to obtains targets outside an area. You can use this to teleport endermen that left back to a certain location.
The following teleports endermen that are 50 blocks away or further from the specified coordinates back to the specified coordinates.
/tp @e[type=Enderman,x=10,y=64,z=10,rm=50] 10 64 10

Answer: You have several options:
1) Move the arena to a far place, then fill out the surrounding space. To get to the arena use /tp.
2) Fill all exposed ground with slabs, water, …
3) Place a repeat and alwyas active command block with this command:
/testfor @e[type=Enderman, x=X, y=Y, z=Z, r=ArenaWidth]

Then, place another repeat, always active command block testing if the 1st command block returned a false output. I'll use XC, YC and ZC as its coordinates:
/testforblock XC YC ZC minecraft:command_block -1 {SuccessCount:0}

Next to that command block place another one, this time chain:
/summon Enderman X Y Z

In both cases X, Y and Z above are the same coordinates.

How to keep endermen in an arena?


Geometric nodes - How to set/offset position of a specific edge's vertices

Question: How can I set/offset position of vertices of specific edge?
In the follow example given a plane with 9 faces. When setting a value in the node "Integer: Index of edge", the two vertices connected to the edge with that index should be offset up by 0.2.
Answer: (Using Blender 3.6.5)
The edge is firstly recovered with two Sample Index nodes set in Edge domain, before its end vertices index is recovered with Edge Vertices nodes. It is to notice that the node Set Position is acting in Point domain.

Resources:
Answer: The follow solution adds a boolean flag attribute for each edge. When an edge's flag is True, its vertices are selected because of the flag value that is interpolated into the vertices domain in the selection process.
This solution has several advantages:

It has a smaller graph.
When wish edge index is out of range, no point will be offset.
It can be easily modified for selecting several edges by changing the logic inside the "Edges chooser" frame.

For example, here is a modification for when we want edges 0,1,2,3 to be offset:


Magnetic field outside permanent magnet

Question: Magnetic field outside permanent magnet after field lines are contained in iron core.So there is no field outside a magnet. Then how external magnet will interact with enclosed magnetic field
can same polarity magnet repel or attract .
Comment: Can you edit your question to clarify what you are asking
Answer: I am not sure what you are asking with this question. I think that you are asking what would a magnet do if it is near other magnets that are between 2 blocks of steel that are taking the magnetic field from the magnets that are attached to it.
In the image that you have shared the end blocks would be steel and would re-direct most of the magnetic field from the magnets that are between them. This magnetic field that is flowing through them would make these steel blocks act like a magnet. A good example of this is the blog post from K&J Magnetics, Does Steel Block or Improve Magnetic Strength. The paperclips that are stuck to the magnet in the first part of the post become a magnet and can attract other ferrous materials.
The external magnet in your scenario would be attracted to the opposite poles of the magnets in the steel blocks or it would be attracted to the opposite pole of the magnetic field induced in the steel blocks.
Comment: Thanks for answering, but i was thinking magnetic direction inside and outside are different.so that's why i was asking if magnet will act differently in this arrangement?

Magnetic field outside permanent magnet


What is the relation between iproute and iproute2?

Question: I'm little confused about the two packages in linux.

Which one should I use?
Does iproute2 obsolete iproute?
Do they have different linux kernel dependency?
Why change the package name, instead of releasing a new version?
Answer: I think there may have once been the first major release of iproute ("iproute1" for the sake of clarity), back in year 2001 or so. But it was quite short-lived and now is all but forgotten and thoroughly obsolete.
The fact that the number 2 was added to the name of the upstream source suggests that iproute2 was probably a major/total rewrite of the old "iproute1" and possibly incompatible with it in some ways. The developer may also have restarted the actual version numbering from zero at that point, creating ambiguity if the name of the new release did not include the 2.
Distributions which had at one point included the "iproute1" would naturally call this re-written version iproute2 as that was the name suggested by the upstream source. Other distributions that had skipped "iproute1" altogether could package the iproute2 tools as either iproute or iproute2, according to each distribution's package naming policy.
It's essentially a trade-off between the desires to have packages with simple names, and to follow the name established by the upstream source when possible. Each distribution can make their own choices.
The other Linux network tool kit that is currently known as net-tools is also known as NET-3. At around the time of the 1.2.xx kernel series, its predecessor NET-2 was used. And at some point (maybe the transition between the 1.x.x and 2.0.x kernels?) it was important to use the correct set of tools for the respective major kernel versions.
So in a sense, there is a precedent to including the major release number to the name of the networking tool kit.
Answer: It seems that both names refer to the same package.
On Centos / RHEL / Fedora the package is called iproute and its homepage is listed as http://kernel.org/pub/linux/utils/net/iproute2/
OpenSUSE has the package called iproute2 and its home page is listed as https://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2 but the source code is at the same place.
Debian / Ubuntu it is iproute2, and it again comes from https://wiki.linuxfoundation.org/networking/iproute2
So, it is the same package.
To answer the last question, on Ubuntu the iproute name has been obsolete since at least 14.04 LTS ("transitional dummy package for iproute2"). Dropping the transitional name four years later is not unheard of. In 18.04 LTS it is still marked with "Replaces: iproute".


InvalidOperationException: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation

Question: I got the following exception:
Exception Type: System.InvalidOperationException
Exception Message: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The possible cause is that a context was Set on the thread and not reverted(undone).
Exception Stack:   at System.Threading.SynchronizationContextSwitcher.Undo()
at System.Threading.ExecutionContextSwitcher.Undo()
at System.Threading.ExecutionContext.runFinallyCode(Object userData, Boolean exceptionThrown)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteBackoutCodeHelper(Object backoutCode, Object userData, Boolean exceptionThrown)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Exception Source: mscorlib
Exception TargetSite.Name: Undo
Exception HelpLink:

The application is a Visual Studio 2005 (.Net 2.0) console application. It is a server for multiple TCP/IP connections, doing asynchronous socket reads and synchronous socket writes.
In searching for an answer I came across this post which talks about a call to Application.Doevents() which I don't use in my code.
I also found this post which has a resolution involved with Component which I also don't use in my code. The application does reference a library that I created that contains custom user controls and components, but they are not being used by the application.
Question: What caused this to happen and how do I prevent this from happening again?
Or a more realistic question: What does this exception actually mean? How is "context" defined in this situation?
Anything that can help me understand what is going on would be very much appreciated.
Answer: context refers to as "Thread Context" and is not in any way related to your code.
However it is an internal issue with .net which could be only limited to beta editions


open atrium features

Question: I installed Open Atrium, and there are no default features showing under the features admin panel. No shoutbox, wiki, blog or calendar. Did I choose a stripped down version of Open Atrium to install by accident?
Answer: No, you have to turn those features on if you'd like to use them.
Create a group and then in that group go to Settings -> Customize Features, here you can enable the features you need.
Comment: that's what I am saying not that they are not enabled but are not even included in the package I downloaded from open atrium. I see nothing at Settings -> Customize Features, and my install of open atrium sites/all/modules folder is empty
Comment: I see on the screenshot that you are on the wrong place. You have to create a group and then find the Customize Features in that group's settings.

In OpenAtrium you can create multiple groups for multiple users and each group can be set up differently. For one group maybe just Notebook needed, for another maybe all features needed, we have the ability to customize them.
Comment: /admin/build/features here all features say default but can not add to dashboard do I have to add a group first?
Comment: Yes, you have to create a group first. Go to front page -> Groups -> Add group to create a group, the rest is described in the second comment.

open atrium features


Which Google Account set up the Analytics?

Question: i have a few different web sites w/ Analytics loaded on.    One site is not showing up in my analytics reports because i think it was set up by someone else working for me at the time.  I know the "UA-xxxx" code.   How do i find out which analytics account it is associated with so i can get in there to see the data and/or transfer elsewhere?
Comment: If possible you will need to contact the previous admin to provide you admin access. It's always a good idea to keep your list of trusted admins updated, and to have more than one at any one time.
Answer: If you have access to that account it will show up in your Google Analytics home screen (UA-ID is displayed next to the name of a property). If your Google Account has no access to the Analytics account then knowing the UA-ID won't help, you will not have access to the data.
Answer: If the Analytic account is yours, you can go to "Admin", on the second column choose "Property settings". Now on property setting on left sidebar, choose your site and you can see the tracking code UA-ID


Multi-file gather using selectable file channels

Question: I implemented a multi-file gatherer input stream which is able to read and combine data from previously scattered file segments. However, the current version uses RandomAccessFile along with fixed size ExecutorService, and with lots of CPU overhead. I'd like to avoid these I/O threads and perform a single threaded Selector based approach. Unfortunately, FileChannel (or JDK7's Path.newByteChannel()) is not selectable. Is there a way to do this data-gather in an NIO way?
Comment: Could you try and narrow down the cause of the CPU overhead first?
Comment: Unfortunately not. VisualVM does not work on my Win7 (throws NPE somewhere deep)
Comment: Can't you just cycle through your file channels round robin and use blocking reads?
Comment: I do blocking read() on each RAF in threads, then join the results. I hoped there is a non-blocking way of doing it - similarly to ServerSocketChannel and SocketChannel.
Answer: Look at jdk7's AsynchronousFileChannel.
Answer: Very late answer but why does it have to be Selectable? It has scattering reads and gathering writes, and files are always ready for reading and writing. So why Selectable?


How to prepare outlook for exchange to googleapps migration

Question: I am switching over roughly 15 users to googleapps, with everyone still using outlook. The migration from exchange to google will happen via individual .pst files syncing to google then pullen down in to outlook from google.
We are in the backup phase, and wondering the best practice for appending the .pst's. How are new messages added? I have been going the route of backing up to the same .pst, opting to "allow duplicates" and wondering if this the best to add new messages since the last backup.
We are on outlook 2010.
Any other suggestions on securing backups is welcome.
Comment: Have you considered performing the mailbox backups through your Exchange server?
Comment: Don't have access to the exchange server, and our admins want it done via outlook .pst, sync with gmail, then download back to outlook once gmail servers are active.
Answer: I would suggest a hard cut-off where PSTs are created and uploaded to Google same-day.  You would possibly have messages arrive during/after the PST migration but likely, they would be few.  I would think that the duplicate message option could cause some confusion.
Answer: Never messed with Google Apps, but the below logic is sound enough:
Set Outlook to deliver mail to the PST instead of the Exchange mailbox for now.
Then setup their mailboxes in google apps and "migrate" mail flow (SMTP) to point to Google Apps.
Verify new mail is flowing into their Google Apps mailbox(es).
Setup Outlook with a new profile to connect to their Google Apps mailbox.
Sync the (now static) PST file used with Exchange to Gmail/GoogleApps mailbox.
(unless there's some reason why Google Apps wouldn't allow for the above or your own internal processes won't allow for it, it's logic is generic enough it should work fine.


What story was Jack telling when Elizabeth fell?

Question: What story was Jack telling when Elizabeth fell? Can someone provide the whole story?
Answer: The scene was ad-libbed by Johnny Depp. It's a reference to The Fast Show (which Depp is a fan of), where Patrick Nice often says "...and [something happened]...which was nice". In one episode, Nice explicitly says this line:

...and then they made me their chief... which was nice.

That said, the second movie: Dead Man's Chest involves Sparrow as the chief for the Pelegostos Tribe. According to the DVD audio commentary with Ted Elliott and Terry Rossio, this is the second time that he has visited them, with the first being the one that was referenced by this line.
The full story of his initial adventure with the tribe was never explained. TV Tropes would call this a noodle incident.
Comment: {four hours later} God DAMMIT, put some warning on a TVTropes link. x_X
Comment: As it turns out, no.
Comment: @Shadur Isn't "TV Tropes would call this a noodle incident" sufficient warning that the link is to a TV Tropes page?
Comment: @Shadur Well, suggest an edit that makes it more obvious and I'll approve it.


Use of Concentration for pH

Question: When we find the pH of a solution, do we use normality or molarity? My teacher said that if the compound is present by itself, we can use normality but in all other cases we should use molarity. Can you explain why?
Answer: Current definition implies that $\mathrm{pH}$ is a function of relative activity.
Originally, the amount concentration of  $\ce{H+}$ in $\pu{mol L-1}$ was proposed, which is also often used these days as an approximation [1].

$\mathrm{pH}$ was originally defined by Sørensen in 1909 … in terms of the concentration of hydrogen ions (in modern nomenclature) as $\mathrm{pH} = −\lg(c_\ce{H}/c^\circ)$ where $c_\ce{H}$ is the hydrogen ion concentration in $\pu{mol dm–3},$ and $c^\circ = \pu{1 mol dm–3}$ is the standard amount concentration. Subsequently …, it has been accepted that it is more satisfactory to define $\mathrm{pH}$ in terms of the relative activity of hydrogen ions in solution
$$\mathrm{pH} = -\lg a_\ce{H} = -\lg (m_\ce{H}γ_\ce{H}/m^\circ)\tag{1}$$
where $a_\ce{H}$ is the relative (molality basis) activity and $γ_\ce{H}$ is the molal activity coefficient of the hydrogen ion $\ce{H+}$ at the molality $m_\ce{H},$ and $m^\circ$ is the standard molality. The quantity $\mathrm{pH}$ is intended to be a measure of the activity of hydrogen ions in solution.
However, since it is defined in terms of a quantity that cannot be measured by a thermodynamically valid method, eq. 1 can be only a notional definition of $\mathrm{pH}.$

So, if the numerical value for normality coincides with the one for molarity, and one can omit the activity in favor of molarity, i.e. when both equivalence factor $f_\mathrm{eq}$ and activity coefficient $γ$ are approx. 1, then yes, normality can also be used to estimate the $\mathrm{pH}.$
I'm not sure how to interpret "present by itself" part of your question, but if it means there is a single solute, then it seems to be incorrect.
The simplest counter example would be a solution of di-, tri- and polybasic acid/base, say $\ce{H2SO4},$ for which the equivalent concentration is double the value of amount concentration.
References

Buck, R. P.; Rondinini, S.; Covington, A. K.; Baucke, F. G. K.; Brett, C. M. A.; Camoes, M. F.; Milton, M. J. T.; Mussini, T.; Naumann, R.; Pratt, K. W.; et al. Measurement of pH. Definition, Standards, and Procedures (IUPAC Recommendations 2002). Pure and Applied Chemistry 2002, 74 (11), 2169–2200. DOI: 10.1351/pac200274112169. (Free Access)
Comment: So in every scenario we would be using Normality rather than Molarity? If so then what do we use Molarity for?
Comment: @Natewilliam No, you got it backwards, it's amount concentration, or molarity, that is used in the absence of activity.
Comment: Isn't it the same? If there's no activity, then normality is equal to molarity ( as Normality = Molarity*activity(or n-factor) ) So isn't it correct to say that we always use normality for any sort of calculation rendering molarity unnecessary?
Comment: @Natewilliam No. [Normality](https://en.wikipedia.org/wiki/Equivalent_concentration) is $c/f_\mathrm{eq}.$ If $f_\mathrm{eq} = 1$ (monobasic substance), then the *numerical values* of normality and molarity are the same. [Activity](https://en.wikipedia.org/wiki/Thermodynamic_activity) has nothing to do with $f_\mathrm{eq}$ (or $n$-factor, s you call it), it's an unrelated quantity.
Answer: pH is not defined versus normality or molarity of an acid: Whatever the normality or the molarity, the pH is defined from the activity (or the concentration) of the ions H+. A given value of the normality or of the molarity does not give you the activity (or the concentration) of H+. So it does not allow you to calculate the pH.
Comment: The statements "*pH is not defined versus normality or molarity*" and "*pH is defined from the activity (or the concentration)*" seem to contradict each other as both normality or molarity *are* concentrations. You either have to be more specific, or stick with only one nominal definition. However, if you do the latter, this won't answer the question. Besides, I don't see how this adds anything to an existing answer.
Comment: I think Maurice's point is that OP seems to be referring to normality or molarity of an acid, not of protons. For a strong acid, the molar amount of protons is equal to normality of acid (which is all in the form of conj base). For a weaker acid, that is not the case, so pH cannot be calculated using only the acid molarity or normality.

Use of Concentration for pH


Tracking stored procedure usage

Question: Besides using SQL Server Profiler, is there any way to track which stored procedures are being used, or at least when they were last executed?
Comment: You can always look at the plan cache.  SQL Server doesn't track this stuff forever because metadata quickly gets large and expensive.
Answer: You can look in the plan cache to get a pretty good idea of Stored Procedure usage.  Take this query, for instance:
select
    db_name(st.dbid) as database_name,
    object_name(st.objectid) as name,
    p.size_in_bytes / 1024 as size_in_kb,
    p.usecounts,
    st.text
from sys.dm_exec_cached_plans p
cross apply sys.dm_exec_sql_text(p.plan_handle) st
where p.objtype = 'proc'
and st.dbid = db_id('SomeDatabase')
order by p.usecounts desc

This will give you the usecounts of the stored procedures that are cached pertaining to SomeDB.
Note: the plan cache contains the execution plans.  This retention of these plans has many factors involved.  Whereas this will give you a good idea of what is being used and how often, it's definitely not the running total of stored procedures and how often/when they were executed.
BOL Reference about the Plan Cache
Comment: Remeber this only tells you the sp has been run fairly recently and gives you no information about procs not in here. Things like procs behind quarterly reports are run infrequenty but are being used. So basically, this just gives you a list to research in the applications that hit your db.
Comment: @HLGEM Precisely.  I've tried to make that point clear in my answer.
Comment: Is it possible doing this for a specific datetime range? (e.g. last day/month, etc) ?
Comment: Note that this query will not return a row for a stored procedure that has been altered and not executed after.
Answer: You can have a look at this as well as it contains info of last_execution_time of every stored procedure.
    SELECT DB_NAME(database_id)
    ,OBJECT_NAME(object_id,database_id)
    ,cached_time
    ,last_execution_time
    ,execution_count
FROM sys.dm_exec_procedure_stats

Comment: There is on caveat to this tho.  These stats are only kept since the last database execution.  I am busy writing a job that will archive it to a table once a day.
Comment: @earthling42, did you ever write a job that archived it to a table daily?
Comment: @Alex Chung - unfortunately never got around to that. Moved onto non MS-SQL projects shortly after the date of this post.  Shouldn't be to hard tho? I'd be happy to try to work it out with you if you are interested.
Comment: another caveat is that not all procedures are kept into the ring buffer. It depend of memory pressure !
Answer: I use the two queries below to track SP execution times. When run via an agent job at the proper intervals this captures all executions in a single table before items are removed from the cache.
You must create the historical table UtilTrackSP and create an agent job (Part 1).
Part 2, this query will show Stored procedures that have not been executed, by comparing data in UtilTrackSP to SP's from INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE = 'PROCEDURE'
/*
* Part 1
*/

/*
* Query uses dm_exec_procedure_stats (which tracks last execution time in procedure cache) to report last execution time and saves data to
* UtilTrackSP table for historical purposes. For SP's that have already been recorded in UtilTrackSP, the last execution time is updated.
* For SP's that do not exist in UtilTrackSP a new record is added.
*
* Run this via a SQL server agent job at set intervals to capture date from dm_exec_procedure_stats before removed from cache.
* the interval depends on how long items remain in cache.
*/

DECLARE @object_id INT -- SP object_id, used as IDENTIFIER for each SP
DECLARE @dbname varchar(25) -- database name
DECLARE @SPName VARCHAR(250) -- SP name
DECLARE @LastExecTime DateTime -- Last excution time
DECLARE @LastUpDateTime DateTime -- Last time UtilTrackSP was updated

--Remove temp table is exists
IF OBJECT_ID('tempdb..#TempSP') IS NOT NULL
 DROP TABLE #TempSP

 -- truncate table UtilTrackSP

-- Create table to store SP usage in active cache
CREATE TABLE #TempSP
(
   idx INT IDENTITY,
   object_id int,
   dbname varchar(25),
   SPName VARCHAR(250),
   LastExecTime Datetime
)

-- insert SP usage in active cache to TempDatabaseNames
INSERT INTO #TempSP (object_id, dbname, SPName, LastExecTime)
SELECT
s.object_id,
DB_NAME(d.database_id) AS [Database],
OBJECT_NAME(object_id, s.database_id) 'proc name',
s.last_execution_time
FROM sys.dm_exec_procedure_stats AS s
join sys.databases d on d.database_id = s.database_id
where DB_NAME(d.database_id) in ('DatabaseA','DatabaseB','DatabaseC')

-- uncomment below to see content of TempSP table
-- select * from #TempSP

--
declare @i int
declare @cnt int
declare @id varchar(20)
select @i = min(idx) - 1, @cnt = max(idx) from #TempSP

-- Display the names of the databases to backup
print 'inserting records'
while @i < @cnt
begin
     select @i = @i + 1
end

--
select @i = min(idx) - 1, @cnt = max(idx) from #TempSP
while @i < @cnt
begin
     select @i = @i + 1

     select @object_id = object_id, @dbname = dbname, @SPName = SPName, @LastExecTime =  LastExecTime
     from #TempSP where idx = @i

print 'object_id: ' + CAST(@object_id AS varchar(50));
print 'dbname: ' + @dbname
print 'SPName: ' + @SPName
print 'LastExecTime: ' + CAST(@LastExecTime AS varchar(50))

-- Begin insert/update record

-- determine if there is an existing entry for the active SP
select @LastUpDateTime = LastExecTime from [YourDB].[dbo].[UtilTrackSP] where object_id = @object_id
select * from [YourDB].[dbo].[UtilTrackSP] where object_id = @object_id

IF @@ROWCOUNT = 0 BEGIN -- If there isn't an entry then insert the entry

    insert into [YourDB].[dbo].[UtilTrackSP] VALUES (@object_id, @dbname, @SPName, @LastExecTime, getdate())
END
ELSE IF (@LastUpDateTime <> @LastExecTime) BEGIN -- If there is an existing entry and the last execute time has changed then record the change (LastExecTime & LastUpDateTime)

    Update [YourDB].[dbo].[UtilTrackSP] set LastExecTime = @LastExecTime, LastUpDateTime = getdate() where object_id = @object_id
END

-- End insert/update record
END

--Remove temp table is exists
IF OBJECT_ID('tempdb..#TempSP') IS NOT NULL
 DROP TABLE #TempSP

/*
* Part 2
*/

/*
* Query compares all stored procs (using INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE') to values in tracked SP usage table.
* The output is stored procs that have not be executed. These are SP that are canidates for deletion.
* One per Database,each combined with UNION clause.
*/
SELECT SPECIFIC_CATALOG, SPECIFIC_NAME  ,SPECIFIC_CATALOG + '_' + SPECIFIC_NAME as lookup
  FROM DatabaseA.INFORMATION_SCHEMA.ROUTINES
 WHERE ROUTINE_TYPE = 'PROCEDURE' and Not exists (select * from YourDB.dbo.UtilTrackSP where [dbname] + '_' + [SPName] = SPECIFIC_CATALOG + '_' + SPECIFIC_NAME)
 union

 SELECT SPECIFIC_CATALOG, SPECIFIC_NAME ,SPECIFIC_CATALOG + '_' + SPECIFIC_NAME as lookup
  FROM DatabaseB.INFORMATION_SCHEMA.ROUTINES
 WHERE ROUTINE_TYPE = 'PROCEDURE' and Not exists (select * from YourDB.dbo.UtilTrackSP where [dbname] + '_' + [SPName] = SPECIFIC_CATALOG + '_' + SPECIFIC_NAME)

 union

 SELECT SPECIFIC_CATALOG, SPECIFIC_NAME ,SPECIFIC_CATALOG + '_' + SPECIFIC_NAME as lookup
  FROM DatabaseC.INFORMATION_SCHEMA.ROUTINES
 WHERE ROUTINE_TYPE = 'PROCEDURE' and Not exists (select * from YourDB.dbo.UtilTrackSP where [dbname] + '_' + [SPName] = SPECIFIC_CATALOG + '_' + SPECIFIC_NAME)

Answer: I just use the userconfigurables objets :

Place this code in firts line of your procedure :
DECLARE @procevent sysname = (SELECT name FROM sys.objects WHERE object_id = @@PROCID);
EXEC sp_trace_generateevent @eventid = 82, @userinfo = @procevent, @userdata = NULL;

create a profiler trace for UserConfigurable0 into a file
You will have in the profiler trace all the executions with startDate and the name of the procedure.

Prefer to store profiler trace into files with a rollover...

read the profiler traces with the following query :
SELECT * FROM sys.fn_trace_gettable('C:\ProfilerTraces\UserTrace.trc', -1)

Just replace "C:\ProfilerTraces\UserTrace.trc" by the first tracefile with directory

Tracking stored procedure usage


Does the stress-energy tensor contain the equations of motion?

Question: Derivatives $\nabla_i T^{ik}=0$ of a stress-energy tensor of physical system express conservation laws. Whether contains a stress-energy tensor also the information on the equations of motion of system?
Answer: 1) Let us assume that the system is classical and has a Lagrangian formulation
$$ S[\phi]~=~ \int \mathbb{L}, \qquad\qquad \mathbb{L} ~=~{\cal L} ~dx^0 \wedge \ldots\wedge  dx^{d-1}, $$
in terms of a Lagrangian density ${\cal L}={\cal L}(\phi,\partial\phi)$ that doesn't depend explicitly on the $d$-dimensional spacetime coordinates $x^{\mu}$.
2) Noether's Theorem for the global translation symmetry $x^{\mu}\to x^{\mu}+\delta x^{\mu} $ yields the following off-shell relation
$$ d_{\mu} T^{\mu}{}_{\nu} ~=~ - \phi^{\alpha}_{,\nu} ~\frac{\delta S}{\delta\phi^{\alpha} }, \qquad\qquad
\phi^{\alpha}_{,\nu}~:=~\frac{\partial\phi^{\alpha}}{\partial x^{\nu}} . $$
Thus one may deduce the conservation law
$$d_{\mu} T^{\mu}{}_{\nu}~\approx~ 0$$
from the equations of motion (eom)
$$\frac{\delta S}{\delta\phi^{\alpha} }  ~\approx~ 0. $$
However, there are many examples where one can not deduce the other way, in particular, if there are more eoms (labeled by $\alpha$) than conservation laws (labeled by $\nu$). [Here the $\approx$ sign means equality modulo eom.]
3) OP raises an interesting question whether one can deduce the equations of motion from knowledge of the stress-energy tensor $T^{\mu}{}_{\nu}$ itself? This is almost the case, but there are certain terms that the stress-energy tensor $T^{\mu}{}_{\nu}$ cannot see, see Section 4, 5 and 6 below. The question is easiest to solve if one has direct access$^1$ to the canonical stress-energy tensor
$$T^{\mu}_{({\rm can})\nu}
~:=~\phi^{\alpha}_{,\nu} ~\Pi^{\mu}_{\alpha}-\delta^{\mu}_{\nu}~{\cal L},\qquad\qquad
\Pi^{\mu}_{\alpha}~:=~\frac{\partial{\cal L}}{\partial \phi^{\alpha}_{,\mu} }. $$
It becomes harder if there are also improvement terms allowed
$$ T^{\mu}{}_{\nu}~=~T^{\mu}_{({\rm can})\nu}+d_{\lambda}f^{\lambda\mu}{}_{\nu},\qquad\qquad f^{\lambda\mu}{}_{\nu} ~=~ - f^{\mu\lambda}{}_{\nu}, $$
and/or if one only knows $T^{\mu}{}_{\nu}$ modulo terms proportional to the eoms (with the additional complication that one doesn't know the eoms to begin with).
4) As a topological-sigma-model-like counterexample, consider a $d$-form
$$ \vartheta ~=~ \frac{1}{d!}\vartheta_{\alpha_1\ldots\alpha_d } ~d\phi^{\alpha_1} \wedge \ldots \wedge  d\phi^{\alpha_d}, \qquad\qquad \vartheta_{\alpha_1\ldots\alpha_d }~=~\vartheta_{\alpha_1\ldots\alpha_d}(\phi), $$
in the $\phi$ target space. Let $\omega:=d\vartheta$ be a corresponding $d+1$ form. Now define the Lagrangian $d$-form
$$  \mathbb{L}~:=~\phi^*\vartheta $$
by the pull-back to the $x$-world volume. The corresponding canonical stress-energy tensor vanishes identically $T^{\mu}{}_{\nu} ~\equiv~0$, while the eoms become
$$\phi^*i_{\alpha}\omega ~\approx~ 0,$$
where $i_{\alpha}$ denotes the contraction wrt. the vector field $\frac{\partial}{\partial\phi^{\alpha}}$.
The main point is that the vanishing stress-energy tensor $T^{\mu}{}_{\nu} ~\equiv~0$ carries no information about the $d$-form  $ \vartheta$. The equations of motion are only trivial, i.e., $0=0$, if $\omega=0$, i.e., if $\vartheta$ is closed.
Still worse, for a generic model, the Lagrangian $d$-form $\mathbb{L}$ could contain such a $\phi^*\vartheta$ term, which the stress-energy tensor $T^{\mu}{}_{\nu}$ cannot see.
5) Consider for simplicity the special case of point mechanics where $d=1$. Then the stress-energy tensor is just the energy function $h:=T^0{}_0$. Similarly, we change notation $x\to t$ and $\phi^{\alpha}\to z^I$. The one-form $\vartheta$ is a presymplectic potential
$$\vartheta ~=~\vartheta_I~ dz^I, \qquad\qquad \vartheta_I~=~\vartheta_I(z), $$
and the two-form $\omega:=d\vartheta$ is a presymplectic two-form. (If the two-form $\omega$ is non-degenerated, it becomes a symplectic two-form.) The Lagrangian is
$$L~=~\vartheta_I~\dot{z}^I,$$
which can be viewed as a Hamiltonian system with zero Hamiltonian. The corresponding energy function vanishes identically $h~\equiv~0$, while the equations of motions becomes
$$\omega_{IJ}~\dot{z}^J ~\approx~ 0.$$
6) To be explicit, consider $n$ non-relativistic charged particles in a magnetic vector potential ${\bf A}$. Working in units where $c=1$, the Lagrangian reads
$$L~=~\sum_{i=1}^n \frac{m_i}{2} \dot{\bf r}^2_i
+ \sum_{i=1}^n q_i\dot{\bf r}_i\cdot {\bf A}({\bf r}_i)
- V({\bf r}_1, \ldots, {\bf r}_n),$$
where we have added a potential $V=V({\bf r}_1, \ldots, {\bf r}_n)$ to be more general. The corresponding energy function
$$h ~=~\sum_{i=1}^n \frac{m_i}{2} \dot{\bf r}^2_i
+ V({\bf r}_1, \ldots, {\bf r}_n)$$
does not know about the magnetic potential ${\bf A}$. However the eoms contain the Lorentz force. Here the magnetic potential ${\bf A}$ plays the role of the presymplectic potential from Section 5.
--
$^1$ It seems admittedly rather artificial that one would know in advance whether a given stress-energy tensor $T^{\mu}{}_{\nu}$ is canonical or not, because if one doesn't know the eoms, one wouldn't know the Lagrangian density ${\cal L}$ as well.
Comment: Concerning magnetic example:
The energy deals only with the length of velocity. However, momentum conservation deals with its direction and gives the remaining e.o.m's: $\sum \frac{\partial L}{\partial \dot{r_i}}=P$ Differentiating this w.r.t. time gives you the remaining e.o.m's
Comment: In point mechanics ($0+1$ world volume dimensions), the stress-energy tensor is just a $1×1$ matrix $T^0{}_0$ carrying only energy $h$. Momentum conservation along the target space directions would be an additional piece of information not implied by OP's setup.
Answer: Simple answer, your equation has only four components, but there is one equation of motion for every field variable in the system which is more than four, so the answer is no.
Comment: Ok, then it is possible to consider as EOM statement $ \nabla_i T ^ {ik} =G ^ {k} $, where $G ^ {k} $ - 4-force?
Comment: The conservation laws give you some information about the equations of motion but not all of it. If further constraints are applied such as requiring spherically symmetrical solutions and the number of fields is small you may find that the conservation laws are sufficient to solve the problem
Comment: Although _No_ may be formally correct, this answer (v1) ignores the fact that the stress-energy tensor almost provides full information about the system.
Comment: That depends on how many field variables you have in your system.
Comment: E.g., if you were told that the energy function of a system is $h = \frac{1}{2} \sum_{i=1}^n m_i \dot{x}^2_i + V(x_1, \ldots, x_n)$, wouldn't you have a pretty good idea of what the equations of motion are, even if $n$ is a huge number?
Comment: That's true that the form of the energy as a function of the variables contains more information. Perhaps that is what the question is really about and I have been misled by the imperfect English.
Answer: The situation is similar to conservation of energy, momentum etc. in classical mechanics. Consider for instance motion of the mass $m$ in the potential $V(r)$. In general case the energy is conserved, and the momentum is not. We know the expression for energy:
$E=\frac{mv^2}{2}+V(r) = const$
The equation of motion is
$\frac{d\vec{v}}{dt}=-\nabla V(r)$
and it cannot be derived from expression for energy. However, knowing the integral of motion makes easier finding solution of the equations of motion.
Similarly, Maxwell equations (that are equations of motion) cannot be derived from electromagnetic field stress-energy tensor.
On the other hand, the expression for stress -energy tensor can be used to derive expressions for some other important physical quantities.
If we consider compound system of charge + electromagnetic field, we can derive the Lorentz force acting on charge from the expression of EM field's stress-energy tensor and Maxwell equations:
$\frac{\partial T^k_i}{\partial x^k}=-\frac{1}{c}F_{il}J^l$
What is important here is that we use expression for the EM field stress-energy tensor and Maxwell equations (that are equations of motion for the EM field) to derive the force acting on charge.
But knowing the force acting on charge is not enough to derive equation of motion for the charge. We also need to know the "inertial properties" of the charge for that.
Comment: Strange, but in the literature often there is a statement that the equations $\nabla_i T^{ik}=0$ are the equations of motion. And that the equations of motion can be derived from conservation laws, seemed to me strange. That is the reason of asking this question.
For example, in the textbook of Landau and Lifshits "Hydrodynamics" the Euler equations of motion of an ideal liquid are deduced from these equations.
Comment: And I disagree with statement that it is impossible to derive the Maxwell equations from $\nabla_i T^{ik}=0$. At least, from this equation it is possible to derive the second pair of the Maxwell  equations $F^{ij}_{,k}+F^{ki}_{,j}+F^{jk}_{,i}=0$.
Comment: As far as I can see from Landau and Lifshits "Hydrodynamics", in derivation of Euler equation they use the Newton's second law (which is the equation of motion itself): force acting on element of fluid is equal to acceleration of this element multiplied by its mass. Regarding the Maxwell equations, see "Do Maxwell's Equations overdefine the electric and magnetic fields?" on physics stack exchange, where it is explained that second pair of Maxwell equations are only consequences of the first pair equations and initial conditions.
Comment: It is necessary to look head named "relativistic hydrodynamics" first paragraph.
Comment: and second paragraph
Comment: There it is told (my translation): "the equations of motion are contained, as it is known, in the equations $$\nabla_i T^{ik}=0.$$
Expressing itself laws of conservation of energy and an impulse of that physical system which the tensor $T^{ik}$ concerns"
Comment: Dear Sergio, there is no need to translate it - I can read the original text. But I guess the statement is not clear: it does not say that conservation law $\nabla_i T^{ik}=0$ is equivalent to equations of motion. For instance, if we consider EM field in empty space, the conservation law is reduced to $F_{kl}\frac{\partial F^{il}}{\partial x^i}=0$, which is different from (although consistent with)  Maxwell equation $\frac{\partial F^{il}}{\partial x^i}=0$.
Answer: There certainly are systems that are fully described by their energy-momentum conservation as a simple example let us take one-dimensional particle in a potential. The energy is conserved:
$$ \frac{m \dot{x}^2}{2} + V(x) = E $$
Differentiating this expression w.r.t. time one gets
$$ \frac{2 m \dot{x} \ddot{x}}{2} + \frac{\partial V(x)}{\partial x} \dot{x} = 0 $$
$$  (m \ddot{x}+ \frac{\partial V(x)}{\partial x} )\dot{x} = 0 $$
This means that either E.O.M.'s are satisfied or the particle is at rest anywhere. If one can rule out the latter case by physical arguments, one arrives at a derivation.
The same is true for e.g. scalar field. However, as demonstrated in other reply (Sigma-model) -conservation laws might be spoiled in the way that they do not bring any information. This is fortunately not the case for classical fields.
Comment: Comment to the answer(v1): If you in the last sentence mean _classical_ systems as opposed to _quantum_ systems, then the last sentence is not true. There are classical counterexamples.
Comment: I would be really glad if you posted any. Bu, either way, my answer could be changed to 'reasonable classical' as i am sure this is the case for Young-Mills (including electromagnetism) and scalar fields.
Comment: E.g., a point charge in a background magnetic field is a classical counterexample, cf. my answer.
Comment: The energy deals only with the length of velocity. However, momentum conservation deals with its direction and gives the remaining e.o.m's: $\sum \frac{\partial L}{\partial \dot{r_i}} = P $ Differentiating this w.r.t. time gives you the remaining e.o.m's
Comment: In point mechanics ($0+1$ world volume dimensions), the stress-energy tensor is just a $1\times 1$ matrix $T^0{}_0$ carrying only energy $h$. Momentum conservation along the target space directions would be an additional piece of information not implied by OP's setup.
Comment: I would like to point out that the classical conservation of energy solution for 1d motion also allows the particle to stop at the maximum and just sit there.
Answer: The case of electrovacuum.
In General Relativity, from the Ricci tensor, we know the stress-energy tensor and vice-versa (by Einstein equation).
There are some conditions which, if are satisfied by the Ricci tensor (or equivalently, by the stress-energy tensor), are equivalent to the fact that the equations of motions are those from electromagnetism, and we can even determine the electromagnetic tensor (up to an overall "phase factor", or even uniquely in "charge without charge"). They are called the Rainich conditions, and were proposed in 1924-25 by G.Y. Rainich.
These conditions were rediscovered by Misner and Wheeler, as part of the charge-without-charge subprogram of geometrodynamics. For this, see Geometry of gravitation and electromagnetism, by L. Witten, and chapter 9 from Gravitation: An Introduction to Current Research, ed. L. Witten, and section 5.3 from Spinors and Space-time: Spinor and twistor methods in space-time geometry, R Penrose, W Rindler - 1986.


Automatically including more packages

Question: I use latex a lot for academic purposes (usually sharelatex and more recently, overleaf v2), because of that I always need some math or physics related packages like amsmath, siunitix and a lot of other ones. Because of that, it would be very practical for me if it was possible to configure my account in a way that everytime I create a new blank project those packages were already included, is there any way to do that?
Answer: You can probably create a template with your packages listed.
A blank project is always blank and I doubt that you can change that.
Answer: I would suggest creating a single project that contains all the customisations you're after, including extra fonts, custom document classes and/or packages and possibly often-used images. Let's call this project main:

You can add whatever detail you want with comments and other bells and whistles. Then you can copy the project whenever you want to work on a new article:

Once you've created a copy, rename it and work on it.

This approach is slightly different from a template. The latter you'll have to maintain on GitHub or upload every time you want to use it, as this is the only option on using it in OverLeaf:

Automatically including more packages


Can I connect two tv antennas in parallel?

Question: In order to get higher signal level on my pre amplifier to the tv set.
Comment: I don't agree with the close votes, this is quite a fundamental question about antennas, not a "how do I connect my TV to my fridge??" type of question.
Comment: @pipe Perhaps if it showed some research it would fair better?
Comment: @Bort Indeed, it's a lazy question, and may deserve a downvote.
Answer: Yes you can, but unless you understand about phasing, and control the impedance  (with non-lossy things like a Wilkinson combiner or a quarter-wave transformer (don't use a lossy 6dB equal split combiner (you'll not get any more signal level))) it's unlikely to give you much benefit, and may make things worse.
It's far better to get a longer antenna, that is a Yagi with more directors.
Comment: Good answer; you can actually make reception worse, e.g. by having the antennas' phase center half a wavelength apart. So, OP really shouldn't be doing this, in general.
Answer:
Can I connect two tv antennas in parallel in order to get higher
  signal level on my pre amplifier to the tv set.

No you can't.
Without an amplifier and with respect to impedance matching to avoid signal losses on cables due to reflections, no you can't. The matching and summing network means that the loss of each individual signal strength due to summing cancels the overall gain in adding two signals together.
A simple 50 ohm combiner uses three 16.7 ohm resistors - when both inputs and the output are connected, each "port" is correctly terminated. Now, if the two input ports were fed from an identical signal sourced twice through two 50 ohm source impedances you would get this: -

If you did the calcs/math you will find that you get exactly the same signal voltage feeding the output 50 ohm (R6) as you would from one source (with its 50 ohm impedance) directly feeding R6 i.e. a signal that is reduced by 6 dB.
You also have to be aware that each antenna has to be positioned so as not to "steal" the power received by the other antenna - you might get lucky with this but that won't help alleviate the situation in my 1st paragraph.


What's the negative about buying contracts 1 month out when scalping options? (Is it buying same day or 2-3 day contracts are way cheaper?)

Question: What's the negative about buying contracts 1 month out when scalping options? (Is it buying same day or 2-3 day contracts are way cheaper?) I don't want Theta to negatively affect my gains.
Answer: By scalping, I assume that you mean short term intraday trades.  If so, then there are several considerations:

High delta

Narrow bid-ask spread

Liquidity

Lowest cost (near term expiration)

Note that (1) and (3) are somewhat antithetical and that (4) gives you little room for error.


AJAX TextBoxWatermarkExtender causes widening of textbox it is attached to

Question: Here's is the issue testcase.
I have some textboxes (multiline, wrap=true) with watermark extenders attached.
then I type a short world, then space, then long word (like 'short longgggggggggggggggggggggggggggggggggggggggg' that consumes more than line so that scrollbar appears)
whenever I set focus to to another textbox, then set it back to watermarked textbox, the last gets widening spontaneously making all the page looking ugly.
The issue occurs in IE only, Firefox performs the same OK.
Not-watermarked textboxes and   watermarked but disabled ones  (property "enabled=false") also behaves OK.
Google keeps silence about this issue, I haven't found even vague tips.
Obviously something wrong with AJAX javascript, but how to fix it?
Are there  solutions but getting rid of watermarks?
Does anybody know?
thanks.
Answer: Initially, I encountered the problem as well and no obvious fixes in sight. The problem does appear to be CSS related.
In my instance I had something like the following pseudocode.

    <asp:textbox id="tbDescription" multiline="true" cssClass="tbMultiline" ..other attributes excluded for brevity />
    <asptoolkit:TextboxWatermarkExtender targetControlId="tbDescription" WatermarkCSS="tbMultilineWatermark" message="blah blah blah" ..other attributes excluded.../>

both css classes specified a width of 100%. However, the bounding TD did not have a fixed width and so it would exhibit the widening behaviour you saw.
I fixed the problem by forcing the width to a fixed %.


which are Linux specific Hadoop internals?

Question: I am trying to learn why hadoop requires cygwin in windows apart from running shell script. I know there are POSIX specific implementations in various hadoop parts, i just wanted to know exactly which parts of hadoop are Linux specific?
Thanks
Comment: I'd suppose the native libs in `lib/native`, run scripts and configs.
Answer: Some Hadoop internals require details information or operations about the system that are not provided by Java.
For it is IIRC not possible to change the owner of a file in Java 6.
However, Hadoop needs this type of operation. In these cases, Hadoop executes the Unix commands in a separate process. The utility class Shell contains a lot of these sub process calls.
The list includes

ulimit
chmod
whoami
ls
and others

For similar reasons, the class ProcessTree uses setsid and kill.
As Hadoop uses the applications, they have to be available on the parent system. Cygwin provides this.
[Edit:]
Actually, the native code in lib/native is optional. It is only used (for performance reasons) if matching library versions are there.
Answer: Hadoop uses shell scripts to start and stop master and slave processes, among other things.  It also requires openssh (passwordless).  Installing cygwin is the simplest way to address this.


Find out if installed package is a dependent to other installed package

Question: According to the title that.
Solution like this one:
apt-cache rdepends packagename
Does list all the reverse package. Although most of the packages in the list I do not have in my system installed. Example:
apt-cache rdepends python-gpgme
python-gpgme

Reverse Depends:
  python-bzrlib
  bzr
  python-gpgme:i386
  nautilus-dropbox
  assword
  alot
  python-gpgme-dbg
  python-bzrlib
  bzr

I do not have bzr, nautilus, alot, and others installed.
So, what is the correct command to find out the list of installed dependent package to that "target" package?
I need to know if python-gpgme is OKAY to purge.
Comment: possible duplicate of [How do I find the reverse dependency of a package?](http://askubuntu.com/questions/13296/how-do-i-find-the-reverse-dependency-of-a-package)
Comment: installed reverse packages sir. not ALL reverse packages.
Answer: If in doubt, just use the -s (aka --simulate, --just-print, --dry-run, --recon and --no-act) flag. You can run the command without root and it'll tell you what it would do based on your current packages.
$ apt-get remove -s python-gpgme
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
  python-gpgme
0 to upgrade, 0 to newly install, 1 to remove and 217 not to upgrade.
Remv python-gpgme [0.3-0ubuntu3]

Comment: In addition, even when removing a package (outside of simulation), I believe apt will give you the list of packages it will be removing and ask for confirmation. To add to this, running `sudo apt-get autoremove` will remove any auto-installed packages (usually libraries) that are no longer needed.
Answer: With aptitude's search patterns (verbose syntax and equivalent shorthand syntax):
aptitude search '?depends(python-gpgme) ?installed'
aptitude search '~Dpython-gpgme ~i'

To include recommendations as well as strict dependencies:
aptitude search '(?depends(python-gpgme) | ?recommends(python-gpgme)) ?installed'
aptitude search '(~Dpython-gpgmg | ~Drecommends:python-gpgme) ~i'

Answer: Or, using aptitude as Gilles answer, just use the why command that will show you "why a package was installed":
aptitude why python-gpgme

For example:
➜  ~  aptitude why python-gpgme
i   bzr Recommends python-gpgme

This tells me, that if there was a reason to install python-gpgme it would be due bzr package that it's installed.
Answer: You can also do:
sudo dpkg -s <package_name> | grep Depends

For example:
sudo dpkg -s bcmwl-kernel-source | grep Depends
Depends: dkms, linux-libc-dev, libc6-dev

Comment: This is only going to show first-line dependencies. It won't show you something that depends on one of these dependencies (so it might not give you a full picture of whether something or not will be safe to remove).


What would happen in a 1.12 player on a 1.16 server got a higher-version item?

Question: I'm going to be starting a Minecraft server, and I intend to allow all versions from 1.16.5 - 1.12.2.
Like Hypixel.
However, I thought of something before doing that. The server will run 1.16, meaning the nether will be generated using the new 1.16 generation. If a 1.12 player were to join, would their client crash, or would the nether just be bugged for them (update blocks from old PE)?
What about items, too? Would those become bugged too?
Comment: servers like hypixel arent 1.16 servers, and therefore dont generate any 1.16 blocks. its much easier to be forward compatible than backwards compatible when it comes to minecraft servers
Answer: It would crash. When the client sees something it wouldn't recognize - blocks, items, entities, etc. - it just says "I'm confused" and will crash. It's like if you loaded a modded world without the mod.
Comment: OK, then....
If that's the case, ill just run the server on 1.12.
Answer: Some servers have specialized plugins to port 1.16 blocks and items to older versions such as 1.12, like replacing basalt with glazed terracotta, or replacing netherite gear with dyed leather armor, but normally it is best to host your server on older versions if you want to port many versions of Minecraft to your server.