What if, for a body moving in a circle, the centripetal force is not equal to $mv^2/r$?

Question: For example, I don't understand why the speed of a satellite moving in an orbit of radius 'a' around the Earth must be equal to $\sqrt{GM/a}$ If I release a particle in outer space with a velocity perpendicular to the line joining the particle and Earth but magnitude not equal to $\sqrt{GM/a}$ what will happen? For al I know, the acceleration will still be perpendicular to its velocity at all instants. And, an always perpendicular acceleration is only capable of changing the direction of velocity continuously. Then, wouldn't the particle still rotate even if its speed not equal to the one given by F=$mv^2/r$?
Comment: Acceleration will only be perpendicular to the velocity only at the moment you released the particle (if the velocity is not equal to $\sqrt {GM/a} $).
Comment: Can you please explain why the acceleration won't be perpendicular at all other instants?
Comment: For a particle having a velocity $v$ , the condition for it to move in a circle of radius $r $ is the force on it should be perpendicular to it and equal to $mv^2/r $
Comment: Lets assume the velocity is $x\sqrt {GM/a} $ where x is not 1. Here the gravitational force is $GMm/a^2$ and the force required is $mv^2/a= x^2GMm/a^2$ which are not equal.
Comment: If $x>1$ then this force is not enough to curl the particle to move in a circle. Thus it will leave the circular orbit the moment you release it (not tangentially but some trajectory between the tangent and the circular path). In that trajectory the force will still be directed towards the earth, but the velocity will have a component in the line joining the particle and the earth. You can similarly reason for $x <1$. The force is more than what is required and the particle will curl more than required for a circle.
Comment: What do you think will happen if you release the particle with a velocity  of zero perpendicular to the line joining the particle and Earth?
Comment: @ChesterMiller It will simply accelerate towards the earth.
Comment: I was asking @Dove what he thought.
Answer: When you have a particle orbiting circularly around Earth, you can easily write the motion laws for two directions: radial direction and tangential direction. In tangential direction, you have uniform motion with constant speed.
In radial direction, due to the motion of the particle, in order to have a circular motion, you should have a radial (i.e., centripetal) force with modulus:
$$F=\frac{m v^2}{ R}$$
with $m$ mass of the particle, $v$ its speed and $R$ radius of the circular orbit.
In this case, this force is gravity and, from the law of Gravitational attraction, you can get:
$$ F = \frac{G mM}{ R^2} $$
with $G$ constant, $M$ mass of the Earth and $R$ distance between them.
If you put these two expressions equal, you can get the right speed for a satellite circularly orbiting the Earth.
$$ v =\sqrt{\frac{GM}{R}} $$
If you have a satellite's speed greater than the one calculated for a circular motion, you can see that in the radial direction the required centripetal force is greater than the actual Gravitational one. This means that gravity cannot keep the satellite orbiting around the Earth, you have a force term in radial direction and it will cause the satellite to go further from the Earth while it is rotating around it.
On the contrary, if the speed is less than required, you still have a force in radial direction and it will cause the satellite to fall toward Earth's surface, while orbiting around it, and the orbit will become elliptical.
Comment: Nice answer. I hope you don't mind that I inserted a few clarifications.
Comment: @BillN Thank you for your help in providing a good answer!!!
Answer: You agree that a satellite with speed $\sqrt{\frac{GM}{a}}$ will undergo a circular orbit of radius $a$.
Now suppose that you take a satellite up to that distance $a$ and give it a tangential speed greater than $\sqrt{\frac{GM}{a}}$.
The satellite will start executing a curved path of smaller curvature, larger radius, than if the speed had been $\sqrt{\frac{GM}{a}}$ because the gravitational attraction of the Earth on the satellite is not large enough for the path to be of radius $a$.
The satellite would therefore move further from the Earth gaining gravitational potential energy but at the same time losing kinetic energy i.e. moving at a slower speed.
Remember that the satellite has a mass and if no force was acting on it the satellite would travel in a straight line.
With the higher speed the gravitational attraction of the Earth cannot pull the satellite enough to make the satellite execute a circular path so it goes along a less curved, elliptical path.
What happens next depends on the speed that you give the satellite.
Below a certain value the satellite would execute an elliptical orbit about the Earth i.e. the distance between the Earth and the satellite would vary as would the speed of the satellite.
At a particular speed, the escape speed, the satellite would execute a parabolic path and escape from the Earth.
Above the escape speed the path of the satellite would be hyperbolic.
Answer:
For example, I don't understand why the speed of a satellite moving in an orbit of radius 'a' around the Earth must be equal to $\sqrt{GM/a}.$

For the satellite to orbit at radius $a$, the Earth's gravitational field must exert a centripetal force $F_c$:
$$F_c=\frac{mv^2}{a}$$
This force is the gravitational force, so:
$$F_c=G\frac{mM}{a^2}$$
So:
$$\frac{mv^2}{a}=G\frac{mM}{a^2}$$
$$\implies v=\sqrt\frac{GM}{a}\tag{1}$$

If the 'launch speed' (as you defined it) is higher, the satellite will move to a different orbit, until $(1)$ is satisfied again.

So here we assume, as per the OP, that $v_0 \neq \sqrt\frac{GM}{a}$.
The 'final orbit' $r$ is found from energy conservation (we assume gravity to be the only external force). At launch the total energy $T$ is ($v_0$ is launch velocity):
$$T=\frac{mv_0^2}{2}-\frac{GMm}{a}$$
In final orbit the total energy $T$ is:
$$T=\frac{GmM}{2r}-\frac{GmM}{r}=-\frac{GmM}{2r}$$
From the identity, $r$ can be calculated:
$$-\frac{GM}{2r}=\frac{v_0^2}{2}-\frac{GM}{a}$$
$$\frac{GM}{r}=\frac{2GM-av_0^2}{a}$$
$$\boxed{r=\frac{aGM}{2GM-av_0^2}}$$
If $v_0 > \sqrt\frac{GM}{a}$, then $r>a$, so the satellite moves to a higher orbit. It slows down because some of its kinetic energy is converted to potential energy.
If $v_0 < \sqrt\frac{GM}{a}$, then $r<a$, so the satellite moves to a higher orbit. It will speed up because some of its potential energy is converted to kinetic energy.
Comment: First, you said that if the launch speed is higher, the satellite will move to a higher orbit. But, according to the equation when v is more then a should be less. Second, if I provide the satellite an initial velocity perpendicular to the gravitational force, then what would provide the satelite the force requored to move to a higher orbit. There is no radial component of initial velocity and the only force on the satelite os towards the center. Then, how will it move to a higher orbit?
Comment: And,I'm not talking about launching the particle from earth with some initial velocity. I'm talking about taking it to some orbit of radius 'a', then providing it an initial velocity perpendicular to the radius but of magnitude not equal to $\sqrt{GM/a}$. Then, what will provide the satellite the force necessary to move to an orbit whose radi
Comment: I've edited the post slightly.
Answer: I will compare circular motion in the case of a rotating frame and with the case of the Schwarzshild metric. In this general relativistic context we can examine what is meant by the centripetal force in this context for a particle in a rotating frame and a particle in a circular orbit around a gravitating mass. We can compare the two and see what is modified by general relativity, and what is interpreted by centripetal acceleration.
The metric for a rotating coordinate system with $d\phi~\rightarrow~d\phi~+~\omega dt$ is
$$
ds^2~=~A(\omega,~r)\left(cdt~-~\frac{\omega r^2}{c^2A(\omega,~r)}d\phi\right)^2~-~dr^2~-~\frac{r^2}{A(\omega,~r)}d\phi^2~-~dz^2,
$$
$$
A(\omega,~r)~=~(1~-~\omega^2r^2/c^2)
$$
gives the Christoffel symbols
$$
\Gamma^r_{tt}~=~\omega^2 r,~\Gamma^\phi_{rr}~=~-\frac{\omega}{r},~\Gamma^\phi_{r\phi}~=~-\frac{1}{r},~\Gamma^r_{\phi\phi}~=~r.
$$
For circular motion we can set $\Gamma^\phi_{rr}~=~\Gamma^\phi_{r\phi}~=~0$. The geodesic equation of interest is of the form
$$
\frac{d^2r}{ds^2}~+~\Gamma^r_{\phi\phi}\left(\frac{d\phi}{ds}\right)^2~=~0,
$$
or equivalently
$$
\frac{d^2r}{ds^2}~+~\omega^2 r\left(\frac{dt}{ds}\right)^2~+~r\left(\frac{d\phi}{ds}\right)^2~=~0.
$$
This is similar to centripetal accleration.
To make the connection to Newtonian physics let us transform this to acceleration in the standard coordinates of an observer. We then have
$$
\frac{d^2r}{ds^2}~=~\left(\frac{d^2r}{dt^2}\right)\left(\frac{dt}{ds}\right)^2,
$$
which employs $dr/dt~=~dz/dt~=~0$ for circular motion. We use the metric with $dr~=~0$
$$
ds^2~=~A(\omega,~r)\left(cdt~-~\frac{\omega r^2}{c^2A(\omega,~r)}d\phi\right)^2~-~\frac{r^2}{A(\omega,~r)}d\phi^2,
$$
so the term $dt/ds$ is seen in
$$
\left(\frac{ds}{dt}\right)^2~=~A(\omega,~r)\left(1~-~\frac{\omega^2r^2}{A(\omega,~r)}\right)~-~\frac{\omega^2r^2}{A(\omega,~r)},
$$
so that $dt/ds$ is a form of Lorentz gamma factor
$$
\gamma(\omega)~\dot=~\frac{dt}{ds}~=~\frac{1}{\sqrt{A(\omega,~r)\left(1~-~\frac{\omega^2r^2}{A(\omega,~r)}\right)~-~\frac{\omega^2r^2}{A(\omega,~r)}}}.
$$
This then gives us a gamma factor modified form of the centripetal acceleration. Since it is evident the modified gamma factor divides out on both side this is centripetal acceleration for a particle fixed to a rotating frame.
The question is then whether this applies to gravitation.
For gravitation we turn to the Schwarzschild metric
$$
ds^2~=~(1~-~2m/r)dt^2~-~(1~-~2m/r)^{-1}dr^2~-~r^2(d\theta^2~+~sin^2\theta d\phi^2)~with~m~=~GM/c^2,
$$
where for a circular orbit we have $dr~=~d\theta=-~0$ and $\theta~=~\pi/2$ so that
$$
ds^2~=~(1~-~2m/r)dt^2~-~r^2d\phi^2.
$$
Dividing through by $dt^2$ and letting $\omega~=~d\phi/dt$ gives
$$
ds^2~=~[(1~-~2m/r)~-~r^2\omega^2]dt^2,
$$
which gives a similar gamma factor
$$
\gamma_m(\omega)~=~\frac{1}{\sqrt{1~-~2m/r~-~r^2\omega^2}}.
$$
The Christoffel symbol relevant for calculation is
$$
\Gamma^r_{tt}~=~\frac{m(r~-~2m)}{r^3},
$$
so that
$$
\frac{d^2r}{ds^2}~+~\frac{m(r~-~2m)}{r^3}\left(\frac{dt}{ds}\right)^2~=~0.
$$
It is evident that the $\gamma_m(\omega)$ divides out and this leaves the dynamical equation
$$
\frac{d^2r}{dt^2}~+~\frac{m(r~-~2m)}{r^3}~=~0.
$$
For $r~>>~2m$ this recovers Newton's second law with gravity.
It appears that in standard coordinates centripetal acceleration is the same. What is modified by general relativity is the nature of gravitation as a force interpreted in standard coordinates.
Answer:
For al I know, the acceleration will still be perpendicular to its
  velocity at all instants. And, an always perpendicular acceleration is
  only capable of changing the direction of velocity continuously.

