Question related to pyroelectric sensor

Question: Is it possible to detect human motion by using a single pyroelectric sensor?
According to me we can't do so using a single sensor.
Comment: You can. The reason two sensors are used is to detect direction (humans tend to only move horizontally) and filter out ambient temperature changes without relying on time delays.
Answer: To detect the motion of a human or other heat source, the sensing element has to distinguish between general background heat radiation and that given by a moving heat source. A single pyroelectric sensor would not be capable of this and so a dual element is used.

One form has the sensing element with a single front electrode but two, separated, back electrodes. The result is two sensors which can be connected so that when both receive the same heat signal their outputs cancel. When a heat source moves so that the heat radiation moves from one of the sensing elements to the other, then the resulting current through the resistor alternates from being first in one direction and then reversed to the other direction. Typically a moving human gives an alternating current of the order of 10-12 A. The resistance R has thus to be very high to give a significant voltage. For example, 50 GV with such a current gives 50 mV. For this reason a transistor is included in the circuit as a voltage follower to bring the output impedance down to a few kilo-ohms.
A focusing device is needed to direct the infrared radiation onto the sensor. While parabolic mirrors can be used, a more commonly used method is a Fresnel plastic lens. Such a lens also protects the front surface of the sensor and is the form commonly used for sensors to trigger intruder alarms or switch on a light when someone approaches.
Comment: Nice explanation
Comment: I disagree that a single pyroelectric sensor *can't*. It is just less effective at it because it would have to detect solely on how rapidly the thermal signature in front of it is changing.

Question related to pyroelectric sensor


objects not falling realistically

Question: I have modeled a screw(like a wood screw) and I want it to fall onto a rigid body plane.  When it falls it hits the plane and has a little bit of movement after that, but mostly stays in the same exact position, which is against all physics...I've pushed a bunch of buttons in the rigid body settings, nothing really helps.  Any suggestions?  Also, where is the option to 'multiply volume by mass'(I don't know if that will help, but I want to try.)  Thanks!
Answer: You probably have wrong Rigid body Collision shape, try changing it to mesh:
Comment: I actually had mesh on, but since you mentioned it, I decided to try a cone, since it is roughly cone shaped and it worked pretty well.  Thanks

objects not falling realistically


MySQL: Delete records whose id is not in the result set of another query

Question: This should be a pretty simple thing, but I'm quite new to (My)SQL.
Basically, given a customers table with attributes id, client, etc., where the client field is not necessarily unique, I want to eliminate rows where the client field is a duplicate of a previous value.
The following:
 SELECT MIN(id) FROM customers GROUP BY client

returns the unique id's of the rows I want. I want everything else out.
I tried
 DELETE FROM customers WHERE customer.id NOT IN
    (SELECT MAX(id) FROM customers GROUP BY client)

to no avail. (ERROR 1093 (HY000): You can't specify target table 'customers' for update in FROM clause).
Why doesn't it work and what do I need to do to accomplish my goal?
Thank you.
Answer: You could create a temporary table that holds the values you want to remove.  Then your delete query could be based on that temporary table.


What is considered as revealing a sin

Question: What is considered as revealing a sin and if someone reveals their sin on this site is it considered as revealing a sin
Answer: What is revealing a sin?
Sin before God
God knows all. A sin cannot be hidden from Him. It cannot be revealed before God.
Consciousness
To become aware that a deed is a sin or may be a sin is a first step. Some of the questions here are put in this stage to ask whether something is a sin.
Confess to God
Although God knows what we do and what we think, it is good for us to confess to God, to direct our thoughts. This is the beginning of repenting and asking for forgiveness.
Some questions here are about the proper way to repent.
Reveal to other people
Sin against ourselves or against God need not be confessed in public.
Unjustice against other people should be acknoledged, asking for forgiveness and if possible offer compensation.
As this site is pseudonymous, it offers the possibility to discuss sin in public without going public in person and reveal a sin to public.

What is considered as revealing a sin


How to measure performance of several scrum teams against each other?

Question: With one scrum team velocity against itself over time it is easy - just number of points per sprint. But how to measure performance of several scrum teams against each other?
Comment: Why do you want to do this? Each team is different - different problems, different team members with different backgrounds and skills, possibly different tools. What information do you hope to achieve? What is the purpose of comparing teams?
Comment: To identify low performing scrums and to also send a message - your performance is measured, keep improving.
Answer: Scrum teams are unique and shouldn't be compared to one another in terms of productivity using things like velocity or story point sizing.
Where you may gain some benefit from comparing scrum teams is in their Agile-Scrum adoption/maturity and practices.
Does one team always meet it's commitments and the other does not?  Why?  Can team 2 use something that team 1 does, to help team 2 meet commitments?  Maybe.
Always remember when you compare Agile-scrum teams, that what works for 1 team doesn't necessarily work for team 2.  Don't fall into the trap of blindly implementing processes or policies across teams without understanding the underlying problem you are trying to solve.
Respect scrum ceremonies and basic building blocks like story definition and estimation.  The rest is up to the team to self-organize.
Answer: Comparing Scrum team performance is easy: measure each team's ability to meet delivery commitments.
The purpose of Scrum is to enable teams to estimate reliably and communicate effectively about development roadblocks so that they can make reliable delivery commitments to each other and customers. The best Scrum team will have the best commitment delivery rating.
A bad Scrum team is one that is unpredictable across iterations (sprints) and can't be relied on to deliver promised software features.
A good Scrum team delivers what it promises, when it promises so that customer and funding decisions can be made with confidence.
Comment: I like this answer the best. Especially the last sentence. People forget too easily that stories, story points, and velocity are all a means to plan for the future. A reliable, consistent scrum team is a team you can plan for. And that is gold.
Answer: Need clarification - what performance are you attempting to measure, and for what purposes? For example, are you attempting to benchmark quality, or business value delivered, or adaptability to changing requirements, or cross-training, or...?
Most important would be what are the primary benefits you hope to benchmarking teams against each other - team performance is a multi-variate problem in so many dimensions that it can be difficult to get to a useful set of metrics which can be used effectively.


Coating brass components cheaply

Question: I have seen a number of products made of brass with a silver-looking coating covering the brass on the outside. These products are all quite cheap (for example a small watering can or clothes hooks). What is the cheapest silver-looking material to coat brass with and what process would be used to perform the coating operation for mass production (500,000+ per year) of these products? I'd imagine chrome plating or electro plating would be too costly for these sorts of products so I wonder how things like these are made.
Comment: Is it possible I am thinking of electroplating as being more expensive than it actually is? I'd imagine once you've bought the machine the ongoing cost could be quite low.
Comment: This is the sort of thing that is often outsourced. Even though you are paying another company, the results can be cheaper since they are experts and are amortizing the cost of the equipment over many customers.
Comment: could be zinc or [electroless nickel](https://en.m.wikipedia.org/wiki/Electroless_nickel-phosphorus_plating)... tin mentioned below would be a cheap choice for electrical parts
Answer: a silver coating on brass is usually nickel electroplate. does your part have to be brass? if it can be made of plastic instead, a shiny coating of metal can be quickly and cheaply applied to it in mass production by either sputtering or metal evaporation.
Comment: yes, but please note if you are in the USA or EU, plating processes are strictly regulated because of the toxicity of the waste that plating factories produce in quantity. this makes plating expensive and plating shops hard to find. in practical terms, the world is moving away from what is called "plated brightwork" and towards bright-polished stainless steel or anodized aluminum. What is your application?
Comment: Thank you for your response. The parts I'm looking at specifically are brass. Is electroplating the most economical production method in that case?
Answer: Tin electro plate would be easy to do ,so likely cheaper than nickel despite the high price of tin. .
Or, avoid plating and use German Silver; brass with about 10 to 20 % Nickle that gives it silver color.

Coating brass components cheaply


Painting walls after taking down wallpaper

Question: What do I need to do to be able to paint walls that at one time had wallpaper on them. I want to take wallpaper down and then paint. Help
Comment: I don't think this is actually a duplicate question but the process for getting back to back to drywall and then prepping the surface for paint are well covered in some of the other q&a's. Search the stack for "Wallpaper removal for painting" and you should find all you ever wanted to know and probably more:)
Answer: This really depends on how the old wallpaper was installed, what type it was, if the walls were primed before and so on.
Best case scenario (happens 10-15% of the time I have to redo walls) is that your walls were painted/primed, they didn't glob on glue, the glue has broken down due to age and you simply pull off wallpaper and paint.
Good case scenario is that after you pull off wallpaper you are left with some felt/paper or some glue residue.  Here I suggest using super hot water and vinegar and a grout sponge (rough side).  If it is really bad you can go through with fine drywall sandpaper (black mesh).
Bad case scenario is wall paper has to be thoroughly wetted and scraped off using a wall paper scraper.  Then you have to fix issues with drywall mud and sand that down, prime, and paint.
Worst case scenario is wall paper is stuck on the wall and the walls haven't been primed.  Wall paper tears off drywall top layer no matter what you do.  At that point its a test of will.  Will you tear down all the drywall (the sane/faster way but also "harder") or will you diligently scrape off every single inch, do tons of touch up which equates to skimming mud on the whole wall...


How can i keep browser from caching map services?

Question: I am using esri's js api with arcserver 10.1 map services. My issue is that sometimes another application deletes a feature from the geodatabase that is the basis for my map service. But my browser does not react quickly to the change. It seems to be caching the map service response. This is evident in ie and firefox. Even a browser refresh will still show the feature that should have been deleted already. Is there a way to force the cache to flush and get new map service data?
Answer: You should use the disableClientCaching on the Dynamic Map Services, and set it to true.
The help states:

When true, images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently.

What this does, is to add a timestamp at the end of every request, so that every request is unique, and hence the client can't cache the response.
Answer: in addition to setting disableClientCaching, you can also set a refreshInterval on the layer in order to force new requests to the service even in instances where the user hasn't panned or zoomed.
https://developers.arcgis.com/javascript/jsapi/arcgisdynamicmapservicelayer-amd.html#refreshinterval
Comment: I have something similar in my code already but i think that it is not working because ie is not even processing the request because it sees that it is identical to the request before it.


How can I use google web fonts with phantomjs

Question: I'm using phantomjs version 1.9.7 which I believe is supposed to support web fonts. I have inserted the font with google web fonts however it is just displaying my fallback font when I automate a screengrab. The webfont is displaying fine in all my browsers. Are there any workarounds for this?
Comment: Am adding this to my css: @import url(http://fonts.googleapis.com/css?family=Open+Sans);
Comment: I just tried [Bootstrap Fonts](http://getbootstrap.com/components/) with phantomjs version 1.9.7 on Windows and the capture worked. Maybe you can try to include it the same way, because there are multiple fallbacks.
Answer: I have struggled with this issue for several hours. Well, there is a simple reason for this controversy: user-agent!
Some services such as Google Fonts are returning different CSS content based on user-agent. When you call a webpage which includes Google Fonts with default PhantomJs user-agent, Google would return TTF version which is supported in PhantomJs.
However, if you set a custom user agent (Chrome, FF, etc.), Google Fonts would return .woff2 version. .woff2 is not supported in PhantomJs 2.x. Obviously, fonts are not going to be loaded.
So, for users who are testing PhantomJs without setting a generic user-agent, Google Fonts is working. If they set for example Google Chrome user-agent, it does not work.
So, you have two options:

Avoid setting a custom user-agent if it is possible.
Avoid using dumb-smart font providers like Google Fonts which does not outputting all font versions in CSS and let the browser decide what it needs.
Comment: I was able to verify this even in PhantomJS 2.1.1. The default UA of `Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/2.1.1 (development) Safari/534.34` (with 'Chrome' absent) seems to work as you described above. Nice catch.
Comment: As for now (2017) situation became opposite: Google Fonts returns `.woff2` fonts for default UA `User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1`. So to fix issue none-standard User-Agent should be set, like just `PhantomJS/2.1.1` for example.
Comment: @shytikov This is exactly what is mentioned in the answer. So nothing is changed.
Answer: I believe your belief is wrong :-)
The 1.9.x series of Phantom is still based on the old WebKit code, which people have been reporting web font problems with all along.
The good news is that a technical preview of Phantom 2.0 is apparently about to be released; https://github.com/ariya/phantomjs/wiki/PhantomJS-2 is intended to be the best place to follow status. And, from memory, someone reported success with web fonts using it (but I may be wrong on that as a quick search of the mailing list archives didn't turn up a definitive message saying web fonts work... but they definitely should).
BTW, SlimerJS is an almost drop-in replacement, based on Firefox's Gecko engine, and does support web fonts (though some problems in corner cases, IIRC).
Comment: "I believe..." an example or even a link to something leading you to believe this would be helpful. There is a closed issue here: https://github.com/ariya/phantomjs/issues/10592. It continues to be a troubling problem, however. An example of it working would be the most helpful.
Comment: @st.derrick Web fonts not being supported in the Phantom 1.x series is something I had seen mentioned on the phantom mailing list. (The corner case problems with web fonts in SlimerJS were mentioned on the slimer mailing list.)
Comment: @st.derrick Just read through that bug issue. Sounds about how I remembered it - a big mess!  Some people still saying it is not working reliably even with PhantomJS 2.0 - it sounds like there may be some complicated dependencies on Ubuntu packages?
Answer: I just had the same issue with PhantomJS 2.1.1.
In my case I was working under a proxy that was blocking PhantomJS from loading the font from Google. After connecting to an open network it rendered correctly.
Answer: I tried all fixes listed here to no avail, but here is a work around. Either option resolved this for me.
First Option:
Install the missing web fonts on the local computer that is running PhantomJS. Most web font providers including Google allow you to easily download the fonts for local install. No change needed at the target URL.
Second:
I sites I have control over, I was able to resolve by splitting up the link tags.
Change This from:
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700|Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>

To:
<link href='//fonts.googleapis.com/css?family=Roboto:400,500,700' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' rel='stylesheet' type='text/css'>

I know this is not an ideal solution but either one works, It depends on if you can modify the target URL.


Subversion (SVN) repository server on Mac OSX Snow Leopard, no longer working with Mountain Lion upgrade

Question: I need some major help.  In snow leopard, Subversion was pre-installed.  I had setup a subversion repository and have several coding projects backed up in the repository.  After upgrading to Mountain Lion, i noticed that A.) Subversion was no longer installed and B.) After installing subversion using Xcode, developer tools, command line tools.. It will not work.  My question is what process do i follow to take my pre-existing SVN repository and migrate it to wherever Xcode/Mountain Lion places the subversion repository??  Thanks
Answer: Turns out that in upgrading my system, the IP of my machine had changed.  Since i was connecting to the SVN repository using the IP, this no longer worked.  I set the IP correctly and the SVN repository started to work again.


