Are these equations "properly" defined differential equations? (finite duration solutions to diff. eqs.)

Question: Are these equations properly defined differential equations?
Modifications were made to a deleted question to re-focus it. I am trying to find out if there exists any exact/accurate/non-approximated mathematical framework to work with physics under the assumption that phenomena have finite ending-times, instead of solutions that at best vanishes at infinity.

Intro
Definition 1 - Solutions of finite-duration: the solution $y(t)$ becomes exactly zero at a finite time $T<\infty$ by its own dynamics and stays there forever after $(t\geq T\Rightarrow y(t)=0)$. So, they are different of just a piecewise section made by any arbitrarily function multiplied by rectangular function: it must solve the differential equation in the whole domain. (Here I just pick the shorter name its look more natural to me for several I found: "finite-time", "finite-time-convergence", "finite-duration", "time-limited", "compact-supported time", "finite ending time", "singular solutions", "finite extinction time", among others).
Recently, in this answer I figure out that the following autonomous scalar ODE:
$$\dot{y}=-\sqrt[n]{y} \tag{Eq. 1}\label{Eq. 1}$$
Could stand the finite-duration solutions, for any real-valued $n>1$ and positive ending time $T>0$:
$$ y(t)=\left[\frac{(n-1)}{n}\left(T-t\right)\right]^{\frac{n}{(n-1)}}\,\theta(T-t)\equiv y(0)\left[\frac{1}{2}\left(1-\frac{t}{T}+\left|1-\frac{t}{T}\right|\right)\right]^{\frac{n}{(n-1)}} \tag{Eq. 2}\label{Eq. 2}$$
with $\theta(t)$ the standard Heaviside step function.
But later, working with the solution of \eqref{Eq. 2} I figure out that if I take its derivative I will end with:
$$\begin{array}{r c l}
\dot{y} & = & -\left[\frac{(n-1)}{n}\left(T-t\right)\right]^{\frac{1}{(n-1)}}\,\theta(T-t)+\underbrace{\left[\frac{(n-1)}{n}\left(T-t\right)\right]^{\frac{n}{(n-1)}}\,\delta(T-t)}_{=\,0\,\text{due}\,(x-a)^n\delta(x-a)=0} \\
& = & -\left[\frac{(n-1)}{n}\left(T-t\right)\right]^{\frac{1}{(n-1)}}\,\theta(T-t) \\
& = & -\frac{n}{(n-1)}\frac{1}{(T-t)}y(t)
\end{array}$$
Which implies that the solutions $y(t)$ are also solving the non-autononous scalar ODE (is time-variant since the time $t$ is explicitely involved):
$$\dot{y}+\frac{n}{(n-1)}\cdot \frac{y}{(T-t)} = 0 \tag{Eq. 3}\label{Eq. 3}$$
This last equation of \eqref{Eq. 3} resembles very much this another question were I found that the finite duration solution:
$$z(t)=\exp\left(\frac{t}{(t-1)}\right)\cdot\theta(1-t) \tag{Eq. 4}\label{Eq. 4}$$
can solve the equation:
$$\dot{z}+\frac{z}{(1-t)^2} = 0,\quad z(0)=1\tag{Eq. 5}\label{Eq. 5}$$
So I started to try another finite-duration solutions to see if their differential equations follows the same "trend" of having terms $(T-t)$ on it: which means that an standard integration constant is becoming part of the differential equation as its finite ending time $T$.

Main analysis
On this question is found that similarly for equations \eqref{Eq. 3}:
$$x(t)=\frac{1}{4}(2-t)^2\theta(2-t) \tag{Eq. 13}\label{Eq. 13}$$
is a finite duration solution to:
$$\dot{x}=-\text{sgn}(x)\sqrt{|x|},\,x(0)=1\tag{Eq. 14}\label{Eq. 14}$$
so I will modify this solution to see what happens:
$$q(t) = \frac{1}{4}(2-t)^2\cos(20\,t)\,\theta(2-t)\tag{Eq. 6}\label{Eq. 6}$$
which can be verified is solves the equation:
$$\ddot{q}+\frac{4}{(2-t)}\cdot \dot{q}+\left(400+\frac{6}{(2-t)^2}\right)\cdot q = 0,\quad q(0)=1,\,\,\dot{q}(0)=-1\tag{Eq. 7}\label{Eq. 7}$$
Again, on \eqref{Eq. 7} there terms $(2-t) \cong (T-t)$ indicating that there exists solutions that are behaving like finite duration solutions (see plot of \eqref{Eq. 6}).
But these "construction" of making finite duration solutions where these two conditions are met:

The differential equation support the zero solution, and
The differential equation also has at least one singular point in time $t=T$ where $x(T)=\dot{x}(T)=0$

both mentioned on this answer, becomes less obvious where more than one variable is considered. Let think and a slight modification to the function of this answer:
$$U(t,x) = \exp\left(1-\frac{1}{(1-(x-t)^2)}\right)\theta(1-(x-t)^2) \tag{Eq. 8}\label{Eq. 8}$$
it will show to be compact supported in space as it moves in the time variable, fulfilling the standard wave equation with a velocity $c=1$:
$$\left(\frac{1}{c^2}\frac{\partial^2}{\partial t^2}-\nabla^2\right)U(t,x)=0 \overset{c=1}{\Rightarrow} U_{tt}-U_{xx}=0 \tag{Eq. 9}\label{Eq. 9}$$
Here the partial equation doesn't show the term $(T-t)$, but it does make sense if the countour plot of \eqref{Eq. 6} is viewed:

It is only compacted-supported in space and it is still never-ending in time.
But if I test this modified version of \eqref{Eq. 8} mixed with the terms of \eqref{Eq. 2}:
$$E(t,x) = U(t,x)\cdot \frac{1}{4}(2-t)^2\,\theta(2-t) = \exp\left(1-\frac{1}{(1-(x-t)^2)}\right)\theta(1-(x-t)^2)\cdot\frac{1}{4}(2-t)^2\,\theta(2-t) \tag{Eq. 10}\label{Eq. 10}$$
where this time it can be seen in its plot that is indeed behaving as also a finite duration solution in time:

It could be verified that is solves the equation:
$$E_{tt}-E_{xx}+\frac{4}{(2-t)}E_{t}+\frac{6}{(2-t)^2}E = 0 \tag{Eq. 11}\label{Eq. 11}$$
within the domain \eqref{Eq. 10} is different from zero (see here). So again the terms $(T-t)$ are required for having finite-duration solutions.
I beforehand know that some of these functions should be defined piecewise because has a undefined value, as example:
$$ f(t) = \begin{cases} \exp\left(\frac{t}{(t-1)}\right),\quad t < 1 \\
                        0, \qquad t\geq 1 \end{cases} \tag{Eq. 12}\label{Eq. 12}$$
instead of the one-line version of \eqref{Eq. 4}, so I ask you now to forgive this shortcut for now: the functions still continuous on these points and for me are easy to work with them finding their differential equations on this way (I have a extended discussion of this here), but if this annoying you, please just assume it is defined piecewise such as the function is zero in the undefined point.
This comment is important, since I want to focus the discussion in the other singularities that appears on these equations (and sometimes the point could be coincident), and are the discontinuities on the differential equations due the terms $(T-t)$.

The questions
1) Are all these differential equations with terms $(T-t)$ "well-defined" as differential equations?
2) Which are the name of this kind of differential equations? (noting here there are ODEs and PDEs with these terms - hope there are any references)
3) Does this $(T-t)$ terms on the denominator make these differential equation Non-Lipschitz? Here looking for parallels with the papers by V. T. Haimo:  Finite Time Differential Equations and Finite Time Controllers.
4) Does this $(T-t)$ terms on the denominator make possible the existence of solutions of finite duration? Remembering here that solutions of finite duration don't fulfill uniqueness (see the recently cited papers for better explanation), a singularity in my opinion makes sense since there are multiple values rising from a single point, which is similar with traditional mistakes made when dividing by zero - but formally speaking, I have no idea of what it is happening.

