Difference between float and decimal data type

Question: What difference does it make when I use float and decimal data types in MySQL?.
When should I use which?
Comment: Don't use `FLOAT(m,n)`, it leads to two roundings; meanwhile, it provides nothing of any use.
Answer: This is what I found when I had this doubt.
mysql> create table numbers (a decimal(10,2), b float);
mysql> insert into numbers values (100, 100);
mysql> select @a := (a/3), @b := (b/3), @a * 3, @b * 3 from numbers \G
*************************** 1. row ***************************
  @a := (a/3): 33.333333333
  @b := (b/3): 33.333333333333
@a + @a + @a: 99.999999999000000000000000000000
@b + @b + @b: 100

The decimal did exactly what's supposed to do on this cases, it
truncated the rest, thus losing the 1/3 part.
So for sums the decimal is better, but for divisions the float is
better, up to some point, of course. I mean, using DECIMAL will not give
you a "fail proof arithmetic" in any means.
Comment: Actually, the DECIMAL addition is in error. If you add 33.333333333 three times you don't get 100. If you divide 100 by 3 you don't get a rational number without a repeating set of trailing digits, so you can't multiply it by 3 and get 100. Get out a calculator and try it. Logically we know 1/3 + 1/3 + 1/3 should equal 3/3rds IE: 1, but this class of rational numbers doesn't allow us to do this.The float answer is correct, but your accountant will HATE it!
Comment: Isn't `@a` giving 99.999999999000000000000000000000 the DECIMAL? Which is technically correct.
Comment: An excellent test. Years ago the C lib's data conversion functions would often create tons of minute differences in values converted from ASCII to float when compared against those in, say, SQLServer. This is rarely true anymore. Testing is the best policy, as it's best to know for certain what the trade-offs are.
Answer: A "float" in most environments is a binary floating-point type. It can accurately store base-2 values (to a certain point), but cannot accurately store many base-10 (decimal) values. Floats are most appropriate for scientific calculations. They're not appropriate for most business-oriented math, and inappropriate use of floats will bite you. Many decimal values can't be exactly represented in base-2. 0.1 can't, for instance, and so you see strange results like 1.0 - 0.1 = 0.8999999.
Decimals store base-10 numbers. Decimal is an good type for most business math (but any built-in "money" type is more appropriate for financial calculations), where the range of values exceeds that provided by integer types, and fractional values are needed. Decimals, as the name implies, are designed for base-10 numbers - they can accurately store decimal values (again, to a certain point).
Comment: @Pradeep: I feel that you're not answering my questions. That may be because you don't know the answers yourself - maybe you don't feel comfortable asking your manager or customer for more details. If that's the case, I suggest biting the bullet, sitting down with them for a couple of hours, and really walking through your application. What *exactly*, and in *great detail*, is your data being used for?
Comment: Actually, currently both float and DECIMAL store their numbers the same way. The difference is in how those numbers are used. DECIMAL uses all bits to comprise a two's complement integer, with an implied decimal point. A float has two integers and one raises the other to a power. Both the base and the exponent are two's complement integers.
Comment: I think your answer may be technically correct, but the emphasis on float being a binary type obscures the point that they both store their data in the same format. A floating point number raised to the first power is an integer, and is stored exactly that way. In fact, for 80-bit precision float, the base is an int64. Conversely, if you wrote a library for integers that raised them to powers, you'd encounter the same issues with integers, or DECIMALS, or Roman Numbers, or lollipops. It's not the storage that is creating the "rounding errors", it's the library's handling of the math.
Comment: Given the very poor quality of the question, where virtually no parameters are given to indicate what the OPs areas of concern are, it's hard to know what's an appropriate response. Generally DECIMAL will store larger numbers and the math libs meet accountant's expectations, while double float is a less efficient storage medium that has massively optimized math libs - which meet scientists and finance (not accountants) guys expectations a lot better.
Comment: @Michael Petrotta - user just enters his decimal numbers in the field given in forms.. i need to just store them in DB. which will be more suitable. ?
Comment: @Pradeep: What will that number be used for?
Comment: @Michael Petrotta -   oh does it depends on wht its used for also.. basically its used for comparison with other decimal value and display purpose.
Comment: @Pradeep: yes, it does matter, and you haven't really told me yet what it's used for. What kind of data are you storing in that field (monetary value, standard deviation, a timespan, etc.)?
Comment: @Michael Petrotta - store values like 2.03 and 456.78 such values.
Comment: @Michael Petrotta i provided u the eaxmples. its used for no calculation purpose. just store and display purpose. hope i am clear now.
Comment: @user2548100, I agree, for the domain being discussed. Do you see a conflict between your comment and my answer?
Comment: @user2548100: Hmm. I wasn't really trying to talk about the format of the datatypes here, but rather, their suitability for different kind of applications. I used "values" in "cannot accurately store many base-10 values" to mean "the result of operations like `1.0 - 0.1`". You more correctly captured this as "the library's handling of the math". Maybe there's a rephrase to be had here - I'll think about it when I get home. In the meantime, feel free to edit my answer, but let's keep the main thrust of the answer on appropriate datatypes for use in applications.
Comment: @user2548100 -- Wrong.  `DECIMAL` is stored quite differently than `FLOAT`/`DOUBLE`.  `DECIMAL` uses a library that handles up to abou 65 digits, and cuts off precisely at the specified decimal place.  Float/double use the IEEE754 standard for _binary_ floating point -- 24 or 53 _bits_ of mantissa, plus some number of bits for exponent.
Answer: MySQL recently changed they way they store the DECIMAL type. In the past they stored the characters (or nybbles) for each digit comprising an ASCII (or nybble) representation of a number - vs - a two's complement integer, or some derivative thereof.
The current storage format for DECIMAL is a series of 1,2,3,or 4-byte integers whose bits are concatenated to create a two's complement number with an implied decimal point, defined by you, and stored in the DB schema when you declare the column and specify it's DECIMAL size and decimal point position.
By way of example, if you take a 32-bit int you can store any number from 0 - 4,294,967,295. That will only reliably cover 999,999,999, so if you threw out 2 bits and used (1<<30 -1) you'd give up nothing. Covering all 9-digit numbers with only 4 bytes is more efficient than covering 4 digits in 32 bits using 4 ASCII characters, or 8 nybble digits. (a nybble is 4-bits, allowing values 0-15, more than is needed for 0-9, but you can't eliminate that waste by going to 3 bits, because that only covers values 0-7)
The example used on the MySQL online docs uses DECIMAL(18,9) as an example. This is 9 digits ahead of and 9 digits behind the implied decimal point, which as explained above requires the following storage.
As 18 8-bit chars:
144 bits
As 18 4-bit nybbles:
72 bits
As 2 32-bit integers:
64 bits
Currently DECIMAL supports a max of 65 digits, as DECIMAL(M,D) where the largest value for M allowed is 65, and the largest value of D allowed is 30.
So as not to require chunks of 9 digits at a time, integers smaller than 32-bits are used to add digits using 1,2 and 3 byte integers. For some reason that defies logic, signed, instead of unsigned ints were used, and in so doing, 1 bit gets thrown out, resulting in the following storage capabilities. For 1,2 and 4 byte ints the lost bit doesn't matter, but for the 3-byte int it's a disaster because an entire digit is lost due to the loss of that single bit.
With an 7-bit int:
0 - 99
With a 15-bit int:
0 - 9,999
With a 23-bit int:
 0 - 999,999
(0 - 9,999,999 with a 24-bit int)
1,2,3 and 4-byte integers are concatenated together to form a "bit pool" DECIMAL uses to represent the number precisely as a two's complement integer. The decimal point is NOT stored, it is implied.
This means that no ASCII to int conversions are required of the DB engine to convert the "number" into something the CPU recognizes as a number. No rounding, no conversion errors, it's a real number the CPU can manipulate.
Calculations on this arbitrarily large integer must be done in software, as there is no hardware support for this kind of number, but these libraries are very old and highly optimized, having been written 50 years ago to support IBM 370 Fortran arbitrary precision floating point data. They're still a lot slower than fixed-sized integer algebra done with CPU integer hardware, or floating point calculations done on the FPU.
In terms of storage efficiency, because the exponent of a float is attached to each and every float, specifying implicitly where the decimal point is, it is massively redundant, and therefore inefficient for DB work. In a DB you already know where the decimal point is to go up front, and every row in the table that has a value for a DECIMAL column need only look at the 1 & only specification of where that decimal point is to be placed, stored in the schema as the arguments to a DECIMAL(M,D) as the implication of the M and the D values.
The many remarks found here about which format is to be used for various kinds of applications are correct, so I won't belabor the point. I took the time to write this here because whoever is maintaining the linked MySQL online documentation doesn't understand any of the above and after rounds of increasingly frustrating attempts to explain it to them I gave up. A good indication of how poorly they understood what they were writing is the very muddled and almost indecipherable presentation of the subject matter.
As a final thought, if you have need of high-precision floating point computation, there've been tremendous advances in floating point code in the last 20 years, and hardware support for 96-bit and Quadruple Precision float are right around the corner, but there are good arbitrary precision libraries out there if manipulation of the stored value is important.
Comment: I believe as of Intel's  Hazwell architecture there are AVX-2 operations on 256bit integers, covering every possible value 77 digits could represent, that could be used to directly operate on DECIMAL's extended precision integers. It may prove prudent for Oracle to support a new form of DECIMAL in the future covering 77 digits vs 65. I would estimate a 5-10X performance improvement using hardware instead of software.