Pullback of sheaf of roots of unity.

Question: Given a closed immersion of integral (and maybe normal) schemes $i^*:Z\hookrightarrow X$. Is it true that $i^*\mu_n$ is isomorphic to $\mu_n|_{Z}$? Here by pullback we consider the sheaf of $n$-th root of unity as a sheaf on the small etale site. By the restriction to $Z$, I mean the sheaf of $n$-th root of unity naturally defined on $Z$.
Comment: Thanks for your comment. Is the reason for this being true because $\mu_n$ is locally constant? It becomes constant on some etale cover.
Comment: So by that logic it is true for $\mathbb{G}_m$ too. But let's assume $Z$ is a closed point corresponding to some maximal ideal. I think $i^*\mathbb{G}_m$ is the stalk of $\mathbb{G}_m$, which is given by $\mathbb{G}_m$ of the etale local ring (strict henselization of the loacl ring at the maximal ideal.). This seems to be different than $\mathbb{G}_m$ on a point ($\text{Spec}(k)$ for a field $k$, which is the residue field of the maximal ideal.) they have different global sections, as the local ring has more invertible elements.
Comment: Yes you are right and I was too quick. This is definitively true if $n$ is invertible on the base scheme. I will give a thought if $n$ is not invertible. I'll remove my comments.
Answer: This isn't true in general. Let me give a counterexample first, and then discuss two cases in which it works.
Counterexample. Consider $X=\operatorname{Spec} \mathbb Z_p[\zeta_p]$, where $\zeta_p$ is a $p$-th root of unity, and let $Z=\operatorname{Spec}\mathbb F_p$, with $i\colon Z\hookrightarrow X$ being the inclusion of the special point. All étale $\mathbb F_p$-algebras are finite products $\prod_i\mathbb F_{p^i}$, hence they don't contain any non-trivial $p$-th root of unity. Thus, the stalk of $\mu_{n,Z}$ at any geometric point $\overline{z}$ of $Z$ is $\{1\}$. However, any étale $\mathbb Z_p[\zeta_p]$-algebra $B$ contains the element $\zeta_p$, and $\zeta_p-1$ is a nonzerodivisor by flatness. Hence also the stalk of $\mu_{n,X}$ at $i(\overline{z})$ contains the non-trivial root of unity $\zeta_p$. Since $(i^*\mu_{n,X})_{\overline{z}}=(\mu_{n,X})_{i(\overline{z})}$ (pullback of étale sheaves preserves stalks), this shows that $i^*\mu_{n,X}$ cannot coincide with $\mu_{n,Z}$.
And now for the two cases in which it works. Neither case needs that $i$ is a closed immersion.
Case 1. Assume $n$ is invertible on $X$ and thus on $Z$ too (I believe you already discussed that case in the now deleted comments, but let me spell it out for completeness). Then the canonical map $i^*\mu_{n,X}\rightarrow  \mu_{n,Z}$ is always an isomorphism, even for $i$ not a closed immersion and $X$, $Z$ not reduced.
This can be seen as follows: $\mu_{n,X}$ is always represented by the scheme $Y=\operatorname{\underline{Spec}}\mathcal O_X[T]/(T^n-1)$, and similarly $\mu_{n,Z}$ is represented by the base change $i^*Y$. If $n$ is invertible, then $Y$ is étale over $X$ and (thus) $i^*Y$ is étale over $Z$. In this case it is completely formal to show that the induced map $i^*h_Y\rightarrow h_{i^*Y}$ on representable sheaves is an isomorphism. Indeed, by Yoneda's lemma, it suffices to check that $$\operatorname{Hom}_{\mathrm{Sh}(Z_{\mathrm{\acute{e}t}})}(h_{i^*Y},\mathcal F)\rightarrow \operatorname{Hom}_{\mathrm{Sh}(Z_{\mathrm{\acute{e}t}})}(i^*h_Y,\mathcal F)$$is an isomorphism for all sheaves $\mathcal F\in \mathrm{Sh}(Z_{\mathrm{\acute{e}t}})$. This follows from the calculation $$ \operatorname{Hom}_{\mathrm{Sh}(Z_{\mathrm{\acute{e}t}})}(h_{i^*Y},\mathcal F)\cong\Gamma(i^*Y,\mathcal F)\cong\Gamma(Y,i_*\mathcal F)\cong\operatorname{Hom}_{\mathrm{Sh}(X_{\mathrm{\acute{e}t}})}(h_{Y},i_*\mathcal F)\cong \operatorname{Hom}_{\mathrm{Sh}(Z_{\mathrm{\acute{e}t}})}(i^*h_{Y},\mathcal F)\,.$$ The first and third isomorphism follow from Yoneda's lemma, the second holds by definition of $i_*\mathcal F$, and the fourth by the $(i^*,i_*)$-adjunction. In the first and the third isomorphism, we critically used that $i^*Y$ and $Y$ are étale over $Z$ and $X$, respectively. This explains why $i^*\mathbb G_{m,X}\rightarrow \mathbb G_{m,Z}$ may fail to be an isomorphism, as you note in the comments: $\mathbb G_{m,X}$ is representable by an $X$-scheme, but not by an étale one.
Case 2. $X$ and (thus) $Z$ have characteristic $p$. We'll only need that $X$ and $Z$ are reduced and $i$ can be any map. Moreover, the question is local, so we may assume $X=\operatorname{Spec} A$ and $Z$ are affine. Finally, $\mu_{n,X}$ is the direct sum of its subsheaves $\mu_{\ell^{m}}$, where $\ell$ is a prime divisor of $n$ and $\ell^m$ is the highest power of $\ell$ dividing $n$. For $\ell\neq p$, case 1 does it, hence we may assume $n=p^m$.
Note that every $\mathbb F_p$-algebra $B$ with a non-trivial $p^m$-th root of unity $\zeta$ is necessarily non-reduced, as $0=\zeta^{p^m}-1=(\zeta-1)^{p^m}$. But every étale algebra over the reduced ring $A$ is reduced again. For $A$ noetherian, this follows from the fact that a noetherian ring is reduced iff it satisfies Serre's conditions $(R_0)$ and $(S_1)$ (the little brother of Serre's normality criterion) and that the conditions $(R_k)$ and $(S_k)$ ascend along étale maps. In general, we can write any étale map $A\rightarrow B$ as a filtered colimit $\operatorname{colimit} (A_\alpha\rightarrow B_\alpha)$ of étale maps between finite type $\mathbb Z$-algebras. Replacing all $A_\alpha$ by their reductions, the above argument shows that $B$ can be written as a filtered colimit of reduced rings $B_\alpha$, whence $B$ is reduced itself.
Therefore, the étale sheaves $\mu_{p^m,X}$ and $\mu_{p^m,Z}$ vanish if $X$ and $Z$ are reduced of characteristic $p$, so $i^*\mu_{p^m,X}\rightarrow \mu_{p^m,Z}$ is trivially an isomorphism.

