Why is attaching a JPanel better?

Question: I've just started coding video games and I've heard that doing all your drawing on a JPanel and attaching that panel onto a JFrame is better than simply drawing onto the JFrame. I was just wondering why is this better?
Comment: @mre  It is something I commonly recommend (or close to that - see my answer), but am also interested to hear the OP's exact source on that info.  To the person asking the question.  This would become a 'good question' with that small extra amount of information.
Comment: +1 , one of the few Java questions I know the answer to. Once created a [Java RPG Game](https://github.com/intermediate-hacker/Pro_RPG), thoroughly enjoyed it. :)
Answer: It is better for various reasons, including:

In most Swing components, custom painting is achieved by overriding the paintComponent(Graphics) method.  Top-level Swing containers (e.g. JFrame, JApplet, JWindow) have only paint(Graphics).  As a result of the common method for painting, people who answer often forget about this difference between common and top-level components, and therefore suggest silly advice.  ;)
A JComponent can be added to a JFrame, or a JApplet, or a JDialog, or a constraint of a layout in a JPanel, or a JInternalFrame, or a..  Just when you think your GUI is complete, the client says "Hey, wouldn't it be great to throw in a tool-bar & offer it as an applet as well?"  The JComponent approach adapts easily to that.
As explained (complete with code!) by Richante, it is easier to calculate the co-ordinates required for painting the custom component, and if it has a preferred size, to size the JFrame to be 'exactly the right size' to contain the GUI (using pack()).  That is  especially the case when other components are added as well.

Now, two minor disagreements with the advice offered.
If the entire component is custom painted, it might be better to simply put a BufferedImage inside an ImageIcon/JLabel combo.  Here is an example of painting to an image. When it comes time to update it:

Call getGraphics() for a Graphics or createGraphics() for a Graphics2D
Draw the custom painting to that graphics instance
Dispose of the graphics instance
Call repaint() on the label.
Comment: There's some benefit to getting the panel's UI delegate.
Comment: No, I'm too tired & distracted to make good use of your time.  I'll keep knocking about here for the moment where I can afford to make mistakes & waste people's time, read the document later, and take it up as a question.  Thanks for the offer. :)
Comment: I recently encountered this interesting [counter-example](http://stackoverflow.com/a/11744971/230513) in which the `JPanel` UI delegate was the problem. Switching to `JComponent` was the solution.
Comment: @trashgod  Thanks for reminding me.  There are some things though, that I do not understand.  1) It seems that the panel UI is obtained from [`JPanel.getUI()`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JPanel.html#getUI%28%29), is that correct?  2) Why would a `JComponent` not (have/have access to) a UI delegate of it's own?  3) Should I start my own question(s) on these matters?
Comment: A `JComponent` has no delegate itself, but it provides some basic infrastructure for subclasses that do. [*How to Write a Custom Swing Component*](http://today.java.net/pub/a/today/2007/02/22/how-to-write-custom-swing-component.html) is an example.
Comment: Thanks, I saw that article from a link you had posted in one of your earlier answers ( I thought to try trawling 'trashgod+UI+delegate' before asking ;), but cannot say I've (either read it thoroughly or) understood it.  I'll look more closely at it.
Answer: It is an easy way to do Double Buffering.
Let me elaborate a bit. In video games, to avoid the flicker caused by redrawing and display smoother graphics, people usually use double buffering. They create an offscreen surface, draw everything on that and then display the entire off-screen surface on the screen  in one go.

In Java2D and Swing, the easiest way to do this, is to simply do your game sprite drawing on a JPanel, and then add the JPanel to a JFrame.
Secondly, by drawing things on a JPanel, you allow more GUI widgets and other graphical objects to be displayed on the JFrame without having to paint them manually in the game loop. For example buttons, menus, other panels, even other rendering JPanels.
Thirdly, it allows you to use automatically translated co-ordinates for your game. You can draw everything from the top-left to the bottom-right without having to worry about the window manager specific things like window border-widths, task panes, titles etc.!

Moreover, this is not just a convention only used by Game Programmers in Java. Creating a separate Game Board, Render Panel or Graphics Widget is quite popular when programming games using a library with an internal mainloop such as a GUI Toolkit. You can use a User Form in Windows Forms and a Drawing Board in GTK+.
Comment: Drawing an image on a JPanel and then adding the JPanel to the JFrame is not how to do double-buffering. I'm pretty sure you can double-buffer in a JFrame.
Comment: @Richante I know very well you can double buffer in a JFrame, what I said was using a JPanel is the _easiest_ way, not the _only_ way to do double-buffering with Java2D and Swing.
Comment: @Richante also, why isn't it a way to do double-buffering? It's used pretty often for that very purpose.
Comment: Oh yes, I didn't notice that JPanel was double-buffered by default. You're probably right about that then.
Answer: The JFrame includes things like the menu, title bar and border. Therefore, when you refer to coordinates you have to account for these. You might also decide to add a menu bar, or some other components, to the frame. If your painting is all in a JPanel, then this won't change how you need to refer to coordinates.
For example, try:
public class Test extends JFrame {

 public Test() {
   super();
   setVisible(true);
   setBounds(100, 100, 200, 100);
 }

 @Override
 public void paint(Graphics g) {
   g.fillRect(0, 0, 50, 50);
 }

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

}

and you will see that the black square is not square! Because (0, 0) is the top left corner of the entire frame, not the corner of the visible area.

Why is attaching a JPanel better?


Using the phrase 'for instance'

Question: Is it correct to say, "Here's a for instance . . ."?  (Meaning, "Here is an example")
Comment: Yeah. Not in formal writing, though it's common enough in speech.
Comment: It's a logical confusion of "types" of syntax, similar to saying "here's a running." I may understand it (it is somewhat common), but it make me wince every time I hear it.
Answer: I'm not sure how you would define "correct". But that is, indeed, a very common pragmatic usage in British and American speech--in my experience, especially in business contexts.
As I've never seen it written (even in reported speech), I'm not sure whether it is usually hyphenated or put in single scare quotes. But I would probably do one or the other to aid readers unfamiliar with your usage in disambiguating from the prevailing function of 'for example' as a sentence-modifying adjunct. Personally, I wouldn't write it except in reported speech, but I'm sure people do.
The usage is similar to saying "I do have a 'but' though" where 'but' refers to a caveat. in both cases, a phrase is being used as a placeholder for a description of its usual semantic function (or the class of things that would usually follow it).  Syntactically, they are both functioning as a noun phrase despite being lexically another part of speech (an adverb and a conjunction, respectively).

Using the phrase 'for instance'


According to Genesis 3:1, what could be God's necessity to create serpent(intelligence) to act aginst self

Question: According to Genesis 3:1, God created the serpent to be crafty and gave the serpent the ability to use the given intelligence.  That means there should not be the disobedient intelligence that will act against God: how is it possible that serpent(intelligence) could act against God's self?
Comment: ... _and the people spake against God ... and the Lord sent fiery serpents ... and they bit the people ..._ Numbers 21:5,6.
Comment: For the purposes of this site asking "Why did God..."  is almost always off topic, unless you prefix it with "according to X".  You can think that X is the source of ultimate truth, but you need to include X or else the question is answerable only by God.
Comment: people who are not eager to know the truth are seeking truth and proclaiming to be knowing the truth
Comment: https://christianity.stackexchange.com/q/61503/23657.  This related question and it's answers may interest you
Answer: Crafty is not necessarily bad.

Behold, I send you forth as sheep in the midst of wolves: be ye therefore wise as serpents, and harmless as doves. Matthew 10:16 (KJV)

It is the use of God-given talents against God's will that makes it sin.
God also has perfect foreknowledge, so He did know exactly what would occur.
Comment: so god knew that he is about to introduce sin to the world
Comment: why god permits to use his power against him i think god wants a fighter for him to fight with
Comment: and comments are blocked because they can not handle truth but rely on self definition of their own truth


Can I assign a language for each iMessage contact?

Question: I write iMessages in different languages, depending on who the message goes to. Text input is very difficult if auto-completion/correction is using the wrong dictionary. Is there a way to assign a language for my contacts, so that iMessage will pick that up? Or if not, is there at least a quick way (without leaving the app) to switch languages manually?
Comment: I asked Apple for this feature through [their feedback form](http://www.apple.com/feedback/iphone.html) 4 years ago. Still I have to tap the globe practically every time I write a message on my stupidphone. Especially strange for this multinational company to expect users to monolingual. I am switching between three languages all the time, why can't my 'smartphone'?
Answer: I don't think automatic switching is available at the moment but a quick way to switch manually without leaving the app is to enable multiple keyboards. You can do this is Settings -> General -> Keyboards.
Your keyboards will now have a globe button next to the 123 button to enable fast switching by tapping the globe and you can hold it down and select the desired language :)
Having the keyboard in a different should change the dictionary and autocorrect features automatically.
Hope this helps


Remove new tab and close tab buttons in Chrome

Question: I always use ctrl + T to open a new tab, so I have no need for the new tab button. I'd also like to remove the close tab buttons since I always close tabs with ctrl + W.
Comment: You cannot just change a setting to achieve this. However, there is an alternative, as Google open-sourced the software. You could dive into the open-source version, the Chromium project, and modify the code to disable the display of these buttons. You need some programming skills to achieve this.
Answer: Currently there seems to be no way to prevent close button from showing up (source), but a way to greatly shrink the horizontal space used by tab title is to pin it (this will remove both title and remove button).
Pinning the tab cannot be done directly, but these methods might help:

Automatic pinning based on URL: URL Pinner Extension
Obtain a shortcut for pinning: Ferro extension - Alt-Shift-P


PhD application research interest

Question: I am applying for PhD programs in the USA, one of the schools requested a PhD research interest. The problem is I do not know how to write it, and I didn't done any research in my masters degree, are there any solution?
Comment: Please don't ask the same question multiple times.
Comment: Don't you have an area of research in mind that you want to pursue during your PhD?
Comment: Are there any research topics you find interesting? Then write about them, why you like them, and what kind of things you would like to do!
Answer: For the abstract just state you did a masters without a thesis. Universities are used to the fact that not all applicant followed a standard model for their prior studies.
As for research interest I'm unclear what the challenge is? I would pick a topic that is not too general (cell biology) so that the interest is hard to elaborate on or too specific (Actin-related protein 2/3 complex subunit 1B) as to suggest hyper-specialization. Make sure you pick a topic that can be studied in the program you are applying to and explain why it is interesting to you.
Answer: You need, at least, to name a subfield of your major field. Not mathematics, say, but functional analysis or something. Narrow is good, but not so narrow that it would be hard to find an advisor. Hopefully you have given this some thought.
If you have any ideas about specific problems in that area it will be a plus, but not everyone has those on entry and needs to discuss with (potential) advisors before getting started.
For someone with just a bachelors degree, less would be required. Having a masters they will expect a bit more. But not a detailed research plan.
Comment: How do I structure it? my area is construction engineering management, should I talk about my work experience and the problems that I have observed, then  I talk about the area that I want to do research?

PhD application research interest


C When division, MSB get set

Question: I'm working on a memory address based problem and I found this is very confusing (Below algorithm is mainly calculate the address difference between "Value" and "nv_var.EEStart"):
    ValueI = (int*)(Value);     // ValueI is int*
    EP = (int)(&nv_var.EEStart);            // EP is int
    E = (long)(EP);                         // E is long
    V = (long)(ValueI);                     // V is long
    adr = (V - E) / 2L;                     // adr is long
    printf("Current V: %.8x\n", V);
    printf("Current E: %.8x\n", E);
    printf("V-E    is: %.8x\n", (V - E));
    printf("V-E/2L is: %.8x\n", (V - E) / 2L);
    printf("address is %.8x\n", adr);

Then I got the following output:
Current V: 00439488
Current E: 004391e0
V-E    is: 000002a8
V-E/2L is: 80000154
address is 80000154
Modbuss address:-2147474308

What confused me is my V-E is actually the expected result, but when I divide this number by 2, the result should be 0x00000154, but I got 0x80000154. I'm using gcc compiler without any extra flag, and  the expected result should be 0x154.
I can improve it easily by masking off the MSB, but I just wondering why this will happen.
Thanks for all the help.
Comment: Since `E, V, adr is long`, use `%.8lx`, ` and enable all warnings.
Comment: `V = (long)(ValueI)` is suspcious.  I'd expect `V = *ValueI`
Comment: Except you give more code. The best is full-code of your program.
Answer: Your program has potential and actual undefined behavior all over the place, but the core problem is likely in part of the code you're not showing: the types of E and V. I suspect they're long. At least (V-E)/2L has type long (or wider), and when you pass that as the argument for a %x format specifier, you get undefined behavior. What's likely happening is that V-E has nonzero bits above bit 31, and your system's implementation of printf (or argument-passing ABI) masks off all the bits outside the size of unsigned int when printing/reading an argument for %x. But after dividing by 2, a nonzero bit 32 has been shifted down to bit 31 and shows in the (UB) printf output.

C When division, MSB get set


Where does the expression "A little birdie told me" come from?

Question: I see and hear this over and over again, and I have not the slightest idea where it comes from.
Comment: The 1965 musical *Man of La Mancha* contains a song called "Little Bird". The expression is obviously older, but there's nothing like a show tune for keeping something in the public mind.
Comment: I am reminded that there was a 50s TV quiz show in the US where questions or answers or some such arrived at the announcer's table via a mechanical bird.  I have always associated the saying with that, but it's a memory from when I was like 8-10 years old.  (There was also sometimes a duck or birdcage involved in *You Bet Your Life*, but I'm pretty sure that not what I'm remembering.)
Comment: For the life of me, I could not get the birdie to tell me. [I hope some humor is allowed]
Comment: It's something that the snake hissed.
Answer: According to 'Brewer's Dictionary of Phrase and Fable', from Ecclesiastes x. 20:

Curse not the King, no not in thy thought; . . . for a bird of the air
  shall carry the voice, and that which hath wings shall tell the matter.
Comment: +1: I don't know if the explanation is totally correct, but it certainly makes a lot of sense, and I'm inclined to believe it.
Comment: Well, I fail to see how one could naysay this. :)
Answer: From The Phrase Finder

Various authors over the centuries, including Shakespeare, have made
  reference to birds, feathered or otherwise, giving messages. The first
  that comes close to our current version of this phrase is Frederick
  Marryat, in Peter Simple, 1833:
"A little bird has whispered a secret to me."

Wikipedia

Peter Simple is an 1834 novel written by Frederick Marryat about a
  young British midshipman during the Napoleonic wars. It was originally
  published in serialized form in 1833

Phrase Finder
 says that the root source of this expression probably is biblical, from Ecclesiastes; see Barrie England's answer, above.
(The phrase "feathered or otherwise" seems odd.  I thought all birds, by definition, had feathers.)
Answer: The first thing that came to my mind were Odin's ravens, Thought and Memory who "brought information to Odin".
https://en.wikipedia.org/wiki/Huginn_and_Muninn
On Wiktionary, they make reference to the same Bible phrase AND a connection to Norse mythology.
https://en.wiktionary.org/wiki/a_little_bird_told_me
Comment: Interesting speculation, but speculation it is.  Your answer would be better if you could back this up.  Many centuries probably elapsed between Odin's ravens and when the "little birdie" expression first appeared.
Comment: Hi there.. I was just offering a theory.  However, the fact that there is a distance of centuries doesn't invalidate what I suggested.  Anyone who had a passing interest in mythology could easily have referenced Odin's ravens in this context.
Answer: There is also this verse from 1810, Charles and Mary Lamb's Poems for Children, The Boy and the Skylark:
"A wicked action fear to do,
When you are by yourself; for though
You think you can conceal it,
A little bird that's in the air
The hidden trespass shall declare
And openly reveal it."
Answer: Reference works discussing 'a little bird told me'
There is a considerable time difference between the earliest occurrence in English of a bird confiding information to a person and the earliest occurrence of the exact phrase "a little bird told me." Following are the entries for the phrase in several reference works that address the issue of its origin.
From Christine Ammer, The American Heritage Dictionary of Idioms, second edition (2013):

little bird told me, a A source one cannot or will not identify gave this information, as in How did you learn that they were getting a divorce?—Oh, a little bird told me. Versions of this idiom date from ancient times and appear in numerous proverb collections.

From Darryl Lyman, Dictionary of Animal Words and Phrases (1994):

a little bird told me In the ancient world, birds were revered for their powers of flight and vision. Many Greek and Roman soothsayers claimed birds as their sources of information. And in the Bible (Ecclesiastes 10:20) there is the following passage: "...a bird of the air shall carry the voice, and that which hath wings shall tell the matter." The idea of a bird carrying messages was picked up in later years, so that today when a person wants to keep a secret, or to claim intuition as, a source of information he says a little bird told me.

From Gregory Titelman, Random House Dictionary of America's Popular Proverbs and Sayings, second edition (2000):

A little bird told (whispered to) me. I won't name the source of my information. Usually used as an evasive answer to the question of how one learned something secret. The idea is of Biblical origin. The earliest form of the saying was included in John Heywood's collection of proverbs (1546). In 1583, Brian Melbancke wrote in Philotimus: "I had a little bird, that brought me newes of it." In 1711, in "Letter to Stella," Jonathan Swift came close to the current version: "I heard a little bird say so."

Curse not the king, no not in thy thought; and curse not the rich in thy bedchamber: for a bird of the air shall carry the voice, and that which hath wings shall tell the matter. Ecclesiastes, 10:20, Authorized Version, 1611.

From Robert Hendrickson, The Facts on File Encyclopedia of Word and Phase Origins, fourth edition (2008):

a little bird told me. One scholar suggests that this familiar expression may have originated with the similar-sounding Dutch expression Er lif t'el baerd, which means "I should betray another." More likely the idea behind the phrase is in the noiseless flight of a bird, reinforced by a biblical passage from Eccles. 10:20: "Curse not the kind [sic], no not in thy thought, ... for a bird of the air shall carry the voice, and that which hath wings shall tell the matter." Used by Shakespeare and Swift, the expression dates back to at least the 16th century.

Precursors of the expression in the wild
Here is the instance from John Heywood, Proverbes (1546), cited in Titelman's entry for the phrase:

But as yee say ; where fyre is, smoke will appeere. / And so hath it done, for I did lately heere, / How fleck and his make use their secret haunting, / By one byrd, that in myne eare was late chaunting.

And here in fuller context is the instance from Brian Melbancke, Philotimus: The Warre Betwixt Nature and Fortune (1583), also cited by Titelman:

But seth I meane to bee angry with you, I will shewe yow the cause of all my garboile. Your late compacted iourney, was not so smothered in hugger mugger, but that I had a litle bird, that brought me newes of it: & when I heard it, I was aggreued, as sicke as a chick, but much more was I angry, when being in your mouth, (as Plotina said) you spit me out like a sluttish morsel and being your next neighbour, and of a little acquaintaunce, you woulde not remember all this vacant time, to let me haue notice of your intent, but left me desolate, taking your flight sodeinly, & now when I haue you, you are gone againe by this time:

I'm not sure what wording in Shakespeare's plays Hendrickson has in mind in his entry for "a little bird told me," but one candidate is line from Henry the Fourth, Part 2 (by 1599):

Prince John. I will lay odds,—that, ere this year expire, / We bear our civil swords, and native fire, / As far as France: I heard a bird so sing, / Whose musick, to my thinking, pleas'd the king. Come, will you hence?

George Steevens, an eighteenth-century Shakespearean commentator, offers the following note about this line:

——I heard a bird so sing,] This phrase, which I suppose to be proverbial, occurs in the ancient ballad of The Rising in the North:

"I heare a bird sing in mine eare. / That I must either fight or flee."

The ballad "The Rising in the North" describes the northern insurrection of 1569, so it is "ancient" only in the sense that anything from the sixteenth century is. Here is the quatrain in which the lines quoted by Steevens appear:

Earle Percy is into his garden gone, / And after him walkes his faire ladìe; / "I heard a bird sing in mine eare, / That I must either fight, or flee."

Earle Percy is using a form of "a little bird told me" to explain to his wife, Lady Anne, why he is choosing this moment to take up arms against Queen Elizabeth.

Early matches for the expression in the wild
With regard to the specific phrase "a little bird told me," the earliest (almost) exact match that a Google Books search turns up is from William Shenstone, "Of Books and Writers," in The Works in Verse and Prose, of William Shenstone, Esq; Most of Which Were Never Before Printed (1764):

"A bird in the air shall carry the tale, and that which hath wings shall tell the matter." Such is also the present phrase—"A little bird told it me,"—says nurse———

Shenstone died in February 1763, so the "present phrase" was in use at least that early. Following are some other eighteenth-century instances of the phrase.
Sophia Lee, The Chapter of Accidents: A Comedy, in Five Acts, fourth edition (1780/1782):

Grey [an infirm Clergyman]. For years did she increase in goodness as in beauty; the charm of ev'ry young heart, and the sole comfort of those old ones, to whom heav'n and man seem'd to have consign'd her for ever.
Governor Harcourt. Well, well; I had a little bird told me all this----

From a speech by Edmund Burke, in The Parliamentary Register; Or, History of the Proceedings and Debates of the House of Commons ... During the Sixth Session of the Sixteenth Parliament of Great Britain (1789):

Whether the putting off the business in the House of Lords the preceding day, had been owing to a difference among Ministers, he [Burke] knew not; but there was a little bird, a small robin red-breast, which sung that something like it had happened ; and when he talked of a little bird, he borrowed the idea from the right honourable gentleman's father, who had said, a little bird told him that the Lords of the Bedchamber were at a certain time, supposed to exercise their influence in a manner not absolutely proper. The same bird, Mr. Burke remarked, had whispered to him that three was a reason for not proceeding as had been intended, and for suddenly shifting the business upon their shoulders.

Conclusion
Precursors of little birds revealing secret information to others go back in the print record at least Ecclesiastes. John Heywood records a somewhat similar expression in his Proverbes (1546). The earliest near-exact match for "a little bird told me" that a Google Books search returns is from a fragment written by William Shenstone no later than 1763 and published in 1764, and the earliest exact match for "a little bird told me" appears in The Chapter of Accidents, a play by Sophia Lee that was first published in 1780.


using Mosaic to new Raster

Question: I have 2 tiffs to mosaic which overlap and there is a order to display them right,  When using Mosaic to New Raster the first file I input will be overlapped by the second input file?
Answer: There is a switch 'Mosaic Operator' which controls the order of layers. If you keep default which is 'LAST', the former will be overwritten by the latter as you assume.

using Mosaic to new Raster


What is the meaning of Noor of Allah

Question: I want to ask what does it means when we say Allah is noor does it means that Allah is a physical light but if we say that wont it be shirk beacuse Allah is not made of anything He is uncreated or does Noor of Allah means in terms of guidance.
Comment: there is a verse in the quran, widely known as the ayat al noor: its in a chapter - surah - of the quran - called surah al noor. you should check it out and the tafseer of it is online so you can read about it more.
Comment: Actually Imam Ghazzali has written a monography on this particular word. The book is called "Mishkāt al-anwār".
Answer: do not interpret something based on physical. noor is the same as light which means it will give you light for your life's journey. may Allah give you a clear path

What is the meaning of Noor of Allah


Zucchini fruits / teeny holes on skin not leaves

Question: To beat the bugs, I planted the zucchini above ground in an unused water fountain the previous owners had.  Cement.  Used excellent bagged dirt.  Leaves are fine.  Fruit shaped and color fine.  But there are these teeny holes as small as pin holes.  Never, in 45 years of gardening, have I seen these,  I live in Wilmington NC.
Comment: Bugs with wings are not exactly going to be deterred by that planting arrangement....and that seems to be what you've likely got.
Comment: A photo would help
Answer: Seems most likely this is "pickleworms" Diaphania nitidalis https://en.wikipedia.org/wiki/Diaphania_nitidalis from a brief search. An alternate and more through site from the University of Florida.
Bore holes in fruit, flowers and stems. Laid by a moth so not going to be stopped by your planting arrangement. Go through multiple stages of growth, so holes likely to get larger as the critters grow. More of a problem the closer to the equator you are, but extending range over the course of the summer as they reproduce quickly and move north (or presumably south) over the course of the summer.


What is the name of the term for character facial expressions showing meaning in a play?

Question: Last year I learnt the term for a character's facial expressions showing the audience what they feel, as well as their tone of voice in the stage directions when reading a play. I am currently writing a dissertation and cannot for the life of me remember what the terms were, and cannot find anything online; all i remember is that at least one of them started with a 'p'. Could anyone please help me and tell me what these terms are?
Thank you all :)
Comment: "Indeed, the study of thousands of stage directions does not elicit a technical backstage vocabulary that is the exclusive property of one or another group of theatrical professionals or is linked to specific venues." [*A Dictionary of Stage Directions ...*](http://www.sddictionary.com/excerpts.html) That said, perhaps you're referring to 'gestural' stage directions (includes facial expressions), also known as 'pantomimic' directions. 'Delivery' directions might be used to refer to tone of voice directions. I could be misunderstanding your question entirely, though.
Comment: Have a look at the answer.
Comment: Are you talking about "miming"?  See also "mugging", defn 7 here http://www.dictionary.com/browse/mugging
Answer: Here are a few suggestions
countenance - the face as an indication of mood, emotion, or character
physiognomy- the facial features held to show qualities of mind or character by their configuration or expression
The verb is physiognomize.
Answer: If you want an outdated term you may try 'look'.

[WITH OBJECT] dated Express (something) by one's gaze:
'Poirot looked a question'

Reference:
http://www.oxforddictionaries.com/definition/english/look
Answer: persona

pl. per·so·nas or per·so·nae (-nē) The character represented by the voice of the speaker in a literary work.

personae The characters in a dramatic or literary work.

AHDEL
:  the personality that a person (as an actor or politician) projects in public :  image (emphasis is mine.)
M-W
Answer: Body language includes a character's facial expressions showing the audience what they feel.
From Wikipedia:

Body language is a kind of nonverbal communication, where thoughts,
  intentions, or feelings are expressed by physical behaviors, such as
  facial expressions, body posture, gestures, eye movement, touch and
  the use of space.


What is the physical significance of curl $\nabla\times\boldsymbol{V}$?

Question: What is the physical significance of curl $$\nabla\times\boldsymbol{V}~?$$  I mean I read 'curl V represents the rotation of the vector $V$. My question what is it about the term $\nabla\times\boldsymbol{V}$ that it represents the rotation of the vector?
Comment: Related: http://physics.stackexchange.com/q/202923/2451 and links therein.
Comment: Now people are voting to close this because it is a duplicate of another question that has been closed as being too broad - insane.
Comment: I think that this question is superior than the proposed duplicate and is not unclear.
Comment: I think the current version of the question is slightly unclear, but that it is easily repaired.
Answer: Curl can be equated with the closed line integral in the
limit that the encircled area $\Delta S$ goes to zero. However, we would have to do
this in three components because curl is a vector.
$$
(\nabla \times \vec{v})_x = \lim_{\Delta S \rightarrow
0} \frac{1}{\Delta S} \oint \vec{v}\cdot d\vec{l}
$$
in the $yz$ plane and so on.
But what does it mean? Well it is easy to show that
$$
\nabla \times \vec{v} = 2 \vec{
\omega}
$$
As follows:
$$ (\nabla \times \vec{v})_x = \partial_y v_z - \partial_z v_y = \partial_y (\vec{\omega} \times \vec{r})_z - \partial_z (\vec{\omega} \times \vec{r})_y $$
$$ (\nabla \times \vec{v})_x = \partial_y (\omega_x y - \omega_y x) - \partial_z (
\omega_z x - \omega_x z) = 2 \omega_x$$
and ditto for the other components
$$ (\nabla \times \vec{v})_y = \partial_z v_x - \partial_x v_z = 2\omega_y$$
$$ (\nabla \times \vec{v})_z = \partial_x v_y- \partial_y v_x = 2\omega_z$$
i.e. the curl of a velocity field equals twice the angular velocity at that point. In
other words it is angular velocity within a fluid flow that creates
curl! You can imagine constructing a ``curl meter'' out of a little
(infinitesimally small) paddle wheel which could be inserted into the fluid flow. If the paddle wheel turns then there is curl.
Comment: 'Curl meter'; an exotic device! Sounds like Purcell's explanation:p
Comment: @user36790 It's mine. From my lecture notes. Though the paddle wheel is a commonly used aid to understanding.
Comment: Don't get bothered, sir. Sorry, if it in anyway disturbs you. What I wanted to tell you is that the same 'curl-meter' had been mentioned by Edward Purcell in his Berkeley Classic: _Electricity & Magnetism_; that's it. I am in no way against you. Sorry again:(
Comment: Yes! This integral relation and the corresponding $\nabla \cdot$ relation are practically the most important things to know about vector calculus.
Answer: You've got a bunch of good answers now, let me add two things that I did not see:
The $\delta$-function curl: things can look twisty without being so.
Consider the field $$\vec V(x, y, z) = \frac{1}{x^2 + y^2}\begin{bmatrix}-y\\x\\0\end{bmatrix} = \hat\theta / r.$$Strangely, $\nabla\times\vec V=0$ at every point except the line $(x,y,z)=(0, 0, z)$ where it is not defined. This "looks" rotational: the $\hat\theta$ vector points around the origin. However, the exact scaling of $1/r$ is just what it needs for the curl to vanish.
So, any naive "the curl tells you how twisty something looks" interpretation is wrong, because here is a thing which looks twisty but has no curl.
Better: the force-torque interpretation.
Suppose $\vec V$ represents a force field -- in the usual physics sense of a force defined at every point in space, please, not the sci-fi sense of an invisible wall.
Now suppose we put a little pinwheel inside the force field and have it feel those forces. Without loss of generality, let's write it as a little circle of radius $\epsilon$ in the $xy$-plane about the origin, the points $\delta\vec r(\theta) = [\epsilon \cos\theta, \epsilon \sin\theta, 0]$ for $0\le\theta\lt 2\pi.$ The force on any point of this circle is approximately: $$\vec F(\theta) \approx \vec V(0, 0, 0) + \frac{\partial \vec V}{\partial x}~\epsilon~\cos(\theta) + \frac{\partial \vec V}{\partial y}~\epsilon~\sin(\theta).$$ To first order in $\epsilon$, of course, the net force on this pinwheel is just $\vec V(0, 0, 0)$: the terms linear in $\epsilon$ vanish.
The net torque, however, does not vanish: $$\delta \vec\tau = \int_0^{2\pi} d\theta~ \delta\vec r(\theta)\times\vec F(\theta) \approx \epsilon \int_0^{2\pi} d\theta~\hat z~\big(\partial_x V_y \cos^2\theta - \partial_y V_x \sin^2\theta \big),$$with all the other terms disappearing as we integrate plain sines and cosines or occasionally $\sin\theta\cos\theta = \frac12 \sin(2\theta),$ all of which oscillate about $0$. Only $\cos^2$ and $\sin^2$ oscillate about a different average, namely $\frac12$. Performing the integral therefore leads to the small torque:$$\delta \vec\tau \approx \frac12~\epsilon ~\hat z \left(\frac{\partial V_y}{\partial x} - \frac{\partial V_x}{\partial y}\right).$$This is $\vec \tau = \epsilon~\hat z~(\hat z \cdot (\nabla \times \vec V)),$ so the proper extension of this to all coordinates is simply: at position $\vec r$ insert a pinwheel in the $\hat n$ direction, the torque per unit radius on that pinwheel is simply $\hat n \cdot (\nabla \times \vec V).$
So the curl of a force field is the torque-per-unit-radius on a small pinwheel, pointed in the direction of greatest torque.
Since a velocity field at small distances will generally influence particles by a linear drag $\vec F \propto \vec v$, this is also a good interpretation for velocity fields: insert a little pinwheel that you are holding fixed, and the curl tells you the torque that the fluid will start exerting on that pinwheel (which you will have to oppose to keep it fixed).
The $\hat \theta / r$ field, therefore, does not rotate a small object as it flows past it. You can roughly understand this by describing the pinwheel not as a little circle of radius $\epsilon$ but a little trapezoid $\delta r, \delta \theta.$ The fluid stays in contact with the outer surface for a length $\delta \theta~(r + \delta r)$ but is only in contact with the inner surface for the length $\delta \theta~ r.$ By making the force go like $\vec F = U_0~\hat \theta/r,$ the work done on the inner surface travelling around the loop is $-U_0~\delta\theta~r/r ~+~ U_0 \delta\theta (r + \delta r) / (r + \delta r) = 0,$ as it must be if the pinwheel doesn't want to rotate that way.
Comment: Of course I agree with all this. The usual way of addressing this is to use the example of the B-field *outside* an infinite current-carrying wire. That depends on $r^{-1}$ and must have a curl of zero by Ampere's law. That is the example I use to point out the dangers of just looking at the (curly) field lines and trying to decide.
Comment: Is there an $\epsilon$ missing from the expression of net torque before the integration is performed?
Answer: Consider $\vec V$ to represent the velocity field of a fluid. We choose a point $x_0$. In a small region around this point we can approximate the vector field by $\vec V(\vec x_0 + \vec x) = \vec V(\vec x_0) + D\vec V(\vec x_0)x$, where $D\vec V(\vec x_0)$ represents the Jacobian matrix. We can decompose this derivative uniquely into the symmetric and antisymmetric part: $J := D\vec V(\vec x_0) = S + A$, where $A^T = -A$ and $S^T = S$. Explicitely, $A = \frac 1 2 (J - J^T)$ and $S = \frac 1 2 (J + J^T)$.
As the velocity fields generated by the symmetric and antisymmetric parts are simply superposed, we can consider their effects separately (and here we only consider the antisymmetric part).
Close to the point $x_0$, the antisymmetric part $A$ generates a velocity field:
\begin{align*}
\vec V_A(\vec x_0 + \vec x) &= \begin{pmatrix}
 0 & -\omega_3 & \omega_2 \\
 \omega_3 & 0 & -\omega_1 \\
 -\omega_2 & \omega_1 & 0
\end{pmatrix} \vec x = \vec \omega \times \vec x.
\end{align*}
This corresponds to the velocity field of a rigid body rotating with the angular velocity $\vec \omega$. (Note, that one simply cleverly names the components of $A$ by $\omega_i$ to get this result).
Writing out the elements of $A$ explicitely, one can trivially identify them with the components of $\nabla \times \vec V$ (e.g. $(\nabla \times \vec V)_1 = \partial_2 V_3 - \partial_3 V_2 = 2A_{23} = 2\omega_1$).
In conclusion, if $\vec V$ is a velocity field, then $\nabla \times \vec V(\vec x) = 2\vec \omega(\vec x)$ with the angular velocity $\vec \omega(\vec  x)$ with respect to point $\vec x$.
A similar analysis of the symmetric part reveals that $\mathrm{Tr}(S) = \nabla \cdot V$ is related to the increased volume of the flow (i.e. to the increase of the volume of a small volume transported in the flow).
Answer: $\nabla$ represent the pseudo-vector $(\frac\partial{\partial x},\frac\partial{\partial y})$ (in 2D). So :

$\nabla(v)$ is the gradient $(\frac{\partial v}{\partial x} , \frac{\partial v}{\partial y})$,
$\nabla\cdot v$ is the divergence $\frac{\partial v_x}{\partial x} + \frac{\partial v_y}{\partial y}$,
$\nabla \times v$  is the curl $\frac{\partial v_y}{\partial x} - \frac{\partial v_x}{\partial y}$

So if $v$ is a rotating field $v(r,\theta) = r\dot{\theta}(-\sin(\theta),\cos(\theta))$ , i.e. $v(x,y)=\dot{\theta}(-y,x)$, you see that curl($v$) = $2\dot{\theta}$, with is (twice) the constante rate of rotation.
Comment: completed up to rotation rate.


Why this bash shortcuts does not work?

Question: I have a test script like this:
asdf() {
  return 1
}

asdf && echo 123 && exit
echo 321

321 is outputed instead of 123
Why is that?
Answer: echo 123 will only be executed iff asdf succeeds as you have tacked the short circuit operator -- && after asdf; now you have return-ed from the function asdf with return value 1, which in turn becomes the exit status of asdf, so the command asdf is considered failed, hence echo 123 (and of course exit) is never run.
There is no such condition on echo 321, hence it is executed in the usual manner.
Answer: The && operator is a logical AND.  It does lazy evaluation : if the statement to the left evaluates to false (i.e. non-zero return code), then applying the logical AND will still evaluate to false anyway, so evaluating the right part is useless (in the logical predicate sense).
Since your function returns 1 (false as far as Bash is concerned), everything to the right is ignored, your exit is not reached, and the echo statement is executed.
If you want to force execution of all commands on that line, use this instead:
{ asdf ; echo 123 ; exit ; }

A command list like this will always evaluate every one of them, irrespective of their return code.  Please note that the last semi-colon is mandatory.
Comment: Try not to use Boolean terminology when discussing exit statuses. `bash` *does* have a context where Boolean values are represented with true as 1 and false as 0, namely arithmetic expressions (try `echo $(( 3 < 5))`), so it's better to keep the concepts of truth and success distinct.

Why this bash shortcuts does not work?


How to determine the distance of a (skewed) rectangular target from a camera

Question: I have a photograph containing multiple rectangles of various sizes and orientations. I am currently trying to find the distance from the camera to any rectangles present in the image. What is the best way to accomplish this?
For example, an example photograph might look like similar to this (although this is probably very out-of-proportion):

I can find the pixel coordinates of the corners of any of the rectangles in the image, along with the camera FOV and resolution. I also know beforehand the length and width of any rectangle that could be in the image (but not what angle they face the camera). The ratio of length to width of each rectangular target that could be in the image is guaranteed to be unique. The rectangles and the camera will always be parallel to the ground.

What I've tried:
I hacked out a solution based on some example code I found on the internet. I'm basically iterating through each rectangle and finding the average pixel length and height.
I then use this to find the ratio of length vs. height, and compare it against a list of
the ratios of all known rectangular targets so I can find the actual height of the target in inches. I then use this information to find the distance:

...where actual_height is the real height of the target in inches, the IMAGE_HEIGHT is how tall the image is (in pixels), the pixel_height is the average height of the rectangle on the image (in pixels), and the VERTICAL_FOV is the angle the camera sees along the vertical axis in degrees (about 39.75 degrees on my camera).

I found this formula on the internet, and while it seems to work somewhat ok, I don't really understand how it works, and it always seems to undershoot the actual distance by a bit.
In addition, I'm not sure how to go about modifying the formula so that it can deal with rectangles that are very skewed from viewing them along an angle. Since my algorithm works by finding the proportion of the length and height, it works ok for rectangles 1 and 2 (which aren't too skewed), but doesn't work for rectangle 3, since it's very skewed, throwing the ratios completely off.
I considered finding the ratio using the method outlined in this StackOverflow question regarding the proportions of a perspective-deformed rectangle, but I wasn't sure how well that would work with what I have, and was wondering if it's overkill or if there's a simpler solution I could try.
Comment: From what I understand two edges of the rectangle are not at the same distance from the camera. So what distance do you want to compute? The one to the center of the each rectangle?
Comment: You said "I also know beforehand the length and width of any rectangle that could be in the image" does that mean that you can specify all 4 corners of the rectangle in some coordinate system?  Said another way, you know everything about the structure of the rectangle and you are trying to find its position/orientation.
Comment: @Bogdan -- yeah, I'm looking for the distance to the center of the rectangle.
Comment: @Hammer -- That's correct -- that's a good way of putting it. I'm specifying the coordinates of the four corners based on the actual pixels they're located at on the image, where `(0,0)` is located at the bottom left corner and the top right corner is `(IMAGE_LENGTH, IMAGE_HEIGHT)`
Comment: @Michael0x2a the general solution to problems like this is to use a PnP algorithm like [solvePnP](http://opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction.html#cv-solvepnp) in openCV.  Basically you provide points in 3d along with their current position in your image.  The algorithm then returns the position of your camera (which is easy to turn into the position of the object)
Comment: Consider asking cs-related questions in [cs.stackexchange.com](http://cs.stackexchange.com).
Comment: Did you find a solution?
Answer: FWIW I once did something similar with triangles (full 6DoF pose, not just distance).
Comment: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.  Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/11479009)
Comment: @BrianTompsett-汤莱恩 Thanks for the suggestion. Despite similarities, there is some distance between this question and what I linked. (They pertain to different generalizations of the same basic problem.) I'll make it a community wiki in case anyone is willing to reconcile them. If the distance is too great, we can delete the answer.


Warping vector graphic

Question: What is the best alternative to Adobe Illustrator which allows for the same feature as Puppet Warp tool? Please suggest any simple tool which allow warping vector graphics. Preferably app for iPad or any online tool.

https://helpx.adobe.com/illustrator/using/puppet-warp.html
Answer: I can tell you I've two preferred vector graphics tools on iPad (Concepts App & Affinity Designer) and one I use far less frequently (Adobe Draw) and though they each have their areas of competency, none of them replicate the Illustrator Puppet warp that I am aware of, nor am I aware at this moment of tools specific to this use case.
There are a huge number of animation tools for iPad, but most are raster based AFAIK.
I do know you can open Affinity Designer files in Affinity Photo, which has envelope and mesh warp tools, so this might help, but I'm not sure your affected layers remain vector in that process - I rather think they get rasterised on the fly.
Hope this is of some help; good luck!

Warping vector graphic


How would a medieval kingdom survive a zombie outbreak

Question: In my world, there is a zombie infestation that destroys and takes out many kingdoms, citystates, and villages. These zombies are fast and like the ones from zombieland. It is possible to get cured, but you would need serious medical care, and the survival chances are low. The technological state is similar to that of the 16th-17th centuries. Most of the major cities have tall walls, and those that haven't are trying to build them fast before it spreads. At first, they think it is just a normal medieval disease. Now at this moment, the zombie infection begins. How would a kingdom or civilization at a time period like this survive, mainly the 17th centuy? Note: while the fantasy world   has multiple continents and different cultures, the main focus here are the european-like kingdoms and civilizations.
Comment: It's also hugely broad in scope which would be off-topic too.
Comment: This seems like less a question of building your world than it is a question about how character driven events in your world will play out. You could write an entire story about this which makes it a very poor fit for this site. It also seems highly dependent upon the specific details of of the kingdom in question. Since you don't provide specific details this question is unanswerable without extensive idea generation on the part of the answers which also makes this question a poor fit.
Comment: They probably would have preferred this war to the Albigensian Crusade.  After all, the zombies can't *talk* people onto their side.  It's also preferable to a modern zombie war, because the knights are mostly covered in tooth-proof materials.  It's easier than modern human trafficking prosecutions, because there's no qualm about burning zombies at the stake, without even getting *into* immigration policy.
Comment: A medieval kingdom in the 17th century? So the question is not about Europe -- in Europe the 1600s are late Renaissance or even Early Modern. But the cities have tall walls; this makes it not about India, or China, or Japan. I am at a loss. Which kingdom do you have in mind, which was medieval in the 17th century and had cities with tall walls in that timeframe?
Comment: @AlexP Russia or some outlying part of the Muslim world, maybe. Particularly if it's the 16th rather than the 17th century, you could just about use the word medieval. Also, it's a fictional world. You're right in that it's not correct usage of the word medieval in general.
Comment: I think the main issue is broadness. If you were asking "what kind of 17th century weapon would be best against zombies." or "how can one limit the virus's spread within a 17th city" it would have been easier to answer. Asking how "in general" includes the questions above and much more, some of these sub-questions being dependent of characters (more story-based like "how this king would protect his lands?").
Answer: Low density
The survival of such areas will depend on low population regions blocking the movement of people. Even in well-developed regions of the world at this time, there will be significant regions of wilderness and tiny isolated villages. When people become concerned about zombies, they will withdraw to old fortified places with many of the people available. Ruthless rulers will slaughter populations to make breaks ( ironically driving people into more isolated places and improving those peoples odds of surviving).
Transportation in this time is more primitive and slow, so such a disease might have a lower chance of crossing long distances. So spread will be much more local and dependent on local circumstances. Island nations would fare better, but drifting ships might still provide a route for infection.
Technology might work in their favor if armor is still available. I suspect a suit if chain mail or boiled leather might be a fairly effective protection. And melee weapons have often been portrayed as being more effective against zombies than guns.
But if the zombies can have a carrier (like rats) or if the zombies wander long distances and persist for long periods in a region, there will be little they can do to keep them from slowly grinding them down.
Answer: Fall Back in Technology
It turns out, 14th and 15th century military technology was pretty well-suited to a zombie outbreak. The standard infantryman wore a solid suit of steel covering, that would foil zombie teeth; and utilized polearms, ideal for keeping the undead out of arms reach; or pinning the living dead in place.

11th and 12th century soldiers were in even better spot, wearing similarly impenetrable armor as an outer layer. Beneath which, padded gambesons are also the equivalent to modern "bite proof" suits of dog trainers.

The stuff, you can see here, is pretty much undefeatable. It took the development of specialty anti-chainmail weapons to beat chainmail, and it took the invention of the cannon (note the cannon, not the rifle) to beat plate mail.
Unfortunately, the 16th century medieval soldier has laid aside much of that protection because the cannon has rendered it obsolete for nation-to-nation warfare.
However, the industrial processes exist, and being only a hundred years old, it would not be too much of a stretch that families dug grandpa's mail out of a locker for the zombie apocalypse.
Answer: River by river.

https://upload.wikimedia.org/wikipedia/commons/4/41/Hydrographic_zoning_Ukraine.jpg
Here is Ukraine.  Like the rest of Europe it has plentiful rivers.  The good thing about zombies of the Zombieland or movie WWZ variety is that they go zombie in a hurry and then they are unsubtle - they do not hide and there is no secret zombie reservoir of infected persons.
Even small rivers present nearly impassable barriers to zombies.  Zombies will not drown but a zombie in the water will fill internal body spaces and sink.  They will then be moved by currents to low spots.  These low spots are muddy and pitch black - zombies will not be able to get traction against the bottom and so will accumulate.  Depending on zombie buoyancy they might sink further, into the mud.
Your villagers will clear land spaces river to river by moving through the countryside ringing bells and calling out "зомбі?  зомбі?".  They will have their farm implements with them and also dogs.  Zombies will be attracted to these parties and be dispatched by phlegmatic country people.  Dogs will bark at any zombies that show up at farms at night, and people will go out and dispatch them.  These will be numerous, small dogs who require little food but have powerful and persistent barks.
Uncleared regions will harbor zombies.  Unmanned zombie traps with windpowered noisemakers will be erected in these territories to lure zombies into quarries or rivers.  Bridges will have V shaped walls erected such that zombies coming to the bridge will move laterally along the walls, which end at a gap in the railing.  Nonzombie refugees from these areas will come across bridges and not be fooled by the V walls, or be ferried across by persons in boats or manned ferries.  These refugees will be welcome manpower in the cleared areas, where the population has diminished because of the zombie epidemic.


Salesforce Certified Platform App Builder Exam

Question: Has anyone here taken the new Force.com Certified App Builder exam? The one which replaced DEV401?
Could I ask for any study materials/tips/exam experience on that?
Comment: Is anything in the study guide not clear ?
Comment: R u looking for an App Builder exam?
Answer: I gave my transition exam for App Builder and it is more scenario based and questions are challenging, also includes a lot of new topics compared to dev 401.
You can download the study guide from link below.
http://certification.salesforce.com/SG_CertifiedPlatformAppBuilder.pdf?v=5
In this pdf on the section 5 you can see the Recommended Training and References. you can look at the online courses from your help and training link in production org. These online courses are very useful and most of them are straight questions in your exam. You can search for these online courses or documentation only if you have premier support. Make a note of all these slides for a quick reference 1 day before the exam.

On the section 6 in the study guide you can see the weighting of each topic in your exam so make sure that you search for all the topics in the salesforce documentation or directly in google.
Comment: My best advice is exactly what @Salesforce Learner stated about googling the study guide topics and reading the relevant Salesforce Documentation that comes up from the search.


Need Pattern for dynamic search of multiple sql tables

Question: I'm looking for a pattern for performing a dynamic search on multiple tables.
I have no control over the legacy (and poorly designed) database table structure.
Consider a scenario similar to a resume search where a user may want to perform a search against any of the data in the resume and get back a list of resumes that match their search criteria.  Any field can be searched at anytime and in combination with one or more other fields.
The actual sql query gets created dynamically depending on which fields are searched.  Most solutions I've found involve complicated if blocks, but I can't help but think there must be a more elegant solution since this must be a solved problem by now.

Yeah, so I've started down the path of dynamically building the sql in code.  Seems godawful.  If I really try to support the requested ability to query any combination of any field in any table this is going to be one MASSIVE set of if statements.  shiver

I believe I read that COALESCE only works if your data does not contain NULLs.  Is that correct?  If so, no go, since I have NULL values all over the place.
Answer: As far as I understand (and I'm also someone who has written against a horrible legacy database), there is no such thing as dynamic WHERE clauses.  It has NOT been solved.
Personally, I prefer to generate my dynamic searches in code.  Makes testing convenient.  Note, when you create your sql queries in code, don't concatenate in user input.  Use your @variables!
The only alternative is to use the COALESCE operator.  Let's say you have the following table:
Users
-----------
Name nvarchar(20)
Nickname nvarchar(10)

and you want to search optionally for name or nickname.  The following query will do this:
SELECT Name, Nickname
FROM Users
WHERE
    Name = COALESCE(@name, Name) AND
    Nickname =  COALESCE(@nick, Nickname)

If you don't want to search for something, just pass in a null.  For example, passing in "brian" for @name and null for @nick results in the following query being evaluated:
SELECT Name, Nickname
FROM Users
WHERE
    Name = 'brian' AND
    Nickname =  Nickname

The coalesce operator turns the null into an identity evaluation, which is always true and doesn't affect the where clause.
Answer: Search and normalization can be at odds with each other. So probably first thing would be to get some kind of "view" that shows all the fields that can be searched as a single row with a single key getting you the resume. then you can throw something like Lucene in front of that to give you a full text index of those rows, the way that works is, you ask it for "x" in this view and it returns to you the key. Its a great solution and come recommended by joel himself on the podcast within the first 2 months IIRC.
Answer: What you need is something like SphinxSearch (for MySQL) or Apache Lucene.
As you said in your example lets imagine a Resume that will composed of several fields:

List item
Name,
Adreess,
Education (this could be a table on its own) or
Work experience (this could grow to its own table where each row represents a previous job)

So searching for a word in all those fields with WHERE rapidly becomes a very long query with several JOINS.
Instead you could change your framework of reference and think of the Whole resume as what it is a Single Document and you just want to search said document.
This is where tools like Sphinx Search do. They create a FULL TEXT index of your 'document' and then you can query sphinx and it will give you back where in the Database that record was found.
Really good search results.
Don't worry about this tools not being part of your RDBMS it will save you a lot of headaches to use the appropriate model "Documents" vs the incorrect one "TABLES" for this application.


Can I straighten bent rims between two flat surfaces?

Question: I have some bent bicycle rims and would like to straighten them. I drew a basic scheme of what I want to do, the idea is to make a concrete plane mold as seen in the design to exert pressure on the bent rims. The details are on the figure. Would you have some design and/or material suggestion? It's OK if you think it's useless I will appreciate the advice.
Thanks in advance!
Comment: Do note that if a rim is merely "wobbly", and there are not any distinct bends in it, then the spokes, properly adjusted, should be able to pull it "true" (even though purists would object that the spoke tensions will not be even).
Answer: This is not going to work.
You won't permanently change the shape of the rim by just smooshing it between two concrete discs, as in order to permanently bend metal you need to exceed the yield stress of the metal and plastically deform it. This means that to bend something to a shape, it has to be precisely bent further than its ultimate designed bend, then elastically bend back to the destined spot. Your concrete discs will not achieve this.
It is tricky enough to form a suitably round rim from a perfectly straight piece of freshly extruded, homogeneous aluminum. Once the rim has been bent, it will have been cold worked, and the mechanical properties will not be uniform along the entire rims length. Thus, trying to precisely bend it back into shape will be impossible as the yield strength and elastic behaviors will not be fully known throughout the entirety of the rim.
Trying to heat treat it won't save you either as that will cause the rim to get softer as it will undo the designed-in cold working of when the rim is created at the factory.
Additionally, this scheme, even if it was possible, would only adjust side-to-side trueness, and would do nothing to adjust vertical trueness. You'd also have to remove the hub and spokes, and at that point you might as well just get a fresh rim. In fact if your rim got bent while it was a wheel, many of your spokes are going to be wrecked anyway.
If a rim is significantly bent, it's only future destination is recycling.
Comment: I see you also have cried in `Strength of Materials` class. But please, as an accepted and highly upvoted answer, do mention that spoke tension can do wonders; throwing away is only for cracked rims or rich eco-unfriendly fellows.
Answer: I'm not a metallurgist, but I would think that once the rim is bent enough that you're looking to straighten it, it's been weakened enough that I wouldn't trust it for riding on.


Apex tests and Run test option

Question: I have a question about running apex tests and why i can't see that "Run Test" under IsTest annotation
just like on the first screenshot
What i see is something like this
Comment: Similar question with alternative solutions:
https://salesforce.stackexchange.com/a/414085/108203
Answer: First update your extension to latest version. As per documentation

If you don't see this icon, make sure that the project contains an sfdx-project.json file in its root directory.
Answer: Be sure Apex Language Server is running, you can check it on Output tab (CTRL + SHIFT + U).
If it is not running, most likely you don't have a valid Java runtime installed. It will work only with Java8 or Java11.
In this case:

from Extension tab check for updates.
close VS Code.
download and install AdoptOpenJDK 11.
be sure to set JAVA_HOME variable.
restart VS Code.

You may find useful enable Retrieve-test-code-coverage option.

Apex tests and Run test option


Mounting ceiling light to junction box with 1 white (running with no ends) and yellow wires only

Question: I have an unused junction box on the ceiling that I would like to install a light fixture (1 white and 1 black wire). When I open the lid, the junction box has 1 white wire with no ends (just running from one end of the junction to the other end of the junction), and a yellow wire that also runs from one end to another, but there's one open end. Do I need to cut the white wire in the middle and connect my light fixture's white wire together? And the black to the open end yellow?
Comment: Add a picture of the wires exiting the right side of the box.  How many wires are in the port on the left side?
Comment: OP - I may be misinterpreting your picture, but I see a single port on the left side with two yellows and two whites exiting that port.  On the right side I see two ports.  The upper port appears to have the white wire that loops  and continue to the left side.  The bottom port appears to have at least a white wire that runs straight to the left side.  Can you confirm that you really only one white and one yellow coming and exiting that junction box.  You did state that the yellow ran through but has a cut end, which is impossible.
Comment: The grey wire is another neutral wire - the colors for neutral, when run in conduit are White and Grey. It, most likely, is paired with the yellow wire that exits the box through the left-hand conduit in the last pic. Note that this other yellow wire has _some_ slack, but not very much. It looks like your electrician did everyone a favor by providing just a bit of slack (maybe at _every_ junction box) which will make it easier in the future if you ever need just a bit more wire at a box.
Answer: Yellow is a hot wire color, same as black.
In conduit wiring methods, white is always neutral.
Given that they left you a single yellow wire that ends here, that is clearly the switched hot to the lamp.
Given that one of the neutrals passing through this box was given a generous loop, that is clearly the correct neutral to be used with the solo hot.   (It matters). Cut it at the halfway point and pigtail to your lamp.  It needs to go through, because it's also returning current for other stuff.
Comment: @mana yes, that is odd, I suspect it might be a new-fangled switch loop.  (Conduit removes the need to actually run the neutral, just need to reserve space in the pipe.  Regardless, We must assume the other neutral is a different circuit.
Comment: "Conduit removes the need to actually run the neutral, just need to reserve space in the pipe" say what now. That's a bootleg. Did you mean *ground*, if so what's that about "reserve space in the pipe"?
Comment: @mazura wires are easy to add to conduit without damaging wall surfaces. Someone upgrading to a smart switch is expected to pull the neutral at that time. The builder's obligation is to leave room for the wire in pipes (conduit fill and 310.15 B3a derate )   and boxes (cubic inches).
Comment: I agree with this. But what doesn't make sense to me is why they put in a neutral loop instead of a single wire. Any connection to ongoing could have been done at the source, along with ongoing hot. Seems like a waste of wire.
Comment: @mazura I think he means pull the neutral at a later time if needed.
Answer: You are probably correct: cut the white wire and connect both halves to your fixtures white wire, and connect the yellow wire to the fixtures black wire. That yellow wire is probably connected to a switch somewhere, which will control your fixture.
Comment: Added are the pic taking from the right and one from the left. If I read all the comments correctly, I should cut the white in the middle and have both ends connect to the white of the light, and connect the open yellow to the black of the light fixture. Sounds about right? Also, I just saw the grayish wire with the new picture. Is that a ground wire?
Comment: More than "probably" right...
Comment: The original comments were based on One White with loop and one Yellow and the one picture that DID NOT show all the wires.  As clearly shown in the new pictures, you have more wires coming in and passing through this book.  Give views time to analyze the wiring.  Look for answers and posting dated after your new picture posting.
Answer: Thanks everyone for all the responses. I cut the white wire and connected the the two halves with the white of the light fixture, and connected the open-end yellow wire to the black of the fixture. It worked! I can turn it on/off using the existing light switch. Thanks!!!


Relation between precision, recall and sample size

Question: I have a large data set for binary classification problem. Now in order to fit model to data I have been trying modeling using various sample size. For each sample size  I gets a different precision recall values. One way to select the model based which has high precision or recall having sample size greater than certain threshold. How to determine this threshold of sample size or in general what is relation between precision, recall and sample size.
Answer: You can calculate the threshold on sample size for given precision/recall assurances. Refer this article:
Statistics: An Introduction to sample size calculations
Edit:
As documented in the linked article,

There are two approaches to sample size calculations:

Precision-based:
  With what precision do you want to estimate the proportion, mean difference . . . (or whatever it is you are measuring)?
Power-based:
  How small a deviation from hypothesis is important to detect and with what degree of certainty?
  The smaller the difference you regard as important to detect, the greater the
  sample size required.

Suppose you want to be able to estimate your unknown parameter with a certain degree of precision. What you are essentially saying is that you want your confidence interval to be a certain width. In general a 95% confidence interval is given by the formula:

Estimate ± 2(approx) × SE

where SE is the standard error of whatever you are estimating. 95% confidence intervals are usually based on the normal distribution or a t-distribution; for a normal distribution the value is 1.96; for t-distributions the value is generally just over 2.
The formula for any standard error always contains n, the sample size. Therefore, if you specify the width of the 95% confidence interval, you have a formula that you can solve to find n.

Power-based sample size calculations relate to hypothesis testing.
As a matter of good scientific practice, a significance level is chosen before data collection and is often set to 0.05 (5%). This significance level, denoted by α, represents the conditional probability of type I error.

Suppose you want to compare the mean in one group to the mean in another (i.e. carry out an unpaired t-test). The number, n, required in each group is given by

n = f(α, β) · 2s^2/δ^2

Where:
   α is the significance level (using a two-sided test) — i.e. your cut-off for regarding the result as statistically significant.
1 − β is the statistical power of your test.
f(α, β) is a value calculated from α and β — see table for f(α, β) in article attached.
δ is the smallest difference in means that you regard as being important to be able to detect.
s is the standard deviation of whatever it is we're measuring — this will need to be estimated from previous studies.

Similar formulae can be obtained for other types of analysis by reference to appropriate texts.
Comment: It would be of more use to the OP if you were to quote the relevant passages from the link, perhaps even including any relevant formulas, rather than simply posting a link.
Comment: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.  Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/103211)
Comment: Thanks for the constructive feedback. I have added the essential explanation based on the link.


Global Settings Menu VS Context Settings Menu

Question: I am working on a web app that offers a set of photo filters.
I want to offer as frictionless an experience as possible and minimize the number of clicks / actions required for the user to perform their desired tasks.
Let's assume my web app offers two tools:

Sketch Tool: which transforms your photo into a sketch
Erase Background Tool: Which erases the background of your photo

In the traditional Adobe-like paradigm: you'd click on a filter tool, then a dialog with the available filter settings would pop up, then you'd click OK and the filter would be applied on the photo.
I wish to avoid all these extra steps and have the button immediately apply the filter when clicked in a single step.
I was wondering then, what would be the best way to allow the user to change the tool's settings?
I thought of three options:

Global settings dialog: A user can access settings for all the tools in a single, global settings dialog by clicking the gear icon. My web app only offers two tools (might offer up to 4 tools in the future) by the way.

Contextual settings dialog: When the user hovers over a tool, a small settings (gear) icon appears on top of the tool. If the user clicks on that icon, the tool's settings dialog appears:

Contextual settings snippet on hover: When the user hovers over a tool, a small snippet containing the tool's settings will appear right on top of the tool:

My first question is: Which one of the above three ways would you prefer, and most importantly, why?
My second question is: Do you think there is a better / more standard way to do this? and if yes, what would that be?
Answer: Personally I would go with #3. There is one less step involved for the user compared to #1 and #2.
It aligns with your friction less user experience by minimizing the number of actions required by the user.
Comment: Thank you, that's what I went for actually :)


Difference between repo start and git checkout -b

Question: Doing some work in the Android Kernel. I am very familiar with git, but not extraordinarily familiar with repo, so I read the following document: http://source.android.com/source/version-control.html. To my understanding from it, as well as experimenting around with topic branches, repo start BRANCH_NAME is the same as git checkout -b BRANCH_NAME. Am I correct in my understanding, or are there some subtle, important details that I am missing?
Answer: The difference is that repo start sets the remote and merge properties for your branch inside of .git/config:
[branch "YOUR_BRANCH_HERE"]
    remote = aosp
    merge = master

Without these, repo won't know how to properly upload your change when you run repo upload later, and it will act as if your new branch simply doesn't exist.
(There's also some logic in there that lets you create the new branch for every project in the repo simultaneously with --all, but that's just a convenience thing.)
Answer: Looking at the start.py source code for repo start, I believe the main difference is in the management of the manifest files which are included in Android projects.

begins a new branch of development, starting from the revision specified in the manifest.

To add to Trevor Johns' answer, you need to check "How do you make an existing Git branch track a remote branch?" (when you are not using repo start):
git checkout -b newBranch -t aosp/master

That will set remote and merge (-t = "track") in the config associated to the new branch.
A simple git checkout -b wouldn't set anything, and create a purely local branch (without tracking any upstream branch to a remote repo)
Comment: Thanks for the response, VonC, I figured there had to be something different between the 2.


Google maps : Is it possible to draw a polygon and retrieve all street names within it?

Question: Using Google Maps' API v3, is it possible to draw a polygon on a Google maps and get a list of all the street names that fall within that polygon?
Comment: Have you tried anything? I can't see an explicit method for that, but I can think of some terrible hacks. Compute a fine grid (2m x 2m) of points over the polygon, reverse-geocode, get the street name from the response. Or use OpenStreetMap instead, and the Overpass API which (I think) can do this.
Comment: you can send the lat,lng of your polygon as directions like http://maps.googleapis.com/maps/api/directions/json?origin=wynkoop+st,+denver&destination=stout+st,+denver&sensor=false
Answer: So I used the solution (OpenStreetMap) from @Spacedman:

Download the .pbf for your country https://download.geofabrik.de

Download the polygon file for the desired municipality from https://github.com/JamesChevalier/cities or create your polygon file (.poly) here : http://share.mapbbcode.org/

Download lasted version from Osmosis https://wiki.openstreetmap.org/wiki/Osmosis#Latest_stable_version

Do this:
osmosis --read-pbf-fast you_file_country-latest.osm.pbf file="your_file_country-latest.osm.pbf" --bounding-polygon file="your_municipality_polygon.poly" --write-xml file="your_file_out.osm"

5. In the .osm file, you obtain all the street names, to extract the names use the option (regex) of notepad++

It's complex but it works, but I still have to find a way to do it directly from Google API
Comment: I think you should take a look at Overpass API, the following query will return all highway=* with a name in your bounding box: http://overpass-turbo.eu/s/AD5 ... Polygon selection would also be possible.
Comment: Please check my [answer](https://gis.stackexchange.com/a/413760/194536) if it helps you.
Answer: Sandra's solution put me into the right direction and helped me a lot. However, I am convinced the way how she "parses" the output file is not correct and the regular expression doesn't cover all streets - at least in Spain as a street can start with Calle and this kind of streets don't have the addr:street key.
This is a Linux solution which bases on Sandra's answer:
bin/osmosis -q ... --bp file="My.poly" \
            --tf accept-nodes way=* --wk keyList=highway --wx file=- \
    | sed -e 's/[ ]*<nd [^>]*>//g' \
    | sed -r '/^\s*$/d' \
    | perl -lne 'print $1 if /k="name" v="(.+)"/' \
    | sort \
    | uniq

What happens:

Get only the way nodes which contain the highway key.
Remove the <nd..> elements. Here I refer to this question regarding removing it.
Remove empty lines.
Run perl in order to get the street name from the element.
Sort the result.
Remove duplicates which can be, when for example the street is a one-way and has multiple entries.


how to get miner address from transaction hash

Question: In ethereum private blockchain i want to get the miner address from transaction hash. eth.getTransaction and eth.getTransactionReceipt are not giving miner details. is there any way to get miner address and total number of transaction validated by miner.
Answer: i got the the answer for getting miner details, we first need to get blockNumber from transaction hash, then we can call eth.getBlock(blockNumber) to get miner address for specific transaction


I'm an undergrad student but I'm co-authoring a paper at a company I work at, what's my affiliation?

Question: Do I write my undergrad institution as my affiliation or no affiliation, or my company or both?
Comment: Why are you at the company? If they hired you as a summer intern you are associated with the company (they are paying you to do their work). If some other university placement, perhaps your university.
Comment: It is possible, under some circumstances, to list both.
Answer: The guidelines are

When the work reported in the paper used resources and support from the university, your affiliation is the university.

When the work reported in the paper used resources and support from the company, your affiliation is the company.

In cooperative projects, a dual affiliation could be listed.
One of the co-authors (the primary author) should direct you further.
Answer: How did you get the position at this company?  Is this through a partnership with a professor at your university or is it a job that you got on your own?
There are many factors at play in this, so it is hard to tell if you should list your undergraduate institution and/or the company.  Most important is who you worked directly under, and if this person and/or the research that you are doing has any affiliation with your undergraduate studies.  You could maybe list the undergraduate institution as an affiliation (and you should especially if this is sponsored by a professor there), but it may be better to mention affiliation with the company instead if there are other factors at play (like you work at this company full time or in the long term).  So it really could go either way depending on your specific situation.
TLDR, "rule of thumb":

If this is more affiliated with your undergraduate institution (including through a professor is how you got this opportunity), use your undergraduate university
If you are directly, formally employed with the company (and especially if this is not related to any research you are doing with faculty at your institution), you could maybe list affiliation with your undergraduate university BUT your affiliation should be primarily with the company


how can I find the default gateway of an ubuntu box

Question: how can I find the default gateway of an ubuntu box
Answer: Classic answer
route

Look for a line that says something like:
default         10.63.3.254     0.0.0.0         UG    0      0        0 eth0

The second column contains the default gateway, and the last column is the interface.
You can also use the ip command:
ip route

which will give you something like
default via 10.63.3.254 dev eth0

Comment: Note that the `ip route` is the currently preferred way of extracting such information. The old route command is kept for compatibility. Also, you can see the IPv6 default route using `ip -6 route`.
Comment: you are correct... but I'm a sucker for old school commands ;)
Comment: for ipv6 use ip -6 route
Answer: You can also use "netstat -nr" (I usually leave the n in the flags, so as to not have to wait for host resolution if there's a DNS issue).
Answer: grog:/var/log# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

You can also check /etc/network/interfaces to see what it'll be on next reboot or networking restart.


IP protocol functionality

Question: In TCP/IP protocol the IP layer gives the minimum functionlity .It does not provide any flow control or doesn't have provision for acknowledgement. Why is this done ?why is the functionality of IP kept at a bare minimum?
Comment: While IP might be a "small" part (debatable), it is *crucial* in the overall process of sending data from one computer to the next.  Much like the screws are a very small piece of a house, a house without screws will not stand or function, and is therefore not really a house as much as a pile of rubble.
Answer: IP just gives you the address to get a packet to it's destination. The next layer handles the specifics on what should happen when it gets there. Also, Not every packet needs to be acknowledged..
Answer: The IP protocol defines the network addressing.  The TCP protocol is one of many protocols that can ride on top of the IP protocol.  TCP and UDP are the two most talked about layer-4 protocols that ride on the layer-3 IP protocol, but there are others.  This provides flexibility in networking that would otherwise be unavailable.
Answer: IP only does a minimum amount of work because sometimes you only want a minimum amount of work to be done.  For example, you talked about flow control and acknowledgement in your question, but neither of these make sense for a number of networking protocols.  Nor do they make sense for most Multicast traffic.  If IP had this functionality, you would have to explicitly disable the functionality for this traffic.
Instead of loading down the packets with overhead for functionality they may not be using, IP takes the approach of allowing you to layer on functionality as you need it.  If you want flow control and retransmissions and guarantees about the order of packet delivery, layer TCP on top of your IP.
Additionally, internet routers only need to care about the relatively simple IP protocol and are free to ignore everything above it.  This allows vendors to build specialized hardware that is very fast and relatively affordable and not waste silicon on handling special cases in IP.  (note: IP options make a mess of this last point, but that's why major routers have a software process that can handle those rare packets where the options are set).
Answer: TCP/IP is synonymous with Internet protocol suite.  Notice the 4 conceptual layers of the protocol suite and that IP is at the Internet layer while TCP, which does have flow control and acknowledgements, is at the transport layer.
Clear separation of functionality between layers is key to the architecture.  The network layer is said to be encapsulated by the transport layer.

IP protocol functionality


Why no sweet tooth

Question: So I play rocket league on the ps4 and I am trying to get the sweet tooth. Now I've tried many different tutorials to get the car and still haven't gotten it. Can anyone tell me how to get it because I've tried every way people show on YouTube.
Answer: You have to win a match with all of the following cars:

Gizmo
Octane
Road Hog
X-Devil

Source
Comment: It should be noted that he is PS exclusive, you don't have to play any kind of online matches, and most importantly it is a known bug that he isn't unlocking for some people and should be fixed in an upcoming (next?) patch.

Why no sweet tooth


How many Arya Samskaras are there? ten or sixteen?

Question: Hindu householders perform a few Samskaras (religious rites), such as annaprashana, upanayana, marriage, shraddha etc. Some say, there are, in total, 10 Samskaras (Dasha Samskaras), whereas some say there are 16 (Shodosha Samskaras). How many Samskaras are there? Is there any reference?
Answer: Shodasha sanskāras:

Garbhādhāna - This is mainly concerned with the purification of the seed and the womb so that the progeny will be endowed with good health and intelligence.
Pumsavana - This is performed with the specific desire of getting a male offspring. The pregnant woman is made to undergo this during the third or the fourth month of pregnancy.
Simantonnayana - This consists in the parting of the hair above the forehead ceremonially. It is said to protect the baby in the womb..
Jātakarma - This is performed immediately after the baby is born and before the umbilical cord is cut..
Nāmakaraṇa - This is the naming ceremony. It is generally performed on the eleventh or the twelfth day after birth..
Niṣkramaṇa - During the fourth month, the baby is brought out of the house for the first time where it was born and is blessed by the relatives and friends..
Annaprāśaṇa - Performed after the sixth month, this sacrament of feeding the baby with solid food is primarily meant to wean it away from breast-feeding and gradually get used to normal food..
Cudākarma - This is the first hair-cutting ceremony for the male child performed generally during the third year and before the seventh. A śikhā1 is to be kept..
Vidyārambha or the beginning of primary education by teaching the alphabet is a subsidiary rite..
Upanayāna - This is of primary importance in the life of a dvija.[2] Investiture with the yajñopavīta[3] and imparting the Gāyatrī-mantra are the most important steps..
Samāvartana - This signifies the return of the brahmacārin, after the completion of his student hood, he is now called a snātaka to his house..
Vivāha - Through vivāha or marriage, the snātaka enters into the second stage of life viz., gārhasthya.[4] This stage is considered as very important, since the householder is the prop of the whole society..
Antyesti - This stands for all the post-death ceremonies performed by the survivors of the dead-person for his future welfare. In later dharmaśāstra literature, the four Vedavratas were omitted and the following four were added:.
Karṇavedha - piercing the ear-lobes
Vidyārambha - same as akṣarābhyāsa, learning the alphabet.
Vedārambha - first study of the Vedas
Keśānta - cutting the hair or shaving the beard
The Concise Encyclopedia of Hinduism, Swami Harshananda, RK Mutt , source

In fact, there are 40 samskaras for householders according to the Gautama Dharmasutra (8.14-21).

गर्भाधान पुंसवन सीमन्तॊन्नयन जातकर्म नामकरण अन्नप्राशन चौड उपनयनं चत्वारि वॆदव्रतानि स्नानं सहदर्मचारिणी सम्यॊग: पञ्चानां यज्ञानां अनुष्ठानं – दॆव पितृ मनुष्य भूत ब्रह्मणां ऎतॆषां च अष्टका पार्वणश्राद्ध श्रावणि आग्रहायणी चैत्र आश्वयुजी इति सप्तपाकयज्ञसंस्था अग्न्याधॆय अग्निहॊत्र दर्शपौर्णमास अग्रयणं चातुर्मास्य निरूढपशुबन्ध श्रॊत्रामणी इति सप्तहविर्यज्ञसंस्थां अग्निष्टॊम अत्यग्निष्टोम उक्थ: षॊडशि वाजपॆय अतिरात्र अप्तॊर्याम इति सप्तसॊमसंस्था इत्येतॆ चत्वारिंशत्संस्कारा: ।
अथ अष्टावात्मगुणा दया सर्वभूतॆषु क्षान्ति अनसूया। शौचम् अनायासम् मङ्गलं अकार्पण्यं अस्पृह इति।
यस्य तु खलु संस्काराणाम् ऎकदॆश अपि अष्टावात्मगुणा अथ स ब्रह्मण सायुज्यं सालॊक्यं च गच्छति गच्छति॥
गौतमधर्मशास्त्रम्, अष्टमोऽध्याय:(Gauthama smrithi)

The forty samskaras which are meant to purify the individual self are: garbhadhana, pumsavana, simanta, jatakarma, namakarana, annaprasana, caula, upanayana, the four rites like prajapatya (Vedavratas) performed during gurukulavasa (the years the celibate student spends in the home of his guru), the ritual bath on completion of gurukulavasa, marriage, the five mahayajnas performed everyday by the householder. We have listed nineteen so far. Then there are seven pakayajnas, seven haviryajnas and seven somayajnas to be conducted by the householder. Thus 19+21=40
The seven pakayajnas are: astaka (anvastaka), sthalipaka, parvana, sravani, agrahayani, caitri, asvayuji. The seven haviryajnas: agniyadhana, agnihotra, darsa-purnamasa, agrayana, caturmasya, nirudhapasubandha, sautramani. The seven somayajnas: agnistoma, atyagnistoma, uktya, sodasi, vajapeya, atiratra, aptoryama.
Rites done to the chanting of mantras are more beneficial than those done without it - a sacrament involving mantras is a samskara.
the five mahayajnas (brahmayajna, devayajna, pitrayajna, manusyayajna, bhutayajna) together with agnihotra and aupasana are to be performed everyday; darsa-purnamasa and sthalipaka once a fortnight; parvani-sraddha once a month. The other yajnas are to be conducted once a year or at least once in a lifetime.(Hindu Dharma the universal way of life, part 8)

These are the forty sanskara (sacramentary rites). (8.21)
Next, the eight virtues of the self: (8.22)Atma gunas
Compassion towards all creatures, patience, lack of envy, purity, tranquillity, having a positive disposition, generosity, and lack of possessiveness. (8.23)
A man who has performed the forty sanskaras but lacks these eight virtues does not obtain union with Brahman. (8.24)
A man who may have performed only some of the forty sanskaras but possesses these eight virtues, on the other hand, is sure to obtain union with Brahman. (8.25)
— Gautama Dharma-sutras,

PS - Shrauta karmas are generally performed for the benefit of the world , whereas smartha karmas are done for one's family
Comment: There is a term Dashakarma. Any idea what it means? Is this the principal 10 samskaras?
Comment: @AmritenduMukhopadhyay , I surmise it could be due attributed to the difference in number of samskaras across various smrithi texts  followed by different traditions/(deshachara). I am not sure if there is anything like principal 10 samskaras


How can I install Flash for Brave browser?

Question: I installed Brave and it had no Flash. I went to the plugins and they were recommending a Flash version called PepperFlash. I found guides online and installed that version, but Flash is still not working in Brave. What should I do?
Comment: Close voters: This question is on topic, not off topic because Brave browser can be installed in Ubuntu Software.
Comment: I checked people's word on it in reddit and it seems that Opera was bought by a Chinese company and some woozy crap and I cant give my information to locals. It's also not open source so Idk. I was opting for Brave because it's kinda faster than a privacy configured firefox but meh
Comment: I checked Brave browser for Flash video playback, and Brave browser does block all Flash videos possibly because of the built-in Brave script blocking feature's settings. My solution is to install Opera `sudo snap install opera` which also has a built-in ad blocker, but it plays all Flash videos by default. I think Opera web browser is what you're looking for even though it does not exactly answer this question.
Answer: I could make Flash work with Brave through these steps:

Installed Brave via the .deb file.
Installed the adobe-flashplugin package following this guide.
Created symlinks so Brave finds the plugin:
sudo mkdir /usr/lib/pepperflashplugin-nonfree
sudo ln -s ../adobe-flashplugin/libpepflashplayer.so /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so
sudo ln -s ../adobe-flashplugin/manifest.json /usr/lib/pepperflashplugin-nonfree/manifest.json

Started Brave and enabled Adobe Flash support from Settings -> Plugins

Edit:
Hmm.. I was too quick. Even if I could enable Flash in the browser, the sites I tested with failed to read the plugin. Will revisit this attempt at an answer soon.
Comment: Did you ever get a chance to revisit your answer?
Comment: @andrew.46: No. But since then the Flash infrastructure has been killed and Flash does no longer work with any browser.
Comment: I'm not sure if anyone needs a flash browser in general, however I have tried a project that is currently being active in this github [repo](https://github.com/radubirsan/FlashBrowser) that works well on operating systems like Windows and Linux.