How do you get a dragon head in Minecraft?

Question: How do you get a dragon head in the Minecraft (survival mode)? I really need help! Thanks!
Answer: You can find Dragon Heads on End Ships.
How to locate an End Ship
After you kill the ender dragon, you might spot two clusters of bedrock with a portal in the center off the edge of the island- these lead to the outer islands of the End.  The portals look like this:

It's extremely hard to get in them, as you can see the gap for the portal is only one block tall (use of an ender pearl is recommended!).  If you can't, the outer islands are ~1000 meters away from the central island, so lots of stacks of some easy-to-obtain block like dirt or cobblestone could get you there too.  Also, you can make a flying machine., make it go outwards from the islands, and AFK for a few minutes. The outer islands look like this:

As you can see, there are many dips in between the islands, you'll need a lot of blocks.  Eventually, you'll come across this:

which is an End City.  Up in the air, you might see an end ship:

On the very front, you'll see a Dragon Head...Feather Falling is extremely recommended!
Thank you for the suggestions, commenters!
Comment: "It's extremely hard to get in them", uuhm, throw an ender pearl in it?
Comment: use slimeblock and piston flying machine. and go AFK for few minutes
Comment: True, I mean other methods.  Though you don't want to obtain the ender pearls in the end, since you'll have an Endermen swarm chasing you...
Comment: @Fennekin Should have thought of that, I'll add that...
Comment: "It's extremely hard to get in them": It's unbreakable bedrock. The only way to get in them is to break the bedrock in creative or throw and enderpearl.
Answer: According to the wiki, dragon heads will generate on End Ships. To quote:

A dragon head can also be seen at the bow of the ship, making this currently the only natural way to obtain the beast's head.

End Ships can be found in an End City, which randomly generate on outer Islands in the End. To quote:

End cities naturally and randomly generate in the outer islands of the End, which are accessible via the end gateway portal that generates after killing the ender dragon. They are fairly rare; one can travel for thousands of blocks without encountering a city.
Comment: @sallyherring if the answer helps you, click the check mark. This will help people with the same problem find an answer faster
Comment: where is the ship??
Comment: @sallyherring I have edited the answer to include where to find End Ships and End Cities.
Comment: happy to help :)
Answer: I found a dragon head on the very very edge of the end ship. I had to put blocks underneath it in order to catch it. check everywhere!
Answer: After you beat the ender dragon there will be a thing floating in the sky that has a small portal in it ender pearl to it then you will be on a new island find a end city there should be a pirate ship very close to it at the front of the ship you will find the head it will be where the mermaid should be floating.


how to distribute a web(webapp) with chromium as a single package?

Question: My product is a website with some advanced feature that needs chromium.
As a alternative way for the customers do not want to / know how to download the latest chromium, I want to distribute the website with a chromium.
I want to know:

how to package a portable chromium with a correct shortcut of the web application.
how to compile a own version of chromium that only for my website(web app).

In my own opinion the solutions to the two questions are:

use a bat or install script (NSIS etc.) to install the chromium and generate the correct application shortcut.
follow the chromium dev instructions to fetch the source code and compile it. And add auto-open-my-app function as well as hiding the tab bar / address bar.

I still want to know better answer.
I remember that there is a project called Prism which is introduced by firefox, is there any equvilent for chromium?
Answer: You can dig into several projects that aim to do just that:

Atom Shell (now called electronjs)
Node Webkit
Chromium embedded framework


How can I align the tilt of a curve to that of the nearest surface normal of a mesh?

Question: I guess my question is the same as the one asked here:
How can I align the tilt of a GN generated curve to the nearest surface normal of a target? Although the answer that the op posted appears not to be quite working (not sure what  it does, but it certainly does not align the curve to the surface normals of the mesh)?
Basically I have a curve, that in my case is "shrinkwrapped" (using proximity node) onto a mesh, what Im looking to do is then have a quad strip array along that curve angled along the face normal of the mesh its "shrinkwrapped" onto.
Ive made some progress already based on answers Ive found here on stackexchange, but I cant quite figure out how to control the tilt of the curve so that it matches that of the face normal. Any help appreciated.
This is the blend file Im working with in caes anyone wanna solve the puzzle directly in place, Ive pointed an arrow to a node group that would ideally be modified to become functional):
Answer: I recently used this setup to align a curve to the surface of a mesh:
It samples the surface normal at each control point and rotates the current normal to the projected mesh normal. Hope this still helps!


How can I create a text-message like system with very low latency?

