Making tamei tahor and tahor tamei - Negaim

Question: Chazal make a big deal out the fact that the ashes of the Parah Adumah are מטהר את הטמא and מטמא את הטהור. It is considered to be the thing that made Parah Adumah inexplicable even to Shlomo Hamelech.
I was wondering why the exact same thing is not said to be happening with the laws of Negaim, tzoraas. One din of tzoraas is מחיה - a place where there is no tzoraas. Paradoxically, that healthy skin is a sign of tumah.
Also, the whole 8th perek is about the din of פורח, where the person becomes completely covered with tzoraas. There is a special gezeiras hakasuv (Vayikra 13:12-13) that this event, which seems to be the worst possible case of tzoraas, is actually tahor. [That itself is an example of a seeming self-contradiction, see Zarka's answer.]
However, the mishnah makes clear that this is only true if the person was already tamei (or at least confined). Here's the first mishnah there, but it's repeated throughout the perek:

הַפּוֹרֵחַ מִן הַטָּמֵא, טָהוֹר. חָזְרוּ בוֹ רָאשֵׁי אֵבָרִים, טָמֵא,
עַד שֶׁתִּתְמַעֵט בַּהַרְתּוֹ מִכַּגְּרִיס. מִן הַטָּהוֹר, טָמֵא.
חָזְרוּ בוֹ רָאשֵׁי אֵבָרִים, טָמֵא, עַד שֶׁתַּחֲזֹר בַּהַרְתּוֹ
לִכְמוֹת שֶׁהָיְתָה:
If a nega broke out completely upon one who was unclean, he becomes
clean. If the ends of his limbs reappeared, he becomes unclean until
the bright spot is reduced to less than the size of a split bean.
[If
it broke out completely upon him] when he was clean, he becomes
unclean. If the ends of his limbs reappeared, he remains unclean
until his bright spot resumes its former size.

So פורח makes pure the impure, and impure the pure. Do Chazal note this and if not why not?
Answer: Chazal do note this, but they put their observation into the mouth of Korach: see Yerushalmi Sanhedrin, where Korach points out a series of inconsistencies in halachah, including the paradox of whole-body tzara'at.
(Scholars argue that Chazal were troubled by the paradoxes and inconsistencies highlighted, but felt more comfortable doing so through Korach's mouth!)
Comment: Cool. He is actually complaining about the _precurser_ to my example, that פריחה works at all. I'll amend my post to mention that, but I was focused on the next step, that פריחה only works if it was tamei.


Why was Abram called the Hebrew in his time?

Question: Many people was called by a name after their forefathers such as the descendants of Canaan were called the Canaanites, the descendants of Ishmael were called Ishmaelites, then we see the Moabites, the Ammonites (Gen. 19:37-38). Why was Abram called "the Hebrew" in his time (Gen. 14:13)?
Comment: Most cases of "Hebrew" applied to the patriarchs are coming from foreigners. That is, Abram did not call himself a Hebrew, but others did. I think there is a case when they themselves did, but even then, they were communicating with outsiders, not within the group. I'll try to collect references.
Comment: Karis, there is a theory that "Hebrew" might be a "profession" more than ethnical description, not quite "mercenary", but "free for hire" or something similar: Habiru https://en.wikipedia.org/wiki/Habiru
Comment: Richard Elliot Friedman on Gn 14.13: This is an unusual use of the word "Hebrew." Elsewhere in biblical stories it is used to identify Israelites only when one is speaking among foreigners. It is not the standard term for the people, which is rather "Israelite" at first and "Jew" later. Perhaps it is used here because there are not yet any other Israelites around, and Abraham himself is the foreigner.
Comment: Thanks Daniel. Yes, I agree with you that most of the cases it was the outsiders who called them Hebrews. When Joseph ate with his brothers, the Egyptians ate with him by themselves for it is an abomination for the Egyptians to eat with the Hebrews (Gen. 43:32). Pharaoh also told the Hebrew midwives to kill the boys at birth, and later commanded all the sons born to the Hebrews shall be cast into the Nile (Exodus 1:15-22). I don't know why they were called the Hebrews. It's worth noticing that the term Israelites should not exist by the time of Abraham, for Jacob was not yet renamed to Israel.
Comment: from a linguistic (rather than hermeneutic, hence not giving this as an answer), the most likely explanation is that Hebrew comes from the root עבר "to cross" and so his identification as a Hebrew refers to his origin across the river. As this passage takes place in Mesopotamia, the most likely river would be the Euphrates. Later uses likely refer to the Jordan instead. The link between Hebrew and Habiru is linguistically problematic
Answer: Abraham is a descendant of Eber (whence we get the term Hebrew) who was a descendant of Shem (whence we get the term Semite) (Genesis 10:21). "Hebrew" therefore simply means 'Eberite,' much in the same wat that "Canaanite" means 'of Canaan.' Given that Abraham is a descendant of Eber, and not the other way around, it's not surprising that people refer to him as an Eberite.
Answer: Ivri עברי is a descendant [of] "Ever" עבר the Noachide. - Each עברי Ivri speaks the holy language of עֵבֶר Ever using knowledge from the עָבָר Past which maintains the monotheistic belief in one Elohim from נֹחַ Noach & שֵׁם Shem. | Avram is also described by his actions in [Genesis 12:6] when יּעבר Ya'Avor "[He] Crossed" out the polytheistic society of חָרָן Haran to consciously focus on only the true worship of  יְהֹוָה YHVH The God of Noach, Shem & Ever.
See [Radak - Commentary on Genesis 14:13]

העברי a member of the tribe of Ever, he and all his descendants proudly regarded Ever as their ancestor. They were the only people who still spoke Hebrew, the original language of man. Subsequent descendants, other than the line which ran through Avraham and the Israelites, changed their language to Aramaic, and were called Aramim, i.e. members of the people of Aram, in recognition of their specific language. Even Lavan, a third or fourth generation descendant of Ever, was already known as לבן הארמי, Lavan who spoke Aramaic. The tribe called עברים was Yaakov and his offspring.
Answer: I'm surprised that the fact that Abram dwelt in Hebron is not mentioned in any of the answers. I'm far from a Bible scholar so please enlighten me if there's a reason that we can't assume that the word "Hebrew"  comes from "Hebron"? https://en.wikipedia.org/wiki/Hebron#:~:text=The%20name%20%22Hebron%22%20appears%20to,sense%20may%20have%20been%20alliance.
I see that we're supposed to "refrain from responding to others'answers", but, please feel free because I'm looking for a response.
Comment: Welcome to Biblical Hermeneutics.  Please take our Tour to see what we look for in answers, and how this site works: https://hermeneutics.stackexchange.com/tour


Skipping gears when downshifting

Question: Is it bad to skip gears when downshifting manually, e.g. from 4th directly down to 2nd etc?
Answer: If your car is slowing down, and you are at a "safe" speed for 2nd gear, then its perfectly normal to skip gears.  If you're going the wrong speed and the engine RPMs aren't even close to what they need to be, the syncros might have a hard time lining everything up and you could hear a little grinding, and cause a little wear, but it still shouldn't cause any major damage if you only do it accidentally a few times.
This is most noticeable in many cars when trying to shift into 1st while the car is still moving because it's expected that you won't need 1st unless you come to a stop. This matches up with what I mentioned about matching speed/RPM.
Related posts:
Gearbox impact of skipping gears driving downwards
Is it OK to skip gears on a motorcycle?
Comment: Semi-related to the second paragraph: Is this why some cars don't let you shift into first gear while the car is moving? My 2000 Renault Laguna prevented that, but the 2006 Volvo V70 is happy to let me (of course then you have to make sure to not release the clutch pedal at the wrong moment, or I'm sure there *will* be wear on various moving parts). I found it incredibly annoying in the Renault as I couldn't "pre-shift" into first gear approaching a red light or stop sign even if I knew I wanted first gear, but had to wait until the car had stopped completely.
Comment: @MichaelKjörling, yes, the transmission has something called "synchros" that allow you to easily change gears while everything is in motion.  Like [this question](http://mechanics.stackexchange.com/q/15481/12030) shows, some cars make it very hard to shift into first while moving.  The ability to easily shift into first while in motion would add parts and complexity, so that ability is not planned for.  I guess it's possible that a transmission would make it impossible, but I'm not sure.
Comment: Except that in my case, the clutch pedal was fully in, so intuitively, there shouldn't have been more things moving when switching from 2nd to 1st gear than when switching from 1st to 2nd gear. I don't think I ever tried to actually *force* it, but it was at least distinctly more difficult shifting into 1st gear than into any other gear when the car was not at a full stop. Maybe I'll ask a full question on this later.
Comment: @MichaelKjörling, sounds like a good question.
Comment: 1st is sometimes not even synchro, and even if it is, it is hard to "spin up" to the necessary rotational speed.
Comment: Question posted: [Why couldn't I shift into 1st gear with car not stopped in my Renault, but my Volvo lets me do it?](https://mechanics.stackexchange.com/q/37734/7356) // cc @mckenzm
Answer: It's a recognized advanced driving technique and is called "Block Shifting" or "Block Changing".  Provided you are proficient in matching RPM and don't rush the 'box, it's not only fine but there are times when it's preferable.
Some more information from the Bristol arm of the Institute of Advanced Motorists
Answer: In the long run, skipping gears when downshifting WILL cause more wear on the synchronizers if you don't double clutch, especially if you are skipping to a low gear for your speed like skipping from 5th to 2nd at 50 MPH. If you do this often as a normal part of driving, your synchronizers likely won't last as long as you would like. Skipping down gears at lower speeds and RPMs isn't as much of a concern, but you will have to be the judge of what is normal use vs abuse for your vehicle and driving conditions. If in doubt, I'd err on the side of not skipping gears when downshifting or double clutching.
One way you can get an idea of how much stress you are putting on the synchronizers is to pay close attention to what the transmission feels like when you shift    it. Remember that the longer a shift takes and the harder you have to push on the shifter to get it into gear, the more wear you are causing. So if the transmission goes into gear quickly and smoothly with little force, you likely aren't causing much wear. But if it resists and feels like it's trying to block you out, that's a good indication that you are likely stressing the transmission and causing unnecessary wear.
My car's owners manual says to not skip gears and I know of at least one manufacturer who created a service bulletin specifically about customers ruining their synchronizers by skip shifting, so there is definitely a risk of causing excessive wear when skipping gears if done poorly or taken to an extreme.

Skipping gears when downshifting


Does an Oathbreaker Paladin keep or lose their Paladin powers?

Question: I would like to know what happens with the powers of paladin — Divine Sense, Lay on Hands, Divine Smite and Divine Health — when a paladin becomes an Oathbreaker.
Comment: [What happens when a Paladin falls from grace?](//rpg.stackexchange.com/q/62023)
Comment: I edited the title to make it more informative in the list of questions on the front page, but I had to slightly guess at what exactly your point of concern is. Can you look at the edit and make sure this is still asking what you are meaning to ask? Thanks!
Comment: This doesn't look like a duplicate to me. One of the things that can happen to a paladin who falls from grace is becoming an Oathbreaker paladin, but whether an Oathbreaker paladin retains their paladin class features is a separate question.
Comment: @ObliviousSage The real question in the duplicate is "Does the Paladin lose all of his/her powers, or does the loss from grace only mean they are abandoned by their deity or order?" and the accepted (and only) answer there also answers this question.
Comment: @ObliviousSage (@LegendaryDude) My hueristic on dupe-voting is to look at whether the *answers* to the other question clearly and obviously answer this question, not so much whether the *questions* are facially duplicates. But maybe I'm wrong?
Answer: RAW, they get to keep all of those powers.
As described on pg. 97 of the DMG:

The paladin replaces the features specific to his or her Sacred Oath with the Oathbreaker features.

Since abilities like Divine Smite and Lay on Hands are class features that are not specific to the Sacred Oath, the paladin will get to keep them.


Divisors on the symmetric product of an elliptic curve

Question: Assume that $C$ is an elliptic curve and $C_p$ is the $p$-fold symmetric product. Let $\beta:C_p\to C$ be defined by the addition on the elliptic curve. Let $u\in C$ be the zero in the additive group of $C$. Then $\beta^*u=:F$ is a divisor on $C_p$. I want to calculate $H^0(C_p,nF)$. The paper Symmetric products of elliptic curves and surfaces of general type with $p_g = q = 1$ by Cantanese and Ciliberto(Link) indicates that $C_p$ is a projective bundle over $C$ and its Theorem 1.17 gives an explicit answer, but I don't understand how the leading coefficient is determined. Another confusion is that it indicates that all divisors on $C_p$ are algebraically equivalent to $mD+nF$, where $D=u+C_{p-1}$, but we know that the Picard group of a projective bundle is the direct sum of the picard group of the base and the integer $\mathbb{Z}$. We have $Pic(C)=C\oplus\mathbb{Z}$. Therefore we should have $Pic(C_p)=Pic(C)\oplus \mathbb{Z}$. I think the symbol $\mathbb{Z}$ in $Pic(C)$ stands for $\mathbb{Z}F$, and the symbol $\mathbb{Z}$ in $Pic(C_p)$ stands for $\mathbb{Z}D$. Why the Picard group of $C_p$ can be generated by only two elements? If there was any misunderstanding, please indicate it to me.
Comment: "algebraically equivalent" $\neq$ "linearly equivalent". The authors claim that the Neron-Severi  group is generated by two elements, not the Picard group.
Answer: For the second part, as what Francesco Polizzi indicated, the group generated by $F$ and $D$ is not the Picard group of $C_p$. For the calculation of the cohomology, we have $$nF=n\beta^*u=\beta^*(nu).$$ Therefore $$H^0(C_p,nF)=H^0(C_p,\beta^*\mathcal{O}_C(nu))=H^0(C,\beta_*\beta^*\mathcal{O}_C(nu)).$$ By projection formula, $$\beta_*\beta^*\mathcal{O}_C(nu)=\beta_*\mathcal{O}_{C_p}\otimes\mathcal{O}_C(nu).$$ We are left to show that $$\beta_*\mathcal{O}_{C_p}=\mathcal{O}_{C}.$$ As indicated by the paper I mentioned in the question, $C_p$ is in the form $\mathbb{P}(E)$ for some vector bundle $E$ on $C$. For any affine open subset $U\cong\mathrm{Spec}(A)\subset C$, $$\beta_*\mathcal{O}_{C_p}(U)\cong\mathcal{O}_{\mathbb{P}(E)}\bigl(\operatorname{Proj}\operatorname{Sym}E(U)\bigr)\cong E^0(U)=\mathcal{O}_C(U).$$


do meteroid impacts occur evenly across the entire moon surface?

Question: Since the moon is tidally locked and has the same face showing to the earth, I would expect that the earth's shadow represents an area on the moon that would be spared some meteoroid impacts. Does the side of the moon opposite the earth have more craters than the side facing us?
Comment: Take a look at the many repositories of images of the "dark side" of the moon.   Ignore the ones showing the secret Nazi war base.
Answer: To directly answer your question: Yes, the far side of the moon (common term for the side not facing Earth) does have significantly more craters, so long as your minimum crater diameter you're counting is several tens of kilometers or miles, or smaller (approximate enough that metric/imperial doesn't matter much here).
However: That answer doesn't really get to answering the bulk of your question.  Crater spatial density (number of craters per unit area) is a proxy for surface age, where the more craters you have, the older the surface is.  Given the many, many more craters on the lunar far side, the reason is that it is older.  The near side has been resurfaced much more recently than the far side by the large craters that were later filled in by lavas.  Those are what you see now as the lunar maria, or dark "seas."  Now, with that said, one of the fundamental assumptions of using impact craters to date surfaces is that the craters form as part of a roughly uniform distribution over long time periods and they form with a uniform spatial distribution.  So, we can't actually use the craters yet to say that there are more on the far side because it's older.
Modeling: Several different researchers have modeled all the effects of the Moon's orbit around Earth, the Earth-Moon system's orbit around the Sun, and the trajectories of objects that would hit the Moon.  I think there's a more recent one, but the most recent off the top of my head is Le Feuvre & Wieczorek (2011).  What they found is not that there should be an enhancement on the far side, but that there should be a marked enhancement on the leading side, which is the western limb (it's the side on the left as seen from Earth).
Why: Due to how the velocities all work out, the Moon is always moving forward in its path around Earth / the Sun.  It never actually back-tracks during half of its orbit against our orbit around the Sun because the orbit around the Sun is faster than its orbit around Earth.  Because of this preferential motion, it is plowing through solar system debris, and so that leading edge plowing through the solar system will accumulate more, larger craters (larger because the impact velocities will be a bit higher).
But: Many different researchers have looked for this effect in the cratering record and have not found any clear signal of it (or, for every study that finds a signal, there's another that doesn't, or, the results are in the noise).  So, while modeling is all well and good, if there are not observations to support it, there's always the question of whether the modeling is correct.
Summing Up: Based on models that factor in a lot of the different mechanics going on, they all pretty much say that the leading edge (around 270°E / 90°W) of the Moon should receive a higher impact rate than either the near or far side.  However, actual evidence of this effect is hard to come by, so  while there's no good reason to say the models are wrong, they cannot yet be confirmed.  If the models are correct, the effect is small enough that the difference between expected craters on the near vs far side is too small to be visible in the crater counts, so the far side does have more craters because it is an older surface.
Comment: Thank you so much for a great answer. But like all good answers, it prompts me to ask more. Such great answers tho should somehow be linked to Wikipedia . Come to think of it, all of stack exchange should cross refer to Wikipedia and vice versa. So the next time I ask something like 'why did lava only flow on one side of the moon' I can get a synopsis of lunar geological events
Answer: Do Lunar Maria count as craters or not?
They are low lying areas which were flooded by dark colored lava which dried, covering up previous craters.  And some of the low lying areas flooded by lave are large impact basis produced by the impacts of large asteroids.
Thus some people might count the large impact basins as giant crater, and might consider that the lava flows have covered uplarge lu numbers of craters.  And the maria are mostly on the near side of the Moon.
Since the Earth has 81 times the mass of the Moon, Earth's gravity tends to attract asteroids toward it.  If asteroids fall straight toward Earth, the far side of the Moon would intercept a small percentabe of the asteroids falling toward Earth and would have craters, and the near side shouldn't have craters.
Asteroids which pass close to Earth would have their orbits changed and then move off in varius directions.
My answer at: Is it a coincidence that on the far side of the moon almost no seas are visible?
Mentions that some asteroids passing close to the Earth might be diverted into paths leading to the Moon.
Comment: Thank you for your informative comment. I never thought of Maria as craters before.


Adding row from non-spatial table to attribute table of shapefile

Question: In QGIS, I have a shapefile containing about 200 polygons. The attribute table contains some variables. I created a excel file from the attribute table and edited some of the variables. Now I want to return the new values of the excel table to the attribute table of the shapefile. Perhaps I could use the unchanged variable "height" in order to identify each single polygon (I forgot to introduce IDs; however, there are no dublicates in "height").
Is there a practical way to update the attribute table?
Answer:
The first thing you need to do is to identify a unique attribute that matches the two tables. You seem to already have done that and identified "height" as a link between the two tables.
The next thing is to load both datasets as layers in QGIS.
Now on the target layer (the shapefile) go the the layer properties and add a join. Use the matching unique field from both tables to join them.
Now you should see the attributes from the excel layer in the attribute table of the shapefile.
Use the field calculator to copy attributes to the shapefile or do other amazing things.
Comment: thank you, that worked! I did not understand the "join"-section in the first place. However, it didn't work with a csv-file; I used the xlsx file et voilà.
Comment: It should work just the same with a csv file, maybe there is an extra space or some other invisible character included at the beginning or end of the attribute. Glad it worked though!


Common values used for hyperparameter grid search?

Question: When performing a grid search for exploring optimal hyperparameters, what are the typical values, or ranges, that are commonly used for alpha, epsilon, gamma, lambda, C, etc? I'm not focused on a particular algorithm at the moment. And I realize each problem is going to be different. But just wondering if anybody has a resource they can share that provides typical values or ranges that would be good starting points for hyperparameter tuning.
Comment: Hyperparameters of what model? Obviously you would not have the same hyperparameters for totally different models.
Comment: This question seems too broad. I think you could ask for a specific algorithm though.
Comment: Sorry for the general nature of the question. Just thought someone may know of a blog post, book, etc that had some suggestions for some beginning parameter values to use in each of a variety of different models. For example, with ridge regression maybe try alpha = [1, 0.1, 0.01, 0.001, 0.0001, 0]; with SVM try C = [0.0001, 1000, 10000, 100000]; with random forest try minimum samples per leaf = [1, 5, 10, 50, 100, 200, 500]; and so on but with all parameter options for each algorithm (and for most of the commonly used algorithms).
Answer: This is going to be very dependent on the algorithm, but I can answer for glmnet.
Glmnet is fit through a cyclical coordinate descent, we apply an update rule to each coordinate in turn and iterate until convergence.  The update rule is equation 5 in this paper.
As the authors note, this update rule implies that, if the some parameter $\beta_j$ is zero at some iteration, then it stays zero after the iteration if and only if
$$ \left| \langle x_j, y \rangle \right| < N \lambda \alpha $$
where $N$ is the number of training data points.  If we let $\tilde \lambda$ denote the minimum lambda for which all parameters are estimated as zero (the set of all such lambdas is clearly an unbounded interval including infinity), the above relation tells us that
$$ N \alpha \tilde \lambda = \max_j \left| \langle x_j, y \rangle \right| $$
that is, all parameters are estimated as zero when
$$ \lambda > \frac{1}{N \alpha} \max_j \left| \langle x_j, y \rangle \right| $$
This gives us bounds on our grid search

When $ \lambda = 0$ we get the un-regularized model.
When $ \lambda > \tilde \lambda $ all parameters are zero.

To fill in the middle, glmnet breaks up this interval into multiplicatively even subintervals, i.e., subintervals whose endpoints are equally spaced on the logarithmic scale.  My assumption is that this was done given some empirical evidence, but I'm not really sure.
Answer: Hyperparameters are often searched on a logarithmic scale. This particularly holds for regularization/penalty terms, and cases where the proper scale is unknown. Other hyperparameters can be searched on a linear scale if there's a priori reason to do this. In some sense, you can think of the search range as a 'hyperprior'.
When searching for values of multiple hyperparameters, random search may be better than grid search. The reason is that performance can be more sensitive to some hyperparameters than others, and the set of relevant hyperparameters isn't known ahead of time (it can vary with the dataset). In this case, grid search would waste iterations on adjusting hyperparameters that don't make much difference, while keeping the others fixed. Random search would adjust all hyperparameters simultaneously. Adjustments to hyperparameters that don't matter won't change anything, and adjustments to those that do will have a chance at improving performance.
See this paper:

Bergstra and Bengio (2012). Random Search for Hyper-Parameter Optimization
Answer: To give a very general answer to your very general question, I usually start out, at least, by choosing ten or so values that seem to cover the range of the parameter. If the range is [a, b] for some real a and b, the values could be evenly spaced between a and b. If the range is (0, ∞), the values could be 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1, 1e1, 1e2, 1e3, 1e4, 1e5. If the range is (∞, ∞), the values could be -1e5, -1e3, -1e-2, 1e-2, 1e3, 1e5.
Answer: Thought I'd post what I've found through additional research in case anyone else stumbles across this looking for the same info. It turns out the caret package for R has baked in standard values/distributions for performing grid and random searches.
To see what values or distributions caret is using as standard, you can view the code for each model available in caret on github:
https://github.com/topepo/caret/tree/master/models/files
When looking through the code, simply look for the "grid" function. The parameter settings within the if(search == "grid") statement would apply to grid searches. The parameter settings within the following else statement would apply to random searches.


Watching "filmon tv" channels on my TV using chromecast and my smartphone

Question: I know the android app called "filmon tv", it is great and with it I can watch UK and USA TV channels on my smartphone. I have also a chromecast device on my TV and wonder how could I watch these "filmon tv" channels on my tv since I do not see any option on the app.
Answer: If you have a Nexus 4, 5, 7, or 10, or some "Google Play edition" phones, running KitKat, then you can simply cast the whole screen of your device. In the settings app, go to Display, then click Cast screen. This can cast to any Miracast device. This might not work with the particular app you want to use: the app can tell Android that its content is "secure", which will exclude it from being recorded or cast in this way.
One of the CWM developers has an app called Mirror. This can cast the whole screen to a Chromecast device, but it's in beta, so you have to register to download it, and it only works on the Nexus 5. See his announcement on G+ for more information and to register.
Otherwise, all you can do is contact the developer and ask them to add Chromecast support to their app. This would be the best option in any case, as the app could make sure that only the movie stream is sent to the Chromecast, rather than the whole screen (including the notification tray and navigation buttons).
Answer: A Chromecast version of FilmOn is now available in the Play Store - it works perfectly!


Matching sets of 3d position data

Question: Imagine a cube filled with air and ~5000 levitating potatoes. The distance between two poatatoes are usually at least an order of magnitude larger than their volume and their distribution is pretty random but not normal. I don't know how many potatoes are in the cube nor their sizes but I have two methods for measuring it: the good but expensive reference method A, and method B which I'm developing. Both methods have given me the x-, y- and z-position of each potato that it found along with it's size. Now I'd like to correlate the two methods and answer the following questions:

How well does method B localize and estimate the size of each potato?
Which method would be appropriate to determine the overall "goodness" of method B? (these two must be standard statistical measures, I'm simply not very experienced in statistics)
Given a result using method B, how do I calculate what the result would be for method A? I'm looking for some kind of conversion formula. Primarily for averaged properties like density, but preferably on the level of each individual potato. Or if I have a histogram of potato sizes vs number of finds by method B, can I translate that to what method A would yield?

Difficulties

Method A and B doesn't find the same number of potatoes. In fact, method B finds about twice as many. The reason for this could be that these potatoes can be very irregular in shape. Whichever the reason is the comparison would have to be able to compare a possible group of potato finds in set B to one in set A.
The resolution of method A is better. That means that method B might find only one potato where method A recognises it's several smaller potatoes (the opposite to the case above). Also, method B will be more likely to over estimate the size of smaller potatoes.
(Bonus: the sets can be translated and rotated <90 degrees. We have a crude method for sorting that out before the analysis starts, but any input on how we could deal with that is appreciated. I'm thinking about solving the translation part with the center of gravity for each set.)

Do I have to start with some method to determine if several close potatoes are one or several "real" potatoes, before matching the sets? Is there a "standard" way to do all of this?
If you lack any information please ask. I might very well not realize that it's needed to solve the problem. And do edit the tags/title if it's needed because I'm not very familiar with proper terminology.
Answer: Will method B has a measurement error (variance) that is about constant over the space? For a start, lets assume that. Then, does it have a somewhat constant bias (translation) over the space? Also assuming that for a start.
So, to get a starting point. Write $B_{[i]}$ for the set of measured points (method B) assigned in some way to correspond to measured point $A_i$. Let
$\text{pos}(B_{[i]}) = \text{pos}(A_i) + \epsilon_{[i]}$ with $\epsilon$ having some distribution with mean $\mu$ and variance $\sigma^2$.  Choose some grid of values for $mu$ (a three-vector), and for each, translate the B-point accordingly, and assign them to A-points in the voronoi cell (https://en.wikipedia.org/wiki/Voronoi_diagram) surrounding it.  Then for each $\mu$, find the sum of squared distances from the A-point to its set of B-points.
This only as an idea, a point of departure.

Matching sets of 3d position data


How to Communicate with a Postdoc PI About a Significant Problem in My First Paper

Question: I am a newly graduated PhD who started my postdoctoral position a month ago. To help me adapt to the environment, my Principal Investigator (PI) asked me to write a brief paper for an invited submission to a journal in the first month. The data for this paper were not difficult to analyze, and the writing was straightforward. However, the submission deadline is urgent, requiring completion within one month.
Since I am a new employee and am not familiar with the data currently used by the group, my colleagues (two senior scientists who have been with the group for many years) selected the sample and shared the analytical data with me, with both of them being the second  and third author. I conducted the analyses and endeavored to complete the paper within a month. I then sent it to my PI, who thought it was excellent, and subsequently, the paper went out for co-author review.
However, during the review stage, one co-author contacted me, noting that the results were not consistent with some of their preliminary work from a couple of years ago (which was not published). Upon re-examination, I realized that the coding of the outcome variable in the dataset shared by my colleague was incorrect. After obtaining the correct data and re-analyzing it, our results changed substantially, indicating that the entire paper needs to be rewritten and all analyses need to be redone. It was particularly challenging for me to identify the coding issue until this week because the raw data was only shared with me recently.
To my colleagues, this does not seem to be a significant issue. They commented, "The data file has undergone numerous edits, and sometimes things get mixed up along the way." However, as this is my first project with my new PI, I am particularly anxious not to make a poor impression.
My PI is currently away at a conference and is unaware of these issues. However, I have a meeting scheduled with him next Monday. How should I communicate this situation to him? I feel very stressed, and completing a new paper before the deadline, which is this week, seems daunting.
Answer: Actually, I suggest an "all hands" meeting in which to discuss things if that is at all possible. Get everyone in the same room.
And, as for the "how to", just lay out the issue as you see it and come to some joint decision about how to proceed.
Straight forward is the best way. Mistakes happen. Most can be recovered from if directly addressed.


QDockWidgets, set nested state from UIDesigner

Question: I created a QtGui with the GuiCreator and added some DockWidgets. I can only allow the nested state from the property editor but how can I set it active for the DockWidgets?
At runtime the user can move the DockWidgets and if one DockWidget is moved over another it goes into the nested state resulting in a TabView.
Now I want to Launch the Application with the DockWidgets in nested state and closed. When the user toggles a DockWidget visible it shall be added as a Tab (nested) and on toggling off it the tab shall be removed.
I know I could use a TabWidget for this, but I want to have the option to undock the DockWidget and have it open as a single Window, so I need the DockWidgets.
Furhter the GUICreator handles all the Widgets as visible and they are shown in the creator resulting in a resize of my MainWindow and this results in strange behavior when I manually set fixed size and values.
Is it better to create those DockWidgets from within the Source Code? It seems that the GuiCreator lacks some of the features I need.
I don't like the fact that I cannot completely build a independent Gui with the creator. I always have to do resizing and adding UI-related stuff to my source code. Am I doing something wrong?
Answer: I don't think you are doing anything wrong. Those QDockWidgets are a pain to work with. (But they are really cool for the user.)


Poco: How to abort a blocking socket operation from another thread

Question: Is there a proper way in Poco to abort a blocking I/O operation from another thread?
Answer: Since the thread doing the I/O would be blocked, I don't see any direct way of going in there an cancelling it, besides being nasty and killing the thread explicitly.  This is however not advised
Comment: @AlexanderVassilev: Try Go.
Answer: Yes, you can call Socket::shutdown(). What happens after that depends on your platform, when recv() returns Poco will throw appropriate exception.
But you do not have to do blocking I/O to start with, since there is Poco::Net::Socket::setBlocking(bool) to enable or disable blocking behavior. Or, even if you want to do blocking, you can still define timeout using Poco::Net::Socket::setSendTimeout() or Poco::NetSocket::setReceiveTimeout()


Safari on iPhone "... too many redirects occurred" but ASP.NET app is not issuing any 301 redirects

Question: I have an ASP.NET "desktop friendly" site (www.company.com) and a separate "mobile friendly" site (m.company.com). Both sites have redirect rules that attempt to detect if the device is a desktop or mobile and redirect the request to the appropriate site.
There is a "View Full Site" link on the mobile site. This sets a session cookie (with the value "1") for the parent domain (.company.com) and sends the user to the desktop site. When the redirect system on the desktop site detects the cookie (which it can read because the cookie belongs to the parent domain) it skips the usual rule that redirects mobile devices to the mobile site.
This is all working fine ... except for Safari on iPhone!
For this platform only, once the link has been clicked, you don't get redirected to the desktop site and all further navigation in the mobile site results in the error "Safari cannot open the page because too many redirects occurred". If you go to the iPhone's Safari settings and click Clear Cookies normality is restored but as soon as you click the "View Full Site" link the problem reoccurs.
My first thought was that the redirect system was issuing alternating 301 redirects - i.e. creating a redirect loop. However, with a debugger attached I can see that this is not happening. There is no stream of requests and redirects issued - not a single one in fact!! It is almost as if Safari is issuing redirect instructions to itself.
This appears to be a common problem with Safari on the iPhone with dozens of reports on various user forums of it happening on many sites. Most users report that it only happens on their iPhone and not e.g. on their iPad.
As the server does not seem to be responsible for the problem I am scratching my head for what to do! My only ideas so far are to hide the "View Full Site" link for iPhones, or to experiment with a non-cookie based redirect-bypass.
Can anyone explain the cause and/or a solution?
Answer: You should look into .htaccess file.
I've had a simple redirect write in .htaccess that was preventing to be loaded on Safari. As such:
<code>RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</code>
Although, this is not a fix, it's a patch.


Transformations on a game board represented as a bitset

Question: I'm using a long as a bitset to represent a game board. If a field is set (X) the corresponding bit is set, if it's empty (-), it's not. The fields are numbered from left to right starting from 0.
For example, the following board
0 1 2       X - X
3 4 5       - X -
6 7 8       X - X

becomes 1 * 2^0 + 1 * 2^2 + 1 * 2^4 + 1 * 2^6 + 1 * 2^8 = 341.
This has the limitation that it can only support boards with < 64 fields (which is fine).
The following are some methods to transform the board, i.e. mirror it horizontally, vertically and along each diagonal, as well as rotate it clockwise by 180, 90 and 270 degrees (the latter two only make sense for quadratic boards; I omitted the code to check for this here).
int h;    // height of the board
int w;    // width of the board
long val; // binary representation

// The field at (x, y) is the nth bit with n = y * width + x.

// mirror the board vertically along its centre
void fliplr() {
  for (int j = 0; j < h; j++) {
    for (int i = 0; i < w / 2; i++) {
      swap(i, j, w - 1 - i, j);
    }
  }
}

// mirror the board horizontally along its centre
void flipud() {
  for (int j = 0; j < h / 2; j++) {
    swapRow(j, h - 1 - j);
  }
}

// mirror the board along its first diagonal (top left to bottom right)
void flipd1() {
  for (int i = 1; i < h; i++) {
    for (int j = 0; j < i; j++) {
      swap(i, j, j, i);
    }
  }
}

// mirror the board along its second diagonal (top right to bottom left)
void flipd2() {
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w - 1 - i; j++) {
      swap(i, j, h - 1 - j, w - 1 - i);
    }
  }
}

void rotate180() {
  flipud();
  fliplr();
}

void rotate270() {
  long tmp = 0;
  for (int j = 0; j < h; j++) {
    for (int i = 0; i < w; i++) {
      tmp = set(tmp, w - i - 1, j, get(i, j));
    }
  }
  val = tmp;
}

void rotate90() {
  long tmp = 0;
  for (int j = 0; j < h; j++) {
    for (int i = 0; i < w; i++) {
      tmp = set(tmp, i, h - j - 1, get(i, j));
    }
  }
  val = tmp;
}

long set(long val, int y, int x, long newVal) {
  long mask = 1L << (y * w + x);
  return (val & ~mask) | ((newVal << (y * w + x)) & mask);
}

void swap(int x1, int y1, int x2, int y2) {
  swap(y1 * w + x1, y2 * w + x2);
}

// swap n bits starting from position b1 with n bits from b2
void swap(int b1, int b2, int n) {
  long xor = ((val >> p1) ^ (val >> p2)) & ((1L << n) - 1);
  val ^= ((xor << b1) | (xor << b2));
}

void swapRow(int r1, int r2) {
  swap(r1 * w, r2 * w, w);
}

My questions:

Is there a more efficient way to perform the rotations? I believe
rotation by 180 degrees should be possible in a single pass and 90
and 270 without the need of a new variable but I couldn't figure it
out yet.
Is there a better way to perform swapping and setting of bits?

EDIT, 2021-09-24: changed flipud to swap entire rows at once (instead of individual bits).
Answer: The questions / replacement algorithms

Is there a more efficient way to perform the rotations?

All the major rotate/flip/transpose operations on bitboards can be implemented efficiently as seen on chessprogramming.org. The way all of them work is by moving/swapping groups of bits at once, never single bits (which is really a waste of using bitboards: the point of bitboards is that they enable replacing slow bit-by-bit algorithm with the efficient multiple-bits-at-once algorithms). The code from chessprogramming.org is specialized for 8x8 boards, but could be used (with minor modifications) for any board to fits in an 8x8 square, though that requires a different representation than you are currently using (namely padding rows to 8 bits instead of a tight packing). Supporting any dimensions with 64 or fewer cells would be more difficult, but it shouldn't be impossible, at the cost of implementing a handful of special cases..

I believe rotation by 180 degrees should be possible in a single pass and 90 and 270 without the need of a new variable but I couldn't figure it out yet.

I feel like it should be possible, but I don't think that makes sense as a metric. Especially not the number of variables, local variables are practically free. But "passes" are also a metric that doesn't really fit bitboards. The efficient algorithms don't really have "passes" at all, and even for the bit-by-bit algorithms it doesn't set apart the good from the bad: for every rotation/flip/permutation and a given w and h there is an implementation that is just a single expression built up as a big bitwise-OR of w*h terms of "extract one bit from the board and shift it to its target position". For most board sizes, that's much worse than doing a handful of delta-swaps (a generalization of your swap function), but it satisfies the "single pass" and even "no new variable" criteria.

Is there a better way to perform swapping and setting of bits?

Not really, but they form an inherent bottleneck: they take wide 64-bit integer operations and force them to work on one or two bits at the time. Your swap function generalizes to swapNBits or a delta swap (depending on how it is generalized) which use a really similar sequence of operations but can perform a lot more work with it (this is how the efficient rotate/flip algorithms get their efficiency).
The code
One thing that really jumps out at me is that the swap-based methods repeatedly modify a field of the instance of the board they're working with, rather than computing a value and then storing it. That makes the object transition through a succession of intermediate states during the most of the process, which is sometimes unavoiable, but when it is easily avoidable I think it should be avoided. Additionally, in my experience it's often more efficient (or at least not slower) to implement this kind of code in the "compute a value and then store it"-way.
Comment: This is already very helpful, thank you. I updated flipud to swap entire rows in one operation and I think I can improve on the other parts too.


select similar rows in excel 2011

Question: i have a spreadsheet in excel that has about 1500 rows and about 8 columns.  One of the columns is headed by 'orderable.'  Every cell in this column has either a value '1' or nothing at all.  I would like to select each row that has no value and delete the entire rows.  There are blank values elsewhere, if that makes a difference.
Answer: Select the entire column, use the Sort tool under the data section to sort by 0? Then they would at least be all touching. Would make it easier. I'm not aware of a way to delete a row based on a value in a column.
Comment: that works well for this...i was searching on it and it seems to need some form of SQL for a more specific selection
Comment: it is 'sort by value' for this instance, since '1' and null are being sorted, if anyone is curious.
Answer: An alternative would be to filter the data for the blank items, you can then delete all the rows which are filtered.
Answer: Select the 'orderable' column. Type ƒ5 (or select Go To…). Choose Special…. Select 'Blanks'. At this point, all blank cells in your original selection should selected.
Right-click on one of the selected cells and click Delete. The resulting dialogue should offer 'Entire Row'. Select it and click OK. All the rows that are part of your selection will be deleted.
Note that if your range were smaller, you could just use CTRL-click to select a cell in each row that you want to delete.
Answer: Old thread I know, but I think the original question is about deleting entire rows when on column in the row is blank and doing this "en-mass".
For Excel 2011:

Select an entire column (or row),
Under the "Edit" menu, select "Go To"
Select "special" in the dialog that pops up
Choose the "Blanks" radio button and click "Ok"
Now go back to the "Edit" menu and choose "Delete"
In the dialog box you should have the option for "Entire row"

Enjoy!

select similar rows in excel 2011


Citing the preface of a book written by a different author in ASA

Question: As the title says, I'm trying to cite the preface of a book. The book is a new edition, and the preface was written by a different author. How do I cite that in ASA style? The closest I can think of is treating it as a book chapter, but that's also not quite right because the original author would be titled as the editor... Thanks!
Answer: I'm not 100% sure if there is a better "more correct" way to do this in ASA, but I would think you should cite it as a chapter with the appropriate author i.e., the one who wrote the section. This is how it is normally done in my field - often each chapter of a textbook has different authors.


Add a symbol before every single category inside a list display categories widget - Wordpress - WP_Widget_Categories

Question: I want to add a symbol (the Hash symbol - #) before every category displayed inside the list display categoris widget in wordpress.
I am not adding the WP_Widget_Categories code to the post question because it is the very basic one that anyone will find with wordpress.
Anyway I am trying to make something like this:
Example
That's all. I started to study php from a few days and I don't know how to do this, any help will be really appriciated.
Answer: You can use a filter to modify the results generated by the default categories widget. Try adding this in your functions file:
function modify_widget_categories_listing( $content ) {
    return "#$content";
}
add_filter( 'list_cats', 'modify_widget_categories_listing', 10, 2 );

You may have to make some changes to what is being returned to get exactly what you're looking for, but that's the gist of it.
Answer: Put this in your functions.php
function show_categories_with_hash() {
    $terms = get_terms( 'categories' );
    echo '
';
    foreach ( $terms as $term ) {
        $term_link = get_term_link( $term );
        if ( is_wp_error( $term_link ) ) {
            continue;
        }
        echo '
#' . $term->name . '
';
    }
    echo '
';
}


Surface Area of a Horn Torus

Question: I have seen similar questions be asked but I'm uncertain if the same principles work for a horn torus. The question I have to ask has to do with Part (iii) of the following question. For Part (i) I stated that the expression is valid for $0 ≤ \theta ≤ 2\pi$ (since I don't think you could create the full circle otherwise, I think the range of θ has to be $2\pi$ long).
For Part (ii) I rearranged the equation to get the equation of a circle with centre (0, 0.5) and radius of 0.5.
For Part (iii), I said that the surface area A, of the torus produced is:
     $$A = \int_{0}^{ 2\pi}2\pi y*ds$$
I believe that is what my teacher was saying in his lecture notes but I am unsure if this integral calculates the surface area of the torus or the cross-sectional area of the original circle. I think that it is the former.
Through my working out, I end up with this surface area and this volume. I thought the volume could be calculated by integrating the surface area with respect to the radius of rotation $R$ (I'm sure a similar principle is applied when finding the volume of a sphere from the surface area of said sphere, or the area of a circle from the perimeter of said circle).
My only doubt is that I have seen equations that state the surface area of the torus as being equal to $(2\pi r)(2\pi R)$, and in the question both R and r should be equal to each other, where $r = 0.5$, which would make my answer for the surface area incorrect. I am unsure where I have gone wrong or if there is something I am not properly understanding.
Any help would be much appreciated.
Answer: Draw a figure, and you will see that the interval $0\leq\theta\leq\pi$ produces the full circle $x^1+\bigl(y-{1\over2}\bigl)^2={1\over4}$. Apart from that $\theta$-values with $-\pi<\theta<0$ are not acceptable, as they would lead to $r<0$.
From $r(\theta)=\sin\theta$ it follows that
$$x(\theta)=\sin\theta\cos\theta, \qquad y(\theta)=\sin^2\theta\ ,$$
which then leads to $x'^2(\theta)+y'^2(\theta)\equiv1$, hence $ds=d\theta$. Your formula for the area element is correct in the present situation. We therefore obtain
$${\rm area}(S)=\int_0^\pi 2\pi y(\theta)\>d\theta=2\pi\cdot{\pi\over2}=\pi^2\ .$$

Surface Area of a Horn Torus


Sponsors business cards are being given to me instead of high res files

Question: I Need Avdice ASAP Please!
I'm designing a 2.5 x 6 ft banner for a benefit concert. The people hosting the concert who have asked me to make the banner, has given me business cards of the 20 sponsors instead of the high res files I requested. I was told the previous graphic designer had always just requested all of the business cards and was able to scan them in and add them. I find that questionable. If I scan the business cards in at 600 dpi, would that image look professional on a banner of that size, or is it like I think, and I would have to remake each logo?
Comment: http://www.brandsoftheworld.com <-- Grab logos for major companies in many instances.
Answer: I would email the client requesting a logo for each company. It would be a good idea to make a logo requirement sheet for the companies to follow so they send a high enough resolution logo or send a vector version of the logo.
Make sure to tell them that if you do not receive a high-resolution logo then the images will be pixelated when enlarged.

would that image look professional on a banner of that size

It depends on how far the viewer is from the banner. It also would not look that great if the business cards all had different backgrounds.
When I need a company logo for an event and I am short on time I have reversed image search of the companies logo to see if they have a higher resolution logo on the web. You could also search for "(company name) logo PDF" and see if they have a vector version in a PDF.


An approach to evaluating a Cauchy principal value that yields unexpected extra imaginary term

Question: $\newcommand{\PV}{\operatorname{PV}}$
I have been working on evaluating the first negative moment of a random variable with a piecewise density function by means of the Cauchy principal value, i.e.
\begin{equation}
\tag{1}
PV\!E(X^{-1})=\PV\int_{-\infty}^\infty\frac{f_X(x)}{x}\,\mathrm dx = \lim_{\epsilon\to0}\left(\int_{-\infty}^{-\epsilon}+\int_\epsilon^\infty \right)\frac{f_X(x)}{x}\,\mathrm dx,
\end{equation}
where $f_X$ is a probability density function. I was unable to get any traction using the definition in $(1)$ but was able to evaluate the moments of $X$ greater than one which yielded
\begin{equation}
\begin{aligned}
E(X^{\epsilon-1})
&=\int_{-\infty}^0 x^{\epsilon-1}f_X(x)\,\mathrm dx%
+\int_0^\infty x^{\epsilon-1}f_X(x)\,\mathrm dx,\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
&=\int_0^\infty x^{\epsilon-1}f_X(x)\,\mathrm{d}x%
-e^{\mathrm i\pi\epsilon}\int_{-\infty}^0 |x|^{\epsilon-1}f_X(x)\,\mathrm dx,\\
&\propto\Gamma(\epsilon)\left(h_1(\epsilon)-e^{i\pi\epsilon}h_2(\epsilon)\right):=\Gamma(\epsilon)D(\epsilon).
\end{aligned}
\end{equation}
I then tried taking the limit of the moments as $\epsilon\to0$. As $\epsilon\to0$, $D(\epsilon)\to0$ while the gamma term blows up. However, by writing the limit as
\begin{equation}
\lim_{\epsilon\to0}E(X^{\epsilon-1})\propto\Gamma(\epsilon+1)D(\epsilon)/\epsilon,
\end{equation}
we see that it is $0/0$ indeterminant.  Using L'Hopitals rule and evaluating the limit I got something of the form
\begin{equation}
\lim_{\epsilon\to0}E(X^{\epsilon-1})= L-f_X(0)\pi\mathrm i.
\end{equation}
Numerical evaluation revealed that $L=PV\!E(X^{-1})$; thus, what I have found is
\begin{equation}
\tag{2}
\lim_{\epsilon\to0}E(X^{\epsilon-1})= PV\!E(X^{-1})-f_X(0)\pi\mathrm i.
\end{equation}
I was able to come up with a proof of the result in $(2)$ by means of contour integration but was wondering if there other ways of getting to this result. So with that said, what is going on here? Why does adding the extra power to $t$ result in a residual imaginary term?
Comment: A specialization of this type of problem is Frullani's Theorem.  A good series of proofs and expansions are in: https://math.stackexchange.com/questions/61828
Comment: I found this to be more helpful (versus the AMS): https://www.jstor.org/stable/2306584  but it's a little hidden behind the jstor paywall; only freely readable online.  It expands Frullani's without "Assume that there exists an inaccessible cardinal. Then there
is a model of ZFC in which every set of reals definable from a countable sequence
of ordinals is Lebesgue measurable." :)
Comment: I may have missed a point, but why are you not saying the pdf of the difference is symmetric about $0$, i.e. $f_X(x)=f_X(-x)$ and so (1) evaluates to $0$? Do the independent gamma random variables have the same distribution?
Comment: @Henry that is because the pdf is in general not symmetric since it is the pdf of the difference of two independent gamma RVs which can have different shape and rate parameters.  It is only symmetric if the shape and rate parameters are equal in which case you are right that the PV would evaluate to $0$.
Comment: @rrogers nice find! This is helpful.
Answer:
What is going on here? Why does the time in which I add the extra power to $t$ matter?

In the first case, for $t < 0$ you multiply the integrand with $e^{i\pi\varepsilon}\cdot \lvert t\rvert^{\varepsilon}$, and in the second case you multiply it just with $\lvert t\rvert^{\varepsilon}$. When we're looking only at the part of the integral for $t < 0$, it is clear by the properties of $f_X$ that
$$I(\varepsilon) := \int_{-\infty}^0 \lvert t\rvert^{\varepsilon}\cdot \frac{f_X(t)}{t}\,dt$$
tends to $-\infty$ as $\varepsilon \searrow 0$. What is not immediately obvious is that the decrease of $I(\varepsilon)$ is essentially proportional to $\varepsilon^{-1}$, and that causes the appearance of the purely imaginary term, since
$$e^{i\pi\varepsilon} = \cos (\pi\varepsilon) + i\sin (\pi\varepsilon) = 1 + i\pi\varepsilon + O(\varepsilon^2)\,.$$
The real part, $\cos (\pi \varepsilon) I(\varepsilon) = I(\varepsilon) + O\bigl(\varepsilon^2 I(\varepsilon)\bigr) = I(\varepsilon) + O(\varepsilon)$, combines with the corresponding integral over $t > 0$ to yield the Cauchy principal value of the integral, and the imaginary part $\sin (\pi\varepsilon)I(\varepsilon)$ produces the $-f_X(0)\pi$.
To see this, split the integral some more. Since $f_X$ is integrable we have
$$\lim_{\varepsilon \to 0} \int_{-\infty}^{-1} \lvert t\rvert^{\varepsilon} \frac{f_X(t)}{t}\,dt = \int_{-\infty}^{-1} \frac{f_X(t)}{t}\,dt$$
by the dominated convergence theorem. We can write the integral from $-1$ to $0$ as
$$\int_{-1}^0 \lvert t\rvert^{\varepsilon} \frac{f_X(t)}{t}\,dt = \int_{-1}^0 \lvert t\rvert^{\varepsilon} \frac{f_X(t) - f_X(0)}{t}\,dt + f_X(0)\int_{-1}^0 \frac{\lvert t\rvert^{\varepsilon}}{t}\,dt\,.$$
If $f_X$ is well-behaved at $0$, the first integral on the right is harmless. Well-behaved means that
$$\int_{-1}^0 \biggl\lvert \frac{f_X(t) - f_X(0)}{t}\biggr\rvert\,dt < +\infty$$
here. For that it is sufficient that $f_X$ is $\alpha$-Hölder continuous for some $\alpha > 0$ (for then the integrand is dominated by a multiple of $\lvert t\rvert^{\alpha - 1}$). This is the case for your $f_X$. Then, again by the dominated convergence theorem, we have
$$\lim_{\varepsilon \to 0} \int_{-1}^0 \lvert t\rvert^{\varepsilon} \frac{f_X(t) - f_X(0)}{t}\,dt = \int_{-1}^0 \frac{f_X(t) - f_X(0)}{t}\,dt\,.$$
And finally we have
$$\int_{-1}^0 \frac{\lvert t\rvert^{\varepsilon}}{t}\,dt = -\int_0^1 u^{\varepsilon - 1}\,du = -\frac{1}{\varepsilon}\,.$$
The analogous splitting of the integral for positive $t$ also produces two parts that tend to a finite limit as $\varepsilon \searrow 0$, plus
$$f_X(0) \int_0^1 t^{\varepsilon - 1}\,dt = \frac{f_X(0)}{\varepsilon}\,.$$
We therefore have
$$\lim_{\varepsilon \searrow 0} \int_{-\infty}^{+\infty} t^{\varepsilon}\frac{f_X(t)}{t}\,dt = \operatorname{PV} \int_{-\infty}^{\infty} \frac{f_X(t)}{t}\,dt + \lim_{\varepsilon \searrow 0}\: f_X(0) \underbrace{\frac{1 - e^{i\pi\varepsilon}}{\varepsilon}}_{\to -\pi i}$$
with
$$\operatorname{PV} \int_{-\infty}^{\infty} \frac{f_X(t)}{t}\,dt = \int_{-1}^1 \frac{f_X(t) - f_X(0)}{t}\,dt + \int_{\lvert t\rvert > 1} \frac{f_X(t)}{t}\,dt\,.$$


How to get code completion in emacs?

Question: I know that emacs supports code completion. But to be honest I have never been a good FAQ reader, at least for something that I'm completely new to.
So I wonder what I need to download and how to make so emacs can do some smart code completion for me in C++, and Java. Or is there any package which does code completion for many of major languages?
Answer: The basic way that will work across any sort of buffer in emacs is dynamic abbreviation used by hitting M-/ (aka alt+/)
That will expand text to duplicate other strings already existing in your current buffer or in other buffers currently open.
For more extensive code completion that is language specific for C++ or Java (or others), you'll want to look at a code templating or snippet package. There are some discussed in this related question on StackOverflow. One that is commonly mentioned in these discussions is yasnippet -- there's a screencast demo in this post on an emacs blog.
Comment: +1. You might also want to give standard library `complete.el` a try. It is very old and little known, but the kind of in-buffer completion it provides can be useful. `M-x find-library complete`, then read the Commentary in the file.
Answer: @Doug's answer is a little out of date and his focus is on code expansion by using pre-defined snippets.
I think the OP's question is about intellisense (auto complete method name of a class, for example).

hippie expand used to be popular, the syntax analyzer is emacs tags. So it supports all languages ctags supports (including C++,Java). But the result is not perfect because ctags only uses regular expression to analyzed the code. See my init-hippie-expand.el for details. You could start by checking the value of hippie-expand-try-functions-list
auto-complete is a modern one with fancy UI (dropdown menu, even in console window). If you use clang as a backend. The intellisense is much better. To get the clang working, you need install auto-complete-clang which is the plugin of auto-complete. It only supports the language clang supports (C/C++/Obj-C). As Sylvain Benner pointed out, you can use emacs-eclim as the java parsing back end which actually calls the executable of eclipse. So auto-complete can support java. See my init-auto-complete.el for details.
semantic provides both the UI and the back end parsing engine. It's slow. The dropdown UI is OK but require X window. The intellisense result is better than ctags. And the documenation is too geeky for me. See init-semantic.el for details.
company-mode is similar to auto-complete, the difference is it packages everything into one bundle. For example, C++ developers only need install company-mode (auto-complete need some 3rd party plugin). Another UI difference is the company will show the candidate automatically. So you press less keys in company. It's possible to do the same thing in auto-complete after customization.

In summary, auto-complete, company are most popular two choice. Semantic and hippie-expand are also welcomed but less used. Others are too trivial to mention and their features are already covered by the big four. For example, auto-complete could use yasnippet as input source (auto-complete provide the UI, but the actual candidates are produced by yasnippet back end).
I suggest using either auto-complete or company as major code completion plugin and either semantic or hippie-expand as complementary plugin.
I use company-mode and hippie-expand because,

Now (year 2017) company-mode is more actively maintained than auto-complete and has more 3rd party plugins (for example, latex plugin)
hippie-expand is not very active but it does not occupy TAB key which company-mode/semantic/auto-complete is using

If you use company-mode for C++/Java, you may want to modify company-backends.
A few more tips on company-mode,
You may need tweak the value of company-backends. For example, suppose its value is (company-eclim company-semantic company-clang (company-dabbrev-code company-gtags company-etags company-keywords)). Then if company-eclim can get non-zero candidates, company thinks you are writing java, so it will NOT run backends after company-eclim.
Now let's look (company-dabbrev-code company-gtags company-etags company-keywords). All these four backends will be used together. For example, even after company-dabbrev-code have fetched non-zero candidates successfully, the other three backends are still executed.
In real world, it's often necessary to re-adjust the order of backends or add new backend (company-rtags, for example).
Comment: which is the best auto-completion package in Emacs 24 for latex?
Comment: @doctorate I think you need use auto-complete and its source http://www.emacswiki.org/emacs/AutoCompleteSources, but I'm a programmer instead of latex user, so you'd better double check at Google plus Emacs community, lots of academic guys there.
Comment: please note note company-mode also supports latex. So I suggest company instead of auto-complete
Answer: Short answer: I know none for emacs that is useful for java. Dynamic expand does not care for the libraries in your class path, it does not know anything about the code you're typing it can only expand to text that already exists in one of the buffers.
JDE and emacs-eclim try to provide this functionality but personally I was not impressed.
Answer: Short answer: M-/
Long answer: RTFM :-)
Comment: +1, god i hope the next question i see is "need help using RTFM command"
Comment: How about `C-h k M-/` ?
Comment: @rownage: oh, thats ``info-emacs-manual'` (`C-h r`)

How to get code completion in emacs?


What is the disadvantage of using spoofing protected version of ARP protocol

Question: I read this article about man-in-the-middle arp poisoning  and how it works , it seems that arp poisoning programs exploits the fact that ARP protocols trusts any packet  to be true and modify its table based on it .
Question is : why the ARP modified versions hasn't been used on large scale yet ? (or has it ?) i saw many papers at IEEE describing what they called "enhanced versions " of ARP (couldn't read it cause it needs log in ) that suppose to be immune to "man-in the-middle-attacks" and arp poisoning in general .  are there disadvantage for any of the mechanisms used to verify arp replay packets ?  in other words is the simplicity of ARP essential that cant be changed?
Comment: May be people like to use legacy systems until they become completely useless.
Comment: I think there is a much broader question here.There are several other protocols out there that are known to be vulnerable but as long as they are giving us the functionality we are satisfied.
Comment: @MayankSharma
i doubt "like " has a place here , personal preference and resistance for change might be a good explanation for normal users why don't they  change for  more secured versions\products  if existed  , but what about companies ?
they cant risk their business for that . however about "why we use protocols that might be vulnerable , well i think (speaking from business point of view ) its about feasibility . sometime the cost of implementing a solution exceeds the expected benefits .
Comment: I personally know a few organizations that are still using windows XP pro(support to end soon) or windows server 2003. in the industry you will find many such legacy systems that are using older software and protocol.the biggest example I think would be the adoption of ipv6 not going as expected.though it has advanced security features and solves the problem of address space saturation, organizations are not very active because their older systems are still doing the job.
Comment: Replacing a protocol like arp is going to be a very big task.i think you would like to have a look at dynamic arp inspection. This a mitigation technique for arp poisoning
Comment: Can you post the title of the article you were trying to read from IEEE, some others may have access and may be able to read and comment.
Answer:
Question is : why the ARP modified versions hasn't been used on large scale yet ?

What is the cost of addressing this versus the risk?  ARP is a local subnet issue. If someone is already successfully on your LAN you probably have a much bigger problem because they can still do attacks at higher layers of the communications stack. Is this where you want to spend your dollars versus other problems?
Port level authentication such as 802.1x, TLS, VPNs, and other protocols may provide adequate protection in the view of a risk assessment or you may be implementing protections at the switch/bridge. There is also likely the cost and complexity of management versus the return on investment. Then again, there may also be a marketing issues where no one has commercialized and convinced the people with the check book to spend on this, especially when things like DLP and SIEM are just so much sexier, costly, and fun.
Comment: ARP modified version is aloso good to protect form attack of lower level. For exemple, if someone gets physical access to an Ethernet port.
Answer: I know a few businesses that have implemented the 802.1x (OSI Layer 2 encryption and authentication that prevent attacks such as man and in middle attack). It takes time and money to setup it.
Switch can put each port on a separated VLAN, thus preventing man in the middle attack. Why implementing 802.1x to prevent man in the midle attacks when you can save money and time by simply using VLAN? Also, there are others security setups that are easier to setup than 802.1x.They are not as secure as 802.1x but they still provide great security.
In private and controlled environments such as banks or government offices, the IT department has the control over all devices, so they can setup such security. But if a school wants to implement this, not all devices support 802.1x. So they are better using other techniques such as VLAN to protect their students. It is pointless to try use 802.1x and if a device does not support it, fall back on the regular ARP protocol. In this case they are better using other type of security controls.


What are ways player characters could awake an ancient evil?

Question: Almost any epic level threat will do, but he/she/it should arise as a direct/indirect result of player character meddling (thereby making them responsible to destroy it). Preferable if PCs have a choice in what they awaken, but don't realize it. (think primordials, demon lords, gods, etc...) (it's only railroading in the sense that they'll probably have to fight this baddie towards the end of the campaign).
Answer: Fantasy literature and fantasy themed tv shows and movies are filled with this trope, so there are plenty of examples to draw from.

Killing one evil releases another. This is all over the place, but one fairly recent example was when Sam and Dean killed Lilith and thus broke the final seal to begin armageddon in Supernatural, I think it was season 4.
Disturbing a tomb The "graverobbing unleashes ancient curse" is a tremendously common trope, with a recent example in "The Mummy".  Depending on your campaign, they might be graverobbing purely to get money/loot and might even know it is cursed (but drammatically underestimate the power level).  That works well if you want to show the consequences of greed.  But they might be doing it for some greater good if the tomb contains...say the cure to a magical illness that the princess has been afflicted with.
Making a bargain.  Bargains with evil entities is a (literally) ancient trope.  Marlowe's Dr. Faustus provides an example of someone who makes a deal with a devil for selfish purposes and is destroyed by it.  But in more convoluted settings, the characters might think they are doing it for the greater good.  This happens more than once in Supernatural.  In The Adventures of Merlin towards the end of season 2, Merlin strikes a deal with a bound and caged dragon to free the dragon in exchange for the Dragon's help in savin Camelot.  But Later the Dragon becomes enraged and seeks to destry Camelot himself forcing Merlin and Arthur to fight against the Dragon.
Angering someone that unleashes the evil. This is a little more indirect, but if the player characters enrage a powerful wizard/cleric/etc. That wizard/cleric could deliberately summon an ancient evil to take revenge on the characters.  Of course in that case the characters might not feel directly responsible since it was the evil wizard/cleric/etc. that did the summoning on purpose, but it was still done in response to something the characters did.  This is common throughout The Adventures of Merlin where several threats have been summoned by enemies of Uther seeking revene for things Uther did in the past.
Enabling the summoner Similar to number four, the characters might do something that lets an evil wizard deliberately release a greater evil.  They might bring him a hard to find and necessary component for instance.  They could do this unwittingly, either to finish a job and get paid or because they believe that what the wizard will do is for the greater good.  In Aladadin Jafar tried and eventually succeeded for a while in getting Aladin to bring him the lamp to unleash the genie.
Comment: 3: Not to mention fae a la the mythology of Tuatha de Dannon or Dresden Files.  They are extremely crafty and precise lawyers with these deals and nothing like a powerful entity breathing down your neck.

5: Nothing like the "Poor Dead Sweety" arc of wanting to bring that lost love back to life with grave consequences
Answer: Not quite awakened, but certainly it's indirectly their fault: An old wizard hires the party to find an obscure item/book in a dangerously guarded treasure horde so he can destroy it to stop anyone else using it for evil (entirely true, with that wording!); a few clues in the horde point to the fact that said item is rather dangerous; six months later a lich starts it's reign of terror, the wizard having finally got the component he needed to complete his lich spell.
Comment: Heh, funny typo: 'horde' should have been 'hoard'. But the way some campaigns play...
Comment: Klatu Verata Niktu.  I have to give this credit for being a classic: Aladdin (in a way), Army of Darkness, and in a much less Heroic Fantasy setting Charlie's Angels or Appleseed (referring to the modern movies for both).
Comment: Heh, I think I'll actually leave that typo there; it's more amusing that way :)
I do now have visions of legions of killer chests and gold coins swarming an adventuring party...
Answer: One AD&D campaign I was party to included a small menagerie of magical sentient swords, each capable of defeating a different archdevil that is imprisoned by the power of another.  Because of the renown for the swords with a certain villainous cult, archdevil #1 was released and we had to put it down.  Because one was released, the other started to awaken so the party opted to go around and try to wake them up from their prisons and put them down before they had their morning coffee, one by one as we had (what we thought were) the right swords.
Another, less convoluted, method is that the players are on a treasure hunt and things go a little Mayan Temple / Egyptian Tomb and the way back becomes blocked and the only releasing mechanism is the complete chickenswitch that summons the Torrasque du jour to the Prime Material and puts a bee in its metaphorical bonnet.
Comment: Thanks for the advice. I might combine the two and have the sword in the temple
Answer: Accidentally
Do something innocuous - eat the wrong thing, say the wrong thing, unknowingly open pandora's box, trip over the wrong wire, press a red button, mispronounce a magic word, etc...
Intentionally
Raise a demon with every intent to kill it. Try to strike a bargain. Make a wish with side effects.
Under deception
Possessed by a demon, sent in by a doom worshipper under pretense of something else, thinking raising a force for good
Prophecy
Unalterable (ie, happened in the distant past but just now discovered) series of events leads to evil being unleashed. Ie, character was born, etc...
Corruption
Demon possession of a force for good, cause an angel to fall, etc...
Force of nature
Accidentally break gravity, start global warming/an ice age, etc...
Comment: See, I've always been a fan of tripping over cables, but that's up to anyone's judgment.
Comment: ... our bard started drunken' dancing and accidentally unplugged the graviton generator at the centre of the earth. We plugged it back in almost immediately, but it was unplugged for just long enough, to get the planet slowly but surely shifting off orbit (etc...)
Answer: so here we are in the ancient chamber, rune-encrusted walls and columns surround you and there's a large round pattern laid out in the centre with a red centre and rune surrounding it that read "idle thumbs".
I go over and look at the bit in the centre.
You see an inscription "don't press".

There are plenty of other similar ideas - from Indiana Jones picking up the gold idol, and unleashing the boulder, to John Hurt "having a quick peek" in the funny egg-shaped object, to Ash saying "Klaatu... verata... n... Necktie. Nectar. Nickel. Noodle".
(I quite like this last one, tell the players the magic words, without letting them write it down, and then ask them to remember them much later on. If they get it right, the wizard telling them can be 'absentminded' and told them the wrong phrase in the first place!)
Answer: Inspired by the "Mistborn" series by Brandon Sanderson the adventures could go on a quest to rid the world of a powerful tyrant by gathering artifacts that will help them defeat the tyrant.
The catch is...spolier alert

 the quest's instructions had been corrupted so that the assembled artifact actually unleashes a more powerful tyrant, in the case of the book series, "Ruin" whose only interest is in destroying all life. Then, the adventures have to work to truly understand the quest's instructions to defeat the life-destroying tyrant.
Answer: Tempt them with greed or lay a hubris trap. For example, a tomb that, at least culturally, should be somewhat taboo for them to touch, yet they are tempted to open it up for the riches that it contains. Too bad the purpose of the tomb of St Fred was placed on that spot to seal off the evil contained below it.
Answer: A rather simple answer, and one that is not foolproof, but just allow the players to be somewhere they shouldn't be.
Maybe an area they are exploring for an unrelated reason has a wall that crumbled due to natural (or supernatural) phenomena, behind this wall is an area that has been untouched for centuries with all sorts of nick-knacks, unpressed buttons, macguffins, strange treasures, whatever you think would be most irresistible to your players without you having to tell them to go in.
Once you've done this, with no direct hook other than opportunity, what they do to awaken the evil is entirely up to what they did of their own volition.  Not only does this work as characters but also in what they did unbidden as players.  In this situation you can have several potential triggers set up and you can choose the one that makes the most dramatic sense depending on what goes on (If you've watched Cabin in the Woods you'll have seen an example).
Even if they do absolutely nothing and refuse to even go in, you can still have the evil use the fact they are present and nearby living beings as a guide for how to get out.  It's less their fault and more "Wrong Place Wrong Time" but it gives you a nice fallback if your players prove to be beyond temptation.
Answer: Players are very willing to break into most anything without regard for what might be sealed up in there.  I see no need for anything more convoluted.  The warders of course put dire warnings but they don't say what it is because they don't want to let anyone who is seeking to free it know where it is.


Designing a home-made shooting room

Question: I am planning to build a "shooting room". I explain myself: I want to reuse a half of an old animal shelter to build a small room (3.5 square meters, 1.7-1.8m height) to store all the weapons, reloading materials (powder, cartridges), etc but also, to be able to shoot a few cartridges sporadically (measuring the FPS and that the reloading process is correct). The room should have two objectives: 1) stabilize the temperature and humidity (to preserve correctly the weapons, powder and cartridges) 2) silence the gunfires outside the room (to avoid disturbing the neighborhood, animals and people).
The first part is quite common and well known. The second part is something I am completely lost and I ask for some help now that I am planning to buy materials and I can design from scratch the whole room (walls, ceiling and floor).
Currently, it has:

10cm Concrete floor

30cm Large rock (cement between them) walls the first 0-50cm.

0.5cm thin wood boards from the end of the rock walls to the roof (50cm to 180-200cm)

4 10x10cm vertical wood beams (corners)

Roof: 0.4cm rubber (external) + 0.7cm wood boards (internal) + 2 10x10cm wood beams. The roof has a slope of around 10-15º.

I am planning to build my own walls in the inner part, that is, preserve the externals (thin wood boards) and build new walls inside them. Externally the shelter will be quite similar.
Also, I am open to build over the rock walls, or even build inside them.
So, first, I thought, what are the characteristics of a rifle gunfire?
I found that it has a peak of 140-165 dB (based on my calibers, near to 165dB) and frequencies from 16 to 2500 Hz. I don't know if that is precise or I should know more important features.
https://pubmed.ncbi.nlm.nih.gov/7761796/
https://www.scielo.br/scielo.php?script=sci_arttext&pid=S1808-86942011000200005
https://www.physicsforums.com/threads/gun-sound-frequency-analysis.898882/
Then, since there are many types of materials and the room configuration can be designed from scratch, I thought about studying it with a simulator, trying to get the best quality/budget materials for my purpose, but it is not an easy task.
I found "pyroomacoustics", and my purpose was to get 2 values: peak dB and dB/time since the shot happened, both inside the room (I don't know if "the dB will be magnified due to the room characteristics") and outside (in different positions), that is where I want the sound reduced. I am still evaluating the tool, but it seems it does not allow to use layers of materials in the same wall (what I was willing to do: e.g. half wall with brickwork+rockwool, another with rock+cement+brickwork), so, maybe I can get only an approximation. I can see this table of materials and their absorption coefficients:
https://pyroomacoustics.readthedocs.io/en/pypi-release/pyroomacoustics.materials.database.html
If I understand the table correctly, the higher the number the more absorption will have that material regarding the sound, that is, less sound will be heard on the other side of the material. Also, the interesting coefficients for my case are from 125 Hz to 2 kHz, since those are the nearest to my 16-2500 Hz.
So, concrete, ceramic tiles or painted brickwork will provide really low absorption coeffs (0.01-0.05). On the other side, 50mm of rockwool (80kg/m3) or Mineral Fibre absorber have good coeffs (0.2-0.6-0.8). But there are many materials and with a variety of coeffs/freq, and those values could not be shared by the product that can be found in my local store.
If I filter by "acoustic isolation", I can find around 30 products in a local warehouse where I can buy. Some interesting to use involve:

Brick block termobrick acoustic and thermal. They are too thick (19cm), I could try to cut in half. 0.69€/unit (https://www.bricomart.es/bloque-ladrillo-termobrick-30x19x24-cm.html)

Semi-rigid agglomerated polyurethane foam panel designed for thermal and acoustic insulation in low-thickness backgrounds. 80 kg/m3. 40 mm thickness. 6.58€/square meter. (https://www.bricomart.es/panel-poliuretano-80-kg-m3-multiaislante-200x100-cm-4cm-espesor.html)

Agglomerated polyurethane foam. Use: acoustic insulation in vertical walls. d = 80 kg/m3. Fire resistance: Euroclass F. 80 mm thickness. 12.58€/square meter. (https://www.bricomart.es/panel-poliuretano-80-kg-m3-multiaislante-200x100-cm-8cm-espesor.html)

Roll of Ultracoustic R glass fibre wool intended for thermal and acoustic insulation in vertical walls. Package of 2 rolls. Thermal resistance (R: 1.35 m2.K/w). Lambda (0.037 w/mK) kg/m3. 50 mm thickness. 1.68€/square meter (https://www.bricomart.es/rollo-lana-mineral-ultracoustic-r-1440x60-cm-5-cm-espesor-2-uds.html)

DANOFON sheet made of recycled fibre blankets and high density bituminous sheet. Indicated for acoustic insulation in low, medium and high frequencies. 275 kg/m3. 28 mm thickness. 11.50€/square meter. (https://www.bricomart.es/lamina-multicapa-danosa-danofon-600x100-cm.html)

133 rock wool covered by aluminium foil. Designed for thermal and acoustic insulation of ventilation ducts, boilers, pipes. 37 kg/m3. Thermal resistance (R: 0.81 m2.K/w). Lambda (0.037 w/mK). 30 mm thickness. 6.60€/square meter (https://www.bricomart.es/rollo-lana-de-roca-con-aluminio-133-800x100-cm-3-cm-espesor.html)

Pyramid-shaped self-adhesive polyurethane acoustic panel designed to reduce reverberant noise in machine rooms. 25 kg/m3. 43 mm thickness. (https://www.bricomart.es/panel-poliuretano-absorbente-chova-piramide-autoadhesivo-45x45-cm-4-3-cm-espesor.html)

TRIACUSTIC 35 multilayer film made up of polyethylene film attached to high-density viscoelastic film. Airborne sound and ground impact insulation. 7 mm thickness. 5.98€/square meter. (https://www.bricomart.es/lamina-multicapa-chova-triacustic-35-800x100-cm.html)

Only for roof: ROCKFON EKLA ACOUSTIC CEILING TILE 60X60X2 CM. Smooth white finished rock wool. Acoustic absorption coefficient: 1. Improves acoustic comfort. Thermal insulation R= 1,25 m²k/w. Very white. 10.64€/square meter (https://www.bricomart.es/placa-techo-acustico-rockfon-ekla-recto-a-60x60x2-cm.html)

My questions:
a) Do you know any realistic simulator I could provide my own designs with 3d objects (STL/OBJ) of the walls/roof/floor and multi-layer materials to simulate what I am looking for? I could answer many questions using those.
b) From the 9 materials exposed above, what is your recommendation for the walls and ceiling? maybe other materials? If I feel paranoic, I can buy pyramid-shaped polyurethane + rockwool for every wall. Is it too much? Or still not enough?
c) The shelter only has soil underneath it, and a thin layer of concrete/cement (eg. 5-10cm). Would you recommend that I create a wood structure with poolwood (or any other material from the list above) and then over it to use PVC paviment/gres for the floor? Or that is overkill, and with just the concrete/cement + PVC paviment/gres is enough? I am thinking about vibrations.
d) A friend recommend me to put fixed windows to avoid using only artificial light, and I thought about "glass brick" (80mm thickness; translucent: https://www.bricomart.es/bloque-vidrio-incoloro-19x19x8-cm.html) but I don't know if that would be bad against acoustic absorption (the glass has low coefficient). I was thinking just to use a couple of rows in one wall, enough to provide a bit of light inside. If it will "destroy" the whole design of the room regarding acoustic absorption, I can forget about providing small fixed windows (alternatively, I have nethacrylate). What do you think?
I attach an scheme of the current state, and the different "ideas" for the walls, floor and ceiling.
https://i.stack.imgur.com/pDWtb.jpg
The shooting wall would have a pipe (20x20cm) directly towards a huge amount of ground/soil, avoiding bouncing. The hole is not designed because it will be performed in the future, after the whole room is built. That hole/pipe will have almost the same design and materials as the room, but with walls of concrete/pure ground. The purpose is not to practice shooting/aiming, but just to measure the FPS after doing the reloading of cartridges. But I have omitted this hole for the room design. I can do it in the future.
Comment: I'm voting to close this question because it is not related to sound design
Answer: Do not attempt to soundproof the whole room, just use a drain type pipe, as heavy walled as possible, insert your arm full length into one end to shoot, your body will partially block that end, put some sandbags against theother end, both to absorb sound and to catch projectile.
You can cut two opposite windows(or maybe just one) for your FPS meter.
Cover hole with glass or acrylic since meters are optical.
Nothing will reduce shot noise to zero but may turn it from a 911 call to "oh, Mike is trying his new handgun"

Designing a home-made shooting room


Iphone tab bar icon

Question: I should probably be asking this on some art website, but in my iPhone app I am trying to make a center button on my tab like the one Daily booth has, but mine is coming out fuzzy.  Does anyone know how to make then clean and crisp? I used illustrator to create and save the icon as a png.
Comment: Are you using a iphone 4? And the png has the good resolution ?
Comment: It should work for both retina and non-retina displays mind...
Answer: Try setting the image size to 30x30 and remember to only use black and transparency. You can make this bigger for the retina display.
Also, are you saving the image as grayscale?
If you're struggling to make them yourself, why not try glyphish.com?
Answer: I really like Paint.NET on Windows for image editing, mostly because it is free.
I noticed somebody had created an Effect for Paint.NET to create tab bar icons.  I haven't tried it myself, so can't vouch for it in any way:
http://www.softpedia.com/get/Multimedia/Graphic/Graphic-Plugins/iPhone-TabbarIcon-Maker-Alpha-from-RGB-Intensity.shtml

Iphone tab bar icon


Transformation of 0 state to superposition of 0 and + state with only using single qubit gates

Question: How to transform a qubit from state $|0\rangle$ to $(|0\rangle+|+\rangle)/N$ by only using an additional qubit, a controlled Hadamard gate, a Hadamard gate and a $Y$ or $Z$ gate? Sequence of the gates may be different.
Comment: Are you allowed to make a measurement?
Answer: I believe the following will work...

How did I come up with this? I realised that the state you were after, $|0\rangle+|+\rangle$ is a +1 eigenstate of the Hadamard gate. There's a standard circuit for how you project onto the +1 eigenstate of an operator if you can implement the controlled-version of that operator. That's the first three gates in the circuit.

At that point, you'd typically measure the top qubit, and if you get the 0 answer, the bottom qubit is in the state you want.
The rest of the circuit is dedicated to saying "if we got the 1 measurement result, how would we convert it into the result we wanted?". The answer is that you'd apply Pauli $Y$.

However, if we're not allowed measurements, we do this with controlled-$Y$ controlled off the top qubit and targeting the bottom one. With the limited set of gates on offer, I used the last 4 gates of the circuit to implement controlled-$iY$. This is the same as controlled-$Y$ with an $S$ gate on the control qubit. But that $S$ doesn't make any difference to the output of the bottom qubit.
Comment: @Mauricio Look at the sequence of the last 4 gates, c-H, Z, c-H, Z. If the control qubit is 0, the c-H do nothing, hence the action on your target is ZZ=I. If the control qubit is 1, the net sequence is $ZHZH=ZX=iY$. Hence, you have controlled-$iY$.
Comment: The topmost circuit results in the top qubit being $|0\rangle + |-\rangle$ normalized and the bottom qubit being $|0\rangle + |+\rangle$ normalized with no entanglement between the two, so any measurement on the top qubit does not matter. Given the ability to use each gate more than once this functions independently of being able to pre-measure.
Comment: Just to understand, the top circuit works only if the top qubit is measured to be 0 right? There is a measurement missing.
Comment: How do you build a C-iY with those gates?
Comment: @Mauricio As another commenter said, you don't need to do any measurement for the big circuit. The whole point is to replace measurement followed by correction with a controlled-operation so that measurement is unnecessary (since it wasn't in the allowed sequence of gates).
Answer: As given, that is a rather unusual and misleading way to describe a quantum state since $|0\rangle$ and $|+\rangle$ are not orthogonal. As a consequence the coefficients of the two, when multiplied by their respective complex conjugates, won't sum to 1 and won't represent the probability of that result upon measurement in the relevant basis. However, provided $N = \frac{1}{\sqrt{2 + \sqrt{2}}}$, it can still represent an actual quantum state with norm 1, given as $\frac{\sqrt{2 + \sqrt{2}}}{2}|0\rangle + \frac{1}{\sqrt{4 + 2\sqrt{2}}}|1\rangle$ in the computational basis. It isn't possible to create this state using one of just those gates in any order. It would traditionally be created with a gate corresponding to a precisely angled rotation around the Bloch Sphere y-axis (Ry gate in Qiskit) which circles around real superpositions of the two computational basis states.
From the available gates in the problem description, this sounds more like the desire is to create the density matrix $\frac{1}{2}(|0\rangle\langle0| + |+\rangle\langle+|)$, representing an equal probability classical ensemble of the two states, when the additional qubit is traced out. But, in this case, all it would take is a Hadamard on the additional qubit followed by the additional qubit controlling a Hadamard on the main qubit, the $Y$ or $Z$ will not be necessary. Intuitively, this makes it so through entanglement that if one measures the other qubit on the computational basis and gets 0, it would be known the main qubit is the $|0\rangle$ state and if one gets 1 the main qubit is in the $|+\rangle$ state.


What's the difference between F4 or F7 flight controllers?

Question: What is the difference between the STM32F411 and the STM32F722RET6 processors in flight controllers? What are the advantages of having the F7 processor over the F4 processor?
Comment: STM32F411 and STM32F722RET6.
Comment: F4 and F7 are two different series of microprocessors from STM. In order to make fair comparisons between the two, we'd need to know what two F4 and F7 parts you're asking about.
Comment: @ifconfig I think that's actually too much information. The F4 and F7 lines have some fundamental differences which are driven by ARM Cortex characteristics. Those are more important than the RAM or processor speed.
Comment: Also the STM32F405 is much more common in flight controllers. The F411 is typically used in small footprint flight controllers only.
Answer: There are a few differences:
Firstly, the F7 chip used in F7 flight controllers operates at a much higher frequency, so can handle more operations per second.
This is useful when you want to start adding lots of dynamic filters, for example RPM filtering, alongside features such as antigravity.
Whilst an F4 can handle almost anything you will want to throw at it in this respect, it will not be able to do so forever (the F3 used to be standard but is now lacking features). Therefore, F7 is better for future proofing.
F7 flight controllers also have extra UARTs. This can be very useful if you want lots of extra features, for example SmartPort telemetry, Smart Audio, GPS and camera control. However, it is not the end of the world if you don't have as many UARTs as you want as you can use softserial to add software UARTs to your FC. Of course, this also takes up processing power so an F7 may cope better.
Finally, F7 flight controllers have built in inverters on their UART ports, while F4's do not. So an F7 FC can handle any inverted signal "as is" on any of its numerous UARTs, while F4 flight controllers have a dedicated external inverter chip on the PCB connected to one of the UARTs.
Because of that, F7's make it easier to use UARTs for SBUS or other inverted signals as it means you can hook them up anywhere without any inversion mods, while on an F4 controller you can only use the special inverted pads (of which there is usually only one, labeled "SBUS").
Answer: The short answer is that F7 is faster than F4, mainly because the F7 can execute two instructions simultaneously. At 216 MHz clockspeed, the STM32F722RE series you asked about has more than double the frequency of the STM32F411 series.
What might matter the most apart from the speed when it comes to flight controllers is UARTs; the STM32F411 has 3 of them, and they can't handle inverted signals. The STM32F722RE has 4, that can handle inverted signals
Answer: If you are asking "real world" differences on how it flies, how it feels and reacts, the short answer is none. There are no differences for typical fpv quadcopters in how they fly and react.
If you add lots of sensors or non typical setups (8 motors, wooden frame with monster vibrations,custom coded firmware) , there will be differences but for say your 2-3-4-5-6 inch FPV quadcopter without GPS or sensors running in ACRO 100% of the time, controlled by ELRS/CRSF there are no differences at all, both F4 and F7 can run equally well Beta Flight.
Maybe in future there will be the need for a more powerful processor, but 3 years are already passed from the original question and all my F411 and F405 and F722 fly exactly the same on the latest BF 4.4.
Personally i would go for F405 for long range drones (LIDAR, GPS) and INAV planes (lots of sensors) leaving F411 for AIO builds. F722 only if it is a really good deal (price difference 10$).
Also mind that F405 and F722 have more UARTS and to use them fully avoid AIO boards that do not implement all the required pads properly. A full FC/ESC stack has more and larger pads to solder and to use the full set of ports.
Answer: The shortest answer would be F4 is the Psx4, and F7 is the Psx5 :) The cpu load that you see being handled in betaflight will be handled with more or less ease, depending in the strnegth of the "cpu"...that brings the question of longevity into play also...