What are bitcoin miners really solving?

Question: As with mining, what are the bitcoin miners really solving? I read they are solving hashes, but what does that really mean. Can we see what they are solving? Can someone give an example of what a bitcoin mining machine sees to solve?
Comment: Related: http://bitcoin.stackexchange.com/q/148/153
Comment: Ok but WHAT data are we mining! Nobody seems to know. I don't care how it works I want to know where the data is coming from that bit mining is decryption or encrypting.
Comment: Here is a visual, gamified version of the problem that bitcoin miners are typing to solve. It is literally a bincoin miner, and if you solve the problem then you win a bitcoin.
http://hashhunt.josh.com/
Answer: Here is an extremely simplified sketch of the problem, but it should give a pretty good idea of what the problem is.
The data:
This is the hash of the lastest block (shortened to 30 characters):
00000000000001adf44c7d69767585

These are the hashes of a few valid transactions waiting for inclusion (shortened).
5572eca4dd4
db7d0c0b845

And this the hash of one special transaction that you just crafted, which gives 25BTC (the current reward) to yourself:
916d849af76

Building the next block:
Now, let's use a gross approximation of what a new block might look like (the real one uses binary format). It contains the hash of the previous block and the hashes of those 3 transactions:
00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--

Now let's do mining by hand! Our goal is to complete this block with a nonce (a piece of garbage) such that the hash of the new block starts with 13 zeros (considering the previous hash, it seems that 13 zeroes is the current difficulty!).
Mining (trying to finalize this block):
Let's try with nonce=1, and compute the hash of the block (I'm using the md5 hash algorithm, but Bitcoin uses double sha256):
> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--1" | md5sum
8b9b994dcf57f8f90194d82e234b72ac

No luck, the hash does not start with a 0… Let's try with nonce=2
> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--2" | md5sum
5b7ce5bcc07a2822f227fcae7792fd90

No luck…
…
If we pursue until nonce=16, we get our first leading zero.
> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--16" | md5sum
03b80c7a34b060b33dd8fbbece79cee3

For nonce=208, we get two leading zeroes!
> echo "00000000000001adf44c7d69767585--5572eca4dd4-db7d0c0b845-916d849af76--208" | md5sum
0055e55df5758517c9bed0981b52ce4a

Continue like this… If you finally find a hash that has 13 leading zeroes… you're a winner! Other miners will now build upon your block, you've just got 25BTC.
But you'll have to be fast!
Back to step 1…
If someone manages to build a block before you do, you'll have to start again from the beginning with the new block's hash (the one of the winner).
Comment: Also your example is conceptually heading in the right direction, but the real success is when the sha256 hash of the header is less than the target. Example target: `00000000000001ae00000000000000` is greater than `00000000000001adf44c7d69767585`     <-- this would be a valid hash.
Comment: @Reonarudo, not exactly, this is a very simplified sketch of what is actally done. Transactions are made with scripts which are often made from adresses, you can find more info on the Bitcoin wiki.
Comment: This basically sounds like a nice (simplified) summary, but at what point does the bitcoin network accept this as _the_ next valid block, and what happens in the (unlikely) event that two different miners managed to submit a valid block almost simultaneously?
Comment: 1) Yes everyone starts over, if you build on top of an old block there's little chance your blocks will be part of the longer chain and they will be disregarded by the rest of the network. There is no guaranty that a block is find within 10 minutes, it's just an average statistical outcome. 2) What transaction? Blocks are broadcast by whoever mined them and relayed by other nodes. 3) Nothing forces you to include all pending transactions, but the more transactions you include the more fees you can collect.
Comment: Wow, great answer! There're a couple of things I still couldn't get my head around though: Let's say you've been searching for a solution for 6 minutes and there comes a new transaction. 1) what happens now? if I have to start over, then that sounds like everyone has to start over. Then how can blockchain guarantee to find a block in ~10 minutes? 2) How does that transaction come to me anyway? 3) What if I find a solution for this block and then a new transaction comes to me from some other node who accepted it for the block I just closed?
Comment: Note that you're not actually "counting zeroes". In reality approximately the first four non zero numbers are being compared with something called a "target".  This is stored in compact form in each block in a field called "bits".
Comment: "And this the hash of one special transaction that you just crafted and which gives 25BTC (the current reward) to yourself: 916d849af76" How is this transaction crafted?
Comment: @Reonarudo: the simplest is to use one of your addresses to produce a single standard output to be spent, but you can forge any kind of custom transaction with custom scripts as well if it pleases you (you are allowed a +25 BTC total balance for this transaction, additionnal inputs were not allowed some time ago, but maybe they are now).
Comment: So normally I would just append my wallet address in the end between - and --?
Comment: 2) The transaction to be added to current block, the one that caused me and all(?) others to restart the calculation. How does it come to me? And also, 3) Why would I accept it for 0.001 btc if I am to find a new block and get 25 btc?
Thanks Stephane!
Answer: The following is a description of the global, statistical gamble which is played every 10 or so minutes.  The interval of the game is controlled by the difficulty which says how many "hashes" are needed per interval.
In other words, the difficulty and target define the "odds of the house" against your chance of getting a winning SHA hash.  The nonce is the "scratch off" area.
Each hash consumes electricity, and emits heat, which requires additional cooling.
This is what is done with each hash:
Step 1
At a high level, the miner software takes a list of active transactions, and then groups them together in something called a "block".
Or more accurately stated: The miner software coverts all the transactions into a summary view called a  "merkle root", and hashes it, which is representative of the transactions.
Step 2
Then mining software converts this to into a binary format called a Block Header, which also references the previous blocks (also called a chain).
Field           Purpose                          Updated when...               Size (Bytes)
Version         Block version number             You upgrade the software and   4
                                                 it specifies a new version

hashPrevBlock   256-bit hash of the previous     A new block comes in          32
                block header
hashMerkleRoot  256-bit hash based on all        A transaction is accepted     32
                the transactions in the block

Time            Current timestamp as seconds     Every few seconds              4
                since 1970-01-01T00:00 UTC

Bits            Current target in compact format   The difficulty is adjusted   4

Nonce           32-bit number (starts at 0)       A hash is tried (increments)  4

Step 3:
The miner hardware changes a small portion of this block called a "nonce".
Step 4:
The block header is hashed and compared to the Target as if it were simply a large number like 10,000,000 > 7,000,000  (the real numbers are much bigger, and in hex).  The target is compressed and stored in each block in a field called bits.
An expanded target looks like this:
  Target   0000000000000083ef00000000000000000000000000000000000000000000000

And the goal is to make sure the SHA256 hash of the block is less than this value.  In the example below "83ee" is smaller than "83ef"
To simplify this concept, you can ballpark the target by counting the leading zeros (as the other answer here explains).  Here is an example:
Here is a sample block with transactions you can view on BlockChain.info. Look in the upper right hand corner of the webpage for this hash:
   Hash 0000000000000083ee9371ddff055eed7f02348e4eda36c741a2fc62c85bc5cf

That previous hash was from today and has 14 leading zeroes.  Let's compare that to what was needed 3 years ago with block 100 which has 8 leading zeros.
   Hash 00000000a8ed5e960dccdf309f2ee2132badcc9247755c32a4b7081422d51899

Summary
So at the end of the day, all a miner does is:

Take a block header as input
Change the Nonce
Test if the Block Header hash is less than the Target.  If it is, you win.
Go to step 2  (or go to step 1 if someone else won the block)

Want to see what Bitcoin-QT does when it finds a block?... I posted it here.. The information in this post will help you understand what happened.
Comment: Yup, you're right, ...from the URL on the Block header: `Whenever Nonce overflows (which it does frequently), the extraNonce portion of the generation transaction is incremented, which changes the Merkle root.`
Comment: Isn't the nonce (32 bits) far too small to be able to find a hash that must start with 14 leading zeroes (14x4 = 56 bits) ?  Finding such a hash would require on average 2^56 / 2 attempts and with a 32 bit nonce only 2^32 attempts are possible before all possible nonce values are exhausted.  Edit: with the time changing every second, I guess this only applies if hash rate exceeds 4 GH/sec (which I think it does...)
Comment: Best answer I've been able to grok so far. I still don't get how a target is established nor do I fully understand the significance of generating a hash lesser than the target. So a hash is generated closest but lesser that the target, why is that important? Is it because it is theoretically the most complex hash so it's the most (or really close to being the most) difficult hash to crack?
Comment: @VanceMcCorkle Among bitcoin mining equipment, it's a race among who can press the gas pedal the furthest without blowing up the engine. Every piston movement creates a hashcode ( so to speak). The significance is only a >>RACE TO BURN OIL<<. Bitcoin should be sponsored by Big Oil and Coal.
Comment: @ChristopherJonMankowski Except that where I live here in Washington state is literally powered by rain water (Grand Coulee Dam). Plus I rent green hosting space for miners. Nevertheless, still I have found no clear explanation on the block validation process that makes sense to me yet. Although I have yet to read the Bitcoin Standard.
Comment: @VanceMcCorkle try calculating the cost per Gigahash or Terrahash per energy FOREX cost. That is the industrial cost of capitalism, but not the TCO equivalent of other debts and tradeoffs of ecology not considered as they are hidden by governance and politics to get somewhere.
Answer: They try to find a random nonce (a little random data) that goes into a block and makes the block have a (SHA256) hash that (in binary) starts with a certain amount of 0's. The more zeroes the more rare hash is. A good hash' outcome is not predictable, and so you have to try a lot of times to find a good nonce.
The amount of zeroes are based on how difficult it is supposed to be to find a block. In Bitcoin it adjusts to have a new block every 10 minutes (on average, given the rate at which previous blocks are found).
Interesting: because the hashes are unpredictable it doesn't matter how the nonce changes! Most of the time it's just a number counting upwards from 0!
Answer: Mining provides a way to reach consensus on what the transaction ledger should look like and know that nobody is cheating.
That's the non-technical definition of mining.

What exactly is Mining?