Well, let's see.  For convenience, stipulate that at $t=0$, the particle is located at $r=R, \theta=\pi/2, \phi=0$ with velocity
$$\vec v(0)=v\;\hat{\boldsymbol{y}}$$
and acceleration
$$\vec a(0)=-\frac{GM}{R^2}\;\hat{\boldsymbol{x}}$$
The velocity at the next instant is then
$$\vec v(0 + dt)=-\frac{GM}{R^2}dt\;\hat{\boldsymbol{x}} + v\;\hat{\boldsymbol{y}}$$
while the acceleration is
$$\vec a(0 + dt)=-\frac{GM}{R^2}\left(\hat{\boldsymbol{x}} + \frac{v}{R}\,dt\;\hat{\boldsymbol{y}}\right)$$
and so the dot product of these velocity and acceleration vectors is
$$\vec v(0 + dt)\cdot \vec a(0 + dt)=-\frac{GM}{R^2}\left[-\frac{GM}{R^2}+\frac{v^2}{R}\right]dt$$
which is zero only if
$$\frac{v^2}{R}=\frac{GM}{R^2}$$
or
$$v=\sqrt{\frac{GM}{R}}$$
Thus, it isn't the case that the acceleration will still be perpendicular to the velocity at all instants for arbitrary $v$.


How to hide and show part of a notebook with a button?

Question: I need to show the user a part of a notebook only if he clicks on a button (or on a checkbox). For example, the user can proceed only if he answers a question correctly in the notebook! Hope to be clear in the answer, thanks to all.
Answer: One possible solution is to use the CellTag option to keep track of the cell you want to display. Here is the code:
createHiddenCell[buttonText_, cellText_] := Module[
  {cell, cellTag = ToString@Unique[], isHidden = True, modifyCell},
  cell = TextCell[cellText, CellTags -> cellTag];
  modifyCell[] := If[isHidden, CellPrint[cell],
    NotebookLocate[cellTag]; NotebookDelete[]];
  Button[buttonText,
   modifyCell[]; isHidden = ! isHidden
   ]
  ]

Usage:
createHiddenCell["Do you like Mathematica?", "Thanks!"]

It will create a button with text "Do you like Mathematica?". And clicking it will toggle the display of your content in the second argument.
You can modify cell variable to create more complicated cell if you want.


Does Thanos have any inherent superpowers without the Infinity Stones

Question: Throughout Avengers Infinity War movie, we see Thanos fight with one or more Infinity Stones. So he's using their power to win against the Avengers. But does he have any superpowers without these stones or is he just a skilled fighter strong enough for his size.
Answer: He does
Although Thanos' backstory is not covered in the MCU, he is an Eternal,

Thanos possesses the superhuman physiology of all Eternals, granting him superhuman strength, endurance, reflexes, and agility. His skin in nearly invulnerable, particularly against heat, cold, electricity, radiation, toxins, aging, and disease, and he can survive indefinitely without food or water even before his "curse" from Death left him immortal, unable to die. His mind is also invulnerable to most forms of psychic attack, and can project a psionic blast of energy as well as blasts of plasma/cosmic energy from his eyes and hands.
Marvel.com

Also a Wikia

Deformed Titan Physiology Thanos is noted to be extremely powerful Titan, so much that he is able to strike fear in the hearts of all of his children and even Loki himself. He even showed no signs of fear upon being threatened by a Infinity Stone empowered Ronan.

Immortality: He is an extremely old being and has been called almost impossible to truly kill.
Superhuman Strength: He has tremendous amounts of bone and muscle power, which was seen to surpass the Hulk's extraordinary physical power and beat him into unconsciousness.
Superhuman Durability: His physical constitution is extremely durable, being able to wield the power of all the Infinity Stones and physically touch them without any damage or injury. He could even take on tremendous amounts of physical damage and still continued on with his mission.
Comment: Hence "nearly".
Comment: Missing "superhuman *size*" :-)
Comment: Gamora also stabbed him in the neck. Sure, it turned out to be an illusion, but Gamora seemed to think that a knife can penetrate his skin.
Comment: _"His skin in nearly invulnerable..."_ A Punch to the face from Iron Man did make Thanos bleed though. He said something like ___"All that for a drop of blood"___ in response.
Comment: None of the text you quoted from the wikia seems to be in the current version of the page. You might want to link to the specific revision of the page you're quoting (and more importantly, include links to the sources of the information, since anyone can edit a wiki page).
Comment: This description also seems to only apply to the comics. In the MCU, Thanos is clearly a very different character with different abilities.


Reference Request: Mathematical Foundations of Physics

