text:
Q: Is there still no known origin of the law of inertia? To quote Feynman at about the 21 minute mark of the first Messenger Lecture on The Character of Physical Law,

...that the motion to keep it going in a straight line has no known reason.  The reason why things coast forever has never been found out.  The law of inertia has no known origin.

This lecture was given in year 1964.  I'm curious if there has been any progress since then to understanding the origin of the law of inertia.  If yes, if a layman explanation can be provided.
Edit 1, adding the definition of scientific law for discussion in comments.  From Kosso (2011, pp 8):

One more term should be clarified, ''law''. Theories differ in terms of their generality. The big bang theory, for example, is about a singular, unique event. It is not general at all, despite being about the entire universe. The theory of gravity, either the Newtonian or relativistic version, is very general. It is about all objects with mass and their resulting attraction. The most general theories, including the theory of gravity, are laws. In other words, laws are theories of a particular kind, the ones that identify whole categories of things and describe their relations in the most general terms. Laws start with the word ''all'', as in, All this are that, All massive objects are attracted to each other.
Being a law has nothing to do with being well-tested or generally accepted by the community of scientists. A theory is a law because of what it describes, not because of any circumstances of confirmation. And a theory is or is not a law from the beginning, even when it is first proposed, when it is a hypothesis. The status of law is not earned, nor does it rub off; it is inherent in the content of the claim. So neither ''theoretical'' nor ''law'' is about being true or false, or about being well-tested or speculative. ''Hypothetical'' is about that kind of thing.

See Kosso (2011) for the definitions of the terms Theory, Fact, and Hypothesis, if needed.
Edit 2, I acknowledge I do not know what definition Feynman held when using the term "law" in the Messenger Lecture (as I had quoted above).  It seems he also referred to it as the principle of inertia (The Feynman Lectures on Physics, Volume I, Chp 7, Sec 3 - Development of dynamics):

Galileo discovered a very remarkable fact about motion, which was essential for understanding these laws. That is the principle of inertia—if something is moving, with nothing touching it and completely undisturbed, it will go on forever, coasting at a uniform speed in a straight line. (Why does it keep on coasting? We do not know, but that is the way it is.)

An interesting side note, according to user Geremia (link):

Galileo, Newton, or even the medieval physicist Jean Buridan (1295-1358), who developed the notion of impetus, were not the first to discover the law of inertia.
The first was John Philoponus ("The Grammarian"), who lived in the late 5th and 2nd ½ of 6th century A.D.

Edit 3, I agree that no "Laws" of physics have a "known" reason.  But that is not the point of my question.  My question is whether or not any progress has been made on understanding the origin (i.e. the mechanisms underlying) the law of inertia.  For example, Darcy's Law can be derived from the Navier–Stokes equations. The Navier-Stokes equations arise from applying Isaac Newton's second law to fluid motion. I suppose this regression to more fundamental mechanisms or reasons can go ad infinitum (as explained here by Feynman. He also addresses the "why" question, Aaron Stevens).
Edit 4, I am not making Feynman into a Pope nor am I appealing to his authority.  He has simply made a statement about the current understanding of the law of inertia.  Of course, I attributed his statement to him.  I then asked a question about his statement. I made no assumption as to whether his statement was correct or not.  If anyone cared to make an answer pointing out his statement is incorrect I would be grateful to hear it.

A: The quote by Feynman is stating the obvious, that the law of inertia has no deeper explanation, other than when used, together with other laws, principles and postulates to set up a theoretical physical model for mechanics.
In general laws, principles, postulates  are extra axioms used in physics models so that the theoretical model fits observations and predicts future ones.
At the moment there does not exist a Theory Of Everything (TOE)for physics. If one such does emerge in the future, it could be possible that the number of physics laws,postulates, principles will be reduced to that one mathematical theory and its axioms. We have not reached that level, if it is ever reached. In such a TOE it could be that inertia would be  theorem and not an axiom, i.e. it would be more in mathematical formulation  economical to have it as a theorem. (In a theory the place of axioms and theorems can be interchanged, one chooses the simplest mathematically as axioms)

A: For me a lot of the answers here went over my head but I think I have an easy explanation for anyone else in my situation -- Relativity.
There is no absolute frame of reference which means that something is only "Moving" relative to something else.  Nothing is ever moving in it's own frame of reference unless it is being acted upon by another force. (I'm not sure the concept of motion exists in your own frame of reference, only acceleration.  That would make a good follow-up question)
As an example: If you fire a bullet from your spaceship, as soon as the acceleration stops the bullet is just sitting in space in it's own frame of reference and the ship is moving away from it.
If the bullet "Slowed" and you looked at it from the bullet's frame of reference it would look like the ship was accelerating towards the bullet--Why would it do that?  Wouldn't it just stay still?  If it turned (not in a straight line) it would look as though the ship suddenly accelerated to the side.  The only sensible option is for both to sit still until something else accelerates them.
Once you think about it this way and subtract some earthbound constants like friction, gravity and a very commonly accepted point of reference it would be surprising anyone would expect any different behavior.
So in essence, the part of the Law of inertia that says a body in motion remains in motion is the exact same thing as the first part "A body at rest remains at rest".  There is no difference between the two except for where the viewer is located.