2^256 =
115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,
639,936 (78 digits)
Comment: Intel's vector processors now support 512 bit mathematical operations. This will cover 154 digits. 2^512 = 13,407,807,929,942,597,099,574,024,998,205,846,127,479,365,820,592,393,377,723,561,443,721,764,030,073,546,976,801,874,298,166,903,427,690,031,858,186,486,050,853,753,882,811,946,569,946,433,649,006,084,096 (155 digits)
Answer: Not just specific to MySQL, the difference between float and decimal types is the way that they represent fractional values.  Floating point types represent fractions in binary, which can only represent values as {m*2^n | m, n Integers} .  values such as 1/5 cannot be precisely represented (without round off error).  Decimal numbers are similarly limited, but represent numbers like {m*10^n | m, n Integers}.  Decimals still cannot represent numbers like 1/3, but it is often the case in many common fields, like finance, that the expectation is that certain decimal fractions can always be expressed without loss of fidelity.  Since a decimal number can represent a value like $0.20 (one fifth of a dollar), it is preferred in those situations.
Comment: Because Intel processors do all intermediate double float operations in 80 bit precision, there is almost without exception no rounding error when the final result is trimmed back from 80 bits to 64 bits. Even many floating point software libraries can handle these and hundreds of other arithmetic anomalies. Theory and practice are thus wildly divergent in this area.
Answer: decimal is for fixed quantities like money where you want a specific number of decimal places.  Floats are for storing ... floating point precision numbers.
Answer: mysql> CREATE TABLE num(id int ,fl float,dc dec(5,2));
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO num VALUES(1,13.75,13.75);
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO num VALUES(2,13.15,13.15);
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM num WHERE fl = 13.15;
Empty set (0.00 sec)

mysql> SELECT * FROM num WHERE dc = 13.15;
+------+-------+-------+
| id   | fl    | dc    |
+------+-------+-------+
|    2 | 13.15 | 13.15 |
+------+-------+-------+
1 row in set (0.00 sec)

mysql> SELECT SUM(fl) ,SUM(dc)  FROM num;
+--------------------+---------+
| SUM(fl)            | SUM(dc) |
+--------------------+---------+
| 26.899999618530273 |   26.90 |
+--------------------+---------+
1 row in set (0.00 sec)

mysql> SELECT * FROM num WHERE ABS(fl -  13.15)<0.01;
+------+-------+-------+
| id   | fl    | dc    |
+------+-------+-------+
|    2 | 13.15 | 13.15 |
+------+-------+-------+
1 row in set (0.00 sec)

Answer: I found this useful:

Generally, Float values are good for scientific Calculations, but should not be used for Financial/Monetary Values. For Business Oriented Math, always use Decimal.

Source: http://code.rohitink.com/2013/06/12/mysql-integer-float-decimal-data-types-differences/
Answer: If you are after performance and not precision, you should note that calculations with floats are much faster than decimals
Answer: Floating-Point Types (Approximate Value) - FLOAT, DOUBLE
The FLOAT and DOUBLE types represent approximate numeric data values. MySQL uses four bytes for single-precision values and eight bytes for double-precision values.
For FLOAT, the SQL standard permits an optional specification of the precision (but not the range of the exponent) in bits following the keyword FLOAT in parentheses. MySQL also supports this optional precision specification, but the precision value is used only to determine storage size. A precision from 0 to 23 results in a 4-byte single-precision FLOAT column. A precision from 24 to 53 results in an 8-byte double-precision DOUBLE column.
MySQL permits a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, "(M,D)" means than values can be stored with up to M digits in total, of which D digits may be after the decimal point. For example, a column defined as FLOAT(7,4) will look like -999.9999 when displayed. MySQL performs rounding when storing values, so if you insert 999.00009 into a FLOAT(7,4) column, the approximate result is 999.0001.
Because floating-point values are approximate and not stored as exact values, attempts to treat them as exact in comparisons may lead to problems. They are also subject to platform or implementation dependencies.
For maximum portability, code requiring storage of approximate numeric data values should use FLOAT or DOUBLE PRECISION with no specification of precision or number of digits.
https://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html
Problems with Floating-Point Values
Floating-point numbers sometimes cause confusion because they are approximate and not stored as exact values. A floating-point value as written in an SQL statement may not be the same as the value represented internally. Attempts to treat floating-point values as exact in comparisons may lead to problems. They are also subject to platform or implementation dependencies. The FLOAT and DOUBLE data types are subject to these issues. For DECIMAL columns, MySQL performs operations with a precision of 65 decimal digits, which should solve most common inaccuracy problems.
The following example uses DOUBLE to demonstrate how calculations that are done using floating-point operations are subject to floating-point error.
mysql> CREATE TABLE t1 (i INT, d1 DOUBLE, d2 DOUBLE);
mysql> INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
    -> (2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40),
    -> (2, 30.40, 30.40), (3, 37.00, 7.40), (3, -29.60, 0.00),
    -> (4, 60.00, 15.40), (4, -10.60, 0.00), (4, -34.00, 0.00),
    -> (5, 33.00, 0.00), (5, -25.80, 0.00), (5, 0.00, 7.20),
    -> (6, 0.00, 0.00), (6, -51.40, 0.00);

mysql> SELECT i, SUM(d1) AS a, SUM(d2) AS b
    -> FROM t1 GROUP BY i HAVING a <> b;

+------+-------+------+
| i    | a     | b    |
+------+-------+------+
|    1 |  21.4 | 21.4 |
|    2 |  76.8 | 76.8 |
|    3 |   7.4 |  7.4 |
|    4 |  15.4 | 15.4 |
|    5 |   7.2 |  7.2 |
|    6 | -51.4 |    0 |
+------+-------+------+

The result is correct. Although the first five records look like they should not satisfy the comparison (the values of a and b do not appear to be different), they may do so because the difference between the numbers shows up around the tenth decimal or so, depending on factors such as computer architecture or the compiler version or optimization level. For example, different CPUs may evaluate floating-point numbers differently.
If columns d1 and d2 had been defined as DECIMAL rather than DOUBLE, the result of the SELECT query would have contained only one row—the last one shown above.
The correct way to do floating-point number comparison is to first decide on an acceptable tolerance for differences between the numbers and then do the comparison against the tolerance value. For example, if we agree that floating-point numbers should be regarded the same if they are same within a precision of one in ten thousand (0.0001), the comparison should be written to find differences larger than the tolerance value:
mysql> SELECT i, SUM(d1) AS a, SUM(d2) AS b FROM t1
    -> GROUP BY i HAVING ABS(a - b) > 0.0001;
+------+-------+------+
| i    | a     | b    |
+------+-------+------+
|    6 | -51.4 |    0 |
+------+-------+------+
1 row in set (0.00 sec)

Conversely, to get rows where the numbers are the same, the test should find differences within the tolerance value:
mysql> SELECT i, SUM(d1) AS a, SUM(d2) AS b FROM t1
    -> GROUP BY i HAVING ABS(a - b) <= 0.0001;
+------+------+------+
| i    | a    | b    |
+------+------+------+
|    1 | 21.4 | 21.4 |
|    2 | 76.8 | 76.8 |
|    3 |  7.4 |  7.4 |
|    4 | 15.4 | 15.4 |
|    5 |  7.2 |  7.2 |
+------+------+------+
5 rows in set (0.03 sec)

Floating-point values are subject to platform or implementation dependencies. Suppose that you execute the following statements:
CREATE TABLE t1(c1 FLOAT(53,0), c2 FLOAT(53,0));
INSERT INTO t1 VALUES('1e+52','-1e+52');
SELECT * FROM t1;

On some platforms, the SELECT statement returns inf and -inf. On others, it returns 0 and -0.
An implication of the preceding issues is that if you attempt to create a replication slave by dumping table contents with mysqldump on the master and reloading the dump file into the slave, tables containing floating-point columns might differ between the two hosts.
https://dev.mysql.com/doc/refman/5.5/en/problems-with-float.html
Answer: Hard & Fast Rule
If all you need to do is add, subtract or multiply the numbers you are storing, DECIMAL is best.
If you need to divide or do any other form of arithmetic or algebra on the data you're almost certainly going to be happier with float. Floating point libraries, and on Intel processors, the floating point processor itself, have TONs of operations to correct, fix-up, detect and handle the blizzard of exceptions that occur when doing typical math functions - especially transcendental functions.
As for accuracy, I once wrote a budget system that computed the % contribution of each of 3,000+ accounts, for 3,600 budget units, by month to that unit's consolidation node, then based on that matrix of percentages (3,000 + x 12 x 3,600) I multiplied the amounts budgeted by the highest organizational nodes down to the next 3 levels of the organizational nodes, and then computed all (3,000 + 12) values for all 3,200 detail units from that. Millions and millions and millions of double precision floating point calculations, any one of which would throw off the roll-up of all of those projections in a bottoms-up consolidation back to the highest level in the organization.
The total floating point error after all of those calculations was ZERO. That was in 1986, and floating point libraries today are much, much better than they were back then. Intel does all of it's  intermediate calculations of doubles in 80 bit precision, which all but eliminates rounding error. When someone tells you "it's floating point error" it's almost certainty NOT true.
Answer: declare @float as float(10)
declare @Decimal as decimal(10)
declare @Inetger as int

set @float =10.7
set @Decimal =10.7
set @Inetger=@Decimal

print @Inetger

in float when set value to integer print 10
but in decimal 11
Answer: float (and double) represents binary fractions
decimal represents decimal fractions


Dining Room Table Refinishing

Question: We have restained our table and have put the first coat of Helmsman on it and I have lightly sanded to get ready for the second coat.However, we dipped one of the staining pads into the can and the varnish and the stain have now mixed. I have tried to filter the varnish but it is now the stained color. Is the rest of the varnish still good to use or will it cause bubbles, etc.?
Answer: If both the varnish and the stain are in the same solvent, then mixing should be fine. (The labels will specify either water or mineral spirits cleanup.)
Don't be tempted to not stir the varnish before use, as there can be flatting agents that collect in the bottom.
Comment: Yup, if they were not compatible they would not have blended. They would be separated in the can or you would have some mucky emulsion. Use quality brush to apply, follow varnish application directions... should be fine.

Dining Room Table Refinishing


Multiple Stuck "Downloading Application" Attention required tap here