Question: I am looking for reading on examples, or preferably a comprehensive summary on how the foundations of mathematics are related to physical theory. I would like to know whether basic set-theoretic and logical assumptions that underlie the higher-level mathematical techniques such as linear algebra, various branches of analysis, etc. have any bearing on the interpretation of theories in physics. For example, would it be of any relevance at all to physics if the axiom of choice was removed from the set of assumptions with which we operate? If anyone has any knowledge of examples themselves, that would also be highly appreciated.
Comment: See Frederic Schuller's Lectures on the Geometrical Anatomy of theoretical physics, where he starts with the foundation of set theory and logics and gradually develops the idea of mathematical gauge theory. Also see his lectures on Quantum theory. The entire course is available in Youtube:  https://www.youtube.com/c/FredericSchuller/playlists For a more detailed account you can also refer to : "The Geometry of Physics, an introduction" by Theodore Frankel
Comment: @KP99 thanks a lot!
Answer: I think you have the relationship between physics and mathematics back to front.
Physicist choose the mathematical tools that they need to support models that explain their empirical observations. If the necessary mathematical tools do not yet exist, or are not quite in the form the physicist wants, then they will develop new tools (as when Newton and Leibniz developed calculus to integrate equations of motion and handle the dynamics of extended objects).
Developments in mathematics do not drive physics. Instead, physical theories are modified as a result of (a) new empirical evidence or (b) a synthesis of ideas that replaces several unconnected models with a single unifying theory (as when Newton's law of universal gravity replaced Kepler's laws of planetary motion, or Maxwell's equations replaced and subsumed Gauss's law, Faraday's law etc.).
Comment: Thanks. I understand that, but I'm nevertheless interested in the relationship between the two. To clarify, I'm not so much interested in how mathematical developments drive physics (although one could argue that the discovery of new mathematical tools has spurred developments, whether those tools were invented by physicists or mathematicians). I want to know whether there would be any differences in interpreting theories which are based on different set theories, logic, etc. I have edited my question to make this more clear.
Answer: Since you asked for a specific reference: You might be interested in the work of Günther Ludwig. He did a lot of research in the logical foundation of physical theories. He also wrotes a book about it. I haven't read it myself so I can't say much about it.
Unfortunately, I am not sure if this book is also available in English. The original one is in German: "Die Grundstrukturen einer physikalischen Theorie" from Springer. However, it seems that there is also a French translation with the title "Les structures de base d'une theorie physique".
But in any case, maybe you find some articles from this author on the subject.


How to clean tv plasma screen

Question: What should I use for cleaning a TV plasma screen? My three-year-old daughter has put her hands many times on the screen and there is a big spot on it.
I don't live in America, so maybe I'm not able to buy a known American brand, but I'll appreciate any kind of guide.
Comment: I'm voting to close this question as off-topic because cleaning a TV screen is outside the site scope per the Help Center.
Answer: The easiest way is water (distilled) and microfiber cloth.  There are tons of screen cleaners on the market that you can order though that are a little easiest to work with than water.
Comment: I actually use a dry microfiber or with some windex -- water won't cut through the oil deposits and using it just seems to make it harder to clean.
Comment: @Ethereal - I wouldn't use anything with alcohol or ammonia.  Both of these can eat away at the coatings they put on the newer TVs.  If you have an oil issue I would just dip part of microfiber cloth in kitchen sink that has a little water and Dawn.  You are going to ruin your TV with the Windex after one time but if you keep doing it, you will have issues if you have an anti-glare film.
Comment: I also use microfiber and very dilute dish soap. I would use caution with a chemical as my wife tried to clean a large rear projection TV that a grand son touched with peanut butter and jelly fingers, it did damage the screen and that was when a 65" cost over 3k. +
Answer: Ideally you want a non-scratching cloth or towel -- if you're aiming for near-perfection, the "lens wipes" sold for cleaning microscope lenses are a good way to go. With respect to the fingerprints, you'll be able to remove fingerprints if you use something in which the oils are at least a bit soluble. The key is to avoid an aggressive solvent (as DMoore notes...) which may also eat away at the screen coating(s). I generally use 35% isopropanol -- this concentration is low enough that it's unlikely to have much of an effect on a screen coating.
Comment: Hello, and welcome to Home Improvement. I'd be concerned about using anything with alcohol in it... the OP should try it in a small corner before wiping a big streak across the middle.

How to clean tv plasma screen


Toll Like Receptors Vs Toll Receptors

Question: What are the major differences between them, apart from one being in humans and other in Drosophilla?
Answer: In Drosophila, Toll receptors are used during embryonic development as well as innate immunity. See The Drosophila Toll Signaling Pathway by Valance, et. al.
Toll-like Receptors are pattern recognition receptors found in organisms other than Drosophila that recognize common motifs found on pathogens.
Toll receptors were first discovered in Drosophila and orthologous receptors were then found in many other organisms, not only Human. Both will transduce signaling and will lead to transcription of genes.

Toll Like Receptors Vs Toll Receptors


Why Do Muggle Borns Get Taught Magic?

Question: In the Harry Potter series, why do they select Muggleborns to also learn magic at the Hogwarts School of Witchcraft and Wizardry and other schools in the wizard world?
Comment: @DVK I'm not convinced this is a duplicate. That one is specifically about for Salazar Slytherin's ideology, while this is about the wizarding community in general. Slytherin also lived in a different time period (middle ages), while this applies to the 'now'.
Comment: May just as well ask why muggles teach reading, writing, math, and science to the children of illiterate janitors. Or more to the point: Why wouldn't they?
Comment: @Andreas You are right
Comment: @DVK You need to reconsider it
Comment: @KevinLauntner - would you mind posting on Meta? If there's consensus that it's not a dupe, I will VTRO (or 5 other people will before I get to it)
Comment: I would have hoped that the new Magical Beasts film would have laid this question to rest.  Allowing Muggle-born wizards to go untrained will lead to way too many Obscuri coming into being.
Answer: Simple: because they possess magic.
If they don't learn how to control it, they will probably end up hurting people, and more importantly, they might use magic in front of a large group of people, which would expose the existance of magic (and probably start the search for other magicians). Think X-men, but with magic.
They could also just kill them, but that would probably lead to outrage in the wizarding community, since a lot of wizards don't hate Muggleborns.
Comment: X-men, but with magic....Xavier, but with hair
Answer: There are any number of possibilities:

It's just the decent thing to do.
Otherwise, you risk untrained muggles causing trouble with "accidental magic"
New bloodlines are necessary in the moribund wizarding genetic pool, so it's best to introduce more magic users.
Answer: They teach anyone who shows magical ability. It is the responsibility of the schools to do so to facilitate the ministry in 'controlling' magic. It means that everyone is able to control their own magic whether born of wizards or muggles and besides as Hagrid would say.

And it's codswallop to boot. "Dirty blood." Why, there isn't a wizard alive today that's not half-blood or less. More to the point, they've yet to think of a spell that our Hermione can't do. Come 'ere. Don't you think on it, Hermione. Don't you think on it for one minute.

Hagrid: The Chamber of Secrets (Movie)
Answer: In addition to the answers already given, there is also the consideration that the Wizarding world is a small one. If they didn't train Muggle Borns in their world, it's probable that they wouldn't have had enough people to sustain a civilization, let alone a population.
There wouldn't be enough people to fill the positions of administrators, teachers, technicians, and craftsman that ran the businesses, governments, schools, etc that are seen in the Harry Potter books. They would lose knowledge and capability from generation to generation due to deaths of older wizards and lack of new ones to train. There probably also wouldn't be as much innovation since the Muggle Borns often brought a different perspective and insight to magic and its practical applications.
Without a stable and growing population, it is also doubtful that they would have been able to maintain the economy and wealth that are seen in the books. Who would buy all of the little doodads and candies? Who would have the money without enough jobs to pay them a wage? Without profit and wealth being generated, how many businesses would last long enough for all of those doodads and candies to actually exist? And without the businesses, where are the jobs to pay people to be able to buy stuff?
There also wouldn't have been the strong ties between the Wizarding and Muggle worlds that are seen in the books, since a pure Wizarding wouldn't have the Muggle knowledge or consideration to interact well with the Muggle governments.
Lastly, with a lower population, Wizards wouldn't have been able to maintain a position of strength in regards to the other magical creatures. Not just in terms of political dominance as with the goblins, but also in terms of safeguarding and controlling the dragons and other beasties to preserve both worlds. Would the Inqusition and witch trials have been ended, or forgotten, if there were still monsters roaming around destroying and controlling the Muggle world?

Why Do Muggle Borns Get Taught Magic?


(re)Harmonising simple tunes

Question: (don't delete this post, this question phrased like this hasn't been asked before) I know about music theory, chord functions and chord substitutions. But more in general terms. When I ask different guitarist to play simple songs, like silent night or other Christmas/kids songs/nursery rhymes etc. They all have different chord progressions. Are they simply just re harmonising the songs playing with tonic, subdominant and dominant at free will? I mean they all sound good and different, does it just boil down to taste and artistic expression? Unlike jazz which is my main category, which uses the real book as sort of a standard.
Comment: @piiperiReinstateMonica If that's all you think jazz is, then you really need to be better informed.
Comment: If out of all genres in the world, jazz is the one where people do NOT invent their own chords and reharmonizations, it means that jazz is now officially dead. Good riddance! Now we can reinvent the whole thing by starting from pop melodies, and not some standards book. Just like jazz used to be before it was killed by standardization and real books and "education" systems. I'll call the new genre Real Jazz.
Comment: @Aaron Maybe you didn't notice, I was referring to the OP's description of jazz as something where tunes come from a standardized book and players don't - can't? or aren't allowed to? - play chords by ear and according to taste. As a characteristic feature of the genre. Even so much so that pop tunes are presented for contrast as something where chords CAN be made up by players.
Answer: You're saying that they don't mess with the melody of a Christmas song, they don't mess with the chords of a jazz one?   Yes, there's some truth in that.    As a vast generalisation, jazzers don't want to play the tune, they want to do their own thing over the chords. The chord sequence, rather than the original melody is the essence of the song.
Whereas, if you're playing 'Silent night' there's not much room for manoeuvre  with the melody.  Some players will be content to play the expected chords, others will feel they can only express themselves by playing anything EXCEPT those :-) There's a place for both approaches. But probably don't book a jazz guitarist to accompany your infant school's Nativity play!

(re)Harmonising simple tunes


Custom services container for ASP .NET core business layer

Question: My model classes (business layer/library of ASP .NET core solution) uses a number of services (IOrmService, IEmailService, IFileService, IHtmlToPdfConverter etc.). Different models requires different combinations of the services for CRUD operations. It prevents me to use base class to max extent and forces to repeat code/methods that are very similar. It could be solved by passing not a combination of services to factory methods but a container with all of the services.
Which solution should I chose:
- inject IServiceProvider (looks like a bit too tight coupling with ASP);
- create and inject my own service container (e.g. IBusinessServiceProvider);
- leave everything as is.
Comment: The _Repository Pattern_ would replace your `IOrmService`.  In other words, you would need a repository for each business object you intend to work with.  Your business logic would then go to the repository for that business object.  You can use generics to enforce common method patterns, etc. across the board.
Comment: My first critique is that your interfaces are two technology specific.  They should be domain specific, or use the terminology of your users.  For example, `IHtmlToPdfConverter` can be `IDocumentConverter` etc.  Second, the implementations of those services can be made up of their own things, but the core business should not have to know about them.  Those implementations would either be in their own libraries, or implemented at the edge (in the ASP.Net layer).
Comment: Good point regarding the naming. I'll change that. Just one addition just in case - in my specific case those services are logically part of business procedures, e.g. saving an invoice and sending it to a client should only happen within the same transaction. If send fails, the transaction shall be rollbacked.
Comment: "The Repository Pattern would replace your IOrmService." - could replace, but I prefer using factory methods on model instead. Yet the problem stays the same, only changes location from model classes to repository classes.
Answer: Move the code that uses these services outside of your models.
If you keep your models pure logic and put the interfaces at the top level of the application they will be easier to read, test and edit.
eg instead of
public class Model
{
    private IFileService fs;
    public SpellCheck(string filename)
}

Have:
public class Model
{
    public SpellCheck(IStream file)
}

public class App
{
    private IFileService fs;
    public void Main()
    {
        var stream = fs.load(filename);
        Model.SpellCheck(stream);
    }
}

Now the classes are even more decoupled than they were when injecting services and you don't have the problem of injecting services just because some sub object has one method which uses them.
Comment: I do use factory methods and inject the dependencies in methods like you described (the repository pattern is too "heavy" for my simple solution).

However, it still prevents me to generalize common behavior in base class. E.g. I have methods:

Invoice.Save(IOrmService ormService, IEmailService mailer, IFileService fileService)
Court.Save(IOrmService ormService) etc. Yet I could avoid code duplication if I provided a common method in base class: Save(IBusinessServiceProvider service)
Comment: I'm saying get rid of the Save methods
Comment: How? If i move it to some other class (repository), i wouldn't solve the problem. Different save methods shall be required for different models even though their internal are very similar.
Comment: it solves your problem of having to inject stuff. whats unclear is what other problem you think it will cause
Comment: I could generalize the save method for all of the model classes in base class like that: https://pastebin.com/xihAmccB The services except for the IOrmSevice and ICacheProvider are only used by concrete model implementations. Those could override virtual methods AuthorizeSave, BeforeSaveAsync, SaveChildrenAsync and AfterSaveAsync to implement custom persistence logic (if required). Yet different models require different services which brings us to different Save method signature.
Comment: You are trying to do too much in one method, the Repo shouldn't have to worry about authority. Apply my advice to all your classes, instead of injecting do it before the call in the calling code.
Comment: You mean getting DTO from a repository method (for fetch) and feeding DTO to a repository method (for save)? To my mind presentation layer (in my case ASP .NET core razor pages + API) shall not be able to avoid authorization within business layer...
Comment: there are several questions on that exact topic
Answer: As an outsider looking in, it appears that you are struggling with the design of the components.  Breaking down actionable functions that users need to perform into a sensible set of things can be done a myriad of ways.  It seems like the current breakdown is somewhere between domain driven design and functional design.  Without more knowledge of your domain, it's hard to provide specific examples.  So, in my answer I'd like to discuss how I approach the problem.
Let's say we have this requirement:

Given we have a report
When an analyst publishes it
Then the report must be sent as a PDF to the manager, and the group that asked for the report