A: The law of inertia can be expressed in terms of spacetime geometry as, "free massive particles follow timelike geodesics". The geodesic equation is an expression of the least action principle. Thus to say, "a free particle obeys the law of inertia", is the same as to say, "a free particle obeys the least action principle".
Another representation of the law of inertia using the least action principle is the Noether theorem stating that a momentum of a free particle is conserved in a space with a continuous translation symmetry.
The origin of the least (or more precisely, stationary) action principle is in quantum mechanics, "if we consider the classical description as a limiting case of the quantum formalism of path integration, in which stationary paths are obtained as a result of interference of amplitudes along all possible paths."  (Principle of Least Action)
Thus the origin of the law of inertia is in the wave properties of matter. The stationary path of inertial motion is a result of a constructive interference of quantum waves (similar to the Fermat's Principle in optics).

A: To answer this question properly requires probing deep - an exercise in deconstructing space and time. This is, in fact, what mathematicians have done over the past century or more, separating out the different elements of the infrastructure into different layers. From the vantage point of a programmer, this frame of mind is quite familiar: one starts with a base type, and builds from it, derived types, each one adding more infrastructure onto the type it is derived from.
At the rock bottom layer is a set of points. That's Layer 0.
They are endowed with a "topology" which gives them sufficient structure to determine such things as "continuity", "contiguity", "connectedness", "interiors", "boundaries", and so forth. Geometry, pursued at this level, is sometimes called "rubber sheet geometry", because at this low level there is no concept of congruence, shape or similarity. The topological structure is Layer 1. In this layer, there is also enough to conceive of the notion of continuous sequences of points, called "paths" or "curves" or "trajectories".
The geometry should be sufficiently structured to support the notion of "rate of change", so we can talk about gradients, velocities and so forth. The additional structure required is called the structure of a "differential manifold". It makes it so that the geometry can be displayed in a series of maps (an "atlas") that consistently mesh together. So, in the vicinity of a point, it looks and acts much like the continuum of an ordinary geometry on which you can do calculus.
That's Layer 2. In this geometry, at Layer 2, there is now not only enough infrastructure to conceive of a notion of paths, but also such notions as its "gradient" or "speed".
Classically, a geometry is purely spatial and involves only spatial relations. However, since the time (at least) of Galileo, who entertained the idea of a symmetry transform that mixed the time coordinate in with the spatial coordinates (that transform now being called a "boost"; i.e. a transform from one frame to another that is moving uniformly with respect to it), the two have been intertwined. This marriage of the two was essentially an elopement that was not fully consummated until around 300 years later, when it also emerged that a "boost" also mixes spatial coordinates in with the time coordinate and alters temporal relations such that what is deemed to be simultaneous, when boosting to another frame, is no longer simultaneous.
The point of the last paragraph is that the notion of geometry necessarily expands to include time, and so would be rightly called a "chrono-geometry"; the object of its study no longer being a "space" but a "space-time".
In a space-time, one not only has the "paths" of purely spatial geometry, but also sequences of points that ascend in time, which are called "trajectories" or "worldlines". The "gradient" of a path becomes the "velocity" of a worldline. So, now we have enough to talk about motion and to do calculus with it. It is at Layer 2, that the basic law of kinematics emerges: Velocity = rate of change of Position with respect to time.
However, at Layer 2, there is not enough infrastructure speak of the "curvature" of a path or the "acceleration" of a worldline! That requires additional infrastructure - and (voilá!) that's the very infrastructure your question pertains to!
It's called a "connection". A connection does two things. For purely spatial geometries, it endows paths with a notion of straightness by determining whether a direction remains "the same" at different points along the path. A path that keeps the same direction is one that is then deemed to be "straight" and is called a "geodesic" (technically, it is only called an "autoparallel", the term "geodesic" only pertains to Layer 4 below). For the curved surface of the Earth, for instance, the geodesics at two nearby points on the equator heading north would be initially parallel but would both proceed along their respective lines of longitude to the north pole, where they converge and meet. The example of such curves on the Earth is the origin of the term "geodesic".
The extra structure of a connection gives you Layer 3.
In the space surrounding the Earth, the spatial geodesics are well-approximated by the paths taken by rays of light, so that a light beam traces out a spatial geodesic.
For trajectories, the connection determines which motions keep the "same velocity" from one time to the next; i.e. which trajectories are non-accelerating or "inertial". Out of all the worldlines in the chronogeometry, the connection determines a subset of them to be inertial. These, too, are called geodesics.
The chief property of the connection is that through each point in each direction runs a unique geodesic.
The question you're asking amounts to the question: "where does the connection come from" or "what determines the connection"? That is, out of all the possible worldlines or paths traversing the space-time, why are some of them straight or inertial and others not?
In Physics, the extra structure is simply assumed to be an extra layer of infrastructure that's just there. In most physical theories, a chrono-geometry with layers 0, 1, 2 and 3 is generally assumed to be there as a precondition to whatever theory is posed.
For dynamic and geometric theories of gravity, the connection is itself subject to dynamical laws that determine how it changes from one point in time to the next. But that it actually be there, in the first place, is assumed at the outset, not explained away. The outstanding example of this is the Einstein Equations. The Einstein equations are formulated on top of a geometry endowed with Layer 3 infrastructure, so the existence of Layer 3 is there as a precondition. The theory assumes that there is a connection, the equations help determine what it is. But the fact that there is that extra infrastructure of a connection is there, is an assumption or precondition. Left unanswered is why there should be any Layer 3 infrastructure at all.
So, when you're asking "what determines which motions are inertial", whether you realize it or not, you're really also asking about where all these other parts of what comprise Layer 3 come from. That includes the question: what determines which curves are "straight"?
Finally, at Layer 4, one has the "metric". For spatial geometry, this provides the additional infrastructure of angles, congruence, path length (and area and volume), orthogonality and a semblance of the Pythagorean relation. For chrono-geometries it provides the infrastructure needed for the concept of duration, time measure, and of a "space-time orthogonality" relation.
(A spatial direction in a chrono-geometry is orthogonal to a temporal direction if a path oriented in that direction is seen as being "simultaneous" from the vantage point of someone on a trajectory oriented in the time-like direction. So space-time orthogonality gives us a local version of "simultaneity".)
To reach Layer 4 from Layer 2, it is enough to just add in a metric. A metric determines a connection and notions of geodesic and inertiality by the "least distance" and "greatest time" principles.
For paths in a purely spatial geometry with a metric, the geodesics are the paths that provide the shortest connection between its nearby points. I say "nearby" with the example of the Earth in mind. The Greenwich mean line is roughly a geodesic, that wraps around the other side of the world as the 180 degree line. Any two points on it can be traversed between in two ways: one directly, and the other by going the opposite way around the world. Only the direct way is the "shortest" way.
For chrono-geometries, the corresponding notion is that of the "inertial" worldline. These are the worldlines that connect two points on its path in the "greatest" amount of time. Thus, for instance, an inertial motion between the Earth and the moon would register more clock time than a motion that quickly accelerates to a high speed upon leaving the Earth and quickly decelerates back to a stop, upon reaching the moon. The amount of time dilation for the worldline is directly related to how much from inertial the worldline deviated.
When the structure of a metric is added directly onto Layer 2 to reach Layer 4, skipping the intermediate stage at Layer 3, the connection derived from the metric is called a "Levi-Civita Connection" and gives you the required infrastructure for Layer 3. Such a geometry is called a Riemannian manifold - if it is a purely spatial geometry. If it is a chrono-geometry, it's called Lorentzian, which is a subclass of what are called the "pseudo-Riemannian" manifolds.
Pseudo-Riemannian manifolds are a larger class of chrono-geometries that permit two or more time-like dimensions, while Lorentzian manifolds have only one, and Riemannian manifolds have none, but only spatial dimensions.
The space-like or time-like nature of a dimension is determined by the metric itself. The metric gives you the approximate semblance of a Cartesian coordinate grid surrounding each point (the prime example, of course, being a segment of the Earth's surface when it is mapped on a flat sheet with a coordinate grid) ... but with the proviso that the Pythagorean relation goes like $α(Δx² + Δy² + Δz²) - β(Δt²)$ for suitable coefficients $α$ and $β$ (e.g. $α = 1$, $β = c²$). The time-like dimensions carry signs that are opposite from the space-like dimensions in the Pythagorean relation.
The distinction between space-like and time-like directions is metrical: the concept exists only at Layer 4. There isn't enough infrastructure at Layer 3 to tell space-like apart from time-like.
A good down-to-Earth example of this, by the way (literally), is this: what happens if you were to take the flight distances between 4 cities (like New York, Chicago, Miami and Houston) and treat the flight paths as straight lines? That is, what if you were to pretend to be a Flat Earther and pretend that all flight paths were not just geodesics but outright straight lines? Could you fit the distances onto a tetrahedron in a Euclidean geometry? The answer turns out to be no! If you actually look up the distances and run through the calculations, you'll find that they require a 2+1 dimensional geometry to fit into.
(If you expand the exercise to include two more cities, like Los Angeles and Seattle, and treat the 15 flight paths all as straight lines, you may very well find that the 15 distances require a 3+2 dimensional geometry to fit into and that they won't fit in either a 5+0 dimensional space, nor even a 4+1 dimensional space!)
So, another answer to your question is to skip Layer 3 and go straight to Layer 4. The question now becomes: "why is there any metric at all?"
It is possible to introduce both the metric and connection independently onto Layer 2. Then one can distinguish between the "native" connection and the Levi-Civita connection given to you by the metric. The difference between the two connections is then called the "contorsion". If we require that metrical relations be preserved along the geodesics (and inertial worldlines) then the connection is called "metrical" and the geometry, itself, is called Riemann-Cartan.
The distinction between "autoparallel" and "geodesic" is here. If the connection is Levi-Civita, then the autoparallel curves are the same as the geodesics. Otherwise, if both a connection and metric are present - as independent objects - then geodesics and autoparallel curves generally do not coincide. It will be the autoparallel curves that are "inertial" and "straight", while the geodesics will be the shortest or longest-duration curves, but not generally inertial or straight. "Autoparallel" is the more general term, since it applies to both Level 3 and Level 4, while "geodesic" only has meaning at Level 4.
There is also an intermediate layer, Layer 3½, which includes only the conformal part of the metric. This is the metric up to change in scale (and sign). This is enough infrastructure to see the distinction between spatial and temporal dimensions, which Layer 3 can't see, enough to recognize geometric similarity and angles (but not congruence or length), and also enough to distinguish which directions are space-like, past-pointing or future-pointing, but not enough to allow you to define a unique Levi-Civita connection, nor an unambiguous notion of "geodesic", but only "auto-parallel".
In addition, it is also possible to only go part way with Layer 4, by allowing the metric to be of rank less than 4. The geometry for non-relativistic theory is a Newton-Cartan chrono-geometry, its metric being only rank 1: $Δt^2$ ... which corresponds to $α = 0$, $β = 1$. There is no notion of spatial geometry, per se, native to this structure. Instead, one has to resort to the inverse metric, which is given by the structure
$$\frac{1}{α} \left(\left(\frac{∂}{∂x}\right)^2 + \left(\frac{∂}{∂y}\right)^2 + \left(\frac{∂}{∂z}\right)^2\right) - \frac{1}{β} \left(\frac{∂}{∂t}\right)^2$$
rescale it (by multiplying by $αβ$) to
$$β \left(\left(\frac{∂}{∂x}\right)^2 + \left(\frac{∂}{∂y}\right)^2 + \left(\frac{∂}{∂z}\right)^2\right) - α \left(\frac{∂}{∂t}\right)^2$$
and then apply $(α,β) = (0,1)$ to get the Poisson Operator:
$$\left(\frac{∂}{∂x}\right)^2 + \left(\frac{∂}{∂y}\right)^2 + \left(\frac{∂}{∂z}\right)^2.$$
The metric and its inverse have to be treated as independent, though related, objects. The Newton-Cartan space is the chrono-geometry which has these two structures added onto it. This is a generalization of the Riemann-Cartan space-times of Layer 4. Unlike the Levi-Civita connection, a connection in a Newton-Cartan space-time is not uniquely determined by the metric.
This can be ameliorated by embedding the geometry into a 5D geometry equipped with an extra 1D invariant
$$Δx² + Δy² + Δz² + 2β Δt Δu + αβ Δu² = 0$$
with the Proper Time invariant given by:
$$Δs ≡ Δt + α Δu.$$
For each value of $(α,β)$ the 4D chronogeometry embeds into the 5D where the metrical relation/constraint, upon substituting for $Δu$, would reduce to the relation
$$β Δs² = β Δt² - α (Δx² + Δy² + Δz²)$$
suitable for use when $β ≠ 0$. So, $s$ plays the role of historical time and is invariant. For $α = 0$ and $β ≠ 0$, it gives you a 5D geometry suitable for Newtonian physics - called the Bargmann Geometry.
The curved version of this metric is used in 5D cosmology, for $αβ ≠ 0$ (which means both Euclidean 4D and Lorentzian 3+1D), because it can be equivalently described as the metric obtained by substituting the proper time $s$ for $u$ as:
$$Δx² + Δy² + Δz² + \frac{β}{α} (Δs² - Δt²) = Re \left(Δx² + Δy² + Δz² - \frac{β}{α} \left(Δ(t + is)\right)^2\right)$$
a metric with complex time $t + is$. It changes between locally Euclidean and locally Minkowski signature when the sign of $αβ$ changes.
Why am I personally interested, also, in the question of the origin of "inertia"? Well, you've seen the recent reports and videos released from the Pentagon about those strange vehicles that zip about with extremely fast and sharp stop and go actions, leaving behind no sound, turbulence or wake, making a complete mockery of the law of inertia, almost as if they're trying to showboat and flaunt it. Whatever is driving those vehicles, it is as if they found a way to actually shield the effect of inertia - not just in the vehicle itself, but in the surrounding space.
(The reports go much further with this, indicating that the craft were able to start at tens of miles up in the air, zip suddenly down to a few feet over the ocean and come to a dead stop - all in a fraction of a second - without any sound, sonic boom, wake or friction burn.)
Never mind whether it is for real or not. Just the mere idea sparks curiosity and raises the question: whether and how it is possible to accomplish that within the known geometric framework just laid out. Within that framework, it's easy to describe: the vehicles are messing around with the infrastructure provided at Layer 3, altering the connection in such a way as to make the fast stop-and-go motion the one that is inertial at each point along its path, instead of the stationary or slow-moving motions ordinary objects would take in that same setting.
Do we need to go outside known physics for this, and are we seeing a demonstration of that as-yet-unknown physics being flaunted before us?
So, the question you're asking now gets put at the top of the heap: is there something more that determines the connection than just the Einstein law of gravity? Something that can actually be engineered in the way that allows one to shield from the effects of inertia at rapid acceleration and deceleration both within the vehicle and in the area surrounding it?

A: The law of inertia can be seen as the result of the translation invariance of the laws of physics. Of course it's a matter of taste whether you think translation invariance makes a more intuitively appealing axiom than the law of inertia itself.

A: This is a great question.
Unfortunately, the best answers don't usually answer the question. Bringing up the equation $E=mc^2$ and the Higgs Mechanism are important parts of explaining mass, but neither actually addresses the question of where does the experience of Inertia come from?
I think I can answer your question, but it starts with a short story.
In 2003, I was sitting in my EM class in college, studying waves in a wave guides, when I had the Aha! moment of a lifetime — Mass is a wave property.
Here's how I originally saw it:
Take the dispersion relationship of a wave inside of a waveguide. This relationship relates the frequency of the wave $\omega$ with the wavelength, parameterized in terms of wavenumber $k$. In free space, these are related simply by $\omega = kc$, but in a waveguide, there's a more complicated relationship:
$$\omega^2 = \left(kc\right)^2 + \left(\frac{\mu\pi c}{a}\right)^2 + \left(\frac{\nu\pi c}{b}\right)^2$$
The waveguide induces a standing wave which normally doesn't exist in free space propagation, and the last two terms represent how the standing wave contributes to the frequency of the wave. The values $\mu$ and $\nu$ are integers parameterizing a standing wave inside of the waveguide.
If we imagine that this wave is the wave of a single photon, then we know that the energy of that photon is given by $E=\hbar\omega$, and the momentum of a photon is given by $p=\hbar k$.  Multiply the dispersion relationship by $\hbar^2$, in order to determine a relationship between the energy and momentum of the photon inside of the waveguide.
$$E^2 = \left(pc\right)^2 +\left(\frac{\hbar \mu\pi c}{a}\right)^2+\left(\frac{\hbar \nu\pi c}{b}\right)^2$$
Relate this expression to the energy, momentum, and mass of a relativistic particle:
$$E^2 = \left(pc\right)^2 + \left(mc^2\right)^2$$
We can see that the energy of mass is directly associated with the standing wave terms of this equation:
$$mc^2 = \left(\frac{\hbar \mu\pi c}{a}\right)^2+\left(\frac{\hbar \nu\pi c}{b}\right)^2$$
Now, that's way too much math to get to the actual punchline: Mass is associated with the energy of a standing wave. If you think about it, this makes a lot of sense: A standing wave has energy, and it's at rest (on average).
Mass as a particle property is axiomatic — you can't dig any deeper than just stating that it just is. But if mass is a property of waves, then perhaps we can figure out what it is that causes the experience of inertia, in terms of waves.  Turns out, once you make this conceptual leap, the rest sort of unfolds quite nicely.
I've recently made a video walking through this explanation, and I encourage you to watch it.  Here's the gist:

*

*Mass is something we experience in two primary ways: Inertia and Gravity

*Both of these experiences can be described as a Force that is actively generated by the massive object in response to acceleration (or an equivalently changing reference frame in the case of Gravity).

*We know that Mass is related to Energy, through the equation $E=mc^2$.  But how does energy actively generate a force in response to acceleration?

*Well, the equation $E=mc^2$ is talking about Energy that is at rest.  So first we answer the question: how is the energy at rest?

*We can think of this Energy as the Energy of a wave, like an Electromagnetic wave.  We might imagine that the Energy is bouncing around inside of a box.   The box is at rest, and the Energy stays inside of the box, so we can think of this Energy as being at rest (on average), even if it is instantaneously in motion while inside the box.

*In order for the Energy to stay inside of the box, we may imagine that it is reflecting off of the walls of the box.  Each reflection transfers momentum to the box.  These momentum transfers will cancel out, because any reflection on one side of the box will eventually be countered by another reflection on the other side of the box.

*If you begin to accelerate the box, what happens with those reflections?

*They experience a doppler shift.  The doppler shift will depend on which way the reflective surface is moving.  For surfaces moving away, the energy will be redshifted.  For surfaces moving toward, it will be blueshifted.

*For an accelerating box, the momentum transferred by reflection no longer cancels out.  Momentum moving in the direction of acceleration will be redshifted, while Momentum moving opposite the direction of acceleration will be blueshifted.

*The average momentum transferred to the box over time is now non-zero, and it is oriented in the direction which opposes acceleration.  The energy inside of the box is actively creating a force opposing acceleration.  That's Inertia.

*In a gravitational field, we'll find that we again have non-zero momentum transferred to the box over time.  Energy moving toward the gravitational source is blueshifted, and energy moving away is redshifted.  The energy inside of the box is actively creating a force pushing the box toward the gravitating source.

*This construction works without the box, or reflections.  If you think of a Standing Wave in terms of being decomposed into two oppositely oriented waves, then you can imagine that accelerating this system of two waves would involve blueshifting one of the waves and redshifting the other, leaving an overall component of momentum opposing the acceleration.

A: There is still no answer to the question of why the law of inertia should hold (and you can say the same of every law from which it is supposed to be deduced). But suppose it didn't hold. What would this imply for the motion of an object in, say, empty space?
The law of inertia states that the momentum of the object stays the same forever, as long as no force acts on it. So the velocity vector of the object is constant during its motion. So what will happen if this is not the case?
I'm sure you can imagine that if the momentum of the object is not constant during its motion, the object would behave in a way that we have never seen. So while the "why" of this law is not known, it certainly is backed up by our observation. The world would look very different. Maybe in a parallel Universe, the law of inertia doesn't hold. Try to imagine how and if we could live there. One can say that the law of inertia is an empirical law, a law based on our observations.
Of course, the (ultimate) base of all our Natural laws is based on observation but empirical laws "beg" for a deeper explanation, like the empirical Bohr model for the energy levels in an atom was totally accounted for by quantum mechanics (which was fully developed years later) by means of the Schrödinger equation. There is no doubt though that Bohr played a role in the development of QM. But in the case of the law of inertia, there is no deeper theory (not yet, and I doubt there will ever be) that explains this law.

A: If one imagines on the origin of the universe as coming from nothing, one immediately realize that:

*

*The net energy in the universe must be zero and the universe should be a free meal, i.e, if some energy is created by stretching up something at a point A, then, somewhere in the universe this thing (or equivalent) is going to be stretched down at a point B. This is the principle of conservation of energy in a nutshell.

*The total amount of "movement" in the universe must be zero, not only because energy is zero, but because there is nowhere for the universe to go as well, i.e, if something is moving right next to point A, another thing(s) must be moving left near point B to counterbalance this motion. This is the principle of conservation of momentum in another nutshell.
People in the vicinity of point A or B may observe the existence of energy and motion, but it just doesn't exist at the big scale. Therefore, if a state of motion is observed somewhere, such a state is demanded to remain the same until it is passed or transferred into another object. This explains why the state of motion should persist (half of the inertia principle). What this doesn't explain, is why the motion appears to resist the change, in other words, why motion is not transferred from object 1 to object 2 at a zero time (the other half).
The fact is that there is another principle that seems to be a part of the universe's behavior (I don't know the reason why) but is well established.

*The transfer of any peace of information (yes, motion is information) cannot be done at a speed higher than the speed of light in vacuum $c$.

Principle 3) demands motion to be passed at a finite amount of time, making an object appear to resist gaining or losing motion. Combining all this together, one realizes that inertia is a consequence of the basic structure of the universe.

A: Well, i think that a motivation for why bodies not subjected to forces obey the inertia principle can be stated: our universe has a space-time that, in this condition, looks homogeneus and isotropic.
If anyone tries to write up the equation of motion for a body moving in such space-time, a lot of properties are strictly forbidden and the only solution left is a uniform straight motion.
However, note that this answer is not totally complete, because now the focus has been shifted to the reason why the space-time of our universe looks exactly homogeneus and isotropic, in absence of charges or fields (i would add).

A: Answering this question really requires a more philosophical take. For one, insofar at least as physics is concerned, the only way you can talk of an "origin" of something is to derive it from a more basic set of principles. Yet that assumes that there is such a more basic set of principles, and that may not be the case, and it's reasonable to imagine it is not the case: there can very easily be a finite set of groundwork, complete principles sufficient to generate all phenomena in the Universe.
The reason we can think this is that it is logically possible, and to show that we need only exhibit a consistent but imaginary example. Consider a Universe composed of a single kind of point particle whose laws of motion were literally just Newton's laws of motion, perhaps with some suitable forces. It's not our Universe, but it's a possible one (c.f. Modal logic). If you were to pose this question in such a Universe, it would have no answer in the way physics, as a mode of study, conceives of such a thing, because these would be its most basic laws with no deeper ones underlying them.
Hence, the only way physics would provide an answer to this is if it turns out that in the real Universe, there is a deeper set of laws in which inertia is not a fundamental phenomenon. Since we don't have a set of laws we can confide in as being complete, it is still possible, but then again, it may not be.
And past that, the question effectively amounts to "why is the Universe we live in the way it is?" even when all discoverable explanations have been exhausted, and this likely goes out of the realm of empirical science altogether. Empirical science does have limitations, and here is it (and those that say otherwise, and/or that say that nothing else is "worth" asking about are, in my mind, of a rather limited, if not hubristic, mindset, but that's for another discussion in likely another forum).
OK, this doesn't really answer the question. The answer is: "right now, we don't know. Moreover, it is reasonable to suspect that we may not ever be able to 'know', and we may very well come to a point where that is the most reasonable conclusion given the balance of evidence that will be available at that time."

A: The main metaphysical point was made in the answer of anna v: in any theory based on mathematical reasoning the role of axioms and theorems (i.e. that which can be deduced from the axioms) can be interchanged. We normally put as axioms the simplest things we can that are sufficient to allow the theorems to be deduced. Determining which are simpler can sometimes be subjective or a matter of taste. Since the law of inertia is already a fairly simple statement, most other statements will be deemed more complicated and therefore less deserving of being called axiomatic in any given formulation of physics.
If we don't want to make the law of inertia axiomatic, then we have a choice of other things which we might argue are simple enough to warrant being used as axioms, from which inertia can be deduced. Here are some.

*

*Symmetry of the Lagrangian with respect to translation in time and space (in classical mechanics), leading to conservation of energy and momentum.

*The claim that the worldline of an object in free fall is a timelike geodesic of spacetime. (Such a worldline can also be described as a line of maximal proper time between any given pair of events on the line.)

*Like (1.) but now invoking quantum mechanics.
I have a slight preference for (2) over (1) here, but of course since the world is quantum physical, one might argue that no classical reasoning can be adequate. However, it seems to me that the law of inertia could be asserted as axiomatic in any  formulation of physics, and thus used to somewhat reduce the set of other things one would have to assert in order to give a complete statement of one's theory, whether present-day quantum theory or any future development.


text:
Q: Send Data as props to other component using history.push So I have my BikeCardContainer in which when I click on button it should navigate to other page and send current object data
handleClick() {
console.log(this.props.bikes);
this.props.propdata.history.push({
  pathname: '/Checkout',
  state: this.props.bikes
});

}
and I want to know how to access this data in receiving page.
    class Checkout extends Component {
  constructor(props) {
    super(props);
    console.log(this.props.bikes)
    this.state = {};
    this.confirmClick = this.confirmClick.bind(this);
    this.goBackClick = this.goBackClick.bind(this);
  }

A: Pass like this
handleClick() {
console.log(this.props.bikes);
this.props.history.push({
  pathname: '/Checkout',
  state: this.props.bikes
});

Access like this
const location = useLocation();
console.log(location);

in Class component
this.props.location

redpajama_set_name: RedPajamaStackExchange


text:
Q: If the row of a matrix is divided by a scalar, is the determinent multiplied by the scalar? Right now I'm a bit confused by my textbook. Where my textbook defines that, when a row is multiplied by a scalar, then the determinant is also multiplied by a scalar
textbook definition
Where I am getting confused, is that a youtube video that I am watching, and following gives me the correct answer is giving an opposite definition.
Picture of Conflicting definition
Following the youtube video's definition gives me the correct answer, but seems to be the exact opposite of the website's definition.Example Problem where you can see that as I mulitply a row by a scalar (1/3), I multiply the determinant by (3) not (1/3), which gives me the correct answer.
Anyone know what am I misunderstanding here?

A: No, you might want to check your work.
If you multiply a row in the matrix by $k$, the determinant is ALSO multiplied by $k$.
Your work also agrees with this.
Let your original matrix be A and your new matrix be B.
You said that $\det(A) = 3\det(B)$, that's the same thing as saying $\det(B) = \frac{1}{3}\det(A)$.

A: If the row of a matrix is multiplied by a scalar, the determinant is also multiplied by that scalar.
The division you're seeing happens because, when we're finding the determinant of a matrix, we don't want it to change at all.
So you might write, for example, that
$$
   \det \begin{bmatrix}1 & 2 \\ 3 & 4\end{bmatrix} =\frac1{100} \det \begin{bmatrix}100 & 200 \\ 3 & 4\end{bmatrix}.
$$
When we multiply the first row by $100$, we multiply the determinant by $100$, so we introduce a factor of $\frac1{100}$ to keep the overall expression the same.
This is equivalent to writing
$$
   \det \begin{bmatrix}100 & 200 \\ 3 & 4\end{bmatrix} = 100\det \begin{bmatrix}1 & 2 \\ 3 & 4\end{bmatrix}.
$$

A: *

*If you multiply a row of a matrix by a constant $k$ then the determinant of the new matrix is $k$ times the determinant of the old matrix.

*If when trying to calculate the determinant of the old matrix you divide a row by a constant $c \not= 0$ then the determinant of the old matrix is $c$ times the determinant of the new matrix.
These two statements are basically saying the same thing with $c = \frac1k$ and are consistent with each other.

A: The rule is
$$
\det(a_1,\ldots,\lambda a_i,\ldots,a_n) = \lambda\det(a_1,\ldots,a_n).
$$
Hence,
$$
\det(a_1,\ldots,a_n) = c\cdot \det(a_1,\ldots,\frac 1ca_i,\ldots,a_n).
$$


text:
Q: toggle modal screen from header react native Hi I want to toggle a transparent modal screen from the header button, im using hooks
Heres my stack component
function MyStack(props) {

  const [modalvisble, setModalvisble] = useState(false)
  ToggleModal = () => {
    console.log(modalvisble)
    setModalvisble(!modalvisble)
  }
  return (
    <NavigationContainer>
      <Stack.Navigator
        initialRouteName="MyTabs"
        screenOptions={{
          header: ({ ToggleModal }) => {
            return (
              <Header
              ToggleModal={()=>ToggleModal}
              />
            )
          },
          cardStyle: { backgroundColor: 'rgba(52, 52, 52, 0.8)',},
          cardStyleInterpolator: ({ current: { progress } }) => ({
            cardStyle: {
              opacity: progress.interpolate({
                inputRange: [0, 0.5, 0.9, 1],
                outputRange: [0, 0.25, 0.7, 1],
              }),
              overlayStyle: {
                opacity: progress.interpolate({
                  inputRange: [0, 1],
                  outputRange: [0, .5],
                  extrapolate: 'identity',
                })
              }
            }
          })
        }}
        mode='modal'
      >
        <Stack.Screen
          name="MyTabs"
          component={MyTabs}
          options={{
          }}
        />
        <Stack.Screen name="ModalScreen" component={ModalBar} modalvisble={modalvisble} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

Header Component
function Header({ ToggleModal }) {

  //const navigation = useNavigation();
  // const toggleIsFocused = () => {
  //   selected ? navigation.navigate('Mytab') : navigation.navigate('ModalScreen')
  //   return toggleSelected;
  //  }
  return (
    <View>
        <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: 30, marginRight: 20, }}>
          <Text style={{ color: 'white', margin: 10, fontSize: 13 }}>User Name</Text>
          <TouchableOpacity

            //onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}
            onPress={ ToggleModal}
          />

        </View>
    </View>
  )
}

export default Header;

Modal Screen
function ModalBar({modalvisble}) {
  return (
    <Modal style={{ flex: 1, }} visible={modalvisble} />
  )
}

I try to pass function from parent component to child / or reverse, but still, do not work.
Goal is like using the user name icon to open modal screen for some info, and press again to close modal screen, with same button.
Thanks!!

A: First, ToggleModal={()=>ToggleModal} this won't actually call ToggleModal function. Instead you should write ToggleModal={() => ToggleModal()}, or just ToggleModal={ToggleModal}.
Second, you dont need to pass ({ ToggleModal }) => {...} as an argument. ToggleModal function is already defined and visible.
Last, you need to use setState(prevState => nextState) form of setState, because otherwise modalVisible will always be seen as true in that function (it won't update, unless you use useCallback) and the function will always set it to false. Here's the code setModalVisible(modalVisible => { return !modalVisible }).


text:
Q: Creating a text data frame from multiple XML files i am trying to create a single data frame in R, that contains the text from multiple xml files. I have tried to create a function that reads the xmls and uses the xml_text from the xml2 package. This is my code:
read_texts <- function(folder) {
  dir_ls(folder, glob = "*.xml") %>%
  map_dfr(
  read_xml(.) %>%
  xml_text(., trim = TRUE) %>%
  tibble()
)
}

read_texts_n <- Vectorize(read_texts)

read_texts_n("forfatterskab")

When I'm doing this I still get the error:
Error: `x` must be a string of length 1

How do I get the code to load my files. The aim is to make a single data frame, that contains all the text. I am not that experienced working with XML.

A: I don't think you need to Vectorize your function since you are using map_dfr.
Try using the below function.
library(xml2)

read_texts <- function(folder) {
  list.files(folder, pattern = '\\.xml$', full.names = TRUE) %>%
    map_dfr(~.x %>% read_xml() %>% xml_text(trim = TRUE) %>%tibble())
}

result <- read_texts_n("forfatterskab")

The only doubt I have is the way you pass the folder name. Usually, I would expect you pass a complete folder path to the function. Something like read_texts_n('Users/username/folder_name').


text:
Q: How to change wstring value in struct? I don't know how to change wstring value in struct .
I don't know where is my error.
do you help me ?
I can't understand why string value change success, wstring value change failed .
struct TestStruct{
  string falg1;
  wstring falg2;

  TestStruct setFlag1(string str ) {
    falg1 = str;
    return *this;
  }

  TestStruct setFlag2(wstring str ) {
    falg2 = str;
    return *this;
  }
};

int main(int argc,
         char ** argv) {

      TestStruct testStruct;
      testStruct.setFlag1("string")
                .setFlag2(L"Wstring");

      wcout << "string length:" << testStruct.falg1.size() << endl;
      wcout << "Wstring content:" << '[' << testStruct.falg2 << ']' << endl;
      wcout << "Wstring length:" << '[' << testStruct.falg2.size() << ']' << endl;
}

The output content is :
string length:6
Wstring content:[]
Wstring length:[0]

A: I am not sure why are you trying to return a copy of your struct, the code looks really weird. I would use a method returning nothing and then setting the flags works as expected:
#include <string>
#include <iostream>

struct TestStruct{
  std::string falg1;
  std::wstring falg2;

  void setFlag1(std::string str ) {
    falg1 = str;
  }

  void setFlag2(std::wstring str ) {
    falg2 = str;
  }
};

int main(int argc,
         char ** argv) {

      TestStruct testStruct;
      testStruct.setFlag1("string");
      testStruct.setFlag2(L"Wstring");

      std::wcout << "string length:" << testStruct.falg1.size() << std::endl;
      std::wcout << "Wstring content:" << '[' << testStruct.falg2 << ']' << std::endl;
      std::wcout << "Wstring length:" << '[' << testStruct.falg2.size() << ']' << std::endl;
}

Output:
string length:6
Wstring content:[Wstring]
Wstring length:[7]

As @Acanogua and @UnholySheep pointed out, it is also possible to return references and then chain the function calls as you tried in your example:
struct TestStruct{
  std::string falg1;
  std::wstring falg2;

  TestStruct& setFlag1(std::string str ) {
    falg1 = str;
    return *this;
  }

  TestStruct& setFlag2(std::wstring str ) {
    falg2 = str;
    return *this;
  }
};

int main(int argc,
         char ** argv) {

      TestStruct testStruct;
      testStruct.setFlag1("string").setFlag2(L"Wstring");

      std::wcout << "string length:" << testStruct.falg1.size() << std::endl;
      std::wcout << "Wstring content:" << '[' << testStruct.falg2 << ']' << std::endl;
      std::wcout << "Wstring length:" << '[' << testStruct.falg2.size() << ']' << std::endl;
}


text:
Q: Class holding collection of other class I have a class Item. Then another class ItemCollection holds std::map<int,Item> item_collection_. The reason to create the class ItemCollection is if I want to do something with collection of type_a I can delegate that task to class ItemCollection. For me this seems normal way of doing tasks on those collection of items.

*

*Does this kind of behavior occur regularly in software design (I have
regularly encountered this problem)?

*Is this the correct way to approach the problem?

*Is there name given to this kind of design problem?

*I don't want others to modify the  collection of item I hold. Any
modification to Item has to go through class ItemCollection. Do
you think keeping this restriction make the design simple or will it
make more complex? Thats why I only have const Item &GetItem(int id).

*I choose map instead of vector because of function like
ClassifyItemsAs. Map helped me find the item by id faster. If I
had vector then search would have been Big O of N, where as in
std::map its Big O of LogN.
.
#include <iostream>
#include <map>
#include <vector>

enum class Classify { no_type, type_a, type_b, type_c };

class Item {
 public:
  Item(int id, double val) : id_(id), value_(val) {}
  int GetID() const { return id_; }
  double GetValue() const { return value_; }
  Classify GetType() const { return type_; }
  void SetType(Classify type) { type_ = type; }

 private:
  int id_;
  double value_;
  Classify type_{Classify::no_type};
};

class ItemCollection {
 public:
  void AddItem(Item arg) {
    item_collection_.insert(std::make_pair(arg.GetID(), arg));
  }
  // Dont know if this is necessary because all the modification should go
  // through this class.
  const Item &GetItem(int id) const { return item_collection_.at(id); }
  // should I make it const reference by having vector of each type stored
  // separately then do GetItemOfTypeA(),GetItemOfTypeB() ...
  std::vector<Item> GetItemOfType(Classify type) const {
    std::vector<Item> item_coll;
    for (const auto &it : item_collection_) {
      if (it.second.GetType() == type){
        item_coll.push_back(it.second);
      }
    }
    return item_coll;
  }
  void ClassifyItemsAs(Classify type, const std::vector<int> &item_ids) {
    for (auto &id : item_ids) {
      item_collection_.at(id).SetType(type);
    }
  }

  void PrintItem(Classify type) const {
    for (const auto &item : GetItemOfType(type)) {
      std::cout << item.GetID() << " : " << item.GetValue() << std::endl;
    }
  }

 private:
  std::map<int, Item> item_collection_;
};

int main() {
  ItemCollection item_coll;
  Item item1(5, 0.1);
  Item item2(16, 0.1);
  Item item3(0, 0.1);
  Item item4(29, 0.1);
  item_coll.AddItem(item1);
  item_coll.AddItem(item2);
  item_coll.AddItem(item3);
  item_coll.AddItem(item4);

  std::vector<int> ids = {5, 16};
  // If I did not have that class then I would have to write all code in main
  // and main would look dirty.
  item_coll.ClassifyItemsAs(Classify::type_a, ids);
  item_coll.PrintItem(Classify::type_a);
}

A: This is a reasonable thing to do. If you were literally duplicating the interface of std::map then it would have been questionable, but still might have been valid if the behaviors of individual functions were slightly different. If there were to be any point of concern, then it would be std::vector<Item> GetItemOfType(Classify type) : given that all modifications are supposed to happen through the collection type, I'd suggest considering the possibility of calculating (and recalculating) the return value of that function ahead of time, and storing it in another map.
As for what this pattern is called, it's called an "object". Normally objects are defined in terms of inheritance & all sorts of other details that breaks the definition every time someone devises a new variant of object, but my own definition is this:
An object is a grouping of zero or more pieces of data, and zero or more sets of instructions, that behave as a single, contiguous thing

Let's use a car as an example: if you intended it to be possible to remove fuel from the car, as well as add it, then representing the fuel with a publicly visible variable in a C++ class would comply with that class being an object or object type. However, if either adding or removing fuel was supposed to not be possible, or the speed at which fuel was added was supposed to be restricted, then it would prevent that class from being a proper object or object type, because the class would not be able to enforce the object's behavioral rules, thus exposing a "seam" in the object where it is no longer a single thing but instead several.
Similarly, if a car is only supposed to have two speeds, "move" and "stay", then exposing a speed variable publicly is fine. If it's supposed to show acceleration, then you need to hide the speed variable, and instead expose an acceleration variable. If you want to somehow model the movement of a foot on an accelerator pedal, then you'll want to either expose a "foot pressure" variable, or even jump straight to a function. The model that you have to follow depends purely on what rules your car is supposed to follow: if you properly enforce those rules, then you've created an object, otherwise you haven't.
Your ItemCollection appears to follow a self-consistent set of rules, so that means it's an actual object.


text:
Q: Buetooth mouse sluggish when bluetooth headset on Since I upgraded to Ubuntu 21.10 I have noticed that my bluetooth mouse is sluggish (has reaction delay) when and only when my bluetooth headset is in use.
If the headset is on, but is not receiving any sound, the mouse works just fine.
Also, the bluetooth headset can no longer be set on A2DP, but only HFP and HSP which I describe in another question:
Bluetooth audio A2DP mode stopped working after 21.10 update

A: Solved by changing the bluetooth coexistence parameter with
echo "options iwlwifi bt_coex_active=0" | sudo tee /etc/modprobe.d/iwlopt.conf

Reboot
Thanks:
https://ubuntuforums.org/showthread.php?t=2372916


text:
Q: Is this possible with blend mode or clip path? enter image description here
I've attached an image.
It has one pink circle and a pink arrow.
When the pink arrow moves towards the circle, can the overlapping part be displayed in white?
(I'm making an animation where the overlap is colored white when the arrow moves towards the
circle.)
No matter how many hours I've been thinking about it, I can't find a solution. Can I get some help?

a{position:relative; padding-right:80px; margin-right:60px; font-size:20px; font-weight:400;}
a::after{position:absolute; content:''; width:1px; height:14px; right:-30px; top:50%; margin-top:-7px; background:#7c7c7c;}
a:last-child{margin-right:0;}
a:last-child::after{display:none;}

a i{position:absolute; width:34px; height:34px; border-radius:34px; right:0; top:50%; margin-top:-17px; background:#ec3294;}
a i svg{position:absolute; right:30px; top:50%; margin-top:-5px; transition:all 0.2s ease; z-index:1;}
a:hover i svg{right:15px;}

  TEST

    <svg version="1.1" id="레이어_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
     y="0px" width="39.999px" height="9.337px" viewBox="0 0 39.999 9.337" enable-background="new 0 0 39.999 9.337"
     xml:space="preserve">
  <g>
    <path fill="none" stroke="#EC3294" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
      M28.228,0.598l11.026,7.458c0.27,0.271,0.205,0.684-0.509,0.684"/>

      <line fill="none" stroke="#EC3294" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="38.972" y1="8.723" x2="0.598" y2="8.723"/>
  </g>
    </svg>

  TEST

    <svg version="1.1" id="레이어_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
     y="0px" width="39.999px" height="9.337px" viewBox="0 0 39.999 9.337" enable-background="new 0 0 39.999 9.337"
     xml:space="preserve">
  <g>
    <path fill="none" stroke="#EC3294" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
      M28.228,0.598l11.026,7.458c0.27,0.271,0.205,0.684-0.509,0.684"/>

      <line fill="none" stroke="#EC3294" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="38.972" y1="8.723" x2="0.598" y2="8.723"/>
  </g>
    </svg>

A: You can use mix-blend-mode difference.
This snippet illustrates this using the deep pink color as #ff00ff (magenta) to make it easier to see what is going one.
The containing anchor element is given a background of #ffffff (white)
The svg and its line are given the complementary stroke color of #00ff00.
When the lines are above the #ffffff background the difference between the two colors is #ff00ff.
When the lines are above the #ff00ff background the difference between the two is #ffffff.
In this way the arrow turns white as it goes over the circle.

a {
  position: relative;
  padding-right: 80px;
  margin-right: 60px;
  font-size: 20px;
  font-weight: 400;
}

a::after {
  position: absolute;
  content: '';
  width: 1px;
  height: 14px;
  right: -30px;
  top: 50%;
  margin-top: -7px;
  background: #7c7c7c;
}

a:last-child {
  margin-right: 0;
}

a:last-child::after {
  display: none;
}

a i {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 34px;
  right: 0;
  top: 50%;
  margin-top: -17px;
  background: #ec3294;
  background: #ff00ff;
}

a i svg {
  position: absolute;
  right: 30px;
  top: 50%;
  margin-top: -5px;
  transition: all 0.2s ease;
  z-index: 1;
}

a:hover i svg {
  right: 15px;
}

svg,
svg g,
svg g path,
svg g path line {
  mix-blend-mode: difference;
}

a {
  background: white;
}

  TEST

    <svg version="1.1" id="레이어_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
     y="0px" width="39.999px" height="9.337px" viewBox="0 0 39.999 9.337" enable-background="new 0 0 39.999 9.337"
     xml:space="preserve">
  <g>
    <path fill="none" stroke="#00ff00" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
      M28.228,0.598l11.026,7.458c0.27,0.271,0.205,0.684-0.509,0.684"/>

      <line fill="none" stroke="#00ff00" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="38.972" y1="8.723" x2="0.598" y2="8.723"/>
  </g>
    </svg>

  TEST

    <svg version="1.1" id="레이어_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
     y="0px" width="39.999px" height="9.337px" viewBox="0 0 39.999 9.337" enable-background="new 0 0 39.999 9.337"
     xml:space="preserve">
  <g>
    <path fill="none" stroke="#00ff00" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
      M28.228,0.598l11.026,7.458c0.27,0.271,0.205,0.684-0.509,0.684"/>

      <line fill="none" stroke="#00ff00" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="38.972" y1="8.723" x2="0.598" y2="8.723"/>
  </g>
    </svg>


text:
Q: Dialing USSD code generates 'IllegalStateException' I wanna transfer money through SIM card Using USSD code..
In instance, for my SIM card, the USSD will Seem like that '*858*2*phonenumber*3#'
This is my android Code..
String ussd = "*858*000*1" + Uri.encode("#");
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Uri.encode(ussd))));

I have the permission of uses-permission android:name="android.permission.CALL_PHONE" in the manifest.
Logcat:
10-13 11:43:16.541  16048-16048/com.example.ahmedsharaf.testingthessid E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.ahmedsharaf.testingthessid, PID: 16048
java.lang.IllegalStateException: Could not execute method of the activity
        at android.view.View$1.onClick(View.java:3848)


text:
Q: How to remove the border on a JMenu or JMenuItem I'm using Eclipse Luna with Java 1.7 and am trying to create a JPanel that has a JMenuBar. This JMenuBar contains a JMenu which again contains a JMenuItem. To fit the whole JMenuBar into my project's visual design, I changed the background and foreground colors of JMenu, JMenuBar and JMenuItem using UIManager.put(). The result should be a drop-down menu with sections only divided by different shades of a Color (blue in my example). No lines or borders.
However, a whiteish, silverish etched border remains on the MenuItem.
My question is this: How can I make this border disappear?
I'd also like to know what element this border appears on and if it's a "feature" or there's some kind of sense to it.
SSCCE:
package sscce;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.UIManager;
@SuppressWarnings("serial")
public class GameUIPanel extends JFrame {
    public GameUIPanel() {
        setLayout(new BorderLayout());
        setPreferredSize(new Dimension(800, 600));
        setResizable(false);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        setLayout(new BorderLayout());
        setBackground(Color.decode("#00a2e8"));

        // create and adjust Components
        UIManager.put("MenuBar.background", Color.decode("#00a2e8"));
        UIManager.put("MenuBar.selectionBackground", Color.decode("#0092e4"));

        UIManager.put("Menu.background", Color.decode("#00beff"));
        UIManager.put("Menu.selectionBackground", Color.decode("#00a2e8"));
        UIManager.put("Menu.foreground", Color.decode("#91593c"));
        UIManager.put("Menu.selectionForeground", Color.decode("#7e3c1a"));

        UIManager.put("MenuItem.background", Color.decode("#00beff"));
        UIManager.put("MenuItem.selectionBackground", Color.decode("#00a2e8"));
        UIManager.put("MenuItem.foreground", Color.decode("#91593c"));
        UIManager.put("MenuItem.selectionForeground", Color.decode("#7e3c1a"));

        UIManager.put("PopupMenu.border",
                BorderFactory.createLineBorder(Color.decode("#00beff"), 1));
        UIManager.put("PopupMenu.foreground", Color.decode("#000000"));

        JMenuBar menubar = new JMenuBar();
        menubar.setBorder(BorderFactory.createLineBorder(
                Color.decode("#7e3c1a"), 2, false));

        JMenu gameMenu = new JMenu("Game");
        gameMenu.setOpaque(true);
        gameMenu.setFont(Font.decode("Arial-BOLD-24"));

        JMenuItem back = new JMenuItem("Back");
        back.setFont(Font.decode("Arial-BOLD-24"));

        gameMenu.add(back);
        menubar.add(gameMenu);

        setJMenuBar(menubar);
        pack();
        setVisible(true);
    }
    public static void main(String[] args) {
        GameUIPanel gui = new GameUIPanel();
    }
}

Added an image, as requestet. I hope this helps.


text:
Q: How to create rolling windows with Apache Beam? Not sliding or fixed but a rolling window Say I want to calculate the average of certain metric over the last 10 mins, after each minute and compare it to the average of the same metric over the last 20 mins, after each minute. I need 2 windows (Not 10 Sliding windows vs 20 Sliding windows) or 2 windows of Fixed Duration, with early firing. I need 2 windows which should keep rolling forward by a minute (of duration 10 min and 20 min each) every minute. Alternatively, if I could discard all but the latest of the sliding windows, my problem could be solved. Otherwise multiple sliding windows are very costly.
Could you please help here? A custom WindowFn() function would be very helpful

A: I must update with what I ended up doing finally.
I created a Global window with AllowedLateness of 1 hour, and triggering every minute repeatedly forever, with Accumulating Panes. From this global window, I applied DoFn filtering for elements with Timestamps in the last 10 mins (Present Instant.minus 10 mins), and events in the last 20 mins (Present Instant.minus 20 mins) to create 2 distinct PCollections. I applied this time filtering twice - once to the trigger output of the global window to add it to the PCollection(s) for 10 min, 20 min and then again to the collection itself to remove all those which are no longer part of the time duration.  For now, these 2 PCollection(s) are serving as the rolling window, but I need to audit the results to confirm if this is indeed working.


text:
Q: Extended JSP taglib Is there any extended JSP taglib available? Basically, because of project constraints, we're using a home-grown framework and working with JSPs. We want a taglib that will help us work easily with html forms and form elements and provide some sort of binding. Something like struts html tablib. I'm not sure if we can use the struts taglib standalone?

A: There should be no problem using Struts with appropriate JAR files in Web App lib folders (put all the Struts JARs in there)

A: The best solution I can provide for you is to use a retired tag library from jakarta.
It still works but it is no longer supported or maintained by them.
The link can be found here
The one you will be interested in is the "input" tag library which has tags for the following fields:
form
text
password
textarea
hidden
select
option
radio
checkbox


text:
Q: Валидация телефоного номера через бэк 'phone' => 'required|string',

Нужна валидация, и я так понимаю это делается через регулярку?
Вот так должна выглядеть маска +7-777-570-77-10
всегда +7

A: Да, вы можете использовать регулярное выражение: ^\+7-\d{3}-\d{3}-\d{2}-\d{2}$:

*

*^: начало строки

*\+7: экранированная строка +7

*\d{3}: 3 цифры

*$: конец строки

Добавить его в валидацию можно с помощью правила regex:
'phone' => 'required|string|regex:/^\+7-\d{3}-\d{3}-\d{2}-\d{2}$/i',


text:
Q: Arduino Sensor Synchronization I have the following 2 questions about using sensors (in general but I am mostly working with Arduino and Rpi)

*

*Once a sensor is initialised or started, does it keep on throwing data continuously (which gets stored in buffer) or does it only respond once we ask it to using let's say
my_sensor = S1.readline()
In other words, when we start reading data from any sensor after turning it on (or lets say initialising it) and lets say we put 10 sec delay,
how is the data read by the computer? I mean, will it read the data
every 10 sec (and not care what happens in b/w those 9 sec)or will
the data get stored even during those 10 Sec in the buffer and we
get the latest value?

*Suppose I have 3 sensors namely S1, S2 and S3 that send data at different rates lets say 50 Hz, 200 Hz and 500 Hz respectively. So
how to synchronize the data in time? In other words, in 1 sec, S1
would send 50 readings, but S3 will send 500 readings, so how can
this difference in data sending rates be accounted for while doing
calculations in Arduino / Rpi projects?.
Can someone make me understand the basics. I don't have background in embedded systems/ electronics. I am just a hobby electronics person.
Thanks

A: *

*It depends on the sensor, some sensors you need to set a 'start' signal and you can get a response (like a ultrasonic distance sensor), but most sensors are 'stupid': whenever you read a signal, you get the signal at that moment (or a few ns/ms before because of some internal buffering for one complete 'result'). So if you need many values in a short time, you have to read the sensor more often and perform yourself an e.g. average calculation.

*Normally sensors do not 'send' data. You request it from the sensor, so you decide the speed at which you receive the data. The more often you do, the better fluctuations you can anticipate on, but the more performance it takes.


text:
Q: MQTT streaming QoS control Probably relating to the SO question MQTT for realtime data streaming, how would the realtime multimedia quality be achieved with MQTT?
This is different from the MQTT defined QoS 0, 1, or 2. In realtime streaming with RTP and RTCP, these extra functionalities are explicitly supported:

*

*Sequencing

*Time-stamping and buffering

*Rate control

*Quality feedback

Though the referenced SO question mentions VoIP are implemented on MQTT, how would the above factors be considered, or just ignored at all?
Edit: As @hardillb mentions below in the answer the "considerations would have to be implemented by application", what protocol the application should follow? Is RTP/RTCP over MQTT a good solution here?

A: While in the previous answer I said VoIP had been implemented, I didn't say how robust it was.
As can be seen from other answers (Is message order preserved?) message order can be influenced by QOS.
All other considerations would have to be implemented by application using MQTT as it's transport.


text:
Q: Getting 'AttributeError: '_io.TextIOWrapper' object has no attribute 'split'' when calling split after a file is open and read I want to read and split each element in this file into a list so I can work with each number individually.
However whenever I use split(), I get an AttributeError.
This is the code:
f= open(r"C:\Users\yooni\Documents\Message.txt", "r")

numbers = f.split(",")

This is the error I get:
AttributeError: '_io.TextIOWrapper' object has no attribute 'split'
The file looks like this:
48, 24, 0, 19, 17, 8, 19, 78, 58, 74, 65, 34, 43, 77, 52, 32, 54, 40, 49, 38, 38, 57, 36, 42, 83, 32, 32, 49, 49, 52, 65, 39, 29, 80, 0...
What am I doing wrong?

A: When you open a file, you get a file object. You need to call .read() on it to get the contents.


text:
Q: Adding to a double-nested array in MongoDB I have a double nested array in my MongoDB schema and I'm trying to add an entirely new array element to a second-level nested array using $push. I'm getting the error cannot use the part (...) to traverse the element
A documents have the following structure
{
    "_id" : ObjectId("5d8e37eb46c064790a28a467"),
    "org-name" : "Manchester University NHS Foundation Trust",
    "domain" : "mft.nhs.uk",
    "subdomains" : [ {
            "name" : "careers.mft.nhs.uk",
            "firstSeen" : "2017-10-06 11:32:00",
            "history" : [
                {
                    "a_rr" : "80.244.185.184",
                    "timestamp" : ISODate("2019-09-27T17:24:57.148Z"),
                    "asn" : 61323,
                    "asn_org" : "Ukfast.net Limited",
                    "city" : null,
                    "country" : "United Kingdom",
                    "shodan" : {
                        "ports" : [
                            {
                                "port" : 443,
                                "versions" : [
                                    "TLSv1",
                                    "-SSLv2",
                                    "-SSLv3",
                                    "TLSv1.1",
                                    "TLSv1.2",
                                    "-TLSv1.3"
                                ],
                                "cpe" : "cpe:/a:apache:http_server:2.4.18",
                                "product" : "Apache httpd"

                                    }
                                  ],
                                    "timestamp" : ISODate("2019-09-27T17:24:58.538Z")
                                }
                            }
                        ]

                    }
                ]
}

What I'm attempting to do is refresh the details held in the history array and add another entire array entry to represent the most recently collected data for the subdomain.name
The net result is that I will have multiple entries in the history array, each one timestamped the the date that the data was refreshed. That way I have a historical record of changes to any of the data held.
I've read that I can't use $push on a double-nested array but the other advice about using arrayfilters all appear to be related to updating an entry in an array rather than simply appending an entirely new document - unless I'm missing something!
I'm using PyMongo and would simply like to build a new dictionary containing all of the data elements and simply append it to the history.
Thanks!

A: Straightforward in pymongo:
record = db.mycollection.find_one()
record['subdomains'][0]['history'].append({'another': 'record'})
db.mycollection.replace_one({'_id': record['_id']}, record)


text:
Q: Why post-merge hook not working with cronjob? I am a bit stuck and any help will appreciated. I am using cronjob on my staging server to have up-to-date repo with compiled assets. This is my cronjob command I am using:
* * * * * cd ~/public_html/ && git reset --hard && git pull

then in .git/hooks/post-merge I have:
#!/usr/bin/env bash
sh compile.sh

permissions:
7494392 -rwxr-xr-x 1 admin admin   34 Jan 30 17:44 post-merge

finally my compile.sh:
#!/bin/sh
cd assets && gulp dev

This hook is executed when I am doing it manually from ssh command line, but not via cron job. Can anyone point me in right direction?
Thanks,


text:
Q: Solving nonlinear minimization equations symbolically in matlab I have a large underdetermined equation system for which I search an unique solution in respect of any given constraints. I simplified my problem into the following one:
x²-4=0,
y²-9=0,
x*y=myMin,
x+y=myMin.

What is the best way to implement this in Matlab symbolically, so that it returns
x=2
y=-3

I'm searching something like
syms x y
S=solve(...
x²-4==0,...
y²-9==0,...
x*y==myMin,...
x+y==myMin);

A: I do not know how specify the min as a function command to solve. But here's an approach that solves the equations and then post-processes the result according to your constraints:
syms x y
S=solve(x^2-4==0,y^2-9==0);

[~,idx] = min(double(S.x .* S.y)+double(S.x + S.y));

X = double(S.x(idx))
Y = double(S.y(idx))

This gives:
X =
  2

Y =
 -3

The symbolic results have to be converted using the double command to allow processing with the min function.

A: The problem you seem to run into is that there is no solution, not even matlab can deal with that.
Try it like this:
myMin = -6;

syms x y
S=solve(...
x²-4==0,...
y²-9==0,...
x*y==myMin,...
x+y==myMin + 5); %Note the +5 to make it feasible

Cannot try myself, but a quick calculation tells me that this one is at least solvable.


text:
Q: Conditional for autosave or auto draft? I am attempting to create a file using fopen() on save_post. I am having trouble finding the right condtionals to prevent the the file from being created from an auto save. I only want to create the file when I click publish the post. Currently the file is created when I click "add new" and when I fill in the title.
I have tried several combinations using wp_is_post_revision() and wp_is_post_autosave() any help would be appreciated.

A: If you are using the save_post action hook; then you can prevent the code from executing during an autosave with the following conditional:
function do_not_autosave( $post ) {

    // Check to see if we are autosaving
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
        return;

    // Rest of the code here
}
add_action( 'save_post', 'do_not_autosave');

A: Although it's an old answer, you should check the post status, when you create a post (before starting editing), it has post status auto-draft.
So the code should be:
function my_theme_name_save_post_callback($post_id, $post) {
    if ( !wp_is_post_autosave( $post ) && $post->post_status !== 'auto-draft' &&
         !wp_is_post_revision( $post_id ) ) {

       /* your code here */

    }
}
add_action('save_post', 'my_theme_name_save_post_callback', 10, 3);

Replace "my_theme_name" prefix with your theme name (slug), as a best practice.
https://developer.wordpress.org/plugins/plugin-basics/best-practices/#prefix-everything


text:
Q: How to properly address 16bpp with pointers in C# I am trying to copy camera metadata into a Bitmap, and seing as each value in the metadata is a 16bit (or ushort) I thought it would be sensible to display it in a 16bpp garyscale Bitmap. The code I wrote is as follows:
// Getting the metadata from the device
metaData = new DepthMetaData();
dataSource.GetMetaData(metaData);

// Setting up bitmap, rect and data to use pointer
Bitmap bitmap = new Bitmap(metaData.XRes, metaData.YRes, PixelFormat.Format16bppGrayScale);
Rectangle rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
BitmapData data = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format16bppGrayScale);

// Pointer pointing to metadata
ushort* ptrMetaData = (ushort*)dataSource.DepthMapPtr.ToPointer();

lock(this)
{
    // Runs through the whole bitmap and assigns the entry in the metadata
    // to a pixel
    for (int y = 0; y < bitmap.Height; ++y)
    {
        ushort* ptrDestination = (ushort*)data.Scan0.ToPointer() + y * data.Stride;
        for (int x = 0; x < bitmap.Width; ++x, ++ptrMetaData)
        {
            ptrDestination[x] = (ushort)*ptrMetaData;
        }
    }
}

// Once done unlock the bitmap so that it can be read again
bitmap.UnlockBits(data);

When running the Metadata's XRes = 640 and YRes = 480. The code throws a memory access exception in the for-loops on "ptrDestination[x] = (ushort)*ptrMetaData;" after only running though 240, half the total, lines.
I used this with 8bpp where I reduced the resolution and it worked nicely, so I don't see why it should not here. Maybe someone finds the problem.
Thanks already

A:     ushort* ptrDestination = (ushort*)data.Scan0.ToPointer() + y * data.Stride;

The data.Stride value is expressed in bytes, not ushorts.  So the pointer is off by a factor of 2 so it bombs at bitmap.Height/2.  Your for loops are broken, swap bitmap.Width and bitmap.Height.  The lock keyword doesn't make much sense here, you are accessing thread-local data, other than dataSource.  Fix:
for (int y = 0; y < bitmap.Height; ++y)
{
    ushort* ptrDestination = (ushort*)data.Scan0.ToPointer() + y * data.Stride / 2;
    for (int x = 0; x < bitmap.Width; ++x, ++ptrMetaData)
    {
        ptrDestination[x] = (ushort)*ptrMetaData;
    }
}


text:
Q: Umbraco 7 slow on production server and keeps restarting Local on my laptop the umbraco projects runs perfectly, but when I put it on the production server the backend is very slow.
Specs of VPS:

*

*Windows Server 2012

*1 CPU with 2 Cores 2.2Ghz

*4Gb RAM

*IIS8

*MSSQL Express

Umbraco version
7.4.1
Also when I add new nodes or other changes in the backend it sometimes hangs and then I see in the log that the application has restarted.
Log see below:
Log rules
2016-03-23 09:59:36,936 [P2616/D99/T30] INFO  Umbraco.Core.UmbracoApplicationBase - Application shutdown. Details: ConfigurationChange

_shutDownMessage=IIS configuration change
HostingEnvironment initiated shutdown
HostingEnvironment caused shutdown

_shutDownStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
   at System.Web.Hosting.PipelineRuntime.StopProcessing()
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
 2016-03-23 09:59:49,483 [P2616/D100/T36] INFO  Umbraco.Core.UmbracoApplicationBase - Application shutdown. Details: ConfigurationChange

_shutDownMessage=IIS configuration change
HostingEnvironment initiated shutdown
HostingEnvironment caused shutdown

_shutDownStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
   at System.Web.Hosting.PipelineRuntime.StopProcessing()

Anyone that has suggestions about this?

A: There is a Windows Server 2012 R2 hotfix for this issue which can be found here - once installed the issue no longer occurs.

A: I had the same problem recently and turned of examine indexing because it forced a configurationchange.
Try this out, go to /config/ExamineSettings.config
And comment out the providers
<providers>
  <!--
  <add name="InternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
       supportUnpublished="true"
       supportProtected="true"
       analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

  <add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
       supportUnpublished="true"
       supportProtected="true"
       analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>

    <add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"/>
  -->
</providers>

It should stop the app pool restarting every time something is saved, but i don't know why the Indexer is forcing a refresh


text:
Q: User account auto-creation using SSH certificate authentication My SSH server is configured to use certificate authentication, so it will trust anyone who presents a certificate issued by the user CA when they connect.
For reasons related with audit logs, I don't want my server admins to access the server with root. Which would be the standard way to have user accounts created in the server, so admins can log in using their own accounts?
I'm thinking of a flow like this:

*

*Alice, server administrator, wants to access server1.

*She uses her SSH certificate signed by the user CA to connect to server1 issuing the command ssh alice@server1 (the certificate is stored in her local SSH agent).

*server1 checks Alice's certificate signature and confirms it was issued by the user CA using the public key specified by the TrustedUserCAKeys key in the sshd_config file).

*server1 sends its host certificate to Alice, which gets validated by the ssh client using the host CA's public key in the known_hosts file.

*The server creates the alice user locally, along with its home directory and group bindings. Here's where I need your magic.

*Alice gets a shell with user alice in server1 and does her admin stuff.


text:
Q: Add values to unexisting keys in dictionary I have a directory with many pickled files, each containing a dictionary. The filename indicates the setting of the dictionary. E.g.: 20NewsGroup___10___Norm-False___Probs-True___euclidean.pickle.
I want to combine these different dicts all in one large dict. To do this, I have written the following code:
PATH = '<SOME PATH>'
all_dicts = os.listdir(PATH)

one_dict = dict()

for i, filename in enumerate(all_dicts):
    infile = open(PATH+filename, 'rb')
    new_dict = pickle.load(infile)
    infile.close()
    splitted = filename.split('___')
    splitted[4] = splitted[4].split('.')[0]
    one_dict[splitted[0]][splitted[1]][splitted[2]][splitted[3]][splitted[4]] = new_dict

However, when I run this, I get a KeyError, as the key for splitted[0] does not yet exist. What is the best way to populate a dictionary similar to what I envision?

A: you need to create in these fields
Example:
from typing import List

PATH = '<SOME PATH>'
all_dicts = os.listdir(PATH)

def check_exist_path(target_dict, paths: List[str]):
     for key in paths:
          if key not in target_dict:
               target_dict[key] = {}

          target_dict = target_dict[key]

one_dict = dict()

for i, filename in enumerate(all_dicts):
    infile = open(PATH+filename, 'rb')
    new_dict = pickle.load(infile)
    infile.close()
    splitted = filename.split('___')
    splitted[4] = splitted[4].split('.')[0]

    for i in range(5):
        check_exist_path(one_dict, [splitted[j] for j in range(i)])

    one_dict[splitted[0]][splitted[1]][splitted[2]][splitted[3]][splitted[4]] = new_dict

A: You could use try-except blocks:
for i, filename in enumerate(all_dicts):
    infile = open(PATH+filename, 'rb')
    new_dict = pickle.load(infile)
    infile.close()
    splitted = filename.split('___')
    splitted[4] = splitted[4].split('.')[0]
    try:
        one_dict[splitted[0]][splitted[1]][splitted[2]][splitted[3]][splitted[4]] = new_dict
    except KeyError:
        one_dict[splitted[0]] = {}
        one_dict[splitted[0]][splitted[1]] = {}
        one_dict[splitted[0]][splitted[1]][splitted[2]] = {}
        one_dict[splitted[0]][splitted[1]][splitted[2]][splitted[3]] = {}
        one_dict[splitted[0]][splitted[1]][splitted[2]][splitted[3]][splitted[4]] = new_dict

This code tries to access nested dictionary keys, if they don't exist, then the code will create them with an empty dictionary.


text:
Q: How to make font awesome icon appear at centre inside a div I Googled for the above mentioned problem, but I still require the help from the stack overflow community.
In my login form, I am using font awesome icon. I have 2 input boxes for username and password respectively.
I want to display fa-user-cirle icon on top of the username input. The login form is displayed in a div as follows:

    <form>

            <input type="text" placeholder="Username" name="uname" required>

            <input type="password" placeholder="Password" name="psw" required>

            <button mat-button (click)="submit()">Login</button>

                <input type="checkbox" checked="checked" name="remember"> Remember me

    </form>

The CSS for icon is:
@import '~@angular/material/theming';
@include mat-core();

$yaana-app-primary: mat-palette($mat-orange, 800,400,200);

.firstDiv {
    height: 40%;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    position: absolute;
    background-color: orangered;
    display: inline-block;
}

.secondDiv {
    position: absolute;
    width: 100%;
    bottom: 0;
    height: 60%;
    left: 0;
    right: 0;
    background-color:whitesmoke;
    display: inline-block;
}

.loginDiv {
    border: 1px solid black;
    background: white;
    left: 50%;
    position: absolute;
    top: 28%;
    transform: translate(-50%);
    background-color: #fff;
    padding: 15px;
    box-shadow:1px 3px 10px rgba(0, 0, 0, 0.34);
}
input[type=text], input[type=password] {
    width: 100%;
    padding: 12px 20px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid #ccc;
    box-sizing: border-box;
}
button {
    width: 215px;
    height: 36px;
    line-height: 36px;
    background: transparent;
    border-radius: 3px;
    will-change: transform;
    -webkit-transition: all .2s ease;
    transition: all .2s ease;
    border: none;
    /*border: 2px solid #FF5126;*/
    cursor: pointer;
    background: #F26722;
    font-size: 16px;
    color: #fff;
    outline: none;
    text-align: center;
    padding: 0 6px;
    margin: 6px 8px;
    font-size: 14px;
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
    text-transform: uppercase !important;
}

button:hover {
    opacity: 0.8;
}
.loginImgContainer {
    display: table;
    max-height: 40px;
    max-width: 40px;
}

i.fa {
    background: #fff;
    display: inline-block;
    transform: scale(4,4);
    border-radius: 50%;
    }

The output I am getting is as follows:

But I want the icon to appear just above the username input and at the centre.
Please help me.

A: Adding this 'centericon' Class and css
.centericon{
  font-size:36px;
  position:absolute;
  top:-18px;
  left:50%;
  transform:translate(-50%,0);
  z-index:99;
  background:white;
}

.firstDiv {
    height: 40%;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    position: absolute;
    background-color: orangered;
    display: inline-block;
}

.secondDiv {
    position: absolute;
    width: 100%;
    bottom: 0;
    height: 60%;
    left: 0;
    right: 0;
    background-color:whitesmoke;
    display: inline-block;
}

.loginDiv {
    border: 1px solid black;
    background: white;
    left: 50%;
    position: absolute;
    top: 28%;
    transform: translate(-50%);
    background-color: #fff;
    padding: 15px;
    box-shadow:1px 3px 10px rgba(0, 0, 0, 0.34);
}
input[type=text], input[type=password] {
    width: 100%;
    padding: 12px 20px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid #ccc;
    box-sizing: border-box;
}
button {
    width: 215px;
    height: 36px;
    line-height: 36px;
    background: transparent;
    border-radius: 3px;
    will-change: transform;
    -webkit-transition: all .2s ease;
    transition: all .2s ease;
    border: none;
    /*border: 2px solid #FF5126;*/
    cursor: pointer;
    background: #F26722;
    font-size: 16px;
    color: #fff;
    outline: none;
    text-align: center;
    padding: 0 6px;
    margin: 6px 8px;
    font-size: 14px;
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
    text-transform: uppercase !important;
}

button:hover {
    opacity: 0.8;
}
.loginImgContainer {
    display: table;
    max-height: 40px;
    max-width: 40px;
}
.centericon{
  font-size:36px;
  position:absolute;
  top:-18px;
  left:50%;
  transform:translate(-50%,0);
  z-index:99;
  background:white;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>

  <form>

    <input type="text" placeholder="Username" name="uname" required>

    <input type="password" placeholder="Password" name="psw" required>

    <button mat-button (click)="submit()">Login</button>

      <input type="checkbox" checked="checked" name="remember"> Remember me

  </form>

A: Try with adding row above the container,

  <form>

    <input type="text" placeholder="Username" name="uname" required>

    <input type="password" placeholder="Password" name="psw" required>

    <button mat-button (click)="submit()">Login</button>

      <input type="checkbox" checked="checked" name="remember"> Remember me

  </form>

A: Thanks for giving me hint and found out the solution with following changes in css,
i.fa {
    background: #fff;
    display: inline-block;
    font-size: 80px;
    transform: translateY(-60%);
    transform: translateX(160%);
    border-radius: 50%;
    }


text:
Q: WebView word-wrap:break-word I have a problem with displaying a long very word in WebView. I don't want to scroll horizontally and zoom in/out. I just want the word to break if it's necessary (like ).
This is my simple html:

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

my settings for WebView:
mMessage.getSettings().setLoadWithOverviewMode(true);
mMessage.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);

xml:
 <WebView
     android:id="@+id/email_message"
     android:layout_width="match_parent"
     android:layout_height="match_parent"/>

This is working if I have a normal text (with spaces) but with this text, it is shown in one line and horizontal scrolling is enabled. I was checking default android email client and the same mail is shown correctly (word breaks)
Any ideas how to achieve the same result?

A: try this solution, from How to force table cell  content to wrap?:
/* css-3 */
white-space: -o-pre-wrap;
word-wrap: break-word;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;


text:
Q: Can one make move_iterator from istream_iterator? Consider following code:
typedef istream_iterator<char> char_itr ;
char_itr eos;

string ll("some text here");

istringstream line_in(ll);
char_itr start(line_in);

move_iterator<char_itr> mstart(start); // !!!
move_iterator<char_itr> meos(eos);
vector<char> vc(mstart, meos);

Above code will not compile because of line (!!!):
error C2440: 'return' : cannot convert from 'const char' to 'char &&'

But if you replace mstart and meos with start and eos, respectively (regular iterators), the code will compile. Why I can't make move_iterators?
EDIT:
For those wondering why I would like to move a character from a stream/string. Actual problem involves more complex data type than char which copying from a string should be avoided. char was used just for the sake of simplicity, to present the mechanism causing error.

A: There was a discussion of this on the std-discussion newsgroup earlier this year: https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/h7jGY95j1oc
The consensus appears to be that istream_iterator::reference is T const& to enforce the InputIterator contract; that is, to prevent users writing *it = value;. Unfortunately, this also prevents moving from the cached value.
As T.C. mentioned above, post the resolution to LWG2106 the code will compile; unfortunately because move_iterator::reference will be T const&& it will silently do the wrong thing, most likely invoking the copy constructor of your type.
Since istream_iterator modifies the cached value when incremented, it is (from a language POV) legal to const_cast the returned reference to T&. Unfortunately (again) that doesn't help here as there's no easy way to interpose a const_cast between the istream_iterator and move_iterator.
Possible workaround solutions:

*

*write your own istream_iterator, with a non-const reference typedef;

*write your own move_iterator performing const_cast;

*write an interposing const_cast iterator;

*use a mutable wrapper around the value type.

The latter option is surprisingly easy:
template<class T>
  struct mutable_wrapper {
    T mutable value;
    operator T&() const { return value; }
  };
// ...
using itr = std::istream_iterator<mutable_wrapper<MyType>>;

Example.

A: Looking at istream_iterator::reference, we see that it's T const &. Dereferencing the iterator gives us such a reference. But to be able to move from something, that something needs to be modifiable. That's what the error message is trying to tell you.
You could make a move_iterator from an istream_iterator, by putting some custom iterator that keeps an internal (non const) storage inbetween.
But why would you want to move from an istream_iterator? Those are single pass iterators, and thus likely have nearly no internal storage.