Pullback of sheaf of roots of unity.


How do you describe the sound of an old computer?

Question: The kind in the 90s with a giant CRT monitors and noisy hard disks & fans. I think "buzz" and "hum" are not loud enough because nowadays laptops still hum when overheated. But I don't know a stronger word. Thanks for any help!
Comment: My new mini-tower computer with its hot CPU and three cooling fans is far noisier than those old-school computers from the 1990s, when the bearings on the fans begin to fail. But there is far less vibration from the modern solid state hard drive! :-) The 6-inch floppy drives made a clicking and clunking sound.
Answer: You might consider whir, which Collins defines as:

whir (or whirr) (n.) a prolonged soft swish or buzz, as of a motor working

Another possibility is drone. The word drone has many meanings, but it can be used as a noun or a verb to describe the noises you mention. From Wordnik:

drone (n.) a continuous low humming or buzzing sound
drone (v.) to produce a low-pitched hum or buzz

As a side note, I'm not sure I agree that buzz is "not loud enough," because buzzing covers a wide spectrum of noises, some of them rather loud:

Though we spotted tracks, we saw very little wildlife; the buzz of the machine tended to scare animals away.
Source: Snowmobiling Mont Tremblant, Quebec, by Ben Abramson, special to The Washington Post, Sunday, January 28, 2001
Answer: As mentioned, the words: whirr, drone, buzz, hum describe the nature of the sound - but don't say much about its volume. You could opt for a word that is less descriptive but implies loudness like "clatter", or you could use hyperbole (which is a tendency of many US native speakers) as in: "That old computer sounds like a helicopter."


(Debian) How to fix whatever nVidia's driver did to usb 2.0

Question: OS: Debian Stretch
Motherboard: Foxconn G33M02
I installed the package nvidia-driver using the instructions at
https://wiki.debian.org/NvidiaGraphicsDrivers
and on reboot, got a looping "over current" error from all usb 2.0 ports that had anything in them (the keyboard and mouse are usb on this mobo). I followed the page's instructions for "Backing out in case of failure", reverting to the Nouveau driver, but the "over current" error remains. After booting the kernel, a second looping error joins the fray: "unable to enumerate". How to get the usb ports functional again now?
Comment: edit the question and add your results like " Edit 1 : The it fixed itself after 30 reboots, explaination ? ", let the community analyse the problem. That might further help us to fix the Deb. Wiki.
Answer: Fixed itself after about 30 reboots.


How does a pricing model 'understand' the cost of hedging?

Question: Suppose I am pricing a multi asset at the expiry payoff. Theoretically I define their joint distributions in the risk neutral measure, and price using expectation. However, how do I know that the model has accounted for cost of vega hedging? Cost of delta hedging is baked into the marginal distributions, but how to account for cost of vega hedging? How does the model 'know' this cost? I suppose this is somehow 'implied' by the 'joint distribution' part, but that begs the question, do I not need a term structure model (i.e. evolve the vol surface over time) to be accurately able to take care of that cost?
Answer: I'm not sure I understand the question, but I'll give it a try anyway.
The mean and variance specified for the terminal distribution $S_T$ are dependent on current asset price, $S_0$, and implied volatility, $\sigma_i$ (which needs to come from the market via hopefully same pricer that one uses).
The expectation of a payoff, function $f(S_T)$, is hence a function of $S_0$ and $\sigma_i$, $V(0, S_0, \sigma_i)$. All one can do at this point is compute delta and vega. No hedging so far. Only pricing.
Hedging comes in when one is interested in the terminal ${\rm PnL}_T$ of the (delta hedged) derivative product.
For this, one has to imagine a process behind $S_T$ (martingale representation theorems come to mind) say of the form
$$ dS_t/S_t = ...dt +\sigma_t dW_t, S_0$$
with $\sigma_t$ the 'true' vol along the asset path.
Assuming delta hedging is done at $\sigma_i$ over the life of the product (see this link for assumptions and details for hedging vol different from implied vol etc.), the terminal PnL is:
$${\rm PnL}_T = \int_0^T {\rm e}^{-rT}(\sigma_i^2 - \sigma_t^2) \frac{1}{2}S_t^2 \frac{\partial^2 }{\partial S^2} V(t,S_t, \sigma_i) dt $$
which bakes in the assumed variance of the the terminal asset, $\sigma_i^2$, but also the realized volatility and Gamma along the asset path. (Gamma is related to Vega; under Black-Scholes assumptions, for European option payoffs, the relationship is explicit: ${\rm Vega} = \sigma_i \tau S^2 {\rm Gamma} $.)
Edit: It is Feynman-Kac theorem (or rather its reciprocal) that says that
$$ u(x,t) = E^Q \left[{\rm e}^{r(T-t)}\psi(X_T) | X_t=x \right] $$
is the solution of the standard parabolic PDE with terminal condition
$$u(x,T)=\psi(x)  $$
which reveals the delta and gamma terms used in hedging (PDE does 'understand hedging').
Comment: Oh yes, I see it now. Thanks a lot for that statement on Feynman Kac.
Comment: Although i understand what you said, I don't believe your claim that you can price without talking about hedging, since price modeled as expectation in unique risk neutral measure depends upon the assumption of a complete market i.e. replication. It is this subtlety I'm trying to understand. Can I, from the risk neutral distribution, comment on the hedging costs or the self financing strategy that underlies it?
Comment: @Arshdeep Singh Duggal Sorry, I wasn't making any claim. I was just redirecting the discussion towards an object I thought was more relevant, the terminal PnL. Regarding your question, maybe it is Feynman-Kac theorem that you are looking for, as it establishes the link between (conditional) expectation of terminal payoff and the PDE which 'understands hedging'.
Comment: @ArshdeepSinghDuggal I'm glad it helps.
Answer: A model 'understands' the price of risks that are assumed to exist. For example, the Black-Scholes model undertands the cost of delta-hedging, but not of vega-hedging. Hence we have stochastic volatility models: these understand the cost of delta-hedging and volatility hedging. However, none of these models take into account transaction costs. Hence you could also argue that none of these models really understand the cost of hedging in practice. The fact that transaction costs are usually not part of a pricing model makes the need for (semi-) static replication of claims even greater. If possible you should always try to have a (semi-)static replication strategy. Of course you can always model transaction costs if semi-static hedging is not possible, but that entails additional computational costs.
Comment: Your point makes sense but my question is: How? Say I tell you that the market is complete, and I give you the distribution of a stock in the terminal measure. You can for sure price it, but I didn't have to speak of cost of replication at all.
Comment: Let's take the BS model and forget about transaction costs for the moment. In the derivation of the BS price formula you take into account that you construct a self-financing replicating portfolio by dynamically rebalancing stocks (delta-hedging). The BS price formula is the solution to the resulting PDE which has this delta-hedging embedded in it. I.e. the solution of the PDE understands that hedging is involved. And since the distribution can be epressed in terms of call prices (Breeden-Litzenberger), the distribution understands the cost of replication. Hope it's clearer now.
Comment: Yes I agree that the distribution somehow understands, as price is just the cost of replication. What I am trying to understand is, given a distribution in the risk neutral measure, what can I say about the replicating portfolio that underlies it? From what I know, I can only say I've assumed there exists one.
Comment: I am not sure anymore what your question is really about. But since you accepted ir7's answer, which is actually about delta-hedging p/l with a constant vol, I take it that you have your answer.
Comment: Actually he answered it in the comments; I was trying to relate the terminal distribution and the hedging costs. He pointed me towards the Feynman Kac theorem which takes us from forming a self financing strategy to a terminal distrbution.


Tailing few lines from huge logs of kubectl logs -f

Question: kubectl logs -f pod shows all logs from the beginning and it becomes a problem when the log is huge and we have to wait for a few minutes to get the last log. Its become more worst when connecting remotely. Is there a way that we can tail the logs for the last 100 lines of logs and follow them?
Answer: In a cluster best practices are to gather all logs in a single point through an aggregator and analyze them with a dedicated tool. For that reason in K8S, log command is quite basic.
Anyway kubectl logs -h shows some options useful for you:
# Display only the most recent 20 lines of output in pod nginx
kubectl logs --tail=20 nginx

# Show all logs from pod nginx written in the last hour
kubectl logs --since=1h nginx

Some tools with your requirements (and more) are available on github, some of which are:

https://github.com/boz/kail

https://github.com/stern/stern
Comment: also `--timestamps` is helpful if you need logs with timestamps
Comment: Is there a way to view the start of the logs? Like `--head=50` would show me the first 50 lines of the logs? I did run `kubectl logs -h` to see all options but couldn't find one that returns the head of logs.
Comment: New to this stuff, are there any official recommendations for how to aggregate the logs?
Comment: fluentd, logstash, look in google for other.
Answer: Try kubectl logs -f pod --tail=10
Answer: To fetch tail lines from logs of a pod with multi containers.
kubectl logs <pod name> --all-containers=true --tail=10

To fetch tail lines from logs of  pods within an application:
kubectl logs --selector app=<your application> --tail=10

(ex:if your application has 3 pods then output of above command can be 30 logs 10 of each pod logs)
Answer: You can ues this way to get the first 10 lines
kubectl logs my-pod-name  -n my-ns | head -n 10

Comment: They are looking for the last 100 lines, not the first lines
Answer: You can also follow logs from the end if you are testing something:
kubectl logs my-pod-name --follow

This will work just like running tail -f in bash or other shells.
Comment: This doesn't answer the OPs question and results in the same problem for large logs. You should consider removing this answer, else it will get down voted


Do stop orders work in overnight trading