Motivation
I am trying to find a mathematical framework to work with dynamical systems under the assumption: the system achieves an end in finite time, which seems really logical to me through daily life experience, but I have found this is really messy when it is translated to math (I still didn't find a related framework).
Current physics solutions at best "vanishes at infinity", which is not exact but fairly good for almost every possible application, so good, that I have had discussions with many people that affirm as true that movement last forever, which at least under the assumption that thermal noise is Gaussian, you can say if it still moving (neither if it has stopped), since already all the information is lost: Gaussian distribution is the Maximum entropy probability distribution for a phenomena with finite mean and finite power. Don't meaning the assumption of never ending movement is wrong, but affirming is true is indeed false (see the comments of this question to a more detailed discussion applied to the pendulum movement).
This subtle distinction is seen for example, in the Galton board toy, where many people affirm that somehow order have risen from chaos, due the appearance of the Normal Distribution, when the right interpretation is that all the information of the path each ball have take when falling is already lost, and the Gaussian distribution is the maximum possible disordered way of been for this system (to have an intuition of why there is a lobe in the middle, take a look to Concentration inequality).
But nowadays there is a lot of theoretical physics squeezing their models to the very last drop and many counter-intuitive things are reaching mainstream: many Youtube videos talking about the "nonexistence" of time (is an illusion), and also many videos about the impossibility of current physics laws to determine "the direction of the arrow of time", and I would like to know if any of this things is due current models are not aware of the effects of keeping the assumption that phenomena have finite ending times.
As example, in all the differential equations of this question there indeed a clue of which way the time is considered to be flowing (due the term $(T-t)$), and for the solutions, going backwards in time will lead to spontaneous rise from zero (being zero from a non-zero meassure interval in time).
I know that current models are on the way they are because the models were designed to keep holding uniqueness of solutions, which if not could lead to a lot of struggles (see here some of this issues with the Norton's Dome example).
But I also know now that for the existence of solutions of finite duration uniqueness of solutions must be abandoned, and I would like to know if this were known by physicists, if the current models would still been having their current formulations (to keep this on perspective, main models have about a hundred years old, and the first papers about finite duration solutions I have found are from 1985).
And maybe because they are "relativately new", I only found these finite duration solutions on control theory papers (where they started assuming a high-knowledge background from the reader), and every book I find on differential equation keep their analysis tied to uniqueness, so they don't touch this topic. With this, any related book reference will be useful.

Answering two firsts comments by @Desura
Some user named @Desura mentioned the existence of the Frobenius method and the Fuchs' theorem for solving differential equations of the form $u''+\frac{p(t)}{t}u'+\frac{q(t)}{t^2}u=0$, and also what is a Regular singular point. On all these pages you can see differential equations that really resemble the ones I have displayed above, so very much for share it.
I would like to comment why I think these kind of methods aren't able to find solutions of finite duration by "themselves", and also how I think I am already using them through Wolfram-Alpha.
On the mentioned papers by Vardia T. Haimo (1985) Finite Time Controllers and Finite Time Differential Equations, where only scalar autonomous ODEs of 1st and 2nd order are studied ($x'=G(x)$ or $x''=G(x',x)$), then by assuming without lost of generality that $T=0$, and also assuming that the right-hand-side of the ODE is at least class $C^1(\mathbb{R}\setminus\{0\})$, the author mentioned that:
"One notices immediately that finite time differential equations cannot be Lipschitz at the origin. As all solutions reach zero in finite time, there is non-uniqueness of solutions through zero in backwards time. This, of course, violates the uniqueness condition for solutions of Lipschitz differential equations."
So, if the author is right, NO Lipschitz 1st or 2nd order scalar autonomous ODEs could stand solutions of finite duration, so classic linear ODEs are discarded.
But reaching zero in finite time have also another consequence, and is that also are discarded classical solutions through Power Series which are analytical in the whole domain, since there exist a non-zero measure compact set of points identical to zero, the only analytical function that could support this matching is the zero function, due the Identity Theorem.
Because of this last paragraph, is why I believe that a method that find the coefficients for a function of the form $\sum_k a_k(T-t)^k$ aren't able to describe a finite duration solution "alone", which is a traditional method for finding solution to ODEs (as the method shown by @Desura).
But fortunately, being analytic in a piecewise part of the time domain and zero on the part "looks like" working if the two restrictions are met (now labeled after \eqref{Eq. 7}), as they are used for finding the solution of the now labeled \eqref{Eq. 14}, which is demonstrated on this answer. Here is where I am using the traditional ways of finding solutions to differential equations, to find the "non-zero section".
But How this "construction" by "stitching solutions" is formally working, or if they are being or not formal solutions to the differential equations is something I don´t know (I am "highly abusing" of an answer without any formal prove - but because it "make sense"), neither when we have to "choose" one solution or another (since there are multiple options now - at least with this "construction": the full solutions, the finite duration alternative, or the other piece that rise spontaneously from zero). This is why I am looking for a framework, but because as requirement uniqueness must be left aside, traditional books in differential equations don't touch this kind of solutions.
Even so, on the mentioned papers of V. T. Haimo, this kind of solutions aren't studied at all, and more interestingly, there are given a 2nd order ODE example where is shown that depending on its parameters, the differential equation could allow having finite duration solutions, but outside "this restriction" the solutions are not of finite duration (unfortunately no exact solution is given).
Last update
I have just found the following papers under the term sublinear damping that shows example in physics of equations really similar to one showed on the papers by V. T. Haimo, containing terms of the form $\text{sgn}(\dot{x})|\dot{x}|^\alpha$ which are achieving finite extinction times without having the form of the Frobenius method with displaced terms $(T-t)$:

"A note on the dynamics of an oscillator in the presence of strong friction" - H.Amann & J.I.Diaz
"A conservation law with spatially localized sublinear damping" - Christophe Besse & Sylvain Ervedoza
"Behavior of Solutions of Second-Order Differential Equations with Sublinear Damping" - J. Karsai & J. R. Graef

I don't know if maybe after knowing their exact solutions, they could be transformed on differential equations similar of the asked on the main question, as it was done for carrying \eqref{Eq. 2} to become into \eqref{Eq. 3} (I believe implying with this their decaying is exponential $\propto t^{-\beta},\,\beta>0$ for some $\beta$), maybe it could be proved with what is shown on the papers. Other similar examples were listed into this another question.
Comment: You might be interested in studying first the following class of linear $n$-th order ODEs $f^{(n)}(z) + \sum_{i=0}^{n-1} p_i(z)f^{(i)}(z) = 0$ with initial data at $z_0 \in \mathbb C$ and coefficients $p_i(z)$ which are meromorphic around $z_0$ for all $i \in \{0,1,...,n-1\}$. Then the point $z_0$ can be classified in three ways : an ordinary point, a regular singular point and a fully irregular point.
Comment: The existence and uniqueness theory breaks only in the fully irregular case. In the regular singular case, solutions with singularity at $z_0$ can exist but this is not always the case and it will depend only on the poles of the $p_i(z)$'s (look for Frobenius Theorem, Fuchs Theorem or Fuchsian Differential Equations). Please note that your equation (7) has a regular singular point at $z_0 = 2$.
Comment: @Desura thanks you very much for your interesting comments. I didn't know before about the [Frobenius method](https://en.m.wikipedia.org/wiki/Frobenius_method) neither about [Regular singular point](https://en.m.wikipedia.org/wiki/Regular_singular_point). I will add, bacause of extension, what I think into the question during the next hour.
Comment: @Desura I have just upload on the question my comments. Hope you can elaborate after read them. Beforehand, thanks you very much.
Comment: It seems to me that the sentence *phenomena have finite ending-times* is ambiguous. For example, the autonomous ODE $y^\prime = y^2$ has solutions exploding to infinity in a finite time. So formally, the system has a finite ending time. Is it something that you regard as a phenomenon that has a finite ending-time? IMHO, I think that you should revisit your question by trying to precisely define what is still fuzzy. That will help yourself to understand in more detail the topic... And then facilitate answers!
Comment: @mathcounterexamples.net I have added a definition now, thanks you very much for commenting.
Comment: @Joako I would rather say if I understand you well, that the solution is always vanishing in an interval $[T , T+ a)$ with $a \gt 0$.
Comment: @mathcounterexamples.net what I am saying is that for a continuous real-valued solution $y(t)$ defined on the whole domain $\mathbb{R}$, the solution is such as exist an ending time $T<\infty$ such that for every $t>T,\, y(t)=0$ **due the dynamics of the system** (not just an arbitrary piecewise section). I believe this can be understood through the question examples.
Comment: @mathcounterexamples.net Maybe I am using mistaken names due my lack of background, and surely there are grammar mistakes since I am not a native English speaker. Since this is different from what you are saying (it needs $a\to\infty$), I am open to suggestions for explainning this better.
Answer: 1) Are all these differential equations with terms $(T-t)$ "well-defined" as differential equations?
Their well-posenedness will depend on the multiplicity of the singularities. You will need to check whether the singular points are regular or irregular. See e.g. https://en.wikipedia.org/wiki/Regular_singular_point. You may also check the Frobenius method which will be particularly useful for some of your differential equations: https://en.wikipedia.org/wiki/Frobenius_method.
2) Which are the name of this kind of differential equations?
They are commonly referred to as singular differential equations.
3) Does this $(T-t)$ terms on the denominator make these differential equation Non-Lipschitz?
Of course, they make it non-Lipschitz. A necessary condition for being Lipschitz is to be continuous and $1/(T-t)$ is not continuous at $t=T$.
4) Does this $(T-t)$ terms on the denominator make possible the existence of solutions of finite duration?
It may but that may not be the best solution to do so. You gave the example in Eq. 4 and Eq. 5.
Comment: *Of course, they make it non-Lipschitz. A necessary condition for being Lipschitz is to be continuous and $1/(T−t)$ is not continuous at $t=T$*. The problem is not so much that $1/(T−t)$ is not continuous at $t=T$. It is that it is not even defined! However $t \mapsto 1/(T−t)$ is locally Lipschitz for any $t$ where the map is defined. Which is enough to ensure that the ODE has a unique maximal solution at any point $t_0 \neq T$.
Comment: @Joako That's an interesting problem.
Comment: @Joako there has been a lot of work on the topic in control theory for finite convergence of control systems and the like. This has been well-studied.
Comment: You will almost never find explicit solutions to differential equations. Most of them are not explicitly solvable only the simple ones are. What is important are the qualitative properties (e.g. stability) and certain quantitative properties (e.g. a bound on the finite convergence time).
Comment: What is $g(x)$?
Comment: That sounds correct to me. You indeed need non-uniqueness of solutions to have that.
Comment: @mathcounterexamples.net Yeah that's correct. I will update my post when I get back home.
Comment: Thanks you very much for the answer!.. I found now this wiki about [Singular solutions](https://en.wikipedia.org/wiki/Singular_solution#Failure_of_uniqueness) where even the "stitch solution construction" is used. There is explained, since the singular point is required to fail uniqueness, that the answer to part (4) is indeed true, is the singularity given by the term $(T-t)$ which makes possible to have finite duration solution. But also, having a singular solution or a Regular singular solution don't grant the differential equation is having solutions of finite duration, since are other...
Comment: (...) other kinds of singular solutions. Now I believe that the **two conditions**: (i) the trivial zero function is a solution, (ii) exist a singular point at time $T<\infty$ such as $y(T)=\dot{y}(T)=0$, are mandatory to have finite duration solutions... but I can prove it, neither know if they are sufficient - or maybe less is required.
Comment: The first condition is trivial to verify, but I tried in past questions to review How to figure out if an equation, like Eq. 11 as example, from it description, if it has a point that fulfill condition (ii) but unsuccessfully: I don't know if it could have points that aren't singular that fulfill the condition $x(T)=\dot{x}(T)=0$. Also, there are examples where the solution is smooth, so all derivatives are going to zero at $t=T$ as it could happen in solutions like Eq. 4 or smooth bump functions, but this don't going to happen in solutions that aren't smooth as in Eq. 13.
Comment: On the papers by V. T. Haimo other requirements are explored, but since there are studied only scalar autonomous systems of 1st and 2nd order ODEs, I don't know if the same method could be extended to analyse general singular solutions.
Comment: As electrical engineer, I have basic knowledge in control theory, and I have read a few papers related to **finite time convergence** but unfortunately, for me, they are very abstract (so far, it have been hard to find closed form/exact solutions examples - also they mix solutions that converges with solutions that diverges). This differently from the websites you site, where with basic knowledge of differential equations you can understand what it is been explained. In the same line, proving that the **two conditions suffice** will made it much easier to understand and work with (I hope).
Comment: I believe I have been lucky this time, after finding Eq. 2 (which can be an approximation to many kinds of different decays), I have been able to made many solutions to later find their differential equations and see how they behave, and it result to have a known and not-too-abstract framework like the Frobenius method, which at least for me, it see much easier to work with than Lyapunov theory (at least from what I have been able to understand from the papers). Hope you give a chance to prove if the 2 conditions suffice, or if could exists non-singular points that fulfill (ii), and include it
Comment: I find already that $g(x)=\cos(x)-1$ will fulfill $g(0)=g'(0)=0$ without being a singular point, so it will be needed to condition (ii) to be a singular point in time.
Comment: @KBS it was just an example function that fulfill $g(T)=g'(T)=0$... the first time I talked about the two conditions I didn't mentioned anything about it has to be a singular point, as I did later talking in this trend of comments... and now I believe this restricted version is the right form: at least for a diff. ec. of the form $a(t)f''(t)+p(t)f'(t)+q(t)f(t)=0$, if there exist a time $T$ such as $f(T)=f'(T)=0$ the equation becomes $a(T)f''(T)=0$, so without taking for granted the value of the second derivative, it is going to be a pole in the point because of $a(t)$,....
Comment: @KBS so at least in the Frobenius Method the point also requires to be a Regular singular point. Later I note that if an arbitrary function $g(t)$ such as at a point $t*$ happen to be $g'(t*)=0$, then I can built other function $s(t)=g(t)-g(t*)$ which will always fulfill $s(t*)=s'(t*)=0$ so having that property by itself is quite general, so, without formal prove, I think that to be a singular point is required.
Comment: Now I figure out is a must to have a singular point, otherwise uniqueness couldn't be violated... sorry about my related confussion.
Comment: In a general framework for a 2nd order scalar diff. eq. $y''=F(y',y)$ if condition (i) is fullfiled I will have that $F(0,0)=0$. Now, if there is a point $t=T,\,|T|<\infty$ where $y(T)=y'(T)=0$ then $y''(T)=F(y'(T),y(T))=F(0,0)=0$, so if additionally, the point $T$ is singular, so uniqueness could be broken, all conditions for stich solutions are made. With this, I believe the "strict two conditions" (now corrected above), for having a solutions of finite duration are sufficient, Is this right? (maybe less is required, since mentioned papers does a different analysis)
Comment: Even if the two conditions are being "sufficient", from the paper of V. T. Haimo looks like sometimes are not necessarily both required: in her analysis she found that for the differential equation:
$$\ddot{x}=−\text{sgn}(x)|x|^a−\text{sgn}(\dot{x})|\dot{x}|^b$$
 if the parameters are such $0<b<1$ and $\frac{b}{2−b}<a$ then there exist solutions of finite duration. Here, completely different from the **two conditions** analysis I did above: I don't know how to apply the (ii) condition since there is no clue of what is the finite ending time (different from the poles in the Frobenius method)
Comment: @KBS I hope you can update your answer as you tell to mathcounterexamples.net, including your last comments. It would be great to share it in a concise way on other forums. Again thanks you very much for your help and pattience.
Answer: Introduction
In what follows, we'll only consider first-order Ordinary differential equations (ODE) defined as $$y^\prime(t) = f(t, y(t))$$ where $f : U \to \mathbb R$ is continuous and $U\subseteq \mathbb R^2$ is an open subset.
According to Peano existence theorem, the Initial value Problem (IVP)
$$\begin{cases}
y^\prime(t) &= f(t, y(t))\\
y(t_0) &= y_0\end{cases}$$ where $(t_0,x_0) \in U$ has at least one maximal solution.
Interestingly, the solution may not be global as can be seen with the case
$$\begin{cases}
y^\prime(t) &= y^2(t)\\
y(1) &= 1\end{cases}$$ that explodes to infinity in a finite time. By the way an interesting theorem states that either the solution of such ODEs is global, either it reaches points outside of any compact in a finite time.
The solution may also not be unique as can be seen with the  following example$$\begin{cases}
y^\prime(t) &= \sqrt{\lvert y(t) \rvert }\\
y(0) &= 0\end{cases}$$
However, as stated by Picard–Lindelöf theorem, the IVP $$\begin{cases}
y^\prime(t) &= f(t, y(t))\\
y(t_0) &= y_0\end{cases}$$ has a unique maximal solution for any $(t_0,y_0) \in U$ providing that $f(t, y)$ is locally Lipschitz in $y$ for any $y_0$. This is in particular the case if $f$ is continuously differentiable.
Solutions of finite duration
So coming back to your question, you're expecting to get solutions $y$ defined in an open interval $(a,b)$ for which $y(t) = 0$ for $t \ge T$ where $T \in (a,b)$ and... that are not always vanishing. That would be too simple.
You can't get such solutions according to Picard–Lindelöf theorem if $f$ is locally Lipschitz in $y$ around $y(T)$.
But you don't need to have $t-T$ in the denominator of some term of the ODE to get the finite duration phenomena. $$\begin{cases}
y^\prime(t) &= \sqrt{\lvert y(t) \rvert }\\
y(0) &= 0\end{cases}$$ is a good example for that!
I know that this doesn't answer to your precise 4 questions. However, I think that this provides you with a much global way to study the finite duration topic you raised.
Interesting would be to answer following question.
Suppose that you have an autonomous IVP $$\begin{cases}
y^\prime(t) &= f(y(t))\\
y(t_0) &= y_0\end{cases}$$ where $f : \mathbb R^2 \to \mathbb R$ is continuous, continuously differentiable for $y \neq 0$ with $f(0)=0$ and $\lim\limits_{y \to 0} \lvert f^\prime(y) \rvert = \infty$. Does we then have finite duration solutions? This would give a very general case of finite duration solutions.
Comment: Thanks you very much for taking the time for this this interesting insight. I don't fully get the last part: you are asking for a finite duration solution with an discontinuity in the acceleration profile at $t=0$?, If this is the case made a similar question [here](https://math.stackexchange.com/q/4389725/909869) and find that something of the form $$x(t) = \frac{(1-t^2+|1-t^2|)\,t\log(t^2)}{4}\,\exp\left(-\frac{t^2}{1-t^2}\right)$$ could do that trick.
Comment: What I am doing in the last part is to try to generalize the case $y^\prime =\sqrt{\lvert y \rvert}$ to get a more general condition on which finite duration solutions exist. For this, I tried to identify what is specific to this particular example.
Comment: If is the generalization of a scalar autonomous IVP, is the first case studied on the papers by V. T. Haimo a cited on the question above... I am not sure if matched your definition at 100% (because of the $\mathbb{R}^2$), Did you review them? I recommend you to see first "Finite Time Controllers", since the other have an important typo mistake in an inequality sign.
Comment: On V. T. Haimo papers are shown required conditions, but I believe now that the two conditions I explain above are sufficient: if (i) zero is solution then $y''=F(y',y)$ leads to $F(0,0)=0$; and (ii) having a singular point $-\infty<T<\infty$ where $y(T)=y'(T)=0$ leads to $y''(T)=F(y'(T),y(T))=F(0,0)=0$, and since is singular there uniqueness could be broken, so conditions to stich solutions with the zero function continuously are met. Same can be done for the case $y'(t)=F(y(t))$.
Comment: Other interesting thing from the paper of V. T. Haimo, is that in her analysis she found that for the differential equation:
$$\ddot{x}=-\text{sgn}(x)|x|^a-\text{sgn}(\dot{x})|\dot{x}|^b$$
founding that if $0<b<1$ and $\frac{b}{2-b}<a$ then there are solutions of finite duration. Here, completely different from the **two conditions** analysis I did above.


install for acer r3 131t Boot repair did not work

Question: hello I did the instructions for efi booting and doing alongside windows.
I have acer r3 131t 32gb model with 2gb ram
I have a 64db sd card and installed there.
it has windows 10 installed (not so bad for $250)
I followed the instructions without doing a windows restore disk because there is no data partition on a 32gb disk!
I got as far as the boot repair but it still did not "repair" it.  It did not instruct me to paste anything.
However I pasted the code from the website below which is also in the "linux user" web page instructions.
bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi
The uploaded bootrepair is on
http://paste.ubuntu.com/14348507/
So I cannot boot into ubuntu 15.10
It luckily still boots into windows.
I did not see any way to delay the boot time in the bios.
I set the boot order to the main disk first.
There is not a choice to boot from sd, but something is surely in the efi partition for ubuntu.  I can see it.
any suggestions.  Please email me in addition to posting here(I am a monk in myanmar).
bksubhuti-atthegma1l  (figure it out)
will edit this out later.
Just a small complaint:  Why can't the install program do this right and why are there all of these help guides?  I am technical and patient.. but how can Ubuntu spread with things like this.  The install program should have a help guide in it.  If you need to do something else... then tell them to do it.
Comment: I ran bootrepair one more time.  It appears that the boot repair is asking me to set my boot to the disk1 not disk0.  This means it wants me to boot using the sd card.  This is not an option.  This is the problem.  So how to fix this?  I did "something else" and installed grub on the disk0 option.  There is no room on the main disk 32gb.  It chose sd and formated it for me with a swap partition.  windows 10 seems to use way too much disk space and grows each week.  only 6gb available with virtually no data on the main disk.  only a small selection of sw.
Comment: Do not know if your model needs to downgrade UEFI, but all Acer require you to set password and enable trust on the ubuntu efi files. Acer E5-573G, downgrade UEFI, supervisor password & trust on Ubuntu efi boot files.
http://askubuntu.com/questions/706912/getting-a-black-screen-when-installing-or-live-booting-ubuntu-any-version-in-m?noredirect=1#comment1039248_706912 and: http://ubuntuforums.org/showthread.php?t=2297947
Comment: I did that. I am not legacy boot.  Boot repair wants me to set boot to disk1.  Bios does not let me do that
Comment: Boot-Repair's script shows sda as installer flash drive. And grub normally wants to install to drive as sda. So use of a memory card confuses it. Grub is small and usually fits into the same ESP - efi system partition as Windows without issue. And if booting from memory card you then can copy all of /EFI/ubuntu to memory card's /EFI/ubuntu folder. You may have to create that. And then copy again to /EFI/Boot folder on memory card's ESP and rename shimx64.efi to bootx64.efi. External drives boot from /EFI/Boot/bootx64.efi and shimx64.efi needs all the files in /EFI/ubuntu to correctly work.
Answer: I was able to fix this problem.
I am not sure 100% the exact cause because I ran boot repair advanced options but that never worked until I did things below:
I read a little bit of the boot repair link I posted and the first comment response helped something clicked after fooling with the bios.
By lucky guess I saw the enable trusted uefi and clicked on it.  Through several clicks..I got to the Ubuntu boot file.  There were several (other than efi backups) probably from many boot repairs.  I selected all of them.  That was cool but it still did not get grub to load.
However I got the grub to boot by the f12 choose boot.  3 choices showed up on the menu this time instead of just Windows.  The third one labeled "1 Yes" worked.
Then I went back to the f2 for general bios and saw "EFI File Boot 1:  Yes" and another with "0" instead of "1" at the bottom of the boot order.  These were familiar new options which I now could see for the f12.
(Before enabling trusted efi, these options were not there)
I may have disabled tpm state too (whatever that is).  It is disabled now and may have been enabled before.  That might also be a cause.
As far as I know through trial and error:
0yes means boot the operating system on mmblk0  (Windows)
1yes means the other disk on mmcblk1 (Ubuntu).
But it could just be the number of boot filled I created with boot repair.  However the "0" file does not boot grub.
Moving "EFI File Boot 1: Yes" to the top of the boot order makes grub boot automatically.  So my work has just begun.  Thanks for helping.
So now I have Ubuntu 15.10 fully installed on my sd (no casper stuff).  It is much better than a live USB.  I just cannot use my SD slot which is no problem.
Ubuntu idles on ½ gb of my 2gb of memory.
In retrospect due to what I write above,  I am not 100% sure grub is on mmblk0p1 (efi) as I said before.
When Grub first did not work, I installed again choosing "something else" and maybe missed the boot install option (though I doubt it and I did a "something else" installation twice to make sure.


Is my water pump short cycling?

Question: I live in a low mains water pressure area, so I had to install an Aquabox water tank in my garage which has a Genyo controller and submersed pump.
It's 3 years old now, but I've only recently noticed that the pump is cycling approx. every minute, even when there is no water being used, is this normal?
I assumed it's not, below is a list of things I have checked:

I've turned off all our toilets in case there's any of them running
The underground MDPE pipes are all sound (recently dug up and replaced and issue was occuring before)
The tank is being filled and there's no failures reported on the Genyo controller
I've pressed the valve on the expansion vessel located in the house and it releases air and not water, so doesn't appear to be damaged.

There are no obvious signs leaks in the system, so I'm stumped at this stage and any help would be appreciated.
Comment: Would need to check the air pressure in the tank.  Read manual or google for your tank for instructions.  Just because pipes were replaced, does not mean there is no problem, less likely, but still might be.  If pressure is correct, might be a problem with pump or controller.
Comment: @crip659 The pressure in the big tank or the expansion vessel?
Comment: Probably both, if like most pressure tanks, air pressure is adjusted according to water pressure.  Should be in the manual.  Air pressure cushions time that the pump needs to come on.
Comment: Where is the location and condition of check valves? If not leaking out of the pipes then that leaves returning to the source.
Answer: Regardless of the state of the tank, it should not cycle at all with no water being used. You have a leak, probably a leaky check valve (so water goes back to the pump tank) if you are QUITE certain no water is being used. That's typically built into the pump outlet for a submersible pump.
If not, then you have something leaking and using water you're unaware of - water softeners and toilets being my prime suspects, as they don't tend to leak in such a way that you find a puddle to notice the leak. But you already tried the toilets. If you have a valve you can shut all water off with after the pressure tank ("expansion vessel"), try it, and see if the problem remains.
Air pressure in the tank should be 2-3 PSI below pump cut-in with the water side drained (incoming water & pump shut off, no pressure in the water pipes.) But the tank isn't the main problem if no water is being used and the pump is cycling.
Comment: Letting the air out can mess things up but a bike pump can be used to get the pressure back to 2-3 psi below cut-in  or pump turn on . This answer hits the problems I have seen.
Comment: Thanks everyone for your help, I was initially looking for a big leak but I looked at my outdoor tap and seen there was a small leak on it, like a spray of mist - isolating that solved the problem

Is my water pump short cycling?


FOSUserBundle modified profile edit page

Question: I have updated my registration form, added a few fields. Registration works properly, nowever when i go to Profile/edit page, i do not see the new fields. Even I manually try to add
 {{ form_widget(form.country) }}

it does not work, can not find country. Which file i need to update to be able to update the profile edit page?
Entity\User
protected $position;

/**
 * Set position
 *
 * @param string $position
 * @return User
 */
public function setPosition($position)
{
    $this->position = $position;

    return $this;
}

/**
 * Get position
 *
 * @return string
 */
public function getPosition()
{
    return $this->position;
}

Answer: You need to override the ProfileFormType class following something similar to this. Also, for validation, FOSUserBundle uses 2 validation groups: Registration and Profile. You need to add the Profile validation group to your property.
Comment: The link is dead.


What is the standard zooming factor?

Question: I am making a simple graphing widget that will have zooming functionality.
I need to decide the zoom factor to use for typical + / - zoom buttons.
My intuition is to go with 15%.
What zoom factor will jive best with user expectations about zooming in general?
Update: the data being graphed are user-provided, so the widget doesn't know what kind of data are in there.
Comment: I think the answer depends entirely on the context of the data being graphed.
Comment: Well, there is no 'standard' since its dependent on the content, and since the content is an unknown, I think you're likely going to have to make a guess at it and see how it works.
Comment: Content here means what exactly? The data from which the graphs are built or the type of the graph? If the latter is known we could come up with a better answer.
Comment: @DA01 please see question update
Answer: It's only a suggestion, but you might try to implement a system that zooms depending on how long the user pressed the zoom button. I think it would be nice to make the content zoom along with the mouse button. So, as long as the user holds the mouse button/keyboard button pressed, keep zooming smoothly and slowly enough to make sure the user has to ability to release the button in time.
I think the zoom speed should depend on the size of the content. How larger how faster is zooms. But ensure you have a nice maximum zoom speed. This, in combination with the current zoom factor. I would slow down zooming slowly.
It's just an idea. I don't know if it will be cool, but I think it is worth trying it, if this is applicable for your situation.
Comment: There's a downside to this as well. When the user wants to zoom to full size, he may have to wait too long for that, and then wait some more to realize it is the full size.
Comment: A double click could make it zoom at 100%.
Answer: According to me the zoom factor should also correspond to whether any new information is made visible by zooming using that zoom factor. Ie whether its 15% or 30% if nothing new is shown once the user zooms once, the user has to zoom many times to actually get to what he/she wants to see.
Conversely if the zoom is too much the user will lose orientation with respect to the whole graph.
I doubt I have answered your question but do keep these constrains in mind. The zoom factor should depend on these constraints.
Answer: From the user point of view, I would like an image to zoom in to its actual size in 4, preferably 3, steps.
25% -> 50% -> 75% -> 100%
20% -> 40% -> 60% -> 80% -> 100%
Comment: For the sake of closing the question, I've awarded the accepted answer to the only one providing a concrete answer. All the answers pointing out that it depends on context are valid, but I still have to decide how to design my widget.
Comment: @ted.strauss Tx. Do let us know when you do decide and adopt a method for your design.
Comment: i'm going to start with 20-40-60-80-100 and revise after alpha testing, which might not be for a couple months. i'll come back and post a link.
Answer: You may want to use a slider that zooms in when slid to the right/top and out to the left/bottom. This way the user can decide exactly how far they need to zoom in on the graph.
Answer: There is no standard - it depends entirely on what's being displayed.
Comment: How do you know there's no standard? Maps have a set of standard scales, for example.
Comment: @dnbrv - if you know of a standard zooming factor that suitable for miscellaneous / unspecified data, I'd be really happy to be proven wrong ;)
Comment: Not knowing of any is not an authoritative reference.
Comment: Sometimes empirical knowledge provides enough to realise that a question cannot possibly be answered. All answers on this page so far, are based upon conjecture.
Comment: @Kris, if someone asked you, "what's the standard colour? " what would you tell them?
Comment: My answer would be "depends". There are definitive standard colors - navy blue, post office red, for example.
Comment: My case in point :)

What is the standard zooming factor?


Can I store character type in python array?

Question: from array import *
>>> ch = array('c',['A','B','D'])
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    ch = array('c',['A','B','D'])
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)

When I compiled above python code, the compiler showed an error.
Comment: How about you use one of the documented type codes instead of "c": https://docs.python.org/3/library/array.html
Comment: because i also wants ask same question instead of "s". sorry
Answer: The only supported array type for strings is Unicode character, with the type code u:
ch = array('u', ['A', 'B', 'D'])

Comment: Why not read the official documentation for [`array`](https://docs.python.org/3/library/array.html)? All type codes are explained there.
Comment: thank you so much brother.Please suggest me any good book for python(basic?+advance)
Comment: i love reading books. sometime internet connection very slow or network issue.Please suggest me book in which all topics are precise and clear with examples
Comment: @Manjeet Look no further than https://www.python.org/doc/, which links to books, and even lets you download the documentation for offline reading.
Answer: If you only want to store ASCII characters, you can use unsigned char: "B".
They must be converted with ord(), though:
ary = array("B", [ord(c) for c in ("A", "B", "C")])
# array('B', [65, 66, 67])

for i in ary:
    print(chr(i))

Answer: use a list :
# define list
chs = ['A','B','D']

# iterate on list
for ch in chs:

    # do stuff
    print(ch)

Answer: try to initialize the array with ch = ['A','B','D'] instead of calling array()
Comment: And what if using a typed array is precisely what OP wants to do…?!
Comment: you mean to say that  i should use list instead of array?
Comment: yes, mainly because you do not need to specify the datatype of lists since python does that for you. you can still use array() but you would need to use a valid type code for that.
Comment: ok then tell me valid type code for character type array ?


how to securely erase disk I am currently on?

Question: I am going to sell my notebook and want to erase my 256GB SDD before so that data cannot be restored under any circumstances.
Using tools like shred and dd I can do that with certain partitions which I am not currently running my OS from.
But since I only have one partition on my notebook, I am wondering how/which tool I can use to safely erase/overwrite the content?
Comment: You should not try to destroy the contents of your disk while you've booted to it. If you want to completely destroy everything, boot to a usb device and destroy it from there
Comment: Does this answer your question? [How to delete file(s) in secure manner?](https://askubuntu.com/questions/57572/how-to-delete-files-in-secure-manner)
Comment: Is the SSD an NVMe device or does it have a SATA interface?
Comment: matigo how to I find that out?
Comment: If you open Terminal and type `lsblk`, you will see the layout for the storage devices. If your main storage device is something like `nvme0n1p1`, then it's an NVMe storage device. If you see `/dev/sda`, then it's using a SATA interface (even if it's in an m.2 slot). If you are using an NVMe disk, then you can (probably) wipe your disk in a half-second without killing it with a full `shred` or `dd` sequence ...
Comment: "under any circumstances" ?  Suggestion... Boot from live usb. Use gparted to delete the partitions, add a new partition formatted to ntfs or exfat. Use shred to fill the card completely with zeros: single pass. Install the new o/s. To verify, you will need to create another live usb specific to the forensics environment, then see what residual fragments may be possibly recoverable. Expect this process to consume days of time.
Answer: You cannot sit on the chair while sawing the legs off. Similarly, a partition you want to wipe should not be in use.
Start a live session using a live USB or DVD, or alternatively, boot into a recovery prompt, and shred the partition from there.
Consider whether shredding is worthy the time and trouble. Reformatting the partition or erasing partitions will be quite faster. Recovering binary data after that already will be very difficult. Someone will really need to have high interest in your data to spend the effort and time recovering these.
Answer: If you are using an NVMe storage device, then you can securely erase all data with the nvme-cli utility:

Boot the computer with an Ubuntu installation USB and choose "Try Ubuntu"
Open Terminal
Erase the encryption key for the flash modules:
sudo nvme format -s2 /dev/nvme0n1

Note: Be sure to replace nvme0n1 with the actual device you wish to clear.
TRIM and zero the flash modules:
sudo blkdiscard /dev/nvme0n1

After this is done, it is pretty much impossible to get any data back.


Vuejs image src isn't reactive

Question: I'm working with Vuejs and have 3 images, a schedule determines which image displays. The appropriate src is loaded in the Computed section so that the images cycle reactively, but it still won't change image unless I manually refresh.
<template>

</template>

My image paths come from the public folder and I have an inkling it's to do with this. Thank you!
Comment: Does this answer your question? [How to bind img src to data in Vue](https://stackoverflow.com/questions/48847644/how-to-bind-img-src-to-data-in-vue)
Answer: I just had a problem with this, and for me it was caused by the fact that the server always named images as original.ext, so it wasn't reactive because the filename was always original.jpg
My fix without changing the server to use more reasonable filenames was to simply append a timestamp to the filename.
For example, in my app, there are two functions that load user data: the login function and the check-access-token function. Both of those make a request to the server that returns the user object that has an image field with the filename that remains unchanged even though the file itself is mutating.
My fix was to set the user object as normal but also store the timestamp that the user data was set, such as:
this.user = response.data.user;
this.refreshed_user_at = (new Date()).valueOf();

This allowed me to version the filename which makes it reactive when the filename remains unchanged and the timestamp is changed:
<img :src="`${auth.user.image}?v=${auth.refreshed_user_at}`">

That results in a DOM element:

I think the original question here is a different problem. In my experience, the img src is reactive when the filename changes in Vue JS, so the problem can only be related to getSrc not updating when values used inside it are changed, thus the filename is not changing. I think more likely here the problem is related to v-if="getSchedule(currentHour()).includes('s1')" because the condition is the result of the method call, and those are not reactive. I would prefer to see a solution that uses a computed prop instead for the condition.
It's tough to recommend a quick fix because I don't understand what the UX goal is. The component seems to be lacking logic related when it should call this.getSchedule(currentHour()).
Perhaps you can simply call it once a second:
data() {
    return {
        intervalId: null,
    };
},

mounted() {
    this.intervalId = setInterval(() => {
        this.getSchedule(this.currentHour());
    }, 1000);
},

beforeDestroy() {
    clearInterval(this.intervalId);
},

Most likely my preferred solution would be to merge getSchedule and getSrc into one computed prop that reads the current hour and returns the correct filename, and then put a setInterval function that sets the current hour into the component state once per second. Then if that merged function is a computed prop, it will automatically update the filename every time the hour changes.

Vuejs image src isn't reactive


Align center flutter

Question: why the container does not align to the center? it always align to the left although I specified that it to align to the center.
Row(

              children: <Widget>[
                Align(
                  alignment: Alignment.center,
                  child: Container(
                    width: 250,
                    color: Colors.grey,

                    padding: const EdgeInsets.all(3.0),

                    child: FittedBox(
                      fit: BoxFit.contain,
                      child: PostBody(),
                    ),
                  ),
                )
              ],
            ),

Answer: Because of the Row. It defaults to MainAxisAlignment.start which is left.
Add this to your Row:
mainAxisAlignment: MainAxisAlignment.center,

And you can remove the Align.
Answer: Try below code hope its helpful to you. just change your widget instead of my widget.

Refer Row widget here
Refer Align class here
Refer Layouts here

Your Code:
Row(
    mainAxisAlignment: MainAxisAlignment.center,
    children: <Widget>[
      Align(
        alignment: Alignment.center,
        child: Container(
          width: 250,
          color: Colors.grey,
          padding: const EdgeInsets.all(3.0),
          child: FittedBox(
            fit: BoxFit.contain,
            child: Text('OK'),// add your PostBody(), widget here
          ),
        ),
      )
    ],
  ),

Your result screen->
Answer: try this by applying property to Row
Row(
               mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Align(
                  alignment: Alignment.center,
                  child: Container(
                    width: 250,
                    color: Colors.grey,

                    padding:  EdgeInsets.all(3.0),

                    child: FittedBox(
                      fit: BoxFit.contain,
                      child: Text('hello'),
                    ),
                  ),
                )
              ],
            )

Answer: You can try this solution :

Row(
  mainAxisAlignment: MainAxisAlignment.center,
  children: <Widget>[
    Container(
      width: 250,
      color: Colors.grey,
      padding: const EdgeInsets.all(3.0),
      child: FittedBox(
        fit: BoxFit.contain,
        child: PostBody(),
      ),
    )
  ],
),
Answer: I think the error in align Widget because the container already have align you can use it inside a container and remove Align widget if you need it in the center of screen like
alignment = Alignment.center

if you want it in the center of row you can use
mainAxisAlignment = MainAxisAlignment.center

Align center flutter


Can TensorFlow Lite can detect material of object and object itself at a time in android studio?

Question: Is there any way to simultaneously detect the material of any specific object and the object itself in android studio for android applications?
Comment: Hi @Laura I have done material detection already with some pretrained models but that is not so accurate and lot of things to do with that so I was thinking that combination of both material detection and object detection can fix that. But at this point I'm not sure too, that what can I do for that!! If I'll find something will post here.
Comment: Hi @Laura,
You can run multiple models in sequence order, but that will be more costly (in time), so it will take longer time to process one frame. The workflow would go smth like this:
1. First you will have to detect the objects, e.g: Drink
2. Then from 1 you will have the coordinates of bbox where that Drink is located
3. Use coordinates from 2. to crop the original frame and take the cropped part
4. Resize it to the dimensions of the second ML model (classifier)
5. The second model (depending on how its trained) will output smth like: Juice, Apple or smth else
Comment: After you have the coordinates you should crop from the original frame that part using this method: Bitmap croppedBitmap = Bitmap.createBitmap(bitmapOriginal, 100, 100,100, 100); , instead of "100" use your coordinates. Then use that cropped bitmap as input for your other model. Its a little hard to write all the logic here without having the app to run and test :/
Comment: Hi @Twisha Kotecha, I'm trying to do something similar. Firstly I ran object detection with yolo. Now I want to understand what the object is. I trained classification model with vgg16.  It should work after Yolo. and I'm stuck right here. Maybe you can guide me:)
Comment: Hello:) @Twisha Kotecha My question is here , https://stackoverflow.com/questions/75697529/classification-model-after-yolo-model    I guess i need to pass the bounding box coordinates through the classification model. but i still don't know exactly where to do it.  I followed here for android yolo. https://github.com/AarohiSingla/TFLite-Object-Detection-Android-App-Tutorial-Using-YOLOv5
Comment: Hi, @Laura it seems like you have done object detection with a bounding box and I have done material detection of objects so which means we both have single- single functionalities but we want them combined, so as per my research we need to train a model in a way which can detect both simultaneously.
Comment: Hello, @Twisha Kotecha, I thought I was going to use more than one model. Example: dinner food detective yolo model, then classification model for soup,main course,salad,dessert then  classification model( for soup: lentil soup, tomato soup, chicken soup; for Main Couse: Fish,Meat, Schnitzel, for Dessert: chocolate cake, macaron)   I have separate .tflite files for each classification model and yolo model. dinnerfood.tflite  ,  SoupMainCourseDessertSalad.tflite, SoupTypesMainCourseTypesDessertTypes.tflite
Comment: Can i run these models after passing through bounding box ? Do I need one model for everything? Please, Can you elaborate? youtube.com/watch?v=ZepT3N6aNFM&t=881s For example in this video he uses separate models, I saw it at 22:01 minutes of this video
Comment: Hi @Notron,  thank you very much for replies. I did object detection. coordinates of bbox : RectF(0.0 ,12.216019, 415.0 412.68738) I found the coordinates in DetectorActivity.java.  How do i pass it through the classification model ?
Comment: @Notron https://stackoverflow.com/questions/75697529/classification-model-after-yolo-model  I added the DetectorActivity code here. Should I crop coordinates after object detection ?
Comment: Hi @Notron crop part is ok. now how do i run my classification model for types?
Comment: the logic should be similar with running ObjectDetection, you should load the Interpreter the same way (with different ml model), and when you get the cropped bitmap you should rescale it in the dimension that the classification model has and input in the second interpreter. I would suggest to try first with only one image (crop image) just to measure the inference.
Comment: @Notron I can't get the cropped bitmap. https://stackoverflow.com/questions/76506244/bounding-box-cropping code snippet here
Answer: For future reference I am doing a small recap of my suggestions from the comments section.
There are two ways to "simultaneously detect the material of any specific object and the object itself" or to do smth similar:

You train a custom ML model to do that, convert that to .tflite and deploy it on your app (I think from ML side this could be more difficult)
You train/get two different ML models, one for object detection (you can find pretrained models for most of the objects, or you train one if you want to detect more specific object), and the other one it can be a classification model, and depending on your use case I think you have to train one yourself, since it very unlikely to find a pretrained model for your use case. Then you will have to run this two models sequentially, first detect the object then classify it.


cypher delete node and all the list of related node

Question: I'm trying to delete an entire list starting from a given node to the end of the list.
Where is the list of the root,relationship and child nodes. The child nodes can have an undetermined nodes.
<code>(r:Root {name:'masterDoc'})<-[p:previous]<-(s1:schema)<-[p1:previous]<-(s2:schema)<-[pn:previous]<-(sn:Schema)
</code>
When I run the cypher query below I'm getting a Type mismatch: expected Node, Path or Relationship but was Collection
<code>MATCH (n:`Root` {name:'masterDoc'})-[r:previous*]-(s) delete s,r,n
</code>
Any Idea?
Answer: You want to pull out the longest path of nodes, iterate over the relationships and delete each one and then iterate over the nodes and delete them.
UPDATED ANSWER
Improvements to Cypher since this answer was posted allow now for nodes to be detached and deleted with a single command.
<code>// match the path that you want to delete
MATCH p=(:Root {name: 'masterDoc'} )-[:previous*]->()
WITH p

// order it in descending order by length
ORDER by length(p) desc

// grab the longest one
LIMIT 1

// delete all of the relationships and their nodes
DETACH DELETE p
</code>
OLDER ANSWER
NOTE: This assumes that each node in the path is no longer anchored to anything other than the nodes in the path otherwise they will not be able to be removed.
<code>// match the path that you want to delete
match p=(:Root {name: 'masterDoc'} )-[:previous*]->()
with p
// order it in descending order by length
order by length(p) desc
// grab the longest one
limit 1
// delete all of the relationships
foreach (r in relationships(p) | delete r)
// delete all of the remaining nodes
foreach (n in nodes(p) | delete n)
</code>
Comment: I like it. I will update the answer. For whatever reason I though DELETE would only operate on a node or a relationship and not a path. I presume you mean the path and not the node p in your query. thanks.
Comment: does not make sense to me, why do a foreach then delete?
Comment: That is just how `FOREACH` is structured. It is really just `FOREACH( loop control structure | mutating operation )`. I updated the answer to reflect some changes in cypher that allow for a new improved approach.
Comment: uh I mean why not delete like this?

`(p:Root {name: 'masterDoc'} )-[:previous*]->()  DETACH DELETE p`


Why do I have a purple key?

Question: Ever since visiting Davy Jones' Locker, this thing showed up in the upper left:

What does it mean?  How did I get one filled? How do I fill/get the rest?
Comment: Whatever it is, I just died and it's still there...
Answer: Davy Jones locker has 4 keys you need to collect before the path to the boss opens up. A recent bug in the latest build has caused the menu showing those keys to never go away (it's supposed to disappear once you leave the dungeon).
You can find the official forum post for the build that introduced the bug here.
As far as I can tell, there's no known fix for it right now.
Comment: Ah!  This explains why I didn't have a quest indicator!  The key is gone now.  Thanks!

Why do I have a purple key?


Uncaught ReferenceError: module is not defined

Question: As the name implies. I am experiencing an issue using the reserved keyword "Module" on bower launch. It seems to relate specifically to the code below. I cannot seem to find the exact location, as it starts at "fetch-bower.js:1". Can anyone please help me to understand how to work around this problem?
(function () {
    'use strict';

angular.module('BlurAdmin.theme.components')
.directive("digitalClock", function ($timeout, dateFilter) {
        return {
            restrict: 'E',
            link: function (scope, iElement) {
                (function updateClock() {
                    iElement.text(dateFilter(new Date(), 'H:mm:ss'));
                    $timeout(updateClock, 1000);
                })();
            }
        };
    });
});

//HTML

Agu State:

Agu Mode:

Last Update:

    <digital-clock></digital-clock>

//Directive.js
(function () {
  'use strict';

  angular.module('BlurAdmin.theme.components')
      .directive('pageTop', pageTop);

  /** @ngInject */
  function pageTop() {
    return {
      restrict: 'E',
      templateUrl: 'app/theme/components/pageTop/pageTop.html'
    };
  }

})();

full error
fetch-bower.js:1 Uncaught ReferenceError: module is not defined
    at fetch-bower.js:1
(anonymous) @ fetch-bower.js:1

Comment: @Jax No good, threw a whole list of warnings, but the error still remains in the browser.
Comment: post your complete code with references
Comment: try `angular.module('BlurAdmin.theme.components', [])` as stated in the [angular docs](https://docs.angularjs.org/guide/module).
Comment: @PatrickEvans To clarify, the browser tools are showing the issue. Pointing to Bower launch position 1
Comment: are you refering the directive in index.html
Comment: @Sajeetharan can you clarify the question? Still very new to angular.
Answer: Make sure you refer the angular.js and Directive.js in the index.html of the application

also you should have empty dependencies injected to your application,
  angular.module('BlurAdmin.theme.components',[])
      .directive('pageTop', pageTop)


Java 8 grouping by, counting and transforming to custom object

Question: I have this code:
Map<List<Object>, Long> collector = root.getReports().stream().collect(
    Collectors.groupingBy(r -> Arrays.asList(i.X(), i.Y(), i.Z(), i.A()), Collectors.counting()));

for(Entry<Object, Long> entry : collector.entrySet())
    System.out.println(String.format("%s = %s", entry.getKey(), entry.getValue()));

Which basically produces this:
[16292, 141, 6, 100] = 2
[16288, 250, 59, 500] = 14
[16286, 250, 91, 50] = 4
[16287, 250, 91, 60] = 29
[16286, 250, 91, 80] = 10
[16293, 141, 6, 100] = 3
[16282, 079, 116, 50] = 9
...

I need to to put this results into a custom class, this one:
@EqualsAndHashCode @ToString
public class CustomReport implements Serializable {
    private static final long serialVersionUID = 2074900904056768029L;

    @Getter @Setter
    private Integer x, y, z;

    @Getter @Setter
    private String a;

    @Getter @Setter
    private Long result;
}

There's a way to do this without go through all the list and doing it manually?
Comment: What do you mean by "manually"? You have to write the code mapping one `Entry, Integer>` to `CustomReport`.
Comment: Depends what you mean by "go through all the list and doing it manually."  You will need to loop over the `entrySet` returned by the collector somehow, whether in a stream or in a for loop, and you will need to manually assign each variable.
Answer: Not sure if this is what you want. But you can get a Map<CustomReport, Long> directly instead of first creating a Map<List<Object>, Long> and then going through it to convert those objects to your target class.
The prerequisite is that CustomReport should have equals() [1] and hashCode() [2] implemented
Then you can do this:
root.getReports().stream().collect(
    Collectors.groupingBy(i -> new CustomReport(i.X(), i.Y(), i.Z(), i.A()),
        HashMap::new,
        Collectors.counting()));

I am assuming CustomReport has a compatible constructor too. If you have to initialize with setters, then you can replace the first argument of the classifier with :
i -> {
    CustomReport c = new CustomReport();
    c.setX(i.X());
    ...
    return c;
}


symbolic matrix with fixed elements

Question: I am trying to create a symbolic matrix but I want to fix some of it elements to 0 in order to reduce the size of the problem. I also want to send all the values to be positive. I have tried this:
X   = sym ('x',[n,n]);
X = sym(X,'positive');
X=times(X,Xf);

where Xf is an nxn matrix with zeros where I want to have fixed values and ones where I want to have the variables in the matrix.
When I solve the problem using fminunc I get some negative values and I also have non zero values for the values I wanted to fix.
n in my case is 30 and solving it with fmincon was not possible
Comment: Could you give some insight on the kind of problem you are trying to solve? I do not quite understand why you want to use fminunc with a symbolic matrix.
Comment: I trying to optimize a matrix of variables such that the differences between its elements and some base matrix elements as well as the difference between the sum of its columns and rows and two base vectors is minimized.@LucaCiti
Answer: After reading your answer to my question, I think you do not need to use symbolic variables. Assuming you want to minimize the squared difference, you can try the following:
    n = 30;
    sumc = (10:n+9)'; % example target sum along columns
    sumr = 15:n+14; % example target sum along rows
    Xtarget = magic(n);  % example target matrix
    Xf = fliplr(eye(n)); % example masking matrix
    X = zeros(n); % example matrix with constant values for masked inputs

    if 0 % easy test case
        X = Xtarget;
        sumc = sum(X, 2);
        sumr = sum(X, 1);
    end

    ix = find(Xf);
    cost = @(A) norm(A(:) - Xtarget(:)) + ...
                norm(sum(A,1) - sumr) + ...
                norm(sum(A,2) - sumc);

    x = fminunc(@(x) cost(subsasgn(X, substruct('()', {ix}), exp(x))), rand(length(ix), 1)); %#ok<SUBSASGN>
    X(ix) = exp(x);

Comment: Would you please explain how did you include the constraints of X>0 and  the elements that are forced to be zero in the matrix?
Comment: I did not force elements to be zero but to be an arbitrary constant (for example one). I edited the example so it's zero now.
Regarding the positiveness, one can try to use an exp function. See edited answer.

symbolic matrix with fixed elements


What's the best way to seal an access hole in a wooden gate?

Question: I have had to cut out a square hole in a tall wooden garden gate in order to be able to gain access to the bolt and padlock that sits on the side of my garden. I've put all weather seal on the cut edges but despite all my sanding and tidying up, the hole still looks a bit untidy and crappy.
Could anyone suggest a good way of putting a border around the inside of the hole to make it look nice and neat?
Answer: If your goal is to make the hole look "neat" instead of just a chunk cut out of the fence gate, I would suggest simply adding a little trim around the hole like was done in the picture below.  Obviously your hole is probably smaller, and a thinner trim would need to be ripped from fence boards, but the concept is the same - cover the rough, unfinished edge of wood with nice, sharply cut trim.

Another option would be to grab some "outside corner molding" which is sold at most stores that stock interior moldings.  It would need to be treated to handle the weather.


Resources for image processing/analysis with Python

Question: I have minor Python experience. I would like to change that with the help of whatever suggestions you may have for me.
I would like to create a program which could process several images one-by-one and output edited images where all particles in the original image have been detected and classified; this could also be supplemented by additional spreadsheet data which lists the total amount of particles, their size categories, and other parameters specific to each detected particle. Example: Black circles or ellipses over a gray background are detected and the results are output; there are 3 circles, 4 ellipses, etc.
I would like to learn how to write such a program, or series of scripts, by myself, or at least have a better idea of how to proceed. I am most familiar with Python. Could anyone with particle detection/analysis, image processing experience please direct me toward material that would be helpful in my case? It can be something as basic as Python for Dummies, just anything someone in the field has once read and would consider conducive to my end goal. Anything that could provide me with bits of knowledge necessary to make the above idea a reality. Any books, videos, websites, regardless of skill level necessary, advanced or basic, would be appreciated.
Thank you very much.
Answer: I think you're asking about two things:

Image recognition
Image analysis

For the first, it's a fairly wide topic. Depending on your use case, scikit-learn might cover your needs. The scikit-learn assumes some knowledge about ML / image recognition though. It's showing how to use their tools to do what you know you want to do. So, if you know aobut image recognition already, then scikit-learn is a good place to go next.
Good examples include

classifying the classic MNIST hand-written digits dataset: https://scikit-learn.org/stable/auto_examples/classification/plot_digits_classification.html
face detection: https://scikit-learn.org/stable/auto_examples/applications/plot_face_recognition.html

Regarding image analysis, commonly used libraries include OpenCV. I'd point in your the direction of their free courses:
https://opencv.org/university/free-courses/
Good luck!


Smoothing out a Line chart with Matplotlib

Question: I have a pandas data frame that looks like this:
import pandas as pd
import matplotlib.pyplot

data = [{'A': 21, 'B': 23, 'C':19, 'D':26,'E':28,
        'F':26,'G':23,'H':22,'I':24,'J':21}]

# Creates DataFrame.
df = pd.DataFrame(data)

plt.figure(figsize=(12,8))

df.iloc[-1].plot(marker='o',markersize=5)

plt.show()

When I try and plot this in Matplotlib, I end up with a very jagged line.
Is there a way I can smooth the line out to make it look more curved and fluid?
I have tried to use scipy's interpolate, but have not been successful.
Thanks
Comment: Interpolation should indeed do the trick. Why did that not work? Any error messages?
Comment: You are trying to plot over a discrete x-values (`ABCDEFGH`). I doubt you can get satisfactory result.
Comment: Yes, that is indeed the issue I am having with interpolate. My x-values are strings. Is there no way around this? Thanks
Answer: This should do the trick:
import pandas as pd
import matplotlib.pyplot as plt
from scipy import make_interp_spline

data = [{'A': 21, 'B': 23, 'C':19, 'D':26,'E':28,
        'F':26,'G':23,'H':22,'I':24,'J':21}]

# Creates DataFrame.
df = pd.DataFrame(data)

y = np.array(df.iloc[-1].tolist())
x = np.arange(len(df.iloc[-1]))

xnew = np.linspace(x.min(), x.max(), 300)
spl = make_interp_spline(x, y, k=3)
ysmooth= spl(xnew)

plt.plot(xnew, ysmooth)

Comment: This is exactly what I needed. The only thing I had to change was np.arange(len(x)) in line 12, to np.arange(len(df.iloc[-1])). Thanks for the help.
Comment: You meant to write `from scipy import make_interp_spline` I believe!
Answer: This is one option (not necessarily the ideal answer though):
You can try and use a polynomial approximation for the data, however you need numeric values for both you x and y axis, i've tried the below:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

#note i've changed the A,B,C... to 1,2,3...
data = [{1: 21, 2: 23, 3:19, 4:26,5:28,
    6:26,7:23,8:22,9:24,10:21}]

#Creates DataFrame.
df = pd.DataFrame(data)

#define your lists
xlist = df.columns.tolist()
ylist = df.values.tolist()
ylist = ylist[0]

#plot data
plt.figure()
poly = np.polyfit(xlist,ylist,5)
poly_y = np.poly1d(poly)(xlist)
plt.plot(xlist,poly_y)
plt.plot(xlist,ylist)
plt.show()

Another option could be the Spline interpolation, the s parameters will allow you to adjust the smoothness of the curve, you can test several values for s:
from scipy.interpolate import splrep, splev

plt.figure()
bspl = splrep(xlist,ylist,s=25)
bspl_y = splev(xlist,bspl)
plt.plot(xlist,ylist)
plt.plot(xlist,bspl_y)
plt.show()


Bucket count on Elasticsearch

Question: I'm trying to extract users with statistics on wearable device usage. The loyal users are the ones who have used the wearable device for more than 20 days in the last 30 day and their average usage of the wearable device is greater than 4 hours per day.
So, in short, a loyal user = (minimum 20 days use + avg use per day > 4 hrs)
In Elasticsearch the usage documents are indexed according to the dates and usage hours.
{
id:"AL-2930",
"usage_duration":4.5,
"sessionDate":"2020-05-01"
},
{
id:"AL-2930",
"usage_duration":5.5,
"sessionDate":"2020-05-02"
},
{
id:"AL-2931",
"usage_duration":3.5,
"sessionDate":"2020-05-01"
},
{
id:"AL-2931",
"usage_duration":3.0,
"sessionDate":"2020-05-02"
},

The query I'm trying to run gives the results correctly.
{

  "aggs": {
    "users": {
     "terms": {
        "field": "id",
        "min_doc_count": 20,
        "order" : { "_key" : "asc" }
      },

      "aggs": {
        "avg_usage": {
          "avg": {
            "field": "usage_duration"
          }

        },
        "usage_filter": {
          "bucket_selector": {
            "buckets_path": {
              "avgUsage": "avg_usage"
            },
            "script": "params.avgUsage > 4.0"
          }

        }

      }
    }

  }

}

The results I get is like this:
{
    "took": 15,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 2139,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    },
    "aggregations": {
        "patients": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 1926,
            "buckets": [
                {
                    "key": "BG-P-A100CR",
                    "doc_count": 24,
                    "avg_usage": {
                        "value": 4.5
                    }
                },
                {
                    "key": "BG-P-A102XF",
                    "doc_count": 24,
                    "avg_usage": {
                        "value": 5.5
                    }
                },
                {
                    "key": "BG-P-A103ZU",
                    "doc_count": 24,
                    "avg_usage": {
                        "value": 5.0
                    }
                },
                {
                    "key": "BG-P-A104IA",
                    "doc_count": 24,
                    "avg_usage": {
                        "value": 6.5
                    }
                },
                {
                    "key": "BG-P-A104ZL",
                    "doc_count": 24,
                    "avg_usage": {
                        "value": 4.5
                    }
                },
                {
                    "key": "BG-P-A106BT",
                    "doc_count": 24,
                    "avg_usage": {
                        "value": 5.0
                    }
                },
                {
                    "key": "BG-P-A110VY",
                    "doc_count": 24,
                    "avg_usage": {
                        "value": 5.5
                    }
                }
            ]
        }
    }

What I really need is the query to return the total number of buckets in the buckets found. I tried answer from a similar question (Count buckets returned by sub aggregation) but it did not help.
Answer: Would the below help:
POST <your_index_name>/_search
{
  "size": 0,
  "aggs": {
    "users": {
     "terms": {
        "field": "id",
        "min_doc_count": 20,
        "order" : { "_key" : "asc" },
        "size": 100,                       <----- Added this
        "show_term_doc_count_error": true  <----- Added this
      },
      "aggs": {
        "avg_usage": {
          "avg": {
            "field": "usage_duration"
          }
        },
        "usage_filter": {
          "bucket_selector": {
            "buckets_path": {
              "avgUsage": "avg_usage"
            },
            "script": "params.avgUsage > 4.0"
          }
        },
        "bucket_count":{
          "bucket_script": {
            "buckets_path": {
              "count": "_count"
            },
            "script": "return params.count"
          }
        }
      }
    },
    "mybucketcount":{
      "stats_bucket": {
        "buckets_path":"users._count"
      }
    }
  }
}

I ran the above query by replacing the "script": "params.avgUsage > 4.0" to "script": "params.avgUsage > 3.0" and made min_doc_count as 2 for the documents set you've mentioned in question and I see the below response:
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 4,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "users" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : "AL-2930",
          "doc_count" : 2,
          "avg_usage" : {
            "value" : 5.0
          },
          "bucket_count" : {
            "value" : 2.0
          }
        },
        {
          "key" : "AL-2931",
          "doc_count" : 2,
          "avg_usage" : {
            "value" : 3.25
          },
          "bucket_count" : {
            "value" : 2.0
          }
        }
      ]
    },
    "mybucketcount" : {
      "count" : 2,             <---- Note this.
      "min" : 2.0,
      "max" : 2.0,
      "avg" : 2.0,
      "sum" : 4.0
    }
  }
}

I'm assuming that you would need the total number of buckets returned by Terms Aggregation i.e. for users and I've simply added the Stats Aggregation to what you have.
Let me know if that helps!
Comment: Also note this in your response `"sum_other_doc_count": 1926`. Could you please try the answer I've updated once more as I've added some more parameters. Let me know what do you observe. Also please do verify by taking two or three sample terms which you think should be coming up as answer but did not show up in if you do a sample term query for that particular term. Note that if the values are case sensitive, it would be treated differently for e.g. `BG-P-A104IA` and `Bg-P-A104IA` are two separate terms. Please do review that as well.
Comment: It only shows 7 results when I try the bucket count over the elastic index. The actual loyal user count that I have in the index is around 82.  I have validated the count from an excel export file of the index with manual counting.
Comment: @Dony could you share your mapping. I'm wondering why is it that you only see 7 buckets. Coz it should work unless there is some issue with any nodes. Could you also check the status of your cluster and confirm that all your nodes/shards are good.
Comment: Yes, the updated answer returns the correct count of 82 users. Thank You

Bucket count on Elasticsearch


Why does this min() call work for dictionaries

Question: I'm trying to find the key of the smallest element in a dictionary.
dictionary = {'a': 5, 'b': 7, 'c': 8}

I should get 'a' as the key.
There was this piece of code that I found but I'm not really sure how it works.
def key_of_min_value(d):
    print(min(d, key=d.get))

I'm confused on what key = d.get means while I'm assuming the min(d, ...) part is saying that it's getting the minimum element in the dictionary.
Answer: The word "key" is a bit overloaded here.  The key passed to min, i.e. d.get, is a callable which is used to transform the values before the comparison. There is a similar key argument for the built-in function sorted.
This "key" is unrelated to the word "key" as used when referring to the keys/values of dictionaries.
So the code works by iterating to find the k in the dictionary for which d.get(k) is minimal.
Answer: From the documentation for min:

min(arg1, arg2, *args[, key]):

Return the smallest item in an iterable or the smallest of two or more arguments.
    If one positional argument is provided, it should be an iterable. The smallest item in the iterable is returned. If two or more positional arguments are provided, the smallest of the positional arguments is returned.
There are two optional keyword-only arguments. The key argument specifies a one-argument ordering function like that used for list.sort(). The default argument specifies an object to return if the provided iterable is empty. If the iterable is empty and default is not provided, a ValueError is raised.

It's important to understand that min operates by iterating through the argument and (without specifying a key) returns the "lowest" ranked value. Comparisons are done with the <, >, etc. operators. When you pass in a callable as key, the individual elements will be used as an argument to this function.
To break this down some more, this is (more-or-less) what is happening when you call min(d, key=d.get):
lowest_val = None
lowest_result = None
for item in d:
    if lowest_val is None or d.get(item) < lowest_val:
        lowest_val = d.get(item)  # These are the elements we are comparing
        lowest_result = item  # But this is the element we are 'returning'
print(f"The min value (result of the callable key) is '{lowest_val}'")
print(f"The min item corresponding to the min value is '{lowest_result}'")

Notice we don't compare each item, but we compare the result of whatever the callable key is, when item is used as an argument.


play framework with ActiveJDBC

Question: I intend to use play web framework with AciveJDBC for persistence. The issue with active JDBC is that it requires instrumentation. My question is ,
Will I need to do a restart on the server to see the changes made on classes that need instrumentation?
Answer: joshua: this has never been attempted, but the answer would be no, you would have to restart the server to have changes in models to have an effect. However, if you practice true TDD and write tests that test models completely, you will not have to restart.
To Pere Villega: your answer is on the mark, and Hibernate truly is a popular framework, but it "being a great tool" is a matter of opinion and IMHO it is not, hence I developed ActiveJDBC.
A small fact: original version of ActiveJDBC back in 2009 did instrumentation on the fly in memory after an app start, which was great, but this has proven unreliable because of some containers' class loader behavior.
Additionally, I developed a Java web framework similar to Ruby on Rails: http://code.google.com/p/activeweb/, which has integration with ActiveJDBC. Currently it will recompile/reload controllers, but will not recompile/instrument models. However, I have plans to introduce this capability into the framework in the future.
cheers,
Igor
Answer: as a disclaimer, I never tried what you said. But from my knowledge on how Play works, this will depend on your integration of ActiveJDBC with Play.
As far as I know, there is no existing module for that integration. This means you will need to create something to plug your model (ActiveJDBC - based) with the Play Model. Similar to what the Siena plugin does, for example.
Once done, with no extra changes Play will only recompile the Java class, using the Eclipse compiler, but it won't generate any instrumentation. For that instrumentation to happen you will probably need to tweak the recompile process so it also generates the instrumentation.
So, short answer, by default instrumentation won't work.
A somehow related question: do you really need ActiveJDBC? What does it offer that JPA/Hibernate (the default in Play) won't? I understand the appealing of an "Active Record"
behavior, but even in the Ruby community there are some complains on its "magic". Are you sure JPA is not good enough? Using it would save you time and headaches when working with Play,  and Hibernate a big team and lot of experience developing ORM, which makes it a great tool...
Comment: Thanks for your detailed response. I was actually trying to stay away from hibernate(when it works it works. when it fails ...). Anyway i will believe that hibernate/jpa wont mess me up in future with unexpected behaviors.

play framework with ActiveJDBC


Tab pages of a tab control get closed when I press enter

Question: I have a tab control with some dialogs as tab pages, I have a button in each of them that creates the next tab, those buttons are set as default buttons, so when I press enter key it goes to next tab. but, after you press those buttons, they become disabled, and when you go back to that tab it doesn't allow the client to click on next button again, the problem is that when I press enter when the buttons are disabled and are not default buttons any more, the tab pages get closed!
It seems enter closes the dialogs! but when I change the tab and come back to that tab again, dialog is showed again!So it means enter does not destroy or close that dialog!
Dialog when the button is enabled.Pressing enter is like clicking on the button:

Same dialog after it creates the next tab:

Pressing enter when the next step button is disabled!

The Dialog after changing the tabs and comming back to that tab again!

I don't understand it's behavior! Notice that I didn't wrote anything for enter button, I just set those buttons as default button, and even when those buttons are not default buttons, it happens!what should I do?
Comment: Hard to guess, a screenshot is a poor substitute for a code snippet.  But the default button of a dialog is like the OK button.  It closes the dialog.
Answer: The default action for dialogs (i.e. what gets called when you press enter, if the focus is not in another button or control that captures enter) is to call OnOk, and by default, OnOk closes the dialog.
So you have to override the dialogs' OnOK function and give them an empty body:
<code>void CMyTabDlg::OnOk()
{
    // Nothing, so it does not close the dialog
}
</code>
Also, you can set the default button to some other button, but I would do the override OnOk thing anyway, just to be safe.


How to obtain generalized barycentric coordinates for n-sided polygon?

Question: Quadrilateral linear basis functions(generalized barycentric coordinates) are defined as:

What are the steps to calculate the above functions?
Is it possible to obtain basis functions for a 5 sided polygon(pentagon) or in general n-sided polygon?
Answer: Quadrilateral basis functions can be calculated using an outer product of the basis of two linear functions (1-r, r) and (1-s, s). The same thing does not apply for arbitrary $n$-sided domains. For this we use generalised barycentric coordinates. Wachspress coordinates are arguably the simplest generalised barycentric coordinates available, are fast to evaluate and are defined for arbitrary $n$.
For a point $p$ on a planar convex polygon defined by vertices $v_1, v_2, \ldots, v_n$, ordered counter-clockwise, you can find weights
$$w_i(p) = \frac{A(v_{i-1}, v_i, v_{i+1})}{A(v_{i-1}, v_i, p)A(v_{i}, v_{i+1}, p)}. $$
Here, $A(v_1, v_2, v_3)$ denotes the signed triangle area. The coordinate functions $\phi_i$ can then be found be normalising the weights $w_i(p)$
$$\phi_i(p) = \frac{w_i(p)}{\sum_{j=1}^n w_j(p)}.$$
Now, the coordinate functions correctly parametrise the point (linear reproduction property)
$$p = \sum_{i=1}^n v_i \phi_i(p).$$
At vertices the coordinates satisfy the Lagrange property $\phi_i(v_j) = \delta_{ij},$ where $\delta_{ij}$ is the Kronecker delta, meaning that the corresponding coordinate function evaluates to 1 at its vertex and linearly interpolate on the edges. It is also important to notice that the coordinate partition unity $\sum_{i=1}^n \phi_i(p) = 1.$
For, non-convex polygons you could use mean value coordinates.
Comment: Thanks for the answer. What happens to the weight function if p is one of the polygon vertices. The Ai triangle becomes a line with zero area? Also what do you mean by signed area?
Comment: I added a paragraph explaining what to do at the boundaries. For the signed triangle area consult [this.](http://demonstrations.wolfram.com/Signed2DTriangleAreaFromTheCrossProductOfEdgeVectors/)


I can't open minecraft 1.8.3 problem in Java?

Question: Whenever I try to open Minecraft the program stops and takes me back to the app launcher, the full problem is listed below.
<code>Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Platform
    at oshi.SystemInfo.<init>(SystemInfo.java:32)
    at h.<clinit>(SourceFile:16)
    at avf.<clinit>(SourceFile:147)
    at net.minecraft.client.main.Main.main(SourceFile:41)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 4 more
</code>
I have tried reinstalling Java and Minecraft.
Comment: The error message looks like it is cut off (`... 4 more`), could you post the full log? Have you tried upgrading to the lastest Minecraft version? Has this problem always occured? Do you have any mods?
Comment: Nope, it does not look like it's been cut off @colorfusion. That is default java behaviour, it does not show the internal stacks that are meaningless to all but people working on the java VM source code.
Answer: This is a not unheard of problem where Minecraft is incapable of downloading the Java Native Access library, mostly because it can't save the files to the location it wants to save them.
Running it as administrator should fix the problem.
Source: http://www.minecraftforum.net/forums/support/unmodified-minecraft-client/2362518-what-was-the-cause-and-the-solution-to-this


Make /sys/devices/system/cpu/intel_pstate/max_perf_pct persistent

Question: Is it possible to make the value of /sys/devices/system/cpu/intel_pstate/max_perf_pct persistent? Is there a kernel parameter? I have to do this to prevent overheating…
I currently set it every time manually after startup using echo 85 | sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct but the value is reset every time I restart the machine.
Comment: No. You will have to make something to automatically run at startup to do what you want. For overheating, yes it is a good idea to find the max_perf_pct where overheat does not occur, just for information purposes. Then it would be a good idea to use a thermal monitoring daemon, such as thermald, to control maximum CPU frequency automatically, thereby not universally limiting the upper bound (i.e. when only 1 core is active, it is probably O.K. to go to higher CPU frequency).
Comment: Hmm, okay, thank you.
Is it worth having a separate thermal daemon for this or can I rely on the daemon (whichever this is?) that already generates these logs:

`[ 3863.970201] mce: CPU0: Package temperature above threshold, cpu clock throttled (total events = 375)`

```[ 3863.975203] mce: CPU0: Package temperature/speed normal```?
Comment: Those messages are directly from the kernel itself. Normally you would not want those (almost) final levels of defence to be hit in the first place. Yes, a properly operating thermal daemon, such as thermald, should take action before the kernel itself has to step in. as a starting point, try it with default settings.
Answer: You may create oneshot service that would set it for you.

Create service

sudo nano /etc/systemd/system/intel_pstate_setup.service
[Unit]
Description=Set maximum performance to 75% and min performance to 30%

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo 75 > /sys/devices/system/cpu/intel_pstate/max_perf_pct; echo 30 > /sys/devices/system/cpu/intel_pstate/min_perf_pct"

[Install]
WantedBy=multi-user.target

Enable
sudo systemctl enable intel_pstate_setup

Reboot
Now when you check you should see:

# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
75


markercluster and google maps v3 error "a is undefined"

Question: I'm struggling trying to cluster 50 markers using the markerclusterer v3 with Google maps API v3.
I've followed the simple example found at: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/docs/examples.html to build my function however when the map is loaded I am getting the following error in firebug:
a is undefined
Ba(H,function(a){if(!a)return l;return...){return new P(this.T.d,this.P.b,i)}; main.js (line 13)

My function is just doing a simple json call to get the point from the server and then build the array of markers before adding them to the markerclusterer.
function addMarkerCluster(){
    //get json data and create array of map markers and mark up the map using
    //a map cluster

    $.getJSON("feed/kml.php?action=json",
        function(data){

            var map;
            var markers = [];

            var latlng = new google.maps.LatLng(24.91654, 15.31326);

            var myOptions = {
                zoom: 3,
                center: latlng,
                mapTypeId: google.maps.MapTypeId.HYBRID

            };
            map = new google.maps.Map(document.getElementById("googlemap"), myOptions);

            google.maps.event.addListener(map, "tilesloaded", function(){
                attachFancyBox();
                hideLoadDialog();
            });

            //loop through the data and add to the markers array the lat/lng of the centerpoints
            //as google lat/lng objects.
            $.each(data, function(i){

                latlng = new google.maps.LatLng(this.lat, this.lng);
                var marker = new google.maps.Marker(latlng);

                markers.push(marker);

            });

            var markerCluster = new MarkerClusterer(map, markers);

        });

}

Any idea why this is causing the google map main.js to fail in this way? If I just add the MarkerClusterer without the array of markers the map renders without errors.
When I add the array of markers then the map errors.
Thanks,
Grant
Answer: Fix was simple I'd miss out the fact that the google maps api v3 needs to have a object passed to it.  The fix was to change
var marker = new google.maps.Marker(latlng)
to
var marker = new google.maps.Marker({'position' : latlng});

Comment: +1 thanks  .. I need to update my plugins .. can you say at what source did you find the solution (webpage, forum..)
Comment: it was a bit of trial and error and reading + re-reading the google maps docs.


What is the difference between "ubuntu software" and "software" centres?

Question: Why are there two software centres in Ubuntu 20.04? What happens if I install an app from both the software centres separately?
Comment: Difference primarily is they are different apps & present details differently.  Yes they can use different sources (eg. some use only standard sources enabled on your system), others can use different sources (ie. *deb* packages from your enabled sources, or snaps from a list), and some vary on the lists they use (and can add sources to your system if you select an app that isn't currently enabled or used on your system). Some may change your sources but only if you install a package that requires it but you won't get duplicates unless you select/cause it (and there are more than two stores)
Comment: Does this answer your question? [Has 'Ubuntu Software' been renamed to 'Snap Store'?](https://askubuntu.com/questions/1252134/has-ubuntu-software-been-renamed-to-snap-store)
Answer: "Software stores" are merely front-ends (GUI) for the actual commands that install stuff so no, you never "install an app from both the software centres separately", you install it from the repositories (.deb or snap or both if you want) regardless of the method or GUI tool.