Can mathematics get from other sciences what it got from physics?

Question: Throughout history, physics has been an unparalleled source of '' inspiration'' for discovering/inventing mathematical ideas, which is due to its ability to describe the physical world. But can this connection be made as profoundly with other fields of science like biology? Can other fields deepen our understanding of mathematics and generate new discoveries/inventions in it? Has this already happened? How so?
Comment: I think we are starting to see the beginnings of this in biology and quantitative finance.
Comment: All we need is another Newton, in a field other than physics.
Comment: Was not Mandelbrot's work in fractals inspired by the natural world?
Comment: I think some interesting results in logic and proof theory have come out of computer science. The PCP theorem is one important example.
Comment: How long do you think will it take to develop more seriously?
Comment: Hard to say, I posted an answer below which might give you some perspective on the economic side.
Comment: I'm almost certain that the first semi-scientific incurrences into electromagnetism came from chemistry and biology, namely by Volta and Galvani. You could say that this was the "spark" that set this study in motion, which obviously led to a world of mathematics. It's a stretch though.
Comment: Computer science, definitely. Arguably, the inspiration has been so strong that an entire new subfield of mathematics (theoretical computer science) has emerged.
Comment: A good article about the biology case: http://www.plosbiology.org/article/info%3Adoi%2F10.1371%2Fjournal.pbio.0020439
Comment: Michael Atiyah argues "no, not even close".
Comment: @Mtiano but quantitative finance is just what a bunch of physicists are coming up with...
Comment: I flagged as "too broad." It's impossible to answer "no" for the reason that it's trivial to produce examples that arguably count. To answer "no" you would have to construct a history of what mathematics got from physics, then construct a narrative for the next several hundred years for mathematics. This is more of a question for Quora, or the break room at a math dept, etc.
Comment: "No, mathematics cannot get calculus." "No, mathematics cannot get rigor." etc. Then the last couple questions in your post the answer is trivially yes.
Comment: @AAA As someone who is a quant and who's PhD work is in mathematics, not physics, I can tell you that's far from true. I might also mention that the vast majority of "econophysics" models out there don't work.
Answer: Of course from economics, as already said, think of Game Theory or Utility Theory.
In the 1940s-1950s a new field called Mathematical Psychology emerged, basic questions of measurement theory(*) (under what conditions and to what extend could qualitative data quantified, and what operations are permissable on that gathered data), of artificial intelligence, learning (for which Markov models where applied). Artificial intelligence is nowadays a part of its own, from connectionistic models, data mining, pattern matching etc all borrow ideas from mathematics.
Also in the 1940s-1950s information theory emerged, which stems some ideas and analogies from thermodynmaics, but essentially has its origin in coding and transmission, so was motivated by electrical engineering.
Last but not least computer science, modelling programs, domain theory, database theory, verification borrowes much from logic and computability theory and also created much theory for themselves (non-hausdorff topology, reasoning about programs by calculus). But also Formal Language Theory, for example finite machines could be interpreted as monoids which opens a whole new door to the mathematical investigation of languages (see Eilenberg, J.E.Pin and many others who created a whole new mathematical theory around that). By the way, formal language theory has its origins also in psychological considerations (see Chomsky, who asked questions about a universal grammar "hard-wired in our brains", to said it simply). Also you might search for Donald Knuth, who wrote a multi-volume compendium on mathematics as applied to computer science, where much of combinatorics is applied to the analysis of algorithms.
And let me add, one of the oldest books, Euclids elements, where not directly motivated by solving physical problems (other then that our physical world permit counting), indeed the platonian view was that mathematical ideas exist outside the physical reality and so mathematics could in theory be done without any appeal to reality.
There are also problems from music, apart form such physical question at what is sound, vibrations, but more concerned with the structure of music itself and not its medium, which motivate new mathematical ideas, look for a guy called Guerino Mazzola who uses Category Theory in Music.
(*) by the way this is not measure theory which is applied in probability and integration,
Answer: This not exactly a science, but it is an outside subject that has helped a lot in the development of mathematics. It was and still is a source of inspiration. I'm talking about gambling or any game which depends on luck.
Probability, during its early days, was not concerned with describing mathematics, or any other subject, but gambling. Nowadays probability has a special place in Quantum Mechanics, Economics, Biology, etc. And of course, probability has its special place in mathematics, being a fundamental subject of study for any mathematician.
Comment: Interesting,can you suggest any other such subjects?
Answer: You might find this interesting, it is written by an applied mathematician who is very well know in the finance industry. http://keplerianfinance.com/2013/05/what-is-keplerian-finance/
Answer: Yes! This might apply to more of computer science and algorithms but look at genetic algorithm which comes straight from Biology. It is a heuristic that mimics the process of natural selection to arrive at an optimal solution or configuration. Basically we define a metric and then generate random solutions and keep the ones that score high on our metric. Then we breed them while also generating random samples. More information here.
Answer: Yes, and I think that psychology has a great potential here. Perhaps not many scientist are devoted to this combination, but a "Newton" might be born somewhere in the jungle of category theory?
Human mind as such has probably absolutely nothing to do with mathematics and my intuition here is directed to the human way of thinking and making decisions. And since there initially could be no better objects to study than the mathematicians themselves, experts of thinking as they are, perhaps some day a light will start to twinkle and enlightening some darkness in human mind?
The benefit would be to extract and classify the patterns of human thinking and their consequences, possibilities and drawbacks. Not in vague philosophical ways or with statistics, but as mathematical models of categories of thinking.
When analyzing the constructive way of thinking, mathematically, the less valuable and even delusive patterns may appear more clear for psychologists and psychiatrists. But also, the study would lead mathematics forward if restraints in our thinking become clear and new examples from reality enriches the theories.
I'm especially interested in qualitative mathematical-psychological theories. The quantitative theories from the 19's and the 20's seems uninteresting and elusive.
I think that mathematics is just as much about inner world as about outer world and might be considered as an extension or product of those two worlds together.

I recently found topics like this
Characterizing projective geometry of binocular visual space by Möbius transformation
Which seems interesting both from the perspective of psychology and of mathematics.
Comment: Please, feel free to comment!
Comment: @Daniel Faust Montana: Yes, only few models of reality are worth substantially more than, lets say, alchemistry. But I think that the coming era of computers will bring down human thinking to it's atoms - but obviously it hasn't happen yet. And the kernel of human thinking is mathematics.


Aren't $\phi^4$ composite operators?

Question: I have this trouble with terminology. I wonder why authors introduce the concept of composite operators after they've already talked about eg phi four theory, it phi cubed. Aren't these operators already composite ones? What's the difference? In particular when considering renormalization, say QED, the procedure goes like introducing factors of $Z^{1/2}$ for each field and so on. So why is the renormalization procedure in QED+Yukawa so different that one needs to consider how composite operators get renormalized? What's the big difference, isn't say $m\bar{\psi}\psi$ of QED already composite?
Comment: What definition of *composite operator* (which, in my experience, is just that of a *local operator*, i.e. some product of fields) are you using? Who are the authors that introduce "composite operators" not already in the simplest applications of Wick's theorem, and that do not consider $\phi^4$ to be a composite one?
Comment: Perhaps phi 4 was a bad example. But what's the difference between Yukawa term and the m-term of QED in this regard? Cheng is the author, but I could be wrong about them not regarding some oleraots as not composite because I've just skimmed through the book, so forgive my ignorance.
Comment: Well, since a local operator is "a product of fields", $\bar\psi\psi$ qualifies as well. My initial comments still stands with the replacement $\phi^4 \mapsto \bar\psi\psi$.
Comment: I must take a deeper look at the book, I'll come back to this.
Answer: Consider a correlator like
$$
\frac{1}{Z}\int \phi(x)^4 \phi(y_1)\ldots\phi(y_n)\ e^{-\int \phi(z)^4 dz}\ d\mu(\phi)
$$
where $d\mu$ is the perturbed free field measure. Both $\phi^4$'s are composite fields but very different ones. The $\phi(z)^4$ in the exponential is a composite field for the free field theory $d\mu$ whereas the $\phi(x)^4$ outside is a composite field for the full interacting theory. In fact, and this is Nelson's proof, it is possible to rigorously construct this interacting theory in 2d (in finite volume) by defining $\phi(z)^4$ as a $d\mu$ composite field (this is just the trivial Wick power renormalization) then sticking it in the exponential and integrating $d\mu(\phi)$.
Basic renormalization theory tells you how to get correlators
$$
\frac{1}{Z}\int \phi(x_1) \phi(x_2) \phi(x_3) \phi(x_4) \phi(y_1)\ldots\phi(y_n)\ e^{-\int \phi(z)^4 dz}\ d\mu(\phi)
$$
AFTER taking the limit $\Lambda\rightarrow\infty$ of removing the UV cut off, for non-coinciding points $x_1,\ldots,y_n$.
To get to the above correlator with $\phi(x)^4$
you still have to follow this by the analysis of the very singular limit $x_1,x_2,x_3,x_4\rightarrow x$. This needs more advanced renormalization theory, typically in the following chapters of QFT textbooks about composite fields and the OPE.
The process I described is in fact the construction of the composite field $\phi^4$
in the interacting theory using the OPE. An alternative construction (in fact the more standard one) is to take the limit $x_1,x_2,x_3,x_4\rightarrow x$ first and then take $\Lambda\rightarrow\infty$. Both procedures should give the same result.
PS: I gave a talk on this just last week at MSU, for a math audience. See
https://www1.math.msu.edu/seminars/gauge_theory/

Aren't $\phi^4$ composite operators?


What is the difference between a generalization and an extension?

Question: Generalizations and extensions are commonplace in mathematics, but I am not clear on what the difference is between the two. Are they really only synonyms? If not, I would appreciate having an example of each, with it being made clear why the generalization should not be called an extension, and why the extension should not be called a generalization.
Comment: I may extend a result from a smaller to a larger set for example, or I can have the result generalised so that it is a corollary of a more general statement. But in either case there is nothing to stop me from calling the generalisation an extension of my 'smaller' result.
Comment: Can you give examples of what you mean? I can explain the difference between generalization and *abstraction*. For example to go from $\mathbb R$ to $\mathbb R^n$ is generalization; to go from $\mathbb R$ to topological spaces is abstraction. So what exactly is extension in this context?
Comment: @user4894: Some would say that for n > 3, the situation is already pretty abstract. My take is that it is good to be aware, as you point out, of the two poles of generalization and abstraction, but that there is an unbroken transition between them, much like the unbroken transition between vapor and liquid above the critical point in the P-T phase diagram of water.
Answer: Let's start with two examples:

Suppose you have a function $f\colon(0,1)\to\mathbb R$. You can turn this into a function $\tilde f\colon\mathbb R\to\mathbb R$ by defining, for example, $\tilde f(x)=f(x)$ when $x\in(0,1)$ and $\tilde f(x)=0$ otherwise.
The function $\tilde f$ is an extension of $f$, not a generalization.
Maybe you have proved earlier that if $x\leq y\leq x$ for some real $x$ and $y$, then $x=y$.
But in fact the same holds true if $x$ and $y$ are matrices.
There is a natural definition of "$\leq$" for matrices.
In the case of $1\times1$ matrices you get the original version back.
The result for matrices is a generalization of the result on the real line.
I would not object to calling this an extension, but I would prefer to use the word "generalization" instead.

I would say that in general objects are extended and results are generalized.
You might want to extend your field from the reals to the complex (or make some other field extension), or you might want to extend the domain of definition of some function.
Generalization is a more general result that contains the original result as a special case.
If the original result is not included, I would not call the new result a generalization but and analogous result inspired by the original.
Similarly, if a new function is somehow inspired by an old one but does not "contain" it, I would prefer to call it an induced function rather than an extension.
Comment: @EsperantoSpeaker1 Take your time. Accepting immediately would only discourage others from giving their answers. I really appreciate the feedback, but I'm not in a hurry to get 15 more internet points.
Comment: @EsperantoSpeaker1 Words like "extension" and "generalization" are soft, and they can often be replaced by other words. Analytic continuation is a good example of extension. I thought perihelion and aphelion were reserved for objects orbiting a sun (Greek: gee$\approx$Earth, helion$\approx$Sun).
Comment: Very nice. I would accept your answer, but I've been chewed out in the past for accepting an answer before others have had a chance to weigh in (like, at least waiting 24 hours). Although I am a satisficer, not a maximizer, I think I'm going to cave in to public pressure on this one. I am, however, up-voting your answer immediately.
Comment: @JoonasIlmavirta Regarding your first example $f\colon(0,1)\to\mathbb R$: Then it's often, and often tacitly, assumed that it acts on the corresponding power sets $\,\mathcal P\big((0,1)\big)\to\mathcal P(\mathbb R)\,$ in the obvious way $\,S\mapsto\{\,f(x)\mid x\in S\,\}$. *Would you call this
an extension, or a generalisation?*
As for every $x\in(0,1)$ we have $\{x\}\in \mathcal P\big((0,1)\big)$ this smells more a (natural) extension, doesn't it?
Comment: @Hanno I would call that an extension much rather than a generalization. But my preference would be to call it the *induced map* between the power sets.
Comment: @JoonasIlmavirta Yes, bull's eye! That's the most appropriate name. Thx for the induced comment.
Comment: @JoonasIlmavirta: It also seems that 'extension' is the general (no pun intended) term, but that in certain contexts might be replaced with another term. Offhand, I can think of one case, namely 'analytic continuation' – the situation being perhaps similar to the general pair of terms 'perihelion' and 'aphelion', and the particular pair 'perigee' and 'apogee' that apply to Earth-orbiting objects.
Answer: I agree with Joonas that "extension" can be used to refer to objects, such as functions extended to a larger domain while preserving some properties, or in field extensions (a larger field containing the original one). However, we do often use the same word to refer to generalizations of a theorem as well, namely we could say something like "We can easily extend this result to an arbitrary metric space.". Hence you see things like "extended mean-value theorem" and "extended Bayes theorem" and "extended Green's theorem". Also, the Wikipedia article about the binomial theorem even uses both words together: "The generalized binomial theorem can be extended to the case where x and y are complex numbers.".
The bottom line is that the words "generalization" and "extension" turn out to just have the natural English meaning even when used in mathematics, most of the time. It may nevertheless be worth pointing out that there is one technical meaning of "extension" in the field of logic, which has little to do with the common English meaning.
Answer: Let us think of a mathematical object as a set on which some operations are defined. An extension is a bigger object of which the original object is part, while a generalization is a less tightly defined object, of which the original object is an example. In an extension, the operations defined on the original set are extended to apply in a similar manner to the extended set. In both cases, some of the characteristic properties of the original operations hold, but generally not all of them.
The canonical example is the counting numbers: $1$, $2$, $3$, ... . This set ($\Bbb Z_+$) of numbers is extended first by $0$ to the natural numbers ($\Bbb N$) and then by the negative numbers to form the integers ($\Bbb Z$). The latter set may naturally be generalized to varying degrees; in particular, it is an example of a commutative ring with identity, which is not a completely defined object. Another example of such a ring is the ring of polynomials in one variable over the integers, $\Bbb Z[x]$, which is itself an extension of the integers. But not all cases of a generalization need to be an extension: for instance, the "clock-arithmetic" ring $\Bbb Z_{12}$ is not an extension of $\Bbb Z$.
Answer: This thread has been dead for a long time, but I will post my answer nevertheless.
To define generalisation, assume that we have a definition $D_0$ that is given by a set of properties $\{d_1,\ldots\
,d_n\}$ that an object must satisfy to be framed by the definition. This definition leads to a set of elements $C_0$ that satisfies the properties of $D_0$.
Now remove some $d_i$ from the list of properties. This leads to a new definition $D_1$ and a new set of elements $C_1$. Necessarily, $C_0 \subseteq C_1$. In this case, we say that $D_1$ is a generalisation of $D_0$. That is; whenever you remove constraints, you generalise, and in the generaliation, you include more elements.
An extension can be a generalisation. Starting with the natural numbes $\mathbb{N}=\{1,2,\ldots\}$ and extending to the integers $\mathbb{Z}=\{\ldots,-1,0,1,\ldots\}$ causes more numbers to be included in the set; hence a generalisation. This is because $\mathbb{N}=\{n \in \mathbb{Z} | n \ge 1\}$, and we obtain $\mathbb{Z}$ by removing the requirement $n \ge 1$.
But extension can be used about non-generalising actions too.
If $C^1([0,1])$ are the once continuously differentiable function on $[0,1]$, we can make an extension to $C^1(\mathbb{R})$ by requiring $f'(0)=f'(1)=0$, and defining
$$
\hat f (x) =
\begin{cases}
f(x) & \text{for $x \in [0,1]$} \\
f(0) & \text{for $x \le 0$} \\
f(1) & \text{for $x \ge 1$.}
\end{cases}
$$
But this extension cannot be considered to be a generalisation.
$\Sigma$: My impression is that extension should be understood in the general English meaning of increasing the reach of something; being a domain, the number of members or anything alike. Whereas generalisation should be understood as defined above.


EE blocked my stolen phone's sim, will this prevent Lost mode from taking effect?