Question: I directed my broker to place a 5% stop order on a stock in my portfolio selling in excess of $100/share. Some weeks later while still holding the stock the price dropped 30% in overnight trading. The 5% stop order did not execute. Can you explain why. Thank you.
Answer: Stop orders and complex orders like  all-or-none order  do not execute in extended sessions though you can place limit orders, assuming that you have account approval to trade during the extended sessions.
In your situation, the order would not execute until the next trading day, assuming that shares opened below your 5% stop price.


What is the purpose of multiple regression?

Question: For instance, consider the following regression equation
$College Score=\beta_0+\beta_1HighSchool GPA+u$. We interpret this $\beta_1$as the effect of a higher High School GPA holding all other variables constant.
The second regression model adds a new term  and becomes $College Score=\beta_0+\beta_1HighSchool GPA+\beta_2ACTSCORE+u$. The interpretation of $\beta_1$ is still the effect of a higher High School GPA holding all other variables constant. So what is the difference?(and the values in two regressions are different). The textbook explanation is that, in the first equation, ACT score is assumed to be fixed. In the second equation, however, ACT score is explicitly controlled. I don't quite understand the real difference between 'assumed fixed' and 'explicitly held fixed'.
Comment: This is a deep question. I now think $E(y|x_1)=\beta_0+\beta_1 x_1$ and $E(y|x_1,x_2) = \beta_0 + \beta_1 x_1 + \beta_2 x_2$ are a lot easier to swallow. To me, interpreting $\beta_1$ of the first model as "holding other variables constant ..." is not very meaningful because it's impossible to hold $u$ fixed. In fact, we don't even know what $u$ is in some (many) cases.
Answer: The difference is that the first regression is unbiased only if you can assume that high school GPA and ACT score are orthogonal on each other $cov(x,z)=0$ where $x$ is shortcut for high school GPA and $z$ for ACT score. Or if you can assume the second variable ATC score does not affect the dependent variable at all $\beta_2=0$. This is because in simple regression the $\beta$ coefficient bias is given by:
$$\hat{\beta_1} = \beta_1 + \beta_2 \frac{\text{COV}(x,z) }{VAR(x)} $$
where $\hat{\beta_1} $ is the estimated beta effect of GPA on col. score (beta reported by your statistical program like R), $\beta_1$ is the true unobserved coefficient, $\beta_2$ is the true unobserved effect of ACT on score, and the fraction is just covariance between $x$ and $z$ over variance of $x$.
So unless you know that the two variables are completely unrelated you will have bias. Now an example of variable that is completely unrelated to another is variable thats hold fixed. For example if in $z(x) =100$ no matter which $x$ we examine then we can be confident that $cov(x,z)=0$. Regressions should be applied only if you think they are unbiased so the first equation implicitly assumes that the second variable is hold constant given $x$. However, once you include the second covariate explicitly you can calculate both expected beta coefficients conditional on each other which is equivalent to actually keeping the other variable constant.
So there is actually a great deal of difference between the two regressions (except for special cases where $cov(x,z)=0$ or $\beta_2=0$).
Comment: thank u! that really answers my question.
Comment: @ChenliZhou I am glad that I could help. If you are satisfied with the answer please don't forget to accept it


Decentralized synchronized secure data storage

