Order of derivative for MGCV splines and low EDF

Question: I'm following up on the informative discussion here concerning choice of m (order of derivative) for MGCV splines. Using the default options in MGCV (thin plate spline, REML for optimization, k=10, etc.) I noticed that the choice of m affects the estimated degrees of freedom, which is not surprising. However, when using m=1, this often results in edf that are close to zero. Reading online (including here) I think that this might occur since when using m=2 (the default), the linear function is in the penalty null space, since the penalty is based on the curvature of the function (second derivative) and the linear function has no curvature. I'm guessing that when m is changed to 1 this no longer applies, since now the linear function would contribute to the penalty, but I admittedly don't entirely understand why. Also, going back to the previous discussion on the choice of m, does it make sense to choose m=1 in cases where the edf is shrunk towards zero? What would be the interpretation of the spline in such cases?  And then finally, why is the default to penalize the second derivative compared to the first?
Answer: The figure below illustrates what is happening when you use m = 2 and m = 1 with the low-rank thin plate regression splines that are the default in mgcv's smooths.
The code to reproduce this is given at the end of this Answer, but do note that you'll need version >= 0.8.9.4 of gratia (which is not on CRAN, so follow instructions at the package homepage to install it).

The first row contains the default basis used in mgcv's smooths specified using s(): s(x, bs = "tp", m = 2, k = 10). The left panel (a) shows the basis functions, while the right panel (b) shows the penalty matrix $\mathbf{S}$ for this smooth. Note the linear basis function in the left panel (a). This function has 0 second derivative and as such it is not affected by the penalty. We say this function is in the penalty null space (and hence any linear function is in the penalty null space). This is reflected in the penalty matrix $\mathbf{S}$ shown in (b) as F9; the elements in the row/column relating to this function are 0.
When we switch to m = 1 with s(x, bs = "tp", m = 1, k = 10), we change the penalty to one based on the first derivative of the spline. This also changes the basis functions used for the smooth. The basis functions and penalty matrix $\mathbf{S}$ for this basis are shown in the lower row of the figure. There are still 9 basis functions (we lose 1 in both bases due to the identifiability constraint for the model constant term). The important difference is in the penalty matrix, where no functions except the constant function are in the penalty null space so we say this basis has no penalty null space (because we parameterise the constant term out of the basis with the identifiability constraint).
With the second order derivative penalty (m = 2) we are, as you rightly surmise, penalizing deviation from a linear function, where deviation is measured by the integrated squared second derivative of the estimated function. Because of the penalty null space, the simplest smooth we can produce with this basis and penalty is a linear function using 1 EDF. There are ways to penalize this even further, but this requires an explicit penalty on the null space, for example via select = TRUE in mgcv. When we use m = 1, we are penalizing deviation from a constant function (with deviation measured by the integrated squared first derivative of the estimated function). As the simplest function we can estimate using this basis and penalty combination is a flat constant function, degrees of freedom of the smooth can be penalized back to <1 EDF. With m = 1, a linear function would contribute to the penalty because the first derivative of any linear function that is not the constant function has a non-zero first derivative.
What difference does the choice of m make?
Consider this example, where data has been simulated from Gu and Wabha's $f_2$ function, that is smooth and non-linear
library("gratia")
library("mgcv")
library("patchwork")

df <- data_sim("gwf2", n = 100, seed = 2)

m_pen2 <- gam(y ~ s(x, m = 2, bs = "tp", k = 10), data = df, method = "REML")
m_pen1 <- gam(y ~ s(x, m = 1, bs = "tp", k = 10), data = df, method = "REML")

plt_a <- draw(m_pen2, n = 400)
plt_b <- draw(m_pen1, n = 400)

plt_a + plt_b +
  plot_layout(ncol = 2) +
  plot_annotation(tag_levels = "a", tag_suffix = ")")

Panel (a) is visually smoother than panel (b). Panel (a) uses the default m = 2 penalty, whereas the visually less-smooth fit in (b) was achieved by setting m = 1. The reason m = 2 is default is I suspect that in this branch of statistics, what has most often been considered as "smooth" are functions that are continuous up to second derivative because this is also what human see as being smooth — higher order derivatives such as the third which are not continuous aren't something that we typically notice. Cubic regression splines, for example, are important in this area, and those smooths meet this definition, and they are continuous up to second derivatives. That is not to say that other penalties/derivatives are not useful or needed. Indeed, they often are.

does it make sense to choose m=1 in cases where the edf is shrunk towards zero?

I'm not sure I follow; you would typically choose m = 1 befor fitting and it is only after fitting is complete can you ask how many EDF the estimated smooth uses. We don't use the EDF of the smooth during fitting, although it is related to the wiggliness of the smooth, which is what is being penalized during fitting. You should choose the penalty order that meets your assumptions about the relationship between the response $y$ and the covariate $x$ that you wish to capture via the smooth function $f(x)$. In many scientific settings, it would be implausible to think that the effect of a covariate on the response could be so jerky and abrupt as that shown in panel (b) above. In other settings, (b) could be entirely justifiable.

What would be the interpretation of the spline in such cases?

That a smooth uses fewer than 1 EDF is nothing special; you can even have non-linear functions that use fewer than 1 EDF. They'll typically be simple functions, close to quadratics say, but they can be estimated. Just focus on the estimated function itself — plot it to visualise the effect of $f(x)$ on the response. If it is an approximately constant function then that implies that the given the sample of data to hand that the effect of $x$ on the response is likely small and indistinguishable from "no effect" (a constant function).
Another area where it can make sense to change the order of the penalty is when interest is on other features of the estimated function; for example, identifying turning points in biodiversity time series are of interest because they give us some idea if the ecosystem is changing (for better or worse). This requires us to get a good estimate of the second derivative of the estimated smooth function and to do that we may need to use a penalty on a higher derivative (the 3rd derivative say) so that the thing we are interested in estimating is not the subject of the penalization directly.
Everything that I write above assumes that you have used a basis that is sufficiently large so as to either include the true but unknown function $f(x)$ or a close approximation to it. Checking that the basis dimension was sufficiently large to represent the true function is an important part of model diagnostics with GAMS. You could very easily estimate a flat approximately constant function where the true function is a sine wave over multiple cycles, for example, if you don't have enough basis functions in the basis to begin with.
library("gratia")
library("mgcv")
library("patchwork")

df <- data.frame(x = seq(0, 1, length = 100))
tprs_2 <- s(x, bs = "tp", m = 2, k = 10)
tprs_1 <- s(x, bs = "tp", m = 1, k = 10)
bs_2 <- basis(tprs_2, data = df, constraints = TRUE)
bs_1 <- basis(tprs_1, data = df, constraints = TRUE)

pen_2 <- penalty(tprs_2, data = df, constraints = TRUE)
pen_1 <- penalty(tprs_1, data = df, constraints = TRUE)

plt_2 <- bs_2 |> draw(title = "TPRS basis (m = 2)") +
  pen_2 |> draw(title = "2nd order derivative penalty") +
  plot_layout(ncol = 2, nrow = 1)
plt_1 <- bs_1 |> draw(title = "TPRS basis (m = 1)") +
  pen_1 |> draw(title = "1st order derivative penalty") +
  plot_layout(ncol = 2, nrow = 1)

plt_2 / plt_1 +
  plot_annotation(tag_levels = "a", tag_suffix = ")")

Comment: Those are some neat new features in `gratia` (+1).
Comment: Thanks @ShawnHemelstrand It's what I call "CrossValidated-driven software development" :-)
Comment: Thank you for a fantastic response! So is it legitimate to, say, run models with differnt choices for m and check which one gives prediction that more closely match prior known data, or should one use some empirical ways to determine whether penalizing 1st or 2nd (or higher) derivatives is optimal? Would trying different models amount to cherrypicking the "right" spline, or is it a legitimate part of the analysis?
Comment: @dean I would suggest that you should choose `m` *a priori* based on knowledge of the system/domain in which you are working. Whenever you make a modelling choice on the basis of *looking at your sample of data* (by "looking" we mean fitting a model, estimating something, etc) you need to correct for that in any subsequent inference (interpreting *p* values, confidence intervals, testing hypotheses, etc). Problem is  we don't know yet how to correct/adjust this post selection inference. It's already bad enough with GAMs where we already have to adjust for selecting smoothing parameters.
Comment: Thank you @Gavin! If so, then what features of the domain knowledge should be used to make this decision? Would it be the plausibility of having an association that is less smooth / jerkier (as is more often seen when penalizing the 1st derivative compared to the 2nd)?
Comment: In my specific domain (healthcare research) penalizing the 1st derivative often leads to a more pronounced threshold effect: e.g. when looking at the association between a certain hormone and a given health outcome, using 1st derivative penalization often better enables to capture specific values above which excess risk for the outcome is observed compared to the default 2nd derivative penalization – but this is hard to know this a priori.


What's the derivative wrt. $x$ of $\int_0^x f(x-s)\,ds$?

Question: I know how to compute the derivative of $f(x-s)$ and by the fundamental theorem of calculus the derivative of $\int_0^x f(s)\,ds$ is $f(x)$. But I can't figure out how to do it when they're mashed together as in $\int_0^x f(x-s)\,ds$. The presence of the $s$ inside $f(x-s)$ prevents me from factoring out $f$ and using the product rule.
Answer: You use the Leibniz formula $$ \frac{d}{dx}\int_{a(x)}^{b(x)} f(x,t)\;dt = f(x,b(x))b'(x) - f(x,a(x))a'(x) + \int_{a(x)}^{b(x)}\frac{\partial}{\partial x}f(x,t)\;dt$$ and get $$ \frac{d}{dx}\int_0^xf(x-t)\;dt = f(0)+\int_0^xf'(x-t)\; dt.$$
Answer: Another way is by a change of variable, which is also essentially how one prove the Leibniz formula mentioned by @spaceisdarkgreen . Take $u = t/x$, then we see that
\begin{align}
\int^x_0 f(x-t)\ dt = \int^1_0 xf(x(1- u))\ du.
\end{align}
Taking the derivative with respect $x$ gives us
\begin{align}
\frac{d}{dx}\int^x_0 f(x-t)\ dt =&\ \int^1_0 f(x(1-u))\ du+ \int^1_0 xf'(x(1-u))(1-u)\ du.
\end{align}
Using integration by part formula, we get
\begin{align}
\int^1_0 xf'(x(1-u))(1-u)\ du =&\ - f(x(1-u))(1-u)\big|^1_{u=0} - \int^1_0 f(x(1-u))\ du\\
=&\ f(x) -\int^1_0 f(x(1-u))\ du
\end{align}
which means
\begin{align}
\frac{d}{dx}\int^x_0 f(x-t)\ dt = f(x).
\end{align}
Comment: (+1) for noticing a massive simplification I missed and not gloating about it.


