How can there be war/battles/combat in a universe where no one can die?

Question: In my world, no one can die. There is no pain, no death, no injury, etc. Everyone has superpowers. Some people have pyrokinesis, some people have godlike strength, some people can read minds, some people can fly, some people can make food out of thin air, some people can turn themselves into poop, and some people can make things (but not people) disappear. However, none of these powers can kill, hurt, or even be felt by anyone. In addition, there is no hunger, no thirst, no needs of any kind. People still have all of the guns and weapons that exist now, but they cannot harm anyone at all. People mainly use them for fun, since they just like to shoot random things. No one has any possessions, so there is nothing to steal. The only constant is that no one can be harmed, trapped, or killed. I am looking for a form of war that is like real war but can still have a victor in my world.
Therefore, since wars/fights are won by killing, trapping, or incapacitating an opponent, and none of those things are possible, how can there be a war or fight or battle in my world?
Comment: "no one can be trapped" - how exactly that works? Everyone has an absolute escape superpower?
Comment: Maybe the losers are thrown in some sort of confinement ? Supermassive black hole, some impossible-to-break-out field that one of your creatures can make?

basically, instead of killing each other, they kidnap and imprison eachother
Comment: What does this part mean? "However, none of these powers can kill, hurt, or even be felt by anyone"
Comment: Do these gods have any motives? No sticks you say but are there carrots? Seeking of novelty, pleasure, power, status? Seeking of status is a huge driver of conflict for humans. If there is no motivation at all why do they exist?
Comment: Don't trap anyone, just liberate them from Earth's gravity and let them enjoy freedom.
Comment: "No one has any possessions" - do you mean like socialism where everything belongs to everyone? Or do you mean that no-one has any desire or need for any physical objects? The former can always be challenged by those who'd rather have their own stuff (and other people's stuff). And the latter seems a bit unbelievable - as long as there is a non-uniform physical world for people to interact with, there will be conflict about who owns what.
Comment: @zedling no one can be trapped.
Comment: Can people still feel pain? "Looks like we'll have to rochambeau for it."  https://www.youtube.com/watch?v=d0H1RSbmlkM
Comment: @BillOnne No they cannot.
Comment: Frame challenge: if no one can die, does that mean the population keeps growing, even if the planet is unable to support it? Or are there no new births either?
Comment: Sounds like Roblox.
Comment: A wonderful work based in such a setting is [What Football Will Look Like in the Future](https://www.sbnation.com/a/17776-football).
Comment: Such universes exist. They are called "multiplayer video games".
Comment: Does this inability to be imprisoned a purely physical aspect or is it an absolute escape power? If it only applies to the physical world then I would take advantage of your superpower system. You can have designated "wardens" on both sides of the conflict. Some could have mental powers and trap prisoners in illusions, others could have spatial powers that keep people in pocket dimensions, and still others could have powers that transform people without harming like turning them into unbreakable statues. You could also take a tech approach and use virtual worlds and Fvr capsules.
Answer: There must be something that people can gain or lose. Without this, there is no reason to fight.
In our world, when people fight, it is because there is a situation where person A stands to gain by person B losing. War is the highest-stakes version of this because we tend to place the highest value on human health and well-being, which is at stake in violent conflict. But there's much more mundane examples too. In a game, you compete because not all players can win. And if we want to raise the stakes of a game beyond just the fun of winning, we give the winner a prize.
So, in your world, perhaps people fight as a game. That's one possibility. But it's not like war, because in war, the stakes are what you care about most. So, in your world, the "war" equivalent would have stakes of whatever the people care about most (that they are capable of losing). Are your people artists? Perhaps in a war, you are trying to destroy your adversary's creations.  Are your people competitive? Perhaps they simply fight to "win" by some set of rules everyone agrees to. Are your people religious? Perhaps they compete to win the favor of God/gods. Hopefully you get the idea. Whatever your people have that they are capable of not having and value most should be what is at stake.
Comment: Like a Minecraft server, set on creative mode, limited in space and with the possibility to grief others's buildings ^^.
Comment: +1 for "destroy your adversary's creations". That was my primary thought as well.
Comment: Capture the flag?
Comment: Honestly the best answer here. I think that taking the comments of the question author into account even this sort of war wouldn't work however. There isn't even a way for these superbeings to prevent each other from doing anything. So "destroying each others creations" would just be a: "Yeah everything's gone now"

I think the described setting is just _very_ boring.
Comment: Fitting quote from Arrival: "ask him the Sanskrit word for 'war'", later answered with "[it means] a desire for more cows"
Answer: War games
I am part of a group that meets regularly to engage in various ersatz conflicts using symbolic tokens and ritualised rules - also known as "board game club". Why? Because it's mentally stimulating, because victory feels satisfying even if it has no material effect, because interacting with others through the formalism of a game can be more entertaining than simply chatting about the weather.
The same applies to your immortal, intangible, invulnerable post-humans, who sound like they would be bored out of their skulls by the utter flattening of their Maslow pyramid. They wage war the way we play Catan, or chess, or Rhino Hero.
Importantly, that's it. There's no dramatic repercussion to their social standing, their attractiveness to mates, their prospects in life. These are not trifling games played for high stakes. They are just a pastime for the terminally ennui'd.
Comment: I suspect your victories really feel satisfying because in your club victors perform the "victory dance" and losers are obliged to watch and applaud politely, even if the dance goes on and on.
Comment: @Willk A patently ridiculous victory dance is best here. One that the losers must politely applaud to while thinking they lost to people like *that*.
Comment: Seems like the real spoils of war are the friends we made along the way
Comment: "Queen's bishop to D6. Your move."
Comment: Online first-person shooters seems like a closer comparison to battles where you can't get hurt (although the strategic aspect of war is probably more like a board game, or strategy game). If one considers esports, and non-e-sports, one can certainly imagine this having some rather significant repercussions to social standing, attractiveness to mates and prospects in life (if you want it to).
Answer:
To wage war, you need three things: one, money; two, money; and three, money.

The vast majority of modern wars, starting with the Thirty Years' War, haven't been won by killing all the other guy's troops. Instead, they are won by mucking up the other guy's infrastructure enough that he can't wage war.
For example, consider the First World War. At the end of the war, the Central Powers were doing quite well militarily. They still had plenty of troops left, and Russia had just surrendered. However, it was at that point that the Central Powers were themselves forced to surrender. Why? While they still had plenty of warm bodies, the infrastructure to feed and arm them was collapsing.
Consider also the Second World War, twenty years later. The reason the Axis lost (again) was because they lacked the manufacturing capabilities to match Russia and the United States. Supplies were always an issue, but the Allied carpet-bombing of their factories destroyed their ability to make necessary supplies, and therefore their ability to prosecute the war. Thus, while they initially made much headway against the Allies, they were soon overrun.
In more modern times, the purpose of nuclear and biologic weapons is not to destroy the enemy's military. After all, military installations tend to be spread out and well hidden. Instead, countries keep WMDs to destroy the civilian and manufacturing centers which comprise the enemy's infrastructure. Insofar as WMDs are meant to be used against military targets at all, it's to keep the enemy from firing WMDs back.
Without food, munitions, and clothing, troops cannot fight.
Furthermore, you must also keep in mind morale. If you can make the enemy lose the will to fight, the war is already won.
Thus, your supermen's wars would likely be much like the Second World War. While there would be significant ground combat, its primary purpose would be to keep enemy ground troops from marauding around behind your lines. The actually useful combat would occur in the form of massive bombardments of enemy cities and manufacturing complexes, accompanied by extensive naval actions to destroy enemy shipping. The purpose of all this: destroy the enemy's manufacturing capabilities, throw a monkey wrench in their economy, and cause as much suffering as possible. Whoever breaks first, loses.
Comment: When suffering is impossible, annoyance may be sufficient.  Sure, maybe people don't _need_ to sleep or eat, but they may want to anyway, and someone raining thunder down around them constantly is going to interrupt that.
Comment: All of this seems related to denying the enemy physical objects needed for their survival, but in this setting, nobody has any needs whatsoever. You don't need food when you can't starve, you don't need clothing when you can't overheat or freeze, and munitions are rather useless when weapons can't injure anyone or destroy anything that someone needs. No matter what you destroy of the enemy's, by the OP's definition of the setting, they didn't need it. How do you cause suffering in someone with no needs?
Comment: @NuclearHoagie Yes, endlessly shelling the enemy won't kill anybody. However, you can still rain on the other guy's parade (sometimes literally, what with the kind of powers the OP describes).
Answer: Physical conflict is evidently not the route to go. As it stands, the stakes are low, perhaps to the point of boredom for our inhabitants. So they might invent conflict to relieve themselves of their ennui.
Mental Tests
Perhaps they engage in matches of chess or some similarly mentally intense game and hold themselves to abide by the results of the match. The games become very intense, as they are the only means by which one may climb your world's social hierarchy. Winning a match is more than just a game, it defines your sphere of influence.
Simulation of War
Perhaps these beings are technologically advanced enough to develop a fully immersive Virtual Reality experience, one in which they can fight and their avatar/character can die. Because they find their ordinary lives so dull, they take a great deal of pride and care in living the longest and most powerful virtual life.
War by Proxy
Perhaps your world is inhabited by some creature that is mortal. The impervious beings select some of these creatures and impart as much training and wisdom as possible into them before setting them out to battle each other to the death. Since the creatures can die, and the beings are emotionally attached to them, we can raise the stakes. Basically, Nuzlocke Pokemon.
However
The stakes in your world are very, very low. While not impossible, it will likely be difficult to convey any sort of significance to a conflict that has no real consequences. Without the possibility of failure, stories can become very bland. I would proceed cautiously, and consider scaling back the power of your entities somewhat. I find the idea that they cannot be trapped to be particularly concerning. As it stands, no one can stop anyone else from doing...anything, really.
Comment: @Ashida in a world where people are so impervious to damage, I really don't see how one could approach this non-vicariously. One might similarly ask for recipes in a world where no one can eat, taste, or smell.
Comment: All of those example are vicarious experiences... I was really looking for more of a physical war that follows rules that are not self-imposed. As this stands, the people could just cheat and/or make a rule that says "I win" to the other people. And there is no way to contest the rule of "I win."
Answer: Sport
Same as the current world—well, we can die, but we don't want to. So instead of constant warfare we have the olympic games to show how great our countries are. We have swordfights where we wear funny costumes and helmets that stop injury, we play american football with giant pads on our shoulders, we play "battles" on a chess board where the ones "dying" are plastic pieces.
Answer: Sending to the future
Someone hit by a weapon can be transported to some distance point in time (or space) taking them out of the fight. This will eventually give the victor control over a block of time/space.
I agree with Dark Malthorp, there needs to be something to gain or lose. In this case that is time/space.
Answer: Everything you describe is true for almost every competitive online multiplayer game ever played.
Every day, millions of people all around the world have merciless firefights in games like Counterstrike, Apex or Fortnite, engage in bloody close-quarter combat in For Honor or Mortal Kombat and throw whole armies at each other in Starcraft or Age of Empires. Over and over again in an endless series of brutal battles. Even though they have no personal reasons why they would want to harm their opponents and no tangible consequence for winning or losing.
Why are all these people doing that?

For fun
For self-improvement. Becoming better at the game as an end in itself.
For social status. They want to be known as the best player in the community. Or the most entertaining one according to their followers on Twitch and/or YouTube.

The same would be true for your world. People would fight each other as a leisure activity, to find out who is the strongest, and to become the strongest themselves. Not for any tangible benefit, but for status and self-actualization.
Answer: Overwhelm their senses. As a bonus, there are some defenses possible, depending on your tech level and the foresight (good to know goggles will help with the 1st point, if you neglected to manufacture/bring them...)

Sight. Blindingly bright light, this won't make the opponents permanently blind, but they cannot quite fight while the light is on. Possibly fought with sunlight and mirrors in a low tech environment, xenon lamps or lasers later. Defense: goggles. Won't really help against individually targeted very strong laser, which opens up some arm race possibilities. Also won't be that efficient if the opponent starts blinking the light - you have to take them off, the eyes have to adapt, and in that moments you are vulnerable. Blinking light gradually morphs into psychological warfare.
Hearing. While there is probably no pain threshold, loud prolonged sound will prevent the opponent from communicating efficiently, and can easily lead to psychological warfare again ("nails on chalkboard").
Smell. Hydrogen sulfide is reasonably harmless in low amount, but still gives terrible nauseating smell. And if people cannot die, you have many interesting alternatives (that are likely immediately fatal in our world). Defense: gas masks. Overcoming the defense: liberal application of strong acids. Again, a possibility for an arm race.
Taste. Very much the same as smell, but different chemical agents and some ways to deliver them (strong liquid stream aimed at the opponent's face?). Probably going to be lumped together with the smell.
Touch. Maybe used on POWs as a (psychological) torture - is tickling a thing in this setting? Or, if itching works as well, spreading some chemical or physical agent (metal filings or sawdust) might be the way to go. Not incapacitating, but makes the fight uncomfortable.
Thermoception. Again, not incapacitating, but making life uncomfortable. High temperature is easier (and lower tech) to use than the low one, as a bonus, if you make your opponents endure fires for some time, their clothes will burn off and they'll have to fight naked, which is a strong psychological barrier (at least in our world).
Answer: So @OCDev, has a good point. You are literally talking about how to create an economy in any MMO. You can't die, but you do have to share a monetary system with everyone else. It's inevitable that said monetary system, or a competition-based hierarchy, or even a status shift, would eventually take place of killing. That's kinda the way the wealthy do things in our world.
You have to replace the concept of death with defeat, based on whatever form of competition is available. Every time someone is defeated, a financial transaction occurs between them and the person that defeated them.
Ooo, here's a fun caveat. If you defeat someone who can't afford the transaction, then YOU have to pay HIM. I'm betting people would carry non-accidental defeat insurance. Also, you don't get credit if you defeat more than one person with an action. In a pseudo-death scenario, setting off a bomb, or even shooting a bullet through two people has no effect.
There's always a status shift when you defeat someone. It tells people who else you might defeat, for one thing. Maybe all defeats are publicly announced.
Answer: This is a common and popular activity on multiplayer games where you often can't harm people, and they can log out, but you still want to traumatize them.
Exclude people from desired areas or groups and put them in undesired locations
While you can't trap or harm people, you can keep them away from locations and groups you value. Build physical barriers around territory you value. Push them away from places you like, and prepare things like poop houses to put people you don't like in. Use movement powers to knock people away from places you like.
Psychologically torture people
You can target their minds even if you can't physically harm them. Offer someone a meal, and then while their senses are turned on cover them in sewage. Display disturbing images or practices that hurt people's minds. Find social secrets people have and threaten to reveal them if they don't surrender/ join your side.
Isolate and make your enemies friendless
Use psychological pressure and fun activities to draw in your enemies. Whoever has the larger group can better block opponents, and can better pressure them.
Ruin enemy activities
If they try to play a game of football, set their field on fire. If they try to have a meal or watch a movie or have romantic relationships play loud and depressing songs. Do your best to ensure your rivals can't have fun.
The end goal is that you make the enemy group disband or leave your group alone.
Answer: Horses for courses
Why can't people be imprisoned? Do they all have every power simultaneously?
The super strong guy gets put somewhere that requires super speed to escape.
The super fast guy gets put somewhere that requires super strength to escape.
The telepath gets fired into the sun. Etc.
Answer: The Question should not be how war could be fought in your world, but why anyone would want it to be.
If you've designed a world in which the only constant is that no one can be harmed, trapped, or killed and even food can be conjured out of thin air, what is there to war about?
If you could re-jig the rules to include something to fight about still, many wars are not won by killing, trapping, or incapacitating anyone, but by anticipating and out-manoeuvring the opponent as pundits have been pointing out for a good few thousand years.
Consider most famously in modern times, the fall of France.
Answer: They fight with thier domains for thier domains.
Since you are basically describing gods and not people, lets just treat them like gods.  The gods in many polytheistic religions ascribe to Domains: aspects of the world that are thier preview (AKA: theirs).  If you are a master of fire, then you might really enjoy hanging out with your own personal volcano.  It is a place where you can do anything you want, have anything you want, because your powers are tied to fire.
But then, some annoying sea-god might come along and hit your volcanic paradise with a tsunami because he does not like the way you keep boiling off his water.  These 2 gods cant harm each other, but they can harm each other's domains.  So a battle ensues between the fire and the water god until the volcano is snuffed out, and the defeated fire god with no more fire left to command has nothing left for him here; so, drastically weakened without a domain to command anymore, he is forced to leave and go find another place to build a new fire domain.
How these individual conflicts escalate into wars
No one god is all powerful against all powers. In the previous example, the fire god was at a distinct disadvantage, but against a forest god, he would have done much better.  So to preserve thier domains, gods form up into Pantheons (alliances) so that when one of thier members is challenged by another god, they can call on one of thier allies that is better suited to win the conflict and destroy the enemy's domain.
In extreme cases, a border conflict could escalate to a full blown war between 2 pantheons as they reshape nature to deprive each other of thier respective domains.  Wars have clear winners and losers when they pass the tipping point where the loosing faction can no longer muster any new powers without thier oppositions immediately being able to destroy thier new domain.  At this point there is nothing left to do but retreat and find new lands where no one is around to destroy thier domains while they rebuild.
Answer: Wars are fought because something can be won
An opponent cannot take one's life for there is no life to give. They cannot take possessions for none are owned. They cannot fight for resources for none are needed. In a world where nothing physical can set one above another, what is left to lose?
Their reputation
Whether the winner obtains bragging rights or the loser is cloaked in shame, all that's left to win or lose is one's reputation. Readers of your story will relate to this because we all remember our school years where our reputation (often defined in terms of "popularity") frequently highlighted or tainted our memories of the era. It was desirable to know that people wanted to be with us and shameful, embarrassing, and/or depressing to know that no one did.
And that's important. You don't just need a solution to your problem. You need a solution that the people who learn about your world can relate to.
Decades ago I remember seeing a photograph of an Arab man sitting on the fallen statue of Saddam Hussein. My memory suggests he was thumbing his nose or some such, but that might be an embellishment. I remember reading the accompanying article, which explained a fascinating fact (and if this isn't quite the truth, please correct me! It's an old memory). In the Arabic world, it's not enough to simply win the war—one had to insult one's enemy. You truly won the battle when you could stand over your enemy and cast aspersions at his family.
I suggest that your wars will depend on the "cast aspersions" part fairly heavily. The winner of a war is one who places the enemy in such a circumstance that they are insulted... embarrassed... their reputation is tarnished and they lose popularity.
People want to be around the winner, the person who can most deftly insult the enemy without bringing shame on themselves. They don't want to be around the loser, the person who can't see it coming, can't overcome the insult, or can't avoid the stain and stigma.
These aren't games anymore than they are today, right now, in our own lives
And this is the important part. Many humans (most, if we're being honest about it) will do almost anything to avoid embarrassment, shame, and loss of reputation. There are actual laws on the books (slander, libel) protecting people from an unfair or unreasonable loss of reputation. We care how we're seen by members of our own families, friends and neighbors, and our communities. We all understand the constant fight for self-worth and the "dark side" of harming another's sense of self-worth.
We poo-poo these issues and try to sweep them into the category of "childish things" by naming the war, "drama." But it's a war that in Real Life leads to very real loss of life through suicide.
We can relate to a group of immortals who have only one thing to lose: their reputation.
Answer: Imprison The Immortals
The ultimate goal of any conflict would be rounding up and imprisoning the immortals. If they have no need to eat or drink, or possibly even breathe, then the prison could be made very efficient. For the worst of the foes, sealing them in a tomb could be a long term solution.
They might eventually claw their way out of that situation...
Maybe a more effective approach would be burying them in cement. The immortal could be left with his head exposed, so you could have civil discussions about them joining your side in exchange for freedom.
Spaceflight
Finally, ejecting the immortal into outer space would probably remove them from the picture. Either you can shoot them towards the sun for a probable removal from the story entirely, or just in random directions, where their fates can be determined by orbital mechanics, and immense amounts of time.
And elsewhere in the galaxy, many centuries later, a man fell to earth...
Answer: The first step will be to identify something to fight over. Maybe some kind of resource that makes the superpowers possible, and preventing your enemy from gaining this resource makes them mortal. Or maybe something that enhances the powers. Or perhaps there are differnent environments and biomes, and some are simply more comfortable, so you would fight to gain access for yourself, and prevent access to others.
Let say, as an example, that there is a planet that is desirable for whatever reason. What i suggest is to map out a chain of countermeasures. So you start with superpowers that allow you to take over the planet. Maybe people who can suppress the enemies, and physically push them off the planet. Then when you have the planet, you need superpowers that create forcefields and so on, as a defense.
In the end, this means that some superpowers will be more useful than others. That means that if you have such a superpower, you might fight for the highest bidder, so mercenary companies might come into existance who bid for the most powerful individuals, and then fight for the faction who is willing to pay.
I am rambling I guess, hopefully you can extract something useful.
Answer: There's a large LARP event in Germany every year called Drachenfest with a similar premise. Characters attending these "war games" cannot die. Instead, if they are killed they go to a special place from which they return after some time.
What this does is take them out of the equation temporarily, and it works well, has worked well for many years.
So if it is possible to temporarily disable opponents, you can strife for objectives. Conquer that hill or city, destroy that building, steal that flag, whatever it may be - you don't need the enemy to die in order to accomplish your objective, you just need them out of the way.
It would change warfare a lot, but there can still be conflict and strife for specific objectives. Keep in mind that in most wars, your actual goal isn't to kill as many enemy soldiers as possible - that's usually just what you need to do to in order to accomplish whatever it is you actually want - control their capital, take their king captive, liberate your oppressed people, etc.


Degrees of freedom for Chi-squared test

Question: I am facing the following dilemma. I am aware of how to handle the one-sided Chi-squared distribution, but I am falling victim to how to handle degrees of freedom. Let me clarify with an example what I mean.
I have the following obseverd and expected values:
[Observed Data]

#Periods      CountryI   CountryII     CountryIII
#(1900-1950)     100      150            20
#(1951-2000)     59       160            50

[Expected DATA]

#Periods   country I     Country II       CountryIII
#(1900-1950)  118.4         52                40
#(1951-2000)   80.5         90                25

My question is: Since this is a one sided-Chi square test,
are the degrees of freedom counted by the formula: (columns-1)(rows-1), in which case I would have $(6-1)(2-1) = 5$?
Or is that really just country1 country2 country3 that matters, so that d.f. would be 3-1=2?
Because d.f. is usually defined as the terms for the chi squared = 6, where we usually subtract 1 from it.
Please help me out with this one.
Comment: Could you please clarify how did you get the expected values, and what hypothesis are you trying to test. The correct degrees of freedom depends on that. Most answers assume that you are interested in independence (is the effect of period the same for each country?).
Answer: How many variables are present in your cross-classification will determine the degrees of freedom of your $\chi^2$-test. In your case, your are actually cross-classifying two variables (period and country) in a 2-by-3 table.
So the dof are $(2-1)\times (3-1)=2$ (see e.g., Pearson's chi-square test for justification of its computation). I don't see where you got the $6$ in your first formula, and your expected frequencies are not correct, unless I misunderstood your dataset.
A quick check in R gives me:
> my.tab <- matrix(c(100, 59, 150, 160, 20, 50), nc=3)
> my.tab
     [,1] [,2] [,3]
[1,]  100  150   20
[2,]   59  160   50
> chisq.test(my.tab)

    Pearson's Chi-squared test

data:  my.tab
X-squared = 23.7503, df = 2, p-value = 6.961e-06

> chisq.test(my.tab)$expected
        [,1]     [,2]     [,3]
[1,] 79.6475 155.2876 35.06494
[2,] 79.3525 154.7124 34.93506

Answer: Degrees of Freedom are (r-1)(c-1).
You have
2 rows   :  1900-1950 and 1950-1999
3 columns:  CountryI   CountryII  CountryIII
Thus (2-1)(3-1) = 2
The actual product of r x c should = n (total # of observations) which is six.  However, this is not used in your calculation of the df.
Edit:  If you were doing an 'Goodness of Fit' then yes, it would be n-1 but you have a contigency table (r x c) where r or c not equal to 1 so you have to use the (r-1)(c-1)
Edit #2 for dimbo (I can't comment):  Expected values should be calculated by (row total)(column total) / (total # of observations)  :  Thus the expected for r1,c1 position is (270)(159) / (539) which gives the values chi gave you.
Edit #:  SAS code confirming Chi
data question;
 do a=1 to 2;
   do b=1 to 3;
     input var @@;
     output;
   end;
  end;
datalines;
100 150 20
59  160 50
;
run;

proc freq data = question;
weight var;
tables a*b /
 chisq expected norow nocol;
run;

Output
      Frequency|
      Expected |
      Percent  |       1|       2|       3|  Total
       --------+--------+--------+--------+
             1 |    100 |    150 |     20 |    270
               | 79.647 | 155.29 | 35.065 |
               |  18.55 |  27.83 |   3.71 |  50.09
      ---------+--------+--------+--------+
             2 |     59 |    160 |     50 |    269
               | 79.353 | 154.71 | 34.935 |
               |  10.95 |  29.68 |   9.28 |  49.91
      ---------+--------+--------+--------+
      Total         159      310       70      539
                  29.50    57.51    12.99   100.00

  Statistics for Table of a by b

  Statistic                     DF       Value      Prob
  ------------------------------------------------------
  Chi-Square                     2     23.7503    <.0001
  Likelihood Ratio Chi-Square    2     24.2964    <.0001
  Mantel-Haenszel Chi-Square     1     23.3700    <.0001
  Chi Coefficient                       0.2099
  Contingency Coefficient               0.2054
  Cramer's V                            0.2099

                                                  Sample Size = 539

Comment: Nothing in the question is indicative of a GOF test because it would require the OP to supply theoretical proportions rather than observed counts (and we couldn't get such a table of expected counts this way).
Comment: Yup, I was saying that his way of calcualting the expected by making everything into a table with 1 row or 1 column and then just using n-1 was more like the process for a GOF test.
Answer: Wait a minute, I think Sandra means 5 rather than 6.
Maybe chl can correct me on this ... but I think it should be rite. If we take the definition that $\chi^2$ is evaluated as follows,
$$\chi^2= \sum_{i=1}^{\#Rows}(observed_i - expected_i)^2/expected_i  $$
and arrange the data as follows:
Observed[O]| Expected[E] | (O-E)^2/E
100          118.4
150           52
 20           40
 59           80.5
160           90
 50           25

Thus, the total number of terms for calculating $\chi^2$ is  6 (as we are adding the final column of terms together which has 6 rows. As by definition, we have d.f.= no of rows or expected frequencies - 1.
Thus we obtain 5.
Comment: Reflect on how you computed the expected values: you had to use two row means and three column means, which is *five* numbers.  However, there is one (linear) relation among them (because they are both related to the grand mean).  That means you used 5-1 = 4 degrees of freedom in computing the expected value.  Because there are 6 observations, you only have 6 - 4 = 2 degrees of freedom left.  Note how your method of placing all the data into a single column obscures the information about degrees of freedom, whereas the standard tabular layout implicitly gives this information.
Comment: by the way why are u saying that Sandra's expected values are incorrect ?
Comment: mpiktas, can u explain please how i would get the p values using the definition which i stated above -- step by step ?
Comment: I still dont really understand the other answers. Someone who actually is in a position, can use the definition i provided above, with a step by step procedure to calculate x^2 value and then the p-value.
Comment: For testing the independence of the two variables, the summation in your formula should be over the number of observed cells, and not only the number of rows. What you describe corresponds to a [GOF test](http://bit.ly/nyUzys), which is not obvious from the question. As we are about to speculate about that, we could imagine variation around RxC tables whereby one of the the variable might be treated as an ordinal outcome, like in [this question](http://bit.ly/ol8NkG), but I believe we have to wait for further clarifications :)
Answer: The degrees of freedom for chi square test in contingency table is determined by the number of 'expected observations' estimated independently. In your 2x3 table since row and column totals are already known, therefore you need estimate just two expected observations using formula (row total)*(column total)/N. Remaining expected observations can be found by subtraction from row or column total. for example if you estimate the first two observations of the first row then third observation of the first row can be found be subtracting these two estimated observations from the first row total and once the first row is known you can easily find the second row expected observations as the column totals are also already known.

Degrees of freedom for Chi-squared test


Careers - add codepen.io

Question: add codepen.io portfolio to the Careers profile page.
I have tons of code examples and things i've created that would GREATLY influence potential clients' decision if to hire me or not.
Answer: You can already do this. You can add an open source project from anywhere - we don't need to add support for every single website.
Just click "other" when adding a project to your profile:

Then enter your CodePen URL and we'll populate the form with details:
Comment: I was thinking more like Carrers would scrap my top pens and automatically insert them in a easy-to-view manner. I put my own profile page there, not every pen I have, since i have way too many.  i'm talking more of proper integration aspect, since codepen is such an important, game-changing website, just like stackoverflow is.

Careers - add codepen.io


Is there a word for when you use a descriptor in place for a word/phrase you've forgotten?

Question: Best example I can give is a post I saw a while back where someone was trying to remember the name for a manta ray and described it as a sea pancake instead. Logically you could call it a sea pancake and most native speakers will get the gist of what you mean, but the actual name is still manta ray. Is there a word for that sort of phrasing in writing when you use nonstandard language but it still gets the point across or works as a valid name/descriptor?
Comment: ***stand-in*** word? That need not even be a word, maybe.
Comment: I would never ever take descriptor out for tea.
Answer: Expressing one thing in terms of another, which is what your friend seems to have done, may be put under the umbrella of 'kenning', per the Oxford English Dictionary:

One of the periphrastic expressions used instead of the simple name of a thing, characteristic of Old Teutonic, and esp. Old Norse, poetry.
*Examples are oar-steed = ship, storm of swords = battle.
The term is adopted from the mediæval Icelandic treatises on poetics, and is derived from the idiomatic use of kenna við or til, 'to name after'.*

Wikipedia has a very detailed and apparently scholarly article on Kennings, which I have linked to above. It isn't very quotable and I can't vouch for its accuracy at all, things are more simply put at YourDictionary.com:

A kenning is a figurative expression that replaces a name or a noun. Often it is a compound of two words and the words are hyphenated. Kennings are usually associated with Old Norse, Icelandic, and Anglo Saxon poetry.
Modern Examples of Kennings:

Ankle biter = a very young child
Bean counter = a CPA or accountant
Bookworm = someone who reads a lot
Fender bender = slight car accident
Four-eyes = someone who wears glasses
Comment: The example the OP gave was of someone making up a phrase, not using an established idiom like these. Of course, all of these must have started out with someone making them up the first time.
Answer:
analogy [noun] a comparison between two things, typically for the purpose of explanation or clarification. ...

the syndrome is called deep dysgraphia because of its analogy to deep dyslexia

a thing which is comparable to something else in significant respects.
Comment: Hi james, please attribute your source.
Comment: ... or this may be removed (copyright issues).


Why do we find evidence against null hypothesis in hypothesis testing?

Question: Why do you make the claim that you want to prove ( or have a hunch to be true) to be alternative hypothesis? One might argue that it has to do with the way hypothesis testing is set up. That you find evidence against null hypothesis as based on the definition:
A null hypothesis is a statistical hypothesis that is tested for possible rejection under the assumption that it is true.

So the subsequent question is: Why do we find evidence against null hypothesis? Why not against alternative?
Comment: Please see https://stats.stackexchange.com/questions/31.
Answer: Because we are making an assumption that the null hypothesis is true, and are trying to prove that assumption by computing the probability a random sample follows that assumption. (And also the alternate hypothesis is the exact opposite of the null hypothesis.)
Comment: We are not "trying to prove" the null hypothesis. Whatever result we find will not prove the null hypothesis.
Answer: The answer by micro5 is right stating that probability computations are made assuming the null hypothesis. If we observe something that is very unlikely under the null hypothesis, this counts as evidence against the null hypothesis (note that in fact what should be very unlikely is what we observed or something that is even further away from what is expected under null hypothesis; in many situations whatever we observe is very unlikely to observe precisely, so this in itself would not be evidence against the null).
As the probability computations that decide about the p-value, or whether the test rejects or does not reject, are computed assuming the null hypothesis, these cannot provide evidence against the alternative. The alternative only comes into play in the sense that the test is defined is such a way that if we reject the null, the data actually point in the direction of the alternative. If the alternative is indeed true, the probability is high (or at least higher than under the null) to reject the null.
Tests are not symmetric in null hypothesis and alternative; they are in the first place constructed to have a low type I error probability (of rejection) if the null is indeed true.
In fact, not only the null hypothesis can never be "proved", neither can the alternative. We're talking about probability models, and as G. Box wrote, "all models are wrong but some are useful". All tests have model assumptions. These go into the definition of both null and alternative, and these can never be guaranteed to hold.
Note also that almost always alternatives are composite, meaning that you may for example test $H_0:\ \mu=0$, where $\mu$ is a normal mean, against $H_1:\ \mu>0$. So even if we reject the $H_0$ and believe in the alternative (which we shouldn't, see above), the test doesn't tell us what $\mu$ is; under the alternative it can be anything larger than 0.


mcdonalds to ProperCase in C#

Question: How would you convert names to proper case in C#?
I have a list of names that I'd like to proof.
For example: mcdonalds to McDonalds or o'brien to O'Brien.
Comment: This is an interesting problem. I don't think there's an 'out of the box' solution. I have bookmarked the following article which may be close to what you want: [Lost and Found Identity Proper Case Format Provider (IFormatProvider implementation)](http://www.codeproject.com/KB/string/ProperCaseFormatProvider.aspx) I haven't tried the code and this solution pretty much requires manually handling all cases. But it is a start and maybe you'll find it useful.
Answer: You could consider using a search engine to help you.  Submit a query and see how the results have capitalized the name.
Comment: I've never actually done it.  Sounds like a task for the new interns!
Answer: I wrote the following extension methods. Feel free to use them.
public static class StringExtensions
{
  public static string ToProperCase( this string original )
  {
    if( original.IsNullOrEmpty() )
      return original;

    string result = _properNameRx.Replace( original.ToLower( CultureInfo.CurrentCulture ), HandleWord );
    return result;
  }

  public static string WordToProperCase( this string word )
  {
    if( word.IsNullOrEmpty() )
      return word;

    if( word.Length > 1 )
      return Char.ToUpper( word[0], CultureInfo.CurrentCulture ) + word.Substring( 1 );

    return word.ToUpper( CultureInfo.CurrentCulture );
  }

  private static readonly Regex _properNameRx = new Regex( @"\b(\w+)\b" );

  private static readonly string[] _prefixes = { "mc" };

  private static string HandleWord( Match m )
  {
    string word = m.Groups[1].Value;

    foreach( string prefix in _prefixes )
    {
      if( word.StartsWith( prefix, StringComparison.CurrentCultureIgnoreCase ) )
        return prefix.WordToProperCase() + word.Substring( prefix.Length ).WordToProperCase();
    }

    return word.WordToProperCase();
  }
}

Comment: You're awesome! Thank you!
Answer: There is absolutely no way for a computer just to magically know that the first "D" in "McDonalds" should be capitalized. So, I think there are two choices.

Someone out there may have a piece of software or a library that will do this for you.
Barring that, your only choice is to take the following approach:  First, I'd look up the name in a dictionary of words that have "interesting" capitalization. Obviously you'd have to provide this dictionary yourself, unless one exists already. Second, apply an algorithm that corrects some of the obvious ones, like Celtic names beginning with O' and Mac and Mc, although given a large enough pool of names, such an algorithm will undoubtedly have a lot of false positives. Lastly, capitalize the first letter of every name that doesn't meet the first two criteria.
Comment: Please, don't do the dummy approach with 'Mac'. My name is being constantly maimed by stupid mail systems.
Comment: @MaciejTrybiło: MacHines will do that do ya.
Answer: The hard part of this is the algorithms to decide on the capitalization.  The string manipulation itself is pretty easy.  There isn't a perfect way, since there are no "rules" for cases.  One strategy might be a set of rules, such as "capitalize the first letter...usually" and "capitalize the 3rd letter if the first two letters are mc...usually"
Starting with a dictionary of real names and comparing them to your own name for matches will help.  You could also take a dictionary of real names, generate a Markhov chain from it, and throw any new names at the Markhov chain to determine the capitalization.  That's a crazy, complicated solution.
The ultimate perfect solution is to use humans to correct the data.
Answer: Doing this requires that your program be able to interpret the english language to an extent.  At the very least be able to break down a string into a set of words.  There is no API built-into the .Net Framework that can achieve this.
However if there was, you could use the following code.
public string ProperCase(string str, Func<string,bool> isWord) {
  var word = new StringBuilder();
  var cur = new StringBuilder();
  for ( var i = 0; i < str.Length; i++ ) {
    cur.Append(cur.Length == 0 ? Char.ToUpper(str[i]) : str[i]));
    if ( isWord(cur.ToString()) {
      word.Append(cur.ToString());
      cur.Length = 0;
    }
  }
  if ( cur.Length > 0 ) {
    word.Append(cur);
  }
  return word.ToString();
}

It's not a perfect solution but it gives you a general idea of the outline
Answer: You could check the lower/mixed case surname against a dictionary (file) that has the correct casings in it, then return the 'real' value from the dictionary.
I had a quick google to see if one exists, but to no avail!
Comment: Doh, just noticed that Gregory said the same thing with additional (and useful) observations. I gracefully bow out :]
Answer: I'm planning on writing such a function, but will probably not go into too many edge cases...  Below in psuedo-code with regex for matching...
start with /\b[A-Z]+\b/ as set matching, so each sequence of letters up against a word boundary, match as a set.
if the string is all uppercase...
  lower-case the string
  upper-case the first letter
  do the following beginning of string replacements
    Vanb -> VanB
    Vanh -> VanH
    Mc? -> Mc?  (uppercase wildcard character)
    Mac[^kh] -> Mac? (uppercase wildcard match)

With the replaced whole-name string do matching against other replacement sets like...
"De La " -> "de la "

That should catch most cases for names in particular... but a nice database of common name casing would be very nice.
Answer: Here was my solution. This hard-codes the names into the program but with a little work you could keep a text file outside of the program and read in the name exceptions (i.e. Van, Mc, Mac) and loop through them.
public static String toProperName(String name)
{
    if (name != null)
    {
        if (name.Length >= 2 && name.ToLower().Substring(0, 2) == "mc")  // Changes mcdonald to "McDonald"
            return "Mc" + Regex.Replace(name.ToLower().Substring(2), @"\b[a-z]", m => m.Value.ToUpper());

        if (name.Length >= 3 && name.ToLower().Substring(0, 3) == "van")  // Changes vanwinkle to "VanWinkle"
            return "Van" + Regex.Replace(name.ToLower().Substring(3), @"\b[a-z]", m => m.Value.ToUpper());

        return Regex.Replace(name.ToLower(), @"\b[a-z]", m => m.Value.ToUpper());  // Changes to title case but also fixes
                                                                                // appostrophes like O'HARE or o'hare to O'Hare
    }

    return "";
}

Answer: CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
TextInfo textInfo = cultureInfo.TextInfo;
string txt = textInfo.ToTitleCase("texthere");

Comment: While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value.
Comment: This does not address the "Mc" case.  Title case would make it "Mcdonalds" not "McDonalds"

mcdonalds to ProperCase in C#


Use External monitor instead of faulty laptop monitor

Question: My laptop monitor is faulty and I am planning to use it as a 'desktop'. I bought an external led monitor. But when I connect it to my laptop via HDMI, the desktop gets extended. What I really want is to turn off the display on my laptop and use the external monitor, not dual monitor. How to do this.
Answer: Go to
System->Preferences->monitors
Select the screen labelled laptop (or similar), select the "off" radio button and then click apply. That worked for me anyway.
Answer: There must be a key, which pressed in combination with the Fn key, will turn off your laptop monitor. That key is usually on the function keys. What is your laptop model?
Answer: Maybe you can use disper: see my answer to this question


Is there formal test of non-linearity in linear regression?

Question: In logistic regression there is Box-Tidwell but I know of nothing like that in linear regression. I use partial residual plots to look for this, a graphical feature, but would love to find a formal test (in honesty I doubt you can do a formal test of this, but I could be wrong).
Comment: Related: https://stats.stackexchange.com/questions/70009/how-do-you-check-the-linearity-of-a-multiple-regression.
Comment: For the model $y=\beta_0+\sum_j\beta_jx_j+\varepsilon$, isn't a formal test $H_0:\beta_j=0$ for all $j$ vs $H_1: \text{not }H_0$? This is similar to an ANOVA F-test.
Answer: Box-Tidwell was developed for ordinary least squares regression models.
So if you were inclined to use Box-Tidwell for this, that's actually what it's designed for.
It's not the only possible approach, but it sounds like an approach you're already familiar with.
However, I'm not convinced that (most times it's used) a formal test is appropriate - I believe it usually answers the wrong question, while the diagnostic plots you've been looking at come closer to answering a useful question. [I have a similar opinion of many other tests of regression assumptions]
Comment: Would I be better off with a different specification is usually a good question, but one hard to tackle except very specifically. (Pun not really intended, but it seems to fit the case.)
Comment: The hypothesis being tested is exact linearity -- which will almost never be the case. If we fail to reject, all we learned was that our sample was too small to detect the nonlinearity, not that its effect was small. If we do reject, we're no better off, we learned what we already knew, but if the nonlinearity is small, it is of little consequence. The test still doesn't tell us whether the nonlinearity actually *matters*;  what we needed to know is how much difference the nonlinearity we have makes to our inference.
Comment: 1. With a large sample, that would form the basis of a (readily answered) question (how to see nonlinearity in a residual plot in such circumstances); ideally adding an example plot that would give you difficulty. 2. If you're fitting to the entire population of interest, notions of testing go out the window (you certainly don't have a random sample!). You literally have the whole thing you want to make inferences about, just calculate what you need.
Comment: @Glen_b Could you state the "wrong" and "useful" questions you refer to?  Thanks.
Comment: A problem I have, because I work with the entire population in question normally, is that I have thousands of data points. They tend to look like big blobs in the residuals so its hard to discern patterns in the regression; they don't represent very well what you see in text.books.
Answer: The best formal tests come from relaxing the linearity assumption, then seeing if removing the nonlinearities damages the explained variation in Y.  For example you can expand X using a regression spline and test the nonlinear components.  My RMS Course Notes goes into details.
But once you've allowed for the possibility of nonlinearity, you distort statistical inference by removing the nonlinear terms.  The real numerator degrees of freedom for the regression are the number of chances to give the model, which must take into account the nonlinear terms.  So the best advice overall is to allow effects not known to be linear to be be nonlinear and be done with it.  This will preserve confidence interval coverage, etc.
Comment: "So the best advice overall is to allow effects not known to be linear to be be nonlinear and be done with it. This will preserve confidence interval coverage, etc." I am not sure how you do that, but in any case in the areas I work in there is no well developed theory (very little in the way of sophisticated statistical analysis at all).
Answer: Fit a non-linear regression (e.g. spline model like GAM) and then compare it to the linear model using AIC or likelihood ratio test. This is a simple and intuitive method of testing non-linearity. If the test rejects, or if AIC prefers the GAM, then conclude there are non-linearities.
Comment: That is an interesting suggestion gammodel, but I have a question. I have many, say 30, predictors in my model. The AIC is going to tell you about the overall model. How would I know which of the individual variables in the model was actually non-linear?


What makes a good [fatwa-explanation] question?

Question: I just read a fatwa, but there's something about it that I don't understand. This totally looks like a job for the fatwa-explanation tag, but how should I phrase my question?
Answer: In order to ensure that such a question attracts actual useful answers, rather than argument and debate, it is important that it be presented as objectively as possible.  As such, the following guidelines are recommended:
1. Identify the fatwa
This is probably the most important step: The question needs to be based on an existing fatwa given by an authority under an identifiable methodology. If the question is about a common doctrinal/cultural understanding (e.g. if your question is "Everybody tells me that…" rather than "This particular scholar says that…"), it is too vague to be a fatwa-explanation (but it could end up as a good islamic-basis question instead)
1a. What counts as an "authority under an identifiable methodology"?
What is or is not considered authoritative can be highly subjective, but for the purposes of this meta post a fatwa can be considered "given by an authority under an identifiable methodology" if it…

…is clearly identified with an established madh'hab
…is written by a scholar with a large enough corpus of fatawa (i.e. a fatwa site or published work) that their methodology can reasonably be
interpreted

If, however, that fatwa comes from a forum or blog post from a relative unknown, it probably does not count as "authoritative".
What is important is that the foundations for the fatwa are understood (or can reasonably be expected to be understood), and that the person providing the fatwa understood (or can reasonably be expected to have understood) those foundations when presenting his own fatwa.
2. Identify the perspective
It is essential that such a question is scoped to the exact perspective of the fatwa itself, be this perspective a particular sect, a particular madh'hab, or even a particular scholar. If you're interested in an explanation of the fatwa, it is important that the fundamental methodology of the fatwa itself is presumed valid; outside perspectives which reject those foundations are more likely to devolve into arguments about those foundations than any actual useful explanation of the end result.
3. Explain the confusion
Just saying you don't understand the fatwa doesn't really say anything. What exactly don't you understand? Does it use complex grammar and vocabulary that you're having trouble parsing? Does it apparently contradict strong evidences? The more details you provide, the easier it is for others to resolve the issue.


Any website that explains most of the BIPs in a different way that newbies can understand better?

Question: Almost everything about all the BIPs is explained on github : https://github.com/bitcoin/bips still looking for a website that explains them differently (simple language, diagrams, history, implementations, etc. which everyone can understand better and appreciate the importance of proposals in Bitcoin.
Answer: I am not aware of one comprehensive write-up, but Aaron van Wirdum has a few great write-ups of various proposals in Bitcoin Magazine, the Bitcoin Optech newsletter has covered a number of the more recent proposals in depth, there are a number of talks (and transcripts of those) about BIPs on Youtube from conferences, workshops and Bitcoin meetups. There are a few BIPs that have their own tags here where they are covered more in depth, but again, I don't know about a single resource that is just focused on explaining all the BIPs. Maybe someone should start one? :D
Until then, our site here is a great place to ask all your questions about any BIPs.
Comment: Thanks. I was planning to make one in my free time if there is no such website.
Comment: Started working on a website: https://bips.gallery GitHub: https://github.com/prayank23/BIPsGallery Tweet thread: https://twitter.com/prayankgahlot/status/1322254155071680512


How can tune MySQL for Wordpress sites?

Question: I'm facing a problem that my MySQL database is slow, so I decided to check with mysqltuner.pl, I don't want to make any changes before I'm sure what I'm doing.
I'm running MySQL 5.7 on Ubuntu 18.04 LTS server.
This is a response from mysqltuner:
    -------- Performance Metrics -----------------------------------------------------------------------
    [--] Up for: 17h 51m 40s (400K q [6.226 qps], 15K conn, TX: 1G, RX: 63M)
    [--] Reads / Writes: 98% / 2%
    [--] Binary logging is disabled
    [--] Physical Memory     : 7.8G
    [--] Max MySQL memory    : 352.4M
    [--] Other process memory: 1.6G
    [--] Total buffers: 192.0M global + 1.1M per thread (151 max threads)
    [--] P_S Max memory usage: 72B
[OK] Maximum reached memory usage: 207.9M (2.61% of installed RAM)
[OK] Maximum possible memory usage: 352.4M (4.43% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (0/400K)
[OK] Highest usage of available connections: 9% (15/151)
[OK] Aborted connections: 0.01%  (1/15256)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 0.0% (0 cached / 338K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 37K sorts)
[!!] Joins performed without indexes: 494
[!!] Temporary tables created on disk: 78% (15K on disk / 20K total)
[OK] Thread cache hit rate: 99% (30 created / 15K connections)
[OK] Table cache hit rate: 29% (1K open / 6K opened)
[OK] Open file limit used: 2% (136/5K)
[OK] Table locks acquired immediately: 100% (1K immediate / 1K locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 72B
[--] Sys schema is installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (3M used / 16M cache)
[OK] Key buffer size / total MyISAM indexes: 16.0M/126.0K
[!!] Read Key buffer hit rate: 68.8% (16 cached / 5 reads)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 128.0M/77.4M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128.0M should be equal 25%
[OK] InnoDB buffer pool instances: 1
[--] Number of InnoDB Buffer Pool Chunk : 1 for 1 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 99.96% (12403660 hits/ 12408102 total)
[!!] InnoDB Write Log efficiency: 51.81% (14419 hits/ 27833 total)
[OK] InnoDB log waits: 0.00% (0 waits / 13414 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.

-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.

-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.

-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.

-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.

-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] This is a standalone server.

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    Control warning line(s) into /var/log/mysql/error.log file
    Control error line(s) into /var/log/mysql/error.log file
    MySQL started within last 24 hours - recommendations may be inaccurate
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    Adjust your join queries to always utilize indexes
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    join_buffer_size (> 256.0K, or always use indexes with joins)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    innodb_log_file_size * innodb_log_files_in_group should be equal to 1/4 of buffer pool size (=64M) if possible.

All of my websites are running on latest version Wordpress, and most of the content is static - like business websites.
How can I improve performance of MySQL based on mysqltuner analyze?
Comment: Additional information request.
# cores, any SSD or NVME devices on MySQL Host server?
Post on pastebin.com and share the links.
From SSH login root, Text results of:
B) SHOW GLOBAL STATUS;    after minimum 24 hours UPTIME
C) SHOW GLOBAL VARIABLES;
D) SHOW FULL PROCESSLIST;
E) complete MySQLTuner report
AND Optional very helpful information, if available includes -
htop OR top  for most active apps,
ulimit -a       for a Linux/Unix list of limits,
iostat -xm 5 3 for IOPS by device and core/cpu count,
for server workload tuning analysis to provide suggestions.
Comment: We want to assist you, but you have not logged in to stackoverflow since Feb 14, 2020. Many resources are available to you, but we need data from you as requested.
Answer: Your box is plenty big enough, no worries there. I can't tell how fast your disk drives are. If you have SSDs you're all set. If you have a drive scavenged from an old laptop, not so much. Upgrade it.
You should start by doing OPTIMIZE TABLE on the WordPress tables for each WordPress instance.  It can help a lot, especially for busy sites.  I've had success using the WP Clean Up plugin for that.
If you need to do more, use the mysqldumpslow command to find out what's in your server's slow query log. It will identify the worst performing queries.
Then you can prefix each slow query with EXPLAIN to see how the query is handled. Looking at the query and its EXPLAIN output can help you see what table indexes might help sped things up. (An explanation of how to do that is way beyond the scope of an SO answer, but see query-performance for many good examples.)
Can you pin the poor performance on a particular plugin? If so, ask the plugin author about it.
Answer: Suggestions for your my.cnf [mysqld] section from the incomplete MySQLTuner posted report,
thread_cache_size=64
tmp_table_size=32M
max_heap_table_size=32M
table_open_cache=4K
innodb_open_files=4K  # to reduce opened_tables count

Please consider posting additional information requested about 24 hours ago and complete MySQLTuner report after shutdown; restart and minimum 24 hours regular workday use.
Comment: @user134969 Have you had an opportunity to try these suggestions?  Please comment on positive/negative results.
Answer: The "meta" tables are poorly implemented by WP.  Here is my fix for that:  http://mysql.rjweb.org/doc.php/index_cookbook_mysql#speeding_up_wp_postmeta
Also, if you provide Wilson's request, I will check the tuning.  77MB of data is rather small, so I don't expect much will need improving.

How can tune MySQL for Wordpress sites?


edit users of assigned domain

Question: i need to one role like 'domainAdmin' in a domain can edit only users of the assigned domain not another domains. is this possible with domain access itself or another modules?
Answer: A good start would be here: http://drupal.org/project/domain_roles - This allows you to segment roles by domain. So you could create different roles, then assign those roles to users and by way of other access modules (Content Access could be useful but I'm not certain how it handles user entities) you could then limit the users to only their domains.
FWIW, this used to be done in Drupal 6 by way of the unstable module: http://drupal.org/project/domain_user_edit - Could be worth contacting the maintainer and seeing what you can do to take it over for Drupal 7 and on.

edit users of assigned domain


Should the alpha channel be gamma corrected

Question: We know that in PNG,BMP,etc... the pixel value stored is not in the linear RGB space. But I found no document saying anything about the alpha channel. Is the alpha channel stored in image files in linear space or not?
Answer:
We know that in PNG,BMP,etc... the pixel value stored is not in the linear RGB space.

This is not necessarily true. You can store whatever color space you want into an image, it doesn't even need to be colors (such as normal maps).
The alpha channel is generally linear. The alpha channel doesn't get displayed, but it is generally a non-color term used for transparency (or whatever else). Because they don't need to display on a monitor, there's no reason to store in in gamma space. If you did, you would unnecessarily lose precision at the lower end of the alpha values. Normals maps follow a similar line of reasoning, as explained very well by Julien Guertault.
Answer: Image file formats themselves do not regard the gamma but store pixel values unmodified as the authoring program (e.g. Photoshop) decides to store the values, so RGB and alpha channels have no distinction from image file format point of view (barring potential lossy compression strategies, but that's another topic).
However, when you author images in Photoshop, they are displayed on the screen in sRGB space including the alpha channel, so if you author alpha channel relying that the perceived brightness of pixels represents transparency, then you can say that alpha is also stored in the gamma space. BUT, if you author alpha by using layer transparency in Photoshop, then the alpha is stored linearly (e.g. 50% transparent layer is stored as alpha=128).
So in the end it depends how you author the data that in which space the data is stored and how you should interpret it. Also a thing to consider is if non-linear distribution of values gives you any precision benefits. Color values are stored in sRGB because human visual system responds logarithmically to light brightness, so it makes sense to have more details in darks than in brights to reduce perceived banding, but you could ask if such distribution would benefit say normal maps or roughness values stored in textures.
Answer: Keeping alpha linear makes it unbiased towards source and destination color. It should not be gamma corrected, because it should not have been subjected to sRGB-encoding.
A specialized application could of course ignore this, for example to get more control over the change in perceived brightness during a blending operation of a bright source color over a dark destination color (assuming alpha is stored in a byte with range 0-255 - which is how sRGB is commonly stored these days for the purpose of data compression - where you can only change the alpha in big steps).
I might add that 8 bit for linear alpha is actually very low resolution. Blending white over black with alpha 1/255 (the smallest non-zero alpha) yields sRGB values 13, 13, 13 when you do the math properly in linear RGB, possibly leading to all sorts of banding and aliasing artifacts. A lot of widespread image editing software is surprisingly inept at offering means for dealing with this.
What I mostly do now is to take whatever alpha my image editing software spits out and apply smooth-stepping like so:
f := float32(alpha) / 255
return (1-f)*f*f + f*(1-(1-f)*(1-f))

This essentially is a hack which balances:

Banding artifacts in low-alpha dark-over-bright and bright-over-dark blending scenarios.
Lossiness in white-over-black alpha-gradients.
Staying close to the original curve.

If the result looks bad, I will usually do some over-correcting in the image instead of in the math. The math is a lost battle due to graphics software doing whatever.
Interpolation artifacts (which are often brought up as a reason for doing alpha pre-multiplication) can be remedied by giving color to pixels with zero alpha which neighbor pixels with non-zero alpha, which is a task best automated with software.
Comment: Finally a convincing argument for linear storage of alpha. Thanks.
Comment: @Ruslan Thanks for your comment. I added some more info from what I've learned since.


nvidia rtx 2080 ti - dual monitor stopped working - smi driver not loaded - ubuntu 18.04.2

Question: One day booting my PC I noticed that only one out of two monitors displayed the signal/data from the PC. Switching cable, ports and rebooting I realized that every of the three display ports of my trx 2080 ti were working fine but not at the same time. At maximum one port/display shows the PC's output data. Further when calling nvidia-smi I had the following result: "NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running."
Going to "settings"->about I found out that the Graphics are managed by "llvmpipe (LLVM 7.0, 256 bits)". Seems to be the fallback variant of the Mesa 3D graphics library when no GPU driver is available. Ubuntu 18.04.2 is currently installed on my machine.
Reinstalling the NVIDIA driver serveral times and using different methods (e.g. by execeuting run_file {NVIDIA Driver, CUDA 10.0 including driver installation}, using the graphics driver ppa from Ubuntu, .deb packages for CUDA 10.0 and CUDA 10.1 including driver installation) did not solve the problem.
After removing the old driver and re-installing the latest versions of the driver (418 and 410) I will get always the same message when executing nvidia-smi:
"NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running." Further, only one monitor works while the other does not a signal.
I also tried another GTX graphic card (different model) and got the same issue.
The strange thing is, that I did not change anything on my system when problem has occurred the first time, besides some regular Ubuntu updates. Could those have been affected the NVIDIA driver?
Comment: Have you tried to look at https://askubuntu.com/questions/1087279/unable-to-install-nvidia-drivers-for-rtx-2080?rq=1 and https://askubuntu.com/questions/1088154/ubuntu-18-04-not-loading-nvidia-drivers-for-a-rtx-card?rq=1 ?
Answer: In meantime I have found out that my cc and c++ refer to clang-8 and clang++-8. I used the update alternatives in order to clang the default compiler. I thought that maybe that has caused the issue. I changed the update alternatives of cc and c++ to refer to gcc-7 and g++-7. Then I removed Cuda and Nvidia with purge and reinstalled Cuda 10.0 bast on the network .deb file. Calling nvidia-smi after that lead to the correct result. I think the problem has been originally caused by cc and c++ referring to Clang.


Setting a web app as default program in Windows?

Question: I use StackEdit quite a bit for writing markdown files.  Is it possible in Windows 7 to associate a web app as default program for a given file type?
Comment: Try making an exe which accepts the file and opens it in StackEdit
Answer: Not that I'm aware of, the closest thing would be opening the page by default and then importing your file from the page. And even that would be hard, as i think you can't pass any arguments to a program when its set as default, and you would have to make a program that launches your web page, and set that as default. You basically can't interact with a page from outside the browser. Short answer: No.


How do AC and DC hipot tests compare?

Question: Suppose I have a DC/DC converter, Recom RPP30 for an example to hand. It lists an isolation voltage of 3000 VDC. How does this translate to an AC isolation voltage? Would this be equivalent to 3000 VAC RMS? 2121 VAC RMS (3000 peak)? Something else?
Comment: Sorry you are getting spammed, just protected your question to help.
Answer: Using the example you have indicated i.e. the Recom RPP30, it is certified UL 60950-1 (PP21) and this makes it a little bit more special than just any old dc convertor with isolation between input and output.
The baseline for a dc-to-dc convertor is that it should isolate but, because it is powered from DC, there may be no expectation for such a basic device to offer full reinforced insulation. This is because it's likely to be fed from an already "safe" ac source from a transformer and rectifier; the transformer (in most applications) will offer the safety insulation features.
However this one is approved/certified to 60950 and (as far as I can tell) it should withstand twice rated voltage plus 1000V. For 250Vac this works out at 1500Vac. I guess the assumption here by Recom is that it could be powered from a dc supply that derives its dc voltage directly from the AC mains power.
How does this tie in with what it says it is tested at?
They say it is tested for 1 minute at 2250Vdc and I guess this is close enough to 1500Vac (pk) so that it doesn't matter.
\$ 1500 \times \sqrt{2} = 2121volts \$
Maybe they decided to add an extra 129 volts on for good measure; hopefully someone can offer a better reason? Maybe they designed it to be safe when directly connected to an ac supply of 296V? This would become: -
\$ \sqrt{2} \times (2 \times 296 + 1000) = 2251volts\$
It's interesting to note that 3000V is precisely one-third more than 2250.

How do AC and DC hipot tests compare?


Relics of Noah's Ark?

Question: Do any Catholic or Orthodox churches claim to have relics of Noah's Ark? (As one might have a piece of the True Cross, for example.)
Comment: @KorvinStarmast I think we may have different standards of what is basic research; some of us weren't even alive three decades ago to remember that event. Besides, my top search results for "Noah's Ark relic" are this question, some news articles about a Babylonian tablet said to refer to Noah's Ark, and some articles about replicas. I dug a little longer, but couldn't find anything obviously referring to relic remains of Noah's Ark.
Comment: Welcome to Christianity.SE. For a quick overview, please take the [Site Tour](http://christianity.stackexchange.com/tour). For more on what this site is all about, see: [How we are different than other sites](http://meta.christianity.stackexchange.com/q/1808/20394). Meanwhile, I hope you'll browse some of the other questions and answers on this site.
Comment: My question was not about contemporary findings of the Ark, but of history and relics. I tagged as Catholic and Orthodox as Protestants don't tend to have reliquaries. (Also Martin Luther and John Calvin ridiculed them.)
Comment: @thunderforge Remove relic from the search term and you may have more success in finding the stories I referred to.  I have removed my objections to this question.
Answer: The Armenian Orthodox Cathedral in Etchmiadzin, Armenia claims to be in possession of a relic of a piece of wood that was part of the ark made by Noah, however it is mostly based on legend.

There are many legends that the mountains could tell about the time when Noah and his family descended from the Ark into the valley. One day the Christians of the area decided to retrace Noah's story by climbing Mount Ararat and finding the Ark. On that day Bishop Jacob of Nisibis grabbed his staff, crossed himself and set off on his journey.
However, he found it very challenging—on his first attempt he stopped to rest and was so exhausted he fell asleep on a warm boulder. When he awoke he found himself standing at the foot of Mt Ararat, staff in hand. He crossed himself again and began to climb once more.
Three times he tried to climb to the summit of Mt Ararat to see the Ark, but each time he became so exhausted he fell asleep and awoke standing at the foot of the mountain.
Finally God saw his efforts and sent him an angel who told him there was no reason to climb the mountain because the Ark could not be found. Instead, in reward for his faith and patience, God gave him a piece of the Ark.
When Bishop Jacob woke he could feel something hard under his head—it was wood from a Shittah tree. According to scripture, Noah, the forefather of all humanity, built the Ark from this wood.
Jacob thought it was best not to question God, and he returned to the people with his recount of what had happened. That sacred piece of Shittah wood was framed in gold and has been displayed in Etchmiadzin cathedral since. - The Legend of Noah's Ark Relic

Relics of Noah's Ark?


First step in OOD?

Question: What is the frst step in OOD?
Comment: Be a bit more specific? What is the problem domain? What do you know already?
Answer: There are no steps, it's not a process.
Answer: The answer is..

(source: headfirstlabs.com)
http://headfirstlabs.com/books/hfooad/
http://www.amazon.com/dp/0596008678/?tag=forelangstud-20
Answer: Practice, read broadly and more practice.
Especially with others to review and comment on approaches.
Reading should cover not just OOD, but also patterns to see how others have approached common problems.
Answer: It's a lot of practice.  The first thing is to get your mind around the way objects work--especially if you are a procedural programmer.
Practice making many small objects--I've literally never seen a system with too many objects; it's possible but I've never seen it.  It should be really obvious when you need to put many objects into one, but it's not as obvious when an object should be broken up.
Ask an object to do something, don't ask for it's data.  Try to avoid getters and setters and concentrate on methods where you ask it to do something with it's data.  If you EVER see code like o.a=o.b+o.c or o.setA(o.getB()+o.getC() you are doing it wrong.
Constantly try to refactor out duplication.  Rewrite your code repeatedly until there is none (or as little as possible).  This will probably do more for your OO design skills than any other practice.  As you get more knowledgeable, try refactoring things you didn't think you could refactor before.  Anything that even looks like a pattern can probably be refactored.  For instance here's a very basic example--if you had lines of code that looked like this:
<code>a = b + c * d;
g = h + i * d;
</code>
Chances are there are HUGE refactorings missing in your code even though it doesn't look like it off the bat.  You probably are missing an object that would hold a,b,c and a second instance would hold g,h,i, after creating these objects a bunch of stuff would factor into your new object.  Learning to recognize new opportunities like this is critical.
I've been programming for over 20 years now, over half of it has been OO at this point and it seems like every few years I think I know it all--a year later I look back and realize how ignorant I was.
Answer: the first step is object oriented analysis - its aim is to identify the objects that make up a system and how they interact; given this knowledge you can then specify the behavior of the object (the interface methods) and then the internals (what are the required data members of an object)
The design process produces a number of diagrams - these are tools that are supposed to help with working out the details of the system :
first come a set of 'use cases' - a use case is a verbal description of a scenario that is implemented by the system (one is supposed to pick the most substantial ones); these are then used to identify the main actors and concepts which are supposed to map to the classes of a system. This understanding is then refined by working out 'object interaction diagrams' 'class diagrams' and 'sequence diagrams' sometimes state charts are used to visual state machines - these diagrams are tools to gain an even better understanding of the system, as a result you have a sufficient understanding of the system to write the class header files/class definitions. There are no fixed rules which one of these diagrams come first, these are used as appropriate.
i found the following book very useful :
OBJECT-ORIENTED ANALYSIS AND DESIGN With applications (second edition) by Grady Booch
the book goes through the process of designing several example systems step by step (i think it is enough to read the design process for these example systems); One minor problem is that the notation used in this book is a bit dated : modern practice is to use the UML notation for diagrams, however the book still uses the older Booch notation. The strong point of the book is that it is always explaining each concept by working through concrete examples.
Answer: There are some preliminary steps:

Understand OOD (in general)
Understand the problem/application domain (the functional specification)
Have a high-level/architectural design: know what O/S, libraries, frameworks etc. you can use

I then use a mixture of top-down and bottom-up development:

Top-down: decide what components and what APIs (object interfaces) I would like to have in order to implement the application (and then, develope those API)
Bottom-up: decide how to add new functionality to existing APIs (object interfaces), by adding new methods and new types of object (and sometimes splitting a large object into several smaller objects).
Answer: The first step of OOD are the OOD principles. Check out The Principles of OOD.

First step in OOD?


change ctrrl+a keyboard shortcut (select all)

Question: I want "super+a" to select all text in whatever text field I'm in. In other words, change the "ctrl-a" shortcut to be super+a.
Here's why: in gnome tweaks: I love the "emacs input" option. I come from mac, so I'm used to ctrl-a going to beginning of the line, ctl-e to the end, ctrl-n next line, etc.
However, if ctrl-a goes to beginning of the line, I need a keyboard shortcut so that I can select all text.
EDIT
For the record, I found a workaround to my immediate problems. After changing the google search terms I used, I found this: https://askubuntu.com/a/607920/52054 . However, "ctrl-/" is still a horrible shortcut, IMO, and I want it to be super-a
Comment: do you find a way please?
Answer: One way is by using dconf-editor
<code>sudo apt-get install dconf-editor
</code>
Under the /org/gnome/terminal/legacy/keybindings, you will find one to select all.
Or you can use xbindkeys.


Why is running the accuser "optional"?

Question: The docs are not really clear, but seem to imply that, to bake, running the baker and the endorser are mandatory (or at least desirable).  In a number of places the documentation states that running the accuser is "optional".  Why?
Comment: Those are different aciviries. You do not need to be baking in order to accuse others afaik
Comment: Thanks @Ezy. So baking, endorsing, accusing.. these are all "optional"; in other words, failure to run one does not impact one's rewards when running the other services, right?
Answer: Your baker and your endorser are working for you : they create blocks and operations with your signature, and you get rewards for that. The accuser is different: it monitors the network, detects double-baking or double-endorsing, and sends an anonymous operation  on the network, that can be inserted by any baker, not only yours. So, even if you don't run an accuser, it is enough that there is one accuser on the network, ran by somebody else, that detects the double-baking and generates the operation, your baker will still be able to use it, and you will receive the rewards.
Answer: I'm not sure where in the documentation it says that but my guess for the rationale is that, while every participant in baking and endorsing increases the security of the network, the marginal gain for the network of someone running an extra accuser once a few are already running is low. However, the marginal gain for the baker isn't low, since accusations can come with high rewards.

Why is running the accuser "optional"?


How can I change the default usage rights settings of the Google Images search?

Question: I would like the default setting to be Labeled for reuse. How can I make this setting apply permanently?
Answer: I've been seeking this for a long time and have yet to find an extension or modifier that will change the defaults image search uses.
My only solution so far was to create a search engine I enter in chrome, with a shortcut gcc (or whatever works for you) and for the query URL:
https://www.google.com/search?q=%s&tbm=isch&tbs=il%3Acl&hl=en

This means in the URL bar I can enter gcc TAB then enter search terms.
It works great, but if I modify the search at all, it reverts to those default settings. The query parameter for the license settings appears to be for CC search
tbs=il%3Acl

and for "Commercial and Other Terms" that value is
tbs=il:ol

I've been using these for years, almost any sites search result can be made into one of these just modifying the results for the search query to be %s
Answer: I found a new idea, install the Requestly extension which is used to modify URLs.
I have a pattern that looks for urls containing the google image search parameter tbm=isch and if it is in the URL, it adds the parameter tbs=il%3Acl that makes the results Creative Commons only.
Import my rule of create a rule like this

All google image searches I have tested so far have the CC option enabled -- the only way to not use it is to disable the rule or the extension. If I was better at regex i could maybe find a more elegant rule pattern.
But all my image searches come with CC selected.


Air Canada only giving partial refund on canceled ticket within 24 hours of booking?

Question: I'm trying to cancel a flight that was booked less than 24 hours ago, I'm seeing that Air Canada does not want to refund the full ticket amount, but their policy appears that they should refund the full amount? Am I missing something or this correct? Currently trying to get through to them on customer service but can't.
Comment: This looks like an after-24-hours cancellation. Are you quite certain of the time? Regardless, you should call them immediately.
Comment: probably whoever coded that didn't special-case the 24 hour thing and this is just generic cancelling. Call someone before the 24 hours are up.
Comment: Those rules often apply per country - and some airlines enforce them as such. If you buy a ticket from the US, you have the right for a full refund within 24h (I don't know for Canada). If you buy from another country, those country's rules apply, and the might be different. The airline might just allow everybody that option, but not all do.
Answer: This Canada Air webpage says a booking made online may be cancelled for full refund within 24 hours. If that's how you booked, you're entitled to cancellation and full refund.
Push harder.


Mass remove/add to multiple security groups cross region

Question: Would it be possible to create a script or use something like terraform to mass remove/add security group entries across several regions under the one account based on the security group name? Specifically we are allowing remote access to a few instances based on public addresses that are changing frequently, so updating manually has become tedious. Thanks!
Answer: Do you already manage your resources with Terraform or are you looking for something to iterate through your AWS environment to change those settings?
If you're currently not managing your environment with Terraform, you'll have to import your resources into Terraform before you can begin making changes to your environment.
Your request sounds more like something you'd use the AWS CLI or perhaps Ansible for. Terraform isn't intended to perform scripting tasks on an environment.


Multiple duplicate URL's

Question: I keep getting these duplicate pages for my about page. I can't figure out what is causing this issue. Any help or direction?
Answer: You have code like

If your href doesn't start with a / and isn't a complete URL like https://example.com/, it will be used as a relative URI, and will simply be added after the current URL.
Add 89 after https://www.docreit.com/about/12/ and you get https://www.docreit.com/about/12/89.
You'll have to figure out what part of your theme generates those links.

Multiple duplicate URL's


How do i share my files from windows 7 to Ubuntu?

Question: I just Downloaded Ubuntu to my laptop and I noticed that my files like music and pictures aren't here. How can I get them from my Windows 7 part of my computer to the Ubuntu part? Please make it simple and step by step. Also to be clear this is all on one device.
Comment: Are you installing Ubuntu through Wubi?
Answer: Alternately , you can also use USB Drive for transferring data. If you are unable to see your data from Windows.
Comment: True, should have thought of that when I was typing my answer, always seems that I forget to add something......Thanks
Comment: This will work for transferring, moving, but doesn't really address the "sharing" issue. I've posted an answer with more detail.
Comment: @TrailRider, btw i got it from your Screenshot!
Answer: At the top of a blank desktop or you home folder go to the menu and hover over the "Go"
a menu will pop up, click on "Computer" on that you will see something similar to this

Instead of my USB drive you will see a icon that looks like the File System icon that will say (size of your hard drive)GB File System(example-500GB File System)  This is your hard drive if you click on it you will mount your Windows partition and you will be able to access the files, your personal files are in the "Users" folder under your username.
F.Y.I.  the "File System" you see on my screen shot is the Ubuntu File System(also seen on the left side bar under Computer)
Oops, forgot to add that you can then move the files from one partition to the other, it will be easier if you open two windows and you can then drag from one to the other, easier than trying to drag between tabs I think.
Note: thank you to Linux Distance for the correction on the Windows folder for Windows 7, I only used Windows 7 for long enough to check that all the hardware on my new  computer were working(about 2 days) then wiped Windows and installed Ubuntu so I was erroneously giving the folder for Win XP as my memory was faulty.
Answer: I think the word "sharing" is critical here.
Presumably you want to access files from your Windows documents folder, use and/or edit them, and still be able to access them from Windows when you next boot into it.
If this is the case, then copying them into ubuntu isn't really going to be very useful for you, for while Ubuntu can see your windows files, the reverse is generally not true.
Instead, make sure you locate them as pointed out by TrailRider and use them in-place.
You could create a shortcut to the windows documents folder in your Ubuntu home folder, so that you can always get there simply, from within application dialogs and such.  To do so:

Locate your documents folder as pointed out by others (Usually under
\Drive\Users\Yourname for Windows 7)
Right click and choose the    option "Make Link"
A new item will appear in the folder, called "Link to Document"
Move the new link to your Ubuntu home directory. You can rename it if you like.

You can create specific document type links if you like, for example, a "Windows Pictures" link in your Ubuntu "Pictures" folder, just for your images.
Comment: {quote} I think the word "sharing" is critical here{quote}  I think your right and I think I misread the title.  When I got to the question it said "get them to" so I didn't notice, thanks for the clarification.
Answer: Assuming that you are using Wubi.

Go to the Home folder by clicking the Folder icon on the Top-Left corner.
Click on File System on the left panel.
Then go to the host folder.

This is your Windows Drive.
If you are using Windows 7, go to /Users/Username to see your home folder in Windows in Ubuntu.
On Windows XP, go to /Documents and Settings/Username to reveal your home folder.  Your Music and Pictures should be present.
After that, copy your personal files to your Ubuntu home folder.
Answer: Link Ubuntu home folders to corresponding Windows folders
Read carefully and do at your own risk.
If you concentrate on the renaming of the folders, the process will go smoothly.
You can match up your Ubuntu home folders to your Windows folders.
Firstly set to automatically mount the Windows partition on boot, using this guide.
Once you have done that, create a shortcut for each of the corresponding folders.

Click the folder, drag and hold the Alt keyboard button.
Drop it into your Ubuntu home folder and select Link Here.
Repeat the process.

Ignore the "Desktop" and "Downloads" folders, because file permissions will cause havoc!
This is because you will not be able to execute installation files in those folders if they sit in the Windows folder and you are currently booted in Ubuntu.
Each link will be named something like "Link to Documents". Leave them this way.
Write down the following instructions for reference...
Once finished, log out of Ubuntu.
Press Ctrl + Alt + F1 to load into the terminal.
Type your username and password to log in.
Type dir to view the folders and file in your Ubuntu home folder.
Raname each original corresponding Ubuntu folder, so they are different.
e.g "Documents" to "Documents Ubuntu" OR "Pictures" to "Pictures_", etc.
By typing:

mv "###" "### Ubuntu"

This is so as to prevent conflict in folder names. Type dir if you are unsure of the state of folders. Type clear to clear the screen for readability.
"###" being the folder name, such as "Pictures". Typing sudo at the start of each line is not necessary here because you are already logged in by this point.
Press Up Arrow to recall the last commands for speed of use.
Once done, for each "Link to ###" folder, rename it to the original Ubuntu folder name by typing:

mv "Link to ###" "###"

Once finished, press Ctrl + Alt + Del to reboot.
Once you are logged back in, check those folders are now linked to your Windows folders. You should notice Ubuntu has still assigned the correct icon images to the folders because it has been tricked into thinking they are the original Ubuntu folders.
Enjoy!
Answer: They are still on your computer, and Ubuntu is able to access it. Just mount your Windows partition. They are in Users/. Alternatively, you can choose to transfer files from Windows 7 while installing Ubuntu.
Comment: Thank you for the correction on the Windows folder.  Bad memory on my part.
Comment: my files were under FileSystem. thanks TrailRider
Answer:
You can develop a sharing folder and assign that folder in Virtual Box "Shared Folders", then enable the folder after booting Ubuntu from "Shared Folders" in Devices.
You can enable "Drag and Drop" in Devices.