The "authority" for double spending is the blockchain.  The blockchain consists of the history of all blocks in the blockchain plus the next block of transactions.  The reward subsidy currently is 25 BTC to the party that submits the next block.  But hey ...you would like that 25 BTC (worth currently about $825) as would I as would everyone else.  So how do you make it so that I can't cheat and claim the block myself?
Well, you put in a system that you and I have to compete.  That's what the proof of work does -- it makes it so that when I claim the reward it is easy to prove that I really did the work involved.  So for me to have a 2% chance of solving a block I need to put in 2% of of the mining work.  There's no way for me to put in less than 2% of all the work and still solve blocks at least 2% of the time (on average).
Thus as a result, when a transaction block is submitted, all the peers verify that there were no double spends, that the right amount of subsidy was claimed, and that the submitter truly expended the work necessary for that solution.  With those three rules, then there doesn't not need to be a central authority managing the process or able to control the outcome.
Answer: Miners guess a random target number that solves an equation generated by the Bitcoin Protocol. Of course, computers make this guess, not people.
Bitcoin blockchain uses the Secure Hash Algorithm SHA-256 to generate a 32-byte numbers of the same length in a way that requires a predictable amount of processor efforts. In order to receive a cryptocurrency reward (and record "legitimate" transactions in the ledger) miners are solving blocks' hash that meet a certain criteria (established by system).
A "guess number" is formed from a final hash of current block hash, nonce, data and previous block hash. A brute-force search is repeated until miners discover a hash that is less than the target number.

Answer: Bitcoin miners are solving complex mathematical puzzles in a process called proof-of-work, which helps secure the Bitcoin network and create new bitcoins. These puzzles are based on cryptographic hash functions, and the main goal is to find a specific input called a nonce that, when combined with the transaction data and previous block's hash, produces an output (a hash) that meets certain requirements, such as having a specific number of leading zeros.
The puzzles are designed to be hard to solve, requiring a lot of computational power, but easy to verify once the solution is found. Miners are essentially searching for a needle in a haystack by trying different nonces until they find the one that meets the required conditions.
The process of solving these puzzles serves two main purposes:
Securing the network: The proof-of-work process makes it difficult for anyone to attack the network or manipulate transaction data. To do so, an attacker would need to control more than 50% of the total mining power, which is highly unlikely given the distributed nature of the network and the vast amount of computational resources required.
Creating new bitcoins: Miners who successfully solve the puzzle and add a new block to the blockchain are rewarded with newly created bitcoins (the block reward) and transaction fees from the transactions included in the block. This serves as an incentive for miners to contribute their computational resources and helps maintain a controlled and predictable supply of new bitcoins.
As more miners join the network and the total computational power increases, the difficulty of the puzzles automatically adjusts to ensure that a new block is added to the blockchain approximately every 10 minutes. This self-adjusting mechanism helps maintain the security and stability of the Bitcoin network.
Bitcoin miners solve a complex mathematical puzzle, called proof-of-work, to generate new bitcoins and secure the network. This puzzle is based on a cryptographic hash function called SHA-256, and the goal is to find a specific input (called a nonce) that results in a hash value that meets certain requirements. Here's a detailed explanation of the process:
Preparing the block: Miners gather recent, unconfirmed Bitcoin transactions and organize them into a data structure called a block. Each transaction is checked to ensure it's valid and not a double-spend attempt. The block also contains a reference to the previous block in the blockchain (by including its hash) and a timestamp.
Calculating the target: The Bitcoin network adjusts the puzzle's difficulty based on the total mining power to maintain an average block generation time of 10 minutes. The difficulty determines the target value for the hash. The target is a 256-bit number, and miners must find a hash that is equal to or lower than this target.
Finding the nonce: Miners generate the hash by combining the block's data, the previous block's hash, and a nonce (a random number). They repeatedly change the nonce and recompute the hash until they find a hash that meets the target requirement. Since hash functions are unpredictable, miners must try many different nonces before finding a valid one. This process is computationally intensive and requires a lot of trial and error.
Proof-of-work: Once a miner finds a valid nonce, they have effectively solved the puzzle and completed the proof-of-work. The valid nonce proves that the miner has expended a significant amount of computational effort to find the solution, thus securing the network.
Broadcasting the block: The miner broadcasts the solved block, along with the valid nonce, to the entire network. Other nodes in the network verify the block and its proof-of-work. If it's valid, they add the block to their local copy of the blockchain.
Block reward: As a reward for solving the puzzle and adding a new block to the blockchain, the miner receives newly created bitcoins (the block reward) and the transaction fees from the transactions in the block. The block reward serves as an incentive for miners to contribute computational resources and secures the network.
This entire process ensures that the Bitcoin network remains secure, transactions are confirmed, and new bitcoins are generated in a controlled and predictable manner. As more miners join the network and the total computational power increases, the difficulty of the puzzle automatically adjusts to maintain the 10-minute block interval, keeping the system stable and secure.

What are bitcoin miners really solving?


Why is my computer running slower after I just installed more RAM and a new HDD?

Question: I just bought 4 GB of ram (2x2GB) and a 1TB hard drive and installed them, upgrading from my original 1GB RAM and 250GB HDD. I put the 2GB sticks in 1st and 3rd slots and the 1GB stick in 2nd. Now with my new ram and HDD my computer is running MUCH slower and I dont know why. I've tried restarting just to see what happens and I noticed that even the Windows XP starting music is lagging. If anyone could help that would be fantastic. It's hard even to type this out.
Comment: Is the RAM the same clock speed and CAS Latency as the original stick?  You now have 5 Gig of RAM and now set to single channel (per the config explained above).  Is it a 64-bit OS?  What kind of spindle speed does the hard drive have?  What is the cache?
Comment: RCIX, there are plenty of disk clone utilities that work fine. Ghost, Acronis, and there are many highly recommended free utilities. I agree that when changing a major component like a motherboard, you're probably best to reinstall, but not a HDD.
Comment: BTW, in general, it's probably best to do a new install anytime you get a new HDD.
Answer: Drop the 1GB stick as you will lose dual channel mode which speeds the machine a lot.
If you have used a tool to merge one hard drive to another, you may want to run scandisk / defrag the new drive and just make sure everything is working the way it should.
If this is just a second drive, unless using IDE (instead of SATA), that shouldn't be causing these problems.
Comment: Scoop, dual channel can improve performance by as much as 15-20% in certain situations. Having 5GB RAM in a 32-bit environment is actually a total waste.
Comment: @caliban: A 32 bit OS can only access around 3.5GB of RAM. Therefore the extra GB is not helping at all.
Comment: Dual Channel Mode has been proven over and over again to deliver extremely insignificant performance improvements. Do not drop the 1GB, more RAM is better.
Answer: Well, first of all you should run just the 2GB sticks, you probably don't have XP x64, so the additional GB does nothing except drop your RAM out of dual channel mode. That alone shouldn't cause this problem though.
Did you add the 2nd HDD as a secondary drive, or did you use a disk clone utility to move the contents of the 250GB to the 1TB?
Open task manager, make sure "Show Processes from all Users" is checked, and sort by CPU usage, what is taking up the most CPU. Also, what does it tell you about your RAM, is it full, or do you have some headroom.
Are these the only two things you upgraded?
What is the make/model of your computer. If it is custom built, what is the hardware in it?
Does this slowdown still happen in safe mode?
Have you used a RAM testing bootable utility such as memtestx86+ from http://www.memtest.org/ ?
If you remove the new RAM and HDD, does this still happen? If it doesn't, add the components one at a time, until you can find out what the culprit is.
You need to do some basic troubleshooting before anyone can even begin to guess at the problems you are having.
Answer: I have had this persistent problem with my PC and it is accompanied by choppy sound.  It seems the HDD defaults to PIO mode if there are too many communications errors.  I fix it by unistalling my ATA/IDE drivers under "Devices" but it is a temporary solution since after a while teh comm errors build up and the machine goes back to PIO mode.
Answer: Check your motherboard. It may only be capable of handling 2GB of RAM, especially if it's an older XP computer. (My old Dell PC could not understand more than 2GB)
Answer: Download Process Explorer.  While Process Explorer is running, do something that takes a long time to run.  Note which process is taking all the CPU.  If it is a process called Interrupts, then your hard drive needs to be set to a DMA mode (it's probably running in PIO mode).
Read here on how to revert back to the DMA mode. Mostly, you can take care of the problem by running this script and then rebooting the box.
Finally, you honestly do not need 5 GB on a Windows XP 32-bit edition, though it is most likely not the problem here.  Remove the 1GB stick, it is totally superfluous.  The only use I could see for it is if you want to use RamDisk Plus from SuperSpeed - it does let you create RamDisks that utilize memory from the beyond the 3.5GB limit.
Answer: Check, in Device Manager, to make sure that Windows is using UDMA moed to access the new drive, and not PIO - this would cause a massive reduction in apparent drive speed while simultaneously consuming extra CPU time for IO operations concerning that drive.
If Windows has dropped the access mode to a lower standard it may just be a "random" glitch due to the change of hardware between boots. It may also be because it has experienced IO errors communicating with the drive. In response to certain types of error it will drop the IO mode down a level and retry so you may not have had noticed of the condition. I suggest checking the SMART logs of the drive closely and performing a full test (drives can perform self-tests, which must SMART related utilities will be able to kick off, I also suggest a full surface scan).


Using PayPal to pay for goods and services

Question: A similar question has been asked here about transferring funds through PayPal but the purpose in this question is different: it is about buying something (or paying for something you are going to get in future) and not about pure funds transfer from one account to another.
There are two main ways to send money through PayPal:

Sending money to friends and family - without paying any fees on any side
Sending money to pay for goods and services - only the seller pays a fee: 3.4% + fixed fee (percentage and the fixed fee vary from country to country); the use of this kind of transaction is when you are sending money to a seller you don't know and you are not sure if the seller will actually ship you the item you agreed upon (could be over eBay, Facebook marketplace, or any other kind of market, as far as I know). If the seller doesn't ship you the item, or the item is does not match the agreed description then you have right to make a claim on PayPal and PayPal is going to refund you (whereas with the first option (Sending money to friends and family) this is not possible).

Is the way number 2 of sending money through PayPal permissible in Islam? To me this seems to be somewhere between a pure funds transfer and some kind of insurance, but this is only my uneducated guess.
Would the ruling change if we were in the role of the seller? Being the seller means you are the one who pays the fee.

Useful links:
https://www.paypal.com/us/brc/article/customer-disputes-claims-chargebacks-bank-reversals
https://www.paypal.com/an/smarthelp/article/What-are-the-fees-for-PayPal-accounts-FAQ690
https://www.paypal.com/uk/webapps/mpp/merchant-fees
https://www.paypal.com/uk/webapps/mpp/paypal-fees
Answer: Paypal is just a virtual payment processor, it's halal if your balance/money source is also halal. Make sure you don't use the debit/credit card that has riba/interest to fund the money.
Islam Q&A fatwa no 131273 (translated) :

There is nothing wrong with dealing with this site (Paypal) and paying the service commission/fee
provided, i.e. to transfer money from the buyer to the seller and others ... however, transactions are required to use a sharia credit(or debit)
card. (Islamic fatwa no. 131273)


Problems transferring photos from Lumix camera to computer

Question: I have a Lumix DMC-ZX3 camera and have always been able to transfer photos from the camera onto my computer.  However, the last time I tried to do so I got two DCIM files (PANA 100 and PANA 101) - usually I only get PANA 100.  I can transfer photos from the PANA 100 file but not from the PANA 101 file.  Can anyone explain why I have two files and why I cant transfer photos from the second file?  Thank you!
Answer: This is normal operation for many/most digital cameras.  It just means that you've taken more than 10,000 photos on your camera.
The first image you take is generally stored to /DCIM/PANA100/IMG_0000.JPG, the second to /DCIM/PANA100/IMG_0001.JPG, and so on.  The 10,000th image is stored as /DCIM/PANA100/IMG_9999.JPG... so where does it store the 10,000st image?  It can't re-use /DCIM/PANA100/IMG_0000.JPG, because you may still have that image (either on the camera, or on your PC where you'd get the two images confused after moving them).
So... it creates a new directory, and stores your image as:  /DCIM/PANA101/IMG_0000.JPG
Every 10,000 images, it will create a new directory.
I'm not sure what happens after 9,000,000 images, when it's used /DCIM/PANA999/IMG_9999.JPG, and is ready to create a new file...
I have no idea why you "can't transfer photos from the second file"--please show us your error message so we can help with that.


