How to permanently delete a row in oracle forever

Question: I want to delete a record from a table and no one should ever be able to recover the deleted data.
I have done delete operation but the record is still in the undo segments. And one can do flashback and retrive that row.
Comment: Define "ever". Are we allowed to recover deleted data by restoring from a year-old offsite backup tape?
Comment: Sounds like you're trying to hide something?
Comment: yes, but it does not tell anything about the record in undo and redo segments
Answer: There is likely a more streamlined set of steps, but here is a start.

Delete the data out of any materialized views or home grown
replication methods using triggers or the like.
Delete the data out of any database audit tables.
Change the database to noarchivelog.
Create a new undo tablespace.
Switch log files until all are archived.
Shutdown the database.
Turn off and purge any storage or virtual machine level snapshot capability.
Delete all trace files that may contain the data.
Delete all backups sets including archive log backups that could contain the data.
Delete all OS audit logs that could contain the data.
Visit any computer that may have the data cached or displayed and destroy it there.
Visit any other storage devices the data may have been copied to and purge those.
Find any hard copies of the data and destroy those.
If someone memorized the data, memory erasure is beyond the scope of this site.
Comment: I would also recommend to move the table to a new tablespace on a new disk drive and procedurally rewrite all the old disks. Else forensic analysis could probably retrieve the old data. Moving a table will only copy logically existing data.
Comment: Is this serious? I think the OP just wants to get rid of the bytes within the database files and logs. Related: [forensically deleting/updating data](http://dba.stackexchange.com/questions/12958/forensically-deleting-updating-data) But of course I'm being presumptious
Comment: @Vincent Malgrat - Indeed, and do the same procedural rewrite for all storage media that were storing backups, trace files, etc.
Comment: It's incredible how Oracle gets in the way at every step to protect data =)
Comment: my boss is a weirdo. He doesnot know what he wants. I recommended him to move to a new tablespace, but it is not practical to do each and everytime. So i told him to use Virtual Private Database. Thanks all for your time and answers


third eye experience of mindful breathing

Question: I am practising mindful breathing and after a while it takes my concentration directly to my forehead. I tried to be in thoughtless state and just keep watching my forehead. After this practice for 2 or 3 days i feel a kind of pressure in my forehead for a day now. is this normal ? i am hesitated to continue my practice because of this. why i experience this sensation ?
Answer: This sensation is being experience probably because you are deliberately focusing your intention on your forehead. Your post states:

I tried to...just keep watching my forehead.

Practising mindful breathing probably takes your concentration directly to your forehead because you are probably concentrating with your forehead.
There is no need to 'concentrate' to practise mindfulness with breathing. If you simply let go & make the mind quiet, awareness of breathing will still occur.
This is because when the mind is quiet & not craving, breathing becomes the most gross or dominant sense object for the mind.
That is why the 8 fold path does not start with concentration but ends with concentration.
'Mindfulness' means to let go of craving. When the mind is quiet, it starts to 'collect' or 'gather' itself, which is the meaning of 'concentration' ('samadhi' - 'collectedness').
Comment: There is no meditation master for me. I tried meditating on what was said by to watch mindful breathing in a book. I have the pressure on forehead and also night sleep was too disturbed. I stopped my practice due to this. Will these symptoms subside on its own ?
Comment: yes. the symptoms will subside. possibly, you were concentrating too hard; with too much effort & force. just return to normal activities & do some physical exercise. if you meditate again, try to be more gentle & natural in your approach. kind regards & best wishes
Comment: really thanks a lot. I was practising this for a couple of days an hour each day but felt this problems so stopped immediately. I was really concerned about my night sleep and pressure in the forehead. If i concentrate something i get the pressure on my forehead again. Day by day the severity is subsiding  but I want to know whether this would return to normal completely.
Comment: my forehead pressure is getting better on and off. but my night sleep is affected. how long does it take to return back to normal ?
Comment: I can't say. But meditating over-vigorously generates unbalanced energy, which why it disturbs sleep. It happened to me in my very 1st week of practising meditation. On that occassion, I stopped meditating, went to a beach & surfed all day for a week. It you returned to normal activities, it should settle. The pressure was created by an impermanent cause and if the cause is stopped the pressure will subside & cease. You have said it is getting better so that is how is should be. Regards
Comment: What do u mean by impermanent cause ? What is it in my case ?
Answer: The suttas didn't place any restriction on what area of the body one can focus on for mindfulness of breathing meditation. But there're 2 areas commonly taught by most masters and widely practiced: the nostril gates or the diaphragm. The nostril gates are taught in the Visuddhimagga commentary (starting from page 259). If you find some discomfort during meditation, please consult your meditation master if you have one. I you don't have one, make sure to closely follow the textual instruction and try switching the focus to the nostril gates to see if it helps.
Answer: May be that your problem lies in taking literally what your meditation master said.  If you find that focusing on the breath gets you distracted, the normal advice that you get is to just focus right between your eyes, or the middle of the forehead when breathing.  The problem comes when you stare right there literally.  While sitting upright, you should 'touch' that  spot with your mind's eye,  and not strain to focus your eyes to that spot.
Answer: In my humble opinion, you should not be hesitant to continue - you should be happy.  This started happening to me yesterday, and continued today when I meditated.  I have a sensation in the middle of my forehead, a humming/glowing feeling.  As I meditated, I simply went with the flow to see what this was about.  I believe that it's what's called the "Third Eye" or the "Mind's Eye".  If you think about the way mindfulness mediation activates your brain's prefrontal cortex (please look at this article: http://www.mindful.org/how-the-brain-changes-when-you-meditate/ ) it completely makes sense that we feel a tingling sensation at the center of our forehead.  I realized that while meditating I was sort of seeing myself from some interior position, like my 2 eyes but further in.  Then when I felt this third eye opening, I decided to let that be my vantage point for looking within, for viewing the chatter and the images that my mind throws about, and when I did that I felt that I made a real breakthrough in strengthening the powers of my prefrontal cortex.
Thinking now about the result of this, well, I can say that I have had some real progress thinking through some career issues today, and it may very well be that I have gotten more in touch with my gut instincts and deeper self-knowledge.
I'm no expert, this is just me.  I hope this is food for thought.  Good luck
Michael


Indexes like S&P 500 vs simply tracking earnings?

Question: I would like to know why ETF's like Vanguard S&P 500 are so popular as opposed to building an index that tracks that top 500 biggest profit makers. Companies like Uber and WeWork can be in the S&P 500 despite them (Still) being losing companies, so maybe it's not that attractive to track companies by market cap?
Comment: No company is **guaranteed** to pay dividends every quarter, but there are many companies which have paid them for a **long time**.    For example, VYM focuses on "This index fund seeks to track a benchmark that provides broad exposure to U.S. companies that are **dedicated to consistently paying larger-than-average dividends**".
Comment: Company profits change from year to year.  **Consistently paying high dividends** can be thought of (imperfect though it may be) as a proxy for highly profitable companies.
Comment: As a supplement to @RonJohn's comment, there are dividend-based ETFs.
Comment: @Kevin but some companies don't pay dividends every year. Why measure dividends and not profit?
Answer: Because most of the growth in an index fund is not due to dividends paid by the stocks it holds, but by the increase in the price of the stocks.  That increase has no obvious, direct relationship to corporate earnings or to dividends paid.  There are plenty of stocks (e.g. Tesla: https://ir.tesla.com/investor-faqs ) that don't pay dividends, but whose share price increases.
An index fund BY DEFINITION tracks the stocks that make up an index.  If that's not what you want, you can find funds that invest in mostly dividend-producing stocks, or which pick their stocks by corporate earnings, or which choose stocks by a multitude of other criteria.  Searching for "mutual funds that invest in dividend stocks" returns about 10 million hits, "by corporate earnings" about 66 million.
Answer: There are filtered S&P500 funds which seek to filter the companies that would be in the index based on some criteria like you lay out but the expense ratios on those funds are generally higher than the ones charged by the big index trackers; but they exist.  So only companies with market cap over X and fully diluted profit per share of Y is an index that might exist.  Whether or not that actually outperforms the S&P500 would need to be researched, then further whether or not it would outperform the vanilla S&P500 index fund net of fees is another point to research.
But remember "profit" is, to some extent, an accounting construct and stock price performance does not correlate to profit.  There are plenty of companies that run at negative profit (loss) but the equity is radically outperforming the S&P500. So why not use positive free cash flow rather than positive net profit?
There are A LOT of different indices.  Whether or not there is one with sufficient assets under management to warrant the extremely low maintenance fee of the big S&P500 options such that you, the investor, will actually benefit is another story.
Comment: To some extent it takes a certain amount of dollars to run a fund.  0.03% of a billion dollars is a lot more dollars than 0.3% of a million dollars.  The scale of the S&P500 tracking funds helps to facilitate the almost negligibly low expense ratios; but the investor pays 10x more in fees.
Comment: Sure, and it also might not and it also might be materially worse, but either way it will most probably be more expensive.
Comment: " the expense ratios on those funds are generally higher ", I don't understand why though. The bottom line profits are publically accessible, it's as easy as measuring market cap index.
Comment: I understand. But what is it about market cap that attracts investors? Or maybe if you could combine market cap with profits so as to dilute companies like Uber and WeWork. Would you agree that market cap indexes have a strong history, which gives them an edge nowadays?
Comment: What difference does it make?  The idea of an index fund came to market before computers, the index one Vanguard chose was the S&P 500.  Now the index funds have literally trillions of dollars in aggregate and Standard and Poors keeps coming up with umpteen different indices which fund management companies then try to roll in to ETFs and some attract some money.  BUT, either way, it's not clear any of these alternate broad indices can actually consistently outperforms the S&P500 anyway.  You're operating on the assumption that your idea would beat the S&P500 but it might not.
Comment: Never that it was clear, just said market cap makes a bit sense but profits make sense as well, and combining the two might work even better. It all seems a bit arbitrary
Answer: Market-cap weighting is uniquely preferred according to the efficient market hypothesis. By owning the S&P 500, you own shares of "the market" (at least a significant part, large US companies -- you should own other asset classes too). The market caps reflect the collective capital-allocation decisions of professional investors, on which you can free-ride. This takes into account not only current earnings, but projected future earnings and various kinds of risk. Using a weighting other than market cap is an attempt to beat the market, which is very difficult and will likely lag the market instead. If investing based purely on current earnings were most effective, everyone would already be doing it and the market caps would reflect it.
Answer: They're so popular because it's an easy way to make money.
Sure you supposedly could beat the market, but it's going to take a whole lot of work. You're going to have to read financial statements for hundreds of hours before you can decide which companies are going to outperform the market in a significant way.
So you could either throw money into an index fund every month or do some research into stocks you currently own and stocks you might want to own and then decide which of them is the best return for your money every single time you want to invest money.


Getting " App couldn't be opened because you don't have permission to view it. " after converting project code from swift 2.2 to swift 3.0

Question: Recently I opened my old project( which is written in Swift 2.2 and project created on Xcode 7.2.) in latest XCode 8.3.1. Xcode asked me for converting the project into swift 3 as XCode 8.3.1 not supporting older version of swift I clicked on convert project and some changes are done automatically some Pods I updated by pod install command and some manually added new swift3 classes. Mostly all viewController's class's syntax changed manually to swift3. It takes two days to build successfully project in Xcode 8.3.1. Now when I run my project on device or simulator it shows me error like:

The file "AppName.app" couldn't be opened because you don't have
  permission to view it.

I searched a lot on StackOverflow and google and found some solutions.
I have tried:

Replacing my info.plist
Deleting Derived Data
Duplicating my app
Editing the permission on the folder of the project Changing
"Compiler for C/C++/Objective-C" to Default in Build Settings
Checking my architectures Cleaning My Project
And there are no any physical folders also
Entered Bundle name As : ${PRODUCT_NAME}
Changed Executable file : ${EXECUTABLE_NAME}

But nothing is working please tell me what should I do? I have a backup of the project should I use old Xcode to run project every time? Please it's a request do not close this question as no solutions working provided by older question's posted on StackOverflow and this question is different also because of swift3. Thanks in advance. :)
Comment: Give it a try -- https://www.tec20.co.uk/resolving-xcode-dont-permission-error/
Comment: Refer to this [answer](https://stackoverflow.com/a/50167291/6521116) with a good summary of this issue.
Answer: I had the same issue, a simple Product -> Clean worked great.

Getting " App couldn’t be opened because you don’t have permission to view it. " after converting project code from swift 2.2 to swift 3.0


Event Handler deployment to remote server -- Event not firing

Question: I have an Event Handler deployed  to a doc lib on my dev box(Win 2003 32 bit OS) and it works.
And now trying to deploy it to my production which is a remote server (Win 2003 64 bit OS)
but it seems the event is not firing....
What i did was copy the dll to the remote server to c:\windows\assembly and then use the EventHandlerexplorer to register the dll.
and did iisreset.
Any ideas what i'm missing...
Do i need to use gacutil to register it on the prod server???
Could having 2 different windows one 32 bit and 64 bit be the problem??
THanks in Advance
Answer: In order for an Event in Sharepoint to be handled by your custom DLL, you will need to let Sharepoint know when and how to use your DLL.  This can be done by creating a feature.xml and elements.xml file that describe how Sharepoint is supposed to use your DLL for handling events.  These XML files will describe:

What list templates the event handler should be applied to
When this event handler should be fired relative to other event handlers
Exactly what DLL to use from the GAC (or bin directory)
What type of event to handle (e.g., ItemAdded)

For a walkthrough / sample code, go to http://developers.de/blogs/adis_jugo/archive/2009/03/12/develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch.aspx.
Also, for pushing out to production, I would recommend packaging up your feature as a solution (WSP file) rather than copying files by hand.  WSPBuilder is a great tool for helping to package it up.
Comment: Thabks Larbo i know about using features..
My bquestion was about pushing it to production though.
If i don't have no WSP Builder inplace how can i make sure the dll is installed to GAC.I reckon the asseblies DLL file are 2 files .dll and .pdb.How can i use gac to install it .The prod box doesn't have Visual Studio installed.
Thanks


How do I fix dead white patches in my lawn?

Question: I'm in the process of trying to repair this lawn and I'm looking for advice on how best to go about it. As you can see from the attached I have a lot of white patches, a problem with dandelions and I've also found the following grub whilst attempting to manually get rid of some of the dandelions. I'm not sure if the dead grass is being caused by this grub (I'm not sure on species etc. ) or just poor maintenance generally. Is this dead grass thatch that needs to be removed or just dormant grass? Sorry for the plethora of questions just would like some advice on what to do next. I'm in the UK and as yet have not fertilised or seeded or dethatched. there has been two cuts done thus far. and mower set highest setting. I'm manually removing weeds.
Comment: Was this grub actually under the soil in the lawn? I can't see any legs, were there any which are not visible in the photo? Scale is difficult to gauge, would you say, stretched out, it would be about  3cm? Have you noticed birds pecking the turf at all, or at least are there pecked up areas of turf?
Comment: it was under the soil.. i dont think its a chaffer grub .. no legs and its too small.. thats the edge of a trowel in the picture  ive added another pix of him on his back. i d say it was maybe 1.5 cm stretched at most. i havent noticed birds pecking much either
Comment: It might be a leatherjacket though - they're usually brownish/greyish, but they do vary a bit, no legs either. Can I ask you to find a largeish sheet of plastic, preferably black plastic, water an area of lawn, then lay the plastic over the top and anchor it down, just to stop it blowing away- lift it the following morning as early as you can manage to see if any more have come to the surface. If they're there, they should....and then get back to your question with an update
Comment: @bamboo my wife and neighbours both think Ive lost the plot, but ive done as requested and will report back tommorow. thanks for ur response thus far.
Comment: Well, it should prove whether there's a leatherjacket problem, even if it does sound bonkers. Hopefully your wife and neighbours will stop short of calling the men in the white coats! I just hope its not too cold where you are at the moment overnight - that will discourage them from surfacing... but we'll see
Comment: Ok.. woke early this morning and lifted the plastic. Not a single leatherjacket. Im not sure if Im disappointed or relieved, I was something akin to a child on Christmas morning waiting for his presents of fresh grubs. It rained last night but dont think it was terribly cold.
Answer: So no presents for you under the plastic then! I'm glad really - that larvae you found could be the larvae of a moth or butterfly because its not immediately recognisable as a leatherjacket, but might have been. What's odd is you found it actually under the lawn, and that isn't at all typical of moth larvae.
First, I'd note that your lawn is cut way too short - I know you said you had the mower on the highest setting, but perhaps there's something wrong with your mower, because, for this time of year, it is too short. I do see lots of what could be dandelions - inspect the lawn thoroughly and decide whether the ratio of weeds and moss to turf is greater than the amount of grass. If it is, you might want to consider stripping it out, including weed roots, preparing the area and laying new turf.
Otherwise, I don't know what kind of regular maintenance routine you've carried out over the previous years, but now is the time to apply a lawn feed, so use a granular preparation with a moss killer, but not a weedkiller - apply at the rates indicated on the box, at least three days after cutting, and try not to overdose. If your soil is heavy, aerate the area by inserting a garden fork about every 9/12 inches, vertically and removing it at the same angle, then feed. Apply when the blades of grass are dry, but on a day when you know rain is due within 1-3 days.
In the meantime, get some Verdone Extra, which is a liquid lawn weedkiller - you'll need a can to mix it in. As the lawn starts to grow and the weeds are growing strongly, with entire leaves and looking lively and bushy, apply the Verdone according to the instructions on the bottle. The reason I suggest a separate weedkiller is because the standard Lawn Weed Feed and Mosskiller preparations are pretty hopeless at killing weeds in lawns, so although it's tedious to apply two different products, it will be more effective.
If any moss that's present turns black, rake it out, and if that leaves bald patches that are quite noticeable, you may need to reseed those patches, but that can't be attempted until six weeks after the chemical treatments have been applied. At this point, you could scarify the lawn - it will make it look pretty awful, but it should recover quickly.
Ensure the blade/s on your mower are good and sharp; raise the height of cut on your mower so that, after cutting, there's a good inch to inch and a half of grass growth left behind. Re-apply your lawn feed 6 weeks after the initial application, depending on the instructions on the box you buy, but do not use past July. Any feed after that should be an Autumn one.
If you want more guidance, there's a book called The Lawn Expert by D. G. Hessayon - you might find the library has a copy, or a charity shop, and last time I looked, there were copies available on Amazon and Ebay. Full retail price around £14, cheaper second hand. Although the chemicals mentioned within it may be out of date, the basic routines outlined in there are entirely valid and haven't changed - contains information on how to lay a lawn, recognise and treat problems, and maintain an ongoing good lawn, including topdressing.
Answer: The earth looks very compact and doesnt from the photos look like there is a good level of good quality top soil.
for me, you need to get some good soil, compost and gypsum on top. poke holes and losen the ground and concentrate on the soil. once that is good, grass will be easier to get going.
I have tried many times to bring lawns back and its much harder when there isnt enough good top soil with airation and nutrients.
Answer: I would recommend working on the basics first before trying to repair the lawn.  Firstly, I would remove all the weeds in the lawn and secondly I would fertilize the lawn.  Also, make sure you are watering the lawn regularly as needed.  You should start seeing the lawn improve quite a bit just from that.  Then, if patches remain, you can try to repair the bare spots by seeding it or laying small patches of grass.  I do think the lawn can be saved by normal maintenance.


Why do all the red states on presidential election maps since 2004 (excluding Alaska) touch other red states?

Question: Since the 2004 election, every state that gave the most votes to the Republican candidate was touching another state geographically that did the same. This is, of course excluding Alaska. And it is not true of blue states which usually touch each other in small regions like the Northeast, CO and NM (2008 onwards), the West. (The upper midwest was isolated in 2016 leaving just Illinois and Minnesota.) By the West I mean the three coastal states CA OR and WA. Why is this?
Comment: Just a suggestion, but you might look at cultural & political differences reflecting geography & population patterns.  Democrats in that period supporting policies that are attractive to urbanites, repugnant to rural populations, the "red states" not being dominated by large urban areas.  Would be even clearer, I think, if you looked at votes by Congressional district, or even finer granularity if the data is available.
Comment: While this is a moderately interesting observation, I don't think there needs to be an "explanation"  If you look at https://projects.fivethirtyeight.com/2020-election-forecast/ you can see that there are many scenarios in which the "red" states don't form a contiguous block, and a few (unlikely but...) in which the democrats do.
Answer: Democratic-majority states are concentrated on the coasts, so they tend to have smaller numbers of neighboring states. Otherwise, this is just a matter of pure chance. I see no reason to think that there is a causal relationship between voting patterns in neighboring states.
Comment: Maybe it has to do with them not being on the coasts.
Comment: @agc A [spurious correlation](https://www.tylervigen.com/spurious-correlations) requires no explanation.
Comment: Interesting observation, red states do indeed tend to border more states than blue ones do. Of the 22 states that border at least 5 other states, 18 of them were red in the last presidential election. Of the 34 states that border at least 4 other states, 25 were red. There's also the overall imbalance of red vs. blue states - there are simply more red states than blue states, increasing the likelihood that they will border one another.
Comment: Re *"I see no reason..."*: just because we might not see a reason doesn't necessarily imply there's not a good reason we do not see.
Comment: @BrianZ, True but irrelevant when replying to a comment that has no spurious correlation.
Answer: As a general US rule, densely-packed areas that are primarily urban and which focus on end-product industry, commerce, or technology tend to lean Left. They are more cosmopolitan, more ethnically diverse, have somewhat higher average educational levels, and are more secular, all of which lead towards more sympathetic views to social justice issues. By contrast, loosely populated rural regions, which emphasize agriculture, ranching, mining, and resource industry (oil extraction, iron smelting, ore processing) tend to lean Right. They are both more religious and more socially conservative, and have little exposure to the issues involved with typically 'liberal' policies. On any level of the US political map one cares to look at, there will be islands of blue concentrated in densely populated areas, separated by oceans of red spreading through lightly populated rural regions. For instance, California is a reliably 'blue' state, but any detail of the California political map will show areas of blue around Los Angeles and the SF Bay Area, with chunks of the coast, most of the Central Valley, and all of the Eastern counties showing bright red.
Various sources have produced election maps in which the geographical size of states is adjusted to reflect the proportion of population they represent. Below are two, by Business Insider (working on a state level) and Metrocosm (working on county-level data). Note how different the maps look when adjusted for population size (the second image includes the conventional geographical depiction for reference).
Comment: Re "more sympathetic views to social justice issues", I think that might be better rephrased as having different views on what exactly social justice issues ARE.  As an extreme example, I expect that many rural people would consider the right to bear arms (and to hunt) as a social justice issue.
Comment: Great pix, but this answer doesn't much address why the red areas are contiguous.
Comment: @agc: actually it does, but maybe not directly enough. The read areas are contiguous because of population density; they are roughly the same amount of people spread out over maybe 5-10 times the area. The red areas appear to 'touch' because pretty much everything outside major cities is red, and the ranching/farming states in the center of the country never developed cities on the scale of NY, Chicago, or LA. It's an artifact of the mapping, not something particularly meaningful in itself.
Comment: @agc: you might as well ask why oil beads when you drop it in water. Something has to be the visual foreground and something the visual background, red gets to be the visual background because conservatives are just a lot more spread out than liberals.
Comment: @jamesqf: That is difficult phrasing, I agree.  I think the real difference, I think, is between a communalist and individualist worldview, and I don't think either position is particularly 'wrong', but it becomes very complex very quickly.  I'll think about it a bit and see if I can phrase it better.
Comment: @TedWrigley, Really beads of water is approximately right.  What I meant was more in the vein of: the population is dense because of *cities*, and cities generally aren't just built at random locations, but rather most cities develop next to ports and waterways.  So it's water, but on a macroscopic scale.
Answer: Democrats tend to do very well in big urban centers and poorly in rural areas. Middle america and the south don't have many big cities that completely dominate a State.
Atlanta, New Orleans, Nashville, St. Louis are all big cities in middle/south USA but they don't completely dominate their State the way New York City, Chicago, Philadelphia/Pittsburgh, Boston dominate their States.
Big cities tend to be concentrated in the costal/northeast regions, so that is where Democrats do well. Conversely, middle\southern America doesn't have many big cities, so Republicans do well. This is why it is called "flyover country" by some - the places between the big cities.
In fact if you look at voting data, even in Democratic strongholds like Illinois, New York and California, rural areas tend to be heavily Republican.


Classifying whether a chess board square contains a piece or not?

Question: I have an image of a chessboard which I segment into its constituent 64 squares. I want to construct a binary  classifier which can detect which square contains a piece or not. I know how to do this via CNN's, but I feel like that might be a bit overkill. I was wondering what would the simplest approach be to this problem? Thank you.
Answer: If it's a screenshot of a computer game, where each constituent has purely that box, that is by default any given box is white or black. then, any simple matrix operation like, variance of color in that box could be a feature in determining if there is a piece or not.
If it's a hover cam image (Top view), then it's a different problem. you can simply do a kernel multiplication for edge detection, any empty box will have array of 0 as it's output. while it won't be the case if there is a piece.
Answer: Each of your squares consists of $x*x$ pixels and each pixel has a color value. Now simply compute the sum of all pixel values from an empty square and you have your classification rule for detecting empty squares.
The same method should also work for nonempty squares to find out which figure uses that square.


One-way functions and pseudorandom number generator

Question: Is it true that if there is Cryptographically secure pseudorandom number generator then there is One-way function?
Comment: Your question is not at all clear. Maybe you can explain what it is you are looking for.
Answer: If you have a really Cryptographically secure pseudorandom number generator you can use it to create a "one time pad" which you can then use to encrypt your message.
One time pad has perfect secrecy (for definition see Shannon or here lecture notes on perfect secrecy).
Your function will be a one way function since only you can invert the coded message to it's original plaintextform.
BUT: to decipher the message you'll still have to send the pad you've used throu a secure channel or encrypt it with some other cryptosystem .


Backdrop size for photoshop

Question: I would like to know if I would need a 1.5m x 2m Backdrop, what's the size of canvas I've to create on photoshop?Thanks!
Comment: Please do a basic search (Internet, this site) before posting such question. If you want to know more about how this site works check the [help]
Answer: There are a couple ways of doing this. Firstly: How are you printing this? How close are people supposed to be looking at this backdrop?
When you create a new document you can choose what size you want in several different units. Simply change to millimeters or centimeters and plot in your size, then choose a fitting DPI. 300 is for photo realistic quality, however once you get to those sizes you can go down in quality due to increased viewing distance, 150 is probably decent.
Alternatively you could make your file in a 1:10, ie: 15x20cm and then ask the printer to produce at 10 times the size. Doing this you certainly need a higher DPI.
Lastly though, what are you making? This sounds more like an InDesign job than a Photoshop job.

Backdrop size for photoshop


When you are standing on the floor, you push down on the floor and the floor pushes back on you. Why doesn't the floor make you rise up?

Question: When you are standing on the floor, you push down on the floor and the floor pushes back on you. Why doesn't the floor make you rise up?
Comment: You have answered your own question. Read your question back to yourself.
Comment: Please explain in more detail why you think the net force on you is non-zero here.
Comment: @superfastjellyfish Because of gravity.
Comment: Why do you push down on the floor?
Comment: That was meant for OP
Comment: @ACuriousMind I think clarification is needed. I think the OP is considering just standing on the floor, so the net force on you is $0$. I don't think the OP is asking about pushing on the floor in the case of something like jumping
Answer: What is the meaning of the phrase "rise up"?  By Newton's 3rd law the force that the floor exerts on you must be equal in magnitude (opposite in direction) to the force that you exert on it.  What force are you exerting on the floor?  More importantly, what is the nature of that force?  Most people would immediately say you are exerting your weight but this is not quite true.  The earth's gravitational field is what creates your weight and the Normal force is NOT related to this.  It is not a reaction to your weight.
When two bodies touch at their surfaces there is a contact force that causes them to be repelled from each other.  This force is perpendicular to the surface of the two bodies and we call it Normal force.  There are a lot of assumptions being made here about the behavior of the bodies and in the right circumstances this could be violated.  For one thing we are assuming that the bodies can withstand a infinite amount of stress without any strain.  When solving basic physics problems we take whatever idealizations are needed to make this true and infer what the normal force is by solving Newtons equations.  We don't know what value it will have in a given situation.  In some sense it acts as a rigid constraint.
In the simple case of an object resting on the floor we would analyze the forces and determine that the object has weight due to gravity and "some other force" due to contact with the ground, this is $N$.  Since the object is not moving (a given in the problem) we must have $N = mg$.  We simply have no other choice based on the information provided.
Consider another case.  Two objects are floating in space, removed from all other sources of gravity.  If they come into contact what happens.  If we neglect the gravitational force between them them then as soon as they make contact the "normal force" that each exerts on the other will cause them to accelerate away from each other.  In fact the contact force does cause one of the objects to "rise up" away from the other.  In the limit of them being brought into contact quasi-statically if they are touching then we will either have $N = 0$, or they will move away from each other due to a non-zero $N$.  In fact one could argue that if the two are at rest and appear to be close then they are probably not touching, there is an infinitesimal space between their surfaces.
Consider one more situation.  A person stands in an elevator that is accelerating upward.  Assuming they remain in contact with the floor the normal force would be determined from Newton's second law to be $N=m(g+a)$.  In this case $N$ is responsible for the person's upward acceleration.  You might think it's the cable attached to the elevator but it is not.  That force does not connect to the person.  Only the force of the floor acting on them does. So, in this case the force of the floor acting on the person does in fact cause them to "rise up".  But not off the floor.
All of these examples treat the floor as some type of ideal constraint.  In fact they also treat the other objects, people, etc. as having no structure.  Our material structure is made up of atoms connected by a web of balanced interaction forces (glossing over all the quantum processes required to get to this point).  In the macro world some of this is experienced as elasticity, and plasticity, bulk properties of large chunks of matter that we are familiar with from experience.  What makes an object distinct from others, at least in some sense, is the boundary that appears to exist which keeps its atoms contained in a well defined volume of space.  The space I occupy seems to be separate from the space my chair occupies.  When two objects touch there is deformation of this boundary, compression of the matter inside, etc.  What we see in the macro world as a Normal force is the result of these processes coming into equilibrium so that the bodies in contact are not destroyed or fused together with all their atoms mixing up.  When I sit in my chair both me and the chair experience stress from the contact forces present and strain, compression and redistribution of matter.  From this point of view you can think of the generation of $N$ as similar to hanging a mass on a horizontal wire and letting it come to equilibrium.  You could ask why doesn't the tension in a wire case the mass at the end to "rise up".  In some sense it is creating enough "rise" to compensate for the "fall" gravity would produce were the floor or wire not there.  The concept of Normal force, or contact force in general, only makes sense under the conditions where everything is preserved, left undamaged in the process.  It is possible for these conditions to be violated and for $N$ to be meaningless.  In fact the study of contact forces like $N$ and friction at a micro-scale or even nano-scale are an interesting area of physics.
As a final example consider jumping.  In this case you are redistributing your body parts and exerting force with your muscles to accelerate yourself (relatively speaking).  But at the end of the day those are all "internal" forces.  The only external force acting on you (neglecting air resistance, power line fields, etc) is $mg$ from the earth and $N$ from the ground.  So, in fact the ground can be used to make you rise up.  In reality when you jump you are pushing the earth away from you, and the earth pushes you away with equal force, and you both move away from your common center of mass, which hasn't moved at all.
Answer: There are four forces at play here, in accordance with Newton's Third Law, or two action-reaction pairs.

Gravity: The Earth pulls the block toward itself by force $mg$ (block of mass $m$) and the block pulls the Earth back with the same amount of force. However, the acceleration of the Earth is negligible because of its huge mass.
Normal/Reaction force: The block is sitting on the floor, but is not able to go through it. This means the floor must exert some force back on the block. This force, typically written as $N$ or $R$, is the normal force from the floor on the block. Its 'action-reaction' force acts on the ground.

The common misconception here is treating $mg$ and $N$ as an action-reaction pair, which they are not. If you do so, you'll reach an incorrect conclusion like the one in your question.
The conceptual clarity to have is that Newton's Third Law states that "If A exerts a force on B, B exerts an equal and opposite force on A." Action-reaction forces, by definition, act on different bodies. It's useful to keep this in mind while applying Newton's Third Law.
Also, it seems from your question that you're looking at the forces as sequential: "first you exert a force on the ground and then the ground exerts a force back onto you". This isn't how forces work: the ground pushes back on you because you're pushing down on it. If you push down harder, the ground will push you back harder. It happens at the same time. These forces act simultaneously and instantly.
Of course, it's easy to see from the free body diagram that the net force on the body is zero and hence your acceleration, is, from Newton's Second Law, zero.
Answer:
Why doesn't the floor make you rise up?

Because the net force on you is zero. Gravity exerts a downward force on you of $mg$. The ground exerts an equal upward force of $mg$ on you. The net force on you is zero, therefore you do not accelerate.
Hope this helps.
Comment: @SolomonSlow I have explained it sufficiently. The force the finger exerts on the puck is the net force on the puck since the air cushion can be considered to approximate a frictionless surface. The acceleration of the puck is then $a=F_{net}/m$ where $m$ is the mass of the puck. The puck exerts an equal and opposite force $F$ on your finger (which is of course connected to your body). If you were standing/sitting on a frictionless surface, your acceleration would be $a=F_{net}/M$ where $M$ is your mass, much larger than $m$, so your acceleration would be much lower than the puck.
Comment: Add static friction between the surface you stand/sit on the net force on you is zero. Therefore you do not accelerate. In the OP example, clearly the net force on the person standing on the ground is zero.
Answer: Because the repulsion between you and the floor only happens appreciably at extremely small distances. The floor pushes against you very hard when you are very close but once it has pushed you away a small distance the force drops off very quickly.
Comment: In terms of a Newtonian mechanics P.o.V., the answer is in the question OP proposed. You push against the floor. The floor pushes back. There's no hint of unequal forces in the question. It's just as simple as the question states: you push, floor pushes back. I'm not sure why OP would think about a person rising up from that.
Comment: just push your two hands together pushing with equal force with both, where du the move?
Comment: What? The force drops off very quickly at a small distance? I *think* I understand what you're saying but you gotta clarify
Comment: This answer is talking about (if I'm not mistaken) the electromagnetic interaction between floor and the body. As correctly stated, according to Coulomb's Law, the magnitude of this force drops exponentially with the displacement.
Answer: This is a fun answer:
Can you stand on the water? The answer is No?
Why? Because the water is less dense than your body, and your body displaces enough volume of water to compensate for your weight, and you have some buoyancy.  Archimedes principle. The downward force from the weight is equalized by the from the buoyant force from the water.
Start making the water denser and denser, you can float on the water, as the bottle full of air here. The density of the ground is such that you are at the limit where buoyancy is really   the opposing force.
Unless extra energy is supplied the force of gravity is opposed by an equal force from the ground. If the force of the ground made you rise, energy would not be conserved.
Comment: You can't stand on water because it's a *liquid*, not because it's less dense than you. You can't stand on corn syrup, either, even though it's *more* dense than you. Conversely, you *can* stand on a block of Styrofoam, even though it's less dense than you. Buoyancy has absolutely nothing to do with the fact that you don't fall through the floor or get lifted up by it.
Comment: Is it really the density alone?  What about surface tension?
Comment: @ggcg  surface tension depends on the density of the liquid, how close the atoms and molecules can get to each other.. in solids they organize into lattices.
Comment: @NuclearWang if the density were high enough, you could. That is why I call it a fun answer, because sinking and buoyancy would work even if you tried to stand on water, as inadvertently you walked into a pool. floating comes next
Comment: I see, thanks for clearing it up
Comment: @annav The densest liquid at STP is mercury, and it's only ~13x as dense as a person - you'd sink into it halfway up to your knees. Any buoyancy requires displacement, so you're always going to be standing *in* the liquid rather than *on* it, no matter how dense it is.
Comment: @NuclearWang   ? Archimedes principle should still  works  https://www.cnet.com/news/mercury-stand-float-codys-lab-video-liquid/
Comment: @annav That video depicts exactly what I said - the guy sinks in about halfway up his boot, and can only stand up by holding onto something for balance, because he has no way to keep his center of mass centered over his feet. It's a bit of a stretch to say he's standing on a liquid - he's floating *in* a bucket of mercury, not standing *on* it.
Comment: @NuclearWang  did you see it to the end? the mercury displaced according to Archemedes principle. Mercury has the differenc from other atoms that it does not make a lattice, i.e. turn to solid. So I gues it is density and atomic affinity, binding into a lattice.
Answer: Because the net force on us is 0. We push on floor and the floor pushes on us but also the Earth pushes us too and this is the same reason why we push on the floor. So the "forces" acting on us are : the push of floor and the pull of Earth and they cancel each other therefore we don't accelerate (this is true for the poles only). As on other latitudes the floor pushes us a little bit less so than we can rotate around Earth with the same speed as the ground below our feet does.
Answer: if you ask why the force from the floor doesn't accelerate you (make you rise up) because it is busy keeping you in place. it is cancelling the acceleration produced by the earth. if somehow the gravitational force vanishes or switches off for a moment then you WILL rise up.
I had similar questions when i was beginning to learn physics. Good.

When you are standing on the floor, you push down on the floor and the floor pushes back on you. Why doesn’t the floor make you rise up?


Migrating from jquery to Backbone - does it make sense with this?

Question: Noob Backbone.js user here. I have a jquery app that I'd like to migrate to Backbone. I have read through docs and the relevant chapter in O'Reilly's Javascript Web Applications.
The jQuery part does the following:

on document.ready, make an Ajax request to get back two (potentially) big pieces of Json. One piece of json represents all the comments and the other represents all the images. Both of these are keyed against the item-id and appropriate div's are created in the markup.
each ajax call on success iterates through the results and appends them into the appropriate div
After this is rendered out, the app listens on the more-info-$id's and toggles displaying them

A couple of ?'s

Does this sound like a good candidate for a Backbone app?
It seems like Backbone has a pretty specific set of uses. Would I want to create a set of Comments and Images and then make the appropriate ajax call? Could I essentially keep the same json and just instantiate a new Comment object and a new Image object and then add to the respective collections?
It seems most of Backbone is around handling events - is using it in this document.ready way ill advised?
Would something as simple as a toggle call be better left in jQuery?

Sorry for all the noob questions, just don't want to get down a wrong path.
thx
Answer: Backbone isn't a replacement for jQuery, it still uses jQuery (or Zepto) out of the box to do ajax/DOM stuff anyway.
In your case Backbone seems like it could be a good candidate for organizing what you already have. What you've done above is describe what you app is currently doing, it would help to have more information along the lines of what your app should do from a conceptual angle - this way we can attempt to design a method of organization (appropriate models/collections/views, etc) for your use-case (this is what Backbone excels at, it definitely does not have a 'specific set of uses', don't worry :)).


Since neutral is connected to ground how is current kept off of ground?

Question: If neutral is connected to ground and current desires ground then I would think it would go to ground.  But my understanding is that it is kept off of ground until it's "upstream" of the breaker box, or unless a malfunctioning device shorts hot to ground.  So what "prevents" the electricity from going to the ground that the neutral is connected to?
Comment: Possible duplicate: [Why didn't homeowners get electrocuted when appliances were grounded through the neutral?](http://diy.stackexchange.com/q/35738/2196)
Comment: I answered this exact question [here](http://diy.stackexchange.com/questions/31263/will-the-second-light-in-this-circuit-light-up/31272#31272), though the explanation is very technical.  The short answer is, there *will* be current through you if you touch a neutral wire while grounded, but it will be so small you will barely feel it.
Comment: The current in the neutral wire in your service drop is a fraction of the current in the two hot legs. First of all, none of your 240 V loads use the neutral at all. Some 240 V/120 V appliances do send a small amount of current into the neutral and ALL the 120 V loads send all of their current into the neutral BUT approx half of them are on one 120 V leg and half are on the other leg SO they cancel out in the neutral! (They cancel out because they are 180 deg out of phase with each other.) Then only a very, very small fraction of that goes through the ground.
Answer: Current doesn't want to return to ground, but rather it wants to return to the source.  The ground isn't a great conductor and while it is in parallel with the service, the amount of current returning through the ground is so small it is effectively zero.  However, if you lose your neutral then the ground becomes the only viable return path for the current to get to the source.
I replaced a residential service and the neutral on the service drop broke on the service drop-side of the point of attachment.  The house still had power because the system was grounded and current was taking "plan B" of returning to source through the ground.  Luckily the home owners just purchased the house and hadn't moved in yet.
Answer: The detailed question here seems to be whether in 'normal operation' there can be 'any' current on the large ground wire from  the main panel to its actual 'earth ground'.
The answer is YES, it is possible - but the amount of current should be very low.
Note: we are not discussing current on the ground wires of the wiring within the house - only the large ground wire from the main panel to an external 'earth ground'.
At the main panel, the supply neutral is bonded to 'earth ground' - so there is a parallel path going 1) to supply neutral, and 2) to 'earth ground'.
The amount of current on a path is determined by the resistance difference between that path and any other path.
Proper design and construction has the resistance of the supply neutral being very much less than the resistance to 'ground' - so the majority of current is on the supply neutral, but a small amount can be on the 'ground' path.
Comment: You're not wrong, but you really haven't added anything to answers that have been here for years. Please take the [tour] and see [how to write a good answer](https://diy.stackexchange.com/help/how-to-answer), then [edit] to improve.
Answer: I know this is an old thread and has been answered in multiple ways here. If I am making this more confusing let me know and I will take it down.
This is my simple version of what happens and why grounded and grounding wires are both important and kept separate all the way to the main disconnect panel, and why 'earth ground' is needed but not adequate to act as sole ground.
The electrical grid is like a big piping system with lots of little pipes with differing pressures. The utility's power plant is a large pump of electrical current, looking to get back everything it sends out through a big loop. (Very much over simplified)

At any point before the main panel, the grounding (green or copper) and grounded (white) are kept separate because the white (grounded or neutral) conductor carries current back to the center-point of the transformer (residential), while the 'grounding' wire is there to ensure an alternate, unused path exists if needed. If these conductors were bonded earlier than the main disconnect panel, then the grounding wire could end up carrying current back to the main panel and become dangerous. In case of a multi-drop circuit, for example, if the Neutral is used as the grounding wire (tied to appliance) there is the potential for the appliance frame to become a current carrying device. i.e. if a downstream neutral is broken, the appliance would look to the person who touches the appliance to be the current's route back.
Earth ground exists as an alternate (alt on drawing) route to the transformer, etc, but is a lousy conductor. This is why a broken neutral to the transformer causes strange (floating) voltages. Earth is not enough of a conductor to carry all the current, so the path becomes any closed circuit in the house, finding its way through differently phased circuits. Earth ground is needed to help diffuse issues with errant current when there is no other path back.
For older appliances with neutral as grounding conductor, the appliance has a straight point to point connection to the panel, so the appliance should never be in series with another neutral. It is an extension of the panel ground. This is not the case if the neutral is severed, which would make the appliance hot, attempting to complete the circuit any way it can, potentially through people. This is why a separate grounding wire is important on circuits and why it needs to be mechanically bonded when spliced.

Here is my art for this description, showing grounds only. It is rudimentary, and though I tried to be accurate, it leaves a lot out. I hope it is helpful in clarifying why 'grounded' and 'grounding' are both very different and important, and why ground doesn't seek earth, it seeks the generation source it came from. (Don't ding the art, it's all I got..The funny little faces off the panels are supposed to be outlets with their grounds only. No power is drawn in the picture except at the transformer to main panel lugs.)
Answer: The short answer is resistance. Electricity will find the easiest path to ground. At the neutral-ground bonding in the breaker panel is a connection to the ground wire that goes to the actual ground. It's a heavy gauge, and connected to grounding bars deeply embedded in the ground to offer the least possible resistance.
For current to travel from the neutral back to the ground wires to where it can electrocute you, it needs:

an imbalance in the house wiring (remember, there are two hots, and with a broken neutral it becomes a circuit with two loads in serial),
a failed neutral since the neutral will be at the difference in current used by the two hots (by design of a center tapped transformer), and
a better path to ground than the ground wire that is connected to the grounding rods.

As long as any one of those three conditions doesn't apply, you should not see any current on the ground wire.
Comment: I doubt that you will ever see an installation where the two hot conductors are perfectly balanced. So you will see some current on the wires that go to the grounding rods. Which is the main reason they are 6 gauge wire, to help pull the voltage down.
Comment: The imbalance will first go out the neutral. After that, it will appear as an increase in voltage on the lesser used hot. See [this question](http://diy.stackexchange.com/q/6351/2196) where using the microwave caused someone's lights to get brighter.
Comment: If you have a multimeter capable of measuring milli-volts, and measured the AC voltage from the grounding rod to the dirt a few feet away; you would see that there is some voltage. See also [infinite resistor grid](https://www.google.com/search?q=infinite+resistor+grid).
Comment: I was looking at the majority of the electricity flow, which is what I think most people are concerned about when wiring a home. The paranoia is from the hot having 120, the neutral on the other end of that 120, the ground connected to the neutral, so metal appliances should have 120 on their exterior ready to electrocute you. Sure, there's going to be some milli-volts from the slight resistance, and there could also be phantom induced voltage, but it's going to be much more like a 9v battery than the 120v hot.
Comment: People are totally underestimating the amount of current that can flow on the grounding system. The ground path can have a VERY low resistance, for example where the GEC is attached to metal piping that in turn is connected to the GEC's (and therefore neutrals) of neighboring residences. I've seen as much as 40% of all 120V loads in a home flowing on its GEC and water service pipe, with no apparent problems, and going on for years.
Comment: @kreemoweet I think we're saying the same thing. The grounding rod, service pipes, etc, are a very low resistance path to ground. Which means you're unlikely to see 120v and a hundred or so amps electrocute you when touching a grounded appliance.
Answer: A great question and it seems odd to have a ground and a neutral. We have a neutral to keep the ground from being loaded. We dont want the ground to be load, it doesnt have the capacity and its for back-up.
In AC systems, there is current on the "hot" leg and on the "reference" leg. We use a neutral leg for reference. In countries with 240v systems, there is no neutral, but two opposite legs of 120v that provide a reference for each other. You see in AC systems, the voltages are not constant - it alternates back forth +X volts and -X volts. + and - from what? voltage is just potential differences from the reference. In 120v systems, on leg will be -60v from the neutral and then switch to +60v from neutral 60 times a second. In a 240v systems with out neutral wire there is a perceived reference between the two 120v legs that are off opposite phase.
So, yes in theory, you could get the potential difference from a 120v "hot" leg and ground, BUT then your would be loading the ground and it would no longer serve a safety function. In practice when you load the ground, appliance panels and other things that are grounded out become will be loaded and can shock.
Comment: The grounding conductor should always have the capacity to carry the full load supplied by the ungrounded (hot) conductor, in a properly wired circuit.
Answer: Because ground is not a return unless you bridge across from neutral, hot, or have a component short to frame ground.
It is a free standing wire/conduit network connected to earth that isn't a part of a circuit till a fault occurs.
Comment: it is part of the circuit because the neutral is connected to it at the panel box. So it's a extension of the neutral wire.
Comment: Ground is always one of the possible return paths for current (where neutrals are grounded) and it absolutely will and does carry current in proportion to its resistance. It's very common for residential ground systems to carry measurable current in normal use
Answer: The ground wire is for safety, it should be very close to the same potential as Earth. To that end, there is a legal limit of how much resistance there is from the ground at the service entrance to dirt outside. In the US it's 25Ω, or you can get away with just using two ground rods 6ft (or more) away from each other. (It's cheaper to install two ground rods than spend time and money on properly testing the resistance)
The reason the neutral and ground wires are connected at the service entrance, is to help keep the voltage potential of the neutral to Earth, as low as possible by keeping the resistance to Earth as low as possible.
To have absolutely no current on the grounding wire going to the ground rods, the nearest transformer would have to have equal current on both hot conductors. Since the transformer typically has it's neutral (center tap) grounded at the the same location as the higher voltage side, there would also have to have to be equal current on all of conductors on the high side as well.

So basically there is always some current going through the grounding system, at the service entrance. The main thing, is that the voltage is kept as low as possible; by keeping the resistance as low as possible.
If you want proof that there is some voltage, and therefore current, on the grounding system, measure the voltage from the grounding rod to a point in the dirt a few feet away.
If you measure any voltage with a high-end multimeter of even a tenth of a volt (AC); then there is current on your grounding system.
You can even measure some voltage from the grounding rod to the point at which the neutral and grounding system are bonded. Although this will be far less than the other test, as copper and aluminum are better conductors than dirt.
Even if you turn off your power, you will still see some voltage with both of these tests. Assuming there is someone else connected to the same transformer as you, and your neutral and ground wires are still wired properly. The amount of wire the current would have to travel through before it got to your premises would be greater, so the amount of current/voltage would be greatly lessened.
Answer: I admittedly know very little about AC wiring.  It doesn't make a lot of sense to me.  But here's my neophyte expalnation.  Somebody please explain why this is not correct.
AC swings from positive to negative 60 times a second.  As the black Hot wire goes positive, the white Neutral wire goes negative.  When the Hot wire is +60V, the Neutral wire is -60V, and vice-versa, for a total voltage swing of 120V.
Another way of thinking about it is, positive voltage is pushing and negative voltage is pulling so there is a push me-pull you effect happening 60 times per second relative to the source (stepdown) transformer.
So, the reason current is not lost thru the Neutral wire to ground is because of potential.  Ground is 0V potential.  The positive voltage being supplied is +60V which is greater than 0V (ground) so you might think Ground is where the current would go.  However, at the same time there is +60V on one wire, there is also -60V on the other.  So, the +60V is actually being pulled back to the source transformer by the negative voltage (-60V) which is has a greater voltage potential than ground (0V). Throughout the sine wave cycle, the positive voltage has an equal negative voltage which keeps the current in the circuit. The potential difference swings from 0V to 120V 60 times per second.
Comment: I think you may be getting hot and neutral confused with the two opposite phase hot wires supplied in typical US residential connections. Neutral does remain neutral, but each hot cycles from positive to negative relative to the neutral. Each hot on average is 120V different from neutral (sometimes positive, sometimes negative) as measured by an averaging method known as root mean square or RMS.


How to drag and drop views in Android tablet app?

Question: I want to show a dashboard like interface in my Android tablet app where the user can drag and drop listviews using touch. Is there a library that i can use to give d&d to my app?
Comment: what you have tried so far? have you referenced any tutorials/articles/example yet?
Answer: For android 3.0 and up, which is usually in all Android tablets. You can use this:
http://developer.android.com/guide/topics/ui/drag-drop.html
You do not necessarily need a library to give the drag and drop functionality. It is already in Android 3.0 and up. If you want the code, the best way is to write it yourself as it will suit you to what you want. To learn about it, look at several examples and read them. It is pretty simple and acts much like OnTouchListener and MotionEvent.


I'd like to get a notification when a question that I've voted to close (but isn't closed yet) is edited

Question: Requested Feature
I'd like to get a notification when a question that I've voted to close (but isn't closed yet) is edited, so I can review the changed question and retract my close vote if appropriate.
Workings and Rationale
Questions can be voted to be closed for a number of (custom) reasons. Those reasons are requests to the OP to adjust their question — to make them less broad, to make them on topic, to provide a test case, and so on.
The OP (or another user) may edit the question to address the issue, but the close votes remain. If another user casts the final vote, the question is closed, even though the original issue was resolved.
To prevent that, the close voters should be notified that the question was edited, so that they can review the edited question and adjust their vote accordingly.
This is for a question in the process of being closed only.
Related Feature Requests
Notify users of a question they closed being edited or nominated for reopening
Not a duplicate, since my request is about questions in the process of being closed, while that request is about questions that are already closed. That could notify users years after they've closed the question. That seems unnecessary and we have the regular re-open process to deal with it anyway.
Is it possible to get an Edit notification on questions that I Vote-to-close?
Same request as mine, but (incorrectly, IMHO) closed as a duplicate of the former.
Answer: If a close-worthy question is edited and made on-topic, then it is very unlikely that it will get more close votes. Existing votes will die away eventually.
But in case it does get closed later by somebody's careless vote, it will be noticed by other users and reopened eventually.


How do you spell 'hoo-wee!'

Question: My dad used the expression 'hoo-wee!' a lot when I was a kid. (That is what it sounds like.) For example, if we were using the grill and it flared up he would say "hoo-wee!", and I love saying it but I'm not sure how to spell it.
Comment: http://en.wiktionary.org/wiki/hoowee You were close. However I understood your meaning, and I wouldn't say that spelling "hoo-woo" with a hyphen is wrong.
Comment: "Whoo" is common. I'd probably write it "whoo-hee" even if that is not quite how it sounds.
Answer: Since the expression is an interjection—a cry of surprise or delight, really—many dictionaries (including Merriam-Webster's, evidently) don't consider it a standard word; in any event they don't list it. As Mari-Lou A points out, several online dictionaries—Wiktionary, YourDictionary, and Urban Dictionary—have entries for hoowee. But the Urban Dictionary also has entries for whoo-wee, whowee, and oowee—and a Google Books search turns up numerous examples in which one or another of these spellings of the term is used to express essentially the same thing.
From Ken Kesey, One Flew Over the Cuckoo's Nest (1962):

The motor chugged and died, chugged again like it was clearing its throat, then roared full on.
"Hoowee! There she goes. Pour the coal to 'er, George, and all hands stand by to repel boarders!"

From Jerry Tidwell, One Family's Journey Through Time (2009):

John W. always punctuated his sentences with Whoowee when he was excited or wanted to make a point. Aunt Mag, the youngest child, was sitting in the back of the wagon and said "Whooowee, I can ride anywhere you can drive!"

From Daniel B. Frank, Deep Blue Funk and Other Stories (1983):

"Y'all ain't seen nothin'," Karl exclaims, "till you've seen my grandmother, boy, whowee! Could she raise the dead with a whuppin'! I remember this one night, my grandmother wanted me to do something and I said, 'no.' Well, I did 'n I saw her start to come after me, so I grabbed the belt off the wall so she couldn't use it on me. And do you know what she did? She went upstairs 'n got an old pipe 'n come after me with it. Whowee, did I run. Run right out the house into the snow with no shoes on!"

And from Clarence Major, Dirty Bird Blues (1997):

"Oowee! Lord, have mercy, look who's here. Speak of the devil," said Trudy, grinning from ear to ear, glancing up at him, as she continued working at an elderly woman's short gray hair.

In the absence of any firmly established authority on the subject, you can decide for yourself which spelling of this exclamation you want to use—and so can everyone else.

UPDATE (11/2/14)
Following up on Joe Blow's suggestion in a comment above, I also found Google Books matches for hoohee, hoo-whee (and hoowhee), whohee, whoohee, whoowhee, whowhee, woohee, and woowee. From James Post, Summer Chickens (and a Velvet Web) (2002):

"Go for it, Bro!" he exhorted the doubtful-looking Barham. "Hoohee, that is some bad blow! Go on, get your beak in the bowl. It ain't like we're poor people, you know what I mean? Get down!"

From Carla Stewart, Stardust: A Novel (2012):

Behind me, Bobby Carl breathed on my neck. "Hoo-whee! That girl sings almost as purty as you. What're you gonna sing when your turn comes?"

From Michelle Sodaro, Whatever You Make of It (2011):

"Sure, Jac, my boy. I sure hope I remember what we were talking about — whohee sometimes my memory short-circuits on me." Henry was smiling as usual.

From Bernard Veale, The Wide Clear Sky (2014):

"Whoohee! He got Yellow Jack? That knocks all tarnation outta a man. He gonna be lucky iffen he ever gets to California." Billy commented.

From Marie Bostwick, A Single Thread (2012):

"Anyway, Heather calls and says that they want to put us on television! Our own show! Quintessential Quilting with Mary Dell and Howard! Can you believe it? Whoowhee!"

From Sarah Shankman, Keeping Secrets (1990):

"Whowhee! That's some brass. They'd have a fit, right?"

From Tom Hron, Whispers of the River (1996):

"Woohee ... I guess I got to raise you two thousand, how you like them apples?
...
"Woohee—mighty big bets to call. You fellows rightly put your chits in . . . and it's only fair that I go all in to call."

And from Mary Monroe, The Butterfly's Daughter (2012):

When they crossed the Red River into Texas, she honked the horn and let loose with a piercing whistle. "That's the Red River, baby!" she shouted, leaning on the horn. "Woowee! That's home!"

No wonder the people at Merriam-Webster are staying far, far away from this issue of orthography.
Comment: "you can decide for yourself which spelling of this expostulation you want to use". Is "hoowee" really an expostulation?
Comment: @EddieKal: No—I completely misused that word. I will change it to "exclamation" (the right word) forthwith. Thanks for pointing out the error.
Answer: Write it any way you want!  There is no standard spelling of this interjection as illustrated by Sven Yargs.  Thankfully, this one place were English still allows improvisation.  Yeehaw, go for it!  (this would have been a comment to the above answer but I don't have enough reputation!!!)
Answer: The OED gives
whoo-ee, int.
Forms:  1800s who-ee, 1800s– hoo-ee, 1900s– whoo-ee. Forms with the letters o and e occurring a greater or lesser number of times are also attested.
Etymology: Extended form of whoo int.
Compare whoopee int., whee int., yippee n. and int., and also cooee n.(Show Less)
1811   Gleaner & Luzerne (Pa.) Advertiser 26 Apr. 3/2   I was half deafened with the cry of—'Who-ee—who-ee—stu-boy—stu-boy.'—A drove of hogs had come along, and..crawled through the broken fence.
1883   A. E. Sweet & J. A. Knox On Mexican Mustang xiii. 175   Wasn't I mad, though..? Hoo-ee! How I did cuss and snort and cavort!
1920   F. S. Fitzgerald This Side of Paradise iii. 120   'There's Findle Margotson, from New Haven!' she cried above the uproar. ''Lo, Findle! Whoo-ee!'
1962   K. Kesey One flew over Cuckoo's Nest i. 26   'Hooeee,' he said, 'look what we got here.'
2003   B. Wagner Still Holding iii. 246   Whoo-eee! We got ourselves a major project acquisition.
Answer: Onomatopoeic (or Echomimetic) words like this are words that imitate sounds. You'll find that in some cases, the these words converge to more frequently used spellings, but there is no hard rule that you must follow.
In 100 Mostly Small But Expressive Interjections, Mark Nichol (Daily Writing Tips) lists many, along with their spelling variations, illustrating the point that there is seldom a consensus for this sort of thing.
For example

Woo and woo-hoo (and variations like yahoo, yee-haw, and yippee) indicate excitement. (Woot, also spelled w00t among an online in-crowd, is a probably ephemeral variant.)

In the same vein, if you write it and it looks right in an echomimetic way, it probably will serve its purpose just fine, and only the most pedantic reader is going to lose focus and second guess you.
Answer: I like Ooo-wee   Ooowee without the h. much like the way they spell the word Shawn  as sene. Now sene sounds like sea   Shawn to me is more proper. You're getting the sha sound for the name of Shawn.
Comment: Hi Dottie, welcome to EL&U. There are some errors in your answer: firstly, if you mean the given name also spelt Shaun, no-one spells it "sene". Perhaps you mean *Sean*? Also, there is no "sha" sound in *Shawn*. But the main problem with your post is that it's simply a personal opinion on what you like. That might suit a discussion forum, but EL&U is a more formal Q&A site. Please read [answer] and take the EL&U **[Tour]** to get a better sense of what we're after. :-)
Comment: "they spell the word Shawn as sene" - who does that?

How do you spell 'hoo-wee!'


I'll Sleep now vs I'll go to sleep now

Question: While talking to a friend over phone if I am feeling sleepy and before hanging up I want to convey to my friend that I want to sleep now. How should I say that?
Comment: You could try "Now I must climb the wooden hill" and see what reaction you get.
Answer: You should say, "I'm going to bed now", or perhaps "It's been great talking to you, but I'm getting a little tired and I think I'm going to go to bed now."
You shouldn't say "I'll sleep now", nor "I'll go to sleep now" - it just sounds a bit odd to use will here.
Comment: There are some informal expressions that can be used as well, like "catch some z's" (for a nap) or "hit the hay" (for going to bed for the night).

I'll Sleep now vs I'll go to sleep now


Why are my files getting corrupted?

Question: I have a folder with several image files. I am able to preview them fine, but I am not able to edit them. I tried to open one with a program such as Paint, but I was told that I don't have permission. So I tried dragging that file to the desktop and tried opening it there, but then it said that it's open in another program, but that wasn't true. Now for some reason, I can't even preview the image any more. This happened to another one already, and it doesn't make any sense. Why is this happening, and how can I fix this?
Comment: .... Did you get hit with a Ransomware virus?
Comment: I have 360 Total Security installed, and it hasn't detected any virus. I suppose it's still a possibility though. What should I do?
Comment: Disconnect from the network, and scan with a bootable anti virus CD
Answer: This sounds like ransomware. You will need to run a boot scan with a several programs to ensure removal. You will need to act FAST. unfortunately encrypted files are virutally impossible to recover. Your best bet is to take your PC down to your local computer repair and have them remove the ransomware for you.
The only other possibility is a slowly dying storage device especially on flash storage.
Comment: Thank you for the feedback, guys. I did some research since I never heard of ransomware before, and I found out that a program called Bitdefender can remove it. Since you said I need to act fast, would you recommend that I give this program a shot?

Why are my files getting corrupted?


Difference between 鞠 and ボール

Question:
僕はまりみたいに弾んだ。
I bounced like a ball.

This is the fist time I've come across the word まり.

Are there differences in usage between まり and ボール?
Is it usual to write it in kanji, 鞠?
Is まり more formal or is it perfectly normal in casual conversation?
Answer: First of all, we seldom use まり in a daily conversation. We come across the word when learning a traditional Japanese culture called [蹴鞠]{けまり} at school. It seems to be similar to a volleyball you use feet instead of hands. We do not see this play other than a traditional ritual like this picture.

For, No.1,3 ボール in katakana and [球]{たま} or [球]{きゅう} in kanji are only used in a daily life.

For No.2 Yes. When you want to describe a ball in archaic way, it can be used although we seldom see the kanji.
Answer: We sometimes use the word 'まり' for balls without specific purpose defined but just a children's toy. Traditionally, kids would have played まりつき, まりなげ or other まりあそび with simple rubber-made balls, and such balls could be called as 'ゴムまり' or simply 'まり'. These days they are almost replaced by better crafted balls like soccer or basket balls.
Another usage of 'まり' is colorful thread-woven ball-shape objects which should be displayed in special occasions like ひなまつり or alike.
Of course, 蹴鞠 is great example of use of the word, that is the game traditionally played among ancient Kyoto nobles in Heian period, and nowadays demonstrated as scenic presentations.
There is another kanji for まり, which is '毬' but this does not make any great difference against use of 鞠, while they suggest its materials (毛糸 or 皮革) but in most cases people does not care much about that point.
The word まり has its own context and is OK even in casual conversations if it is natural enough, but, if it is out-of-context, most of ボールs should not be called as まり, and it won't be taken as formal wording.

Difference between 鞠 and ボール


Which is more efficient, basic mutex lock or atomic integer?

Question: For something simple like a counter if multiple threads will be increasing the number. I read that mutex locks can decrease efficiency since the threads have to wait. So, to me, an atomic counter would be the most efficient, but I read that internally it is basically a lock? So I guess I'm confused how either could be more efficient than the other.
Comment: Should this answer be for all platforms and programming languages supporting pthreads or some subset? I do not completely understand the relationships between pthreads, operating systems and programming languages but it seems these relationships could be relevant.
Answer: Atomic operations leverage processor support (compare and swap instructions) and don't use locks at all, whereas locks are more OS-dependent and perform differently on, for example, Win and Linux.
Locks actually suspend thread execution, freeing up cpu resources for other tasks, but incurring in obvious context-switching overhead when stopping/restarting the thread.
On the contrary, threads attempting atomic operations don't wait and keep trying until success (so-called busy-waiting), so they don't incur in context-switching overhead, but neither free up cpu resources.
Summing up, in general atomic operations are faster if contention between threads is sufficiently low. You should definitely do benchmarking as there's no other reliable method of knowing what's the lowest overhead between context-switching and busy-waiting.
Comment: "Locks actually suspend thread execution" this is not true in a general sense. You can have a spin lock or a non-spin lock. It entirely depends on how the lock is implemented and it's critical that you, as a programmer, know what kind of lock you're using.
Comment: I'm a bit confused that you say atomic operations dont use locks at all. If I look at the assembly code generated for `compare_exchange()` function in C++, it has instruction `lock cmpxchg %rcx,(%rsi)` (on x86).
Answer: If you have a counter for which atomic operations are supported, it will be more efficient than a mutex.
Technically, the atomic will lock the memory bus on most platforms.  However, there are two ameliorating details:

It is impossible to suspend a thread during the memory bus lock, but it is possible to suspend a thread during a mutex lock.  This is what lets you get a lock-free guarantee (which doesn't say anything about not locking - it just guarantees that at least one thread makes progress).
Mutexes eventually end up being implemented with atomics.  Since you need at least one atomic operation to lock a mutex, and one atomic operation to unlock a mutex, it takes at least twice long to do a mutex lock, even in the best of cases.
Comment: It is important to understand it depends how well the compiler or interpreter supports the platform to generate the best machine instructions (in this case lock-free instructions) for the platform. I think this is what @Cort Ammon meant by "supported". Also some mutexes might make guarantees about forward progress or fairness for some or all threads that are not made by simple atomic instructions.
Answer: A minimal (standards compliant) mutex implementation requires 2 basic ingredients:

A way to atomically convey a state change between threads (the 'locked' state)
memory barriers to enforce memory operations protected by the mutex to stay inside the protected area.

There is no way you can make it any simpler than this because of the 'synchronizes-with' relationship the C++ standard requires.
A minimal (correct) implementation might look like this:
class mutex {
    std::atomic<bool> flag{false};

public:
    void lock()
    {
        while (flag.exchange(true, std::memory_order_relaxed));
        std::atomic_thread_fence(std::memory_order_acquire);
    }

    void unlock()
    {
        std::atomic_thread_fence(std::memory_order_release);
        flag.store(false, std::memory_order_relaxed);
    }
};

Due to its simplicity (it cannot suspend the thread of execution), it is likely that, under low contention, this implementation outperforms a std::mutex.
But even then, it is easy to see that each integer increment, protected by this mutex, requires the following operations:

an atomic store to release the mutex
an atomic compare-and-swap (read-modify-write) to acquire the mutex (possibly multiple times)
an integer increment

If you compare that with a standalone std::atomic<int> that is incremented with a single (unconditional) read-modify-write (eg. fetch_add),
it is reasonable to expect that an atomic operation (using the same ordering model)  will outperform the case whereby a mutex is used.
Answer: atomic integer is a user mode object there for it's much more efficient than a mutex which runs in kernel mode. The scope of atomic integer is a single application while the scope of the mutex is for all running software on the machine.
Comment: This is almost true.  Modern mutex implementations, like Linux's Futex, do tend to leverage atomic operations to avoid the switch to kernel mode on the fast path.  Such mutexes only have to jump into kernel mode if the atomic operation failed to do the desired task (such as the case where the thread needs to block).
Comment: I think the scope of an atomic integer is *a single process*, which is significant insofar as applications can be comprised of multiple processes (e.g., Python multiprocessing for parallelism).
Answer: The atomic variable classes in Java are able to take advantage of Compare and swap instructions provided by the processor.
Here's a detailed description of the differences:  http://www.ibm.com/developerworks/library/j-jtp11234/
Answer: Most processors have supported an atomic read or write, and often an atomic cmp&swap. This means that the processor itself writes or reads the latest value in a single operation, and there might be a few cycles lost compared to a normal integer access, especially as the compiler can't optimise around atomic operations nearly as well as normal.
On the other hand a mutex is a number of lines of code to enter and leave, and during that execution other processors that access the same location are totally stalled, so clearly a big overhead on them. In unoptimised high-level code, the mutex enter/exit and the atomic will be function calls, but for mutex, any competing processor will be locked out while your mutex enter function returns, and while your exit function is started. For atomic, it is only the duration of the actual operation which is locked out. Optimisation should reduce that cost, but not all of it.
If you are trying to increment, then your modern processor probably supports atomic increment/decrement, which will be great.
If it does not, then it is either implemented using the processor atomic cmp&swap, or using a mutex.
Mutex:
get the lock
read
increment
write
release the lock

Atomic cmp&swap:
atomic read the value
calc the increment
do{
   atomic cmpswap value, increment
   recalc the increment
}while the cmp&swap did not see the expected value

So this second version has a loop [incase another processor increments the value between our atomic operations, so value no longer matches, and increment would be wrong] that can get long [if there are many competitors], but generally should still be quicker than the mutex version, but the mutex version may allow that processor to task switch.
Answer: Mutex is a kernel level semantic which provides mutual exclusion even at the Process level. Note that it can be helpful in extending mutual exclusion across process boundaries and not just within a process (for threads). It is costlier.
Atomic Counter, AtomicInteger for e.g., is based on CAS, and usually try attempting to do operation until succeed. Basically, in this case, threads race or compete to increment\decrement the value atomically. Here, you may see good CPU cycles being used by a thread trying to operate on a current value.
Since you want to maintain the counter, AtomicInteger\AtomicLong will be the best for your use case.


Cup products in the Mayer-Vietoris sequence

Question: Let $(X;U,V)$ be an excisive triad and consider the corresponding part of the Mayer-Vietoris sequence $H^{\bullet-1}(U\cap V)\stackrel{\delta^*}{\to} H^\bullet(X)\to H^\bullet(U)\oplus H^\bullet(V)$. Now let $\alpha,\beta\in H^{\bullet-1}(U\cap V)$. Can we say anything about $\delta^*(\alpha\smile\beta)$?
Comment: I don't think you can in general, but if $\alpha$ is the restriction from $X$ of $\alpha'$, then $\delta^*(\alpha \cup \beta) = \alpha' \cup \beta$. You can check this by properly choosing a lift of $\alpha \cup \beta$ as a chain to $U$ ($\alpha'|_U \cup \beta'$ for some lift $\beta'$).
Comment: Can you extend on our argument or do you have a reference for it? This formula would be great, but I only find the version for the relative cohomology sequence.
Answer: Here are some comments.
The map $\delta^\ast$ is a composition of the form
$\require{AMScd}$
\begin{CD}
H^{\ast-1}(U\cap V) @> \sigma >\cong > H^{\ast}(\Sigma (U\cap V)) \to H^\ast X
\end{CD}
where the first map is given by the suspension isomorphism and the second is induced by the map $X\to \Sigma(U\cap V)$ which cones off $U$ and $V$ in $X$ (here $\Sigma$ means suspension). This second displayed map is cup product preserving so it is sufficient to investigate the first map.
Setting $Z = U\cap V$,  represent your cohomology classes as maps
$a: X \to K(\Bbb Z,k)$, $b: X \to K(\Bbb Z,\ell)$ (where we the Hopf classification theorem to identify $H^k(X)$ with  $[X,K(\Bbb Z,k)]$, where $K(\Bbb Z,k)$ is the Eilenberg-Mac Lane space). Then $a\cup b$ is given by
$\require{AMScd}$
\begin{CD}
X @>\text{diag} >> X \wedge X @>a\wedge b>> K(\Bbb Z,k)\wedge K(\Bbb Z,\ell) @> m >> K(\Bbb Z,k+\ell)\, .
\end{CD}
where $m$ represents the evident cohomology class in degree $k+\ell$ of the smash product (using the Künneth formula).
The class $\sigma(a\cup b)$ is given by
\begin{CD}
\Sigma X @>\Sigma \text{diag} >> \Sigma X \wedge X @>\Sigma a\wedge b>> \Sigma K(\Bbb Z,k))\wedge K(\Bbb Z,\ell) @>\Sigma m>> \Sigma K(\Bbb Z,k+\ell)\to K(\Bbb Z,k+\ell+1)\, ,
\end{CD}
where the last map represents the generator of
$H^{k+\ell+1}(\Sigma K(\Bbb Z,k+\ell))$.
Comment: What is a reference for this description of the Mayer-Vietoris map $\delta^\ast$? I haven't seen it in Hatcher, Dold, Spanier, etc. (albeit the standard references seem to only elaborate on the homological MV unless it's using de Rham cohomology). I take it "cones off" means pinches off $U-(U\cap V)$ and $V-(U\cap V)$ separately in $X$. I like this description because then it's easy to see that elements in $Im(\delta^\ast)$ have trivial (cup product) square.
Comment: I don't know of a  reference; it's probably folklore. It is a reinterpretation that uses the Barratt-Puppe sequence. There's a cofiber sequence $X \to \Sigma (U \cap V) \to \Sigma U \vee \Sigma V$, where $\Sigma$ means unreduced suspension. The sequence  wiill induce the Mayer-Vietoris sequence on cohomology.
Comment: "cones off" refers to the following: There is an inclusion $X = U \cup_{U\cap V} V \to CU \cup_{U\cap V} C V \simeq \Sigma (U\cap V)$, where $C$ means the unreduced cone.


HTML markup is still stripped out, even if I am using the mimemail-message.tpl.php template

Question: I'm having an issue where confirmation emails from Ubercart seem to have  HTML markup removed. In my setup somehow the HTML markup in the Ubercart email template is being stripped when it reaches the mimemail template. A view of the source for emails sent shows that the HTML markup Mimemail puts into the message is there. It's just everything coming from Ubercart that is stripped out.
The line 35 of the mimemail-message.tpl.php template file is the following one
<?php print $body ?>

This is where the problem lies. All the HTML markup above and below this makes it into the email. However, the HTML markup that should be in the $body variable is stripped out.
Is there something I could be missing in my settings?
Answer: I added the htmlmail module and this fixed the problem.


How to catch INSUFFICIENT_OUTPUT_AMOUNT Error?

Question: I'm trying to create a trading bot and I noticed that even when a transaction is 100% gonna fail, the swapExactTokensForTokens still pushes through hence paying gas fee. My question is, how does Pancakeswap know that a transaction is gonna fail before executing it? How do we catch errors so that we don't have to pay gas fees for a transaction that's gonna fail?
Answer: If i'm understanding your question correctly, you should be able to trigger this with revert, require, assert. The error INSUFFICIENT_OUTPUT_AMOUNT is like a string that is being returned when something is being violated on the contract side.
Comment: I'm trying to do a pre-blockchain check so that I don't have to pay for gas fees just to know if a transaction will fail or not. I'm not sure how uniswap does it though and I'm finding it hard to find information online.
Comment: Usually if a transaction will revert, it'll show up in metamask before the tx is submitted. This is the difference between the different error statements. For example, in the case of `assert` there is 0 gas refunded, whereas in the case of `require` all remaining gas is refunded if you try to force an invalid tx through. Not sure if this is what you meant!
Comment: I actually found out that estimateGas throws different exceptions and I think that has similar effect to how uniswap/pancakeswap check for errors before the transaction. I just thought that function would just return the estimated gas basing on its name so it was a bit misleading.
Answer: When calling swapTokensForExactTokens (see interface below) make sure that amountInMin is using getAmountsOut(uint amountIn, address[] memory path), as that is what the contract is checking against


Is it correct to say "it is forty-five past nine"?

Question: I had a quiz and I failed because I wrote that 9.45 was "forty-five past nine" instead of "quarter to ten". I think it should have been accepted by my teacher. I searched the Internet and I found the possibility of saying so.
Is it correct to say "it is forty-five past nine"?
Comment: It's grammatical, but not idiomatic. The kind of thing a spy will pay for with his life. Your teacher is saving lives.
Comment: I would say that technically, your answer is correct, but, as Andrew said, it's not generally spoken that way. As to whether or not the teacher was justified in marking you wrong, that depends on the motive of the question and the test. If the lesson was on normal conventions for speaking times, and the lesson material reflects what @Andrew says in his answer, then the teacher rightly marked it wrong. But if the question was a math problem (i.e., "Two trains leave New York at 7am..."), then, if I were the teacher, I'd have to let "forty-five past nine" slide, even if I'd say it differently.
Comment: Actually, in these days of digital timepieces, "quarter to ten" is becoming uncommon, too.  We just say "nine forty-five".  But without the "past".
Comment: Reminds me of this (http://ca.answers.yahoo.com/question/index?qid=20100820085024AAF43U5) I'm sure the teacher must have mentioned the point of the lesson at some time was to understand telling time in a way that is consistent with common usage (for whatever culture that was being discussed.)
Comment: As an English Learner, you might find our sister-site, [English Language Learners](http://ell.stackexchange.com), to be a better fit for you.
Answer: Just because someone has written it on the internet does not make it correct.
In English speech, times up to "half-past" the hour are "past"; after that they are "to" the next hour.
When writing times in figures it's not possible to indicate "to the next hour", so with figures it's always written like "9:45". To say the time you either read it as "nine forty-five" or convert it to "a quarter to ten".
There is one very specific exception, when talking of timetables. A train which occurs at (say) 9:47, 10:47, 11:47 etc. might be said to leave at "forty-seven minutes past the hour". But this is only used for this specific timetable instance; and note that the word minutes is used — it's never just "forty-seven past ten".
[Note that American English can also use "of" instead of "to".]
Comment: Great answer!  As a Canadian I have never heard _of_ replacing _to_ in time-telling but Googled it and sure enough those crazy Americans do in fact do it on occasion. News to me. The only other regional variation you missed is, Americans and Canadians never say _past_; instead they/we say _after_.
Comment: @ShawnMooney As an American, I frequently say _past_, as in "half past seven."
Comment: @ShawnMooney As an (eastern) Canadian I sometimes say "twenty past", though I usually use "twenty after". Perhaps I've picked up an influence from British TV though.
Answer: In English we don't really say '45 past 9' for times. Times up to half past are said as '10, a quarter, 20 past, etc. Those between half past and the next hour are said as '20, a quarter, 10 TO', meaning the next hour.
Digital type times as you've said are worded as 9.45 am.
Answer: In the US the younger generation is getting away from the "quarter of" format. They see almost all times as digital. So they see it in the lower corner of the computer screen, in the center of their smart phone, and in text messages or tweets. Sometimes I have even had to clarify that "Five of ten" is the same as 9:55. Also the "X of format" doesn't work with the 24 hour or military time system, nobody says "quarter of Fifteen-hundred".
In the United States "Nine Forty-Five" would have been the best answer.
Answer: Forty-five past nine is not wrong, but, in classic computer hacker jargon, it is non-canonical. That is to say, it is contrary to the usual or standard manner.
Answer: If you are putting it down on a test, or for homework, it is not advised, but for everyday use, nobody will stick their noses up at you!


Not being able to start lightdm

Question: I'm trying to use lightdm service for my workstation but not being able to enable it.
I have removed gdm.service using yum remove gdm and currently at init 5.
Now if I pass the command
systemctl enable lightgdm.service

I'm getting an error:

Failed to execute operation: File exists.

And if I run
systemctl status lightgdm.service

it shows:

lightdm.service - Light Display Manager
Loaded: loaded (/usr/lib/systemd/system/lightdm.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:lightdm(1)

Upon reboot the system comes as black screen.
Current status of the system:
$ systemctl list-unit-files | grep gdm
gdm.service masked
$ systemctl list-unit-files | grep display
display-manager.service masked
$ systemctl list-unit-files | grep lightdm
lightdm.service diabled

How to enable lightdm then?
Answer: You have to disable the GDM service before you enable the LightDM service.  With Yum you just uninstalled the GDM package which is not the same as the associated SystemD service.

Not being able to start lightdm