Question: I just got a replacement WP8 Nokia 928 for a defective one.  After putting the SIM card in the new phone from the old I went through the start up options and one of them was to restore from my old phone, it showed the name of the old phone ore start with a clean slate.  I select restore settings from the old phone and everything seemed to be going well until I got an error message that said it was not able to restore because it lost signal (my paraphrase).  Ever since then I have 16 of these messages in my Market place message area, Downloading Application Attention required tap here.  Can I get rid of these w/o resetting my phone?
Comment: Update: I did a reset of my phone and restore from the previous, i.e. the same one I started the other day.  I received no error messages and it finished successfully, but still I have 16 stuck "Downloading Application" Attention required... messages.  Is this a bug?
Comment: If you click those apps they provide more info? I had a similar problem. It was because some apps were removed from the store (but the backup hold them) and apps that were carrier or OEM specifics. I changed from an HTC to a Nokia.
Answer: After some frustration and searching I found the answer here.
In short, if you hold the "Downloading application" progress message instead of tapping it, a pop-up dialog appears offering a "Retry" or "Cancel download" option. Tapping "Cancel" successfully cancels the corresponding download.


How can I create a flow to change a content type after an item is created or modified, without giving people the ability to change the content types?

Question: So I have a flow in place where an item's content type changes from "Item" to "Edit item".  The plan here is when someone submits a new item in the list, the next time someone goes to edit that item the form will look different with different fields.  The flow works if I keep "Allow Management of content types" on yes.  However, this also leaves the content type on the form where people can change the content type to whatever they want.  If I turn off the management of content types, my flow no longer works and my items remain the "Item" content type.  How can I change the form from a new entry to an edit entry without letting any user change what content type it is?
Answer: Don't know if this will work but try this:
Enable content types on your list. Add your content types. Write your Flow. Then disable content types on the list.
The content types will exist, users won't be able to use them (other than the default) and they'll still be settable via code. At least that's my theory based on years of SharePoint hacking.
Comment: I assumed that would work.  The flow doesn't work when I disable content types.  It works while the content types are enabled, but when I disable them the flow can't see the Content Name I am using.


pre-load new scene in unity async but don't show it

Question: I have a top down dungeon crawler in 3D where I show one room at a time. Each room is it's own unity scene. Each room has an exit point that when clicked I fade the screen, load a new scene and then fade in the screen. What I'd like to do, but not sure how, is to pre-load the next possible scenes (note the S, there will be 2 but could be more. 2 because it's the next room or the previous if the player decides to go back) while in one scene. I know the scenes that are possible to get to, but how can I pre-load but not show them and because there is more than 2, I assume if they go in one direction, there is a pre-loaded one that I need to unload. Overall I want to do this to make a faster/smoother transition between rooms, but I want the one room at a time for artistic style.
Answer:
Parent everything in each room's scene to one (or a few) root GameObject(s) that can serve as a point of reference for the room as a whole.
Place a script on these roots with an Awake() method that switches off its own GameObject using gameObject.SetActive(false); - Now as soon as the room is loaded, it will disable its own rendering & gameplay before it has a chance to affect anything or appear on screen.
When it's time to show that room, re-enable its root object(s) with gameObject.SetActive(true);
Your roots' Awake methods can register them with the corresponding exit points from the main room, so they're easy to find when you need to show them or unload them.
Comment: One thing to note, be careful how many layers deep you nest though as every time an object moves it notifies every object up the chain to the root object. Just an optimization thing to keep in mind. I like the approach though and might use it in my own projects.
Comment: Profile first to see if this becomes an issue — so far I haven't seen significant impacts from hierarchy depth in any Unity game I've worked on. If it does begin to pose an issue, you can simply add to the disabling script to have it find all its dynamic children and dump them into the top level of the scene when needed. ;)
Comment: I have actually seen that used. Unity had a blog post about it.


Is there a safe place to stash items in Hengsha?

Question: I've recently moved onto the second major hub area in Deus Ex: Human Revolution. So far, I haven't come across anyplace as safe as my apartment in Detroit. I don't feel like lugging a rocket launcher with me everywhere - is there a safe place I can stow extra gear, or can I drop it anywhere and it'll be there when I return later?
Comment: I'm not sure your apartment in Detroit is safer than any other non-restricted area.  If anything, your apartment is a worse place to store items since its out of your way most of the time.
Comment: I'm not 100% sure if they will be remain when moving from city to city but int he same city, yes.
Comment: That's fine for now. If you'd like to post your comment as an answer, I'll accept it and we can clean this up a bit.
Answer:
City hubs with sidequests are temporarily safe to "store" things in, until you leave the city hub, and the game always warns you when you do this about how side-quests will be un-completable.
No other mission area is safe. Sometimes the game tells you you won't be able to return to an area, but don't count on it. If nothing else, there are some one-way elevator rides, etc.
Answer: I left a fully upgraded silenced pistol on the floor of my apartment in front of the "stash" area and when I returned, it was nowhere to be found (much to my intense rage). Luckily I had an old save file that still had it. My recommendation is to leave ammo and health and non-essentials there, or to just sell them. Any weapon you really like should probably stay in your inventory, or make sure you save a file before you leave it on the floor.
Comment: That's very odd. I left some weapons and ammo on the floor of my apartment, and when I returned back to Detroit after Hengsha things were exactly as I left them. Not sure why that wouldn't always be the case.
Answer: I'm not sure your apartment in Detroit is safer than any other non-restricted area. If anything, your apartment is a worse place to store items since its out of your way most of the time.
I'm not 100% sure if they will be remain when moving from city to city.
Comment: Items you place in your apartment in Detroit do remain even after leaving for China.
Comment: If you ever get a "are you sure" prompt during the main quests that mentions side-quests will become un-completable, that means the hub is either going to be inaccessible after that point or else going to be "reset" for new plot conditions.
Answer: IMO the best bet is the Hengsha Whore Hotel, somewhere near the weapons dealer, available from the very start of first visit in Hengsha; I think that only storing some spares makes sense here, as Detroit is visited more times and covers more of the gameplay. Also, slight story spoiler,

 don't place the items in Alice Garden Pods - that area will get off-limit for/at some time.

To sum up: simply use the streets; no NPC will bother with your items at all, and they will stay there until the riots start.
After that, you're up to your arm augs to help you manage your stuff, as you won't be getting back to Detroit after that, and your following visit in Hengsha will also be the last.
Note that some subareas do get reset with time (doors re-closed, barrel/boxes/computer terminals reset etc), but the loot doesn't.
Source: my recent gameplay;

 all the items left in various places during the very first visit were still there during the riots


How far should my wall be from my furnace/water heater?

Question: ) we are refinishing the basement and are enclosing the furnace/water heater, leaving a thin 27" door. My water heater sits back beside my furnace and the enclosure is going to be square so I think the WH will be fine. But how far from the front of the furnace should  I put the studs? And how about the one side? Oh yea they sit about a foot and a half off the wall so the back will not be enclosed.
Thanks so much
Comment: If the appliances you mentioned use gas, don't forget to put grilles in the door or the wall: one on the top and one on the bottom. Those things need air to burn gas.
Comment: You should locate the original manufacturers documentation for the equipment (might find it online), and check that for clearance values.  As iLikeDirt points out, if these are gas appliances, you'll have to supply enough combustion air. You'll also want to check local codes, as there's typically an area about the equipment that must remain clear (known as "*working space*", or similar).
Answer: According to International Residential Code (IRC), you'll need to provide a 30" x 30" level working space for servicing and inspection of both appliances. You'll also have to follow the manufacturers installation instructions, for clearances from combustible materials and any other restrictions.
You'll also have to consider supplying the equipment with adequate combustion air, and supplying the air from an appropriate source.
Working Space

International Residential Code 2012
Chpater 13 General Mechanical System Requirements
Section M1305 Appliance Access
M1305.1 Appliance access for inspection service, repair and replacement.
Appliances shall be accessible for inspection, service, repair and replacement without removing permanent construction, other appliances, or any other piping or ducts not connected to the appliance being inspected, serviced, repaired or replaced. A level working space at least 30 inches deep and 30 inches wide (762 mm by 762 mm) shall be provided in front of the control side to service an appliance. Installation of room heaters shall be permitted with at least an 18-inch (457 mm) working space. A platform shall not be required for room heaters.

Water Heater

International Residential Code 2012
Chapter 28 Water Heaters
Section P2801 General
P2801.2 Installation.
Water heaters shall be installed in accordance with this chapter and Chapters 20 and 24.
P2801.3 Location.
Water heaters and storage tanks shall be installed in accordance with Section M1305 and shall be located and connected to provide access for observation, maintenance, servicing and replacement.
Chapter 20 Boilers and Water Heaters
Section M2005 Water Heaters
M2005.1 General
Water heaters shall be installed in accordance with the manufacturer's instructions and the requirements of this code. Water heaters installed in an attic shall comply with the requirements of Section M1305.1.3. Gas-fired water heaters shall comply with the requirements in Chapter 24. Domestic electric water heaters shall comply with UL 174. Oiled-fired water heaters shall comply with UL 732. Thermal solar water heaters shall comply with Chapter 23 and UL 174. Solid-fuel-fired water heaters shall comply with UL 2523.

Furnace

International Residential Code 2012
Chapter 24 Fuel Gas
Section G2408 (305) Installation
G2408.5 (305.8) Clearances to combustible construction.
Heat-producing equipment and appliances shall be installed to maintain the required clearances to combustible construction as specified in the listing and manufacturer's instructions. Such clearances shall be reduced only in accordance with Section G2409. Clearances to combustibles shall include such considerations as door swing, drawer pull, overhead projections or shelving and window swing. Devices, such as door stops or limits and closers, shall not be used to provide the required clearances.
G2409.4 (308.4) Central heating boilers and furnaces.
Clearance requirements for central-heating boilers and furnaces shall comply with Sections G2409.4.1 through G2409.4.5. The clearance to these appliances shall not interfere with combustion air; draft hood clearance and relief; and accessibility for servicing.
G2409.4.1 (308.4.1) Appliances clearances.
Central-heating furnaces and low-pressure boilers shall be installed with clearances in accordance with the manufacturer's instructions
G2409.4.5 (308.4.3) Clearance for servicing appliances.
Front clearance shall be sufficient for servicing the burner and the furnace or boiler.
Answer: Even if the furnace is direct vent, meaning it requires no interior air supply, it is still wise to allow air to circulate in the furnace space with the space outside it.  Otherwise the temperature can potentially run quite high possibly leading to premature furnace component failure, especially the electronics.
During damp weather, my grandmother would use the furnace room as a drying room for laundry.  If your space is not at a premium, perhaps making the enclosure extra large would help create a naturally green drying solution.
Comment: Heck I just use the whole house as a drying room. Clothes go on a folding rack right by a register!