Buying stocks in company merging/acquisitions

Question: Does an acquiring company have to buy all the stocks of a target company to acquire/merge with it?
If so, why? I thought stocks give voting rights and dividends, but not direct control of company management.
If not, why do they usually do it?
Answer: Stocks/shares are equity (a share is 'a part of' something) and are thus essential to ownership of a company. Owning shares means that you own part nof a company. The ownership, as a side effect, gives voting rights on the C-suite and dividends.
Acquiring a company requires you to buy all of the shares of that company (so that you own it).
Comment: But you don't need stocks to control a company. Imagine an acquiring company controls a target company and changes the target company's bylaws to equal those of the acquiring company. However, they do not buy all the target company's stock. Would there be any practical difference between this and a normal takeover where they do buy the stock?
Comment: @roobee How would you control a company without owning stock?
Comment: The same way you control one if you do? You convince the company that a merger would be mutually beneficial. You tell them the bylaws they should adopt and the procedures they follow. If you do buy their stock you still have to do all this, right? Since the stock would only give you voting rights, but no authority to tell the company what to do or change their bylaws.
Answer: Acquiring a company involves acquiring all of its shares and giving the previous shareholders money, your stock, or other valuable things, like options.
You don't have to acquire all the shares on the open market, though.  You would never be able to persuade every single shareholder to sell their shares.  You just have to get enough that the board of directors (or a majority of shareholders at a shareholder meeting) votes to merge the target company in, converting all existing shares into the cash or shares that you are offering.
If the management is willing, you don't have to buy any on the open market.  They just vote to accept your offer to merge their company in and all shareholders receive whatever it is you offered.  If the management is not in favor, you have to buy enough shares that you plus the other investors who are willing have enough influence to make it happen.  This can mean replacing board members or casting direct votes.


If I create an account on Game Of war will I lose my progress?

Question: I have Game of War on my Phone and I have 1.9 million power. It keeps asking me to create a account for it. So if I listen and create and account will I lose my progress or will it still stay there?
Answer: It will stay there.
 At the moment, your game data is only saved on your phone. The purpose of creating an account is that if you change another phone in the future, you can still have your game data by logging in to that account because the data will be saved into the account online.
Answer: As of 2017, you have to create an account and confirm an email sent to you after. Next time you enter the game, it will ask for your login information and you will have your data.
Any other action other than that, you'll lose data in moment you log in. i.e. if log in with an existing account.
Comment: reason for downvoting?


Is undergrad research experience related to the undergrad field preferred, or can I do research on the area I plan to study in grad school instead?

Question: Is undergrad research experience related to the undergrad field preferred, or can I do research on the area I plan to study in grad school instead?
Answer:
Is undergrad research experience related to the undergrad field preferred, or can I do research on the area I plan to study in grad school instead?

It's actually just the opposite: research in the area you plan to study in grad school is preferred, because it sheds more light on your talent and preparation in this field and it demonstrates that you understand what's involved in this work.  If your undergraduate research is not in the field you plan to study, then there's a risk that you won't do as well in that field or won't enjoy it.
Comment: @ZeroTheHero: Your advice for the OP about how to approach college is good, but it doesn't contradict my answer.  Graduate admissions committees will treat undergraduate research in their field as more meaningful and significant than research in another field.  This is certainly inconvenient for undergraduates, who might not have discovered their long-term interests yet, but it makes sense.  (It's easier to gauge someone's potential in neuroscience based on prior neuroscience research than based on prior CS research.)
Comment: @user62977 The answer does not address this because this is a fairly different question than what has been asked. Here at SE the general policy is to ask one question per post only.
Comment: What if you want to research in one field in graduate school but your home university (undergraduate) does not offer research in that field? your answer does not address this issue.
Comment: This is a strange answer.  The OP has not even started undergraduate and it is highly unlikely he/she has really discovered what he/she is passionate for.  The OP should focus in undergraduate studies, choose undergraduates courses with a  open mind and decide in his/her last year what is the most interesting field for her/him.
Answer: Research in computer science reflects your field of "origin."
Research on the brain reflects your "destination" field.
It's easier for you to "prove" yourself in your field of "origin" (computer science).
But if you feel that your grades, test scores and other activities have already proved your capabilities, you may wish to get a "head start" on your graduate program by doing your research in your "target" field of neuroscience.
Most graduate programs would appreciate and understand this, because your interest is actually more believable this way.
Answer: Keeping in mind that although you feel sure right now of exactly what kind of master's you are going to do, that might change, nevertheless, I will go along with what you have planned, as a working hypothesis for now.
To succeed in interdisciplinary work, you need to get some very good intuition about the area of application, which in this case is neuroscience.  In the bulk of your coursework, you will be doing a lot of programming and computer science.  Doing hands on work in a neuroscience lab would be a great way of complementing that.  However, you would need to make sure you have taken enough coursework in neuroscience to be comfortable in the lab.  That might be a tall order.  Also, you might find that the nitty gritty lab work is not your cup of tea.  After all, presumably there are reasons you are not doing neuroscience for your Bachelor's!
So, those are my thoughts, coming from another interdisciplinary field, mathematical biology.
At this early stage, it might be wise to keep both options open.
Comment: I would love to do Neuroscience for my Bachelor's.But there are no such courses in my country and for abroad i would have go through a long procedure which will be requiring additional 2 years of formalities. Due to various reasons i already had my 2 years wasted so i do not want to waste more time in it.
Comment: @ManishYadav - I'm starting to get it.  Okay, the answer is, you do not need to confine your undergraduate research involvement to computer science.
Answer: If you are hoping to get into a new area in grad school, doing research on that area while you are in undergrad will give you new perspective, and it will be better for you in the long term, since you have an idea whether or not you really want to do this field, or maybe even what you have originally been doing in undergrad, come grad school.


Sitecore 10 Desktop search direct hit result

Question: In Sitecore 9 or 10 - I'm not sure which as I skipped v9 - Sitecore have removed Sitecore.Pipelines.Search.IDResolver which is used in the search pipeline as defined in the OOTB Sitecore config in SC8:
<search>
  <processor type="Sitecore.Pipelines.Search.IDResolver, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.Search.PathResolver, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.Search.UrlResolver, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.Search.SecurityResolver, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.Search.DatabaseResolver, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.Search.CategorizeResults, Sitecore.Kernel"/>
  <processor type="Sitecore.Pipelines.Search.AddInstantOptions, Sitecore.Kernel"/>
</search>

In SC10 this pipeline has been somewhat streamlined to the following:
<search>
  <processor type="Sitecore.Pipelines.Search.UrlResolver, Sitecore.Kernel" />
  <processor type="Sitecore.Pipelines.Search.SecurityResolver, Sitecore.Kernel" />
  <processor type="Sitecore.Pipelines.Search.DatabaseResolver, Sitecore.Kernel" />
  <processor type="Sitecore.Pipelines.Search.CategorizeResults, Sitecore.Kernel" />
</search>

The IDResolver pipeline processor provides an amazingly simple, effective and performant "Direct hit" search result, which a lot of my users rely on and actually use every single day. It supports multiple formats of GUID, which is another great feature. It looks like this:

It bypasses the search indexes, which is a good thing since indexes can exclude results for various reasons, e.g.

they can get out of sync with the real data
they can have custom config applied to filter inbound and outbound data
they can have custom config applied to alter the root node of the index
they can be altered by any number of other possible config patches/customizations which are entirely valid setups

I've managed to re-introduce this functionality by copying the decompiled legacy processor class into my codebase and patching it into the pipeline. It works perfectly and because it's in my codebase I know it won't actually be deleted by Sitecore on the next upgrade.
I guess my question is: WHY? I don't see any reason to do this, it just makes the product worse and doesn't add anything. It's not even a complex piece of code to maintain, nor does it use any APIs which are going to be deprecated in the future (unless they plan to deprecate Database.GetItem()!!) It's removal is not documented anywhere that I can tell. I had to find out by decompiling the Sitecore assemblies and diffing old and new config files.
Answer: Both IDResolver and PathResolver are not fully removed in Sitecore 10.1 yet. They are marked as deprecated and they're going to be removed in one of the next major releases.
But their code is still there and you can use it if you want. Just use patch file like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore role:require="Standalone or ContentManagement or ContentDelivery">
    <pipelines>
      <search>
        <processor
          patch:before="*[@type='Sitecore.Pipelines.Search.UrlResolver, Sitecore.Kernel']"
          type="Sitecore.Pipelines.Search.IDResolver, Sitecore.Kernel" />
        <processor
          patch:before="*[@type='Sitecore.Pipelines.Search.UrlResolver, Sitecore.Kernel']"
          type="Sitecore.Pipelines.Search.PathResolver, Sitecore.Kernel" />
      </search>
    </pipelines>
  </sitecore>
</configuration>

I don't know what's the reason of making them deprecated. You may try asking this question to Sitecore Support, but I don't think you will get any answer.


Why do we typically visually assess our assumptions?