Question: I had my iphone 6s plus stolen in a nightclub at the weekend, I activated lost mode straight away but the phone was offline. I then phoned EE to report the theft and they blocked the sim, but I've since realised that the phone has to connect to the internet in order for Lost mode to take effect and lock my phone and enable tracking to occur, so have I played into the thief's hands by having the sim blocked?
Answer: If you phone was stolen (and you didn't just lose it) you did the right thing having the sim blocked because it would also work in any other phone - once in possession they would be able to remove the sim, insert it into any other device and you would then be liable for any costs which occur.
Assuming that your phone was protected with a passcode, anyone trying to switch on the phone would not be able to access its content or reset the phone to keep for themselves or sell on.
However, due to the difficulty thief's have trying to re-enable locked phones, its most likely that your phone will have already been taken apart and sold for its parts.
If however you had just misplaced the phone and it was in fact not stolen, then with the phone being offline already, there would again be very little else you could have done anyway. You can still put it in lost mode, lock it, or remotely erase it. The next time your device is online, these actions will take effect.
Comment: Thanks for your reply, I hadn't even considered the sim being put into another phone. The phone was definitely stolen and unfortunately I didnt have the passcode turned on, thats why I really want the Lost mode to get activated so that the phone will be locked. It has been offline ever since it was taken though so I doubt I'll ever get it back.


How to restrict who can post on a channel in Slack?

Question: I want to have a special channel primarily to post company's announcement in my Slack team, and I don't want anybody, except me and a select few people, to post in that channel, to not distract the channel viewer from the announcement content. But I still want everybody to be able to see the content of the channel (e.g. making it one of the default channels new user automatically joins to). Can I do that in Slack? How? Or is there an alternative or workaround to achieve the similar result?
Answer: You can restrict who can post to the #general channel on your team settings, in http://my.slack.com/admin/settings#permissions
Available restrictive options are Team Owners and Admins or Team Owners only.
You can rename #general to something more appropriate like "#announcements".
Currently, you cannot restrict posting rights to other public channels than #general.
More information is available on https://get.slack.help/hc/en-us/articles/220105027-The-general-channel
Comment: Ouw, great information nonetheless. Thanks!
Comment: Since this post was written you can now apply these changes to any channel _if_ you are on at least the Plus plan: https://slack.com/intl/en-au/blog/transformation/managing-slack-at-scale-announcement-channels-and-new-admin-apis
Answer: There still is no way to do it inside Slack :( but I've worked around this by using a simple Slack App using Amazon AWS Lambda. The actual Lambda python function could just as easily be modified to run on some other server, of course.
https://github.com/flipswitchingmonkey/SlackMonitor
Answer: You can do this now in Slack

Create your channel.
Right click on channel name in the side bar, and choose Open channel details
Click Settings | Posting Permissions
Select the You and Specific People radio button, and add team members that are allowed to post to this channel.
Uncheck Allow Threads
Answer: we also need to have some channels that only certain people can post and readonly for others, so I've wrote very simple script that does it for us. You can take a look https://github.com/ypogorelova/slack_blockbot


How to interpret qq plot "not on the line"?

Question: What does it mean for my model diagnostics if my qq plot looks like this:

As you can see .... "off the line".
Comment: Could you share the data or some code that gave you a plot that looks like this?
Answer: It means, the data has non zero mean. Here is the demo, where there are 3 data sets. The first one is generated from standard normal, the second one (the middle plot) is generated with mean $1.0$ and third one (the right plot) is generated with mean $2.0$
<code>set.seed(0)
par(mfrow=c(1,3))
qqnorm(rnorm(1e3))
abline(0,1,col=2,lwd=2)
qqnorm(rnorm(1e3,mean=1))
abline(0,1,col=2,lwd=2)
qqnorm(rnorm(1e3,mean=2))
abline(0,1,col=2,lwd=2)
</code>
Answer: It depends on how you drew the plot and how you determined the line.
A qqplot for a normal distribution usually uses the standard normal (mean 0, sd 1) as the reference distribution.  If you use the $x=y$ line as the reference line (one option, others are based more on the actual data)  Then the points will only be expected to fall on (near) the line if the observed data come from a normal with the same mean and standard deviation (or variance).  If the observed data comes from a distribution with a different mean but the same (or nearly the same) standard deviation and the reference line is $x=y$ then the plot will look like what you drew.
To account for this you could instead use a reference distribution that has the same mean and SD as the observed data, or use a different line than $x=y$, such as one drawn through $Q_1$ and $Q_3$, or a regression line through the middle half of the points (or others).


Way to calculate zoom and pan using canvas and d3.js hierarchical circle structure

Question: I currently have a d3 hierarchical circle pack graph in canvas (with help from this awesome tutorial!)
I wanted to make the graph also pan with the mouse and scale with the wheel in addition to zooming in to a node. I used this.
Now, when I first pan and then zoom to a node using the initial scale (When the page first loads), it works as expected. It zooms to the node from wherever the graph's last panned position was.
But when I try to pan and zoom from the zoomed state, the view starts at a completely different place before it ends at the expected node. If from the zoomed state I don't pan, but jump/zoom from one node to another, the transition works as expected. I'm not sure why this happens. Can anyone help me figure out what I'm doing wrong? Thanks in advance!
(Sorry for any faux-pas -- Its my first stack overflow question...)
<code>
  @ViewChild('myCanvas') canvas: ElementRef;
  @ViewChild('myCanvas') hiddenCanvas: ElementRef;
  public context: CanvasRenderingContext2D;
  public hiddenContext: CanvasRenderingContext2D;

  public focus;
  public xleftView = 0;
  public ytopView = 0;

  public widthViewOriginal = window.innerWidth;
  public heightViewOriginal = window.innerHeight;
  public widthView = this.widthViewOriginal;
  public heightView = this.heightViewOriginal;
  public widthCanvas = window.innerWidth;
  public heightCanvas = window.innerHeight;

  public mouseDown = false;
  public movedCoordinatesX;
  public movedCoordinatesY;
  public lastX = 0;
  public lastY = 0;

  public zoomInfo = {
    centerX: window.innerWidth / 2,
    centerY: window.innerHeight / 2,
    scale: 1
  };

    public handleMouseDown(event) {
      // get where the mouse first clicked to pan the graph
      this.movedCoordinatesX = event.clientX
      this.movedCoordinatesY = event.clientY
      if (event.which === 1) {
        this.mouseDown = true;
      }
    }

    public handleMouseUp(event) {
      this.mouseDown = false;
      // Get the distance moved in the x & y direction from the initial click to the end mouse position
      this.movedCoordinatesX = this.movedCoordinatesX - event.clientX
      this.movedCoordinatesY =  this.movedCoordinatesY - event.clientY

      // add distance in the X & Y to the old view's X & Y (to make the transition happen from the current position
      this.vOld[0] = (this.vOld[0] + this.movedCoordinatesX)
      this.vOld[1] = (this.vOld[1] + this.movedCoordinatesY)
    }

    public handleMouseMove(event) {

      var X = event.clientX - this.context.canvas.offsetLeft -  this.context.canvas.clientLeft + this.context.canvas.scrollLeft;
      var Y = event.clientY -  this.context.canvas.offsetTop -  this.context.canvas.clientTop +  this.context.canvas.scrollTop;
      if (this.mouseDown) {
          var dx = (X - this.lastX) / this.widthCanvas * this.widthView;
          var dy = (Y - this.lastY)/ this.heightCanvas * this.heightView;
          this.xleftView -= dx;
          this.ytopView -= dy;
      }
      this.lastX = X;
      this.lastY = Y;
  }

  // Listen for clicks on the main canvas
  public zoomInToNode(e) {
    // We actually only need to draw the hidden canvas when there is an interaction.
    // This sketch can draw it on each loop, but that is only for demonstration.
    this.drawCanvas(this.hiddenContext, true);

    //Figure out where the mouse click occurred.
    var mouseX = e.layerX;
    var mouseY = e.layerY;
    this.lastX = mouseX
    this.lastY = mouseY

    // Get the corresponding pixel color on the hidden canvas and look up the node in our map.
    // This will return that pixel's color
    var col = this.hiddenContext.getImageData(mouseX, mouseY, 1, 1).data;
    //Our map uses these rgb strings as keys to nodes.
    var colString = "rgb(" + col[0] + "," + col[1] + ","+ col[2] + ")";
    var node = this.colToCircle[colString];

    if(node) {
      if (this.focus !== node) {

        this.xleftView = 0
        this.ytopView = 0
        this.hiddenContext.setTransform(1, 0, 0, 1, 0, 0);
        this.zoomToCanvas(node);
      }
      else {

        this.xleftView = 0
        this.ytopView = 0
        this.hiddenContext.setTransform(1, 0, 0, 1, 0, 0);

        this. widthView = this.widthViewOriginal;
        this. heightView = this.heightViewOriginal;
        this. widthCanvas = window.innerWidth;
        this. heightCanvas = window.innerHeight;
        this.zoomToCanvas(this.rooting);
      }
    }//if
  };

  public zoomToCanvas(focusNode) {
    // the node that we want to zoom to
    this.focus = focusNode;

    var v = [this.focus.x, this.focus.y, this.focus.r * 2.05]; //The center and width of the new "viewport"

    this.interpolator = d3.interpolateZoom(this.vOld, v); //Create interpolation between current and new "viewport"

    this.duration = this.interpolator.duration; //Interpolation gives back a suggested duration
    this.timeElapsed = 0; //Set the time elapsed for the interpolateZoom function to 0
    this.vOld = v; //Save the "viewport" of the next state as the next "old" state

  }//function zoomToCanvas

  // Perform the interpolation and continuously change the zoomInfo while the "transition" occurs
  public interpolateZoom(dt) {
    if (this.interpolator) {
      this.timeElapsed += dt;
      var t = this.ease(this.timeElapsed / this.duration);

      if(isFinite(t)) {
      this.zoomInfo.centerX = this.interpolator(t)[0];
      this.zoomInfo.centerY = this.interpolator(t)[1];
      this.zoomInfo.scale = this.diameter / this.interpolator(t)[2];

      if (this.timeElapsed >= this.duration) this.interpolator = null;
      }
    }//if
  }//function zoomToCanvas

  public drawCanvas(chosenContext, hidden) {
    chosenContext.save();
    chosenContext.setTransform(1,0,0,1,0,0);
    chosenContext.clearRect(0, 0, this.canvas.nativeElement.width, this.canvas.nativeElement.height);
    chosenContext.scale(this.widthCanvas/this.widthView, this.heightCanvas/this.heightView);
    chosenContext.translate(-this.xleftView,-this.ytopView);
    chosenContext.restore();

  }

</code>
Answer: So I figured it out... I was supposed to divide by the overall scale.
I really want to thank this answer for giving me the inspiration!
<code>    public handleMouseUp(event) {
      this.mouseDown = false;
        this.movedCoordinatesX = this.movedCoordinatesX - event.clientX
        this.movedCoordinatesY =  this.movedCoordinatesY - event.clientY

        if(this.zoomInfo.scale == 1) {
          this.vOld[0] = (this.vOld[0] + this.movedCoordinatesX)
          this.vOld[1] = (this.vOld[1] + this.movedCoordinatesY)
        } else {
          this.vOld[0] = (this.vOld[0] + (this.movedCoordinatesX/this.zoomInfo.scale))
          this.vOld[1] = (this.vOld[1] + (this.movedCoordinatesY/this.zoomInfo.scale))
        }
    }

</code>


Bruteforce on 10 characters length WPA2 password

Question: I'm trying to hack my own WPA2 network for learning purposes.
I have the *.cap file generated by aircrack-ng tools after a WPA handshake.
I've tested by including my own password and a bunch of incorrect passwords on a wordlist and aircrack-ng crack successfully. My password is 10 characters length, only uppercase letters and numbers, so I tried generating a wordlist with crunch (10 characters length, uppercase and numbers only):
$ crunch 10 10 -f charset.lst ualpha-numeric -o wordlist.txt

But crunch weight estimation was stunning:
Crunch will now generate the following amount of data: 40217742840692736 bytes
38354628411 MB
37455691 GB
36577 TB
35 PB
Crunch will now generate the following number of lines: 3656158440062976

The wordlist is incredibly big. And I generated the wordlist by having clues about the lenght and characters involved. If I didn't know that It'd be even bigger.
I guess I know believe that bruteforce attacks on non trivial passwords is impossible, at least with pre generated wordlists.
Is there a way to let aircrack-ng incrementally crack the password with a given length and charset?
What other sane options do I have to attack my password?
Comment: You don't need to actually generate those huge files. You can pipe each line like @Anon did.
Answer: I'd look at OCLHashcat, as it let's you brute force with specific character sets and doesn't need to generate the list beforehand.
I'm not sure what you mean by "incrementally" however, if you mean stopping and starting OHC will let you do that.
In terms of cracking WPA2, you've got 3 options.

Dictionary attacks
Reaver attack against WPS (most successful option in majority of cases)
Taking a wrench to the person and beating their password out of them

Ok, perhaps two options if you're not really wanting that password.
Brute force, unless you know a lot about the password and it's incredibly stupid (i.e. you know for certain it's an 8 character set of numbers) is going to be a non-starter.
Don't forget, strictly speaking there "shouldn't" be a way to break the password, so if none of these options seem viable, it just means you've got decent security. There may not be an answer as to how you can do it.
Comment: [Obligatory xkcd related to #3](https://www.xkcd.com/538/).
Answer: john --stdout --incremental:all | aircrack-ng -e ESSID -w - /home/user/input_wpa.cap

Edit the john conf file to change from 8 to 10
Comment: Nice solution. I have "solved" this previously using named pipes to generate wordlists on the fly with john: used mkfifo /tmp/named_pipe ; john --stdout --incremental:all > /tmp/named_pipe & aircrack-ng -e ESSID -w /tmp/named_pipe wpa.cap
Answer: I'm currently developing similar technologies.  Aircrack-ng really is brilliant although it does have some limitations.
I have also attempted a brute force on my own wifi using crunch to generate passwords. and my findings are as such:

You can pipe crunch directly into Aircrack-ng to eliminate the need to create a .txt file and use it simultaneously saving you processing power to perform calculations, the Syntax for this method in bash is as such:

./crunch <max> <min>(stick to 8 for now)<options>(abcd1234..)
  can give partial passwo@@@| aircrack-ng -b [bssid] -w - [.cap file]

here you can see the standard format for piping into aircrack-ng and some simple options.
Here is a working copy you can paste into terminal (below), I'll talk you through it a little.
From left to right:

The name of the command crunch, if this doesn't work straight away force execution by starting with ./crunch.
8  8 is the max and min chars you're going to need as I'm sure you already know.
Then a pipe symbol. This feeds the output directly into the file that aircrack-ng is going to use as a dictionary
Fill in Bssid's as you already know how to do in this format once your handshake has been established.

WORKING COPY:
crunch 8 8 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ -t 97KQA@@@ | aircrack-ng -b 78:54:2E:28:E7:86 -w - thehak-01.cap

THE PROBLEM WITH THIS METHOD:
Using a permutation equation and using an expected 1000 combinations per second (this is what my actual output is) I have calculated that testing each of the generated combinations will take 77.8 years
Comment: This post is a bit of a mess. I started to edit it into shape but soon got lost with not being able to figure out what belongs together. Can you please clean it up to use code blocks, where appropriate, better formatting, punctuation, and other types of readable grammar?
Answer: You could try using John the Ripper to generate the passwords and then pipe them to Aircrack-ng. John has a mode called INCREMENTAL where you can define what type of passwords it generates and you dont have to stome them on file as you are piping it to aircrack, and it has resume capabilities.
Answer: This thread is from a year or two ago but i would recommend using reaver.
reaver -i (your intnerface/wlan0mon) -b (BSSID/MAC address) -vv
Might take a few hours (4 - 12 possibly) but to get pass with wordlist is extremely lucky with wpa2.
If you get rate limiting error try
reaver -i (wlan0mon) -b (Mac address) -d 30 -vv -dh-small
If you still get the Rate Limiting error don't bother, move on. Although, never give up.
Comment: Is this an attack against WPS? WPS is not mentioned by the OP and is known to be broken anyway.


How many addresses should a checkout system store for an existing customer?

Question: I'm working on a checkout system, and there are instances where an existing user can have up to 8 delivery addresses. Is it in your opinion a good experience to have that many, or have an unlimited number of addresses - increased cognitive load? Or should the system limit the number of stored addresses - reduce cognitive load?
Comment: From an ethical design point of view, as few as is required.
Answer: I can't really imagine many users will have more than 5 active addresses though as with any user data, the user always knows best.
I would do the following and allow the user to store as many as they need:

Allow the user to set a primary address which is used as the default.
Offer to save any other addresses the user uses on checkout.
At checkout display their primary address followed by the saved addresses ordered by last used first. You could also show primary, last used, and then sort the rest by most used if users are more likely to use the same address multiple times.
Optionally delete secondary addresses after they haven't been used for a while.
Comment: You could even save new addresses automatically without even asking.
Answer: I have 14 delivery adresses in my Amazon account. Granted, many in there I have only used once (when I was on holiday somewhere, or to send a gift to someone). Some are no longer relevant as I moved since.
However, I'm pretty sure many people have a lot more than that, and probably use many of them on a regular basis.

Just don't set any arbitrary limit at all.
Do indeed have a default address, and allow the user to easily make another address the default (if they select an existing address other than the default, or add a new address).
Sort the rest by most recently used or most frequently used.
Add UI to add/delete/edit addresses.

Not UX related, but when you edit an address, make sure it doesn't affect previous orders. Either copy the address in the order, or create a new copy of the address and mark the previous one deleted.


How to Calculate the time of Charging and Discharging of battery?

Question: How do I calculate the approximated time for the Charging and Discharging of the battery? Is there any equation available for the purpose? If yes, then please provide me.
Comment: What chemistry does your battery have?
Comment: @abdullah kahraman  Li-Ion battery
Comment: Dave Jones of EEVBlog fame has several tutorial videos about the subject. [EEVBlog #140 Battery Capacity Tutorial](https://www.youtube.com/watch?v=R8hTQXqURB4) and [EEVBlog #772 How to Calculate Wasted Battery Capacity](https://www.youtube.com/watch?v=1hs_9vx9APw)
Answer: Discharge time is basically the Ah or mAh rating divided by the current.
So for a 2200mAh battery with a load that draws 300mA you have:
\$\frac{2.2}{0.3} = 7.3 hours\$*
The charge time depends on the battery chemistry and the charge current.
For NiMh, for example, this would typically be 10% of the Ah rating for 10 hours.
Other chemistries, such as Li-Ion, will be different.
*2200mAh is the same as 2.2Ah.  300mA is the same as 0.3A
Comment: I would like to point out that some batteries, and certainly all circuits, will not work down to 0 Volts at the supply, so your circuit will stop working a long time before the battery is fully drained
Comment: This answer is about 4 years old now - but it's incorrect for LiIon batteries, which is what he is asking about. (Advised after this answer). See my answer for detail - but, LiIon can typically be charged at the C/1 rate until Vbat = 4.2V/cell. That takes typically 45 minutes to about 75% capacity and then about 2 hours at reducing rate for the balance .
Answer: Charging of battery: Example: Take 100 AH battery. If the applied Current is 10 Amperes, then it would be 100Ah/10A= 10 hrs approximately. It is an usual calculation.
Discharging: Example: Battery AH  X Battery Volt / Applied load.
Say, 100 AH X 12V/ 100 Watts = 12 hrs (with 40% loss at the max = 12 x 40 /100 = 4.8 hrs) For sure, the backup will lasts up to 4.8 hrs.
Comment: The charge formula above assumes a 100% efficiency charge, so it's not ideal, but it is a good, simple way to get a rough idea of charge time. For a more accurate estimation, you can assume 80% efficiency for NiCd and NiMh batteries and 90% efficiency for LiIon/LiPo batteries. Then, the formula becomes `capacity / (efficiency * chargeRate)` or, to use the same values from above (assuming lithium chemistry), `100Ah / (0.9 * 10A) = 11.11 hours`
Answer: Discharge rates are well enough covered here.
LiIon / LiPo have almost 100% current charge efficiency but energy charge efficiency depends on charge rate. H=Higher charge rates have lower energy efficiencies as resistive losses increase towards the end of charging.
Below LiIon and LiPo are interchangeable in this context.
The main reason to adding an answer to a 3+ year old question is to note that:
LiIon / LiPo should not be charged at above manufacturers spec. This is usually C/1, sometimes C/2 and very occasionally 2C. Usually C/1 is safe. LiPo batteries designed specifically for extremely high discharge use may have 10C to mybe 50C allowed discharge rates. These are not usually encountered in 'everyday' applications.
LiIon's are charged at CC =  constant current = <= max allowed current from 'empty' until charge voltage reaches 4.2V.    They are then charged at CV = constant voltage = 4.2V and the current falls under battery chemistry control.
Charge endpoint is reached when I_charge in CV mode falls to some preset % of Imax  - typically 25% to 50%. Higher % termination current = longer cycle life, lower charge time and slightly less capacity for the following discharge cycle.
When charged from "empty" at C/1 a LiIon cell achieves about 70% - 80% of full charge in 0.6 to 0.7 hours ~= 40 to 50 minutes.
The CV stage typically takes 1.5 to 2 hours (depending on termination current% and other factors) so total charge time is about 40m +1.5 hours to 50 minutes +2 hours or typically 2+ to 3 hours overall. But, a very useful % of total charge is reached in 1 hour.
Answer: Peukert's Law gives you the capacity of the battery in terms of the discharge rate. Lower the discharge rate higher the capacity. As the discharge rate ( Load) increases the battery capacity decereases.
This is to say if you dischage in low current the battery will give you more capacity or longer discharge .
For charging calculate the Ah discharged plus  20% of the Ah discharged if its a gel battery. The result is the total Ah you will feed in to fully recharge.
Comment: How can you advise to charge with 10 A if you have absolutely no specs of the battery in question?
Answer: In the ideal/theoretical case, the time would be t = capacity/current. If the capacity is given in amp-hours and current in amps, time will be in hours (charging or discharging).  For example, 100 Ah battery delivering 1A, would last 100 hours. Or if delivering 100A, it would last 1 hour.  In other words, you can have "any time" as long as when you multiply it by the current, you get 100 (the battery capacity).
However, in the real/practical world, you have to take into consideration the heat generated in each process, the efficiency, the type of battery, the operating range, and other variables.  This is where "rules of thumb" come in.  If you want a the battery to last a "long" time and no overheating, then the charging or discharging current must be kept at not more than 1/10 of the rated capacity.  You also need to keep in mind that a battery is not supposed to be "fully" discharged. Typically, a battery is considered "discharged" when it looses 1/3 of its capacity, therefore it only needs 1/3 of its capacity to be fully charged (range of operation). With these constraints and the above values, one gets only one answer,  t = 33Ah/10A = 3.3hr.
Answer: Rules of thumb given in other answers are often good enough but if you can find the datasheet of the battery it's best to check the relevant graph. As an example here's the datasheet of a low cost 12V battery. In the datasheet you'll find this graph:

Let's say that this is a battery with 7Ahr capacity and that you want to draw 14A. You'll have to observe the 2C curve (2C means to discharge at 7Ahr*2/h=14A). You'll note that this battery will drop to 9.5V-10V after about 15mins. Of-course this is only true for a fresh from the shelf battery kept at 25 deg.Celsius. Temperature, age and usage negatively affect the performance.


Should I cut off roots that grow out from a pot's drain?

Question: I have a Ficus lyrata whose roots have grown out of the 25cm pot's drain hole. They form a dish shape within the pot's dish. Is it wise to cut these roots so that the pot can sit level again, or is it a sign that I need a larger pot?
Comment: You needed a larger pot as soon as any roots emerged from the drain holes, not after they are making the pot unstable. Unless you destroy the pot by cutting it up, you may *have* to prune the roots now to get the plant out of it. In any case, it is better to prune any roots that you damage while "unpotting" the plant.
Comment: @alephzero - can you construct your comment as an answer - you  have the right of it, but unless you post it as an answer, it can't be voted on nor accepted...
Answer: I have a 10 ft tall Lyrata in a 30 cm pot. It has some roots out the bottom and a few over the top rim and down to the saucer. I don't trim the roots and I am not moving it to a bigger pot as this one is already a hassle to move out in the spring and back inside in the fall. So I think you can do what you want.


What are the differences between the pre-crisis Superman and the post-crisis Superman?

Question: In the comics, how many different Superman have appeared or existed?
Are there any big differences between those different versions of Superman?
Comment: well, he can no longer sneeze and destroy a solar system, and can't shape shift.
Comment: You might wanna re-word your question a bit. Any good answer will be a very long list, which is off-topic for this site.
Comment: There's actually a good answer for this on Quora, but link-only answers aren't allowed, and stupidly long answers aren't allowed, so I guess my hands are tied in this case.
Comment: If you were just asking about the question given in the title of your post, I believe I could provide a decent answer about the differences between those two versions (Pre-Crisis and Post-Crisis), but the *text* of your post asks much more *sweeping* questions -- asking how many different versions of Superman there have ever been, for instance. (Short answer: "Lots and lots, but some only appeared in one or two stories and then were forgotten!") As others have said, it would really help if you narrowed it down -- sticking to asking about "Pre-Crisis versus Post-Crisis," for instance.
Answer: As indicated in the comments, there have technically been hundreds (at least) of different versions of Superman. In the 50's and 60's, it was common for the Superman family of comics to include "imaginary stories", stories that were explicitly not considered as featuring the same Superman as appeared in regular stories. Think of it like the Simpsons "Treehouse of Terror" Halloween shows. Superman might have new powers, or be married to Lois (or Lana, or Lori Lemaris; pretty much anyone with an alliterative name that started with "L"; except Lex Luthor - 1950s and 1960s, remember?). So, for now, let's ignore these (usually) one-off alternates.
Starting in FLASH #123, the DC multiverse was officially born. With that, we had an Earth-1 Superman, an Earth-2 Superman, and the evil Ultraman of Earth-3.
The Crisis on Infinite Earths (1985-86) destroyed most of the multiverse, and rolled several worlds together into one. This brought us the Post-Crisis Superman. While the multiverse was eventually recreated, we mostly saw it populated by characters from one-off stories, or variations on the themes above.
Then, Flashpoint changed the DC Universe again, and gave us a "New 52" Superman that had notable differences from the Post-Crisis Superman. With Rebirth, we saw the Post-Crisis Superman returned; and now, I believe that the current Superman is some sort of amalgam of these last two (with the emphasis on the Post-Crisis version, as he's still married to Lois, and still has a son with her).
So, let's cover the golden age Superman (Earth-2), the silver age Superman (Earth-1), the post-Crisis Superman, and the New-52 Superman.
Golden Age, Silver Age:  over the course of the first 2 years of his publishing history, Superman picked up various new/enhanced powers, and had various small alterations in his environment. Unlike most characters, Superman was continuously published from the late 1920's through today. So, when Earth-2 and Earth-1 were set up, they distinguished the Earth-1 Superman from the Earth-2 Superman mostly by keying into these changes that had happened over time.
Post-Crisis: John Byrne was selected as the writer (and main artist) to launch the post-Crisis version of Superman. He reined back in the character's powers to some extent (although later teams tended to expand them again). From 1986  through Flashpoint in 2011, Superman's story was much more coherent and consistent than it had been prior to that point.
New 52: Grant Morrison's stories reintroduced Superman in the post-Flashpoint "New 52" era. There were a few adjustments made (reversing some of Byrne's points).
I'm just going to hit some of the most notable differences in the character's history and powers. Unless otherwise stated, all version have powers including enormous strength, flight, invulnerability, super-speed, heat vision, x-ray vision, etc.; and all came to Earth from Krypton, and had a long-term romantic relationship with Lois Lane.
Golden Age Superman: His powers were generally scaled back a little, often using the theme from the 1950's SUPERMAN TV show as the rough limits: faster than a speeding bullet, more powerful than a locomotive, able to leap tall buildings in a single bound (I believe they did leave him able to fly, actually); he could be hurt by powerful enough explosions or weapons.
As far as personal background, I don't believe he had any significant memories of Krypton. His birth name was Kal-L. His adoptive parents were dead by the time he first appeared as Superman. He adopted his identity as a young man; he had not been Superboy as a child. In the 1970's, we found out he had eventually (sometime after we started reading about the Earth-1 Superman in the comics) married Lois Lane; they had no children. He and Lois worked at the Daily Star. His cousin, Kara, came to earth in a sentient space craft, arriving long after he did; she became Power Girl. He was thought to have died in the Crisis, but actually survived until the INFINITE CRISIS crossover, as did his Lois.
His strangest ability, unique to him, was the ability to mold his face to look like someone else (only used in a few stories in the 40s).
Silver Age Superman: This is the Superman that the Christopher Reeve movies were based on. He had near boundless strength and invulnerability; he not only could fly, but could fly through space unaided; and he had heat vision and freeze breath. His costume was made from blankets in his spaceship - being from Krypton, this made the costume invulnerable.
Kal-El was sent to Earth by his parents, Jor-El and Lara, as an infant, just before Krypton exploded - and somehow, this seemed to draw a significant portion of the exploded planet, plus almost any space debris in its orbit, to the vicinity of Earth (eventually). His teenaged cousin Kara had lived in a city on an intact fragment of Krypton; however, that eventually broke down, and she was sent to Earth so he could take care of her; she became Supergirl, of course. His adoptive parents, Jonathan and Martha Kent, died when he was a young man (at least 18, less than 22). He had a career as Superboy as a pre-teen and teenager. His pet dog from Krypton, Krypto, showed up during this time. He met time-traveling heroes inspired by his legends during his Superboy period; they were called the Legion of Super-Heroes, and he frequently travelled into the future and had adventures with them. He dated Lois Lane (sometimes as Clark Kent, more often as Superman), but never married her. they worked together at the Daily Planet (except for a period during the 70's and 80's where they also worked for a Metropolis TV station, WGBS - Clark was a news anchor).
He had a number of strange abilities. The oddest was "super-hypnosis" (which he used sub-consciously during the new broadcasts, to make Clark seem smaller and thinner than Superman. My personal favorite strange ability wasn't generally identified as such, but in practice he tended to look ludicrous while using it. You seem, he could move planets out of (or back into) their orbits; which he would apparently do by simply using flight and strength together, and pushing the planet. One can imagine seeing him while he was doing this, and coming up and asking him why he seemed to be straining so much to do that handstand....
Post-Crisis Superman: His basic power set was the same as the Silver Age Superman. Initially, the powers were toned down (for instance, couldn't survive in space without oxygen), but eventually ramped back up to almost the same level as his predecessor. However, his powers were more thoroughly explained (with pseudoscience, but still). He was a solar power battery; keep him in the dark long enough and his powers fade to basically nothing. Rather than actually being invulnerable, he basically had a force field surrounding him (this kept the bulk of his costume (except the cape) from damage, most of the time).
Sent from Krypton as an infant; named Kal-El; adopted by Jonathan and Martha Kent. Uniquely, his adoptive parents were both alive well into his adulthood (Jonathan died in the mid 2000's). No career as Superboy or ties to the Legion (some sort of tie was re-established in the mid 2000's, but without an indication of a career as Superboy in his youth). Like the Golden Age Superman, this version not only dated Lois Lane as Clark, but married her. They both worked at the Daily Planet. He got a Kara and a Krypto, but (again) not until the 2000s. Prior to Flashpoint, he and Lois had a kid named Jonathan in their life; he was at least part Kryptonian, but was not their son. When the character came back on-stage post-Crisis (coming out of the Convergence event), they now have a son named Jonathan.
The most unusual thing about his powers was the explanations as to how they worked, which were covered above.
Finally, the New 52 Superman: powers seem to basically match up with the Post-Crisis Superman (except maybe the force-field style invulnerability, as his outfit does seem to take a bit more of a beating).
Kal-El; Krypton as an infant; Jonathan and Martha Kent; no career as Superboy; Kents died wen he was a young adult; Daily Planet; romantic interest in Lois; cousin Kara. With the advent of the Rebirth event, this Superman and the matching Lois Lane both died. However, the "Post-Crisis Superman" and his wife Lois appeared from the multiverse. The essences of both versions of these characters were merged somehow; I expect that the resulting characters will be more post-Crisis than New 52, but time will tell.
Other variations of some note include:

The titular character of three recent "Superman: Earth-One" graphic novels;
Kent Shakespeare (intended to take his place in the Legion, initially);
The Earth-Prime Superboy (locked away with golden age Superman from Post-Crisis to Infinite Crisis)
The older version of the Post-Crisis from the time of BATMAN BEYOND (sometimes referred to as Superman Beyond).
Comment: This is well written. Before adding my own tid bits...are we speaking here in terms of powers and abilities, or characterization?


Why does my pepper plant have a few leaves turning over? Not curling

Question: I have a young Bontempi pepper plant that is kept in the greenhouse, has no sign of pests and is well watered. The main of the plant looks really healthy. But for some reason 3 of the original now large leaves have turned over, their stem has completely twisted so the leaf is facing downwards, the leaves themselves are healthy other than facing donwards.
Any ideas why please?
Comment: Do they remain like that even after dark?
Comment: Can you show us a picture? Thanks.
Comment: Has it been transplant, repotted, moved to another location, or had a change in lighting recently?
Comment: Is it cold at night, or windy (any time)?
Answer: I got similar thing on my cowpea after moved outside. I think that they are bitten by slugs or snails, it's real plague and they are going to eat everything. Stems are bitten, but not completly, so they turn over
Answer: I have the same thing happening on a few of my peppers (California Wonder). The leaves in question are fairly large leaves at the end of long petioles. The leaf stems are quite strong but maybe when the leaf is really long and normally cupped slightly upwards at the edges and gets turned over in windy conditions it has no mechanism to twist them back against gravity. I'll keep an eye open for them returning to normal.
Update: a couple of days later and it seems to me that there are far fewer leaves turned this morning than before. I did not take a count previously so I don't have numbers, but I have the strong impression that some have returned to normal. So a mechanism may exist after all.
Update after another 24 hours: all leaves now right side up. None turned over. No rain in meantime, no bugs, and there have been no extreme weather events. I invite you to speculate what might have happened.
Answer: That can happen when the plant is stressed. Some stressors that can cause this, I think, are these:

Whiteflies
Aphids
Maybe thrips
Extreme or fluctuating temperatures
Moisture irregularities
Strong sun

It might be a virus.


Expanding synology virtual machine disk - disk space not recognized

Question: I've created a Virtual Machine in Synology Disk Station Manager (an ubuntu server) with a specific amount of storage space in a virtual disk, but I have depleted it. Went to Synology Disk Station / Virtual Machine Manager again and expanded the virtual disk; however, the space is not recognized inside Ubuntu Server. How can I fix this?
Comment: You'll need to grow the partition inside your Ubuntu server. Run `lsblk` and look for your device (It might be "sda" or "sdb" or something). Then run: `sudo parted /dev/sda --print` (replace "sda" with your actual device) to get the partition information on Ubuntu. If it's ext4, then chances are, you just need to run the following command: `sudo resize2fs /dev/sda`
Comment: Thank you. I have updated the question with an image. What I need to resize is a logical volume (ubuntu--vg-ubuntu--lv) which resides inside sda3. As shown, sda3 has 29G available while the logical volume is only using 19GB.
Answer: I have managed to find a solution. First I booted the system using GParted Live ISO and used the "VERIFY" command on the partition that was showing an exclamation mark, which was the right one. Then booted into the virtual machine and, in the command line, expanded the LVM and filesystem using the commands:
lvdisplay

(to identify the MOUNTPOINT), and then:
lvextend –l +100%FREE [MOUNTPOINT]

to extend the LVM partition and
resize2fs [MOUNTPOINT]

to resize the filesystem.
Answer: I search a lot and ended up here however I found out that there is a more simple way that worked for me without the need to boot another image . After you resize your VM storage from synology interface, you should be able to see the free space. You can take advantage of it using normal tools like fdisk and create a new partition. If you want to grow your space without booting a different image you will be limited to last partition, in your case sda3. In order to do this, start your VM log into it and install growpart that is part of cloud-utills
sudo apt-get install -y cloud-utils
resize partition -> you can grow only the last partition from lsblk in my case was sda1
sudo growpart /dev/sda 1 1 is actual partition number ( ex sda1 )
resize your volume in my case I had ext4
sudo resize2fs /dev/sda1
You have a logical volume so that can span on multiple partitions so you can try ether to create a new partition then extend logical volume on it or just grow the exited one as I suggested. Here is more info on logical volumes.
https://www.golinuxhub.com/2014/03/how-to-extendresize-lvm-and-volume
Comment: This does not provide an answer to the question. Once you have sufficient [reputation](https://serverfault.com/help/whats-reputation) you will be able to [comment on any post](https://serverfault.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/526005)
Comment: This is how I actually resized the disk on my Ubuntu VM on a Synology Disk Station. Did you pay atention?


TI Microcontroller Programming Circuit

Question: I am working on designing a pcb that will contain a TI TM4C1231D5PZ microcontroller. I have only ever used a launchpad before for coding, so I do not know how to get my program code onto a microcontroller that is going to be on a pcb. I have looked at multiple resources, including the datasheet, and I can't find a circuit or even an understandable explanation of how to put the program code onto the microcontroller. I believe that I have all of the software complete and working, but I just need to get it on to the microcontroller. How is this process accomplished? Are there any helpful resources that explain this process?
Comment: There are many ways. A common one would be to use the JTAG interface.
Comment: It's been a while for me on the TI TMS MCUs, but I believe they are programmed in-circuit via the JTAG interface as @Tyler mentioned.  In fact the needed lines are brought to pins on the Launchpad which you can connect to a MCU in-circuit and do programming for prototypes and small production.  For large scale production the distributor can often program them for you.
Answer: It's always a good idea to add a JTAG interface for in-circuit debugging.
There are various debug probes you can choose from. The XDS100v2 is fairly cheap, if you can get a hold on one (TI doesn't distribute this anymore).
Another good option is the XDS110 (PDF / Product Page).
You can even use the LaunchPad as debug probe. See SPMA075 (referenced below), chapter 4.6.
And on the PCB you have to add a JTAG header (e.g. ARM 10-pin header):

For more info, check the Application Report SPMA075: Using TM4C12x Devices Over JTAG Interface.

For production, where you only need to program the TM4C, you can use the integrated Boot Loader (ROM).
The TM4C1231D5PZ supports UART0, SSI0, I2C0 and USB. Check the Datasheet chapter 18.104.22.168 Boot Loader Overview.
Also check the TivaWare Boot Loader User's Guide.
As PC tools you can either use LM Flash Programmer or Uniflash.

TI Microcontroller Programming Circuit


How to take avi snapshot in .NET

Question: I'm looking easy way to take snapshot of AVI file in .NET (C#)
I need take pictures of given time - I mean:
<code>TakeSnapshot (file_name, second)
</code>
Any advice(s) how to deal with that?
Comment: Check http://www.codeproject.com/KB/security/steganodotnet4.aspx
Answer: 1)  Most web cameras you buy will have their own software, and they can usually generate .avi output.
3) The "best" Win32 API for Video Capture has always been Microsoft DirectShow.  Here's a good link:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd318627%28v=vs.85%29.aspx
4) The "annointed" .Net successor to DirectShow was supposed to be Windows Media Framework.  But I've never used it, and it doesn't sound like it's ready for Prime Time yet:
http://www.jasonrowland.com/2011/02/video-capture-with-c/
5) Here's one other library you might wish to consider - it can be used with C#, and it supports .avi output:
http://directshownet.sourceforge.net/

How to take avi snapshot in .NET


How to merge data from multiple background jobs back to a single data stream in bash

Question: I've run into a couple of similar situations where I can break a single-core bound task up into multiple parts and run each part as separate job in bash to parallelize it, but I struggle with collating the returned data back to a single data stream. My naive method so far has to create a temporary folder, track the PID's, have each thread write to a file with its pid, then once all jobs complete read all pids and merge them into a single file in order of PID's spawned.  Is there a better way to handle these kind of multiple-in-one-out situations using bash/shell tools?
Comment: @frabjous uuuuuh, IO buffers say that is practically never a good idea, unless results are all single characters long or you can definitely 100% guarantee no buffering and result sizes small enough to fit into write buffers of your `programN`s read and write buffers of your shell.
Comment: Yes. With append mode, the operating system can handle it. Fyi: https://unix.stackexchange.com/questions/346062/concurrent-writing-to-a-log-file-from-many-processes
Comment: @guest in general, only single calls to `write` (2) on files are  atomic (but if the file was opened with `O_APPEND`, skipping to the end of it is atomic together with that single `write`). So if your program writes all its output in a single call to `write`, fine, if it calls `write` multiple time, you might get intertwined output data, which might simply be broken. I'd like to add that the assumption "a program called from a shell script only uses `write` on stdout a single time" is a very big assumption.
Comment: @Archemar I know about wait and use that in my scripts to wait till all the jobs are done to start reading in the files, but I dont see a way wait helps me get the data directly from those jobs once they complete
Comment: If the order is not relevant, just write the output in append mode (aka >> /common/logfile.out).
Comment: Would something as simple as `(program1 & program2) > combined_output.txt &` work?
Comment: @K-att- do you know if  >> assure all writes will eventually take place without overwriting?  That would work nicely for writing to a log file
Answer:
My naive method so far has to create a temporary folder, track the PID's, have each thread write to a file with its pid, then once all jobs complete read all pids and merge them into a single file in order of PID's spawned.

This is almost exactly what GNU Parallel does.
parallel do_stuff ::: job1 job2 job3 ... jobn > output

There are some added benefits:

The temporary files are automatically removed, so there is no cleanup - even if you kill GNU Parallel.
You only need temporary space for the currently running jobs: The temporary space for completed jobs is freed when the job is done.
If you want output in the same order as the input use --keep-order.
If you want output mixed line-by-line from the different jobs, use --line-buffer.

GNU Parallel has quite a few features for splitting up a task into smaller jobs. Maybe you can even use one of those to generate the smaller jobs?
Comment: oh nice! I think I might really need to get the hang of GNU Parallel. I just realized the documentation is way nicer than I remember it being!
Answer: What you propose seems pretty sensible, as it avoids having to think about how to merge the data before it's complete. So, honestly, not a bad approach!
Another common solution is to have a central program that collects the data, understands data "piece" semantics/boundaries and merges things as you go.
How to implement that depends a lot on the kind of data you're generating! This can be as simple as a really minimal program just reading messages e.g. out of UNIX or UDP or TCP sockets (but you might need to then think about having a serialization format where it's possible to know at which point some data point is complete), one socket per worker. Or just run a small relational database server (PostgreSQL?). Or you use e.g. ZeroMQ sockets to have multiple publishers and the central merger as subscriber to these, with the added benefit that this instantly also works over network. Or you use a database for time-series data. Or your data looks more like logging messages, so you implement workers that log the results via syslog or sd_journal_print, and use journald's logging namespaces to put all these log messages into a single file. Or...
In the end, your options really are:

write many files, merge after the fact (here you're using the fact that a filesystem allows for concurrent write access by different workers to different files, with no problem).
use some kind of pipe/socket/inter-process communication method to send messages to a central process (here you're using the fact that you know how your data is structured and can do the merging live).

How you actually do that 100% depends on your data structure, amount and the way you want to merge.


Achievements I should know before I start Final Fantasy XIII

Question: I recently picked up Final Fantasy XIII for the 360 and I wanted to know if there are any achievements I should know about a head of time so I don't screw up and have to play through again.
Answer: The two you want to watch out for are the following:

Loremaster (Discerned the full attributes of 100 enemies.): just make sure you use Libra multiple times on enemies until all attributes are filled out (no question marks). There are way more than 100 enemies in the game, but some enemies only appear in one chapter, which is really annoying if you're trying to be a completionist.
Treasure Hunter (Held every weapon and accessory): make sure you equip every item before you sell it, and don't sell weapons, even if you think they're junk. You don't want to sell weapons because you'll need to upgrade at each weapon at least once (upgrading creates a new item) to get the achievement.

The rest of the achievements you'll get as you progress through the game, or can be completed once you complete the game. Some of the achievements can only realistically be done after you complete the game.
Comment: I don't think you need to equip every item to get that achievement (according to what I've read, didn't go through it myself). Not selling anything is definately good advice though, I think some items rely on things being dismantled as well possibly?
Comment: Loremaster's easy pretty easy. I didn't know you had to equip them for Treasure HunTer though. I thought you  just had to hold them since it says that. =/
Comment: Loremaster's easy, but it threw me for a loop because *Libra* in past iterations of Final Fantasy exposed all stats when you first use it. In FF13, it can take 2 or 3 casts before you get all the stats.
Comment: Earlier, I had said in the answer and a comment that you needed to equip the items for the achievement: you guys are right and I was wrong; you only need to have owned them. Regarding dismantling, it's not necessary to get all the accessories or the components to upgrade weapons.
Answer: Check it out at Xbox360achievements.com
It lists all Secret Achievement also, so don't scroll down to far if you don't want to know.
Final Fantasy XIII
If you click the Achievement guide tab it will give you a full description on how to get each achievement.
Comment: I think he's asking more which achievements he needs to know ahead of time, so he won't miss one, but still doesn't have the majority spoiled.
Comment: Ok. I realize I was giving a more wide ranged answer now. Its still an option. I have not played Final Fantasy XIII myself, but this is how I would find out about the achievements to achieve before hand.
Answer: Looking at the list that Tricky posted, they look like the same ones as on the PS3. I don't believe it's possible to make any of them unachievable. I skipped some of the less-linear parts, but you can still come back later if it was important.
Comment: Maybe not unachievable, but less annoying.  If there was an achievement to kill 1000 enemies with a chainsaw thats the kind of thing where I want to start killing enemies at day 1, instead of finding out after the final boss and then going to find 900 enemies.
Comment: Yeah, true enough.


Backbone and Rivets: don't immediately update a model instance with values from DOM

Question: Two-way binding with Rivets and Backbone is great. Your Model instance gets updated as the user introduces changes in a form and then you just have to issue a save() on it.
The thing is that sometimes that Model instance is being shown somewhere else and you don't want the changes to be noticed until the save() operation has been successfully processed (or not) on server-side. In another words, sometimes is desirable to delay publishing of changes from DOM to the Model instance.
The best solution we've thought of is to bind Rivets not to the Model instance itself but to a plain object representation of it (via model.toJSON()). Rivets then publishes changes to that plain object and you only have to pass it as the 'attributes' parameter to model.save().
Have you found a better solution/pattern/practice? Thanks in advance
Answer: I haven't used Rivets per se but one solution to this sort of problem is to use a 'dirty model', ie a copy of the original model that you pass to Rivets and then when you're ready to save it you save it's attributes to the original model. So:
var dirtyModel = new Backbone.Model( originalModel.toJSON() );

then you pass that model to Rivets or whatever else you are using and then you're ready to save it you do:
originalModel.save( dirtyModel.toJSON() );

That way you escape the trap of two-way binding when you don't want it...
Comment: Thanks, I'll try that and let you know how it goes.


Setup for Sensing change in concentration of NaCl

Question: I am making a sensor to sense the change in concentration of NaCl. My background is in electronics and chemistry is not my strong area. I got some screen printed electrodes, with Silver (Working Electrode) and Ag/AgCl (Reference Electrode). My initial test is to put the electrodes in separate solutions, with Reference Electrode in a reference solution of known concentration of NaCl and the Working Electrode in the test solution of varying concentration of NaCl. Will this give me a potential difference and will I be able to determine the change in Concentration of NaCl in the working electrode? If not can you make any suggestion on the setup? Thanks.
Comment: Thank you. I am making a sweat sensor of some sort. This is the first step to show the basic working principles on the sensing aspect.
Answer: This will work with the correct set up. You're constructing a galvanic cell, which will result in a cell voltage. The cell voltage will change when you alter the concentration of NaCl on either side. Important though that your two half cells (each side) are connected both electronically and ionically. Do you have a salt bridge or a membrane between them? https://en.wikipedia.org/wiki/Salt_bridge
Comment: Thank you for the info, I do not have a salt bridge. I was not sure what chemical to use for the salt bridge, in my setup. I did a bit of researching on that and KNO3 and KCl look like a strong choice for salt bridge.


Must every sentence be 25 words or less?

Question: Many books that are read today frequently use long sentences, far surpassing the 25 word limit. There is pleasure in reading such sentences, and there is pleasure in comprehending them. But oftentimes style guides tell us to limit our sentences to 25 words or less, a principle that is applied especially to informative prose and fiction. Should we always abide by this rule? And is it true that only short sentences are easy to comprehend?
Answer: No, you should not always abide by this rule.
However it depends on what type of writing you are doing.  If you are writing instructions that need to be understood by people with a wide range of reading skills, this might be a good idea.  The UK government website adopts this policy.  It needs to communicate clearly with people who have learning differences, dyslexia, English as an additional language. It also needs to be easily understood by people who are busy, frustrated, looking for loopholes or dislike reading.  Keeping sentences short helps increase readiblity.
But if you are writing a novel, or if you want to explore the complexities of a character's internal thoughts, then there is no limit on the number of words in a sentence. If you are writing a complex report for a PhD, you might need longer sentences.  You should be aware that longer sentences will slow your readers down, and even exclude some of them. It's your choice.
Remember that if you are required to conform to a style guide, then you must stick to this rule.  And if you are working to a style guide, even though not required, you should only break the rule purposefully and with your eyes open.
Comment: Already gave a thumbs up. One possible use of sentence length is to give a character a particular type of dialog. Somebody who speaks in only very short sentences is easy to distinguish from somebody who uses page-long sentences. But, as James warned, purposefully and with your eyes open.


import PCB components into KiCAD which are sold in the electronics industry

Question: When drawing a schematic in Eeschema Editor in KiCAD, there is a button to "Run CvPcb to associate components and footprints", so a schematic symbol on the *.sch file can be associated to a physical component to generate the Netlist and be soldered on the PCB when manufacturered.  The component list in this library is kind of small relative to the number of components available for sale online.  Is it possible to import components into KiCAD that users of the program have already created, so you don't have to build them from scratch using the Editor?  Where can I find them, and how do I import them?  I've only been using KiCAD for a week, because I learned it in Ham Radio Club.  So I've never drawn a schematic before this week.
Comment: PCB design typically involved a lot of staring at data sheets and often the wielding of digital calipers as well.  For larger parts, a good final check can be to print things out at exact 1:1 scale, verify overall printout outline dimensions with calipers, and set your parts on the printout.  Watch out for hole *sizes* as well as positions, and watch out for shields or features that might short to exposed copper.
Comment: This question is very broad, and seems to start from a lacking awareness of the industry norm that a project will typical require creating *custom* footprints and schematic symbols unless a part has already been used by that designer and the results validated.
Comment: Hi Chris, you and @JRE seem to have more experience in this realm.  I'm just a Ham, not an electrical engineer.  I'm actually a software engineer myself.  But I'm happy you two are answering from the perspective of what is typically done in electrical engineering.  Sounds like I'll need to custom build components instead of trusting KiCAD library components being correct before having a board made.  Thanks for clarifying.
Answer: The Kicad philosophy is: There are components and there are footprints, and you need to match the component with the footprint. Why? Because the same component might be available in different footprints. AFAIK, all common footprints are already present in Kicad. Only footprints I have had to make were of heatsinks and connectors.
After you draw the schematic (and have run annotate), you have to run CvPCB. This will pull up the browser where you can select your footprints. Only after all components have been assigned footprints, should you create the netlist. Then start the board editor and import netlist. If some components do not have footprints assigned yet, the board editor will issue warnings when you import the netlist there. Go to the schema editor, and run CvPCB to fix that.
The issue with components and footprints also extends to the schematic editor. There are devices and there are components and you need to match the device to the components. e.g. there are 3 leg transistors, 4 leg transistors etc... and you need to match your part with the correct schematic, and then again match the correct footprint with that schematic. Only constraint is the number of pins on the schematic and footprint must match, and they must be numbered the same. You need to check that the numbering is in correct order. e.g. there are transistors with BCE, CBE, ECB... and all of them have pins numbered 123. You will need to make sure 1,2 and 3 correspond to the correct transistor leg. There is a footprint viewer from CvPCB, which will show you which pad corresponds to which pin number. The schematic editor already shows the pin number.
All this is unlike eagle, where footprints are hardcoded with the component. In Kicad, it is perfectly possible to assign a capacitor footprint to a diode, intentionally, or by mistake. Very flexible.
PS: CVPCB may need internet to run. There is a way to force it to use the already installed libraries. Open the settings from CvPCB, and change the KGithub to KISYSMOD. Hope you're using the latest version of Kicad.
Answer: There are a lot of places where you can import custom-made components that manufacturers provide. For instance, Macrofab, a company here in Houston where I live, has instructions on how to do what you're asking.
Assuming that the manufacturer has components you can import into KiCAD, here are the instructions on how to do so. You may need to contact the manufacturer of the component to see if they have a component for KiCAD. Otherwise, you'll have to end up making it yourself and specifying its characteristics. I know at my job, I typically ask for the vendor if they have any SPICE or CAD components of their own products that I can import into the software and they typically do.
Otherwise, I have two options if they don't have what I am looking for: 1) Don't use their products and move on to the next product that I can use to get the job done... or 2) Ask for a specifications sheet along with its architecture (if I'm dealing with FPGAs or ASICs) and create it on the software... which isn't exactly a lot of fun.
But I'm digressing (but it is important if you're dealing with manufacturers)... Here the steps you can take to import what you need into KiCAD.
1) Open KiCAD
2) On the program/tool list, go to Eeschema.

3) Click Select -> Preferences -> Library.

