Is it loshon hora to speak badly about someone even though the listener already knows?

Question: I've heard that if something is publicly known that it is not considered loshon hora? Is it true that it wouldn't be loshon hora if Reuven tells Shimon that Levi is very fat, even though Shimon already knows that?
Comment: But if it's negative I would suspect it would still be a problem of rechilus
Answer: The Chafetz Chaim writes about the heter for lashon hara of something that is already public in Chapter 2. He writes that "yesh omrim" that if you heard something said in public (i.e., before three people), then it is not lashon hara for you to repeat it because we assume that the rumor will spread anyway. He doesn't talk specifically about talking to the person who already knows (I hope if he addresses it someone else someone will add). However there are several limitations.

You can't have intention to spread it; it just isn't lashon hara if you happen to mention it to someone else in conversation. 2:3.
The heter only applies to those who heard it directly in public. But if you heard it second hand, the mere fact that it's public doesn't allow you to spread it further, especially since you don't know it's true. 2:4.
The heter doesn't apply if the original listeners were yirei shamaim, because we can't assume they will spread the rumon. 2:5. Similarly, it doesn't apply if the original speaker told people not to repeat it. 2:7.
The heter only applies within the same city; you can't spread it to a new city. 2:6.
You can only say "I heard X," you cannot add to it or endorse it. 2:9.
While it may not be asur to say it, you should still worry that the person you tell will be over in isurim, for example if you think he will believe it and spread it more or amplify it. 2:10.

I think what comes out of this is not that we say once something is public all bets are off. Rather, we say that if you know firsthand that something was said in public, maybe you don't need to be quite so careful about spreading it further by accident. So applying this to your example, the fact that the listener already knows also shouldn't create a blanket heter for Reuven and Shimon to sit around trashing Levi, especially if it might cause them to add to it.
Lastly, I would add two points from my own svara l'fi aniyut daati. First, the Chafetz Chaim writes in 2:1 that the more people hear it the bigger than sin. So even if you might be off the hook for spreading the story more, I would worry that you are compounding the isur of the original speaker, and why would you want to do that? Second, all of this refers to the specific isur of lashon hara. But there could be other isurim involved. For example if you do in fact contribute to spreading the story or you're just keeping the rumor alive instead of letting it quiet down, you might be causing more pain and embarrassment to the victim.
Comment: Although public information may be related in an incidental manner not designed to further publicize the information (e.g., "I think you should limit your consumption of junk food. Don't you remember how Shmuel gave a speech explaining how he gained so much weight from overeating junk food? I don't want that to happen to you."), it is not permitted if the intent or manner of discussion of the known information is disparaging ("What a fatso Shmuel is!" "I know, right?!").
Comment: @Fred I agree and think I made that clear in my post. If you think it's not clear you can by all means edit my post.


When is it appropriate to use WCF over webclient or httpwebrequest?

Question: I'm looking to understand when to use a WCF services instead of just using webclient or httpwebrequest. I guess I'm also looking to understand the difference between the design patterns that would be appropriate for both.
Answer: Are you talking about when to create a WCF service yourself (over web service), or when to consume an existing web service using WCF instead of .NET 2.0 ASMX clients?
As for creating a WCF service yourself:

Gives you a lot more options in terms of hosting (in an app, Windows Service, IIS, WAS)
Gives you a lot more security options
Gives you a lot more protocol options (besides just HTTP, you can also use WS-*, TCP, Named Pipes, MSMQ and more)
Allows you to write your service once, and expose it on multiple end-points with different protocols at the same time

As for using WCF to talk to an existing HTTP (ASMX) web service - I don't see a whole lot of massive benefits, except WCF uses more configuration over code, and it can be good to standardize on one way of doing things, if you already use other WCF services, anyway.
Marc
Answer: I'm currently using WCF for most of the things that I would use WebClient or HttpWebRequest/HttpWebResponse in the past.  While there definitely is overhead for learing how to make calls to web methods using WCF, the extensibility of WCF and the abstraction it provides makes it a MUCH better candidate for these types of calls.
I've already used it to make calls to Akismet and RPX pretty easily.
To get started, I'd look at the section of the MSDN documentation titled "WCF Web Programming Object Model", located at:
http://msdn.microsoft.com/en-us/library/bb412204.aspx


Easy way to remove the sticky pages of a book caused by being wet?

Question: I have an old bible gold edition (recovery version) that has been soaked because of a leak in my ceiling during a typhoon. Now it is dry, but the pages are in poor condition and stick to each other, I can carefully separate the pages manually but it would take me a long time because it has thousands of pages. Are there any other methods of separating the pages in a much faster way?
Answer: Ultimately, the best course is to buy a new one, but if you must keep this one, try this:
Get the book wet again. The pages will loosen, and you can dry them out carefully as described here. If you need them flat, you can iron them after they were dry. You can do several pages at once if you want, to save time. Or you can just leave them wrinkled.
Answer: According to wikiHow, there are the following 4 methods:
Method 1: Slightly damp

Remove as much liquid as possible from the book by taking it out of the puddle and carefully shaking off the liquid.
Blot the affected pages, preferably with a towel (cloth, not a paper towel).
Assess how much of the book has gotten wet. If a certain portion is still dry, insert something between the wet portion and the dry portion to prevent the liquid soaking the whole thing while you prepare for the next step.
Plug in your iron. Turn it to a very gentle setting (silk, for example) and wait for it to heat up. Turn off the steam.
Place your book on your ironing board and carefully single out a wet page. Be careful not to tear it.
Take a piece of absorbent paper like a paper towel (or a piece of toilet paper)and place it on your wet book page.
Place your warm iron on the tissue and move it carefully from side to side. If you can't do it without creating wrinkles in the tissue, press it down, then lift it up, set it down a little to the left or right of your original spot, and continue.
Check the page under the tissue to see how dry it is. Repeat the former step until you achieve your desired dryness.
Continue with this method until you have dried all affected pages of your book. Use new pieces of absorbent paper for every page, as needed.

Method 2: Soaked - If your book falls into some water and it's floating.

Check carefully the position of the book while it floats and attempt to catch it gently. Place your hands inside the water beneath the book and lift it as not to rip up the frail paper.
If the book is completely soaked, trying the method above will rip the paper. If even the cover is wet you should put down the book on a warm and clean surface. Good options are a boat's deck in the sun, a balcony, a car's hood or concrete floor, if you watch it so that no one else picks it up.
Try to access the extent of the damage by trying to flip the pages of the book. If you can see the next page's writing through the first don't pull them apart.
Flip the book every so often, to ensure it dries throughout.
When the pages are tough enough to read as a regular book but it still feels moist, you may try the first method used above for smaller amounts of liquids.

Method 3: Using a hairdryer. This works well for both for damp and soaked books.

Carefully smooth out the pages.
Dry on the high heat setting 10 centimeter (3.9 in) away from page on slow dry.

Method 4: Making rabbit ears.
This method helps air circulation and prevents pages from sticking together.

Fold each wet page corner, 2–3 centimeter (0.8–1.2 in) toward the center of the page, without pressing on the loop that formed.
You can skip a page every now and then.
Repeat for both "open" corners or just one corner, depends on the level of dampness.
Leave to dry.
Comment: All these methods are for books which are still wet, the book in the Q seems to be dry already.
Comment: These are all good methods. But which is the best?
Comment: @darthnesscoveredthesky There is no best I think, because it depends what happened to your book and how bad it is. Each person should choose the method depending on his needs and availability of the tools.
Answer: My BIL is the "Maytag Man". He says a wet book should be placed in the freezer, and left for weeks or months.
Comment: Can you please expand on this answer? The bible in the question is already dry, should he make it wet again?


Can I make my Nikon DSLR put photos in separate folders per day?

Question: When I take photos, I want my camera to create a folder for that specific date, and when I take photos on another day, it'll have a folder for that specific day, and so on. During thtransfer of my photos from SD card to computer, it would be easier to see the dates on which I took the photos. Is it possible?
Answer: There's no way to assign a date-based filename on-camera. However, there are quite a few pieces of software that will help do just this when ingesting photos from the memory card to your computer, giving you the ability to define your preferred file name, folder structure, and assorted metadata, too, such as Adobe Lightroom and Camera Bits Photo Mechanic.
Comment: For what it's worth (not much, I suppose, but in case this is a _really_ important feature to someone and they can't live with your suggestion for doing it on "ingestion", there's no way on this Nikon model, but it _is_ possible on some other brands of DSLR.
Answer: If you're ok with Dropbox, Using the automatic import function will rename all of your files to the datetime taken. My process is:
1) Plug SD card into computer (in my case it's an iMac)
2) Let dropbox do the automatic import
3) Have hazel automatically file into my Pictures folder with the structure Year/Month/Day Taken
4) In Lightroom, I use the synchronize folder function to import any recently added photos
I have a separate hazel rule that deletes files from the dropbox camera uploads folder a 1 week after they were taken. So really, dropbox is just a temporary holding place for my files.
Answer: Nikon assigns sequential filenames to the pictures, but it does record the date, which will show up in the date column on your PC.  I usually have a separate folder on the PC for each day I shoot.
So, as long as you have correctly set the date and time on your camera, you should be good.
Answer: Why not just load your photos (which I do daily) onto your computer and when you "select all" you can rename your photos in a zip.  It doesn't take but a few tries to get that right. If you see a set of photos you want to put in its own group for a certain day, then "highlite" just those photos by pressing control then enter then rename to your discretion (by date or occasion) This make it alot easier than trying to put all this to a camera (which some cameras will put a date on each photo). Hope this helps.


How do I collect my Defender Bonus?

Question: I put a pokemon in a gym and the gym later on got defeated and replace with another colour. I didn't get any defender bonus from the gym. This happen two times so far.
Comment: Did you go into the shop and claim the defender bonus as soon as you held the gym?
Comment: There is no defender bonus in the shop. I was thinking you might have to be in a gym for a certain amount of time so you can get defender bonuses?
Comment: Your problem is that your Pokemon was not in the gym defending it when you went to collect the bonus. Next time collect the bonus right after you capture and leave a Pokemon at the gym.
Comment: @ThePickleTickler not really a duplicate, though a lot of recurring themes...
Answer: You can collect your defender bonus in the shop window of the Pokemon go app.