Question: For example, in linear regression, we assume the errors are normally distributed, have constant variance and have an expected value of 0. These assumptions all refer to the population. But we look at our actual data points to see if these assumptions are satisfied, Why do we do this? How do we know that results hold for the population? If we only have 10 data points, why don't we say that we don't have enough data to test whether these assumptions are satisfied?
Answer: I disagree with holding the opinion that the data is normally distributed unless you have statistically rejected normality. This is the procedure we follow when the goal of our research is actually to REJECT H0. It is not a procedure we should follow to test the assumptions of our statistical analysis.
What do we usually do to test for normality? There are tests, but as many people do, I do not think they are usually useful. If the sample is small the power is too low and if it it large the tests detect even small deviations from normality, which are almost always there and do not actually matter much. So, the usually thing to do is to look at the QQ-plot. Since you use "visually" I assume you are familiar with it.
Since it plots estimated quantiles against theoretical quantiles, you can expect that the estimated quantiles are asymptotically the populations quantiles and that the QQ-plot is more or less stable as the sample size increases.
If your sample size is very small (10 qualifies) you either admit not being able to assume normality, or you are able to justify it in some other way (experiences with similar data, theoretical reasons,...) . In an ideal world it's at least an assumptions that should be discussed.
Answer: You certainly could say that you don't have enough data to test the assumptions.  Generally speaking, in significance testing we hold that there is a default position which we will continue to believe unless there is sufficient evidence to the contrary.  (Somewhat odd, I agree.)  This 'default position' goes by the name of 'the null hypothesis'.  Thus, for example with the normality assumption, we simply assume the data (actually the residuals) are normally distributed until the data force us to change our mind.
As to the question of why we do this visually instead of via a formal hypothesis test, there are several things.  First, your visual system is just amazingly powerful: possibly the majority of your brain is devoted to visual processing (depending on how you count), ~70% of the sensory input is visual in nature, etc.  It is considerably more powerful than the rational / reasoning parts (as counter-intuitive as that may sound).  Personally, I feel like I understand something about my data when I see it that I just don't when I read in the statistical output that p<.05.  I think a second reason is that there is a decent argument to be made that many statistical tests would ultimately show 'significance' if we had enough data, and thus you are only testing your $N$ (which you already knew).  Moreover, if you have enough data to establish that they aren't normal, but your data are reasonably normal-ish, the central limit theorem will cover you anyway.  So, what you really want to know is do you have a moderately-sized (or larger) deviation from normal with a mid-sized (or smaller) data set.  Given that you know your $N$, a qq-plot, or similar approach, is more helpful.  More along these lines can be found in this classic CV question.
Comment: It's true that hypothesis tests are typically used when people want to show that they are justified in rejecting the null hypothesis. However, that is not always the case (another example might be nested model tests). At any rate, if you plug your data into a normal distribution test, examine the output, & if p>.05 say that your data are normal, then you are following the standard hypothesis testing procedure. Hypothesis testing is really not a good fit for this task, as I state above, but it very much does happen. (IMHO, hypothesis testing is rarely a good approach.)
Comment: Am I correct in understanding that if I want to show normality with a hypothesis test I start with a normal null hypothesis and only reject it if there is sufficient evidence against it?  Wouldn't this be contrary to the scope of the null hypothesis? - from what I read, you should only use hypothesis testing to gather evidence in favour of the alternate hypothesis and not the null hypothesis.
Answer: Why do we look at the sample - because it's all we've got.  It would be great to look at the population to see if it meets our assumption but we can't.
We typically know what the residuals (or whatever) from our sample would look like if the population met our assumptions - so we look at them, just as part of the normal inference from sample to population.
Obviously it is silly to look at your sample of 2 and conclude "yes, that's plausibly from a normal distribution".  So the approach becomes one of thinking carefully about power, what can be expected from your sample size, what you know about how the sample was generated, etc.


block Torrent through firewall

Question: is there a way to block users on firewall level from using torrents?
Comment: check https://security.stackexchange.com/a/234350/191896
Answer: Most commercial firewalls only block incoming, they allow all outgoing and that is sometimes enough to get torrents working with minimal speed.
If you need to block it, the best thing you can do is block all outgoing on the router, excluding items that are needed such as smtp, pop3, http, https.
Also, block UPnP as this dynamically allows clients to assign / make outgoing/incoming connection rules.
Comment: +1 - Only open what is required for business.
Comment: I hear what you're saying, but "needed for business" almost always turns out to include HTTPS, and once you've opened one port for encrypted - and therefore uninspectable - traffic, you've effectively opened everything.  As has been said elsewhere, there are proxies which, combined with a local CA root installed on all browsers in the enterprise, can decrypt, inspect, and re-sign HTTPS traffic at the perimeter, but these are uncommon and expensive - and people using them probably don't need to ask the OP's question.
Answer: Deep packet inspection is the way to go here.  The traffic has to be examined in order to block it effectively.  If encryption is used, though, all bets are off.
You might try looking at Untangle.  It sounds like it could do what you want.
Comment: Untangle's "Protocol Control" is a great way to manage this.
Answer: You could use a Squid proxy server or a Smoothwall firewall appliance.   These would work because traffic shaping needs to use "deep packet inspection" to detect the protocol type.
If you cant figure out how to block the traffic then you have 2 more options:

Limit bandwidth by IP
Limit number of inbound connections by IP (that would slow Torrent to a crawl).
Answer: Your default firewall rule should be to deny all traffic in any direction
Other rules should be added on a pre requirement basis. For example, your DNS server(s) should be allowed to perform DNS lookups on the internet from the private network, but possibly no other machine should be allowed. Your HTTP proxy server should be allowed out on ports 80 and 443, no other devices should have this access unless absolutely required
I have to disagree with Wil, any well configured firewall should take in to account traffic in both directions. If it doesn't, the value of a firewall is somewhat lost as traffic does indeed flow in and out
I would suggest you review your infrastructure, and figure out what requires access in what direction. And, check your logs frequently for any traffic that's being denied, and act upon it if required
Answer: You might want to take a look at a similar question I asked a little while back:
Battling Bittorrent
Hope this helps.
Answer: Block all incoming and outgoing traffic to ports 6800-7000 to block most default setups for bittorrent clients.
The problem with this is that users can adjust the ports on the client to use other ports.
As another stated, just having inbound traffic on port 80 is enough for many bittorrent clients to work, just very slowly.
The only true way to block it is if there is some marker in the packet from/to the bittorrent client that an intelligent router/firewall could read and then block. I am not aware of any markers like this, though. And most routers/firewalls would only read certain parts of the header, not the whole packet, which would be needed. It could add a significant delay to all network traffic at a large site.
Comment: "Block all incoming and outgoing traffic to ports 6800-7000"  Not any more - uTorrent (the most popular client out there) for instance uses a random port around 50,000
Answer: You can also use a DNS system such as OpenDns and set security up so that the known torrent tracking domains are blocked.  I believe there is already a very large database of them.  You can also have this system setup to not allow access to gaming sites, social networking sites, ect.  It all depends on your business and if your network users should be allowed access to facebook or not.
Make it a KNOWN policy that it will not be tolerated, and appropriate action will be taken.
Perform random security audits of desktops to make sure that the security settings put in place are still in place.
Comment: where do I do that?
Answer: Intrusion Prevention Systems handle this seemlessly.  We use Tipping Point.
Answer: You can list popular torrent sites and block HTTP requests to them. This will disable uses from loading ".torrent" files, so they won't be able to use torrent clients. Mostly :)
Comment: and then I need to maintain list of all torrents sites?
Comment: Yep, but it's much easier to setup, and you'll need no special devices and/or software to make it work. Harder, but cheaper ;)

block Torrent through firewall


Inexpensive Math Books