4) Click Add and choose the newly exported ".lib" file.

5) You're finished!
Now if you want to import the footprints and patterns, then you need to follow these steps:
1) On the program/tool list, go to Pcbnew.

2) Follow the same steps as you would importing symbols, only this time select the ".mod" file.

3) You're done!
This is where I got this tutorial and pictures from.
Comment: You'll find that most of the real engineers recommend drawing your own parts rather than importing parts that someone else made.  By the time you've hunted down a source, imported it, checked it for accuracy, and corrected any errors, you could have just drawn it already.  They also usually customize the parts, anyway.  Slightly different sized solder pads, labeling things consistently, fonts and text size, layers, etc.  You really are better off "rolling your own."
Comment: Good to know, @JRE!  @KingDuken, I noticed that the first set of steps did not update the dialog from the button in my question.  But rather, the very last step in this answer did.  I ended up downloading the library from the digikey.com website, and pointed to the *.pretty folder, containing *.mod files.  The "digitkey-footprints" showed up at the very end of the left panel of the association dialog.  The *.mod items showed up on the right panel are found after clicking on the the "digikey-footprints" item, so I could associate one of them to a given Annotated symbol in the middle panel.
Comment: @JRE, do you have any resources on what to watch out for on the PCB manufacturer website(s) (ie: I found www.oshpark.com) for common issues if I use an existing library, and how making your own will be better?  I'm planning on just making a very basic circuit with a coin battery, voltage regulator, diode, DC-AC relay, and an AC device after the relay is switched.
Comment: @KingDuken, I'm still puzzled with where the *.lib file went to, or how I can see what I added for the first "Add" in your answer.  I'll play with again this weekend when I have time.