The bonus can be collected instantly; however, you can only do this while you have your Pokemon in the gym. This means that if you don't collect your bonus while your Pokemon is in the gym and your team controls it you will loose it.
Also (as per comment below by Fatalize); please note that if you collect the defender bonus, and then capture another gym before the bonus claiming has cooled down, you will be unable to claim the bonus for that new gym until the 21 hour cool-down for collection is completed. This means that you may not be able to collect a second bonus at all if you have collected one then join/capture another gym, but loose it before your cool-down for collection is over.
Answer: As of the recent gym system overhaul, you no longer collect your gym bonus from the Shop screen. Instead, you are given all of your Defender bonus rewards all at once when your Pokémon that had been defending a gym returns to you. That is, Defender bonus collection is no longer a manual process.
This article explaining the new system backs this up:

But you also do not collect the bonus once every 24 hours anymore. Instead, you only collect it when your Pokemon is no longer defending that gym. Whenever the Pokemon returns to you from the gym, it will bring with it all of the coins that you have collected over that entire period. ... You will receive a notification when the Pokemon returns home from the gym informing you how many coins you have collected.

(emphasis mine)

How do I collect my Defender Bonus?


Could there exist a non-addictive drug giving the same pleasure as heroin?

Question: The drug should have the same effect as heroin, but without being addictive at all. Is this chemically possible?
Comment: It seems to me that without physiological addiction is possible (no painfull effects on withdrawal), but since it feels good, it would still cause psychological addiction (longing to experience it again.)
Comment: Yes. Stackexchange. $\color{white}{cica}$
Comment: One way to make this happen would be to save a copy of the individual's brain, experience the extremely pleasurable event, and then roll back to brain to the earlier state. This would be guaranteed free of addiction, since the person wouldn't remember at all having the experience. Since short-term memory loss can be caused by drugs, a drug that has both of these effects should be possible.
Comment: I think the answer is no because while horrific, I read somewhere they are not the real problem - the psychological addiction is. Which put the answer into a very bad problem as the psychological addiction is actually the extreme pleasure giving. So, you may get a drug that is not physically addictive, but it will STILL be extremely addictive.
Comment: The question explicitly asked for something non-addictive.
Comment: @MorningStar: So you claim Stackexchange beeing non-addictive? Are you trying to fix readers? Shame on you.
Comment: @isaacg that's what  i had in mind, but something realistic, such as a drug that let's you feel pleasure but, then triggers other reactions that undo "the pleasant" reactions
Comment: The effect of heroin is to kill pain.   Whether a person finds pleasure in loss of sensation or similar effects is a separate issue.
Answer: Larry Niven's Known Space writing universe included a device called a Tasp which induced electrical signals inside the pleasure centers of the human brain.  It's effects were described as overwhelmingly euphoric, rendering the "victim" so flooded with pleasurable sensations that they could not perceive or interact with their real world surroundings.
Such a device did not involve any chemicals being added to the brain, but it was described as being extremely addictive.
It is my belief that this is a fair prediction of the addictive properties of anything that makes us feel as good as heroin apparently does.  It does not matter if there is any chemical cause for the addiction, our simple desire for the continuation of that sensation can enslave us as strongly as any drug.
If your chemical-addiction-free heroin substitute has the same effect as real heroin, we will become addicted to those effects regardless of the chemistry.
Comment: @Hyfnae Cocaine withdrawal (for example) has psychological symptoms like anxiety, craving, and anhedonia; but not the physical symptoms of heroin withdrawal like diarrhea, nausea, and muscle cramps. Yet people say that cocaine too is addictive.
Comment: Psychologically it might still induce the same king of longing/craving, but wouldn't the absence of physical withdrawal symptoms make kicking it at least a little easier?
Comment: @WGroleau This video was covered on Skeptics and it isn't as groundbreaking as the authors make it sound https://skeptics.stackexchange.com/questions/30697/is-it-fair-to-say-that-everything-we-think-we-know-about-addiction-is-incorrect
Comment: https://m.youtube.com/watch?v=ao8L-0nSYzg.— What really causes addiction?
Comment: @Hyfnae The physical symptoms are not what bring people back again and again (even though those might kill them) it's the brain chemistry stuff, the craving.
Comment: Seriously, that's wrong on many levels. That experiment does not prove anything. It's really really wrong to conclude that in a fundamental way. It's irrelevant whether I consume any substance, or not, as long as some stimuli will dictate my body's chemical reactions.
Comment: The Tasp is not science fiction. The experiment was performed on rats in Skinner Boxes, where the rats had a button attached to an electrode which was embedded in their pleasure centers. The rats then proceeded to do nothing BUT press the button for their next "fix".
Comment: Just as my near-homonym, I think that this device is probably based on some real-world experiences such as the work of [José Manuel Rodriguez Delgado](https://en.wikipedia.org/wiki/Jos%C3%A9_Manuel_Rodriguez_Delgado) : "Some consider one of Rodríguez Delgado's most promising finds is that of an area called the septum within the limbic region. This area, when stimulated by Rodríguez Delgado, produced feelings of strong euphoria. These euphoric feelings were sometimes strong enough to overcome physical pain and depression."
Comment: The only one of these books I read, the tasp was described as being highly addictive
Comment: While the tasp was intensely addictive, it was not so to everybody. In later books Niven makes a point of describing the wirehead problem as one which, in the long run, was self-limiting, as those susceptible did not reproduce to any degree.
Answer: Absolutely, it would be addictive, because what you're talking about is messing with brain chemistry.
I think that perhaps you might be confusing two different things: Dependence happens when the body has adapted to the continued presence of a drug Addiction can be bound up with dependence, but it doesn't have to be. With addiction all that needs to be present is a persistent compulsive use of a substance or action known by the user to be harmful to their lives and/or bodies
Anything that's pleasurable can be addictive. Some of addiction has less to do with physical withdrawal and more to do with brain chemistry. A certain number of people are predisposed to addiction through genetics, the age at which they tried drugs (the earlier, and more frequent the more likely to have the pattern), and the environment.
You might think that with no physical withdrawal symptoms that it's not actually addictive.
I disagree. Because anything that messes with the pleasure centers has an effect.

When stimulated by amphetamine, cocaine or other addictive drugs, the reward system disperses up to 10 times more dopamine than usual.
  Continuous use of such drugs robs them of their power to induce euphoria. Addictive substances keep the brain so awash in dopamine that it eventually adapts by producing less of the molecule and becoming less responsive to its effects. As a consequence, addicts build up a tolerance to a drug, needing larger and larger amounts to get high. In severe addiction, people also go through withdrawal—they feel physically ill, cannot sleep and shake uncontrollably—if their brain is deprived of a dopamine-stimulating substance for too long. SOURCE

The source I have quoted above is an article from Scientific America on GAMBLING addiction. Please do click on the link and read the article, it is simply chock full of info you would find useful regarding the subject of addiction and how it works.
The article, which is worth reading, basically talks about how initially a gambling addiction was just thought of as a bad habit that could ruin your life rather than bona fide addiction. But they have found that the same sort of therapeutic treatments and approach used to beat addiction, and the same brain chemistry issues are present in those who can't stop gambling.
You might say "hey not gambling won't give people physical symptoms when they don't so it doesn't count as a addictive." To which I say, for a certain segment of the population it absolutely is.
Furthermore, gambling, which is something that involves no drug at all, can change brain chemistry and response in the same EXACT ways drug addiction does.

A 2005 German study using such a card game suggests problem gamblers—like drug addicts—have lost sensitivity to their high: when winning, subjects had lower than typical electrical activity in a key region of the brain's reward system. In a 2003 study at Yale University and a 2012 study at the University of Amsterdam, pathological gamblers taking tests that measured their impulsivity had unusually low levels of electrical activity in prefrontal brain regions that help people assess risks and suppress instincts. Drug addicts also often have a listless prefrontal cortex.
  Further evidence that gambling and drugs change the brain in similar ways surfaced in an unexpected group of people: those with the neurodegenerative disorder Parkinson's disease. Characterized by muscle stiffness and tremors, Parkinson's is caused by the death of dopamine-producing neurons in a section of the midbrain. Over the decades researchers noticed that a remarkably high number of Parkinson's patients—between 2 and 7 percent—are compulsive gamblers. Treatment for one disorder most likely contributes to another. To ease symptoms of Parkinson's, some patients take levodopa and other drugs that increase dopamine levels.

So what does this tell us? It tells us that if something gives us pleasure, it has the capacity to be addictive. You might be able to gamble and stop, no problem. There are people who were able to do heroin a few times and stop, periodically using again--but the rate of addiction for the drug is pretty high, even for those who don't have a predisposition to addiction.
Let's take a drug though, that we have today that does stimulate the pleasure centers, but that has been claimed not to be addictive.
Molly. Ecstasy. MDMA.
It's not supposed to be that addictive. There aren't really physical symptoms. But the brain can be completely changed.

While many people do not develop chemical dependency on Molly,
  psychological craving (the defining characteristic of addiction) can
  be quite high. Molly effects the brain by altering the chemical
  responses of neurotransmitters. These disruptions hinder proper
  communication between neurons.

There are people, right now, who are on Molly just to function, not to get high, which is, of course, a big sign that they are an addict.
Here's what I would do with your fictional drug to get to where you want:

It repairs/resets anything it damaged before it wears off.
The high is exactly the same every time. As in you don't need more of it to get high. No one builds a tolerance. If there is no tolerance, then folks are less likely to need it just to function.

This is not chemically possible as of yet. Far into the realm of sci-fi, I would say.
Comment: @aboat I am saying that the physical dependency (literally dying because you don't have the drug) is not as big of a pull as the mental dependency, and that literally anything that gives pleasure can change brain chemistry in such a way that it takes more and more and more to get the same amount of pleasure. It's not so much remembering as it is the brain no longer reacting the same way or giving them the same  high as it did before. That's what I am saying about resetting tolerance.
Comment: @jamesqf Yes, the predisposition or lack of it varies from person to person. Accidiction runs in families. You can take or leave gambling, and there are even some people who can take or leave heroine. It's not just the pleasure, it's chasing that pleasure and the diminishing returns each time.  Finding the addiction gene or widely available chemicals that can switch that off would be very good for everyone.
Comment: A question though, is why some people evidently find particular things pleasurable, while others don't.  Take gambling, for instance: I used to be a professional gambler - I made money at it - but it was just work, and in fairly unpleasant conditions.  I quit when I found better-paying work, and haven't been in casinos since.  OTOH I get a lot of pleasure from skiing, wouldn't willingly give it up, but when the snow melts I do something else and am quite happy.
Comment: @Erin I don't have time now, I skimmed through what you wrote, i'll take some time later, but what you are saying
(and others, it seems), is that people continue to use substances like heroin, even when they are conscious that it destroys their life mainly due to the pleasant memory of the previous hit? I'm not talking about the first hit. If  yes, I'd say I disagree, for now.
Answer: I'd also say, the answer is No, "without being addictive, at all," is impossible because everything pleasurable is addictive. We have sex addiction, food addiction, exercise addiction, porn addiction, gambling addiction, gaming addiction, just to name a few that are legal and have been academically studied. Notice none of those are physically addicting (not even the food), but they all cause very similar (or identical) changes in the brain in terms of releasing endorphins. Heroin and cocaine are the masters of this release, but consider the proof by extremes here: We have people that are seeing and paying psychologists to help them break their sex addiction, which has any chemical component whatsoever, Because this is interfering with their work (repeatedly missing in action, late, distracted), their marriage (about to end, with custody hearings for kids), and their lifelong friendships and extended family life.
Now as pleasurable as sex may be, rock stars and sports stars that can have all the partners they want, as many as they want at a time, still say heroin blows sex away in the magnitude of the euphoria.
Chemical dependence is not the main feature of addiction, anything just like cocaine will most certainly be very highly addictive, and still destroy people's finances, relationships, and lives, still lead to the same lies, cover-ups, and crimes to feed the addiction. There is no way to make anything that is pleasurable "not addictive at all".
Comment: I don't know about you, but *I'm* addicted to food.  There are serious physical withdrawal symptoms when I don't get a regular hit. :-)
Comment: Oxygen man, I just can't get enough of that stuff!
Comment: @Anixx Okay. As I indicate in my post, physical addiction is a side issue. For people with expanded stomachs due to food addiction, it has been shown that surgically reducing the stomach size, thereby bypassing the "physical" part of the food addiction, does not cure the addiction, they often become obese again, or indeed there are cases in which they die due to eating enough to rupture their smaller stomach. Also cases in which they reduce the stomach and then develop **another** addiction, like drugs. It is their reward system they are compelled to constantly stimulate one way or another.
Comment: @StephenG Ha. But to be clear, addiction is not equivalent to hunger, it is specifically related to a compulsion to stimulate the reward centers in the brain *to excess* for its own sake. Eating when you are hungry will release dopamine and feel satisfying. Eating when you are not hungry will often do that too, a hit of glucose causes pleasure. Neither is addiction; addiction is more of a persistent state (or cycle) of imbalance, the loss of control and indulging in such self-stimulation despite the external costs incurred (social, financial, legal, and health related).
Comment: Food is physically addictive. I can name at least 2 mechanisms: the stomach expands if you eat more, so you need more food to feel fed up, and also the stomach acid is produced at the times when you usually take food so if you do not eat at that time, you will experience negative sensations in stomach.
Answer: It's a tad ironic you asked this question today.  The most popular (emailed) story at the nytimes.com is about how all the intensely pleasurable activities (drugs, comfort food, sex, etc) are addictive, because they are pleasurable.  It talks about the power of habit, but also the change the dopamine receptors in your brain, causing you to no longer be stimulated by less intense experiences.
Now, you can be dependent on heroin to avoid withdrawal symptoms.  But that's considered differently from addiction in medical literature.  If you're asking if something can be that pleasurable without physical dependence, sure.  If you're asking if something can be that pleasurable without being addictive, I don't believe so.
Comment: I watched Trainspotting, and made me wonder.
Answer: It seems like it would be most plausible if the user took a drug that prevents the addiction from forming. I'm thinking something along the lines of ibudilast.
http://www.huffingtonpost.com/2013/04/03/meth-addiction-cure-ucla-ibudilast_n_2863126.html
One could imagine a heroin user mainlining an anti-inflammatory drug or a biologic, or having a port that connects to either drug (or a saline drip to easily rehydrate). This could also open the door for some interesting conflict (addiction blocker gets stolen, user runs out without realizing it, someone maliciously replaces drug with placebo or other drug, etc).
Comment: Welcome to WorldBuilding! If you have a moment please take the [tour] and visit the [help] to learn more about the site. Have fun!
Answer: Other answers have dealt with the difference between physical and psychological addiction.  Physical requires repeated uses and a recalibration of the physiology such that the lack of the drug causes withdrawals.  There are lots of examples of this and not all are fun - clonidine, for example, is a blood pressure drug.  If you take a lot and the run out or go cold turkey you can suffer a surge of blood pressure.  The withdrawals from opiates or alcohol are similar physiologic effects.  Since there are several opiate receptors and it is possible to have drugs which are selective inhibitors of specific ones (e.g. methylnaltrexone) you could theoretically have an opiate which conferred a heroin high without inducing dependence with repeated use.
The other issue is psychologic addiction.  If you crave the different feeling conferred by a substance or experience it might not matter what the substance or experience is.  This would be a risk with the non-dependence opioid described above.
All of this is in the other answers.  The new piece here: the way around psychologic addiction is amnesia.  If you do not remember how good it felt, you will not be thinking about it and craving it.  There is some thought that the hormone oxytocin works this way (but in the reverse) as regards childbirth - if a woman giving birth clearly remembered how much it hurt, she might avoid that in the future and so decrease her genetic fitness.  Those women who did not lay down memories clearly during the experience would be less likely to avoid it in the future.  Short acting amnestics are used routinely for unpleasant medical procedures - it is bad for the person while it happens, but they don't remember afterwards.  This is also the principle behind the date rape drugs.
So: your no-addiction drug must lack the ability to cause physical dependence, and either itself or with a codelivered drug block the ability to lay down memories of the experience.
Answer: As others have said, since activities themselves can become additive for certain people, there's no way to totally limit the addiction potential. However, if the substance in question also had the effect after the high wore off of acting as an opioid-receptor blocker, then subsequent re-doses of the chemical would fail to achieve any kind of noticeable high. There are actually products on the market now that can block these receptors temporarily, but for the purpose of making the chemical TRULY non-addictive, there can be only one choice:
Have a single usage of the chemical end with the complete disabling of all the opioid/amphetamine/cannabinoid/etc receptors in the brain.
You can therefor only use this drug once, and while it can provide the greatest feeling ever, after it's over, you will never again have any other kind of high in its class of drug. This will have the effect of making the drug unappealing to some folks who feel the need to constantly medicate themselves, but would also open up the drug to a whole class of other "respectable" citizens who would otherwise be worried about addiction and would never consider taking anything that didn't have this baked-in buffer.
Furthermore, if the primary effect of the chemical was a profound psychedelic experience, it could be used by existing addicts as a final "cure" for their addictions, since they'd have the duration of the drug for its primary effect to contemplate how their lives had gotten so screwed up, with the knowledge that they would now be unable to return to opioid/other abuse. This is similar to the real-world usage of ibogaine and ayahuasca to treat drug addiction.
Answer: Yes, I think so. Certainly you can speculate such thing being possible. Stories about "herbal remedies" that actually "reset" drug addiction do exist after all. Bad news is that since drug policy is such a sensitive thing research has been limited. Good news is that this also means we are free to speculate.
The basic issue is that pleasure is the way brain uses to reward experiences that should be repeated so there is a hard-wired system that strengthens behaviour patterns that led to the experience. So pleasurable activities are innately habit forming and addictive regardless of the nature and specifics of the activity.
The pleasure and and the habit forming are still two separate processes. So it is possible to have pleasure without it becoming addictive. Mental and physical state for example can reduce or increase addiction. Your hypothetical drug would simply contain an additional component that entirely blocks the habit forming process. This drug would be entirely non-addictive. Although it would be even more incapacitating than the unaltered drug.
If the drug simply blocks or inverts the strengthening of the habit it would actually help reduce pre-existing addictions to similar drugs.
Answer: As others have said, it's pleasure that people can be addicted to, not so much a chemical.  One study noted that 20% of soldiers in Vietnam were using heroin, but most quit when they came home.  Another study showed rats preferring cocaine-laced water over plain, but a follow-up study showed that under different circumstances, they avoided the cocaine.
Quick summary based on Chasing the Scream.
Comment: I know about those. But, it's not that simple. It may be that, pleasant activities helped the vets give up on heroin. For the case of rats, it may be that mating is more pleasant than heroin, or that some biological process determines the rat to choose mating instead of cocaine. Those experiments don't prove that it's just psychological.
Comment: No, they don't.  But they suggest that much of it is psycho-emotional.  And certainly the "war on drugs" isn't working real well.  Portugal claims (I haven't verified) that drug use is less since they eliminated penalties.
Comment: Well, the war on drugs is another subject. I did not downvote you.


Access HDFS HADOOP using APACHE Web Server, Linux CentOS

Question: If I have an apache web server as a directory how I can access to HDFS Cluster for upload and modify files, what is the configuration i want to do?
many thanks
Answer: Apache can't access HDFS directly. You would either need to use one of the HDFS FUSE filesystems to mount HDFS so that Apache can access it with normal file access, or setup Hoop or HDFS Proxy (which provide an HTTP interface to HDFS) and configure Apache to proxy to that.


Drupal: change path to uploaded files

Question: I copied a site files to test host for further developement.
And I want uploaded files to be loaded from old host.
For example, files a re stored in drupal_folder/sites/default/files/ (example.com/sites/default/files).
I need this files to be accessible from other site (example.dev.com)
I mean I want to change path to all files on a new host (example.dev.com).
I tried to change path to all files in database with command
<code>UPDATE `files` SET `filepath` = REPLACE(`filepath`, "sites/default/files/", "http://example.dev.com/sites/default/files/");
</code>
but URLs are like example.dev.com/http://example.dev.com/sites/default/files/ after this.
I hope it makes sence.
How can I do it?
Answer: Use ln to create the link to that directory if you are using linux.
http://linux.about.com/od/commands/l/blcmdl1_ln.htm

Drupal: change path to uploaded files


Quicksort partition why random pivot?

Question: Suppose I have 2 cases:
Case 1: I always choose the 1st element as pivot. In this case the worst case O(n2) is when the array is already sorted or reverse sorted.
Case 2: I choose a random element as pivot. Here worst case O(n2) is possible when the random pivot is always the max or the min element in the subarray.
Can't I argue that if we are given a Random array, P(O(n2) in Case 1) = P(O(n2) in case 2). Because intuitively P(sorted array or reverse sorted array) = P(random pivot is always the max or the min element in the subarray)?
If so, how is the 2nd case any good because we need extra effort to select random pivot? We need 2nd case only when the data would be following a certain pattern. Am I right? Please enlighten.
Comment: See [Quicksort — Choosing the pivot](https://stackoverflow.com/questions/164163/quicksort-choosing-the-pivot/) for information about this.
Answer: When all permutations of the input are equally likely, the probability of every time choosing a bad pivot is the same for both strategies (first or random). It would be the same for any strategy that makes no comparison (middle, third, alternating between beforelast and second...).
(This might be different for a strategy that compares elements, such as median-of-three.)
But the truth is that in practice, the permutations aren't equiprobable at all and there is a strong bias toward the nearly sorted sequences.

Said differently, when the input is well shuffled or when you choose the pivot randomly, you must be very unlucky to do a bad drawing every time and the probability of the worst-case is infinitesimal. For a sorted sequences, odds are quite different as you are sure to lose every time !

As a side note, picking a random value indeed has a cost, which is not neglectible compared to the partitioning of small sequences. This is why it matters to switch to a more straightforward sort for sequences of length L or less, and tune the value of L to optimal.
Answer: To avoid the worst case, you have to choose the optimal pivot for each subdivision: the median element. If you use any short-cut method to select the pivot, like random, first, median-of-three or whatever, then the possibility is there of encountering the worst case. It's just a question of probabilities.
Certain input cases are likely to occur, at least in some applications, such as the case when the elements are already sorted or nearly sorted.
If there is going to be the threat of worst-case behavior, then it is good to at least mitigate the threat by preventing input cases which are likely from triggering that worst case behavior.
Comment: Some shortcuts are guaranteed not to be worst-case, but you're right that they may not be best-case.
Answer: By picking predictable element, like first element, you could easily hit the worst case. If a grain of randomness is added, then the pattern will likely be broken and at some point actual running time of the sorting algorithm will be lower than O(N^2).
On a related note, random picking the pivot is not that good idea either. There are techniques, such as median of medians, which are coming with a proof that worst case running time will still be O(NlogN). That is huge advantage over taking the first element as the pivot.
You can refer to this article for implementation based on median of medians: Finding Kth Smallest Element in an Unsorted Array
Answer: We're not worried about the runtime for when we're given a randomly-generated array. We're worried about the runtime when the array is sorted or near-sorted, which is actually pretty common. We're also worried about the runtime when the array is generated by an adversary with elements specifically chosen to ruin our day.
If it were just about random input, picking the first element as the pivot would be fine.

Quicksort partition why random pivot?


Herbivore digestive System

Question: Why do Herbivores have many different types of digestive Systems? for example a Rabbit has a mono-gastric Digestive system and a hippopotamus has a pseudo ruminant digestive system but they are both Herbivores.
Comment: Rabbits and hippos are separated by ~95 Mya of evolutionary time: http://www.timetree.org/
Answer: This is kind of like asking why animals have so many different ways of moving quickly (dogs run, birds fly, kangaroos jump...)  There is a problem, and evolution has solved the problem in different ways.
In the case of herbivores (and in particular leaf and grass-eating herbivores) the problem is that their food is low in nutrients and high in indigestible cellulose. The particular solution depends on other evolutionary pressures.  For many leaf-and-grass eaters the solution is to become big, with complex many-chambered digestive systems that allow for long slow processing of the food. Horses, hippos and ruminants all tend to be large. This means that the animal can eat a lot and hold the food in themselves for a long time, allowing enzymes and gut bacteria time to work.
Rabbits, as burrowing creatures, can't evolve a large size, so depend on a range of gut bacteria and coprophagia to pass food through their intestines twice.
Grasshoppers can produce their own cellulase to break down cellulose without microbial assistance.
There's more than one way to do it and as a rule, in evolution, for every possible solution, some animal will be using it.
Comment: there are plenty of other factors as well, like grazers having to deal with highly abrasive food that browsers don't have to deal with.
Comment: Another factor is that there's not a strict divide between herbivores, omnivores, and carnivores.  Examples of each can be found on many branches of the mammalian evolutionary tree, implying that digestive systems must have undergone frequent modification.
Comment: "for every possible solution, some animal will be using it." is inaccurate - evolution has to discover a possible solution, and nothing guarantees that it will discover them all in finite time.

Herbivore digestive System


Does Firefox support hardware acceleration on Ubuntu?

Question: After I have installed Ubuntu 12.04 LTS (32 bits), Firefox 12 works fine but without hardware acceleration. Needless to say I have the latest nVidia's proprietary drivers installed and my Firefox Preferences, on "Advanced" tab, "Browsing" section, have the option "Use hardware acceleration when available" checked.
I have tried the following things before asking this question:

Creating a boolean key "webgl.force-enabled" and set it to true on Firefox's page about:config;
Starting a new profile like commented on thread Mozilla Firefox 12 is very slow on Ubuntu 12.04
LTS;
I have updated my nVidia driver to version 295.53.

And none of this have worked. As you can see below in my Firefox's page about:support report, "Graphics" section shows no "GPU Accelerated Windows":

Adapter Description     NVIDIA Corporation -- GeForce GTX 460/PCIe/SSE2
Vendor ID               NVIDIA Corporation
Device ID               GeForce GTX 460/PCIe/SSE2
Driver Version          4.2.0 NVIDIA 295.53
WebGL Renderer          NVIDIA Corporation -- GeForce GTX 460/PCIe/SSE2 -- 4.2.0 NVIDIA 295.53
GPU Accelerated Windows 0
AzureBackend            skia

I use the following site to test hardware acceleration:
http://ie.microsoft.com/testdrive/Performance/FishBowl/
On Windows 7 I get 60 fps even with 1,750 fishes on browser's Full Screen Mode (1680x1050x32bit-color). On Ubuntu 12.04 LTS, same nVidia drivers (as shown in report), won't go faster than 15 fps with only 1,000 fishes.
Can anybody help me?
Answer: My Firefox's page about:config, and this is showed in graphic details.
<code>Adapter Description       ATI Technologies Inc. -- ATI Mobility Radeon HD 5000 Series
Vendor ID                 ATI Technologies Inc.
Device ID                 ATI Mobility Radeon HD 5000 Series
Driver Version            4.2.11627 Compatibility Profile Context
WebGL Renderer            ATI Technologies Inc. -- ATI Mobility Radeon HD 5000 Series  -- 4.2.11627 Compatibility Profile Context
GPU Accelerated Windows   0
AzureBackend              skia
</code>
It seems the browser can detect my GPU perfectly fine just it won't use it. This issue effects both NVIDIA and AMD user.
Currently, it's impossible for Firefox to use GPU on Linux. It's discussed at Ubuntu Forums.
Comment: I have the same problem both in ubuntu 12.04 and kubuntu 12.04!I have a nVidia GT 240M.
Comment: Currently, it's impossible for Firefox to use GPU on Linux. It's discussed at http://ubuntuforums.org/showthread.php?t=1976988
Comment: I am very sad that my lovable Firefox cannot use hardware acceleration. :(
Comment: Please, do something to have firefox running well on ubuntu.

If you want to support this motion, please suscribe to this bug report https://bugs.launchpad.net/ubuntu/+source/fglrx-installer/+bug/1066313
Comment: to get the info type in the firefox browser: about:support scroll down to "Graphics"


Convert G-code to SVG

Question: This question is a bit of an edge case for what 3D Printing SE covers, but it has to do with topics most closely related to 3D printing.

I've found a plethora of ways to convert SVG (vector graphics) into G-code, but I can't seem to find any way to take a series of G-code movements and convert them into lines as a vector graphic.
Why would I want to do this, you ask?
I have a Silhouette, which can cut paper, or draw on paper, depending on if you insert a knife tool or a pen tool.
I have a polar draw bot (Makelangelo) which doesn't want to behave... the motors keep losing steps when the number of steps/second is low, and thus positioning gets off.
I want to use the drawing algorithms in the Makelangelo software to create drawings using my Silhouette, but the Silhouette wants vector graphics, not G-code.
The simplest way in my mind to do this is to convert G-code generated in the Makelangelo software, convert it to a standard vector format (SVG), and import it into Silhouette's software suite.
Alternately, if there's a way to send G-code directly to my Silhouette and have it work, that'd be a much better solution.
Comment: I've converted gcode into an XYZ format before. With a couple Regular Expressions, you can reverse engineer a gcode file relatively back into 3D model. Is this kind of what you're looking for?
Comment: Sort of. I am dealing with x, y, and "z", where z is lifting/lowering the pen. So 2D.
Answer: There are a number of programs available which will convert g-code to DXF, a common drawing format. If your device does not support DXF directly, there are a number of programs to convert DXF to SVG. I would paste links but a quick search with your favorite search engine should give you useful results. The better conversion programs will allow you to eliminate movement g-code entries, which prevents connections between lines. I did not paste links, as my research shows such variety as to be overwhelming.
Comment: The conversion itself should be fairly easy using such tools, but most such tools will convert each gcode movement to a separate vector. So, for example, if your drawing was a circle you'd get an awful lot of tiny strokes, instead of a single SVG, DXF, or similar "circle" object. Some devices do have gcode "arc" commands, but they might or might be used in your files. That should work fine, so long as you don't need to edit or change anything....
Comment: I have run into that which you describe. It can make the result unpalatable, to be sure. I believe that the free program Inkscape, which reads vector files, has the ability to smooth such tiny strokes, but that turns a semi-automatic process into a much more manual one.
Comment: I've found a possible solution, but don't have a file suitable to test. The web site https://makeprintable.com/ will accept g-code files (extension .gcode) and convert to an STL file. In the test I attempted, the gcode was for an outline of a rectangular block and the stl created was vertical. I used Meshmixer (free) to rotate it to the horizontal, then used Slic3r (free) to slice to SVG. When opened in Inkscape (free) it appeared damaged, but the paths were there when clicked. When opened in Illustrator, same result. The paths exist and need to be colored?

Convert G-code to SVG


Periods of Heavy Speciation

Question: I have a set of microRNA ages with corresponding labels suggesting which clade they first emerged from. For instance, for hsa-mir-1, let's say, it would have an age of Eutheria. I have several peaks in the distributions of my age. One idea I had was to check to see if these peaks correspond to periods of intense specialization. For instance, the Eutheria clade saw a vast diversification of species relative to other clades. I'd like to determine this from a more computational perspective rather than Googling each clade.
Comment: Can you clarify what exactly your question is? You want to phylogenetically classify using microRNAs??
Answer: My guess (as your question need heavy editing!!) would be MiRdup.

MiRdup Goals:

Validation of pre-miRNAs predictions
Prediction of mature miRNA

Abstract: MicroRNAs (miRNAs) are short RNA species derived from hairpin-forming miRNA precursors (pre-miRNA)
  and acting as key post-transcriptional regulators. Most computational
  tools labeled as miRNA predictors are in fact pre-miRNA predictors and
  provide no information about the putative miRNA location within the
  pre-miRNA. Sequence and structural features that determine the
  location of the miRNA, and the extent to which these properties vary
  from species to species, are poorly understood. We have developed
  miRdup, a computational predictor for the identification of the most
  likely miRNA location within a given pre-miRNA or the validation of a
  candidate miRNA. MiRdup is based on a random forest classifier trained
  with experimentally validated miRNAs from miRbase, with features that
  characterize the miRNA-miRNA* duplex

Periods of Heavy Speciation


prerequisites for calculus

Question: What are the prerequisites for learning calculus?
I have experience in proof writing, trigonometric functions,permutations and combinations,naive set theory, mathematical induction,
and the abstract notion of functions. Should I start calculus or should I complete some other prerequisites?I want to learn calculus more by theorems and proofs than computation. Can I learn
calculus theorems without much experience in computational calculus? Is it mandatory to do computational calculus first?How many hours should i devote to it?Can I self study calculus?
Comment: You need solid algebra skills; almost nothing that you mention is a true prerequisite (trigonometric functions can be learned along-the-way, on a "just-in-time" basis). Knowing what a function is might be nice, but it's usually just the first thing you need in calculus. Note that calculus is about *calculation* (hence the name). If what you want is the abstract mathematical theory, that's called "Analysis", not calculus.
Answer: Calculus has many levels. The prerequisite is pre-calculus. Here is a free online pre-calculus textbook. If you are above this level, then you are ready for Calculus I.

prerequisites for calculus


I'm a digital painter, will the art I make be 50% owned by my spouse after marriage?

Question: If I make art like digital paintings, will my spouse own the original files? What about copies of the originals being sold? Is it possible that whatever I do with my creativity can be owned by my spouse after marriage or not?
Comment: Of course we need your jurisdiction to begin to present an answer.
Comment: I live in Belgium.
Answer: No
It would either be :

100% owned by both of you (the Common Estate regime which is what happens if you don't have a marital contract), or
100% by you (or whatever is detailed in your marital contract).

For 1., being 100% owned by both of you is different from owning 50% each. For example, you can't sell your "share" to a third party without your spouse's permission.
For 2., if the marriage ends in divorce, part of what the wealthier party owns (up to 1/3) can be claimed by the other party.
Comment: @gnasher729 I can't say for Belgium but in Common Law countries IP is just personal property like a car or TV are.
Comment: The question is ambiguous. I would think that pre-marital painting stay separate upon marriage and that only paintings created during the marriage would be part of the common estate. It isn't clear which scenario is being asked about. (Admitting that I may be wrong.)
Comment: With "digital paintings" I assume the value is really in the copyright. And copyright might have different rules than normal property.


Executing a .net command line application from Perl script

Question: I have a Perl script that calls a command line application created in .Net.  The .Net application doesn't like being called from the script, it gives the error.

"Unhandled Exception: System.Exception: Cannot read keys when either
  application does not have a console or when console input has been
  redirected from a file. Try Console.Read."

Other than complaining about not having the console, the application works ok.
I'm using back ticks to run the application but I've also tried open, system and exec.  Is there any other way I can fool the .net application to think it's being run from the console.
Answer: You want a pseudo terminal. See Expect and the underlying IO::Pty.


Performance issues with high polygon count and memory leak

Question: Good day,
I am working on a Model with a high polygon count, 27,066,816 to be exact. Therefore I am having long loading times when switching between object, edit and sculpting mode.
My goal is to sculpt by using a python script which is working, but is very slow due to the aforementioned switching between modes. Is there a possibility to reduce blenders downtime when switching modes?
The model is imported from an stl file and the only way I found to get enough vertices in the relevant places was by remeshing the entire object, therefore i can't reduce the polygon count. To preserve the objects details i also have to use a high detail for remeshing.
I also tried to use dyntopo but for some reason it did not just apply new topology to the area I sculpted but all over the object and therefore it is not an alternative right now.
CPU and RAM do not seem to cause any issues. I also tried disabling OpenGl but without any visible effect.
Edit: I have noticed that the RAM usage is going up after some time.
I investigated this and it seems that every time my script switches to edit mode there is some memory leakage. After about 10 executions of my script, Blender occupied almost 60GB of RAM, where as the model originaly only used 12 GB of RAM. I have now disabled Undos completly but it didnt improve the situtation.
Edit: I have tried a different aproach at remeshing and reduced the vertex count down to 1,374,572. The speed improved significantly but the memory leak still persists. I know that this is a known issue but I havent found any solution to it yet. Any directions would be great.
Answer: This might not be feasible in your case depending on the object you are working on, but perhaps splitting the mesh in several parts to reduce the size of the chunks you are working with at a time might speed up the process.


Why do sites with a single sign-on system redirect to a login screen?

Question: Why do sites such as Google / Youtube have a redirect to a login screen for their Single Sign-On systems. Is this an industry practice?
Comment: Can you suggest an alternative? (Real question, not being snarky.)
Comment: @Matt some single sign-on providers allow the user to login via a modal. (Facebook connect works this way in some cases)
Answer: Good question! There's actually a very big reason for the redirect.
Single sign-on works by forwarding the user to the authentication provider, which does the actual authentication. This login page is hosted with the provider. If authenticated, the provider sends the user back to the consumer with an authentication token/ticket.
The reason it has to happen this way is because the consumer does not have access to the underlying systems needed to authenticate the user, and shouldn't be allowed to receive the user's credentials either.
Answer: It is done mostly for technical reasons. For the same reason, the default mechanism for ASP.NET websites is to have a standalone logon page, with a redirect after a successful logon back to where the user was.
Embedding the logon form on every page, with no redirect mechanism, has several issues:

You are sending the logon form for every page, making every page longer (in terms of transmitted bytes of HTML data). A link to a logon page is much shorter.
Showing and hiding logon form on click requires JavaScript, and a specific version must be made for people with JavaScript disabled. The form must be also shown on failed logon (in order to display an error).
If the logon form appears as a "togglable" small rectangle in the top right corner of the page, you don't have enough place for descriptive error messages on failed logon.
If the page itself has other forms, they must not have the same names of fields as ones used for the user name and the password field.

UX-wise, the difference between a standalone logon page versus a logon form in the corner of every page is not too big. Moreover, having a standalone logon page let you display additional information and have much more descriptive error messages.
Comment: ASP.NET's forms authentication doesn't really use a seperate login page for the same reason... this is just the simplest implementation for a login page. Single sign-on uses a redirect because it has to occur on a completely different domain.

Having an extra form with 2 or 3 inputs isn't going to impact the response size very much at all.

That's not correct about the form field names... as long as they are wrapped in separate form tags they can use the same field names.
Comment: @Kroehre: Ok, reading your comment and your answer, I understand that I misunderstood the original question. For me, it was not about OpenID and similar mechanisms, but about the logon inside the same website, i.e. an ordinary, internal logon.
Comment: As a front-end software engineer, these are minor technical considerations. The driving reason for this pattern, at least in my experience, is security.
Answer: This is not a usability problem, it's for security.
From UX  point of view, the better solution would probably be to use a dialog of embedded html provided by the 3rd party (ie. an html modal).
The only reason why this is not possible is security.
If the authentication dialog were running on the requesting site, then a malicious script on that page could steal your password, or authorize his own app in a hidden way.
Auth providers (google, facebook, etc.) could use an iframe on the site, that would prevent (at least on not very old browsers) from code in the host page to access the iframe (eg. to steal your password), but the vulnerability there is that the host page could overlay visual elements on top of the iframe to disguise it as something different (eg. hide requested permissions by the app putting a white square on top of it, etc).
Therefore, the only way to ensure the requesting site can't do anything malicious with your Google/Facebook/etc account is (unfortunately) a redirect (or a popup, which is worse).


how to connect remotely to oracle database

Question: I've installed oracle 11g express edition and sql developer. I don't know ho to connect to a database on remote server. Can anyone help please. Note that I didn't installed any other software like oracle client. Please help, I'm new to this environment
Comment: Hello ling, welcome to DBA.SE. I'm not sure how anyone could help you with your request - you haven't told us what you're trying to connect to what, or what errors you're getting when you try connecting. Please edit your question (there's an edit link right under the tags) to add more details (including exact error messages) so that people can help you out.
Answer: If I understand you correctly, you want to connect SQL Developer to an Oracle XE database on a remote host.

Hit the green plus icon to create a new connection.
Enter a name of your choice for the new connection
Enter a username. If you have not yet created a user the "system" user will let you log on and create one.
Enter your password, if logging on as "system" that will be the password you specified during installation of Oracle XE.
Change the hostname from "localhost" to the ip address or hostname of your Oracle XE server.

Assuming you installed everything with default options and provided you have nothing blocking the network traffic to port 1521 of your oracle server, you should now be able to connect.
I just happened to see a nice screenshot in another question here: How to open Oracle listener for three database instances?
I recommend the book Oracle Database XE 11gR2 Jump Start Guide by Asif Momen to get you started. It's available as an e-book on Amazon or can be read on Safari Books Online, I believe they still offer a free trial.


Smarter recursion to compute #tilings of $m \times n$ board with $2 \times 1$ dominoes?

Question: So I was thinking about how to computationally (e.g., with recursion) obtain the number of tilings of an $m \times n$ board with $2 \times 1$ dominoes. If $m \leq n$, then we can use recursion on $n$ by keeping track of the which squares are filled in the $n$th column, which gives $2^m$ cases to keep track of for each value of $n$, with the cases related between $n-1$ and $n$ based on how the empty spaces in the $(n-1)$th column are filled with horizontal and vertical dominoes. I was wondering, are there any significant improvements known for this type of recursion? For example can we take advantage of symmetry somehow and e.g. only keep track of the lengths of the contiguous filled squares and contiguous empty squares? Or other improvements? If improvements are possible, does it change the asymptotics of the number of cases that need to be tracked?
Answer: From my answer on math.SE:
If you just used $1\times2$ rectangles, then this is same as finding the number of matchings in the $m \times n$ rectangle graph, and a formula for that has been given by Kastelyn:
$$ \sqrt{\left|\prod_{j=1}^{m}\prod_{k=1}^{n} \left(2 \cos \frac{\pi j}{m+1} + 2i\cos \frac{\pi k}{n+1}\right)\right|}$$
This was done, by mapping the number to the square root of the determinant of a weighted adjacency matrix of the graph.
You can find a nice exposition for the $1\times 2$ case in the first chapter of Kenyon's lecture notes.
Comment: Thanks, I vaguely remember a formula like this and I believe Lior Pachter even gave a direct purely combinatorial proof. However my question also generalizes to cases where different small shapes can be used in the tiling (e.g. $2 \times 1$ dominoes and $2 \times 2$ squares and L-shapes of side length $2$ combined), and I'm still interested to know if the basic type of recursion I gave can be improved in any way.
Comment: @user2566092: I see. That wasn't clear from your question (the generalization). Perhaps you should create another question...
Comment: Sure, I'll post another question with general small shapes and ask specifically about the recursion again.


Why did New York try to pass a bill to allow disability schools to 'keep' money they were 'not required to pay back'?

Question: Back in October, Governor Hochul vetoed a bill with unanimous support that would have allowed special education providers to keep federal PPP loan money.

The state Legislature unanimously passed a bill through both houses earlier this year that allowed pre-school special education providers to keep at least a portion of the PPP money they didn't use, but Hochul vetoed the bill Monday night.

This bill would have allowed pre-school special education providers to keep 1% of the revenue per year over the next four years and up to 4% total.

Hochul vetoes bill that would've let special education providers keep leftover PPP funds
Yet, the governor's justification for this was that the school would not be required to pay that money back anyway.

Gov. Hochul's office defended the veto, saying that these schools will not be required to pay any of the PPP money back and these providers are already allowed to keep a 1% surplus through the administrative rate-setting process.

Hochul's office also argues that future funding rates would then be based off an inflated number when the 1% extra funding is added in.

Simply put, this doesn't make sense to me.  If the schools already do not have to pay back the money, what is the purpose of this bill?  And how does it inflate future funding rates?
Answer: Annual budgets are based off of allocations made in the previous year. This 1% increase, though unnecessary, would raise the baseline when preparing the budget and allocating funding in future years.


System that generates constant volume speech

Question: I am curious to know if this problem is solved. The idea is quite simple. For a given audio (or video with audio) we limit the loudness to a specific value without using a cutoff or saturation. Let me explain e.g we have an audio where a person sometimes speaks in normal voice and sometimes shouts and somtimes mumbles in low voice. Now, we process the audio and "equalize" the loud shouting speech and low mumble speech so it sounds as loud as the normal speech without there being any obvious distortion in the sound that could occur if we applied a simple cut-off amplitude using saturation limit. Thus, it would appear that the person has been speaking at the same loudness the entire time.
Answer: Automatic Gain Control algorithms range from simple gain adjustments based on the input level and desired output level to more complicated algorithms that use loudness measurements and desired loudness levels (these days the ITU 1770 standard is mostly used).
There are also multi-band methods, where a wide-band AGC is followed by 4 or 5 compressor-limiters in appropriate frequency bands before being reconstructed.
AGC is mostly frame-based, usually needs some look-ahead and involves, on a high level:

Input level or loudness measurement (can be smoothed using Exponential Moving Average filters)
Gain signal computation based on the target (desired) level/loudness
Gain signal interpolation
Applying the gain signal to the input signal
Limiter

Going further, some loudness control solutions also add a noise manager, so that noisy signals do not get "leveled" (imagine some low-level background noise being leveled up to a higher target level).
Finally, pumping/breathing artifacts happen at the low to high and high to low input level transitions, more so when the loudness leveling is set to be aggressive and care should be taken to find a good compromise between the aggressiveness of the solution and resulting artifacts.
Comment: @quantum231 AGC is indeed a general purpose term, hence why I specified "*AGC **algorithms***". The one I described is pretty standard, but also rather basic. Most Television audio processing modules (either proprietary or third party solution) have a version of this running. For example going from a movie to a commercial, the difference in level can be drastic and a good loudness control solution is needed. It's also needed at the beginning of audio chains where modules down the chain rely on a consistent level (such as compressors).
Comment: Pretty sure every classical voice codec does some form of AGC as well to put the coefficients with which its represents speech into a useful range before quantizing them for compression purposes. Also pretty sure that car audio systems have an AGC to make whoever is calling you understandable but not painfully loud at whatever noise situation is currently in your car's cabin.
Comment: Would a Wiener filter be suitable for removing the low-level background noise?
Comment: @CaporalFourrier Wiener filters work well when the noise statistics are known. To use in real time, you'd need a good noise detection algorithm combined with statistical computations, and finally the filtering itself. Why not just use the noise detection and adapt the AGC time constants accordingly (noise detected -> no levelling) ? Furthermore, some background noise you wouldn't want to filter out (background ambience such as rain for example). You just don't want it to level up the way speech or music would.
Comment: "Automatic Gain Control" is a general purpose term like digital signal processing. Are you aware of some sort or product or design that does this, maybe somewhere on the internet?
Comment: @MarcusMüller I'm not really familiar with speech coding but that second one hits home !
Comment: @Jdip well in linear prediction, the LPC will inherently try to scale the prediction coefficients match these of the input; then, as far as I can tell, a global gain factor is calculated such that quantization of the coefficients is more efficient.
Answer: You are describing an AGC (automatic gain control) that is routinely used for even speech level. The term «dynamic compressor» is user somewhat overlapping.


My cat stopped eating, drinking, and getting up to go to the bathroom

Question: My 2 year old cat stopped eating, drinking, and doesn't get up to go to the bathroom. I'm taking him into the vet in the morning. Are there any suggestions on what I should and shouldn't do to help him until then? I am unsure what to do.
Comment: Keep him as comfortable as possible and allow him access to fresh water.  Restrict him to one room of the house, do not let him outdoors. It's not uncommon for sick cats to run away.
Comment: how is he today?
Comment: Is he eliminating at all? Like on himself? If so, try to gently clean him up, so he's not licking or self-cleaning his poop. If you're keeping an eye on him and trying not to go anywhere you may have an extra set of panties and a maxi pad you could temporarily use for one night (when you're sleeping. Do you think this is a good or poor recommendation @YvetteColomb ? If you have a cat bed or can make a bed with towels, this may help to keep him warm and comfortable.
Comment: @ChristyB. I wouldn't be putting panties on him, it will only distress him. Other than that, checking on him and keeping him clean is good advice.
Answer: Sounds like sickness to me. If he is not cleaning it might be that he´s too overweight to, or just the sickness part again.
Cats are clean instinctively.
Comment: i am sorry but you dont answer the question about what to do to help the cat in the time before the owner can bring the cat to the vet.everybody here want to help the pets and their owners in the best way possible the answers may be short as long as they are helpfull for the ones asking them.on questions like this when a cat stop eating the only advice is to go to the vet but here the op asks if there is something she or he can do to make it easier for the cat before a visit to the vet is possible.
Comment: this answer is not helpfull,99%reading the first four words in the header of the question knows the cat is sick.
Comment: @trondhansen Okay. But be nicer about it. It seems like everyone on this website are complete jerks.
Comment: unhelpful answer.


What am I liable for with a rental property?

Question: I have signed a contract with 5 of my friends at university for a 6 bed flat. I have decided to withdraw from the uni and therefor do not need the flat, if I just never turn up and never pay anything what am I liable for/what could they do. I have paid a £300 deposit.
Answer: It depends on the lease, but generally speaking you would be liable for your portion of the rent for the duration of the lease. So if you were supposed to pay £300 a month for 12 month, £3600 is what you owe. If the tenants are jointly and severally liable for the money, the landlord will probably collect from the remaining tenants, and they might sue you for your share. They may have to sue you, if they aren't allowed to replace you (to sublet). If this is university housing only available to university students, there is probably a clause covering the situation where a tenant drops out or never enrolls in the first place. You basically have to read the lease, but just not showing up is not a legal way of extinguishing your contractual obligation.
Comment: thank you, for some reason my dad (a part time landlord in his own right) thought that id only be liable for the deposit although he hasn't had the opportunity to read the contract yet. I think he's going to get a friend who's a solicitor to have a look at the contract but I wanted to see what I could find in the mean time


Can I connect a 90 degree tee to my plumbing that goes straight down?

Question: I currently have a kitchen sink on the first floor which leads to a vertical pipe (illustrated in black). I would like to connect a bathroom sink to the same vertical pipe (illustrated in orange). Can I do this using a 90 degree tee or does both pipes have to be connected separately to the vertical pipe?
Comment: Is there a vent pipe anywhere? Generally you would connect two separate sinks to the same vertical pipe using a double fixture sanitary tee.
Answer: Use two 90 degree sanitary tees for this, one for each sink. You'll never be able to unclog the drain with a tee as you've got it shown.

If space is limited, you can use a double fixture fitting like the one below.
Comment: @MLEN  Yes, you won't be able to unclog the vertical stack from either sink.
Comment: I wont be able to drain unclog the vertical pipe you mean? If I would install a inspection in the vertical pipe? I also considered two tees, but it is up in a ceiling and space is very limited.
Answer: For reduced clearance, use a "double wye" or a "double fixture fitting" and cap off the vertical (the opening at the top).
You need the sweep for the clean-out and to prevent water crossing over or inhibiting flow when both sinks in use.

Image: https://www.pmmag.com/articles/102042-riding-the-plumbing-roller-coaster-direction-changes-in-a-system-give-water-a-wild-ride


Is there any vegan food that is dangerous in excess? Which ones?

Question: I have heard about some ingredients which contain small quantities of toxic substances and that in excess could cause health damage, (for example I heard that sunflower seeds contains selenium and in excess selenium toxicity can result in symptoms of selenosis). Are there other vegan foods which could be dangerous in excess?
Comment: Literally everything taken in excess is dangerous. I think the question you mean to ask is: `Are there any (vegan) foods where relatively small amounts can be dangerous? (ie where the "excess" is actually a small amount).` For example, nutmeg.
Answer: Yes, some foods (even plant-based foods) can be harmful when consumed in excess. Consuming too much of one food can displace other foods from your diet, making your diet less balanced overall. But I believe your question is about toxicity from individual foods assuming other nutritional needs have been met, so I'll provide a couple examples of foods that may be harmful within an average daily calorie budget.

Acute selenium toxicity can arise from eating foods that are very high in selenium. For example, a diet of exclusively brazil nuts (60 nuts per day) would provide a toxic amount of selenium that would likely induce nausea and vomiting.
Facial flushing (redness of the skin) could be introduced by consuming too much nutritional yeast, as described in the question Are there risks from eating too much nutritional yeast?
The tolerable upper limit for copper intake is set at 10 mg, and this limit would be exceeded if one ate 4 whole bunches of kale every day. If this was kept up over a long period of time, it could cause chronic copper toxicity. Of course nobody is eating 4 bunches of kale per day.
Many processed foods are high in sodium which can lead to high blood pressure.

In practice there is no need to worry about any of this as long as you're eating a varied diet that doesn't put too much emphasis on any one food. This is especially true when eating whole foods (as opposed to packaged and refined products) because it is difficult to consume whole foods to excess.
Answer: Soy in Excess
Often soy based products are used to substitute as many dairy alternatives, like soy milk, and meat alternatives, like tofu products. However, many nutritionists have been cautioning against the regular consumption of soy based products, as soy is naturally high in phytoestrogens, which is the organic compound that mimics estrogen. Thus, eating such foods have potential to not only create hormonal imbalances within an individual, but animal studies suggest that consuming large amounts of estrogenic compounds might reduce fertility in women, trigger premature puberty and disrupt development of fetuses and children. Other animal studies have seen direct changes in testosterone levels after soy was consumed.
More on Soy: here & here
Comment: The problem is not organic or non gmo soy products such as tofu, but the soy protien isolates - that is the protein stripped out of the soy to be used in processed foods, inluding processed vegetarian and vegan products. The Okinawan's traditional diet is fish and tofu and they have the longest life expectancy on earth, with no testosterone or other supposed health problems from a lifetime of eating soy. I doubt the younger generation will fare as well on their modernized, western influenced diets
Comment: @terryflys, the enzymes in your digestive system will 'isolate' proteins from soy no matter how you eat it. That's the whole point of digestion. But yes, the keyword is _excess_, and when it becomes fashionable to replace everything "unhealthy" with soy [products], problems may arise. Those Okinawans might develop problems if the replaced their fish with soy.
Answer: How about plain old sugar and salt?  Probably the most common dietary advice is to cut down on these.
Excess potassium is lethal but I have never heard of anyone dying from a natural source.  Bananas are high in potassium but death by banana is rare if not unknown.
Answer: Water is toxic (in excess)

Are there other vegan foods which could be dangerous in excess?

Yes, water is one example. It is dangerous to drink too much water. Too much water is not only toxic, but it can be fatal (ie drinking too much water can kill you).
Which ones [are toxic]?
The answer to your question "which ones?" is everything.
Literally everything eaten in excess is dangerous. This applies to all vegan and non-vegan foods and drinks.


Interpreting Impulse Response Function after first differences of logarithm transformation

Question: I created an impulse response function from a VAR model. I used data transformed by taking the first difference of logarithms. I am now in trouble with giving a substantive interpretation of the scale of the impulse response function. How can I properly interpret it?
The IRF is an Orthogonal impulse response function, and an example is below:

As said here:

An IRF indicates what is the impact of an upward unanticipated one-unit change in the "impulse" variable on the "response" variable over the next several periods (typically 10).

In this case, data are differentiated. Thus, I would say that the values at each time point on the x-axis represent the difference between that time point's value and the previous one. For instance, the value at time $t3$ is the difference between the values at time $t3$ and $t2$ ($t3 - t2$). This difference is then logged.
Therefore, I would interpret the above chart, for example, as follows, starting from the first time period on the x-axis:
A one-log-unit increase from time $t-1$ to time $t0$ in the impulse variable $s1$, leads to a change of about 0.002 log-units in the response variable $s2$ from the time period $t-1$ to $t$.
The maximum effect can be seen at time $t3$, where one-log-unit increase from the time $t-1$ to $t0$ in the impulse variable $s1$, leads to about 0.005 log-units change in the response variable $s2$ from period $t2$ to $t3$.
I could then transform back the logged units by taking the exponential of the values. In this case, I would say, for instance:
The increase in the response $s2$ at time $t1$ is about 1 ($exp(0.002)$) for each 2.718282 units increase ($exp(1)$) in the impulse variable $s1$.
Is that correct?
There are similar questions on CrossValidated, like this one and this one, but they are still without answers.
Answer: Your impulse response function graph shows time evolution of how s2 responds to a shock that originated in s1. A one-unit (one-standard-deviation of s1) change (shock) in your variable s1 at time t results in a change in your dependent variable s2 whose magnitude is shown on the y axis of your graph.
For example, your log differences s2 would go up by 0.002 at t=1 in response to a shock that originates in s1 whose magnitude is one standard deviation of s1.


Looking for problems in which a KNN-K mate is forced

Question: Does anyone know of any problems in which a KNN-K mate is forced in the end? It is fine if you make one yourself.
Answer: To get the following position as a checkmate, the last move must be Nb3#.
<code>[fen "8/8/8/8/8/1NN5/2K5/k7 b - - 0 2"]
</code>
Prior to Nb3#, black must have made a non-king move, so must have moved something to b3.  If it were anything other than a pawn, it could choose to avoid the b3 square, so it's not a forced win for white.  If it were a pawn on b4, it could capture the c3 knight, which is also not a forced win.  Thus black must have had a pawn on c4, and be forced to capture on b3 on black's previous move.
So here's one such puzzle (LiChess):
<code>[fen "8/8/8/8/2pN4/2N5/1PK5/k7 w - - 0 1"]
</code>
White to move and mate in 2.
It's possible to move black's pawn back a bit, and give a slightly longer puzzle with the same idea:
<code>[fen "8/8/2p5/8/7N/2N5/1PK5/k7 w - - 0 1"]
</code>
White to move and mate in 4.
I haven't exhaustively checked all possible flips and rotations of the board (which makes more difference than I initially thought).  There's also a few possible mating patterns, but I expect the idea is going to be much the same in each case.
Comment: Your #4 is cooked: 1 b3, 1 Nf3 and 1 Nf5 all work. The play after 1 b3 and 1 Nf3 has further duals, but that after 1 Nf5 is sound.
Comment: "If it were anything other than a pawn, it could choose to avoid the b3 square,..." Is not quite correct. For instance (one of many counter examples): white Kc2, Nb3, Nc3, Nd4, black Ka1, Rb5.
Answer: Here's a #4 where White has just KNN and there are no Black units blocking Black king flights:
<code>[Title "C. Barton; Family Herald 5 Nov 1859, no. 65"]
[StartFlipped "0"]
[fen "8/8/8/8/8/6K1/4p1N1/4N1k1 w - - 0 1"]

1.Ne3 Kh1 2.Ng4 Kg1 3.Nf3+ Kh1 (3... Kf1 4.Ne3#/Nh2#) 4.Nf2#
</code>
Here's a #5 where White has just KNN and the play is a bit more interesting than in Barton's #4:
<code>[Title "Otto Dehler; Denken und Raten 31 Dec 1934"]
[StartFlipped "0"]
[fen "8/1p6/8/8/3K4/N7/8/k1N5 w - - 0 1"]

1.Kc3 b6 (1...b5 2.Kc2 b4 3.Kb3 bxa3 4.Kc2 a2 5.Nb3#) 2.Kc2 b5 3.Nb1 b4 4.Nd2 b3+ 5.Ndxb3#
</code>
Answer: https://www.apronus.com/chess/puzzle/?p=08X8X2p5X8X7NX2N5X1PK5Xk7_w_-_-_0_1&N=4&w=rqsqpqq-aqfqrqw-aqfqiqw-aqpqiqq-aqpqsqw-iqrqpqq-iqoqiqq-iqoqsqw&h=White%20to%20move%20and%20win%20by%20checkmate%20in%204%20moves&m=9
This is a real puzzle solving interface for one of the mate in 4 ideas given in another answer. There are many alternative solutions ending in 4.Nb3#
Answer: The mate in 4 from another answer can be presented as an interactive puzzle with this link
https://www.apronus.com/chess/puzzle/?p=08X8X8X8X8X6K1X4p1N1X4N1k1_w_-_-_0_1&N=4&w=uqtqowd-uqtqoqp-uqtqoqf&h=%3Ch1%3EMate%20in%204%3C%2Fh1%3EC.%20Barton%3B%20Family%20Herald%205%20Nov%201859%2C%20no.%2065&m=9
While the mate in 5 is this https://www.apronus.com/chess/puzzle/?p=08X1p6X8X8X3K4XN7X8Xk1N5_w_-_-_0_1&N=0&w=owaqeqiqw-oqsqaqoqw&h=%3Ch1%3EMate%20in%205%3C%2Fh1%3EOtto%20Dehler%3B%20Denken%20und%20Raten%2031%20Dec%201934&m=9


Yukawa coupling to the top quark and superstring theories

Question: Can superstring theory give a good reason of why the Yukawa coupling to the top quark is almost "natural" while the remaining leptons and quarks have negligible couplings to the Higgs? I mean, is there any symmetry principle based in superstring theories/M-Theory which shed light to the natural top mass quark but the unnatural masses of the remaining particles?
Answer: In field theory, one often talks about the yukawa matrices in terms of "textures", patterns of zeroes in the yukawa matrix. So one might posit a particular zero texture at grand unification scale, and then try to obtain the standard model yukawas, with their specific hierarchical structure, from a zero texture plus corrections.
Apparently heterotic string model builders have known for some time that stringy yukawas will often equal zero when calculated, but for no obvious reason. There's now some preliminary work on "Generalized Vanishing Theorems for Yukawa Couplings in Heterotic Compactifications", building on earlier work which explained these yukawa "vanishing conditions" by embedding "structures on the Calabi-Yau manifold" in "a larger ambient space". The authors write:

the physical quark masses in the Standard Model require a comparatively heavy top quark. Such a mass hierarchy could be achieved by topological vanishings that left only one family with perturbatively non-zero couplings, leaving the remainder to be generated by non-perturbative effects

But string theory is big, and there is room for many possible explanations. The masses of the top and the Higgs combine to place the standard model at the edge of metastability, Abel and Dienes relate the Higgs mass to the cosmological constant, Abel and Stewart relate the yukawas to the cosmological constant... It would be nice if this could all tie up together!


What causes a particular object to have a tendency to go outwards in circular motion when the centripetal force is inwards to the center

Question: Like a circular bead with a thread passing through it and the system being rotated . It can't be centrifugal force as it is pseudo only and has no existence when we are already in an inertial frame like an stationary person outside the assembly. Help in clearing the doubt taking all cases in account :- Uniform and Non Uniform motion, presence and absence of friction between the thread and bead.
Answer: The object isn't being forced to outwards: it is trying to go in a straight line. If there is insufficient force to keep it in a circular orbit, it will follow a path that is "more straight". From the rotating frame of reference, that looks like it is "not moving". From the "outside" reference, the object is going straight.
Comment: Is this the case of uniform circular motion that it will continue to go out due to insufficient force not changing its magnitude. Will then in case of non uniform motion , as the velocity of object will increase the centripetal force will increase and then the body may start slowly turn its motion from spiral outwards to spiral inwards ?
Answer: You are mixing two points. One is that of fictitious forces ad addressed in the previous answer. The other is the moon slowly increasing its orbit due to earth - moon tidal interection. I am confident it has been already discussed here and in astronomy. I really wanted to point that you somehow mixed these two aspects and the answer addressed only one, but I can't comment. If someone could FLAG me, perhaps the moderators could made a brief comment and delete this answer from me.


uv4l configuration file missing

Question: I ran "sudo apt-get install uv4l-uvc" and no errors were reported. The service status reported that the configuration file was missing. I found that /etc/uv4l was empty. However, "dpkg -L uv4l-uvc" reports that /etc/uv4l/uv4l-uvc.conf should have been included during installation. What could cause the configuration file to be missing?
Answer: I think I figured out what went wrong. I ran "sudo apt-get remove uv4l-uvc" to remove the package. I noticed that the configuration file was still present so I removed it manually using "sudo rm -rf /etc/uv4l". When I tried installing uv4l-uvc again, the file was missing. From another post, I see that I should have used "sudo apt-get purge uv4l-uvc" to properly remove the configuration file.

uv4l configuration file missing


Is true to say in which scales or tonality

Question: I was wondering when we want to ask someone about a piece of music , I could say what the scale of that music is  or the tonality of that.
Which one is true
Comment: Hesam, welcome to this forum.  We try to be helpful but your question is rather broad and not very clear.  Can you give an example of how you would use each term to describe a piece of music?
Comment: Thank you , I mean when you want to talk about a piece , for example one of ed Sheeran songs , you say that this piece is written in X tonality or scale?
Comment: is there a tonality without a key?
Comment: Definitely not , but what do you mean?
Comment: @AlbrechtHügli "is there a tonality without a key" - yes, in the sense that 'tonality' (in one of the meanings of the word) is a general concept describing the 'tonal palette' or 'harmonic palette' of a piece of music, and 'keys' are ways to specify certain types of tonality. You can't successfully describe all types of tonality using keys.
Comment: I believe you are asking an English-language question, not a music-theory question. In English, the expressions we would use are "What key is that song in?" and "This is in (the key of) G."
Answer: Maybe think of it with an analogy.
A painter's palette has lots of mixed colors but un-arranged on the palette in no particular order.
Put the colors in a specific order on the canvas and you get the gradations of a sunset or a rainbow.
When talking about a picture's palette it refers to the un-arranged colors of the palette. Like a monochrome palette.
In music a tonality is like a painter's palette. It's a set of notes in no particular order.
If all those tones are put in a particular order - a step wise order for a full octave - you have a scale. It's a particular melodic treatment of the tones in a tonality.
In music you say a composition is in a tonality. That's the music palette.
Key is a specific kind of tonality using the major/minor system. You can have other tonalities beside the major/minor system. Blues and modal are two common types. So, music could be in tonalities like the key of D minor or a blues in B flat or a folk tune in C Mixolydian.
As a hierarchy...

Tonal music: the music has some tonal center

Specific tonality: key, mode, etc. the palette of tones

scales may or may not be a melodic feature used in the music
Comment: Thank you Michael . Your comparison was really helpful , but I didn't got the last paragraph ."key is a specific kind of tonality ",  what do you mean?
Comment: Key signatures define the composition root and also mode of it .
Comment: @Hesam No, key signatures can't define a mode - any key signature could apply to any one of 7 diatonic modes, for example. They don't define a root either. A simple example is that the key signature for C Ionian could be the same as A Aeolian.
Comment: But in major and minor modes , if you add a half step to last sharp  it gives you the name of the tonality s root and its major name , while if you come down 2 while step from n scale with flat  you have its minor
Comment: @Hesam, you can do many alterations with sharps and flats to change a tonality - like lower scale degree ^2 in a minor key signature to get Phrygian. Those are simply changes at the _tonality_ level. The point is to call that a _tonality_ not a _scale_. The matter here is only about using the right word to get the hierarchical category right. It's kind of hair-splitting, but that is the nature of your question: being picky about terminology.
Comment: @Hesam "if you add a half step to last sharp it gives you the name of the tonality s root and its major name" - no, that's not correct, because if you're assuming that half a step above the last sharp is the root, you're already *assuming* that the tonality is major, which you can't know just from the key signature.
Comment: Yeah, this is drifting into a separate question - which has already been asked and answered on this forum - key signature alone is not enough to define tonality. Simplest example: zero sharps and flats. Could be C major, D Dorian, etc. ...or it could be atonal!
Answer: Tonality is the key of a piece. It has a bit to do with scale notes, but that's all.
There are often times in any piece where diatonic notes won't do the job, so talking in terms of a 'scale' is pointless.
Saying somethng is in, say, C major, doesn't automatically mean that the only notes in there will be C D E F G A and B. Music doesn't work like that.
We learn initially that it actually does, but that's to simplify things for beginners. Unfortunately, that piece of info. seems to stick - which is where we are here.
Comment: key is *a* way to describe tonality, but not the only way - and perhaps not always a very complete way? One obvious example, often repeated here, is blues - there isn't a 'key' you can state that, by itself, indicates blues tonality.
Comment: @topoReinstateMonica - not really. When I'm playing blues with others, there ***HAS*** to be a specified key. You're either playing blues in A or you're not. Don't really see where the discrepancy is. Blues is no different from any other music, key (or tonality) wise. There has to be a key that everyone is in. Tell me that blues in A hasn't got A as the root note.
Comment: Thx , it was helpful
Comment: Well, my remark about the limitations of 'keys' is more about the limited choice of 'minor or major', rather than the idea of having a root note. If your piece is bluesy, saying your piece is a 'blues in A' is actually likely to be a much better description of its tonality than simply specifying a key - which only gives you the choice of "A major" or "A minor".