Question: I am a college student with a limited budget looking to find an inexpensive way to collect high-level mathematics textbooks. I have access already to quite a few, both online and physical copies, through my University's website, but I am trying to get copies for myself so I can take notes in them, and I find I learn better from physical copies. Many introductory books are not too expensive for me, especially the Dover and (some of the) Springer series, but many books in the area I'm researching with a professor (Geometric Group Theory and Algebraic Topology) are on the $100+ range, and one book I would find very useful to have a hard copy of, A Primer on Mapping Class Groups, is over \$60 (by Farb and Margalit, I believe), which is still beyond my price point. I would appreciate any information on websites/bookstores where such books might be sold cheaply or even exchanged for other books.
Comment: @İbrahimİpek to quote the question: "I have access already to quite a few, both online and physical copies, through my University's website, I am trying to get copies for myself so I can take notes in them, and I find I learn better from physical copies." The OP is trying to get personal physical copies of the books.
Comment: Oh, i see. Deleted my comment now
Comment: Then maybe you should instead send your online copies to a press company. We do such stuff in Turkey. It is a lot more cheaper than buying the book.
Answer: Unfortunately there are plenty of books which as far as I know can't be found (in hard copy form) for anything approaching a reasonable price ($\$60$ being comparatively quite reasonable). In case the text exists freely and legally online, I recommend printing it out - or, more accurately, printing out individual sections as you need them. Eventually you'll have printed out the whole thing - there are then various services to get it bound cheaply. You won't have something fancy, but you will have a hard copy of the text in question which you can mark (and probably will have marked) at will. This still won't be free of course if your university doesn't give you free printing, but even then it will be much cheaper: e.g. at five cents per page, which I think is fairly common, you'd get A primer on mapping class groups and Hatcher's algebraic topology for about $\$55$ total.
Now what if the cost of printing winds up being prohibitive (or there's some other reason that's not feasible for you - maybe you have free printing but an enforced page limit)? You can in principle talk to your relevant professor about them printing sections out for you, clarifying that there is a genuine financial issue for you. I believe professors get free printing (certainly that's true at my institution), and while there are putative limits they don't seem to be enforced. However, without knowing the professor(s) in question I should point out that this may be risky - I have seen one or two people react negatively to being asked (although personally I find that response odd).
Answer: I don't know if it's ethical or not but you can access the Low Price Edition Books which are manufactured for developing countries by asking a friend or relative to ship it. It's very much cheaper but it has relatively bad paper quality at times and the text isn't coloured mostly. Also they are available for limited books and I checked there isn't one for the book you're searching.
You can also try Libgen.io and access PDFs of archived books and get them printed yourself if you're more comfortable with hardcopies.
Here are download links for book you mentioned
https://libgen.is/search.php?req=A+primer+on+mapping+class+groups&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def
Incase you're worried about the legality of downloading these books you can refer to this answer-
https://academia.stackexchange.com/q/112509/110568

Inexpensive Math Books


Can a contract be written that unlocks parts?

Question: Is it possible to write a contract that unlocks parts rather than, or in addition to, money or science?
I want to make it so that, for example, to unlock a better engine you would have to prove that the previous one was tested by taking it to an altitude above the ground, to simulate learning and using the part.
Comment: Modding is on topic. The only thing that currently isn't that is related to modding is specifically modded Minecraft crash dump style tech support questions.
Comment: @user16973 , people at [this forum](https://www.reddit.com/r/KSPModDevelopment/) may be able to help you. BTW, great idea!!!
Comment: Is this a modding question?
Comment: @Ash: Just asking for clarification, does this include both the usage of mods and the development of mods? Because OP is focusing on the latter and I thought only the former was considered on topic.
Answer: This question is old. I started playing on version 1.6. But it's not answered today:
Contracts which order you to test some part, enable the part as "experimental".
You kind of unlock it. But only until you solve this mission.


Heat equation and evolution of number of critical points

Question: Let $u_0$ be a smooth function on the unit sphere $S^1$ and assume that $u(t,x)$ is a smooth solution of the heat equation with initial data $u(0,x)=u_0(x)$. How one can apply the maximum principle to prove that the number of critical points of $u(t,x)$ at any given time is not bigger than the number of critical points of $u_0$?
Answer: Since $u$ is nothing but a $2\pi$-periodic solution of $u_t=u_{xx}$, looking at critical points amounts to looking at the zeroes of $v:=u_x$, which is another solution of the same equation. Then your question is solved by H. Matano : Nonincrease of the lap-number of a solution for a one-dimensional semilinear parabolic equation. J. Fac. Sci. Univ. Tokyo Sect. IA Math. 29 (1982), no. 2, 401–441.
Answer: In arbitrary dimensions one has the following  phenomenon. Start with a compact Riemann manifold $(M,g)$.    Fix an orthonormal basis of $L^2(M)$ consisting of eigenfunctions $(\psi_k)_{k\geq 0}$ of the Laplacian. Assume that the spectrum is
$$ =0=\lambda_0<\lambda_1 \leq \lambda_2\leq \cdots \leq \lambda_k\leq cdots $$
where aboveeach eigenvalues appears as often as its multiplicity A smooth function $\newcommand{\bR}{\mathbb{R}}$ $u_0:M\to \bR$ has an eigenfunction expansion
$$u_0=\sum_{k\geq 0} A_k \psi_k. $$
Suppose now that the coefficients are   independent normal random variables  such that the above  random function is almost surely smooth. (This happens if the variance of $A_k$ goes to zero very fast.)  We get another random function
$$ u_t=e^{-t\Delta} u_0. $$
As $t\to\infty$ the expected number of critical points of $u_t$ converges to the number of  critical points of the eigenfunction of $\Delta$ corresponding to the first nonzero eigenvalue.
On the other  hand if you choose $u_0$ of the form
$$ u_{0, R}=\sum_{\lambda_k \leq R^2} C_k \psi_k, $$
where $(C_k)$ is sequence  of independent  standard normal random variables, then for large  $R$, the expected number of critical points of the random function $u_{0, R}$ is  approximatively $Z_m R^m$, where $m=\dim M$ and $Z_m$ is a universal constant that depends only on $m$.   This random number of critical points is highly concentrated around its mean.      On the other hand as $t\to\infty$ the function
$$ e^{-t\Delta} u_{0,R}, $$ will have, on average,  fewer and fewer  critical points. The animation below illustrates this phenomenon (in the case $M=S^1$).

Remark 1.  Consider a random trigonometric polynomial of high degree $N$
$$u_0=\frac{1}{\sqrt{\pi}}\sum_{n=1}^N (A_n\cos n\theta+B_n\sin n\theta), $$
where $A_n, B_n$ are independent  normal random variables.
We set  $u_t=e^{-t\Delta} u_0$, and denote by $C_t(N)$ the expcted number of critical points of $u_t$. Then Kac-Rice formula implies that
$$C_t(N)=2\sqrt{\frac{\sum_{n=1}^N n^4 e^{-2tn^2}}{\sum_{n=1}^N n^2 e^{-2tn^2}}}. $$
One can prove the following.
For $t>0$ fixed we have
$$\lim_{N\to \infty}C_t(N)= 2.  $$
For $t=0$ we have
$$ C_0(N)\sim 2\sqrt{\frac{3}{5}} N\;\;\mbox{as}\;\;N\to\infty. $$
Remark 2.  Given a smooth function on a Riemannian manifold $(M,g)$  with eigenfunction decomposition
$$ u_0= v_1+\sum_{\lambda_k>\lambda 1}c_k\psi_k, $$
and $v_1$ is in the $\lambda_1$-eigenspace, then
$$u_t= e^{-t\Delta}u_0= e^{-t\lambda_1}v_1+\sum_{\lambda k >\lambda_1} e^{-\lambda_k t} c_k\psi_k, $$
then we observe that $u_t$ has the same number of critical points as
$$ U_t=v_1+\underbrace{\sum_{\lambda k >\lambda_1} e^{-(\lambda_k-\lambda_1) t} c_k\psi_k}_{=:R_t}. $$
We have
$$\lim_{t\to infty}\Vert R_t\Vert_{C^2(M)}=0. $$
The last condition implies that if $v_1$ is a Morse function, then the number of critical points of $U_t$ (or $u_t$) is equal to the number of critical points of $v_1$ if $t$ is sufficiently large. The above animation gives a depiction of $U_t$ for various moments of time $t$.
We typically expect $u_0$ to have a large number of critical points because the eigenfunctions $\psi_k$ for $k$ large are highly oscillatory.
Comment: See the new remarks I have added.
Comment: All that I claimed is this will happen for a random $u_0$ with high  probability.
Comment: Thanks Liviu. Where can I find a proof for the fact that "the function $e^{-t\Delta} u_{0,R}$ will have, on average, fewer and fewer critical points" ?
Comment: Is it true that there exists a sequence $t_n$ such that $t_n \rightarrow \infty $ and $e^{-t_n\Delta} u_0$ has fewer critical points than $u_0$ itself?
Comment: Thanks Liviu. I just posted a related question and I would appreciate if you take a look at it: http://mathoverflow.net/questions/194522/spherical-harmonics-and-nodal-sets


prosecutorial discretion and selective prosecution?

Question: Have there ever been any selective prosecution defences that have been successful ? A lot of news outlets claim that various racial groups are disproportionately targeted by prosecutors while framing charges. But has this as a legal defence ever succeeded and do courts take statistics into account ?
Comment: In what jurisdiction?
Comment: North America and Canada
Comment: Given your tags, I presume you're not interested in Central America or the Caribbean Islands, which are also part of North America.
Comment: I have citizenship of both though I'm currently living in my home country.
Answer: Yes.   The earliest case in the U.S. serves as the basis of the SCOTUS case of Yick Yo v. Hopkins (1886) which struck down a San Francisco law that targeted Laundry services run by Chinese Immigrants.  The case was later cited in 150 SCOTUS decisions and was used as a basis to reverse the Plessy v. Ferguson (1896) decision that permitted Jim Crow Laws in the Deep South.
That said, an affirmative defense of selective prosecution is hard to win, as selective enforcement has non-biased reasons to exist.  For example, it is impossible for cops to ticket all speeders, so most departments may prioritize ticketing speeders who are egregious or overly reckless over speeders who are 5-10 miles over the limit but are keeping with the flow of the rest of traffic.   The defense must show that the enforcement has a pattern of bias against a constitutionally protected class.   If a cop writes 5 tickets in a day, of which only 1 ticket is for a woman, it does not inheritably mean that the cop is targeting men (but rather that men were 4 times as likely to be aggressive drivers), and it would have to be shown that there was a conscious choice by the officer (either personal or institutional) to pull over men violating the law and ignore women.


Comparing two images and showing the difference in a new image?

Question: I would like to compare two web pages images using computer vision techniques.
Show what are non-unique portions comparing both images. Which part image1 not exist in  image2 vice versa.
Answer: A simple and time efficent solution is the computation of the absoulte values of the difference image. This can be done as follows:
<code>import cv2
img_a = cv2.imload([first_image_filename])
img_b = cv2.imload([second_image_filename])
img_diff = cv2.absdiff(img_a, img_b)
cv2.imshow('abs difference', img_diff)
cv2.waitKey(-1)
</code>
Comment: Thank you I can see the difference. Is it possible to ignore the same alphabets with different font sizes(Can we show as no difference)?
Comment: With such a low level analysis not. To ignore alphabets you would have to apply an optical character recognition (OCR) and than set regions with detected characters to 0.
Comment: Thank you, I will try to apply OCR and is there any similar kind of work or any blog.
Comment: I have got no specific blog in mind. Maybe https://www.learnopencv.com/tag/ocr/


Current being a differential form with distribution coefficients

Question: It is a standard result that on a domain $\Omega$ in $\mathbb{R}^n$, $T=\sum_{|I|=q}T_{I}dx_{I}$ for any $q$-current $T$, where $T_{I}$ is a $0$ current or a distribution on $\Omega$ for each multi-index $I$. Now, for an $r$-current $T$ and an $s$-form $\alpha$ on $\Omega$, define an $r+s$-current as $(T\wedge\alpha)(\beta)=T(\alpha\wedge\beta)$ for any $n-r-s$-form $\beta$ on $\Omega$. Then, in the above we have $T=\sum_{|I|=q}T_{I}\wedge dx_{I}$ on $\Omega$. At this stage, if we start with a general smooth manifold $M$(orientable) and a $q$-current $T$ on $M$, can we write $T=\sum_{\alpha}T_{\alpha}\wedge\omega_{\alpha}$ on $M~?$ (Here $T_{\alpha}$ and $\omega_{\alpha}$ are distributions and $q$-forms on $M$ for each $\alpha$).
Answer: The answer is mostly yes, although you may need to be careful with non-compact manifolds.
First look at the case of a compact manifold. Cover $M$ with a finite number of coordinate charts $\phi_i: U_i \to M$ and take a subordinate partition $\psi_i$ of $1$, so that $\sum_i \psi_i = 1$ and $\mathop{supp} \psi_i \subset \subset\phi_i(U_i)$. Now on each chart you can use the pushforward to consider $S_i := (\phi_i^{-1})_* (T \wedge \psi_i)$ as a current with compact support on $U_i \subset \mathbb{R}^n$. So apply your standard result on $S_i$ to get $S_i = \sum_I S_{i,I} dx_I$ and push this back to $M$, in order to get
$$T \wedge \psi_i = \sum_I \underbrace{(\phi_i)_* S_{i,I}}_{T_{i,I}} \underbrace{(\phi_i)_* dx_I}_{\omega_{i,I}}$$
Sum over $i$ to get the result. (You may need to cut of the $\omega_{i,I}$ outside of $\mathop{supp} \psi_i$ to guarantee smoothness, but I'll leave that to you)
For a non-compact manifold you can only choose a locally finite cover, so either your sum will be infinite or you will have to combine non-overlapping coordinate charts somehow, I vaguely remember that this can be done.
You can probably also try to take a different route, I think the main condition is finding $\omega_a$ such that they span the space of all $q$-forms in each point. If you have those than you can probably proceed similarly to the original proof.


Once demoted to a lower arena, can you still get the higher arena cards?

Question: If I was in arena 4 but got demoted back to arena 3, will I still get the arena 4 cards?
Answer: Nope, your chests are tied to your current - not highest - arena level.  If you make it to the top and then fall back to arena 1, you'll get arena 1 chests with arena 1 cards.
Answer: While what agent86 said is true, if you have any chests over from the higher arena, they will still contain those arena's cards. So yes, you will still get arena 4 cards but you will not get arena 4 chests. Therefore, the only way to get the arena 4 cards would be if there were arena 4 cards in the shop before you were demoted, or if you had any arena 4 chests.
Answer: In fact, the answer is yes (to your title, at least), but only in a very specific circumstance.  As I mentioned here - the Arena you play in determines what the awards will be for either player if they are the victor.  You can therefore get a Chest from a higher Arena if you are high enough and get lucky (both by getting matched to a higher Arena, and winning that match).
Answer: No. But I have discovered that if you unlock a card from a arena, and then fall back down, you can still get more of that card.
Answer: No. what ever arena you are in, is what arena cards your gonna get... If your in arena 4 and drop down to 3, you'll still get your chests from 4; and then once your out... Your gonna get lvl 3 arena cards only;)
Answer: What everyone answered is true. However, you can also still request the higher-arena cards if you have already recieved them.


Admob real ads not showing after publishing it

Question: After I publish my game in google play and download from play store, I'am waiting for my banner ads to come up and unfortunately it doesn't showing up... but when I include the build.adTest(); when I trying the game/app the ads shows. What do you think is the problem or do admob take some time to show their live/real ads?
Comment: Can you please add your code
Comment: @ApurvaKolapkar My game is now published on google play. I don't include the adTestDevice("xxxx.."); ... but when I debugging/ testing the game with adTestDevice();, the ads shows up.
Answer: According to Google

"It could be that you have only recently created a new Ad Unit ID and
  requesting for live ads. It could take a few hours for ads to start
  getting served if that is that case. If you are receiving test ads
  then your implementation is fine. Just wait a few hours and see if you
  are able to receive live ads then. If not, can send us your Ad Unit ID
  for us to look into."

https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/fBe3YL3ffpo
so wait for a few hours.
Comment: its been 6 Days since no ad is showing
Comment: @frankied003 it started working after 10 Days :)
Comment: Any update with this? Did you just have to wait or did you implement it wrong? @AmanDeep
Comment: 10 days? That's crazy! I have to wait for a week more. :(
Answer: In my case, I have to submit the payment details first to show ads in app. Just visit admob and read the warning at top.
Comment: Checkout this issue:  https://stackoverflow.com/questions/58143111/unable-to-setup-payment-method-on-new-admob-account.
Comment: In the payment section it is saying : The requested URL was not found on this server!
Answer: I had the same issue
spent 1/2 days of analysis
because of an innocent looking/clever bug:
It was due to 2 things mainly:

I removed all default test ids from all plugins
this helped me to know what is the issue
we know different types of ads will have different default test ids given in AdMob
.
troubleshooting I did is below:

a) test ad id - test ad should load
b) wrong ad id - no ad should on load (nothing should show), wrong id can be '1111111'
c) real ad id - real ad should NOT load locally (nothing should show, since it not uploaded)
d) real ad id - real ad should load after uploading to google play (after 4 hours or so, after upload)