Evisa (Tourist) for turkey, I have a valid Austrailian visa will that help?

Question: I am Indian passport holder, I have a valid Visa of Australia and I want to travel to Turkey, does this Australian visa help in processing the Visa ?
Answer: No, an Australian visa is not a valid supporting document for a Turkish e-visa.
If you apply on the Turkish Govt. e-visa website and select India - Ordinary Passport, you get a list of pre-requisites (emphasis mine)

My passport covers the period that I will be staying in Turkey.
I can prove that I hold a return ticket, hotel reservation and at least 50 $ per each day of my stay.
I am travelling for the purposes of tourism or business.
I have a valid Supporting Document (Valid visa OR valid residence permit from one of the Schengen Countries, USA, UK or Ireland).
  E-visas are not accepted as supporting documents.
I confirm that I meet each and every one of the conditions listed above.


How does the 2nd Noble truth explain the cause of suffering-as-suffering (e.g. resulting from a severe burn)?

Question: I would like to ask question regarding the 4 Noble Truths. The second Noble Truth broadly speaking is that suffering is a result of craving, aversion and ignorance. I can see how this can been seen as a cause of suffering-as-change (Viparinama-dukkha), and suffering-as-conditions (Sankhara-dukkha); but can not relate craving, aversion and ignorance to suffering-as-suffering (Dukkha-dukkha). For example how can the cause of suffering resulting from a severe burn be explained by those three factors?
Comment: See also this question: [Experiencing physical pain](https://buddhism.stackexchange.com/q/5142/254)
Comment: Suffering arises due to aversion to the physical pain of the burn. The physical pain itself is not suffering.
Answer: Dukkha-dukkha is just painful feelings accompanied by craving. Painful feelings are simply feelings. In the case of severe burns, one would experience a lot of painful feelings. But it is still just a physical feeling like any other physical feeling. It becomes suffering only when you wish it to go away. That is called Vibhava-tanha. In other words, the craving for a certain experience to go away causes you suffering.
Answer: Cūḷavedallasutta:

Miss, how sukkha-vedanā clearly appears as sukkhā, and dukkhā?

Āvuso visākā, sukkhā-vedanā clearly appears as sukkhā when it's arising, and dukkhā
  when it's changed (vipariṇāma;vanish).
Dukkhā-vedanā clearly appears as dukkhā when it's arising, and sukkhā when it's
  changed.
Adukkhamasukhā-vedanā clearly appears as sukkhā when it's arising simultaneously with vijjā, dukkhā when it's arising simultaneously with avijjā.

Note: Above sutta talking about the clearly appearing, so the answers mentioning just the  adukkhamasukhā-vedanā, which harder to appear clearly than the other vedanas. But naturally, avijjā can arise with every vedanā in S.N. Saḷāyatanavagga, nirāmisasutta.
In paṭiccasamuppāda, dependent origination:

Every steps are arising simultaneously with phassa, vedanā, saññā,
cetanā, jīvitindriya, and manasikāra in S.N. Nidānavagga, Samanupassanāsutta.
Also, every taint steps, craving & aversion, are arising simultaneously with avijjā, in Samanupassanāsutta, too.
So,  caving causes the first Noble Truth, such as dukkadukkha. Because avijjā arising simultaneously with taṇhā, sukhā/dukkhā/adukkhamasukkhā vedanā, and bodily/verbal/mental apuññābhi-saṅkhāra, that causes, not simultaneously, The first Noble Truth, bad resultants (dukkha-vipāka) which arising simultaneously, such as viññāṇa, nāna&rūpa, saḷayatana, phassa, dukkhā (dukkhadukkha)/adukkhamasukkhā vedanā, etc.
But,  ariyamagga causes the third Noble Truth. Because vijjā arising simultaneously with sukhā/adukkhamasukkhā vedanā, and bodily/verbal/mental puññābhi-saṅkhāra, that causes, not simultaneously, saupādisesanibbānadhātu, ariya's life, which leading to anupādisesanibbānadhātu, the third Noble Truth.

See the path of purification, CHAPTER XVII — THE SOIL OF UNDERSTANDING (CONCLUSION): DEPENDENT ORIGINATION, for more detail.
Answer: The "problem" might be that one is to much attached to see cause and effect as a straight linear pattern.
Suffering with suffering shows good the fact, that phenomenas are not only caused by past actions, but also how reaction is giving at the present and actually there is the door of release and the chain works here in a more subtly way, in a manifold smaller scale. If taking the raw tool, used to, to investigate, the picture is certainly blurred. That's why refined states of awarness are required, lack of clinging/maintaining (to objects of odentification) is nessesary to do not only see the cause of suffering but also the cessation as it act-ually comes into being.
Discernment: Right View, in wings of awakening, might be supportive to clear up doubts.
That is way it is good to understand depending origination as depending co-arising and to understand "from this comes that" and/or "with the arising of this, that arises".
Or let it be explained with simply words:

It's like this knife: "I want to lift up just its blade, but the back of the blade will have to come along as well." Learn to think in this way. Wherever there are causes, things can arise again. They won't stop.
Still, Flowing Water

[Note: This is a gift of Dhamma, not meant for commercial use or other lower wordily gains by ways of exchange or trade]
Answer: The 2nd noble truth states the arising (samudhaya) of suffering is due to craving that leads to new 'becoming' or 'ego-existence' (bhava). In other words, craving without becoming does not lead to the arising of suffering.

And this, monks, is the noble truth of the origination of stress: the craving that makes for further becoming — accompanied by passion &
  delight, relishing now here & now there — i.e., craving for sensual
  pleasure, craving for becoming, craving for non-becoming.
SN 56.11

The craving that makes for further becoming — accompanied by passion & delight, relishing now here & now there — i.e., craving for sensual
  pleasure, craving for becoming, craving for non-becoming: This, friend
  Visakha, is the origination of self-identification described by
  the Blessed One."
MN 44

The audio lecture 4. Noble Truth of Dukkha's Origin (part 1 | part 2) will provide a proper explanation.

The Second Noble Truth states that there is an origin of suffering and that the origin of suffering is attachment to the three kinds of
  desire: desire for sense pleasure (kama tanha), desire to become
  (bhava tanha) and desire to get rid of (vibhava tanha). This is the
  statement of the Second Noble Truth, the thesis, the pariyatti. This
  is what you contemplate: the origin of suffering is attachment to
  desire.
Ajahan Sumedho


HTML parser for Windows Phone 8.1

Question: I'm a iOS developer starting to learn Windows Phone. My project is targeted for 8 and 8.1 and it's about parsing a HTML document. I found a library named HTMLAgilityPack which is most used to parse HTML, but it is not supported for 8.1 version. So i tried to find another way to parse my HTML document and could not find any help online.
Answer: Did you try using the HtmlAgilityPack using Linq?
HtmlAgilityPack using Linq for windows phone 8.1 platform
But as far as i know HtmlAgilityPack doesn't support any 8.1 apps for WP. But the blog mentioned in this thread has mentioned about using this parser for Universal apps.
Answer: I found a solution using HtmlAgilityPack-PCL which can be accessed here.

HTML parser for Windows Phone 8.1


Did Mandodari marry Vibhishana after Ravana was killed?

Question: Is it true that after lord Rama defeated Ravana and declared Vibhishana the king, Vibhishana married Mandodari?
Comment: from where did you got this information?
Comment: While having conversations with my friend about Ramayana he told me. But he didn't know about details.
Comment: I'm pretty sure it is false information. In that period elder brother's wife was considered as mother. People like bali did existed but as we all know vibhishan was follower of rama and wouldn't have anything like mentioned. I have never came across anything like this in any version of ramayana.
Answer: Traditions differ from one kingdom/area to another.
Vanaras follow a tradition of marrying wife of dead brother.  That was why Sugriva married Tara, after the death of Vali.
On reaching Kishkinda, in Pushpaka Vimana, Sita says as follows;

सुग्रीवप्रियभार्याभिस्ताराप्रमुखातो नृप || ६-१२३-२४ अन्येषां
  वानरेन्द्राणां स्त्रीभिः परिवृता ह्यहम् | गन्तुमिच्छे सहायोध्यां
  राजधानीं त्वया सह || ६-१२३-२५
"O king! I wish to reach the capital City of Ayodhya along with you,
  accompanied by the wives of other monkey-chiefs with Tara and other
  beloved wives of Sugreeva."

However, Rakshasas did not follow this tradition.
According to Valmiki Ramayana, Vibhishana becomes king of Lanka, after the death of Ravana.  However, it was not mentioned that he married his dead brother's wife, Mandodari.


How can a non-native Korean speaker say "Pure Korean" or "Native Korean" in Korean?

Question: When talking about Korean word origin, there are "Pure/Native Korean" words, "Sino-Korean" (i.e. Hanja) words, and of course other origins like English. I am wondering how to say "Pure Korean" or "Native Korean" in Korean. I have heard "순한글" before talking about the numbers, but when I used it more generally, I was corrected and told to say "순우리말"; however, that obviously doesn't work well coming from a foreigner. I suggested "순한국말" or "순한국어" as alternatives, but supposedly that was awkward too. What should I call Pure/Native Korean words in Korean?
Comment: I was doing more research on this, and found that Naver Dictionary does in fact have [순 우리말 단어](http://endic.naver.com/krenIdiom.nhn?sLn=en&idiomId=873b2384ba7c49eb8c91dabf0fec426a&query=%EC%88%9C+%EC%9A%B0%EB%A6%AC%EB%A7%90+%EB%8B%A8%EC%96%B4). I also asked around to Koreans, and [고유어](http://endic.naver.com/search.nhn?sLn=en&isOnlyViewEE=N&query=%EA%B3%A0%EC%9C%A0%EC%96%B4) is another possible candidate.
Comment: I'd rather say and stick to "`고유어`." That's how I was taught in school, a widely used term in the academic realm. The term referring to a native Korean word doesn't have to be one, amirite? =P
Answer: 순우리말:  I think this would be fine coming from a non-Korean. While being a Korean speaker or learner, you can consider it yours. Also the sense of 우리 in 순우리말 (without any spaces in it) has become attenuated.
순 한글:  This may be problematic because 한글 is supposed to mean the Korean script.  So a Sino-Korean word written in 한글 would be 순 한글. Text incorporating Chinese characters would be not 순 한글. Also I don't know that writing 순한글 (without spacing) is acceptable.
순 한국말, 순 한국어:  This too should serve your purpose.  Only, I don't know that writing these expressions without a space in them is acceptable.
As an aside, some people seem to question the idea of some words being more "pure" Korean than others.
Comment: Thank you for the detailed answer. I like that you said, "While being a Korean speaker or learner, you can consider it yours." I hadn't thought of it that way before.


Moneymaking in Perfect World International?

Question: I like to play Perfect World International, but I'm not interested in spending real money on the game.  How can I make "game money" easily without paying "real money" for it?
Answer: If you are able to have a store open 24/7 you can make and sell shards for crazy stone quest. You can get a small profit of players that dont wanna spend a few min on making them thereself. Getting real rich might take time tho, since the profit is kind of small since other players doing this aswell and that couse the price to drop.
Farming is the hard workers way to get money, either farm mats from Twilight Temple and simulair instances, or farm mid/high mats out in the world. Even herbs can be sold.
If you are able to join a faction that owns some territories, and they pay thier members for doing Territory War, thats an easy way to get a weekly pay check.
Answer: After few updates there are several ways to make money in Perfect World.
Easiest way is the Cube. It's daily event where you need to go throught 50 rooms. You need to get into room 18 or 46. You'll recieve 9 cards and you need to buy 1. There are vendors who sold (2x of buy price) and buy cards. You can sell 9 or buy 1.
Also in the cube you can buy some boxes. For example, it's event in room 8 and 17 (there are more such rooms). It depends on box, but you can get 1M (10%), 5M (2%), 3 Shards or 1 (yes, one, 90%). Sometimes it's worth opening, or you can sell and earn 10-15k.
There are clan hall evenets where you can get valuable items to sell, but I haven't been there yet.


Could the U.S. Congress abolish itself?

Question: Hypothetically, could the U.S. Congress abolish itself and transfer all power to the President? I'm thinking of a scenario where Congress amends the Constitution and gives all power the President, while also removing its own power.
Comment: @Ramon Importantly, Congress (alone) can't amend the Constitution.
Comment: @divibisan Even if Congress passed a law giving it powers to the executive branch, would the `intelligible principle` block this law from taking effect? Also, certain powers are constitutionally granted specifically to Congress and these cannot be delegated.
Comment: Congress can pass laws that delegate power to the President, but those laws can be changed or revoked by Congress whenever they want. Is this kind of thing what you're looking for? Or are you asking specifically asking about Congress truly abolishing itself, in a way that they can't take that power back if they want?
Comment: @divibisan I'm thinking of a scenario where Congress amends the Constitution and gives all power the President, while also removing it's own power.
Comment: @doneal24 Certainly, these would apply if Congress passed a law about this, but this question is specifically asking about possible constitutional amendments which specifically have the power to change the text and meaning of the constitution
Comment: It can happen, but only if the regional governors are given direct control over their territories.
Answer: Theoretically Yes, but they couldn't do it on their own
Amendments to the US Constitution can change or overrule earlier parts without issue. For example, the 17th Amendment modified the part of Article 1, Section 3 which said that Senators were elected by the State Legislature, and replaced it with direct elections by voters in each state.
Therefore, there is no reason that a constitutional amendment couldn't make other fundamental changes, such as letting the President appoint Congress, or giving the President the ability to propose and approve bills.

However, even if they wanted to give up their power, Congress couldn't pass a Constitutional Amendment on their own. Article 5 of the US Constitution dictates a 2-step process for passing an amendment:

The Congress, whenever two thirds of both Houses shall deem it necessary, shall propose Amendments to this Constitution, or, on the Application of the Legislatures of two thirds of the several States, shall call a Convention for proposing Amendments, which, in either Case, shall be valid to all Intents and Purposes, as Part of this Constitution, when ratified by the Legislatures of three fourths of the several States, or by Conventions in three fourths thereof, as the one or the other Mode of Ratification may be proposed by the Congress;

First, an amendment must be proposed, either by passing both the House and the Senate with a 2/3 majority, or by being approved at a Constitutional Convention called by the states (which has never happened, after the original Convention).
Then, the amendment must be ratified by the State Legislature, or a state Constitutional Convention, in 3/4 (currently 38) states.
So, it wouldn't be enough for Congress to want to institute a dictatorship, the individual states would have to agree too.

There's one other limitation:
The last clause of Article 5 puts another limitation on constitutional amendments:

Provided that ... no State, without its Consent, shall be deprived of its equal Suffrage in the Senate

You could make an argument that abolishing the Senate would maintain equal Suffrage (every state gets the same 0 Senators), but any State that opposed this plan would almost certainly have grounds to sue to the Supreme Court on these grounds.
Comment: Couldn't Article 5 be amended though, in theory?
Comment: Yes, but that amendment would have to be ratified by the normal process. So, sure, you could amend Article 5 to let Congress amend the constitution without involving the states, but that amendment would have to be ratified by the states. You could imagine a process of amendments that gradually eat away at these restrictions, but that's getting pretty far into the speculative
Comment: @divibisan I would imagine that this is all done in a single amendment: remove all mentions of Congress, effectively, including the equal suffrage clause, at once.
Answer:
Hypothetically, could the U.S. Congress abolish itself and transfer
all power to the President? I'm thinking of a scenario where Congress
amends the Constitution and gives all power the President, while also
removing it's own power.

No.
Congress can proposed amendments to the U.S. Constitution, but it can't adopt amendments to the U.S. Constitution without approval from state legislatures. So, because Congress can't amend the Constitution, the answer is no.
Furthermore, Article V of the U.S. Constitution provides that:

no State, without its Consent, shall be deprived of its equal Suffrage
in the Senate

via a Constitutional Amendment. And, I do not believe that any fair reading of the U.S. Constitution would find that abolishing the U.S. Senate entirely would not violate this provision.
Since this is beyond the scope of a permitted constitutional amendment, the only way to secure your proposed change would be to violate the law and the constitution in some sort of coup or revolution (bloodless or otherwise) and to establish a new regime, much as the United States did when it extra-legally declared its independence from the British Monarch.
Congress also cannot pass a law that would do this because the non-delegation doctrine (a separation of powers concept that is part of U.S. Constitutional law) provides that a law that does not provide an "intelligible principle" to govern how it should be carried out is unconstitutional and void.
Comment: The Constitution doesn't seem to prohibit you from amending the constitution to remove clauses concerning prohibited amendments, though.  That seems to at best be "implicitly prohibited" because it violates the entire spirit of the constitution as forming an unseverable union of indestructible states.
Comment: @zibadawatimmy "The Constitution doesn't seem to prohibit you from amending the constitution to remove clauses concerning prohibited amendments, though." I don't think that this would be found to be legitimate or legal, although, obviously, it has never been tested. The clear intent of the prohibited amendments language was to take those kinds of changes to the constitution permanently off the table, not to allow them be be changed by going through one extra hoop using a hyper technical reading of the language driven by 21st century sensibilities for an 18th century document.
Answer: Congress can't do it alone.  Congress could start the process by sending the necessary constitutional amendment for ratification to the states.  But it would only work if every state ratified it.
Why?  Because the constitution requires that states not be deprived of equal suffrage in the Senate without the consent of each state so deprived.  So unlike a normal amendment that requires ratification by three quarters of the states, this would only take effect if every state consented.  It seems reasonable that ratification by the state would signal the state's consent.  Although we've never reduced a state's suffrage in the Senate, so the process is not exactly well developed.
It could also work the way that adopting the constitution in the first place did.  The states left the original government and joined the new one.  Under the current constitution, that could start happening with only three quarters of the states ratifying.  So the remaining states would have equal suffrage in the smaller remaining Senate.
So this is not entirely impossible (except that Congress can't do it alone).  But neither would it be an easy thing to do.
Note that it would actually be easier for the states to do it.  The states don't need Congress to pass an amendment, whereas Congress does need the help of the states.  Assuming unanimous agreement among the states, they could call a constitutional convention with only two thirds of the states.  Then they could ratify with only three quarters.  Then it just remains to get unanimous consent to the elimination of the Senate (the House can go at three quarters).  But all this assumes a unanimous decision of the states.
No president since James Monroe has received a unanimous vote from the states much less anything close to support for a permanent dictatorship.  Only George Washington ever got every electoral college vote.  Source:  Wikipedia.
Even really popular modern presidents like Franklin Delano Roosevelt in 1936 (Maine and Vermont), Richard Nixon in 1972 (Massachusetts), and Ronald Reagan in 1984 (Minnesota) lost at least one state.
Comment: I am not sure about the argument, after all if there is a constitutional ammendment then the clause that requires that "states can not be deprived of equal suffrage without its consent" could be invalidated as well as part of such ammendment
Comment: If they try to do it as one amendment, then the clause would still be in effect when they tried to pass the amendment and would block it.  Two amendments is conceivable, but the Supreme Court might rule that the clause itself requires unanimous consent to remove.  Otherwise, it has no practical meaning.  And amendment only has single Ms (two total, not three), no doubled M.

Could the U.S. Congress abolish itself?


Measuring Honking through OBD

Question: This is probably too simple question for this forum but would appreciate your help anyways.
I was wondering if I buy and connect a OBD port to my car and is successful in collecting data, would there be any data which would tell me directly or indirectly how much I have honked during the day or during a particular drive?
In other words, is there any data collected by OBD2 port at all which measures the level of honking?
Comment: I don't think so, never heard of a horn sensor lol!!!!
Answer: On a fancier car with a very customizable body control unit, you might be able to see when the horn button is down with a CANBus interface, but probably not even then.  OBDII doesn't deal with car accessories and is just there to expose engine related data.
Horns are too simple and are a required safety device that is not customizable so I would think they have their own circuits and are not tied in to any computer system.
Comment: You never know with a Tesla, though ... seems everything in those case are tied back to the computer!
Comment: That's true.  If there was one car I would expect to see it, it would be a Tesla.  Elon Musk can probably summon a symphony of horns in San Francisco whenever he wants... Just not with ODBII.
Comment: gms control the horn through the bcm. but i don't know of any software that provide a count. of times switched. you're right though that many are just relays and a switch.
Comment: Thanks for confirming my doubts @Jphi and to all the useful comments below
Answer: It depends what make and model of vehicle.
PSA after 2003, VAG after around 2005-7, BMW depends but all after 2008 have the horn controlled by the BCM (or whatever they each choose to call it). Many other makes may also have the horn controlled by the BCM.
So it is possible to see if the horn is actively being pressed through the CAN bus if the horn is controlled through some sort of BCM, it may or may not be available on raw data bus and most definitely will not be available through standard PIDs as these deal with engine and safety systems.
You will have to monitor the CAN bus data and keep pressing the horn (you could disconnect it to not annoy the neighbours!) if you see some data change you then watch it more closely to be sure that this data bit is in fact the horn. If the horn status is not on the raw data things get more tricky but it still may be possible, you would need to access a good diagnostic scanner which can communicate with the BCM and give live data. View the live data with the scanner at the same time as monitoring the raw data, you will notice more IDs appear, these are reserved for communications with diagnostic tools, you can now monitor these as above for changes when the horn is pressed.
The BCM doesn't do any data logging so you will have to do this yourself which is simple enough if you have basic to good electronic and software skills or there is data loggers available to buy but getting them to work with manufacture specific PID / codes can be hard to impossible. You would need this plugged into the OBD port or connected anywhere else to the CAN bus for the entire time you wanted to log horn presses.
As you can tell it may be a rather complicated task but certainly doable if the horn is controlled through a control module and that control module is connected to a CAN bus.
Comment: Thanks for the detailed response Terry. Yes I wanted to go ahead and try some hack on my own but before I start doing that I thought I will check if there is easier solution already existing.

Measuring Honking through OBD


Why grandmasters play giuoco pianissimo less often than the ruy lopez?

Question: White players in search for the win are sometimes annoyed when people play the berlin defense against their ruy lopez. I notice that the italian game often reaches position very similar to the ruy lopez middle game. So my question is why grandmaster do not switch to the italian game as the new E4 main line?
Comment: Related: http://chess.stackexchange.com/questions/226/why-is-the-ruy-lopez-such-a-common-opening
Comment: @DagOskarMadsen yes, I think your [answer](http://chess.stackexchange.com/a/2919/7297) explains it sufficiently well.
Answer: In italian game black put his bishop easily to c5 while not making too many concessions. In Ruy-Lopez prospects of that piece are usually worse. Berlin is not the main choice for black in the first place and it isn't horrible to play with white either. Many black players just stop thinking about Berlin the first time they see Re1 line. No fun at all. Endgame, while interesting, also not to everyone's taste. And white can settle for d3 systems. Black positions seem perfect by machine eyes, but still people prefer a6. The more people play a6, the less you worry about Berlin. And you can still make your opponent suffer in Berlin.
Comment: It is worth mentioning that the Berlin defense may just turn into a standard Spanish Game by move inversions, should Black not directly take in e4 or after 4. d4, exd4.
Answer: I am not grandmaster, but I took lessons from one, and he said RL immediately threatens defender of center pawn, whereas GP is less aggressive (more quiet).  If you want a sharper game the RL is sharper, but both lead to open games. I was told if opponent kicks pawn to take knight immediately.
I find that a lot of people don't like their knight gone right away.  Others don't seem to care so much as they might keep the bishop pair.  Some of chess is personal preference.  Experience players will try to find games that their opponents have played, see what they do when they play black or white, and the prepare to give them the kind of game they don't like.
Answer: The Berlin defence only got popular after the world championship match in 2000. Various lines have been tried over the years to play for a win with white. So it is not like it made the Ruy Lopez immediately drawish.
Some possible answers to your question:

Some (older) grandmaster or coaches might still be more used to the Ruy Lopez than to the Italian game.
Even the Berlin is not automatically a draw but requires precise play.
The Italian does not give much of an advantage for white either. It is mostly played for trying something new, perhaps less analysed.
Some white players might like the Berlin endgame.
Some black players might not like the Berlin endgame. If white is aware of it, no need to forego the Ruy Lopez.
Overall most decent openings if analysed well enough will lead to drawish positions.

PS: Magnus Carlsen just won against Karjakin in the WC match in an anti-Berlin (not because of the opening though) and did not achieve much in the Italian.


Should I use contractions in a technical tutorial?

Question: In a technical tutorial which fits better:

In this tutorial you'll learn

or

In this tutorial you will learn

or in general does it make no difference?
Answer: It depends on how formal the context is.  If you're writing a short blog post about getting started with a new game, "you'll" probably won't be out of place.  If you're writing a tutorial as part of the documentation set for expensive enterprise software, it's more common in my experience to avoid contractions.
If your company or publisher has a style guide, follow it.  If they don't or you're self-publishing, decide how formal you want to be: "you'll" is more folksy and "you will" is more formal (but not stuffy).
One tangential note: I try to avoid making promises about what the reader will learn; who knows if my reader will actually get it?  I talk about what we will show, not what you will learn.
Comment: +1 for "One tangential note: I try to avoid making promises about what the reader will learn; who knows if my reader will actually get it? I talk about what we will show, not what you will learn."
Comment: Thank you Monica, even your edit, makes the question better
Answer: It makes no difference to the reader. Or if it does, they will probably prefer the less formal. It makes a difference to some companies, but most are discovering that a more informal style makes them seem less stuffy and more approachable.
The idea that a "formal" style was more appropriate for technical communication has two roots. One is in the entirely appropriate desire that technical communication should be precise. The other is in the use of language as a form of class distinction, in which certain forms are used to distinguish the speech of the educated from that of the uneducated.
The latter is largely moribund among the general population, but still popular with a class of editor and grammar fiends, for more or less the old reasons: as a mark of distinction, to set themselves apart from the hoipoloi.
The concern with precision is as relevant as ever, but there is an increasing recognition that a formal precision that is not actually expressed in the language of the reader does nothing to lead the common reader to correct action. In any case, contractions do nothing to reduce precision.
Answer: If you want to seem a professional, don't use personal style and short forms. In this case I propose use sentence like this:

Tutorial "title of this tutorial" shows how to doing sth...<
Tutorial "title of this tutorial" introduces the reader to the...<
Tutorial "title of this tutorial" is an introduction to the topic...<
Tutorial "title of this tutorial" presents information about...<

Google helps you to find good examples, such as listed below:

https://docs.python.org/2/tutorial/

This tutorial introduces the reader informally to the basic concepts and features of the Python language and system.

https://developers.google.com/apps-script/articles

These tutorials are designed to help you start using Google Apps Scripts more quickly.

https://www.atlassian.com/git/tutorials/using-branches

This tutorial is a comprehensive introduction to Git branches.


Is it useful in C# to apply DeMorgan's theorem to manually optimize boolean expressions in conditional statements (e.g. if conditions)

Question: Back in the day when I did most of my work in C and C++, as a matter of course, I would manually apply deMorgan's theorem to optimize any non-trivial boolean expressions.
Is it useful to do this in C# or does the optimizer render this unnecessary?
Answer: On processors this fast, it's virtually impossible for rearranging boolean expressions to make any actual difference in speed. And the C# compiler is very smart, it will optimize it as well. Optimize for readability and clarity!
Comment: +1. I frequently de-optimize the boolean tests in my code, specifically for readability.
Comment: A compiler cannot optimize the logic of expressions without causing evaluation at different times.  See firoso's answer.  It may be smart enough to know when it is not smart enough though.
Comment: I can agree that there are situations in which the compiler can safely optimize, but as a general rule, it can't and won't.  This question is not very helpful, it's much closer to a warm fuzzy "don't worry about it" feel good answer.
Comment: Actually compilers can, if they can determine by walking the AST that the expression has no side-effects or is constant, they are free to rearrange the expression. Just like if I write "if (false || false && true)", the compiler can simplify the expression to "if (false)", then never take the branch
Comment: "Optimization is the art of lying --- and not getting caught."
Answer: Your first goal should be to optimize such statements for developer comprehension and ease of maintenance.
DeMorgan's theorem can be a useful tool for this.
Answer: The optimization in the JIT, in its current form, does not (from what I've read) optimize this for you.  If you need to optimize it, you would need to still take this into account.
That being said, this is a fairly small micro-optimization.  In general, I'd prefer to write your "non-trivial boolean expressions" in a more expressive form so they are easier to understand.  To me, this is more valuable than any very small optimization you'll get from applying deMorgan's theorem.
Answer: I believe that the correct answer to this question is that the compiler does not (normally) optimize boolean evaluations, simply due to logical short circuiting, for instance:
if (GetFlagA() || GetFlagB())
{
   ...do something
}

The order of that if evaluation can really matter if calling GetFlagA modifies something that GetFlagB relies on (granted this is REALLY bad code practice, but that's a different topic for a different thread.)  The problem here is logical short circuiting, if GetFlagA runs and returns true, GetFlagB will never run, as seen here the outcome of GetFlagB is inconsequential to the evaluation of the statement.
A | B | =
F | F | F
F | T | T
T | F | T true regardless of B's return val.
T | T | T true regardless of B's return val.
So in summary, asking if you can optimize by using Demorgan's or anything really is just like the rest of computer science and software engineering.  "It depends."  if you're using non-functional evaluation, it can probably be optimized. Honestly tho you're talking a few operations on an insanely fast platform, you'd be better off spending your time writing documentation.
I hope this helps.
Comment: Demorgan's shouldn't change the execution. Because the logic gets flipped around. !(!A && !B) still only executes B if A is false.
Comment: @BenjaminAutin I was wondering about that. Is the behavior you described typical in most languages which implement short-circuiting, or unique to C#?
Comment: Should be, once the end result is set, why do any more work than necessary?
Answer: I guess the compiler will do that already. You can do the test and look at the compiled IL via Reflector.
Optimize for readability and maintainability. Ask yourself if you will understand your clever optimization in a year and if you think, the code could use some comments, make the code self documenting.
Answer: The only time you should do rearranging, boolean algebra or demorgan's is when the logic is too complex to do it another way.  If it is not too complex, keep it readable.  There is a case for simplifying the logic.
Sometimes when the logic is tricky I need to create a Karnaugh Map to simplify the logic down to something that I can even write down.  Often, using K-Maps can help you to come up with more succinct ways of expressing your logic.  The result may or may not make sense, but it will be equivalent.
And I would also say that DeMorgan's itself really isn't an optimization that will make a difference, If more than half of the terms are negative(NOT), you will at best get the performance of removing a few NOT's, which is a single instruction for a CPU per NOT.  At worst, you can add as many NOTs as you take away, and if you shouldn't have use DeMorgan's you will get more NOTs than you had in the first place.
If you're going to optimize logic, use some boolean algebra, or my personal favorite K-Maps to reduce the number of terms(if possible). Don't just move the boolean operators around, it's silly.
Answer: Since boolean expressions evaluation uses shortcut semantics, you can move subexpressions that are cheaper to calculate to the front:
if (CountAllFilesOnDrive('C:\') > 7 && useFileScan) { ... }

will run the expensive call anytime the expression is evaluated, even if it isn't needed. Turning around that statement skips the file check if useFileScan is false:
if (useFileScan && CountAllFilesOnDrive('C:\') > 7) { ... }

DeMorgan's might help you move "early exits" to the front, and thus get better average performance.
Note that due to the guarantee of left-to-right evaluation, the optimizer doesn't have much freedom to modify the expression.
Answer: Take readability and maintenance into account.  If you have a rather complex set of boolean expressions that are difficult to read, DeMorgan's theorm might be a great approach to reducing the expression to something easier to read/maintain but that is still valid/consistent with the original expressiom.
If on the other hand, a more verbose expression is much easier to read and reducing the expression, while logically equivelant, makes it more difficult to understand, leave it as is.
Answer: In almost all practical cases I can think of, the arrangement of boolean operators has no noticeable effect on the overall performance. If your program waits for the database, the network etc. it will spend by far more time there than in those tiny operations. Should you write a program where it really makes a difference, better skip C# and use C++ instead.
Comment: the counter example is `fnThatHitsDB && flagVar` c# will hit the db before it checks the local variable.
Answer: DeMorgan by itself may be totally irrelevant in the presence of short circuit evaluation.
return !(exp1 || exp2);
return !exp1 && !exp2;

get compiled to
if(   exp1 ) return !(true); else return !(exp2);
if(!(!exp1)) return   false; else return !(exp2);

with the nots canceled and constants folded, these are identical.
The more important case is order of evaluation; put cheep things that are likely to trigger short circuits at the front of expressions. The compiler can't optimize this for you because  it is hard for it to detect semantic issues like side effects or if later expression make assumptions based on earlier ones:
return validState() && checkAssumuingValidState();

Answer: I agree with the general statements that Readability and Maintainability are most important when it comes to optimizing boolean expressions these days.  Therefore, DeMorgan's theorem is generally very useful.
There is one exception to this rule.  If the boolean expression changes a Demorgan's Theorem-optimized expression it might be more difficult to maintain.  Consider an expression with several inputs that has been optimized to only show a few boolean conditions.  One change to the required boolean logic might force someone to again list out all the possible boolean combinations and then reoptimize.  Had the expression been left in an unoptimized format, a change would have taken less steps to complete.
More from an anecdotal perspective, I wonder if educating a team about DeMorgan's Theorem and Karnaugh Maps, etc would reduce unnecessary/inefficient boolean expressions.  Perhaps if someone has a good understanding of these methods, he/she will tend to produce better expressions.  For example, I recently came across this boolean expression in the code of the software I maintain:
if ({boolean variable} != true && false)

Comment: Whoever wrote that isn't ready for de Morgan and Karnaugh yet.  Let's get the basic stupidities out of the way, and then write for readability.
Comment: Yikes!  I suppose the "&& false" could be left-over debugging logic ('temporarily' ensuring that the if block isn't executed), but it's surprising how often you run across cruft like this.
Answer: The C# optimizer can't really do too much given the short-circuiting rules for logical expression evaluation.  So applying DeMorgan's Law won't do much unless it allows you to see other useful refactorings (and of course it can help make your code clearer).
But there are cases where you can make substantial performance improvements with other kinds of expression optimization.  For instance these conditions should be swapped
if ( costly_boolean_function() && cheap_often_false_boolean_function() )

SQL query optimizers do this as a matter of course, since SQL doesn't have short-circuiting. A query optimizer will aggressively rearrange conjunctive WHERE clause predicates (of the form c1 AND c2 AND ... cn) to put the least expensive conditions first, since they may evaluate to false and obviate the need to evaluate the more expensive ones.
Answer: First deal with maintainability, and high-level optimization.
Then deal with low-level optimization.
Answer: For all us non-CS majors:

wikipedia on De Morgan's laws:
De Morgan's laws are rules relating
  the logical operators "and" and "or"
  in terms of each other via negation,
  namely:
NOT (P OR Q) = (NOT P) AND (NOT Q)
  NOT (P AND Q) = (NOT P) OR (NOT Q)
Answer: De Morgan's law is useful for reducing it to a normal form, e.g. Disjunctive normal form (DNF) or conjunctive normal form (CNF).  Basically this means that it's either
DNF:
(a and b and c) OR (e and f and g) ...
or
CNF:
(a or b or c) AND (e or f or g) ....
You can throw the NOT's in at the lowest level.
I agree with the previous posters that you should optimize for readability and comprehension.


Salt bridge in galvanic cell

Question: When we make a galvanic cell using zinc rod (in zinc sulphate solution) and copper rod (in copper sulphate solution), there is a flow of sulphate ions from the copper compartment to the zinc compartment through the salt bridge. Once the sulphate ions reach the zinc compartment, what happens to them?
Comment: Nothing. They are no different from those sulphate ions which were there from the beginning.
Answer: According to my opinion i think you are wrong because the sulphate ion does not enter the other compartment. This is because the function of the salt bridge is to maintain electrical neutrality by either allowing the sulphate ion to reside in it or by allowing the cations inside the salt bridge to enter the compartment so as to balance the ions.
Comment: Can you please confirm that no sulphate ions are flowing through the salt bridge. And that, the salt in the salt bridge supplies the required ions. Thanks.

Salt bridge in galvanic cell


Fast search: Remapped managed property contains old data

Question: I'm having a problem with managed properties. I've made a custom web part to do a people search / keywordQuery based on user properties/managed metadata. I had to change a managed property to map to a different crawled property, because the previous mapping was wrong. I then did a full crawl. The problem is that now, the property contains both new (correct) and old (incorrect) data. I guess I could do an index reset, but this seems to be a bad solution, since this (I think) will make the search unavailable, and could take some time. I guess I'm afraid to "break" something. Is there an easier, safer way of correcting the returned search values, other than resetting the entire index? I am using Fast search.
Comment: Do the index reset out of hours if you can, and then a full crawl. It will mean your search is down for a short period but only the length of a full crawl.
Answer: If a full crawl / incremental crawl doesn't do it then, do the index reset out of hours. If you can, and then a full crawl. It will mean your search is down for a short period but only the length of a full crawl.


Query posts by Custom Meta (checkbox) & Genesis Grid Loop

Question: I've been trying tons of things for the last 2 days.  I'm at a standstill now. I read a ton of posts here but nothing has worked yet.
I have a CPT 'artists'.  This CPT contains a custom field checkbox called Featured Artists 'ecpt_featured_artist'.
Within the Genesis Grid Loop on the Artists archive page 'artists-archive.php' I am able to target the Featured Artist like this:
$featuredartist = get_post_meta($post->ID, 'ecpt_featured_artist', true); ?>
<?php if( $featuredartist ) {
    echo '

';
}

I'm currently using Bill Erickson's code to put the artists-archive in a grid... like this:
    function be_archive_post_class( $classes ) {
    $classes[] = 'one-fourth';
    global $wp_query;
    if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 4 )
        $classes[] = 'first';
    return $classes;
}
add_filter( 'post_class', 'be_archive_post_class' );

What i'm trying to accomplish:
I want to query ONLY post with the checkbox checked, and display them in the Genesis Grid, on a page called Featured Artists. Right now i'm attempting to do that via a page template.
If there is a better way altogether to accomplish this, I'm open to suggestions.
Right now, I can't even query the posts properly.
My last failed attempt looked like this:
add_action('genesis_loop', 'gt_custom_loop');
function gt_custom_loop() {
global $paged;

    $args = array(
    'post_type' => 'artists',
    'key' => 'ecpt_featured_artist',
    'compare' => '=',
    'type' => 'CHAR',
    'value' => 1,
    );
    // Accepts WP_Query args
    // (http://codex.wordpress.org/Class_Reference/WP_Query)
    genesis_custom_loop( $args );

}

Any help appreciated!
EDIT: I've reduced it down to minimal code ONLY in my functions.php file, with the page using the default page template.
This code now 404's me on my 'page' Featured Artists:
add_action( 'pre_get_posts', 'pw_filter_query' );
function pw_filter_query ( $query ) {
    if( $query->is_page('featured-artists')) {
    $query->set('post_type', 'artists');
    }
}

What is going on!?
Answer: Well I don't know anything about genesis, but if it does indeed use WP_Query args, then your args array should be something like:
 $args = array(
    'post_type' => 'artists',
    'meta_key' => 'ecpt_featured_artist',
    'meta_value' => 1,
    );

Comment: Using your args in the code I have above returned "Sorry, no posts matched your criteria." I'm lost.


Small engine starts then stops

Question: A craftsman mower did not start at all.  I cleaned out the carburetor, cleaned the passages on the bowl bolt.  The air filter is clean, the fuel drips in a 1/8" stream without the bowl attached.  After all of this, A few pulls will get the engine to start, and it has run as long as ten seconds or so before dying with a puff of blue-ish smoke.  The spark plug has a .03" gap but looks a little oily.  I cleaned it up with little change in behavior.
Comment: This is a usual sign the carburetor is having issues. As I've mentioned to others, lots of times it's just easier to replace the carb than it is to try and clean or rebuild it. While it costs more, the time wasted trying to get it to work right makes up for it.
Comment: That sounds like a good idea.  The one I'm dealing with now does not have a primer.  Perhaps I could upgrade.
Comment: Stick with the same carb.  Typically, you have a choke OR a primer.  Have you tried moving the throttle and choke by hand to see if you can keep it running for longer?
Answer: I had a similar issue with my Craftsman mower. Turned out the needle valve was sticking. Once it started, I could tap the side of the carburetor with a small hammer and it would then keep running. Replaced the needle valve and it's been running fine all summer.
Answer: Unless you're absolutely sure that your fuel tank contains 100% fresh new gasoline, drain the fuel tank completely and fill it with 100% fresh new gasoline. If that fails to do the job, check the needle valve - you may be able to clean it if it's sticky, you may not.

Small engine starts then stops


Will the viewkey ever be able to view both incoming and outgoing transactions in a wallet?

Question: I am aware that the current viewkey setup allows us to check for funds sent to our wallets.  However, in the example case of cold storage, it would be very nice to be able to check if funds are still there as well, giving us a sort of "live" view of a wallet balance.  Is there a possibility of the viewkey giving us that ability at some point?
Comment: See https://github.com/monero-project/monero/issues/1070
Answer: Very unlikely, unless the crypto changes substantially.
However, if your goal is to see whether your cold storage has gone bye bye, there is a way to do this (though no current tooling to allow you to do this easily currently): the cold wallet can export the key images for the outputs it received, and a hot wallet can watch the blockchain for those. If they appear at some point, it means the corresponding output was spent. Hopefully by you :)
Feel free to file a bug on https://github.com/monero-project/bitmonero/issues asking for that particular capability to be added to the tooling.
Comment: Great response.  I was unaware of the cold/hot wallet technique.  Maybe I'll play around with it at some point :)
Answer: As you stated, the view key can only be used to view incoming transactions.
The spend key is needed to view outgoing transactions. Using the spend key is not currently possible with a cold wallet (without exposing it to the Internet).
There us hope that offline hardware wallets such as Trezor will be able to solve this problem eventually.


Should I include the courses I taught in my resume?

Question: I've been working for 2 years already as a developer in my company, during this time I also imparted some courses on how to use tech in industry. Now that I'm looking for a new job, should I include these in my resume or it could be seen by the new company as a bad thing?
Comment: Welcome to TWP.  Good question.  In the future, you may want to wait a few days to pick a best answer, as questions without a chosen best answer tend to attract more attention
Answer:
should I include these in my resume or it could be seen by the new
company as a bad thing?

Absolutely, include them.
Make sure to include a link, if you can, so the content may be viewed by prospective employers.  If you cannot make it available online, definitely be prepared to discuss or show the course when interviewing.
Probably goes without saying, but make sure the links actually work and that the content displays as you expect.  I am making the assumption that the quality of the courses is good.
Most employers look fondly on this type of thing ( teaching a technology ), and I don't see any negatives to this.
Comment: @Gamopo There are a lot of good things implied by teaching: You're good at what you know, you're able to explain these concepts to people who know less than you (which also implies you'd be good at mentoring junior co-workers), real interest in your area of expertise (you likely did at least some work for this on your own time), etc. It would especially help you if you applied for roles in Developer Relations, Training, and things directly involving teaching but it's all good stuff in general.
Comment: Agreed : there's absolutely NO downside to include your teachings. No sane company/recruiter would look down on that. And those who do… well, I'd strongly advise against working for them !
Comment: That'ts a good advice, I'll do it that way, I thought maybe employers would think: "Why was this guy teaching if he is a developer?"
Answer: "Bah, Humbug!"  "Dead giveaways of age?" (These kids today!!")
But seriously ... "the ability to 'do' something, yourself, is one thing, but the ability to 'teach or train'* someone else *to do it, is entirely another!"
Today, I'm extremely proud that I served for very-many as a community-college instructor, and also as a professional trainer. (And, who knows, my career isn't exactly over yet ...)
Yes! I highlight this in a separate section of my resume, after my summary of my most-recent jobs or engagements.
Answer: I am not expert but I am a software developer too and I added my last course and certification that I have done , this is a plus for you because you are telling them you have more abilities and skills ,etc  if you have a youtube channel about devs you also should add it because this kind of things show them that you have great skills.


Is opening ports in the firewall bad?

Question: From what little I know about networking, opening ports lets external data get sent in. But how that data is handled is entirely up to the applications running on my machine. So if I'm not running any malicious applications, there should be nothing wrong with disabling the firewall, right? Also, how do applications work when ports aren't forwarded? For example, I need to forward port TCP 6112 to host Blizzard games, but I've heard that HTTP uses port 80, but I haven't forwarded that port, yet Firefox still works. Btw I'm using Windows Vista.
Comment: Firewalls block incoming connections. If you request a web page, that would be an outgoing connection.
Comment: Actually, most firewalls are capable of blocking/allowing incoming and outgoing connections.
Answer: Technically speaking, the only dangerous open port is one on which there is malicious software accepting connections without your knowledge.  An open port in your firewall (allowing incoming connection requests) is not a threat at all if there is nothing on your side of the firewall listening for those requests.
The reality is that we all need to run multi-layered security which includes closing "unnecessary" ports so that they cannot be co-opted by malicious software.  I.e. you would never knowingly install malicious software which would answer those inbound connection requests, but that's part of the social engineering aspect of malicious software: finding a way to convince people to install it so that it can find those open ports and hijack them.
In essence, opening ports isn't "bad", it's just necessary and should only be done individually on a case by case basis.
Answer: HTTP uses port 80 for listening on the server side (incoming connections). You aren't hosting a web server, using Firefox to browse is different (outgoing connections). I'd keep the firewall on regardless. You're right in the aspect that an application needs to be listening, but if you download malicious software you've made that aspect even easier for the writer of the software to connect back and communicate with an IRC server for example to control your machine. Since the ports are already open, it can communicate on pretty much any one it wants with the exception of used ports.
If you're hosting a service (game server for example) you'll need to open ports for other users to connect. Since it's trusted software you have listening for connections there shouldn't be a problem. If you want to be extra cautious though, disable the port forwarding rule in the router when you're done with the server.
Comment: I vote this up. Applications connecting to internet usually establish outgoing connections. Most applications in a desktop pc don't listen for connections because there is no need for other computers or applications to start a connection to them. Also, this question and answer apply to all operating systems.
Comment: HTTP typically uses port 80 on the server side, but it can use any port. Say 7600.
Answer: Not unless you know what ports and who'll be using the ports.
Port opening is necessary if you want to do it manually, if not that's what UPnP is for. But I strongly advise against UPnP.
I'd like to think manually opening ports is safer than allowing applications do it for you.

Is opening ports in the firewall bad?


What is the cheapest graphics card for a desktop

Question: What is the cheapest graphics card for a desktop that can handle the new age of empires 2 definitive version and the Halo reach for PC? I'm thinking about getting new parts for my cooler master centurion 541 case and I would like to know the cheapest graphics card that can handle these games
Comment: And I would also like to know the best specs to handle those games I don't want a gaming desktop but just a desktop that doesn't look gaming but can handle games
Comment: "Cheapest that can handle" has a *lot* of meanings here. I'm guessing 10-15 fps wouldn't be acceptable. **What settings would you like to play on**? In addition, could you **post a price limit** so we can figure out if you have the budget for what you are seeking?
Comment: I don't know maybe to 150$ and i don't want this to be a gaming desktop I want it to look like a normal computer
Comment: Maybe low graphics but smooth and not slow
Comment: Does your PC CPU have an integrated graphics card (e.g. can you boot to windows on your monitor screen without a (discrete) GPU plugged into via PCI-e)? Technically this would be the cheapest option at $0 and can probably run some old games on low settings at about 30 fps. Otherwise I can recommend some GPUs for exactly $150 that can run some triple A fps games at 60 fps.
Answer: Halo Reach is not a very demanding game. Probably because it was built and optimized for the Xbox 360's GPU, which was released in 2005! 2D games like Age of Empires are much less demanding than Halo Reach too.
I'm not sure whether your $150 budget is just for a GPU or an entire upgrade; I have to assume just the GPU because an entire upgrade would cost much more.
If you're going to buy a new CPU:
The AMD Ryzen 5 3400G CPU has integrated graphics.
It can achieve 53 to 69 FPS at 1080p on Halo Reach.
Technically buying this CPU means you'd be spending $0 on a GPU if you accounted for buying a CPU anyways.
If you are just buying a GPU:
Consider the NVIDIA GTX 1050, 1050 Ti, or the AMD RX 560, RX 570. These four cards are around the $150 - $250 price range. The RX 570 is particularly good value (FPS per $) if you can catch it on sale.

If you just want to run Age of Empires for as cheap as possible, practically any integrated graphics should be able to handle it. It's a remaster of a very old game, and the higher resolution does not add much work for the GPU. So if you have any video output at all on a PC, it's probably good to go at $0 cost to you.
Comment: I have a GTX 1050 Mobile and I can play new gamesat Medium to High at 1080p FHD at 60fps
Answer: I run AoE2 DE on integrated graphics (the graphics built into the cpu of my laptop) and it runs fine. However, that does not work well for games like Reach. You will want to buy a dedicated GPU. The RX 570 has a very good price to performance ratio.


How does Karma work for a person who has converted to Hinduism?

Question: I am just curious to know how does Karma work for a person who has converted to Hinduism.
If we consider Karma as a bank account; how is Karma accounted for a converted individual? Is it the Karma after conversion or the Karma since birth?
Comment: There's nothing in Hindu scripture that says that you only accrue karma if you happen to believe in Hinduism.  Karma accrues to everyone, regardless of whether you're Hindu.  All the karma you accrued since you were born, and the karma you accrued in past births counts whether you convert to Hinduism, or stay Christian.
Comment: And in the next birth nobody is sure whether one is born as an animal, bird or tree, where there is only one religion, 'nature'.
Answer: Karma is what you had done and what you are doing in your life time. So Karma will be there from the very next moment of your birth. There is nothing to do with Hindu, Muslim or Christian.
The Karmaphalam, Fruit(Reward) for your Karma will be awarded to you in your life time, may be in your next life too. Whether you are or were a Hindu or Muslim or Christian won't be considered in this.
Answer: Karma is the work or action or activity.
Karma never binds you, only your intentions, wishes, willingness from that Karma's gains binds you. Your own wishes, gain desires and your own thoughts bind you with good or bad fruit of Karma.
Every soul who is in body performs activity (Karma), so Karma theory is beyond religion.
Karma theory is exactly like Newton's third Law.

What you did is what you get. or one can say "Tit for tat"

It is like a resultant force of your applied force.
One who is a soul in body this law applies to him. Being Hindu, muslim, Sikh or isai has nothing to do with anything. Even this law is applicable to animals. Every living being comes under this Karma theory.
Just make sure you perform your activities as Vairagi (Desireless Person), and with duty, rise above fruits, Moha attraction and just do it as it is GOD's will, that Karma will never bind you according to Karma Yoga of Shrimad Bhagwat Geeta. But this applies to all souls nevertheless of they are from any religion, converted to some or not.
Is Karma accounted?
Yes but not from birth, from your "first birth on Mrutyu Loka", your Karma is accounted, noted and you can only be freed by attaining Moksha. Hindu scriptures state that Chitragupta notes every activity of all souls on Mrityuloka when a person dies his judgments are done on behalf of his activities only. He may face his fruits in next lives also. But judgement is always full of justice.
Almost all (may be 75%) religions have theory of judgement, paradise and hell. Almost all of them have the concept of Dharmaraj or Yama.
Answer: Hinduism is not a sectarian religion in which certain things depend on your conversion to or from. It is called the Eternal Religion and rightly so. Law of karma affects us all regardless of what earthly beliefs and identities we have. Yes law of karma acts upon each and every individual and it is free of conversion. In fact it is not from birth but even before that, from previous lifetimes.


спускаться/опускаться, но подниматься

Question: If a person goes up (e.g., on a staircase), then человек поднимается. If an elevator is going up, then лифт поднимается. That's the same verb for the person and for the elevator. However, if a person is coming down then человек спускается while if an elevator comes down then лифт опускается. I'm surprised that one direction has the same verb while the other direction uses different verbs. If the language can handle the idea that going up is the same thing for people and for elevators, why doesn't it do that for going down? Is there a commonly used verb for going down that can be applied to both people and elevators?
Answer: It is not true that the verb "опуститься" is used only for objects and "спуститься" is used for people.
There is a tendency to use the verb "спуститься" to denote a deliberate action and the verb "опуститься" for an uncontrolled movement:

Птицы спустились с неба. - The birds flew down to the ground.
  Воздушный шар плавно опускался на землю. - The balloon was slowly going down.

However, in my opinion, there is also another difference, which may be even more important to consider, when you choose, which verb to say. "Спуститься" denotes movement down relative to an object (a tree, a mountain), while "опуститься" refers to downward movement in general. In particular, the verb "спуститься" is more likely to be used with preposition "с" - "from" and "в\на" - "to", than the verb "опуститься":

Вася, спустись с дерева! - Vasya, get down the tree!
  Я спустился в подвал (по лестнице). - I went (downstairs) to the basement.
  Сорочка лёгкая спустилась c её прелестного плеча. - The light chemise fell from her lovely shoulder.
  Паром спустился по течению реки. - The ferry came down the river.
  Этот лифт спустился с пятого этажа. - This elevator came down from the 5th floor.

But

Лифт наконец-то опустился, и мы вошли в него. - The elevator has finally arrived (from above), and we entered it. (actually, you could also use "спуститься", if you cared enough about the fact that it has been above before)
  Занавес опустился, и зазвучали аплодисменты. - The curtain fell down, and there was applause. (we don't care where the curtain fell from)
  На гору опустилось облако. - A cloud covered a mountain. (literally: fell down onto the mountain)

So, to answer your question: you can use both verbs for people and for elevators, it does not depend that much on who or what came down, it rather depends whether you care from where it came down.
Comment: Is there a corresponding distinction for types of motion going up? It would seem odd for the vocabulary of upward motion to be more flexible than for downward motion.
Comment: @KCd: See my answer for explanation why there is no similar distinction for moving up.
Comment: @KCd I don't know why there is no other word like "подниматься" for going upwards in Russian. It is theoretically possible to distinguish movement with respect to a landmark and simple upward movement, but Russian doesn't seem to have this distinction.
Comment: @Olga "взбираться", "залезать", "взойти" и т.д.?
Comment: @КуЪ Да-да, я знаю эти слова. Я имела в виду, всего одно слово с таким же корнем как у "подниматься"
Answer: Language is not math.  And even strictly scientifically: going up and going down are two very different things - it is not like going left and going right.
I agree with Olga's answer. I could have really put my answer as a comment to hers, just putting it as a separate answer because of the size.
We are talking here only about "спускаться" and "опускаться" in the meaning of going down. They have other meanings as Lyth points out.
"Опускаться" accents the moment of final smooth breaking before to stop on the ground. It is especially noticeable in the form "Он опустился на землю" - here most of the people imagine the moment of landing and smooth breaking before it (притормаживание). It may mean the whole process but just accents the ending part.
"Cпускаться" - accents the process of moving legs, hands and whatever else during the descending. "Он спустился на землю" - here people will imagine the end of possibly long process of steps of descending.
Because there is no natural moment of soft breaking when a person or object goes up there is no special word "оподняться" for moving up. Even when there is some ceiling, usually objects just hit it when go up - there is no smooth breaking before it. OK, the smooth breaking may happen but the language did not need a special word for it because of rareness and insignificance of this phenomenon.
Just for illustration of non-equivalence of up and down movements, let's look at moving through the water for objects. In Russian there are two more or less equivalent (except for the direction) verbs "тонуть" and "всплывать". In English there is "to sink" for "тонуть" but for "всплывать" there is no direct equivalent (or I could not find it :). There is "to surface" but it accents the moment of emerging on the surface - not the whole movement, and there is "to float" which mostly means (according to Webster) "to rest on the surface, or be suspended in liquid", or even moving in any direction: "yellow leaves floated down" (= плыть in Russian).
Comment: To be fair to English in my last example I must say that while Russian language tends to modify words by attaching prefixes and suffixes, English loves to keep words atomic but combine them into groups thus creating [multi-word verbs](http://www.englishclub.com/grammar/verbs-phrasal-verbs.htm). So, "float up" would probably be more the direct counterpart of Russian "всплывать".
Comment: Why would they be "strictly different" things scientifically? Both processes are described via the same equation, the difference being in one case potential energy increases, in another — decreases.
Comment: @theUg: :-) I wrote "very different" - not "strictly different". The important vector in the situation we talk about is the vector *g* (acceleration of gravity). Out of all directions in which two objects could be moving the biggest difference of projections to the axis of *g* will be for directions *up* and *down*. So the *up* and *down* directions are in a way the *most different* directions in respect to gravity. That's all what I was saying.
Answer: I think it's ok to use спускается for an elevator. Спускаться bears meaning of "to go down by own will" and when used with inanimate objects indirectly animates them (which is perfectly fine).
Опускаться is more difficult; the difference between спускать and опускать is like "to bring down" and "to bring down gently/steadily". This extra detail plays a dirty trick on reflexive suffix "-ся" and gives an extra meaning of "being brought down (by someone or something)". More than that, опускать has a second meaning "to omit" (опускаться — "to be omitted"), and a third — "to bring down" in a moral point of view (опускаться — "to fall").
As an alternative you may use "идти вниз" (literally "go down") — "лифт идёт вниз", "человек идёт вниз" are both normal phrases.
Comment: Anyway, "Вы вниз?" or "Вы вверх?" is just shorter and more comprehensible than any other phrase containing "this elevator".
Comment: If an elevator door opens and I want to ask the people inside if it's going up or down, would I ask "подимается или опускается" or "поднимается или спускается", or something else?
Comment: Except for very dumb elevators or when people go out, elevators stop only if they go down, so no question is usually necessary. And yet the best and the most understood question is "Вы вниз?" ("are you going down?").
Comment: Elevators don't stop only if they go down, but also if they go up too. It depends on which way you want to go while waiting and also on which way it is moving if someone gets off right before you get on.

спускаться/опускаться, но подниматься