I start to think about what are the nouns?  I've basically have been given the noun of Report and a number of Users that have different roles.  Then I think about what are my verbs?  In this scenario, I have the verb publish but the meanings are implied.  I also have the verb send, but this seems like that verb is something the publish verb does as a step.
Next I start thinking what else do I need to make this happen?  So implied in this scenario is something that manages reports.  There are common patterns for what "managing" something means, so I opt for the repository pattern and have a ReportRepository.  Also, I need to know how to find users and verify them as well.  So that implies I need a UserRepository and potentially a Role field in the User object.  To get the "group that asked for the report" then either the Report needs to keep track of the Requester or I need to query the ReportRegistry how to get the requester.
OK so let's look at what we have now:
public interface IReportRepository {
    bool publish(Report report, User fromUser);
}

public interface IUserRepository {
    User findManager(User fromUser);
}

public class Report {
    User getRequester();
}

public class User {
    Role getRole();
}

OK, I can start to see things take shape.  I personally prefer to use Dependency Injection as opposed to the Factory pattern, because I may have to implement something outside the core business logic.  One such example would be the thing that sends the report to the specific users.  Also, since the format of the report is specified in my requirements, it's likely I may have to convert form one format to another.  In that case, we need to look at detecting the report format and doing a conversion.
At this point I need to pause and think about where the report gets converted.  Does the notifier take a Report object and convert if necessary? or does the ReportRepository take care of that for you?  Both are valid ways of doing this.  For the sake of argument, I am going to make the executive decision that the thing that distributes the report worries about that.  That means I only need to add one more noun into my central business objects:
public enum Format {
    HTML,
    PDF,
    Word
}

public interface IReportDistributor {
    public bool send(Report report, Format format,
                     User fromUser, param User... toUsers);
}

// and since we would need to know the format of the report, Report gets new methods.
public class Report {
    User getRequester();
    Format getFormat();
    OutputStream getContent();
}

Now, when I implement my IReportRepository I know it needs an IReportDistributor and a IUserRepository.  Since this is core functionality in my business logic, the implementation class also goes here:
public class RepositoryManager : implements IRepositoryManager {
    private final IUserRepository userRepository;
    private final IReportDistributor distributor;

    public RepositoryManager(IUserRepository users, IReportDistributor distributor) {
        this.userRepository = users;
        this.distributor = distributor;
    }

    public bool publish(Report report, User fromUser) {
        if (fromUser.Role != Role.Analyst) {
            return false;
        }

        User toManager = userRepository.findManager(fromUser);
        User toRequestor = report.getRequestor();

        return distributor.send(report, Format.PDF, fromUser, toManager, toRequestor);
    }
}

That's the whole implementation from the business perspective.  Now, the implementation of the IReportDistributor is made closer to the edge, because we are choosing to implement it outside of the whole system.
You have enough here in the business logic to test the business rule in the application.  You just need to supply a mock or stub instance of the IReportDistributor to validate that the parameters are filled out exactly like you expect.
For the sake of brevity, I will leave the conversion code implementation and email implementation of report distribution to you.  That would be in it's own DLL since those things are complex enough.
Comment: Ok, you create a repository per model. Than pretty much all of the repositories will have method Save. As the save operation requires different services per model, each of the repositories shall have different constructor signatures. Yet the Save method will contain very similar code for each model which is what I want to avoid. Or shouldn't I?
Comment: You can use generics to address a lot of those commonalities.
Comment: All the repositories should be added in ConfigureServices?


What can cause oven's heating element to deform?

Question: What can cause a heating element to deform this way?

My oven is tripping the breaker whenever I turn on the heating, LCD and light are working fine, the front LED flickers though!
The model of the oven is IKEA Framdit OV9.
One of the elements has 30 ohm resistance and the other has 60, and given the data on the elements they have 1650 and 800 Watts power rating respectively. So for 230v they resistance seems be fine.
Comment: Honestly, just from looking at it, I would say it's almost certainly some kind of physical damage while shipping or something, or someone took a hammer to it or something. It seems a bit hard to believe that thermal expansion alone would cause this extreme warping, but I suppose it *is* possible.
Comment: It could well be that the element was hit by the oven tray while it was hot!?
Answer: It is shorted to case, check resistance between contact and outer metallic shield. This resistance should be infinite, in your case is something near zero if you test it with megger. You should change the damaged heater.
Comment: I checked the if there is a short between the element cover and the terminals but couldn't find anything wrong!
Comment: @Haider You probaby have a "partial short". You need a Megger or similar to test it. Worst case it's fine even then at room temperature but with the heat expansion, it shorts and trips your breaker. Replace the heater!
Comment: Thanks, I've already ordered a new one.  Will update the question and confirm the answer once it get it and try it out.
Comment: @winny has right., as written in answer you may not be able to detect this short with an ordinary multimeter, as it uses a small voltage to check resistance. A megger sends a HV pulse which has the energy limit not to kill, but better not to touch wires when it energises So this HV pulse then detects the insulation break, while a multimeter can't.
Comment: You may have to heat it to cherry red for the short to appear. At that temperature it's pretty soft and easy to deform. Fortunately they are easily available and pretty cheap for most ovens. If Ikea don't carry spares just google the oven name + "oven heating element"
Comment: I got the new heating element today (bought for ~19€), and the oven is now working again. Thank you!
Answer:
What can cause a heating element to deform this way?

Bad mounting.
Metal expands when it gets hot. This means that this ~2 Meter heating strip becomes ~25mm longer per 100 degree rise in temperature.
When you have a steel tube fixed in two points and make it longer by heating it, something must give. Either the mounting must allow the expansion or the tube will bend.

These steel tubes contain heat conducting ceramic sand an a resistive wire for that carries the heating current. This wire is coiled to allow for bending and expansion.
However, when the bending radius is too tight, or a thermal cycling pumping effect moves the sand away, you will get a short circuit.
However, since everything expands and contracts by heat the short may not become noticeable  until the heater gets to a certain temperature.
When designing mounting for heaters like this there may only be one rigid point. All other mounts must allow for sliding or other movement to give room to the expansion. (the clicking noises in your oven)
The reason for this element to fail is probably the horizontal mounting bar in the middle. It provided too much rigidity causing the element to buckle.
Comment: fascinating! Even the humble heating element needs precision design. Thanks.

What can cause oven’s heating element to deform?


Finding shared segments between two shapes (line) using QGIS

Question: I have two line shapefiles. I want to find between them, where are located all shared segments and extract the new selection shapefile.
I am using QGIS. I know that in ArcGIS, there are a tool, named "share line segment with".
Is there some tool like this in QGIS?
Answer: go to Vector -> Geoprocessing Tools -> Intersect; select the two shapefiles you want to analyse and set a name and location for the result shapefile.
Comment: Hello. I have already done it but the result shapefile is empty even if i invert the order of the input vector layer and intersect layer in the intersection box. Now i am trying to use SAGA (line-polygon intersection) where one of the layer is a line and the other is a polygon. But it gives me an error: "Saga folder is not configured". I have tryed to configure it but no results. How can I resove it? Thank you
Comment: Regarding QGIS Intersection: Make sure that both of your layers have the same CRS. To reproject them save them in the same CRS and load them again. For SAGA: You need to download it (google saga-gis), extract it into a folder and then open the sextante options (Analysis menu-> sextante options) and point sextante directly to the extracted folder (doubleclick provider saga dir)


Can you set Visual Studio's "smart indent" to not remove tabs in blank lines?

Question: When Visual Studio (2005) has Options -> Text Editor -> C/C++ -> Tabs -> Indenting set to Smart it will automatically indent code blocks and line up squiggly brackets, {}, as expected. However, if you hit enter inside a code block, move the cursor to another line, and then move it back, the inserted tabs are gone and the cursor is positioned all the way to the left. Is there a way to set Visual Studio to keep these tabs?
Answer: As far as I know, the only way to do that is to enter something (anything) on that line, then delete it.  Or hit space and you'll never see it there until you return to that line.
Once VS determines that you've edited a line of text, it won't automatically modify it for you (at least, not in that way that you've described).
Answer: This is an annoyance to myself as well. Anytime the code is reformatted the blank lines are de-tabbed.
You might look at this: http://visualstudiogallery.msdn.microsoft.com/ac4d4d6b-b017-4a42-8f72-55f0ffe850d7 it's not exactly a solution but a step in the right direction


Replacement capacitor type for microphonic ceramic cap

Question: I have a guitar effects pedal that has become microphonic, meaning if you tap the enclosure the sound can be heard in the amplifier. I've traced the issue to a single ceramic capacitor on the board. The cap value is 0.01uF and I'd like to replace it. The pedal isn't expensive so I'm not too worried about damaging it by attempting a repair. The problem is that it's a tiny SMD component, I think a 0603 package. Should I replace it with a different type of capacitor or is it a fluke that this ceramic one is defective?
Comment: I assume you suspect the capacitor because jiggling it causes the audio effect.  Do only taps get through, like causing a click, or will it actually pick up and broadcast other loud noises like vocals?  If it's just clicking this could be disconnection and reconnection due to vibration and not actually a microphonic effect.  If so you may just have a broken trace somewhere and it's even possible the capacitor isn't defective and just needs to be resoldered/reconnected.  Caps do wear out though.
Comment: @KH Initially I noticed this because I could hear the metal foot switch, and I mean not even when engaging the switch but just touching or turning it. I then opened the enclosure and did a bunch of chopstick tapping tests to test if the sounds where louder or softer around different components. When I tapped on this single cap, the sound is significantly louder.
Comment: I think you should try something other than a tap test.  Put the speaker in another room and get someone to listen to it while you scream at the guitar pedal for not working properly.  Let us know if the screaming comes through the speaker.
Comment: You want me to yell at my poor, sick pedal? ;) I can also hear just scraping the stick near the component, and the sounds are not just noise but sound like the source of the noise (metal from the switch, scraping the board, tapping the component). But, for science, I'll do it!
Comment: As long as you're absolutely sure it's actually reproducing sound as opposed to making a similar sound due to vibration that's an adequate test.  Buzzes, hisses, clicks, pops, thumps, scraping noises can all be simulated by bad connection and vibration, but a more complex vibration without touching the device like voice would be unmistakable.  I'm not there though.  The vibrations you've been testing with may well be adequate.
Answer: You can try replacing it with an NP0 dielectric ceramic capacitor, but it may be hard or impossible to find in 0603.
Edit: Actually that's wrong, Eg. Murata GRM1885C1E103JA01D in 0603 and many other options.
Comment: Got it, I'll order a few of them and report back. +1
Comment: Thanks, the board seems to have plenty of room given the tiny components on it, just didn't know if an 0805 would still make solid connections. I can also find film caps in 0805, would those be appropriate?
Comment: I suggest the NP0 as it's the same size.  SMT film caps are fine electrically, but they're not very forgiving of being overheated or stressed when hand soldering.
Comment: No, 0,01uF is easally available in 0603. Using NP0/C0G dieletric is important as these are not acting as a piezotransducer/small speaker. Other ceramics are.
Comment: @Arcatus Yes, you're right. Edited.