using above point, I fixed the bug in the code
innocent looking copied code from the internet worked great for test ads
since it loaded test ads correctly, have assumed it was correct code as other said both test & real ads are from same channel (real ads won't show until uploaded to play console, acc. to point d) above)

when the ad id was given incorrect, a plugin was taking default test id so showing test ads
just before uploading apk to play console, changed to real id, built and released apk
after uploading to play store, initially showed a blank screen for a few hours (maybe 2-4 hours), then real ads started showing.
hope that was detailed & helps others, else ping below.
Comment: I have not uploaded my app on play store yet. So you are saying that is the reason for real ads not showing up??
Comment: Looks like so, for initial/first-time upload.
Answer: I had the same issue, I tried 2-3 days.
I had placed the correct ad id, but ads were not showing in real device.
I got this problem fixed by :

I published the app on play store.
I shared the app to 3-4 friends to test it. Even then the ads were not shown, after 2-3 hours ads began to show.

Conclusion: For newly created ads to work, Admob need more requests to start showing ads.
Answer: Yeah. Sometimes it takes some time. And, it also depends on your geographic location. Some locations have more ads availability than others.


Are Jarvis Virus/Ada Refactors useless to the other side?

Question: If an Enlightenment player picks up an ADA Refactor or if a Resistance player picks up a JARVIS virus, are they of any use?  (Apart from recycling!)
Each appears to be a weapon that can only be used by one side.
Answer: The refactor viruses can be used by either sides. If you use the virus to switch the control to your faction, you become the owner of the portal and all of the attached resonators, destroying any link and fields attached to the portal itself, but getting no AP from the action. If instead you use your opposite faction's refactor, the portal becomes owned by "Jarvis" (or "ADA").
Switching the portal to the opposite faction can be useful to destroy links that are in the way of the construction of a big field. Using both kinds of refactor on a portal can also let you create a L8 portal without the need to have eight L8 agents available.
Comment: @Informaficker I'm absolutely sure. You can check it [here](https://plus.google.com/+Ingress/posts/QP5AKXk12Gw).
Comment: Are you sure that there is no AP given? I heard the opposite, but couldn't try it myself yet.
Answer: Here is a variant of "campfiring".
Wherever the resonators are deployed (correctly or not), an undefended portal is no match to a high level player.
But an increasing number of players have their "home portal" or "work portal" directly accessible from their couch or their desk. These home portals usually have a combination of heat sink and multi-hack mods in order for their "owner" to be able to farm efficiently on them.
To prevent them from doing so, one can deploy a portal, add four link amps on it (which are no use either for defence or farming) and then convert it to the enemy faction. The link amps will be unremovable, and the owner will be stuck with their regular four hacks per 4 hours, unless they use a refractor/virus to convert-destroy-rebuild-upgrade.
Answer: You can also use other-team refactor viruses as a portal denial weapon. Here's how:

Take down the enemy's portal by normal means.
Stand directly on the portal's location and deploy eight level-1 resonators.
Flip the portal into your enemy's hands.

This leaves them unable to space the resonators properly without using a refactor of their own, but makes the portal so vulnerable to attack that they can't wisely invest much in upgrading it or linking it. I've heard this called "campfiring" the portal, since the eight L1 resonators look like a fire at the base of the portal.
Comment: For extra credit - Deploy 4 link amps to it so they can't even shield it.
Comment: Someone did this to a portal near me just recently. I used my otherwise unused "convert to the enemy's side" weapon, just so I could destroy it in front of them. May have been a little petty, but I had no other use for the weapon.
Comment: Hi @Ben, what do you mean by "unable to space the resonators properly"? Thanks.
Answer: Edit: As of 2013-11-07 there's a one hour penalty until another virus can be used on the very same portal again (source). However the technique can be used to easily gain the same amount of MU for (big) fields up to 4 times by flipping the anchors.
The other faction's viruses can be used for quick-levelling.
One can gain very much AP in a very short time span from otherwise not-so-useful viruses of the other factions type.
Needed:

Area with many dense portals (not yet fully linked)
A number of Jarvis viruses or Ada refactors
Plenty of keys of the area or a group of players (to hack keys on the fly)

How to do it:

Area needs to be in the own hand, but not linked yet (best)
Pick a special portal to be the root portal
Link every portal in reach to this portal, then make as much fields as possible
Now flip the special root node portal
Destroy it, rebuild it, re-link everything
Repeat

We did this once and one L7 player made L8 with an AP gain of around 250k in less than one or two hours. Let there be n portals to connect to the root node each round, then you can gain
<code>n*313 + (n-1)*1250 = (n-1)*1563 + 313 AP per *round*
</code>
E.g. if you have 15 portals, this gives you 23.8k AP per Jarvis/Ada and round.
Comment: Just get a beer and wait
Comment: Nowadays it wouldn't work are viruses can only be used once per hour on each portal.
Answer: On the Comms channel, a team-member suggested another use.
A high-level user can help a newbie by destroying a portal, allowing the newbie to (poorly) place low-level resonators on the portal, convert the portal to the enemy's side and then destroy the easily-demolished portal. It will earn them some easy AP, especially if they have enough keys to establish fields twice.
In fact, the newbie could do this directly, without the higher-level player.
Comment: Take a line of portals and connect them, then draw the fields from a single portal on the outside that you link all the way up, flip it, kill it, link it back up, etc.  Quick AP if you have the keys/flip cards
Answer: The refactor viruses can be used to frustrate the other faction, by removing and blocking farming modifiers on their portals.

Flip the enemy L8 farming portal to your faction (or take it down.)
Remove the multi-hack and heat sink mods (or deploy low level resonators if you took it down.)
Deploy a full set of less useful mods; common shields, link amps etc.
Flip the portal back to enemy faction.

The enemy faction will not be able to change the modifiers without flipping the portal or waiting for it to be taken down by decay or enemy agents.
Answer: Since recent updates fields cannot overlap. Existing long links block creation of smaller links and fields if in the way. Enemy weapon is useful for removing nasty long links mid-town.
Answer: FARMING! FARMING! FARMING!
If anything, I think they are actually MORE useful. They are useful for getting rid of friendly derp links (long nonsensical links that block potentially useful links), but also, they are great for FARMING. Here is what you do:
Build a farm of level 8 portals. Make sure it is not too big; you should be able to burn out the whole farm in about an hour. Deploy all four mod slots with hacking mods (3 Multi-Hacks and one Heat Sink are usually best). Then flip the farm to the enemy faction and farm it! They can't blow it up (because it is their faction), and they can't flip it back and blow it up for at least an hour, because ADA and JARVIS give portals one hour immunity to another ADA/JARVIS. So, instead of wasting any of your Mod Slots on shields or other defensive mods, you can fill them all with hacking mods (Multi-Hacks and Heat Sinks) and get way more hacks out of your farm. PLUS you get 100 AP for each hack. And when it's over, if you don't feel like leaving a farm up for others to use, you can just blow it up.
The only danger at all in this strategy is that members of your faction might unwittingly blow up your farm, so make sure that they know not to, and have it in a more isolated area if you can.


Which type of DC electric motor is the best suited for driving a mechanical clock?

Question: I want to drive a clock mechanism with a motor. In order to get acceptable accuracy I need a motor that can deliver a certain rpm very precisely, is low on vibrations, noise and power consumption, and has a certain longevity. I don't need "production grade" accuracy, this is just for the learning experience, but I want to come as close as feasible. So far what I found out was that it should probably brushless and be able to operate at a low voltage. Still there is a staggering selection. Which other criteria should I pay attention to?
Comment: synchronous machine and then gears... this is how wall clocks work. generator companies have a requirement to met quite a tight long term average for the supply frequency. Why this way over say some controller and more complex motor commutation? you will not beat the mains for long term timing (well atomic clocks do :) )
Comment: I would say a stepper motor. but you can hardly call it a "mechanical clock".
Comment: Ok true it's not powered by a spring so maybe it's not the right word. I considered a stepper motor, but want to have a fixed rpm so that I have to figure out the precise transmission to use for the mechanics. A stepper motor would feel like cheating.
Comment: Cheating whom? :) Is it educational project, or you just want make something working?
Comment: Cheating myself. The challenge is to get two or three separate hands moving from a single fixed rpm motor using only gears
Comment: AC (mains) powered or DC?
Comment: DC
Comment: Are you saying that you want a *smooth* sweep of the second hand rather than a step every second?
Comment: Yes I guess a smooth sweep will be much easier to implement.
Comment: @JonRB Modern wall clocks use a quartz oscillator, which I believe also beats mains for long-term timing.
Comment: @Felthry I don't know if even a TCXO will be more accurate than the mains in the long term (over a week and more, recent problems in Europe notwithstanding). The mains frequency is accurate long-term by law (legal, not physical).
Answer:
The challenge is to get two or three separate hands moving from a single fixed rpm motor using only gears.
DC supply.

