How to mesure distance between two objects?

Question: I have some idea about make something and make some small production. Idea is to have something that measure distance between two objects. First one called A size doesn't matter, can be connected to pc or something and measure distance to B. B have to be insignificant size. This will operate with maximum distance 5m (10m even better) in xyz with precision of mm. Is there some technology to measure this, and what technology? And A to B is not necessary to be at line of view, and speed of motions is speed of human motions. B can be attached on for example human who is moving some room or open space.
Comment: I make wrong it is not about xyz that I need. Points A and B will mouve in xyz, but I need only precise distance between them. It is gonna be hard. Thank you for answers. Any one any other idea?
Comment: Can you provide more detail on what size do you consider insignificant?
Comment: May be a duplicate of this, but not 100% identical: http://electronics.stackexchange.com/questions/33110/options-for-short-range-distance-determination-between-two-objects
Comment: Could you attach some recogniseable feature (maybe a sticker with some pattern) to object B, point a camera to it, and see how large the feature appears to be? (requires LOS..)
Answer: I've seen three basic options for distance measurement: triangulation, measuring power drop from a source of known power, and measuring travel time for a signal of known velocity.
Signal power drop is an issue over 10 meters because of the inverse square law: if a signal can be detected 10m away, it's going to be 10000x stronger at a distance of 10 cm. For magnetic fields, for example, that's a difference between 60 uT (about the Earth's magnetic field) and 6 T (a very very strong magnet, which would rip the metal off anything nearby). You might could use RF power drop, but I expect that there would be similar safety issues, not to mention the FCC coming down on you like a ton of bricks.
You've got two basic options for timing signal propagation: sound, and EM fields. EM fields can't really give you the precision you want using travel time as your distance measurement, because 1 mm is about 3 picoseconds at the speed of light. I could be wrong, but that's orders of magnitude beyond what's a reasonable granularity for timing measurements with any hardware I've ever seen.
Sound is easier to work with, but can't really propagate at the distances you're talking about at frequencies over about 250 kHz. (http://www.katho.be/apps.aspx?smid=2688) The wavelength of 250 kHz is about 1.4 mm, so no one microphone is going to give you an arrival time down to the precision you want. Possibly some sort of interferometer? Not to mention that those high frequencies aren't going to work so well without line of sight.
Your best bet is probably triangulation. That requires three locations, not two, and might give you acceptable results if a third station is something you can work with. That changes the question to: how do I determine the direction to something, when it might change location by 1mm 10 meters away, giving a needed precision of five thousandths of a degree?
I'm afraid I don't know the answer to that one. :)
Answer: For measuring the xyz you will need at least 3 detectors in order to make triangulation you cannot do it with only on receiver.
The the detectors must be away from each other and in a known relative position much like GPS satellites.
Answer: You should investigate the technology that Polaroid first used in its cameras to perform autofocus.  It uses pulses of sound at about 50 kHz.  Similar devices are still available, e.g. the SensComp 7000 is a complete system comprising a transmitter, receiver and transducer. It claims a range up to about 10 meters and a 17 degree beamwidth and is relatively low cost (about $55).  Accuracy and range resolution are not specified but should be in the order of 10 mm, maybe better since this technology was used to focus a camera lens. You may have problems in your application if the target is small and/or moves  fast.  Some sort of scanning may be necessary if the bearing of the target B relative to your A can vary a lot and rapidly.
Answer: If you have a accurate high resolution clock, you can measure the time difference a data frame uses to travel from host to device and back. This principle is used in the Network Time Protocol (NTP) that in turn is used to make PC's keep accurate time. Once NTP is in sync, you know the delay (the distance between sender and receiver in seconds) and the jitter (accuracy). Now the fun part about this is that NTP is an open protocol and therefore extensively explained on Internet, the downside is that it is quite complicated to grasp first time. This might be a good start if you are interested in how NTP works. On the upside, you are only in it for measuring delay, not for exact time keeping. This may simplify the programming efforts.
Comment: NTP isn't reasonable for the OP's question. At 10 m the round trip time is a few ns.
Comment: I wrote 'accurate high resolution clock'.


Counting Number of Database Connections on a Page

Question: I have a LAMP stack(mysql and php) wordpress site and I want to know the number of database connections opened when a page loads. I can find other numbers but I can't figure out the number for a specific page.
Answer: One would hope that the answer is "1".
I don't think there is a way to get that answer easily...
Turn on the "general log".  Make sure that that page is loaded (and moved away from) at least once.  Turn off the general log.
Now look at the log.  Part of the info is a "connection number".  Try to decipher which queries apply to your page load and which came from others.  You may need help from the Apache log to see which pages were loaded, when.  If the general log is too 'busy', try again again.
You may be surprised (even appalled) at list of queries that show up.  It might be more than just "number of connections" that is 'inefficient'.  Start a new Question with the list; let's poke at it to see what could be improved.  (And tag it with [wordpress], too.)


Is there a way I can export or access my photoshop Custom Shapes Library in illustrator

Question: I've been trying to export my Photoshop CC custom shapes library into Illustrator, all in one, go rather than individually pasting them into Illustrator. I guess similar to loading and saving effects files. Can this be done?
Comment: Could you possibly please state what you tried, so we know what hasn't worked for you?  For example, have you tried copy to copy and paste a custom shape you have drawn in Photoshop into Illustrator?  Is there some reason this does not work for you?
Comment: Sorry for the late reply. I had a family emergency. Thanks for replying. I was trying to export all my premade custom shape files at one time rather than individually. I guess similar to loading and saving effects files.
Comment: I have edited your question, and added that extra information since it will be important if someone is going to answer.
Comment: Yes you could write a loop in jsx and save them individually
Answer: Photoshop custom shapes are saved in .csh files, which are only usable in Photoshop.  Illustrator doesn't recognise the format.
I guess what you could do is place all the custom shapes, one at a time, in a Photoshop document, and using the Path Selection tool, select all the paths, paste them into a new Illustrator document, and apply a fill to all the shapes.  Then save that document, then as you need them just copy and paste into any Illustrator document. Or even select each shape and turn it into a symbol.


In which orgs is possible to upgrade managed package

Question: Is it possible to upgrade a managed package, not in main Dev Hub org and its scratches? I mean in some not related to the Dev Hub org. We have a git repository with code from the managed package and need to add some new functionality to the package but we don't have access to the Dev Hub org
Answer: If you're using a First Generation Managed Package, you need to update the package in the Packaging Org. This will be a normal Developer Edition org. If you're using a Second Generation Managed Package, you need access to the Dev Hub org.


The Kanji for ありがとうございます

Question: 有難う御座います is one Kanji spelling. However, I thought, 'is ございます here an auxilliary verb, and thus are the Kanji incorrect?' Should the proper spelling be 有難うございます?
Answer: ありがとうございます is a greeting which was lexicalized long ago, and I don't think it's a good idea to analyze it like this and try to apply the modern style guideline.
And while most of the recent style guidelines do say hiragana should be used for auxiliary verbs, this is not a strict rule. Not many people strictly follow this in daily life. I can't say, for example, 起きて下さい or 見て貰う are incorrect.
At any rate, the most common form of this greeting is ありがとうございます, in all-hiragana. 有難うございます is usually acceptable, but it looks a bit too stilted by today's standards, and a strict person may stop you from using this in a business email.
Answer: Jisho says you can use both forms:

有り【あり】難う【がとう】ございます
有り【あり】難う【がとう】御座います【ございます】

Even though I suppose Japanese only use the kanji on formal texts. The kana-way is probably better for a daily-basis use, as mentioned here.
Comment: What do you mean by "Jisho says you can use both forms"? (1) I don't think the WWWJDIC (the database used by jisho.org) makes any style recommendations and (2) it even says "Usually written using kana alone".
Comment: @Earthliŋ Not exactly a style recommendation, but they desire to [have the most frequently used form as the 'surface form'](https://groups.yahoo.com/neo/groups/edict-jmdict/conversations/messages/5330) (i.e. first of the listed variants.)

The Kanji for ありがとうございます


How are living things able to exert force on themselves?

Question: Suppose I'm just standing somewhere and I move my hands. My body is the system. When I move my hands, it's not like the rest of my body has to be moved in the opposite direction. I can move my hands while keeping the rest of the body still. When the position of hands changes, the configuration of particles changes, hence the center of mass of my body accelerates. But a system shouldn't be able to exert net force on itself! In case of jumping, we don't create the jump force, instead it comes from the reaction force of the ground. But in the hand motion, we don't have to exert force on the ground, hence no reaction, no outside force. So, do living things create this force?
Comment: There's an external force on the system you defined, that is the reaction from the ground. If you were floating in deep space and did that exercise, your other body parts would move but overall your center of mass won't accelerate.
Comment: @Rick I don't feel like pushing the ground in any way during this exercise.
Comment: You do, when you move your hands you push the ground with varying forces, think of what would happen if you did it on a trampoline or a mattress.
Answer: If you were floating in space, what you say would be true.  However, here on earth, your feet are planted on the ground.
When you move your hand, the rest of your body does move in the opposite direction a little, especially at first.  However, your body has a amazing mechanical control system.  It will compenstate for the movement of your body and restore its initial position by changing how it pushes on the floor with the feet.  This happens so well and is so automatic that you aren't usually aware of it unless you deliberately think about it.


What controls the node connections when multiple access points with the same SSID are present?

Question: What would govern the nodes connected to a wireless network when I have multiple access points that use the same SSID for roaming? I believe there is a command that shows the associations in Cisco IOS that could help me find this but I do not know what it is.
Answer: The clients choose for themselves which AP to connect to.
The 802.11 standard leaves it up to the clients to decide which AP to join. It doesn't even specify what algorithm or criteria a client should use to pick an AP. That has always been left up to implementors as an implementation detail. Most client implementations just pick the AP with the strongest signal strength, of the ones that are publishing the desired SSID.
Some enterprise-class 802.11 network infrastructure gear (such as "thin" APs with separate "Wireless LAN Controller" boxes coordinating them, as you can buy from Cisco, Aruba, and others) tries to second-guess the clients and employ various proprietary, nonstandard tricks to try to get clients to join the APs that the WLAN infrastructure gear wants the clients to join. They'll do things like purposely have some APs not respond to Probe Requests from the clients, or have a busy AP refuse to let a client join, so that the client is forced to pick a different AP. These tricks are, again, proprietary and nonstandard, and vary from vendor to vendor.


Which Matrix is an Inner Product

Question: We define the inner product of square matrices to be $\langle\vec x, \vec y\rangle_A=\vec x^TA\vec y$. One of the matrices $$\begin{bmatrix}
1 & 2 \\
2 & 1 \\
\end{bmatrix}$$ $$\begin{bmatrix}
2 & 1 \\
1 & 2 \\
\end{bmatrix}$$ violates the requirement $\langle\vec x, \vec x\rangle_A > 0$ for $\vec x \neq \vec 0$. I don't really understand the inner product in general, and I am really struggling to understand and prove which matrix isn't an inner product. Any help would be greatly appreciated.
Answer: The first one does not generate an inner product because it has an eigenvalue of $-1$. You can check:
$$
        \begin{bmatrix}1 & -1 \end{bmatrix}
\begin{bmatrix}
1 & 2 \\
2 & 1 \\
\end{bmatrix}\begin{bmatrix} 1 \\ -1 \end{bmatrix} = -2
$$
The second one does generate an inner product.
Comment: @Konstantin : The matrix must be positive definite in order for $[x,y]=x^{T}Ay$ to be an inner product. Positive semi-definite would mean that $[x,x]=0$ could hold without $x=0$, even though all other required properties of an inner product would be satisfied.
Comment: Thank you very much for your explanation, my mistake!
Comment: @Konstantin : Any positive definite square matrix defines an inner product. All norms are equivalent on a given finite-dimensional space, meaning that there are positive constants $A$, $B$ such that $\|x\|_1 \le A\|x\|_2$ for all $x$ and $\|x\|_2 \le B\|x\|_1$ for all $x$.
Comment: Thank you for the reply! Does the matrix need to be positive semi-definite (=non-negative eigenvalues) because if we select $x=y$ there may be a violation of the inner product's definition? https://math.stackexchange.com/questions/518890/prove-that-every-positive-semidefinite-matrix-has-nonnegative-eigenvalues
Comment: A couple more questions if possible: any positive definite square matrix represent an inner product or there are some additional requirements? Would proper matrices of same dimensions define essentially the same inner product (norms in finite dim. spaces are the same up to isomorphism)?
Answer: An inner product is a way to map vectors to a scalair quantity. You can use it to 'multiply' vectors. To check wether this is an inner product, you'll have to go over the definition of an inner product and see if it suffices.
For the first matrix we have:
$\overrightarrow{x} = ({x_1, x_2})^T$ so : $< \overrightarrow{x}, \overrightarrow{y} >_A = (x_1 + 2x_2)y_1 + (2x_1 + x_2)y_2$
Now you need to check if this equals the complex conjugate of $< \overrightarrow{x}, \overrightarrow{y} >_A$, check linearity in the first argument, and check wether $0 \leq < \overrightarrow{x}, \overrightarrow{x} >_A$ and $ < \overrightarrow{x}, \overrightarrow{x} >_A = 0$ only if $\overrightarrow{x}$ is $\overrightarrow{0}$.
Same for the second matrix.

Which Matrix is an Inner Product


Are any genes over a billion years old?

Question: Are there any genes (for any organism) for which we can say with confidence that they are over a billion years old?
Answer: Ribosomal RNA (rRNA) genes are shared among all living organisms, including lineages that have diverged from one-another well before a billion years. Bacteria, Archaea, and Eukaryotes diverged over 3 billion years ago, and their rRNAs are virtually identical to one-another. http://www.biologyreference.com/Ar-Bi/Archaea.html
Any genes that are shared between plants, animals and fungi would also be over a billion years old.
Comment: "…their rRNAs are virtually identical to one-another." No. Just counting the bases, typical examples are ssRNA: bacteria 1542 nt, eukaryotes 1869 nt; lsRNA: bacteria 2906 nt, eukaryotes 5070 nt. They are certainly related, but a nuanced explanation of how is required. See e.g. [R. Brimacombe (1984) TIBS  9  273–277](https://www.sciencedirect.com/science/article/pii/0968000484901646).
Comment: Counting the bases is meaningless. Eukaryotes possess non-conserved expansion segments that account for virtually all the variations in length. You can take ribosomes from a prokaryote, and insert them into eukaryotes, and they still function. I stand by the fact that they are virtually identical. Saying that they are related is obvious, but seems to indicate a lack of understanding for how genes evolve following their divergence after speciation. At the time lineages split, the genes are identical. Then the nucleotides change over time, but the structure remains.
Comment: I didn't want to answer myself and inevitably overlap with yours, so I suggested you edit it to clarify the point. But I have no wish to argue the point, I'll just write one of my own when I have the time.

Are any genes over a billion years old?


What's the difference between a POST and a PUT HTTP REQUEST?

Question: They both seem to be sending data to the server inside the body, so what makes them different?
Comment: Does this answer your question? [PUT vs. POST in REST](https://stackoverflow.com/questions/630453/put-vs-post-in-rest)
Answer: HTTP PUT:
PUT puts a file or resource at a specific URI, and exactly at that URI. If there's already a file or resource at that URI, PUT replaces that file or resource.  If there is no file or resource there, PUT creates one. PUT is idempotent, but paradoxically PUT responses are not cacheable.
HTTP 1.1 RFC location for PUT
HTTP POST:
POST sends data to a specific URI and expects the resource at that URI to handle the request.  The web server at this point can determine what to do with the data in the context of the specified resource. The POST method is not idempotent, however POST responses are cacheable so long as the server sets the appropriate Cache-Control and Expires headers.
The official HTTP RFC specifies POST to be:

Annotation of existing resources;
Posting a message to a bulletin board, newsgroup, mailing list,
or similar group of articles;
Providing a block of data, such as the result of submitting a
form, to a data-handling process;
Extending a database through an append operation.

HTTP 1.1 RFC location for POST
Difference between POST and PUT:
The RFC itself explains the core difference:

The fundamental difference between the
POST and PUT requests is reflected in
the different meaning of the
Request-URI. The URI in a POST request
identifies the resource that will
handle the enclosed entity. That
resource might be a data-accepting
process, a gateway to some other
protocol, or a separate entity that
accepts annotations. In contrast, the
URI in a PUT request identifies the
entity enclosed with the request --
the user agent knows what URI is
intended and the server MUST NOT
attempt to apply the request to some
other resource. If the server desires
that the request be applied to a
different URI, it MUST send a 301 (Moved Permanently) response; the user agent MAY then make
its own decision regarding whether or not to redirect the request.

Additionally, and a bit more concisely, RFC 7231 Section 4.3.4 PUT states (emphasis added),

4.3.4.  PUT
The PUT method requests that the state of the target resource be
created or replaced with the state defined by the representation
enclosed in the request message payload.

Using the right method, unrelated aside:
One benefit of REST ROA vs SOAP is that when using HTTP REST ROA, it encourages the proper usage of the HTTP verbs/methods.  So for example you would only use PUT when you want to create a resource at that exact location.  And you would never use GET to create or modify a resource.
Comment: So in a nutshell: The URI in a **POST** request identifies **the resource that will handle the enclosed entity**. The URI in a **PUT** request identifies **the entity itself**.
Comment: some additional exception which makes the difference very clear is at next URL - https://dzone.com/articles/put-vs-post
Comment: What I don't understand is how to implement the idempotency of PUT. in general, most API's will be using auto generation of an ID in case of creating a new resource. and in PUT, you should create a resource if it doesn't exists, but use the ID specified in the URI, but how can you do that if the id generation method is set to be automatic ???
Comment: I read in the specs that `If the Request-URI does not point to an existing resource [...] the origin server *can* create the resource with that URI`. So an implementation of PUT that refuses to create a resource if not present would be correct, right? If so, does this happen in practice? Or implementations usually also create on PUT?
Comment: Responses to POST method are not cacheable, UNLESS the response includes appropriate Cache-Control or Expires header fields
Comment: There are also some security-related differences: see my [answer below](https://stackoverflow.com/questions/107390/whats-the-difference-between-a-post-and-a-put-http-request/55382661#55382661)
Comment: @RoniAxelrad I was wondering about this myself. But I think the idea is that you should never create a duplicate resource ever. So for example if you wanted to store a transaction as a "resource" using http://api.example.com/payments and the body of 2 requests are exactly the same, why are you storing them both and generating unique primary keys? Are you possible processing duplicate **requests**? Should you maybe reconsider your design?
Comment: Re: _"paradoxically PUT responses are not cacheable"_. Perhaps worth expanding the paradox that what **can be cacheable in PUTs are REQUESTs**: The 2014's RFC 7231 (one of RFCs that obsolete the 1999's RFC 2616) mentions [here](https://tools.ietf.org/html/rfc7231#section-4.3.4) that PUT `allows a user agent to know when the representation body it has in memory remains current`, i.e. the server `MUST NOT send ... an ETag or Last-Modified ... unless the request's representation was saved without any transformation`.There may not be many clients with such cache but the servers should follow spec.
Answer: Only semantics.
An HTTP PUT is supposed to accept the body of the request, and then store that at the resource identified by the URI.
An HTTP POST is more general.  It is supposed to initiate an action on the server.  That action could be to store the request body at the resource identified by the URI, or it could be a different URI, or it could be a different action.
PUT is like a file upload.  A put to a URI affects exactly that URI.  A POST to a URI could have any effect at all.
Comment: That which implies a certain function may not actually
Answer: To give examples of REST-style resources:
POST /books with a bunch of book information might create a new book, and respond with the new URL identifying that book: /books/5.
PUT /books/5 would have to either create a new book with the ID of 5, or replace the existing book with ID 5.
In non-resource style, POST can be used for just about anything that has a side effect. One other difference is that PUT should be idempotent: multiple PUTs of the same data to the same URL should be fine, whereas multiple POSTs might create multiple objects or whatever it is your POST action does.
Comment: I feel the idempotency is the most distinguishing and important difference between PUT and POST
Comment: Hi ChanGan, here's an explanation which Wikipedia gives about your "POST /books/5" case: "Not generally used. Treat the addressed member as a collection in its own right and create a new entry in it."
Comment: Hi Bhollis, What will happen, if I use POST /books/5? will it throw resource not found?
Comment: this answer gives the impression that PUT and POST can be defined on the same resource, however the other difference next to idempotency is who controls the ID space. In PUT, the user is controlling the ID space by creating resources with a specific ID. In POST, the server is returning the ID that the user should reference in subsequent calls like GET. The above is weird because its's a mix of both.
Answer:
GET: Retrieves data from the server. Should have no other effect.
PUT: Replaces target resource with the request payload. Can be used to update or create a new resource.
PATCH: Similar to PUT, but used to update only certain fields within an existing resource.
POST: Performs resource-specific processing on the payload. Can be used for different actions including creating a new resource, uploading a file, or submitting a web form.
DELETE: Removes data from the server.
TRACE: Provides a way to test what the server receives. It simply returns what was sent.
OPTIONS: Allows a client to get information about the request methods supported by a service. The relevant response header is Allow with supported methods. Also used in CORS as preflight request to inform the server about actual the request method and ask about custom headers.
HEAD: Returns only the response headers.
CONNECT: Used by the browser when it knows it talks to a proxy and the final URI begins with https://. The intent of CONNECT is to allow end-to-end encrypted TLS sessions, so the data is unreadable to a proxy.
Comment: Information given about PUT and POST is not right in this answer. PUT can be used to create a new entity as well as update an existing entity. POST is more generic and can be used to perform similar action like in PUT or can be used to perform any other action as well on the incoming entity (with side effects) and ideally, PUT should be idempotent where as POST may or may not be idempotent
Comment: Is CONNECT fired prior to each request when using https?
Answer: PUT is meant as a a method for "uploading" stuff to a particular URI, or overwriting what is already in that URI.
POST, on the other hand, is a way of submitting data RELATED to a given URI.
Refer to the HTTP RFC
Answer: As far as i know, PUT is mostly used for update the records.

POST - To create document or any other resource
PUT  - To update the created document or any other resource.

But to be clear on that PUT usually 'Replaces' the existing record if it is there and creates if it not there..
Comment: What is a record in this context? The question is about HTTP Request.
Comment: What would POST do if the document/resource is already present? Will it throw an error, or will it just go off OK?
Comment: Here's not a place where you share "As far as I know" type opinions. We need brief, documental answers.
Answer: Define operations in terms of HTTP methods
The HTTP protocol defines a number of methods that assign semantic meaning to a request. The common HTTP methods used by most RESTful web APIs are:
GET retrieves a representation of the resource at the specified URI. The body of the response message contains the details of the requested resource.
POST creates a new resource at the specified URI. The body of the request message provides the details of the new resource. Note that POST can also be used to trigger operations that don't actually create resources.
PUT either creates or replaces the resource at the specified URI. The body of the request message specifies the resource to be created or updated.
PATCH performs a partial update of a resource. The request body specifies the set of changes to apply to the resource.
DELETE removes the resource at the specified URI.
The effect of a specific request should depend on whether the resource is a collection or an individual item. The following table summarizes the common conventions adopted by most RESTful implementations using the e-commerce example. Not all of these requests might be implemented—it depends on the specific scenario.

Resource
POST
GET
PUT
DELETE

/customers
Create a new customer
Retrieve all customers
Bulk update of customers
Remove all customers

/customers/1
Error
Retrieve the details for customer 1
Update the details of customer 1 if it exists
Remove customer 1

/customers/1/orders
Create a new order for customer 1
Retrieve all orders for customer 1
Bulk update of orders for customer 1
Remove all orders for customer 1

The differences between POST, PUT, and PATCH can be confusing.
A POST request creates a resource. The server assigns a URI for the new resource and returns that URI to the client. In the REST model, you frequently apply POST requests to collections. The new resource is added to the collection. A POST request can also be used to submit data for processing to an existing resource, without any new resource being created.
A PUT request creates a resource or updates an existing resource. The client specifies the URI for the resource. The request body contains a complete representation of the resource. If a resource with this URI already exists, it is replaced. Otherwise, a new resource is created, if the server supports doing so. PUT requests are most frequently applied to resources that are individual items, such as a specific customer, rather than collections. A server might support updates but not creation via PUT. Whether to support creation via PUT depends on whether the client can meaningfully assign a URI to a resource before it exists. If not, then use POST to create resources and PUT or PATCH to update.
A PATCH request performs a partial update to an existing resource. The client specifies the URI for the resource. The request body specifies a set of changes to apply to the resource. This can be more efficient than using PUT, because the client only sends the changes, not the entire representation of the resource. Technically PATCH can also create a new resource (by specifying a set of updates to a "null" resource), if the server supports this.
PUT requests must be idempotent. If a client submits the same PUT request multiple times, the results should always be the same (the same resource will be modified with the same values). POST and PATCH requests are not guaranteed to be idempotent.
Comment: No. PUT is for actually placing literal content at a URL and it rarely has its place in a REST API. POST is more abstract and covers any sort of adding content that doesn't have the semantics of "Put this exact file at this exact URL".
Comment: I think you have PUT and POST backwards
Comment: −1 because in addition to **update**, PUT is also used to **create** a *target* resource (the resource identified by the request URI), contrary to POST which cannot create a target resource because it is not a CRUD operation on the resources' states (data management) but a *process* operation (cf. RFC 7231). The process may create a resource but different from the target resource so that does make it a CRUD operation.
Comment: This is by far the best and most accurate explanation for Put and Post. It's the only one that talks about the client being able supply a meaningful URI to the resultant resource.
Comment: Is every request that does not change the server's state a GET request? For example an endpoint that identifies keywords from a text sent as the request's body - is such an endpoint GET endpoint?
Comment: @dpelisek There is no request body in GET method
Comment: @LongNguyen, what is it then? According your answer both post and get creates a resource. But this example does not creates any resource.
Comment: @dpelisek Could you please quote the sentences I mentioned that GET creates a resource?
Comment: sorry, I meant both post and put
Answer: Others have already posted excellent answers, I just wanted to add that with most languages, frameworks, and use cases you'll be dealing with POST much, much more often than PUT.  To the point where PUT, DELETE, etc. are basically trivia questions.
Answer: Please see: http://zacharyvoase.com/2009/07/03/http-post-put-diff/
I've been getting pretty annoyed lately by a popular misconception by web developers that a POST is used to create a resource, and a PUT is used to update/change one.
If you take a look at page 55 of RFC 2616 ("Hypertext Transfer Protocol – HTTP/1.1"), Section 9.6 ("PUT"), you'll see what PUT is actually for:

The PUT method requests that the enclosed entity be stored under the supplied Request-URI.

There's also a handy paragraph to explain the difference between POST and PUT:

The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request – the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource.

It doesn't mention anything about the difference between updating/creating, because that's not what it's about. It's about the difference between this:
obj.set_attribute(value) # A POST request.

And this:
obj.attribute = value # A PUT request.

So please, stop the spread of this popular misconception. Read your RFCs.
Comment: This seems pointlessly rude, and pedantic in a less-than-useful way. In the example of a PUT you cite, the new entity is, in a RESTful api, a 'new' record - and accessible at that location. It's questionable whether it's a good design choice to allow sub-members be mutable like that (I think it's not ideal), but even were it, you're using a subspecies to attack a lot of useful information. Most of the time, the description as it is usually stated is a great statement of both the RFC's content, summarized, and a statement of usual and customary practice. Also, it won't hurt you to be polite.
Comment: This cannot be upvoted enough. PUT has no place in a REST API. Most of the time, POST indicates the correct semantics.
Comment: Not said well, but indeed an accurate interpretation of the RFCs. The web developer world is quite a swamp of misinformation, it seems.
Comment: @Beefster There's no such thing as 'POST Indicates'. Najeebul made a great point here. How do you figure what it indicates? except that you just use it because you've always used it that way since the first day you learned it but don't really know why you should use it compared to the others?
Answer: A POST is considered something of a factory type method.  You include data with it to create what you want and whatever is on the other end knows what to do with it.  A PUT is used to update existing data at a given URL, or to create something new when you know what the URI is going to be and it doesn't already exist (as opposed to a POST which will create something and return a URL to it if necessary).
Answer: It should be pretty straightforward when to use one or the other, but complex wordings are a source of confusion for many of us.
When to use them:

Use PUT when you want to modify a singular resource that is already a part of resource collection. PUT replaces the resource in its entirety. Example: PUT /resources/:resourceId
Sidenote: Use PATCH if you want to update a part of the resource.

Use POST when you want to add a child resource under a collection of resources.
Example: POST => /resources

In general:

Generally, in practice, always use PUT for UPDATE operations.
Always use POST for CREATE operations.

Example:
GET     /company/reports      => Get all reports
GET     /company/reports/{id} => Get the report information identified by "id"
POST    /company/reports      => Create a new report
PUT     /company/reports/{id} => Update the report information identified by "id"
PATCH     /company/reports/{id} => Update a part of the report information identified by "id"
DELETE    /company/reports/{id} => Delete report by "id"
Answer: The difference between POST and PUT is that PUT is idempotent, that means, calling the same PUT request multiple times will always produce the same result(that is no side effect), while on the other hand, calling a POST request repeatedly may have (additional) side effects  of creating the same resource multiple times.
GET : Requests using GET only retrieve data , that is it requests a representation of the specified resource
POST : It sends data to the server to create a resource. The type of the body of the request is indicated by the Content-Type header. It often causes a change in state or side effects on the server
PUT : Creates a new resource or replaces a representation of the target resource with the request payload
PATCH : It is used to apply partial modifications to a resource
DELETE : It deletes the specified resource
TRACE : It performs a message loop-back test along the path to the target resource, providing a useful debugging mechanism
OPTIONS : It is used to describe the communication options for the target resource, the client can specify a URL for the OPTIONS method, or an asterisk (*) to refer to the entire server.
HEAD : It asks for a response identical to that of a GET request, but without the response body
CONNECT : It establishes a tunnel to the server identified by the target resource ,  can be used to access websites that use SSL (HTTPS)
Answer: It would be worth mentioning that POST is subject to some common Cross-Site Request Forgery (CSRF) attacks while PUT isn't.
The CSRF below are not possible with PUT when the victim visits attackersite.com.
The effect of the attack is that the victim unintentionally deletes a user just because it (the victim) was logged-in as admin on target.site.com, before visiting attackersite.com:
Malicious code on attackersite.com:
Case 1: Normal request. saved target.site.com cookies will automatically be sent by the browser: (note: supporting PUT only, at the endpoint, is safer because it is not a supported <form> attribute value)

<form id="myform" method="post" action="http://target.site.com/deleteUser" >
    <input type="hidden" name="userId" value="5">
</form>

Case 2: XHR request. saved target.site.com cookies will automatically be sent by the browser: (note: supporting PUT only, at the endpoint, is safer because an attempt to send PUT would trigger a preflight request, whose response would prevent the browser from requesting the deleteUser page)
//deletes user with id 5
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://target.site.com/deleteUser");
xhr.withCredentials=true;
xhr.send(["userId=5"]);

MDN Ref : [..]Unlike "simple requests" (discussed above), --[[ Means: POST/GET/HEAD ]]--, for "preflighted" requests the browser first sends an HTTP request using the OPTIONS method[..]

cors in action :  [..]Certain types of requests, such as DELETE or PUT, need to go a step further and ask for the server's permission before making the actual request[..]what is called a preflight request[..]
Answer: In simple words you can say:
1.HTTP Get:It is used to get one or more items
2.HTTP Post:It is used to create an item
3.HTTP Put:It is used to update an item
4.HTTP Patch:It is used to partially update an item
5.HTTP Delete:It is used to delete an item
Answer: REST-ful usage
POST is used to create a new resource and then returns the resource URI
EX
      REQUEST : POST ..../books
        {
        "book":"booName",
        "author":"authorName"
        }

This call may create a new book and returns that book URI
Response ...THE-NEW-RESOURCE-URI/books/5

PUT is used to replace a resource, if that resource is exist then simply update it, but if that resource doesn't exist then create it,
REQUEST : PUT ..../books/5
{
"book":"booName",
"author":"authorName"
}

With PUT we know the resource identifier, but POST will return the new resource identifier
Non REST-ful usage
POST is used to initiate an action on the server side, this action may or may not create a resource, but this action will have side affects always it will change something on the server
PUT is used to place or replace literal content at a specific URL
Another difference in both REST-ful and non REST-ful styles
POST is Non-Idempotent Operation: It will cause some changes if executed multiple times with the same request.
PUT is Idempotent Operation: It will have no side-effects if executed multiple times with the same request.
Answer: Actually there's no difference other than their title. There's actually a basic difference between GET and the others. With a "GET"-Request method, you send the data in the url-address-line, which are separated first by a question-mark, and then with a & sign.
But with a "POST"-request method, you can't pass data through the url, but you have to pass the data as an object in the so called "body" of the request. On the server side, you have then to read out the body of the received content in order to get the sent data.
But there's on the other side no possibility to send content in the body, when you send a "GET"-Request.
The claim, that "GET" is only for getting data and "POST" is for posting data, is absolutely wrong. Noone can prevent you from creating new content, deleting existing content, editing existing content or do whatever in the backend, based on the data, that is sent by the "GET" request or by the "POST" request. And nobody can prevent you to code the backend in a way, that with a "POST"-Request, the client asks for some data.
With a request, no matter which method you use, you call a URL and send or don't send some data to specify, which information you want to pass to the server to deal with your request, and then the client gets an answer from the server. The data can contain whatever you want to send, the backend is allowed to do whatever it wants with the data and the response can contain any information, that you want to put in there.
There are only these two BASIC METHODS. GET and POST. But it's their structure, which makes them different and not what you code in the backend. In the backend you can code whatever you want to, with the received data. But with the "POST"-request you have to send/retrieve the data in the body and not in the url-addressline, and with a "GET" request, you have to send/retrieve data in the url-addressline and not in the body. That's all.
All the other methods, like "PUT", "DELETE" and so on, they have the same structure as "POST".
The POST Method is mainly used, if you want to hide the content somewhat, because whatever you write in the url-addressline, this will be saved in the cache and a GET-Method is the same as writing a url-addressline with data. So if you want to send sensitive data, which is not always necessarily username and password, but for example some ids or hashes, which you don't want to be shown in the url-address-line, then you should use the POST method.
Also the URL-Addressline's length is limited to 1024 symbols, whereas the "POST"-Method is not restricted. So if you have a bigger amount of data, you might not be able to send it with a GET-Request, but you'll need to use the POST-Request. So this is also another plus point for the POST-request.
But dealing with the GET-request is way easier, when you don't have complicated text to send.
Otherwise, and this is another plus point for the POST method, is, that with the GET-method you need to url-encode the text, in order to be able to send some symbols within the text or even spaces. But with a POST method you have no restrictions and your content doesn't need to be changed or manipulated in any way.
Answer: Summary

Use PUT to create or replace the state of the target resource with the state defined by the representation enclosed in the request. That standardized intended effect is idempotent so it informs intermediaries that they can repeat a request in case of communication failure.
Use POST otherwise (including to create or replace the state of a resource other than the target resource). Its intended effect is not standardized so intermediaries cannot rely on any universal property.

References
The latest authoritative description of the semantic difference between the POST and PUT request methods is given in RFC 7231 (Roy Fielding, Julian Reschke, 2014):

The fundamental difference between the POST and PUT methods is highlighted by the different intent for the enclosed representation. The target resource in a POST request is intended to handle the enclosed representation according to the resource's own semantics, whereas the enclosed representation in a PUT request is defined as replacing the state of the target resource. Hence, the intent of PUT is idempotent and visible to intermediaries, even though the exact effect is only known by the origin server.

In other words, the intended effect of PUT is standardized (create or replace the state of the target resource with the state defined by the representation enclosed in the request) and so is common to all target resources, while the intended effect of POST is not standardized and so is specific to each target resource. Thus POST can be used for anything, including for achieving the intended effects of PUT and other request methods (GET, HEAD, DELETE, CONNECT, OPTIONS, and TRACE).
But it is recommended to always use the more specialized request method rather than POST when applicable because it provides more information to intermediaries for automating information retrieval (since GET, HEAD, OPTIONS, and TRACE are defined as safe), handling communication failure (since GET, HEAD, PUT, DELETE, OPTIONS, and TRACE are defined as idempotent), and optimizing cache performance (since GET and HEAD are defined as cacheable), as explained in It Is Okay to Use POST (Roy Fielding, 2009):

POST only becomes an issue when it is used in a situation for which some other method is ideally suited: e.g., retrieval of information that should be a representation of some resource (GET), complete replacement of a representation (PUT), or any of the other standardized methods that tell intermediaries something more valuable than "this may change something." The other methods are more valuable to intermediaries because they say something about how failures can be automatically handled and how intermediate caches can optimize their behavior. POST does not have those characteristics, but that doesn't mean we can live without it. POST serves many useful purposes in HTTP, including the general purpose of "this action isn't worth standardizing."
Answer: Both PUT and POST are Rest Methods .
PUT - If we make the same request twice using PUT using same parameters both times, the second request will not have any effect. This is why PUT is generally used for the Update scenario,calling Update more than once with the same parameters doesn't do anything more than the initial call hence PUT is idempotent.
POST is not idempotent  , for instance Create will create two separate entries into the target hence it is not idempotent so CREATE is used widely in POST.
Making the same call using POST with same parameters each time will cause two different things to happen, hence why POST is commonly used for the Create scenario
Answer: Post and Put are mainly used for post the data and other update the data. But you can do the same with post request only.


Energy conservation in General Relativity

Question: I understand that energy conservation is not a rule in general relativity, but I'd like to know under what circumstances it can still be possible. In other words, when is it possible to associate a potential energy to the gravitational field, so that the energy is constant in the evolution of the system?
Here are some examples, is there a convenient way to define energy in these scenarios?

Just a system of gravitational waves.
A point mass moving in a static (but otherwise arbitrary) space-time. Equivalent (if I'm not mistaken) to a test mass moving in the field of a second much larger mass, the larger mass wouldn't move.
Two rotating bodies of similar mass.

Overall, I'm trying to understand what keeps us from associating a potential energy to the metric. When we break the time translation symmetry of a system by introducing an electromagnetic field, we can still conserve energy by defining an electromagnetic potential energy. Why can't we do the same when we break TT symmetry by making space-time curved?
Answer: There are a few different ways of answering this one.  For brevity, I'm going to be a bit hand-wavey.  There is actually still some research going on with this.
Certain spacetimes will always have a conserved energy.  These are the spacetimes that have what is called a global timelike (or, if you're wanting to be super careful and pedantic, perhaps null) Killing vector.  Math-types will define this as a vector whose lowered form satisfies the Killing equation: $\nabla_{a}\xi_{b} + \nabla_{b} \xi_{a} = 0$.  Physicists will just say that $\xi^{a}$ is a vector that generates time (or null) translations of the spacetime, and that Killing's equation just tells us that these translations are symmetries of the spacetime's geometry.  If this is true, it is pretty easy to show that all geodesics will have a conserved quantity associated with the time component of their translation, which we can interpret as the gravitational potential energy of the observer (though there are some new relativistic effects--for instance, in the case of objects orbiting a star, you see a coupling between the mass of the star and the orbiting objects angular momentum that does not show up classically).  The fact that you can define a conserved energy here is strongly associated with the fact that you can assign a conserved energy in any Hamiltonian system in which the time does not explicitly appear in the Hamiltonian--> time translation being a symmetry of the Hamiltonian means that there is a conserved energy associated with that symmetry.  If time translation is a symmetry of the spacetime, you get a conserved energy in exactly the same way.
Secondly, you can have a surface in the spacetime (but not necessarily the whole spacetime) that has a conserved killing tangent vector.  Then, the argument from above still follows, but that energy is a charge living on that surface.  Since integrals over a surface can be converted to integrals over a bulk by Gauss's theorem, we can, in analogy with Gauss's Law, interpret these energies as the energy of the mass and energy inside the surface.  If the surface is conformal spacelike infinity of an asymptotically flat spacetime, this is the ADM Energy.  If it is conformal null infinity of an asymptotically flat spacetime, it is the Bondi energy.  You can associate similar charges with Isolated Horizons, as well, as they have null Killing vectors associated with them, and this is the basis of the quasi-local energies worked out by York and Brown amongst others.
What you can't have is a tensor quantity that is globally defined that one can easily associate with 'energy density' of the gravitational field, or define one of these energies for a general spacetime.  The reason for this is that one needs a time with which to associate a conserved quantity conjugate to time.  But if there is no unique way of specifying time, and especially no way to specify time in such a way that it generates some sort of symmetry, then there is no way to move forward with this procedure.  For this reason, a great many general spacetimes have quite pathological features.  Only a very small proprotion of known exact solutions to Einstein's Equation are believed to have much to do with physics.
Comment: Sorry I am nit-picky, but math-types would definitely define the Killing vector as ${\mathcal L}_{\xi}\, g = 0$ :-P
Comment: @jerry, added "small" in "only a very small proportion" ;-) Hopefully that's what you meant (maybe it was "tiny")
Comment: I should point out that the essential difference with E&M here is that, although the electromagnetic field is dyanmic, the hamiltonian of the E&M field still does not explicitly include time--it only includes time in the dependence of $\vec E$ and $\vec B$ on time.  This makes time translation a symmetry of its hamiltonian.  For a spacetime with no timelike or null killing vector, there is no vector that generates time translations in this way.  And with no such symmetry, there is no energy defined.
Comment: Heh.  Fair enough.  But they're equivalent if you have a metric-compatible connexion, and I didn't want to get into what the Lie Derivative was.
Answer: Energy conservation does work perfectly in general relativity. The overall Lagrangian is invariant under time translations and Noether's Theorem can be used to derive a non-trivial and exact conserved current for energy. The only thing that makes general relativity a little different from electromagnetism is that the time translation symmetry is part of a larger gauge symmetry so time is not absolute and can be chosen in many ways. However there is no problem with the derivation of conserved energy with respect to any given choice of time translation.
There is a long and interesting history to this problem. Einstein gave a valid formula for the energy in the gravitational field shortly after publishing general relativity. The mathematicians Hilbert and Klein did not like the coordinate dependence in Einstein's formulation and claimed it reduced to a trivial identity. They enlisted Noether to work out a general formalism for conservation laws and claimed that her work supported their view.
The debate continued for many years especially in the context of gravitational waves which some people claimed did not exist. They thought that the linearised solutions for gravitational waves were equivalent to flat space via co-ordinate transformations and that they carried no energy. At one point even Einstein doubted his own formalism, but later he returned to his original view that energy conservation holds up. The issue was finally resolved when exact non-linear gravitational wave solutions were found and it was shown that they do carry energy. Since then this has even been verified empirically to very high precision with the observation of the slowing down of binary pulsars in exact agreement with the predicted radiation of gravitational energy from the system.
The formula for energy in general relativity is usually given in terms of pseudo tensors such as those proposed by Laundau & Lifshitz, Dirac, Weinberg or Einstein himself. Wikipedia has a good article on these and how they confirm energy conservation. Although pseudotensors are mathematically rigorous objects which can be understood as sections of jet bundles, some people don't like their apparent co-ordinate dependence. There are other covariant approaches such as the Komar Superpotential or a more general formula of mine which gives the energy current in terms of the time translation vector $k^{\mu}$ as
$ J^{\mu}_G = \frac{1}{16\pi G} (k^{\mu}R - 2k^{\mu}\Lambda - 2{{k^{\alpha}}_{;\alpha}}^{\mu} + {{k^{\alpha}}_{;}}^{\mu}_{\alpha}+ {{k^{\mu}}_{;}}^{\alpha}_{\alpha})$
Despite these general formulations of energy conservation in general relativity there are some cosmologists who still take the view that energy conservation is only approximate or that it only works in special cases or that it reduces to a trivial identity. In each case these claims can be refuted either by studying the formulations I have referenced or by comparing the arguments given by these cosmologists with analogous situations in other gauge theories where conservation laws are accepted and follow analogous rules.
One area of particular contention is energy conservation in a homogeneous cosmology with cosmic radiation and a cosmological constant. Despite all the contrary claims, a valid formula for energy conservation in this case can be derived from the general methods and is given by this equation.
$ E = Mc^2 + \frac{\Gamma}{a} + \frac{\Lambda c^2}{\kappa}a^3 - \frac{3}{\kappa}\dot{a}^2a - Ka = 0$
$a(t)$ is the universal expansion factor as a funcrtion of time normalised to 1 at the current epoch.
$E$ is the total energy in an expanding region of volume $a(t)^3$. This always comes to zero in a perfectly homogeneous cosmology.
$M$ is the total mass of matter in the region
$c$ is the speed of light
$\Gamma$ is the density of cosmic radiation normalised to the current epoch
$\Lambda$ is the cosmological constant, thought to be positive.
$\kappa$ is the gravitational coupling constant
$K$ is a constant that is positive for spherical closed space, negative for hyperbolic space and zero for flat space.
The first two terms describe the energy in matter and radiation with the matter energy not changing and the radiation decreasing as the universe expands. Both are positive.
The third term is "dark energy" which is currently though to be positive and contributing about 75% of the non-gravitational energy, but this increases with time.
The final two terms represent the gravitational energy which is negative to balance the other terms.
This equation holds as a consequence of the well-known Friedmann cosmological equations, that come from the Einstein field equations, so it is in no sense trivial as some people have claimed it must be.
Comment: "there is no problem with the derivation of conserved energy with respect to any given choice of time translation." So for all choices of "time translation" energy is conserved. Where do that energy come from? As in what other energy is getting converted to "Dark Energy"?
Answer: o carry on with Jerry Schirmer, the Killing vector defines isometries on a manifold.  If there exists a Killing vector $K_t~=~\partial/\partial t$ this means the momentum $K_t\cdot P~=~$ constant.  This then is a statement which can be interpreted as the constancy of an observable labeled energy.  As a rule of thumb, if a metric component involves time in an explicit way, and for example $K_t~\propto~\sqrt{g_{tt}(t)}$ is not proper or the action of this vector is not an isometry.
This happens with the FLRW equation of cosmology.  In a de Sitter form we have
$$
ds^2~=~dt^2~-~e^{\sqrt{\Lambda/3}t}(dr^2~+~r^2d\Omega^2),
$$
which has a time dependency.  So we are not able to derive a conservation of energy from first principles.  The Ricci curvature is $R_{\mu\nu}~=~\Lambda g_{\mu\nu}$, and for $k~=~0$ the spatial curvature is zero.  The cosmological constant is dependent on the vacuum energy density, plus pressure terms.  With the equation of state $p~=~-\rho$, which approximates observational data pretty well, one can do some detailed balance work to show the universe is a net nothing and remains so.
Does this connects with something deeper than just a "detailed balance?  It might, and I suspect that Phillip's analysis connects with this.  The deSitter metric is a time dependent conformal theory of a flat metric.  For $g'~=~\Omega^2g$ the line element for $g'$
$$
ds^2~=~\Omega^2(du^2~-~d\sigma_{space}^2).
$$
However for the time variable $du^2~=~\Omega^{-2}dt^2$ $\Omega$ is time dependent and
$$
ds^2~=~dt^2~-~\Omega^2(t)d\sigma_{space}^2.
$$
This recovers the de Sitter metric for $\Omega^2(t)~=~exp(\sqrt{\Lambda/3}t)$.  The de Sitter spacetime is then conformally equivalent to a flat spacetime which trivially has a $K_t~=~\partial/\partial t$.  So the spacetime we observe with the equation of state $p~=~-\rho$ is a class of spacetimes which are conformal to flat spacetime and which also preserve $E~=~constant$. I think that Phillip's work on this matter projects out this special case of conformal spacetimes.


Excel hyperlink to a file-shortcut

Question: I have an Excel spreadsheet that contains a hyperlink to a (file-)shortcut to another Excel spreadsheet.
The shortcut is meant to easily change the target spreadsheet (roll over new versions for example).
When I click on the hyperlink Excel seems to be broken, it displays the hourglass, doesn't open the second spreadsheet, works partially then finishes by failing.
I use Excel 2016 from Office 365. Is this a known bug ?
Thanks
Comment: Do hyperlinks to other files / locations work? Does the file open correctly if you open it from its folder?
Comment: What error do you get?
Comment: Yes an hyperlink direct to the second excel spreadsheet works (the same spreadsheet the shortcut refers to): Excel opens the spreadsheet fine. Also I made tests using the C: drive to avoid any UNC / path related problems, so the issue occurs with all files in the C: drive. There is no error when I try the hyperlink to the shorcut, just Excel is not responsive for some time (like if it was busy), then you can edit the original spreadsheet, but after some time Excel just hangs .. like if the hyperlink opening was still processing in the background and never completing.
Comment: Indeed in our environment, I tested with all Excel 2010, 2013, 2016 and got the same result for all three
Comment: Try opening both spreadsheets first and then verify link works without issue.  IF it works, then may need to go into security center and enable external links
Answer: I just had this problem and happened to stumble on the solution.  Shortcut files have a hidden file extension, ".lnk" which you'll need to include at the end of the target filename.  That's it!

Excel hyperlink to a file-shortcut


Commuting matrices still commute if you conjugate one of them?

Question: If two square matrices, $A$ and $B$, of the same size and with complex entries commute, why does $\overline{A}$ (the complex conjugate of $A$) commute with $B$?  If this is not true, is it true if one is nilpotent?
Comment: This doesn't answer the question, but $\bar{A}$ commutes with $\bar{B}$ since $0=\bar{0}=\overline{AB-BA}=\bar{A}\bar{B}-\bar{B}\bar{A}$.
Answer: If $A$ commutes with $B$, then $\overline{A}$ commutes with $\overline{B}$.  If $B$ is real, then $\overline{B} = B$ and your claim is true.  However, this is not true in general.  For example, $A$ commutes with itself, but $A$ does not necessarily commute with $\overline{A}$.  For a nilpotent example, take $$A = \pmatrix{0&i&0\\0&0&1\\0&0&0}$$ and check that $A \overline{A} \ne \overline{A} A$.
What's going on: If $A$ commutes with $B$, and $v$ is an eigenvector of $B$ with eigenvalue $c$, then $B(Av) = A(Bv) = c(Av)$.  Thus $Av$, if it is nonzero, is another eigenvector of $B$ with the same eigenvalue $c$.  Now if you replace $A$ with $\overline{A}$, there is no reason to expect that $\overline{A} v$ will be an eigenvector of $B$ with eigenvalue $c$, just because $Av$ is.


C: GTK+ 3.0 (3.20) - Cross-Compile from GNU/Linux (Arch Linux) to Windows

Question: I need to cross-compile GTK+ application from GNU/Linux (Arch Linux) to Windows. I have already tried to use mingw32, but it does not see all libraries (including c's standard library!). So, I need to: find the standard libary; find all other (glib, gio, gtk, etc) libraries. But there's a problemm - I cannot find them. I also cannot compile from Windows. What must I do?
Answer: You can find the binaries for gtk 3 for windows on source forge or on http://win32builder.gnome.org/.
Once you have extracted them, you can follow this tutorial steps:
1) Install the compilation toolchain

Install the GCC compiler for Windows (namely MinGW, Arch Linux doc of package):
#pacman -S migw-w64
Download the latest all-in-one bundle ZIP archive directly from the official website (here's a direct link)
Adapt GTK+ to its location : In a terminal, move to the "gtk3-win32" folder you just created. For example: $cd /opt/gtk3-win32
then do :
find -name '*.pc' | while read pc; do sed -e "s@^prefix=.*@prefix=$PWD@" -i "$pc"; done

2) Compile

We will tell pkg-config to locate GTK+3 libraries in our custom path. If you extracted to /opt/gtk3-win32:
export PKG_CONFIG_PATH=/opt/gtk3-win32/lib/pkgconfig
We are ready to compile a sample C source ! Let's use a command in this style :
i586-mingw32msvc-gcc source.c -o executable.exe `pkg-config --cflags --libs gtk+-3.0

A new executable should have been created if everything went well.
It won't run on our Linux system, because it's targeting Windows !
3) Release

Create a folder containing the binary and the Windows .dll files. If you extracted to /opt/gtk3-win32:
mkdir ~/distri
cp executable.exe ~/distri
cp /opt/gtk3-win32/bin/*.dll ~/distri
Here we go ! Transfer this folder to a Windows box. Double-click on the executable and...
Comment: Good, but what if i need gtk3.20, not gtk 3.6? There's giant differences between them. Almost like gtk2 and gtk3
Comment: The latest version on source forge is 3.18. I am not sure 3.20 has been ported yet.
Comment: My current version: 3.20.9
Comment: Do you mean on Windows or on Linux? I have 3.20 on Linux but I am not sure it has been ported to Windows platform yet. I wouldn't be surprised if the Windows port was a good few month behind the Linux release.
Comment: On linux. (cts)
Answer: The following instructions are for gcc 5.3.0 (thread model: posix) and gtk+ 3.20.4
Install msys2 on windows
Install gtk3 files and copy the files
After installation, in msys2 shell
pacman -S mingw-w64-i686-gtk3

cd /mingw32
tar cfz c:/temp/mingw32.tar.gz

Ensure matching gcc version on Arch Linux
For gcc 5.3.0, edit /etc/pacman.conf
[core]
Server = https://archive.archlinux.org/repos/2016/05/10/$repo/os/$arch

[extra]
Server = https://archive.archlinux.org/repos/2016/05/10/$repo/os/$arch

[community]
Server = https://archive.archlinux.org/repos/2016/05/10/$repo/os/$arch

In case of upgrade
pacman -Syu

In case of downgrade
pacman -Syyuu

Later Arch Linux version seem to have gcc 6.1.1 that might be incompatible with msys2 gcc. A virtual machine might be a good idea for an Arch Linux installation that will not be upgraded (i.e. no security updates).
Copy files to linux
Unpack mingw32.tar.gz on linux, for example /opt/mingw32
Modify pkg-config files
perl -pi.bak -e 's,^prefix=.*,prefix=/opt/mingw32,' /opt/mingw32/lib/pkgconfig/*.pc

Set PKG_CONFIG_PATH
For example, before executing a configure script
export PKG_CONFIG_PATH=/opt/mingw32/lib/pkgconfig

Comment: I noticed that these gtk3 dll libraries depend on *libgcc_s_dw2-1.dll* i.e. the exception model is dw2. The compiler that comes with Arch Linux mingw-w64-gcc package has been built with option `--disable-dw2-exceptions`.
Comment: I don't have windows system


Word for an adjective of a group

Question: We have a word for an adjective of a country: demonym, but do we also have a word for the adjective of a group? For example, people who belong to reddit are redditers, and this is an adjective for the group of reddit.
Answer: There are actually two words that come to mind here. Both of these primarily refer to people in a culture, or geographical area, but can also refer to a non-geographical group as well.
The first is exonymn

a name used by foreigners for a place, as Florence for Firenze.
a name used by foreigners to refer to a people or social group that the group itself does not use, as Germans for Deutsche.

The second term is endonymn

a name used by natives for a place, as Bharat for India.
a name used by a group of people to refer to themselves, their region, or their language, as opposed to a name given to them by other groups.

However, there isn't a term that encompasses both of these meanings, nor a word that negates the geographical implication. Also, being modern linguistic constructions, these words aren't found in any major dictionary.
Comment: You've written endonym twice! But yeah, sounds like the word I'm looking for, if you take it out of geographical context
Comment: Oh yeah, let me change that

Word for an adjective of a group


Word or sentence to describe a process

Question: I am looking for a word or sentence to describe a process in formal terms. A process that is not an "Automated process" or "Manual Process" but somewhere in between. A word or sentence if you must, for example, a hand-operated process. Any ideas?
Answer: I think you can describe it as  a semi-automated  process:

partially automated.

(Dictionary.com)
Comment: @GeraldGray- Semi-manual, would be a less common option, or semi-automatic.
Comment: Any other word without sticking to Automated ?
Answer: A machine/software assisted    process ?
Answer: At your place I would write as below [1] Semi-Automated.
                           OR
[2]".. by use of some of both: brain and brawn;we mean hand and machine.
In fact at the end of day each item we make is made by hand.
If you asked me, we would say: Aren't machines made by man after all?"
Kindly let me have your feed back fast and oblige.
Did you like the suggestion? It will make me happy.
{ look for defn. of brawn below:
brawn  (brôn)
Share:
n.
1. Solid and well-developed muscles, especially of the arms and legs.
2. Muscular strength and power.
3. Chiefly British The meat of a boar.
4. Headcheese.
[Middle English, muscle, from Old French braon, meat, of Germanic origin; see bhreu- in the Appendix of Indo-European roots.]
The American Heritage® Dictionary of the English Language, Fifth Edition copyright ©2015 by Houghton Mifflin Harcourt Publishing Company. All rights reserved.}
https://ahdictionary.com/word/search.html?q=brawn&submit.x=23&submit.y=30
Comment: Hi @Abhilaaj. Welcome to ELU. As with all stackexchange sites, we are a question and answer site, not a discussion site. Hence a question should stand on its own and each answer should stand on its own. Answers should not have "chat" in them, or solicit responses. Hence please keep comments such as *"Kindly let me have your feed back fast and oblige. Did you like the suggestion? It will make me happy."* out of your posts.
Comment: Your answer [1] is no different from [Josh61's](http://english.stackexchange.com/a/305529/91730), and your answer [2] seems to be a long comment and not an actual suggestion for wording. Hence this answer isn't providing anything currently, in my opinion.
Comment: "Semi-Automated is a catchier word"? Catchier than what? Than Josh61's suggestion of "semi-automated"?
Comment: I beg to disagree.Semi- Automated is a catchier word. Let us await for compliance from the actual user. My answer is out of the box. Let us be receptive to creativity please.

Word or sentence to describe a process


Normal Matrix with Real Eigenvalues is Hermitian

Question: Let $A$ be a normal matrix. Then I want to show that, if $A$ has real eigenvalues, $A$ is Hermitian. (Notation: * denotes the complex conjugate, T denotes the transpose, and $\dagger$ denotes the conjugate transpose.)
Suppose that $A$ has only real eigenvalues and let $\lambda,v$ be a nonzero eigenvalue-eigenvector pair of $A$. Then we have
$\lambda(v,v)=(v,\lambda v)=(v,Av)=(A^\dagger v,v)$.
$\lambda(v,v)=\lambda^*(v,v)=(\lambda v,v)=(Av,v)$.
Thus, $(Av,v)=(A^\dagger v,v)$ and hence $\sum_i (Av)_i^*v_i=\sum_i (A^\dagger v)_i^* v_i$.
Write this as a matrix product: $(A^*v^*)^Tv=(A^{\dagger*}v^*)^Tv\implies (A^*v^*)^Tv-(A^{\dagger*}v^*)^Tv=0\implies ((A^*v^*)^T-(A^{\dagger*}v^*)^T)v=0$.
Since $v$ is nonzero, we have $(A^*v^*)^T-(A^{\dagger*}v^*)^T=0\implies A^*v^*-A^{\dagger*}v^*=0\implies (A^*-A^{\dagger*})v^*=0$
Since $v$ was nonzero, we have $v^*$ is also nonzero, so $(A^*-A^{\dagger*})=0\implies A^*=A^{\dagger*}$. Thus, we have $A=A^\dagger$ so $A$ is hermitian.
I've seen (here, for example) a much simpler proof. However, I can't find where I use that $A$ is normal, but I know that normality is required. Could anyone could point out where I made this assumption or where I've made a mistake?
Answer: You use the "fact" that if $(Bx,y)=0$ and $y\neq 0$, then $Bx =0$. You wrote it as
$$((A - A^\dagger) \nu, \nu ) = 0 \implies (A- A^\dagger) \nu = 0$$


Why don't flight recorders transmit only when they receive a ping?

Question: I was surprised that flight recorders only have enough battery to send out signals for 30 days. I'm guessing that it blindly sends out signals that help it to be located. But instead, why aren't they made to only send out a signal when they receive a ping? Surely, then, they could last for years?
Comment: How do you propose to power a *receiver* that is sensitive enough to "detect a ping" under several thousand meters of water "for years". With a battery, maybe? ...  ;)
Comment: @alephzero Receiving needs very little power. Surely it's more amazing how they can be located in the first place, given their limited battery to transmit
Answer: Think about it a bit: you'd need a monstrous piece of gear to be able to receive a ping from a distant source on a search platform. Transmitters are not the same as receivers.
  The primary design goal of the flight recorder assembly is crash survival.  Further, after 30 days, there's pretty much no chance of finding survivors (with the notable exception of the   Andes 1972 crash .  The world's a big place.  Aircraft occasionally disappear and are found years later pretty much by blind luck.  For that matter,  cargo ships sink all the time and even given their bulk and the theoretical ability to put a very large, long-lived beacon on them, they're not found either.
Comment: I disagree: you say it needs monstrous gear to receive a ping. The ping it receives could be sent from a search vessel at a high power. Receiving needs little power or size. The difficulty is surely getting the box to transmit at a high enough power. An aside: I read they are now planning to extend it to 90 days given Malaysia 370. While lives may not be saved immediately, it will help to improve future safety knowing what went wrong
Comment: "For that matter, cargo ships sink all the time..." Actually very *few* ships are now "lost at sea" compared with the number of sinkings and other accidents. This is not really surprising, since all cargo ships of more than 300 tons gross tonnage (and all passenger ships of any size) must be fitted with the AIS automatic tracking system - which also tells the ship's own crew where they are and what other ships are close enough to be a safety hazard. https://en.wikipedia.org/wiki/Automatic_identification_system. Of course AIS can be deliberately switched off - but that's a different issue.
Comment: @Jodes making the receiver survive the crash is also a problem all on its own.
Answer: An ELT or Emergency Locator Transmitter is built to be a reliable emergency device to locate a wrecked aircraft relatively quickly by satellite and ground triangulation. The goal of locating the aircraft is to save human lives; so 30 days is usually sufficient. Finding remains and satisfying people's curiosity is not part of the current design criteria.
Transmitting on an interval is the most reliable method, as it starts transmitting on the emergency frequency as soon as a plane goes down; not when someone decides to start looking for it. Satellites and ground towers are always listening on this frequency and will triangulate the signal as quickly as possible. Think of it like your house is on fire and you are trapped inside. You would yell "help, help, help" loudly and continuously instead of listening at the door for bystanders before you yell.
To extend the amount of time an ELT signal lasts could be done by:

 Adding a larger battery (obviously)
 After the 30 days go into a "Marco Polo" mode, waiting to receive a signal before transmitting like you mentioned. Remember it still takes some power to listen.
 After the 30 days decrease how often the signal is transmitted logarithmically. If the ELT synchronized with the aircraft clock it could emit signals at predictable times so that search personnel would be ready to listen. This would allow for very very low power use during the waiting period.
 Adding water pressure sensing capability to the unit so that it only sends sonar pulses after being submerged to a certain depth.
 Adding multiple directional antennas instead of an omnidirectional antenna. Sensors in the unit could fire the antennas that are not pointed at the ground increasing signal strength and reducing power consumption.
Comment: I'm not sure I agree with the statement "satisfying people's curiosity is not part of the current design criteria."  I think the purpose of flight data recorders and cockpit voice recorders is to satisfy our curiosity about why the plane crashed, so changes can be made to prevent it from happening again.


Archaeological findings of events in the Torah or Neviim Rishonim

Question: I am looking for archaeological findings that support what is written in the Torah or Neviim Rishonim. I am looking for non-sensational findings that are agreed upon by the general scientific community.Also, I am not necessarily looking for confirmation of miracles but just a confirmation of any the events, people or objects mentioned.
Comment: https://en.wikipedia.org/wiki/List_of_artifacts_in_biblical_archaeology
Comment: @nbubis Not always
Comment: see also [this question](https://judaism.stackexchange.com/q/87121/11501) and my answer there
Comment: I've voted to close as too broad.
Comment: You might find the [Cyrus Cylinder](https://en.wikipedia.org/wiki/Cyrus_Cylinder) of particular interest, as well as [Sennacherib's Annals](https://en.wikipedia.org/wiki/Sennacherib%27s_Annals).
Comment: You are aware that the archeological findings clearly contradict the Torah, yes?
Comment: [This book](http://a.co/6OvKvpw) came highly recommended but I haven't read it yet
Answer: Biblical Archaeology Review has a list of 53 people that archaeology has confirmed in the bible. All of these are things that are generally agreed upon by the scientific community (although just as with any community of people, there are always some outliers in every direction). It includes ketuvim too so it's a little broader than your question in that sense. The full article at BAR contains details on all of these. Here is the list:
Egypt
1   Shishak (= Sheshonq I)  pharaoh 945–924 1 Kings 11:40, etc.
2   So (= Osorkon IV)   pharaoh 730–715 2 Kings 17:4
3   Tirhakah (= Taharqa)    pharaoh 690–664 2 Kings 19:9, etc
4   Necho II (= Neco II)    pharaoh 610–595 2 Chronicles 35:20, etc.
5   Hophra (= Apries)   pharaoh 589–570 Jeremiah 44:30
Moab
6   Mesha   king    early to mid-ninth century  2 Kings 3:4–27
Aram-Damascus
7   Hadadezer   king    early ninth century to 844/842  1 Kings 11:23, etc.
8   Ben-hadad, son of Hadadezer king    844/842 2 Kings 6:24, etc.
9   Hazael  king    844/842–c. 800  1 Kings 19:15, etc.
10  Ben-hadad, son of Hazael    king    early eighth century    2 Kings 13:3, etc.
11  Rezin   king    mid-eighth century to 732   2 Kings 15:37, etc.
Northern Kingdom
12  Omri    king    884–873 1 Kings 16:16, etc.
13  Ahab    king    873–852 1 Kings 16:28, etc.
14  Jehu    king    842/841–815/814 1 Kings 19:16, etc.
15  Joash (= Jehoash)   king    805–790 2 Kings 13:9, etc.
16  Jeroboam II king    790–750/749 2 Kings 13:13, etc.
17  Menahem king    749–738 2 Kings 15:14, etc.
18  Pekah   king    750(?)–732/731  2 Kings 15:25, etc.
19  Hoshea  king    732/731–722 2 Kings 15:30, etc.
20  Sanballat "I"   governor of Samaria under Persian rule  c. mid-fifth century    Nehemiah 2:10, etc.
Southern Kingdom
21  David   king    c. 1010–970 1 Samuel 16:13, etc.
22  Uzziah (= Azariah)  king    788/787–736/735 2 Kings 14:21, etc.
23  Ahaz (= Jehoahaz)   king    742/741–726 2 Kings 15:38, etc.
24  Hezekiah    king    726–697/696 2 Kings 16:20, etc.
25  Manasseh    king    697/696–642/641 2 Kings 20:21, etc.
26  Hilkiah high priest during Josiah's reign   within 640/639–609  2 Kings 22:4, etc.
27  Shaphan scribe during Josiah's reign    within 640/639–609  2 Kings 22:3, etc.
28  Azariah high priest during Josiah's reign   within 640/639–609  1 Chronicles 5:39, etc.
29  Gemariah    official during Jehoiakim's reign   within 609–598  Jeremiah 36:10, etc.
30  Jehoiachin (= Jeconiah = Coniah)    king    598–597 2 Kings 24:6, etc.
31  Shelemiah   father of Jehucal the royal official    late seventh century    Jeremiah 37:3, etc.
32  Jehucal (= Jucal)   official during Zedekiah's reign    within 597–586  Jeremiah 37:3, etc.
33  Pashhur father of Gedaliah the royal official   late seventh century    Jeremiah 38:1
34  Gedaliah    official during Zedekiah's reign    within 597–586  Jeremiah 38:1
Assyria
35  Tiglath-pileser III (= Pul) king    744–727 2 Kings 15:19, etc.
36  Shalmaneser V   king    726–722 2 Kings 17:3, etc.
37  Sargon II   king    721–705 Isaiah 20:1
38  Sennacherib king    704–681 2 Kings 18:13, etc.
39  Adrammelech (= Ardamullissu = Arad-mullissu)    son and assassin of Sennacherib early seventh century   2 Kings 19:37, etc.
40  Esarhaddon  king    680–669 2 Kings 19:37, etc.
Babylon
41  Merodach-baladan II king    721–710 and 703 2 Kings 20:12, etc.
42  Nebuchadnezzar II   king    604–562 2 Kings 24:1, etc.
43  Nebo-sarsekim   official of Nebuchadnezzar II   early sixth century Jeremiah 39:3
44  Nergal-sharezer officer of Nebuchadnezzar II    early sixth century Jeremiah 39:3
45  Nebuzaradan a chief officer of Nebuchadnezzar II    early sixth century 2 Kings 25:8, etc. & Jeremiah 39:9, etc.
46  Evil-merodach (= Awel Marduk = Amel Marduk) king    561–560 2 Kings 25:27, etc.
47  Belshazzar  son and co-regent of Nabonidus  c. 543?–540 Daniel 5:1, etc.
Persia
48  Cyrus II (= Cyrus the Great)    king    559–530 2 Chronicles 36:22, etc.
49  Darius I (= Darius the Great)   king    520–486 Ezra 4:5, etc.
50  Tattenai    provincial governor of Trans-Euphrates  late sixth to early fifth century   Ezra 5:3, etc.
51  Xerxes I (= Ahasuerus)  king    486–465 Esther 1:1, etc.
52  Artaxerxes I Longimanus king    465-425/424 Ezra 4:7, etc.
53  Darius II Nothus    king    425/424-405/404 Nehemiah 12:22
Comment: There's also https://en.wikipedia.org/wiki/Baruch_ben_Neriah#Historicity though that's a bit controversial.
Answer: As a general rule, you find plenty archaeological evidence in the Bible for events which were written down by authors that lived near the time of the events, though the evidence sometimes shows that the the biblical authors "fixed" the historical story to match their ideology. As the date of authorship becomes farther away from the date in which the events described happened, evidence becomes scarce, and the evidence found at times contradicts the story entirely.
Here are some key examples:
The Exodus
Whatever traditions the exodus story is based on, archaeological evidence shows that Egypt was in fact the ruler of Canaan during the 14th century BC, and that no mass changes to the population (600,000 men plus their families would have constituted around half the population of Egypt at that time) seem to have happened. Cities and nations mentioned by name in Exodus are known to have only existed many hundreds of years later, Camel's are known not to have brought to Egypt until many hundreds of years later, as well as many other issues. In short, here the archaeological evidence clearly dismisses the biblical story, and indeed, we're talking about some 700 years before the reign of Josiah.
David and Solomon's Kingdom
There is no real archaeological evidence for the large united kingdom of David and Solomon large kingdom described in the Bible, with a lack of large structures and inhabited sites that would be required in such a kingdom. The earliest evidence we have for David is from the Tel Dan Stele which only mentioned the "House of David", not David himself. In short, at the very least, no real evidence.
Kings of Israel
The Omrides are mentioned in multiple archaeological findings, with the defeat of Joram son of Ahab mentioned in the Mesha Stele.
Assyrian siege of Jerusalem
The famous Assyrian clay prisms describe Sennacherib's siege on Jerusalem, and agree with most biblical details, other than the miracle described in the bible, where 185,000 of Sennacherib's troops perished overnight.
Comment: It's not what I want. It's what the OP wants. A request was made for proof to one side of an argument. The major thrust of this answer seems to be an attempt to prove the opposing view. It's not a matter of intellectual honesty or religious doctrine. It's a matter of answering with an appropriate answer.
Comment: This doesn't answer the question. The request was for confirmation, not contradiction.
Comment: @user6591 - There three confirming examples in my answer. Do you want more, or do you just want a an answer that ignores the stuff that contradicts certain beliefs?
Comment: Actually, I remember some articles that showed that the timeline that denies the tanach statements (such as Yehoshuah or the kingdoms of Dovid and Shlomo) were actually off because of the assumptions as to what period the items found actually should be assigned to. Thus, the assumption of a period *belonging* to the kingdoms of Dovid and Shloo were placed in an area were there were no indications. Indications of major populations and economic activity were assumed to be Cannanite and destructions caused by the entry of Bnai Yisrael were assumed to be either earlier or later.


Draw border around a Canvas

Question: I'm in the process of coding an application that (essentially) mimics MS Paint; you can select the Pencil tool, and draw a line with a stroke of 3; you can select the Marker tool and draw a line with a stroke of 7, etc.
I wanted to have a border drawn around my Canvas. This is simple, yes. However, with other methods I have, the only way I can think to implement this revolves around a lot of spot-checking after the border is drawn. Is there an efficient way to do this without conflicting with the stroke/color of the already selected Tool?
Here is the drawBorder() method:
private void drawBorder(GraphicsContext g) {
    final double canvasWidth = g.getCanvas().getWidth();
    final double canvasHeight = g.getCanvas().getHeight();

    g.setStroke(Color.BLACK);
    g.setLineWidth(4);
    g.strokeRect(0, 0, canvasWidth, canvasHeight);

    //sets the color back to the currently selected ColorPicker color
    g.setStroke(selectedColor);
}

However, this code will conflict with my clear() action
clearTool.setOnAction(e -> {
            graphics.clearRect(0, 0,
                canvas.getWidth(), canvas.getHeight());
            drawBorder(graphics);
        });

because after the clearing of the Canvas, the stroke line width will be 4. This is an issue because if I had the pencil tool as the selected tool (stroke linewidth of 3), it will be 4 until I select another tool and switch back to the pencil tool; furthermore, the same concept applies if I had the marker tool selected at the time of pressing the clear button (stroke linewidth of 7 will be 4 until I select another tool and then reselect the marker tool).
I'm trying to avoid having to set a check for each tool, and have it reset the stroke's linewidth each and every time--while that would work, it seems convoluted.
Answer: Consider putting the canvas in a pane, and using CSS to style the pane. For example:
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class CanvasWithBorderExample extends Application {

    @Override
    public void start(Stage primaryStage) {

        final int SIZE = 400 ;
        Canvas canvas = new Canvas(SIZE, SIZE);

        GraphicsContext gc = canvas.getGraphicsContext2D() ;
        gc.setStroke(Color.RED);
        gc.moveTo(0, 0);
        gc.lineTo(SIZE, SIZE);
        gc.stroke();

        StackPane canvasContainer = new StackPane(canvas);
        canvasContainer.getStyleClass().add("canvas");

        VBox root = new VBox(10, canvasContainer, new Button("Click here"));
        root.setFillWidth(false);
        VBox.setVgrow(canvasContainer, Priority.NEVER);
        root.setAlignment(Pos.CENTER);

        Scene scene = new Scene(root);
        scene.getStylesheets().add("canvas-with-border.css");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

with canvas-with-border.css:
.canvas {
    -fx-background-color: antiquewhite, white ;
    -fx-background-insets: 0, 20 ;
    -fx-padding: 20 ;
}

Answer: EDIT: I was to quick to apply Swing Canvas knowledge to JavaFX. If you use a resizable Canvas in JavaFX, you will still need to do it as described below.
If not, I would probably use a layer approach as described in the Java tutorial by Oracle.

If I understand you correctly, then it appears to me you have an incorrect approach. I am assuming you are drawing into the Canvas directly when the user draws his pencil, for example. This is not correct.
The Canvas can ask you to redraw it at any time, and you must be prepared for that.
That is, do the user drawings in an off-screen GraphicsContext, with its own settings that you can keep in line with the tools the user selects.
Then, in your Canvas paint() method, copy the contents of that context to the Canvas. At that time you can also add your own border or other annotations if you like.
It could be that you already use off-screen drawing and would like to draw your border into the off-screen buffer (for example due to an "add border" action from the user). Then have a look at the save() and restore() methods of GraphicsContext. They enable to save the state, change your settings, do the drawing, and then restore the old state.
Comment: There is no `Canvas.paint()` method in JavaFX.
Comment: @James_D Ah, my mistake. Adapted the answer.
Comment: Is there anywhere I can see an example of this?

Draw border around a Canvas


How Zero Knowledge Proof enables Privacy By Design

Question: How does Zero Knowledge Proof (ZKP) enable Privacy By Design?
Comment: All data that the verifier receives can be perfectly simulated, i.e., the verifier can generate all the elements that the prover send by himself, so these elements leak no information...But i think this is a very basic question, and I think you can easily find several posts and lecture notes that explain this point, I am not sure that this requires a new topic here. For instance: https://www.cs.princeton.edu/courses/archive/fall07/cos433/lec15.pdf
Answer: I got some information about zero knowledge proof which is shared below:
Zero Knowledge Proofs enable a way to share validated data with a third party without actually sharing the data itself. This is a fascinating concept, as intuitively it takes a little time to wrap one's mind around the fact that you can share sensitive information without actually sharing sensitive information.
Zero-knowledge proofs work in the following way: If I would like to prove something to someone (let's say Person A), I generally would need to have a piece of evidence that backs up my claim to Person A, who is trying to verify my claim. Zero-knowledge proofs create an irrefutable way to prove that I have evidence to back up my claim, by sharing a proof instead of the evidence with a verifier that can be used to validate my claim. Using a zero-knowledge proof, I do not actually need to share any information/data, but a cryptographic proof (that does not leak any data) to prove my claim to Person A. Zero-Knowledge Proofs effectively provide a riskless way to share data (assuming we trust the process of setup that creates the proof).
There are countless ways that we can use Zero-Knowledge Proofs to protect our data. One way that has not been widely discussed in realistic terms and that solves two big problems is calling into call centers. Suppose Alice needs to call her bank to initiate a transfer from one of her bank accounts to another bank account. Wouldn't it be great if when Alice called the bank, instead of going through a process of answering questions about herself to verify her identity (account number, social security number, address, mother's maiden name), Alice could send a cryptographic proof from her mobile phone to the bank that automatically authenticates her identity. That would save time, and increase privacy.
A Zero-Knowledge Proof enables one party (Alice the prover) to prove to another party (Bob the verifier, the call center agent) that Alice can prove that Bob is speaking with Alice (Alice is looking to prove her identity). All this occurs without revealing any of Alice's private and sensitive information while proving that Alice is in fact Alice.
Typically, the way Bob would believe that Alice is Alice, is to ask Alice questions about herself to prove to Bob that Alice is in fact Alice (ex: What is your address, social security number, mother's maiden name, etc.). However, this relies on sharing information, which can be costly as well as become a reputation risk if the data is leaked through the bank's computer system and shared with unauthorized third parties.
There is a form of a zero-knowledge proof called a zk-SNARK (Zero-Knowledge Succinct Non-Interactive ARgument of Knowledge) that can be used to satisfy the condition of proving Alice is Alice with 100% certainty and without revealing any more information than the cryptographic proof generated from the zk-SNARK. A key element in the zk-SNARK is the non-interactive element: there only needs to be one set of data that is shared with Alice's Bank, hence there is no interaction between Bob and Alice where they exchange sensitive and private information to prove Alice's identity. Remember: the cryptographic proof shared cannot be linked to the data that was put into the creation of the proof. This means that if Alice provides her social security number to the Zero-Knowledge Proof program, she can be 100% confident the verifier (Alice's Bank) will not be able to derive her social security number from the proof Alice provides. Utilization of zk-SNARKs start us on a path where we can retain ownership of our data by simply not sharing sensitive data any longer, thus significantly increasing privacy, and significantly reducing risk for organizations.


Cannot authenticate to 10.6 server

Question: I have an OS X 10.6. server that I have created 400 users accounts on. It is configured as an Open Directory Master - Home Accounts were created with LDAP and can I see the Home Accounts on the share - but cannot login with the created usernames. It is a fairly simple setup in that the users only need to connect via AFP for simple file transfers. I have other OS X servers that are Stand Alone, and do not rely on LDAP. Perhaps there is something basic I have missed in setting up the accounts?
Comment: We need much more details here: How exactly did you configure your users, your shares and your clients? Did you create the users with Workgroup Manaager or with some other LDAP tool? What kind of error message do you get when you try to login? Are there any log messages?
Comment: I used Passenger to mass import - then set home directories with WGM.  I can login with the admin account created during install as well as the diradmin account. Not in front of client right now, but I believe the message was indicating the password was incorrect.
Answer: I don't know Passenger (what is it?), but it's likely you haven't created all necessary LDAP attributes and password server/Kerberos entries when importing your users.
Open Directory needs a set of Apple specific attributes to work correctly, so maybe try if everything works if you create a user from scratch in WGM.
Answer: Do you have service access control turned on? 10.6 server turns this on if you use the "Create Users and Groups" option in the initial setup.  You can check and adjust it in Server Admin -> server name in sidebar -> Access in the toolbar -> Services tab below that -> AFP service in the list below that.  You can either add users and/or groups to the access list, or just enable the service for all users & groups (that option is above the list on the right).

Cannot authenticate to 10.6 server


Recipe for Imperial Red Ale?

Question: If I want to make a red ale in the vein of Lagunitas's Imperial Red, Dry Hopped St. Rogue Red, or Green Flash Hop Head Red. Anyone have any recipes for me? I'm not looking for a traditional Irish red.
Comment: This question is a little too broad.
Comment: Not ignoring you, just don't have anything to share with you.
Comment: Not ignoring your question, I just don't have anything like this to share!
Comment: Also interested, after I thought about the idea for a while :)
Comment: Cleaning up tags: Changed redale to red-ale
Answer: There are two that come to mind. The first is Jamil's Evil Twin, which is available in his book Brewing Classic Styles.  The second one is Fire in the Hole, available in both extract and all-grain versions from Morebeer.com.  I've brewed it, and found it to be very close to Lagunitas' Imperial Red, Pizza Port's Shark Attack, and Pike's Tandem Double -- all delicious Imperial Reds.  The only adjustment I would make to the Fire in the Hole recipe is to delete the oak chips -- it tastes fine, but none of the 3 I mentioned use oak.  See my version and recipe at http://huningtonsachsbrauerei.blogspot.com/2009/11/firebreaks.html  It's a mini-mash/extract version.
Comment: This looks good, and this is the answer I would probably select, unfortunately I can't figure out how to get into the somehow unregistered WhatsBillDoing account that I asked this question under.
Answer: This seems like a recipe that might work. The IBUs are about right, and the grain bill looks solid. I'll have to experiment to see if I can convert it into a mash-extract recipe.
[http://www.brewtility.com/ViewRecipe.aspx?recipeID=3][1]
Oddly, I'm answering my own question through a different account of the same name. Splendid.
Comment: Be sure to post if you get it converted to an extract recipe.

Recipe for Imperial Red Ale?


Progress Bar gem or plugin for Rails 3 that uses jquery

Question: Does anyone know of a progress bar gem, plugin, or tutorial that will asynchronously allow updating a progress bar from a controller? I do not want to use prototype or JRails. The  part of the DOM that I want to refresh is not in a form. I need to be able to refresh the progress bar as the Rails control performs several tasks called within a loop. I want to refresh the progress bar after each task is executed in the loop. I know how to create the progress bar in the specific  tag in document. I just do not know what event to use or how to repeatedly call that event so the progress bar refreshes the progress indication.
Answer: Take a look at this. http://blog.bitcrowd.net/uploadify-paperclip-rails-3-and-sessions/
There is no one solution for it. But a lot of older solutions will also work.
Answer: Maybe this gem is what you are looking for:
https://github.com/yrgoldteeth/css3-progress-bar-rails