What happened to McCean's question?

Question: A member McCean (I hope I have his name right) asked for suggestions this morning (EST) regarding ethical systems, secular humanism, or something like that. I am sorry I can't remember the exact title or body of the question. It was a perfectly reasonable question in my opinion, especially when compared to some of other questions we get here.   It met with an objection from MichaelK that it was much (in bold) too broad. In the OP's response, he asked for feedback in order to improve his question.  Now I can't find the question. Can someone help me find it?
Comment: Title: Secular Philosophies of Self Control
Comment: Text: Outside of thought that deals with self control as it pertains to the supernatural and afterlife, I wonder what writing (and by who) has been put out there about self-control, self-transcendence, will-power, and that type of thing, but with more of a secular lean to it.

Thanks for any guidance.
Answer: The question was removed by its author. Because of this, the link will not work unless you have a significant amount of reputation points.
Comment: @Gordon "Because of this, the link will not work unless you have a significant amount of reputation points."
Comment: It says "page not found". Anyway, it's too bad he removed his question, maybe he will repost it. I would like to ask him why he removed his question.
Comment: Yes, you explained that above. The link does me no good ultimatey, but I thought the "title" would be listed.

What happened to McCean's question?


DSA - can $k$ be 1?

Question: I'm learning DSA and I'm wondering if $k$ can be 1. I know that k has to be from $\mathbb{Z}_{q-1}$ but I don't know whether 1 is allowed (not talking about security concerns, purely educational). I know that h can't be 1, because $h^{(p-1)/q}>1$ but I don't know about $k$.
Comment: @kelalaka I tried it and R was the same as S. However, I was still able to sign the message and verify the signature. Is that a problem?
Comment: @kelalaka no, would that open some attack vectors?
Comment: Though in theory I think $k=1$ is allowed though it actually occuring has a really small probability of roughly $1/q$ (as has any other fixed value knowing which immediately breaks DSA fully).
Answer: The $k$ is randomly chosen as nonce (number used once) from the range $[1,q\hbox{ - }1]$ according to NIST FIPS 186-4. As far as I've searched there is no reason not to use $k=1$. The probability of selection $k=1$ is  $1/q$ and that is actually is very small.
You should not re-use any $k$. That simply breaks it. A linearly increased $k$ is also insecure. More than those any small bias while selection the $k$ can be catastrophic. See;