A stepper motor typically gives you 200 steps per revolution. You could gear that to give the second hand a step per second or half-second. You can precisely control it by microcontroller (so you'll have an accurate clock) and you still have all the gearing to play with between the second, minute and hour hands.
The stepper won't be cheating. It will be a sensible solution to the problem.
Answer: Use the plate mover motor from an old microwave. These are also available as spare parts for less than $10. These are synchronous motors which rotate at a fixed fraction of the mains frequency, usually about 10rpm. All you have to add is an additional gear which does one round per hour.
Comment: Good idea, but I guess it's only for AC. I'm looking for DC.
Answer: If you want 'a certain rpm very precisely', then your only options for a pure motor are a stepper motor, or a BLDC run as a stepper.
You could use an ordinary motor, servoed with some sort of encoder, but that's just a more complicated way of getting to your exact rpm.
From the comments, you consider that use of a stepper motor is cheating. It is, if you present the clock as pendulum/escapement regulated. It isn't, if you want to build a mechanical time display, that's as accurate as the timebase you choose to employ.
Answer: Depending what you consider a "motor" you could consider one of the solenoid-assisted pendulums. It avoids the sense of cheating as the period is derived from the pendulum, and, as a converter of electrical into kinetic energy is still legitimately a motor.
For example, suspend a magnet on the pendulum, and pulse a solenoid coil when the magnet triggers a Hall effect sensor.
See also Hipp toggle, Synchronome, or a home built derivative, or the much less exotic ATO clock .


Word for someone who says exactly what they are thinking

Question: Is there a word for someone who would say exactly what they are thinking. Sort of if there is this boy named Bob, and whenever he has something on his mind he just says it out loud.
Comment: As Launius pointed out, we need a little more information.  There are various words for someone who says what they are thinking.  Forthright, straight forward, straight shooter, blunt, candid, frank, sincere, truthful... Please read the page on single word request.  "YOU MUST INCLUDE A SAMPLE SENTENCE.... [and] questions that show no research are likely to be closed."
https://english.stackexchange.com/tags/single-word-requests/info
Answer: Forthright is a word which describes someone who says exactly what they are thinking.

'free in expressing one's true feelings and opinions'

Merriam-Webster

George Orwell's contention was that it is a sure sign of trouble when things can no longer be called by their right names and described in plain, forthright speech. . . . Christopher Lasch

Quote
Answer: One adjective that might work is unfiltered, which Merriam-Webster's Eleventh Collegiate Dictionary (2003) defines as follows:

unfiltered adj (ca 1775) 1 : not filtered {unfiltered wine}; also : not modified, processed, or refined {unfiltered commercial publicity material —Paul Grimes} 2 : lacking a filter {an unfiltered cigarette}

As the Eleventh Collegiate notes in its definition of filter, that word can refer to

something that has the effect of a filter (as by holding back elements or modifying the appearance of something

A person who has no internal check on his or her thoughts and thus holds back nothing of what he or she is thinking may thus be described as unfiltered.
Answer: Blunt might be a good choice.  My choice would probably depend on the connotation of said person's behavior.  You are painting a picture for your audience; what do you want them to see?  Is the behavior inconsiderate?  Assertive or aggressive?  Or is it embarrassing?  Something else?  There are a lot of options.


Antisymmetric matrices in effective field theory

Question: I'm trying to construct a nonlinear $d$-dimensional version E&M as an effective field theory. Let $F_{\mu\nu}=\partial_\mu A_\nu-\partial_\nu A_\mu$ be the field strength. The most general action I can write down will be a generic function of the following? Treating $F_\mu^\nu$ as a $d$-dimensional antisymmetric matrix, I can create Lorentz invariant combinations by taking
$$\text{tr}(F^2),~~\text{tr}(F^4),~~\text{tr}(F^6),\dots,\text{tr}(F^{2n}).$$
My question is: What is the largest value of $n$ such that the above traces are all independent of one another?
Comment: I am not sure if this is exactly what you're asking, could [this answer](https://physics.stackexchange.com/a/145580/222555) by Nikos M. and other users be related?
Comment: One Natural non-linear generalization of EM is DBI (Dirac-Born-Infield)action.
Comment: By looking at the characteristic polynomial in 4D, i found that the only non-trivial combinations are $E^2-B^2$ and $(E\cdot B)^2$, which agrees with the above comments. Im mostly interested in 4D, so this essentially answers my question, but just for the sake of curiosity, I would like to know how this generalizes to higher dimension.
Answer: The number of independent invariants of electromagnetic field in $d$ dimensions is $\lfloor \frac d 2 \rfloor $, where $\lfloor \,. \rfloor$  is the floor function.
The number could be guessed because for a general (non-null) field  there would be a Lorentz transform of the field strength tensor (see e.g. here) which would have at most $\lfloor \frac d 2 \rfloor $ independent real parameters:
$$
F'_{\mu\nu} = \Lambda \Lambda F  = \begin{bmatrix}
  \begin{matrix}0 & B_1 \\ -B_1 & 0\end{matrix} &  0 & \cdots & 0 \\
  0 & \begin{matrix}0 & B_2 \\ -B_2 & 0\end{matrix} & & 0 \\
  \vdots & & \ddots & \vdots \\
  0 & 0 & \cdots & \begin{matrix}0 & B_r\\ -B_r & 0\end{matrix} \\
    & & & & \begin{matrix}0 \\ & \ddots \\ & & 0 \end{matrix}
\end{bmatrix}
$$
So, for  $\text{tr}(F^n)$ with $n>d$ there should be recurrence relation expressing the trace through traces of lower powers.
Explicit construction of algebraic invariants of field strength tensor in arbitrary dimensions and the discussion of algebraically special cases could be found here:

Sokolowski, L. M., Occhionero, F., Litterio, M., & Amendola, L. (1993). Classical electromagnetic radiation in multidimensional space-times. Annals of Physics, 225(1), 1-47, doi:10.1006/aphy.1993.1050.


Condition for $a, b + \omega$ to be the canonical basis of an ideal of a quadratic order

Question: Let $K$ be a quadratic number field.
Let $R$ be an order of $K$, $D$ its discriminant.
By this question, $1, \omega = \frac{(D + \sqrt D)}{2}$ is a basis of $R$ as a $\mathbb{Z}$-module.
Let $I$ be a non-zero ideal of $R$.
By this question, there exist unique integers $a, b, c$ such that $I = \mathbb{Z}a + \mathbb{Z}(b + c\omega),
a \gt 0, c \gt 0, 0 \le b \lt a, a \equiv 0$ (mod $c$), $b \equiv 0$ (mod $c$).
If $c = 1$, we say $I$ is a primitive ideal.
Let $a = ca'$, $b = cb'$.
Then $I = cJ$, where $J = \mathbb{Z}a' + \mathbb{Z}(b' + \omega)$.
Clearly $J$ is a primitive ideal.
Let $I = \mathbb{Z}a + \mathbb{Z}(b + \omega)$ be a primitive ideal, where $a$ and $b$ are integers such that $a \gt 0, 0 \le b \lt a$.
Let $\omega'$ be the conjugate of $\omega$, i.e. $\omega' = \sigma(\omega)$, where $\sigma$ is the unique non-identity automorphism $K/\mathbb{Q}$.
Since $\omega + \omega' = D$, $\omega' \in R$.
Hence $N_{K/\mathbb{Q}}(b + \omega) = (b + \omega)(b + \omega') \in I$.
Hence $N_{K/\mathbb{Q}}(b + \omega)$ is divisible by $a$.
I came up with the following proposition.
Proposition
Let $K, R, \omega$ be as above.
Let $a \ne 0$ and $b$ be integers.
Suppose $N_{K/\mathbb{Q}}(b + \omega)$ is divisible by $a$.
Then $I = \mathbb{Z}a + \mathbb{Z}(b + \omega)$ is an ideal of $R$.
Outline of my proof
I showed $(b + \omega)\omega \in I$ using $\omega + \omega' = D$.
My question
How do you prove the proposition?
I would like to know other proofs based on different ideas from mine.
I welcome you to provide as many different proofs as possible.
I wish the proofs would be detailed enough for people who have basic knowledge of introductory algebraic number theory to be able to understand.
Answer: It suffices to prove that $(b + \omega)\omega \in I$.
Let $N_{K/\mathbb{Q}}(b + \omega) = ac$.
Then $(b + \omega)(b + \omega') = (b + \omega)(b + D - \omega) = ac$.
Hence $(b + \omega)(b + D) - (b + \omega)\omega = ac$.
Hence $(b + \omega)\omega = (b + \omega)(b + D) - ac \in I$ as desired.


Window will not close

Question: I have a single hung vinyl window that I can't get to close all the way.  The the building was built in 2007 and I assume the window is that old. Nothing appears to be blocking the track. Can this be fixed or should I look into replacing the window.
picture of the small gap at the bottom of the window
Comment: have a really good look at the problem and describe it in great detail ... the picture shows something that you neglected to mention
Comment: Check the track on which the window slides, and check that the catch at the **top** of the window** is not hitting an obstruction.
Comment: I tried to take the window out to look at tracks and sides of the window. One of the take-out clips is missing and the other one is broken. I'm going to put new take-out clips in and see if I can get the window out.
Comment: There is a 1/8 inch gap between the bottom rail and the frame of the window. The catch does not engage. It feels like something is blocking the window from closing. When I inspected the window I could not find anything that might be blocking it from closing.
Comment: you seem to be missing the fact that the window is at an angle to the frame
Comment: The picture might make it look that way. However the 1/8th inch gap runs along the full window. I'm going to add a new picture.
Comment: It appears that I have broken channel balance. I'm going to try to find the right replacement part and go from there.
Answer: The window had a broken channel balance. I was able to order parts and replace both channel balances. I replaced both since it seemed like I should but maybe I could have just replaced the broken one.
How to replace a non-tilt window channel balance:
https://youtu.be/u4g8Z8jkwTk

Window will not close


SQLite Read Column

Question: I have a SQlite Database with an id,name,number.
My problem is that I need a command which gives me the name connected with an AutoComplete function in an editView and in another editView there should stand the correct number related to the name. For example: I have the name rice and the number 50. I want the rice in the first editText and connected to the AutoComplete and the number 50 in another editText.
I am looking up the internet and also some manuals for SQLite for that, but it seems like I am too blind to find the right command. Someone has a suggestion for a tutorial where this is shown or someone has the right command for me to read this information out of my database.
Answer: SELECT number FROM table_id_name_number WHERE name = 'rice';

SQLite Read Column


Data Annotation for column width

Question: I'm binding a collection of objects to a DevExpress GridControl, and using 15.1 Data Annotations to customise the look. However I'm struggling to find anything about setting column size of a property. Is this possible through annotations?
Class with annotations:
public class DataFeedback
{
    [Display(Name = "Row Num", Order = 0)]
    public int RowNum { get; set; }
    [Display(Name = "Description", Order = 1)]
    public string Desc { get; set; }

    public DataFeedback(int rowNum, string desc)
    {
        RowNum = rowId;
        Desc = desc;
    }
}

Simple Binding
var feedbackList = new List<DataFeedback>()
feedbackList.Add(new DataFeedback(1, "test"))
gridControl1.DataSource = feedbackList;

// only layout I've found so far
gridView1.BestFitColumns();

Comment: did you try using the StringLengthAttribute?
Answer: Out of the box there are no data annotation attributes that can be used to specify the column size of the UI grid. The StringLength attribute (and others) are used to specify the column size in the database and the size of the data for data validation, but that's as far as they'll go.
I'm not familiar with the DevExpress controls, but if it provides a hook in to the automatic column generation process you can do something similar to what I did for the Telerik grid (http://geekswithblogs.net/sdorman/archive/2015/11/05/kendo-grid-mvc-wrapper-automatic-column-configuration.aspx).
In that solution, I created a custom data annotations attribute (similar to this):
public class GridColumnAttribute : Attribute, IMetadataAware
{
    public const string Key = "GridColumnMetadata";

    public string Width { get; set; }

    public void OnMetadataCreated(ModelMetadata metadata)
    {
        metadata.AdditionalValues[GridColumnAttribute.Key] = this;
    }
}

Then, you decorate your view model:
public class DataFeedback
{
    [Display(Name = "Row Num", Order = 0)]
    [GridColumn(Width = "100px")]
    public int RowNum { get; set; }

    [Display(Name = "Description", Order = 1)]
    [GridColumn(Width = "300px")]
    public string Desc { get; set; }
 }

Finally, in the code that gets called from your column generation hook, you would do something similar to this:
public static void ConfigureColumn<T>(GridColumnBase<T> column) where T : class
{
   CachedDataAnnotationsModelMetadata metadata = ((dynamic)column).Metadata;
   object attributeValue = null;
   if (metadata.AdditionalValues.TryGetValue(GridColumnAttribute.Key, out attributeValue))
   {
      var attribute = (GridColumnAttribute)attributeValue;
      column.Width = attribute.Width;
   }
}

It looks like you might be able to do this by using the supported fluent API and the With<T> extension method and/or possibly hooking in to the RowCellStyle event. (https://documentation.devexpress.com/#WindowsForms/CustomDocument18017)
If you can't hook in to the column generation process, you may be able to do the same thing but using your own extension method that gets called after the grid is bound, much like you're doing with calling BestFitColumns().
Answer: If you look on this page  https://documentation.devexpress.com/#WindowsForms/CustomDocument114039
In the section "Validation Attributes", there is a StringLength attribute, where you can specify the min and max number of characters of the data, e.g.
[StringLength(20, MinimumLength = 3)]

Data Annotation for column width


text gets pixalated when converting from illustrator to Photoshop

Question: I drew a 8.5"x 11"rectangle, then convert it to smart object and distort it according to the image size.(am creating a mock)
But when i copy my document from illustrator and paste it on the rectangle in Photoshop every thing gets pixelated.
How can i stop this from happening.
Answer: Looks like you are trying import your smart object into a low resolution image.
It also looks like you have zoomed in on the image. If you zoom in far enough on any raster image you will see pixels. Don't zoom in. View the image at 100% zoom.
Note that everything in Photoshop is raster. Even vectors are rendered as raster images.
Also note that Smart objects are rendered at the resolution of the image you are importing them into, so if you begin with a low resolution image and import a vector image as a smart object it will look like cr*p, especially if you zoom in on it.
The solution is to begin with a higher resolution image, then paste your smart object into that.
Comment: Thank you so much billy. i just discovered that too. resolution is the answer here. without thinking anything i set my resolution 300 dpi from 72. magic happens! Thank you again! <3


Asbestos between floors

Question: I have a layer of white paper or cardboard like material houses between the subfloor and a layer of wood on top. The stuff crumbles pretty easy. I do not intend to demo the floor or anything so my question is, will this potential asbestos be okay living there between wood floors or as I walk do I grind it up and move it about to the point where it will leak through cracks etc.  thanks.
Comment: How old is the house, and how long do you guess the floor has been down that has the questionable material under it?
Answer: As long as the asbestos material is contained between your subfloors you are fine.  It doesn't matter if it crumples up being sandwiched in there.  You may have to take extra precautions taking it out in this case but it isn't a concern in current state.

Asbestos between floors


How induced EMF possible in a stationary conducting loop?

Question: If a conducting loop is placed in an increasing magnetic field, current starts flowing through it due to induced EMF. But similar to a conducting wire, if the loop is considered to have 0 resistance (and should also have same potential at any point) why should current flow through it?
Answer: If magnetic field is changing in time, it is associated with so-called induced electric field. This kind of electric field is not conservative field, it cannot be described by the concept of potential.
This electric field, if alone, would push the mobile charge carriers and start current. Without ohmic resistance, the current would keep on increasing. The rate of current increase would depend on self inductance of the circuit L. The higher the L, the slower the current increase rate.
Answer: The electric potential can only be defined for a conservative electric field, and by Faraday's law, the electric field is not conservative in a region with a time-varying magnetic field.  So, it does not make sense to talk about the potential in this case.
For a loop of finite volume and conductivity, current flows according to Ohm's Law, $\mathbf{J} = \sigma \mathbf{E}$, where $\mathbf{E}$ is the induced electric field satisfying $\oint \mathbf{E} \cdot d\mathbf{l} = -\dfrac{d}{dt}\oint \mathbf{B} \cdot d\mathbf{s}$. As the conductivity is increased, the current concentrates near the boundaries of the conductor, in what's known as the "skin effect". A small electric field, mostly tangential to the boundary, "pushes" the current in the thin skin region. In the limit of infinite conductivity, any time-varying EM field vanishes inside the conductor and all the current flows in the zero-thickness surface that bounds the conductor. The current that flows in this surface needs no electric field to push it along, as the resistance is zero. What determines the surface current is the condition that the EM fields it produces exactly cancel the EM fields that would exist in the region of the conductor if the conductor were absent. From the boundary condition for the magnetic field $\mathbf{H}$, this surface current is $\mathbf{J}_s = \mathbf{\hat{n}} \times \mathbf{H}|_\text{on boundary}$, where $\mathbf{\hat{n}}$ is the outward-pointing unit normal to the conductor boundary. Note that since the electric field is zero inside the conductor, there can be no time-varying magnetic flux through the loop. The infinite conductivity of the loop (an idealization of course), allows immediate cancellation of the magnetic flux through the loop, which makes sense in view of Lenz's law.
Answer: An increasing magnetic field is a changing field, and will produce some current in a conducting loop. A stationary conducting loop in an unchanging magnetic field will produce no current.
Answer: Its more or less like an ideal wire connected to an ideal battery. The charges rush to make both the terminals at the same potential but fail because the battery is constantly trying to maintain the potential difference by means of re-dox reactions.
Same in this case, the charges move in response to the induced E-field (EMF) to make two points at the same potential but the EMF is again generated due to the relative movement of the two (magnet and wire loop).
Remember you can't use Ohm's law here because your wires have no resistance. However in reality, the current will always be limited due to resistance of the wires.
Answer: The correct answer is that in general there is a scalar - energy - potential that depends on charge. In this case there is no charge. This potential is conservative. Then there is a vector or momentum potential that depends on current. It is not conservative. The time derivative of this potential contributes to the force in charges, hence by the definition implied in the Lorentz field must be called electrical field even though it is caused by currents.


What is the maximum G load a 747 can withstand during an emergency course reversal?

Question: In an emergency course reversal, passenger safety first priority, to avoid say, a column of ash from a new volcano, what it the most G a 747 can withstand with an average passenger complement?
Comment: @RalphJ What is the exact process of calibrating the seat of your pants?  :P
Comment: "Withstand" as in, before you break the wing spar or some other necessary component?  That all depends on the fatigue history of the aircraft and its exact gross weight. Unless you're pulling hard to avoid a SAM, nobody wants to go that far beyond the operating limitations of the flight manual.  I suspect that 60 degrees, which is 2 G's, is as much as anybody would really use.  But I'll defer to @Terry for the actual 747 driver's answer!
Comment: Also, once you leave level flight, you're sorta guessing at your G-loading. Level, G-loading maps to bank angle, although not (at all) in a linear way.  With a descent - the quickest way to make a 180, assuming you have terrain clearance - you can bank quite a bit & maintain a low G-load if you're willing to accept the lost altitude & gained speed. But without a G-meter (not typically found in airliners!) or a highly calibrated seat-of-the-pants, you don't KNOW how much G you're pulling. You can estimate, but you don't know -- unless you regularly pull 2, 2.5, 3, etc outside of airline flying.
Comment: Don't the EASA and FAA specs require a minimum load factor of 2.5 for a large plane? And back from school I remember an aerospace safety factor of 1.5. So I'm guessing maybe 4 to 4.5g.
Comment: Nowadays the flight control computer would prevent the pilot from exceeding a certain limit load factor. So the aircraft structure could handle more, but the computer won't let him.
Comment: Possible duplicate of [What does it take to turn a 747 around 180 degrees?](https://aviation.stackexchange.com/questions/8012/what-does-it-take-to-turn-a-747-around-180-degrees)
Comment: I disagree with the duplicate question. This question asks about limit loads and ultimate loads, the earlier question asked for a turning radius.
Comment: Related : https://aviation.stackexchange.com/q/8073/679
Comment: Dynamic loads are usually higher than static loads. So the safety factor would go on top of these.
Answer: It depends on how you define :withstand". China Airlines flight 006 experienced vertical load factors of up to 5.1 g on 19 February 1985. The aircraft could be landed safely and there were no fatalities, but there was considerable damage:
Image source
From the NTSB incident report:

The wings were bent or set permanently 2 to 3 inches upward at the wingtips; however, the set was within the manufacturer's allowable tolerances. The left aileron's upper surface panel was broken and the trailing edge wedge was cracked in several places.

The maximum load factor an aircraft can be subjected to is a function of time. Two cases are determined for civil aircraft:

Limit load factor. For transport aircraft weighing more than 50,000 lb
(22,680 kg) this load factor is equal to 2.5, while for lighter aircraft it is a function of the weight.
Ultimate load factor = 1.5 times limit load factor, is the higher of the gust and the manoeuvre load factor.

The load factors are determined in accordance with the airworthiness regulations 14 CFR part 23.341 and 14 CFR Part 25.341. Damage tolerance of the airframe and the consequences of metal fatigue are stated in 14 CFR part 25.571.
The B747SP of the incident is an aeroplane that was designed and constructed in the 60s/70s, before Computer Aided Design and engineering were wide-spread, and the structures were designed with analytical mathematics and knowledge from experience, then tested for limit loads and ultimate loads. The more the design stresses can be modelled on a computer screen, the closer the wing ultimate load can be to 150% of limit load. Older aeroplanes did not have these modelling tools, and wings could end up to be stronger and heavier than they needed to be. Something that everybody applauds, but nobody wants to pay for with a higher ticket price.
A video of the B777 shows how the static testing for ultimate load is done: an actual wing is bent until it breaks. It is not a test of wing flex, it is a test of static strength.

The particular 747 of the incident had a wing designed for an MTOW of 378,000 kg, while actual MTOW of the 747SP was 320,000 kg: an extra load factor of 1.18. Fuel in the wing tanks provides extra bending relief, not for the ailerons though..
Answer: Civil aircraft certification requirements for airliners demand normal operations be possible up to 2.5g and down to -1g in clean configuration up to design manoeuvring speed, reducing above that speed. Googling EASA CS25 should show this for European-certified aircraft. The same design requirements furthermore specify that the structure must withstand loads in excess of these, but I am not quite sure as to the actual factors.
There have been accidents where design operational loads were exceeded which still ended with a safe landing.
Comment: My question was right inline with the picture of the damaged aircraft. If the turn does not cause the craft to immediately break but allows a landing and saves everyone's life that is the G loading I was asking about.
Answer: In clean configuration, as has already been said, it's +2.5 / -1g, this is called limit load. Then you add on a 50% factor to yield the 'proof load',  or ultimate fail load, which is proven in destructive testing.
But it's important to remember though, bits break by force, not G. G is just acceleration. So you have to multiply it by the aircraft weight to yield the shear force that breaks the wing root, spar, or whatever. That's why the limit load is applicable at Max Take Off weight. And also why a glider or aerobatic aeroplane can pull more G, because multiplied by the mass, the ultimate force applied to the components is lower.
Comment: Welcome to AV.SE! Note that the best answers would be ones that add information not previously covered.


Macbook Pro won't power up

Question: My Macbook Pro will not boot normally or in safe mode. My power cable lights up green when it is connected. Pressing the power button does nothing. However, if I unplug the battery and wait a few seconds, the screen will light up, the apple and the progress/status bar comes on, as well. The working indicator starts to whirl but when the status indicator gets about a tenth across the bar, the screen goes black. There is no hard drive sounds.
Answer: I have had the same problem with my mac book pro. Maybe you could try booting from an external HDD?
In my case I tried everything from replacing the hard drive, reset PRam(hold cmd+shift+p+r right after pressing the power button), replacing the internal battery; all without success. So if none of those things won't work it's probably your motherboard having a serious issue. Only thing I could have done was replacing it.

Macbook Pro won't power up


Should I take a mean of answers given by an individual on a Likert-Style Scale?

Question: I want to use three established scales which have a Likert Scale as a response - for instance the 10-item Need for Belonging scale (Leary et al., 2013). This scale is a 1-5 response alongside another scale and the third scale is a 1-7 response. I would like to ask that when a participant answers the scales, can I compute a mean score from their answers and thus have a per participant score like this for each scale i.e. three scores, one for each scale per participant?
Some papers I read that employ these scales say "To analyze the motivational scales, mean scores were computed across the relevant items to form indices" or "We averaged the items in each scale and used the average scores in the data analyses." but I was not sure how to interpret them.
Comment: You do not say anything about the overall objective of your study. You have described one of three 'scales' in detail, but said nothing about the other two, how the three scales relate to each other, or how you propose to analyze your data. // Because Likert scores are ordinal, but not numerical it is unclear whether a mean of answers on several questions (say 10 as for 'Belong') is meaningful. (Is the difference btw Likert 4 and 5 as meaningful as difference btw 2 and 3?) It may be better to use the median score
Answer: Comment continued: Also, if your analysis will involve any comparison of Likert-5 data with Likert-7 data, you may need to transform Likert-7 for compatibility with Likert-5. Maybe something like $L.5 = 2(L.7 - 4)/3 + 3 = 2L.7/3 + 1/3$ might work.
Consider Likert-7 data:
L.7 = sample(1:7, 100, rep=T)
summary(L.7)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
   1.00    2.00    4.00    4.05    6.00    7.00

'Transformed' to L.5 scale:
L.5 = 2*L.7/3 + 1/3
summary(L.5)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  1.000   1.667   3.000   3.033   4.333   5.000

Note: There is more than one way to do this. You can google something like 'transform Likert 7 to Likert 5' to see links with lots of approaches and lots of ads.


WPF Attached DependencyProperty -- how are local values resolved?

Question: With respect to DependencyProperty which are not attached, it is my understanding -- and pls correct me if I am wrong as I am a beginner -- that the procees of resolution of local value is based on figuring out first, per a given DependencyProperty in question, what is the key of that DependencyProperty.  The key is a hash code, or some unique value, representing the type of the owner of the DependencyProperty as well as the name of the property (e.g., background).
Once this key is calculated, the value resolution process proceeds to find a mtach for that key withing a dictionary which belongs to the parent type and which contains keys of DependencyProperty (just as explained in previous sentence) and corresponding values which were set locally  with the DependencyProperty Set wrapper (e.g., SetBackground) corresponding to the DependencyProperty in question.  If the key is found within the dictionary, then the local value is considered resolved and the value dound in the dictionary is the value we look for.
However, if the Set wrapper was not used before per the owner control such that the dictionary mentioned in previous paragraph (DependencyProperty keys and values) does not contain the key we seek to find, then the value resolution process proceeds to move up in the logical hierarchy to next parent control and apply the same resolution process with respect to the parent control.  That is, a key composed of the parent type and the same name of the property is sought in the key/values dictionary belonging to the parent control.  If it's found this time, then resolution is complete; otherwise, the local value resolution proceeds to the next control in the logical hierarchy, and the process repeats on itself, until the DependencyProperty's value is resolved.  If no value is found, a different way of determination is employed that is not dependent on setting the value locally.
This is more or less the process for DependencyProperty which is not attached. I was wondering if anyone could tell me what is the value resolution process (of local value) per such property.  I assume that the key value dictionary is one which resides in an external control (i.e., not the control in which the DependencyProperty resides), correct ?  This might be the dictionary into which values are stored(using the Set[Proeprtyname]) with respect to DependencyProperty whose parent is that external control (which must be static).
Much appreciation if anyone can shed some more light about the Attached DependencyProperty.
Answer: Attached properties do not cascade. That is, if you don't explicitly set the value on the control, then it defaults to the DefaultValue defined in the property definition.


Why is it more common to move the extruder on the Z-axis than the print bed, in consumer FDM printers?

Question: Why is it more common for consumer level FDM printers to move the extruder on the Z-axis (For example, the Ender 3) while the bed remains at a fixed height, than to have a bed that moves up and down on the Z-axis?
Comment: if the nozzle is crooked it's no big deal. if the bed is crooked, it's a very big deal.
Answer: The reason is economics, building cheap printers for the masses requires the use of as less material as possible; this keeps the price down.
A bed that moves up and down requires a sturdy construction and usually more and more expensive materials.
If you look at the Prusa i3 style printer, the bed moves in Y direction while the X-Z is a single plane perpendicular to the Y-axis. This allowed printer designs to have a single upright frame made from acrylic (not the best solution, but cheap) or steel plate (expensive due to the cutout and waste material) or aluminum profiles (value for money solution). If you need the bed to go up and down, you need to constrain the X-Y plane high above the build plate (e.g. Ultimaker printers, Hypercube, etc.); this requires a stiff frame and hence more material.

Do note that e.g. the Voron 2.4 although a boxed up printer, has a fixed bed and a moving X-Y plane. This requires even more materials and is even more expensive.
Comment: Building the printer upside down avoids a big part of this constraint. See for example the [Positron V3](https://github.com/KRALYN/PositronV3).
Comment: @R..GitHubSTOPHELPINGICE As seller of such a concept I would be concerned on supporting my community with prints not sticking to the build plate... ;-)  (Thanks for the reference though!) Furthermore this concept uses linear rails which are very expensive compared to aluminum profiles, plate steel or acrylic, especially the quality ones.
Comment: FWIW I think the back-and-forth motion of a bed slinger is probably more of a problem for adhesion than gravity.


Show a hidden panel

Question: Vegas newbie here. I started working on Vegas Pro 14 and I somehow hid one panel.  I don't know it's name, so I can't even Google it. It is the red one on the left side of timeline tracks.) How can I turn that panel back on?
Comment: alt D, D or View > Window Layouts > Default Layout
Answer: If you open the Help and navigate to The Vegas Pro Window section, you will see a picture with all main components of the Vegas UI explained.
The area you pointing to is the Track List. It seems that it is not a separate sub-window, but a part of the timeline window. What most likely happened you moved the vertical divider all the way to the left. Try hovering the mouse at the left edge of the timeline window and see whether it will change to a double vertical line with two arrows pointing left and right. Click and drag to the right.

Show a hidden panel


Primary decomposition of power of a prime.

Question: Let $R$ be a commutative Noetherian ring with unit. Suppose $P$ is a prime ideal that is not maximal. How can we go about finding a normal (reduced) primary decomposition of the power of $P$, say a normal decomposition for $P^2$ or $P^3$?
Answer: I was just recently looking into symbolic powers and primary decompositions, and I remember looking at this script. It didn't really help me with my question, but I think that section 8 might be of perfect use to you. You might find more texts by Swanson on the topic, she has done some very nice work in that area.
Comment: I had looked up that article, but still i dont have a good feeling on how to get a primary decomposition of a power of a prime in a specific example say. But thanks.
Comment: @messi This is because there is no clever answer to your question. What Swanson does is purely theoretical and somehow at an asymptotic level.
Comment: @YACP, Yes, you are right. But I wish there was something nice and clever one could say, something very explicit.