Current in Battery

Question: When a battery is performing work on a charge and moves it to the higher potential, why doesn't the charge move through the battery and return to the low potential? Why does it go through the circuit?
Answer: Batteries are constructed with an internal barrier between the two electrolytes that does not conduct electricity (i.e., electrons can't pass), but that does allow ions to pass through.  See the figure below (taken from Wikimedia, open source), of a simple alkaline dry cell (e.g., an AA battery), in particular the part labeled "ION CONDUCTING SEPARATOR."

The reason batteries are made this way is because in order for the anode electrolyte and the cathode electrolyte to come to thermochemical equilibrium, there has to be a transfer of both electrons and ions.  By putting the separator in there that only conducts ions, you block equilibration of electrons except in the case where you have it connected to an external circuit.  If you conduct an imaginary experiment where you * SNAP * your fingers and make that ion conducting separator disappear, the electrons would indeed surge from one electrolyte to the other as you describe, as fast as mass transfer would allow.  (You would then having to imagine the battery either exploding or melting, because this would make a LOT of heat.)
Answer: The charge doesn't "move back through the battery" because in order to do that, it would have to pass directly through the chemical reactions that put it there in the first place. It moves through the external circuit, because that's the only path available to it.
To take it to the next level of detail, the half-reactions that occur at the two plates inside the battery are actually occurring in both directions all of the time. When the battery is open-circuit, both reactions are occurring at the same rate. The forward reactions are slowed down by the electric field created by the separation of charge, and the reverse reactions are accelerated by it, and the battery maintains equilibrium.
When an external path for current is created across the battery terminals, some of the charge flows through it reducing the voltage and the E-field slightly, and this allows the forward reactions within the battery to occur at a higher rate than the reverse reactions, and this is what eventually dicharges the battery as the reactants are consumed.
Answer: The answer is: it will! When no salt bridge or similar conducting element is present between the two half cells, the reaction will quickly run to equilibrium. The state in which the potential force of the difference in electron affinity between the two electrodes more or less equals the Coulomb force of the opposite charges that accumulate in them. However, if you make use of a salt bridge this charge difference accumulation can be removed, since an electrolyte, which sort of completes the circuit. Usually salt bridges are constructed in a manner that prevents intermixing of the ions in both half cells, so that there is some certainty about what redox reaction is actually going on, and how. An example of a common salt bridge used in high school chemistry experiments is a filter paper soaked in a solution of potassium chloride.

Current in Battery


How to execute all autocmds of a specific augroup?

Question: As title. I just randomly come up with this question. To do so one would need to iterate over all autocmds in the augroup. Is this possible?
Answer:
To do so one would need to iterate over all autocmds in the augroup.

No. Operating on a bunch of autocommands in one go is precisely why autocommand groups exist, as explained under :help autocmd-group:
Autocommands can be put together in a group.  This is useful for removing or
executing a group of autocommands.  For example, all the autocommands for
syntax highlighting are put in the "highlight" group, to be able to execute
":doautoall highlight BufRead" when the GUI starts.

Anyway, back to your question:

How to execute all autocmds of a specific augroup?

You can't do it elegantly and you probably don't want to anyway.
The use case for an autocommand is to execute a specific command when a specific event is triggered with a specific value.
When you enter a window…

a WinEnter event is triggered with the name of the buffer displayed in the window as value,
Vim tests the patterns of every WinEnter autocommand in every group against that value,
if the pattern matches, the command is executed.

Now, you have the possibility of doing the same thing manually with :help :doautocommand:
:doautocmd WinEnter

and you can even pass an arbitrary value:
:doautocmd WinEnter foobar

In both cases, every autocommand that matches against any value (pattern is *) and every autocommand that specifically matches foobar are going to be executed.
That's the main scenario envisioned by the Vim developers for :doautocmd and :doautoall: triggering a specific event in an explicit manner.
The whole autocommand system is designed around the notion of event, not around patterns or commands or groups. Using it correctly is only a matter of thinking in events. All the rest is implementation detail.
You listen to a specific event. You trigger a specific event. And that's it.
Some events, like BufNewfile, can have hundreds if not thousands of autocommands associated, with as many patterns. In that context, doing:
:doautocmd BufNewFile
(goes through a massive number of autocommands)

may not be a great idea. Or you may only want to execute the subset of available autocommands that actually suits your needs. That's where autocommand groups enter the picture. By specifying a group name, you tell Vim to only execute the autocommands associated with the given event that belong to the given group:
:doautocmd MyGroup BufNewFile
(goes through fewer autocommands)

Which is not much more than a specialized case of the scenario above.
Another benefit of grouping autocommands is the example provided at the bottom of :help autocmd-groups.
In short, Vim makes it easy to do the following:

execute all autocommands for a given event,
execute a subset of all commands for a given event,

but it doesn't provide a way to do the following:

execute all autocommands
execute all autocommands for a given group

presumably because there are lots of events and therefore lots of potentially available autocommands, which means lots of commands and lots of risk.
In fact, as noted by @Matt in the comments, the following will throw an error:
:doautocmd MyGroup *

So Vim really goes out of its way to actually prevent what you want to do.
That said, there is still this little loophole:
:doautocmd MyGroup BufNewFile,Bufread,WinEnter[and so on…]

but that sounds extremely silly.
Comment: You could add that `doau testgroup *` results in E217. So such action is _intentionally_ prohibited by Vim.
Comment: But sometimes it is not that easy for me to find the exact part related to my confusion. For example, with `:h doautoa` it doesn't say explicitly that it will execute all autocmds from the specified **augroup**. Instead it says: `Like ":doautocmd", but apply the autocommands to each loaded buffer.  The current buffer is done last.`. In my perspective it is not related to my question here, where I want to execute all autocmds from an augroup.
Comment: @job_start `:help :doautoall` starts off with `Like ":doautocmd", but[…]`. If you don't know what `:doautocmd` does then you can't understand `:doautoall` so you are expected to read `:help :doautocmd`, which is quite explicit about autocommand groups. Your perspective and your strategy don't work. Change them.
Comment: Thanks for your update on it. I usually have trouble reading long documentation. What I learned these years is to express my confusion as long as I have any doubt about any little part. Apologies if any of my comments may be too offensive.
Comment: Indeed, I did try something similar days before, maybe that's the source of my post here. Thanks for your beautiful answer, it does solve many of my recently asked questions (all in today). (Oops, I just realized that the comment is by Matt)
Answer: There's the autocmd_get() function for this, which accepts a dict to filter the returned value:
:echo autocmd_get(#{group: 'my-autocmds'})[3]
{'cmd': 'setl et', 'group': 'my-autocmds', 'pattern': 'awk', 'nested': v:false, 'once': v:false, 'event': 'FileType'}

The full output is rather long, so only printing one entry here, which is:
augroup my-autocmds
    " ...

    au Filetype awk         setl et
augroup end

This was added to vim fairly recently, with Vim 8.2.5030 (May 2022). From a quick search, it seems it's not ported to Neovim, but they may have a different API for it.


How to get the smart contract name given the address

Question: I've been trying to get a smart contract name given the contract address.
Not a smart contract in particular, but I wanted the process to be able to get the name of any contract by the address.
I've been using web3js and infura but without any luck.
Can anyone point me towards the right method to use?
Comment: You cannot do this via web3.js. You can do it via Etherscan, but only if the deployer of the contract (or anyone who knows its source code for that matter) has verified it on Etherscan.
Answer: You have a couple of options. None of them great.
You can use ENS. This is one of its primary purposes. Check the ENS docs.
You can use Etherscan. Again nowhere near perfect, but a possible source of some names.
The trouble, as you've encountered, is that there is no centralized registry (nor should there be — nor can there be!).
Both of the above sources are hit or miss at best. People have to have gone to these sites and added the names. It's mostly miss except for popular contracts.
Comment: Thanks Thomas, I actually tried with Etherscan but this feature is behind their paid API and it's quite expensive for using only one feature.
I will definitely check out the ENS doc you mentioned and see if I can find anything useful.


Can the invention from this patent be used in a research project in pharmacy?

Question: In reference to the patent: EP1341498A4
Answer: Patent rights do not, in principle, extend to research activities. This means that universities and other research institutes are free to use patented technology within the course of their activities, provided that they are strictly for academic pursposes and not for business activities. A good overview of this and the legislation behind it can be found in the below article:
"Safe harbors in Europe: an update on the research and
Bolar exemptions to patent infringement", Nature Biotechnology, 2015, volume 33, p.710
Similar provisions exist worldwide, having their origins in Article 30 of the TRIPS agreement.
There seems to be a blur borderline between the terms "on the patented invention" vs "with the patented invention", but this depends on the details of each case.
In your reference, EP1341498A4 is the search report of patent application EP1341498A2, which never got granted, so it doesn't matter anyway.


how i can lazy load thumbnail images to scroll view vertically with pages?

Question: i have photo gallery which loaded to scroll view vertically and i only want to load visible pages to avoid memory issues like table views did. Is there a way to do this? i am using core data to get images and there are more than 150+ images in it.
Answer: I used this: http://www.markj.net/iphone-asynchronous-table-image/ and I'd think it would help in your scenario as well
Answer: if you are using vertical only scroll you may use UITableView with custom UITableViewCell.
This way, you get the lazy load done.


Why erf(a-b)+erf(a)+erf(a+b) is so close to 3erf(a)?

Question: I am approximating an empirical distribution function with a sum of three gaussians, and noticed that for erf function $erf(a-b)+erf(a)+erf(a+b)$ is numerically very close to $3erf(a)$ for applicable values of $a$ and $b$, $a>>b$. Close, but not quite the same, of course. Could you suggest an analytical explanation why these functions are so close?
Comment: Did you mean $3 erf(a)$ instead? Because as its written right now, you can subtract $erf(a)$ from both sides to get a positive number $erf(a-b)+erf(a+b)$ being close to zero, which I don't think is what you meant.
Comment: Do you mean close to $3 \text{erf(a)}$ ?
Comment: Yes, thanks, I meant 3. Will edit now
Comment: This is true for "most" functions, not just $\operatorname{erf}$.
Comment: @Rahul, this is true for smooth functions when $b$ is tiny, but for $erf$ that is noticeable for larger $b$ than what I would expect. Claude Leibovici explained it nicely in his answer: the $b^2$ coefficient in the Taylor series has term $e^{-a^2}$, which is very small in my range.
Answer: Assuming you mean close to $3\, \text{erf}(a)$, set $b=x\, a$ and perform a Taylor expansion at $x=0$.
You should arrive to $$\text{erf}(a-a x)+\text{erf}(a )+\text{erf}(a+ax)=3\, \text{erf}(a)-\frac{4 \left(a^3 e^{-a^2}\right) x^2}{\sqrt{\pi }}+O\left(x^4\right)$$ or, if you prefer, $$\text{erf}(a-b)+\text{erf}(a )+\text{erf}(a+b)=3\,\text{erf}(a)-\frac{4 \left(a e^{-a^2}\right) b^2}{\sqrt{\pi }}+O\left(b^4\right)$$ I suppose that this is clarifying.


How do I implement an application similar to google maps on android?

Question: I have a couple of images on available to my program. They are parts of jigsaw puzzle (with rectangular pieces though). I wanted the look and feel similar to that of google maps in android.
One way I could implement was to create a set of ImageViews and keep recycling them, as the user pans the image in any direction. However, to me that appears like a brute force method. Is there any alternative approach to implement such kind of application?
Or rather how is google maps implemented? A set of Imageviews ?
Answer: I think for your case the OpenGL route might be the best choice.  You can get started with the GLSurfaceView.
Comment: SurfaceView was made for this type of thing!
Answer: Using set of images and recycling them is a valid method. But you can enhance it by adding some redundant ones to keep close to view area images preloaded.


Is there a on-line money manager system that can import Microsoft Money UK data files?

Question: I need to move away from Microsoft Money as it has come to the end of its life.
There seems to be lots of on line money management systems, however I need one that:

Can import my UK Microsoft Money data files
Will track investments (including stock splits etc)
As well as day to day banking
Does not lock me in (I wish to be able to get my data out if needed)
Answer: The main online personal finance aggregation services that I know of in the UK are yodlee.com and moneydashboard.net though the latter is a new service (in Beta) powered by the former (which is more established; I've been using it on and off for around two years).
Some more info/bit of background on the two services, and some discussion in the comments, here: http://eu.techcrunch.com/2010/05/12/money-dashboard-launches-its-bid-to-become-the-mint-for-the-uk/
and this article has some screenshots/talks a bit more about what the service offers: http://thenextweb.com/apps/2010/05/14/can-money-dashboard-become-the-uks-mint-com/
I doubt they import from desktop apps like MS Money, but you may find one or other to be a viable alternative going forward..
There are also a couple of others that need you to have an account with them: Egg Money Manager (though that one saves data on a specific computer rather than being entirely web based) and First Direct have an aggregation service as well.
Been doing a bit of research into this and almost everything else I've seen is US-only unfortunately :)
Answer: Have you looked at GnuCash? Website here
There are specific instructions for importing Microsoft Money files here: http://wiki.gnucash.org/wiki/FAQ#Q:_How_do_I_import_my_data_from_Microsoft_Money.3F
Comment: GnuCash is not a webapp
Comment: Good point, well bought out :-)
Answer: Xero can import OFX format files. They also have a free personal version, and allow automatic transaction imports with certain banks.
You also have a wide variety of export formats for your data too - along with a good API so you can write your own software to interact with the data for reporting etc.
Comment: I don't think Xero will track investments


Example when globally unbiased estimator does not exist while locally unbiased estimator exists?

Question: The locally unbiased(l.u.) estimator $\hat{\theta}\left( x \right)$, with $x$ stands for the experiment result, refers to the estimator that satisfies(see Eq(5) of this paper for multiparameter case) $$\sum_x{p\left( x|\theta =\varphi \right) \hat{\theta}\left( x \right)}=\varphi ,\sum_x{\partial _{\theta}p\left( x|\theta \right) |_{\theta =\varphi}\hat{\theta}\left( x \right)}=1$$
where I have used $\varphi$ to stands for true value. It is a weak version of globally unbiased, i.e. unbiased at any possible true value of $\theta$. The aim of the l.u. estimator is that there might be cases when a globally unbiased estimator does not exist. So I want to know if there is some specific example that we cannot find a globally unbiased estimator while we can find a l.u. estimator?
Comment: A trivial example might be (I am not so sure about the second condition) $\hat\theta(x)=7$ when $\varphi=7$, i.e., the trivial estimator that does not consider the data and happens to be "lucky" and one true parameter value.
Comment: @ChristophHanck Thanks for the comment. In this case, the estimator does not satisfy the second condition since $\sum_x{\partial _{\theta}p\left( x|\theta \right) |_{\theta =\varphi}7}=\partial _{\theta}\sum_x{p\left( x|\theta \right) |_{\theta =\varphi}7}=0$. The partial derivative is used to require the estimator not to act so weirdly at least around the true value. I'm not sure if this l.u. normally used in statistical inference, but in the field named quantum metrology, this condition is used a lot.
Answer: You can always construct a locally unbiased estimator at a point $\varphi$ from an arbitrary (non constant) estimator by shifting and scaling.
suppose that $\tau(x)$ is some estimator, then define $\hat \theta(x)= \varphi + \alpha( \tau(x) - E_\varphi[\tau(x)])$.
Clearly $E_\varphi[\hat\theta(x)] = \varphi$, and
$\partial_\theta E_\theta[\hat \theta(x)]_{\theta=\varphi} =\alpha \partial_\theta E_\theta[\tau(x)]_{\theta=\varphi}$.
So by choosing $\alpha=1/\partial_\theta E_\theta[\tau(x)]_{\theta=\varphi}$ the second condition is satisfied (assuming the derivative of the expectation at $\varphi$ is not zero).
Since a locally unbiased estimator always exists, the question is therefore just whether there are examples where a globally unbiased estimator does not exist. You can probably find many of those, as in this example.


Is that we can send the multipart/form-data till 2GB by using rest api in apex

Question: Is that multipart message is available in RestAPI in Apex 2021 to send the large files(till 2GB) from source org to target org??
Answer: Apex can't handle data this large. You will need some kind of external ETL (Extract, Transform, Load) tool, or custom software, in order to migrate files of this size. By the way, you're looking for "chunked" upload, not "multipart message." The former is an HTTP header that allows for resuming uploads, the latter is used for posting forms with binary content.


SharePoint 2016 May 2017 CU update

Question: I am installing SharePoint 2016 with latest CU May 2017.
Do I have to install first Feature Pack 1 November 2016 CU and then install May 2017 CU OR only installing May 2017 CU will be enough (means May 2017 CU contains Nov 2016 CU)?
Comment: Did you get your answer? Looking at the questions you have asked before, I don't see you getting back to the answers whether they have been helpful to you. Have you seen the Help Center article for [What should I do when someone answers my question?](https://sharepoint.stackexchange.com/help/someone-answers). I wholeheartedly suggest you to go through this article.
Answer: You don't have to install November 2016 CU before installing May 2017 CU, as May 2017 CU includes the Feature Pack 1.

This CU also includes Feature Pack 1 which was released with November 2016 CU.

Source: https://blogs.technet.microsoft.com/stefan_gossner/2017/05/09/may-2017-cu-for-sharepoint-server-2016-is-available-for-download/
Answer: May 2017 CU includes the Feature Pack 1 in it, simply install the May CU 2017.
Two things, you need to understand.

You have to Install both patches " SharePoint Server 2016 (language independent)" & "SharePoint Server 2016 (language dependent fixes)" from May CU 2017. Order of installation does not matter, but you have to install the both packages.
Run the config wizard after installation of both patches on all servers in the farm.

SharePoint 2016 May 2017 CU update


Is spawning charecter in game haram

Question: I'm sorry for annoying but before you thumbs down this please hear me out I played one game where you can spawn characters,animals,objects,etc it is called garrys mod I would like to know if this is permissible to play
Answer: This game would not be clarified as 'haraam' if the creations are temporary, you acknowledge that this is a game and that we are all Allah's creations and are obedient towards him. If you are designing a character, this is 100% haraam, because you are drawing something lifely. I am no scholar, so do not take my answer strictly, and please look at the fatwas posted below! The following fatwas may not relate directly to your question, but consider what they have to say and see if they apply to your circumstances. If this does not help, visit a trusted Imam at your local mosque.
Quotes on drawing / creating lively things:

Ibn Abbas (May Allah be pleased with them) said: I heard the Messenger of Allah (sallallaahu 'alayhi wa sallam) saying, "Every painter will go to Hell, and for every portrait he has made, there will be appointed one who will chastise him in the Hell.'' Ibn `Abbas said: If you have to do it, draw pictures of trees and other inanimate things. [Al-Bukhari and Muslim].
Muslim :: Book 24 : Hadith 5246
A'isha reported that Gabriel (peace be upon him) made a promise with Allah's Messenger (may peace be upon him) to come at a definite hour; that hour came but he did not visit him. And there was in his hand (in the hand of Allah's Apostle) a staff. He threw it from his hand and said: Never has Allah or His messengers (angels) ever broken their promise. Then he cast a glance (and by chance) found a puppy under his cot and said: 'A'isha, when did this dog enter here? She said: By Allah, I don't know. He then commanded and it was turned out. Then Gabriel came and Allah's Messenger (may peace be upon him) said to him: You promised me and I waited for you, but you did not come, whereupon he said: It was the dog in your house which prevented me (to come), for we (angels) do not enter a house in which there is a dog or a picture.
Aishah (May Allah be pleased with her) said: The Messenger of Allah (sallallaahu 'alayhi wa sallam) visited me after returning from a journey, and I had a shelf with a thin cloth curtain hanging over it and on which there were portraits. When he saw it, the colour of his face changed (because of anger) and he said, "O Aishah! the most grievous torment from Allah on the Day of Resurrection will be for those who imitate (Allah) in the act of His creation.'' `Aishah said: We tore it into pieces and made a cushion or two cushions out of that. [Al-Bukhari and Muslim].

Look at this question, too: Is drawing or photographing people prohibited in Islam?
https://www.islamweb.org/en/fatwa/402529/designing-games-with-animated-characters
https://www.islamweb.net/en/fatwa/435574/playing-games-in-which-the-character-looks-exactly-like-a-human
https://islamqa.org/hanafi/daruliftaa-birmingham/136553 (This is a much stricter view for the 'Hanafi' sect. I do not identify with it.
https://fatwa.ca/fiqh/video-game-character-customization-making-game-characters-animate-beings/

Is spawning charecter in game haram


Why don't the states in the National Popular Vote Interstate Compact apportion their electoral votes by congressional district?

Question: If the goal is to get the electoral college to better reflect the popular vote, the simple solution is to avoid the winner-take-all system and apportion votes by congressional district based on the popular vote in the state. So why don't the states who signed the interstate compact do exactly that? It does not require any other states to go along with it and can have an immediate effect.
Comment: Huh? The goal is to reflect the __national popular vote__. Apportioning electoral votes by congressional district would approximate that, but going off the full popular vote would be the best
Comment: @RainWillow The states that favor federalism most are the states that benefit most from it, and that would be states that are mostly rural and have small populations. States with large populations are disenfranchised in the Senate, and even in the House. Moreover, those states with large urban populations benefit from uniform regulations across the country. The purpose of the National Popular Vote Interstate Compact is to circumvent the compromise that protects small states that is built-in to the concept of an Electoral College.
Comment: @divibisan: But that is counter to the basis of federalism. It's also counter to the text and the spirit of the constitution which was established to protect the rights of the minority and the rights of smaller states.
Comment: @DavidHammen: "Moreover, those states with large urban populations benefit from uniform regulations across the country." ...How so?
Comment: Several disparate examples, @RainWillow. (1) Imagine if each state had its own regulations on train track widths. There were several competing gauges of railroad track. The Pacific Railroad Acts of 1862 made a standard gauge the law of the land and opened up the west. (2) Radio communications. Fortunately the federal government saw the mess that could have been ahead of time and created the Federal Communications Commission in 1934. (3) Television (an offshoot of the FCC). NTSC ("Not The Same Color") is bad enough. I can only imagine how bad things would if standards were left to each state.
Comment: (4) Thalidomide babies. We need to be very thankful that the US FDA refused to approve thalidomide for use in the US. This would not have been possible if the FDA had not been created in 1938, over the strong objections of states and drug companies.
Comment: (5) Airplanes. The US federal government quickly took over authority from the states, and that is a very good thing. The first thing that happens with every airplane mishap nowadays is that various government agencies are called in to investigate.
Comment: (6) Rockets. (My field.) States have no authority over what is safe, what is not when it comes to launching rockets into space. Some have tried, and fortunately have died in these efforts. States that have spaceports make sure they are compliant with federal regulations. The states that do want spaceports know that the various federal agencies have decades of experience while the states have none. Federal agencies encourage states to develop their own spaceports, but within federal regulatory boundaries.
Comment: Do I need to go on? High tech needs high standards.
Comment: It does not help that the US is only metric superficially. (All US federal standards are essentially conversion factors from metric to customary units.) It helps even less that the length of a mile is not the same in all fifty states. Rhetorical question: Does this make **any** sense?
Comment: I edited your question because that last sentence is worded in a way that makes it sound like you are trying discredit the pact. I am assuming good faith here, and have simply removed the problematic part of the question. I think the question is otherwise salvageable and answerable. If I am in error, please feel free to rollback of course, but keep in mind restoring the previous wording may make it again sound like your entire purpose here is to discredit the compact.
Answer: Since the National Popular Vote Interstate Compact only takes effect once it covers enough electoral college votes to decide the presidential election, and the compact dictates that the signers allocate all their votes to whoever wins the national popular vote, the result of the electoral college vote will be brought into line with the national popular vote once it takes effect (regardless of what non-signing states do).
If the signers instead immediately started dividing their electoral college votes to proportionally match the popular vote of those in the area, the immediate effect would be diluting the power of their votes. Without all states signing it, the compact could not force the electoral college vote to match the national popular vote, and those states not signing would effectively become stronger "swing states" - a few votes in a non-signing winner-takes-all state could change the outcome of the electoral college vote, while a few votes in a signing proportional-allocation state would change significantly fewer electoral college votes.
Comment: @RainWillow I'm not aware of how my answer suggests that. Can you explain why you think it suggests that?
Comment: @RainWillow You've put the same comment on two fine answers.  But it is only showing your opinion. There is nothing in this or the other answer that implies that the goal is to ensure Democrats win close elections.  The question states that the goal of the NPCIC is to ensure that the winner of the popular vote takes the presidency, and nothing else.
Comment: Irrelevant..... It would equally dilute the power of red states.
Comment: Your answer suggests that the unstated, real purpose of the interstate compact is to ensure Democrats win close elections as opposed to the publicly stated goal of reflecting the popular vote. This is further supported by the fact that only blue states have signed the compact.
Comment: @JamesK: Your second paragraph. "the immediate effect would be diluting the power of their votes." Those are all blue states.
Comment: @RainWillow: Not wanting to dilute the power of the votes doesn't necessarily have to do with favoring one party or the other. It also has to do with the helping the state's own interests. Making the electoral votes winner-takes-all makes candidates (of both parties) spend more money and attention on the state to try to win it if it is a swing state, and that benefits the state politically, as it means the candidates will likely be more aware of the political concerns of the state's residents, and may promise policies that benefit the state to curry favor.
Answer: Because you can use gerrymandering to make it so that the popular vote in a state doesn't win the majority of the congressional districts in that state. This of course is not counting for the two votes that each state gets for its Senators.
In the end the only way to ensure the popular vote winner gets the votes is to award it solely based on the popular vote alone.
https://en.wikipedia.org/wiki/Gerrymandering
Comment: True, but I wonder if doing it by CD would be a compromise more sates would accept once the EC backfires on the group it's recently been helping.
Comment: @dandavis I know that Republicans tried to get rid of the system breaking it down by House districts in Nebraska after a Democrat managed  to get one of Nebraska's electoral college votes.
Answer: The issue would be that unless every state agreed, those that changed their method of apportionment would likely have less influence overall.  Take California, for example, with its 55 electoral votes.  Today, that is a very blue state so the Democrats can basically count on getting all 55 electoral votes every election.  If California decided to apportion electors by district (I'll assume the 2 extra go to the overall state winner), and assuming the election went the same way as the last House election, Republicans would take 7 or 8 of those 53 districts (a previously Republican seat is vacant) so you'd end up with 47 or 48 electoral votes for the Democratic candidate and 7 or 8 for the Republican candidate.  Effectively, that reduces the impact of winning California from a net of 55 to a net of ~40 electoral votes.
If California allocated its votes proportionately to the statewide popular vote, eliminating the impact of district gerrymandering, then based on the 2016 results, it would have given ~1/3 of the votes to the Republican and ~2/3 to the Democrat.  Lets say that works out to 37 votes for the Democrat and 18 for the Republican (depending on the rules, the Libertarian and Green parties might have won an elector as well).  Now the winner of the state only nets 19 more electoral votes than the loser.
Abolishing the Electoral College is something that has more support among Democrats than Republicans.  If the solidly Democratic states decided to change how they apportioned electors while the Republican states stayed as winner-take-all, it would become extremely difficult for a Democratic candidate to win the White House.  You would need the solidly Republican states to reciprocate before elections where some states had adopted the change and others had not were fair.
Incidentally, this is one of the reasons that the National Popular Vote Interstate Compact doesn't take effect until it is ratified by states representing at least 270 electors.  Solidly Democratic states don't want to put their candidate in a position where he or she has to win the national popular vote to get all the Democratic states plus win additional winner-take-all states in order to win the election.
Comment: @RainWillow - No.  It suggests that the Democrats are realists who don't want to intentionally put themselves at a structural disadvantage.  They would prefer to reflect the popular vote but don't want to be in a position where they have no chance of winning in the interim.
Comment: Your answer suggests that the unstated, real purpose of the interstate compact is to ensure Democrats win close elections as opposed to the publicly stated goal of reflecting the popular vote. This is further supported by the fact that only blue states have signed the compact.
Comment: Toe-may-toe, toe-mah-toe. Our arguments are the two sides of the same coin. You are basically repeating the same idea I expressed but doing so in a way that uses more positive words to describe the same behavior. What we both agree on is that the behavior is the result of a political calculation by the Democrats.
Comment: @RainWillow: both sides want to win, nothing sinister about that, that's the point of having sides.


Is AC really as powerful as I think it is?

Question: My understanding of AC is that an enemy must roll higher than your AC to take any damage on you. However, if this is the case, wouldn't a player only need an AC higher than 20 to be invincible? I am level 1 and my AC is already 17 so even now I don't see how monsters can hit me very well. I am aware of monsters with bonuses to attack rolls, but are these the only monsters that can really hurt me?
Comment: The real answer to this question is "just keep playing the game, it will all become clear."
Comment: I love this!  I remember thinking the exact same thing once upon a time.
Answer: It's d20 + attack bonus vs. AC, not just d20 vs. AC.
For example, the basic ogre in the Monster Manual makes attacks at +8. So that ogre can hit AC 20 on a 12 or higher.
Rolling a "natural 20" (i.e. the die itself comes up 20) is a hit regardless of AC, so opponents have at least a 5% chance of inflicting some damage on you. (Damage tends to scale with levels, though, so that level 1 goblin isn't a huge threat to a level 10 character even if he does get lucky and roll a 20.)
Beyond that, a lot of enemies will have special abilities — especially spells — that Armor Class doesn't protect against. So saving throws (Fortitude, Reflex, and Will) are just as important as AC for avoiding damage. At higher levels, magical effects that can straight-up nullify attacks also become very powerful.
Comment: Not to mention that the DM can, at their discretion, create NEW enemies.  The monster manual has tons of monsters, but human enemies with magical weapons and a lot of class levels are also something to look out for.
Answer: If you're asking "I am aware of monsters with bonuses to attack rolls, but are these the only monsters..." then right here is the misunderstanding.

ALL the enemies will have an attack roll bonus. For the very, very weakest enemies (say, a single rat) the bonus will be +0, but that's an exception rather than the rule, usually all enemies appropriate for a starting lvl 1 party will have a combat bonus - so "the only monsters that can really hurt you" includes everyone.
The attack bonus of your enemies will scale up as you grow in level, and I believe their attack bonus would grow faster than your AC unless you heavily focus on AC - which might not be the best choice, as attack and the other defences are important, too.
That being said, in low levels against opponents that aren't magic/tricksters, a high AC would mean that you'll be getting hit rarely - but that's ok, you can't withstand many hits and you'll get multiple opponents, so having a 20% chance in every attack to get damage is enough to be dangerous/deadly/fun.
Comment: Concisely and clearly answers the question without getting bogged down in extraneous details that would muddy the answer, nicely tailoring it for the asker's degree of knowledge. +1!
Answer: Four things you should consider are:

You have to equal or exceed the target's AC for the attack to hit.
Attack bonuses increase as monsters get stronger, from a combination of base attack bonus and strength/dexterity getting higher.
There are circumstances when AC can be reduced, such as being prone, and when attack bonuses can increase, such as flanking. You can read about them here.
Not all attacks are made against normal AC, some go against touch AC, and other times the target may be flat footed. And a lot of spells don't even care about AC, such as favorites like Fireball and Lightning Bolt.

So in conclusion, an AC of 20 does not make you invincible. To put this in perspective I am in an epic level campaign with a level 22 character who has an AC around 40 and I still get hit frequently by enemies such as Balors. The effectiveness of AC is relative to what you are fighting.
Answer: In D&D there are different times at which AC is effective. In the early game, between levels 1-10 or so AC can be a reliable way to avoid getting hit, after that point Monster To-Hit and other special abilities that avoid AC entirely begin to scale far past what an unoptimized character is capable of having. At that point its more cost effective to just buy some miss chance. Blur, Displacement, Mirror Image or something like that.
That being said no one attribute ever makes you Invulnerable, you could have infinite Armor Class and still be killed by level 1 wizards casting magic missile. You could have Infinite DR and still be burned to death. Infinite hit points and you can still be drowned to death.
Answer: All attacks have bonuses, and as you level up, those bonuses keep growing pretty much automatically. Early on in the game, you get a big chunk of AC for very little (your Dex mod, your armor and shield's base AC), but getting more AC after that requires expensive magical items.
As a result, AC is actually quite weak: as you level up, you have to pay a lot of gold just to keep your AC relevant against enemies of your new level, who have higher attack bonuses just by virtue of being a higher level. If you can keep up, it's fairly useful, but plenty of things can just ignore it, which means you are putting a lot of resources towards a defense a lot of things won't care about.
Generally, the best strategy for AC is to take whatever you can get for cheap (the best armor you are proficient in, having a reasonable Dex score, casting basic spells like mage armor, whatever), and then not sink too many more resources in it.
Answer: While I'm not talking about touch AC (we're talking about invulnerability from "hitter" monsters, right?), your assumptions still do not hold up.
I think the basic assumption we need to debunk here is that "some monsters have a bonus to their attack rolls".
Every creature in the D&D universe, be it a monster or a NPC with class levels, has a base attack bonus akin to the one the player have, tied to its HD. They often have a positive strenght or whichever ability influences their to-hit roll and they sometimes benefit from feats. They might get a size bonus (or a penalty, really, but this is often compensated by a lot of strenght) or be able to buff themselves with spells and/or spell-like abilities.
An enemy rolling to hit you very rarely has a +0 modifier to its attack rolls, and this is usually only true for low level monsters with a CR lower than 1 (which are supposed to swarm you and get some hit sooner or later, I suppose).
AC, however, plays an important role only until level 7~9-ish.
Raising AC means spending a lot on money on it and to-hit rolls raise even without spending money there (because of BAB and monsters with better ability modifiers showing up), so AC becomes very easy to bypass if not specialized into (a thing only spellcasters can really afford), especially for high-HD monsters, buffed people and high BAB classes / racial HD.
In the meantime, other ways to harm characters show up, such as spells that requires Saves, spells that can only be stopped by Spell Resistance or even worse spells that hit the target no matter what.
Overall, high AC is not invulnerability.
Answer: You are right that AC is powerful, but as the other answers have said it's only powerful against one specific attack and there are ways to reduce the effectiveness of AC.
For example against a heavily armoured target switch to touch attacks. Vs a target with high dex scores try and make them lose their dex bonus...or you can flank for flanking bonuses, etc. As enemies increase in levels their attack bonuses and abilities that bypass armour all increase too.
As a level 1 character with AC 20 then most enemies you fight will have only a small chance to hit you, however if they do manage to hit you then you do not have many hit points to survive those hits.
By dedicating too much time to bolstering your AC you can actually reduce your defence against other things that matter just as much. AC 20 is no help at all if you are grappled and held to the floor, or if you fail a will save and start attacking friends, or if you fail a reflex save and fall into a pit trap, etc.
Answer: You can roll higher than 20 on a d20, if your bonuses are high enough. In fact, you have to do this to beat any DC higher than 20 (the natural-20-always-succeeds rule notwithstanding).
I put it this way because while it does in fact keep AC from making you invulnerable to physical attacks, it also affects many other aspects of the game. You probably won't face such high-DC rolls while you're still Level 1, but you'll start facing them soon enough.
Answer: Alex P's response explains the basic mechanic pretty well.  Here are some additional considerations.

AC reduces resource drain.  Resource management is a big part of every edition of D&D to date, and AC is crucial to this.  Many players undervalue defense generally, and AC particularly, by overstating the "best defense is a good offense" axiom.  For instance, martial-type characters often dismiss using shields because such reduce their gross damage output. There are a number of reasons why defense in general, and AC in particular, should not be so ignored, but one of the biggest is that it greatly reduces the rate at which healing resources are expended by a party.  Hit points, healing effects (including spells and potions) are almost always expended resources (with a few generally very limited and/or expensive exceptions).  By far the most commonly useful way to avoid damage is AC. In most situations, you can safely assume that the higher your AC is, the less frequently you will need to expend those healing resources.
For spellcasters, AC improves offense as well as defense.  Because taking damage can interrupt casting a spell, thereby losing a precious offensive action, any individual who depends upon spellcasting for offense becomes dependent on good defenses.  Albeit with exceptions, divine casters get better AC and other defenses than arcane casters, and this is an enormous edge (generally counterbalanced by weaker offensive spells).  There are defenses other than AC, particularly the "miss chance" provided by concealment and certain magical effects.  "Miss chance" is attractive because unlike AC it can't be overwhelmed by high attack bonuses, but a prepared opponent can generally overcome such defenses.
Keep in mind the different kinds of AC.  Armor Class is indeed powerful, but often you have to be a bit more specific about it.  There are two basic types of AC, "touch AC" (which generally comes from actively avoiding attacks) and "flat-footed AC" (which generally comes from passive protection).  In most situations both contribute to defense but often one or the other will be bypassed.  There are many situations where a low (total) AC character is better defended against a particular attack than a high (total) AC character.
Comment: Answer the question independently of other answers. Stack Exchange doesn't very well handle follow-up answers that merely add useful info, but don't actually answer the question. If you need to, just summarise the answer briefly and link to another if you want to provide credit.


Is it safe to use fallocate --dig-holes while being modified

Question: Is it safe to use fallocate --dig-holes on a file while it is being modified/written?  For example on a QCOW2 image opened by a KVM guest?
Comment: That depends on how much data loss you consider "safe"...
Comment: The hope would be none.  So I take it the answer is no.  Is that any different on Btrfs because it's transnational?
Comment: It's not safe to do _anything_ to a disk image outside the VM while the VM is using it. The filesystem is irrelevant.
Comment: That's an answer I'd accept and upvote if you post it.
Answer: I'd generally say no. If the file is an image mounted to a VM, you can try TRIM (e.g., fstrim -a) instead. Strictly speaking, this is not an equivalent (TRIM can also free space of some deleted file that is not zeroed), but this might be what you want.
It might be safe in some specific cases, but I wouldn't rely on it. For example, when some data are  sequentially streamed to a file without any preallocation, it sounds potentially safe. But since this is not implied by documentation and it would rely only on implementation, I strongly don't recommend it.
What can go wrong? Imagine the app/VM is going to overwrite some zeroed block and you concurrently run fallocate -d. The race can look like:

Fallocate sees a block of zeroes, so it decides to dig a hole there.
Another application/VM writes to the zeroed block some data.
Fallocate digs a hole in the block.

It might sound like there is a small timeframe between 1 and 3. Maybe it is true, but fallocate might want to free multiple subsequent blocks at once. (Not sure, I haven't checked the implementation, but even if the opposite is true, you cannot rely on it in the future.) This can increase the delay between 1 and 3, making the race condition much more likely.


Safe Contract Signature

Question: Can a Gnosis safe contract be owner of another Gnosis Safe contract ? Does it works ? if it works, how to integrate contract-signature with it ?
Answer: Yes, it is possible. Simply add the address of a safe as the owner to another safe and it should work normally.
Regarding contract signature, what would you like to do? It should be able to broadcast any transactions like it would with any other Safe. If you are referring to EIP-712 (or EIP-1271), Safe contracts support them natively.
Hope it helps,
Louis

Safe Contract Signature


How to show the years b/w to specific dates

Question: I am working on a php. In my project when a student register, he chooses starting and ending date of his course e.g (2012/06/05) - (2015/06/25). Now he submit his fees after every six months. now what I want to do is that when student fill the form to submit his fees he only have to select the years from those years for which he will do the course i.e 2012,2013,2014 and 2015. How to do that.
So can anyone please show me someway out there.
Thanks in advance.
Answer: Try this:
$begin = date('Y', strtotime('2012-06-05'));
$end   = date('Y', strtotime('2015-06-25'));
$years = array();

while($begin <= $end){
  $years[] = $begin++;
}

echo "
";
print_r($years);

it gives:
Array
(
  [0] => 2012
  [1] => 2013
  [2] => 2014
  [3] => 2015
)

This $years is an array containing all the years between the two dates entered by the user.
Hope this helps.
Peace! xD
Answer: You need to use strtotime() for getting year from start and end date as and than get all years between two years as:
$start = date('Y', strtotime('2012/06/05'));
$end   = date('Y', strtotime('2015/06/25'));

$years = array();
for ($end = $start; $end < date('Y'); $end++) {
    $years[] = $end;
}

echo "
";
echo implode(",",$years); //2012,2013,2014,2015

Answer: This can be done very easy:
$start = new DateTime('2012/01/20');
$end = new DateTime('2015/01/20');

$years = range($start->format('Y'), $end->format('Y'));

<select name="year">
<?php foreach ($years as $year): ?>
    <option value="<?= $year; ?>"><?= $year; ?></option>
<?php endforeach; ?>
</select>