Crate - What is the minimum memory requirement for a node host?

Question: I can find cheap VPS hosts with 128MB RAM, and I wonder if that is enough to run a crate node for a tiny database, initially for testing. (I'm not looking for recommended memory, but the minimum one, for not running into out-of-memory exceptions. Crate is supposed to be the only service in the node.)
Comment: what kind of queries do you expect to be able to run - and how many records do you expect? clearly, the less memory, the less data your response can handle.
Comment: ~10000 records of ~10Kb each; at peak it must handle 10 writes/minute and 100 reads/minute. Simple queries (no joins) on columns' values, array elements and one fulltext column.
Comment: Each read must bring at most 100 records of 10Kb each (total max 1MB/read). Each write saves only one record.
Answer: It is possible to run Crate in such an environment. I wouldn't recommend it, though. In any case you need to take a few precautions:

Select a lean Linux distribution that actually boots and runs with such a small memory footprint. Alpine might be one choice.
Install Java. You need at least openjdk7 (update 55 and up).
Install and start Crate from the tarball as explained on the Crate website.

On a virtual machine with 128 MB RAM on top of Alpine 3.3, I installed openjdk8-jre (you have to enable community repositories in /etc/apk/repositories) on disk. I downloaded the Crate 0.54.7 tarball and just extracted it. I set CRATE_HEAP_SIZE=64m as this is the recommeded half of the available memory.
I created a table "demo"
DROP TABLE IF EXISTS demo;
CREATE TABLE demo (
    data string
);

and filled it up with 10,000 records of 10 KB random strings each with a slow bash script:
head -c7380 /dev/urandom | uuencode - | grep ^M | tr -d '\n\047'

This took a few minutes (about 20 records/s), but with bulk inserts it should be way faster and just take seconds.
The net amount of data was about 100 MB and took 287 MB gross on disk as reported by the admin UI.
Operating system, the installed software, and the data altogether claimed 820 MB on the disk.
I configured twice the amount of memory as swapspace and got the following footprint (the Crate process itself without data takes up about 40 MB):
# free
             total       used       free     shared    buffers     cached
Mem:        120472     117572       2900          0        652       6676
-/+ buffers/cache:     110244      10228
Swap:       240636     131496     109140

A fulltext search over all 10,000 records (SELECT count(*) FROM demo WHERE data LIKE '%ABC%') took about 1.9 seconds.
Summary: Yes, it's possible, but you lose a lot of features if you actually do so. Your results will heavily depend on the type of queries you actually run.
Answer: I just played around a bit how much you could reduce the HEAP size to, and it looks like that 64MB heap (128MB memory) could work out for your use case.
Make sure you set the HEAP size correctly using the CRATE_HEAP_SIZE (docs) environment variable and also set bootstrap.mlockall: true (docs) to the JVM does not swap memory.
However, I would recommend at least 256MB HEAP (512MB memory).


How many combinations of three dice given as a product an even number

Question: I want to know how many combinations of three dice given as a product an even number. If these dice are different from each other the answer would be $6^3- 3^3$. What about if these dice are equal to one another? Like having $2, 4, 6$ is the same as $4, 6, 2$.
Comment: Do you know how to enumerate the number of possible results of three dice under the constraint? I.e., what takes the role of '$6^3$' if you're talking about the set of dice and not the individual dice?
Comment: @StevenStadnicki could you be more specific?
Answer: First you need to know how many combinations you can get from three dice if the order doesn't matter.  This is what Steven Stadnicki meant in his comment.
There are $6$ ways if all three numbers are the same.
If two of the numbers are the same, and the other is different, there are $6\cdot5=30$ ways.
If all numbers are different, there are ${6\choose3}=20$ ways.
Altogether that makes $56$ ways.
Now do the same kind of analysis to count the cases where all the dice show odd numbers.
Answer: Have you heard of the stars and bars method?  In this case, each die would be represented by a star.  Any dice before the first bar is a 1, any between the first and second bar is a 2, etc.  So, for example, |*||**|| would represent one 2 and two 4's.  There are 8 possible locations to choose 3 stars, so the total number of results from rolling 3 dice is $\binom83=56$.
You can follow similar logic to count the results where all dice are odd.


Excel 2007: plot data points not on an axis/ force linear x-incrementation without altering integrity of non-linear data

Question: In Excel, how does one go about plotting points that don't have an x component that is an x-axis label?
For example, in my graph, the x-components are derived from the cosine function and aren't linear, but Excel is displaying them as if .0016 to .0062 to .0135 is an equal incrementation.
How would I change this so that the x-axis has an even incrementation without altering the integrity of the points themselves? In other words, how do I plot a point with an x component independent from the x-axis label?
Answer: I think you might be looking for the "Scatter" Diagram type.


Basic additive inverse property for rings

Question: I am trying to prove the following property for a ring $R$
$$a\cdot(-b)=(-a)\cdot b=-(a\cdot b)$$
where $a,b\in R$ and let $-x$ denote the additive inverse of $x\in R$. By definition, we know that such an inverse exists for all ring's elements. Also let $1$ be the multiplicative identity which does not necessarily exists in $R$. Thus, I cannot figure out a rigorous proof for the above result.
Comment: What this means is that if you add $a\cdot (-b)$ to $ab$ you should get zero; so add the two together, and rearrange using the axioms of arithmetic in a ring.
Answer: We have
$$
a\cdot b + a\cdot (-b) = a\cdot (b + (-b)) = a\cdot 0 = 0
$$
so we see that $a\cdot (-b)$ fulfills the defining property of $-(a\cdot b)$. Since the addition in a ring gives a group, we know that additive inverses are unique, so we must have $a\cdot (-b) = -(a\cdot b)$. A very similar proof shows that $(-a)\cdot b = -(a\cdot b)$.


Changing an object's acceleration through blender python

Question: I have a rocket based off of some data of its real-world acceleration. The acceleration is changing at an inconstant rate. So for every second (24 frames in my situation) I want to update my rocket's acceleration in python. The only way I have thought of it being possible is keyframing gravity, but I have no idea how to do that in blender python.
Comment: Are you trying to simulate the rocket's path using a physics simulation?  If so, your acceleration is a force that you're applying to the rocket, and you can keyframe the value of the force.
Comment: Where would you get acceleration as a force, and how would you keyframe it?
Comment: While you answered the nuts and bolts of the question, the spirit of the question begs the question of why not just key-framing a force-field's force...
Comment: In my scenario, I needed to align the objects acceleration with external data. Unfortunately, force fields aren't measured in newtons, as far as I'm aware. Essentially what I'm trying to say is that force fields won't work for me because I can't convert force field units to newtons, and back to acceleration. Even if I could, I believe just changing the acceleration to the data is much simpler.
Answer: Fixed the issue, it seems that through scripting, we can change the gravity (acceleration) variable at certain frames. In my situation, I wanted to switch gravity at every second, therefore, every 24 frames. So it would look like
<code> C = bpy.context
 def my_handler(scene):
     if C.scene.frame_current % 24 == 0:
         C.scene.gravity[2] = currentAccList[int(C.scene.frame_current/24)]
</code>
Essentially, for every second, we update our acceleration from a list. In my situation, that list is rocket acceleration data.
C.scene.gravity[2] represents acceleration in the Z axis (up, down).
Another useful tip, if you want to have the simulation and gravity set beforehand, this reference helps:
Comment: You might want to add additional context, right now as written the force will be set to zero on the 24th frame and stay zero (and if that's what you want, why not just >= 24?)
Comment: Updated it, hopefully it makes more sense.


Number of logic gates for counter with each type of flip flop

Question: I am designing two synchronous counters one mod 21 and the other one mod 30. Is there a way to know which kind of flip flop (D, SR, JK, T) will use the smallest number of logic gates?
I know we can build all of them and then check for the answer but that will be a lot of work. I am just wondering if there is a simple way to know that before design.
Comment: Thinnk that the nr of extern logic gates depends on the truth table of counter states, state(n) vs state(n+1), if there is a binary pattern then you will require minimal gates.
Comment: I assume you are asking about logic gates outside the flops, because flops themselves are made up of logic gates?
Answer: D, JK or T flip flops can all be configured such that they divide by 2.  SR flip-flops, by themselves, can not be wired to toggle that way.  So they are not applicable.
There are really only two types of counters you can build; a ripple counter, which divides by 2\$^N\$ using N flip-flops, and a ring counter, which divides by N using N flip-flops.  The ripple counter's output can be short-circuited to divided by a number less than 2\$^N\$, for example a decade counter using four flip-flops.  So we just need ripple counters, the ring counter will always use more flip-flops and can be discarded.
So to minimize the number of flip-flops, you need to break the counter value into prime factors, e.g. 21 breaks up into 3 x 7, and 30 breaks up into 2 x 3 x 5.
In the first case (21), since it doesn't divide by two you can't use a single flip-flop to divide the input by half.  But you can cascade two ripple counters, one counting to 3 and the other counting to 7 (the output of the first fed into the input of the second).  The total number of flip-flops needed would be 2 + 3 = 5.
In the second case (30), you can divide the input by two using a single flip-flop, and once again cascade two ripple counte3rs, one counting to 3 and the other counting to 5.  The total number of flip-flops needed would be 1 + 2 + 3 = 6. (Or, you could use one ripple counter counting to 5, and another counting to 6, using the same number of flip-flops.)


If a strictly stationary process is also independent, does this imply i.i.d.?

Question: Suppose I have a time series process $\{X_t\}$ that is strictly stationary in the sense that the joint distribution of $[X_{t_1},...,X_{t_k}]$ and $[X_{t_1+a},...,X_{t_k+a}]$ are the same for any set of integers $t_1,...,t_k$ and any integer $a$. If in addition, I know that this process have mutually independent observations. Does this imply that $\{X_t\}$ is an i.i.d. process? My guess is that it is. Because strict stationarity implies that every term in this time series have the same distribution as $X_1$, and thus when independence also hold, it is an i.i.d. process.  Does this look correct?
Comment: @mhdadk Yeah, it's about joint distribution, but I meant it IMPLIES marginals are have identical distribution. Just take $t_1,...,t_k$ as 1, the definition says $X_1$ has the same distribution as $X_{1+a}$ for any $a$. What's wrong with this?
Comment: "Because strict stationarity implies that every term in this time series have the same distribution as $X_1$" This is not what strict stationarity means. This contradicts the definition that you gave, which is about the joint distribution, and not the marginals.
Answer: Yes, that is correct.  Strict stationarity implies a common marginal distribution for the variables in the series, which is the ID part in IID.  If you combine this with an assumption of independence you then get IID.
Comment: @whuber: For now I'll leave the answer unchanged, since I think that mutual independence is the strong form.  Like you, I always take the unqualified term "independence" as meaning the strong (mutual) form, so don't need the qualifier, but perhaps OP wanted to specify to be sure.
Comment: @whuber: Isn't mutual independence the stronger one (i.e., independent conditional on any of the observations in the series)?  I was under the impression that pairwise, triplewise, etc., were the weaker and mutual independence is full independence.
Comment: You could be right: I had understood "mutual" as meaning "pairwise," for otherwise why modify the word "independence" at all?
Comment: Thanks a lot! This is very helpful.
Comment: But isn't the assumption of "mutual independence" in the question weaker than independence?  That distinction appears to be the crux of the matter.


What is the name for The husband to the Lady President or head of state

Question: If the head of state or president is a lady , what do we call the husband to the Lady president . I know that when the man is the president , the wife is called the "First Lady" , what about the vice versa.
Answer: I don't think there is a special word that describes a male First Lady! But let me put some light on the title in concern.
The First Lady is not necessarily used for the wives of the presidents. The term is used for the White House's official hostess which is generally the wife of the president. Imagine if the president is a widow and the duties are performed by someone else (maybe daughters). In such case, they'll be the First Lady.
I think even if you have some female as the President, the constitution still requires some host/hostess at the White House. In such case, if her husband is not interested, again her daughter or some female would be appointed.
Interesting paragraph on Wikipedia (and the answer to this question):

Should a woman be elected to the US Presidency, her spouse would presumably be known as "The First Gentleman". Such usage was made in various literary works describing the term of a fictional woman President, such as The Coming of the Quantum Cats.
In The Coming of the Quantum Cats, in one universe, Nancy Reagan is the President of the United States and her mostly-disregarded husband Ronald is known as "The First Gentleman."

Till date, there has been no lady president and probably that's the reason, no title is thought yet! ;)
Comment: We also call our president's spouse "First Lady" this is in Kenya. We too have lady presidents in other parts of the world e.g Liberia , Brazil and what have you. I am not Necessarily referring to the U.S.A @ Maulik V
Comment: Yes, you are right. It is an unofficial title used for the wife of a head of state. But broadly, the term refers to the US President's wife.


ordered logit-difference-in-difference

Question: I ran an ordered logit difference-in-difference estimation and got stuck in terms of interpretation. The dependent variable takes on values 1 2 and 3 and I am trying to obtain coefficients for the variables for each of the three categories as I see in papers but I am not sure how to go about it.
Comment: Please provide a specific simplified example of your desired result.
Comment: say I am trying to estimate the effect of a policy on marital status-single, married and divorced.
Comment: That sounds like a standard 2 degree of freedom test comparing 3 groups, which can be done by removing marital status from the model or by using a 2 d.f. contrast to get a Wald $\chi^2$ statistic.  A double difference is not implied by the example question you provided.
Comment: when I run the ordered logit, I get treatment effect for the dependent variable as a whole, but i am trying to get the treatment effect for each of the categories.
Comment: Get those from the coefficients (which represent difference from the reference cell in log odds scale) or by taking differences in coefficients to get other comparisons.
Answer: If you have specified the difference in differences as the interaction of your time and group variable then you need to be aware that interactions in non-linear models (like ordered logit) have a different interpretation. This relates to a similar question here which asked how difference in differences works in the context of logit models. In this reply there are alternative models and links to articles that explain the intuition and interpretation of difference in differences in the context of nonlinear models. Have a look and then see whether ordered logit is actually what you want to do. Particularly relevant for your case would be Karaca-Mandic et al (2012). Note though that what you are trying to do is not very well explored in the econometric literature which is mostly for the fact that difference in differences in nonlinear models is far from trivial (for an overview of the problem see Athey and Imbens, 2006).

ordered logit-difference-in-difference


Recovering a group from its quotient group

Question: Suppose I've a group $G$ and a normal subgroup $H$. I know the structure of $G/H$ as well as the structure of $H$. Is it possible to recover the original structure of G from this?
Comment: Dear Mohan, [This question](http://math.stackexchange.com/q/25315/221) and its answers are quite relevant. Regards,
Comment: An infinite groups counter-example: suppose $G$ is a free group of arbitrary rank greater than one, then every (non-trivial) normal subgroup of infinite index is isomorphic to the free group on countably many generators. Thus, if $G/H$ is any infinite group and $H$ is the free group of countably-infinite rank, then $G$ can be any free group of rank greater than one.
Answer: Unfortunately, no; the simplest example is $G_1=\mathbb{Z}/4\mathbb{Z}$ and $H_1=2\mathbb{Z}/4\mathbb{Z}$, as compared with $G_2=(\mathbb{Z}/2\mathbb{Z})\times(\mathbb{Z}/2\mathbb{Z})$ and $H_2=(\mathbb{Z}/2\mathbb{Z})\times\{\overline{0}\}$. We have
$$H_1\cong H_2\cong\mathbb{Z}/2\mathbb{Z},\qquad G_1/H_1\cong G_2/H_2\cong\mathbb{Z}/2\mathbb{Z}$$
but $G_1\not\cong G_2$. The general problem of determining what groups $G$ could arise, given a specified normal subgroup and the corresponding quotient, is called the group extension problem.
Comment: Dear Zev, It is good to remember though that Schur--Zassenhaus applies if $G/H$ and $H$ are of coprime order.  Cheers,
Comment: @MattE But it is also important to remember that even then, we cannot in general uniquely recover $G$.
Comment: @Tobias: Dear Tobias, As I wrote in my answer, we have to also remember the action of $G/H$ on $H$ (obviously).  Regards,
Answer: There is one important piece of data that you have omitted: namely, if $H$ is normal in $G$, then $G$ acts on $H$ by conjugation, and so there is a homomorphism
$G/H \to Out(H)$ (the group of outer automorphisms of $H$); without remembering this, there would be no chance of reconstructing $G$.
Now in general giving $G/H$, $H$, and a map from $G/H$ to $Out(H)$, there is
still no chance of reconstructing $G$.  E.g. even if $G$ and $H$ are abelian,
so that the homomorphism $G/H \to Out(H)$ is trivial, Zev's answer gives
a counterexample.
However, if $G/H$ and $H$ are finite of coprime order, then in fact any extension
of $G/H$ by $H$ is necessarily a semidirect product, and so in this case your question (suitably modified by remembering the conjugation action) has a positive answer.  This is the Schur--Zassenhaus theorem.
This is why counterexamples (such as in Zev's answer) tend to focus on $p$-groups.


What is meant by "stochastic sampling"?

Question: What exactly is meant by "stochastic sampling" and is it profoundly different from the regular Nyquist-Shannon sampling theorem? Is it related to sampling a stochastic process?
Answer: Stochastic sampling doesn't have anything to do with sampling stochastic waveforms. It simply means that instead of sampling at regular intervals, the waveform is sampled randomly.
Recall that in a sampling scheme per the Nyquist-Shannon sampling theorem, a continuous signal $x(t)$ on $\mathbb{R}$ is sampled as $x[n]=x(nT),\ n\in\mathbb{Z}$, where $T$ is the sampling interval and $f_s=1/T$ is the sampling frequency. If the maximum frequency in the signal is $f_{max}$, then $f_s$ must be such that $f_s\geq 2f_{max}$ so as to avoid aliasing. For ease of comparison with stochastic sampling later on in the answer, let me redefine the sampling in a slightly different form than usual as
$$
\begin{align}
s(t)&=\sum_{n=0}^{f_s\tau -1}\delta(t-nT)\\
x[n]&=x(t)\cdot s(t)
\end{align}
$$
where $\delta(t)$ is the Dirac delta function and $x(t)$ is only sampled on the interval $[0,\tau]$.
If you actually think about it, regular sampling is pretty limiting in practice. Aliasing crops up in several places, and probably a well known and visible effect is the Moiré patterns which can be reproduced at home by taking a photo of regular patterns displayed on a television (examples below).

However, this is always a problem with cameras, but never with your eyes if you were to see the pattern directly! The reason is because the photoreceptors in your retina are not laid out in a regular pattern unlike the CCD in a camera. The idea behind (not necessarily the idea that led to its development) stochastic sampling is very similar to the non-regular layout of photoreceptors in the eye. It is an anti-aliasing technique which works by breaking up the regularity in the sampling.
In stochastic sampling, every point in the signal has a non-zero probability of being sampled (unlike regular sampling where certain sections will never be sampled). A simple uniform stochastic sampling scheme can be implemented over the same interval $[0,\tau]$ as
$$
\begin{align}
s(t)&=\sum_{n=0}^{f_s \tau -1}\delta(t-t_n),\quad t_n\sim \mathcal{U}(0,\tau)\\
x[n]&=x(t)\cdot s(t)
\end{align}
$$
where $\mathcal{U}(0,\tau)$ is the uniform distribution on the interval $[0,\tau]$.
By sampling stochastically, there is no "Nyquist frequency" to talk about, so aliasing will no longer be a problem as before. However, this comes at a price. What you gain in anti-aliasing, you lose by noise in the system. The stochastic sampling introduces high-frequency noise, although for several applications (especially in imaging), aliasing is a much stronger nuisance than noise (e.g., you can see the Moiré patterns easily in the above images, but to a lesser extent the speckle noise).
As far as I know, stochastic sampling schemes are almost always used in spatial sampling (in image processing, computer graphics, array processing, etc.) and sampling in the time domain is still predominantly regular (I'm not sure if people even bother with stochastic sampling in the time domain). There are several different stochastic sampling schemes such as Poisson sampling, jittered sampling, etc., which you can look up if you're interested. For a general, low key introduction to the topic, see

M. A. Z. Dippé and E. H. Wold, "Antialiasing Through Stochastic Sampling", SIGGRAPH, Vol. 19, No. 5, pp. 69-78, 1985.
Comment: There are some applications of stochastic sampling schemes in the time domain; random sampling intervals can be used in [compressed sensing](http://en.wikipedia.org/wiki/Compressed_sensing), although the technique is not universally applicable.
Comment: could be improved of an example of an image that was extrapolated from stochastic sampling.
Comment: @JasonR Thanks. I am aware of the application in compressed sensing, but it works only because of the sparsity condition, which is why I didn't mention it. (besides, the examples I've seen in compressed sensing are also mostly with images/spatial sampling, but that could just be my bias from selective reading)
Comment: stochastic sampling has a huge application on graphics rendering, especially real-time graphics rendering.

What is meant by "stochastic sampling"?


Measuring text width in Qt

Question: Using the Qt framework, how do I measure the width (in pixels) of a piece of text rendered with a given font/style?
Answer: You can use QFontMetrics class - see the width() method which can give you the width of a given QString.
QFont myFont(fontName, fontSize);;
QString str("I wonder how wide this is?");

QFontMetrics fm(myFont);
int width=fm.width(str);

Answer: Since Qt 5.11 you must use horizontalAdvance() method of QFontMetrics class instead of width(). width() is now obselete.
QFont myFont(fontName, fontSize);;
QString str("I wonder how wide this is?");

QFontMetrics fm(myFont);
int width=fm.horizontalAdvance(str);

Answer: In the paintEvent
QString text("text");
QFontMetrics fm = painter.fontMetrics();
int width = fm.width(text);

Answer: As an addition to the answer by @Paul, I found that when painting text (Qt4.8 on linux), the width of an actually painted text compared to the width of what QFontMetrics::boundingRect returns is often off. In my cases, the painting was often too wide.
If you want accurate results when painting text (for example to dimension rectangles you draw around text), better use the boundingRect functions provided directly by QPainter.
Comment: Found the same situation on OS X with Qt 5.5.1. The height was off. I was using a standalone QFontMetrics but needed to set the font on the painter and use its boundingRect directly to accurately measure the text.

Measuring text width in Qt


How can I get a list of all active enabled contexts on drupal site with drush?

Question: I can list all enabled modules by calling drush pml.
I can also used flags to only return certain kinds of modules, based on where they are enabled or not and so on:
Show a list of available extensions (modules and themes).

Options:
 --type                                    Filter by extension type. Choices: module, theme.
 --status                                  Filter by extension status. Choices: enabled, disable and/or 'not installed'. You can use multiple comma
                                           separated values. (i.e. --status="disabled,not installed").
 --package                                 Filter by project packages. You can use multiple comma separated values. (i.e. --package="Core -
                                           required,Other").
 --core                                    Filter out extensions that are not in drupal core.
 --no-core                                 Filter out extensions that are provided by drupal core.
 --pipe                                    Returns a space delimited list of the names of the resulting extensions.

How can I list all the contexts enabled on a site in a similar fashion, so I can rype something like drush context-list
Answer: i would say something like this:
drush php-eval "print_r(context_active_contexts());"


Mesh generation in FEM

Question: When a frame structure is analyzed using a FEM computer software, does the program still generate mesh, even as a line mesh, on frame members, or we must do it ourselves?
Answer: This is really dependant on the package or the software used. Most commercial software packages such as ANSYS and COMSOL multiphysics have built-in mesh generators. If you are writing your own code to solve structural problems, then you could use open-source discretization packages like MeshLab or TetGen. Personally, I like using COMSOL multiphysics for these kinds of problems. Their interface is very intuitive for mesh generation.
Comment: Analyzing a frame structure with an auto-generated 3D solid mesh is overkill by several orders of magnitude, but if you have a million times more computing power than you actually need to get the work done, wasting it doesn't really cost much - except when it produces meaningless stress concentrations near the joints which make it hard to interpret the output!
Comment: Yes that was what I was thinking, so in other words, we do not do auto meshing in frame structures, and we just draw/show the frame line or shell elements and the program divides each member evenly to several pieces and that is all we need for frame or truss structures correct? I mean that is the mesh here, but it is not like a 3D mesh which is overkill right? So this 2d or 3d auto meshing would be more beneficial for the people who analyze irregular 2d or 3d problems correct?

Mesh generation in FEM


Is it possible to set two exposure values and set them on a loop?

Question: I'm trying to capture a time lapse of the moon rising and would like to set one exposure time for the moon and one for the foreground. Is it possible to save two exposure values or do I have to switch back and forth manually?
Comment: What kind of camera are you using? The correct answer to your question is very much dependent upon the capabilities of the specific camera you are using.
Answer: Depends on the camera, but look at bracketing settings. Most cameras allow you to take 3 exposures - one correct (as metered), one underexposed and one overexposed, but some allow 2 exposures too - e.g. one as metered and one overexposed (which seems to be what you're looking for). If you enable bracketing before starting the timelapse, the camera should bracket each shot.
Answer: Most DSLR cameras have a built-in intervalometer to shoot timelapses, but they don't offer very good control over their parameters. Also, the support for bracketing during timelapses is very model/manufacturer-dependent.
For what you want to shoot, you might consider getting a dedicated time lapse intervalometer. These devices usually also allow you to increase or decrease the exposure slowly over the timelapse (known as bulb ramping, or bramping).


High(very high) frequency sound waves = heat?

Question: I had this question in mind and did not quite found the answer on google. If heat is a vibration of particles in matter, and sound is pressure wave moving using particles (causing them to fluctuate), could a very high frequency sound wave raise the temperature of matter which it is travelling in?
Comment: So I can make use of my better half's tirades by positioning the cup between her and I. Brilliant
Answer: Sound waves can definitely be used for heating of matter. High intensity ultrasound waves are (among other applications) used for internal heating of parts of the human body for medical therapy of a number of conditions. See Therapeutic Ultrasound. The extreme heating of gas bubbles in water by high-intensity ultarsound has also led to the discovery of the baffling phenomenon of sonoluminescence.
Answer: Technically speaking there is a difference between high frequency sound waves and heat, though they can have similarities.  Heat is typically stochastic vibrations -- random vibrations that nobody can predict.  Sound waves are typically well ordered vibrations, which still have some structure to them.  Accordingly there are ways you can use many sound waves which you cannot use heat for.
Now quite often high frequency sounds can be absorbed by a medium, which really means that they were turned into random vibrations -- heat.  However, we typically think of the sound as something other than heat as long as we can find ways to use its structure.
If you were to think of all the particles of a material as little tiny loudspeakers, and they were all emitting noise (Brownian noise, to be specific), then the connection between sound waves and heat would probably be pretty close to perfect.


How is Argon2 used for key derivation?

Question: By my understanding, a key derivation is when you take some data, say a password, and use a function to convert it into a number that can be used as a secret key in say elliptic curve cryptography. Argon2 uses a random salt when hashing, which necessitates that the hash is different every time despite the same password being used. If the hash is different, how can it be used to represent the same secret key?
Comment: Does this answer your question? [Encrypt a file with AES using a secret key derived with Argon2](https://crypto.stackexchange.com/questions/75021/encrypt-a-file-with-aes-using-a-secret-key-derived-with-argon2) and you store the extra information.
Comment: What you describe in the question is actually common with all KDFs that support a salt. @kelalaka While I agree the linked question has some in overlap with this one, the setting and the context are quite different from a comprehension perspective.
Comment: @DannyNiu I've already mentioned that as _keep this information with..._, if the OP is asking why do we remember the salt, the answer is obvious, the PBKDFs and KDFs are all deterministic, so if you input the same values you will get the same result. This is what we want from the Random Oracles, once we get a value for an input, we want the same value when we asked with the same input.  and the last part  `always uses a random salt for hashing`... I think I've covered all.
Comment: @DannyNiu wrote one to cover all, may be I've missed some part, though some need to be copy and paste...
Comment: @kelalaka that question actually answers my questions, thanks
Answer: It is true, you use a randomly generated salt with argon2i/argon2d/argon2id. However that random salt only needs to be generated a single time. You need to know the salt and parameters used in argon2 hash-generation in order to validate that hash later.
Some libraries offer encoded hash output for argon2. Encoded output stores the hash/paramaters/salt all in a single string. This encoded string can then be split out into hash/params/salt at the time you go to verify the hash.
This Defcon talk is somewhat recent and explains some of the technical implementation with regard to argon2:
https://youtu.be/4Tn71-1GN20?t=1271
Answer:
By my understanding, key derivation is when you take some data, say a password, and use a function to convert it into a number that can be used as a secret key in say elliptic curve cryptography.

Yes, this is correct, however, keep in mind that your password should have good enough strength to protect from brute-forcing. A common way is using the dicewire or Bip39 like password mechanisms, see in xkc936.
Once you derive the key $k$, then this is your private key, and $[k]G$ is your public key in ECC with the base point $G$ of the curve. Erase the $k$ after using, even don't store it in the memory, and keep your password safe!

Argon2 uses a random salt when hashing, which necessitates that the hash be different every time despite the same password being used.

Yes, that is correct, too. You may consider this like that with all of the parameters of the Argon2, you run a deterministic function. The same input will result from the same output. This is what we want from the hash functions, password hash functions, and Random Oracles; be deterministic; the same input must result in the same output.
Using different salt is used for deriving more than one key from a password. The salt at the same time is a good countermeasure aginst the rainbow tables where applicable.

If the hash is different, how can it be used to represent the same secret key?

To get the same key, you need to use the same parameters; the same password, the same salt, the same iteration, the same memory usage, and the same parallelization. Parameters apart from your password must not necessarily be secret, they can be stored openly. For example, this kind of information is stored in LUKS header, the important part is to keep your password secret all the time.
One must store these parameters when deriving the key from the password.

How is Argon2 used for key derivation?

First, decide your target security; i.e. how much do you want the life of the attacker is hard. Adjust the number of iterations, degree of parallelization, and memory usage according to your target security. Once you have decided, generate a uniform random salt. Determine the desired key size, like 256 bits (or 32 bytes). Now you are ready to use Argon2 with this information.
You supply your information to Argon and decide your target security;
<code>Usage:  ./argon2 [-h] salt [-i|-d|-id] [-t iterations] [-m memory] [-p parallelism] [-l hash length] [-e|-r] [-v (10|13)]
        Password is read from stdin
Parameters:
        salt            The salt to use, at least 8 characters
        -i              Use Argon2i (this is the default)
        -d              Use Argon2d instead of Argon2i
        -id             Use Argon2id instead of Argon2i
        -t N            Sets the number of iterations to N (default = 3)
        -m N            Sets the memory usage of 2^N KiB (default 12)
        -p N            Sets parallelism to N threads (default 1)
        -l N            Sets hash output length to N bytes (default 32)
        -e              Output only encoded hash
        -r              Output only the raw bytes of the hash
        -v (10|13)      Argon2 version (defaults to the most recent version, currently 13)
        -h              Print argon2 usage
</code>
Note that the Argon2 has three types;

Argon2d is faster and uses data-depending memory access. Data dependency immediately enables side-channel. This is suitable for cryptocurrencies and applications with no threats from side-channel attacks.

Argon2i uses data-independent memory access and this is preferred for password hashing and password-based key derivations.

Argon2id In the first half of the first iteration works as Argon2i and for the rest works as the Argon2d. This enables both side-channel protection and time-memory trade-off.

and form draft-irtf-cfrg-argon2-03;

If you do not know the difference between them or you consider side-channel attacks as viable threat, choose Argon2id.

How is Argon2 used for key derivation?


OFDM SubCarrier and its relationship with IFFT in context of Real and Complex

Question: In the process of OFDM Signal generation. We take symbols (constellation symbols) and map it to a sub-carrier (real analog time domain) harmonics of 15khz, add different sub-carriers separated by 15khz gap (say SubCarrier are N), now we get our OFDM Signal and we can send it.
To overcome this generation of Freq of multiple of 15khz we use the process of IFFT (fast IDFT process) and in the formula of it we see symbol treated equivalent as Freq point value multiplied with exponential component--> we say this represents carrier which opens to be cos+jsin, but my carrier was never complex it was real where I wanted to send data.
Does it means my output of IFFT which is discrete time signal is complex and then I convert it to analog and upconvert it-->this is still complex signal?
So initially we were mapping complex symbols on real, adding them and sending. Now we are mapping complex symbols to complex waves and sending?
Comment: Found a detailed answer here [Explanation of OFDM TRANSMITTER and use of I & Q Paths](https://dsp.stackexchange.com/questions/88248/what-is-use-of-quadrature-converter-in-ofdm)
Answer: When you map data to subcarrier symbols in OFDM, that IS a complex mapping.  Each "constellation symbol" becomes the magnitude and phase for an FFT bin, so ultimately when you take the Inverse FFT, you are creating the time domain waveform that would represent all of those constellations being broadcast in parallel on closely spaced carriers each separated in frequency by $1/T$ where $T$ is the symbol update rate.
For the simplest case, consider QPSK modulation for each subcarrier: for that you could map pairs of data bits onto each subcarrier according to:
11: $exp(j \pi/4)$ or equivalently $0.707 + j0.707$,
10: $exp(j 3\pi/4)$ or equivalently $-0.707 + j0.707$,
11: $exp(-j 3\pi/4)$ or equivalently $-0.707 -j0.707$,
01: $exp(-j \pi/4)$ or equivalently $0.707 -j0.707$
The OFDM signal as the FFT, and its time domain signal as the IFFT are both complex signals at baseband when mapped according to the example above (and must be complex in order to represent each possible point in the constellation which itself is complex). We can then translate a complex baseband signal (which requires in implementation two real data paths: one for "I" or in-phase component and one for "Q" or quadrature component) to a real IF or RF carrier frequency using an quadrature up-conversion (two multipliers or mixers, a sine and cosine local oscillator and combine the output).
If you understand single-carrier modulation (such as the QPSK example here), then consider OFDM as the most efficient way to send multiple low-rate QPSK or QAM modulations in parallel on closely spaced carrier frequencies. That is what the FFT is (closely spaced frequencies each with their own magnitude and phase, as a complex number), which makes it convenient for OFDM implementation.
Below is a further attempt to add some clarity starting with the OP's perspective of a QPSK or QAM modulator. The first drawing below shows how we could implement an OFDM transmitter the "hard way" by grouping together traditional QPSK/QAM modulators with closely spaced carriers given by $\omega_1$ and $\omega_2$. I show two such groupings but you can extend it to $N$ modulators, with carrier frequencies spaced by the inverse of the symbol rate or $1/T$:

In the initial implementation shown above, $I_{LO1}$ and $Q_{LO1}$ represent the higher frequency carrier frequencies (either an IF or RF carrier) as $\cos(\omega_1 t)$ and $\sin(\omega_1 t)$ respectively, and similarly for $I_{LO2}$ and $Q_{LO2}$ for carrier frequency $\omega_2$. $I_1$ and $Q_1$ represent the real and imaginary portions of the selected symbol for the upper modulator, and $I_2$ and $Q_2$ represent the complex symbol for the lower modulator (given by the mappings first introduced, for example). Thus the data input pair $I_1$ and $Q_1$ represent a complex data path given as $I_1+jQ_1$ and similarly the local oscillator is a complex data path given as $I_{LO1}+jQ_{LO1}$ for the upper modulator, and similarly for the lower modulator. Thus it may appear that the two multipliers form a complex multiplier, and they are indeed part of that. Assuming in this case we are doing the frequency translation with a high enough carrier frequency, we can immediately take the real part of the output without interference from the complex conjugate spectrum any real waveform will have.  Note below the equivalent complex representation that one of the two modulators shown above would be given by the complex multiplication:
$$Re\{e^{j\phi_1}e^{-j\omega_1 t}\}$$
$$=Re\{(I_1+jQ_1)(I_{LO1}-jQ_{LO1})\}$$
$$= I_1 I_{LO1} + Q_1 Q_{LO1}$$
Given this, consider what we would need to do if $\omega_1$ and $\omega_2$ were at "baseband", for instance at $\omega_1 = -2\pi 1/T$ and $\omega_2 = 2\pi 1/T$. We would need to represent these with complex signals (I and Q) until we can translate this to a higher IF or RF frequency using an "IQ Mixer" (to refer to an analog implementation) since given $\omega_1 = -$\omega_2$, they cannot be independent data symbols with a real waveform that must be complex conjugate symmetric (but can be with a complex waveform!). Such an implementation the "hard way" is given by the diagram below:

And similarly in more compact form with the wide data paths representing complex waveforms (where each wide trace below is a complex data path as $I+jQ$):

Above as mentioned is the "hard way" to implement multi-carrier with orthogonal spacing (spacing the carriers by $1/T$ with $T$ being the symbol rate provides orthogonality), where the drawing above can be extended out to $N$ carriers.
OFDM allows us to do this the "easy way"! Notice that each carrier is simply a bin in the FFT (if we were to take an FFT of the combined result). So with OFDM we simply start with that, load the constellation onto each bin according to our mapping and then take the inverse FFT to create the equivalent analog signal that the above would create (as a complex signal that we would need to translate to a real RF carrier at an IF or RF frequency). There is a lot more detail with OFDM such as adding a cyclic prefixes to avoid the effects of delay spread that I am not mentioning here, but the intention with this introduction is to remove the mystery of how the complex signals for each DFT bin can represent the equivalent analog waveform to a multi-carrier QPSK/QAM system. Further the above shows the most generic form fully utilizing the independent bins in a full FFT, but OFDM implementations can also be done with Hermitian symmetry ($N/2+k = k^*$) such that the direct output can be real such that and IQ frequency translation is not required.

The complete OFDM transmitter as is shown below in its typical form, where we see this is an equivalent structure to what was developed above and the importance of the complex values for each QPSK/QAM symbol as represented by $k_0$, $k_1$, etc.

If the frequency translation with complex signals as depicted in this post is still not clear, the follow post may also be helpful and get to root of the OP's question that goes far beyond OFDM specifics:
Frequency shifting of a quadrature mixed signal
Answer:
In the process of OFDM Signal generation. We take symbols (constellation symbols) and map it to a sub-carrier (real analog time domain) harmonics of 15khz, add different sub-carriers separated by 15khz gap (say SubCarrier are N), now we get our OFDM Signal and we can send it.

In short: no. You can't generate an OFDM system just by placing carriers in a regular grid in analog domain. These carriers need to carry a synchronized, rectangular symbol sequence, else it's not OFDM.
A system that does that inherently is a time-discrete system with a DFT as synthesizer bank.
I never liked the explanation of OFDM as "just" an easy-to-implement analog multicarrier system. The requirements to the relationship of these carriers inherently make the system discrete-time.

but my carrier was never complex it was real where I wanted to send data.

You should be thinking of complex baseband here – the center frequency of the OFDM signal is completely irrelevant.
So, no. your carrier was not real to begin with.

Does it means my output of IFFT which is discrete time signal is complex and then I convert it to analog and upconvert it-->this is still complex signal?

You will need to understand equivalent complex baseband before you can understand OFDM! This is really not something we can explain as an "aside" in an answer, but it's at the heart of every modern communications scheme, so:
no, your passband signal is not (usually) complex.

So initially we were mapping complex symbols on real,

no, you're mapping complex symbols to complex-valued subcarriers in complex baseband,

adding them

err, you do that by doing an IDFT, and that has the addition internal,

and sending.

mix them up to a carrier frequency and then transmit that.
Answer: The 'IFFT' method of generating 'OFDM' is misleading. A set of 'N' QAM vectors (complex values) presented to an IFFT module will result in 'N' output vectors. If that set of N output vectors is considered to be a complex-valued time-domain sequence, and if it is transmitted using quadrature modulation, then that block sequence would need to be transmitted repeatedly, in looped fashion (ie. periodic) in order for the spectrum to be 'OFDM'. Otherwise, if sending that particular complex N-value block sequence just once only, then that would just be quadrature modulation. Not 'OFDM'. You need to have at least 'some' physical periodicity in your IFFT sequence in order to even begin to consider the existence of sub-carriers. No periodicity, no sub-carriers, and no OFDM symbols, as we need periodicity in the time domain to make that 'connection' with the counterpart frequency domain 'vector components'. This also means that the IFFT signal that everyone is talking about is not actually an OFDM signal at all. It is just quadrature modulation. That's because each IFFT chunk or block that is sent out is not periodic. You need to physically create periodicity in the time-domain before we even begin to contemplate existence of sub-carriers and/or carriers that represent the vector components in the frequency domain.


Magento Title tag seo

Question: I have a magento website Logtech . I have changed the default title and all to my site variables. But when I search in google for logtech.in it shows the title Magento Commerce.
Comment: Give Google time to re-crawl your pages. The changes don't reflect immediately.
Answer: Inside your Google Webmasters Tools Account you can fetch pages for re-indexing.
More information on the steps can be found at: https://support.google.com/webmasters/answer/1352276?hl=en
Answer: For your or any website crawling all searching engines have a certain round robin mechanism, so they will pick your title soon, when your turn comes.
Answer: Hi bro use webmaster and follow some step.
1. Submit sitemap.xml
2. Check crowl status.
3. Check robots.txt
4. Use index tool
5. Don't miss data highlighter tool in webmaster this is very important tool index point of view...
If you have confussion and want all index rule check my quora profile. https://www.quora.com/profile/PRADEEP-KUMAR-4135
I hope this answers helpful for you.
Cheers...

Magento Title tag seo


How can I store the MAC address of a client in a file before redirecting to any port using iptables/ebtables

Question: I want to store the MAC address of the client to a file before redirecting to some IP or port.
I'm doing the redirection using iptables. Is it possible to get the MAC of the client and store it in a file?
Answer: Yes, it's possible to get the MAC address of the client and store it in a file. You need to change your network driver to perform this when it parses packet from the client. The MAC address belongs to Layer 2 of the of the OSI network model, thus it can be extracted before passing it to Layer 3, which handles the IP.


flex ButtonBar problem

Question: I want to generate a button sequence on ButtonBar with some disabled buttons:
<mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;

            [Bindable]
            public var nav:ArrayCollection=new ArrayCollection();

            ...

            function initApp():void
            {
                nav.removeAll();

                for(var i:uint=0;i<navSize;i++)
                {
                nav.addItem({label: i });
                }

                nav.addItem({label: "Last", enabled:false});

            }
        ]]>
    </mx:Script>
...
<mx:ButtonBar id="btnBar" dataProvider="{nav}"/>

but why the last button is still enabled?
UPD: I found solution by adding updateComple event handler:
function upd()
            {
                trace("upd()");
                for (var i:int=0; i < btnBar.numChildren; i++)
                {
                    if ([condition])
                    {
                        Button(btnBar.getChildAt(i)).enabled=false;
                    }
                }
            }

Anybody have better solution?
Answer: The ButtonBar considers items in your dataProvider as generic objects.  It will not look into those objects for values other than label.  The way that list classes work is there is a labelField, a labelFunction, and a method named itemToLabel.  I assume that the ButtonBar uses a similar approach.
The itemToLabel function is called whenever the component needs to find the label from the item in your dataPRovider.  It will not look into your dataProvider for other settings and that is why the enabled property in your dataProvider has no effect.
I'm unclear exactly why you want to disable buttons in the ButtonBar.  Knowing that would help us give you direction on where to put the code.  Using the ButtonBar's updateComplete event will run that code every time the component's visual display is updated, which you probably don't want.
You can run this code on creationComplete, which is a one time event.  But, if you need constant updates this would not work.

flex ButtonBar problem


Should you turn off label smoothing when validating?

Question: As the subject says. On one hand, the answer should be yes because label smoothing is a regularization feature and how can you know if it improves performance without turning it off? On the other hand, I haven't seen any authoritative source claiming that it should be turned off during validation, not even the article that introduced the technique mentions it. And afaict, as the feature is implemented in Keras it is not turned off during validation.
Answer: The way most people gain an initial understanding of label smoothing (and what most common explanations have to say on the subject) plays a great role in how one would approach this question.
At first glance, label smoothing is exactly what the name suggests: we modify the labels or some portion of them in order to get a better, more general, more robust model. It makes sense that we don't want the model to learn from (and later predict with) extreme confidence levels, especially when we know that some of the labels are wrong, since this hurts the model's abilities to perform on unseen data. The intuitive explanation of LS mechanics, then, is that we are not feeding the model with pure 1's and 0's, but with less confident values instead, resulting in a more reserved decision function that doesn't extrapolate in an extreme manner. Now, we know that smoothed labels are not the true labels, so at this point the main concern pops up - once we have trained on smoothed labels, do we also use smoothed labels for validation?
If you think about LS purely as a data manipulation technique, the answer to the question above is not obvious, as it may go both ways depending on the argument. However, one must remember that LS is almost always regarded as a regularization technique -- you mention this in the question yourself -- and there is a good reason for that. Regularization, by definition, is when the loss function is extended with an additional regularization term, which usually has to do with penalization. In LS, this penalty term is responsible for punishing high confidence predictions. Even though it may not appear as such, LS, once applied, becomes an essential part of the loss function, which should persist between training and validation if we aim to take advantage of the technique. When we apply LS during training, we are effectively trying to minimize a loss function with the regularization term added in. Throwing it out during validation would defeat the very purpose of including it in the first place: if we decide not to apply LS to the validation set as well, we are making the mistake of expecting extreme confidence (1/0 labels) from a learner that was just a moment ago specifically trained against making overly confident predictions on previously unseen data. The correct thing to do would be to validate that the predictions are of moderate confidence, just as desired. This is why the validation set should also have the regularizer present in the loss function, i.e. have smoothed labels as well.
Comment: Makes sense but then how would I know if label smoothing improved my model? With LS turned on I'm likely to get different and perhaps even worse values for validation loss and accuracy. I don't want to use LS if I can't say that it makes my model better.
Comment: I would suggest comparing two models (one with LS, another without it) by testing their accuracy/precision/recall/AUC/whatever on a holdout set. That way you'd be looking at an objective performance metric.
Comment: Isn't that more or less what is done with the validation dataset?
Comment: Not quite. In the beginning, we use training and validation sets to first teach the model and then make sure that it learned in the right way. We usually build multiple models over training+validation data, as we try different techniques, tune parameters, etc. The test dataset (also called holdout) is used only at the very end to assess unbiased performance of the final model(s) -- this is the data than never affected the models being tested nor (and this is equally important) our previous decisions which lead to having these models as final candidates.
Answer: AFAIK label smoothing comes into picture while calculating the loss while training. There is no loss computation during validation.
Comment: Sure there is. You're thinking about testing perhaps.
Answer: Label Smoothing is a regularizer technique that is applied to target value so that the model can learn the data well without overfitting. There is no need to do label smoothing for validation.But even if you do it, it won't be problem.


How did Luthien defeat Sauron with such ease?

Question: I haven't read the entire Silmarillion yet (I know that I should!), but I've read bits of it, and  one thing that strikes me is how Luthien, a half-Maia, defeats a full Maia of great power like Sauron? I know she cast a shadow or cloak over his eyes, but did Sauron have any effect on Luthien at all?
Comment: @CarlSixsmith No - he beat Finrod Felagund in a battle of sorcery.
Comment: Well he beat celebrimbor in a one and one and defeated elendil and gil galad in a 2 v 1 just saying hehe
Comment: He beat finrod, celebrimbor, defeated the king of the high elves and a near 8 foot numenorean in a 2 v 1
Comment: @user31546: Sauron died killing Elendil and Gil-Galad. Finrod lost in a battle of magic and was killed by wolves, not Sauron himself. I don't think we have details on how he killed Celebrimbor.
Comment: How do you read bits of a book?
Comment: Sauron lost every one on one battle he fought in. He's not that tough on his own I guess. Plus like Melkor, his investment in control over others weakened him.
Comment: Luthien didn't fight Sauron, you're probably mistaking it with putting Morgoth to sleep.
Comment: luthien could enchant beings with a form of drowsiness, which she used against Sauron (and later Morgoth through song).  She cast out Sauron with the help of Huan the hound while he was under that effect.
Comment: I my self ordered the silmarillion by mail and never received it, and while waiting for it to arrive read bits and pices of it in a local bookstore i until I have read almost all of it in small random parts, but I never read it fromstart to finish.
Comment: @Daft When I first read GoT Fire and Ice, I read all of the Jon Snow & Daenerys Targaryen chapters, skipping the rest...
Answer: She didn't. Huan did. All Luthien did was make Sauron stumble. And then Huan, a Maia, took up the battle.

So great was the horror of his approach that Huan leaped aside. Then Sauron sprang upon Luthien; and she swooned before the menace of the fell spirit in his eyes and the foul vapour of his breath. But even as he came, falling she cast a fold of her dark cloak before his eyes; and he stumbled, for a fleeting drowsiness came upon him. Then Huan sprang. There befell the battle of Huan and Wolf-Sauron, and howls and baying echoed in the hills, and the watchers on the walls of Ered Wethrin across the valley heard it afar and were dismayed.
  But no wizardry nor spell, neither fang nor venom, nor devil's art nor beast-strength, could overthrow Huan of Valinor; and he took his foe by the throat and pinned him down. Then Sauron shifted shape, from wolf to serpent, and from monster to his own accustomed form; but he could not elude the grip of Huan without forsaking his body utterly. Ere his foul spirit left its dark house, Lúthien came to him, and said that he should be stripped of his raiment of flesh, and his ghost be sent quaking back to Morgoth; and she said: 'There everlastingly thy naked self shall endure the torment of his scorn, pierced by his eyes, unless thou yield to me the mastery of thy tower.'

(Silmarillion)
As you can see, Sauron's direct attack did seem to afflict Luthien; only her cloak and Huan seem to have saved her.
At the end, Luthien is simply threatening Sauron with disembodiment (effected by Huan) unless he yields up the tower. Since he concedes, Huan and Luthien let him go and he escapes (relatively) unscathed, with just a throat-wound that drips blood on the trees.
Answer: Sauron is one of those LOTR characters whose power isn't supposed to be determined by a>b>c.
"Power" is something very ambiguos in Tolkien's universe. (Example: Tulkas (a valar) could beat the virtually-invincible Morgoth in a battle of pure physical strength. But since when is that the only way to fight? He beat Morgoth because A)he fought on his own terms and B) Morgoth was already exhausted. If it had been an all out battle Tulkas would've been obliterated). Sauron has great physical strength for a Maia, but that's not where his power lies. His strength is in deception, magic, and sorcery. So when he fought a great hound of the Valar (technically a tier above him, so Sauron was actually punching above his own weight), he couldn't really have won in the end. Not because he was inferior, but because he didn't get to fight his way.
Also in answer to the question Luthien is a sorceress. She just cast a spell of drowsiness on Sauron, and it took all her strength for that. Sauron's mere presence rendered her unconscious
Comment: The first two paragraphs of this don't appear to be an attempt to answer the question, but rather a tangentially-related commentary on it, which is not answers are meant to be used for. We have a dedicated comments section for that, but the ability to comment everywhere is a privilege reserved for those who've earned sufficient reputation. The final paragraph does qualify as an answer to the question, however, it contradicts [Shamshiel's answer](https://scifi.stackexchange.com/a/100065/122024), which provided evidence to support its position, whereas this answer lacks any supporting evidence.
Comment: I'm not sure "cast a spell of drowsiness" really captures the intent of the text, though. It was more that she desperately flung her cloak with sleep-inducing properties at him, which cloak she'd made much earlier and already used on others.
Answer: "Lúthien stood upon the bridge, and declared her power: and the spell was loosed that bound stone to stone, and the gates were thrown down, and the walls opened, and the pits laid bare; and many thralls and captives came forth. But Beren came not."
She then goes on, without Huan, and fells Carcharoth into a deep sleep so she and Beren can pass the gates of Angband.
Then, in the deepest pits of hell, using a cloak made of her own hair and the power of her music, she knocks Morgoth Bauglir off his throne, into quite a long state of total unconsciousness along with all of his servants and attending monsters and foul creatures. If you read Tolkien's works with no prejudice you would see that Women often proved to be much more magically powerful than men. Without Melian, Galadriel and Lúthien the wars against Morgoth and Sauron would have ended in defeat.
Comment: Hi, welcome to SF&F.  The question is specifically about the fight between Sauron and Lúthien, so that should be the scope of your answer.  This is really just a comment on the question, so it shouldn't be posted as an answer.  When you earn some reputation you'll be able to leave comments; you might want to take the [tour].


Identify diode marked CD

Question: Diode that needs identification. It is from a power board for a xenon lamp. I could not identify it at all. I referred to the STM site as well but could not find anything. Could you please help?
Comment: Although there is a answer informing to be a "Transil" diode, that is a kind of overvoltage protection/clamping diode, a Xenon lamp application typically would not need such protection, so the description may mean other component too. It could be identified with more safety if you could post more photos for the PCB surroundings for this diode.
Answer: It's a 3.3V low-voltage transil (SMLVT3V3) from ST.
Comment: I saw your link, but doesn't make sense to me why such 3.3V overvoltage protection diode would be used in a Xenon Lamp circuit. Without more information about the circuit, I would think  such application would use/need a fast switching and/or high voltage rectifier diode.

Identify diode marked CD


What Result Is Valuable in Mathematics?

Question: I'm a physics student, and I know that, in physics, value is considered for compliance with experiment. No theory, no matter how beautiful, is taken serious without experimental proof. People publish papers in physics, when they find new applications of physics or when they give new meanings to some physical entities through their new theories. What result is valuable in Mathematics? Do you call it new, for example, when someone presents a fast way to compute number of primes, or when someone presents a complicated formula but a precise one, or just the beauty of the approach is valued?
Comment: I like the spirit of this question, but I'll warn that it it risks being closed as too broad.
Comment: "[In physics] value is considered for compliance with experiment". True, but it's not the only form of value. If you asked a fair sample of physicist "What results are valuable in physics?" then I'd bet a good percentage would state mathematical results that at present have no relation to experimental evidence (e.g. string theory). Also that mantra you have been told that "No theory, no matter how beautiful, is taken serious without experimental proof" is not as true as it once was.
Comment: The most valuable theorems are the most general ones.
Comment: Is there experimental proof of string theory?
Comment: you are right, maybe I should have said "If one obtains experimental results opposing to those expected from the theory, the theory has no value".
Answer: One way to be valuable is to be aesthetically pleasing: $$e^{i\pi}=-1\quad \text {(Euler)}$$
A second way is to  solve a problem which had baffled great mathematicians: $$x^n+y^n=z^n \;\text {has no non-trivial solutions in integers for }  n\gt2    \quad    \text {(Wiles) }   $$
A third way is to prove  a difficult  and useful result in some branch of mathematics: $$  \text {Every algebraic variety in characteristic zero  has a resolution of singularities }     \text {(Hironaka) } $$   A fourth way is to introduce a powerful new concept:    $$\text {Logarithms } \:\text {(Napier) } \quad\text {Flatness } \:\text {(Serre) }  \quad \text {Distributions }  \;   \text {(Sobolev, Schwartz) }                $$
...and there are many, many other ways.
Answer: I'd say it depends on the context and no real objective answer can be drawn but it's quite an interesting question.
To my mind, though it can be debated, the function of mathematics is to answer questions in the language of mathematics, which may have come from the physical world or more abstract settings. This would suggest that a result is valuable if it provides an meaningful answer to a question. The result's value may be enhanced by its clarity, simplicity, beauty and rigor but none of those characteristics are inherently necessary.
As to whether a result of fast computations of primes is valuable, per se. The speed of the algorithm would be valuable to the computer scientist but only indirectly valuable to the mathematician as a tool for their work. The real value to the mathematician comes in the answer to the question of "how fast can we make prime finding algorithms" and "what is the next biggest prime?".
The question of whether we call a mathematical object "new", is rooted in the timeless, philosophical debate of whether mathematics is invented or discovered. Which is interesting but ultimately probably useless.
As to whether complicated but precise formulae are valuable, yes, in the sense that they have precision in answering questions, but they would be more valuable if they were simpler. Ideally, mathematics shouldn't fill blackboards with long-winded, formulae that go on forever, it should get to the point in an articulate and straight-forward way.

What Result Is Valuable in Mathematics?


EventReceiver is working on local site where code is written.But when I deploy its wsp on another site it is not working?

Question: I have written Event Receiver for a list on my local site on its item added event in that event receiver it creates subsite under a top level site. And updates a url in the list. This functionality is working fine on my own development machine but when i deployed wsp to another machine it is not working why does that happen so? Even I can't debug that wsp, what is the way to find out error?
Answer: Configure ULS Logs and try to find events relative to your solution.
http://samirvaidya.blogspot.ru/2012/03/where-are-sharepoint-uls-logs.html
http://technet.microsoft.com/en-us/library/ff463595(v=office.15).aspx


WebORB for Java or BlazeDS?

Question: I'm in the beginning phases of a project that uses a flex front end with a java/glassfish back end.  I'm curious which technology is better to connect the two, WebORB or BlazeDS. At first glance WebORB seems a little bit easier to deal with, but BlazeDS has a larger support community.
Comment: There is a third contestant as well: http://www.graniteds.org
Answer: I can't say much about WebORB because I've never used it, but I have used BlazeDS extensively and it is a solid product. It's relatively easy to install, and it's well documented.
As an added benefit, it's an official Adobe open-source product there are engineers and testers that are accountable for fixing community issues :)
Answer: One important question is what features you intend to use: straight up RPC calls over HTTP/AMF, Consumer/Producer-style messaging, do you need RTMP, etc?
One important thing worth nothing is that WebOrb Community edition doesn't support clustering and you need to purchase the Enterprise edition to get that.  Blaze DS does support clustering via JGroups if I remember correctly.
Answer: I'm starting to use Flex + Java too, so I'm comparing those two.
In the first time I tried BlazeDS, but I found a terrible limitation:
BlazeDS doesn't handle well the Lazy initialization of Hibernate; and none of the solutions I saw seems to be good.
Anyone knows a good way to handle Lazy with BlazeDS?

see
/blazeds-vs-graniteds-vs-weborb-vs-lifecycleds-for-business-applications-on-flex-and-java/
at  artemgolubev(dot)com
Answer: While WebORB Community Edition doesn't support clustering, it does support more than 100 concurrent users, which I have been told by BlazeDS converts is a limitation for BlazeDS.
Also, my colleague and I just finished writing an integration selection guide which has been published in the Flash&Flex Developers Magazine September issue (2010)(available online at ffdmag(dot)com.  We've tried to capture the important features you are looking for and have challenged other integration server vendors to contribute in the next update to this guide.
Finally, I just want to officially announce that WebORB for Java v.4.0 is out.  There are two free versions (development mode and community edition).

WebORB for Java or BlazeDS?


Accidentally deleted my user's home folder

Question: so, I'm running a home server using Ubuntu Server 18.04.2 LTS and I'm currently controlling it via ssh outside home. I wanted to delete everything I had on my user's home folder so I used "sudo rm -r /home/user" and deleted everything including the user folder. now everytime I do "cd" it says "-bash: cd: /home/user: No such file or directory"
I've already tried to restart the server (via ssh) but still the same.
What should I do to recover my user's home folder?
Comment: There is no 'recovery' in the sense of recovering the previous user directory and any files within it. Those are gone, gone gone. You can use `sudo mkdir` to create a new directory with the correct username, then `sudo chown` to change ownership of the new home directory to the correct user.
Comment: What backup strategy did you put in place?   Knowing that is how you restore your removed files, and we cannot know what you chose to use.
Answer: Just recreate the folder, add the default config files, and change the owner to you:
<code>sudo mkdir /home/user
cp -a /etc/skel/* /home/user
chown -R user:user /home/user
</code>
Answer: Have you tried
mkhomedir_helper
Usage: mkhomedir_helper  [ []] ?
If you are asking about recovery of the folder it was possible only before the restart.


How do you maintain a balance between mystery and offering clues?

Question: Giving good clues that offer just enough information can be difficult.  I think I tend to not give the players enough information and then to overcompensate with a reveal that comes too easily.  Anyone have tips?
Answer: If what you're looking to do is create mysteries for the players to solve, Chris Lehrich on the Forge had a good idea he called "abduction". It's deduction taken back end up, so to speak. In abduction, the players come up with their theory about what happened. Then they theorize clues that must exist if the theory is true; then they look for those clues.
The important part of this process is that the players must do their thinking out loud, so that the game master can hear it. Because the GM probably hasn't placed those specific clues at the scene yet, but the GM does know how the crime/mystery happened. If their theory is correct and it means the clue must exist, then the clue does, in fact, exist for them to find—even though the GM doesn't have it in their notes.

If the players are working abductively, they will create clues of their own accord, then seek them out. That is, if they hypothesize that the killer must have run across that flowerbed, they will realize that it will help the Case immensely if there are footprints in the flowerbed. If the Case is accurate on this point, the GM has them find the footprints.
This means that the GM's job is to have a clear Case in mind and to work very strongly on Deduction, prior to the game, to figure out what the clear Results will be.

The players can't just say that their characters are looking in the flowerbed, however. They must say why they are looking in the flowerbed.
Comment: It works quite well. We used this heavily in a game Chris and I played in together.
Comment: I used abduction just in a game session this week to good effect. Recommend.
Answer: The key seems to be to hide way more clues than you think are necessary, but to not have any one clue be too revealing. Think lots of small clues that are relatively easy to find but don't reveal anything individually. The players should have to combine them to get any useful info from them.
Another good technique is to have lots of clues in various places that all point to the same information, but only give the players the first clue they find that provides that information. That way you can be relatively sure that they'll learn what they need to learn no matter where they look, but they don't get constant reminders of the facts.
Also, this depends a lot on what kind of game you're running. If it's a traditional murder mystery-style game, the players are likely stuck with whatever info you give them. Players in a game like D&D have more options with regard to divination spells, etc., and you can be more sparing with clues since they have the means to find out a lot without them.
Answer: Always keep in mind:

You are probably being too subtle most the time
Players will often see clues where there aren't any, twist your existing clues into theirs
Don't forget you know all the answers and your players don't, see it from their view
If the investigation has come to a halt and no one is enjoying scrabbling for more clues or trying to work out the existing clues then throw them a lifeline, keep the game rolling
Answer: The various games based on the GUMSHOE system (Esoterrorists, Trail of Cthulhu, Mutant City Blues) approach the investigation genre with a fairly cool approach - you automatically find the basic clues if you look for them at a scene.  Then you worry more about interpreting the clues.  You can get more details and whatnot if you do better or bring specific skills to bear.  I think the general approach can be applied to any system.
Answer: They way I do it is to keep back many of the clues and then when the player team starts to get stuck, I feed them a little bit more to keep the game going.
Alternatively, I always offer the players lots of different options of things they can do. If they get stuck on one problem, then the can do something else and come back to it when they have accumulated more information.
Answer: Clues are fun. Hidden clues that nobody finds aren't fun.
You can try to 'give them without hesitation, but at a price'. Perhaps your character will have to pay something dear, a favor, have to rough up a witness... what are you willing to do to get that clue?
Answer: In addition to some great answers...
To the players, everything the GM says has the same shade of grey.  Whether the GM has just made it up on the spot and is utterly irrelevant or it is a major clue will be a shade of grey. This can be a huge problem where the GM knows what is important and the players have no clue whatsoever -- bad pun intended. Not because they do not have the clues but because they cannot see them in the sea of information.
The way I deal with this is to guide the players by giving information to the characters.  So, if they fixate on a clue that is not relevant, I tell whoever plays the clever character that this is probably not fitting in.
Also, my players are well conditioned to draw spider diagrams (also known as mind maps). Those become quiet complex but if an piece of information does not fit, then it quickly becomes apparent. Again, sometimes, I give the clever character a nudge by pointing out that moving X to the centre will yield some better results.


Can't use in ground pool anymore, how do I maintain it?

Question: Health problems and up keep costs have led to the decision not to use in ground pool.  What do I need to do to keep the pool mosquito free while not having to pay the pool service company and the costs associated with running the pump and filter?
Comment: I don't have enough experience to post this as an answer, but a bunch of problems come to mind. Empty pools can pop out of the ground or they can crack. If you don't run the pumps they can be damaged. Typical winterizing is performed with de-winterizing in sight so we lube stuff and add antifreeze with the expectation that it will all be undone in a few months.
Comment: You could probably 'winterize' it...
Answer: Difficult.
You may be able to drain it, but it doesn't take much standing water for mosquitoes to breed so that's an ongoing issue unless you fill it in.
If your don't drain it, you can keep it chlorinated/brominated/ozonated to kill the mosquitoes. That may require running the filter system. If you can keep the pool covered, you can reduce the amount of organic material drifting into the water, which shold make maintaining the chemistry easier. But any standing water on top of the cover risks becoming a skeeter colony again; see above. And you may face Attractive Nuisance legal risks.
You could try turning it into a fishpond, stocking it with enough fish to eat most of the skeeter larvae. Your county extension office, or the equivalent agricultural advisory service in other countries, might be able to tell you whether this would be at all workable. Converting it back into a usable pool might not be easy, though, and the fishpond might still be considered an Attractive Nuisance.
I believe the way most folks solve this is by selling the house to a family who wants the pool and using the proceeds to buy an equivalent or better house, or by selling the land the pool is on (either makes it someone else's problem) or by accepting that it has outlived its usefulness and filling it in.
Comment: I like the fishpond idea. How much maintenance would that require? Would it need aeration or one of the pumps running? Would a decorative fountain suffice to keep it from turning into a pond of slimy goo? Would you have to feed them?
Comment: I'd give +5 for selling the house if I could.  Granted, here in New England pools have a relatively short season, but inground pools are more often a drawback than a selling point.
Comment: @carlwitthoft: I grew up with an old-style paint-over-plaster-over-concrete inground pool, so I have a personal fondness for them. But if "boat" is defined as "a hole in the water you pour money into", an in-ground pood is an inside-out boat and thus a hole in the ground you pour money into. If you are certain you won't use it, it's a liability. Of course the other answer would be to resolve to use it; it's great exercise, and if you are willing to either heat it or wear a wetsuit the season can be extended considerably...


How can I show that a sequence of regular polygons with $n$ sides becomes more and more like a circle as $n \to \infty$?

Question: If we construct regular polygons with larger and larger numbers of sides, they will look more and more like circles.
That is intuitively true.
I hope you will help me to express and prove it mathematically.
Comment: I find all these comments and the answer by dfeur by far too sarcastic. It is clear that the real meaning of this question is the following. *Intuitively, the regular $n$-gon tends to a circle. What would be the appropriate mathematical setting to get this intuition formally correct?*
Comment: Be aware that "to become more like a circle" is a weak statement; eg, that property is not enough, in itself, to compute a perimeter. See this (which also "tends to a circle") http://math.stackexchange.com/questions/12906/is-value-of-pi-4
Comment: There is no such thing as a polygon with "largest number of sides". There is also no such thing as a polygon with an infinite number of sides.
Comment: First of all, you can't "construct" a regular polygon with an infinite number of sides. By definition a polygon only has a finite number of sides. The statement is mathematically imprecise and certainly not "logically true". You can show by inscribing a regular $n$-gon in the unit circle that letting $n$ go to infinity you can arbitrarily approximate a circle by a regular $n$-gon, but that is somewhat different from your claim.
Comment: @J.-E.Pin: You make a very good point. I'm tired and in a foul mood, so I probably should keep my mouth shut. However, I probably couldn't resist the logic bomb bit even in better circumstances.
Comment: @dfeur I appreciate your new answer. Good reply.
Answer: Here's one serious approach: Let $f_n\colon [0,2\pi]\to \Bbb R_+$ be the function whose graph, in polar coordinates, is the regular $n$-gon centered at the origin with a vertex at $(1,0)$. Then $(f_n)$ converges uniformly to a constant function mapping any angle to $1$, whose graph is a circle.
We can also look at the limit of the area, a la Archimedes, and the perimeter.
Comment: can you please construct and upload the graph you mentioned in your answer
Comment: @NefinAbraham: I could, but so could you! The GeoGebra program (which is free) is great for this sort of thing.
Answer: The regular polygon approaches the circle in the following sense:

All vertices of the polygon are on the circle.
The maximal distance of the polygon to the circle is given by $2R\sin^2(\frac{\pi}{2n})$, which goes to zero as $n$ goes to $\infty$.
Comment: It might be worth to warn that this does NOT guarantee that the perimeter converges to that of the circle.
Answer: It seems worth emphasizing that "look more and more like circles" admits numerous interpretations. The answers and comments currently visible say that the polygons converge to the circle in several ways: They eventually lie within arbitrarily narrow annuli just within the circle. Their areas converge to the circle's area. Their perimeters converge to the circle's circumference.  One could add more; for example, for almost all rays $R$ emanating from the origin, the direction in which the $n$-gon crosses $R$ converges to the direction in which the circle crosses $R$ (namely, perpendicular to $R$).  The "almost" here refers to the unpleasantness that a few (countably many) $R$'s pass through a vertex of one of the polygons, so the direction of crossing is undefined there, but even these $R$'s are OK if one uses the average of the directions just to the left and just to the right of $R$.  I suspect there are lots of other convergence properties that one could state and prove in this situation.  An interesting but non-mathematical question would be to determine which of the many notions of convergence cause people to say that the $n$-gons for large $n$ "look like circles".
Answer: There is nothing wrong with this question. All you have to do to formulate your assumption rigorously is to use the Hausdorff distance. Then you can show, that for a sequence of regular Polygons $P_n$ of the inner radius $r$ and and the circle $S^1_r$ of radius $r$ the Hausdorff distance $d_H (P_n , S^1_r ) $ tends to  $0$. More information about Regular polygons and Hausdorff distance can be found in Richard Gardner's book called "Geometric Tomography".
Answer: The half-angle formula is sin(t/2)
S = 2*sin(t/2)       Arc length = 2^54*sin(t/2^54) = pi/2 at 90 degree
  S = 2*sin(90 degree/2) = 2^(1/2) approximate 1.4141    Arc length = pi/2 approximate 1.5707
  Sn = 2^54*sin(90 degree/2^54)   Sn = 2^53 sides
  circle total sides = 4*(2^53) = 2^55 sides
  Tanks Giuseppe Stagno
Answer: I have proven that the circle is a binary polygon and has 2^55 SIDES
The formulas are :
<code>      I1 is the First Increment = (2+2x) ^ (1/2).
     arc lenght =[(2-I53) ^(1/2)]*2^53=pi/2 at 90 degree.
    t= degree

   Arc length=2^54*sin(t/2^54)=pi/2 at 90 degree.
</code>
I Giuseppe Stagno the author: my email   email@example.com  thanks
Answer: For Polygons, as number of sides increases,the length of each side is reducing
so at ∞, the length will be equal to a point.
Each Side can be assumed to be shortened to the vertex(ie a point)
Now, the polygon becomes a locus of points which are actually the vertices of the polygon.
However, each vertex is equidistant from the centre of polygon, so the resulting polygon
becomes a locus of points, equidistant from a common centre point, which is a circle.
After Edit:
Now, what remains, is to prove that at n->∞, length of side tends to zero, ie a point.
It can be proved by contradiction.
1) Suppose at n->∞, length of each side is not equal to a point, but is L.for n-> ∞, total    length = n*L = ∞.
Now, total length is infinite,however, polygon is a closed figure, so its total length is
obviously finite.
Thus this contradicts that length is infinite, which in turn contradicts our original supposition.
Therefore, at n-> ∞, length of each side tends to 0, ie each side becomes a point.
Comment: This at best (disregarding some... inaccuracies, as "at $\infty$, length will be equal to a point") shows that the polygon curve tends to the circle, but this does not prove that its length tends to that of the circle. See this http://math.stackexchange.com/questions/12906/is-value-of-pi-4 and http://math.stackexchange.com/a/229269/312
Comment: Pl check my solution again, I've edited it.
Comment: "what remains, is to prove that at $n\to\infty$, length of side tends to zero, ie a point" "What remains" for proving... what? You don't state that. In the linked examples above the length of the small segments all tends to zero. And your statement "polygon is a closed figure, so its total length is obviously finite" is also wrong. ("obviously" ? are you aware of fractals? a closed figure can have infinite perimeter.
Comment: What remains means that it was left to prove in my first attempt at the solution.
However,"obviously finite" was a wrong thing on my part.I was thinking about Koch Snowflake when I thought about the solution.I had a misconception that Koch Snowflake suggests that inspite of having infinite perimeter,length is finite. Anyway, I was wrong, & thanks for clearing that.