Question: I am creating an app with PhoneGap, which needs to act kind of like a texting app. The problem I am having is with latency, and data usage. I have tried polling, but its to slow and used to much data, websockets, but AppFog doesn't support them, i have also tried others but none seem to work. How would a text-message like system this be best accomplished with a PhoneGap app, javascript, and any type of backend(currently using node, but can change)? Also how can a PhoneGap app get notifications while in the background?
Answer: There is a Phonegap plugin for push notifications on Android (you didn't say which platforms your app was intended for...), and I think also one for iOS.
Socket.io is a great library that uses websockets if possible, but will fall back to Ajax long polling if necessary. That should avoid the data usage problem of repeated polling. Having a connection open for minutes or hours probably isn't going to work, though.
You'll probably have to blend the two approaches. When the user is in the app, use socket.io to achieve low latency when they're actually watching. When the user is not in the app, you can afford the small amount of extra latency required to do push notifications, since they won't know that the person actually sent the message twenty seconds ago.


Quotient map-torus

Question: Let $e_{1},e_{2}$ be a frame of $\mathbb{R}^{2}$. $G=(ne_{1}+me_{2} : n,m \in \mathbb{Z})$ be a subgroup acting on $\mathbb{R}^{2}$ by translation.Show that the quotient map
$\pi :\mathbb{R}^{2}\to\mathbb{R}^{2}/G$ is locally bijective.
Answer: Let $x\in\mathbb{R}^2$ be arbitrary. Pick a neighbourhood $U$ of $x$ such that $|U\cap\mathbb{Z}^2|\le 1$. Then $\pi\left|_U\right.$ is bijective onto its image, since every $y\in U$ maps to a different equivalence class in $\mathbb{R}^2/G$.

Quotient map-torus


Why Mac and iPhone sent message are separated?

Question: I am logged in on Mac and iPhone to my iCloud account. When I am sending message from them, receiver has two different conversation from different sources / devices. Why?
Answer: You can send messages from different phone numbers and email addresses linked to your Apple ID. You can check those under:

(on iOS) Settings.app -> Messages -> Send & Receive
(on macOS) Messages.app -> "⌘," (Preferences) -> iMessage tab

If you are sending from different addresses and the receiver does not have both addresses saved in the same contact they will definitely show up as separate conversations.


Grouped, Bundled or other?

Question: I am trying to create an offer for some tshirts. So basically I want to sell 5 tshirts for a certain price. The trouble i'm having is that when the items are added to the basket the amount is adding up to the price I want to sell the 5 tshirts for X5, so basically if i want to sell 5 tshirts for £15 its charging £75 as it's adding them all altogether. I've tried the Group and Bundle options, I've made sure the simple products (sizes and colours) are set to £0.00 but no luck, is it possible to do this without a plugin?
Answer: Set a tier price for the simple product of $3 for five or more, or create a promotional price rule to apply a similar discount.
Another alternative: create a simple product for your "five shirts" bundle at the desired price.
Answer: If you want a separate product page for the bundle, use a bundled product, but when creating it, choose "Price type = Fixed". Then you can specify one price for the bundle, independent of the options.
Associate the simple products for the T-Shirts and set the selection qty to "User defined = no". You can still associate different variations of the T-Shirts so that the user can choose like this:
<code>5x [ Red T-Shirt S     v]       (dropdown)
     Red T-Shirt M
     Red T-Shirt L
     Blue T-Shirt S
     Blue T-Shirt M
     Blue T-Shirt L
</code>

Grouped, Bundled or other?


How to construct a multi-control quantum gate whose control bit relation is XOR?

Question: So far, the control bits of most control gates have an AND relationship. How to construct a quantum gate whose control bits are XOR with the fewest auxiliary qubits? And then generalize it, is it possible to realize multi-control quantum gates of arbitrary control logic with different relationships?
Answer: I think what you are asking for is a block unitary matrix. To be concrete I'll discuss a three-qubit case, the generalization is straightforward. Consider $$U=|00\rangle\langle00|\otimes U_{00}+|01\rangle\langle01|\otimes U_{01}+|10\rangle\langle10|\otimes U_{10}+|11\rangle\langle11|\otimes U_{11}$$ or, in matrix representation
$$
U=\begin{pmatrix}U_{00}&0&0&0\\0&U_{01}&0&0\\0&0&U_{10}&0\\0&0&0&U_{11}\end{pmatrix}
$$
where $U_{00}-U_{11}$ are $2\times2$ matrices.
So, the matrix $U_{00}$ is applied to the last qubit if the first two are in the state $|00\rangle$, $U_{01}$ is applied when the control qubits are in the state $|01\rangle$ etc. Using these block unitaries, you can realize your arbitrary control logic.
The case when $U_{00}=U_{10}=U_{01}=\mathbb{1}$ and $U_{11}=V$ is the standard controlled-$V$ on the last qubit.
$$
U=\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&V\end{pmatrix}
$$
To insert $V$ at another place, say at $|01\rangle\langle01|$ you just need to swap $|01\rangle$ and $|11\rangle$. This is easy, since $|01\rangle=X_0 |11\rangle$. Explicitly, start with a standard
$$C^2V=|11\rangle\langle11|\otimes V+(1-|11\rangle\langle11|)\otimes 1$$
and conjugate it with $X_0$ to get
$$X_0C^2VX_0=|01\rangle\langle01|\otimes V+(1-|01\rangle\langle01|)\otimes 1=\begin{pmatrix}1&0&0&0\\0&V&0&0\\0&0&1&0\\0&0&0&1\end{pmatrix}$$
General block unitary can be constructed as a product of these simpler ones with only a single control state. This method uses no extra ancilla qubits. Note however that it may be very inefficient in terms of depth/gate counts.
Comment: It's really cool theory, and the whole thing looks very straightforward and concise. I don't know if there is any relevant literature for this theory. The direct construction of the U operator you discussed opened my mind, and I will also think about the idea in practice, which may be a useful research. Also Qiskit seems to be able to set the Uniray matrix directly, I will do a verification on it.


Updating a Calender Event using MsGraph sets the wrong Timezone in Start end End properties

Question: I'm creating code to add and update calender events to a specific user outlook calender using MsGraph in C#.
I have created a class "CalenderEvent" which contains the properties I need to add/update the event. The start and end property are defined like
internal class EventDateTime
{
   public string DateTime { get; set; }
   public string TimeZone { get; set; }
}

Adding an Event will fill CalenderEvent in a function and returns a StringContent like
var data = new CalendarEvent();
data.Subject = subject;
data.Body = new Body
{
    ContentType = "text",
    Content = description
};
data.BodyPreview = string.IsNullOrEmpty(description) ? "" : description.Length > 15 ? description.Substring(0, 15) : description;
data.Start = new EventDateTime
{
    DateTime = $"{startDate.Date.Add(startTime.TimeOfDay):O}",
    TimeZone = "W. Europe Standard Time"
};
data.End = new EventDateTime
{
     DateTime = $"{startDate.Date.Add(startTime.TimeOfDay).AddMinutes(duration):O}",
     TimeZone = "W. Europe Standard Time"
};
data.Sensitivity = "normal";
data.Importance = "normal";

string eventAsJson = JsonConvert.SerializeObject(data);
var content = new StringContent(eventAsJson);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
content.Headers.Add("Prefer", "outlook.timezone=\"W. Europe Standard Time\"");

As you can see I'm using the 'W. Europe Standard Time'
To add the event to Outlook I make a call through the httpClient
var task = $"users/{outlookUser.Id}/calendar/events";
var content = FillEventData(activity);
var resultToProcess = GetMsGraph(GetConfidentialClientApplication()).CallPost(task, content);

GetMsGraph and GetConfidentialClientApplication are function to get a proper connection to MsGraph.
CallPost will execute the task, with the content like:
var response = HttpClient.PostAsync($"{webApiUrl}v1.0/{task}", jsonData).Result;

This will result in a new Event in the calender of the user, with the correct time and timezone
To update the event I have to call httpClient Patch. Because this is not available in our current Version I changed the call so it will execute a patch.
var task = $"users/{outlookUser.Id}/calendar/events/{outlookId}";
var request = new HttpRequestMessage(new HttpMethod("PATCH"), $"{webApiUrl}v1.0/{task}")
{
    Content = jsonData
};
var response = HttpClient.SendAsync(request).Result;

The jsonData is filled similer as for creating the event.
The problem I have is that when I update the event, the timezone seems to be changed. In the calender view of outlook, the correct time is displayed, but opening the event will show the time of (in my case -2 hours) and a timezone "Coordinated Universal Time".
I have looked for a solution but could not find any that worked.
I tried to add a header in the httpClient. Same result.
I tried to add a header in the HttpRequestMessage. Same result.
I need this to be solved, because end users won't understand why the time not correct.
Comment: Have you found any solutions to this? I'm currently experiencing it too. Can't update new times without having the outlook client change it to UTC as well.
Answer: Looks like you are using an unsupported timezone, here is the list of supported timezones.


Why is this question poor, how can I improve it, and what can I do in the future to prevent doing the same mistakes

Question: I simply want people to tell me what I did wrong here so that I can correct my question and make it better, in addition to learn what I must not do.
GLSL "if" statement producing segmentation fault
Comment: Look at the close reason your question is on it's way to being closed as.  Also look at the numerous comments by users explaining problems they see in your question.  Asking us what's wrong with it before you've addressed any of the problems that you've already been informed of isn't productive.
Comment: Of course people didn't tell you that they downvoted and why.  That isn't productive.  But numerous people *did* tell you that your question had problems, and how to fix them.  Asking people why your question is problematic and how to improve it *when you have already been given lots of information on how your question is problematic and how to improve it* is just wasting everyone's time.  It's not a helpful (meta) question.  When you ask a question that's not helpful, you get downvotes (on meta sites and main sites).
Comment: If you've already done everything you can to address all of the problems people have already pointed out to you (both in comments, and via close votes), and you're still getting feedback that your question is problematic, *then* it could be useful to go to meta for additional feedback.  But as is you're just asking us to repeat the comments you've already gotten, which is just wasting your time and ours.
Comment: Of the people downvoting none of them specified what exactly were the reasons the question was poor. Look at the comments. I don't understand why these is a reason to be downvoted in meta, I want to improve the quality of my questions, if you feel helping me is a waste of time then don't, but why is asking help to improve my SO questions reason enough to downvote? You didn't even look at the question before commenting.
Answer: It's the second question today from you that claims that introducing an irrelevant line in a shader produces a segfault. Both show code examples that are so much reduced that it is completely unclear what is happening. The second question (the one discussed here) should have just been an edit to the first one. On it's own it doesn't make any sense.
For your first question, it lacked a lot of code. You were calling a function claiming that this introduces a problem without showing that function.
Attributes, varyings, uniforms are missing so we could only guess what you are actually accessing. Which glsl version are you targeting? You are not even saying what type of shader it is? Compute shader? Vertex Shader? Fragment Shader?
Then, the segmentation fault doesn't even happen inside the shader. It happens in some code that depends on the shader but you didn't show to us.
Comment: tl;dr: The minimal and complete parts of MCVE are really important.


Factors affecting pain of static electricity shock

Question: Referring to How to avoid getting shocked by static electricity?, someone I knew suffered much pain from static electric shocks when touching door knobs or car doors where I didn't feel anything doing the same thing in the same environment. What are the importance of factors determining how painful (or not) shocks are, e.g. one's pain threshold, shoes and clothes one wears or even how one walks?
Answer: Everyone is likely to have a similar pain threshold to electric shocks.
If your friend wears leather soled shoes he will conduct static electricity to earth because they offer much less resistance to earth than rubber or plastic soled shoes. Wearing synthetic clothes may cause a similar effect.
If he/she has lower resistance than you (by having sweaty hands for example) that may make things worse for him/her.
Possibly your friend lives in a house with carpets made from polyester or some other synthetic material which builds up static electricity as he/she walks on it.
Comment: Actually we were in the same house so were exposed to the same carpets etc.


C# Interpreted Language

Question: I am looking to write an interpreted language in C#, where should I start? I know how I would do it using fun string parsing, but what is the correct way?
Answer: It can be a pretty difficult endeavour to do right.
If you don't have much knowledge in compiler theory you should probably first start reading about it.
Just using "fun string parsing", if I understand that term correctly, isn't going to get you very far at all.
The first basic step is to write your language grammar that defines the valid syntax for the language.
A tool like ANTLR will help you get the pieces together, but I would suggest reading the Dragon book as it is the canonical starting point to get up to speed on the subject.
Answer: If you want to build an interpreted language on .NET, the DLR is the way to go - check out Martin Maly's LOLCODE sample at http://www.iunknown.com/2007/11/lolcode-on-dlr.html
Edit: Here's another link with more information from Scott Hanselman: http://www.hanselman.com/blog/TheWeeklySourceCode11LOLCodeDLREdition.aspx
Answer: Checkout the Phoenix compiler from Microsoft.   This will provide many of the tools you will need to build a compiler targeting native or managed environments.  Among these tools us a optimizing back end.
I second Cycnus' suggestion on reading Aho Sethi and Ullman's "Dragon Book" (Wikipedia, Amazon).
RGR

C# Interpreted Language


Are some chord voicings only good in the middle or higher octaves?

Question: I was playing 7th chord inversions on the piano and notice that some inversions don't sound as good in the octaves below middle C. For example, a 2nd inversion major 7 chord seems to sound a bit dissonant when played lower (perhaps because of the minor second interval in the inverted maj 7th chord? ). Is this just my imagination or is this true? If it is indeed true, then why does this happen?
Comment: You seem to have discovered the [lower interval limit](https://www.youtube.com/watch?v=iW6YeDJklhQ).
Comment: its definitely not your imagination. Which voicings sound good depend a lot on the position of the keyboard you are playing them, and there is a loot of teachings on this matter. In general, the lower you are in pitches, the further apart you want your intervals, to avoid muddy and unclear chords, and the further up the more you can use close intervals. I think what you are doing, experimenting with voicing in different ranges and checking if they sound good or not, is the best practice!
Comment: It's better to not play root and M7 next to each other in a block chord - wherever they are in the inversion - they sound better nearly an octave apart.
Answer: Yes, right from our Harmony 101 class in 4-voice vocal writing we're taught that close intervals between the bass and tenor voices low in their ranges are to be avoided (as are over-wide intervals between the upper voices).

Close chords in the low register sound muddy.  'Colour' notes - 7ths, 9ths, even 3rds work better in the upper range.   A minor 2nd between upper voices is acceptable, in the bass register it's just ugly.   We can explain this by considering the cacophony of overtones from closely-spaced low notes occupying the same range as the melody.
There are exceptions, and instrumentation is a factor.  This (below) sounds muddy on a modern piano.  But Beethoven often wrote something similar.  His piano, with its shorter strings and leather (rather than felt) hammers had a thinner, brighter tone than the modern instrument. Fewer overtones to fight with each other in the midrange.
Comment: Another exception that perhaps should be mentioned is just intonation.  While close chords always sound somewhat clearer higher up than lower down, just chords (say, the triad 4/5/6) sound quite nice even pretty low.
Comment: I might argue that that so-called "muddiness" might have been Beethoven's intent.  The opening to the Pathetique Sonata, which is almost exactly what you wrote but in a minor key, is meant to be somewhat dark and heavy, in contrast to the faster-moving parts of the movement.  I've heard it played on a period instrument and the effect is still pretty evident despite the thinner tone.  It's something of a judgement call to say that any voicing is "bad" or "good".  They are different, certainly, but those different qualities may be desired in some cases.
Comment: @Darrel Hoffman  Whether YOU like the sound on a modern Bosendorfer or not, it's difficult to argue with the fact that Beethoven wrote with the sound HIS piano made in mind!   Admittedly, Beethoven was sometimes prepared to sacrifice beauty in favour of drama!
Answer: When playing harmonically complicated sounds, the overlapping of the lower notes' harmonics within the pitch range of the upper notes contributes to muddiness, as noted by Laurence Payne's answer.  When using harmonically simpler sounds, however, another factor comes into play.
A combination of signals at two frequencies f1 and f2 may be perceived either as two separate pitches, or as a single pitch (f1+f2)/2 which, depending upon the relative amplitude of the original signals, wavers at a rate of either f2-f1 or 2(f2-f1).  The greater the difference between f1 and f2, the more likely they are to be perceived as separate pitches, and the less likely they are to be perceived as single modulated pitch.
If an organist were to use an 8' flute stop to play a C, E at the bottom of the keyboard (the lower note would be the low C of a cello, though a cello would be much richer harmonically), the pitches would be 65.4Hz and 82.4Hz, respectively, with a difference of 17.0Hz.  That difference frequency is low enough that a listener would be likely to perceive a single tone at 73.4Hz--roughly the D between the two pitches--warbling at 17Hz (slightly less than twice as fast as the 10Hz pulses from a rotary phone).
Note that the more harmonically sparse the tones are, the more pronounced this effect will be.  Many people perceive the telephone "ringback" sound used in the US and many other countries (which combines pure tones at 440Hz and 480Hz) as a tone with a very fast warble, despite the fact that the 40Hz would be high enough to be heard as a tone in its own right).  On the other hand, most instruments produce enough overtones that the sound of playing the C and E an octave higher than those above would be perceived as two distinct tones despite their difference only being 34Hz.


Whats wrong with ZK viewport meta?

Question: i migrated a project from zk5 to zk6.5.1.
The most is fine except the viewport on tablet device. Its the same meta as before but the tablet does scale the page in the early version and now the page will be croped. Crop => left on the page is a grey area without content this is the meta:
<code><?meta name="viewport" content="width=1000; initial-scale=1.0; maximum-scale=1.0;" ?>
</code>
anyone know this effect? and how to solve that?
Tablet device: Samsung Galxay GT-P7500, Android 3.1
Answer: Viewport meta is buggy in this version of android 3.1.
Got two Tablets but the other one was with 3.2 there it works! grml

Whats wrong with ZK viewport meta?


Undefined property or object with if statement still gives error

Question: Examples:
if (foo) {}

if (foo != undefined) {}

if (foo != null) {}

try {foo} catch(e:Error) {}

Gives a compiler error. How do I prevent this?
Answer (thanks Poke):
// declare the variable first
var foo:DisplayObject;

if (foo == null) {
    trace('foo is null') // traces
}

Answer: ActionScript 3 is statically typed. That means that every variable has to be declared before it can be used in any way. Declaring a variable is unrelated to its initialization in which the variable gets a value for the first time; very often, both are done at the same time though doing something like var myVar:uint = 2 (this declares the variable myVar as uint and initializes it with the value 2).
So in your case, you get an error because you are accessing a variable that has not been declared, so the compiler does not know about the name you are trying to access. So you will need to make sure that your variable is actually declared before you use it.
Comment: Thanks, that makes a lot of sense. I did find that you could have a null child inside an existing object, and it won't throw any errors.


Couchbase - Unable to store key and value though bucket is connected to successfully

Question: I've been trying to set up a Couchbase server. But unable to store any value and value.
Following Couchbase manual, I simply install Couchbase, refer the Couchbase Client .NET (Enyim.Caching) into project, then re-configure Couchbase section in app setting with my local pool url (http://local:8091/pools).
I can though connect to connect to bucket through set up CouchbaseClient and CouchbaseClientConfiguration, but unable to store any key-value after that (by .Store(StoreMode.Set, key, value) always returns false).
Any help will be appreciated.
Answer: Could you confirm that your local pool URL is http://localhost:8091/pools/default and not http://local:8091/pools?  Also, what are the versions of the server and client that you're using?
Thanks.


What is the best way to deploy profiles in Salesforce? (especially system admin)

Question: What is the best way to deploy profiles in Salesforce?
I have a system admin profile with access given to the objects that i have created in my sandbox. I have about 1000 fields across these objects. Eclipse suggests that we should not deploy profiles.
Also in production, there is a high possibility that Admins would have been given access to other object fields' which are not available in my sandbox.
Background :-
Say I have a sandbox dev1 and am working on it for application 1 after refreshing from production.
I have another sandbox dev2 and another group of devs are working on it for application 2 after refreshing from production.
Dev2 goes live (to production) before dev1, and in dev2 System Admin profile, I have added some fields based on the objects that are needed for application 2 and have deployed it to production..
Now, If I deploy dev1 to production (and if I have about some 1000 fields added in my dev1 sandbox and the access has been given to System Admin) :
How will I deploy this system admin profile with necessary field access to production? (Because if I overwrite the system admin profile, the field access that were already given for dev2, application2 will be removed. How do I handle this??
I know we can achieve this using permission set for all other existing profiles. How to do this for System Admin profile?
Comment: Have you tried using the feature where it lets you specify associated profile changes when you're adding a component to a change set. Does that help?
Comment: we can do that @techtrekker but if we have some deployment from someother environment, the permissions will be overwritten if am right.
Answer: The metadata API and the "change set" feature are not "destructive" by nature. Many people think that when you copy a profile, you are copying all of the permissions for that profile, including all object and field permissions. However, this simply isn't true. While you do need to compare base profiles for a comparison of, for example, "API Enabled" or "Export Data", objects and fields are enabled separately by default, which means that you can copy just a subset of all available permissions without worrying about a complete overwrite.
It is true that you should be wary about using profiles in the Eclipse IDE, and with good reason. The plugin is "smart" and tries to only deploy changes. This means that in order to deploy a change to a field level security item, you have to modify both the profile and the custom field in order for a change to occur. This is usually a huge hassle, and so you should probably avoid doing that.
Change sets, and the metadata toolkit, however, are perfect ways to copy just the permissions you want to copy. This is because the system will only change the settings relevant to the combination of profiles and fields/objects. The Metadata Toolkit gives you the flexibility of editing raw XML files, allowing you to copy only the information you want to.
Let's take a look at using the Metadata Toolkit, since it's fairly easy to use, and has reasonable documentation.
First, I create a package.xml file that has the following content:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Lead.CurrentGenerators__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>Admin</members>
        <name>Profile</name>
    </types>
    <version>29.0</version>
</Package>

Here, I specifically request a single field and a single profile. The results of this export gives me:
objects/Lead.object
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <fields>
        <fullName>CurrentGenerators__c</fullName>
        <externalId>false</externalId>
        Current Generator(s)
        <length>100</length>
        <required>false</required>
        <trackFeedHistory>false</trackFeedHistory>
        <type>Text</type>
        <unique>false</unique>
    </fields>
</CustomObject>

profiles/Admin.profile
<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <fieldPermissions>
        <editable>true</editable>
        <field>Lead.CurrentGenerators__c</field>
        <readable>true</readable>
    </fieldPermissions>
    <userLicense>Salesforce</userLicense>
</Profile>

If I change "editable" to false, and deploy this change to another organization with the same field (or, even if the field does not exist), then the only change that would occur is that the single field level security setting would change-- all other fields, objects, and other permissions would remain intact.
This feature is often used to deploy security changes that are scoped out in a Sandbox. You can be as selective as you'd like to be, even down to just a single field's permissions. In this manner, you can choose which permissions you'd like to deploy. Also, you could choose to manually edit the XML files before deployment to deploy different sets of field level security permissions within the same package. They do not need to be a fully rectangular matrix. For example, you could build a deployment like this:
           Field 1 Field 2 Field 3
Profile 1  Edit    -       Read
Profile 2  Read    Edit    -
Profile 3  Edit    Edit    Edit

In this case, two field level security settings will not change (Profile 1's Field 2 security, and Profile 2's Field 3 security), while the other settings will be as specified. Hopefully this answer will help clear up the confusion of the other answers that have been posted to this question.
TL;DR version
Only settings explicitly mentioned in a change set or metadata API xml file will be modified. One should not think of this as an "overwrite", but instead a "selective edit."
Comment: @ESRouter Today, Permission Sets and Permission Set Groups are arguably the way to go. Don't mess with profiles if you can help it. Each app can have its own permission set, and you can assign them with Apex code, SFDX CLI, and other newer generation tools. Profiles should be limited to page layout assignments and record type assignments, and pretty much nothing else. I wouldn't recommend relying on profiles any more than necessary, and definitely not this level of cherry picking, if one can help it.
Comment: Nearly 8 years later - do you still support this method? Essentially, you're saying to "cherry-pick" every change. Lightning has added so much more to the mix. I work in Health Cloud where there's constant development, separate apps, and mng pkg installs for docs etc. Dev env is widely different than Prod. This supposed to be a "click-config" solution. Trying it this way I'm constantly peppered with "No --master-- recordtype defined for..." or excluding things like automatic visibilities to "standard__AllTabSet". Wouldn't u agree today a spreadsheet matrix and "by hand" is the best way to go?
Comment: I would echo this statement: "Profiles should be limited to page layout assignments and record type assignments, and pretty much nothing else."
definitely for the larger organisations.
If you have a crystal ball and know you will never have too many permissions/user types, then maybe Profiles alone is ok. On a sliding scale small organisation and Profiles at 1 end, large organisations and Permissions Set and PS Groups at the other.
Comment: That said, yet to see a large org implement properly (always a mess). What does properly mean? 1 question: "What does you change control process look like?"
---
question:
Do you(the global you) manage your permission change control in 1 matrix? If not you're doing it wrong.
Answer: Profiles are the only piece of metadata for which I advocate making changes by hand. It can be tons of clicking, but the metadata API is far too "all or nothing" for profile changes to easily keep them in synch, at least in my experience. Attempting to deploy Profiles automagically carries the added risk that comes from the fact that in dev sandboxes, it's frequently necessary to mess around with privileges when doing profile-related stuff, and it's easy to accidentally deploy a security change one did not intend.
Using diffs against profiles is basically impossible for anything but the most trivial of changes - profiles get lots of stuff added in different positions, and your source profiles will likely be so out of synch with the destinations that a diff is not practical.
I've taken to doing deploys with Ant, then a long "run list" of sys admin manual changes, which are usually mostly profile clicks that have been compiled by the developers. Then the admin makes the changes, and tests them by impersonating the various modified profiles.
I suppose permission sets could ease part of the pain with this, but I haven't yet rolled them into my methodology so can't really comment.
Comment: Long ago I wrote a Greasmonkey/Userscript that allows you to copy+paste basically an entire profiles settings as a text-string from one org to another and it highlights the changes it's about to apply before you press save. It modifies the standard profile edit pages (works on permission sets too). It comes with no support but it's worked well for my team for years. Works better in Firefox with greasemonkey addon than Chrome these days, primarily because Chrome enforces limits on the length of text you can handle in a prompt-dialog. Source/installable javascript: http://bit.ly/1F83oJP
Comment: Usually end up doing this as well...this is so painful for any large projects...so many clicks.  Have done some quick selenium scripts to simulate a "check all" feature, but never attempted a full suite of automated profile set up with selenium.
Comment: That's awesome! Thanks for that. Looks pretty useful. I have been using a Chrome plugin that allows a drag/drop to select checkboxes: https://chrome.google.com/webstore/detail/multicheck-checkbox-check/bmcleiancmakcoknkgnfgijomcddhpbi but a greasemonkey script seems a better way to go!
Comment: Manual changes is an ever changing situation.
Duplicate Matching Rules for example.
Community Settings, and the list goes on....

So to say ONLY would be incorrect.

this is true now, and has always been true, profiles has never been the only manual change scenario. And it most likely will never be the ONLY.
Answer: The Metadata API is the fullest footprint of settings - packaging and change sets both make assumptions on how to handle particular cases that may not be desirable. I definitely recommend making changes through the Force.com IDE or ANT. Also, while ultimately there will be some cases where you will have to make manual changes (e.g. standard apps like sales or call center are not supported in the Profile metadata type in the Metadata API and therefore must be made manually), you can at least reduce the number of manual changes you need to make.
Keep in mind, profiles can be big - for each object in your org, there are six bits of permissions, each field of each object there are two bits of permissions, each visualforce page or apex class is a bit, and then there are approximately 150 user permission bits to manage on top of it. And that's without settings like record types or layouts - all in all, there can be well over a million configurations to capture in a larger org so you might as well make it easier by automating where you can.
Answer: I have one other suggestion / workaround which worked well for me when faced with the same problem you have: use permission sets.
Profiles have their well-known drawbacks and permissions sets are perfect for packaging authorisation for new applications. Say you are developing a new application with it's own objects, pages, classes and tabs. Create a new permission set which you then deploy. You can then assign this to:

Individual users manually
Multiple users via the Data Loader OR
Multiple users via The Permissioner app
Answer: I would suggest you can compare the metadata files for profiles using file comparator tools like diff doff or exam diff and then come to conclusion that this are the major changes that are essential.
Then may be you can modify metadata according to your need and then use ANT to push the changes .
ANT provides the flexibility of changing the metadata also you can mock run in the sandbox before doing final deployment
Comment: Comparing metadata files for Profiles across orgs is nearly impossible for anything but the most trivial of changes.
Comment: While comparing the metadata may be tedious it is still probably the best way to identify the changes, short of keeping a running delta by hand.
Comment: Also, note that the metadata API and Change Sets will not update permissions to standard fields on standard objects; only to custom fields on standard objects or every field on custom objects.
Comment: Although it may serve a different use case than comparing one profile between two sandboxes, you can look at the Audit Trail in the source org to see all of the profile changes that were done.
Answer: This is an excellent question in need of a solution. In theory you can compare the .profile files between orgs but here's what I've learned:

Make sure you have 2 projects (PROD and SandBox) which both have all meta data contained. I noticed any objects missing in your project do not appear in the profile metadata file!
You have to sort and normalize the .profile xml in order to compare it with text-based diff (non-XML) tools. One way would be to write an XSL which does this (see sample below).

You can then compare the PROD and Sandbox .profile files, merge and (in theory) deploy.
Sample XSL
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://soap.sforce.com/2006/04/metadata"
    version="1.0">

    <xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes" />

    <xsl:template match="/Profile">
    <Profile>

    <xsl:for-each select="classAccesses">
        <xsl:sort select="apexClass"/>
        <classAccesses><xsl:copy-of select="apexClass"/><xsl:copy-of select="enabled"/></classAccesses>
    </xsl:for-each>

    <xsl:for-each select="userLicense">
        <xsl:copy-of select="."/>
    </xsl:for-each>

</Profile>
</xsl:template>

</xsl:stylesheet>

This XSL still needs some work (obviously) in order to allow you to compare each object type.
Answer: Diff'ing profiles via their metadata XML is time consuming, but I disagree with previous answers that it is useless or impossible.
The first step to happiness is to push all non-profile changes so that the two orgs are synchronized.
Next, we must ensure that we are comparing apples to apples. To do this, we'll need to ensure that we are using the same package.xml when pulling the profiles (either through the Eclipse IDE or ANT). Now we can readily compare the files.
Additional suggestions:

If there are many changes to the profile involving non-conflicting SObjects (e.g. we are only worried about additional field access granted on Accounts, Contacts, and Opportunities), consider splitting out the package.xml into "stuff we're happy to overwrite" and "stuff that we need to carefully merge". This will allow you to focus your attention where it is needed. With one deployment being easy, while the second requires the manual diff'ing.
If you need to merge profiles, you can do this using a combination of cloning the existing profile, deploying your new profile on top of the cloned profile, then (optionally) redeploying the original profile on top of the cloned profile. Note, you'll need to manually change file names to accomplish this, but it works if the two profiles are generally distinct.
Answer: Problem:
Deploy Profiles
profiles includes permissions to many metadata items and needs to be included in the XML, and many of those metadata items may not exist on destination org causing the deployment to fail.
Solution:
Use an appexchange application: Copado Deployer
it will describe all the metadata on source org to produce a full XML of your profiles.
it will apply a smart algorithm an remove any reference to non existing metadata on destination.
Full Profile will be deployed successfully not leaving behind 1 permission.


Can ionic and covalent bond be explained in terms of orbitals?

Question: Covalent bonding is stated as overlap of atomic orbitals .In ionic bonding the composite ions are held together by their electrostatic charges that result from the transfer of electrons from one atom to the other. What is exactly meant by "transfer"
in terms of orbitals?
Comment: A plot of the expectation value for the electron's wave function would be heavily biased towards one of the two atoms, resulting in a net dipole moment.
Comment: For the ionic form of $\ce{AB}$ viz. $\ce{A^+B^-},$ the wavefunction can be written as $\psi_{\ce{A^+B^-}}(1,2)= \psi_{\ce{B}}(1)\psi_{\ce{B}}(2)\;.$
Answer: The "transfered" electron will be in an orbital that is mostly on the side of only one atom, i.e. the anion. That orbital will be slightly deformed by the presence of the cations around it, but no significant overlap with any of their outer orbitals (those which are as good as empty, because the electron has been lost to the other atom).
(Im writing "mostly" and "as good as" because there can always be a covalent contribution to the bond.)


Updating posterior distribution in online fashion

Question: First, I am sorry if this is an obvious question, I am starting to study bayesian statistics (mainly for machine learning) and I was seeing the classic coin flip example using a Bernoulli distribution with parameter $q$. So I checked the math using an uniform prior ($P(q)=1$), and I was trying to see how the posterior would change after seeing for example $D=\{heads,tails\}$. So After computing the equations, I got that the posterior $P(q|D)=6(q-q^2)$. Then I did the same computation, but this time in 2 steps; that is, first I computed  $P(q|D)$ but only with $D=\{heads\}$ which was equal to $2q$. Then I computed the posterior again with $D=\{tails\}$ but this time using the posterior that I just obtained ($P(q)=2q$). And then I obtained the same posterior as before.
My question is, is this always the case if we assume iid samples or just works for this simple case?
Is this how real life systems are programmed (using the previous posterior distribution as prior)?
Thanks!
Answer: Yair Daon is right, what is also worth mentioning is that what you have observed is called Bayesian updating, and as already mentioned, it can be done all-at-once, in batches, or sequentially. The derivation shown by Yair Daon uses the chain rule in probability and applies not only to the Bayesian inference, but to conditional probabilities in general.
Comment: I should have known it's going to be a duplicate...
Comment: @YairDaon I also learned about this after answering. But this is not a problem, we simply have two threads, later on we may think of merging them.
Answer: Say you have some prior $p(x)$ and a likelihood $p(D|x)$ for (say) two iid random variables $y_1, y_2$, so $p(D|x) = p(y_1,y_2|x) = p(y_1|x)p(y_2|x)$ and $p(D) = p(y_1)p(y_2)$. The posterior is then:
$$
p(x|D) = \frac{p(D|x)p(x)}{p(D)} = \frac{p(y_2|x)}{p(y_2)}\frac{p(y_1|x)p(x)}{p(y_1)} .
$$
But after seeing $y_1$, we believe a different belief in the distribution of $x$ (by Bayes rule):
$$
p(x|y_1) = \frac{p(y_1|x)p(x)}{p(y_1)},
$$
so
$$
p(x|D) = \frac{p(y_2|x) p(x|y_1)}{p(y_2)}.
$$
But that is just Bayes rule with the prior $p(x|y_1)$!
So your intuition was correct. It does not matter if you imagine you saw all observations at once (as $D$) or one by one (as $y_1,y_2$).


Multiple Users under El-Capitan

Question: On a MacBook Air, running OS X El Capitan, can two different Users login to their own User Account while accessing their own individual and different iCloud Accounts?
Answer: Yes! Simply create a second user:
Add a user

In Users & Groups preferences, click Add (+) below the list of users.
Choose the type of user you want to create from the New Account
pop-up menu.
Type a full name for the new user. ...
Enter a password for the user, then enter it again to verify. ...
Click Create User.

Source
Comment: I should add: You will be able to add your different iCloud accounts after the new user is made. :)

Multiple Users under El-Capitan


What's going on with these Snow in Summer plants?

Question: I planted about a dozen Snow in Summer flowers about 2 months ago and most of them are turning brown in the center. I don't think this is a water issue, but perhaps... the ground doesn't drain very well. Any thoughts?
Answer: From your pictures I am going to say too little sun and too much water.  Have these plants bloomed at all this year? Doesn't look like they have.  I'd move these plants to a sunnier location and allow the soil to dry out in-between waterings.  Best place for this plant is on top of a rock wall, rockery.  In case you have a one lying around somewhere? Grin...
Once Cerastium tomentosum, Snow in Summer, blooms (should be early summer), cut off all the flowers, shear this plant.  Needs great drainage, can deal with partial shade, a bit of a short-lived ground-cover, has to be sheared to keep dense. Use Osmocote 14-14-14, extended release fertilizer twice during the growth season.
Please let me know if my assumptions were correct, I'll correct the best I am able!
Comment: I think they are getting too much water. The problem is the soil is pretty damp because of bad drainage. What if I add rocks to this bed?
Answer: More or less in agreement with previous answer, but for one thing. As said, this appearance is normal for this plant if you don't shear it back to 2 inches after its flowered, I'm afraid, and particularly if grown in less than full sun in dampish soil. Here's the disagreement - it doesn't appreciate being fed very much, grows much better in poor soil, so I wouldn't feed it at all.
Answer: Definitely scrape out all the bark and use a good few inches of gravel under and around instead as your plant is rotting where it's wet. A good haircut and I'd hope that would do the trick. Can't beat this gorgeous plant!


SPO calendar overlays

Question: A user has a calendar with overlays from other departments.  However, the user only wants to see entries from people he supervises. There are 5 different calendars with several people working in a department.  Is it possible to pull entries from particular individuals from those 5 calendars and overlay them into one?  Example: Department boss supervises 5 managers.  Each of those managers maintain a leave calendar for their respective shop.  Dept boss wants leave overlayed from each calendar.  However, Dept boss only wants to overlay the leave from the managers he supervises, not the other employees in those shops.
Answer: Have you tried Calendar Overlays feature on SharePoint Online? If not, please have a try. You can combine multiple calendars and view all events from both calendars (technically up to 10 calendars) in a single view.
There is a blog for your reference:
https://www.sharepointdiary.com/2019/01/create-calendar-overlay-in-sharepoint-online.html

If the answer is helpful, please click "√" on the left panel of the answer and kindly upvote it.
Comment: I am checking to see if you have a chance to see the following answer. If you have any doubts about this issue, please feel free to reply.

SPO calendar overlays


How to analyze temporal effect on outcomes in two populations

Question: I'm looking for guidance for how to plan an analysis.  I am interested in temporal differences amongst two different populations.  More specifically I'm interested in assessing differences in length of stay for patients admitted during the week vs weekend stratified by trauma vs urgent surgery.  The hypothesis is that patients receiving urgent surgery would have a longer relative length of stay if admitted on the weekend than patients requiring trauma surgery.  The data that I am using does have weekday, weekend, trauma, urgent, and length of stay, but I'm curious how to analyze this.  I would appreciate any help/guidance!
Answer: Sounds like some form of regression / generalized linear model would work well. You could predict the length of stay with the weekday vs. weekend day variable, trauma vs. urgent variable, and with their interaction.
A significant interaction would suggest that intake reason has a different relation to length of stay depending on intake day, and you could then do follow-up comparisons to check whether such differences are in line with your hypothesis. If the data meets the assumptions of linear regression, you could use that. If not, some form of generalized linear model might work.


Make a .deb for a Node.js application

Question: How I make a .deb for a Node.js application that installs Node.js and its required npm modules on dpkg -i?
Which is the place in the filesystem where I have to put this application? (/opt,/usr/local).
Thanks in advance.
Answer: Here's an article + screencast on the subject:
How to create a .deb for NodeJS apps
Answer: I know this is kind of late.
Here is a ppa repo that might help you:
https://launchpad.net/~chris-lea/+archive/node.js/
This installs node to a standard location. I consider installing with npm to local directories (part of the application) the best practice.
Source: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
Comment: Your answer isn't related to my question. I asked how build a .deb for a Node.js app, not install Node.js from a .deb. But thanks anyway :D

Make a .deb for a Node.js application


How do Aquinas' and Aristotle's mixed regimes differ?

Question: Both Aristotle and Aquinas seem to subscribe to the idea of a mixed constitution as the form of government best disposed to the common good. By "mixed constitution", I mean mixing between Aristotle's classical taxonomy of political government (Kingship, Oligarchy, Democracy). I wonder how do their ideas of "mixed government" differ? For example, for Aristotle in Politics, the mixing is actually to find a mean between the extremes. So he builds his best constitution on the metaphysics of "middle class,"  which is the mean of the rich and poor. This is not the case in summa theologica by Aquinas, who just chooses one characteristic from each good form of government and combines them. Are there any other dissimilarities between the two? E.g., we all know that Aquinas tries to adapt Aristotlean philosophy to Christian theology. So what role does theology play in Aquinas' mixed government different from that of Aristotle's?
Comment: So many people focus on the Summa Theologica, which was a work of theology. If you want to know what Aquinas thought about politics though, you may want to look at his commentaries on Aristotle's philosophy. There you will encounter Aquinas as a philosopher. I know he wrote a commentary on Aristotle's politics, but I have not read it myself.
Answer: Integralism: A Manual of Poilitical Philosophy ch. 5 "Forms of Polity", §"Possibility of mixed polities":

Aristotle noted that "some say that the best constitution is a mixture of all the constitutions (την άρίστην πολιτείαν εξ άπασών είναι των πολιτειών μεμειγμένην)".[Politics II.6] The phrase however has been variously used, sometimes to refer to a constitution giving a stake in the city to all the social classes, sometimes to refer to a separation of the organs of government.  Here we use it to refer to a polity which possesses elements of more than one of the three 'pure' polities. This yields four new possibilities: a mixture of all three pure polities, a mixture of monarchy and aristocracy, of monarchy and democracy, and of aristocracy and democracy. Hence we may speak of seven basic forms of polity, as St Robert Bellarmine remarks [in On the Roman Pontiff bk. 1 ch. 1].

St. Thomas in De Regno ch. 4 agrees with Aristotle that tyranny, oligarchy, and democracy are corruptions of monarchy, aristocracy, and timocracy*, respectively:

democracy stands in contrary opposition to polity*, since both are governments carried on by many persons, […]; while oligarchy is the opposite of aristocracy, since both are governments carried on by a few persons; and kingship is the opposite of tyranny since both are carried on by one person.

*Integralism ibid. fn. 5: "In the Nicomachean Ethics, VIII.10, Aristotle explains that this word comes from the term τίμημα (timeema), property, and denotes rule by many people who nevertheless each possess a specified amount of property. He notes that such a system is normally called by the name of the genus, and termed a 'polity'. In the Politics, he conforms to this common but confusing practice."

Although a theological work, St. Thomas Aquinas does describe the ideal form of government in Summa Theologica I-II q. 105 a. 1 ("Whether the Old Law enjoined fitting precepts concerning rulers?") co.:

the first place is held by the "kingdom," where the power of government is vested in one; and "aristocracy," which signifies government by the best, where the power of government is vested in a few. Accordingly, the best form of government is in a state or kingdom, where one is given the power to preside over all; while under him are others having governing powers: and yet a government of this kind is shared by all, both because all are eligible to govern, and because the rules are chosen by all. For this is the best form of polity, being partly kingdom, since there is one at the head of all; partly aristocracy, in so far as a number of persons are set in authority; partly democracy, i.e. government by the people, in so far as the rulers can be chosen from the people, and the people have the right to choose their rulers.


where is postgres database stored on hard disk

Question: i want to hand in a course work for marking but i have no idea what files represent the database.
Question:
Where can i find the postgres sql database on my hard disk?
Thanks.
Answer: You should use pg_dump to export the database to SQL. Giving the raw files won't work if they are running a different version, 64bit instead of 32bit or something else in the environment.
You can easily export it using pgadmin3
Answer: Checkout the startup parameter -D for the Postgres service. It defines where the data directory is located.
Edit:
To hand in your homework, you'd better export the database using pg_dump as WoLpH suggested. The actual files in the data directory are binary files and I bet your teacher want's to have SQL scripts
Answer: The database files are in what is called the "data" directory. Depending on your environment there are a few ways to tell - here is one that should work everywhere:
psql -d database_name_here -c "show data_directory"
And if you're turning this in for some school work you should:
pg_dump -d database_name_here
Answer: If installed by apt-get or similar package manager, most likely in
/usr/local/pgsql/data


Taking clearer pics in dark arena?

Question: On iPhone 4 - I was at a wrestling show - low light, except for strobe/laser lighting in the distance - and I was unable to take clear pictures. I had to zoom in 100% as I was sat far away. The pics came out blurry at best (with or without flash) What can I do to get clearer pics?
Answer: Aside from getting more light in the room, there's not really anything you can do. You can try using a third-party camera app, like Nightcap, to try and boost the capabilities of your phone, or Camera+, to modify your photos in post-production and possibly increase their fidelity (just as you could take your pictures into your PC/Mac and edit them in Photoshop). You will, however, be limited.
Until cell phone capabilities increase substantially, your options are few. My best advice is to try to get as close to your subject(s) as possible and attempt to capture as much light as possible. If you can rest the phone on something stable to minimize shake during long shutter speeds, do it. As rough as it can be, those are still the best ways to get good pictures in your situation.
Oh, and avoid zooming. You're usually better off taking a full picture and cropping in post.

Taking clearer pics in dark arena?


What are some checkmates with very few moves from the starting position?

Question: I would like to learn about a few checkmates using very few moves. I know one where you develop the knight and march it directly towards the King. Does anyone know the name of this mate and suggest others?
Comment: If you know the mate you're thinking about, can you post the moves?
Comment: @Daniel why did you change the wordings of the question ? #Admin why are folks editing the questions for no reason ?
Comment: 1. e4 e5 2. Qh5 Ke7 3.Qxe5#
Comment: 1.e4 Nc6 2.Ne2 Ne5 3.c3 Nd3# or something like this might be the mate you refer to in the question, but it is too silly to have a name.
Answer: There are probably as many quick mates as there have been first time players (since we all get caught in these at the start!) but here are a few common ones:
Fool's Mate
This is the shortest possible checkmate in a mere two moves:
1.f4 e5 2. g4 Qh4#
[FEN ""]

1. f4 e5 2. g4 Qh4# 0-1

White can also play f3 instead of f4 or move the g pawn before the f pawn.
Scholar's Mate
This mating pattern is also sometimes referred to as "Fool's Mate" and there are two main patterns:
1.e4 e5 2. Bc4 (2. Qh5 Nc6 3. Bc4 Nf6 4. Qxf7#) Nc6 3. Qf3 Bc5 4. Qxf7#
[FEN ""]

1. e4 e5 2. Bc4 (2. Qh5 Nc6 3. Bc4 Nf6 4. Qxf7#) Nc6 3. Qf3 Bc5 4. Qxf7# 1-0

The key is that f7 is insufficiently defended and mate is delivered there.
Légal's Mate
Légal's Mate (also spelled as Légall's Mate) is probably the mate referenced in the question:
1.e4 e5 2.Nf3 Nc6 3.Bc4 d6 4.Nc3 Bg4  5.h3 Bh5? 6.Nxe5! Bxd1?? 7.Bxf7+ Ke7 8.Nd5#
[FEN ""]

1.e4 e5 2.Nf3 Nc6 3.Bc4 d6 4.Nc3 Bg4
5.h3 Bh5? 6.Nxe5! Bxd1?? 7.Bxf7+ Ke7 8.Nd5# 1-0

Comment: Legal's mate is quite cute. Isn't it?
Comment: After `6.Nxe5` black can reply with `6...Nxe5!` which nets out to the loss of a pawn after `7.Qxh5 Nxc4 8.Qb5+`.  If white omits `5.h3`, then the black knight on e5 will defend the bishop on g4 and white will be down a piece.
Comment: is 5.h3 even necessary in Légal's Mate? why bother kicking the bishop at all? I see this line so often it'll be a great one to add to my repertoire.
Comment: Légal's Mate is the smartest mate on this page, I never thought about it. I could've mated at least 30 opponents with it! Damn I should have read your answer long ago.
Answer: For a short mating possibility in a very standard mainline opening, one can look to the Smyslov-Karpov variation in the Caro-Kann Defense:
[FEN ""]
[Result "1-0"]
1.e4 c6 2.d4 d5 3.Nc3 dxe4 4.Nxe4 Nd7 5.Qe2 Ngf6?? 6.Nd6#

The most popular continuations are 5. Nf3, 5. Bc4 and 5. Ng5 (an aggressive try which Kasparov assayed a number of times against Karpov). The sneaky try 5. Qe2 just sets up a pin against Black's e-pawn, making the intended followup 5... Ngf6?? unplayable.
There are a mere 271 games in my database (out of several million) in which this 5. Qe2 appears, but one finds a few GMs giving it a go: Ivan Radulov, Oleg Nikolenko, Joe Gallagher (against as strong an opponent as IM Tibor Karolyi), even some guy named Alekhine (though, admittedly, only in a consultation game against a team of four amateurs). A 2300 player also tried it out against Yasser Seirawan on the black side; Seirawan didn't fall into the trap of course, but the 2300 did manage to get a draw out of the game.
If you're still reading, you're probably curious: out of the 271 games I have on record, in only 34 of them did black fall into the trap with 5... Ngf6. Alekhine's amateur foes were among the victims, and the highest rated victim was in a game Hans Speck (2140) - Nikolaus Mertens (2165) from the 1997 Liechtenstein Open. Most interestingly, on two of those 34 occasions, the white player failed to reply with 6. Nd6#. One was a player rated 1873 who went on to lose to his 2202 opponent; the other was rated 2264(!) and managed to win anyway against a 2113 on the black side.
Comment: This is an exact game sequence between GM Rapport and a 2050 odd player a few weeks ago. I can't imagine the horror.
Answer: The Scholar's and Fool's mates that others have cited are the shortest.  They rely on two different but highly important principles chess players should remember.  Scholar's mate relies on the opponent's insufficiently protected f2 (or ...f7) point, while Fool's mate relies on a weakening of the diagonal from h5 (or ...h4) to the opponent's king.
While you can actively try for Scholar's mate (and many weak amateurs fall for it), Fool's mate pretty much relies on very poor play by the opponent -- advancing the f and g pawns such that the critical diagonal is fatally weakened.  A variant of Fool's mate is more likely to occur that involves several more moves and induces the opponent to make the required weakening moves.  Consider the following sequence; White's fourth move is a fatal mistake leading to the loss of his queen or getting mated along the ...h4-e1 diagonal.
[FEN ""]
1. d4 Nf6 2. Nd2 e5 3. dxe5 Ng4 4. h3?? Ne3 5. fxe3 Qh4+ 6. g3 Qxg3#

An excellent old book that should probably be a new player's second or third book is "The Art of Checkmate", despite being so old it still uses descriptive notation:
http://www.amazon.com/The-Art-Checkmate-Dover-Chess/dp/0486201066
Comment: White's fourth move is indeed fatal but 2.Nd2 is pretty terrible and the real cause of the problem. In general terms, it's bad because it blocks in the bishop; in this specific line, it blocks the queen's escape after 4... Ne3 and means the king has no escape either.
Answer: A mate in 2½ move, derived from Wayward Queen Attack, occurs if black moves Ke7 as a panic attempt to "protect" the e5 pawn with the king, which may occur if young players move too quickly:
[FEN ""]

1. e4 e5
2. Qh5 Ke7
3. Qe5#

Comment: The king must have super powers to protect that pawn XD
Comment: Step 1: touch the king and forget to say "j'adoube".
Comment: @FedericoPoloni Yes, The correct procedure is: 1. e4 e5 (very reasonable moves). Then, while playing 2. Qh5, make a big circular movement which "accidentally" topples the black king. It is very likely that many black players would forget to say j'adoube in such a situation before placing the king upright again.
Comment: ["j'adoube"](https://en.wiktionary.org/wiki/j%27adoube): To adjust
Comment: This is also probably more common than you may think, in older games. I seem to recall the penalty for an illegal move was at one stage to move the king
Answer: [FEN "nbqnbrkr/pppppppp/8/8/8/8/PPPPPPPP/NBQNBRKR w KQkq - 0 1"]
[StartPly "3"]

1. d3 {Pyt Honisten eröffnet mit seinem Lieblingsbauern} g5 {Retho Riker antwortet mit seiner Standard-Antwort} 2. Qxg5# {Pyt Honisten ging zum nächsten Brett, während sich Retho Riker tränenreich vom Schach verabschiedete.}

With Chess960, also known as Fisher Random Chess, you can achieve it, too.
Answer: The Blackburne-Shilling Gambit could result in a quick loss for White if he plays some fairly plausible moves:
1.e4 e5 2.Nf3 Nc6 3.Bc4 {Italian opening} Nd4 4.Nxe5 {Free pawn!} Qg5 5.Nxf7 {Forking the queen and rook.} Qxg2 6.Rf1 {Preventing Qxh1} Qxe4+ 7.Be2 {Qe2 Nxe2 drops the queen} Nf3#
[FEN ""]
1.e4 e5 2.Nf3 Nc6 3.Bc4 {Italian opening} Nd4 4.Nxe5 {Free pawn!} Qg5 5.Nxf7 {Forking the queen and rook.} Qxg2 6.Rf1 {Preventing Qxh1} Qxe4+ 7.Be2 {Qe2 Nxe2 drops the queen} Nf3#  0-1

Answer: There's a 2-move checkmate, termed fool's mate:

f3 e5 2. g4 Qh4#

Fool's mate on Wikipedia
Comment: I played Fool's Mate when I was in the 7th or 8th grade.  I decided that the chess match against a neighboring school was a really good time to "invent a new opening."  I was wrong.
Comment: I also lost to it in my bizarre-paws-opening period, a careless day :D (as a 1900 ^^)
Answer: [FEN ""]

1. d4 Nf6 2. c4 c5 3. d5 b5 4. cxb5 a6 5. Nc3 axb5 6. e4 b4 7. Nb5 Nxe4 8. Qe2 Nf6 9. Nd6#

Answer: To add to the Fool's Mate idea, this game left enough of an impression on me to remember it.
[FEN ""]
1. d4 f5 2. Bg5 {An enterprising line, threatening to weaken Black's pawn structure after the natural Nf6.} h6 3. Bh4 g5!? {This seems to trap the bishop, but the holes around the Black king are very dangerous. It is objectively OK, but only if Black does not play to win material.} 4. Bg3 f4? {This move is a definite mistake.} 5. e3! {Now fxg3 leads to Qh5#, and White threatens to rescue his bishop with exf4} h5 {Renewing the threat, now 6. exf4 h4 and the bishop is still trapped} 6. Bd3 {Objectively this move isn't the best, but it threatens Bg6#} Rh6?? 7. Qxh5+! Rxh5 8. Bg6#

Comment: This is the [Teed vs Delmar](https://www.chessgames.com/perl/chessgame?gid=1242990) game (1896).
Answer: The Kieninger Trap in the Budapest gambit has trapped numerous amateurs but even some masters over the years. It involves a similar mating pattern to those found in some of the other answers. There are only so many ways to blunder a king early in the game.
1.d4 Nf6
2.c4 e5
3.dxe5 Ng4
4.Bf4 Nc6
5.Nf3 Bb4+
6.Nbd2 Qe7
7.a3 Ngxe5
8.axb4 Nd3#
[FEN ""]
1.d4 Nf6
2.c4 e5
3.dxe5 Ng4
4.Bf4 Nc6
5.Nf3 Bb4+
6.Nbd2 Qe7
7.a3 Ngxe5
8.axb4 Nd3#

Answer: Here's a simple example which I always like.
[FEN ""]
1. d4 e5 2. Bg5 Qxg5 3. Qc1 Qxc1#

Comment: Yes thanks for pointing it out! Ok changed to another short one
Comment: Well, 2 Bg5 is quite a bad blunder. White needn't hang wQ & allow mate, but Black has an advantage whatever White plays.
Answer: Against the Bird Opening (1.f4), black can play the From Gambit which threatens a kind of fool's mate:
[FEN ""]

1.f4 e5 2.fxe5 d6 3.exd6 Bxd6 4.Nc3? Qh4+ 5.g3 Qxg3+ 6.hxg3 Bxg3#

Instead of 4.Nc3, which is just an example move, 4.d4 and 4.g3 are common.
Answer: Légal's mate, which Andrew mentioned, can also occur in the Italian Opening, with a move order which is perhaps more credible:
1.e4 e5 2. Nf3 Nc6 3. Bc4 d6 4. Nc3 Bg4? 5. h3 Bh5? 6. Nxe5! Bxd1? 7. Bxf7+! Ke7 8. Nd5#.
Black has a similar trap in the Petrov:
1.e4 e5 2. Nf3 Nf6 3. Nxe5 Nc6? 4. Nxc6 dxc6 5. d3 Bc5 6. Bg5? Nxe4! 7. Bxd8? Bxf2+ 8. Ke2 Bg4#.
John Coleman mentioned the Kieninger Trap, a Black trap in in the Budapest gambit. White has two traps in the Caro-Kann that are similar to this:
1.e4 c6 2. d4 d5 3. Nc3 dxe4 4. Nxe4 Nd7 {Nf6 is better} 5. Qe2?! Ngf6? 5. Nd6#
This also works after 2. Nc3 d5 3. Nf3.


Cannot pair two phones to one car

Question: I have two phones (Samsung e5 and iPhone 6s) and two vehicles (2013 Subaru Impreza and 2015 Subaru Forester).
I tried pairing both phones in both cars (via the head unit and hands free) but cannot pair both phones. Best scenario is that one car takes the Samsung and the other the iPhone. I read somewhere that Subaru indicates that only 1 phone can be paired. Is that true? What is the procedure (if any) to solve the problem? Many thanks.
Comment: In the bluetooth settings, how many registered devices are there? Also, are you sure your phones are set to be discoverable? also do you expect both phones to connect at once? in which case this wont be the case, only one phone can be connected at any one time but a larger number may be paired.
Comment: i can only see 1 device
Answer: Looks like the manual for the 2013 Impreza says it is limited to one "registered (paired)" device. So for the Impreza you'll only be able to pair a single device.
For the 2015 Forester however, there is no notation about a pairing or registering limit, so you should be able to pair both devices to the Forester.
As Mauro noted in the comments, you won't be able to use both device at the same time, even if both are registered (paired). You can only get audio or phone functionality from a single device usually. My wife's car (2017 Accord and previously 2014 Civic) allow you to pair 1 device for phone functionality and 1 device for audio. So she could make and receive calls via the car using her phone, at the same time I could stream Pandora from my phone. It really depends on how the manufacturer programs (and also designs the circuitry for) the infotainment system.
Comment: tks for the insights. no am not planning to have both phones working at the same time. just need to have 1 phone programmed for both cars
Comment: In that case, just chose which phone and use it in bother cars. Start over and remove all pairing data from both phone and cars. As long as Subaru didn't do something ***really*** dumb, like giving the Bluetooth units the same name and is info, then it should work.
Comment: tks for the advise much appreciated

Cannot pair two phones to one car


Arguments passed on by shell to command in Unix

Question: I've been going over this question and I can't for the life of me figure out why the answer is what it is.  How many arguments are passed to the command by the shell on this command
line:<pig pig -x " " -z -r" " >pig pig pig
a. 8 b. 6 c. 5 d. 7 e. 9
The first symbol is supposed to be the symbol for redirected input but the site isn't letting me use it. [Fixed.]
I looked at this question and said ok...arguments...not options so 2nd pig, then " ", then -r" ", 4th pig and 5th pig...-z and -x are options, so I count 5.  The answer is b. 6.  Where is the 6th argument that's being passed on?
Comment: Ok thanks guys...discovered that the prof is throwing in made up commands and programs we've never heard of to throw us off on the midterm.  He has never once mentioned that there is anything in unix called pig...and if you try to man pig in the bash shell...you get nothing back so I assumed it was another argument and the command was arbitrarily to the left of redirected input.
Comment: He's not trying to throw you off--he's trying to drill into your head that it doesn't matter what the command is named or what it does. What matters is the syntax of the command line. The shell doesn't even know if the command exists at the time that it parses the command line into its argument components. All the shell knows is that the first thing on the command line not a redirection or an assignment is the name of the command and that everything following except redirections are arguments. After the shell has parsed the line, then it attempts to find the command to execute it.
Answer: The arguments passed to the pig program are:

-x
" "
-z
-r" "
second-to-last pig
last pig

From a programming perspective, it's customary to consider everything in argv (except argv[0]) an argument to the program. This includes "option" tokens -- I mean, what if the program didn't take any options at all, and instead considered something like "-x" to be a filename?
Answer: I think you're running into semantics issues with exactly what counts as an argument.
Options are, at the command line level, arguments that the command happens to treat specially. (More specifically: they are included in the argv array passed to the command.) So depending on exactly what's meant by "argument", they might or might not be included in the count. I suspect they are being included, but that the second "pig" isn't (because it's the commandname, which isn't an argument) (well, ok, it's included in argv too, but it doesn't count) (mostly).
To illustrate what I mean about options being specially-treated arguments (and the arbitrariness of the distinction), consider the following command:
tar cv -f foo.tar bar

tar is the command
cv is two options (create and verbose). I know it doesn't look like it, but tar predates consistent use of - to introduce options, and will treat its first "argument" as one or more options even if it doesn't start with -
-f foo.tar is another option and its argument (which is different from a general command argument)
bar is a normal command argument (finally!)

Note that these commands are both equivalent to the above:
tar cvf foo.tar bar
tar cv -ffoo.tar bar


Calculating composite scores of abilities

Question: I have created cognitive summary scores from a battery of 17 neuropsychological measures.  I standardized the raw scores of my patient group to the mean and standard deviation of a matched healthy control group and then averaged these standardized scores to create a composite score.  The resulting composite scores were normally distributed.  A journal reviewer is implying that the raw scores on each of the neuropsych measures had to be normally distributed in the control group in order to use this approach.  Is this so?  Could you suggest a reference that speaks to this issue?
Comment: Are you sure you mean: _standardize_ and not _normalize_?
Answer: Several issues seem bundled up together here.

Why you are standardizing (Value - mean) / SD naturally does nothing to the shape of a distribution, and the reason(s) for standardizing must be something else, e.g. washing out different measurement units or producing comparable numbers.
Why is anything being normally distributed important to your analysis? You don't spell out why it is important. To me, the distributions are what they are: they will depend on your patient samples, and if not normal that could be very interesting or important. For example, you may have some very unusual patients in there, possibly even outliers.
The more you average, the more the resulting averages will be normally distributed You don't need references for this: it is the central limit theorem. If the individual standardized scores are normal, the fit of the overall averages to a normal will be better, but starting out with normal distributions isn't essential here. You could do some simulations averaging random samples from various distributions to show that.
Normal or not is too coarse There is an overarching assumption that being normal is a yes or no matter, but it is better to think that there are just degrees of approximation to normality, poor or good as the case may be. I'd recommend that you use normal probability plots throughout in keeping track on how close distributions are to the normal.


Is stroboscope a substitution for accelerometer testing?

Question: given that handy stroboscope can also check translational vibration of parts, is it a substitute for a test that can be done by accelerometer for stationary vibrating equipment?
Comment: This is pretty much a repeat of your previous question, https://engineering.stackexchange.com/questions/40018/is-stroboscope-a-useful-device-to-control-the-translational-vibrations. If you don't get an answer to a question then please improve it rather than post it again.
Comment: No it's not a repeat, that was with focus on vibration type here the instrumentation is the focus
Answer: No. Strobes are useful for what they can do, but they are not substitutes for accelerometers.
A strobe can give you a "picture", but it doesn't measure anything except maybe frequency. It doesn't measure amplitude, harmonic content of the vibration, etc.
Also a strobe is only useful for amplitudes which are big enough to see. Accelerometers can measure high frequency vibrations with amplitudes of micrometers or smaller.


Is there a difference between red painted glass and painted red glass?

Question: Is there a difference between red painted glass and painted red glass? I guess painted red glass can be yellow, green, or etc..
Comment: @JamesK It's fairly common for Pyrex cookware to be painted glass.
Comment: Is "painted glass" common?  I see "stained glass" and "coloured glass", but do many people paint glass?
Answer: Yes, there is a difference.
As a native English speaker, the way I would naturally interpret these two statements is as follows:
A "painted red glass" is a glass made from red material, which has then been painted (with paint of any color).
A "red painted glass" is a glass made from material of any color, which has then been painted with red paint.


Identical particle state with spin

Question: We construct identical particle state by symmetrizing or antisymmetrizing the tensor product of single partice states. When considering spin, a two fermions state should be $$|\psi\rangle=\frac{1}{\sqrt{2}}(|\psi_1\rangle_{\sigma_1}\otimes|\psi_2\rangle_{\sigma_2}-|\psi_2\rangle_{\sigma_2}\otimes|\psi_1\rangle_{\sigma_1}),$$ where $|\psi_1\rangle_{\sigma_1}=|\psi_1\rangle\otimes|\sigma_1\rangle$. However, many text books said that $|\psi\rangle=|\phi\rangle\otimes|\chi\rangle$, where $|\phi\rangle$ is the spatial part and $|\chi\rangle$ is the spin part. My question is which one is correct, are the two answers coherent?
Answer: I think the question already has the answer. In this case $|\psi_i \rangle$ is the spatial part, and $|\sigma_i \rangle$ is the spin part of $i^{\text{th}}$ particle. These two are different properties and lie in seperate spaces. One is position living in a Hilbert space of infinite dimensions and the other is spin Hilbert space of two dimensions, representing an internal property. Combined wavefunction is the direct product of each space for just one particle.
Since there are two fermions associated with different spaces, we shall take the direct product of each of the particles. Anti-symmetrizing the wavefunction using Slater determinant yields the equation mentioned by OP.
See the below for detailed explanation.

The state vector $|\Psi^{(n)} \rangle$ of a system of $N$ particles is an element of the direct product space,
$$ |\Psi^{(n)} \rangle = |\psi{(1)} \rangle \otimes |\psi{(2)} \rangle \otimes |\psi{(3)} \rangle \otimes \cdots \otimes |\psi{(n)} \rangle $$
formed from the $N$ single-particle spaces $|\psi(i) \rangle$ associated with each particle.
There are various properties (more precisely, degrees of freedom) associated to each particle, e.g. position, spin etc. and each of them lives in a different Hilbert space of certain dimension. For two properties $P_1$ and $P_2$ that are independent of each other for a particle, dimension $N_1$ and $N_2$, respectively (either or both of which may be infinite), the combined system should be represented as,
$$P_{12} = P_1 \otimes P_2$$ of dimension $N_1 \times N_2$.
The main point of this digression is that the state space of one spin-$1/2$
particle can be represented as direct product,
$$|\Psi \rangle = |\psi_{\text{spatial}}\rangle  \otimes |\sigma_{\text{spin}}\rangle$$
of a quantum space $|\psi_{\text{spatial}}\rangle$ describing the particle's spatial state (which is spanned, e.g., by an infinite set of position eigenstates $|\mathbf{r}\rangle$), and a two-dimensional quantum space $|\sigma_{\text{spin}}\rangle$ describing the particle's internal structure.
Answer: Neither answer is right in general.

The only actual requirement is that the state be [anti]symmetric with respect to exchange. That's it.

The first state you give, $|\psi\rangle=\frac{1}{\sqrt{2}}(|\psi_1\rangle_{\sigma_1} \otimes|\psi_2\rangle_{\sigma_2}-|\psi_2\rangle_{\sigma_2} \otimes |\psi_1 \rangle_{ \sigma_1})$, is a special case, but it is not general. This can be thought of as a single 'configuration', or Slater determinant, and those are often good approximations in the absence of strong correlations. But there are valid states which are superpositions of multiple different Slater determinants and cannot be reduced into this form.

The second state you give, $|\psi\rangle=|\phi\rangle\otimes|\chi\rangle$, generally with spatial and spin parts of definite exchange symmetry, is again a special case, in which the spatial and spin parts are factorizable. If the system's hamiltonian has no spin-orbit coupling, then you are guaranteed an eigenbasis of states of this form. But in general (i) states need not have this form, (ii) your system's hamiltonian may well have spin-orbit coupling, and thus (iii) the eigenstates won't have this form.
Comment: Thanks a lot! I think the point is that both of them are basis of the fock space, then definitely they are not eigenstates for a general Hamiltonian with interaction, but any state can be expressed as linear combination of them.

Identical particle state with spin


Creating a CNN for object detection

Question: I want to create a convolutional neural network to identify a particular object in an image, say a guitar. I know there are a lot of posts and answers about this but I'm very new to this field and am not being able to find a simple explanation. If I have the coordinates for any guitar in an image how do I convert that to vector/tensor can someone please tell me??
Just a few steps as to what I should do next would be very helpful! Thanks!
Comment: you need a lot of guitar images. there's a large number of examples in internet with MNIST sample, that recognizes digits. I'd start with them
Answer: To train a neural network you need lots of examples (10'000s typically) where you have the correct answer.
More generally, I like the explanation by Ujjwal Karn and Adit Deshpande.
After that, Tensorflow has good tutorials. Starting with this will be a good start so that you will understand the following tutorials on CNN's (this and this tutorial) better.

Creating a CNN for object detection


context-free grammar

Question: How we could create a context-free grammar that generates sentences of arbitrary length like:
the cat died.
the cat the dog chased died.
the cat the dog the rat bit chased died.
the cat the dog the rat the elephant admired bit chased died.
 this is what I think but not sure
s-NP VP
NP- det Nom
Nom- N
VP- V
Det- the
N- cat, dog,rat, elephant
v- died, admired, bit, chased
is that correct?
Comment: Do you care if it also generates sentences like the the the died cat dog?
Comment: yes, it should exactly generate sentences like above, the+noun.
Answer: No, you need additional rules.  Here are your rules (I rewrote them so I could read them):
S -> NP VP
NP -> Det Nom
Nom -> N
VP -> V
Det -> the
N -> cat, dog, rat, elephant
V -> died, admired, bit, chased

And below, I've started to make a tree for "the cat the dog chased died", but your rules give me no way to get "the dog chased" into its place as a modifier of "cat".
[S NP VP]
[S NP [VP V]]
[S NP [VP [V died]]]
[S [NP Det Nom] [VP [V died]]]
[S [NP [Det the] Nom] [VP [V died]]]
[S [NP [Det the] [Nom N]] [VP [V died]]]
[S [NP [Det the] [Nom [N cat]]] [VP [V died]]]
...
[S [NP [Det the] [Nom [N cat] ?? the dog chased ?? ]] [VP [V died]]]

Comment: Would you please draw a tree for the sentence like the cat the dog the rat the elephant admired bit chased died? I got confused. Thanks alot.
Comment: No, @liza, I'm leaving the rest of the problem for you.  It will be fun.  I think you can do it with just one additional rule.
Comment: I'm not convinced the relationship between the rules and the tree is clear to you.  You have to use the rules to build the tree.  How does the S "the dog chased" in this example get into the tree?  You need to add a new rule to the rules you already have to get it into the tree.
Comment: I got it, thank you. But I have another question. I read somewhere that we creating center-embedded sentences could occur until the level 3 like the cat the dog the rat bit chased died. is that correct? why?
Comment: I don't know that there is a precise cut off at 3, but center embedded constructions do become much more difficult to understand as the level increases.  It is not known why.  Analogies to computer programming suggest that once a constituent has been completely analyzed, the processing resources it used during the analysis is freed up and available for other uses.  But before the analysis is complete, resources are still tied up, and this can interfere with the processing of a new instance of the construction.
Answer: Altho' it looks like a homework question, here are some useful rules:
S ->  ε
S -> NP S VP
NP -> Det N
VP -> V
Det -> the
N -> cat
N -> dog
V -> chased
V -> died

Add more rules for other terminals (bit, admired, rat, elephant, ...). I didn't care for generating initial capitalisation or interpunctuation (you can add this if you care).
Comment: I don't think that we need the first line(S ->  ε). is it possible to write parse tree for center-embedded sentences? should we rewrite these sentences with "that"?
Comment: The first rule says that S may be empty -- nothing there.  Look at the second rule and try to match up the parts of the rule with the example "the cat died".  In S -> NP S VP, the first S is for the whole example "the cat died", the NP is for "the cat", there is nothing for the following S, and VP is for "died".  The first rule says it is okay for nothing to correspond to the S.  (I wouldn't do it this way.)
Comment: Somehow the sentence generation must terminate. But is is probably better to have the rule S -> NP VP. This excludes the empty sentence from the "language" (in computer science sense).

context-free grammar


Statistics exercise with bayes theorem with 4 events

Question: I got confused with the probabilities:
ABC airport has $3$ terminals: $T_1$ is for international flights, $T_2$ just for national flights and $T_3$ for regional flights. From all flights departing from the airport $10\%$ are international and $30\%$ are national flights. The probability of an international flight having a delayed departure is $0.10$; from those flights having delayed departures $20\%$ are regional flights, the probability a flight has a delayed departure is $0.05$.
a) What is the probability that a national flight, randomly chosen, has a delayed departure?
b) It is known that a specific flight has had a delayed departure. From which terminal is more probable it has departed?
I have already defined events ( but I'm not sure if they are correct)
$P[T_1]= 0.1$; $P[T_2]= 0.3$; $P[T_3]= 0.6$; $P[D \mid T_1]= 0.1$; $P[T3\mid D]= 0.2$; $P[D]= 0.05$, while $D$ is an event that the flight was delayed. How to solve this excersise?
Answer: It is easy to see that $(D \cap T_i) \cap (D \cap T_j)= \emptyset$ for all $ \mathcal i,j $ so these sets are a partition of D.
Now by what we were given we compute:

$P( D \cap T_1)= P( D| T_1) P(T_1)=0.01$
$P(T_3 \cap D)= P(T_3|D) P(D)=0.01$

Now, we have (why?): $ P(D)= P(D \cap T_1) + P(D \cap T_2) + P(D \cap T_3) $
So we get that $ P(D \cap T_2) =0.03$.
I hope this helped.


How to avoid certain notes ringing out when played with distortion

Question: When I play a certain note like the 9th fret on the G string or the 8th fret on the B string (it is more prominent with higher notes) it seems to ring out almost like reverb but I have no reverb on my amp. It is only annoying when I play single notes (like a solo) and it rings out after I've lifted my finger off the note or even tried to mute it. I guess it's almost like a harmonic being played but my finger is on the space in between the fret. It only stops ringing if I put my entire palm on the string. My guitar is an Ibanez GRX70QA and my amp is a Blackstar V3 10W. I would say there's something wrong with the amp (even though it is like new and working perfect) but I've tried this with other amps and it still happens so I think it might be my guitar or possibly because I have distortion on?
Comment: It's more likely your technique than anything else. When you go to stop the note, are you muting *all* of the strings?
Comment: Probably linked : https://music.stackexchange.com/questions/104170/striking-open-b-e-high-strings-causes-newly-purchased-classical-guitar-to-re
Comment: It would help a lot if you can post an audio clip (video even better) of the issue occurring. Most people are telling you it's an issue with your technique but it would be good to rule out other things.
Answer: Muting guitar strings is a bit tricky, especially if you use lots of distortion, and is a significant part of playing technique you need to learn.
Whenever you play a note (or even a note is played by another source close to the instrument), other strings may also resonate with sympathetic vibration.
What might not be obvious is that strings can and do vibrate with many frequencies besides the fundamental frequency: there are also harmonic components an octave above, octave + fifth, 2 octaves and further up. Various frequencies of the note you play can excite various harmonics on other strings. E.g. the note on 9th fret of the G string is E4, and it can excite harmonics on both E strings, and also the A string. The note on the 8th fret of the B string is G4, and will excite G string, maybe also A string. The only solution to this is to make sure to mute all strings. There are various ways to do that, using both hands.

I guess it's almost like a harmonic being played but my finger is on the space in between the fret.

Touching a string with a single finger might be insufficient to mute it, especially when the finger is close to the harmonic node. As you noticed, you need to use whole palm or several fingers touching at various points. This is particularly tricky because depending on the part of the neck or specific notes you play the same muting technique may or may not work.
Answer: In addition to sympathetic resonance from other strings, on guitars with vibrato tailpiece the vibrato springs can resonate too. You can tell this from strings resonating by muting all strings for a short moment. If the sound comes back after you free the strings, it's the vibrato.
If it's the vibrato, there are tricks for muting it like piece of foam in the cavity, rubber tubes around the springs or just changing the tension a bit to change the resonance frequencies to some rarely used key.
On some guitars the piece of string between nut and tuner can vibrate too, and some guitarists like to mute it.
Comment: Good point. In tune-o-matic also the part of the string between the bridge and the tailpiece can resonate.
Comment: wondering if some occurrances of the word "strings" in the first paragraph should read "springs"?
Comment: @Yorik yes, fixed now
Comment: The string section between Jazzmaster-style vibrato and bridge is on the other hand awesome and should not be muted.
Comment: I stuff little tubes of rolled up paper into my springs to dampen this effect.
Answer: Guitarists all have to learn at some point to mute the strings not being played, particularly when using high volumes or distortion.
The reasons are exactly as user 1079505 states, and are a part of guitaring.
We all have to find our own way of muting the unplayed strings - palm of playing hand, fingers of each hand, very careful playing - and there is no one way that works for all. Keeping a good distance from the amp also helps.
Answer: maybe you are not releasing the fret in a clean way? try to do it slower and in a 90° angle away from the neck, do you know what pull offs are? Maybe you are accidentally doing that?, also, try muting strings with your left and right hand, by resting your right hand palm on the bridge and bringing it onto the string you wish to mute, it is very far away from harmonics there but still very accessable and works for me when i play stuff from (Enter any thrash, power, glam or groove metal band name here)


Installed Virtualbox guest additions on host

Question: I just ran:
sudo apt-get install virtualbox-guest-additions-iso
on my host (Ubuntu 13.10). I was hoping to get a copy of the iso file, but I'm afraid that it may have installed the guest additions on my host machine. The only problem that I have seen (so far) is that VirtualBox has lost all of my virtual machines. The directories and files are still there, but VirtualBox does not see them.
Have I messed up my host OS by installing guest additions on it?
Is there a way to get back my virtual machines?
Comment: What? Why would you install GA on your system?
Comment: I was trying to load the ISO file for guest additios. It was probably already on my system, but I was looking in the wrong place because the VirtualBox docs give the wrong location.
Answer: No harm done. The package virtualbox-guest-additions  of the repositories will only install the CD-ROM .iso file in /usr/share/virtualbox/VBoxGuestAdditions.iso.
What may have happened however is that as a dependency you also had installed the OSE edition of Virtual Box from the repositories. This will override the installation of Virtual Box from the Oracle repository or a downloaded DEBIAN package. You will have to remove the OSE version again
sudo apt-get purge virtualbox

before you will be able to reinstall a newer version of Virtual Box. Your virtual machines will not be touched by this.
Comment: Everything seems to be working now (without re-installing the OS). I removed VirtualBox, then re-installed the latest version from www.virtualbox.org. A couple things that I wish I knew earlier: The ISO file is in /usr/share/virtualbox/VBoxGuestAdditions.iso (as you said), but older documentation gives a different location. The one ISO file contains the guest additions for all platforms. When you look at the drive on the guest system, you can see all of the versions. On Windows it automatically loads the correct version, on Linux you have to manually choose the linux version.
Comment: If you choose to install guest additions from Virtual Box Manager only the appropriate .iso will be loaded.


How can I disable truncated long filename in icon view?

Question: I would like to know how I can disable the feature in nautilus which truncates long filenames in icon view? I beleive there may be a gconf key which controls this but I'm not sure which specific key, if it exists, or has to be added manually.
Answer: They gconf key you're looking for is /apps/nautilus/icon_view/text_ellipsis_limit
Basically you just need to set it to [0] and it won't truncate at any zoom level
Here is the full description from gconf if you're curious:

A string specifying how parts of overlong file names should be replaced by ellipses, depending on the zoom level. Each of the list entries is of the form "Zoom Level:Integer".
For each specified zoom level, if the given integer is larger than 0, the file name will not exceed the given number of lines. If the integer is 0 or smaller, no limit is imposed on the specified zoom level. A default entry of the form "Integer" without any specified zoom level is also allowed. It defines the maximum number of lines for all other zoom levels.
Examples: 0 - always display overlong file names; 3 - shorten file names if they exceed three lines; smallest:5,smaller:4,0 - shorten file names if they exceed five lines for zoom level "smallest". Shorten file names if they exceed four lines for zoom level "smaller". Do not shorten file names for other zoom levels. Available zoom levels: smallest (33%), smaller (50%), small (66%), standard (100%), large (150%), larger (200%), largest (400%)
Answer: The other answer from @swrobel is right.
A note for Gnome3 users (like Ubuntu18, 19): you need to use dconf-editor, and the dconf key is /org/gnome/nautilus/icon-view/text-ellipsis-limit. Then set the key to 0 and it won't truncate filenames at all.