How does the "biased-k attack" on (EC)DSA work?
What is TPMFail attack and what are the countermeasures?

Also, one should not reveal any $k$ used for a signature made public. That compromises the private key, just as re-using any $k$ for two signatures made public. As a consequence, one should not purposely use $k=1$, nor any other particular public value ( thanks to fgrieu).
One can also use a deterministic process to generate the $k$:

RFC-6979 Deterministic Usage of the Digital Signature Algorithm (DSA) and
Elliptic Curve Digital Signature Algorithm (ECDSA) : talks about

It is possible to turn DSA and ECDSA into deterministic schemes by
using a deterministic process for generating the "random" value k.
That process must fulfill some cryptographic characteristics in order
to maintain the properties of verifiability and unforgeability
expected from signature schemes; namely, for whoever does not know
the signature private key, the mapping from input messages to the
corresponding k values must be computationally indistinguishable from
what a randomly and uniformly chosen function (from the set of
messages to the set of possible k values) would return.

DSA - can $k$ be 1?


Does Doc Notice His Past/Future Self?

Question: In Back To The Future Part 2, when Doc Brown is riding a bike and ends up coming upon himself (in the past) working on his "weather experiment" to get the old Marty back to 1985, is there any proof that either of them noticed who they were? If there is proof that they noticed one another, did (or could've) it change anything?
Comment: The BttF2 Doc Brown said to the BttF1 Doc Brown something along the lines of warning him about the connection for the coupling that ultimately came loose.  I'm pretty positive that BttF2 noticed his earlier self and gave him a helpful hint.  I'm not submitting this as an answer as I can't find any quote for what Doc said to himself, I'm going from memory.
Answer: BTtF2 1985 Doc definitely noticed the original 1955 Doc, however, not vice versa.  Specifically, the 1955 Doc requests a 5/8 wrench, but the 1985 Doc correctly indicates it should be the 3/4 inch wrench because he knew what the 1955 doctor was doing.
Because the 1985 doc is already from the future he knew what was going to happen.  As the 1955 doc did not notice the 1985 doc was himself (though the bell is familiar), no time paradoxes were created.
The exact scene excerpt is below.  I hope this helps.

1955 Doc: Excuse me, sir. Yes, you with the hat.
(1985 Doc pulls down his hat so that the 1955 Doc won't recognize him.)
1985 Doc: Who me?
1955 Doc: Yes, be a pal and hand my five-eighths wrench out of that toolbox.
1985 Doc: Five-eighths? Don't you mean three-quarters?
1955 Doc: Why, you're right.
1985 Doc: I presume you're conducting some sort of weather experiment.
1955 Doc: That's right. How did you know that?
1985 Doc: Oh, I happen to have a little experience in this area.
1955 Doc: Yes, well, I'm hoping to see some lightning tonight, although the weatherman says there is not going to be any rain.
1985 Doc: There's going to be plenty of rain all right. Wind, thunder, lightning. It's going to be one hell of a storm.
1955 Doc: Well, thanks. Nice talking to you. Maybe we'll bump into each other some time again in the future.
1985 Doc: Or in the past.
(1985 Doc gets on his bike and ride off, ringing his bell. 1955 Doc looks up. That ring sounded very familiar!)
Comment: Wait - why would 1955 Doc recognize the bell? I assumed 1985 Doc bought the bike quickly to go after Marty.
Answer: First of all this was not at all anything to do with the bell ringing on 1985 docs bike! A bell is a bell! Pay attention to what was really said and why I believe both docs did know that they had ran into each other! Let me explain what happened! Let's flash back before the weather experiment! 1955 doc knows what 1985 doc looks like because of the video recorder he hooked up to his black and white TV! Yes at first he thought just a guy in a hat! But what has caused 1955 doc to look back at 1985 doc as he rang the bell and rode off , 1955 doc did a double take on 1985 doc because he realized what he had just said to him last.
""1955 Doc: Maybe we will bump into each other again sometime in the future!""
""1985 Doc: OR IN THE PAST""
That caused the double take! Who says that? Maybe we will bump into each other in the past? How would we bump into each other "again" in the past without a time machine?
1955 doc realizes what was just said, saw the silver hair he knows from the video cam he will eventually have, and realizes that 1985 doc already knows it's himself talking to himself in the past and that if he doesn't ignore 1985 doc and says something about him being himself, it will then cause a paradox! Now to avoid the paradox, 1985 doc knowing it's himself in 1955 has to make sure he believes that 1955 doc doesn't know it's himself! Now 1955 doc can know that it's 1985 doc is who he is, as long as he lets 1985 doc ride off on the bike believing he succeeded in not allowing 1955 doc to know it's him 30 years later!
Bottom line is in the end, both docs knew who they were! 1955 doc knew as well but knew he had to keep what he thought may be him 30 years later under control! If he tries to act on it by saying "HEY ME, why are you here? That right there will make 1985 doc realize he has now been caught by himself revealing himself to himself which now everything is on the table which now destroys the entire universe!
What I'm trying to say is, 1955 doc is a hero! He saved the world from blowing up! What I'm trying to say is, if you ever build a time machine like doc, first thing you should do is fly back to 1955 and thank doc for keeping seeing himself a secret to allow you to travel back in time! Because you wouldn't be breathing right now if it weren't for 1955 doc saving us all from a paradox!
Sincerely,
James
Comment: As has been pointed out (repeatedly) Doc suffered weirdly selective amnesia that prevented him from remembering the outcome of events.
Answer: He probably did but not until hearing Marty story in BTTF3 when he explained what happened. It should of rang a bell to think "I knew there was something familiar about that guy with the white hair with bicycle, it was my future self, no wonder he avoided looking at me!".
Seriously, if I was doc brown. I would be smart enough to know this unless that hit on the head falling off the toilet screwed up my brain to even put two and two together an issue
Comment: Hi, welcome to SF&F.  The question asked if there was any proof that either noticed/recognized the other.  You've presented a theory; do you have any evidence to support it?
Answer: Yes 1955 doc realized what he said about bumping into eachother again and 1985 doc said or the past, it took a second then 1955 doc realized then who he was and looked as he rode away, in part 3 at the beginning marty explains to 1955 doc while hes hiding in the bathroom that they had both come to 1955 again, so that would of confirmed it even more that yes he did bump into 1985 doc
Comment: Hi, welcome to SF&F.  This is really hard to understand without sentences or proper punctuation.  But it appears that you're basically repeating what the previous answers says about the suspicious reply from 1985 Doc.  The bit about BTTF3 seems to be new, but I can't really figure it out.  Perhaps you could [edit] this to make it more clear?

Does Doc Notice His Past/Future Self?