Question: Introduction
Hi, I am going to ask a question which seems utopic for me, but I need to know if there is a way to achieve what I need. And if not, I need to know why not.
The idea
Suppose I have a database structure, in MySql.
I want to create some solution to allow anyone (no matter who, no matter where) to have a synchronized copy (updated clone) of this database (with its content)
Well, and it is not going to be just one synchronized copy, it could (and should) be a multiple replication (supposing the basic, this means, for example, ten copies all over the world)
And, the most important thing: It must be secure. By secure I mean only real-accepted transactions will be synchronized with all the others (no matter how many) database copies/clones.
Note: Since it would be quite difficult to make the synchronization in real-time,  I will design everything to make this feature dispensable. So it is not required.
My auto-suggestion
This is how I am thinking to manage it:
Time identifiers and Updates checking: Every action (insert, update, delete...) will be stored as the action instruction itself, associated to the time identifier. [I think better than a DATETIME field, it'll be an INT one, with the number of miliseconds passed from 1st january 2013 on, for example]. So each copy is going to ask to the "neighbour copy" for new actions done since last update, and execute them after checking they are allowed.
Problem 1: the "neighbour copy" could be outdated too.
Solution 1: do not ask just one neighbour, create a random list with some of the copies/clones and ask them for news (I could avoid the list and ask ALL the clones for updates, but this will be inefficient if clones number ascends too much).
Problem 2: Real-time global synchronization is not active. What if...
<code>   Someone at CLONE_ENTERPRISING inserts a row into TABLE.
   ... this row goes to every clone ...
   Someone at CLONE_FIXEMALL deletes this row.
   ... and at the same time, somewhere in an outdated clone ...
   Someone at CLONE_DROPOUT edits this row (now inexistent at the other clones)
</code>
Solution 2: easy stuff, force a GLOBAL synchronization before doing any new "depending-on-third-data action"  (edit, for example). This global synch. will be unnecessary when making an INSERT, for instance.
Note: Well, someone could have some fun, and make the same insert in two clones... since they're not getting updated in real-time, this row will exist twice. But, it's the same as when we have one single database, in some needed cases we check if there is an existing same-row before doing the final action. Not a problem.
Problem 3: It is possible to edit the code and do not filter actions, so someone could spread instructions to delete everything, or just make some trolling activity. This is not a problem, since good clones will always be somewhere. Those who got bad won't interest anymore.
I really appreciate if you read. I know this is not the perfect solution, it has possibly hundred of holes, but it is my basic start. I will now appreciate anything you can teach me now. Thanks a lot.
PS.: It could be that all this I am trying already exists and has its own name. Sorry for asking then (I'd anyway thank this name, if it exists)
Answer: I would suggest a look at Sync Framework from Microsoft. It might be better suited to SQL Server but it should work with MySQL too. The problem you are tackling is quite a complex one.


802.11n wlan card 5ghz router compatability

Question: I have a question about 802.11n wlan cards in general: if they support 802.11n radio types, shouldn't they be able to connect to 802.11n 5ghz bands transmitted by routers?  I read into this online, and I learned that the 802.11a radio type must be supported by the 802.11n wlan card as well to be able to use 5ghz, but I also got conflicting/confusing information stating that if the wlan card supports 802.11n, then it can work on 2.4ghz or 5ghz bands.
Comment: Welcome to serverfault!  From our FAQ: Server Fault is for Information Technology Professionals needing expert answers related to managing computer systems in a professional capacity.  As your question doesn't appear to meet that criterion but is otherwise alright, it will probably be migrated to superuser.
Answer: 802.11n is a break with the prior 3 major standards, in that it can function on both 2.4GHz and 5GHz.  Compliant devices may support either (they tend to support either 2.4GHz only, or 5GHz as well as 2.4GHz).  It happens that 802.11a uses 5GHz, and in consequence many device manufacturers add 802.11a support despite that almost no 802.11a APs can be found anywhere.  Support for 802.11a is a very strong indication that the device will support 802.11n on 5GHz, but there are lots of devices out there supporting 802.11n on 2.4GHz only, and probably quite a few that support it on 5GHz as well but don't advertise 802.11a support.
Comment: Exactly.  I don't think I've ever seen one that only supports 5GHz though.
Comment: oh, so you're saying that an 802.11n wlan card may support 2.4GHz or 5Ghz, but not necessarily both?
Comment: There is some 5Ghz-only kit, but it's things like backhaul radios for mesh networks and client radios.


How much ballast is required in 110 mph winds to stabilize: a 60 lb., 20' pole; 3' below ground/17' above ground, with a 24lb. wind turbine atop it?

Question: I can't seem to find an answer that doesn't involve more than a ton and a half of concrete. The manual for the wind turbine reports that the load on the turbine in a 110 mph wind is only 155 lbs. When I add the weight of the pole above ground that's just over 200 lbs. Shouldn't 3x or 4x that amount of weight in ballast be sufficient? The county won't let me set up my alternative power system until I get a solid answer to this question.
Comment: Basically, you need to imagine it's just sitting on your lawn with the pole in a disc of concrete. Design a disc of concrete that wont blow over. Don't forget the wind loading on the pole.  When you get the size and weight, add in about 8-10% steel reinforcing by weight. All needs to be below frost line. Steel poles conduct the cold down to the concrete really well. The coefficients of thermal expansion for steel and concrete are nearly identical, but they have to be the same temp. So figure on a cast-in baseplate and insulated flange connection below grade. These are available off the shelf.
Comment: For a larger machine we had 90 tons of concrete buried in a top hat shape - from the side a larger disc and a smaller disc on top to reduce the amount showing out of the ground.
Answer: Using very conservative assumptions, it makes sense that you'll need massive ballast weights to stabilize your pole. This is because the ballast is extremely inefficient for this task. I won't go into the math itself, but here's a conceptual demonstration of what's going on.

Imagine your pole is a vertical lever, with the fulcrum at the soil level. At the top of the pole is a horizontal force, and at the bottom is a vertical force. When the pole is precisely vertical, the vertical force at the bottom won't do anything, but the horizontal force at the top will want to topple the pole, so it will rotate.
Once the structure has rotated a bit, the vertical force will start to work against the pole's rotation, restraining it. However, it is very inefficient in doing so. Without going into the math, the following equilibrium must be reached:
$$F_{ballast}\ell_{underground}\theta = F_{wind}\ell_{aboveground}$$
where $\theta$ is the pole's rotation in radians at stability. Therefore, the weight of the ballast must be equal to
$$F_{ballast} = \dfrac{F_{wind}\ell_{aboveground}}{\ell_{underground}\theta}$$
This shows us that the greater the aboveground/underground ratio, the heavier the ballast. Also, the less the structure is allowed to rotate to achieve stability, the heavier the ballast as well. Since structures aren't allowed to deflect far, $\theta$ can be assumed very small, so the ballast must be very, very large. Tons seems absurd, but is actually reasonable.
This, however, uses the very conservative assumption of ignoring any work done by the ground to restrain the pole's motion. Assume for a moment that your pole is embedded in solid diamond (or titanium, or whatever). Will any ballast be required? Of course not. The wind will try to rotate your pole, but that'll make the underground section push against the diamond, which will push right back and impede any such rotation.
The same applies to any type of soil. When something pushes it (like the pole trying to push the soil out of its way so it can rotate), the soil develops what's known as "passive pressure" and pushes back. The soil will do this until the pressure crosses its ultimate strength, at which point it collapses and loses any resistive capacity. Using the diagram from before, this becomes equivalent to:

This distributed force is far more efficient and can dramatically reduce the necessary ballast. However, it is a function of the type of soil. If your pole is embedded into solid rock, you probably won't need any ballast. If your pole is embedded into a marsh, this force will probably be insignificant and you'll need your massive ballast.
To determine how much the soil can help you, you'll need to hire a qualified geotechnical engineer, who'll need to extract samples from the exact spot (and surrounding area) where you intend to plant your pole. This will need to be combined with a reasonable structural model, according to applicable codes, to determine the appropriate size of the ballast. All of this should be done by qualified engineers and this should not be considered a DIY project.
Obviously, another possibility would be to adopt a different structural model, such as support cables around your pole, which could be significantly more effective than simple ballast. To judge the feasibility of this, however, we'd need a lot more information regarding your "alternative power system", and it would probably be out-of-scope for this question anyway.
Answer: Sounds about right for an unstayed structure. You can reduce the ballast somewhat if you stay your mast (probably 2/3 the way up, design to keep the blades well clear of the stays under worst case sag/vibration/bending. But now you need three or four ballast masses to hold the stays into the ground.

How much ballast is required in 110 mph winds to stabilize: a 60 lb., 20’ pole; 3' below ground/17’ above ground, with a 24lb. wind turbine atop it?


$G$ is a finite abelian group. For every prime $p$ that divides $|G|$, there is a unique subgroup of order $p$.

Question: $G$ is a finite abelian group. Assume that for every prime $p$ that divides $|G|$, there is a unique subgroup of order $p$. I'd like to prove that $G$ is cyclic. I'm thinking about the approach of induction but not able to develop a complete proof yet.
Comment: Use the abelian group structure theorem to reduce the problem to the case where $|G|$ is a prime power.
Comment: Use the Sylow theorems to find a nice way to write down $G$, then use a well-known corollary of the Chinese remainder theorem to show that $G$ is cyclic.
Comment: You can find the solution in Rotman , Introduction in the theory of groups pg 80 .It's a corollary to Sylow theorems.It is just the existence..
Comment: Is there any other way besides using Sylow theorems? Since we haven't learn it yet there should be a more elementary way to prove it.
Answer: Set $G = \{g_{1}, g_{2}, ..., g_{n}\}$, with $|g_{i}| =d_{i}$.
Consider the group $H = \prod_{i=1}^{n}\mathbb{Z}\backslash d_{i}\mathbb{Z}$.
Since $G$ is abelian, the map $f: H \rightarrow G: f(g_{1}, g_{2}, ..., g_{n}) = \prod_{i=1}^{n}g_{i}^{k_{i}}$ is a well-defined surjective group homomorphism so that by one of the isomorphism theorems, $\prod_{i}^{n}d_{i} = |H| = |\ker f| |G| \implies p|d_{j}$ for some $j$. The element $g = g_{i}^{\frac{d_{j}}{p}}$ has order $p$ just as it was promised.
Comment: I don't understand the way you define $H$. Could you give more explanation to it?
Comment: It is just a finite product of abelian groups which is a group.
Comment: Could you give more explanation for each step? It seems right but kind of elusive for me...


Algorithm to identify degree of similarity based on prior categorization

Question: I am working with digital images that people have manually categorized on a number of parameters.
I want to be able to find images that are similar or dissimilar based on certain categories. For instance, we might want to pick two random images from our database that have similar "significance", but are otherwise as different as possible.
As an example, this picture of Stonehenge would be categorized like this:

<code>colors: blue, green, grey
themes: natural, land, sky
brightness: light
location: outdoor
shapes: angular
texture: hard
lines: vertical
significance: historical
</code>
The categories are mostly fixed and small, so when manually categorized the person is choosing the main colors from a list of ten colors (red, orange, yellow, green, blue, purplse, white, black, grey, brown), and the same is true of the other categories. Most of the categories only have a small number of options, such as location is indoor, outdoor, or unknown, and brightness is light, dark, or neutral.
My naive approach is something like this:

Query the database for pictures with historical significance
Pick a random starting image from the historically significant images
Of the remaining historical images, do a random sampling of N images. Different values of N will give us more variety at the expense of accuracy.
For each randomly selected image, create an ordered binary vector for all possible category values (ex. red=0, blue=1, outdoor=1, etc), producing some binary value.
Compare the binary values for the starting image and the random image, for example by using a bitwise XOR operation (or equivalent set operation), then count the number of 1's in the result.

I am not necessarily interested in finding the most dissimilar images. Any two images that are mostly dissimilar will be fine, and in fact we typically do want some randomness so the same images pairs are not frequently selected.
This naive approach works okay. Are there any proper algorithms or techniques I should look at that might apply to this problem?
Comment: It's been a long time since school - is [Pattern Recognition](https://en.wikipedia.org/wiki/Pattern_recognition) relevant here?
Answer: Sirisian's answer started along the right path, but then he lost me, so here is my take on the issue.
The fact that you are dealing with images is irrelevant, and the fact that one of the properties must be identical is also irrelevant.  They are both red herrings.  All I see here is entities with properties, and the problem can easily be redefined to exclude the property which must be identical, and to only consider the subset of entities that do in fact have the same value on that excluded property.
So, basically, what you have is a set of entities where each entity has a list of N properties, and you have a separate entity which we will call the "reference" entity, and you want to search through that set to find entities that have as dissimilar as possible values from the reference entity.
Essentially, you want a maximum distance in N-dimensional space algorithm.
First of all you need to compute the N-dimensional vector of the values of your reference entity.  This is essentially the coordinates of a point in N-dimensional space. (If you want, you can imagine that N = 3, so you can be thinking of the problem in 3-dimensional space.)
Then, you need to loop through the rest of your entities, and for each entity you need to calculate its N-dimensional vector, (imagine another point in 3-dimensional space,) then you need to calculate the distance between the reference vector and this vector, which is going to be another N-vector, and then you need to take the absolute value, a.k.a. magnitude of that vector, which will be a single value, and store it.
Once all the magnitudes have been collected, you need to sort all your entities by this magnitude value, and your desired results will be gathered near the end of the list, where the largest magnitudes will be.
This is the standard way of solving the bulk of your problem, and I would strongly advise solving it precisely like that, so as to be implementing an algorithm which will be understandable by others, and also by yourself, should you revisit it a few months later.
Now, your particular situation has certain peculiarities:

The values of your properties are not nice real numbers, they are sets of discrete values. So, you will need to map them to real numbers.  A range from 0 to 1 will work just fine, as Sirisian suggested. You can probably combine your discrete color and your discrete brightness together into three property values, whether they be HSV, HSL, or perhaps even RGB, I don't think it will matter much.
You want a variable number of results, and you want some randomness.  So, select a percentage of entities at the end of the sorted list, and choose a specific number from them, at random.
Answer: Everything you said sounds close, but it's missing some details on vector creation and querying that are important. Ideally you need to form unique vectors for each image. You'll need to convert the color into HSV (or HSL) or a color space that lends itself to comparisons. Assign a number to each choice for the components.
Next assign a weight to each component in your vector. This should normalize the importance of each component. If you can imagine your vector in n-dimensional space you want each component to have equal weight (or be biased by its importance in the comparison). As an example lines might not be important so in the range [0, 1] horizontal = 0.2 and vertical = 0.4. Outdoor might be an important distinction so indoor = 0.5 and outdoor = 1.0. (You don't have to stay between 0 and 1, but it does keep it simple).
For colors you have to handle them specially. For color assign each component a number between [0, 1] (for each HSV component).
My only worry with your setup is your categorization is very simple and your color and theme system is a bit complex having multiple colors and themes. When generating a vector you'd essentially want to union the results with the vector and each color and theme. So for a single image with you'd generate every combination of vector (filtering for components you're searching for). Example:
(blue, natural,light, ...)
(blue, land, light, ...)
(blue, sky, light, ...)
(green, natural, light, ...)
(green, land, light, ...)
(green, sky, light, ...)
(grey, natural, light, ...)
(grey, land, light, ...)
(grey, sky, light, ...)
You'd convert each component to their numeric weighted values, so you'd have a real vector in n-dimensional space. (blue would be converted to 3 HSV components just to be very clear).
When you have vectors based on the parameters you want to compare you'd normally use a k-d tree nearest neighbor look-up.
https://en.wikipedia.org/wiki/K-d_tree#Nearest_neighbour_search
Then perform for each vector an n neighbor look-up to get a set of vectors associated with an image. Then union the resulting sets. If you find nothing increase n in your sampling. You can use a dot product calculation averaged for all vector comparisons to kind of get a similarity factor if you're looking for a percentage of similarity. (Might need to be clever in that regard if you compare a lot of components since it'll make the images appear more dissimilar than they might seem to the eye).
This is a very rough overview of k-d tree data mining. You'd need to read a data mining book to get the more exact answer and other approaches. (Creating the weights though is a bit of an art since it's up to you if color is more important than theme or shape).


c++ push_back, non const copy constructor

Question: I have a class that i want to push_back into a deque. The problem is when i push back i need the original object to be changed thus i need a non const copy ctor. Now if i implement that my const copy ctor gets called. If i removed the const ctor i get an compile error about no available ctors. How do i implement this in a way that i can modify  the original struct when i pass it in? i need to modify it bc the class destructs objects when it goes out of scope and i would like to tell it not to do so when there is another instance around. I cant use boost since my platform doesnt support it.
Answer: Your problem is that a fundamental requirement of standard containers is that objects are copy-constructible. That not only means that they have a copy constructor, but that also means that if you copy the object, the copy and the original are the same.
Your object, however, resembles a move-constructor semantic. That is, after a move, the new object owns the resource, and the old object is empty. That's not supported by deque as of C++03. That is, by the way, the same reason that forbids putting auto_ptr into a container.
The next C++ version, called c++0x will support those move semantics by introducing special move constructors. Until then, you will have to use an object that shares ownership when you want to put it into a standard container. That means if you copy your object, and the original goes out of scope, the owned resource is not freed until all the copies go out of scope. Consider using boost::shared_ptr for example, or wrap it into your class, if you don't want to program your own class managing that.
Comment: greg, i meant c++1x (won't be released before 2010). but i accept your edit, because some ppl call it c++0x, even tho a small group of ppl (tho, a growing one) call it c++1x :)
Comment: In other circles, the thought is that the standard will be C++0b or C++0c! :)
Answer: If you're not doing anything dodgy with resources (see other comments) then making the member variable that you want to change mutable will allow you to alter it in a const function.
Answer: Depending on what you are trying to do (more details would be nice), you can either modify the object before/after you call push_back or write a simple wrapper class that takes a pointer to your class and can be inserted into a deque. This object can then do the appropriate thing to your class on construction/destruction/etc.
Comment: Thats not true, auto_ptr uses a non-const copy ctor to implement (poorly) movable semantics.
Comment: You are indeed correct. I blame a quick Google + lack of compiler/standard when I answered it. Curse you false information on the internet!
Answer: You can't do what you're trying to do.  You'll have to use pointers, either plain or smart (but not auto_ptr<>).  Why can't you use Boost smart pointers?  They're pretty lightweight, and should work in all reasonably standard C++ compilers.  You don't have to use all of Boost.


Extracting values from a sigmoidal dose curve

Question: I need to extract the real lethal doses from a sigmoidal dose curve from a probit model. The doses (mg) are the X-Axis and were log transformed. Model parameters were not reported, only that the true values of the two X's (bottom right) are 7.14 mg and 12.2mg, which on the graph have X-axis values of 0.390 and 0.717, respectively. From this information, is there a way to transform the X-axis into the real (mg) values?
Comment: Your tag suggests it's a logistic model. Is it definitely a logit model, or something else?  What are the y-values -- percentage of deaths?
Answer: If the information in your post was all correct, yes, you could work out what the dosages were for any x-value:
If those x-values are truly on a log scale then their difference will be proportional to the log of the ratio of the dosages; this would allow us to work out the base of the logs:
<code>> log(c(12.2/7.14))
[1] 0.5357232
> 0.717-0.390
[1] 0.327
> exp(0.5357/0.327)
[1] 5.146034
</code>
I highly doubt that the logs were in that base, so I strongly doubt the axis shows log-dosages (note that a change of units would not change the log of the ratio, so it's not simply a log scale as your post suggests)
Perhaps some additional transformation has been applied to the x-axis.


Should I output warnings to STDERR or STDOUT?

Question: I'm making a script that handles a predefined set of data, outputting to a file. I want to pop up a warning when one datum (which is always "Regular" in every set that I've had access to) is different stating that this value is unhandled (since I don't know how it affects the data). Should I output this warning to stderr or stdout?
Answer: If I save the output of this script (i.e. stdout only) so that I could process it later, would that warning interfere with how the output is parsed?  Moreover, if output is piped to another process, the warning should show up on the terminal, so the user sees it immediately.
For those reasons, in general, you output warnings to stderr.
Answer: The warning should go to stderr.
In addition to the points presented by others (causing parsing errors for downstream processes and hiding the error from the user at the console), there is an issue of flexibility.
If the user does not want the warning from stderr to go to a downstream process that is parsing stdout, they don't have to do anything special.
your_script | downstream_process

If the user wants the warning from stderr to go to a downstream process that will parse stdout and stderr, the user can use 2>&1 to redirect stderr into stdout.
your_script 2>&1 | downstream_process

If you output both warnings and any normal data to stdout, the user has no good way of separating the warnings from the data without parsing everything.
So sending the warnings to stderr gives your script more flexibility as well.
Answer: The real question is: if someone were to redirect the output of your script to a file, would you want the warning placed in the file, or directed to the user?
If you're expecting the user to take some action as a result of the warning, it should go to STDERR.  If some downstream script is likely to be tripped up by the warning, it should go to STDERR.
Comment: So it should go to stderr regardless?  Or did you intend one of the two references to STDERR to be STDOUT?
Comment: I meant STDERR on both.  They are two cases where you pretty much have to send it to stderr.  The only time I can think of wanting it to go to stdout is if the script's output is for human consumption (maybe you're going to email the output to someone to have a look over it), and you might want the warnings to follow the output without having to remember to redirect stderr.


If suddenly "knocked" or perturbed from its orbit, would gravity eventually return the Earth to its original orbit?

Question: If suddenly "knocked" or perturbed from its orbit, would gravity eventually return the Earth to its original orbit?
I am curious as to whether this is even possible.
It seems to me that since the orbit is based on gravity, the same gravity will pull it back to correct orbit eventually. Is this reasoning right?
Comment: I can't explain, But one-word Ans is No. Actually solar system as a whole is a complex phenomenon
Comment: Welcome to Astronomy! I've updated your title so that it better fits this site. Can you double check that it still matches the intent of your question? *Thanks!*
Comment: Do you mean literally knocked by something huge colliding with it, or just perturbed by the gravity of a large rogue body passing nearby? In the former case, anything with enough momentum to make a significant difference to Earth's velocity is likely to do significant damage. And in the latter case, I'd also expect it to do enough damage to make Earth uninhabitable (at the very least).
Comment: I think your reasoning is wholly wrong. "The same gravity…" will not pull it back, because "the same gravity" will be applied to an Earth in a different situation. It's the situation - IE, the Earth's relationship to the other bodies - that matters.

That is so much true, there isn't real any such thing as "the same gravity…"
Comment: @Toby Good point. It'd be interesting to calculate how much Earth's orbit was perturbed by the impact with Theia (assuming that theory is correct).
Comment: Isn't that pretty much what happen when the Moon arrived?
Comment: FWIW, the Earth's [gravitational binding energy](https://en.wikipedia.org/wiki/Gravitational_binding_energy) is around $2.49×10^{32}$ joules, and its mean orbital kinetic energy is around $2.65×10^{33}$ joules. Of course, the Earth is also bound chemically, not just gravitationally, but I assume the gravitational binding energy is dominant. After all, gravity is sufficient to mould rocky bodies of radius >1000 km into spheres. But I can't find hard data on the chemical binding energy of the Earth. (Maybe I should ask a question about that...).
Comment: The existence of comets with massively elliptical orbits implies that the premise is incorrect.
Answer: There's a few parts to this question so there's more than one answer.
Earth gets knocked a little bit out of its orbit all the time by gravitational influence of other planets in our solar system. Jupiter and Venus are the primary two, but all the planets have some effect.  These are called orbital perturbations and they tend to alternate, not add up.  They're the causes of Earth's Milankovich cycles and the effect isn't negligible.  These variations in Earth's orbit, which take thousands of years to move back and forth can cause the formation and recession of glaciation, sometimes called ice ages.
These orbital perturbations, in addition to being cyclical, as a rule, don't effect Earth's semi-major axis which is very consistent, and may only change slightly as the Sun loses mass.
Orbital perturbations can to lead to much greater variations of eccentricity and axial tilt.   Mars, for example, undergoes much bigger variations than Earth, but it still undergoes a cyclical back and forth that leads to general stability within a range.   All eight known planets in our solar system are thought to be relatively long term stable.
The exception to this cyclical back and forth is if there's a resonance where the effect can grow over time.   The closest example of this in our current solar system is Jupiter and Mercury, where they're not in, but they're close to resonance and it's possible that Mercury will be tossed out of its orbit in a few billion years.  It's the most unstable planet in our solar system.
This article isn't published, but I still think it's a good summary of both the stability of orbits in our solar system and the possible (but perhaps unlikely) destabilization of Mercury in a few billion years.
Planetary migration is another means for tossing a smaller planet out of its orbit.  This is thought to be fairly common, based on observations of other solar systems and some uncertainty that gas giant planets could form close to their suns.  (there may be room for debate on that), but migrating planets is thought to be fairly common, if somewhat slow. It's never been observed but it can be modeled.  It's been suggested that when our solar system was young, Jupiter moved inwards, perhaps tossing Uranus and Neptune outwards and reducing the material available that would eventually become Mars and when migrating back outwards, leading to the late heavy bombardment which brought water to Earth. This is called the grand tack hypothesis.
An inwardly migrating Jupiter could certainly toss Earth about easily into a completely different orbit, but there's no evidence that suggests Jupiter is likely to migrate that much in the future.
A massive enough object from beyond the solar system could toss Earth into a different orbit and in doing so, not only change Earth's eccentricity and orbital plane, but change Earth's semi-major axis as well and that change would effectively be permanent.
A gravity assist of that kind could give Earth both a new eccentricity, a new orbital plane and a new semi major axis and perhaps a new set of Milankovich cycles, though I suspect over time, the orbit could re-circularize and the Milankovich cycles, largely reset to where they were, so there could be some correction not by the sun, but by the other planets orbiting the sun, but not everything would go back to where it was.   The Semi-major axis change would likely be permanent and there would also be the question of whether the new orbit was in near resonance with other planets which would lead to further changes over time.
A higher eccentricity could create stronger seasonal variations and perhaps trigger a new ice age, or maybe fix man made global warming.  :-)
The effects of a change in semi-major axis would change the length of a year, so, we'd need new calendars, and could warm or cool if it was big enough.
There would also be tidal concerns if a massive object passed close enough to significantly change Earth's orbit and perhaps even, pulling the Moon out of its stable orbit.
The good news is, space is big and quite empty and an object massive enough to change Earth's orbit passing close enough to do so is extremely unlikely.
Comment: You're missing the obligatory HHGTTG quote. :)
Comment: @WGroleau that's an extremely unlikely scenario - the perturbing body would have to come it with the exact right speed, angle, and mass to get that effect. If it does happen, Earth is "too fast" for a circular orbit, so it will got into an ellipse that reaches out to whatever distance its velocity will carry it.
Comment: No mention of angular momentum - which is the key quantity.
Comment: This and other answers have the planet changed to a different orbit.  But, if something were to pull earth further away from the sun, without changing its "forward" speed, wouldn't that allow it to continue moving further away?  Because it would be faster than an orbit at that distance requires?
Comment: @WGroleau In a simple Kepler orbit scenario (one body orbiting a much more massive central body), if the orbiting body receives a single impulse at point X it gets perturbed into a new orbit, but that new orbit still passes through point X. Things are more complicated in the real Solar System, but the Keplerian analysis is still a good first approximation.
Comment: @WGroleau If Earth is pulled by a passing object, it's orbital velocity will change, so that's inevitable.  Because Earth has an eccentricity to it's orbit, it's velocity is always changing anyway.  We generally speak of the average orbital velocity.  The question then becomes the direction and degree of the change.  Once the Earth is pulled by the passing massive object and the object has moved off, the new orbit becomes permanent in Kepler's model like Earth's orbit is permanent now in Kepler's model.  It can't continue to move away without a continued force and a passing body is temporary.
Comment: @WGroleau It could, in theory, reach escape velocity and escape the Sun's gravity and continue to move away, but if it stays in orbit, a changed orbit, once changed, in Kepler's model, is permanent.   The new orbit becomes the orbit and it doesn't return to the old orbit unless a new force acts on it.   There may be additional forces with tight orbits like tidal forces or tidal locking or with multiple planets, perturbations, resonance, and perhaps circularization, but that's more complicated than Kepler's models.
Answer: In a 2 body scenario: Lets say there is one large body (sun) and a smaller body (asteroid)
The orbit of the asteroid is an ellipse around the sun and completely stable. If you knock the asteroid it will change the orbit to a different ellipse, and that new orbit is also completely stable.  The asteroid won't change back to its orginal orbit unless you give it another knock that reverses the effects of the first.
The same is true of any two body system such as Sun-planet  (except a knock that is big enough to change the orbit of the Earth by a large amount is probably enough to wipe out life on Earth)
Gravity would return the asteroid to the same position, but with different velocity (the new velocity that it had after the knock) and so the asteroid would be in a new orbit.
In more complex systems with three or more bodies, resonant orbits can exist whereby an asteroid has an orbit which is has the exact ratio of orbital periods with a planet.  In these orbits a gentle enough knock on the asteroid will be perturbed back towards the resonant orbit.  Note that the Earth is not in a resonant orbit with any larger body. So this doesn't apply to the Earth.
Answer: There is no "correct" orbit. In a two body system, no orbit is special; each is equally valid. If the Earth is perturbed into a different orbit, the new orbit is "just as good" as the original one.
Comment: For humans, I think "correct" means "the one we're used to". ;)
Comment: @LawnmowerMan I think most people would include "circular" in the definition of "correct".  Would the orbit of a comet be considered incorrect even if it's well known?
Answer: In general, the answer is no, but I give a possible exception below.
The earth's orbit is pretty darned Keplerian, since the Sun is much more massive than the earth, and since gravitational forces exerted on the earth from other bodies are very small compared to the forces exerted by the sun.  For Keplerian orbits, Kepler's orbital elements are stable without perturbations.  So, if you change the orbital elements through a perturbation, they won't change back unless another perfect perturbation occurs that resets the elements to their original values.
But it's statistically impossible for an orbit to be perturbed into a new orbit and then perturbed back to it's original orbit, right?  Nope, the retrograde asteroid 2015 BZ 509 orbits the sun and has it's orbit perturbed to a new orbit and then perturbed back every orbit by Jupiter. Per the article in Nature:

The retrograde motion of 2015 BZ509 relative to Jupiter is also
depicted in Fig. 1. Two relatively close passes to Jupiter take place
each orbit, and for stability the effects on the orbit due to each
pass must cancel out.

Of course, this means Jupiter's orbit also gets changed slightly each pass.  If Earth had a hugely massive 1:1 resonant retrograde asteroid like this, then the earth's orbit would continually be perturbed into a new orbit and then perturbed back, once every year!
Comment: @MikeScott Gosh, I did not know we had a 1:1 resonant asteroid to the earth.  Your comment leaves me mildly perturbed.
Comment: But Earth _does_ have a 1:1 resonant asteroid, so its orbit does indeed change, but not noticeably because of the vast difference in mass. https://en.wikipedia.org/wiki/3753_Cruithne
Comment: @MooingDuck It gets kind of tricky since a perturbation may affect only some of the orbital elements.  For example, if an asteroid strikes the earth orthogonal to the ecliptic, for example, the orbit could change, but the oval shape (eccentricity) and size (semi-major axis) could stay the same.  Also, I think it's ok to have some heavy jargon answers to this question.  There are several other excellent answers, so the OP and voters can certainly choose one that they think explains things better!
Comment: The first paragraph might be a bit much for a layperson. Maybe clarify? "The orbit is an oval, and any bumps will usually simply shift earth to a different oval shape."
Comment: I'd consider your last paragraph, if technically not quite wrong, at least highly misleading. The effects that even a closely passing asteroid could have on the Earth's (much less Jupiter's) orbit are so vanishingly small that they're surely lost in the noise from other random perturbations. To a first approximation, compared to actual planets, asteroids are massless.
Comment: @IlmariKaronen  I agree it might be a bit misleading, so I added 'hugely massive' to the above answer.  However, it is far from incorrect. If 2015 BZ 509 had a mass of just 1 gram, it would still perturb Jupiter and then perturb it back by about the same amount twice a year (though it really is always slightly perturbing it).  Similarly, I don't think NASA is 'technically not quite wrong' but 'highly misleading' when they say a spacecraft flyby of Jupiter does 'actually decrease the planet's orbital momentum by a tiny amount': https://solarsystem.nasa.gov/basics/primer/
Comment: The NASA statement is only misleading insofar as the phrase "tiny amount" is a bit vague and open to misinterpretation. If they'd qualified it with "*immeasurably* tiny *but theoretically non-zero* amount", I wouldn't have any objections whatsoever.


Inspect and test multiple live URLs in Google Search Console

Question: Is it possible to live test multiple URLs instead of manually submit each url and click the "live test" button in the Google Search Console -> URL Inspection tool?
Answer: No. Currently this feature is not in the new Google Search Console. Although we are expecting that it will be available soon.
Comment: Hello, any udpate on this question ? thanks !
Comment: Hi, it has been 3 years since this question was first asked, and I still can not inspect multiple URL's... Is there any roadmap to do this in the future? This is making my life unbearable right now. I have to manually check hundreds of pages where I have to wait 2 minutes in-between. Which means I'd have to do manual labor for tens of hours just because there isn't a select all of these previously non indexed url's... This can literally cause people to get Repetitive Strain Injuries. And I am not in the mood of writing automation software because someone decided not to implement a checkbox...


How do I find how long ago a Linux system was installed?

Question: How can I find the time since a Linux system was first installed, provided that nobody has tried to hide it?
Comment: When every part of a linux installation has been replaced over the years, is it still the same installation? (Same as the original analogy of a ship that had all of its parts slowly replaced) I ask because my root partition has changed disks and filesystems, and my home partition is older than that. Some appliances are prepared once as gold images, then get custom hostnames, ssh host keys and fs uuids on deployment. Gold images can be modified and frozen again, like the turnkey linux lineage.
Comment: Isn't that a bit like asking the age of [Theseus' ship](en.wikipedia.org/wiki/Ship_of_Theseus)?
Comment: @Let: I was expecting an answer along the lines of "check the timestamp of /some/oscure/file, it is never modified". Please make that an answer.
Comment: What do you mean by age?
Comment: @Let: The time since it was set up.
Comment: @Tim There is no way to determine that. You could estimate by searching for the oldest files.
Comment: I'd say look at the creation date of `/etc` or `/sbin` as a rough and not-totally-reliable estimate.
Comment: @ultrasawblade -- how would you find that?
Comment: Ahh, after researching I found out linux doesn't store this information in its filesystems, but FreeBSD does.  (http://www.linuxquestions.org/questions/general-10/file-creation-date-in-linux-473684/)  Sorry to mislead you with bad advice.
Comment: Well, look in /etc and find a configuration file related to a program or service that's likely never to have been used.  The `mtime`, visible with the `stat` command, should approximate the date of install.  For example, if no one's ever bothered to change the inittab, that might provide a clue.
Comment: See [the same question on Ask Ubuntu](http://askubuntu.com/questions/1352/how-can-i-tell-what-date-ubuntu-was-installed), which has both Ubuntu-specific and more generic answers.
Comment: Probable duplicate of http://unix.stackexchange.com/questions/7149/installation-date-of-ubuntu/7157#7157
Answer: sudo tune2fs -l /dev/sda1 **OR** /dev/sdb1*  | grep 'Filesystem created:'

This will tell you when the file system was created.
* = In the first column of df / you can find the exact partition to use.
Comment: +1. However, i have to note that my current desktop was created around 1994.  Absolutely everything about it has changed multiple times since then (including the disks, and the filesystem type i use) but it's still the same system.  This method will only, at best, tell me the date of the most recent move to a new filesystem.
Comment: The solution is good, but filesystem dependent and requires root privileges.
Comment: Usually `/dev/sda1` or something like that (whatever `df /` shows in the first column), but the principle is sound.
Comment: This shouldn't be the accepted answer because it works only with ext2 (maybe up to ext4?) which I don't use.
Comment: Hey, that's handy to know, thanks. And this information survives copying the filesystem too. +1.
Comment: Cool solution. It worked even on a system where I used `dump` and `restore` to replace the system drive. But I guess it won't work if you use other methods, such as `cp -a` or `rsync`, to copy the data to the new drive.
Comment: sudo tune2fs -l $(df / | tail -n 1 | awk -F' ' '{ print $1 }') | grep 'Filesystem created:'
Comment: But this not support xfs filesystem?
Answer: Check the date of the root filesystem with dumpe2fs.  I can't really think of how that could be anything other than the date you're looking for:
dumpe2fs $(mount | grep 'on \/ ' | awk '{print $1}') | grep 'Filesystem created:'

Comment: You forgot to mention that this is only applicable to ext2/ext3/ext4 filesystem.
Comment: ... or `tune2fs -l`
Comment: You'd get the wrong date on several of my machines, where I've upgraded hard drives, and just copied the install over.
Comment: @derobert, I still think my answer would be correct, given the OPs question.  A new disk isn't any different from new RAM -- you still have the same 'installation' even though you popped a new disk in...
Comment: @pboin No, when I copy the install over, its a larger disk, so I repartition and mkfs (then use tar/cp to copy it, not dd). May even be a different filesystem (e.g., ext2 -> ext3 -> ext4) So you'd get the time I copied the install over. That's how it could be other than the date OP is looking for.
Comment: It doesn't even have to be a new disk: a filesystem upgrade alone would change that date.
Answer: There are a few dates lying around.

All files have dates.
Log files have dates in them.

On Debian or Ubuntu and their derivatives, see /var/log/installer/syslog for the definitive answer if it exists it is part of the log of the instillation.
But beware this is not guaranteed. (see other answers/comments for some of the reasons it may not work.)
Comment: @Bill: Yes, I said specific to Debian/Ubuntu. Meaning the recipe would work for both Debian and Ubuntu, but possibly not for other (non-Debian-based) Linux distributions.
Comment: But not all files HAVE A CREATION DATE. AFAIK birth date was only introduced in ext4, and that is not POSIX anyway.
Comment: This might be specific to Debian/Ubuntu though.
Comment: @Faheem Mitha: Same file/directory is used for Ubuntu.
Comment: @KonradGajewski But nether this answer, or any of its comments mention file creation date.
Comment: This did not work on my Debian Testing system (installed as Linux Mint Debian Edition –and later transitioned to the more sane Debian Testing– in Mar 2014 according to the [dumpe2fs](https://unix.stackexchange.com/a/9990/87770) answers).  Instead, try `ls -ltc --full-time /etc` to list the contents of `/etc` by order of creation time as noted in [my answer](https://unix.stackexchange.com/a/310397/87770) below.
Comment: @gerlos your edit (not approved), could be a new answer. Add it as an answer and I will up vote it (if I notice, may be add a comment here, we should delete both comment afterward).
Answer: On Red Hat based distributions (e.g. CentOS, Scientific, Oracle etc) you can use:
rpm -qi basesystem
Name        : basesystem
Version     : 10.0
Release     : 7.el7
Architecture: noarch
Install Date: Mon 02 May 2016 19:20:58 BST
Group       : System Environment/Base
Size        : 0
License     : Public Domain
Signature   : RSA/SHA256, Tue 01 Apr 2014 14:23:16 BST, Key ID     199e2f91fd431d51
Source RPM  : basesystem-10.0-7.el7.src.rpm
Build Date  : Fri 27 Dec 2013 17:22:15 GMT
Build Host  : ppc-015.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
Summary     : The skeleton package which defines a simple Red Hat Enterprise Linux system
Description :
Basesystem defines the components of a basic Red Hat Enterprise Linux
system (for example, the package installation order to use during
bootstrapping). Basesystem should be in every installation of a system,
and it should never be removed.

or
rpm -q basesystem --qf '%{installtime:date}\n'
Mon 02 May 2016 19:20:58 BST

Comment: How come `rpm -qi` gives me `Install Date: Mon 07 Jul 2014 03:20:44 PM UTC`, while `tune2fs` says `Filesystem created: Sat Dec 20 23:41:41 2014`?
Comment: On my Azure's VM all have the same time, so rpm is not reliable at all
Answer: The solution most neutral to filesystem and distribution (that I can come up with) is to use the oldest file given by ls -lact /etc, which looks at each file's metadata for the creation time.  While this can be gamed, it is not affected by touch or files created by extracting archives (e.g. tar -p to preserve timestamps).
I think it's best to look at files rather than directories since directories do change their creation time metadata when their contents change (perhaps somebody can shed light on why that is?)
ls -lact --full-time /etc |tail

Systems that lack GNU Coreutils should remove the --full-time option (the sort order will still be correct and you'll still get the day).  You can get the creation time from a file's metadata with stat FILE |grep Change (run that on the oldest file listed by ls -lact).
On other non-Linux systems, stat likely has that information in a slightly different arrangement, possibly requiring different flags.  Note that this still uses the file's metadata and accuracy isn't guaranteed.
Also note that stat from GNU Coreutils has a "Birth" time which tends to be wrong (Linux with ext4 yields 0 to indicate it's unknown, FreeBSD with UFS showed a "Birth" time that is older than the system I queried).  The correct value was listed as its "Change" time.
If you want to get fancy and get just the creation time of the oldest file in/etc:
ls -lact --full-time /etc |awk 'END {print $6,$7,$8}'

This command worked for me on an old FreeBSD system (UFS, no GNU utils):
stat "/etc/$(ls -act /etc |tail -1)" |awk -F\" '{print $6}'

(Yes, this parses ls and that's taboo, but there shouldn't be mischievously named files in /etc.)
You can also use stat to get other time formats.  For example, to get the creation time in Unix epoch: stat -c %Z FILE (with GNU, note that %Z is "time of last status change" but that's the correct flag for my Linux and BSD systems, as noted above; %W is the "time of file birth") or stat -f %c FILE (with BSD).
Comment: This didn't work for me (a few files were much older than the installation date). But looking only at symbolic links in /var and /etc seems to work: `ls -lact --full-time /var | grep ' ->' |  tail -4; echo; ls -lact --full-time /etc | grep ' ->' |  tail -4`
Comment: @ndemou – What version of `ls` are you using? On what filesystem? I wonder about the validity of the creation times you're seeing; `ls` may be ignoring/misinterpreting `-c` and/or the filesystem may not be storing it correctly. Interesting idea on the symlinks. You could do your trick more simply with `find /etc /var -maxdepth 1 -type l -print0 |xargs -0 ls -lactd |tail -n4`
Comment: `ls` is ver.8.2 and filesystem is xfs. `stat` also shows Change and Modify times that match `ls` output (FWIW it's a CentOS 7 server)
Answer: In Fedora, anaconda installer stores the config details of your install in root's home folder, that can give you some idea.
On Debian (at least more recent ones), several logs from the install are stored in /var/log/installer/. Older versions stored them in /var/log/installer.*. That's at least back to 2003.
Answer: ls -alct /|tail -1|awk '{print $6, $7, $8}'

Answer: I have been looking for similar tool, and the best I could come up with was ls -lAhF /etc/hostname, simply the age of the hostname file. I think, generaly, the hostname of a system is set at the beginning, and left unchanged during the life of the system. The date of the creation of the filesystem is certailny helpful, but can be misleading. I, for example, often use virtual machines image, which I have installed some time ago, copy it, change the hostname and make a new server from it. Therefore, in my case /etc/hostname is better indication than tune2fs -l /dev/sda1
Answer: As requested by OP.
If you are looking for the time, when the system was setup, there isn't a way to determine that. For one, the system might have been cloned (not installed) which would effectively fake the file creation time.
You can estimate the age by searching for oldest files.
Comment: mattdm is right; you can get access time, modification time, and change time; ctime is the last. See [this SO post](http://stackoverflow.com/questions/79809/what-is-the-difference-between-file-modification-time-and-file-changed-time)
Answer: I look at the oldest file in /boot (top of "ls -ltr /boot". Often there is an original boot sector from the first install there. On my oldest system this gives the date of original installation, despite having replaced everything in the machine and copied the contents of the file system around a few times :)
Answer: Since a time ago, I usually install at the sime time that the linux distribution a package called Tuptime, which keeps useful statistics about the running time, startups, shutdowns...
For your questions, the line "System life" have that information. As example:
System startups:    110   since   10:15:27 08/08/15
System shutdowns:   107 ok   -   2 bad
System uptime:      4.04 %   -   1 days, 22 hours, 4 minutes and 44 seconds
System downtime:    95.96 %   -   45 days, 13 hours, 57 minutes and 30 seconds
System life:        47 days, 12 hours, 2 minutes and 15 seconds

Largest uptime:     2 hours, 10 minutes and 44 seconds   from   20:49:17 09/08/15
Shortest uptime:    9 seconds   from   10:23:36 08/08/15
Average uptime:     25 minutes and 8 seconds

Largest downtime:   7 days, 10 hours, 17 minutes and 26 seconds   from   06:09:45 10/08/15
Shortest downtime:  15 seconds   from   19:27:24 19/09/15
Average downtime:   9 hours, 56 minutes and 42 seconds

Current uptime:     23 minutes and 33 seconds   since   21:54:09 24/09/15

More info: https://github.com/rfrail3/tuptime/
Answer: Here is a nice script which attempts to provide the OS installation date for various operating systems using various techniques: https://github.com/dmbaturin/scripts/blob/master/installdate.sh
Answer: For a simpler solution, you could just do:
stat --format=%w /

This will tell you when the root of your filesystem was created.

You also could do just this:
stat /

Advantages:

Extremely easy to remember.

No need for root privileges, or sudo.

Example of the unfiltered result.
$ stat /
  File: /
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 10302h/66306d   Inode: 2           Links: 21
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-12-13 21:08:27.833202790 +0100
Modify: 2023-11-27 11:19:52.611063992 +0100
Change: 2023-11-27 11:19:52.611063992 +0100
 Birth: 2018-06-16 11:26:24.000000000 +0200

where the last line is relevant.
Comment: Thank you for the direct result method. I knew about `stat /`, but anyway. Cheers
Answer: ls -alct /root               -> root home directory is created at install time
Comment: But it might have changed afterwards. The time on `/` is slightly less likely to have changed if the kernel isn't kept in `/`, but it's still not a very good indicator. (Reminder: `-c` is not the creation time, it's the metadata change time. Most unix filesystems do not store a file's creation time.)
Comment: show me any time which cannot be changed :)
Comment: The question had the assumption "provided that nobody has tried to hide it". The ctime of `/root` is likely to change naturally (e.g. every time someone creates a file there).
Answer: If you used LVM during the installation, you can check the creation date of a Logical Volume done on the installation day, example :
$ sudo lvdisplay /dev/mapper/KUbuntu_VG-rootFS | grep Creation
  LV Creation host, time kubuntu, 2014-12-28 20:52:15 +0100

Answer: This is another way
# rpm -q -last basesystem
basesystem-10.0-7.el7.noarch                  Tue 11 Jul 2017 03:57:52 PM UTC

Answer: Dealing with virtual machines, some of the file system etc were created when the image was created, can be long before the instance was created.
The time stamp on /etc/locale.conf seems  modified when the instance is boot up during instance creation.  This might be a good time to use unless the locale is modified later on.
The /etc/hostname is similar, except that we do modify it in certain situations.
Any idea as to other files that are modified when a instance is created but not modified thereafter?
Answer: I found a simple file. name "1". Maybe is the first file.
▶ ls -lact --full-time /1
-rw-r--r--. 1 root root 0 2017-03-23 12:02:46.880994133 +0800 /1

Comment: I don't have this file on my Linux.
Comment: why downvote. This time is really point out the last system installed time.


Which website is best for freelancing?

Question: I'm currently working as a freelancer at fiverr from the last few months. Now I've listen about many others sites for freelancers like freelancer,guru,upwork etc. I don't know which website is best for beginners. Anyone here, who wanted to share his/her experience with me. Every single suggestion will be appreciated
Answer: There is only 1 best site - best site for you. That site can be the worst for me.
So the only solution is to try them ALL and find your best one.
Or simply use one with millions of freelancers and try to succeed there.
Answer: There is not a single bullet to end your search for best freelancing website.
Also, instead of relying on a freelance website, your aim as a freelancer should be to build your own brand as the authority in your skill set / niche.
Apart from websites, social networking (both physical and on-line) is very useful for lead generation. Going to meetups, joining relevant LinkedIn and Facebook groups is very beneficial.
You may start the journey by applying at popular freelance websites, forums and groups related to your skill set but also keep building your portfolio on the side. Then come a day when you will get majority of your work from prospective clients landing on your website.
Hope this helps.

Which website is best for freelancing?