What is 'protein' in food?

Question: I know that proteins perform a lot of functions and as a result there are a lot of different types of proteins in our bodies. When I eat food that has x grams of 'protein', what is this? A homogenous mix of proteins? A heterogenous one? Is it specific set of them that are general enough to be used by my body despite coming from a different organism? How can it be sure that my body can use the kind of protein in the food?
Answer: When we say "protein" with respect to food, what is generally meant is material that contains amino acids.  Every protein is, at its heart, a long string of amino acids, which then gets processed through some combination of folding, cutting, and bonding together with other molecules.
Much of our food is made out of cells, whether animal (e.g., meat), plant (e.g., vegetables, fruits, grains), fungal (e.g., mushrooms), or bacterial (e.g., yogurt).  Every cell has a widely heterogeneous mix of proteins, comprised in turn of a widely heterogeneous mix of amino acids.  Milk-based foods aren't cellular, but also have a wide range of amino acid content, because mammals produce milk as a complete food source for their babies.
Inside your body, digestion breaks the proteins, whatever they might have been originally, down into amino acids, and that's what you really need to pay attention to in terms of nutrition.
The human body can synthesize the majority of amino acids out of other molecules, but there are nine essential animo acids that we have to get from our food.  Any diet that provides a sufficiency of those amino acids, no matter what sort of proteins they may be originally bound up in, will provide what you body needs in terms of protein.
Comment: I suspect that the actual bacterial biomass in a standard yogurt is pretty darn low.
Comment: @Arthur well, if we take a _standard_ yogurt — e.g. specified by a Russian standard, [GOST 31981-2013](https://docs.cntd.ru/document/1200107778), we get the requirement of ≥10⁷ CFU of particular bacteria (see §3.1). Dunno whether it's high or low, but the numbers are available.
Comment: @Ruslan 10^7 CFU *per gram* if Google reads the Russian correctly·  But even assuming we could say 1 live cell=1CFU (as I do below to get a crude guesstimate), we don't know how many dead bacterial cells are in there.  Presumably not 0.  Taking sizes for lactobacillus cells from Britannica and assuming they're mainly water from the point of view of density we get something like 1 part in 10^5 by mass live cells, or "pretty darn low".  I'm no biologist so couldn't even begin to work out the live:dead cell ratio - but can't trivially find it
Answer: It's a mix of all the proteins in whatever organism the food is coming from. Some (especially vegetable/grain) sources might have fairly specific proteins present because you are eating a specific part of that organism which is enriched in that particular protein, but ultimately the specific proteins don't matter much unless you have some sort of allergy. The reason it doesn't matter much is that your body won't use the whole proteins at all.
All proteins you eat are digested into their constituent parts: amino acids. Essential amino acids are those that a human cannot synthesize themselves, so it's important that the diet contain all of these. Vegetarians/vegans in particular should be familiar with the concept of "complete protein", or combinations of food sources that serve as "complete", to ensure they have access to all the essential amino acids.
Answer: As one might suspect, if a label says just "protein" without being more specific, it means any protein, without being more specific.
The reason we are not that interested in the details is that the body denatures most proteins in the acidic stomach and the intestines and breaks them up into their building blocks, the amino acids, without really taking a close look at them. (It's a bit like breaking up your brother's Lego stuff when you simply need grey bricks: It doesn't really matter whether it's his Millenium Falcon or his Saturn V.) The amino acids are then absorbed through the intestinal wall. They are used to synthesize the proteins our body needs (build your own star ship).
Our body can synthesize many of the 21 amino acids from scratch, some of them always in sufficient amounts; but nine of them must be ingested with food. They are called "essential" amino acids. They are like the special corner pieces you so badly need to finish your design and that are not so common.
If they are missing, which can happen with a non-varied diet, the body cannot use the other amino acids to create its needed body proteins and instead synthesizes carbs and fat from them. Therefore, a diverse diet is needed to fully utilize protein in food as building blocks for the proteins the body needs. That's the — important — exception to the rule that all food proteins are nutritionally equal.
Comment: @MikeMaxwell if nothing else, **one would think** that eating collagen would ensure that you get all the amino acids required to build collagen in the human body.
Comment: Which is why eating collagen-rich food if you think you're body needs to build more collagen (like for joints) doesn't make any sense.  Even this site: https://www.webmd.com/diet/foods-high-in-collagens#1 gets it wrong: if your body is going to break the collagen down into amino acids, what difference does it make whether those amino acids come from collagen or from some other protein?
Comment: The two most common amino acids in collagen are glycine and proline. ( https://en.wikipedia.org/wiki/Collagen ) The glycine-proline-hydroxyproline is the most important sequence motif for collagen structure. Neither glycine nor proline are essential amino acids (and hydroxyproline is made by post-translation modification of proline), so I think @MikeMaxwell has a point.
Answer: The other answers are correct: foods you eat include a mix of proteins, which are mostly cut into their constituent amino acids in your digestive system. However, while a burger (meat or veggie), might contain thousands or millions of distinct proteins, there are some proteins that much more common than others. For example, in blood plasma, there are more serum albumin molecules than all the other protein molecules combined.
Meat
In meat, the predominant proteins are actin, myosin, and tropomyosin. As might be expected, the function of these proteins is to allow muscles to move and apply force. Myosin heads "walk" on actin tubules. Connective tissue proteins collagen and elastin are also a major components. The function of these proteins is to provide structure and elasticity. Blood proteins such as serum albumin, myoglobin and hemoglobin are also included. The major role of serum albumin is to regulate the osmotic pressure of blood (keeping cells from accumulating too much water and bursting or losing too much water and dessicating). The function of myoglobin and hemoglobin is to carry oxygen.

Myofibrillar proteins are the main components of meat, and there are around 20 or so different types in this particular group. In perspective, out of the overall 50%–55% of myofibrillar protein, myosin and actin alone account for around 65%–70% of this figure.

From: Meat: Food and Science of the Animal Kingdom.

Actin, by Thomas Splettstoesser, CC BY-SA 3.0
Beans, peas, lentils
Pulses (peas, beans, lentils) contain mostly legumins and vicilins, which are oligomeric storage proteins. Hence, they serve no function other than to store amino acids that the new plant can use to grow from the seed. Legumins form from 6 subunits and have a total mass of 300–400 kDa. Vicilins are heteromeric or homomeric trimers with overall masses of 145–190 kDa.

Phaseolin, a vicilin storage protein in beans.
Milk
The major protein in dairy milk is casein. These proteins have an unusually high amount of proline, which inhibits secondary and tertiary structure formation. Their function is to supply amino acids to infant mammals and carry essential nutrients such as phosphorus and calcium. Together α-, β- and κ-caseins make up about 70% of cows' milk, with the rest consisting of lactoalbumin and lactoglobulin.  They comprise 20–45% of the proteins in human milk, depending on stage of lactation.

What is 'protein' in food?


LED typical and forward voltages

Question: So, I was going through the spec sheet of super bright 5mm orange LED, and it was listed that the forward voltage is between 1.8V and 2.5V. Below that there was a property listed as 'typical voltage' and had a value of 3.2V. I'm confused as to what value of resistance I must use.
Comment: Provide said spec sheet please.
Comment: I think it should read 2.3 instead of 3.2.
Comment: Here ya go : http://pcboard.ca/leds-and-led-ribbon/leds/5mm-leds/5mm-super-bright-orange.html
Comment: Yeah. Strange. Perhaps they mean typical circuit voltage, this LED is used in?
Comment: Okay. But if that's so what's the relevance of such a value?
Comment: Looks like an error on the page,  if you ask me. Because the data for the white one looks ok
Answer: The important thing to realize is that CURRENT is what MATTERS to an LED. The voltage is given as a range because the voltage varies, depending on manufacturing tolerances, temperature, etc.
If you design well for LEDs, you feed them with a current source, and the voltage simply needs to be adequate for the number of LEDs you have in series on each current source. In figuring the voltage compliance your current source should have, look at the highest voltage quoted.
If you use resistors for current-limiting LEDs, use either the LOWEST value of forward voltage provided, or a bit less than that (safety margin) when choosing a resistor to set the current. This is sub-optimal .vs. a current source, as it will generally be providing less than the maximum safe current in order not to provide more than the maximum safe current under conditions (or for parts) where the forward voltage is particularly low.
Comment: Using a current source for LEDs is totally overkill for many applications. Using resistors is just fine for indicators.
Comment: ...where sub-optimal is just fine, being merely an indicator. I didn't say it was wrong, I said it was sub-optimal - and it is, if looking for maximum safe output.
Answer: Quick solution. If you want to know the forward voltage hook your LED to a power supply turned down to 0 volts and slowly crank up the voltage.
You LED will turn on once forward voltage is reached.
However, you might blow an LED up doing this so proceed with caution.
To help answer your question. Use forward current to decide on what resistor to use and take the worst case forward voltage.
Comment: The power supply proposal is more realistic if you have a lab supply that has variable voltage and variable current limit. Set the voltage to say 4 volts and start with the current set to 0. Connect the LED in forward bias mode and carefully increase the current limit up to allow current to flow to the LED.
Comment: It's a pretty bad suggestion... no current limiting? Come on..
Comment: @EugeneSh. Never had a problem with current draw, and very helpful when your LEDs get jumbled up. But like I said, its risky.
Comment: Always use a resistor in series.
Comment: I think it's a bad idea. Once the threshold is reached, even for a slight increase in voltage, the current levels will increase unprecedentedly.
Comment: @MichaelKaras I agree that would be useful for finding forward current but not forward voltage. I think if you want to be safe about not damaging your LEDs you could set the current limit to the forward current on your power supply.
Comment: @JakeRobinson - My bench supply works pretty nice as I described. It has digital meters on it that show current and voltage. As the current is increased the meter on the supply is showing the voltage across its terminals at the same time. You can crank up current to desired level and directly read out the LED voltage.
Comment: @MichaelKaras O nice, well in that case sounds good. Your description made it sound like you could not read back the voltage  after setting it to 4.
Comment: @JakeRobinson - Well if the lab supply had no volt meter it would stand to reason that if trying to measure LED forward voltage you would have a DVM hooked up.....right?
Comment: @MichaelKaras If that is what you are trying to do then yes.
Answer: If you have doubts on the stated specs, you can make a simple Constant Current regulator to test an LED out with a common adjustable LDO.

R1 can be a fixed resistor, or more conveniently, a variable resistor or trimpot. For 20 mA, that's 62.5 Ω. (R = V/I, in this case VRef / IOut).
Simply measure the voltage across the Load/LED and you know how much it's Forward Voltage Drop at 20mA is.
Comment: Sounds like a good idea. A constant current source will always come in handy.
Comment: A small doubt though.. What's the cap used here for..
Comment: @user4493465 filtering the input. Use whatever cap is recommended by the regulator you use. It may be 1~100 uF instead.

LED typical and forward voltages


Is a protocol an application?

Question: Basically, I was debating in my head how an API and a protocol are different. After thinking about it, I come my newbie conclusions that I believe they are pretty much the same, except that protocols are more like an API that is widely accepted and used. For example, both API's and protocols define criteria and specifications for two or more components to work together. An API defines that criteria for a specific program. A protocol say, such as SSH, is a program itself, with it's own specifications. Another to think about is that a protocol is simply a set of specifications. Any thoughts guys? Sorry if I sound ignorant.
Comment: In the sense that a protocol accomplishes something against a specification, yes, it is an application.  But so is a cake recipe.
Comment: An API is not an application. Your title and the body of your question do not agree.
Comment: related (possibly a duplicate): [What's the difference between the terms "protocol" and "standard"?](http://softwareengineering.stackexchange.com/questions/105449/whats-the-difference-between-the-terms-protocol-and-standard)
Comment: Neither a protocol, an API nor a cake recipe are applications.   SSH can refer to a protocol and there is an application named SSH.  Those are not the same things.
Comment: so how about TCP/IP protocol? what's the program for it?
Comment: Neither is an interface an implementation.
Comment: @LưuVĩnhPhúc I believe TCP and IP applications implemented as part of the OS Kernel.
Comment: In DOS there's no TCP/IP support in kernel, but there are still some browsers running in DOS. Application is an implementation of something whereas ABIs, APIs and protocols are just conventions for connecting and communicating between applications.
Answer: No. A protocol is not an application.
A protocol is a set of rules for systems or components of systems to communicate with each other, exchange information, recover from errors, establishing a semantics.
A protocol can be implemented by hardware, software, people, or a combination of any of them.
Usually, the specified behavior is independent of any particular implementation.
On the other hand an application is a computer program, a piece of software.

A protocol say, such as SSH, is a program itself

In reality that app is called after a protocol. Two things with the same name are not necessarily the same thing. You could write an application that implements the SSH protocol and call it "Buba". The application is not the protocol and vice versa. Different versions of Unix and or Linux can have different implementations of the SSH utility, yet all of them call the program ssh.
Many applications implement the XMPP protocol and they are not named after the protocol.
Also it is possible for a protocol to exist only on a document or published (or unpublished) paper if nobody has implemented it yet. Yet is is still a protocol. Even when no software app, system or API implements it. When a protocol is widely accepted (and widely implemented) it can become a standard (or not).
Comment: Awesome explanation Tulanis! Thanks for the clarification.
Comment: Hmm, nothing here is wrong , it defines a protocols context fairly well but this fails to explain why an API can't be the same thing.  The op is right about the concepts being similar.  I believe the main difference is the context that would traditionally be implied.  Not exactly a  technical difference.  Americans call it a can. Brits call it a tin.  If this is wrong please edit to clarify why.
Answer: All APIs are protocols, but not all protocols are APIs. For example, the connection between a keyboard and the motherboard is governed by one or several protocols (PS/2, USB, Bluetooth, etc), but we certainly wouldn't call it an API. An API is a specialized form of protocol that allows two applications, sub-systems, etc (or two copies of the same application) to communicate and possibly control each other.
APIs are also what we refer to when we start talking about libraries, such as OpenGL, Win32, .Net, and so on. The source code that you write in whatever language you use calls API endpoints, which in turn invokes libraries, and eventually the operating system or a specific piece of hardware. The API abstracts the literal machine or network interpretation away from the developer so they can focus on implementing applications rather than worrying about how that feature is implemented in the lower levels. In that sense, APIs are a form of abstraction.
For example, the SOAP API of many enterprise applications allow developers to import the API into the development environment of their choice in order to communicate in a prescribed manner. Once implemented, the client software can speak to the server and cause it to insert data, update data, retrieve data, delete data, and so on, in a method prescribed by the server.
Sometimes, protocols and applications are coincidentally named the same thing, usually as a matter of convenience, or because it was the first of its kind. In your example, the SSH application uses the SSH protocol for communication to a text-based terminal. However, Git also allows the SSH protocol to be used as a form of communication to an upstream repository, but Git is not called SSH.
Here's the difference, though: Git's use of the SSH protocol constitutes an API, while the SSH application's use of the SSH protocol is simply a tunnel to a server, and not an API. Git commands, like "push", "pull", "merge", and so on communicate through the SSH protocol but utilize the Git API. Manipulating the server via SSH requires additional commands that are interpreted by a shell, where the shell acts as the API, and SSH acts as the protocol.

Is a protocol an application?


What is the meaning of highlighted part in the paragraph given down below?

Question: "But there is another group of observable phenomena, more subtle, that you can't study in fact, you can't even tell they're there at all unless you suspend or bracket your skepticism and try every way possible to perceive them."
Answer: To suspend your scepticism means to pause or temporarily prevent this quality from being in force.
To bracket your scepticism means to restrain it, check it; don't allow it to be active.
He needs to do one or the other (or both) if he is expected to understand whatever esoteric mumbo-jumbo is taking place in this text.
Answer: It means you have to believe/have faith in order to be able to see less obvious tangible things
(basically the opposite of a scientific mind)


Subheading for comments

Question: We have a subheading for votes, badges, answers, and questions. Could we have it for comments as well, so that we note how many comments we have, and how many votes or flags each of them have?
Comment: Very good idea. Unfortunately, this would go against the policy of our website's creators, which is to discourage commenting in general and prevent us from using comments efficiently. They have explicitly stated this policy. Their reason is that they want to discourage discussion; in short, they want simple answers or nothing.
Answer: If you want to see your comments I suggest your user page activity tab, filtered for comments:
https://english.stackexchange.com/users/8183/ham-and-bacon?tab=activity#apage_1-afilter_comments
The main function of a Q&A system is asking questions and getting answers, so there's a limit to how much we want to promote the meta-commentary of comments.
That's why

it takes 50 rep to leave a comment
there is no gold comment badge, only silver

for example.

Subheading for comments


How can I glue photos back to back to a card, then laminate?

Question: I want to print two photographs, then glue them back to back, and laminate the result. what glue should I use? Is 3M Spray Mount spray suitable?
Comment: @StanRogers, to be fair, I added the archival tag because I figured the topic would come up in the answers. Maybe Harry can let us know what degree of longevity is required for his application.
Comment: 3M Spray Mount will do the job, but nothing that involves laminating or gluing (or anything else that isn't reversible without damaging the work) belongs in any discussion of archival materials or methods.
Answer: I have done some tests. I made some business card sized images and printed them on Xerox paper, matt coated one side, 95 gm/square metre. To form a two sided image I printed,  using an ink-jet printer.  The front and back were adjacent so that I could fold the result. I used Staples (the office supplier) glossy 125 micron (each side, 250 micron total) thick pouches and a domestic laminator.
Four tests:

No glue and left a margin of transparent laminate around the paper.
This was ok, but I didn't want the margin if I could
avoid it.
No glue and cut off the laminate at the edge of the paper. I thought it possible that the laminate glue might penetrate the paper and glue it together. No such luck, it remained as a folded sheet.
I glued the folded paper together with 3M Photo Mount spray and laminated the result. However vapour from the glue made the laminated result bubble up, although it shrank back to a flat card after a while. Trimming the margins off left me with a viable result with the images going to the edges of the card.
Did the same as (3) but I left the glued paper in a warm place (an airing cupboard) overnight.  There was no bubbling and the final result was what I wanted.
Comment: Very informative answer about what you tried and what did and didn't work.  I just applied some editing to make it a little easier to read
Answer: I frequently use 3M Spray mount or similar for mounting photos.  There is also a photo specific version that is slightly more friendly to the dies and such in theory.
If you are laminating the result, really even something that is minimally tacky should work and might give a smoother result since it would be a thinner coat and only needs to hold it in place until the lamination.
Comment: Thanks for those answers@Stan Rogers and @AJ Henderson, very helpful. I was mostly afraid that the glue might do something nasty in the heat. I realised after I had asked, that I can find out by experiment, and I will report my findings here as a comment, if that is appropriate.
Comment: @HarryWeston - it's actually perfectly appropriate (and encouraged) to report back your findings as an answer as well.
Comment: I have done some tests (delayed by urgent DIY). I made some business card sized images, and printed them on Xerox paper, matt coated one side, 95 gm/square metre. to forma a two sided image I printed the front and back adjacent so that I could fold the result. I used Staples (the office supplier) glossy 125 micron (each side, 250 micron total) thick and a domestic laminater. Four tests: (1) no glue and left a margin round the paper and of course this was ok. (2) no glue and cut off the laminate at the edge of the paper. I thought it possible that the laminate glue
Comment: Thanks @AJ Henderson. I started off that comment but it got too long  (should have RTFM, you said "answer"). I posted it so that, being lazy, I could copy and paste it as an answer, and then could not delete it, sorry, happy to have these last two comments removed.
Answer: Most recommendations concerning what glues and cements are best for photographs, stem from the days of chemical-based prints. We are talking silver/gelatin black & white and dye/gelatin color prints on conventional chemical-based photo paper. These recommendations steered you away from cements with low pH and chemical content that could damage. All sound advice. Chemical-based silver/gelatin prints are attacked by sulfur, and chemical-based color prints are comprised of organic dyes that persist only if the pH is within a narrow range.
Further, both the color and the black & white images were bonded to the paper using glue made from gelatin. This is the same gelatin used to make tempting desserts. Pastes and glues that absorb moisture are no-nos; the moisture migrates to the gelatin. Add water to gelatin on paper (or film) you get a tasty meal for mold and other beasties. I think modern prints produced by inkjet and the like are more robust. Not to the point that we should throw caution the wind, but not to the point we should become paranoid as to what glue or pastes we should use.


IPhone OpenGL ES single or multiple views?

Question: I'm confused on what the best approach is when writing a game for the iphone. The game will be rendered with OpenGL , but im curious when creating the Start Screen, Menu's, High Score page, etc. Do you do all of that with OpenGL or do you create additional UIViews and use the UIKit?
Answer: I don't think there is a best approach. If you have the time to code up menus and high score tables in OpenGL the you have a lot more flexibility - you could for example have a 3d animation going on in the background.
If you code menus, high score tables, etc. using standard UIKit views and switch out the OpenGL view while they are shown then this has the advantage that it's very quick to code (esp. if you took the time to learn to use Interface Builder), but it is inherently 2d. Even though you can still use custom button graphics and fonts to make it look less like a business app, it's still going to look less polished compared to other games in the app store.
What you don't want to do is to layer a transparent UIView over the top of you OpenGL view - this will be very slow.
I personally use Interface Builder generated views to get stuff like menus in while I'm building the rest of the program. The intention is to replace that with OpenGL animated code later. In the end though, it's really down to how much time you have available.
Comment: Thanks, i think i will just go the ES route to do all of this.
Comment: But, what You do about the text ?...I can make my buttons and interfaces in openGL, but how do You deal with the text ?...if all of my game is in english for example I only write It over my graphic assets, but what if i need to  localize  It ?, seems kinda of complicated
Comment: Usually in a game you have two situations: a small amount of text and a large amount. If it's a small amount you'd probably burn the text into a bitmap and in the case of localisation, just have multiple copies of the bitmap. Where you have large amounts of text, it's not practical to store it in a bitmap anyway, you need to render the text at runtime. You can create a graphics context on an off-screen bitmap, use Quartz APIs to render whatever (including text) and then use that bitmap as an OpenGL texture.
Answer: I don't think there is a right answer for this. I personally use opengl for everything, for example in menu structures I use textures for the text. I guess it depends on what you want to display, I think it would be easier to create a custom look and feel that goes well with your game if you stick with opengl.
Comment: Yes i think i will take this approach, but i just didnt know if it was better practice to let apples uikit handle the basic's.
Answer: I've heard contradictory things about this. I've heard it's slow when you render UIKit over the OES.
I say, if you see another app doing it that performs okay, follow suit.
Some of the more popular games do everything in OES - e.g. Rolando. Maybe it's best to follow that pattern.
Comment: I don't think he's asking about layering UIKit over OpenGLES views, just whether to use it for other 'modes' of the game.
Comment: Yes like u62 said, basically i would have in that example a bunch of view controllers and pushing/poping views based on the proper one to display.
Answer: In addition to what others have said, consider that it's a bit easier on you to stick with OpenGL since that's going to be the bulk of your codebase.


Using Ethereum public and private keys to encrypt and decrypt message (metamask client)

Question: I am trying to use Ethereum private and public keys for message encryption like PGP and I found out this npm module on github, https://github.com/pubkey/eth-crypto#encryptwithpublickey, which it lets you get public key from private key, encrypt message with public key, and decrypt message with private key. I am using MetaMask as the web3 interface for my dapp and I am trying make the message encryption works seamlessly. However, I cannot find a way to automatically pass in MetaMask default account's private key to the npm modules rather than manually clicking export private key from MetaMask's extension UI.
Answer: The point of Metamask as a product is to never expose the private key to the web applications that the user browses to. In order for you to use that particular tool to encrypt data in a custom way, Metamask as a plugin would need to include a hook to have the web application pass in the data to be encrypted, and have Metamask to the encryption itself.
This is similar to the idea of signing a message; there's an established standard for using a private key to sign a given message, and Metamask provides a hook to allow application developers to send a string to Metamask and have it sign the string and return the signature, never exposing the private key.
The approach you'd probably want to take with your application is not to work with Metamask, but to create a utility that fulfils the same role as Metamask (is an Ethereum wallet in its own right), such that it receives the private keys (or mnemonic phrase) from the user, and then has the keys available to encrypt data for the user.
Comment: Thank you for the comment, I was thinking about using MetaMask's signing workflow. However, the signing function is pretty limited, which I don't think I can build a PGP like encryption messaging system upon it. You are right, I'll look into building a Ethereum client with encryption system built in.
Answer: Your private key shouldn't be automatically sent to any website, that's actually a security feature. Since anyone with your private key would allow to any website that has access to it would also have full access to your ethereum account, that's not only desirable, but i would also recommend to use a different account solely to encrypt and decrypt messages, because if any security issues arise from this or any other site, you would only loose the secrecy of said messages and not your funds or any other functionality associated with your main account.
Comment: Totally agree with you. What would you recommend me to do for message encryption on ethereum besides using whisper.
Answer: You can use Metamask's built-in decrypt functionality.
Check this out: https://betterprogramming.pub/exchanging-encrypted-data-on-blockchain-using-metamask-a2e65a9a896c


Difference between confidential, protected, and restricted data

Question: I've been reading this article about Data Handling Security Measures, what's the difference between confidential, protected, and restricted data? Maybe I could understand it well with example of the data itself.
Answer: Nevermind, those terms are depends on the data classification stated by the company (in this case NYU). Different company has different data classification so the term maybe should not be generalized.
Answer: There is no one size fits all rule for data classification, every organization should make their own classification. A medical records company would have completely different requirements than a industrial design company. The medical records company would need to protect personal data, and a breach would lead to reputational loss. An industrial design company would want to protect their trade secrets, and a breach would lead to financial loss through competition. Each would want to write their policies to protect themselves in their own unique situation dependent on several factors including:

Industry
Regulations and laws
The types of data the organization handles
The types of losses that can be incurred from data leakage

A data classification policy may be kept separate from other policies, in fact it is linked to in the page you supplied with your question.
You can see from the definitions that NYU classifies personal data higher than intellectual property, most likely because a breach of PII or health records would create the biggest media splash.


How to politely ask if they would be paying for the project

Question: Hello I am a junior student of Computer Science Major in Software Engineering, there were persons from other colleges who wants us to collaborate with them to make an application for their thesis. The other teams have already come up with the agreement their other party who also want to have systems made for their thesis that they would pay. So I want to accept this proposal, for money and experience, but how should I ask them if they would be paying for the software we will be building for them? And that we wouldn't work for free?
Comment: Not sure. Perhaps this fits [academia.se] better?
Comment: Hi. Who is "they" you want to ask? If you know who is going to be paying who, and if this is a group project, could you not ask one of your team members to explain this to you?
Comment: How are the other teams involved? How were you made aware of the opportunity? Are those people also undergrads? (And a side note - are you sure writing software for someone else's thesis like this is ethical? It could be, but it's unclear what your role is in this situation.)
Comment: Where are you located? Interpersonal skills are often culturally specific.
Comment: @NVZ This would *probably* get closed on Academia - they are geared towards grad students and faculty and do not take questions about undergrads.
Answer: When you work on a project you get "paid" in 3 different ways:
1. With money.
2. With the experience.
3. With the contacts you gain.
Look at this project and score the order in which you are motivated to do this project? Is it experience first, money second and contacts third? Which one is the top one?
If money is the most important, decide how important and under which amount of money you'd feel they've taken advantage of you. Let's say you decided $200 is the minimum you're after. Anything under this makes you feel resentful.
Also think of the industry you want to work in and how this would help/not help with getting into that industry.
Then you can tell them:
"thank you for considering us/me. Who is going to pay for this project? I know when X team did a similar project for Y team they paid Z amount."
Then let them speak.
You know your lowest limit, so if they say they weren't thinking of paying then say:.
"I'm afraid $200 is the minimum I'd accept to work on this project. However if you're looking for people who may want to do it for free, you may want to spread the word via x, y or z groups".
So you stand firm on your offer but at the same time you are stil helpful by giving them alternatives.
Comment: Note that doing it "for experience and contacts" is a terrible deal if the person you are working for is intending to make money off of it.
Answer: It might just be worthwhile to modulate your dialogue with them in such a way that your primary focus is seen as gaining experience, even though it is only fair to expect that you are (and should be) compensated for the time you'd spend working on it.

First, make sure that you express your genuine interest in gathering the requirements for the project. Take notes, ask for clarifications and queries, if the need be.
Ask for the timescales (basically the number of days) that they're looking at to accomplish the completion of the said work.
Finally, coming to the finances, you could phrase your question as:

May I know if you have any budget in mind for this work?

Essentially, this will indicate that you'd be expecting some sort of
 compensation for your time. However, to ascertain that the
 conversation doesn't become uncomfortable (should the budget be low or
 nil), have at least one more question on your plate; for example:

Ask about the schedule: specifically, start date for the project. Once this is answered, you could request for a little time (maybe a day or two) to get back to them with a review, and close the conversation gracefully.
Now you'll have all the details you need to consider / re-consider working on the project. If either of the things above don't look good to you, you could request for another meeting. Only this time, be ready with a thorough review / feedback. Explain if something is not technically feasible or needs more clarity, discuss the complexities, offer any suggestions that you might have.
Finally, if the project is worth working on — based on your assessment from the first meeting, initiate a proper conversation about the timescales and budget, if you think there's any wiggle room with it.


Why does fuse blow up sometimes?

Question: Sometimes once in a year, either one of main fuses or a fuse in room blow up due to something. What is the cause of this? Why do we even use fuses? Is it because the voltage doesn't stay at 220V all the time?
Comment: A fuse "blowing up" and "blowing" are two quite different things.
Comment: Does a light bulb happen to blow at exactly that time?
Comment: Yes, sometimes I noticed the light bulb get fused too and people goes like "fuse blowed up the light bulb" but from last few years I have tube lights in every room apart from bathroom which has a 100watt light bulb.
Comment: Do the fuses blow as frequent as before you installed the tube lights?
Comment: Now its fine but its usually one of the main fuse that blows up. Last time, It blew up when I turned on the microwave oven.
Answer: IMPORTANT:

It is far far better that a fuse sometimes blows when there was no need for it to, than for it to sometimes fail to blow when a fault condition exists.

Blowing a fuse.  The term "blow" will be used here for the fusing of a fuse - the act of melting the fuse wire and breaking the electrical circuit. Terms such as "it blew a fuse"  and "why did the fuse blow?" are common here. The term "blow" in this context may be less common in some countries. Using "fuse" which is correct, as in "the fuse fused", is liable to be too confusing :-).
Why do they blow?
Should they?
 The purpose of a fuse is to protect equipment and wiring against the damaging effects of electrical faults which cause excess currents, and to disable equipment which is faulty. The fuse "blows" when the current carried exceeds the rated value for an excessive time. The higher the overload the shorter the period before the fuse blows. So, equipment which is meant to "draw"  10 amps but which has a short from phase to ground, so it draws, say, 100 amps, will blow its fuse in milliseconds. But, a piece of equipment which draws say double the fuse's rated value, may take many seconds to melt the fusewire and to blow the fuse. The ratio between trip times(time to blow) and "overload to rated current ratio" vary with fuse design and can to some extent be controlled by the manufacturer. This is a complete subject in its own right, but assume that a fuse will blow "after a while" at 2 x + overload and will blow almost immediately with say 10 x +  overload.
A piece of wire can only be so smart ...
 Because a somewhat complex task is being carried out by a deceptively simple piece of equipment (ie a piece of wire) and because the fuse is not always optimally dimensioned for the equipment used, the fuse sometimes "blows" when there is no significant or long term fault condition present.
To blow or not to blow ? - that is the question.
 Dimensioning & surges.
 Assume that a fuse will blow "after a while" at 2 x its rated value then we can expect it to run indefinitely at its rated value.
If we have a household circuit rate at 20 amps and a number of outlets rated at say 10A then it is possible to connect more load that the rated fuse value. If we connect say a 10A fan heater, a 5 amp one bar radiator (maybe in the next room), a 400 Watt plasma TV (about 2A), and some plug in mood lighting at say 1 A or less then all SHOULD be well. 10+5+2+1 = 18A. If somebody then turns on an electric jug rated at say 8A current rises to 26A. More than the 20A nominal value but less than the 2 x 20A = 40A we have said it will blow at. But if the plasma TV is off and is turned on suddenly the power supply input filters amy present a nearly pure capacitive load to the mains. The mains will be at random phase at TV turnon and usually a current spike will cause no problems. But on some random lucky (or unlucky) day the mains may be at the very peak of the mains cycle at turn on.   The capacitor may have stored charge of opposite polarity from last turnoff leading to an even greater current spike. Add a possibly high mains voltage (as happens) and some heavy switching spikes from a nearby factory, or even domestic equipment (treadmill, welder, drill, sander, router, planer ...) Then load + capacitor spike + high mains + switching transient may lead to a very high short term load. And the fuse may decide enough is enough and melt. Or may not.
*Unlikely?*Is all the above likely to happen at once?
 No. But as reported, the nuisance blowing happens only a few times a year. Ij the order of what is expected.
We could make the fuse rating higher (more amps)!
 Yes. That is one solution. But the ability to react to moderate overloads is lost. Along with lack of protection may go loss of insurance, if the insurance loss assessors find a still intact 2 x 20A wire fuse in the smouldering ruins of your workshop.
Comment: @MBraedley - protection of life and property / termination of hazard is a major factor.
Comment: As if that's not confusing enough, fuse can also mean "install a fuse", as well as "join together", which is the exact opposite of what happens inside the fuse at that magic moment.
Comment: Let's also be clear on one thing: the fuse is less about protecting the devices plugged into outlets, and more about the wires that carry the power to those outlets.  Wiring is rated for carrying a certain amount of current, which by most building codes must be greater than or equal to the rating of the fuse/breaker protecting it.
Answer: Might want to see what the rating is, and check what you have connected. High current draw devices (like your microwave as you say above) can and will blow fuses/trip the breaker regularly. Try to put it on an alternate circuit if possible.
Answer: Every fuse has a number of important ratings:

The amount of current which a fuse is guaranteed to let flow indefinitely without any possibility of it blowing.
The amount of current which is guaranteed to cause the fuse to blow within a certain period of time.
The amount of current and voltage which the fuse is guaranteed to safely prevent from flowing once it blows (in some cases, the fuse's resistance once it blows will be sufficient to limit current to a safe limit provided its voltage rating is not exceeded; that is not always true, however, in the absence of external resistance).

If the amount of current that flows through a fuse is slightly more than the fuse can handle, the fusing material will slowly heat up to the point that it melts away, whereupon no more current will flow.  If, however, the current that flows through it is much higher, some of the metal fusing material may vaporize.  The metal vapor will itself be somewhat conductive, and the current flowing through that metal vapor may generate enough heat to vaporize more metal, increasing the current flow further.  Given time, the metal vapor would dissipate and the circuit would open.  The more current is driven through the fuse, however, the more heat will be generated before this occurs.  If enough heat is generated, the pressure of the gas inside the fuse may increase sufficiently to cause failure of the containing material, sending pieces of it flying.
If the resistance of the circuit in which the fuse is placed exceeds the resistance of the vaporized metal, then an increase in the concentration of vaporized metal in the fuse will temporarily increase the amount of power dissipated in places other than the fuse (which might not be a good thing) but decrease the amount of power dissipated within the fuse itself.  The fact that the fuse would be continuing to conduct might be a bad thing for the circuitry the fuse is supposed to be protecting, but reduction in power dissipation within the fuse would decrease the rate at which metal vaporized, reducing the likelihood of the fuse exploding.  On the other hand, if most of the effective resistance in the circuit is within the fuse itself, the decrease in resistance caused by the metal vapor will increase the power dissipation within the fuse, thus causing more metal to be vaporized and reducing the resistance further.
Answer: It depends on the type of fuse.
In all cases the fuse is to weak.
A "cut out" or "savety fuse" gets older of time and the wire gets weaker and weaker. It heats up and shrinks. So after a while the wire is to thin to stand the current.
A "automatic circuit breaker" has to parts an short term magnetic trigger and a long term thermal break. If the load is always on the limit the thermal break will break the circuit.
Thats what I guess in your case.
Sorry for my bad english.
Answer: As stated by @RussellMcMahon, the fuse, although extremely simple in construction, is very useful and can prevent a lot damage and a false positive is preferrable to a false negative. Beside the protection for the equipment you have in your house, it can also protect you from electric shock in the case of ungrounded devices.
The reason why a fuse blows can be really manifold. Here are just a few, off the top of the hat:

The fuse is designed for too small a current and does blow as it actually should at the given current.
You have a device in your household that introduces extra spikes that make the fuse give up. (Check for large consumers, e.g. air conditioning, washing mashine, very old fridge or boiler, power tools, etc. If the fuses blow when these are turned on, then they are very likely to be the culprits.)
Faulty wiring. This can be especially the case if your wiring is very old. In case it's older than 30 years, it might make sense to rip everything out of the walls and have the cables installed again.
Simply a faulty household appliance. Happened to me before. One of my lamps had the insulation gone off on a tiny section of the cable, right where it entered the lamp, under the gasket, so I couldn't see it. It produced a spectacular short which blew the fuse on that outlet and the fuse for the whole appartment...
Bad quality fuses... (not impossible)
Spike propagating to your fuse box from the outside (e.g. from neighbours... in such cases there isn't much you can do about it...)
Other <code>:)</code>

IMPORTANT: In any case DO NOT try to circumvent the fuse box! This can be extremely dangerous! I also discourage you from using fuses with larger current rating, unless you know for sure you have a load inside your house that draws that kind of current. Make sure the reason is not an undetected fault! If it happens frequently without any apparent reason and an electrician can't find anything, maybe you should replace the fuses with appropriately rated circuit breakers. Then all you have to do is flip a switch when the lights go out again.
Comment: Uhhh. Higher current rating fuses shouldn't be used unless the _wiring_ it protects can handle it. The load attached is irrelevant. If the load wants more current than the wiring can handle, putting in a larger fuse is just asking for trouble. The load should be put on wiring that can handle it.

Why does fuse blow up sometimes?


I pressed alt+f to change the camera view and I do not know how to revert to the original camera MOVEMENT

Question: My camera movement (the viewport camera) in blender has become strange after pressing alt+f (and possibly other keys). When I scroll in with my mouse, the camera moves toward the origin instead of where my viewport is 'pointing'. The camera also rotates around the object that feels different than the original setting. I've already tried moving the cursor to center and pressing (.) on numpad but this hasn't worked. How do I completely reset camera movement?
Answer: Just found the solution: Messed up zoom navigation, need help! (somehow I locked the view to the object which can be changed in the panel where you press N to hide and reveal it)


What are the most restrictive external firewall / DNS listening port settings I can have for my DNS server (internal clients only)

Question:
This question relates specifically to hardening the configuration of DNS, firewalls and at the limit, ntp. (not proxys, http access,vpn's or other services).
This is about the externally-facing side of the network.  DNS clients are locally connected inside on a separate interface card of the dns server.  I just want to remove my DNS server's clients or other internal stuff from the equation.
Trying to open the least amount of ports and restrict the open ports as much as possible anywhere in the stack (by tcp/udp, source/dest port....).
My biggest concern is that from my understanding, my DNS server queries to other DNS servers can be made with a source port between 1024 and 49152, but I do not want to open all those ports.
The firewall is using "masquerade" (NAT).
DNS is using dns-sec.
Security is the priority over a slower response time.
If you can provide an answer with the least amount of ports/protocols etc ... (including "obvious" ports), aka smallest attack surface that must be open for the DNS to communicate to other servers and why that is, that would be most helpful.
As FirewallD is a newer front end in the *nix world, any example that might use FirewallD (rather than straight iptables or pf) would be of additional value.
This is essentially a general question, but terms of my context, I have common standard applications: an RHEL-family linux server with bind DNS, Squid Proxy, and firewallD firewall, all in the same machine, facing the external internet.
I have looked around and see a number of specific questions that are dependent on specific software or fixing a problem.  This question relates more to approach and security than specific applications.
Thanks in advance for your time.
Comment: As per the sites question policy, I tried to be clear with my question.   The least amount of open ports, and those open, the most restricted for a general dns server setup.  This is a great opportunity for an answer that is useful for many people.  I can adapt a general answer to my specific gear.  I had to choose between posting here or in Network Infrastructure, but this forum seemed more appropriate.
Comment: The traditional solution is having a Internet DNS server and a separate internal one.
Answer: Using Bind it's possible to limit the set of source ports used for a query. DNSSec aside, restricting the source port too much makes it easier for fake replies to be injected.
If you want to lock down entirely, you could use an external proxy such as Google's 22.214.171.124 DNS servers on 220.127.116.11. Single (internal) source. Single destination for all queries. I can't advise on the DNSSec aspect for this, though.

The reference NTP implementation uses port 123 for source and destination, but not every implementation does so. Unless you control the upstream server you're not yet going to get a security pairing, so you need to be able to reach servers that are "sufficiently" trusted. Ideally three or five. Certainly not just two ("they're different, but which one's wrong"). It's very easy to find Stratum 3 servers. Not too hard to find Stratum 2s, and if you look it's possible to find public access Stratum 1s. (Or you could just run your own GPS based receiver. They're not excessively expensive these days.)


Calling a file with variable file name in bash script

Question: Let's say that I have a source file named A with a lot of strings of 1 and 2, and whose content is being regurlarly and automatically changed (new strings of 1 and 2 are added), and that I perform a grep on this file to extract '1' strings into another file called B.
grep '1' A > B

Now the next grep operations must not only grep A content into B, but also compare B and A in order to extract new strings (and only new strings) into another file. This must be done repetitively. For that I create a new file C which contains the '1' strings of the updated content of A, compare it with B and extract the difference into a new file named D:
grep '1' A > B
sleep 60
while true; do
grep '1' A > C
grep -v -F -x -f B C > D
sleep 60
done &

The problem is that it won't work properly as B is an old grep of A, so the next time it runs C will only be compared to this old B that is not being updated. Furthermore, D is being overwritten each time.
I need to be able to instruct the script to each time keep a copy of last B, so A is always compared to its previous version, and C always shows the difference between current A and previous, last B. I don't need to keep previous versions of C as I copy them elsewhere.
I figured that I had to use variable file names and I tried to add a $(date) variable in B and C filenames, but obviously it doesn't work as grep doesn't recognize them (as the date changes between each run of the script).
PS: I found a workaround by wiping the content of A between each run, so that only new content is taken into consideration, which eliminates the necessity of using variable names and the second grep operation. I would still like to learn how to call variable file names in bash scripts.
PS2: I am writing on my phone, so don't know how to properly encode the bash script.
Comment: The question is a bit convoluted for me to follow.  However, there is a command called "comm" which will give you lines in A but not in B (comm -23 A B) and you can grep on that output.
Answer: why not simply replace B ?
grep '1' A > B
sleep 60
while true; do
grep '1' A > C
grep -v -F -x -f B C > D
cat C >> B   ####
sleep 60
done &

this way D will only get last 60 sec of 1 in A.
Comment: @Paka - you should accept this answer


Are two numbers, $a$ and $b$, uniquely determined by their addition $a+b$ and product $a b$?

Question: I'm wondering whether for any two numbers, are their respective values uniquely determined by the output of their addition, and output of their product? For example if we knew $x = a+b$ and $y = a b$, would we always know $a$ and $b$? And if so, would this apply to more than two numbers?
Comment: Say $x=1$ and $y=-2$.  Then $a=2$ and $b=-1$ or $a=-1$ and $b=2$.
Answer: If $a+b=x$ and $ab=y$ then $a(x-a)=y$, which implies $a^2-xa+y=0$. This is a quadratic equation which has at most two complex solutions. They are given by $a_1=\frac{x+\sqrt{x^2-4y}}{2}$ and $a_2=\frac{x-\sqrt{x^2-4y}}{2}$. It doesn't matter which solution you will choose, you will get that the second solution equals to $b=x-a$. So yes, such $a$ and $b$ are unique up to switching between them.
Answer: You know them up to permutation. That is, you can know the set $ \{a,b \} $ but not who specifically $ a,b $ are.
Indeed, with your notations, $ a,b $ are the only roots of the polynomial $ X^2 -xX + y = (X-a)(X-b) $.
This generalizes to any finite list of numbers $ (x_1,..., x_n) $ :  you can know it up to permutation from the knowledge of $ \displaystyle \sum_{i_0<...<i_k} x_{i_0}...x_{i_k} $ for $ k $ varying from $ 0 $ to $ n-1 $ because these are the coefficients of the polynomial $ (X-x_1)...(X-x_n) $ whose roots are precisely this list, up to permutation.
Comment: What's nice about this approach is that by avoiding any explicit solving for $a,b$ we can be confident that there are no hidden singularities for special values of $a,b$, so this generalizes very cleanly.
Comment: @ErickWong : or special fields if we're interested in more general numbers. The accepted answer, for instance, doesn't deal wkth characteristic $ 2 $
Answer: You have two equations in two unknowns.  Because one is quadratic, you expect two solutions, which are accounted for by swapping $a$ and $b$.
With more than two variables, you have fewer equations than unknowns, so expect an infinite number of solutions, though some may be complex.  As a real example, note that $$1+4+11=16\\ 1\cdot 4 \cdot 11=44$$, then if we want one number to be $2$ we just solve the above with sum of $14$ and product of $42$, getting
$$2,7-\sqrt 7, 7+\sqrt 7$$
with the same sum and product
Answer: Here's an intuitive way to see this. The description is long, but simple once you visualize it.
First, let's change symbols to the convention that $x,y$ are variables and $a,b$ are constants:
$$\begin{align}
  x+y & =a \\
  xy & =b
\end{align}
$$
Solve for $y$, so we can graph them:
$$\begin{align}
  &y=-x+a\\  &y=b\frac{1}{x}
\end{align}
$$
The first equation is a line with gradient $-1$ (so it slopes diagonally right-down), with y-intercept at $a$, which could be positive or negative or zero.
The second equation is two curves, symmetrical over the diagonal line $y=x$, and also over the diagonal line $y=-x$. Perhaps it's easier to see in the original form $xy=b$: whatever values of $x,y$ make this equation true, swapping them is also makes it true.
If $b$ is positive, there's two curves, one in quadrant I (both $x,y$ are positive), and the other in quadrant III (both $x,y$ are negative). If $b$ is negative, the curves are in quadrants II and IV (only one of $x,y$ is negative). In all, $y$ is not defined at $x=0$.
Finally, the line and curves constrain $x,y$ to their intersection.
When $b$ is positive (curves in Quadrants I, III), the diagonal line might go between the curves, and there's no solution. Or, just touch one of the curves, and there's one solution. Or, it might intersect one of the curves twice. Because the curves are symmetrical over the diagonal line $y=x$, the intersections are the same values for $x,y$, but swapped.
If $b$ is negative (curves in Quadrants II, IV), the line always intersects both curves once. Because the curves are also symmetrical over the line $y=-x$, again the two intersections are the same values for $x,y$, just swapped.
The key thing about this proof is that there is a unique solution, just swapped. The swapping is secondary, but another way to see that swapping must give the same solution is that addition and multiplication are both commutative: $x+y=y+x$ and $xy=yx$.
PS: maybe I should have just drawn the graphs.


InDesign: how to change fonts for all text frames at once?

Question: After a restart InDesign says all my footnotes are now in Adobe Garamond T1 from the previous Adobe Garamond and that the four fonts (regular, italic, bold and bold italic) are missing. Is there a way to change the font for all the footnotes instead of one by one, or to add the T1 font (I'm not finding it for download) ?
Answer: So a system restart and suddenly the fonts are missing? You might have a corrupt font file if the font was working before the restart.
And Yes, you can change the fonts in 1 step:

With the document open, Choose Type > Find Font from the menu

That will allow you to select a font in the top of the window (missing fonts will have an asterisks and be at the top of the list), and then use the drop down menus below to select a replacement font. It should be fairly self-explanatory once the dialog window pops up.
Comment: It's stranger than that. Before the restart the font was Garamond (simple) and became Garamond T1.
I tried replace, then done, but after reopening the document it still said missing fonts.
Comment: Sounds like you've got some corruption someplace.. hard drive, ram, document... You might think about doing some general Operating System maintenance.
Comment: Re. you solution that was it. I had to do `change all` for each font so the change could take effect. Thx for the advice.